diff --git a/QGCApplication.pro b/QGCApplication.pro index 8198081cfdc1e3a7012c66c9dda3b087c059b031..8a60935341eb0425c056b4fda4dc86f55133f4a8 100644 --- a/QGCApplication.pro +++ b/QGCApplication.pro @@ -21,7 +21,12 @@ include(QGCCommon.pri) TARGET = qgroundcontrol TEMPLATE = app -DESTDIR = $${OUT_PWD}/build + +DebugBuild { + DESTDIR = $${OUT_PWD}/debug +} else { + DESTDIR = $${OUT_PWD}/release +} # Load additional config flags from user_config.pri exists(user_config.pri):infile(user_config.pri, CONFIG) { @@ -35,7 +40,7 @@ LinuxBuild { # QGC QtLocation plugin (for ios, it's all compiled in with the rest.) -!ios { +!iOSBuild { LIBS += -L$${LOCATION_PLUGIN_DESTDIR} LIBS += -l$${LOCATION_PLUGIN_NAME} } @@ -78,18 +83,25 @@ QT += testlib # MacBuild { - QMAKE_INFO_PLIST = Custom-Info.plist - ICON = $${BASEDIR}/resources/icons/macx.icns - OTHER_FILES += Custom-Info.plist + QMAKE_INFO_PLIST = Custom-Info.plist + ICON = $${BASEDIR}/resources/icons/macx.icns + OTHER_FILES += Custom-Info.plist } iOSBuild { - QMAKE_INFO_PLIST = $${BASEDIR}/ios/iOS-Info.plist - OTHER_FILES += $${BASEDIR}/ios/iOS-Info.plist - BUNDLE.files = $$files($$PWD/ios/AppIcon*.png) $$PWD/ios/LaunchScreen.xib + BUNDLE.files = $$files($$PWD/ios/AppIcon*.png) $$PWD/ios/QGCLaunchScreen.xib QMAKE_BUNDLE_DATA += BUNDLE LIBS += -framework AVFoundation OBJECTIVE_SOURCES += src/audio/QGCAudioWorker_iOS.mm + #-- Info.plist (need an "official" one for the App Store) + ForAppStore { + message(App Store Build) + QMAKE_INFO_PLIST = $${BASEDIR}/ios/iOSForAppStore-Info.plist + OTHER_FILES += $${BASEDIR}/ios/iOSForAppStore-Info.plist + } else { + QMAKE_INFO_PLIST = $${BASEDIR}/ios/iOS-Info.plist + OTHER_FILES += $${BASEDIR}/ios/iOS-Info.plist + } #-- TODO: Add iTunesArtwork } @@ -662,6 +674,14 @@ AndroidBuild { $$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java \ $$PWD/android/src/org/qgroundcontrol/qgchelper/UsbDeviceJNI.java \ $$PWD/android/src/org/qgroundcontrol/qgchelper/UsbIoManager.java + + DISTFILES += \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradlew \ + android/res/values/libs.xml \ + android/build.gradle \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew.bat } #------------------------------------------------------------------------------------- @@ -676,11 +696,3 @@ include(QGCSetup.pri) # include(QGCInstaller.pri) - -DISTFILES += \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradlew \ - android/res/values/libs.xml \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew.bat diff --git a/QGCCommon.pri b/QGCCommon.pri index 809dd9672cc1e90eb248d1fb4fc6466c9d8492ad..ef571bdfad2efbcba853cd72ed9bb68b6908714d 100644 --- a/QGCCommon.pri +++ b/QGCCommon.pri @@ -122,7 +122,7 @@ win32:debug_and_release { BASEDIR = $$IN_PWD -!ios { +!iOSBuild { OBJECTS_DIR = $${OUT_PWD}/obj MOC_DIR = $${OUT_PWD}/moc UI_DIR = $${OUT_PWD}/ui diff --git a/QGCInstaller.pri b/QGCInstaller.pri index 553916cc107484c3068ecac005383947dba53a53..84f36d83a14e8e39cf35394fa10d886c01de61ef 100644 --- a/QGCInstaller.pri +++ b/QGCInstaller.pri @@ -23,39 +23,41 @@ installer { VideoEnabled { # Install the gstreamer framework # This will: - # Copy from the original distibution into libs/lib/Framworks (if not already there) + # Copy from the original distibution into DESTDIR/gstwork (if not already there) # Prune the framework, removing stuff we don't need # Relocate all dylibs so they can work under @executable_path/... # Copy the result into the app bundle # Make sure qgroundcontrol can find them message("Preparing GStreamer Framework") - QMAKE_POST_LINK += && $$BASEDIR/tools/prepare_gstreamer_framework.sh $$BASEDIR/libs/lib/Frameworks/ $$DESTDIR/$${TARGET}.app $${TARGET} + QMAKE_POST_LINK += && $$BASEDIR/tools/prepare_gstreamer_framework.sh $${OUT_PWD}/gstwork/ $${DESTDIR}/$${TARGET}.app $${TARGET} } else { message("Skipping GStreamer Framework") } # We cd to release directory so we can run macdeployqt without a path to the # qgroundcontrol.app file. If you specify a path to the .app file the symbolic # links to plugins will not be created correctly. - QMAKE_POST_LINK += && cd release && mkdir package - QMAKE_POST_LINK += && $$dirname(QMAKE_QMAKE)/macdeployqt qgroundcontrol.app -verbose=2 -qmldir=../src - QMAKE_POST_LINK += && cd .. + QMAKE_POST_LINK += && cd $${DESTDIR} && mkdir package + QMAKE_POST_LINK += && $$dirname(QMAKE_QMAKE)/macdeployqt qgroundcontrol.app -verbose=2 -qmldir=$${BASEDIR}/src + QMAKE_POST_LINK += && cd $${OUT_PWD} QMAKE_POST_LINK += && hdiutil create -layout SPUD -srcfolder $${DESTDIR}/qgroundcontrol.app -volname QGroundControl $${DESTDIR}/package/qgroundcontrol.dmg } WindowsBuild { - # The pdb moving command are commented out for now since we are including the .pdb in the installer. This makes it much - # easier to debug user crashes. - #QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY $${DESTDIR_WIN}\\qgroundcontrol.pdb - #QMAKE_POST_LINK += $$escape_expand(\\n) del $${DESTDIR_WIN}\\qgroundcontrol.pdb + # The pdb moving command are commented out for now since we are including the .pdb in the installer. This makes it much + # easier to debug user crashes. + #QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY $${DESTDIR_WIN}\\qgroundcontrol.pdb + #QMAKE_POST_LINK += $$escape_expand(\\n) del $${DESTDIR_WIN}\\qgroundcontrol.pdb QMAKE_POST_LINK += $$escape_expand(\\n) $$quote("\"C:\\Program Files \(x86\)\\NSIS\\makensis.exe\"" /NOCD "\"/XOutFile $${DESTDIR_WIN}\\qgroundcontrol-installer.exe\"" "$$BASEDIR_WIN\\deploy\\qgroundcontrol_installer.nsi") - #QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY qgroundcontrol.pdb $${DESTDIR_WIN} - #QMAKE_POST_LINK += $$escape_expand(\\n) del qgroundcontrol.pdb + #QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY qgroundcontrol.pdb $${DESTDIR_WIN} + #QMAKE_POST_LINK += $$escape_expand(\\n) del qgroundcontrol.pdb OTHER_FILES += deploy/qgroundcontrol_installer.nsi } LinuxBuild { + #-- TODO: This uses hardcoded paths. It should use $${DESTDIR} QMAKE_POST_LINK += && mkdir -p release/package - QMAKE_POST_LINK += && tar -cjf release/package/qgroundcontrol.tar.bz2 release --exclude='package' --transform 's/release/qgroundcontrol/' + QMAKE_POST_LINK += && tar -cjf release/package/qgroundcontrol.tar.bz2 release --exclude='package' --transform 's/release/qgroundcontrol/' } AndroidBuild { + #-- TODO: This uses hardcoded paths. It should use $${DESTDIR} QMAKE_POST_LINK += && mkdir -p release/package QMAKE_POST_LINK += && make install INSTALL_ROOT=release/android-build/ QMAKE_POST_LINK += && androiddeployqt --input android-libqgroundcontrol.so-deployment-settings.json --output release/android-build --deployment bundled --gradle --sign android/android_release.keystore dagar --storepass $$(ANDROID_STOREPASS) diff --git a/QGCSetup.pri b/QGCSetup.pri index edc6288690dbcf10da0bc89f1c3ddca05747280f..02020d452e9fdf610df4ee325df23e740bc2008b 100644 --- a/QGCSetup.pri +++ b/QGCSetup.pri @@ -51,106 +51,10 @@ WindowsBuild { # MacBuild { - - # Copy non-standard libraries and frameworks into app package - QMAKE_POST_LINK += && $$QMAKE_COPY_DIR $$BASEDIR/libs/lib/mac64/lib $$DESTDIR/$${TARGET}.app/Contents/libs + # Copy non-standard frameworks into app package QMAKE_POST_LINK += && rsync -a --delete $$BASEDIR/libs/lib/Frameworks $$DESTDIR/$${TARGET}.app/Contents/ - - # Fix library paths inside executable - - INSTALL_NAME_TARGET = $$DESTDIR/$${TARGET}.app/Contents/MacOS/$${TARGET} - INSTALL_NAME_LIB_LIST = \ - libOpenThreads.dylib \ - libosg.dylib \ - libosgViewer.dylib \ - libosgGA.dylib \ - libosgDB.dylib \ - libosgText.dylib \ - libosgWidget.dylib - for(INSTALL_NAME_LIB, INSTALL_NAME_LIB_LIST) { - QMAKE_POST_LINK += && install_name_tool -change $$INSTALL_NAME_LIB "@executable_path/../libs/$${INSTALL_NAME_LIB}" $$INSTALL_NAME_TARGET - } - - # Fix library paths within libraries (inter-library dependencies) - - # OSG GA LIBRARY - INSTALL_NAME_TARGET = $$DESTDIR/$${TARGET}.app/Contents/libs/libosgGA.dylib - INSTALL_NAME_LIB_LIST = \ - libOpenThreads.dylib \ - libosg.dylib \ - libosgGA.dylib \ - libosgDB.dylib \ - libosgUtil.dylib - for(INSTALL_NAME_LIB, INSTALL_NAME_LIB_LIST) { - QMAKE_POST_LINK += && install_name_tool -change $$INSTALL_NAME_LIB "@executable_path/../libs/$${INSTALL_NAME_LIB}" $$INSTALL_NAME_TARGET - } - - # OSG DB LIBRARY - INSTALL_NAME_TARGET = $$DESTDIR/$${TARGET}.app/Contents/libs/libosgDB.dylib - INSTALL_NAME_LIB_LIST = \ - libOpenThreads.dylib \ - libosg.dylib \ - libosgDB.dylib \ - libosgUtil.dylib - for(INSTALL_NAME_LIB, INSTALL_NAME_LIB_LIST) { - QMAKE_POST_LINK += && install_name_tool -change $$INSTALL_NAME_LIB "@executable_path/../libs/$${INSTALL_NAME_LIB}" $$INSTALL_NAME_TARGET - } - - # OSG TEXT LIBRARY - INSTALL_NAME_TARGET = $$DESTDIR/$${TARGET}.app/Contents/libs/libosgText.dylib - INSTALL_NAME_LIB_LIST = \ - libOpenThreads.dylib \ - libosg.dylib \ - libosgDB.dylib \ - libosgUtil.dylib \ - libosgText.dylib - for(INSTALL_NAME_LIB, INSTALL_NAME_LIB_LIST) { - QMAKE_POST_LINK += && install_name_tool -change $$INSTALL_NAME_LIB "@executable_path/../libs/$${INSTALL_NAME_LIB}" $$INSTALL_NAME_TARGET - } - - # OSG UTIL LIBRARY - INSTALL_NAME_TARGET = $$DESTDIR/$${TARGET}.app/Contents/libs/libosgUtil.dylib - INSTALL_NAME_LIB_LIST = \ - libOpenThreads.dylib \ - libosg.dylib - for(INSTALL_NAME_LIB, INSTALL_NAME_LIB_LIST) { - QMAKE_POST_LINK += && install_name_tool -change $$INSTALL_NAME_LIB "@executable_path/../libs/$${INSTALL_NAME_LIB}" $$INSTALL_NAME_TARGET - } - - - # OSG VIEWER LIBRARY - INSTALL_NAME_TARGET = $$DESTDIR/$${TARGET}.app/Contents/libs/libosgViewer.dylib - INSTALL_NAME_LIB_LIST = \ - libOpenThreads.dylib \ - libosg.dylib \ - libosgGA.dylib \ - libosgDB.dylib \ - libosgUtil.dylib \ - libosgText.dylib - for(INSTALL_NAME_LIB, INSTALL_NAME_LIB_LIST) { - QMAKE_POST_LINK += && install_name_tool -change $$INSTALL_NAME_LIB "@executable_path/../libs/$${INSTALL_NAME_LIB}" $$INSTALL_NAME_TARGET - } - - # OSG WIDGET LIBRARY - INSTALL_NAME_TARGET = $$DESTDIR/$${TARGET}.app/Contents/libs/libosgWidget.dylib - INSTALL_NAME_LIB_LIST = \ - libOpenThreads.dylib \ - libosg.dylib \ - libosgGA.dylib \ - libosgDB.dylib \ - libosgUtil.dylib \ - libosgText.dylib \ - libosgViewer.dylib - for(INSTALL_NAME_LIB, INSTALL_NAME_LIB_LIST) { - QMAKE_POST_LINK += && install_name_tool -change $$INSTALL_NAME_LIB "@executable_path/../libs/$${INSTALL_NAME_LIB}" $$INSTALL_NAME_TARGET - } - - # CORE OSG LIBRARY - QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$DESTDIR/$${TARGET}.app/Contents/libs/libosg.dylib - # SDL Framework QMAKE_POST_LINK += && install_name_tool -change "@rpath/SDL.framework/Versions/A/SDL" "@executable_path/../Frameworks/SDL.framework/Versions/A/SDL" $$DESTDIR/$${TARGET}.app/Contents/MacOS/$${TARGET} - } WindowsBuild { @@ -165,29 +69,29 @@ WindowsBuild { $$BASEDIR\\libs\\thirdParty\\libxbee\\lib\\libxbee.dll for(COPY_FILE, COPY_FILE_LIST) { - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"$$COPY_FILE\" \"$$DESTDIR_WIN\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"$$COPY_FILE\" \"$$DESTDIR_WIN\" } ReleaseBuild { - # Copy Visual Studio DLLs - # Note that this is only done for release because the debugging versions of these DLLs cannot be redistributed. - win32-msvc2010 { - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp100.dll\" \"$$DESTDIR_WIN\" - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr100.dll\" \"$$DESTDIR_WIN\" - } - else:win32-msvc2012 { - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp110.dll\" \"$$DESTDIR_WIN\" - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr110.dll\" \"$$DESTDIR_WIN\" - } - else:win32-msvc2013 { - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp120.dll\" \"$$DESTDIR_WIN\" - QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr120.dll\" \"$$DESTDIR_WIN\" - } - else { - error("Visual studio version not supported, installation cannot be completed.") - } - } + # Copy Visual Studio DLLs + # Note that this is only done for release because the debugging versions of these DLLs cannot be redistributed. + win32-msvc2010 { + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp100.dll\" \"$$DESTDIR_WIN\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr100.dll\" \"$$DESTDIR_WIN\" + } + else:win32-msvc2012 { + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp110.dll\" \"$$DESTDIR_WIN\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr110.dll\" \"$$DESTDIR_WIN\" + } + else:win32-msvc2013 { + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp120.dll\" \"$$DESTDIR_WIN\" + QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr120.dll\" \"$$DESTDIR_WIN\" + } + else { + error("Visual studio version not supported, installation cannot be completed.") + } + } DEPLOY_TARGET = $$shell_quote($$shell_path($$DESTDIR_WIN\\$${TARGET}.exe)) QMAKE_POST_LINK += $$escape_expand(\\n) windeployqt --no-compiler-runtime --qmldir=$${BASEDIR_WIN}\\src $${DEPLOY_TARGET} diff --git a/android_environment.sh b/android_environment.sh index 477c0dbd1b3d3e3be5afd084fd7e7e47f65a8405..04abee5d505eb0cd56e001ec42982cfdc4766b91 100644 --- a/android_environment.sh +++ b/android_environment.sh @@ -1,7 +1,7 @@ #!/bin/bash #---------------------------------------------------------- # You will need: -# - Qt 5.4 android_armv7 kit +# - Qt 5.5.x android_armv7 kit # - Android SDK # - Androig NDK # - Current Java @@ -10,7 +10,7 @@ # Update with correct location for these export ANDROID_HOME=~/Library/Android/sdk export ANDROID_SDK_ROOT=~/Library/Android/sdk -export ANDROID_NDK_ROOT=~/Library/Android/ndk +export ANDROID_NDK_ROOT=~/Library/Android/sdk/ndk-bundle export ANDROID_NDK_HOST=darwin-x86_64 export ANDROID_NDK_PLATFORM=/android-9 export ANDROID_NDK_TOOLCHAIN_PREFIX=arm-linux-androideabi @@ -19,19 +19,11 @@ export ANDROID_NDK_TOOLS_PREFIX=arm-linux-androideabi #---------------------------------------------------------- # To build it, run (replacing the path with where you have Qt installed) # -# For a shadow build: (strongly recomended) -# # >source android_environment.sh # cd ../ # mkdir android_build # cd android_build # >~/local/Qt/5.4/android_armv7/bin/qmake -r -spec android-g++ CONFIG+=debug ../qgroundcontrol/qgroundcontrol.pro -# >make -j24 -# >~/local/Qt/5.4/android_armv7/bin/androiddeployqt --input ./android-libqgroundcontrol.so-deployment-settings.json --output ./android-build --deployment bundled --android-platform android-22 --jdk /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home --verbose --ant /opt/local/bin/ant -# -# For an in place build (not recomended) +# >make -j24 install INSTALL_ROOT=./android-build/ +# >~/local/Qt/5.4/android_armv7/bin/androiddeployqt --input ./android-libqgroundcontrol.so-deployment-settings.json --output ./android-build --deployment bundled --android-platform android-22 --jdk /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home --verbose --ant /usr/local/bin/ant # -# >source android_environment.sh -# >~/local/Qt/5.4/android_armv7/bin/qmake -r -spec android-g++ CONFIG+=debug qgroundcontrol.pro -# >make -j24 -# >~/local/Qt/5.4/android_armv7/bin/androiddeployqt --input ./android-libqgroundcontrol.so-deployment-settings.json --output ./android-build --deployment bundled --android-platform android-22 --jdk /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home --verbose --ant /opt/local/bin/ant diff --git a/ios/LaunchScreen.xib b/ios/QGCLaunchScreen.xib similarity index 100% rename from ios/LaunchScreen.xib rename to ios/QGCLaunchScreen.xib diff --git a/ios/iOS-Info.plist b/ios/iOS-Info.plist index 884b7b5b5f26a4984d8b5fec939a371cd87fce14..cef6abd540b20c6f0c7d9408a8bcd9833c82e148 100644 --- a/ios/iOS-Info.plist +++ b/ios/iOS-Info.plist @@ -11,7 +11,7 @@ CFBundleIconFile CFBundleIdentifier - com.grubba.qgroundcontrol + org.mavlink.qgroundcontrol CFBundleName QGroundControl CFBundlePackageType @@ -27,13 +27,13 @@ NOTE This file was generated by Qt/QMake. UILaunchStoryboardName - LaunchScreen.xib + QGCLaunchScreen UIRequiresFullScreen CFBundleInfoDictionaryVersion 6.0 ForAppStore - Yes + No UISupportedInterfaceOrientations UIInterfaceOrientationLandscapeLeft diff --git a/ios/iOSForAppStore-Info.plist b/ios/iOSForAppStore-Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..f7da584756cdc10f33111b24736257077139ff77 --- /dev/null +++ b/ios/iOSForAppStore-Info.plist @@ -0,0 +1,83 @@ + + + + + CFBundleDisplayName + QGroundControl + CFBundleExecutable + qgroundcontrol + CFBundleGetInfoString + Created by Qt/QMake + CFBundleIconFile + + CFBundleIdentifier + com.grubba.qgroundcontrol + CFBundleName + QGroundControl + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NOTE + This file was generated by Qt/QMake. + UILaunchStoryboardName + QGCLaunchScreen + UIRequiresFullScreen + + CFBundleInfoDictionaryVersion + 6.0 + ForAppStore + Yes + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CFBundleIcons + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AppIcon29x29.png + AppIcon29x29@2x.png + AppIcon40x40@2x.png + AppIcon57x57.png + AppIcon57x57@2x.png + AppIcon60x60@2x.png + + + + CFBundleIcons~ipad + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AppIcon29x29.png + AppIcon29x29@2x.png + AppIcon40x40@2x.png + AppIcon57x57.png + AppIcon57x57@2x.png + AppIcon60x60@2x.png + AppIcon29x29~ipad.png + AppIcon29x29@2x~ipad.png + AppIcon40x40~ipad.png + AppIcon40x40@2x~ipad.png + AppIcon50x50~ipad.png + AppIcon50x50@2x~ipad.png + AppIcon72x72~ipad.png + AppIcon72x72@2x~ipad.png + AppIcon76x76~ipad.png + AppIcon76x76@2x~ipad.png + + + + + diff --git a/libs/lib/lib.pro b/libs/lib/lib.pro deleted file mode 100644 index a60585f0297a7b585f351517d1c6fe6920960388..0000000000000000000000000000000000000000 --- a/libs/lib/lib.pro +++ /dev/null @@ -1 +0,0 @@ -TEMPLATE = subdirs \ No newline at end of file diff --git a/libs/lib/mac32/frameworks/.gitignore b/libs/lib/mac32/frameworks/.gitignore deleted file mode 100644 index 39aa8067655ced203e5e936db165559cad9040d8..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/frameworks/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.framework -osgPlugins* diff --git a/libs/lib/mac32/frameworks/README b/libs/lib/mac32/frameworks/README deleted file mode 100644 index 2436e3d15e557bb60a2adcecf99663c59df5963b..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/frameworks/README +++ /dev/null @@ -1,3 +0,0 @@ -For instructions how to download or build the frameworks necessary to get OSG / osgEarth support, please refer to the QGroundControl wiki: - -http://qgroundcontrol.org/dev/open_scene_graph diff --git a/libs/lib/mac32/include/OpenThreads/Atomic b/libs/lib/mac32/include/OpenThreads/Atomic deleted file mode 100644 index 8b8ac4de304836fd40419100fd20a3710d49f0b1..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Atomic +++ /dev/null @@ -1,287 +0,0 @@ -/* -*-c++-*- OpenThreads library, Copyright (C) 2008 The Open Thread Group - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef _OPENTHREADS_ATOMIC_ -#define _OPENTHREADS_ATOMIC_ - -#include -#include - -#if defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC) -# include -# define _OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES -#elif defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) && defined(__i386__) -# define _OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES -#elif defined(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED) -# define _OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) -# include -# include "Mutex" -# include "ScopedLock" -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) -# include "Mutex" -# include "ScopedLock" -#endif - -#if defined(_OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES) -#define _OPENTHREADS_ATOMIC_INLINE -#else -#define _OPENTHREADS_ATOMIC_INLINE inline -#endif - -namespace OpenThreads { - -/** - * @class Atomic - * @brief This class provides an atomic increment and decrement operation. - */ -class OPENTHREAD_EXPORT_DIRECTIVE Atomic { - public: - Atomic(unsigned value = 0) : _value(value) - { } - _OPENTHREADS_ATOMIC_INLINE unsigned operator++(); - _OPENTHREADS_ATOMIC_INLINE unsigned operator--(); - _OPENTHREADS_ATOMIC_INLINE unsigned AND(unsigned value); - _OPENTHREADS_ATOMIC_INLINE unsigned OR(unsigned value); - _OPENTHREADS_ATOMIC_INLINE unsigned XOR(unsigned value); - _OPENTHREADS_ATOMIC_INLINE unsigned exchange(unsigned value = 0); - _OPENTHREADS_ATOMIC_INLINE operator unsigned() const; - private: - - Atomic(const Atomic&); - Atomic& operator=(const Atomic&); - -#if defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - mutable Mutex _mutex; -#endif -#if defined(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED) - volatile long _value; -#elif defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC) - volatile int32_t _value; -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - volatile uint_t _value; - mutable Mutex _mutex; // needed for xor -#else - volatile unsigned _value; -#endif -}; - -/** - * @class AtomicPtr - * @brief This class provides an atomic pointer assignment using cas operations. - */ -class OPENTHREAD_EXPORT_DIRECTIVE AtomicPtr { -public: - AtomicPtr(void* ptr = 0) : _ptr(ptr) - { } - ~AtomicPtr() - { _ptr = 0; } - - // assigns a new pointer - _OPENTHREADS_ATOMIC_INLINE bool assign(void* ptrNew, const void* const ptrOld); - _OPENTHREADS_ATOMIC_INLINE void* get() const; - -private: - AtomicPtr(const AtomicPtr&); - AtomicPtr& operator=(const AtomicPtr&); - -#if defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - mutable Mutex _mutex; -#endif - void* volatile _ptr; -}; - -#if !defined(_OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES) - -_OPENTHREADS_ATOMIC_INLINE unsigned -Atomic::operator++() -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - return __sync_add_and_fetch(&_value, 1); -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - return __add_and_fetch(&_value, 1); -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - return atomic_inc_uint_nv(&_value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - return ++_value; -#else - return ++_value; -#endif -} - -_OPENTHREADS_ATOMIC_INLINE unsigned -Atomic::operator--() -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - return __sync_sub_and_fetch(&_value, 1); -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - return __sub_and_fetch(&_value, 1); -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - return atomic_dec_uint_nv(&_value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - return --_value; -#else - return --_value; -#endif -} - -_OPENTHREADS_ATOMIC_INLINE unsigned -Atomic::AND(unsigned value) -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - return __sync_fetch_and_and(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - return __and_and_fetch(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - return atomic_and_uint_nv(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - _value &= value; - return _value; -#else - _value &= value; - return _value; -#endif -} - -_OPENTHREADS_ATOMIC_INLINE unsigned -Atomic::OR(unsigned value) -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - return __sync_fetch_and_or(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - return __or_and_fetch(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - return atomic_or_uint_nv(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - _value |= value; - return _value; -#else - _value |= value; - return _value; -#endif -} - -_OPENTHREADS_ATOMIC_INLINE unsigned -Atomic::XOR(unsigned value) -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - return __sync_fetch_and_xor(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - return __xor_and_fetch(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - ScopedLock lock(_mutex); - _value ^= value; - return _value; -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - _value ^= value; - return _value; -#else - _value ^= value; - return _value; -#endif -} - -_OPENTHREADS_ATOMIC_INLINE unsigned -Atomic::exchange(unsigned value) -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - return __sync_lock_test_and_set(&_value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - return __compare_and_swap(&_value, _value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - return atomic_cas_uint(&_value, _value, value); -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - unsigned oldval = _value; - _value = value; - return oldval; -#else - unsigned oldval = _value; - _value = value; - return oldval; -#endif -} - -_OPENTHREADS_ATOMIC_INLINE -Atomic::operator unsigned() const -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - __sync_synchronize(); - return _value; -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - __synchronize(); - return _value; -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - membar_consumer(); // Hmm, do we need??? - return _value; -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - return _value; -#else - return _value; -#endif -} - -_OPENTHREADS_ATOMIC_INLINE bool -AtomicPtr::assign(void* ptrNew, const void* const ptrOld) -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew); -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - return __compare_and_swap((unsigned long*)&_ptr, (unsigned long)ptrOld, (unsigned long)ptrNew); -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - return ptrOld == atomic_cas_ptr(&_ptr, const_cast(ptrOld), ptrNew); -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - if (_ptr != ptrOld) - return false; - _ptr = ptrNew; - return true; -#else - if (_ptr != ptrOld) - return false; - _ptr = ptrNew; - return true; -#endif -} - -_OPENTHREADS_ATOMIC_INLINE void* -AtomicPtr::get() const -{ -#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) - __sync_synchronize(); - return _ptr; -#elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) - __synchronize(); - return _ptr; -#elif defined(_OPENTHREADS_ATOMIC_USE_SUN) - membar_consumer(); // Hmm, do we need??? - return _ptr; -#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX) - ScopedLock lock(_mutex); - return _ptr; -#else - return _ptr; -#endif -} - -#endif // !defined(_OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES) - -} - -#endif // _OPENTHREADS_ATOMIC_ diff --git a/libs/lib/mac32/include/OpenThreads/Barrier b/libs/lib/mac32/include/OpenThreads/Barrier deleted file mode 100644 index 663d198f12fa93d3cc1eb644a756b81d6fef8283..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Barrier +++ /dev/null @@ -1,100 +0,0 @@ -/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - - -// -// Barrier - C++ barrier class -// ~~~~~~~ -// - -#ifndef _OPENTHREADS_BARRIER_ -#define _OPENTHREADS_BARRIER_ - -#include - -namespace OpenThreads { - - -/** - * @class Barrier - * @brief This class provides an object-oriented thread barrier interface - * - * @warning It is unwise to use the construct "Barrier barrier" in the - * global namespace on sgi's. The object "barrier" - * will confilict with the c-library sproc function "barrier" and - * unpredictable results may occur. You have been warned. - */ -class OPENTHREAD_EXPORT_DIRECTIVE Barrier { - -public: - - /** - * Constructor - */ - Barrier(int numThreads=0); - - /** - * Destructor - */ - virtual ~Barrier(); - - /** - * Reset the barrier to it's original state. - */ - virtual void reset(); - - /** - * Block until numThreads threads have entered the barrier. - */ - virtual void block(unsigned int numThreads=0); - - /** - * Release the barrier, now. - */ - virtual void release(); - - /** - * Return the number of threads currently blocked in the barrier, - * Return -1 if error. - */ - virtual int numThreadsCurrentlyBlocked(); - - - void invalidate(); - -private: - - /** - * Private copy constructor, to prevent tampering. - */ - Barrier(const Barrier &/*b*/) {}; - - /** - * Private copy assignment, to prevent tampering. - */ - Barrier &operator=(const Barrier &/*b*/) {return *(this);}; - - /** - * Implementation-specific private data. - */ - void *_prvData; - - - bool _valid; - -}; - -} - -#endif // !_OPENTHREADS_BARRIER_ - diff --git a/libs/lib/mac32/include/OpenThreads/Block b/libs/lib/mac32/include/OpenThreads/Block deleted file mode 100644 index 0b821e4ed126c5fd59ef5c5da58002d80ac8ea95..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Block +++ /dev/null @@ -1,177 +0,0 @@ -/* -*-c++-*- OpenThreads - Copyright (C) 1998-2007 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef _OPENTHREADS_BLOCK_ -#define _OPENTHREADS_BLOCK_ - -#include -#include -#include -#include - -namespace OpenThreads { - -/** Block is a block that can be used to halt a thread that is waiting another thread to release it.*/ -class Block -{ - public: - - Block(): - _released(false) {} - - ~Block() - { - release(); - } - - inline bool block() - { - ScopedLock mutlock(_mut); - if( !_released ) - { - return _cond.wait(&_mut)==0; - } - else - { - return true; - } - } - - inline bool block(unsigned long timeout) - { - ScopedLock mutlock(_mut); - if( !_released ) - { - return _cond.wait(&_mut, timeout)==0; - } - else - { - return true; - } - } - - inline void release() - { - ScopedLock mutlock(_mut); - if (!_released) - { - _released = true; - _cond.broadcast(); - } - } - - inline void reset() - { - ScopedLock mutlock(_mut); - _released = false; - } - - inline void set(bool doRelease) - { - if (doRelease!=_released) - { - if (doRelease) release(); - else reset(); - } - } - - protected: - - Mutex _mut; - Condition _cond; - bool _released; - - private: - - Block(const Block&) {} -}; - -/** BlockCount is a block that can be used to halt a thread that is waiting for a specified number of operations to be completed.*/ -class BlockCount -{ - public: - - BlockCount(unsigned int blockCount): - _blockCount(blockCount), - _currentCount(0) {} - - ~BlockCount() - { - _blockCount = 0; - release(); - } - - inline void completed() - { - OpenThreads::ScopedLock mutlock(_mut); - if (_currentCount>0) - { - --_currentCount; - - if (_currentCount==0) - { - // osg::notify(osg::NOTICE)<<"Released"< mutlock(_mut); - if (_currentCount) - _cond.wait(&_mut); - } - - inline void reset() - { - OpenThreads::ScopedLock mutlock(_mut); - if (_currentCount!=_blockCount) - { - if (_blockCount==0) _cond.broadcast(); - _currentCount = _blockCount; - } - } - - inline void release() - { - OpenThreads::ScopedLock mutlock(_mut); - if (_currentCount) - { - _currentCount = 0; - _cond.broadcast(); - } - } - - inline void setBlockCount(unsigned int blockCount) { _blockCount = blockCount; } - - inline unsigned int getBlockCount() const { return _blockCount; } - - inline unsigned int getCurrentCount() const { return _currentCount; } - - protected: - - OpenThreads::Mutex _mut; - OpenThreads::Condition _cond; - unsigned int _blockCount; - unsigned int _currentCount; - - private: - - BlockCount(const BlockCount&) {} - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/OpenThreads/Condition b/libs/lib/mac32/include/OpenThreads/Condition deleted file mode 100644 index 454c079d3d7569d00ce352e9bd11a6d0b4048a33..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Condition +++ /dev/null @@ -1,93 +0,0 @@ -/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - - -// -// Condition - C++ condition class -// ~~~~~~~~~ -// - -#ifndef _OPENTHREADS_CONDITION_ -#define _OPENTHREADS_CONDITION_ - -#include -#include - -namespace OpenThreads { - -/** - * @class Condition - * @brief This class provides an object-oriented thread condition interface. - */ -class OPENTHREAD_EXPORT_DIRECTIVE Condition { - -public: - - /** - * Constructor - */ - Condition(); - - /** - * Destructor - */ - virtual ~Condition(); - - /** - * Wait on a mutex. - */ - virtual int wait(Mutex *mutex); - - /** - * Wait on a mutex for a given amount of time (ms) - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - virtual int wait(Mutex *mutex, unsigned long int ms); - - /** - * Signal a SINGLE thread to wake if it's waiting. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - virtual int signal(); - - /** - * Wake all threads waiting on this condition. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - virtual int broadcast(); - -private: - - /** - * Private copy constructor, to prevent tampering. - */ - Condition(const Condition &/*c*/) {}; - - /** - * Private copy assignment, to prevent tampering. - */ - Condition &operator=(const Condition &/*c*/) {return *(this);}; - - /** - * Implementation-specific data - */ - void *_prvData; - -}; - -} - -#endif // !_OPENTHREADS_CONDITION_ diff --git a/libs/lib/mac32/include/OpenThreads/Config b/libs/lib/mac32/include/OpenThreads/Config deleted file mode 100644 index 1e6a686796a0063a03a674e5bc32efb00fccee85..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Config +++ /dev/null @@ -1,34 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -/**************************************************************************** - * THIS FILE IS AUTOGENERATED BY CMAKE. DO NOT EDIT! - ****************************************************************************/ - -/* Changes to the configuration reflected here can be made with ccmake on - * unix or with cmake-gui on windows. Alternatively you can use cmake's -D - * or -P switches to set some configuration values at cmake configuration time. - */ - -#ifndef _OPENTHREADS_CONFIG -#define _OPENTHREADS_CONFIG - -#define _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS -/* #undef _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS */ -/* #undef _OPENTHREADS_ATOMIC_USE_SUN */ -/* #undef _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED */ -#define _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC -/* #undef _OPENTHREADS_ATOMIC_USE_MUTEX */ -/* #undef OT_LIBRARY_STATIC */ - -#endif diff --git a/libs/lib/mac32/include/OpenThreads/Exports b/libs/lib/mac32/include/OpenThreads/Exports deleted file mode 100644 index 2a54144241c6a08b9fbbe009e8a60c3a1a26c0dc..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Exports +++ /dev/null @@ -1,44 +0,0 @@ -/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef _OPENTHREAD_EXPORTS_H_ -#define _OPENTHREAD_EXPORTS_H_ - -#include - -#ifndef WIN32 - #define OPENTHREAD_EXPORT_DIRECTIVE -#else - #if defined( OT_LIBRARY_STATIC ) - #define OPENTHREAD_EXPORT_DIRECTIVE - #elif defined( OPENTHREADS_EXPORTS ) - #define OPENTHREAD_EXPORT_DIRECTIVE __declspec(dllexport) - #else - #define OPENTHREAD_EXPORT_DIRECTIVE __declspec(dllimport) - - #if 0 // Commented out for now - - #ifdef _MSC_VER - #ifdef _DEBUG - #pragma comment(lib ,"OpenThreadsWin32d") - #else - #pragma comment(lib, "OpenThreadsWin32") - #endif - #endif - #endif - #endif -#endif - -#endif - - diff --git a/libs/lib/mac32/include/OpenThreads/Mutex b/libs/lib/mac32/include/OpenThreads/Mutex deleted file mode 100644 index e13ad189f148abd458e6ddf4ac3333c365af599b..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Mutex +++ /dev/null @@ -1,100 +0,0 @@ -/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - - -// -// Mutex - C++ mutex class -// ~~~~~ -// - -#ifndef _OPENTHREADS_MUTEX_ -#define _OPENTHREADS_MUTEX_ - -#include - -namespace OpenThreads { - -/** - * @class Mutex - * @brief This class provides an object-oriented thread mutex interface. - */ -class OPENTHREAD_EXPORT_DIRECTIVE Mutex { - - friend class Condition; - -public: - - enum MutexType - { - MUTEX_NORMAL, - MUTEX_RECURSIVE - }; - - /** - * Constructor - */ - Mutex(MutexType type=MUTEX_NORMAL); - - /** - * Destructor - */ - virtual ~Mutex(); - - - MutexType getMutexType() const { return _mutexType; } - - - /** - * Lock the mutex - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - virtual int lock(); - - /** - * Unlock the mutex - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - virtual int unlock(); - - /** - * Test if mutex can be locked. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - virtual int trylock(); - -private: - - /** - * Private copy constructor, to prevent tampering. - */ - Mutex(const Mutex &/*m*/) {}; - - /** - * Private copy assignment, to prevent tampering. - */ - Mutex &operator=(const Mutex &/*m*/) {return *(this);}; - - /** - * Implementation-specific private data. - */ - void *_prvData; - MutexType _mutexType; - -}; - -} - -#endif // _OPENTHREADS_MUTEX_ diff --git a/libs/lib/mac32/include/OpenThreads/ReadWriteMutex b/libs/lib/mac32/include/OpenThreads/ReadWriteMutex deleted file mode 100644 index c78a651d6e34fadbb5f8d7e4d759b87e226a7b1e..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/ReadWriteMutex +++ /dev/null @@ -1,114 +0,0 @@ -/* -*-c++-*- OpenThreads - Copyright (C) 1998-2007 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef _OPENTHREADS_READWRITEMUTEX_ -#define _OPENTHREADS_READWRITEMUTEX_ - -#include -#include - -namespace OpenThreads { - -class ReadWriteMutex -{ - public: - - ReadWriteMutex(): - _readCount(0) {} - - virtual ~ReadWriteMutex() {} - - virtual int readLock() - { - OpenThreads::ScopedLock lock(_readCountMutex); - int result = 0; - if (_readCount==0) - { - result = _readWriteMutex.lock(); - } - ++_readCount; - return result; - } - - - virtual int readUnlock() - { - OpenThreads::ScopedLock lock(_readCountMutex); - int result = 0; - if (_readCount>0) - { - --_readCount; - if (_readCount==0) - { - result = _readWriteMutex.unlock(); - } - } - return result; - } - - virtual int writeLock() - { - return _readWriteMutex.lock(); - } - - virtual int writeUnlock() - { - return _readWriteMutex.unlock(); - } - - protected: - - ReadWriteMutex(const ReadWriteMutex&) {} - ReadWriteMutex& operator = (const ReadWriteMutex&) { return *(this); } - -#if 0 - ReentrantMutex _readWriteMutex; - ReentrantMutex _readCountMutex; -#else - OpenThreads::Mutex _readWriteMutex; - OpenThreads::Mutex _readCountMutex; -#endif - unsigned int _readCount; - -}; - -class ScopedReadLock -{ - public: - - ScopedReadLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.readLock(); } - ~ScopedReadLock() { _mutex.readUnlock(); } - - protected: - ReadWriteMutex& _mutex; - - ScopedReadLock& operator = (const ScopedReadLock&) { return *this; } -}; - - -class ScopedWriteLock -{ - public: - - ScopedWriteLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.writeLock(); } - ~ScopedWriteLock() { _mutex.writeUnlock(); } - - protected: - ReadWriteMutex& _mutex; - - ScopedWriteLock& operator = (const ScopedWriteLock&) { return *this; } -}; - -} - -#endif diff --git a/libs/lib/mac32/include/OpenThreads/ReentrantMutex b/libs/lib/mac32/include/OpenThreads/ReentrantMutex deleted file mode 100644 index fdfefb32d1761baf52d4bb8b1a71edaa73bec590..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/ReentrantMutex +++ /dev/null @@ -1,34 +0,0 @@ -/* -*-c++-*- OpenThreads - Copyright (C) 1998-2007 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef _OPENTHREADS_REENTRANTMUTEX_ -#define _OPENTHREADS_REENTRANTMUTEX_ - -#include -#include -#include - -namespace OpenThreads { - -class ReentrantMutex : public OpenThreads::Mutex -{ - public: - - ReentrantMutex(): - Mutex(MUTEX_RECURSIVE) {} - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/OpenThreads/ScopedLock b/libs/lib/mac32/include/OpenThreads/ScopedLock deleted file mode 100644 index b665ecaa8ffef33faf6bf8036f4a2032c7afc3fc..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/ScopedLock +++ /dev/null @@ -1,70 +0,0 @@ -/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - - -// -// ScopedLock and ReverseScopedLock templates -// ~~~~~~~ -// -#ifndef _ScopedLock_ -#define _ScopedLock_ - -namespace OpenThreads{ - -template class ScopedLock -{ - private: - M& m_lock; - ScopedLock(const ScopedLock&); // prevent copy - ScopedLock& operator=(const ScopedLock&); // prevent assign - public: - explicit ScopedLock(M& m):m_lock(m) {m_lock.lock();} - ~ScopedLock(){m_lock.unlock();} -}; - -template class ReverseScopedLock -{ - private: - M& m_lock; - ReverseScopedLock(const ReverseScopedLock&); // prevent copy - ReverseScopedLock& operator=(const ReverseScopedLock&); // prevent assign - public: - explicit ReverseScopedLock(M& m):m_lock(m) {m_lock.unlock();} - ~ReverseScopedLock(){m_lock.lock();} -}; - - -template class ScopedPointerLock -{ - private: - M* m_lock; - ScopedPointerLock(const ScopedPointerLock&); // prevent copy - ScopedPointerLock& operator=(const ScopedPointerLock&); // prevent assign - public: - explicit ScopedPointerLock(M* m):m_lock(m) { if (m_lock) m_lock->lock();} - ~ScopedPointerLock(){ if (m_lock) m_lock->unlock();} -}; - -template class ReverseScopedPointerLock -{ - private: - M* m_lock; - ReverseScopedPointerLock(const ReverseScopedPointerLock&); // prevent copy - ReverseScopedPointerLock& operator=(const ReverseScopedPointerLock&); // prevent assign - public: - explicit ReverseScopedPointerLock(M* m):m_lock(m) { if (m_lock) m_lock->unlock();} - ~ReverseScopedPointerLock(){ if (m_lock) m_lock->lock();} -}; - -} -#endif diff --git a/libs/lib/mac32/include/OpenThreads/Thread b/libs/lib/mac32/include/OpenThreads/Thread deleted file mode 100644 index 0297b98768df84f293578b5e43e8aa1eec8819ce..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Thread +++ /dev/null @@ -1,389 +0,0 @@ -/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - - -// -// Thread - C++ Thread class -// ~~~~~~~~ -// - -#ifndef _OPENTHREADS_THREAD_ -#define _OPENTHREADS_THREAD_ - -#include - -#include - -namespace OpenThreads { - -/** - * Get the number of processors. - * - * Note, systems where no support exists for querrying the number of processors, 1 is returned. - * - */ -extern OPENTHREAD_EXPORT_DIRECTIVE int GetNumberOfProcessors(); - -/** - * Set the processor affinity of current thread. - * - * Note, systems where no support exists no affinity will be set, and -1 will be returned. - * - */ -extern OPENTHREAD_EXPORT_DIRECTIVE int SetProcessorAffinityOfCurrentThread(unsigned int cpunum); - -/** - * @class Thread - * @brief This class provides an object-oriented thread interface. - */ -class OPENTHREAD_EXPORT_DIRECTIVE Thread { - -public: - - /** - * Set the concurrency level for a running application. This method - * only has effect if the pthreads thread model is being used, and - * then only when that model is many-to-one (eg. irix). - * in other cases it is ignored. The concurrency level is only a - * *hint* as to the number of execution vehicles to use, the actual - * implementation may do anything it wants. Setting the value - * to 0 returns things to their default state. - * - * @return previous concurrency level, -1 indicates no-op. - */ - static int SetConcurrency(int concurrencyLevel); - - /** - * Get the concurrency level for a running application. In this - * case, a return code of 0 means that the application is in default - * mode. A return code of -1 means that the application is incapable - * of setting an arbitrary concurrency, because it is a one-to-one - * execution model (sprocs, linuxThreads) - */ - static int GetConcurrency(); - - /** - * Enumerated Type for thread priority - */ - enum ThreadPriority { - - THREAD_PRIORITY_MAX, /**< The maximum possible priority */ - THREAD_PRIORITY_HIGH, /**< A high (but not max) setting */ - THREAD_PRIORITY_NOMINAL, /**< An average priority */ - THREAD_PRIORITY_LOW, /**< A low (but not min) setting */ - THREAD_PRIORITY_MIN, /**< The miniumum possible priority */ - THREAD_PRIORITY_DEFAULT /**< Priority scheduling default */ - - }; - - /** - * Enumerated Type for thread scheduling policy - */ - enum ThreadPolicy { - - THREAD_SCHEDULE_FIFO, /**< First in, First out scheduling */ - THREAD_SCHEDULE_ROUND_ROBIN, /**< Round-robin scheduling (LINUX_DEFAULT) */ - THREAD_SCHEDULE_TIME_SHARE, /**< Time-share scheduling (IRIX DEFAULT) */ - THREAD_SCHEDULE_DEFAULT /**< Default scheduling */ - - }; - - /** - * Constructor - */ - Thread(); - - /** - * Destructor - */ - virtual ~Thread(); - - - /** - * Return a pointer to the current running thread - */ - static Thread *CurrentThread(); - - - /** - * Initialize Threading in a program. This method must be called before - * you can do any threading in a program. - */ - static void Init(); - - /** - * Yield the processor. - * - * @note This method operates on the calling process. And is - * equivalent to calling sched_yield(). - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - static int YieldCurrentThread(); - - /** - * This method will return the ThreadPriority of the master process. - * (ie, the one calling the thread->start() methods for the first time) - * The method will almost certainly return - * Thread::THREAD_PRIORITY_DEFAULT if - * Init() has not been called. - * - * @return the Thread::ThreadPriority of the master thread. - */ - static ThreadPriority GetMasterPriority() {return s_masterThreadPriority;}; - - - /** - * Get a unique thread id. This id is monotonically increasing. - * - * @return a unique thread identifier - */ - int getThreadId(); - - /** - * Get the thread's process id. This is the pthread_t or pid_t value - * depending on the threading model being used. - * - * @return thread process id. - */ - size_t getProcessId(); - - /** - * Start the thread. This method will configure the thread, set - * it's priority, and spawn it. - * - * @note if the stack size specified setStackSize is smaller than the - * smallest allowable stack size, the threads stack size will be set to - * the minimum allowed, and may be retrieved via the getStackSize() - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int start(); - int startThread(); - - /** - * Test the cancel state of the thread. If the thread has been canceled - * this method will cause the thread to exit now. This method operates - * on the calling thread. - * - * Returns 0 if normal, -1 if called from a thread other that this. - */ - int testCancel(); - - - /** - * Cancel the thread. Equivalent to SIGKILL. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - virtual int cancel(); - - /** - * Set the thread's schedule priority. This is a complex method. - * Beware of thread priorities when using a many-to-many kernel - * entity implemenation (such as IRIX pthreads). If one is not carefull - * to manage the thread priorities, a priority inversion deadlock can - * easily occur (Although the OpenThreads::Mutex & OpenThreads::Barrier - * constructs have been designed with this senario in mind). Unless - * you have explicit need to set the schedule pirorites for a given - * task, it is best to leave them alone. - * - * @note some implementations (notably LinuxThreads and IRIX Sprocs) - * only alow you to decrease thread priorities dynamically. Thus, - * a lower priority thread will not allow it's priority to be raised - * on the fly. - * - * @note seting the environment variable OUTPUT_THREADLIB_SCHEDULING_INFO - * will output scheduling information for each thread to stdout. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int setSchedulePriority(ThreadPriority priority); - - /** - * Get the thread's schedule priority (if able) - * - * @note seting the environment variable OUTPUT_THREADLIB_SCHEDULING_INFO - * will output scheduling information for each thread to stdout. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int getSchedulePriority(); - - /** - * Set the thread's scheduling policy (if able) - * - * @note On some implementations (notably IRIX Sprocs & LinuxThreads) - * The policy may prohibit the use of SCHEDULE_ROUND_ROBIN and - * SCHEDULE_FIFO policies - due to their real-time nature, and - * the danger of deadlocking the machine when used as super-user. - * In such cases, the command is a no-op. - * - * @note seting the environment variable OUTPUT_THREADLIB_SCHEDULING_INFO - * will output scheduling information for each thread to stdout. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int setSchedulePolicy(ThreadPolicy policy); - - /** - * Get the thread's policy (if able) - * - * @note seting the environment variable OUTPUT_THREADLIB_SCHEDULING_INFO - * will output scheduling information for each thread to stdout. - * - * @return policy if normal, -1 if errno set, errno code otherwise. - */ - int getSchedulePolicy(); - - /** - * Set the thread's desired stack size (in bytes). - * This method is an attribute of the thread and must be called - * *before* the start() method is invoked. - * - * @note a return code of 13 (EACESS) means that the thread stack - * size can no longer be changed. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int setStackSize(size_t size); - - /** - * Get the thread's desired stack size. - * - * @return the thread's stack size. 0 indicates that the stack size - * has either not yet been initialized, or not yet been specified by - * the application. - */ - size_t getStackSize(); - - /** - * Print the thread's scheduling information to stdout. - */ - void printSchedulingInfo(); - - /** - * Detach the thread from the calling process. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int detach(); - - /** - * Join the calling process with the thread - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int join(); - - /** - * Disable thread cancelation altogether. Thread::cancel() has no effect. - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int setCancelModeDisable(); - - /** - * Mark the thread to cancel aysncronously on Thread::cancel(). - * (May not be available with process-level implementations). - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int setCancelModeAsynchronous(); - - /** - * Mark the thread to cancel at the earliest convenience on - * Thread::cancel() (This is the default) - * - * @return 0 if normal, -1 if errno set, errno code otherwise. - */ - int setCancelModeDeferred(); - - /** - * Query the thread's running status - * - * @return true if running, false if not. - */ - bool isRunning(); - - /** - * Thread's run method. Must be implemented by derived classes. - * This is where the action happens. - */ - virtual void run() = 0; - - /** - * Thread's cancel cleanup routine, called upon cancel(), after the - * cancelation has taken place, but before the thread exits completely. - * This method should be used to repair parts of the thread's data - * that may have been damaged by a pre-mature cancel. No-op by default. - */ - virtual void cancelCleanup() {}; - - void* getImplementation(){ return _prvData; }; - - /** Thread's processor affinity method. This binds a thread to a - * processor whenever possible. This call must be made before - * start() or startThread() and has no effect after the thread - * has been running. In the pthreads implementation, this is only - * implemented on sgi, through a pthread extension. On other pthread - * platforms this is ignored. Returns 0 on success, implementation's - * error on failure, or -1 if ignored. - */ - int setProcessorAffinity( unsigned int cpunum ); - - /** microSleep method, equivilant to the posix usleep(microsec). - * This is not strictly thread API but is used - * so often with threads. It's basically UNIX usleep. Parameter is - * number of microseconds we current thread to sleep. Returns 0 on - * succes, non-zero on failure (UNIX errno or GetLastError() will give - * detailed description. - */ - static int microSleep( unsigned int microsec); - -private: - - /** - * The Private Actions class is allowed to operate on private data. - */ - friend class ThreadPrivateActions; - - /** - * Private copy constructor, to prevent tampering. - */ - Thread(const Thread &/*t*/) {}; - - /** - * Private copy assignment, to prevent tampering. - */ - Thread &operator=(const Thread &/*t*/) {return *(this);}; - - /** - * Implementation-specific data - */ - void * _prvData; - - /** - * Master thread's priority, set by Thread::Init. - */ - static ThreadPriority s_masterThreadPriority; - - /** - * Is initialized flag - */ - static bool s_isInitialized; -}; - -} - -#endif // !_OPENTHREADS_THREAD_ diff --git a/libs/lib/mac32/include/OpenThreads/Version b/libs/lib/mac32/include/OpenThreads/Version deleted file mode 100644 index 39e5608ecb0e9805f902dbdaf7b2c45bcb9d55a3..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/OpenThreads/Version +++ /dev/null @@ -1,38 +0,0 @@ -/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OPENTHREADS_VERSION -#define OPENTHREADS_VERSION 1 - -#include - -extern "C" { - -#define OPENTHREADS_MAJOR_VERSION 2 -#define OPENTHREADS_MINOR_VERSION 6 -#define OPENTHREADS_PATCH_VERSION 0 -#define OPENTHREADS_SOVERSION 12 - -/** OpenThreadsGetVersion() returns the library version number. - * Numbering convention : OpenThreads-1.0 will return 1.0 from OpenThreadsGetVersion. */ -extern OPENTHREAD_EXPORT_DIRECTIVE const char* OpenThreadsGetVersion(); - -/** The OpenThreadsGetSOVersion() method returns the OpenSceneGraph soversion number. */ -extern OPENTHREAD_EXPORT_DIRECTIVE const char* OpenThreadsGetSOVersion(); - -/** The OpenThreadsGetLibraryName() method returns the library name in human-friendly form. */ -extern OPENTHREAD_EXPORT_DIRECTIVE const char* OpenThreadsGetLibraryName(); - -} - -#endif diff --git a/libs/lib/mac32/include/osg/AlphaFunc b/libs/lib/mac32/include/osg/AlphaFunc deleted file mode 100644 index c35dc3c910428c2804454dc58c812a4f9d059e55..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/AlphaFunc +++ /dev/null @@ -1,102 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_ALPHAFUNC -#define OSG_ALPHAFUNC 1 - -#include - -#ifndef GL_ALPHA_TEST - #define GL_ALPHA_TEST 0x0BC0 -#endif - -namespace osg { - -/** Encapsulates OpenGL glAlphaFunc. -*/ -class OSG_EXPORT AlphaFunc : public StateAttribute -{ - public : - - enum ComparisonFunction { - NEVER = GL_NEVER, - LESS = GL_LESS, - EQUAL = GL_EQUAL, - LEQUAL = GL_LEQUAL, - GREATER = GL_GREATER, - NOTEQUAL = GL_NOTEQUAL, - GEQUAL = GL_GEQUAL, - ALWAYS = GL_ALWAYS - }; - - - AlphaFunc(); - - AlphaFunc(ComparisonFunction func,float ref): - _comparisonFunc(func), - _referenceValue(ref) {} - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - AlphaFunc(const AlphaFunc& af,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(af,copyop), - _comparisonFunc(af._comparisonFunc), - _referenceValue(af._referenceValue) {} - - META_StateAttribute(osg, AlphaFunc,ALPHAFUNC); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(AlphaFunc,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_comparisonFunc) - COMPARE_StateAttribute_Parameter(_referenceValue) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_ALPHA_TEST); - return true; - } - - inline void setFunction(ComparisonFunction func,float ref) - { - _comparisonFunc = func; - _referenceValue = ref; - } - - inline void setFunction(ComparisonFunction func) { _comparisonFunc=func; } - inline ComparisonFunction getFunction() const { return _comparisonFunc; } - - inline void setReferenceValue(float value) { _referenceValue=value; } - inline float getReferenceValue() const { return _referenceValue; } - - virtual void apply(State& state) const; - - protected: - - virtual ~AlphaFunc(); - - ComparisonFunction _comparisonFunc; - float _referenceValue; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/AnimationPath b/libs/lib/mac32/include/osg/AnimationPath deleted file mode 100644 index 9062e3cd5810b71dc83fb4da57a5b972fa24cc99..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/AnimationPath +++ /dev/null @@ -1,314 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_ANIMATIONPATH -#define OSG_ANIMATIONPATH 1 - -#include -#include -#include - -#include -#include -#include -#include - -namespace osg { - -/** AnimationPath encapsulates a time varying transformation pathway. Can be - * used for updating camera position and model object position. - * AnimationPathCallback can be attached directly to Transform nodes to - * move subgraphs around the scene. -*/ -class OSG_EXPORT AnimationPath : public virtual osg::Object -{ - public: - - AnimationPath():_loopMode(LOOP) {} - - AnimationPath(const AnimationPath& ap, const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Object(ap,copyop), - _timeControlPointMap(ap._timeControlPointMap), - _loopMode(ap._loopMode) {} - - META_Object(osg,AnimationPath); - - class ControlPoint - { - public: - ControlPoint(): - _scale(1.0,1.0,1.0) {} - - ControlPoint(const osg::Vec3d& position): - _position(position), - _rotation(), - _scale(1.0,1.0,1.0) {} - - ControlPoint(const osg::Vec3d& position, const osg::Quat& rotation): - _position(position), - _rotation(rotation), - _scale(1.0,1.0,1.0) {} - - ControlPoint(const osg::Vec3d& position, const osg::Quat& rotation, const osg::Vec3d& scale): - _position(position), - _rotation(rotation), - _scale(scale) {} - - void setPosition(const osg::Vec3d& position) { _position = position; } - const osg::Vec3d& getPosition() const { return _position; } - - void setRotation(const osg::Quat& rotation) { _rotation = rotation; } - const osg::Quat& getRotation() const { return _rotation; } - - void setScale(const osg::Vec3d& scale) { _scale = scale; } - const osg::Vec3d& getScale() const { return _scale; } - - inline void interpolate(float ratio,const ControlPoint& first, const ControlPoint& second) - { - float one_minus_ratio = 1.0f-ratio; - _position = first._position*one_minus_ratio + second._position*ratio; - _rotation.slerp(ratio,first._rotation,second._rotation); - _scale = first._scale*one_minus_ratio + second._scale*ratio; - } - - inline void interpolate(double ratio,const ControlPoint& first, const ControlPoint& second) - { - double one_minus_ratio = 1.0f-ratio; - _position = first._position*one_minus_ratio + second._position*ratio; - _rotation.slerp(ratio,first._rotation,second._rotation); - _scale = first._scale*one_minus_ratio + second._scale*ratio; - } - - inline void getMatrix(Matrixf& matrix) const - { - matrix.makeRotate(_rotation); - matrix.preMultScale(_scale); - matrix.postMultTranslate(_position); - } - - inline void getMatrix(Matrixd& matrix) const - { - matrix.makeRotate(_rotation); - matrix.preMultScale(_scale); - matrix.postMultTranslate(_position); - } - - inline void getInverse(Matrixf& matrix) const - { - matrix.makeRotate(_rotation.inverse()); - matrix.postMultScale(osg::Vec3d(1.0/_scale.x(),1.0/_scale.y(),1.0/_scale.z())); - matrix.preMultTranslate(-_position); - } - - inline void getInverse(Matrixd& matrix) const - { - matrix.makeRotate(_rotation.inverse()); - matrix.postMultScale(osg::Vec3d(1.0/_scale.x(),1.0/_scale.y(),1.0/_scale.z())); - matrix.preMultTranslate(-_position); - } - - protected: - - osg::Vec3d _position; - osg::Quat _rotation; - osg::Vec3d _scale; - - }; - - - /** Given a specific time, return the transformation matrix for a point. */ - bool getMatrix(double time,Matrixf& matrix) const - { - ControlPoint cp; - if (!getInterpolatedControlPoint(time,cp)) return false; - cp.getMatrix(matrix); - return true; - } - - /** Given a specific time, return the transformation matrix for a point. */ - bool getMatrix(double time,Matrixd& matrix) const - { - ControlPoint cp; - if (!getInterpolatedControlPoint(time,cp)) return false; - cp.getMatrix(matrix); - return true; - } - - /** Given a specific time, return the inverse transformation matrix for a point. */ - bool getInverse(double time,Matrixf& matrix) const - { - ControlPoint cp; - if (!getInterpolatedControlPoint(time,cp)) return false; - cp.getInverse(matrix); - return true; - } - - bool getInverse(double time,Matrixd& matrix) const - { - ControlPoint cp; - if (!getInterpolatedControlPoint(time,cp)) return false; - cp.getInverse(matrix); - return true; - } - - /** Given a specific time, return the local ControlPoint frame for a point. */ - virtual bool getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const; - - /** Insert a control point into the AnimationPath.*/ - void insert(double time,const ControlPoint& controlPoint); - - double getFirstTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.begin()->first; else return 0.0;} - double getLastTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.rbegin()->first; else return 0.0;} - double getPeriod() const { return getLastTime()-getFirstTime();} - - enum LoopMode - { - SWING, - LOOP, - NO_LOOPING - }; - - void setLoopMode(LoopMode lm) { _loopMode = lm; } - - LoopMode getLoopMode() const { return _loopMode; } - - - typedef std::map TimeControlPointMap; - - void setTimeControlPointMap(TimeControlPointMap& tcpm) { _timeControlPointMap=tcpm; } - - TimeControlPointMap& getTimeControlPointMap() { return _timeControlPointMap; } - - const TimeControlPointMap& getTimeControlPointMap() const { return _timeControlPointMap; } - - bool empty() const { return _timeControlPointMap.empty(); } - - void clear() { _timeControlPointMap.clear(); } - - /** Read the animation path from a flat ASCII file stream. */ - void read(std::istream& in); - - /** Write the animation path to a flat ASCII file stream. */ - void write(std::ostream& out) const; - - /** Write the control point to a flat ASCII file stream. */ - void write(TimeControlPointMap::const_iterator itr, std::ostream& out) const; - - protected: - - virtual ~AnimationPath() {} - - TimeControlPointMap _timeControlPointMap; - LoopMode _loopMode; - -}; - - -class OSG_EXPORT AnimationPathCallback : public NodeCallback -{ - public: - - AnimationPathCallback(): - _pivotPoint(0.0,0.0,0.0), - _useInverseMatrix(false), - _timeOffset(0.0), - _timeMultiplier(1.0), - _firstTime(DBL_MAX), - _latestTime(0.0), - _pause(false), - _pauseTime(0.0) {} - - AnimationPathCallback(const AnimationPathCallback& apc,const CopyOp& copyop): - NodeCallback(apc,copyop), - _animationPath(apc._animationPath), - _pivotPoint(apc._pivotPoint), - _useInverseMatrix(apc._useInverseMatrix), - _timeOffset(apc._timeOffset), - _timeMultiplier(apc._timeMultiplier), - _firstTime(apc._firstTime), - _latestTime(apc._latestTime), - _pause(apc._pause), - _pauseTime(apc._pauseTime) {} - - - META_Object(osg,AnimationPathCallback); - - /** Construct an AnimationPathCallback with a specified animation path.*/ - AnimationPathCallback(AnimationPath* ap,double timeOffset=0.0,double timeMultiplier=1.0): - _animationPath(ap), - _pivotPoint(0.0,0.0,0.0), - _useInverseMatrix(false), - _timeOffset(timeOffset), - _timeMultiplier(timeMultiplier), - _firstTime(DBL_MAX), - _latestTime(0.0), - _pause(false), - _pauseTime(0.0) {} - - /** Construct an AnimationPathCallback and automatically create an animation path to produce a rotation about a point.*/ - AnimationPathCallback(const osg::Vec3d& pivot,const osg::Vec3d& axis,float angularVelocity); - - - void setAnimationPath(AnimationPath* path) { _animationPath = path; } - AnimationPath* getAnimationPath() { return _animationPath.get(); } - const AnimationPath* getAnimationPath() const { return _animationPath.get(); } - - inline void setPivotPoint(const Vec3d& pivot) { _pivotPoint = pivot; } - inline const Vec3d& getPivotPoint() const { return _pivotPoint; } - - void setUseInverseMatrix(bool useInverseMatrix) { _useInverseMatrix = useInverseMatrix; } - bool getUseInverseMatrix() const { return _useInverseMatrix; } - - void setTimeOffset(double offset) { _timeOffset = offset; } - double getTimeOffset() const { return _timeOffset; } - - void setTimeMultiplier(double multiplier) { _timeMultiplier = multiplier; } - double getTimeMultiplier() const { return _timeMultiplier; } - - - virtual void reset(); - - void setPause(bool pause); - bool getPause() const { return _pause; } - - /** Get the animation time that is used to specify the position along - * the AnimationPath. Animation time is computed from the formula: - * ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier.*/ - virtual double getAnimationTime() const; - - /** Implements the callback. */ - virtual void operator()(Node* node, NodeVisitor* nv); - - void update(osg::Node& node); - - public: - - ref_ptr _animationPath; - osg::Vec3d _pivotPoint; - bool _useInverseMatrix; - double _timeOffset; - double _timeMultiplier; - double _firstTime; - double _latestTime; - bool _pause; - double _pauseTime; - - protected: - - ~AnimationPathCallback(){} - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ApplicationUsage b/libs/lib/mac32/include/osg/ApplicationUsage deleted file mode 100644 index a035c919ea59d82fc783d7af8911b9b5a18a4643..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ApplicationUsage +++ /dev/null @@ -1,122 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_APPLICATIONUSAGE -#define OSG_APPLICATIONUSAGE 1 - -#include - -#include -#include -#include - -namespace osg { - -class OSG_EXPORT ApplicationUsage : public osg::Referenced -{ - public: - - static ApplicationUsage* instance(); - - ApplicationUsage() {} - - ApplicationUsage(const std::string& commandLineUsage); - - typedef std::map UsageMap; - - - /** The ApplicationName is often displayed when logging errors, and frequently incorporated into the Description (below). */ - void setApplicationName(const std::string& name) { _applicationName = name; } - const std::string& getApplicationName() const { return _applicationName; } - - /** If non-empty, the Description is typically shown by the Help Handler - * as text on the Help display (which also lists keyboard abbreviations. */ - void setDescription(const std::string& desc) { _description = desc; } - const std::string& getDescription() const { return _description; } - - enum Type - { - NO_HELP = 0x0, - COMMAND_LINE_OPTION = 0x1, - ENVIRONMENTAL_VARIABLE = 0x2, - KEYBOARD_MOUSE_BINDING = 0x4, - HELP_ALL = KEYBOARD_MOUSE_BINDING|ENVIRONMENTAL_VARIABLE|COMMAND_LINE_OPTION - }; - - void addUsageExplanation(Type type,const std::string& option,const std::string& explanation); - - void setCommandLineUsage(const std::string& explanation) { _commandLineUsage=explanation; } - const std::string& getCommandLineUsage() const { return _commandLineUsage; } - - - void addCommandLineOption(const std::string& option,const std::string& explanation, const std::string &defaultValue = ""); - - void setCommandLineOptions(const UsageMap& usageMap) { _commandLineOptions=usageMap; } - const UsageMap& getCommandLineOptions() const { return _commandLineOptions; } - - void setCommandLineOptionsDefaults(const UsageMap& usageMap) { _commandLineOptionsDefaults=usageMap; } - const UsageMap& getCommandLineOptionsDefaults() const { return _commandLineOptionsDefaults; } - - - void addEnvironmentalVariable(const std::string& option,const std::string& explanation, const std::string& defaultValue = ""); - - void setEnvironmentalVariables(const UsageMap& usageMap) { _environmentalVariables=usageMap; } - const UsageMap& getEnvironmentalVariables() const { return _environmentalVariables; } - - void setEnvironmentalVariablesDefaults(const UsageMap& usageMap) { _environmentalVariablesDefaults=usageMap; } - const UsageMap& getEnvironmentalVariablesDefaults() const { return _environmentalVariablesDefaults; } - - - void addKeyboardMouseBinding(const std::string& option,const std::string& explanation); - - void setKeyboardMouseBindings(const UsageMap& usageMap) { _keyboardMouse=usageMap; } - const UsageMap& getKeyboardMouseBindings() const { return _keyboardMouse; } - - - void getFormattedString(std::string& str, const UsageMap& um,unsigned int widthOfOutput=80,bool showDefaults=false,const UsageMap& ud=UsageMap()); - - void write(std::ostream& output,const UsageMap& um,unsigned int widthOfOutput=80,bool showDefaults=false,const UsageMap& ud=UsageMap()); - - void write(std::ostream& output,unsigned int type=COMMAND_LINE_OPTION, unsigned int widthOfOutput=80,bool showDefaults=false); - - void writeEnvironmentSettings(std::ostream& output); - - protected: - - virtual ~ApplicationUsage() {} - - std::string _applicationName; - std::string _description; - std::string _commandLineUsage; - UsageMap _commandLineOptions; - UsageMap _environmentalVariables; - UsageMap _keyboardMouse; - UsageMap _environmentalVariablesDefaults; - UsageMap _commandLineOptionsDefaults; - -}; - -class ApplicationUsageProxy -{ - public: - - /** register an explanation of commandline/environmentvariable/keyboard mouse usage.*/ - ApplicationUsageProxy(ApplicationUsage::Type type,const std::string& option,const std::string& explanation) - { - ApplicationUsage::instance()->addUsageExplanation(type,option,explanation); - } -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ArgumentParser b/libs/lib/mac32/include/osg/ArgumentParser deleted file mode 100644 index e20bdee324be5cae35f8720c3fec86ee01ba7916..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ArgumentParser +++ /dev/null @@ -1,213 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_ARGUMENTPARSER -#define OSG_ARGUMENTPARSER 1 - -#include -#include -#include - -#include -#include -#include - -namespace osg { - -class OSG_EXPORT ArgumentParser -{ - public: - - class OSG_EXPORT Parameter - { - public: - enum ParameterType - { - BOOL_PARAMETER, - FLOAT_PARAMETER, - DOUBLE_PARAMETER, - INT_PARAMETER, - UNSIGNED_INT_PARAMETER, - STRING_PARAMETER - }; - - union ValueUnion - { - bool* _bool; - float* _float; - double* _double; - int* _int; - unsigned int* _uint; - std::string* _string; - }; - - Parameter(bool& value) { _type = BOOL_PARAMETER; _value._bool = &value; } - - Parameter(float& value) { _type = FLOAT_PARAMETER; _value._float = &value; } - - Parameter(double& value) { _type = DOUBLE_PARAMETER; _value._double = &value; } - - Parameter(int& value) { _type = INT_PARAMETER; _value._int = &value; } - - Parameter(unsigned int& value) { _type = UNSIGNED_INT_PARAMETER; _value._uint = &value; } - - Parameter(std::string& value) { _type = STRING_PARAMETER; _value._string = &value; } - - Parameter(const Parameter& param) { _type = param._type; _value = param._value; } - - Parameter& operator = (const Parameter& param) { _type = param._type; _value = param._value; return *this; } - - bool valid(const char* str) const; - bool assign(const char* str); - - protected: - - ParameterType _type; - ValueUnion _value; - }; - - /** Return true if the specified string is an option in the form - * -option or --option. */ - static bool isOption(const char* str); - - /** Return true if string is non-NULL and not an option in the form - * -option or --option. */ - static bool isString(const char* str); - - /** Return true if specified parameter is a number. */ - static bool isNumber(const char* str); - - /** Return true if specified parameter is a bool. */ - static bool isBool(const char* str); - - public: - - ArgumentParser(int* argc,char **argv); - - void setApplicationUsage(ApplicationUsage* usage) { _usage = usage; } - ApplicationUsage* getApplicationUsage() { return _usage.get(); } - const ApplicationUsage* getApplicationUsage() const { return _usage.get(); } - - /** Return the argument count. */ - int& argc() { return *_argc; } - - /** Return the argument array. */ - char** argv() { return _argv; } - - /** Return the char* argument at the specified position. */ - char* operator [] (int pos) { return _argv[pos]; } - - /** Return the const char* argument at the specified position. */ - const char* operator [] (int pos) const { return _argv[pos]; } - - /** Return the application name, as specified by argv[0] */ - std::string getApplicationName() const; - - /** Return the position of an occurrence of a string in the argument list. - * Return -1 if no string is found. */ - int find(const std::string& str) const; - - /** Return true if the specified parameter is an option in the form of - * -option or --option. */ - bool isOption(int pos) const; - - /** Return true if the specified parameter is a string not in - * the form of an option. */ - bool isString(int pos) const; - - /** Return true if the specified parameter is a number. */ - bool isNumber(int pos) const; - - bool containsOptions() const; - - /** Remove one or more arguments from the argv argument list, - * and decrement the argc respectively. */ - void remove(int pos,int num=1); - - /** Return true if the specified argument matches the given string. */ - bool match(int pos, const std::string& str) const; - - /** Search for an occurrence of a string in the argument list. If found, - * remove that occurrence and return true. Otherwise, return false. */ - bool read(const std::string& str); - bool read(const std::string& str, Parameter value1); - bool read(const std::string& str, Parameter value1, Parameter value2); - bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3); - bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4); - bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5); - bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6); - bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7); - bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8); - - - /** If the argument value at the specified position matches the given string, - * and subsequent parameters are also matched, then set the parameter values, - * remove the arguments from the list, and return true. Otherwise, return false. */ - bool read(int pos, const std::string& str); - bool read(int pos, const std::string& str, Parameter value1); - bool read(int pos, const std::string& str, Parameter value1, Parameter value2); - bool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3); - bool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4); - bool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5); - bool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6); - bool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7); - bool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8); - - - enum ErrorSeverity - { - BENIGN = 0, - CRITICAL = 1 - }; - - typedef std::map ErrorMessageMap; - - /** Return the error flag, true if an error has occurred when reading arguments. */ - bool errors(ErrorSeverity severity=BENIGN) const; - - /** Report an error message by adding to the ErrorMessageMap. */ - void reportError(const std::string& message,ErrorSeverity severity=CRITICAL); - - /** For each remaining option, report it as unrecognized. */ - void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN); - - /** Return the error message, if any has occurred. */ - ErrorMessageMap& getErrorMessageMap() { return _errorMessageMap; } - - /** Return the error message, if any has occurred. */ - const ErrorMessageMap& getErrorMessageMap() const { return _errorMessageMap; } - - /** Write error messages to the given ostream, if at or above the given severity. */ - void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN); - - - /** This convenience method handles help requests on the command line. - * Return the type(s) of help requested. The return value of this - * function is suitable for passing into getApplicationUsage()->write(). - * If ApplicationUsage::NO_HELP is returned then no help commandline option - * was found on the command line. */ - ApplicationUsage::Type readHelpType(); - - - protected: - - int* _argc; - char** _argv; - ErrorMessageMap _errorMessageMap; - ref_ptr _usage; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Array b/libs/lib/mac32/include/osg/Array deleted file mode 100644 index 19d7396c0f93f3e0bc8040c36c8bbb0b9ec3198c..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Array +++ /dev/null @@ -1,491 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_ARRAY -#define OSG_ARRAY 1 - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -namespace osg { - -class ArrayVisitor; -class ConstArrayVisitor; - -class ValueVisitor; -class ConstValueVisitor; - -class OSG_EXPORT Array : public BufferData -{ - - public: - - enum Type - { - ArrayType = 0, - ByteArrayType = 1, - ShortArrayType = 2, - IntArrayType = 3, - UByteArrayType = 4, - UShortArrayType = 5, - UIntArrayType = 6, - Vec4ubArrayType = 7, - FloatArrayType = 8, - Vec2ArrayType = 9, - Vec3ArrayType = 10, - Vec4ArrayType = 11, - Vec2sArrayType = 12, - Vec3sArrayType = 13, - Vec4sArrayType = 14, - Vec2bArrayType = 15, - Vec3bArrayType = 16, - Vec4bArrayType = 17, - DoubleArrayType = 18, - Vec2dArrayType = 19, - Vec3dArrayType = 20, - Vec4dArrayType = 21, - MatrixArrayType = 22 - }; - - Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0): - _arrayType(arrayType), - _dataSize(dataSize), - _dataType(dataType) {} - - Array(const Array& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - BufferData(array,copyop), - _arrayType(array._arrayType), - _dataSize(array._dataSize), - _dataType(array._dataType) {} - - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const; - - virtual void accept(ArrayVisitor&) = 0; - virtual void accept(ConstArrayVisitor&) const = 0; - - virtual void accept(unsigned int index,ValueVisitor&) = 0; - virtual void accept(unsigned int index,ConstValueVisitor&) const = 0; - - /** Return -1 if lhs element is less than rhs element, 0 if equal, - * 1 if lhs element is greater than rhs element. */ - virtual int compare(unsigned int lhs,unsigned int rhs) const = 0; - - Type getType() const { return _arrayType; } - GLint getDataSize() const { return _dataSize; } - GLenum getDataType() const { return _dataType; } - virtual const GLvoid* getDataPointer() const = 0; - virtual unsigned int getTotalDataSize() const = 0; - virtual unsigned int getNumElements() const = 0; - - /** Frees unused space on this vector - i.e. the difference between size() and max_size() of the underlying vector.*/ - virtual void trim() {} - - /** Set the VertexBufferObject.*/ - inline void setVertexBufferObject(osg::VertexBufferObject* vbo) { setBufferObject(vbo); } - - /** Get the VertexBufferObject. If no VBO is assigned returns NULL*/ - inline osg::VertexBufferObject* getVertexBufferObject() { return dynamic_cast(_bufferObject.get()); } - - /** Get the const VertexBufferObject. If no VBO is assigned returns NULL*/ - inline const osg::VertexBufferObject* getVertexBufferObject() const { return dynamic_cast(_bufferObject.get()); } - - protected: - - virtual ~Array() {} - - Type _arrayType; - GLint _dataSize; - GLenum _dataType; -}; - -template -class TemplateArray : public Array, public MixinVector -{ - public: - - TemplateArray() : Array(ARRAYTYPE,DataSize,DataType) {} - - TemplateArray(const TemplateArray& ta,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Array(ta,copyop), - MixinVector(ta) {} - - TemplateArray(unsigned int no) : - Array(ARRAYTYPE,DataSize,DataType), - MixinVector(no) {} - - TemplateArray(unsigned int no,const T* ptr) : - Array(ARRAYTYPE,DataSize,DataType), - MixinVector(ptr,ptr+no) {} - - template - TemplateArray(InputIterator first,InputIterator last) : - Array(ARRAYTYPE,DataSize,DataType), - MixinVector(first,last) {} - - TemplateArray& operator = (const TemplateArray& array) - { - if (this==&array) return *this; - this->assign(array.begin(),array.end()); - return *this; - } - - virtual Object* cloneType() const { return new TemplateArray(); } - virtual Object* clone(const CopyOp& copyop) const { return new TemplateArray(*this,copyop); } - - inline virtual void accept(ArrayVisitor& av); - inline virtual void accept(ConstArrayVisitor& av) const; - - inline virtual void accept(unsigned int index,ValueVisitor& vv); - inline virtual void accept(unsigned int index,ConstValueVisitor& vv) const; - - virtual int compare(unsigned int lhs,unsigned int rhs) const - { - const T& elem_lhs = (*this)[lhs]; - const T& elem_rhs = (*this)[rhs]; - if (elem_lhs( *this ).swap( *this ); - } - - virtual const GLvoid* getDataPointer() const { if (!this->empty()) return &this->front(); else return 0; } - virtual unsigned int getTotalDataSize() const { return static_cast(this->size()*sizeof(T)); } - virtual unsigned int getNumElements() const { return static_cast(this->size()); } - - typedef T ElementDataType; // expose T - - protected: - - virtual ~TemplateArray() {} -}; - -class OSG_EXPORT IndexArray : public Array -{ - - public: - - IndexArray(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0): - Array(arrayType,dataSize,dataType) {} - - IndexArray(const Array& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Array(array,copyop) {} - - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - - virtual unsigned int index(unsigned int pos) const = 0; - - protected: - - virtual ~IndexArray() {} -}; - -template -class TemplateIndexArray : public IndexArray, public MixinVector -{ - public: - - TemplateIndexArray() : IndexArray(ARRAYTYPE,DataSize,DataType) {} - - TemplateIndexArray(const TemplateIndexArray& ta,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - IndexArray(ta,copyop), - MixinVector(ta) {} - - TemplateIndexArray(unsigned int no) : - IndexArray(ARRAYTYPE,DataSize,DataType), - MixinVector(no) {} - - TemplateIndexArray(unsigned int no,T* ptr) : - IndexArray(ARRAYTYPE,DataSize,DataType), - MixinVector(ptr,ptr+no) {} - - template - TemplateIndexArray(InputIterator first,InputIterator last) : - IndexArray(ARRAYTYPE,DataSize,DataType), - MixinVector(first,last) {} - - TemplateIndexArray& operator = (const TemplateIndexArray& array) - { - if (this==&array) return *this; - this->assign(array.begin(),array.end()); - return *this; - } - - virtual Object* cloneType() const { return new TemplateIndexArray(); } - virtual Object* clone(const CopyOp& copyop) const { return new TemplateIndexArray(*this,copyop); } - - inline virtual void accept(ArrayVisitor& av); - inline virtual void accept(ConstArrayVisitor& av) const; - - inline virtual void accept(unsigned int index,ValueVisitor& vv); - inline virtual void accept(unsigned int index,ConstValueVisitor& vv) const; - - virtual int compare(unsigned int lhs,unsigned int rhs) const - { - const T& elem_lhs = (*this)[lhs]; - const T& elem_rhs = (*this)[rhs]; - if (elem_lhs( *this ).swap( *this ); - } - - virtual const GLvoid* getDataPointer() const { if (!this->empty()) return &this->front(); else return 0; } - virtual unsigned int getTotalDataSize() const { return static_cast(this->size()*sizeof(T)); } - virtual unsigned int getNumElements() const { return static_cast(this->size()); } - - virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } - - typedef T ElementDataType; // expose T - - protected: - - virtual ~TemplateIndexArray() {} -}; - -typedef TemplateIndexArray ByteArray; -typedef TemplateIndexArray ShortArray; -typedef TemplateIndexArray IntArray; -typedef TemplateIndexArray UByteArray; -typedef TemplateIndexArray UShortArray; -typedef TemplateIndexArray UIntArray; - -typedef TemplateArray FloatArray; - -typedef TemplateArray Vec2Array; -typedef TemplateArray Vec3Array; -typedef TemplateArray Vec4Array; - -typedef TemplateArray Vec4ubArray; - -typedef TemplateArray Vec2sArray; -typedef TemplateArray Vec3sArray; -typedef TemplateArray Vec4sArray; - -typedef TemplateArray Vec2bArray; -typedef TemplateArray Vec3bArray; -typedef TemplateArray Vec4bArray; - -typedef TemplateArray DoubleArray; -typedef TemplateArray Vec2dArray; -typedef TemplateArray Vec3dArray; -typedef TemplateArray Vec4dArray; - -typedef TemplateArray MatrixfArray; - - -class ArrayVisitor -{ - public: - ArrayVisitor() {} - virtual ~ArrayVisitor() {} - - virtual void apply(Array&) {} - virtual void apply(ByteArray&) {} - virtual void apply(ShortArray&) {} - virtual void apply(IntArray&) {} - virtual void apply(UByteArray&) {} - virtual void apply(UShortArray&) {} - virtual void apply(UIntArray&) {} - virtual void apply(FloatArray&) {} - virtual void apply(DoubleArray&) {} - - virtual void apply(Vec2Array&) {} - virtual void apply(Vec3Array&) {} - virtual void apply(Vec4Array&) {} - - virtual void apply(Vec4ubArray&) {} - - virtual void apply(Vec2bArray&) {} - virtual void apply(Vec3bArray&) {} - virtual void apply(Vec4bArray&) {} - - virtual void apply(Vec2sArray&) {} - virtual void apply(Vec3sArray&) {} - virtual void apply(Vec4sArray&) {} - - virtual void apply(Vec2dArray&) {} - virtual void apply(Vec3dArray&) {} - virtual void apply(Vec4dArray&) {} - - virtual void apply(MatrixfArray&) {} -}; - -class ConstArrayVisitor -{ - public: - ConstArrayVisitor() {} - virtual ~ConstArrayVisitor() {} - - virtual void apply(const Array&) {} - virtual void apply(const ByteArray&) {} - virtual void apply(const ShortArray&) {} - virtual void apply(const IntArray&) {} - virtual void apply(const UByteArray&) {} - virtual void apply(const UShortArray&) {} - virtual void apply(const UIntArray&) {} - virtual void apply(const FloatArray&) {} - virtual void apply(const DoubleArray&) {} - - virtual void apply(const Vec2Array&) {} - virtual void apply(const Vec3Array&) {} - virtual void apply(const Vec4Array&) {} - - virtual void apply(const Vec4ubArray&) {} - - virtual void apply(const Vec2bArray&) {} - virtual void apply(const Vec3bArray&) {} - virtual void apply(const Vec4bArray&) {} - - virtual void apply(const Vec2sArray&) {} - virtual void apply(const Vec3sArray&) {} - virtual void apply(const Vec4sArray&) {} - - virtual void apply(const Vec2dArray&) {} - virtual void apply(const Vec3dArray&) {} - virtual void apply(const Vec4dArray&) {} - - virtual void apply(const MatrixfArray&) {} -}; - - -class ValueVisitor -{ - public: - ValueVisitor() {} - virtual ~ValueVisitor() {} - - virtual void apply(GLbyte&) {} - virtual void apply(GLshort&) {} - virtual void apply(GLint&) {} - virtual void apply(GLushort&) {} - virtual void apply(GLubyte&) {} - virtual void apply(GLuint&) {} - virtual void apply(GLfloat&) {} - virtual void apply(GLdouble&) {} - - - virtual void apply(Vec2&) {} - virtual void apply(Vec3&) {} - virtual void apply(Vec4&) {} - - virtual void apply(Vec4ub&) {} - - virtual void apply(Vec2b&) {} - virtual void apply(Vec3b&) {} - virtual void apply(Vec4b&) {} - - virtual void apply(Vec2s&) {} - virtual void apply(Vec3s&) {} - virtual void apply(Vec4s&) {} - - virtual void apply(Vec2d&) {} - virtual void apply(Vec3d&) {} - virtual void apply(Vec4d&) {} - - virtual void apply(Matrixf&) {} -}; - -class ConstValueVisitor -{ - public: - ConstValueVisitor() {} - virtual ~ConstValueVisitor() {} - - virtual void apply(const GLbyte&) {} - virtual void apply(const GLshort&) {} - virtual void apply(const GLint&) {} - virtual void apply(const GLushort&) {} - virtual void apply(const GLubyte&) {} - virtual void apply(const GLuint&) {} - virtual void apply(const GLfloat&) {} - virtual void apply(const GLdouble&) {} - - virtual void apply(const Vec4ub&) {} - - virtual void apply(const Vec2&) {} - virtual void apply(const Vec3&) {} - virtual void apply(const Vec4&) {} - - virtual void apply(const Vec2b&) {} - virtual void apply(const Vec3b&) {} - virtual void apply(const Vec4b&) {} - - virtual void apply(const Vec2s&) {} - virtual void apply(const Vec3s&) {} - virtual void apply(const Vec4s&) {} - - virtual void apply(const Vec2d&) {} - virtual void apply(const Vec3d&) {} - virtual void apply(const Vec4d&) {} - - virtual void apply(const Matrixf&) {} -}; - -template -inline void TemplateArray::accept(ArrayVisitor& av) { av.apply(*this); } - -template -inline void TemplateArray::accept(ConstArrayVisitor& av) const { av.apply(*this); } - -template -inline void TemplateArray::accept(unsigned int index,ValueVisitor& vv) { vv.apply( (*this)[index] ); } - -template -inline void TemplateArray::accept(unsigned int index,ConstValueVisitor& vv) const { vv.apply( (*this)[index] );} - -template -inline void TemplateIndexArray::accept(ArrayVisitor& av) { av.apply(*this); } - -template -inline void TemplateIndexArray::accept(ConstArrayVisitor& av) const { av.apply(*this); } - -template -inline void TemplateIndexArray::accept(unsigned int index,ValueVisitor& vv) { vv.apply( (*this)[index] ); } - -template -inline void TemplateIndexArray::accept(unsigned int index,ConstValueVisitor& vv) const { vv.apply( (*this)[index] );} - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ArrayDispatchers b/libs/lib/mac32/include/osg/ArrayDispatchers deleted file mode 100644 index d2c0505f11b083781a63b9ec6b51ec76a6f5980c..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ArrayDispatchers +++ /dev/null @@ -1,138 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_ArrayDispatchers -#define OSG_ArrayDispatchers 1 - -#include -#include -#include -#include - -namespace osg { - -// forward declare -class State; -class AttributeDispatchMap; - -struct AttributeDispatch : public osg::Referenced -{ - virtual void assign(const GLvoid*, const IndexArray*) {} - virtual void operator() (unsigned int) {}; -}; - -/** Helper class for managing the dispatch to OpenGL of various attribute arrays such as stored in osg::Geometry.*/ -class OSG_EXPORT ArrayDispatchers : public osg::Referenced -{ - public: - - ArrayDispatchers(); - ~ArrayDispatchers(); - - void setState(osg::State* state); - - AttributeDispatch* vertexDispatcher(Array* array, IndexArray* indices); - AttributeDispatch* normalDispatcher(Array* array, IndexArray* indices); - AttributeDispatch* colorDispatcher(Array* array, IndexArray* indices); - AttributeDispatch* secondaryColorDispatcher(Array* array, IndexArray* indices); - AttributeDispatch* fogCoordDispatcher(Array* array, IndexArray* indices); - AttributeDispatch* texCoordDispatcher(unsigned int unit, Array* array, IndexArray* indices); - AttributeDispatch* vertexAttribDispatcher(unsigned int unit, Array* array, IndexArray* indices); - - void reset(); - - void setUseGLBeginEndAdapter(bool flag) { _useGLBeginEndAdapter = flag; } - bool getUseGLBeginEndAdapter() const { return _useGLBeginEndAdapter; } - - void setUseVertexAttribAlias(bool flag) { _useVertexAttribAlias = flag; } - bool getUseVertexAttribAlias() const { return _useVertexAttribAlias; } - - void activate(unsigned int binding, AttributeDispatch* at) - { - if (at) _activeDispatchList[binding].push_back(at); - } - - void activateVertexArray(unsigned int binding, osg::Array* array, osg::IndexArray* indices) { if (binding && array) activate(binding, vertexDispatcher(array, indices)); } - void activateColorArray(unsigned int binding, osg::Array* array, osg::IndexArray* indices) { if (binding && array) activate(binding, colorDispatcher(array, indices)); } - void activateNormalArray(unsigned int binding, osg::Array* array, osg::IndexArray* indices) { if (binding && array) activate(binding, normalDispatcher(array, indices)); } - void activateSecondaryColorArray(unsigned int binding, osg::Array* array, osg::IndexArray* indices) { if (binding && array) activate(binding, secondaryColorDispatcher(array, indices)); } - void activateFogCoordArray(unsigned int binding, osg::Array* array, osg::IndexArray* indices) { if (binding && array) activate(binding, fogCoordDispatcher(array, indices)); } - void activateTexCoordArray(unsigned int binding, unsigned int unit, osg::Array* array, osg::IndexArray* indices) { if (binding && array) activate(binding, texCoordDispatcher(unit, array, indices)); } - void activateVertexAttribArray(unsigned int binding, unsigned int unit, osg::Array* array, osg::IndexArray* indices) { if (binding && array) activate(binding, vertexAttribDispatcher(unit, array, indices)); } - - void dispatch(unsigned int binding, unsigned int index) - { - AttributeDispatchList& ad = _activeDispatchList[binding]; - for(AttributeDispatchList::iterator itr = ad.begin(); - itr != ad.end(); - ++itr) - { - (*(*itr))(index); - } - } - - bool active(unsigned int binding) const { return !_activeDispatchList[binding].empty(); } - - void Begin(GLenum mode) - { -#ifdef OSG_GL1_AVAILABLE - if (_useGLBeginEndAdapter) _glBeginEndAdapter->Begin(mode); - else ::glBegin(mode); -#else - _glBeginEndAdapter->Begin(mode); -#endif - } - - void End() - { -#ifdef OSG_GL1_AVAILABLE - if (_useGLBeginEndAdapter) _glBeginEndAdapter->End(); - else ::glEnd(); -#else - _glBeginEndAdapter->End(); -#endif - } - - protected: - - void init(); - - void assignTexCoordDispatchers(unsigned int unit); - void assignVertexAttribDispatchers(unsigned int unit); - - bool _initialized; - State* _state; - GLBeginEndAdapter* _glBeginEndAdapter; - - AttributeDispatchMap* _vertexDispatchers; - AttributeDispatchMap* _normalDispatchers; - AttributeDispatchMap* _colorDispatchers; - AttributeDispatchMap* _secondaryColorDispatchers; - AttributeDispatchMap* _fogCoordDispatchers; - - typedef std::vector AttributeDispatchMapList; - AttributeDispatchMapList _texCoordDispatchers; - AttributeDispatchMapList _vertexAttribDispatchers; - - typedef std::vector AttributeDispatchList; - - typedef std::vector ActiveDispatchList; - ActiveDispatchList _activeDispatchList; - - bool _useVertexAttribAlias; - bool _useGLBeginEndAdapter; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/AudioStream b/libs/lib/mac32/include/osg/AudioStream deleted file mode 100644 index a9d5c124baf80e2c32e88b936971b99845a0e9a7..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/AudioStream +++ /dev/null @@ -1,86 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_AUDIOSTREAM -#define OSG_AUDIOSTREAM 1 - -#include -#include - -namespace osg { - -/** Pure virtual AudioSink bass class that is used to connect the audio system with AudioStreams. */ -class OSG_EXPORT AudioSink : public osg::Object -{ -public: - - AudioSink(); - - virtual const char * libraryName() const { return "osg"; } - virtual const char * className() const { return "AudioSinkInterface"; } - - virtual void play() = 0; - virtual void pause() = 0; - virtual void stop() = 0; - - virtual bool playing() const = 0; - - virtual double getDelay() const { return _delay; } - virtual void setDelay(const double delay) { _delay = delay; } - - virtual void setVolume(float) {} - virtual float getVolume() const { return 0.0f; } - -private: - - virtual AudioSink * cloneType() const { return 0; } - virtual AudioSink * clone(const osg::CopyOp &) const { return 0; } - - double _delay; -}; - -/** Pure virtual AudioStream base class. Subclasses provide mechanism for reading/generating audio data*/ -class OSG_EXPORT AudioStream : public osg::Object -{ - public: - AudioStream(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - AudioStream(const AudioStream& audio,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=0; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "AudioStream"; } - - virtual void setAudioSink(osg::AudioSink* audio_sink) = 0; - - virtual void consumeAudioBuffer(void * const buffer, const size_t size) = 0; - - virtual int audioFrequency() const = 0; - virtual int audioNbChannels() const = 0; - - enum SampleFormat - { - SAMPLE_FORMAT_U8, - SAMPLE_FORMAT_S16, - SAMPLE_FORMAT_S24, - SAMPLE_FORMAT_S32, - SAMPLE_FORMAT_F32 - }; - - virtual SampleFormat audioSampleFormat() const = 0; -}; - -} // namespace - -#endif diff --git a/libs/lib/mac32/include/osg/AutoTransform b/libs/lib/mac32/include/osg/AutoTransform deleted file mode 100644 index efa0f65e5cd9b54faf2f7f042455af72ba2a6b22..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/AutoTransform +++ /dev/null @@ -1,161 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_AUTOTRANSFORM -#define OSG_AUTOTRANSFORM 1 - -#include -#include -#include -#include - -namespace osg { - -/** AutoTransform is a derived form of Transform that automatically - * scales or rotates to keep its children aligned with screen coordinates. -*/ -class OSG_EXPORT AutoTransform : public Transform -{ - public : - AutoTransform(); - - AutoTransform(const AutoTransform& pat,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual osg::Object* cloneType() const { return new AutoTransform (); } - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new AutoTransform (*this,copyop); } - virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* className() const { return "AutoTransform"; } - virtual const char* libraryName() const { return "osg"; } - - virtual void accept(NodeVisitor& nv); - - virtual AutoTransform* asAutoTransform() { return this; } - virtual const AutoTransform* asAutoTransform() const { return this; } - - inline void setPosition(const Vec3d& pos) { _position = pos; _matrixDirty=true; dirtyBound(); } - inline const Vec3d& getPosition() const { return _position; } - - - inline void setRotation(const Quat& quat) { _rotation = quat; _matrixDirty=true; dirtyBound(); } - inline const Quat& getRotation() const { return _rotation; } - - inline void setScale(double scale) { setScale(osg::Vec3(scale,scale,scale)); } - - void setScale(const Vec3d& scale); - inline const Vec3d& getScale() const { return _scale; } - - void setMinimumScale(double minimumScale) { _minimumScale = minimumScale; } - double getMinimumScale() const { return _minimumScale; } - - void setMaximumScale(double maximumScale) { _maximumScale = maximumScale; } - double getMaximumScale() const { return _maximumScale; } - - inline void setPivotPoint(const Vec3d& pivot) { _pivotPoint = pivot; _matrixDirty=true; dirtyBound(); } - inline const Vec3d& getPivotPoint() const { return _pivotPoint; } - - - void setAutoUpdateEyeMovementTolerance(float tolerance) { _autoUpdateEyeMovementTolerance = tolerance; } - float getAutoUpdateEyeMovementTolerance() const { return _autoUpdateEyeMovementTolerance; } - - - enum AutoRotateMode - { - NO_ROTATION, - ROTATE_TO_SCREEN, - ROTATE_TO_CAMERA, - ROTATE_TO_AXIS - }; - - void setAutoRotateMode(AutoRotateMode mode); - - AutoRotateMode getAutoRotateMode() const { return _autoRotateMode; } - - /** Set the rotation axis for the AutoTransform's child nodes. - * Only utilized when _autoRotateMode==ROTATE_TO_AXIS. */ - void setAxis(const Vec3& axis); - /** Get the rotation axis. */ - inline const Vec3& getAxis() const { return _axis; } - - /** This normal defines child Nodes' front face direction when unrotated. */ - void setNormal(const Vec3& normal); - /** Get the front face direction normal. */ - inline const Vec3& getNormal() const { return _normal; } - - void setAutoScaleToScreen(bool autoScaleToScreen) { _autoScaleToScreen = autoScaleToScreen; _matrixDirty=true; } - - bool getAutoScaleToScreen() const { return _autoScaleToScreen; } - - void setAutoScaleTransitionWidthRatio(float ratio) { _autoScaleTransitionWidthRatio = ratio; } - float getAutoScaleTransitionWidthRatio() const { return _autoScaleTransitionWidthRatio; } - - - virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const; - - virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const; - - virtual BoundingSphere computeBound() const; - - - protected : - - virtual ~AutoTransform() {} - - Vec3d _position; - Vec3d _pivotPoint; - double _autoUpdateEyeMovementTolerance; - - AutoRotateMode _autoRotateMode; - - bool _autoScaleToScreen; - - mutable Quat _rotation; - mutable Vec3d _scale; - mutable bool _firstTimeToInitEyePoint; - mutable osg::Vec3 _previousEyePoint; - mutable osg::Vec3 _previousLocalUp; - mutable Viewport::value_type _previousWidth; - mutable Viewport::value_type _previousHeight; - mutable osg::Matrixd _previousProjection; - mutable osg::Vec3d _previousPosition; - - double _minimumScale; - double _maximumScale; - double _autoScaleTransitionWidthRatio; - - void computeMatrix() const; - - mutable bool _matrixDirty; - mutable osg::Matrixd _cachedMatrix; - - enum AxisAligned - { - AXIAL_ROT_X_AXIS=ROTATE_TO_AXIS+1, - AXIAL_ROT_Y_AXIS, - AXIAL_ROT_Z_AXIS, - CACHE_DIRTY - }; - - Vec3 _axis; - Vec3 _normal; - - // used internally as cache of which what _axis is aligned to help - // decide which method of rotation to use. - int _cachedMode; - Vec3 _side; - void updateCache(); - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Billboard b/libs/lib/mac32/include/osg/Billboard deleted file mode 100644 index dcec5d935bb0a9117cdb3cfc2d5ee2ab779ebdbc..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Billboard +++ /dev/null @@ -1,132 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BILLBOARD -#define OSG_BILLBOARD 1 - -#include -#include - -namespace osg { - -/** Billboard is a derived form of Geode that orients its osg::Drawable - * children to face the eye point. Typical uses include trees and - * particle explosions, -*/ -class OSG_EXPORT Billboard : public Geode -{ - public: - - enum Mode { - POINT_ROT_EYE, - POINT_ROT_WORLD, - AXIAL_ROT - }; - - Billboard(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - Billboard(const Billboard&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, Billboard); - - /** Set the billboard rotation mode. */ - void setMode(Mode mode); - /** Get the billboard rotation mode. */ - inline Mode getMode() const { return _mode; } - - /** Set the rotation axis for the billboard's child Drawables. - * Only utilized when mode==AXIAL_ROT. */ - void setAxis(const Vec3& axis); - /** Get the rotation axis. */ - inline const Vec3& getAxis() const { return _axis; } - - /** This normal defines child Drawables' front face direction when unrotated. */ - void setNormal(const Vec3& normal); - /** Get the front face direction normal. */ - inline const Vec3& getNormal() const { return _normal; } - - - /** Set the specified child Drawable's position. */ - inline void setPosition(unsigned int i,const Vec3& pos) { _positionList[i] = pos; } - /** Get the specified child Drawable's position. */ - inline const Vec3& getPosition(unsigned int i) const { return _positionList[i]; } - - /** Type definition for pivot point position list. */ - typedef std::vector PositionList; - - /** Set the list of pivot point positions. */ - inline void setPositionList(PositionList& pl) { _positionList=pl; } - - /** Get the list of pivot point positions. */ - inline PositionList& getPositionList() { return _positionList; } - - /** Get a const list of pivot point positions. */ - inline const PositionList& getPositionList() const { return _positionList; } - - /** Add a Drawable with a default position of Vec3(0,0,0). - * Call the base-class Geode::addDrawble() to add the given Drawable - * gset as a child. If Geode::addDrawable() returns true, add the - * default position to the pivot point position list and return true. - * Otherwise, return false. */ - virtual bool addDrawable( Drawable *gset ); - - /** Add a Drawable with a specified position. - * Call the base-class Geode::addDrawble() to add the given Drawable - * gset as a child. If Geode::addDrawable() returns true, add the - * given position pos to the pivot point position list and return true. - * Otherwise, return false. */ - virtual bool addDrawable(Drawable *gset,const Vec3& pos); - - /** Remove a Drawable and its associated position. - * If gset is a child, remove it, decrement its reference count, - * remove its pivot point position. and return true. - * Otherwise, return false. */ - virtual bool removeDrawable( Drawable *gset ); - - - bool computeMatrix(Matrix& modelview, const Vec3& eye_local, const Vec3& pos_local) const; - - virtual BoundingSphere computeBound() const; - - protected: - - virtual ~Billboard(); - - enum AxisAligned - { - AXIAL_ROT_X_AXIS=AXIAL_ROT+1, - AXIAL_ROT_Y_AXIS, - AXIAL_ROT_Z_AXIS, - POINT_ROT_WORLD_Z_AXIS, - CACHE_DIRTY - }; - - - Mode _mode; - Vec3 _axis; - Vec3 _normal; - Matrix _rotateNormalToZAxis; - PositionList _positionList; - - // used internally as cache of which what _axis is aligned to help - // decide which method of rotation to use. - int _cachedMode; - Vec3 _side; - void updateCache(); - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/BlendColor b/libs/lib/mac32/include/osg/BlendColor deleted file mode 100644 index 3670a6065ce88f9dc2e14edc5ee3d5ce3e8869d4..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/BlendColor +++ /dev/null @@ -1,125 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BLENDCOLOR -#define OSG_BLENDCOLOR 1 - -#include -#include -#include -#include - - - -namespace osg { - -/** Encapsulates OpenGL blend/transparency state. */ -class OSG_EXPORT BlendColor : public StateAttribute -{ - public : - - BlendColor(); - - BlendColor(const osg::Vec4& constantColor); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - BlendColor(const BlendColor& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(trans,copyop), - _constantColor(trans._constantColor) {} - - META_StateAttribute(osg, BlendColor,BLENDCOLOR); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(BlendColor,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_constantColor) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_BLEND); - return true; - } - - void setConstantColor(const osg::Vec4& color) { _constantColor = color; } - - inline osg::Vec4& getConstantColor() { return _constantColor; } - - inline const osg::Vec4& getConstantColor() const { return _constantColor; } - - virtual void apply(State& state) const; - - - - - /** Encapsulates queries of extension availability, obtains extension - * function pointers, and provides convenience wrappers for - * calling extension functions. */ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - void setBlendColorSupported(bool flag) { _isBlendColorSupported=flag; } - bool isBlendColorSupported() const { return _isBlendColorSupported; } - - void glBlendColor(GLclampf red , GLclampf green , GLclampf blue , GLclampf alpha) const; - - protected: - - ~Extensions() {} - - - typedef void (GL_APIENTRY * GLBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - bool _isBlendColorSupported; - GLBlendColorProc _glBlendColor; - - }; - - /** Returns the Extensions object for the given context. - * If createIfNotInitalized is true and the Extensions object doesn't - * exist, getExtensions() creates it on the given context. - * Returns NULL if createIfNotInitalized is false and the Extensions - * object doesn't exist. */ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions() allows users to override the extensions across graphics contexts. - * Typically used when you have different extensions supported across graphics pipes, - * but need to ensure that they all use the same low common denominator extensions. */ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - - - protected : - - virtual ~BlendColor(); - - osg::Vec4 _constantColor; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/BlendEquation b/libs/lib/mac32/include/osg/BlendEquation deleted file mode 100644 index de4ab4fe925ae5ea082d9641b79dcd84fe2610cd..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/BlendEquation +++ /dev/null @@ -1,161 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BLENDEQUATION -#define OSG_BLENDEQUATION 1 - -#include - -#ifndef GL_VERSION_1_2 -/* Logic Ops */ -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#endif - -#ifndef GL_LOGIC_OP -#define GL_LOGIC_OP 0x0BF1 -#endif - -#ifndef GL_ALPHA_MIN_SGIX -#define GL_ALPHA_MIN_SGIX 0x8320 -#define GL_ALPHA_MAX_SGIX 0x8321 -#endif - -namespace osg { - -/** Encapsulates OpenGL BlendEquation state. */ -class OSG_EXPORT BlendEquation : public StateAttribute -{ - public : - - enum Equation { - RGBA_MIN = GL_MIN, - RGBA_MAX = GL_MAX, - ALPHA_MIN = GL_ALPHA_MIN_SGIX, - ALPHA_MAX = GL_ALPHA_MAX_SGIX, - LOGIC_OP = GL_LOGIC_OP, - FUNC_ADD = GL_FUNC_ADD, - FUNC_SUBTRACT = GL_FUNC_SUBTRACT, - FUNC_REVERSE_SUBTRACT = GL_FUNC_REVERSE_SUBTRACT - }; - - BlendEquation(); - - BlendEquation(Equation equation); - - BlendEquation(Equation equationRGB, Equation equationAlpha); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - BlendEquation(const BlendEquation& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(trans,copyop), - _equationRGB(trans._equationRGB), - _equationAlpha(trans._equationAlpha){} - - META_StateAttribute(osg, BlendEquation,BLENDEQUATION); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(BlendEquation,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_equationRGB) - COMPARE_StateAttribute_Parameter(_equationAlpha) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_BLEND); - return true; - } - - - inline void setEquation(Equation equation) { _equationRGB = _equationAlpha = equation; } - inline Equation getEquation() const { return _equationRGB; } - - inline void setEquationRGB(Equation equation) { _equationRGB = equation; } - inline Equation getEquationRGB() const { return _equationRGB; } - - inline void setEquationAlpha(Equation equation) { _equationAlpha = equation; } - inline Equation getEquationAlpha() const { return _equationAlpha; } - - virtual void apply(State& state) const; - /** Encapsulates queries of extension availability, obtains extension - * function pointers, and provides convenience wrappers for - * calling extension functions. */ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - bool isBlendEquationSupported() const { return _isBlendEquationSupported; } - bool isBlendEquationSeparateSupported() const { return _isBlendEquationSeparateSupported; } - bool isSGIXMinMaxSupported() const { return _isSGIXMinMaxSupported; } - bool isLogicOpSupported() const { return _isLogicOpSupported; } - - void glBlendEquation(GLenum mode) const; - void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) const; - - protected: - - ~Extensions() {} - - typedef void (GL_APIENTRY * GLBlendEquationProc)(GLenum mode); - typedef void (GL_APIENTRY * GLBlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha); - - bool _isBlendEquationSupported; - bool _isBlendEquationSeparateSupported; - bool _isSGIXMinMaxSupported; - bool _isLogicOpSupported; - - GLBlendEquationProc _glBlendEquation; - GLBlendEquationSeparateProc _glBlendEquationSeparate; - }; - - /** Returns the Extensions object for the given context. - * If createIfNotInitalized is true and the Extensions object doesn't - * exist, getExtensions() creates it on the given context. - * Returns NULL if createIfNotInitalized is false and the Extensions - * object doesn't exist. */ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions() allows users to override the extensions across graphics contexts. - * Typically used when you have different extensions supported across graphics pipes, - * but need to ensure that they all use the same low common denominator extensions. */ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - - protected : - - virtual ~BlendEquation(); - - - Equation _equationRGB, _equationAlpha; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/BlendFunc b/libs/lib/mac32/include/osg/BlendFunc deleted file mode 100644 index 4b75e310ccd7f1141c37c47f2db1045183d95b25..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/BlendFunc +++ /dev/null @@ -1,221 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BLENDFUNC -#define OSG_BLENDFUNC 1 - -#include - - -#ifndef GL_VERSION_1_2 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#endif - -#ifndef GL_VERSION_1_4 -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#endif - - -namespace osg { - -/** Encapsulates OpenGL blend/transparency state. - * - * Blending combines incoming fragment with a fragment - * already present in the target buffer. - * - * OpenGL 1.1 supports following source and destination blending factors: - * GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, - * GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, - * GL_ZERO, GL_ONE. - * - * Moreover, there are three source-only blending factors: - * GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA_SATURATE - * and two destination-only blending factors: - * GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR. - * OpenGL 1.4 allowed to use these five blending factors - * as both - source and destination blending factors. - * - * Following four source and destination blending factors - * were added by Imaging subset of OpenGL 1.2 - * and made mandatory by OpenGL 1.4: - * GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, - * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA - * - * OpenGL 1.4 further provides glBlendFuncSeparate - * (promoted from GL_EXT_blend_func_separate). - * It makes possible to set blending functions for RGB and Alpha separately. - * Before, it was possible to set just one blending function for RGBA. - */ -class OSG_EXPORT BlendFunc : public StateAttribute -{ - public : - - BlendFunc(); - - BlendFunc(GLenum source, GLenum destination); - BlendFunc(GLenum source, GLenum destination, GLenum source_alpha, GLenum destination_alpha); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - BlendFunc(const BlendFunc& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(trans,copyop), - _source_factor(trans._source_factor), - _destination_factor(trans._destination_factor), - _source_factor_alpha(trans._source_factor_alpha), - _destination_factor_alpha(trans._destination_factor_alpha) {} - - META_StateAttribute(osg, BlendFunc,BLENDFUNC); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(BlendFunc,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_source_factor) - COMPARE_StateAttribute_Parameter(_destination_factor) - COMPARE_StateAttribute_Parameter(_source_factor_alpha) - COMPARE_StateAttribute_Parameter(_destination_factor_alpha) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_BLEND); - return true; - } - - enum BlendFuncMode { - DST_ALPHA = GL_DST_ALPHA, - DST_COLOR = GL_DST_COLOR, - ONE = GL_ONE, - ONE_MINUS_DST_ALPHA = GL_ONE_MINUS_DST_ALPHA, - ONE_MINUS_DST_COLOR = GL_ONE_MINUS_DST_COLOR, - ONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA, - ONE_MINUS_SRC_COLOR = GL_ONE_MINUS_SRC_COLOR, - SRC_ALPHA = GL_SRC_ALPHA, - SRC_ALPHA_SATURATE = GL_SRC_ALPHA_SATURATE, - SRC_COLOR = GL_SRC_COLOR, - CONSTANT_COLOR = GL_CONSTANT_COLOR, - ONE_MINUS_CONSTANT_COLOR = GL_ONE_MINUS_CONSTANT_COLOR, - CONSTANT_ALPHA = GL_CONSTANT_ALPHA, - ONE_MINUS_CONSTANT_ALPHA = GL_ONE_MINUS_CONSTANT_ALPHA, - ZERO = GL_ZERO - }; - - inline void setFunction( GLenum source, GLenum destination ) - { - _source_factor = source; - _destination_factor = destination; - _source_factor_alpha = source; - _destination_factor_alpha = destination; - } - - inline void setFunction( GLenum source_rgb, GLenum destination_rgb, GLenum source_alpha, GLenum destination_alpha ) - { - _source_factor = source_rgb; - _destination_factor = destination_rgb; - _source_factor_alpha = source_alpha; - _destination_factor_alpha = destination_alpha; - } - - void setSource(GLenum source) { _source_factor = _source_factor_alpha = source; } - inline GLenum getSource() const { return _source_factor; } - - void setSourceRGB(GLenum source) { _source_factor = source; } - inline GLenum getSourceRGB() const { return _source_factor; } - - void setSourceAlpha(GLenum source) { _source_factor_alpha = source; } - inline GLenum getSourceAlpha() const { return _source_factor_alpha; } - - void setDestination(GLenum destination) { _destination_factor = _destination_factor_alpha = destination; } - inline GLenum getDestination() const { return _destination_factor; } - - void setDestinationRGB(GLenum destination) { _destination_factor = destination; } - inline GLenum getDestinationRGB() const { return _destination_factor; } - - void setDestinationAlpha(GLenum destination) { _destination_factor_alpha = destination; } - inline GLenum getDestinationAlpha() const { return _destination_factor_alpha; } - - virtual void apply(State& state) const; - /** Encapsulates queries of extension availability, obtains extension - * function pointers, and provides convenience wrappers for - * calling extension functions. */ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - void setBlendFuncSeparateSupported(bool flag) { _isBlendFuncSeparateSupported=flag; } - bool isBlendFuncSeparateSupported() const { return _isBlendFuncSeparateSupported; } - - void glBlendFuncSeparate(GLenum sfactorRGB, - GLenum dfactorRGB, - GLenum sfactorAlpha, - GLenum dfactorAlpha) const; - - protected: - - ~Extensions() {} - - - typedef void (GL_APIENTRY * GLBlendFuncSeparateProc) (GLenum sfactorRGB, - GLenum dfactorRGB, - GLenum sfactorAlpha, - GLenum dfactorAlpha); - bool _isBlendFuncSeparateSupported; - GLBlendFuncSeparateProc _glBlendFuncSeparate; - - }; - - /** Returns the Extensions object for the given context. - * If createIfNotInitalized is true and the Extensions object doesn't - * exist, getExtensions() creates it on the given context. - * Returns NULL if createIfNotInitalized is false and the Extensions - * object doesn't exist. */ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions() allows users to override the extensions across graphics contexts. - * Typically used when you have different extensions supported across graphics pipes, - * but need to ensure that they all use the same low common denominator extensions. */ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - - protected : - - virtual ~BlendFunc(); - - GLenum _source_factor; - GLenum _destination_factor; - GLenum _source_factor_alpha; - GLenum _destination_factor_alpha; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/BoundingBox b/libs/lib/mac32/include/osg/BoundingBox deleted file mode 100644 index da52b10dd120d62eccb860f4a198e7ba0c431b22..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/BoundingBox +++ /dev/null @@ -1,243 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BOUNDINGBOX -#define OSG_BOUNDINGBOX 1 - -#include -#include -#include -#include -#include - -namespace osg { - -template -class BoundingSphereImpl; - -/** General purpose axis-aligned bounding box class for enclosing objects/vertices. - * Bounds leaf objects in a scene such as osg::Drawable objects. Used for frustum - * culling etc. -*/ -template -class BoundingBoxImpl -{ - public: - typedef VT vec_type; - typedef typename VT::value_type value_type; - - /** Minimum extent. (Smallest X, Y, and Z values of all coordinates.) */ - vec_type _min; - /** Maximum extent. (Greatest X, Y, and Z values of all coordinates.) */ - vec_type _max; - - /** Creates an uninitialized bounding box. */ - inline BoundingBoxImpl() : - _min(FLT_MAX, - FLT_MAX, - FLT_MAX), - _max(-FLT_MAX, - -FLT_MAX, - -FLT_MAX) - {} - - /** Creates a bounding box initialized to the given extents. */ - inline BoundingBoxImpl(value_type xmin, value_type ymin, value_type zmin, - value_type xmax, value_type ymax, value_type zmax) : - _min(xmin,ymin,zmin), - _max(xmax,ymax,zmax) {} - - /** Creates a bounding box initialized to the given extents. */ - inline BoundingBoxImpl(const vec_type& min,const vec_type& max) : - _min(min), - _max(max) {} - - /** Clear the bounding box. Erases existing minimum and maximum extents. */ - inline void init() - { - _min.set(FLT_MAX, - FLT_MAX, - FLT_MAX); - _max.set(-FLT_MAX, - -FLT_MAX, - -FLT_MAX); - } - - /** Returns true if the bounding box extents are valid, false otherwise. */ - inline bool valid() const - { - return _max.x()>=_min.x() && _max.y()>=_min.y() && _max.z()>=_min.z(); - } - - /** Sets the bounding box extents. */ - inline void set (value_type xmin, value_type ymin, value_type zmin, - value_type xmax, value_type ymax, value_type zmax) - { - _min.set(xmin,ymin,zmin); - _max.set(xmax,ymax,zmax); - } - - /** Sets the bounding box extents. */ - inline void set(const vec_type& min,const vec_type& max) - { - _min = min; - _max = max; - } - - - inline value_type& xMin() { return _min.x(); } - inline value_type xMin() const { return _min.x(); } - - inline value_type& yMin() { return _min.y(); } - inline value_type yMin() const { return _min.y(); } - - inline value_type& zMin() { return _min.z(); } - inline value_type zMin() const { return _min.z(); } - - inline value_type& xMax() { return _max.x(); } - inline value_type xMax() const { return _max.x(); } - - inline value_type& yMax() { return _max.y(); } - inline value_type yMax() const { return _max.y(); } - - inline value_type& zMax() { return _max.z(); } - inline value_type zMax() const { return _max.z(); } - - /** Calculates and returns the bounding box center. */ - inline const vec_type center() const - { - return (_min+_max)*0.5; - } - - /** Calculates and returns the bounding box radius. */ - inline value_type radius() const - { - return sqrt(radius2()); - } - - /** Calculates and returns the squared length of the bounding box radius. - * Note, radius2() is faster to calculate than radius(). */ - inline value_type radius2() const - { - return 0.25*((_max-_min).length2()); - } - - /** Returns a specific corner of the bounding box. - * pos specifies the corner as a number between 0 and 7. - * Each bit selects an axis, X, Y, or Z from least- to - * most-significant. Unset bits select the minimum value - * for that axis, and set bits select the maximum. */ - inline const vec_type corner(unsigned int pos) const - { - return vec_type(pos&1?_max.x():_min.x(),pos&2?_max.y():_min.y(),pos&4?_max.z():_min.z()); - } - - /** Expands the bounding box to include the given coordinate. - * If the box is uninitialized, set its min and max extents to v. */ - inline void expandBy(const vec_type& v) - { - if(v.x()<_min.x()) _min.x() = v.x(); - if(v.x()>_max.x()) _max.x() = v.x(); - - if(v.y()<_min.y()) _min.y() = v.y(); - if(v.y()>_max.y()) _max.y() = v.y(); - - if(v.z()<_min.z()) _min.z() = v.z(); - if(v.z()>_max.z()) _max.z() = v.z(); - } - - /** Expands the bounding box to include the given coordinate. - * If the box is uninitialized, set its min and max extents to - * Vec3(x,y,z). */ - inline void expandBy(value_type x,value_type y,value_type z) - { - if(x<_min.x()) _min.x() = x; - if(x>_max.x()) _max.x() = x; - - if(y<_min.y()) _min.y() = y; - if(y>_max.y()) _max.y() = y; - - if(z<_min.z()) _min.z() = z; - if(z>_max.z()) _max.z() = z; - } - - /** Expands this bounding box to include the given bounding box. - * If this box is uninitialized, set it equal to bb. */ - void expandBy(const BoundingBoxImpl& bb) - { - if (!bb.valid()) return; - - if(bb._min.x()<_min.x()) _min.x() = bb._min.x(); - if(bb._max.x()>_max.x()) _max.x() = bb._max.x(); - - if(bb._min.y()<_min.y()) _min.y() = bb._min.y(); - if(bb._max.y()>_max.y()) _max.y() = bb._max.y(); - - if(bb._min.z()<_min.z()) _min.z() = bb._min.z(); - if(bb._max.z()>_max.z()) _max.z() = bb._max.z(); - } - - /** Expands this bounding box to include the given sphere. - * If this box is uninitialized, set it to include sh. */ - void expandBy(const BoundingSphereImpl& sh) - { - if (!sh.valid()) return; - - if(sh._center.x()-sh._radius<_min.x()) _min.x() = sh._center.x()-sh._radius; - if(sh._center.x()+sh._radius>_max.x()) _max.x() = sh._center.x()+sh._radius; - - if(sh._center.y()-sh._radius<_min.y()) _min.y() = sh._center.y()-sh._radius; - if(sh._center.y()+sh._radius>_max.y()) _max.y() = sh._center.y()+sh._radius; - - if(sh._center.z()-sh._radius<_min.z()) _min.z() = sh._center.z()-sh._radius; - if(sh._center.z()+sh._radius>_max.z()) _max.z() = sh._center.z()+sh._radius; - } - - - /** Returns the intersection of this bounding box and the specified bounding box. */ - BoundingBoxImpl intersect(const BoundingBoxImpl& bb) const - { return BoundingBoxImpl(osg::maximum(xMin(),bb.xMin()),osg::maximum(yMin(),bb.yMin()),osg::maximum(zMin(),bb.zMin()), - osg::minimum(xMax(),bb.xMax()),osg::minimum(yMax(),bb.yMax()),osg::minimum(zMax(),bb.zMax())); - - } - - /** Return true if this bounding box intersects the specified bounding box. */ - bool intersects(const BoundingBoxImpl& bb) const - { return osg::maximum(xMin(),bb.xMin()) <= osg::minimum(xMax(),bb.xMax()) && - osg::maximum(yMin(),bb.yMin()) <= osg::minimum(yMax(),bb.yMax()) && - osg::maximum(zMin(),bb.zMin()) <= osg::minimum(zMax(),bb.zMax()); - - } - - /** Returns true if this bounding box contains the specified coordinate. */ - inline bool contains(const vec_type& v) const - { - return valid() && - (v.x()>=_min.x() && v.x()<=_max.x()) && - (v.y()>=_min.y() && v.y()<=_max.y()) && - (v.z()>=_min.z() && v.z()<=_max.z()); - } -}; - -typedef BoundingBoxImpl BoundingBoxf; -typedef BoundingBoxImpl BoundingBoxd; - -#ifdef OSG_USE_FLOAT_BOUNDINGBOX -typedef BoundingBoxf BoundingBox; -#else -typedef BoundingBoxd BoundingBox; -#endif - -} - -#endif diff --git a/libs/lib/mac32/include/osg/BoundingSphere b/libs/lib/mac32/include/osg/BoundingSphere deleted file mode 100644 index b24a011fff1834ee47cfa060934d88c1581c4402..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/BoundingSphere +++ /dev/null @@ -1,306 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BOUNDINGSPHERE -#define OSG_BOUNDINGSPHERE 1 - -#include -#include -#include -#include - -namespace osg { - -template -class BoundingBoxImpl; - -/** General purpose bounding sphere class for enclosing nodes/objects/vertices. - * Bounds internal osg::Nodes in the scene, assists in view frustum culling, - * etc. Similar in function to BoundingBox, it's quicker for evaluating - * culling but generally will not cull as aggressively because it encloses a - * greater volume. -*/ -template -class BoundingSphereImpl -{ - public: - typedef VT vec_type; - typedef typename VT::value_type value_type; - - vec_type _center; - value_type _radius; - - /** Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere.*/ - BoundingSphereImpl() : _center(0.0,0.0,0.0),_radius(-1.0) {} - - /** Creates a bounding sphere initialized to the given extents. */ - BoundingSphereImpl(const vec_type& center, value_type radius) : _center(center),_radius(radius) {} - - /** Creates a bounding sphere initialized to the given extents. */ - BoundingSphereImpl(const BoundingSphereImpl& bs) : _center(bs._center),_radius(bs._radius) {} - - /** Creates a bounding sphere initialized to the given extents. */ - BoundingSphereImpl(const BoundingBoxImpl& bb) : _center(0.0,0.0,0.0),_radius(-1.0) { expandBy(bb); } - - /** Clear the bounding sphere. Reset to default values. */ - inline void init() - { - _center.set(0.0,0.0,0.0); - _radius = -1.0; - } - - /** Returns true of the bounding sphere extents are valid, false - * otherwise. */ - inline bool valid() const { return _radius>=0.0; } - - /** Set the bounding sphere to the given center/radius using floats. */ - inline void set(const vec_type& center,value_type radius) - { - _center = center; - _radius = radius; - } - - /** Returns the center of the bounding sphere. */ - inline vec_type& center() { return _center; } - - /** Returns the const center of the bounding sphere. */ - inline const vec_type& center() const { return _center; } - - /** Returns the radius of the bounding sphere. */ - inline value_type& radius() { return _radius; } - /** Returns the const radius of the bounding sphere. */ - inline value_type radius() const { return _radius; } - - /** Returns the squared length of the radius. Note, For performance - * reasons, the calling method is responsible for checking to make - * sure the sphere is valid. */ - inline value_type radius2() const { return _radius*_radius; } - - /** Expands the sphere to encompass the given point. Repositions the - * sphere center to minimize the radius increase. If the sphere is - * uninitialized, set its center to v and radius to zero. */ - template - void expandBy(const vector_type& v); - - /** Expands the sphere to encompass the given point. Does not - * reposition the sphere center. If the sphere is - * uninitialized, set its center to v and radius to zero. */ - template - void expandRadiusBy(const vector_type& v); - - /** Expands the sphere to encompass the given sphere. Repositions the - * sphere center to minimize the radius increase. If the sphere is - * uninitialized, set its center and radius to match sh. */ - void expandBy(const BoundingSphereImpl& sh); - - /** Expands the sphere to encompass the given sphere. Does not - * repositions the sphere center. If the sphere is - * uninitialized, set its center and radius to match sh. */ - void expandRadiusBy(const BoundingSphereImpl& sh); - - /** Expands the sphere to encompass the given box. Repositions the - * sphere center to minimize the radius increase. */ - void expandBy(const BoundingBoxImpl& bb); - - /** Expands the sphere to encompass the given box. Does not - * repositions the sphere center. */ - void expandRadiusBy(const BoundingBoxImpl& bb); - - /** Returns true if v is within the sphere. */ - inline bool contains(const vec_type& v) const - { - return valid() && ((v-_center).length2()<=radius2()); - } - - - /** Returns true if there is a non-empty intersection with the given - * bounding sphere. */ - inline bool intersects( const BoundingSphereImpl& bs ) const - { - return valid() && bs.valid() && - ((_center - bs._center).length2() <= (_radius + bs._radius)*(_radius + bs._radius)); - } - -}; - - -template - template -void BoundingSphereImpl::expandBy(const vector_type& v) -{ - if (valid()) - { - vec_type dv = v-_center; - value_type r = dv.length(); - if (r>_radius) - { - value_type dr = (r-_radius)*0.5; - _center += dv*(dr/r); - _radius += dr; - } // else do nothing as vertex is within sphere. - } - else - { - _center = v; - _radius = 0.0; - } -} - -template - template -void BoundingSphereImpl::expandRadiusBy(const vector_type& v) -{ - if (valid()) - { - value_type r = (v-_center).length(); - if (r>_radius) _radius = r; - // else do nothing as vertex is within sphere. - } - else - { - _center = v; - _radius = 0.0; - } -} - -template -void BoundingSphereImpl::expandBy(const BoundingSphereImpl& sh) -{ - // ignore operation if incomming BoundingSphere is invalid. - if (!sh.valid()) return; - - // This sphere is not set so use the inbound sphere - if (!valid()) - { - _center = sh._center; - _radius = sh._radius; - - return; - } - - - // Calculate d == The distance between the sphere centers - double d = ( _center - sh.center() ).length(); - - // New sphere is already inside this one - if ( d + sh.radius() <= _radius ) - { - return; - } - - // New sphere completely contains this one - if ( d + _radius <= sh.radius() ) - { - _center = sh._center; - _radius = sh._radius; - return; - } - - - // Build a new sphere that completely contains the other two: - // - // The center point lies halfway along the line between the furthest - // points on the edges of the two spheres. - // - // Computing those two points is ugly - so we'll use similar triangles - double new_radius = (_radius + d + sh.radius() ) * 0.5; - double ratio = ( new_radius - _radius ) / d ; - - _center[0] += ( sh.center()[0] - _center[0] ) * ratio; - _center[1] += ( sh.center()[1] - _center[1] ) * ratio; - _center[2] += ( sh.center()[2] - _center[2] ) * ratio; - - _radius = new_radius; - -} - -template -void BoundingSphereImpl::expandRadiusBy(const BoundingSphereImpl& sh) -{ - if (sh.valid()) - { - if (valid()) - { - value_type r = (sh._center-_center).length()+sh._radius; - if (r>_radius) _radius = r; - // else do nothing as vertex is within sphere. - } - else - { - _center = sh._center; - _radius = sh._radius; - } - } -} - -template -void BoundingSphereImpl::expandBy(const BoundingBoxImpl& bb) -{ - if (bb.valid()) - { - if (valid()) - { - BoundingBoxImpl newbb(bb); - - for(unsigned int c=0;c<8;++c) - { - vec_type v = bb.corner(c)-_center; // get the direction vector from corner - v.normalize(); // normalise it. - v *= -_radius; // move the vector in the opposite direction distance radius. - v += _center; // move to absolute position. - newbb.expandBy(v); // add it into the new bounding box. - } - - _center = newbb.center(); - _radius = newbb.radius(); - - } - else - { - _center = bb.center(); - _radius = bb.radius(); - } - } -} - -template -void BoundingSphereImpl::expandRadiusBy(const BoundingBoxImpl& bb) -{ - if (bb.valid()) - { - if (valid()) - { - for(unsigned int c=0;c<8;++c) - { - expandRadiusBy(bb.corner(c)); - } - } - else - { - _center = bb.center(); - _radius = bb.radius(); - } - } -} - -typedef BoundingSphereImpl BoundingSpheref; -typedef BoundingSphereImpl BoundingSphered; - -#ifdef OSG_USE_FLOAT_BOUNDINGSPHERE - typedef BoundingSpheref BoundingSphere; -#else - typedef BoundingSphered BoundingSphere; -#endif -} - -#endif diff --git a/libs/lib/mac32/include/osg/BoundsChecking b/libs/lib/mac32/include/osg/BoundsChecking deleted file mode 100644 index d33cd038ae70a798c62fbd215183fab7ccb2de76..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/BoundsChecking +++ /dev/null @@ -1,216 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BOUNDSCHECKING -#define OSG_BOUNDSCHECKING 1 - -#include - -namespace osg { - - -/** If value is greater than or equal to minValue do nothing - legal value, - * Otherwise set value to minValue, and warn that valueName was clamped. - * Note this is effectively A=max(A,B). */ -template -inline void clampGEQUAL(T& value,const T minValue,const char* valueName) -{ - if (value -inline void clampLEQUAL(T& value,const T maxValue,const char* valueName) -{ - if (value>maxValue) - { - notify(WARN) << "Warning: "< -inline void clampBetweenRange(T& value,const T minValue,const T maxValue,const char* valueName) -{ - if (valuemaxValue) - { - notify(WARN) << "Warning: "< -inline void clampArrayElementGEQUAL(A& value,unsigned int i,const T minValue,const char* valueName) -{ - if (value[i] -inline void clampArrayElementLEQUAL(A& value,unsigned int i,const T maxValue,const char* valueName) -{ - if (value[i]>maxValue) - { - notify(WARN) << "Warning: "< -inline void clampArrayElementBetweenRange(A& value,unsigned int i,const T minValue,const T maxValue,const char* valueName) -{ - if (value[i]maxValue) - { - notify(WARN) << "Warning: "< -inline void clampArrayElementsGEQUAL(A& value,unsigned int first,unsigned int last,const T minValue,const char* valueName) -{ - for(unsigned int i=first;i<=last;++i) - clampArrayElementGEQUAL(value,i,minValue,valueName); -} - -/** For each element of value[] in the range (first,last), if the element is - * less than or equal to maxValue do nothing - legal value, Otherwise clamp - * the element to maxValue, and warn that valueName[i] was clamped. */ -template -inline void clampArrayElementsLEQUAL(A& value,unsigned int first,unsigned int last,const T maxValue,const char* valueName) -{ - for(unsigned int i=first;i<=last;++i) - clampArrayElementLEQUAL(value,i,maxValue,valueName); -} - -/** For each element of value[] in the range (first,last), if the element is - * between or equal to minValue and maxValue do nothing - legal value, - * Otherwise clamp the element to the range and warn that valueName[i] was - * clamped. Equivalent to calling - * clampArrayElementsGEQUAL( value, first, last, minValue, valueName); - * clampArrayElementsLEQUAL( value, first, last, maxValue, valueName); */ -template -inline void clampArrayElementsBetweenRange(A& value,unsigned int first,unsigned int last,const T minValue,const T maxValue,const char* valueName) -{ - for(unsigned int i=first;i<=last;++i) - clampArrayElementBetweenRange(value,i,minValue,maxValue,valueName); -} - - -/** For each element of the three-element array value[], if the element is - * greater than or equal to minValue do nothing - legal value, Otherwise - * clamp the element to minValue, and warn that valueName[i] was clamped. */ -template -inline void clampArray3GEQUAL(A& value,const T minValue,const char* valueName) -{ - clampArrayElementsGEQUAL(value,0u,2u,minValue,valueName); -} - -/** For each element of the three-element array value[], if the element is - * less than or equal to maxValue do nothing - legal value, Otherwise clamp - * the element to maxValue, and warn that valueName[i] was clamped. */ -template -inline void clampArray3LEQUAL(A& value,const T maxValue,const char* valueName) -{ - clampArrayElementsLEQUAL(value,0u,2u,maxValue,valueName); -} - -/** For each element of the three-element array value[], if the element is - * between or equal to minValue and maxValue do nothing - legal value, - * Otherwise clamp the element to the range and warn that valueName[i] was - * clamped. Equivalent to calling - * clampArray3GEQUAL( value, minValue, valueName); - * clampArray3LEQUAL( value, maxValue, valueName); */ -template -inline void clampArray3BetweenRange(A& value,const T minValue,const T maxValue,const char* valueName) -{ - clampArrayElementsBetweenRange(value,0u,2u,minValue,maxValue,valueName); -} - - - -/** For each element of the four-element array value[], if the element is - * greater than or equal to minValue do nothing - legal value, Otherwise - * clamp the element to minValue, and warn that valueName[i] was clamped. */ -template -inline void clampArray4GEQUAL(A& value,const T minValue,const char* valueName) -{ - clampArrayElementsGEQUAL(value,0u,3u,minValue,valueName); -} - -/** For each element of the four-element array value[], if the element is - * less than or equal to maxValue do nothing - legal value, Otherwise clamp - * the element to maxValue, and warn that valueName[i] was clamped. */ -template -inline void clampArray4LEQUAL(A& value,const T maxValue,const char* valueName) -{ - clampArrayElementsLEQUAL(value,0u,3u,maxValue,valueName); -} - -/** For each element of the four-element array value[], if the element is - * between or equal to minValue and maxValue do nothing - legal value, - * Otherwise clamp the element to the range and warn that valueName[i] was - * clamped. Equivalent to calling - * clampArray4GEQUAL( value, minValue, valueName); - * clampArray4LEQUAL( value, maxValue, valueName); */ -template -inline void clampArray4BetweenRange(A& value,const T minValue,const T maxValue,const char* valueName) -{ - clampArrayElementsBetweenRange(value,0u,3u,minValue,maxValue,valueName); -} - -} - -#endif diff --git a/libs/lib/mac32/include/osg/BufferIndexBinding b/libs/lib/mac32/include/osg/BufferIndexBinding deleted file mode 100644 index c073ecd2e37399ac62edc1ae5885169ec05905c9..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/BufferIndexBinding +++ /dev/null @@ -1,134 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * Copyright (C) 2010 Tim Moore - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BUFFERINDEXBINDING -#define OSG_BUFFERINDEXBINDING 1 - -#include -#include -#include - -#ifndef GL_TRANSFORM_FEEDBACK_BUFFER - #define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#endif - -namespace osg { - -class State; - -/** Encapsulate binding buffer objects to index targets. This - * specifically supports the uniform buffer and transform feedback - * targets. - */ - -// Common implementation superclass -class OSG_EXPORT BufferIndexBinding : public StateAttribute -{ - protected: - BufferIndexBinding(GLenum target, GLuint index); - BufferIndexBinding(GLenum target, GLuint index, BufferObject* bo, GLintptr offset, - GLsizeiptr size); - BufferIndexBinding(const BufferIndexBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY); - public: - // The member value is part of the key to this state attribute in - // the State class. Using the index target, we can seperately - // track the bindings for many different index targets. - virtual unsigned getMember() const { return static_cast(_index); } - - GLenum getTarget() const { return _target; } - /** Get the index target. - */ - GLuint getIndex() const { return _index; } - /** Set the buffer object that will be bound to the index target. - */ - void setBufferObject(BufferObject *bo) { _bufferObject = bo; } - /** Get the buffer object to be bound. - */ - BufferObject* getBufferObject() const { return _bufferObject.get(); } - /** Set the starting offset into the buffer object for data for - the indexed target. Note: the required alignment on the offset - may be quite large (e.g., 256 bytes on NVidia 8600M). This - should be checked with glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT...). - */ - void setOffset(GLintptr offset) { _offset = offset; } - GLintptr getOffset() const { return _offset; } - /** Set the size of data for the indexed target. - */ - void setSize(GLsizeiptr size) { _size = size; } - GLsizeiptr getSize() const { return _size; } - virtual void apply(State& state) const; - protected: - virtual ~BufferIndexBinding(); - const GLenum _target; - const GLuint _index; - ref_ptr _bufferObject; - GLintptr _offset; - GLsizeiptr _size; -}; - -/** StateAttribute for binding a uniform buffer index target. - */ -class OSG_EXPORT UniformBufferBinding : public BufferIndexBinding -{ - public: - UniformBufferBinding(); - UniformBufferBinding(GLuint index); - /** Create a binding for a uniform buffer index target. - * @param index the index target - * @param bo associated buffer object - * @param offset offset into buffer object - * @param size size of data in buffer object - */ - UniformBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size); - UniformBufferBinding(const UniformBufferBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY); - META_StateAttribute(osg, UniformBufferBinding, UNIFORMBUFFERBINDING); - - virtual int compare(const StateAttribute& bb) const - { - COMPARE_StateAttribute_Types(UniformBufferBinding, bb) - - COMPARE_StateAttribute_Parameter(_target) - COMPARE_StateAttribute_Parameter(_index) - COMPARE_StateAttribute_Parameter(_bufferObject) - COMPARE_StateAttribute_Parameter(_offset) - COMPARE_StateAttribute_Parameter(_size) - return 0; - } -}; - -/** StateAttribute for binding a transform feedback index target. - */ -class OSG_EXPORT TransformFeedbackBufferBinding : public BufferIndexBinding -{ - public: - TransformFeedbackBufferBinding(GLuint index = 0); - TransformFeedbackBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size); - TransformFeedbackBufferBinding(const TransformFeedbackBufferBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY); - META_StateAttribute(osg, TransformFeedbackBufferBinding, TRANSFORMFEEDBACKBUFFERBINDING); - - virtual int compare(const StateAttribute& bb) const - { - COMPARE_StateAttribute_Types(TransformFeedbackBufferBinding, bb) - - COMPARE_StateAttribute_Parameter(_target) - COMPARE_StateAttribute_Parameter(_index) - COMPARE_StateAttribute_Parameter(_bufferObject) - COMPARE_StateAttribute_Parameter(_offset) - COMPARE_StateAttribute_Parameter(_size) - return 0; - } -}; -} - -#endif diff --git a/libs/lib/mac32/include/osg/BufferObject b/libs/lib/mac32/include/osg/BufferObject deleted file mode 100644 index 5c3e243a1097dba61abf908333346cf7ce71e7d5..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/BufferObject +++ /dev/null @@ -1,828 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_BUFFEROBJECT -#define OSG_BUFFEROBJECT 1 - -#include -#include -#include -#include - -#include -#include -#include - -#ifndef GL_ARB_vertex_buffer_object - - #define GL_ARB_vertex_buffer_object - - // for compatibility with gl.h headers that don't support VBO, - #if defined(_WIN64) - typedef __int64 GLintptrARB; - typedef __int64 GLsizeiptrARB; - #elif defined(__ia64__) || defined(__x86_64__) - typedef long int GLintptrARB; - typedef long int GLsizeiptrARB; - #else - typedef int GLintptrARB; - typedef int GLsizeiptrARB; - #endif - - #define GL_ARRAY_BUFFER_ARB 0x8892 - #define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 - #define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 - #define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 - #define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 - #define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 - #define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 - #define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 - #define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A - #define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B - #define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C - #define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D - #define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E - #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F - #define GL_STREAM_DRAW_ARB 0x88E0 - #define GL_STREAM_READ_ARB 0x88E1 - #define GL_STREAM_COPY_ARB 0x88E2 - #define GL_STATIC_DRAW_ARB 0x88E4 - #define GL_STATIC_READ_ARB 0x88E5 - #define GL_STATIC_COPY_ARB 0x88E6 - #define GL_DYNAMIC_DRAW_ARB 0x88E8 - #define GL_DYNAMIC_READ_ARB 0x88E9 - #define GL_DYNAMIC_COPY_ARB 0x88EA - #define GL_READ_ONLY_ARB 0x88B8 - #define GL_WRITE_ONLY_ARB 0x88B9 - #define GL_READ_WRITE_ARB 0x88BA - #define GL_BUFFER_SIZE_ARB 0x8764 - #define GL_BUFFER_USAGE_ARB 0x8765 - #define GL_BUFFER_ACCESS_ARB 0x88BB - #define GL_BUFFER_MAPPED_ARB 0x88BC - #define GL_BUFFER_MAP_POINTER_ARB 0x88BD - -#endif - -#ifndef GL_VERSION_1_5 - #if defined(_WIN64) - typedef __int64 GLintptr; - typedef __int64 GLsizeiptr; - #elif defined(__ia64__) || defined(__x86_64__) || defined(ANDROID) - typedef long int GLintptr; - typedef long int GLsizeiptr; - #else - typedef int GLintptr; - typedef int GLsizeiptr; - #endif - - #define GL_STREAM_DRAW 0x88E0 - #define GL_STREAM_READ 0x88E1 - #define GL_STREAM_COPY 0x88E2 - #define GL_STATIC_DRAW 0x88E4 - #define GL_STATIC_READ 0x88E5 - #define GL_STATIC_COPY 0x88E6 - #define GL_DYNAMIC_DRAW 0x88E8 - #define GL_DYNAMIC_READ 0x88E9 - #define GL_DYNAMIC_COPY 0x88EA -#endif - -#ifndef GL_VERSION_2_1 - #define GL_PIXEL_PACK_BUFFER 0x88EB - #define GL_PIXEL_UNPACK_BUFFER 0x88EC - #define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED - #define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#endif - - -#ifndef GL_ARB_pixel_buffer_object - #define GL_PIXEL_PACK_BUFFER_ARB 0x88EB - #define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC - #define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED - #define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF -#endif - -namespace osg -{ - -class State; -class BufferData; -class BufferObject; - -class BufferObjectProfile -{ - public: - BufferObjectProfile(): - _target(0), - _usage(0), - _size(0) {} - - BufferObjectProfile(GLenum target, GLenum usage, unsigned int size): - _target(target), - _usage(usage), - _size(size) {} - - BufferObjectProfile(const BufferObjectProfile& bpo): - _target(bpo._target), - _usage(bpo._usage), - _size(bpo._size) {} - - bool operator < (const BufferObjectProfile& rhs) const - { - if (_target < rhs._target) return true; - else if (_target > rhs._target) return false; - if (_usage < rhs._usage) return true; - else if (_usage > rhs._usage) return false; - return _size < rhs._size; - } - - bool operator == (const BufferObjectProfile& rhs) const - { - return (_target == rhs._target) && - (_usage == rhs._usage) && - (_size == rhs._size); - } - - void setProfile(GLenum target, GLenum usage, unsigned int size) - { - _target = target; - _usage = usage; - _size = size; - } - - BufferObjectProfile& operator = (const BufferObjectProfile& rhs) - { - _target = rhs._target; - _usage = rhs._usage; - _size = rhs._size; - return *this; - } - - GLenum _target; - GLenum _usage; - GLenum _size; -}; - -// forward declare -class GLBufferObjectSet; -class GLBufferObjectManager; - -class OSG_EXPORT GLBufferObject : public Referenced -{ - public: - - GLBufferObject(unsigned int contextID, BufferObject* bufferObject, unsigned int glObjectID=0); - - void setProfile(const BufferObjectProfile& profile) { _profile = profile; } - const BufferObjectProfile& getProfile() const { return _profile; } - - void setBufferObject(BufferObject* bufferObject); - BufferObject* getBufferObject() { return _bufferObject; } - - struct BufferEntry - { - BufferEntry(): modifiedCount(0),dataSize(0),offset(0),dataSource(0) {} - - BufferEntry(const BufferEntry& rhs): - modifiedCount(rhs.modifiedCount), - dataSize(rhs.dataSize), - offset(rhs.offset), - dataSource(rhs.dataSource) {} - - BufferEntry& operator = (const BufferEntry& rhs) - { - if (&rhs==this) return *this; - modifiedCount = rhs.modifiedCount; - dataSize = rhs.dataSize; - offset = rhs.offset; - dataSource = rhs.dataSource; - return *this; - } - - unsigned int modifiedCount; - unsigned int dataSize; - unsigned int offset; - BufferData* dataSource; - }; - - inline unsigned int getContextID() const { return _contextID; } - - inline GLuint& getGLObjectID() { return _glObjectID; } - inline GLuint getGLObjectID() const { return _glObjectID; } - inline GLsizeiptrARB getOffset(unsigned int i) const { return _bufferEntries[i].offset; } - - inline void bindBuffer(); - - inline void unbindBuffer() - { - _extensions->glBindBuffer(_profile._target,0); - } - - inline bool isDirty() const { return _dirty; } - - void dirty() { _dirty = true; } - - void clear(); - - void compileBuffer(); - - void deleteGLObject(); - - void assign(BufferObject* bufferObject); - - bool isPBOSupported() const { return _extensions->isPBOSupported(); } - - static GLBufferObject* createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject); - - static void deleteAllBufferObjects(unsigned int contextID); - static void discardAllBufferObjects(unsigned int contextID); - static void flushAllDeletedBufferObjects(unsigned int contextID); - static void discardAllDeletedBufferObjects(unsigned int contextID); - static void flushDeletedBufferObjects(unsigned int contextID,double currentTime, double& availbleTime); - static void releaseGLBufferObject(unsigned int contextID, GLBufferObject* to); - - /** Extensions class which encapsulates the querying of extensions and - * associated function pointers, and provide convenience wrappers to - * check for the extensions or use the associated functions.*/ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - bool isBufferObjectSupported() const { return _glGenBuffers!=0; } - bool isPBOSupported() const { return _isPBOSupported; } - bool isUniformBufferObjectSupported() const { return _isUniformBufferObjectSupported; } - - void glGenBuffers (GLsizei n, GLuint *buffers) const; - void glBindBuffer (GLenum target, GLuint buffer) const; - void glBufferData (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage) const; - void glBufferSubData (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data) const; - void glDeleteBuffers (GLsizei n, const GLuint *buffers) const; - GLboolean glIsBuffer (GLuint buffer) const; - void glGetBufferSubData (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data) const; - GLvoid* glMapBuffer (GLenum target, GLenum access) const; - GLboolean glUnmapBuffer (GLenum target) const; - void glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params) const; - void glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params) const; - void glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); - void glBindBufferBase (GLenum target, GLuint index, GLuint buffer); - - protected: - - typedef void (GL_APIENTRY * GenBuffersProc) (GLsizei n, GLuint *buffers); - typedef void (GL_APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); - typedef void (GL_APIENTRY * BufferDataProc) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); - typedef void (GL_APIENTRY * BufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); - typedef void (GL_APIENTRY * DeleteBuffersProc) (GLsizei n, const GLuint *buffers); - typedef GLboolean (GL_APIENTRY * IsBufferProc) (GLuint buffer); - typedef void (GL_APIENTRY * GetBufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); - typedef GLvoid* (GL_APIENTRY * MapBufferProc) (GLenum target, GLenum access); - typedef GLboolean (GL_APIENTRY * UnmapBufferProc) (GLenum target); - typedef void (GL_APIENTRY * GetBufferParameterivProc) (GLenum target, GLenum pname, GLint *params); - typedef void (GL_APIENTRY * GetBufferPointervProc) (GLenum target, GLenum pname, GLvoid* *params); - typedef void (GL_APIENTRY * BindBufferRangeProc) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); - typedef void (GL_APIENTRY * BindBufferBaseProc) (GLenum target, GLuint index, GLuint buffer); - - - GenBuffersProc _glGenBuffers; - BindBufferProc _glBindBuffer; - BufferDataProc _glBufferData; - BufferSubDataProc _glBufferSubData; - DeleteBuffersProc _glDeleteBuffers; - IsBufferProc _glIsBuffer; - GetBufferSubDataProc _glGetBufferSubData; - MapBufferProc _glMapBuffer; - UnmapBufferProc _glUnmapBuffer; - GetBufferParameterivProc _glGetBufferParameteriv; - GetBufferPointervProc _glGetBufferPointerv; - BindBufferRangeProc _glBindBufferRange; - BindBufferBaseProc _glBindBufferBase; - - bool _isPBOSupported; - bool _isUniformBufferObjectSupported; - }; - - /** Function to call to get the extension of a specified context. - * If the Extension object for that context has not yet been created - * and the 'createIfNotInitalized' flag been set to false then returns NULL. - * If 'createIfNotInitalized' is true then the Extensions object is - * automatically created. However, in this case the extension object is - * only created with the graphics context associated with ContextID..*/ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions allows users to override the extensions across graphics contexts. - * typically used when you have different extensions supported across graphics pipes - * but need to ensure that they all use the same low common denominator extensions.*/ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - protected: - - virtual ~GLBufferObject(); - - unsigned int computeBufferAlignment(unsigned int pos, unsigned int bufferAlignment) const - { - if (bufferAlignment<2) return pos; - if ((pos%bufferAlignment)==0) return pos; - return ((pos/bufferAlignment)+1)*bufferAlignment; - } - - unsigned int _contextID; - GLuint _glObjectID; - - BufferObjectProfile _profile; - unsigned int _allocatedSize; - - bool _dirty; - - typedef std::vector BufferEntries; - BufferEntries _bufferEntries; - - BufferObject* _bufferObject; - - public: - - GLBufferObjectSet* _set; - GLBufferObject* _previous; - GLBufferObject* _next; - unsigned int _frameLastUsed; - - public: - Extensions* _extensions; - -}; - -typedef std::list< ref_ptr > GLBufferObjectList; - -class OSG_EXPORT GLBufferObjectSet : public Referenced -{ - public: - GLBufferObjectSet(GLBufferObjectManager* parent, const BufferObjectProfile& profile); - - const BufferObjectProfile& getProfile() const { return _profile; } - - void handlePendingOrphandedGLBufferObjects(); - - void deleteAllGLBufferObjects(); - void discardAllGLBufferObjects(); - void flushAllDeletedGLBufferObjects(); - void discardAllDeletedGLBufferObjects(); - void flushDeletedGLBufferObjects(double currentTime, double& availableTime); - - GLBufferObject* takeFromOrphans(BufferObject* bufferObject); - GLBufferObject* takeOrGenerate(BufferObject* bufferObject); - - void moveToBack(GLBufferObject* to); - void addToBack(GLBufferObject* to); - void orphan(GLBufferObject* to); - void remove(GLBufferObject* to); - void moveToSet(GLBufferObject* to, GLBufferObjectSet* set); - - unsigned int size() const { return _profile._size * _numOfGLBufferObjects; } - - bool makeSpace(unsigned int& size); - - bool checkConsistency() const; - - GLBufferObjectManager* getParent() { return _parent; } - - unsigned int computeNumGLBufferObjectsInList() const; - unsigned int getNumOfGLBufferObjects() const { return _numOfGLBufferObjects; } - unsigned int getNumOrphans() const { return _orphanedGLBufferObjects.size(); } - unsigned int getNumPendingOrphans() const { return _pendingOrphanedGLBufferObjects.size(); } - - - protected: - - virtual ~GLBufferObjectSet(); - - OpenThreads::Mutex _mutex; - - GLBufferObjectManager* _parent; - unsigned int _contextID; - BufferObjectProfile _profile; - unsigned int _numOfGLBufferObjects; - GLBufferObjectList _orphanedGLBufferObjects; - GLBufferObjectList _pendingOrphanedGLBufferObjects; - - GLBufferObject* _head; - GLBufferObject* _tail; -}; - -class OSG_EXPORT GLBufferObjectManager : public osg::Referenced -{ - public: - GLBufferObjectManager(unsigned int contextID); - - unsigned int getContextID() const { return _contextID; } - - - void setNumberActiveGLBufferObjects(unsigned int size) { _numActiveGLBufferObjects = size; } - unsigned int& getNumberActiveGLBufferObjects() { return _numActiveGLBufferObjects; } - unsigned int getNumberActiveGLBufferObjects() const { return _numActiveGLBufferObjects; } - - void setNumberOrphanedGLBufferObjects(unsigned int size) { _numOrphanedGLBufferObjects = size; } - unsigned int& getNumberOrphanedGLBufferObjects() { return _numOrphanedGLBufferObjects; } - unsigned int getNumberOrphanedGLBufferObjects() const { return _numOrphanedGLBufferObjects; } - - void setCurrGLBufferObjectPoolSize(unsigned int size) { _currGLBufferObjectPoolSize = size; } - unsigned int& getCurrGLBufferObjectPoolSize() { return _currGLBufferObjectPoolSize; } - unsigned int getCurrGLBufferObjectPoolSize() const { return _currGLBufferObjectPoolSize; } - - void setMaxGLBufferObjectPoolSize(unsigned int size); - unsigned int getMaxGLBufferObjectPoolSize() const { return _maxGLBufferObjectPoolSize; } - - bool hasSpace(unsigned int size) const { return (_currGLBufferObjectPoolSize+size)<=_maxGLBufferObjectPoolSize; } - bool makeSpace(unsigned int size); - - GLBufferObject* generateGLBufferObject(const osg::BufferObject* bufferObject); - - void handlePendingOrphandedGLBufferObjects(); - - void deleteAllGLBufferObjects(); - void discardAllGLBufferObjects(); - void flushAllDeletedGLBufferObjects(); - void discardAllDeletedGLBufferObjects(); - void flushDeletedGLBufferObjects(double currentTime, double& availableTime); - void releaseGLBufferObject(GLBufferObject* to); - - GLBufferObjectSet* getGLBufferObjectSet(const BufferObjectProfile& profile); - - void newFrame(osg::FrameStamp* fs); - void resetStats(); - void reportStats(std::ostream& out); - void recomputeStats(std::ostream& out); - - unsigned int& getFrameNumber() { return _frameNumber; } - unsigned int& getNumberFrames() { return _numFrames; } - - unsigned int& getNumberDeleted() { return _numDeleted; } - double& getDeleteTime() { return _deleteTime; } - - unsigned int& getNumberGenerated() { return _numGenerated; } - double& getGenerateTime() { return _generateTime; } - - unsigned int& getNumberApplied() { return _numApplied; } - double& getApplyTime() { return _applyTime; } - - static osg::ref_ptr& getGLBufferObjectManager(unsigned int contextID); - - protected: - - typedef std::map< BufferObjectProfile, osg::ref_ptr > GLBufferObjectSetMap; - unsigned int _contextID; - unsigned int _numActiveGLBufferObjects; - unsigned int _numOrphanedGLBufferObjects; - unsigned int _currGLBufferObjectPoolSize; - unsigned int _maxGLBufferObjectPoolSize; - GLBufferObjectSetMap _glBufferObjectSetMap; - - unsigned int _frameNumber; - - unsigned int _numFrames; - unsigned int _numDeleted; - double _deleteTime; - - unsigned int _numGenerated; - double _generateTime; - - unsigned int _numApplied; - double _applyTime; - -}; - - -class OSG_EXPORT BufferObject : public Object -{ - public: - - BufferObject(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - BufferObject(const BufferObject& bo,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "BufferObject"; } - - void setTarget(GLenum target) { _profile._target = target; } - GLenum getTarget() const { return _profile._target; } - - /** Set what type of usage the buffer object will have. Options are: - * GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, - * GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, - * GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY. - */ - void setUsage(GLenum usage) { _profile._usage = usage; } - - /** Get the type of usage the buffer object has been set up for.*/ - GLenum getUsage() const { return _profile._usage; } - - BufferObjectProfile& getProfile() { return _profile; } - const BufferObjectProfile& getProfile() const { return _profile; } - - - /** Set whether the BufferObject should use a GLBufferObject just for copying the BufferData and release it immmediately so that it may be reused.*/ - void setCopyDataAndReleaseGLBufferObject(bool copyAndRelease) { _copyDataAndReleaseGLBufferObject = copyAndRelease; } - - /** Get whether the BufferObject should use a GLBufferObject just for copying the BufferData and release it immmediately.*/ - bool getCopyDataAndReleaseGLBufferObject() const { return _copyDataAndReleaseGLBufferObject; } - - - void dirty(); - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objects - * for all graphics contexts. */ - void releaseGLObjects(State* state=0) const; - - unsigned int addBufferData(BufferData* bd); - void removeBufferData(unsigned int index); - void removeBufferData(BufferData* bd); - - void setBufferData(unsigned int index, BufferData* bd); - BufferData* getBufferData(unsigned int index) { return _bufferDataList[index]; } - const BufferData* getBufferData(unsigned int index) const { return _bufferDataList[index]; } - - unsigned int getNumBufferData() const { return _bufferDataList.size(); } - - void setGLBufferObject(unsigned int contextID, GLBufferObject* glbo) { _glBufferObjects[contextID] = glbo; } - - GLBufferObject* getGLBufferObject(unsigned int contextID) const { return _glBufferObjects[contextID].get(); } - - GLBufferObject* getOrCreateGLBufferObject(unsigned int contextID) const - { - if (!_glBufferObjects[contextID]) _glBufferObjects[contextID] = GLBufferObject::createGLBufferObject(contextID, this); - return _glBufferObjects[contextID].get(); - } - - unsigned int computeRequiredBufferSize() const; - - /** deprecated, provided for backwards compatibility.*/ - static void deleteBufferObject(unsigned int contextID,GLuint globj); - - protected: - - ~BufferObject(); - - typedef std::vector< BufferData* > BufferDataList; - typedef osg::buffered_object< osg::ref_ptr > GLBufferObjects; - - BufferObjectProfile _profile; - - bool _copyDataAndReleaseGLBufferObject; - - BufferDataList _bufferDataList; - - mutable GLBufferObjects _glBufferObjects; -}; - -class OSG_EXPORT BufferData : public Object -{ - public: - - BufferData(): - Object(true), - _modifiedCount(0), - _bufferIndex(0) {} - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - BufferData(const BufferData& bd,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - osg::Object(bd,copyop), - _modifiedCount(0), - _bufferIndex(0), - _modifiedCallback(bd._modifiedCallback) {} - - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "BufferData"; } - - virtual const GLvoid* getDataPointer() const = 0; - virtual unsigned int getTotalDataSize() const = 0; - - void setBufferObject(BufferObject* bufferObject); - BufferObject* getBufferObject() { return _bufferObject.get(); } - const BufferObject* getBufferObject() const { return _bufferObject.get(); } - - void setBufferIndex(unsigned int index) { _bufferIndex = index; } - unsigned int getBufferIndex() const { return _bufferIndex; } - - GLBufferObject* getGLBufferObject(unsigned int contextID) const { return _bufferObject.valid() ? _bufferObject->getGLBufferObject(contextID) : 0; } - GLBufferObject* getOrCreateGLBufferObject(unsigned int contextID) const { return _bufferObject.valid() ? _bufferObject->getOrCreateGLBufferObject(contextID) : 0; } - - struct ModifiedCallback : public virtual osg::Object - { - ModifiedCallback() {} - - ModifiedCallback(const ModifiedCallback&,const CopyOp&) {} - - META_Object(osg,ModifiedCallback); - - virtual void modified(BufferData* /*bufferData*/) const {} - }; - - void setModifiedCallback(ModifiedCallback* md) { _modifiedCallback = md; } - ModifiedCallback* getModifiedCallback() { return _modifiedCallback.get(); } - const ModifiedCallback* getModifiedCallback() const { return _modifiedCallback.get(); } - - /** Dirty the primitive, which increments the modified count, to force buffer objects to update. - * If a ModifiedCallback is attached to this BufferData then the callback is called prior to the bufferObject's dirty is called. */ - inline void dirty() - { - ++_modifiedCount; - if (_modifiedCallback.valid()) _modifiedCallback->modified(this); - if (_bufferObject.valid()) _bufferObject->dirty(); - } - - /** Set the modified count value.*/ - inline void setModifiedCount(unsigned int value) { _modifiedCount=value; } - - /** Get modified count value.*/ - inline unsigned int getModifiedCount() const { return _modifiedCount; } - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objects - * for all graphics contexts. */ - void releaseGLObjects(State* state=0) const; - -protected: - - virtual ~BufferData(); - - unsigned int _modifiedCount; - - unsigned int _bufferIndex; - osg::ref_ptr _bufferObject; - osg::ref_ptr _modifiedCallback; -}; - - -class Array; -class OSG_EXPORT VertexBufferObject : public BufferObject -{ - public: - - VertexBufferObject(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - VertexBufferObject(const VertexBufferObject& vbo,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Object(osg,VertexBufferObject); - - unsigned int addArray(osg::Array* array); - void removeArray(osg::Array* array); - - void setArray(unsigned int i, Array* array); - Array* getArray(unsigned int i); - const Array* getArray(unsigned int i) const; - - protected: - virtual ~VertexBufferObject(); -}; - -class DrawElements; -class OSG_EXPORT ElementBufferObject : public BufferObject -{ - public: - - ElementBufferObject(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - ElementBufferObject(const ElementBufferObject& pbo,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Object(osg,ElementBufferObject); - - unsigned int addDrawElements(osg::DrawElements* PrimitiveSet); - void removeDrawElements(osg::DrawElements* PrimitiveSet); - - void setDrawElements(unsigned int i, DrawElements* PrimitiveSet); - DrawElements* getDrawElements(unsigned int i); - const DrawElements* getDrawElements(unsigned int i) const; - - protected: - - virtual ~ElementBufferObject(); -}; - -class Image; -class OSG_EXPORT PixelBufferObject : public BufferObject -{ - public: - - PixelBufferObject(osg::Image* image=0); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - PixelBufferObject(const PixelBufferObject& pbo,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Object(osg,PixelBufferObject); - - void setImage(osg::Image* image); - - Image* getImage(); - const Image* getImage() const; - - bool isPBOSupported(unsigned int contextID) const { return _glBufferObjects[contextID]->isPBOSupported(); } - - protected: - - virtual ~PixelBufferObject(); -}; - -/** - * This object represent a general class of pixel buffer objects, - * which are capable of allocating buffer object (memory) - * on the GPU. The memory can then be used either for CPU-GPU - * pixel transfer or directly for GPU-GPU transfer, without CPU intervention. - **/ -class OSG_EXPORT PixelDataBufferObject : public BufferObject -{ - public: - PixelDataBufferObject(); - PixelDataBufferObject(const PixelDataBufferObject& pbo, const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Object(osg, PixelDataBufferObject); - - //! Set new size of the buffer object. This will reallocate the memory on the next compile - inline void setDataSize(unsigned int size) { _profile._size = size; dirty(); } - - //! Get data size of the used buffer - inline unsigned int getDataSize() const { return _profile._size; } - - //! Compile the buffer (reallocate the memory if buffer is dirty) - virtual void compileBuffer(State& state) const; - - //! Bind the buffer in read mode, which means that data can be downloaded from the buffer (note: GL_PIXEL_UNPACK_BUFFER_ARB) - virtual void bindBufferInReadMode(State& state); - - //! Bind the buffer in write mode, which means following OpenGL instructions will write data into the buffer (note: GL_PIXEL_PACK_BUFFER_ARB) - virtual void bindBufferInWriteMode(State& state); - - //! Unbind the buffer - virtual void unbindBuffer(unsigned int contextID) const; - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - enum Mode - { - //! A normal mode of this data buffer - NONE = 0, - - //! Buffer is in read mode (@see bindBufferInReadMode) - READ = 1, - - //! Buffer is in write mode (@see bindBufferInWriteMode) - WRITE = 2 - }; - - Mode getMode(unsigned int contextID) const { return (Mode)_mode[contextID]; } - - protected: - - virtual ~PixelDataBufferObject(); - - typedef osg::buffered_value ModeList; - - mutable ModeList _mode; - -}; - -class OSG_EXPORT UniformBufferObject : public BufferObject -{ - public: - UniformBufferObject(); - UniformBufferObject(const UniformBufferObject& ubo, const CopyOp& copyop=CopyOp::SHALLOW_COPY); - META_Object(osg, UniformBufferObject); - protected: - virtual ~UniformBufferObject(); -}; - -inline void GLBufferObject::bindBuffer() -{ - _extensions->glBindBuffer(_profile._target,_glObjectID); - if (_set) _set->moveToBack(this); -} - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Camera b/libs/lib/mac32/include/osg/Camera deleted file mode 100644 index 631a1783f2fb696ff10db5f5ab6e327fb1c5d93b..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Camera +++ /dev/null @@ -1,674 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CAMERA -#define OSG_CAMERA 1 - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace osg { - -// forward declare View to allow Camera to point back to the View that its within -class View; -class RenderInfo; - -/** Camera - is a subclass of Transform which represents encapsulates the settings of a Camera. -*/ -class OSG_EXPORT Camera : public Transform, public CullSettings -{ - public : - - - Camera(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Camera(const Camera&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, Camera); - - /** Set the View that this Camera is part of. */ - void setView(View* view) { _view = view; } - - /** Get the View that this Camera is part of. */ - View* getView() { return _view; } - - /** Get the const View that this Camera is part of. */ - const View* getView() const { return _view; } - - - /** Set the Stats object used for collect various frame related - * timing and scene graph stats. */ - void setStats(osg::Stats* stats) { _stats = stats; } - - /** Get the Stats object.*/ - osg::Stats* getStats() { return _stats.get(); } - - /** Get the const Stats object.*/ - const osg::Stats* getStats() const { return _stats.get(); } - - - /** Set whether this camera allows events to be generated by the - * associated graphics window to be associated with this camera. */ - void setAllowEventFocus(bool focus) { _allowEventFocus = focus; } - - /** Get whether this camera allows events to be generated by the - * associated graphics window to be associated with this camera. */ - bool getAllowEventFocus() const { return _allowEventFocus; } - - - /** Set the DisplaySettings object associated with this view.*/ - void setDisplaySettings(osg::DisplaySettings* ds) { _displaySettings = ds; } - - /** Get the DisplaySettings object associated with this view.*/ - osg::DisplaySettings* getDisplaySettings() { return _displaySettings.get(); } - - /** Get the const DisplaySettings object associated with this view.*/ - const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); } - - - /** Set the clear mask used in glClear(). - * Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */ - inline void setClearMask(GLbitfield mask) { _clearMask = mask; applyMaskAction(CLEAR_MASK); } - - /** Get the clear mask.*/ - inline GLbitfield getClearMask() const { return _clearMask; } - - /** Set the clear color used in glClearColor(). - * glClearColor is only called if mask & GL_COLOR_BUFFER_BIT is true*/ - void setClearColor(const osg::Vec4& color) { _clearColor=color; applyMaskAction(CLEAR_COLOR); } - - /** Get the clear color.*/ - const osg::Vec4& getClearColor() const { return _clearColor; } - - /** Set the clear accum used in glClearAccum(). - * glClearAcumm is only called if mask & GL_ACCUM_BUFFER_BIT is true. */ - void setClearAccum(const osg::Vec4& color) { _clearAccum=color; } - - /** Get the clear accum value.*/ - const osg::Vec4& getClearAccum() const { return _clearAccum; } - - /** Set the clear depth used in glClearDepth(). Defaults to 1.0 - * glClearDepth is only called if mask & GL_DEPTH_BUFFER_BIT is true. */ - void setClearDepth(double depth) { _clearDepth=depth; } - - /** Get the clear depth value.*/ - double getClearDepth() const { return _clearDepth; } - - /** Set the clear stencil value used in glClearStencil(). Defaults to 0; - * glClearStencil is only called if mask & GL_STENCIL_BUFFER_BIT is true*/ - void setClearStencil(int stencil) { _clearStencil=stencil; } - - /** Get the clear stencil value.*/ - int getClearStencil() const { return _clearStencil; } - - - /** Set the color mask of the camera to use specified osg::ColorMask. */ - void setColorMask(osg::ColorMask* colorMask); - - - /** Set the color mask of the camera to specified values. */ - void setColorMask(bool red, bool green, bool blue, bool alpha); - - /** Get the const ColorMask. */ - const ColorMask* getColorMask() const { return _colorMask.get(); } - - /** Get the ColorMask. */ - ColorMask* getColorMask() { return _colorMask.get(); } - - - /** Set the viewport of the camera to use specified osg::Viewport. */ - void setViewport(osg::Viewport* viewport); - - /** Set the viewport of the camera to specified dimensions. */ - void setViewport(int x,int y,int width,int height); - - /** Get the const viewport. */ - const Viewport* getViewport() const { return _viewport.get(); } - - /** Get the viewport. */ - Viewport* getViewport() { return _viewport.get(); } - - - enum TransformOrder - { - PRE_MULTIPLY, - POST_MULTIPLY - }; - - /** Set the transformation order for world-to-local and local-to-world transformation.*/ - void setTransformOrder(TransformOrder order) { _transformOrder = order; } - - /** Get the transformation order.*/ - TransformOrder getTransformOrder() const { return _transformOrder; } - - enum ProjectionResizePolicy - { - FIXED, /**< Keep the projection matrix fixed, despite window resizes.*/ - HORIZONTAL, /**< Adjust the HORIZONTAL field of view on window resizes.*/ - VERTICAL /**< Adjust the VERTICAL field of view on window resizes.*/ - - }; - - /** Set the policy used to determine if and how the projection matrix should be adjusted on window resizes. */ - inline void setProjectionResizePolicy(ProjectionResizePolicy policy) { _projectionResizePolicy = policy; } - - /** Get the policy used to determine if and how the projection matrix should be adjusted on window resizes. */ - inline ProjectionResizePolicy getProjectionResizePolicy() const { return _projectionResizePolicy; } - - - /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ - inline void setProjectionMatrix(const osg::Matrixf& matrix) { _projectionMatrix.set(matrix); } - - /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ - inline void setProjectionMatrix(const osg::Matrixd& matrix) { _projectionMatrix.set(matrix); } - - /** Set to an orthographic projection. See OpenGL glOrtho for documentation further details.*/ - void setProjectionMatrixAsOrtho(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Set to a 2D orthographic projection. See OpenGL glOrtho2D documentation for further details.*/ - void setProjectionMatrixAsOrtho2D(double left, double right, - double bottom, double top); - - /** Set to a perspective projection. See OpenGL glFrustum documentation for further details.*/ - void setProjectionMatrixAsFrustum(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details. - * Aspect ratio is defined as width/height.*/ - void setProjectionMatrixAsPerspective(double fovy,double aspectRatio, - double zNear, double zFar); - - /** Get the projection matrix.*/ - osg::Matrixd& getProjectionMatrix() { return _projectionMatrix; } - - /** Get the const projection matrix.*/ - const osg::Matrixd& getProjectionMatrix() const { return _projectionMatrix; } - - /** Get the orthographic settings of the orthographic projection matrix. - * Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/ - bool getProjectionMatrixAsOrtho(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar) const; - - /** Get the frustum setting of a perspective projection matrix. - * Returns false if matrix is not a perspective matrix, where parameter values are undefined.*/ - bool getProjectionMatrixAsFrustum(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar) const; - - /** Get the frustum setting of a symmetric perspective projection matrix. - * Returns false if matrix is not a perspective matrix, where parameter values are undefined. - * Note, if matrix is not a symmetric perspective matrix then the shear will be lost. - * Asymmetric matrices occur when stereo, power walls, caves and reality center display are used. - * In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.*/ - bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, - double& zNear, double& zFar) const; - - - - /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ - inline void setViewMatrix(const osg::Matrixf& matrix) { _viewMatrix.set(matrix); dirtyBound();} - - /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ - inline void setViewMatrix(const osg::Matrixd& matrix) { _viewMatrix.set(matrix); dirtyBound();} - - /** Get the view matrix. */ - osg::Matrixd& getViewMatrix() { return _viewMatrix; } - - /** Get the const view matrix. */ - const osg::Matrixd& getViewMatrix() const { return _viewMatrix; } - - /** Set to the position and orientation of view matrix, using the same convention as gluLookAt. */ - void setViewMatrixAsLookAt(const osg::Vec3d& eye,const osg::Vec3d& center,const osg::Vec3d& up); - - /** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */ - void getViewMatrixAsLookAt(osg::Vec3d& eye,osg::Vec3d& center,osg::Vec3d& up,double lookDistance=1.0) const; - - /** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */ - void getViewMatrixAsLookAt(osg::Vec3f& eye,osg::Vec3f& center,osg::Vec3f& up,float lookDistance=1.0f) const; - - /** Get the inverse view matrix.*/ - Matrixd getInverseViewMatrix() const; - - - enum RenderOrder - { - PRE_RENDER, - NESTED_RENDER, - POST_RENDER - }; - - /** Set the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within. - * For rendering to a texture, one typically uses PRE_RENDER. - * For Head Up Displays, one would typically use POST_RENDER.*/ - void setRenderOrder(RenderOrder order, int orderNum = 0) { _renderOrder = order; _renderOrderNum = orderNum; } - - /** Get the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within.*/ - RenderOrder getRenderOrder() const { return _renderOrder; } - - /** Get the rendering order number of this camera relative to any sibling cameras in this subgraph.*/ - int getRenderOrderNum() const { return _renderOrderNum; } - - /** Return true if this Camera is set up as a render to texture camera, i.e. it has textures assigned to it.*/ - bool isRenderToTextureCamera() const; - - enum RenderTargetImplementation - { - FRAME_BUFFER_OBJECT, - PIXEL_BUFFER_RTT, - PIXEL_BUFFER, - FRAME_BUFFER, - SEPERATE_WINDOW - }; - - /** Set the render target.*/ - void setRenderTargetImplementation(RenderTargetImplementation impl); - - /** Set the render target and fall-back that's used if the former isn't available.*/ - void setRenderTargetImplementation(RenderTargetImplementation impl, RenderTargetImplementation fallback); - - /** Get the render target.*/ - RenderTargetImplementation getRenderTargetImplementation() const { return _renderTargetImplementation; } - - /** Get the render target fallback.*/ - RenderTargetImplementation getRenderTargetFallback() const { return _renderTargetFallback; } - - - /** Set the draw buffer used at the start of each frame draw. - * Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.*/ - void setDrawBuffer(GLenum buffer) { _drawBuffer = buffer; applyMaskAction( DRAW_BUFFER ); } - - /** Get the draw buffer used at the start of each frame draw. */ - GLenum getDrawBuffer() const { return _drawBuffer; } - - /** Set the read buffer for any required copy operations to use. - * Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.*/ - void setReadBuffer(GLenum buffer) { _readBuffer = buffer; applyMaskAction( READ_BUFFER ); } - - /** Get the read buffer for any required copy operations to use. */ - GLenum getReadBuffer() const { return _readBuffer; } - - enum BufferComponent - { - DEPTH_BUFFER, - STENCIL_BUFFER, - PACKED_DEPTH_STENCIL_BUFFER, - COLOR_BUFFER, - COLOR_BUFFER0, - COLOR_BUFFER1 = COLOR_BUFFER0+1, - COLOR_BUFFER2 = COLOR_BUFFER0+2, - COLOR_BUFFER3 = COLOR_BUFFER0+3, - COLOR_BUFFER4 = COLOR_BUFFER0+4, - COLOR_BUFFER5 = COLOR_BUFFER0+5, - COLOR_BUFFER6 = COLOR_BUFFER0+6, - COLOR_BUFFER7 = COLOR_BUFFER0+7, - COLOR_BUFFER8 = COLOR_BUFFER0+8, - COLOR_BUFFER9 = COLOR_BUFFER0+9, - COLOR_BUFFER10 = COLOR_BUFFER0+10, - COLOR_BUFFER11 = COLOR_BUFFER0+11, - COLOR_BUFFER12 = COLOR_BUFFER0+12, - COLOR_BUFFER13 = COLOR_BUFFER0+13, - COLOR_BUFFER14 = COLOR_BUFFER0+14, - COLOR_BUFFER15 = COLOR_BUFFER0+15 - }; - - static const unsigned int FACE_CONTROLLED_BY_GEOMETRY_SHADER; - - /** Attach a buffer with specified OpenGL internal format.*/ - void attach(BufferComponent buffer, GLenum internalFormat); - - /** Attach a Texture to specified buffer component. - * The level parameter controls the mip map level of the texture that is attached. - * The face parameter controls the face of texture cube map or z level of 3d texture. - * The mipMapGeneration flag controls whether mipmap generation should be done for texture.*/ - void attach(BufferComponent buffer, osg::Texture* texture, unsigned int level = 0, unsigned int face=0, bool mipMapGeneration=false, - unsigned int multisampleSamples = 0, - unsigned int multisampleColorSamples = 0); - - /** Attach a Image to specified buffer component.*/ - void attach(BufferComponent buffer, osg::Image* image, - unsigned int multisampleSamples = 0, - unsigned int multisampleColorSamples = 0); - - /** Detach specified buffer component.*/ - void detach(BufferComponent buffer); - - struct Attachment - { - Attachment(): - _internalFormat(GL_NONE), - _level(0), - _face(0), - _mipMapGeneration(false), - _multisampleSamples(0), - _multisampleColorSamples(0) {} - - int width() const - { - if (_texture.valid()) return _texture->getTextureWidth(); - if (_image.valid()) return _image->s(); - return 0; - }; - - int height() const - { - if (_texture.valid()) return _texture->getTextureHeight(); - if (_image.valid()) return _image->t(); - return 0; - }; - - int depth() const - { - if (_texture.valid()) return _texture->getTextureDepth(); - if (_image.valid()) return _image->r(); - return 0; - }; - - GLenum _internalFormat; - ref_ptr _image; - ref_ptr _texture; - unsigned int _level; - unsigned int _face; - bool _mipMapGeneration; - unsigned int _multisampleSamples; - unsigned int _multisampleColorSamples; - }; - - typedef std::map< BufferComponent, Attachment> BufferAttachmentMap; - - /** Get the BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.*/ - BufferAttachmentMap& getBufferAttachmentMap() { return _bufferAttachmentMap; } - - /** Get the const BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.*/ - const BufferAttachmentMap& getBufferAttachmentMap() const { return _bufferAttachmentMap; } - - - /** Explicit control over implicit allocation of buffers when using FBO. - Implicit buffers are automatically substituted when user have not attached such buffer. - - Camera may set up two FBOs: primary Render FBO and secondary Resolve FBO for multisample usage. - So in practive we have two masks defined for the Camera: - implicitBufferAttachmentRenderMask - implicitBufferAttachmentResolveMask - They can be set together by setImplicitBufferAttachmentMask method, or separately - by setImplicitBufferAttachmentRenderMask and setImplicitBufferAttachmentResolveMask. - - Camera defaults are USE_DISPLAY_SETTINGS_MASK which means that by default - Camera chooses to substitue buffer attachments as defined by DisplaySettings. - - Usually DisplaySettings implicit buffer attachment selection defaults to: DEPTH and COLOR - for both primary (Render) FBO and seconday Multisample (Resolve) FBO - ie: IMPLICT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT - - If these masks are not changed and user did not attach depth buffer and/or color buffer - to Camera, then OSG implicitly substitues these buffers. - By default it does not implicitly allocate a stencil buffer. - Use implicti buffer attachment masks to override default behavior: - to turn off DEPTH or COLOR buffer substitution or to enforce STENCIL buffer substitution. - - Note that both values are ignored if not using FBO. - Note that the second mask value is ignored if not using MSFBO. - */ - enum ImplicitBufferAttachment - { - IMPLICIT_DEPTH_BUFFER_ATTACHMENT = DisplaySettings::IMPLICIT_DEPTH_BUFFER_ATTACHMENT, - IMPLICIT_STENCIL_BUFFER_ATTACHMENT = DisplaySettings::IMPLICIT_STENCIL_BUFFER_ATTACHMENT, - IMPLICIT_COLOR_BUFFER_ATTACHMENT = DisplaySettings::IMPLICIT_COLOR_BUFFER_ATTACHMENT, - USE_DISPLAY_SETTINGS_MASK = (~0) - }; - - typedef int ImplicitBufferAttachmentMask; - - void setImplicitBufferAttachmentMask(ImplicitBufferAttachmentMask renderMask = DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT, ImplicitBufferAttachmentMask resolveMask = DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT) - { - _implicitBufferAttachmentRenderMask = renderMask; - _implicitBufferAttachmentResolveMask = resolveMask; - } - - void setImplicitBufferAttachmentRenderMask(ImplicitBufferAttachmentMask implicitBufferAttachmentRenderMask) - { - _implicitBufferAttachmentRenderMask = implicitBufferAttachmentRenderMask; - } - - void setImplicitBufferAttachmentResolveMask(ImplicitBufferAttachmentMask implicitBufferAttachmentResolveMask) - { - _implicitBufferAttachmentResolveMask = implicitBufferAttachmentResolveMask; - } - - /** - Get mask selecting implict buffer attachments for Camera primary FBO - if effectiveMask parameter is set, method follows USE_DISPLAY_SETTINGS_MASK dependence and returns effective mask - if effectiveMask parameter is reset, method returns nominal mask set by the Camera - */ - ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask(bool effectiveMask = false) const - { - if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK ) - { - const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get(); - return ds->getImplicitBufferAttachmentRenderMask(); - } - else - { - return _implicitBufferAttachmentRenderMask; - } - } - - /** - Get mask selecting implict buffer attachments for Camera secondary MULTISAMPLE FBO - if effectiveMask parameter is set, method follows USE_DISPLAY_SETTINGS_MASK dependence and returns effective mask - if effectiveMask parameter is reset, method returns nominal mask set by the Camera - */ - ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask(bool effectiveMask = false) const - { - if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK ) - { - const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get(); - return ds->getImplicitBufferAttachmentResolveMask(); - } - else - { - return _implicitBufferAttachmentResolveMask; - } - } - - /** Create a operation thread for this camera.*/ - void createCameraThread(); - - /** Assign a operation thread to the camera.*/ - void setCameraThread(OperationThread* gt); - - /** Get the operation thread assigned to this camera.*/ - OperationThread* getCameraThread() { return _cameraThread.get(); } - - /** Get the const operation thread assigned to this camera.*/ - const OperationThread* getCameraThread() const { return _cameraThread.get(); } - - - - /** Set the GraphicsContext that provides the mechansim for managing the OpenGL graphics context associated with this camera.*/ - void setGraphicsContext(GraphicsContext* context); - - /** Get the GraphicsContext.*/ - GraphicsContext* getGraphicsContext() { return _graphicsContext.get(); } - - /** Get the const GraphicsContext.*/ - const GraphicsContext* getGraphicsContext() const { return _graphicsContext.get(); } - - - /** Set the Rendering object that is used to implement rendering of the subgraph.*/ - void setRenderer(osg::GraphicsOperation* rc) { _renderer = rc; } - - /** Get the Rendering object that is used to implement rendering of the subgraph.*/ - osg::GraphicsOperation* getRenderer() { return _renderer.get(); } - - /** Get the const Rendering object that is used to implement rendering of the subgraph.*/ - const osg::GraphicsOperation* getRenderer() const { return _renderer.get(); } - - - /** Set the Rendering cache that is used for cached objects associated with rendering of subgraphs.*/ - void setRenderingCache(osg::Object* rc) { _renderingCache = rc; } - - /** Get the Rendering cache that is used for cached objects associated with rendering of subgraphs.*/ - osg::Object* getRenderingCache() { return _renderingCache.get(); } - - /** Get the const Rendering cache that is used for cached objects associated with rendering of subgraphs.*/ - const osg::Object* getRenderingCache() const { return _renderingCache.get(); } - - - /** Draw callback for custom operations.*/ - struct OSG_EXPORT DrawCallback : virtual public Object - { - DrawCallback() {} - - DrawCallback(const DrawCallback&,const CopyOp&) {} - - META_Object(osg, DrawCallback); - - /** Functor method called by rendering thread. Users will typically override this method to carry tasks such as screen capture.*/ - virtual void operator () (osg::RenderInfo& renderInfo) const; - - /** Functor method, provided for backwards compatibility, called by operator() (osg::RenderInfo& renderInfo) method.*/ - virtual void operator () (const osg::Camera& /*camera*/) const {} - }; - - /** Set the initial draw callback for custom operations to be done before the drawing of the camera's subgraph and pre render stages.*/ - void setInitialDrawCallback(DrawCallback* cb) { _initialDrawCallback = cb; } - - /** Get the initial draw callback.*/ - DrawCallback* getInitialDrawCallback() { return _initialDrawCallback.get(); } - - /** Get the const initial draw callback.*/ - const DrawCallback* getInitialDrawCallback() const { return _initialDrawCallback.get(); } - - - /** Set the pre draw callback for custom operations to be done before the drawing of the camera's subgraph but after any pre render stages have been completed.*/ - void setPreDrawCallback(DrawCallback* cb) { _preDrawCallback = cb; } - - /** Get the pre draw callback.*/ - DrawCallback* getPreDrawCallback() { return _preDrawCallback.get(); } - - /** Get the const pre draw callback.*/ - const DrawCallback* getPreDrawCallback() const { return _preDrawCallback.get(); } - - - /** Set the post draw callback for custom operations to be done after the drawing of the camera's subgraph but before the any post render stages have been completed.*/ - void setPostDrawCallback(DrawCallback* cb) { _postDrawCallback = cb; } - - /** Get the post draw callback.*/ - DrawCallback* getPostDrawCallback() { return _postDrawCallback.get(); } - - /** Get the const post draw callback.*/ - const DrawCallback* getPostDrawCallback() const { return _postDrawCallback.get(); } - - - /** Set the final draw callback for custom operations to be done after the drawing of the camera's subgraph and all of the post render stages has been completed.*/ - void setFinalDrawCallback(DrawCallback* cb) { _finalDrawCallback = cb; } - - /** Get the final draw callback.*/ - DrawCallback* getFinalDrawCallback() { return _finalDrawCallback.get(); } - - /** Get the const final draw callback.*/ - const DrawCallback* getFinalDrawCallback() const { return _finalDrawCallback.get(); } - - - OpenThreads::Mutex* getDataChangeMutex() const { return &_dataChangeMutex; } - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases any associated OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objexts - * for all graphics contexts. */ - virtual void releaseGLObjects(osg::State* = 0) const; - - public: - - /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ - virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const; - - /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ - virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const; - - /** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/ - virtual void inheritCullSettings(const CullSettings& settings, unsigned int inheritanceMask); - - protected : - - virtual ~Camera(); - - mutable OpenThreads::Mutex _dataChangeMutex; - - - View* _view; - - osg::ref_ptr _stats; - - bool _allowEventFocus; - - osg::ref_ptr _displaySettings; - - GLbitfield _clearMask; - osg::Vec4 _clearColor; - osg::Vec4 _clearAccum; - double _clearDepth; - int _clearStencil; - - ref_ptr _colorMask; - ref_ptr _viewport; - - TransformOrder _transformOrder; - ProjectionResizePolicy _projectionResizePolicy; - - Matrixd _projectionMatrix; - Matrixd _viewMatrix; - - RenderOrder _renderOrder; - int _renderOrderNum; - - GLenum _drawBuffer; - GLenum _readBuffer; - - RenderTargetImplementation _renderTargetImplementation; - RenderTargetImplementation _renderTargetFallback; - BufferAttachmentMap _bufferAttachmentMap; - ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask; - ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask; - - ref_ptr _cameraThread; - - ref_ptr _graphicsContext; - - ref_ptr _renderer; - ref_ptr _renderingCache; - - ref_ptr _initialDrawCallback; - ref_ptr _preDrawCallback; - ref_ptr _postDrawCallback; - ref_ptr _finalDrawCallback; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/CameraNode b/libs/lib/mac32/include/osg/CameraNode deleted file mode 100644 index 676b84b80aa2064ff607792f6debd1c1d79ba80d..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CameraNode +++ /dev/null @@ -1,27 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CAMERANODE -#define OSG_CAMERANODE 1 - -#include - -namespace osg { - -#ifdef USE_DEPRECATED_API - typedef osg::Camera CameraNode; -#endif - -} - -#endif diff --git a/libs/lib/mac32/include/osg/CameraView b/libs/lib/mac32/include/osg/CameraView deleted file mode 100644 index 048394710d64e19235f006e75a0e75fa6ece4c8a..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CameraView +++ /dev/null @@ -1,105 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CAMERAVIEW -#define OSG_CAMERAVIEW 1 - -#include -#include -#include -#include -#include - -namespace osg { - -/** CameraView - is a Transform that is used to specify camera views from within the scene graph. - * The application must attach a camera to a CameraView via the NodePath from the top of the scene graph - * to the CameraView node itself, and accumulate the view matrix from this NodePath. -*/ -class OSG_EXPORT CameraView : public Transform -{ - public : - CameraView(); - - CameraView(const CameraView& pat,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Transform(pat,copyop), - _position(pat._position), - _attitude(pat._attitude), - _fieldOfView(pat._fieldOfView), - _fieldOfViewMode(pat._fieldOfViewMode), - _focalLength(pat._focalLength) {} - - - META_Node(osg, CameraView); - - /** Set the position of the camera view.*/ - inline void setPosition(const Vec3d& pos) { _position = pos; dirtyBound(); } - - /** Get the position of the camera view.*/ - inline const Vec3d& getPosition() const { return _position; } - - /** Set the attitude of the camera view.*/ - inline void setAttitude(const Quat& quat) { _attitude = quat; dirtyBound(); } - - /** Get the attitude of the camera view.*/ - inline const Quat& getAttitude() const { return _attitude; } - - /** Set the field of view. - * The camera's field of view can be constrained to either the horizontal or vertical axis of the camera, or unconstrained - * in which case the camera/application are left to choose an appropriate field of view. - * The default value if 60 degrees. */ - inline void setFieldOfView(double fieldOfView) { _fieldOfView = fieldOfView; } - - /** Get the field of view.*/ - inline double getFieldOfView() const { return _fieldOfView; } - - enum FieldOfViewMode - { - UNCONSTRAINED, - HORIZONTAL, - VERTICAL - }; - - /** Set the field of view mode - controlling how the field of view of the camera is constrained by the CameraView settings.*/ - inline void setFieldOfViewMode(FieldOfViewMode mode) { _fieldOfViewMode = mode; } - - /** Get the field of view mode.*/ - inline FieldOfViewMode getFieldOfViewMode() const { return _fieldOfViewMode; } - - /** Set the focal length of the camera. - * A focal length of 0.0 indicates that the camera/application should determine the focal length. - * The default value is 0.0. */ - inline void setFocalLength(double focalLength) { _focalLength = focalLength; } - - /** Get the focal length of the camera.*/ - inline double getFocalLength() const { return _focalLength; } - - - virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const; - virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const; - - - protected : - - virtual ~CameraView() {} - - Vec3d _position; - Quat _attitude; - double _fieldOfView; - FieldOfViewMode _fieldOfViewMode; - double _focalLength; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ClampColor b/libs/lib/mac32/include/osg/ClampColor deleted file mode 100644 index b817f4fbc908bf1dac749eb5ff8b160fb614695f..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ClampColor +++ /dev/null @@ -1,139 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CLAMPCOLOR -#define OSG_CLAMPCOLOR 1 - -#include - -#ifndef GL_ARB_color_buffer_float -#define GL_RGBA_FLOAT_MODE_ARB 0x8820 -#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A -#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B -#define GL_CLAMP_READ_COLOR_ARB 0x891C -#define GL_FIXED_ONLY_ARB 0x891D -#endif - -#ifndef GL_FIXED_ONLY -#define GL_FIXED_ONLY GL_FIXED_ONLY_ARB -#define GL_CLAMP_VERTEX_COLOR GL_CLAMP_VERTEX_COLOR_ARB -#define GL_CLAMP_READ_COLOR GL_CLAMP_READ_COLOR_ARB -#define GL_CLAMP_FRAGMENT_COLOR GL_CLAMP_FRAGMENT_COLOR_ARB -#endif - -#if defined(OSG_GL3_AVAILABLE) - #define GL_CLAMP_VERTEX_COLOR 0x891A - #define GL_CLAMP_FRAGMENT_COLOR 0x891B -#endif - -namespace osg { - -/** Encapsulates OpenGL ClampColor state. */ -class OSG_EXPORT ClampColor : public StateAttribute -{ - public : - - ClampColor(); - - ClampColor(GLenum vertexMode, GLenum fragmentMode, GLenum readMode); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - ClampColor(const ClampColor& rhs,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(rhs,copyop), - _clampVertexColor(rhs._clampVertexColor), - _clampFragmentColor(rhs._clampFragmentColor), - _clampReadColor(rhs._clampReadColor) {} - - META_StateAttribute(osg, ClampColor,CLAMPCOLOR); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(ClampColor,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_clampVertexColor) - COMPARE_StateAttribute_Parameter(_clampFragmentColor) - COMPARE_StateAttribute_Parameter(_clampReadColor) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - void setClampVertexColor(GLenum mode) { _clampVertexColor = mode; } - GLenum getClampVertexColor() const { return _clampVertexColor; } - - void setClampFragmentColor(GLenum mode) { _clampFragmentColor = mode; } - GLenum getClampFragmentColor() const { return _clampFragmentColor; } - - void setClampReadColor(GLenum mode) { _clampReadColor = mode; } - GLenum getClampReadColor() const { return _clampReadColor; } - - - virtual void apply(State& state) const; - /** Encapsulates queries of extension availability, obtains extension - * function pointers, and provides convenience wrappers for - * calling extension functions. */ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - void setClampColorSupported(bool flag) { _isClampColorSupported=flag; } - bool isClampColorSupported() const { return _isClampColorSupported; } - - void glClampColor(GLenum target, GLenum mode) const; - - protected: - - ~Extensions() {} - - typedef void (GL_APIENTRY * GLClampColorProc) (GLenum target, GLenum mode); - bool _isClampColorSupported; - GLClampColorProc _glClampColor; - - }; - - /** Returns the Extensions object for the given context. - * If createIfNotInitalized is true and the Extensions object doesn't - * exist, getExtensions() creates it on the given context. - * Returns NULL if createIfNotInitalized is false and the Extensions - * object doesn't exist. */ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions() allows users to override the extensions across graphics contexts. - * Typically used when you have different extensions supported across graphics pipes, - * but need to ensure that they all use the same low common denominator extensions. */ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - - protected : - - virtual ~ClampColor(); - - GLenum _clampVertexColor; - GLenum _clampFragmentColor; - GLenum _clampReadColor; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ClearNode b/libs/lib/mac32/include/osg/ClearNode deleted file mode 100644 index a2e3e31b0e11f33ff1d94eb3b5ba9abb6d4ad8d4..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ClearNode +++ /dev/null @@ -1,75 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CLEARNODE -#define OSG_CLEARNODE 1 - -#include -#include - -namespace osg { - -/** A Group node for clearing the color and depth buffers. Use setClearColor - * to change the clear color, and setRequiresClear to disable/enable the call - * clearing. You might want to disable clearing if you perform your clear by - * drawing fullscreen geometry. If you do this, add child nodes to perform - * such drawing. The default StateSet associated with this node places - * children in render bin -1 to ensure that children are rendered prior to - * the rest of the scene graph. -*/ -class OSG_EXPORT ClearNode : public Group -{ - public : - - ClearNode(); - - ClearNode(const ClearNode& cs, const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Group(cs,copyop), - _requiresClear(cs._requiresClear), - _clearColor(cs._clearColor), - _clearMask(cs._clearMask) {} - - - META_Node(osg, ClearNode); - - /** Enable/disable clearing via glClear. */ - inline void setRequiresClear(bool requiresClear) { _requiresClear = requiresClear; } - - /** Gets whether clearing is enabled or disabled. */ - inline bool getRequiresClear() const { return _requiresClear; } - - /** Sets the clear color. */ - inline void setClearColor(const Vec4& color) { _clearColor = color; } - - /** Returns the clear color. */ - inline const Vec4& getClearColor() const { return _clearColor; } - - /** Set the clear mask used in glClear(..). - * Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */ - inline void setClearMask(GLbitfield mask) { _clearMask = mask; } - - /** Get the clear mask.*/ - inline GLbitfield getClearMask() const { return _clearMask; } - - protected : - - virtual ~ClearNode() {} - - bool _requiresClear; - Vec4 _clearColor; - GLbitfield _clearMask; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ClipNode b/libs/lib/mac32/include/osg/ClipNode deleted file mode 100644 index 4e7dde75f2b64f4fdcbb47bd4b49d663b55ac743..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ClipNode +++ /dev/null @@ -1,113 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CLIPNODE -#define OSG_CLIPNODE 1 - -#include -#include - -namespace osg { - -/** Node for defining the position of ClipPlanes in the scene.*/ -class OSG_EXPORT ClipNode : public Group -{ - - public: - - typedef std::vector > ClipPlaneList; - - - ClipNode(); - - ClipNode(const ClipNode& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, ClipNode); - - enum ReferenceFrame - { - RELATIVE_RF, - ABSOLUTE_RF - }; - - /** Set the light sources's ReferenceFrame, either to be relative to its - * parent reference frame, or relative to an absolute coordinate - * frame. RELATIVE_RF is the default. - * Note: setting the ReferenceFrame to be ABSOLUTE_RF will - * also set the CullingActive flag on the light source, and hence all - * of its parents, to false, thereby disabling culling of it and - * all its parents. This is necessary to prevent inappropriate - * culling, but may impact cull times if the absolute light source is - * deep in the scene graph. It is therefore recommended to only use - * absolute light source at the top of the scene. - */ - void setReferenceFrame(ReferenceFrame rf); - - ReferenceFrame getReferenceFrame() const { return _referenceFrame; } - - - /** Creates six clip planes corresponding to the given BoundingBox. */ - void createClipBox(const BoundingBox& bb,unsigned int clipPlaneNumberBase=0); - - /** Adds the clipplane. Returns true on success, and false if the plane - * has already been added, or if clipplane is NULL. */ - bool addClipPlane(ClipPlane* clipplane); - - /** Removes the clipplane. Returns true on success, false if clipplane - * isn't in this ClipNode.*/ - bool removeClipPlane(ClipPlane* clipplane); - - /** Remove the ClipPlane with the given index. Returns true on success, - * false if pos is not a valid plane index. */ - bool removeClipPlane(unsigned int pos); - - /** Returns the number of ClipPlanes. */ - inline unsigned int getNumClipPlanes() const { return _planes.size(); } - - - /** Get ClipPlane at the given index position. */ - inline ClipPlane* getClipPlane(unsigned int pos) { return _planes[pos].get(); } - - /** Get const ClipPlane at the given index position. */ - inline const ClipPlane* getClipPlane(unsigned int pos) const { return _planes[pos].get(); } - - /** Set the ClipPlaneList. */ - inline void setClipPlaneList(const ClipPlaneList& cpl) { _planes=cpl; } - - /** Get the ClipPlaneList. */ - inline ClipPlaneList& getClipPlaneList() { return _planes; } - - /** Get the const ClipPlaneList. */ - inline const ClipPlaneList& getClipPlaneList() const { return _planes; } - - /** Set the GLModes for all ClipPlanes, on the StateSet. */ - void setStateSetModes(StateSet&,StateAttribute::GLModeValue) const; - - /** Set up the local StateSet. */ - void setLocalStateSetModes(StateAttribute::GLModeValue=StateAttribute::ON); - - virtual BoundingSphere computeBound() const; - - protected: - - virtual ~ClipNode(); - - StateAttribute::GLModeValue _value; - ClipPlaneList _planes; - - ReferenceFrame _referenceFrame; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ClipPlane b/libs/lib/mac32/include/osg/ClipPlane deleted file mode 100644 index 0913039b71e14e5f97db857d5e579d307955fe26..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ClipPlane +++ /dev/null @@ -1,127 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CLIPPLANE -#define OSG_CLIPPLANE 1 - -#include -#include -#include - -#ifndef GL_CLIP_PLANE0 - #define GL_CLIP_PLANE0 0x3000 - #define GL_CLIP_PLANE1 0x3001 - #define GL_CLIP_PLANE2 0x3002 - #define GL_CLIP_PLANE3 0x3003 - #define GL_CLIP_PLANE4 0x3004 - #define GL_CLIP_PLANE5 0x3005 -#endif - -namespace osg { - -/** Encapsulates OpenGL glClipPlane(). -*/ -class OSG_EXPORT ClipPlane : public StateAttribute -{ - public : - - ClipPlane(); - inline ClipPlane(unsigned int no):_clipPlaneNum(no) {} - inline ClipPlane(unsigned int no,const Vec4d& plane):_clipPlaneNum(no) { setClipPlane(plane); } - inline ClipPlane(unsigned int no,const Plane& plane):_clipPlaneNum(no) { setClipPlane(plane); } - inline ClipPlane(unsigned int no,double a,double b,double c,double d): _clipPlaneNum(no) { setClipPlane(a,b,c,d); } - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - ClipPlane(const ClipPlane& cp,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(cp,copyop) - { - _clipPlane[0]=cp._clipPlane[0]; - _clipPlane[1]=cp._clipPlane[1]; - _clipPlane[2]=cp._clipPlane[2]; - _clipPlane[3]=cp._clipPlane[3]; - _clipPlaneNum=cp._clipPlaneNum; - } - - virtual osg::Object* cloneType() const { return new ClipPlane( _clipPlaneNum ); } - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new ClipPlane(*this,copyop); } - virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "ClipPlane"; } - virtual Type getType() const { return CLIPPLANE; } - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(ClipPlane,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_clipPlaneNum) - COMPARE_StateAttribute_Parameter(_clipPlane[0]) - COMPARE_StateAttribute_Parameter(_clipPlane[1]) - COMPARE_StateAttribute_Parameter(_clipPlane[2]) - COMPARE_StateAttribute_Parameter(_clipPlane[3]) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - virtual unsigned int getMember() const { return _clipPlaneNum; } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode((GLMode)(GL_CLIP_PLANE0+_clipPlaneNum)); - return true; - } - - - /** Set the clip plane with the given Plane. */ - void setClipPlane(const Plane& plane) - { - _clipPlane.set(plane[0],plane[1],plane[2],plane[3]); - } - - /** Defines the plane as [ a b c d ]. */ - void setClipPlane(double a,double b,double c,double d) - { - _clipPlane.set(a,b,c,d); - } - - /** Set the clip plane with the given Vec4. */ - inline void setClipPlane(const Vec4d& plane) { _clipPlane = plane; } - - /** Gets the clip plane as a Vec4d. */ - const Vec4d& getClipPlane() const { return _clipPlane; } - - - /** Sets the clip plane number. */ - void setClipPlaneNum(unsigned int num); - - /** Gets the clip plane number. */ - unsigned int getClipPlaneNum() const; - - /** Applies the clip plane's state to the OpenGL state machine. */ - virtual void apply(State& state) const; - - protected : - - virtual ~ClipPlane(); - - Vec4d _clipPlane; - unsigned int _clipPlaneNum; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ClusterCullingCallback b/libs/lib/mac32/include/osg/ClusterCullingCallback deleted file mode 100644 index 9aa8a9590e7ceef6ca8fa6bd15653a635b5b1bb8..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ClusterCullingCallback +++ /dev/null @@ -1,75 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CLUSTERCULLINGCALLBACK -#define OSG_CLUSTERCULLINGCALLBACK 1 - -#include -#include - -namespace osg { - -/** Implements cluster culling to cull back facing drawables. Derived from - * Drawable::CullCallback. -*/ -class OSG_EXPORT ClusterCullingCallback : public Drawable::CullCallback, public NodeCallback -{ - public: - - ClusterCullingCallback(); - ClusterCullingCallback(const ClusterCullingCallback& ccc,const CopyOp& copyop); - ClusterCullingCallback(const osg::Vec3& controlPoint, const osg::Vec3& normal, float deviation); - ClusterCullingCallback(const osg::Drawable* drawable); - - META_Object(osg,ClusterCullingCallback); - - /** Computes the control point, normal, and deviation from the - * given drawable contents. */ - void computeFrom(const osg::Drawable* drawable); - - /** Transform the ClusterCullingCallback's positional members to a new coordinate frame.*/ - void transform(const osg::Matrixd& matrix); - - void set(const osg::Vec3& controlPoint, const osg::Vec3& normal, float deviation, float radius); - - void setControlPoint(const osg::Vec3& controlPoint) { _controlPoint = controlPoint; } - const osg::Vec3& getControlPoint() const { return _controlPoint; } - - void setNormal(const osg::Vec3& normal) { _normal = normal; } - const osg::Vec3& getNormal() const { return _normal; } - - void setRadius(float radius) { _radius = radius; } - float getRadius() const { return _radius; } - - void setDeviation(float deviation) { _deviation = deviation; } - float getDeviation() const { return _deviation; } - - virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const; - - /** Callback method called by the NodeVisitor when visiting a node.*/ - virtual void operator()(Node* node, NodeVisitor* nv); - - protected: - - virtual ~ClusterCullingCallback() {} - - osg::Vec3 _controlPoint; - osg::Vec3 _normal; - float _radius; - float _deviation; -}; - - -} - -#endif diff --git a/libs/lib/mac32/include/osg/CollectOccludersVisitor b/libs/lib/mac32/include/osg/CollectOccludersVisitor deleted file mode 100644 index b0491318f886164bf64d17f17640babd18da3661..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CollectOccludersVisitor +++ /dev/null @@ -1,109 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_COLLECTOCCLUDERSVISITOR -#define OSG_COLLECTOCCLUDERSVISITOR 1 - -#include -#include - -#include - -namespace osg { - -class OSG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::CullStack -{ - public: - - - typedef std::set ShadowVolumeOccluderSet; - - CollectOccludersVisitor(); - virtual ~CollectOccludersVisitor(); - - META_NodeVisitor("osg","CollectOccludersVisitor") - - virtual CollectOccludersVisitor* cloneType() const { return new CollectOccludersVisitor(); } - - virtual void reset(); - - virtual float getDistanceToEyePoint(const Vec3& pos, bool withLODScale) const; - virtual float getDistanceToViewPoint(const Vec3& pos, bool withLODScale) const; - - virtual float getDistanceFromEyePoint(const Vec3& pos, bool withLODScale) const; - - virtual void apply(osg::Node&); - virtual void apply(osg::Transform& node); - virtual void apply(osg::Projection& node); - - virtual void apply(osg::Switch& node); - virtual void apply(osg::LOD& node); - virtual void apply(osg::OccluderNode& node); - - /** Sets the minimum shadow occluder volume that an active occluder - * must have. vol is units relative the clip space volume where 1.0 - * is the whole clip space. */ - void setMinimumShadowOccluderVolume(float vol) { _minimumShadowOccluderVolume = vol; } - float getMinimumShadowOccluderVolume() const { return _minimumShadowOccluderVolume; } - - /** Sets the maximum number of occluders to have active for culling - * purposes. */ - void setMaximumNumberOfActiveOccluders(unsigned int num) { _maximumNumberOfActiveOccluders = num; } - unsigned int getMaximumNumberOfActiveOccluders() const { return _maximumNumberOfActiveOccluders; } - - void setCreateDrawablesOnOccludeNodes(bool flag) { _createDrawables=flag; } - bool getCreateDrawablesOnOccludeNodes() const { return _createDrawables; } - - void setCollectedOccluderSet(const ShadowVolumeOccluderSet& svol) { _occluderSet = svol; } - ShadowVolumeOccluderSet& getCollectedOccluderSet() { return _occluderSet; } - const ShadowVolumeOccluderSet& getCollectedOccluderSet() const { return _occluderSet; } - - /** Removes occluded occluders for the collected occluders list, then - * discards all but MaximumNumberOfActiveOccluders of occluders, - * discarding the occluders with the lowest shadow occluder volume. */ - void removeOccludedOccluders(); - - - protected: - - /** Prevents unwanted copy construction. */ - //CollectOccludersVisitor(const CollectOccludersVisitor&):osg::NodeVisitor(),osg::CullStack() {} - - /** Prevents unwanted copy operator. */ - CollectOccludersVisitor& operator = (const CollectOccludersVisitor&) { return *this; } - - inline void handle_cull_callbacks_and_traverse(osg::Node& node) - { - /*osg::NodeCallback* callback = node.getCullCallback(); - if (callback) (*callback)(&node,this); - else*/ if (node.getNumChildrenWithOccluderNodes()>0) traverse(node); - } - - inline void handle_cull_callbacks_and_accept(osg::Node& node,osg::Node* acceptNode) - { - /*osg::NodeCallback* callback = node.getCullCallback(); - if (callback) (*callback)(&node,this); - else*/ if (node.getNumChildrenWithOccluderNodes()>0) acceptNode->accept(*this); - } - - float _minimumShadowOccluderVolume; - unsigned _maximumNumberOfActiveOccluders; - bool _createDrawables; - ShadowVolumeOccluderSet _occluderSet; - -}; - -} - -#endif - diff --git a/libs/lib/mac32/include/osg/ColorMask b/libs/lib/mac32/include/osg/ColorMask deleted file mode 100644 index 48ac2eb535dfb43ec1c65761f2885211d7d9189f..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ColorMask +++ /dev/null @@ -1,100 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_COLORMASK -#define OSG_COLORMASK 1 - -#include -#include - -namespace osg { - -/** Encapsulates OpenGL glColorMaskFunc/Op/Mask functions. -*/ -class OSG_EXPORT ColorMask : public StateAttribute -{ - public : - - - ColorMask(); - - ColorMask(bool red,bool green,bool blue,bool alpha): - _red(red), - _green(green), - _blue(blue), - _alpha(alpha) {} - - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - ColorMask(const ColorMask& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(cm,copyop), - _red(cm._red), - _green(cm._green), - _blue(cm._blue), - _alpha(cm._alpha) {} - - META_StateAttribute(osg, ColorMask, COLORMASK); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(ColorMask,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_red) - COMPARE_StateAttribute_Parameter(_green) - COMPARE_StateAttribute_Parameter(_blue) - COMPARE_StateAttribute_Parameter(_alpha) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - inline void setMask(bool red,bool green,bool blue,bool alpha) - { - _red = red; - _green = green; - _blue = blue; - _alpha = alpha; - - } - - inline void setRedMask(bool mask) { _red=mask; } - inline bool getRedMask() const { return _red; } - - inline void setGreenMask(bool mask) { _green=mask; } - inline bool getGreenMask() const { return _green; } - - inline void setBlueMask(bool mask) { _blue=mask; } - inline bool getBlueMask() const { return _blue; } - - inline void setAlphaMask(bool mask) { _alpha=mask; } - inline bool getAlphaMask() const { return _alpha; } - - virtual void apply(State& state) const; - - protected: - - virtual ~ColorMask(); - - bool _red; - bool _green; - bool _blue; - bool _alpha; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ColorMatrix b/libs/lib/mac32/include/osg/ColorMatrix deleted file mode 100644 index 169419c01fbe9bef2d3882d3a3e27354e8e16d07..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ColorMatrix +++ /dev/null @@ -1,72 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_COLORMATRIX -#define OSG_COLORMATRIX 1 - -#include -#include - -namespace osg { - -/** Encapsulates OpenGL color matrix functionality. */ -class OSG_EXPORT ColorMatrix : public StateAttribute -{ - public : - - ColorMatrix(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - ColorMatrix(const ColorMatrix& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(cm,copyop), - _matrix(cm._matrix) {} - - META_StateAttribute(osg, ColorMatrix, COLORMATRIX); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(ColorMatrix,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_matrix) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - /** Sets the color matrix. */ - inline void setMatrix(const Matrix& matrix) { _matrix = matrix; } - - /** Gets the color matrix. */ - inline Matrix& getMatrix() { return _matrix; } - - /** Gets the const color matrix. */ - inline const Matrix& getMatrix() const { return _matrix; } - - /** Applies as OpenGL texture matrix. */ - virtual void apply(State& state) const; - - protected: - - virtual ~ColorMatrix( void ); - - Matrix _matrix; - -}; - -} - - -#endif diff --git a/libs/lib/mac32/include/osg/ComputeBoundsVisitor b/libs/lib/mac32/include/osg/ComputeBoundsVisitor deleted file mode 100644 index 320870ff1d795ad5efe50c15dee6fbd30340a3a5..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ComputeBoundsVisitor +++ /dev/null @@ -1,61 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_COMPUTEBOUNDSVISITOR -#define OSG_COMPUTEBOUNDSVISITOR 1 - -#include -#include -#include - -namespace osg { - -class OSG_EXPORT ComputeBoundsVisitor : public osg::NodeVisitor -{ -public: - - ComputeBoundsVisitor(TraversalMode traversalMode = TRAVERSE_ALL_CHILDREN); - - META_NodeVisitor("osg","ComputeBoundsVisitor") - - virtual void reset(); - - osg::BoundingBox& getBoundingBox() { return _bb; } - - void getPolytope(osg::Polytope& polytope, float margin=0.1) const; - - void getBase(osg::Polytope& polytope, float margin=0.1) const; - - void apply(osg::Node& node); - - void apply(osg::Transform& transform); - - void apply(osg::Geode& geode); - - inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); } - - inline void popMatrix() { _matrixStack.pop_back(); } - - void applyDrawable(osg::Drawable* drawable); - -protected: - - typedef std::vector MatrixStack; - - MatrixStack _matrixStack; - osg::BoundingBox _bb; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Config b/libs/lib/mac32/include/osg/Config deleted file mode 100644 index 35d05934f52ddad19329ac42ed2ed5035930caf3..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Config +++ /dev/null @@ -1,47 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008-2009 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -/**************************************************************************** - * THIS FILE IS AUTOGENERATED BY CMAKE. DO NOT EDIT! - ****************************************************************************/ - -/* Changes to the configuration reflected here can be made with ccmake on - * unix or with cmake-gui on windows. Alternatively you can use cmake's -D - * or -P switches to set some configuration values at cmake configuration time. - */ - -#ifndef OSG_CONFIG -#define OSG_CONFIG 1 - -/* #undef OSG_NOTIFY_DISABLED */ -/* #undef OSG_USE_FLOAT_MATRIX */ -/* #undef OSG_USE_FLOAT_PLANE */ -#define OSG_USE_FLOAT_BOUNDINGSPHERE -#define OSG_USE_FLOAT_BOUNDINGBOX -#define OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION -/* #undef OSG_USE_UTF8_FILENAME */ -#define OSG_DISABLE_MSVC_WARNINGS - -#define OSG_GL1_AVAILABLE -#define OSG_GL2_AVAILABLE -/* #undef OSG_GL3_AVAILABLE */ -/* #undef OSG_GLES1_AVAILABLE */ -/* #undef OSG_GLES2_AVAILABLE */ -/* #undef OSG_GL_LIBRARY_STATIC */ -#define OSG_GL_DISPLAYLISTS_AVAILABLE -#define OSG_GL_MATRICES_AVAILABLE -#define OSG_GL_VERTEX_FUNCS_AVAILABLE -#define OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE -#define OSG_GL_FIXED_FUNCTION_AVAILABLE - -#endif diff --git a/libs/lib/mac32/include/osg/ConvexPlanarOccluder b/libs/lib/mac32/include/osg/ConvexPlanarOccluder deleted file mode 100644 index 397eb40a1b32b8a02eef9e710fe2c7ecee3fb7e1..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ConvexPlanarOccluder +++ /dev/null @@ -1,67 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CONVEXPLANAROCCLUDER -#define OSG_CONVEXPLANAROCCLUDER 1 - -#include -#include - -namespace osg { - -class OccluderVolume; - -/** A class for representing convex clipping volumes made up of several ConvexPlanarPolygon. */ -class OSG_EXPORT ConvexPlanarOccluder : public Object -{ - - public: - - ConvexPlanarOccluder():Object() {} - ConvexPlanarOccluder(const ConvexPlanarOccluder& cpo,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Object(cpo,copyop), - _occluder(cpo._occluder), - _holeList(cpo._holeList) {} - - META_Object(osg,ConvexPlanarOccluder); - - void setOccluder(const ConvexPlanarPolygon& cpp) { _occluder = cpp; } - - ConvexPlanarPolygon& getOccluder() { return _occluder; } - - const ConvexPlanarPolygon& getOccluder() const { return _occluder; } - - - - typedef std::vector HoleList; - - void addHole(const ConvexPlanarPolygon& cpp) { _holeList.push_back(cpp); } - - void setHoleList(const HoleList& holeList) { _holeList=holeList; } - - HoleList& getHoleList() { return _holeList; } - - const HoleList& getHoleList() const { return _holeList; } - - protected: - - ~ConvexPlanarOccluder(); // {} - - ConvexPlanarPolygon _occluder; - HoleList _holeList; - -}; - -} // end of namespace - -#endif diff --git a/libs/lib/mac32/include/osg/ConvexPlanarPolygon b/libs/lib/mac32/include/osg/ConvexPlanarPolygon deleted file mode 100644 index 8c4546b8bef75908f42a2d649034151e1cdf81be..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ConvexPlanarPolygon +++ /dev/null @@ -1,49 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CONVEXPLANARPOLYGON -#define OSG_CONVEXPLANARPOLYGON 1 - -#include - -#include - -namespace osg { - -/** A class for representing components of convex clipping volumes. */ -class OSG_EXPORT ConvexPlanarPolygon -{ - - public: - - ConvexPlanarPolygon(); - - typedef std::vector VertexList; - - void add(const Vec3& v) { _vertexList.push_back(v); } - - void setVertexList(const VertexList& vertexList) { _vertexList=vertexList; } - - VertexList& getVertexList() { return _vertexList; } - - const VertexList& getVertexList() const { return _vertexList; } - - protected: - - VertexList _vertexList; - -}; - -} // end of namespace - -#endif diff --git a/libs/lib/mac32/include/osg/CoordinateSystemNode b/libs/lib/mac32/include/osg/CoordinateSystemNode deleted file mode 100644 index 4235ffe30bcc459428d529cc1d57aba8cd695ca5..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CoordinateSystemNode +++ /dev/null @@ -1,248 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_COORDINATESYSTEMNODE -#define OSG_COORDINATESYSTEMNODE 1 - -#include -#include - -namespace osg -{ - -const double WGS_84_RADIUS_EQUATOR = 6378137.0; -const double WGS_84_RADIUS_POLAR = 6356752.3142; - -/** EllipsoidModel encapsulates the ellipsoid used to model astronomical bodies, - * such as sun, planets, moon etc. - * All distance quantities (i.e. heights + radius) are in meters, - * and latitude and longitude are in radians.*/ -class EllipsoidModel : public Object -{ - public: - - /** WGS_84 is a common representation of the earth's spheroid */ - EllipsoidModel(double radiusEquator = WGS_84_RADIUS_EQUATOR, - double radiusPolar = WGS_84_RADIUS_POLAR): - _radiusEquator(radiusEquator), - _radiusPolar(radiusPolar) { computeCoefficients(); } - - EllipsoidModel(const EllipsoidModel& et,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Object(et,copyop), - _radiusEquator(et._radiusEquator), - _radiusPolar(et._radiusPolar) { computeCoefficients(); } - - META_Object(osg,EllipsoidModel); - - void setRadiusEquator(double radius) { _radiusEquator = radius; computeCoefficients(); } - double getRadiusEquator() const { return _radiusEquator; } - - void setRadiusPolar(double radius) { _radiusPolar = radius; computeCoefficients(); } - double getRadiusPolar() const { return _radiusPolar; } - - inline void convertLatLongHeightToXYZ(double latitude, double longitude, double height, - double& X, double& Y, double& Z) const; - - inline void convertXYZToLatLongHeight(double X, double Y, double Z, - double& latitude, double& longitude, double& height) const; - - inline void computeLocalToWorldTransformFromLatLongHeight(double latitude, double longitude, double height, osg::Matrixd& localToWorld) const; - - inline void computeLocalToWorldTransformFromXYZ(double X, double Y, double Z, osg::Matrixd& localToWorld) const; - - inline void computeCoordinateFrame(double latitude, double longitude, osg::Matrixd& localToWorld) const; - - inline osg::Vec3d computeLocalUpVector(double X, double Y, double Z) const; - - // Convenience method for determining if EllipsoidModel is a stock WGS84 ellipsoid - inline bool isWGS84() const {return(_radiusEquator == WGS_84_RADIUS_EQUATOR && _radiusPolar == WGS_84_RADIUS_POLAR);} - - // Compares two EllipsoidModel by comparing critical internal values. - // Ignores _eccentricitySquared since it's just a cached value derived from - // the _radiusEquator and _radiusPolar members. - friend bool operator == ( const EllipsoidModel & e1, const EllipsoidModel& e2) {return(e1._radiusEquator == e2._radiusEquator && e1._radiusPolar == e2._radiusPolar);} - - - protected: - - void computeCoefficients() - { - double flattening = (_radiusEquator-_radiusPolar)/_radiusEquator; - _eccentricitySquared = 2*flattening - flattening*flattening; - } - - double _radiusEquator; - double _radiusPolar; - double _eccentricitySquared; - -}; - -/** CoordinateFrame encapsulates the orientation of east, north and up.*/ -typedef Matrixd CoordinateFrame; - -/** CoordinateSystem encapsulate the coordinate system that is associated with objects in a scene. - For an overview of common earth bases coordinate systems see http://www.colorado.edu/geography/gcraft/notes/coordsys/coordsys_f.html */ -class OSG_EXPORT CoordinateSystemNode : public Group -{ - public: - - CoordinateSystemNode(); - - CoordinateSystemNode(const std::string& format, const std::string& cs); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - CoordinateSystemNode(const CoordinateSystemNode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - - META_Node(osg,CoordinateSystemNode); - - - /** Set the coordinate system node up by copying the format, coordinate system string, and ellipsoid model of another coordinate system node.*/ - void set(const CoordinateSystemNode& csn); - - /** Set the coordinate system format string. Typical values would be WKT, PROJ4, USGS etc.*/ - void setFormat(const std::string& format) { _format = format; } - - /** Get the coordinate system format string.*/ - const std::string& getFormat() const { return _format; } - - /** Set the CoordinateSystem reference string, should be stored in a form consistent with the Format.*/ - void setCoordinateSystem(const std::string& cs) { _cs = cs; } - - /** Get the CoordinateSystem reference string.*/ - const std::string& getCoordinateSystem() const { return _cs; } - - - /** Set EllipsoidModel to describe the model used to map lat, long and height into geocentric XYZ and back. */ - void setEllipsoidModel(EllipsoidModel* ellipsode) { _ellipsoidModel = ellipsode; } - - /** Get the EllipsoidModel.*/ - EllipsoidModel* getEllipsoidModel() { return _ellipsoidModel.get(); } - - /** Get the const EllipsoidModel.*/ - const EllipsoidModel* getEllipsoidModel() const { return _ellipsoidModel.get(); } - - /** Compute the local coordinate frame for specified point.*/ - CoordinateFrame computeLocalCoordinateFrame(const Vec3d& position) const; - - /** Compute the local up-vector for specified point.*/ - osg::Vec3d computeLocalUpVector(const Vec3d& position) const; - - protected: - - virtual ~CoordinateSystemNode() {} - - std::string _format; - std::string _cs; - ref_ptr _ellipsoidModel; - -}; - - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// implement inline methods. -// -inline void EllipsoidModel::convertLatLongHeightToXYZ(double latitude, double longitude, double height, - double& X, double& Y, double& Z) const -{ - // for details on maths see http://www.colorado.edu/geography/gcraft/notes/datum/gif/llhxyz.gif - double sin_latitude = sin(latitude); - double cos_latitude = cos(latitude); - double N = _radiusEquator / sqrt( 1.0 - _eccentricitySquared*sin_latitude*sin_latitude); - X = (N+height)*cos_latitude*cos(longitude); - Y = (N+height)*cos_latitude*sin(longitude); - Z = (N*(1-_eccentricitySquared)+height)*sin_latitude; -} - - -inline void EllipsoidModel::convertXYZToLatLongHeight(double X, double Y, double Z, - double& latitude, double& longitude, double& height) const -{ - // http://www.colorado.edu/geography/gcraft/notes/datum/gif/xyzllh.gif - double p = sqrt(X*X + Y*Y); - double theta = atan2(Z*_radiusEquator , (p*_radiusPolar)); - double eDashSquared = (_radiusEquator*_radiusEquator - _radiusPolar*_radiusPolar)/ - (_radiusPolar*_radiusPolar); - - double sin_theta = sin(theta); - double cos_theta = cos(theta); - - latitude = atan( (Z + eDashSquared*_radiusPolar*sin_theta*sin_theta*sin_theta) / - (p - _eccentricitySquared*_radiusEquator*cos_theta*cos_theta*cos_theta) ); - longitude = atan2(Y,X); - - double sin_latitude = sin(latitude); - double N = _radiusEquator / sqrt( 1.0 - _eccentricitySquared*sin_latitude*sin_latitude); - - height = p/cos(latitude) - N; -} - -inline void EllipsoidModel::computeLocalToWorldTransformFromLatLongHeight(double latitude, double longitude, double height, osg::Matrixd& localToWorld) const -{ - double X, Y, Z; - convertLatLongHeightToXYZ(latitude,longitude,height,X,Y,Z); - - localToWorld.makeTranslate(X,Y,Z); - computeCoordinateFrame(latitude, longitude, localToWorld); -} - -inline void EllipsoidModel::computeLocalToWorldTransformFromXYZ(double X, double Y, double Z, osg::Matrixd& localToWorld) const -{ - double latitude, longitude, height; - convertXYZToLatLongHeight(X,Y,Z,latitude,longitude,height); - - localToWorld.makeTranslate(X,Y,Z); - computeCoordinateFrame(latitude, longitude, localToWorld); -} - -inline void EllipsoidModel::computeCoordinateFrame(double latitude, double longitude, osg::Matrixd& localToWorld) const -{ - // Compute up vector - osg::Vec3d up ( cos(longitude)*cos(latitude), sin(longitude)*cos(latitude), sin(latitude)); - - // Compute east vector - osg::Vec3d east (-sin(longitude), cos(longitude), 0); - - // Compute north vector = outer product up x east - osg::Vec3d north = up ^ east; - - // set matrix - localToWorld(0,0) = east[0]; - localToWorld(0,1) = east[1]; - localToWorld(0,2) = east[2]; - - localToWorld(1,0) = north[0]; - localToWorld(1,1) = north[1]; - localToWorld(1,2) = north[2]; - - localToWorld(2,0) = up[0]; - localToWorld(2,1) = up[1]; - localToWorld(2,2) = up[2]; -} - -inline osg::Vec3d EllipsoidModel::computeLocalUpVector(double X, double Y, double Z) const -{ - // Note latitude is angle between normal to ellipsoid surface and XY-plane - double latitude; - double longitude; - double altitude; - convertXYZToLatLongHeight(X,Y,Z,latitude,longitude,altitude); - - // Compute up vector - return osg::Vec3d( cos(longitude) * cos(latitude), - sin(longitude) * cos(latitude), - sin(latitude)); -} - -} -#endif diff --git a/libs/lib/mac32/include/osg/CopyOp b/libs/lib/mac32/include/osg/CopyOp deleted file mode 100644 index 129225b9e9772ff702ae10c08f05a0dc91403c2c..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CopyOp +++ /dev/null @@ -1,93 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_COPYOP -#define OSG_COPYOP 1 - -#include - -namespace osg { - -class Referenced; -class Object; -class Image; -class Texture; -class StateSet; -class StateAttribute; -class StateAttributeCallback; -class Uniform; -class Node; -class Drawable; -class Array; -class PrimitiveSet; -class Shape; -class NodeCallback; - - -/** Copy Op(erator) used to control whether shallow or deep copy is used - * during copy construction and clone operation.*/ -class OSG_EXPORT CopyOp -{ - - public: - - enum Options - { - SHALLOW_COPY = 0, - DEEP_COPY_OBJECTS = 1<<0, - DEEP_COPY_NODES = 1<<1, - DEEP_COPY_DRAWABLES = 1<<2, - DEEP_COPY_STATESETS = 1<<3, - DEEP_COPY_STATEATTRIBUTES = 1<<4, - DEEP_COPY_TEXTURES = 1<<5, - DEEP_COPY_IMAGES = 1<<6, - DEEP_COPY_ARRAYS = 1<<7, - DEEP_COPY_PRIMITIVES = 1<<8, - DEEP_COPY_SHAPES = 1<<9, - DEEP_COPY_UNIFORMS = 1<<10, - DEEP_COPY_CALLBACKS = 1<<11, - DEEP_COPY_USERDATA = 1<<12, - DEEP_COPY_ALL = 0x7FFFFFFF - }; - - typedef unsigned int CopyFlags; - - inline CopyOp(CopyFlags flags=SHALLOW_COPY):_flags(flags) {} - virtual ~CopyOp() {} - - void setCopyFlags(CopyFlags flags) { _flags = flags; } - CopyFlags getCopyFlags() const { return _flags; } - - virtual Referenced* operator() (const Referenced* ref) const; - virtual Object* operator() (const Object* obj) const; - virtual Node* operator() (const Node* node) const; - virtual Drawable* operator() (const Drawable* drawable) const; - virtual StateSet* operator() (const StateSet* stateset) const; - virtual StateAttribute* operator() (const StateAttribute* attr) const; - virtual Texture* operator() (const Texture* text) const; - virtual Image* operator() (const Image* image) const; - virtual Array* operator() (const Array* array) const; - virtual PrimitiveSet* operator() (const PrimitiveSet* primitives) const; - virtual Shape* operator() (const Shape* shape) const; - virtual Uniform* operator() (const Uniform* shape) const; - virtual NodeCallback* operator() (const NodeCallback* nodecallback) const; - virtual StateAttributeCallback* operator() (const StateAttributeCallback* stateattributecallback) const; - - protected: - - CopyFlags _flags; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/CullFace b/libs/lib/mac32/include/osg/CullFace deleted file mode 100644 index 647ce20568adee7912b2ccc1c3f8a5dc39b0433d..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CullFace +++ /dev/null @@ -1,79 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CULLFACE -#define OSG_CULLFACE 1 - -#include -#include - -namespace osg { - -/** Class to globally enable/disable OpenGL's polygon culling mode. - */ -class OSG_EXPORT CullFace : public StateAttribute -{ - public : - - enum Mode { - FRONT = GL_FRONT, - BACK = GL_BACK, - FRONT_AND_BACK = GL_FRONT_AND_BACK - }; - - CullFace(Mode mode=BACK): - _mode(mode) {} - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - CullFace(const CullFace& cf,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(cf,copyop), - _mode(cf._mode) {} - - META_StateAttribute(osg, CullFace, CULLFACE); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(CullFace,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_mode) - - return 0; // passed all the above comparison macros, must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_CULL_FACE); - return true; - } - - inline void setMode(Mode mode) { _mode = mode; } - - inline Mode getMode() const { return _mode; } - - virtual void apply(State& state) const; - - protected: - - virtual ~CullFace(); - - Mode _mode; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/CullSettings b/libs/lib/mac32/include/osg/CullSettings deleted file mode 100644 index 3bebebf84580d7f5a3251b03ca709d59214bd4d9..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CullSettings +++ /dev/null @@ -1,274 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CULLSETTINGS -#define OSG_CULLSETTINGS 1 - -#include -#include -#include - -namespace osg { - -// forward declare -class ArgumentParser; -class ApplicationUsage; - -class OSG_EXPORT CullSettings -{ - public: - - CullSettings() - { - setDefaults(); - readEnvironmentalVariables(); - } - - CullSettings(ArgumentParser& arguments) - { - setDefaults(); - readEnvironmentalVariables(); - readCommandLine(arguments); - } - - CullSettings(const CullSettings& cs); - - virtual ~CullSettings() {} - - CullSettings& operator = (const CullSettings& settings) - { - if (this==&settings) return *this; - setCullSettings(settings); - return *this; - } - - - virtual void setDefaults(); - - - enum VariablesMask - { - COMPUTE_NEAR_FAR_MODE = (0x1 << 0), - CULLING_MODE = (0x1 << 1), - LOD_SCALE = (0x1 << 2), - SMALL_FEATURE_CULLING_PIXEL_SIZE = (0x1 << 3), - CLAMP_PROJECTION_MATRIX_CALLBACK = (0x1 << 4), - NEAR_FAR_RATIO = (0x1 << 5), - IMPOSTOR_ACTIVE = (0x1 << 6), - DEPTH_SORT_IMPOSTOR_SPRITES = (0x1 << 7), - IMPOSTOR_PIXEL_ERROR_THRESHOLD = (0x1 << 8), - NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES = (0x1 << 9), - CULL_MASK = (0x1 << 10), - CULL_MASK_LEFT = (0x1 << 11), - CULL_MASK_RIGHT = (0x1 << 12), - CLEAR_COLOR = (0x1 << 13), - CLEAR_MASK = (0x1 << 14), - LIGHTING_MODE = (0x1 << 15), - LIGHT = (0x1 << 16), - DRAW_BUFFER = (0x1 << 17), - READ_BUFFER = (0x1 << 18), - - NO_VARIABLES = 0x00000000, - ALL_VARIABLES = 0x7FFFFFFF - }; - - typedef int InheritanceMask; - - /** Set the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object.*/ - void setInheritanceMask(InheritanceMask mask) { _inheritanceMask = mask; } - - /** Get the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object.*/ - InheritanceMask getInheritanceMask() const { return _inheritanceMask; } - - /** Set the local cull settings values from specified CullSettings object.*/ - void setCullSettings(const CullSettings& settings); - - /** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/ - virtual void inheritCullSettings(const CullSettings& settings) { inheritCullSettings(settings, _inheritanceMask); } - - /** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/ - virtual void inheritCullSettings(const CullSettings& settings, unsigned int inheritanceMask); - - /** read the environmental variables.*/ - void readEnvironmentalVariables(); - - /** read the commandline arguments.*/ - void readCommandLine(ArgumentParser& arguments); - - - enum InheritanceMaskActionOnAttributeSetting - { - DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT, - DO_NOT_MODIFY_INHERITANCE_MASK - }; - - void setInheritanceMaskActionOnAttributeSetting(InheritanceMaskActionOnAttributeSetting action) { _inheritanceMaskActionOnAttributeSetting = action; } - InheritanceMaskActionOnAttributeSetting getInheritanceMaskActionOnAttributeSetting() const { return _inheritanceMaskActionOnAttributeSetting; } - - /** Apply the action, specified by the InheritanceMaskActionOnAttributeSetting, to apply to the inheritance bit mask. - * This method is called by CullSettings::set*() parameter methods to ensure that CullSettings inheritance mechanisms doesn't overwrite the local parameter settings.*/ - inline void applyMaskAction(unsigned int maskBit) - { - if (_inheritanceMaskActionOnAttributeSetting==DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT) - { - _inheritanceMask = _inheritanceMask & (~maskBit); - } - } - - - /** Switch the creation of Impostors on or off. - * Setting active to false forces the CullVisitor to use the Impostor - * LOD children for rendering. Setting active to true forces the - * CullVisitor to create the appropriate pre-rendering stages which - * render to the ImpostorSprite's texture.*/ - void setImpostorsActive(bool active) { _impostorActive = active; applyMaskAction(IMPOSTOR_ACTIVE); } - - /** Get whether impostors are active or not. */ - bool getImpostorsActive() const { return _impostorActive; } - - /** Set the impostor error threshold. - * Used in calculation of whether impostors remain valid.*/ - void setImpostorPixelErrorThreshold(float numPixels) { _impostorPixelErrorThreshold=numPixels; applyMaskAction(IMPOSTOR_PIXEL_ERROR_THRESHOLD); } - - /** Get the impostor error threshold.*/ - float getImpostorPixelErrorThreshold() const { return _impostorPixelErrorThreshold; } - - /** Set whether ImpostorSprite's should be placed in a depth sorted bin for rendering.*/ - void setDepthSortImpostorSprites(bool doDepthSort) { _depthSortImpostorSprites = doDepthSort; applyMaskAction(DEPTH_SORT_IMPOSTOR_SPRITES); } - - /** Get whether ImpostorSprite's are depth sorted bin for rendering.*/ - bool getDepthSortImpostorSprites() const { return _depthSortImpostorSprites; } - - /** Set the number of frames that an ImpostorSprite is kept whilst not being beyond, - * before being recycled.*/ - void setNumberOfFrameToKeepImpostorSprites(int numFrames) { _numFramesToKeepImpostorSprites = numFrames; applyMaskAction(NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES); } - - /** Get the number of frames that an ImpostorSprite is kept whilst not being beyond, - * before being recycled.*/ - int getNumberOfFrameToKeepImpostorSprites() const { return _numFramesToKeepImpostorSprites; } - - enum ComputeNearFarMode - { - DO_NOT_COMPUTE_NEAR_FAR = 0, - COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES, - COMPUTE_NEAR_FAR_USING_PRIMITIVES - }; - - void setComputeNearFarMode(ComputeNearFarMode cnfm) { _computeNearFar=cnfm; applyMaskAction(COMPUTE_NEAR_FAR_MODE); } - ComputeNearFarMode getComputeNearFarMode() const { return _computeNearFar;} - - void setNearFarRatio(double ratio) { _nearFarRatio = ratio; applyMaskAction(NEAR_FAR_RATIO); } - double getNearFarRatio() const { return _nearFarRatio; } - - enum CullingModeValues - { - NO_CULLING = 0x0, - VIEW_FRUSTUM_SIDES_CULLING = 0x1, - NEAR_PLANE_CULLING = 0x2, - FAR_PLANE_CULLING = 0x4, - VIEW_FRUSTUM_CULLING = VIEW_FRUSTUM_SIDES_CULLING| - NEAR_PLANE_CULLING| - FAR_PLANE_CULLING, - SMALL_FEATURE_CULLING = 0x8, - SHADOW_OCCLUSION_CULLING = 0x10, - CLUSTER_CULLING = 0x20, - DEFAULT_CULLING = VIEW_FRUSTUM_SIDES_CULLING| - SMALL_FEATURE_CULLING| - SHADOW_OCCLUSION_CULLING| - CLUSTER_CULLING, - ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING| - SMALL_FEATURE_CULLING| - SHADOW_OCCLUSION_CULLING| - CLUSTER_CULLING - }; - - typedef int CullingMode; - - /** Set the culling mode for the CullVisitor to use.*/ - void setCullingMode(CullingMode mode) { _cullingMode = mode; applyMaskAction(CULLING_MODE); } - - /** Returns the current CullingMode.*/ - CullingMode getCullingMode() const { return _cullingMode; } - - - void setCullMask(osg::Node::NodeMask nm) { _cullMask = nm; applyMaskAction(CULL_MASK); } - osg::Node::NodeMask getCullMask() const { return _cullMask; } - - void setCullMaskLeft(osg::Node::NodeMask nm) { _cullMaskLeft = nm; applyMaskAction(CULL_MASK_LEFT); } - osg::Node::NodeMask getCullMaskLeft() const { return _cullMaskLeft; } - - void setCullMaskRight(osg::Node::NodeMask nm) { _cullMaskRight = nm; applyMaskAction(CULL_MASK_RIGHT); } - osg::Node::NodeMask getCullMaskRight() const { return _cullMaskRight; } - - /** Set the LOD bias for the CullVisitor to use.*/ - void setLODScale(float scale) { _LODScale = scale; applyMaskAction(LOD_SCALE); } - - /** Get the LOD bias.*/ - float getLODScale() const { return _LODScale; } - - /** Set the Small Feature Culling Pixel Size.*/ - void setSmallFeatureCullingPixelSize(float value) { _smallFeatureCullingPixelSize=value; applyMaskAction(SMALL_FEATURE_CULLING_PIXEL_SIZE); } - - /** Get the Small Feature Culling Pixel Size.*/ - float getSmallFeatureCullingPixelSize() const { return _smallFeatureCullingPixelSize; } - - - - /** Callback for overriding the CullVisitor's default clamping of the projection matrix to computed near and far values. - * Note, both Matrixf and Matrixd versions of clampProjectionMatrixImplementation must be implemented as the CullVisitor - * can target either Matrix data type, configured at compile time.*/ - struct ClampProjectionMatrixCallback : public osg::Referenced - { - virtual bool clampProjectionMatrixImplementation(osg::Matrixf& projection, double& znear, double& zfar) const = 0; - virtual bool clampProjectionMatrixImplementation(osg::Matrixd& projection, double& znear, double& zfar) const = 0; - }; - - /** set the ClampProjectionMatrixCallback.*/ - void setClampProjectionMatrixCallback(ClampProjectionMatrixCallback* cpmc) { _clampProjectionMatrixCallback = cpmc; applyMaskAction(CLAMP_PROJECTION_MATRIX_CALLBACK); } - /** get the non const ClampProjectionMatrixCallback.*/ - ClampProjectionMatrixCallback* getClampProjectionMatrixCallback() { return _clampProjectionMatrixCallback.get(); } - /** get the const ClampProjectionMatrixCallback.*/ - const ClampProjectionMatrixCallback* getClampProjectionMatrixCallback() const { return _clampProjectionMatrixCallback.get(); } - - - /** Write out internal settings of CullSettings. */ - void write(std::ostream& out); - - protected: - - InheritanceMask _inheritanceMask; - InheritanceMaskActionOnAttributeSetting _inheritanceMaskActionOnAttributeSetting; - - ComputeNearFarMode _computeNearFar; - CullingMode _cullingMode; - float _LODScale; - float _smallFeatureCullingPixelSize; - - ref_ptr _clampProjectionMatrixCallback; - double _nearFarRatio; - bool _impostorActive; - bool _depthSortImpostorSprites; - float _impostorPixelErrorThreshold; - int _numFramesToKeepImpostorSprites; - - Node::NodeMask _cullMask; - Node::NodeMask _cullMaskLeft; - Node::NodeMask _cullMaskRight; - - -}; - - -} - -#endif diff --git a/libs/lib/mac32/include/osg/CullStack b/libs/lib/mac32/include/osg/CullStack deleted file mode 100644 index 04ec4873a1204cd9db4a6c63d72d8ad3d8b0db75..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CullStack +++ /dev/null @@ -1,302 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CULLSTACK -#define OSG_CULLSTACK 1 - -#include -#include -#include -#include -#include - -namespace osg { - -/** A CullStack class which accumulates the current project, modelview matrices -and the CullingSet. */ -class OSG_EXPORT CullStack : public osg::CullSettings -{ - - public: - - - CullStack(); - CullStack(const CullStack& cs); - - ~CullStack(); - - typedef std::vector OccluderList; - - void reset(); - - void pushCullingSet(); - void popCullingSet(); - - void setOccluderList(const ShadowVolumeOccluderList& svol) { _occluderList = svol; } - ShadowVolumeOccluderList& getOccluderList() { return _occluderList; } - const ShadowVolumeOccluderList& getOccluderList() const { return _occluderList; } - - void pushViewport(osg::Viewport* viewport); - void popViewport(); - - void pushProjectionMatrix(osg::RefMatrix* matrix); - void popProjectionMatrix(); - - void pushModelViewMatrix(osg::RefMatrix* matrix, Transform::ReferenceFrame referenceFrame); - void popModelViewMatrix(); - - inline float getFrustumVolume() { if (_frustumVolume<0.0f) computeFrustumVolume(); return _frustumVolume; } - - - /** Compute the pixel size of an object at position v, with specified radius.*/ - float pixelSize(const Vec3& v,float radius) const - { - return getCurrentCullingSet().pixelSize(v,radius); - } - - /** Compute the pixel size of the bounding sphere.*/ - float pixelSize(const BoundingSphere& bs) const - { - return pixelSize(bs.center(),bs.radius()); - } - - /** Compute the pixel size of an object at position v, with specified radius. fabs()ed to always be positive. */ - float clampedPixelSize(const Vec3& v,float radius) const - { - return getCurrentCullingSet().clampedPixelSize(v,radius); - } - - /** Compute the pixel size of the bounding sphere. fabs()ed to always be positive. */ - float clampedPixelSize(const BoundingSphere& bs) const - { - return clampedPixelSize(bs.center(),bs.radius()); - } - - inline void disableAndPushOccludersCurrentMask(NodePath& nodePath) - { - getCurrentCullingSet().disableAndPushOccludersCurrentMask(nodePath); - } - - inline void popOccludersCurrentMask(NodePath& nodePath) - { - getCurrentCullingSet().popOccludersCurrentMask(nodePath); - } - - inline bool isCulled(const std::vector& vertices) - { - return getCurrentCullingSet().isCulled(vertices); - } - - inline bool isCulled(const BoundingBox& bb) - { - return bb.valid() && getCurrentCullingSet().isCulled(bb); - } - - inline bool isCulled(const BoundingSphere& bs) - { - return getCurrentCullingSet().isCulled(bs); - } - - inline bool isCulled(const osg::Node& node) - { - return node.isCullingActive() && getCurrentCullingSet().isCulled(node.getBound()); - } - - inline void pushCurrentMask() - { - getCurrentCullingSet().pushCurrentMask(); - } - - inline void popCurrentMask() - { - getCurrentCullingSet().popCurrentMask(); - } - - - typedef std::vector< CullingSet > CullingStack; - - inline CullingStack& getClipSpaceCullingStack() { return _clipspaceCullingStack; } - - inline CullingStack& getProjectionCullingStack() { return _projectionCullingStack; } - - inline CullingStack& getModelViewCullingStack() { return _modelviewCullingStack; } - - inline CullingSet& getCurrentCullingSet() { return *_back_modelviewCullingStack; } - inline const CullingSet& getCurrentCullingSet() const { return *_back_modelviewCullingStack; } - - inline osg::Viewport* getViewport(); - inline osg::RefMatrix* getModelViewMatrix(); - inline osg::RefMatrix* getProjectionMatrix(); - inline osg::Matrix getWindowMatrix(); - inline const osg::RefMatrix* getMVPW(); - - inline const osg::Vec3& getReferenceViewPoint() const { return _referenceViewPoints.back(); } - inline void pushReferenceViewPoint(const osg::Vec3& viewPoint) { _referenceViewPoints.push_back(viewPoint); } - inline void popReferenceViewPoint() { _referenceViewPoints.pop_back(); } - - inline const osg::Vec3& getEyeLocal() const { return _eyePointStack.back(); } - - inline const osg::Vec3& getViewPointLocal() const { return _viewPointStack.back(); } - - inline const osg::Vec3 getUpLocal() const - { - const osg::Matrix& matrix = *_modelviewStack.back(); - return osg::Vec3(matrix(0,1),matrix(1,1),matrix(2,1)); - } - - inline const osg::Vec3 getLookVectorLocal() const - { - const osg::Matrix& matrix = *_modelviewStack.back(); - return osg::Vec3(-matrix(0,2),-matrix(1,2),-matrix(2,2)); - } - - - protected: - - // base set of shadow volume occluder to use in culling. - ShadowVolumeOccluderList _occluderList; - - typedef fast_back_stack< ref_ptr > MatrixStack; - - MatrixStack _projectionStack; - - MatrixStack _modelviewStack; - MatrixStack _MVPW_Stack; - - typedef fast_back_stack > ViewportStack; - ViewportStack _viewportStack; - - typedef fast_back_stack EyePointStack; - EyePointStack _referenceViewPoints; - EyePointStack _eyePointStack; - EyePointStack _viewPointStack; - - CullingStack _clipspaceCullingStack; - CullingStack _projectionCullingStack; - - CullingStack _modelviewCullingStack; - unsigned int _index_modelviewCullingStack; - CullingSet* _back_modelviewCullingStack; - - void computeFrustumVolume(); - float _frustumVolume; - - unsigned int _bbCornerNear; - unsigned int _bbCornerFar; - - ref_ptr _identity; - - typedef std::vector< osg::ref_ptr > MatrixList; - MatrixList _reuseMatrixList; - unsigned int _currentReuseMatrixIndex; - - inline osg::RefMatrix* createOrReuseMatrix(const osg::Matrix& value); - - -}; - -inline osg::Viewport* CullStack::getViewport() -{ - if (!_viewportStack.empty()) - { - return _viewportStack.back().get(); - } - else - { - return 0L; - } -} - -inline osg::RefMatrix* CullStack::getModelViewMatrix() -{ - if (!_modelviewStack.empty()) - { - return _modelviewStack.back().get(); - } - else - { - return _identity.get(); - } -} - -inline osg::RefMatrix* CullStack::getProjectionMatrix() -{ - if (!_projectionStack.empty()) - { - return _projectionStack.back().get(); - } - else - { - return _identity.get(); - } -} - -inline osg::Matrix CullStack::getWindowMatrix() -{ - if (!_viewportStack.empty()) - { - osg::Viewport* viewport = _viewportStack.back().get(); - return viewport->computeWindowMatrix(); - } - else - { - return *_identity; - } -} - -inline const osg::RefMatrix* CullStack::getMVPW() -{ - if (!_MVPW_Stack.empty()) - { - if (!_MVPW_Stack.back()) - { - _MVPW_Stack.back() = createOrReuseMatrix(*getModelViewMatrix()); - (*_MVPW_Stack.back()) *= *(getProjectionMatrix()); - (*_MVPW_Stack.back()) *= getWindowMatrix(); - } - return _MVPW_Stack.back().get(); - } - else - { - return _identity.get(); - } -} - -inline RefMatrix* CullStack::createOrReuseMatrix(const osg::Matrix& value) -{ - // skip of any already reused matrix. - while (_currentReuseMatrixIndex<_reuseMatrixList.size() && - _reuseMatrixList[_currentReuseMatrixIndex]->referenceCount()>1) - { - ++_currentReuseMatrixIndex; - } - - // if still within list, element must be singularly referenced - // there return it to be reused. - if (_currentReuseMatrixIndex<_reuseMatrixList.size()) - { - RefMatrix* matrix = _reuseMatrixList[_currentReuseMatrixIndex++].get(); - matrix->set(value); - return matrix; - } - - // otherwise need to create new matrix. - osg::RefMatrix* matrix = new RefMatrix(value); - _reuseMatrixList.push_back(matrix); - ++_currentReuseMatrixIndex; - return matrix; -} - -} // end of namespace - -#endif diff --git a/libs/lib/mac32/include/osg/CullingSet b/libs/lib/mac32/include/osg/CullingSet deleted file mode 100644 index cb1739827954ad6578fa0ec3d4cbb2d778351d40..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/CullingSet +++ /dev/null @@ -1,350 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_CullingSet -#define OSG_CullingSet 1 - -#include -#include -#include - -#include - - -namespace osg { - -#define COMPILE_WITH_SHADOW_OCCLUSION_CULLING - -/** A CullingSet class which contains a frustum and a list of occluders. */ -class OSG_EXPORT CullingSet : public Referenced -{ - - public: - - typedef std::pair< osg::ref_ptr, osg::Polytope > StateFrustumPair; - typedef std::vector< StateFrustumPair > StateFrustumList; - - CullingSet(); - - CullingSet(const CullingSet& cs): - Referenced(), - _mask(cs._mask), - _frustum(cs._frustum), - _stateFrustumList(cs._stateFrustumList), - _occluderList(cs._occluderList), - _pixelSizeVector(cs._pixelSizeVector), - _smallFeatureCullingPixelSize(cs._smallFeatureCullingPixelSize) - { - } - - CullingSet(const CullingSet& cs,const Matrix& matrix, const Vec4& pixelSizeVector): - _mask(cs._mask), - _frustum(cs._frustum), - _stateFrustumList(cs._stateFrustumList), - _occluderList(cs._occluderList), - _pixelSizeVector(pixelSizeVector), - _smallFeatureCullingPixelSize(cs._smallFeatureCullingPixelSize) - { - _frustum.transformProvidingInverse(matrix); - for(OccluderList::iterator itr=_occluderList.begin(); - itr!=_occluderList.end(); - ++itr) - { - itr->transformProvidingInverse(matrix); - } - } - - CullingSet& operator = (const CullingSet& cs) - { - if (this==&cs) return *this; - - _mask = cs._mask; - _frustum = cs._frustum; - _stateFrustumList = cs._stateFrustumList; - _occluderList = cs._occluderList; - _pixelSizeVector = cs._pixelSizeVector; - _smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize; - - return *this; - } - - - inline void set(const CullingSet& cs) - { - _mask = cs._mask; - _frustum = cs._frustum; - _stateFrustumList = cs._stateFrustumList; - _occluderList = cs._occluderList; - _pixelSizeVector = cs._pixelSizeVector; - _smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize; - } - - inline void set(const CullingSet& cs,const Matrix& matrix, const Vec4& pixelSizeVector) - { - _mask = cs._mask; - _stateFrustumList = cs._stateFrustumList; - _occluderList = cs._occluderList; - _pixelSizeVector = pixelSizeVector; - _smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize; - - //_frustum = cs._frustum; - //_frustum.transformProvidingInverse(matrix); - - _frustum.setAndTransformProvidingInverse(cs._frustum,matrix); - - for(StateFrustumList::iterator sitr=_stateFrustumList.begin(); - sitr!=_stateFrustumList.end(); - ++sitr) - { - sitr->second.transformProvidingInverse(matrix); - } - - for(OccluderList::iterator oitr=_occluderList.begin(); - oitr!=_occluderList.end(); - ++oitr) - { - oitr->transformProvidingInverse(matrix); - } - - } - - typedef std::vector OccluderList; - - typedef int Mask; - - enum MaskValues - { - NO_CULLING = 0x0, - VIEW_FRUSTUM_SIDES_CULLING = 0x1, - NEAR_PLANE_CULLING = 0x2, - FAR_PLANE_CULLING = 0x4, - VIEW_FRUSTUM_CULLING = VIEW_FRUSTUM_SIDES_CULLING| - NEAR_PLANE_CULLING| - FAR_PLANE_CULLING, - SMALL_FEATURE_CULLING = 0x8, - SHADOW_OCCLUSION_CULLING = 0x10, - DEFAULT_CULLING = VIEW_FRUSTUM_SIDES_CULLING| - SMALL_FEATURE_CULLING| - SHADOW_OCCLUSION_CULLING, - ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING| - SMALL_FEATURE_CULLING| - SHADOW_OCCLUSION_CULLING - }; - - void setCullingMask(Mask mask) { _mask = mask; } - Mask getCullingMask() const { return _mask; } - - void setFrustum(Polytope& cv) { _frustum = cv; } - - Polytope& getFrustum() { return _frustum; } - const Polytope& getFrustum() const { return _frustum; } - - void addStateFrustum(StateSet* stateset, Polytope& polytope) { _stateFrustumList.push_back(StateFrustumPair(stateset,polytope)); } - - void getStateFrustumList(StateFrustumList& sfl) { _stateFrustumList = sfl; } - StateFrustumList& getStateFrustumList() { return _stateFrustumList; } - - void addOccluder(ShadowVolumeOccluder& cv) { _occluderList.push_back(cv); } - - void setPixelSizeVector(const Vec4& v) { _pixelSizeVector = v; } - - Vec4& getPixelSizeVector() { return _pixelSizeVector; } - const Vec4& getPixelSizeVector() const { return _pixelSizeVector; } - - void setSmallFeatureCullingPixelSize(float value) { _smallFeatureCullingPixelSize=value; } - - float& getSmallFeatureCullingPixelSize() { return _smallFeatureCullingPixelSize; } - - float getSmallFeatureCullingPixelSize() const { return _smallFeatureCullingPixelSize; } - - - /** Compute the pixel of an object at position v, with specified radius.*/ - float pixelSize(const Vec3& v,float radius) const { return radius/(v*_pixelSizeVector); } - - /** Compute the pixel of a bounding sphere.*/ - float pixelSize(const BoundingSphere& bs) const { return bs.radius()/(bs.center()*_pixelSizeVector); } - - /** Compute the pixel of an object at position v, with specified radius. fabs()ed to always be positive. */ - float clampedPixelSize(const Vec3& v,float radius) const { return fabs(pixelSize(v, radius)); } - - /** Compute the pixel of a bounding sphere. fabs()ed to always be positive. */ - float clampedPixelSize(const BoundingSphere& bs) const { return fabs(pixelSize(bs)); } - - - inline bool isCulled(const std::vector& vertices) - { - if (_mask&VIEW_FRUSTUM_CULLING) - { - // is it outside the view frustum... - if (!_frustum.contains(vertices)) return true; - } - - if (_mask&SMALL_FEATURE_CULLING) - { - } - - if (_mask&SHADOW_OCCLUSION_CULLING) - { - // is it in one of the shadow occluder volumes. - if (!_occluderList.empty()) - { - for(OccluderList::iterator itr=_occluderList.begin(); - itr!=_occluderList.end(); - ++itr) - { - if (itr->contains(vertices)) return true; - } - } - } - - return false; - } - - inline bool isCulled(const BoundingBox& bb) - { - if (_mask&VIEW_FRUSTUM_CULLING) - { - // is it outside the view frustum... - if (!_frustum.contains(bb)) return true; - } - - if (_mask&SMALL_FEATURE_CULLING) - { - } - - if (_mask&SHADOW_OCCLUSION_CULLING) - { - // is it in one of the shadow occluder volumes. - if (!_occluderList.empty()) - { - for(OccluderList::iterator itr=_occluderList.begin(); - itr!=_occluderList.end(); - ++itr) - { - if (itr->contains(bb)) return true; - } - } - } - - return false; - } - - inline bool isCulled(const BoundingSphere& bs) - { - if (_mask&VIEW_FRUSTUM_CULLING) - { - // is it outside the view frustum... - if (!_frustum.contains(bs)) return true; - } - - if (_mask&SMALL_FEATURE_CULLING) - { - if (((bs.center()*_pixelSizeVector)*_smallFeatureCullingPixelSize)>bs.radius()) return true; - } -#ifdef COMPILE_WITH_SHADOW_OCCLUSION_CULLING - if (_mask&SHADOW_OCCLUSION_CULLING) - { - // is it in one of the shadow occluder volumes. - if (!_occluderList.empty()) - { - for(OccluderList::iterator itr=_occluderList.begin(); - itr!=_occluderList.end(); - ++itr) - { - if (itr->contains(bs)) return true; - } - } - } -#endif - return false; - } - - inline void pushCurrentMask() - { - _frustum.pushCurrentMask(); - - if (!_stateFrustumList.empty()) - { - for(StateFrustumList::iterator itr=_stateFrustumList.begin(); - itr!=_stateFrustumList.end(); - ++itr) - { - itr->second.pushCurrentMask(); - } - } - - -#ifdef COMPILE_WITH_SHADOW_OCCLUSION_CULLING - if (!_occluderList.empty()) - { - for(OccluderList::iterator itr=_occluderList.begin(); - itr!=_occluderList.end(); - ++itr) - { - itr->pushCurrentMask(); - } - } -#endif - } - - inline void popCurrentMask() - { - _frustum.popCurrentMask(); - - if (!_stateFrustumList.empty()) - { - for(StateFrustumList::iterator itr=_stateFrustumList.begin(); - itr!=_stateFrustumList.end(); - ++itr) - { - itr->second.popCurrentMask(); - } - } - -#ifdef COMPILE_WITH_SHADOW_OCCLUSION_CULLING - if (!_occluderList.empty()) - { - for(OccluderList::iterator itr=_occluderList.begin(); - itr!=_occluderList.end(); - ++itr) - { - itr->popCurrentMask(); - } - } -#endif - } - - void disableAndPushOccludersCurrentMask(NodePath& nodePath); - - void popOccludersCurrentMask(NodePath& nodePath); - - static osg::Vec4 computePixelSizeVector(const Viewport& W, const Matrix& P, const Matrix& M); - - virtual ~CullingSet(); - - - protected: - - - Mask _mask; - Polytope _frustum; - StateFrustumList _stateFrustumList; - OccluderList _occluderList; - Vec4 _pixelSizeVector; - float _smallFeatureCullingPixelSize; - -}; - -} // end of namespace - -#endif diff --git a/libs/lib/mac32/include/osg/DeleteHandler b/libs/lib/mac32/include/osg/DeleteHandler deleted file mode 100644 index 0d10e7a1fad99881f56179670d588c99448422fb..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/DeleteHandler +++ /dev/null @@ -1,88 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_DELETEHANDLER -#define OSG_DELETEHANDLER 1 - -#include - -#include - -namespace osg { - - -/** Class for override the default delete behavior so that users can implement their own object - * deletion schemes. This might be done to help implement protection of multiple threads from deleting - * objects unintentionally. - * Note, the DeleteHandler cannot itself be reference counted, otherwise it - * would be responsible for deleting itself! - * An static auto_ptr<> is used internally in Referenced.cpp to manage the - * DeleteHandler's memory.*/ -class OSG_EXPORT DeleteHandler -{ - public: - - typedef std::pair FrameNumberObjectPair; - typedef std::list ObjectsToDeleteList; - - DeleteHandler(int numberOfFramesToRetainObjects=0); - - virtual ~DeleteHandler(); - - /** Set the number of frames to retain objects that are have been requested for deletion. - * When set to zero objects are deleted immediately, by set to 1 there are kept around for an extra frame etc. - * The ability to retain objects for several frames is useful to prevent premature deletion when objects - * are still be used the graphics threads that are using double buffering of rendering data structures with - * non ref_ptr<> pointers to scene graph elements.*/ - void setNumFramesToRetainObjects(unsigned int numberOfFramesToRetainObjects) { _numFramesToRetainObjects = numberOfFramesToRetainObjects; } - - unsigned int getNumFramesToRetainObjects() const { return _numFramesToRetainObjects; } - - /** Set the current frame number so that subsequent deletes get tagged as associated with this frame.*/ - void setFrameNumber(unsigned int frameNumber) { _currentFrameNumber = frameNumber; } - - /** Get the current frame number.*/ - unsigned int getFrameNumber() const { return _currentFrameNumber; } - - inline void doDelete(const Referenced* object) { delete object; } - - /** Flush objects that ready to be fully deleted.*/ - virtual void flush(); - - /** Flush all objects that the DeleteHandler holds. - * Note, this should only be called if there are no threads running with non ref_ptr<> pointers, such as graphics threads.*/ - virtual void flushAll(); - - /** Request the deletion of an object. - * Depending on users implementation of DeleteHandler, the delete of the object may occur - * straight away or be delayed until doDelete is called. - * The default implementation does a delete straight away.*/ - virtual void requestDelete(const osg::Referenced* object); - - protected: - - DeleteHandler(const DeleteHandler&): - _numFramesToRetainObjects(0), - _currentFrameNumber(0) {} - DeleteHandler operator = (const DeleteHandler&) { return *this; } - - unsigned int _numFramesToRetainObjects; - unsigned int _currentFrameNumber; - OpenThreads::Mutex _mutex; - ObjectsToDeleteList _objectsToDelete; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Depth b/libs/lib/mac32/include/osg/Depth deleted file mode 100644 index 7080f3a0afb128971bcfa526ec052748a1141f03..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Depth +++ /dev/null @@ -1,112 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_DEPTH -#define OSG_DEPTH 1 - -#include - -namespace osg { - -/** Encapsulate OpenGL glDepthFunc/Mask/Range functions. -*/ -class OSG_EXPORT Depth : public StateAttribute -{ - public : - - - enum Function - { - NEVER = GL_NEVER, - LESS = GL_LESS, - EQUAL = GL_EQUAL, - LEQUAL = GL_LEQUAL, - GREATER = GL_GREATER, - NOTEQUAL = GL_NOTEQUAL, - GEQUAL = GL_GEQUAL, - ALWAYS = GL_ALWAYS - }; - - - Depth(Function func=LESS,double zNear=0.0, double zFar=1.0,bool writeMask=true); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Depth(const Depth& dp,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(dp,copyop), - _func(dp._func), - _zNear(dp._zNear), - _zFar(dp._zFar), - _depthWriteMask(dp._depthWriteMask) {} - - - META_StateAttribute(osg, Depth, DEPTH); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(Depth,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_func) - COMPARE_StateAttribute_Parameter(_depthWriteMask) - COMPARE_StateAttribute_Parameter(_zNear) - COMPARE_StateAttribute_Parameter(_zFar) - - return 0; // passed all the above comparison macros, must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_DEPTH_TEST); - return true; - } - - inline void setFunction(Function func) { _func = func; } - inline Function getFunction() const { return _func; } - - - inline void setRange(double zNear, double zFar) - { - _zNear = zNear; - _zFar = zFar; - } - - inline void setZNear(double zNear) { _zNear=zNear; } - inline double getZNear() const { return _zNear; } - - inline void setZFar(double zFar) { _zFar=zFar; } - inline double getZFar() const { return _zFar; } - - inline void setWriteMask(bool mask) { _depthWriteMask = mask; } - inline bool getWriteMask() const { return _depthWriteMask; } - - - virtual void apply(State& state) const; - - protected: - - virtual ~Depth(); - - Function _func; - - double _zNear; - double _zFar; - - bool _depthWriteMask; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/DisplaySettings b/libs/lib/mac32/include/osg/DisplaySettings deleted file mode 100644 index 6f0ddda04ce6d0921a1c28482ce0401faa83c3e4..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/DisplaySettings +++ /dev/null @@ -1,337 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_DisplaySettings -#define OSG_DisplaySettings 1 - -#include -#include - -#include -#include - -namespace osg { - -// forward declare -class ArgumentParser; -class ApplicationUsage; - -/** DisplaySettings class for encapsulating what visuals are required and - * have been set up, and the status of stereo viewing.*/ -class OSG_EXPORT DisplaySettings : public osg::Referenced -{ - - public: - - /** Maintain a DisplaySettings singleton for objects to query at runtime.*/ - static ref_ptr& instance(); - - DisplaySettings(): - Referenced(true) - { - setDefaults(); - readEnvironmentalVariables(); - } - - DisplaySettings(ArgumentParser& arguments): - Referenced(true) - { - setDefaults(); - readEnvironmentalVariables(); - readCommandLine(arguments); - } - - DisplaySettings(const DisplaySettings& vs); - - - DisplaySettings& operator = (const DisplaySettings& vs); - - void setDisplaySettings(const DisplaySettings& vs); - - void merge(const DisplaySettings& vs); - - void setDefaults(); - - /** read the environmental variables.*/ - void readEnvironmentalVariables(); - - /** read the commandline arguments.*/ - void readCommandLine(ArgumentParser& arguments); - - - enum DisplayType - { - MONITOR, - POWERWALL, - REALITY_CENTER, - HEAD_MOUNTED_DISPLAY - }; - - void setDisplayType(DisplayType type) { _displayType = type; } - - DisplayType getDisplayType() const { return _displayType; } - - - void setStereo(bool on) { _stereo = on; } - bool getStereo() const { return _stereo; } - - enum StereoMode - { - QUAD_BUFFER, - ANAGLYPHIC, - HORIZONTAL_SPLIT, - VERTICAL_SPLIT, - LEFT_EYE, - RIGHT_EYE, - HORIZONTAL_INTERLACE, - VERTICAL_INTERLACE, - CHECKERBOARD - }; - - void setStereoMode(StereoMode mode) { _stereoMode = mode; } - StereoMode getStereoMode() const { return _stereoMode; } - - void setEyeSeparation(float eyeSeparation) { _eyeSeparation = eyeSeparation; } - float getEyeSeparation() const { return _eyeSeparation; } - - enum SplitStereoHorizontalEyeMapping - { - LEFT_EYE_LEFT_VIEWPORT, - LEFT_EYE_RIGHT_VIEWPORT - }; - - void setSplitStereoHorizontalEyeMapping(SplitStereoHorizontalEyeMapping m) { _splitStereoHorizontalEyeMapping = m; } - SplitStereoHorizontalEyeMapping getSplitStereoHorizontalEyeMapping() const { return _splitStereoHorizontalEyeMapping; } - - void setSplitStereoHorizontalSeparation(int s) { _splitStereoHorizontalSeparation = s; } - int getSplitStereoHorizontalSeparation() const { return _splitStereoHorizontalSeparation; } - - enum SplitStereoVerticalEyeMapping - { - LEFT_EYE_TOP_VIEWPORT, - LEFT_EYE_BOTTOM_VIEWPORT - }; - - void setSplitStereoVerticalEyeMapping(SplitStereoVerticalEyeMapping m) { _splitStereoVerticalEyeMapping = m; } - SplitStereoVerticalEyeMapping getSplitStereoVerticalEyeMapping() const { return _splitStereoVerticalEyeMapping; } - - void setSplitStereoVerticalSeparation(int s) { _splitStereoVerticalSeparation = s; } - int getSplitStereoVerticalSeparation() const { return _splitStereoVerticalSeparation; } - - void setSplitStereoAutoAdjustAspectRatio(bool flag) { _splitStereoAutoAdjustAspectRatio=flag; } - bool getSplitStereoAutoAdjustAspectRatio() const { return _splitStereoAutoAdjustAspectRatio; } - - - void setScreenWidth(float width) { _screenWidth = width; } - float getScreenWidth() const { return _screenWidth; } - - void setScreenHeight(float height) { _screenHeight = height; } - float getScreenHeight() const { return _screenHeight; } - - void setScreenDistance(float distance) { _screenDistance = distance; } - float getScreenDistance() const { return _screenDistance; } - - - - void setDoubleBuffer(bool flag) { _doubleBuffer = flag; } - bool getDoubleBuffer() const { return _doubleBuffer; } - - - void setRGB(bool flag) { _RGB = flag; } - bool getRGB() const { return _RGB; } - - - void setDepthBuffer(bool flag) { _depthBuffer = flag; } - bool getDepthBuffer() const { return _depthBuffer; } - - - void setMinimumNumAlphaBits(unsigned int bits) { _minimumNumberAlphaBits = bits; } - unsigned int getMinimumNumAlphaBits() const { return _minimumNumberAlphaBits; } - bool getAlphaBuffer() const { return _minimumNumberAlphaBits!=0; } - - void setMinimumNumStencilBits(unsigned int bits) { _minimumNumberStencilBits = bits; } - unsigned int getMinimumNumStencilBits() const { return _minimumNumberStencilBits; } - bool getStencilBuffer() const { return _minimumNumberStencilBits!=0; } - - void setMinimumNumAccumBits(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha); - unsigned int getMinimumNumAccumRedBits() const { return _minimumNumberAccumRedBits; } - unsigned int getMinimumNumAccumGreenBits() const { return _minimumNumberAccumGreenBits; } - unsigned int getMinimumNumAccumBlueBits() const { return _minimumNumberAccumBlueBits; } - unsigned int getMinimumNumAccumAlphaBits() const { return _minimumNumberAccumAlphaBits; } - bool getAccumBuffer() const { return (_minimumNumberAccumRedBits+_minimumNumberAccumGreenBits+_minimumNumberAccumBlueBits+_minimumNumberAccumAlphaBits)!=0; } - - - void setMaxNumberOfGraphicsContexts(unsigned int num); - unsigned int getMaxNumberOfGraphicsContexts() const; - - void setNumMultiSamples(unsigned int samples) { _numMultiSamples = samples; } - unsigned int getNumMultiSamples() const { return _numMultiSamples; } - bool getMultiSamples() const { return _numMultiSamples!=0; } - - void setCompileContextsHint(bool useCompileContexts) { _compileContextsHint = useCompileContexts; } - bool getCompileContextsHint() const { return _compileContextsHint; } - - void setSerializeDrawDispatch(bool serializeDrawDispatch) { _serializeDrawDispatch = serializeDrawDispatch; } - bool getSerializeDrawDispatch() const { return _serializeDrawDispatch; } - - /** Set the hint for the total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.*/ - void setNumOfDatabaseThreadsHint(unsigned int numThreads) { _numDatabaseThreadsHint = numThreads; } - - /** Get the hint for total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.*/ - unsigned int getNumOfDatabaseThreadsHint() const { return _numDatabaseThreadsHint; } - - /** Set the hint for number of threads in the DatbasePager to dedicate to reading http requests.*/ - void setNumOfHttpDatabaseThreadsHint(unsigned int numThreads) { _numHttpDatabaseThreadsHint = numThreads; } - - /** Get the hint for number of threads in the DatbasePager dedicated to reading http requests.*/ - unsigned int getNumOfHttpDatabaseThreadsHint() const { return _numHttpDatabaseThreadsHint; } - - void setApplication(const std::string& application) { _application = application; } - const std::string& getApplication() { return _application; } - - - void setMaxTexturePoolSize(unsigned int size) { _maxTexturePoolSize = size; } - unsigned int getMaxTexturePoolSize() const { return _maxTexturePoolSize; } - - void setMaxBufferObjectPoolSize(unsigned int size) { _maxBufferObjectPoolSize = size; } - unsigned int getMaxBufferObjectPoolSize() const { return _maxBufferObjectPoolSize; } - - /** - Methods used to set and get defaults for Cameras implicit buffer attachments. - For more info: See description of Camera::setImplicitBufferAttachment method - - DisplaySettings implicit buffer attachment selection defaults to: DEPTH and COLOR - for both primary (Render) FBO and seconday Multisample (Resolve) FBO - ie: IMPLICT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT - **/ - enum ImplicitBufferAttachment - { - IMPLICIT_DEPTH_BUFFER_ATTACHMENT = (1 << 0), - IMPLICIT_STENCIL_BUFFER_ATTACHMENT = (1 << 1), - IMPLICIT_COLOR_BUFFER_ATTACHMENT = (1 << 2), - DEFAULT_IMPLICIT_BUFFER_ATTACHMENT = IMPLICIT_COLOR_BUFFER_ATTACHMENT | IMPLICIT_DEPTH_BUFFER_ATTACHMENT - }; - - typedef int ImplicitBufferAttachmentMask; - - void setImplicitBufferAttachmentMask(ImplicitBufferAttachmentMask renderMask = DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT, ImplicitBufferAttachmentMask resolveMask = DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT ) - { - _implicitBufferAttachmentRenderMask = renderMask; - _implicitBufferAttachmentResolveMask = resolveMask; - } - - void setImplicitBufferAttachmentRenderMask(ImplicitBufferAttachmentMask implicitBufferAttachmentRenderMask) - { - _implicitBufferAttachmentRenderMask = implicitBufferAttachmentRenderMask; - } - - void setImplicitBufferAttachmentResolveMask(ImplicitBufferAttachmentMask implicitBufferAttachmentResolveMask) - { - _implicitBufferAttachmentResolveMask = implicitBufferAttachmentResolveMask; - } - - /** Get mask selecting default implict buffer attachments for Cameras primary FBOs. */ - ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask() const { return _implicitBufferAttachmentRenderMask; } - - /** Get mask selecting default implict buffer attachments for Cameras secondary MULTISAMPLE FBOs. */ - ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask() const { return _implicitBufferAttachmentResolveMask;} - - enum SwapMethod - { - SWAP_DEFAULT, // Leave swap method at default returned by choose Pixel Format. - SWAP_EXCHANGE, // Flip front / back buffer. - SWAP_COPY, // Copy back to front buffer. - SWAP_UNDEFINED // Move back to front buffer leaving contents of back buffer undefined. - }; - - /** Select preferred swap method */ - void setSwapMethod( SwapMethod swapMethod ) { _swapMethod = swapMethod; } - - /** Get preferred swap method */ - SwapMethod getSwapMethod( void ) { return _swapMethod; } - - /** Set the hint of which OpenGL version to attempt to create a graphics context for.*/ - void setGLContextVersion(const std::string& version) { _glContextVersion = version; } - - /** Get the hint of which OpenGL version to attempt to create a graphics context for.*/ - const std::string getGLContextVersion() const { return _glContextVersion; } - - /** Set the hint of the flags to use in when creating graphic contexts.*/ - void setGLContextFlags(unsigned int flags) { _glContextFlags = flags; } - - /** Get the hint of the flags to use in when creating graphic contexts.*/ - unsigned int getGLContextFlags() const { return _glContextFlags; } - - /** Set the hint of the profile mask to use in when creating graphic contexts.*/ - void setGLContextProfileMask(unsigned int mask) { _glContextProfileMask = mask; } - - /** Get the hint of the profile mask to use in when creating graphic contexts.*/ - unsigned int getGLContextProfileMask() const { return _glContextProfileMask; } - - protected: - - virtual ~DisplaySettings(); - - - DisplayType _displayType; - bool _stereo; - StereoMode _stereoMode; - float _eyeSeparation; - float _screenWidth; - float _screenHeight; - float _screenDistance; - - SplitStereoHorizontalEyeMapping _splitStereoHorizontalEyeMapping; - int _splitStereoHorizontalSeparation; - SplitStereoVerticalEyeMapping _splitStereoVerticalEyeMapping; - int _splitStereoVerticalSeparation; - bool _splitStereoAutoAdjustAspectRatio; - - bool _doubleBuffer; - bool _RGB; - bool _depthBuffer; - unsigned int _minimumNumberAlphaBits; - unsigned int _minimumNumberStencilBits; - unsigned int _minimumNumberAccumRedBits; - unsigned int _minimumNumberAccumGreenBits; - unsigned int _minimumNumberAccumBlueBits; - unsigned int _minimumNumberAccumAlphaBits; - - unsigned int _maxNumOfGraphicsContexts; - - unsigned int _numMultiSamples; - - bool _compileContextsHint; - bool _serializeDrawDispatch; - - unsigned int _numDatabaseThreadsHint; - unsigned int _numHttpDatabaseThreadsHint; - - std::string _application; - - unsigned int _maxTexturePoolSize; - unsigned int _maxBufferObjectPoolSize; - - ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask; - ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask; - - std::string _glContextVersion; - unsigned int _glContextFlags; - unsigned int _glContextProfileMask; - - SwapMethod _swapMethod; -}; - -} - -# endif diff --git a/libs/lib/mac32/include/osg/DrawPixels b/libs/lib/mac32/include/osg/DrawPixels deleted file mode 100644 index f47783f6507d3e3642aa6d0c0806edb83f6fee3c..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/DrawPixels +++ /dev/null @@ -1,80 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_DRAWPIXELS -#define OSG_DRAWPIXELS 1 - -#include -#include -#include - -namespace osg { - -/** DrawPixels is an osg::Drawable subclass which encapsulates the drawing of - * images using glDrawPixels.*/ -class OSG_EXPORT DrawPixels : public Drawable -{ - public: - - DrawPixels(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - DrawPixels(const DrawPixels& drawimage,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual Object* cloneType() const { return new DrawPixels(); } - - virtual Object* clone(const CopyOp& copyop) const { return new DrawPixels(*this,copyop); } - - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "DrawPixels"; } - - - void setPosition(const osg::Vec3& position); - - osg::Vec3& getPosition() { return _position; } - const osg::Vec3& getPosition() const { return _position; } - - void setImage(osg::Image* image) { _image = image; } - - osg::Image* getImage() { return _image.get(); } - const osg::Image* getImage() const { return _image.get(); } - - void setUseSubImage(bool useSubImage) { _useSubImage=useSubImage; } - bool getUseSubImage() const { return _useSubImage; } - - void setSubImageDimensions(unsigned int offsetX,unsigned int offsetY,unsigned int width,unsigned int height); - void getSubImageDimensions(unsigned int& offsetX,unsigned int& offsetY,unsigned int& width,unsigned int& height) const; - - virtual void drawImplementation(RenderInfo& renderInfo) const; - - virtual BoundingBox computeBound() const; - - protected: - - DrawPixels& operator = (const DrawPixels&) { return *this;} - - virtual ~DrawPixels(); - - Vec3 _position; - ref_ptr _image; - - bool _useSubImage; - unsigned int _offsetX, _offsetY, _width, _height; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Drawable b/libs/lib/mac32/include/osg/Drawable deleted file mode 100644 index e1e6cd6983eaacad4fcbfbb2b0f69a5558e4bb6c..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Drawable +++ /dev/null @@ -1,920 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_DRAWABLE -#define OSG_DRAWABLE 1 - -#include -#include -#include -#include -#include - - -#ifndef GL_NV_occlusion_query - - #define GL_OCCLUSION_TEST_HP 0x8165 - #define GL_OCCLUSION_TEST_RESULT_HP 0x8166 - #define GL_PIXEL_COUNTER_BITS_NV 0x8864 - #define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 - #define GL_PIXEL_COUNT_NV 0x8866 - #define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 - -#endif - -#ifndef GL_ARB_occlusion_query - - #define GL_SAMPLES_PASSED_ARB 0x8914 - #define GL_QUERY_COUNTER_BITS_ARB 0x8864 - #define GL_CURRENT_QUERY_ARB 0x8865 - #define GL_QUERY_RESULT_ARB 0x8866 - #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 - -#endif - - -#ifndef GL_TIME_ELAPSED - #define GL_TIME_ELAPSED 0x88BF - #define GL_TIMESTAMP 0x8E28 -#endif - -#ifndef GL_QUERY_RESULT - #define GL_QUERY_RESULT 0x8866 - #define GL_QUERY_RESULT_AVAILABLE 0x8867 -#endif - - -#if !defined(GL_EXT_timer_query) && !defined(OSG_GL3_AVAILABLE) - #ifdef _WIN32 - typedef __int64 GLint64EXT; - typedef unsigned __int64 GLuint64EXT; - #else - typedef long long int GLint64EXT; - typedef unsigned long long int GLuint64EXT; - #endif -#endif - - -namespace osg { - - -class Vec2f; -class Vec3f; -class Vec4f; -class Vec4ub; -class Geometry; -class NodeVisitor; -class ArrayDispatchers; - -// this is defined to alter the way display lists are compiled inside the -// the draw method, it has been found that the NVidia drivers fail completely -// to optimize COMPILE_AND_EXECUTE in fact make it go slower than for no display -// lists, but optimize a separate COMPILE very well?! Define it as default -// the use of a separate COMPILE, then glCallList rather than use COMPILE_AND_EXECUTE. - -#define USE_SEPARATE_COMPILE_AND_EXECUTE - -/** Pure virtual base class for drawable geometry. In OSG, everything that can - * be rendered is implemented as a class derived from \c Drawable. The - * \c Drawable class contains no drawing primitives, since these are provided - * by subclasses such as \c osg::Geometry. - *

Notice that a \c Drawable is not a \c Node, and therefore it cannot be - * directly added to a scene graph. Instead, Drawables are attached to - * Geodes, which are scene graph nodes. - *

The OpenGL state that must be used when rendering a \c Drawable is - * represented by a \c StateSet. Since a \c Drawable has a reference - * (\c osg::ref_ptr) to a \c StateSet, StateSets can be shared between - * different Drawables. In fact, sharing StateSets is a good - * way to improve performance, since this allows OSG to reduce the number of - * expensive changes in the OpenGL state. - *

Finally, Drawables can also be shared between different - * Geodes, so that the same geometry (loaded to memory just once) can - * be used in different parts of the scene graph. -*/ -class OSG_EXPORT Drawable : public Object -{ - public: - - static unsigned int s_numberDrawablesReusedLastInLastFrame; - static unsigned int s_numberNewDrawablesInLastFrame; - static unsigned int s_numberDeletedDrawablesInLastFrame; - - Drawable(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Drawable(const Drawable& drawable,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "Drawable"; } - - /** Convert 'this' into a Geometry pointer if Drawable is a Geometry, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual Geometry* asGeometry() { return 0; } - - /** Convert 'const this' into a const Geometry pointer if Drawable is a Geometry, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual const Geometry* asGeometry() const { return 0; } - - - /** Compute the DataVariance based on an assessment of callback etc.*/ - virtual void computeDataVariance(); - - - /** A vector of osg::Node pointers which is used to store the parent(s) of drawable.*/ - typedef std::vector ParentList; - - /** Get the parent list of drawable. */ - inline const ParentList& getParents() const { return _parents; } - - /** Get the a copy of parent list of node. A copy is returned to - * prevent modification of the parent list.*/ - inline ParentList getParents() { return _parents; } - - /** Get a single parent of Drawable. - * @param i index of the parent to get. - * @return the parent i. - */ - inline Node* getParent(unsigned int i) { return _parents[i]; } - /** Get a single const parent of Drawable. - * @param i index of the parent to get. - * @return the parent i. - */ - inline const Node* getParent(unsigned int i) const { return _parents[i]; } - - /** - * Get the number of parents of node. - * @return the number of parents of this node. - */ - inline unsigned int getNumParents() const { return static_cast(_parents.size()); } - - /** Get the list of matrices that transform this node from local coordinates to world coordinates. - * The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */ - MatrixList getWorldMatrices(const osg::Node* haltTraversalAtNode=0) const; - - - /** Set the StateSet attached to the Drawable. - Previously attached StateSet are automatically unreferenced on - assignment of a new drawstate.*/ - void setStateSet(StateSet* stateset); - - /** Get the attached StateSet.*/ - inline StateSet* getStateSet() { return _stateset.get();} - - /** Get the attached const StateSet.*/ - inline const StateSet* getStateSet() const { return _stateset.get();} - - /** Get the attached const StateSet, - * if one is not already attached create one, - * attach it to the drawable and return a pointer to it.*/ - StateSet* getOrCreateStateSet(); - - - /** Set the initial bounding volume to use when computing the overall bounding volume.*/ - void setInitialBound(const osg::BoundingBox& bbox) { _initialBound = bbox; dirtyBound(); } - - /** Set the initial bounding volume to use when computing the overall bounding volume.*/ - const BoundingBox& getInitialBound() const { return _initialBound; } - - /** Dirty the bounding box, forcing a computeBound() on the next call - * to getBound(). Should be called in the internal geometry of the Drawable - * is modified.*/ - void dirtyBound(); - - /** Get BoundingBox of Drawable. - * If the BoundingBox is not up to date then its updated via an internal call to computeBond(). - */ - inline const BoundingBox& getBound() const - { - if(!_boundingBoxComputed) - { - _boundingBox = _initialBound; - if (_computeBoundCallback.valid()) - _boundingBox.expandBy(_computeBoundCallback->computeBound(*this)); - else - _boundingBox.expandBy(computeBound()); - - _boundingBoxComputed = true; - } - return _boundingBox; - } - - - /** Compute the bounding box around Drawables's geometry.*/ - virtual BoundingBox computeBound() const; - - /** Callback to allow users to override the default computation of bounding volume. */ - struct ComputeBoundingBoxCallback : public osg::Object - { - ComputeBoundingBoxCallback() {} - - ComputeBoundingBoxCallback(const ComputeBoundingBoxCallback&,const CopyOp&) {} - - META_Object(osg,ComputeBoundingBoxCallback); - - virtual BoundingBox computeBound(const osg::Drawable&) const { return BoundingBox(); } - }; - - /** Set the compute bound callback to override the default computeBound.*/ - void setComputeBoundingBoxCallback(ComputeBoundingBoxCallback* callback) { _computeBoundCallback = callback; } - - /** Get the compute bound callback.*/ - ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() { return _computeBoundCallback.get(); } - - /** Get the const compute bound callback.*/ - const ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() const { return _computeBoundCallback.get(); } - - - /** Set the Shape of the \c Drawable. The shape can be used to - * speed up collision detection or as a guide for procedural - * geometry generation. - * @see osg::Shape. - */ - inline void setShape(Shape* shape) { _shape = shape; } - - /** Get the Shape of the Drawable.*/ - inline Shape* getShape() { return _shape.get(); } - - /** Get the const Shape of the const Drawable.*/ - inline const Shape* getShape() const { return _shape.get(); } - - - - /** Set the drawable so that it can or cannot be used in conjunction with OpenGL - * display lists. When set to true, calls to Drawable::setUseDisplayList, - * whereas when set to false, no display lists can be created and calls - * to setUseDisplayList are ignored, and a warning is produced. The latter - * is typically used to guard against the switching on of display lists - * on objects with dynamic internal data such as continuous Level of Detail - * algorithms.*/ - void setSupportsDisplayList(bool flag); - - /** Get whether display lists are supported for this drawable instance.*/ - inline bool getSupportsDisplayList() const { return _supportsDisplayList; } - - - /** When set to true, force the draw method to use OpenGL Display List for rendering. - If false, rendering directly. If the display list has not been compiled - already, the next call to draw will automatically create the display list.*/ - void setUseDisplayList(bool flag); - - /** Return whether OpenGL display lists are being used for rendering.*/ - inline bool getUseDisplayList() const { return _useDisplayList; } - - /** Return OpenGL display list for specified contextID. */ - inline GLuint& getDisplayList(unsigned int contextID) const { return _globjList[contextID]; } - - /** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation - method to use OpenGL vertex buffer objects for rendering.*/ - virtual void setUseVertexBufferObjects(bool flag); - - /** Return whether OpenGL vertex buffer objects should be used when supported by OpenGL driver.*/ - inline bool getUseVertexBufferObjects() const { return _useVertexBufferObjects; } - - - /** Force a recompile on next draw() of any OpenGL display list associated with this geoset.*/ - virtual void dirtyDisplayList(); - - - /** Return the estimated size of GLObjects (display lists/vertex buffer objects) that are associated with this drawable. - * This size is used a hint for reuse of deleted display lists/vertex buffer objects. */ - virtual unsigned int getGLObjectSizeHint() const { return 0; } - - - - /** Draw OpenGL primitives. - * If the \c Drawable has \c _useDisplayList set to \c true, then use - * an OpenGL display list, automatically compiling one if required. - * Otherwise, call \c drawImplementation(). - * @note This method should \e not be overridden in subclasses, as it - * manages the optional display list (notice this is not even - * \c virtual). Subclasses should override - * \c drawImplementation() instead. - */ - inline void draw(RenderInfo& renderInfo) const; - - /** Immediately compile this \c Drawable into an OpenGL Display List/VertexBufferObjects. - * @note Operation is ignored if \c _useDisplayList is \c false or VertexBufferObjects are not used. - */ - virtual void compileGLObjects(RenderInfo& renderInfo) const; - - /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ - virtual void setThreadSafeRefUnref(bool threadSafe); - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objects - * for all graphics contexts. */ - virtual void releaseGLObjects(State* state=0) const; - - struct UpdateCallback : public virtual osg::Object - { - UpdateCallback() {} - - UpdateCallback(const UpdateCallback&,const CopyOp&) {} - - META_Object(osg,UpdateCallback); - - /** do customized update code.*/ - virtual void update(osg::NodeVisitor*, osg::Drawable*) {} - }; - - /** Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal. */ - virtual void setUpdateCallback(UpdateCallback* ac); - - /** Get the non const UpdateCallback.*/ - UpdateCallback* getUpdateCallback() { return _updateCallback.get(); } - - /** Get the const UpdateCallback.*/ - const UpdateCallback* getUpdateCallback() const { return _updateCallback.get(); } - - /** Return whether this Drawable has update callbacks associated with it, and therefore must be traversed.*/ - bool requiresUpdateTraversal() const { return _updateCallback.valid() || (_stateset.valid() && _stateset->requiresUpdateTraversal()); } - - - struct EventCallback : public virtual osg::Object - { - EventCallback() {} - - EventCallback(const EventCallback&,const CopyOp&) {} - - META_Object(osg,EventCallback); - - /** do customized Event code. */ - virtual void event(osg::NodeVisitor*, osg::Drawable*) {} - }; - - /** Set the EventCallback which allows users to attach customize the updating of an object during the Event traversal.*/ - virtual void setEventCallback(EventCallback* ac); - - /** Get the non const EventCallback.*/ - EventCallback* getEventCallback() { return _eventCallback.get(); } - - /** Get the const EventCallback.*/ - const EventCallback* getEventCallback() const { return _eventCallback.get(); } - - /** Return whether this Drawable has event callbacks associated with it, and therefore must be traversed.*/ - bool requiresEventTraversal() const { return _eventCallback.valid() || (_stateset.valid() && _stateset->requiresEventTraversal()); } - - - struct CullCallback : public virtual osg::Object - { - CullCallback() {} - - CullCallback(const CullCallback&,const CopyOp&) {} - - META_Object(osg,CullCallback); - - /** deprecated.*/ - virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const { return false; } - - /** do customized cull code, return true if drawable should be culled.*/ - virtual bool cull(osg::NodeVisitor* nv, osg::Drawable* drawable, osg::RenderInfo* renderInfo) const { return cull(nv, drawable, renderInfo? renderInfo->getState():0); } - }; - - /** Set the CullCallback which allows users to customize the culling of Drawable during the cull traversal.*/ - virtual void setCullCallback(CullCallback* cc) { _cullCallback=cc; } - - /** Get the non const CullCallback.*/ - CullCallback* getCullCallback() { return _cullCallback.get(); } - - /** Get the const CullCallback.*/ - const CullCallback* getCullCallback() const { return _cullCallback.get(); } - - - - - /** Callback attached to an Drawable which allows the users to customize the drawing of an exist Drawable object. - * The draw callback is implement as a replacement to the Drawable's own drawImplementation() method, if the - * the user intends to decorate the existing draw code then simple call the drawable->drawImplementation() from - * with the callbacks drawImplementation() method. This allows the users to do both pre and post callbacks - * without fuss and can even disable the inner draw if required.*/ - struct DrawCallback : public virtual osg::Object - { - DrawCallback() {} - - DrawCallback(const DrawCallback&,const CopyOp&) {} - - META_Object(osg,DrawCallback); - - /** do customized draw code.*/ - virtual void drawImplementation(osg::RenderInfo& /*renderInfo*/,const osg::Drawable* /*drawable*/) const {} - }; - - /** Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.*/ - virtual void setDrawCallback(DrawCallback* dc) { _drawCallback=dc; dirtyDisplayList(); } - - /** Get the non const DrawCallback.*/ - DrawCallback* getDrawCallback() { return _drawCallback.get(); } - - /** Get the const DrawCallback.*/ - const DrawCallback* getDrawCallback() const { return _drawCallback.get(); } - - /** drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that - * must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable. - * drawImplementation(RenderInfo&) is called from the draw(RenderInfo&) method, with the draw method handling management of OpenGL display lists, - * and drawImplementation(RenderInfo&) handling the actual drawing itself. - * @param renderInfo The osg::RenderInfo object that encapsulates the current rendering information including the osg::State OpenGL state for the current graphics context. */ - virtual void drawImplementation(RenderInfo& renderInfo) const = 0; - - - /** Return a OpenGL display list handle a newly generated or reused from display list cache. */ - static GLuint generateDisplayList(unsigned int contextID, unsigned int sizeHint = 0); - - /** Set the minimum number of display lists to retain in the deleted display list cache. */ - static void setMinimumNumberOfDisplayListsToRetainInCache(unsigned int minimum); - - /** Get the minimum number of display lists to retain in the deleted display list cache. */ - static unsigned int getMinimumNumberOfDisplayListsToRetainInCache(); - - /** Use deleteDisplayList instead of glDeleteList to allow - * OpenGL display list to be cached until they can be deleted - * by the OpenGL context in which they were created, specified - * by contextID.*/ - static void deleteDisplayList(unsigned int contextID,GLuint globj, unsigned int sizeHint = 0); - - /** Flush all the cached display list which need to be deleted - * in the OpenGL context related to contextID.*/ - static void flushAllDeletedDisplayLists(unsigned int contextID); - - /** Flush all the cached display list which need to be deleted - * in the OpenGL context related to contextID. - * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. - * this call is useful for when an OpenGL context has been destroyed. */ - static void discardAllDeletedDisplayLists(unsigned int contextID); - - /** Flush the cached display list which need to be deleted - * in the OpenGL context related to contextID.*/ - static void flushDeletedDisplayLists(unsigned int contextID,double& availableTime); - - typedef unsigned int AttributeType; - - enum AttributeTypes - { - VERTICES = 0, - WEIGHTS = 1, - NORMALS = 2, - COLORS = 3, - SECONDARY_COLORS = 4, - FOG_COORDS = 5, - ATTRIBUTE_6 = 6, - ATTRIBUTE_7 = 7, - TEXTURE_COORDS = 8, - TEXTURE_COORDS_0 = TEXTURE_COORDS, - TEXTURE_COORDS_1 = TEXTURE_COORDS_0+1, - TEXTURE_COORDS_2 = TEXTURE_COORDS_0+2, - TEXTURE_COORDS_3 = TEXTURE_COORDS_0+3, - TEXTURE_COORDS_4 = TEXTURE_COORDS_0+4, - TEXTURE_COORDS_5 = TEXTURE_COORDS_0+5, - TEXTURE_COORDS_6 = TEXTURE_COORDS_0+6, - TEXTURE_COORDS_7 = TEXTURE_COORDS_0+7 - // only eight texture coord examples provided here, but underlying code can handle any no of texture units, - // simply co them as (TEXTURE_COORDS_0+unit). - }; - - class AttributeFunctor - { - public: - virtual ~AttributeFunctor() {} - - virtual void apply(AttributeType,unsigned int,GLbyte*) {} - virtual void apply(AttributeType,unsigned int,GLshort*) {} - virtual void apply(AttributeType,unsigned int,GLint*) {} - - virtual void apply(AttributeType,unsigned int,GLubyte*) {} - virtual void apply(AttributeType,unsigned int,GLushort*) {} - virtual void apply(AttributeType,unsigned int,GLuint*) {} - - virtual void apply(AttributeType,unsigned int,float*) {} - virtual void apply(AttributeType,unsigned int,Vec2*) {} - virtual void apply(AttributeType,unsigned int,Vec3*) {} - virtual void apply(AttributeType,unsigned int,Vec4*) {} - virtual void apply(AttributeType,unsigned int,Vec4ub*) {} - - virtual void apply(AttributeType,unsigned int,double*) {} - virtual void apply(AttributeType,unsigned int,Vec2d*) {} - virtual void apply(AttributeType,unsigned int,Vec3d*) {} - virtual void apply(AttributeType,unsigned int,Vec4d*) {} - }; - - - /** Return true if the Drawable subclass supports accept(AttributeFunctor&).*/ - virtual bool supports(const AttributeFunctor&) const { return false; } - - /** accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has. - * return true if functor handled by drawable, - * return false on failure of drawable to generate functor calls.*/ - virtual void accept(AttributeFunctor&) {} - - - class ConstAttributeFunctor - { - public: - - virtual ~ConstAttributeFunctor() {} - - virtual void apply(AttributeType,unsigned int,const GLbyte*) {} - virtual void apply(AttributeType,unsigned int,const GLshort*) {} - virtual void apply(AttributeType,unsigned int,const GLint*) {} - - virtual void apply(AttributeType,unsigned int,const GLubyte*) {} - virtual void apply(AttributeType,unsigned int,const GLushort*) {} - virtual void apply(AttributeType,unsigned int,const GLuint*) {} - - virtual void apply(AttributeType,unsigned int,const float*) {} - virtual void apply(AttributeType,unsigned int,const Vec2*) {} - virtual void apply(AttributeType,unsigned int,const Vec3*) {} - virtual void apply(AttributeType,unsigned int,const Vec4*) {} - virtual void apply(AttributeType,unsigned int,const Vec4ub*) {} - - virtual void apply(AttributeType,unsigned int,const double*) {} - virtual void apply(AttributeType,unsigned int,const Vec2d*) {} - virtual void apply(AttributeType,unsigned int,const Vec3d*) {} - virtual void apply(AttributeType,unsigned int,const Vec4d*) {} - }; - - /** Return true if the Drawable subclass supports accept(ConstAttributeFunctor&).*/ - virtual bool supports(const ConstAttributeFunctor&) const { return false; } - - /** Accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has. - * return true if functor handled by drawable, - * return false on failure of drawable to generate functor calls.*/ - virtual void accept(ConstAttributeFunctor&) const {} - - - - /** Return true if the Drawable subclass supports accept(PrimitiveFunctor&).*/ - virtual bool supports(const PrimitiveFunctor&) const { return false; } - - /** Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Drawable has. - * return true if functor handled by drawable, return false on failure of drawable to generate functor calls. - * Note, PrimtiveFunctor only provides const access of the primitives, as primitives may be procedurally generated - * so one cannot modify it.*/ - virtual void accept(PrimitiveFunctor&) const {} - - /** Return true if the Drawable subclass supports accept(PrimitiveIndexFunctor&).*/ - virtual bool supports(const PrimitiveIndexFunctor&) const { return false; } - - /** Accept a PrimitiveIndexFunctor and call its methods to tell it about the internal primitives that this Drawable has. - * return true if functor handled by drawable, return false on failure of drawable to generate functor calls. - * Note, PrimtiveIndexFunctor only provide const access of the primitives, as primitives may be procedurally generated - * so one cannot modify it.*/ - virtual void accept(PrimitiveIndexFunctor&) const {} - - - /** Extensions class which encapsulates the querying of extensions and - * associated function pointers, and provide convenience wrappers to - * check for the extensions or use the associated functions.*/ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - void setVertexProgramSupported(bool flag) { _isVertexProgramSupported=flag; } - bool isVertexProgramSupported() const { return _isVertexProgramSupported; } - - void setSecondaryColorSupported(bool flag) { _isSecondaryColorSupported=flag; } - bool isSecondaryColorSupported() const { return _isSecondaryColorSupported; } - - void setFogCoordSupported(bool flag) { _isFogCoordSupported=flag; } - bool isFogCoordSupported() const { return _isFogCoordSupported; } - - void setMultiTexSupported(bool flag) { _isMultiTexSupported=flag; } - bool isMultiTexSupported() const { return _isMultiTexSupported; } - - void setOcclusionQuerySupported(bool flag) { _isOcclusionQuerySupported=flag; } - bool isOcclusionQuerySupported() const { return _isOcclusionQuerySupported; } - - void setARBOcclusionQuerySupported(bool flag) { _isARBOcclusionQuerySupported=flag; } - bool isARBOcclusionQuerySupported() const { return _isARBOcclusionQuerySupported; } - - void setTimerQuerySupported(bool flag) { _isTimerQuerySupported = flag; } - bool isTimerQuerySupported() const { return _isTimerQuerySupported; } - void setARBTimerQuerySupported(bool flag) { _isARBTimerQuerySupported = flag; } - bool isARBTimerQuerySupported() const { return _isARBTimerQuerySupported; } - void glSecondaryColor3ubv(const GLubyte* coord) const; - void glSecondaryColor3fv(const GLfloat* coord) const; - - void glFogCoordfv(const GLfloat* coord) const; - - void glMultiTexCoord1f(GLenum target,GLfloat coord) const; - void glMultiTexCoord2fv(GLenum target,const GLfloat* coord) const; - void glMultiTexCoord3fv(GLenum target,const GLfloat* coord) const; - void glMultiTexCoord4fv(GLenum target,const GLfloat* coord) const; - - void glMultiTexCoord1d(GLenum target,GLdouble coord) const; - void glMultiTexCoord2dv(GLenum target,const GLdouble* coord) const; - void glMultiTexCoord3dv(GLenum target,const GLdouble* coord) const; - void glMultiTexCoord4dv(GLenum target,const GLdouble* coord) const; - - void glVertexAttrib1s(unsigned int index, GLshort s) const; - void glVertexAttrib1f(unsigned int index, GLfloat f) const; - void glVertexAttrib1d(unsigned int index, GLdouble f) const; - void glVertexAttrib2fv(unsigned int index, const GLfloat * v) const; - void glVertexAttrib3fv(unsigned int index, const GLfloat * v) const; - void glVertexAttrib4fv(unsigned int index, const GLfloat * v) const; - void glVertexAttrib2dv(unsigned int index, const GLdouble * v) const; - void glVertexAttrib3dv(unsigned int index, const GLdouble * v) const; - void glVertexAttrib4dv(unsigned int index, const GLdouble * v) const; - void glVertexAttrib4ubv(unsigned int index, const GLubyte * v) const; - void glVertexAttrib4Nubv(unsigned int index, const GLubyte * v) const; - - - void glGenBuffers (GLsizei n, GLuint *buffers) const; - void glBindBuffer (GLenum target, GLuint buffer) const; - void glBufferData (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage) const; - void glBufferSubData (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data) const; - void glDeleteBuffers (GLsizei n, const GLuint *buffers) const; - GLboolean glIsBuffer (GLuint buffer) const; - void glGetBufferSubData (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data) const; - GLvoid* glMapBuffer (GLenum target, GLenum access) const; - GLboolean glUnmapBuffer (GLenum target) const; - void glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params) const; - void glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params) const; - - - void glGenOcclusionQueries( GLsizei n, GLuint *ids ) const; - void glDeleteOcclusionQueries( GLsizei n, const GLuint *ids ) const; - GLboolean glIsOcclusionQuery( GLuint id ) const; - void glBeginOcclusionQuery( GLuint id ) const; - void glEndOcclusionQuery() const; - void glGetOcclusionQueryiv( GLuint id, GLenum pname, GLint *params ) const; - void glGetOcclusionQueryuiv( GLuint id, GLenum pname, GLuint *params ) const; - - void glGetQueryiv(GLenum target, GLenum pname, GLint *params) const; - void glGenQueries(GLsizei n, GLuint *ids) const; - void glBeginQuery(GLenum target, GLuint id) const; - void glEndQuery(GLenum target) const; - void glQueryCounter(GLuint id, GLenum target) const; - GLboolean glIsQuery(GLuint id) const; - void glDeleteQueries(GLsizei n, const GLuint *ids) const; - void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params) const; - void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params) const; - void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params) const; - void glGetInteger64v(GLenum pname, GLint64EXT *params) const; - - protected: - - friend class ArrayDispatchers; - - typedef void (GL_APIENTRY * FogCoordProc) (const GLfloat* coord); - - typedef void (GL_APIENTRY * VertexAttrib1sProc) (GLuint index, GLshort s); - typedef void (GL_APIENTRY * VertexAttrib1fProc) (GLuint index, GLfloat f); - typedef void (GL_APIENTRY * VertexAttrib1dProc) (GLuint index, GLdouble f); - typedef void (GL_APIENTRY * VertexAttribfvProc) (GLuint index, const GLfloat * v); - typedef void (GL_APIENTRY * VertexAttribdvProc) (GLuint index, const GLdouble * v); - typedef void (GL_APIENTRY * VertexAttribubvProc) (GLuint index, const GLubyte * v); - - typedef void (GL_APIENTRY * SecondaryColor3ubvProc) (const GLubyte* coord); - typedef void (GL_APIENTRY * SecondaryColor3fvProc) (const GLfloat* coord); - - typedef void (GL_APIENTRY * MultiTexCoord1fProc) (GLenum target,GLfloat coord); - typedef void (GL_APIENTRY * MultiTexCoordfvProc) (GLenum target,const GLfloat* coord); - typedef void (GL_APIENTRY * MultiTexCoord1dProc) (GLenum target,GLdouble coord); - typedef void (GL_APIENTRY * MultiTexCoorddvProc) (GLenum target,const GLdouble* coord); - - - typedef void (GL_APIENTRY * GenBuffersProc) (GLsizei n, GLuint *buffers); - typedef void (GL_APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); - typedef void (GL_APIENTRY * BufferDataProc) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); - typedef void (GL_APIENTRY * BufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); - typedef void (GL_APIENTRY * DeleteBuffersProc) (GLsizei n, const GLuint *buffers); - typedef GLboolean (GL_APIENTRY * IsBufferProc) (GLuint buffer); - typedef void (GL_APIENTRY * GetBufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); - typedef GLvoid* (GL_APIENTRY * MapBufferProc) (GLenum target, GLenum access); - typedef GLboolean (GL_APIENTRY * UnmapBufferProc) (GLenum target); - typedef void (GL_APIENTRY * GetBufferParameterivProc) (GLenum target, GLenum pname, GLint *params); - typedef void (GL_APIENTRY * GetBufferPointervProc) (GLenum target, GLenum pname, GLvoid* *params); - - typedef void (GL_APIENTRY * GenOcclusionQueriesProc) ( GLsizei n, GLuint *ids ); - typedef void (GL_APIENTRY * DeleteOcclusionQueriesProc) ( GLsizei n, const GLuint *ids ); - typedef GLboolean (GL_APIENTRY * IsOcclusionQueryProc) ( GLuint id ); - typedef void (GL_APIENTRY * BeginOcclusionQueryProc) ( GLuint id ); - typedef void (GL_APIENTRY * EndOcclusionQueryProc) (); - typedef void (GL_APIENTRY * GetOcclusionQueryivProc) ( GLuint id, GLenum pname, GLint *params ); - typedef void (GL_APIENTRY * GetOcclusionQueryuivProc) ( GLuint id, GLenum pname, GLuint *params ); - typedef void (GL_APIENTRY * GetOcclusionQueryui64vProc) ( GLuint id, GLenum pname, GLuint64EXT *params ); - - typedef void (GL_APIENTRY *GenQueriesProc) (GLsizei n, GLuint *ids); - typedef void (GL_APIENTRY *DeleteQueriesProc) (GLsizei n, const GLuint *ids); - typedef GLboolean (GL_APIENTRY *IsQueryProc) (GLuint id); - typedef void (GL_APIENTRY *BeginQueryProc) (GLenum target, GLuint id); - typedef void (GL_APIENTRY *EndQueryProc) (GLenum target); - typedef void (GL_APIENTRY *QueryCounterProc)(GLuint id, GLenum target); - typedef void (GL_APIENTRY *GetQueryivProc) (GLenum target, GLenum pname, GLint *params); - typedef void (GL_APIENTRY *GetQueryObjectivProc) (GLuint id, GLenum pname, GLint *params); - typedef void (GL_APIENTRY *GetQueryObjectuivProc) (GLuint id, GLenum pname, GLuint *params); - typedef void (GL_APIENTRY *GetQueryObjectui64vProc) (GLuint id, GLenum pname, GLuint64EXT *params); - typedef void (GL_APIENTRY *GetInteger64vProc) (GLenum pname, GLint64EXT *params); - - ~Extensions() {} - - bool _isVertexProgramSupported; - bool _isSecondaryColorSupported; - bool _isFogCoordSupported; - bool _isMultiTexSupported; - bool _isOcclusionQuerySupported; - bool _isARBOcclusionQuerySupported; - bool _isTimerQuerySupported; - bool _isARBTimerQuerySupported; - - FogCoordProc _glFogCoordfv; - - SecondaryColor3ubvProc _glSecondaryColor3ubv; - SecondaryColor3fvProc _glSecondaryColor3fv; - - VertexAttrib1sProc _glVertexAttrib1s; - VertexAttrib1fProc _glVertexAttrib1f; - VertexAttrib1dProc _glVertexAttrib1d; - VertexAttribfvProc _glVertexAttrib1fv; - VertexAttribfvProc _glVertexAttrib2fv; - VertexAttribfvProc _glVertexAttrib3fv; - VertexAttribfvProc _glVertexAttrib4fv; - VertexAttribdvProc _glVertexAttrib2dv; - VertexAttribdvProc _glVertexAttrib3dv; - VertexAttribdvProc _glVertexAttrib4dv; - VertexAttribubvProc _glVertexAttrib4ubv; - VertexAttribubvProc _glVertexAttrib4Nubv; - - MultiTexCoord1fProc _glMultiTexCoord1f; - MultiTexCoordfvProc _glMultiTexCoord1fv; - MultiTexCoordfvProc _glMultiTexCoord2fv; - MultiTexCoordfvProc _glMultiTexCoord3fv; - MultiTexCoordfvProc _glMultiTexCoord4fv; - MultiTexCoord1dProc _glMultiTexCoord1d; - MultiTexCoorddvProc _glMultiTexCoord2dv; - MultiTexCoorddvProc _glMultiTexCoord3dv; - MultiTexCoorddvProc _glMultiTexCoord4dv; - - GenBuffersProc _glGenBuffers; - BindBufferProc _glBindBuffer; - BufferDataProc _glBufferData; - BufferSubDataProc _glBufferSubData; - DeleteBuffersProc _glDeleteBuffers; - IsBufferProc _glIsBuffer; - GetBufferSubDataProc _glGetBufferSubData; - MapBufferProc _glMapBuffer; - UnmapBufferProc _glUnmapBuffer; - GetBufferParameterivProc _glGetBufferParameteriv; - GetBufferPointervProc _glGetBufferPointerv; - - GenOcclusionQueriesProc _glGenOcclusionQueries; - DeleteOcclusionQueriesProc _glDeleteOcclusionQueries; - IsOcclusionQueryProc _glIsOcclusionQuery; - BeginOcclusionQueryProc _glBeginOcclusionQuery; - EndOcclusionQueryProc _glEndOcclusionQuery; - GetOcclusionQueryivProc _glGetOcclusionQueryiv; - GetOcclusionQueryuivProc _glGetOcclusionQueryuiv; - - GenQueriesProc _gl_gen_queries_arb; - DeleteQueriesProc _gl_delete_queries_arb; - IsQueryProc _gl_is_query_arb; - BeginQueryProc _gl_begin_query_arb; - EndQueryProc _gl_end_query_arb; - QueryCounterProc _glQueryCounter; - GetQueryivProc _gl_get_queryiv_arb; - GetQueryObjectivProc _gl_get_query_objectiv_arb; - GetQueryObjectuivProc _gl_get_query_objectuiv_arb; - GetQueryObjectui64vProc _gl_get_query_objectui64v; - GetInteger64vProc _glGetInteger64v; - - }; - - /** Function to call to get the extension of a specified context. - * If the Extension object for that context has not yet been created - * and the 'createIfNotInitalized' flag been set to false then returns NULL. - * If 'createIfNotInitalized' is true then the Extensions object is - * automatically created. However, in this case the extension object is - * only created with the graphics context associated with ContextID..*/ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions allows users to override the extensions across graphics contexts. - * typically used when you have different extensions supported across graphics pipes - * but need to ensure that they all use the same low common denominator extensions.*/ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - - protected: - - Drawable& operator = (const Drawable&) { return *this;} - - virtual ~Drawable(); - - - /** set the bounding box .*/ - void setBound(const BoundingBox& bb) const; - - void addParent(osg::Node* node); - void removeParent(osg::Node* node); - - ParentList _parents; - friend class Node; - friend class Geode; - friend class StateSet; - - ref_ptr _stateset; - - BoundingBox _initialBound; - ref_ptr _computeBoundCallback; - mutable BoundingBox _boundingBox; - mutable bool _boundingBoxComputed; - - ref_ptr _shape; - - bool _supportsDisplayList; - bool _useDisplayList; - bool _supportsVertexBufferObjects; - bool _useVertexBufferObjects; - - typedef osg::buffered_value GLObjectList; - mutable GLObjectList _globjList; - - ref_ptr _updateCallback; - unsigned int _numChildrenRequiringUpdateTraversal; - void setNumChildrenRequiringUpdateTraversal(unsigned int num); - unsigned int getNumChildrenRequiringUpdateTraversal() const { return _numChildrenRequiringUpdateTraversal; } - - ref_ptr _eventCallback; - unsigned int _numChildrenRequiringEventTraversal; - void setNumChildrenRequiringEventTraversal(unsigned int num); - unsigned int getNumChildrenRequiringEventTraversal() const { return _numChildrenRequiringEventTraversal; } - - ref_ptr _cullCallback; - ref_ptr _drawCallback; -}; - -inline void Drawable::draw(RenderInfo& renderInfo) const -{ -#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE - if (_useDisplayList && !(_supportsVertexBufferObjects && _useVertexBufferObjects && renderInfo.getState()->isVertexBufferObjectSupported())) - { - // get the contextID (user defined ID of 0 upwards) for the - // current OpenGL context. - unsigned int contextID = renderInfo.getContextID(); - - // get the globj for the current contextID. - GLuint& globj = _globjList[contextID]; - - // call the globj if already set otherwise compile and execute. - if( globj != 0 ) - { - glCallList( globj ); - } - else if (_useDisplayList) - { -#ifdef USE_SEPARATE_COMPILE_AND_EXECUTE - globj = generateDisplayList(contextID, getGLObjectSizeHint()); - glNewList( globj, GL_COMPILE ); - if (_drawCallback.valid()) - _drawCallback->drawImplementation(renderInfo,this); - else - drawImplementation(renderInfo); - glEndList(); - - glCallList( globj); -#else - globj = generateDisplayList(contextID, getGLObjectSizeHint()); - glNewList( globj, GL_COMPILE_AND_EXECUTE ); - if (_drawCallback.valid()) - _drawCallback->drawImplementation(renderInfo,this); - else - drawImplementation(renderInfo); - glEndList(); -#endif - } - - return; - - } -#endif - - // draw object as nature intended.. - if (_drawCallback.valid()) - _drawCallback->drawImplementation(renderInfo,this); - else - drawImplementation(renderInfo); -} - - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Endian b/libs/lib/mac32/include/osg/Endian deleted file mode 100644 index 9476ef13cd1168aae1732147a3b57df55f97b030..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Endian +++ /dev/null @@ -1,85 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_ENDIAN -#define OSG_ENDIAN 1 - -#include - -namespace osg { - -enum Endian -{ - BigEndian, - LittleEndian -}; - -inline Endian getCpuByteOrder() -{ - union { - char big_endian_1[2]; - short is_it_really_1; - } u; - u.big_endian_1[0] = 0; - u.big_endian_1[1] = 1; - - if (u.is_it_really_1 == 1) - return BigEndian; - else - return LittleEndian; -} - -inline void swapBytes( char* in, unsigned int size ) -{ - char* start = in; - char* end = start+size-1; - while (start -// define USE_DEPRECATED_API is used to include in API which is being fazed out -// if you can compile your apps with this turned off you are -// well placed for compatibility with future versions. -#define USE_DEPRECATED_API - -// disable VisualStudio warnings -#if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS) - #pragma warning( disable : 4244 ) - #pragma warning( disable : 4251 ) - #pragma warning( disable : 4275 ) - #pragma warning( disable : 4512 ) - #pragma warning( disable : 4267 ) - #pragma warning( disable : 4702 ) - #pragma warning( disable : 4511 ) -#endif - -#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__) - # if defined( OSG_LIBRARY_STATIC ) - # define OSG_EXPORT - # elif defined( OSG_LIBRARY ) - # define OSG_EXPORT __declspec(dllexport) - # else - # define OSG_EXPORT __declspec(dllimport) - # endif -#else - # define OSG_EXPORT -#endif - -// set up define for whether member templates are supported by VisualStudio compilers. -#ifdef _MSC_VER -# if (_MSC_VER >= 1300) -# define __STL_MEMBER_TEMPLATES -# endif -#endif - -/* Define NULL pointer value */ - -#ifndef NULL - #ifdef __cplusplus - #define NULL 0 - #else - #define NULL ((void *)0) - #endif -#endif - -/** - -\namespace osg - -The core osg library provides the basic scene graph classes such as Nodes, -State and Drawables, and maths and general helper classes. -*/ - -#endif - diff --git a/libs/lib/mac32/include/osg/Fog b/libs/lib/mac32/include/osg/Fog deleted file mode 100644 index 56bf41113001cb2b4d45d5e83d922c94dc629b62..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Fog +++ /dev/null @@ -1,146 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_FOG -#define OSG_FOG 1 - -#include -#include - -#ifndef GL_FOG_DISTANCE_MODE_NV - #define GL_FOG_DISTANCE_MODE_NV 0x855A -#endif -#ifndef GL_EYE_PLANE_ABSOLUTE_NV - #define GL_EYE_PLANE_ABSOLUTE_NV 0x855C -#endif -#ifndef GL_EYE_RADIAL_NV - #define GL_EYE_RADIAL_NV 0x855B -#endif - - -#ifndef GL_FOG_COORDINATE - #define GL_FOG_COORDINATE 0x8451 -#endif -#ifndef GL_FRAGMENT_DEPTH - #define GL_FRAGMENT_DEPTH 0x8452 -#endif - -#ifndef GL_FOG - #define GL_FOG 0x0B60 - #define GL_EXP 0x0800 - #define GL_EXP2 0x0801 -#endif - -#ifndef GL_FOG_HINT - #define GL_FOG_HINT 0x0C54 -#endif - -namespace osg { - - -/** Fog - encapsulates OpenGL fog state. */ -class OSG_EXPORT Fog : public StateAttribute -{ - public : - - Fog(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Fog(const Fog& fog,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(fog,copyop), - _mode(fog._mode), - _density(fog._density), - _start(fog._start), - _end(fog._end), - _color(fog._color), - _fogCoordinateSource(fog._fogCoordinateSource), - _useRadialFog(fog._useRadialFog) {} - - META_StateAttribute(osg, Fog,FOG); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(Fog,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_mode) - COMPARE_StateAttribute_Parameter(_density) - COMPARE_StateAttribute_Parameter(_start) - COMPARE_StateAttribute_Parameter(_end) - COMPARE_StateAttribute_Parameter(_color) - COMPARE_StateAttribute_Parameter(_fogCoordinateSource) - COMPARE_StateAttribute_Parameter(_useRadialFog) - - return 0; // passed all the above comparison macros, must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_FOG); - return true; - } - - enum Mode { - LINEAR = GL_LINEAR, - EXP = GL_EXP, - EXP2 = GL_EXP2 - }; - - inline void setMode( Mode mode ) { _mode = mode; } - inline Mode getMode() const { return _mode; } - - inline void setDensity( float density ) { _density = density; } - inline float getDensity() const { return _density; } - - inline void setStart( float start ) { _start = start; } - inline float getStart() const { return _start; } - - inline void setEnd( float end ) { _end = end; } - inline float getEnd() const { return _end; } - - inline void setColor( const Vec4 &color ) { _color = color; } - inline const Vec4& getColor() const { return _color; } - - inline void setUseRadialFog( bool useRadialFog ) { _useRadialFog = useRadialFog; } - inline bool getUseRadialFog() const { return _useRadialFog; } - - enum FogCoordinateSource - { - FOG_COORDINATE = GL_FOG_COORDINATE, - FRAGMENT_DEPTH = GL_FRAGMENT_DEPTH - }; - - inline void setFogCoordinateSource(GLint source) { _fogCoordinateSource = source; } - inline GLint getFogCoordinateSource() const { return _fogCoordinateSource; } - - virtual void apply(State& state) const; - - protected : - - virtual ~Fog(); - - Mode _mode; - float _density; - float _start; - float _end; - Vec4 _color; - GLint _fogCoordinateSource; - bool _useRadialFog; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/FragmentProgram b/libs/lib/mac32/include/osg/FragmentProgram deleted file mode 100644 index 9d86311e88a1c96916c38b8415dec633a88a0a62..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/FragmentProgram +++ /dev/null @@ -1,312 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_FRAGMENTPROGRAM -#define OSG_FRAGMENTPROGRAM 1 - -#include -#include -#include -#include - -#include -#include - -// if not defined by gl.h use the definition found in: -// http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_program.txt -#ifndef GL_ARB_fragment_program -#define GL_FRAGMENT_PROGRAM_ARB 0x8804 -#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 -#define GL_PROGRAM_LENGTH_ARB 0x8627 -#define GL_PROGRAM_FORMAT_ARB 0x8876 -#define GL_PROGRAM_BINDING_ARB 0x8677 -#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 -#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 -#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 -#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 -#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 -#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 -#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 -#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 -#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 -#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 -#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA -#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB -#define GL_PROGRAM_ATTRIBS_ARB 0x88AC -#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD -#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE -#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF -#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 -#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 -#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 -#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 -#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 -#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 -#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 -#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 -#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A -#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B -#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C -#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D -#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E -#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F -#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 -#define GL_PROGRAM_STRING_ARB 0x8628 -#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B -#define GL_CURRENT_MATRIX_ARB 0x8641 -#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 -#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 -#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F -#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 -#define GL_MATRIX0_ARB 0x88C0 -#define GL_MATRIX1_ARB 0x88C1 -#define GL_MATRIX2_ARB 0x88C2 -#define GL_MATRIX3_ARB 0x88C3 -#define GL_MATRIX4_ARB 0x88C4 -#define GL_MATRIX5_ARB 0x88C5 -#define GL_MATRIX6_ARB 0x88C6 -#define GL_MATRIX7_ARB 0x88C7 -#define GL_MATRIX8_ARB 0x88C8 -#define GL_MATRIX9_ARB 0x88C9 -#define GL_MATRIX10_ARB 0x88CA -#define GL_MATRIX11_ARB 0x88CB -#define GL_MATRIX12_ARB 0x88CC -#define GL_MATRIX13_ARB 0x88CD -#define GL_MATRIX14_ARB 0x88CE -#define GL_MATRIX15_ARB 0x88CF -#define GL_MATRIX16_ARB 0x88D0 -#define GL_MATRIX17_ARB 0x88D1 -#define GL_MATRIX18_ARB 0x88D2 -#define GL_MATRIX19_ARB 0x88D3 -#define GL_MATRIX20_ARB 0x88D4 -#define GL_MATRIX21_ARB 0x88D5 -#define GL_MATRIX22_ARB 0x88D6 -#define GL_MATRIX23_ARB 0x88D7 -#define GL_MATRIX24_ARB 0x88D8 -#define GL_MATRIX25_ARB 0x88D9 -#define GL_MATRIX26_ARB 0x88DA -#define GL_MATRIX27_ARB 0x88DB -#define GL_MATRIX28_ARB 0x88DC -#define GL_MATRIX29_ARB 0x88DD -#define GL_MATRIX30_ARB 0x88DE -#define GL_MATRIX31_ARB 0x88DF - -#endif - - -namespace osg { - - - -/** FragmentProgram - encapsulates the OpenGL ARB fragment program state.*/ -class OSG_EXPORT FragmentProgram : public StateAttribute -{ - public: - - FragmentProgram(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - FragmentProgram(const FragmentProgram& vp,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_StateAttribute(osg, FragmentProgram, FRAGMENTPROGRAM); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const osg::StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(FragmentProgram,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_fragmentProgram) - - return 0; // passed all the above comparison macros, must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_FRAGMENT_PROGRAM_ARB); - return true; - } - - // data access methods. - - /** Get the handle to the fragment program id for the current context.*/ - inline GLuint& getFragmentProgramID(unsigned int contextID) const - { - return _fragmentProgramIDList[contextID]; - } - - - /** Set the fragment program using a C style string.*/ - inline void setFragmentProgram( const char* program ) - { - _fragmentProgram = program; - dirtyFragmentProgramObject(); - } - - /** Set the fragment program using C++ style string.*/ - inline void setFragmentProgram( const std::string& program ) - { - _fragmentProgram = program; - dirtyFragmentProgramObject(); - } - - /** Get the fragment program.*/ - inline const std::string& getFragmentProgram() const { return _fragmentProgram; } - - /** Set Program Parameters */ - inline void setProgramLocalParameter(const GLuint index, const Vec4& p) - { - _programLocalParameters[index] = p; - } - - typedef std::map LocalParamList; - - /** Set list of Program Parameters */ - inline void setLocalParameters(const LocalParamList& lpl) { _programLocalParameters = lpl; } - - /** Get list of Program Parameters */ - inline LocalParamList& getLocalParameters() { return _programLocalParameters; } - - /** Get const list of Program Parameters */ - inline const LocalParamList& getLocalParameters() const { return _programLocalParameters; } - - /** Matrix */ - inline void setMatrix(const GLenum mode, const Matrix& matrix) - { - _matrixList[mode] = matrix; - } - - typedef std::map MatrixList; - - /** Set list of Matrices */ - inline void setMatrices(const MatrixList& matrices) { _matrixList = matrices; } - - /** Get list of Matrices */ - inline MatrixList& getMatrices() { return _matrixList; } - - /** Get list of Matrices */ - inline const MatrixList& getMatrices() const { return _matrixList; } - - - /** Force a recompile on next apply() of associated OpenGL vertex program objects.*/ - void dirtyFragmentProgramObject(); - - /** use deleteFragmentProgramObject instead of glDeletePrograms to allow - * OpenGL Fragment Program objects to be cached until they can be deleted - * by the OpenGL context in which they were created, specified - * by contextID.*/ - static void deleteFragmentProgramObject(unsigned int contextID,GLuint handle); - - /** flush all the cached fragment programs which need to be deleted - * in the OpenGL context related to contextID.*/ - static void flushDeletedFragmentProgramObjects(unsigned int contextID,double currentTime, double& availableTime); - - /** discard all the cached fragment programs which need to be deleted - * in the OpenGL context related to contextID. - * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. - * this call is useful for when an OpenGL context has been destroyed. */ - static void discardDeletedFragmentProgramObjects(unsigned int contextID); - - virtual void apply(State& state) const; - - virtual void compileGLObjects(State& state) const { apply(state); } - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** release an OpenGL objects in specified graphics context if State - object is passed, otherwise release OpenGL objects for all graphics context if - State object pointer == NULL.*/ - virtual void releaseGLObjects(State* state=0) const; - - /** Extensions class which encapsulates the querying of extensions and - * associated function pointers, and provide convenience wrappers to - * check for the extensions or use the associated functions.*/ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - void setFragmentProgramSupported(bool flag) { _isFragmentProgramSupported=flag; } - bool isFragmentProgramSupported() const { return _isFragmentProgramSupported; } - - void glBindProgram(GLenum target, GLuint id) const; - void glGenPrograms(GLsizei n, GLuint *programs) const; - void glDeletePrograms(GLsizei n, GLuint *programs) const; - void glProgramString(GLenum target, GLenum format, GLsizei len, const void *string) const; - void glProgramLocalParameter4fv(GLenum target, GLuint index, const GLfloat *params) const; - - protected: - - ~Extensions() {} - - bool _isFragmentProgramSupported; - - typedef void (GL_APIENTRY * BindProgramProc) (GLenum target, GLuint id); - typedef void (GL_APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs); - typedef void (GL_APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs); - typedef void (GL_APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string); - typedef void (GL_APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params); - - BindProgramProc _glBindProgram; - GenProgramsProc _glGenPrograms; - DeleteProgramsProc _glDeletePrograms; - ProgramStringProc _glProgramString; - ProgramLocalParameter4fvProc _glProgramLocalParameter4fv; - }; - - /** Function to call to get the extension of a specified context. - * If the Extension object for that context has not yet been created and the - * 'createIfNotInitalized' flag has been set to false then returns NULL. - * If 'createIfNotInitalized' is true then the Extensions object is - * automatically created. However, in this case the extension object will - * only be created with the graphics context associated with ContextID..*/ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions allows users to override the extensions across graphics contexts. - * typically used when you have different extensions supported across graphics pipes - * but need to ensure that they all use the same low common denominator extensions.*/ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - - protected: - - - virtual ~FragmentProgram(); - - typedef buffered_value FragmentProgramIDList; - mutable FragmentProgramIDList _fragmentProgramIDList; - - std::string _fragmentProgram; - - LocalParamList _programLocalParameters; - MatrixList _matrixList; -}; - - - -} - -#endif - diff --git a/libs/lib/mac32/include/osg/FrameBufferObject b/libs/lib/mac32/include/osg/FrameBufferObject deleted file mode 100644 index c84226ec0f888fab15042fc1d337ab50a7047627..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/FrameBufferObject +++ /dev/null @@ -1,518 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -// initial FBO support written by Marco Jez, June 2005. - -#ifndef OSG_FRAMEBUFFEROBJECT -#define OSG_FRAMEBUFFEROBJECT 1 - -#include -#include -#include -#include - -#ifndef GL_EXT_framebuffer_object -#define GL_EXT_framebuffer_object 1 -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_RENDERBUFFER_EXT 0x8D41 -// #define GL_STENCIL_INDEX_EXT 0x8D45 // removed in rev. #114 of the spec -#define GL_STENCIL_INDEX1_EXT 0x8D46 -#define GL_STENCIL_INDEX4_EXT 0x8D47 -#define GL_STENCIL_INDEX8_EXT 0x8D48 -#define GL_STENCIL_INDEX16_EXT 0x8D49 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD -#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 -#endif - -#ifndef GL_EXT_framebuffer_blit -#define GL_EXT_framebuffer_blit 1 -#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA -#endif - -#ifndef GL_EXT_framebuffer_multisample -#define GL_EXT_framebuffer_multisample 1 -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -#endif - -#ifndef GL_MAX_SAMPLES_EXT -// Workaround for Centos 5 and other distros that define -// GL_EXT_framebuffer_multisample but not GL_MAX_SAMPLES_EXT -#define GL_MAX_SAMPLES_EXT 0x8D57 -#endif - -#ifndef GL_NV_framebuffer_multisample_coverage -#define GL_NV_framebuffer_multisample_coverage 1 -#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB -#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 -#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 -#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 -#endif - -#ifndef GL_DEPTH_COMPONENT -#define GL_DEPTH_COMPONENT 0x1902 -#endif - -#ifndef GL_VERSION_1_4 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#endif - -#ifndef GL_DEPTH_COMPONENT32F -#define GL_DEPTH_COMPONENT32F 0x8CAC -#endif - -#ifndef GL_DEPTH_COMPONENT32F_NV -#define GL_DEPTH_COMPONENT32F_NV 0x8DAB -#endif - -#ifndef GL_EXT_packed_depth_stencil -#define GL_EXT_packed_depth_stencil 1 -#define GL_DEPTH_STENCIL_EXT 0x84F9 -#define GL_UNSIGNED_INT_24_8_EXT 0x84FA -#define GL_DEPTH24_STENCIL8_EXT 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 -#endif - -namespace osg -{ - -/************************************************************************** - * FBOExtensions - **************************************************************************/ - - class OSG_EXPORT FBOExtensions : public osg::Referenced - { - public: - typedef void GL_APIENTRY TglBindRenderbuffer(GLenum, GLuint); - typedef void GL_APIENTRY TglDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers); - typedef void GL_APIENTRY TglGenRenderbuffers(GLsizei, GLuint *); - typedef void GL_APIENTRY TglRenderbufferStorage(GLenum, GLenum, GLsizei, GLsizei); - typedef void GL_APIENTRY TglRenderbufferStorageMultisample(GLenum, GLsizei, GLenum, GLsizei, GLsizei); - typedef void GL_APIENTRY TglRenderbufferStorageMultisampleCoverageNV(GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); - typedef void GL_APIENTRY TglBindFramebuffer(GLenum, GLuint); - typedef void GL_APIENTRY TglDeleteFramebuffers(GLsizei n, const GLuint *framebuffers); - typedef void GL_APIENTRY TglGenFramebuffers(GLsizei, GLuint *); - typedef GLenum GL_APIENTRY TglCheckFramebufferStatus(GLenum); - typedef void GL_APIENTRY TglFramebufferTexture1D(GLenum, GLenum, GLenum, GLuint, GLint); - typedef void GL_APIENTRY TglFramebufferTexture2D(GLenum, GLenum, GLenum, GLuint, GLint); - typedef void GL_APIENTRY TglFramebufferTexture3D(GLenum, GLenum, GLenum, GLuint, GLint, GLint); - typedef void GL_APIENTRY TglFramebufferTexture(GLenum, GLenum, GLint, GLint); - typedef void GL_APIENTRY TglFramebufferTextureLayer(GLenum, GLenum, GLuint, GLint, GLint); - typedef void GL_APIENTRY TglFramebufferRenderbuffer(GLenum, GLenum, GLenum, GLuint); - typedef void GL_APIENTRY TglGenerateMipmap(GLenum); - typedef void GL_APIENTRY TglBlitFramebuffer(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); - typedef void GL_APIENTRY TglGetRenderbufferParameteriv(GLenum, GLenum, GLint*); - - TglBindRenderbuffer* glBindRenderbuffer; - TglGenRenderbuffers* glGenRenderbuffers; - TglDeleteRenderbuffers* glDeleteRenderbuffers; - TglRenderbufferStorage* glRenderbufferStorage; - TglRenderbufferStorageMultisample* glRenderbufferStorageMultisample; - TglRenderbufferStorageMultisampleCoverageNV* glRenderbufferStorageMultisampleCoverageNV; - TglBindFramebuffer* glBindFramebuffer; - TglDeleteFramebuffers* glDeleteFramebuffers; - TglGenFramebuffers* glGenFramebuffers; - TglCheckFramebufferStatus* glCheckFramebufferStatus; - TglFramebufferTexture1D* glFramebufferTexture1D; - TglFramebufferTexture2D* glFramebufferTexture2D; - TglFramebufferTexture3D* glFramebufferTexture3D; - TglFramebufferTexture* glFramebufferTexture; - TglFramebufferTextureLayer* glFramebufferTextureLayer; - TglFramebufferRenderbuffer* glFramebufferRenderbuffer; - TglGenerateMipmap* glGenerateMipmap; - TglBlitFramebuffer* glBlitFramebuffer; - TglGetRenderbufferParameteriv* glGetRenderbufferParameteriv; - - static FBOExtensions* instance(unsigned contextID, bool createIfNotInitalized); - - bool isSupported() const { return _supported; } - bool isMultisampleSupported() const { return glRenderbufferStorageMultisample != 0; } - bool isMultisampleCoverageSupported() const { return glRenderbufferStorageMultisampleCoverageNV != 0; } - bool isPackedDepthStencilSupported() const { return _packed_depth_stencil_supported; } - - protected: - FBOExtensions(unsigned int contextID); - - bool _supported; - bool _packed_depth_stencil_supported; - }; - -/************************************************************************** - * RenderBuffer - **************************************************************************/ - - class OSG_EXPORT RenderBuffer: public Object - { - public: - RenderBuffer(); - RenderBuffer(int width, int height, GLenum internalFormat, int samples=0, int colorSamples=0); - RenderBuffer(const RenderBuffer& copy, const CopyOp& copyop = CopyOp::SHALLOW_COPY); - - META_Object(osg, RenderBuffer); - - inline int getWidth() const; - inline int getHeight() const; - inline void setWidth(int w); - inline void setHeight(int h); - inline void setSize(int w, int h); - inline GLenum getInternalFormat() const; - inline void setInternalFormat(GLenum format); - inline int getSamples() const; - inline int getColorSamples() const; - inline void setSamples(int samples); - inline void setColorSamples(int colorSamples); - - GLuint getObjectID(unsigned int contextID, const FBOExtensions *ext) const; - inline int compare(const RenderBuffer &rb) const; - - /** Mark internal RenderBuffer for deletion. - * Deletion requests are queued until they can be executed - * in the proper GL context. */ - static void deleteRenderBuffer(unsigned int contextID, GLuint rb); - - /** flush all the cached RenderBuffers which need to be deleted - * in the OpenGL context related to contextID.*/ - static void flushDeletedRenderBuffers(unsigned int contextID,double currentTime, double& availableTime); - - /** discard all the cached RenderBuffers which need to be deleted in the OpenGL context related to contextID. - * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. - * this call is useful for when an OpenGL context has been destroyed. */ - static void discardDeletedRenderBuffers(unsigned int contextID); - - static int getMaxSamples(unsigned int contextID, const FBOExtensions *ext); - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases any associated OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objexts - * for all graphics contexts. */ - virtual void releaseGLObjects(osg::State* = 0) const; - - protected: - virtual ~RenderBuffer(); - RenderBuffer &operator=(const RenderBuffer &) { return *this; } - - inline void dirtyAll() const; - - private: - mutable buffered_value _objectID; - mutable buffered_value _dirty; - - GLenum _internalFormat; - int _width; - int _height; - // "samples" in the framebuffer_multisample extension is equivalent to - // "coverageSamples" in the framebuffer_multisample_coverage extension. - int _samples; - int _colorSamples; - }; - - // INLINE METHODS - - inline int RenderBuffer::getWidth() const - { - return _width; - } - - inline int RenderBuffer::getHeight() const - { - return _height; - } - - inline void RenderBuffer::setWidth(int w) - { - _width = w; - dirtyAll(); - } - - inline void RenderBuffer::setHeight(int h) - { - _height = h; - dirtyAll(); - } - - inline void RenderBuffer::setSize(int w, int h) - { - _width = w; - _height = h; - dirtyAll(); - } - - inline GLenum RenderBuffer::getInternalFormat() const - { - return _internalFormat; - } - - inline void RenderBuffer::setInternalFormat(GLenum format) - { - _internalFormat = format; - dirtyAll(); - } - - inline int RenderBuffer::getSamples() const - { - return _samples; - } - - inline int RenderBuffer::getColorSamples() const - { - return _colorSamples; - } - - inline void RenderBuffer::setSamples(int samples) - { - _samples = samples; - dirtyAll(); - } - - inline void RenderBuffer::setColorSamples(int colorSamples) - { - _colorSamples = colorSamples; - dirtyAll(); - } - - inline void RenderBuffer::dirtyAll() const - { - _dirty.setAllElementsTo(1); - } - - inline int RenderBuffer::compare(const RenderBuffer &rb) const - { - if (&rb == this) return 0; - if (_internalFormat < rb._internalFormat) return -1; - if (_internalFormat > rb._internalFormat) return 1; - if (_width < rb._width) return -1; - if (_width > rb._width) return 1; - if (_height < rb._height) return -1; - if (_height > rb._height) return 1; - return 0; - } - -/************************************************************************** - * FrameBufferAttachement - **************************************************************************/ - class Texture1D; - class Texture2D; - class Texture2DMultisample; - class Texture3D; - class Texture2DArray; - class TextureCubeMap; - class TextureRectangle; - - class OSG_EXPORT FrameBufferAttachment - { - public: - FrameBufferAttachment(); - FrameBufferAttachment(const FrameBufferAttachment& copy); - - explicit FrameBufferAttachment(RenderBuffer* target); - explicit FrameBufferAttachment(Texture1D* target, unsigned int level = 0); - explicit FrameBufferAttachment(Texture2D* target, unsigned int level = 0); - explicit FrameBufferAttachment(Texture2DMultisample* target, unsigned int level = 0); - explicit FrameBufferAttachment(Texture3D* target, unsigned int zoffset, unsigned int level = 0); - explicit FrameBufferAttachment(Texture2DArray* target, unsigned int layer, unsigned int level = 0); - explicit FrameBufferAttachment(TextureCubeMap* target, unsigned int face, unsigned int level = 0); - explicit FrameBufferAttachment(TextureRectangle* target); - explicit FrameBufferAttachment(Camera::Attachment& attachment); - - ~FrameBufferAttachment(); - - FrameBufferAttachment&operator = (const FrameBufferAttachment& copy); - - bool isMultisample() const; - void createRequiredTexturesAndApplyGenerateMipMap(State& state, const FBOExtensions* ext) const; - void attach(State &state, GLenum target, GLenum attachment_point, const FBOExtensions* ext) const; - int compare(const FrameBufferAttachment &fa) const; - - RenderBuffer* getRenderBuffer(); - const RenderBuffer* getRenderBuffer() const; - - Texture* getTexture(); - const Texture* getTexture() const; - - unsigned int getCubeMapFace() const; - unsigned int getTextureLevel() const; - unsigned int getTexture3DZOffset() const; - unsigned int getTextureArrayLayer() const; - - private: - // use the Pimpl idiom to avoid dependency from - // all Texture* headers - struct Pimpl; - Pimpl* _ximpl; - }; - -/************************************************************************** - * FrameBufferObject - **************************************************************************/ - class OSG_EXPORT FrameBufferObject: public StateAttribute - { - public: - typedef std::map AttachmentMap; - typedef std::vector MultipleRenderingTargets; - - typedef Camera::BufferComponent BufferComponent; - - FrameBufferObject(); - FrameBufferObject(const FrameBufferObject& copy, const CopyOp& copyop = CopyOp::SHALLOW_COPY); - - META_StateAttribute(osg, FrameBufferObject, (StateAttribute::Type)0x101010/*FrameBufferObject*/); - - inline const AttachmentMap& getAttachmentMap() const; - - - void setAttachment(BufferComponent attachment_point, const FrameBufferAttachment &attachment); - inline const FrameBufferAttachment& getAttachment(BufferComponent attachment_point) const; - inline bool hasAttachment(BufferComponent attachment_point) const; - - inline bool hasMultipleRenderingTargets() const { return !_drawBuffers.empty(); } - inline const MultipleRenderingTargets& getMultipleRenderingTargets() const { return _drawBuffers; } - - bool isMultisample() const; - - int compare(const StateAttribute &sa) const; - - void apply(State &state) const; - - enum BindTarget - { - READ_FRAMEBUFFER = GL_READ_FRAMEBUFFER_EXT, - DRAW_FRAMEBUFFER = GL_DRAW_FRAMEBUFFER_EXT, - READ_DRAW_FRAMEBUFFER = GL_FRAMEBUFFER_EXT - }; - - /** Bind the FBO as either the read or draw target, or both. */ - void apply(State &state, BindTarget target) const; - - /** Mark internal FBO for deletion. - * Deletion requests are queued until they can be executed - * in the proper GL context. */ - static void deleteFrameBufferObject(unsigned int contextID, GLuint program); - - /** flush all the cached FBOs which need to be deleted - * in the OpenGL context related to contextID.*/ - static void flushDeletedFrameBufferObjects(unsigned int contextID,double currentTime, double& availableTime); - - /** discard all the cached FBOs which need to be deleted - * in the OpenGL context related to contextID.*/ - static void discardDeletedFrameBufferObjects(unsigned int contextID); - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases any associated OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objexts - * for all graphics contexts. */ - virtual void releaseGLObjects(osg::State* = 0) const; - - protected: - virtual ~FrameBufferObject(); - FrameBufferObject& operator = (const FrameBufferObject&) { return *this; } - - void updateDrawBuffers(); - - inline void dirtyAll(); - - GLenum convertBufferComponentToGLenum(BufferComponent attachment_point) const; - - private: - AttachmentMap _attachments; - - // Buffers passed to glDrawBuffers when using multiple render targets. - MultipleRenderingTargets _drawBuffers; - - mutable buffered_value _dirtyAttachmentList; - mutable buffered_value _unsupported; - mutable buffered_value _fboID; - - }; - - // INLINE METHODS - - inline const FrameBufferObject::AttachmentMap &FrameBufferObject::getAttachmentMap() const - { - return _attachments; - } - - inline bool FrameBufferObject::hasAttachment(FrameBufferObject::BufferComponent attachment_point) const - { - return _attachments.find(attachment_point) != _attachments.end(); - } - - inline const FrameBufferAttachment &FrameBufferObject::getAttachment(FrameBufferObject::BufferComponent attachment_point) const - { - return _attachments.find(attachment_point)->second; - } - - inline void FrameBufferObject::dirtyAll() - { - _dirtyAttachmentList.setAllElementsTo(1); - } - - -} - -#endif - diff --git a/libs/lib/mac32/include/osg/FrameStamp b/libs/lib/mac32/include/osg/FrameStamp deleted file mode 100644 index 7cdea2164a0a525266636cf7dcecfb699113a8dd..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/FrameStamp +++ /dev/null @@ -1,91 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_FRAMESTAMP -#define OSG_FRAMESTAMP 1 - -#include - -#if defined(__sgi) || (defined(WIN32) && !defined(__MWERKS__)) -#include -#else -#include -using std::tm; -#endif - -namespace osg -{ - -/** Class which encapsulates the frame number, reference time and calendar - * time of specific frame, used to synchronize operations on the scene graph - * and other machines when using a graphics cluster. Note the calendar - * time can be an artificial simulation time or capture the real time - * of day etc.*/ -class OSG_EXPORT FrameStamp : public Referenced -{ - public: - - FrameStamp(); - FrameStamp(const FrameStamp& fs); - - FrameStamp& operator = (const FrameStamp& fs); - - void setFrameNumber(unsigned int fnum) { _frameNumber = fnum; } - unsigned int getFrameNumber() const { return _frameNumber; } - - void setReferenceTime(double refTime) { _referenceTime = refTime; } - double getReferenceTime() const { return _referenceTime; } - - void setSimulationTime(double refTime) { _simulationTime = refTime; } - double getSimulationTime() const { return _simulationTime; } - - void setCalendarTime(const tm& calendarTime); - void getCalendarTime(tm& calendarTime) const; - - // keep public to allow it to be permit allocation which is - // not on the heap used osgcluster - virtual ~FrameStamp(); - - protected: - - - // note no dynamic memory is used so that data can be passed - // via a simple memory copy or within a data packet across - // the network. - - unsigned int _frameNumber; - double _referenceTime; - double _simulationTime; - - // member variables of time.h's tm structure, copied here to - // ensure that all data is not dynamic. The tm structure itself - // is not completely consistent between implementations, which - // could be a problem when sending the FrameStamp across a network - // with different versions of tm (i.e mixing Unix and Windows.) - int tm_sec; /* Seconds. [0-60] (1 leap second) */ - int tm_min; /* Minutes. [0-59] */ - int tm_hour; /* Hours. [0-23] */ - int tm_mday; /* Day. [1-31] */ - int tm_mon; /* Month. [0-11] */ - int tm_year; /* Year - 1900. */ - int tm_wday; /* Day of week. [0-6] */ - int tm_yday; /* Days in year. [0-365] */ - int tm_isdst; /* DST. [-1/0/1]*/ - - -}; - -} - - -#endif diff --git a/libs/lib/mac32/include/osg/FrontFace b/libs/lib/mac32/include/osg/FrontFace deleted file mode 100644 index 43eeb8eb8d314762b6623c85ac7c46a2541e02a7..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/FrontFace +++ /dev/null @@ -1,70 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_FRONTFACE -#define OSG_FRONTFACE 1 - -#include -#include - -namespace osg { - -/** Class to specify the orientation of front-facing polygons. -*/ -class OSG_EXPORT FrontFace : public StateAttribute -{ - public : - - enum Mode { - CLOCKWISE = GL_CW, - COUNTER_CLOCKWISE = GL_CCW - }; - - FrontFace(Mode face=COUNTER_CLOCKWISE); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - FrontFace(const FrontFace& ff,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(ff,copyop), - _mode(ff._mode) {} - - META_StateAttribute(osg, FrontFace, FRONTFACE); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(FrontFace,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_mode) - - return 0; // passed all the above comparison macros, must be equal. - } - - inline void setMode(Mode mode) { _mode = mode; } - inline Mode getMode() const { return _mode; } - - virtual void apply(State& state) const; - - protected: - - virtual ~FrontFace(); - - Mode _mode; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/GL b/libs/lib/mac32/include/osg/GL deleted file mode 100644 index 9f43694a30021afb0bc6e88b8111a3144e0b3eb4..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GL +++ /dev/null @@ -1,221 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GL -#define OSG_GL 1 - -#include -#include - -#if defined(OSG_GLES1_AVAILABLE) - - #ifdef __APPLE__ - //if its apple include the target defines so we can check for IOS - #include "TargetConditionals.h" - #include - #else - #include - #endif - -#elif defined(OSG_GLES2_AVAILABLE) - - #ifdef __APPLE__ - //if its apple include the target defines so we can check for IOS - #include "TargetConditionals.h" - #include - #else - #include - #endif - - -#else - - #ifndef WIN32 - - // Required for compatibility with glext.h sytle function definitions of - // OpenGL extensions, such as in src/osg/Point.cpp. - #ifndef APIENTRY - #define APIENTRY - #endif - - #else // WIN32 - - #if defined(__CYGWIN__) || defined(__MINGW32__) - - #ifndef APIENTRY - #define GLUT_APIENTRY_DEFINED - #define APIENTRY __stdcall - #endif - // XXX This is from Win32's - #ifndef CALLBACK - #define CALLBACK __stdcall - #endif - - #else // ! __CYGWIN__ - - // Under Windows avoid including - // to avoid name space pollution, but Win32's - // needs APIENTRY and WINGDIAPI defined properly. - // XXX This is from Win32's - #ifndef APIENTRY - #define GLUT_APIENTRY_DEFINED - #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) - #define WINAPI __stdcall - #define APIENTRY WINAPI - #else - #define APIENTRY - #endif - #endif - - // XXX This is from Win32's - #ifndef CALLBACK - #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) - #define CALLBACK __stdcall - #else - #define CALLBACK - #endif - #endif - - #endif // __CYGWIN__ - - // XXX This is from Win32's and - #ifndef WINGDIAPI - #define GLUT_WINGDIAPI_DEFINED - #define DECLSPEC_IMPORT __declspec(dllimport) - #define WINGDIAPI DECLSPEC_IMPORT - #endif - - // XXX This is from Win32's - #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4))) - typedef unsigned short wchar_t; - #define _WCHAR_T_DEFINED - #endif - - #endif // WIN32 - - #if defined(OSG_GL3_AVAILABLE) - - #define GL3_PROTOTYPES 1 - #include - - #else - #ifndef __gl_h_ - #ifdef __APPLE__ - #include - #else - #include - #endif - #endif - #endif - - #ifndef GL_APIENTRY - #define GL_APIENTRY APIENTRY - #endif // GL_APIENTRY - -#endif - - -#ifdef OSG_GL_MATRICES_AVAILABLE - - inline void glLoadMatrix(const float* mat) { glLoadMatrixf(static_cast(mat)); } - inline void glMultMatrix(const float* mat) { glMultMatrixf(static_cast(mat)); } - - #ifdef OSG_GLES1_AVAILABLE - inline void glLoadMatrix(const double* mat) - { - GLfloat flt_mat[16]; - for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i]; - glLoadMatrixf(flt_mat); - } - - inline void glMultMatrix(const double* mat) - { - GLfloat flt_mat[16]; - for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i]; - glMultMatrixf(flt_mat); - } - - #else - inline void glLoadMatrix(const double* mat) { glLoadMatrixd(static_cast(mat)); } - inline void glMultMatrix(const double* mat) { glMultMatrixd(static_cast(mat)); } - #endif -#endif - -// add defines for OpenGL targets that don't define them, just to ease compatibility across targets -#ifndef GL_DOUBLE - #define GL_DOUBLE 0x140A - typedef double GLdouble; -#endif - -#ifndef GL_INT - #define GL_INT 0x1404 -#endif - -#ifndef GL_UNSIGNED_INT - #define GL_UNSIGNED_INT 0x1405 -#endif - -#ifndef GL_NONE - // OpenGL ES1 doesn't provide GL_NONE - #define GL_NONE 0x0 -#endif - -#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) - //GLES defines (OES) - #define GL_RGB8_OES 0x8051 - #define GL_RGBA8_OES 0x8058 -#endif - -#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GL3_AVAILABLE) - #define GL_POLYGON 0x0009 - #define GL_QUADS 0x0007 - #define GL_QUAD_STRIP 0x0008 -#endif - -#if defined(OSG_GL3_AVAILABLE) - #define GL_LUMINANCE 0x1909 - #define GL_LUMINANCE_ALPHA 0x190A -#endif - -#ifdef OSG_GL1_AVAILABLE - #define OSG_GL1_FEATURES 1 -#else - #define OSG_GL1_FEATURES 0 -#endif - -#ifdef OSG_GL2_AVAILABLE - #define OSG_GL2_FEATURES 1 -#else - #define OSG_GL2_FEATURES 0 -#endif - -#ifdef OSG_GL3_AVAILABLE - #define OSG_GL3_FEATURES 1 -#else - #define OSG_GL3_FEATURES 0 -#endif - -#ifdef OSG_GLES1_AVAILABLE - #define OSG_GLES1_FEATURES 1 -#else - #define OSG_GLES1_FEATURES 0 -#endif - -#ifdef OSG_GLES2_AVAILABLE - #define OSG_GLES2_FEATURES 1 -#else - #define OSG_GLES2_FEATURES 0 -#endif - - -#endif // __osgGL_h diff --git a/libs/lib/mac32/include/osg/GL2Extensions b/libs/lib/mac32/include/osg/GL2Extensions deleted file mode 100644 index 8137951bf1fe601e76599361b0cf5b17c275151b..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GL2Extensions +++ /dev/null @@ -1,791 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * Copyright (C) 2003-2005 3Dlabs Inc. Ltd. - * Copyright (C) 2004-2005 Nathan Cournia - * Copyright (C) 2007 Art Tevs - * Copyright (C) 2008 Zebra Imaging - * Copyright (C) 2010 VIRES Simulationstechnologie GmbH - * - * This application is open source and may be redistributed and/or modified - * freely and without restriction, both in commercial and non commercial - * applications, as long as this copyright notice is maintained. - * - * This application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -*/ - -/* file: include/osg/GL2Extensions - * author: Mike Weiblen 2008-01-02 - * Holger Helmich 2010-10-21 -*/ - -#ifndef OSG_GL2EXTENSIONS -#define OSG_GL2EXTENSIONS 1 - -#include -#include - -#include - -#ifndef GL_SAMPLER_2D_ARRAY_EXT - #define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 - #define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 - #define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 - #define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 -#endif - -#if !defined(GL_VERSION_2_0) -typedef char GLchar; -#endif - -#if !defined(GL_VERSION_2_0) - #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 - #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#endif - -#if !defined(GL_VERSION_2_0) && !defined(GL_ES_VERSION_2_0) -#define GL_VERSION_2_0 1 -#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_COORDS 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#endif - -#ifndef GL_VERSION_2_1 -#define GL_VERSION_2_1 1 -#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB_ALPHA 0x8C42 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_SLUMINANCE_ALPHA 0x8C44 -#define GL_SLUMINANCE8_ALPHA8 0x8C45 -#define GL_SLUMINANCE 0x8C46 -#define GL_SLUMINANCE8 0x8C47 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#define GL_COMPRESSED_SLUMINANCE 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B -#endif - -// EXT_geometry_shader4 -#ifndef GL_GEOMETRY_SHADER_EXT -#define GL_GEOMETRY_SHADER_EXT 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA -#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB -#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD -#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE -#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 -#define GL_LINES_ADJACENCY_EXT 0x000A -#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B -#define GL_TRIANGLES_ADJACENCY_EXT 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 -#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 -#endif - -// ARB_tesselation_shader -#ifndef GL_TESS_EVALUATION_SHADER -#define GL_PATCHES 0x000E -#define GL_PATCH_VERTICES 0x8E72 -#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 -#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 -#define GL_MAX_PATCH_VERTICES 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 -#define GL_MAX_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 -#define GL_MAX_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 -#define GL_MAX_MAX_TESS_PATCH_COMPONENTS 0x8E84 -#define GL_MAX_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 -#define GL_MAX_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 -#define GL_MAX_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 -#define GL_MAX_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A -#define GL_MAX_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C -#define GL_MAX_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D -#define GL_MAX_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E -#define GL_MAX_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F -#define GL_TESS_EVALUATION_SHADER 0x8E87 -#define GL_TESS_CONTROL_SHADER 0x8E88 -#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 -#define GL_TESS_GEN_MODE 0x8E76 -#define GL_TESS_GEN_SPACING 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 -#define GL_TESS_GEN_POINT_MODE 0x8E79 -#define GL_ISOLINES 0x8E7A -#define GL_FRACTIONAL_ODD 0x8E7B -#define GL_FRACTIONAL_EVEN 0x8E7C -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 -#endif - -// EXT_gpu_shader4 -#ifndef GL_INT_SAMPLER_2D_EXT -#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 -#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 -#define GL_SAMPLER_BUFFER_EXT 0x8DC2 -#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 -#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 -#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 -#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 -#define GL_INT_SAMPLER_1D_EXT 0x8DC9 -#define GL_INT_SAMPLER_2D_EXT 0x8DCA -#define GL_INT_SAMPLER_3D_EXT 0x8DCB -#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC -#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD -#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF -#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 -#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 -#endif - -// ARB_uniform_buffer_object -#ifndef GL_UNIFORM_BUFFER -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFFu -#endif - -//ARB_get_program_binary -#ifndef GL_PROGRAM_BINARY_RETRIEVABLE_HINT -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#endif - -namespace osg { - -class OSG_EXPORT GL2Extensions : public osg::Referenced -{ - public: - GL2Extensions(unsigned int contextID); - GL2Extensions(const GL2Extensions& rhs); - - void lowestCommonDenominator(const GL2Extensions& rhs); - - void setupGL2Extensions(unsigned int contextID); - - /** Does the GL driver support OpenGL Shading Language? */ - bool isGlslSupported() const; - - float getGlVersion() const { return _glVersion; } - float getLanguageVersion() const { return _glslLanguageVersion; } - - void setShaderObjectsSupported(bool flag) { _isShaderObjectsSupported = flag; } - bool isShaderObjectsSupported() const { return _isShaderObjectsSupported; } - - void setVertexShaderSupported(bool flag) { _isVertexShaderSupported = flag; } - bool isVertexShaderSupported() const { return _isVertexShaderSupported; } - - void setFragmentShaderSupported(bool flag) { _isFragmentShaderSupported = flag; } - bool isFragmentShaderSupported() const { return _isFragmentShaderSupported; } - - void setLanguage100Supported(bool flag) { _isLanguage100Supported = flag; } - bool isLanguage100Supported() const { return _isLanguage100Supported; } - - void setGeometryShader4Supported(bool flag) { _isGeometryShader4Supported = flag; } - bool isGeometryShader4Supported() const { return _isGeometryShader4Supported; } - - void setTessellationShadersSupported(bool flag) { _areTessellationShadersSupported = flag; } - bool areTessellationShadersSupported() const { return _areTessellationShadersSupported; } - - void setGpuShader4Supported(bool flag) { _isGpuShader4Supported = flag; } - bool isGpuShader4Supported() const { return _isGpuShader4Supported; } - - void setUniformBufferObjectSupported(bool flag) { _isUniformBufferObjectSupported = flag; } - bool isUniformBufferObjectSupported() {return _isUniformBufferObjectSupported; } - - void setGetProgramBinarySupported(bool flag) { _isGetProgramBinarySupported = flag; } - bool isGetProgramBinarySupported() {return _isGetProgramBinarySupported; } - - /** Function to call to get the extension of a specified context. - * If the Exentsion object for that context has not yet been created then - * and the 'createIfNotInitalized' flag been set to false then returns NULL. - * If 'createIfNotInitalized' is true then the Extensions object is - * automatically created. However, in this case the extension object - * only be created with the graphics context associated with ContextID..*/ - static GL2Extensions* Get(unsigned int contextID,bool createIfNotInitalized); - - /** allows users to override the extensions across graphics contexts. - * typically used when you have different extensions supported across graphics pipes - * but need to ensure that they all use the same low common denominator extensions.*/ - static void Set(unsigned int contextID, GL2Extensions* extensions); - - - void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) const; - void glDrawBuffers(GLsizei n, const GLenum *bufs) const; - void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) const; - void glStencilFuncSeparate(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) const; - void glStencilMaskSeparate(GLenum face, GLuint mask) const; - void glAttachShader(GLuint program, GLuint shader) const; - void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name) const; - void glCompileShader(GLuint shader) const; - GLuint glCreateProgram(void) const; - GLuint glCreateShader(GLenum type) const; - void glDeleteProgram(GLuint program) const; - void glDeleteShader(GLuint shader) const; - void glDetachShader(GLuint program, GLuint shader) const; - void glDisableVertexAttribArray(GLuint index) const; - void glEnableVertexAttribArray(GLuint index) const; - void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const; - void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const; - void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj) const; - GLint glGetAttribLocation(GLuint program, const GLchar *name) const; - void glGetProgramiv(GLuint program, GLenum pname, GLint *params) const; - void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) const; - void glGetShaderiv(GLuint shader, GLenum pname, GLint *params) const; - void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) const; - void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source) const; - GLint glGetUniformLocation(GLuint program, const GLchar *name) const; - void glGetUniformfv(GLuint program, GLint location, GLfloat *params) const; - void glGetUniformiv(GLuint program, GLint location, GLint *params) const; - void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params) const; - void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params) const; - void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params) const; - void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer) const; - GLboolean glIsProgram(GLuint program) const; - GLboolean glIsShader(GLuint shader) const; - void glLinkProgram(GLuint program) const; - void glShaderSource(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length) const; - void glUseProgram(GLuint program) const; - void glUniform1f(GLint location, GLfloat v0) const; - void glUniform2f(GLint location, GLfloat v0, GLfloat v1) const; - void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) const; - void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) const; - void glUniform1i(GLint location, GLint v0) const; - void glUniform2i(GLint location, GLint v0, GLint v1) const; - void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2) const; - void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) const; - void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) const; - void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) const; - void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) const; - void glUniform4fv(GLint location, GLsizei count, const GLfloat *value) const; - void glUniform1iv(GLint location, GLsizei count, const GLint *value) const; - void glUniform2iv(GLint location, GLsizei count, const GLint *value) const; - void glUniform3iv(GLint location, GLsizei count, const GLint *value) const; - void glUniform4iv(GLint location, GLsizei count, const GLint *value) const; - void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) const; - void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) const; - void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) const; - void glValidateProgram(GLuint program) const; - void glVertexAttrib1d(GLuint index, GLdouble x) const; - void glVertexAttrib1dv(GLuint index, const GLdouble *v) const; - void glVertexAttrib1f(GLuint index, GLfloat x) const; - void glVertexAttrib1fv(GLuint index, const GLfloat *v) const; - void glVertexAttrib1s(GLuint index, GLshort x) const; - void glVertexAttrib1sv(GLuint index, const GLshort *v) const; - void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y) const; - void glVertexAttrib2dv(GLuint index, const GLdouble *v) const; - void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) const; - void glVertexAttrib2fv(GLuint index, const GLfloat *v) const; - void glVertexAttrib2s(GLuint index, GLshort x, GLshort y) const; - void glVertexAttrib2sv(GLuint index, const GLshort *v) const; - void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z) const; - void glVertexAttrib3dv(GLuint index, const GLdouble *v) const; - void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z) const; - void glVertexAttrib3fv(GLuint index, const GLfloat *v) const; - void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z) const; - void glVertexAttrib3sv(GLuint index, const GLshort *v) const; - void glVertexAttrib4Nbv(GLuint index, const GLbyte *v) const; - void glVertexAttrib4Niv(GLuint index, const GLint *v) const; - void glVertexAttrib4Nsv(GLuint index, const GLshort *v) const; - void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) const; - void glVertexAttrib4Nubv(GLuint index, const GLubyte *v) const; - void glVertexAttrib4Nuiv(GLuint index, const GLuint *v) const; - void glVertexAttrib4Nusv(GLuint index, const GLushort *v) const; - void glVertexAttrib4bv(GLuint index, const GLbyte *v) const; - void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) const; - void glVertexAttrib4dv(GLuint index, const GLdouble *v) const; - void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) const; - void glVertexAttrib4fv(GLuint index, const GLfloat *v) const; - void glVertexAttrib4iv(GLuint index, const GLint *v) const; - void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) const; - void glVertexAttrib4sv(GLuint index, const GLshort *v) const; - void glVertexAttrib4ubv(GLuint index, const GLubyte *v) const; - void glVertexAttrib4uiv(GLuint index, const GLuint *v) const; - void glVertexAttrib4usv(GLuint index, const GLushort *v) const; - void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) const; - - // C++-friendly convenience wrapper methods - GLuint getCurrentProgram() const; - bool getProgramInfoLog( GLuint program, std::string& result ) const; - bool getShaderInfoLog( GLuint shader, std::string& result ) const; - bool getAttribLocation( const char* attribName, GLuint& slot ) const; - bool getFragDataLocation( const char* fragDataName, GLuint& slot) const; - - // GL 2.1 - void glUniformMatrix2x3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) const; - void glUniformMatrix3x2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) const; - void glUniformMatrix2x4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) const; - void glUniformMatrix4x2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) const; - void glUniformMatrix3x4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) const; - void glUniformMatrix4x3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) const; - - // EXT_geometry_shader4 - void glProgramParameteri( GLuint program, GLenum pname, GLint value ) const; - void glFramebufferTexture( GLenum target, GLenum attachment, GLuint texture, GLint level ) const; - void glFramebufferTextureLayer( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ) const; - void glFramebufferTextureFace( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face ) const; - - // ARB_tessellation_shader - void glPatchParameteri(GLenum pname, GLint value) const; - void glPatchParameterfv(GLenum pname, const GLfloat *values) const; - - // EXT_gpu_shader4 - void glGetUniformuiv( GLuint program, GLint location, GLuint *params ) const; - void glBindFragDataLocation( GLuint program, GLuint color, const GLchar *name ) const; - GLint glGetFragDataLocation( GLuint program, const GLchar *name ) const; - void glUniform1ui( GLint location, GLuint v0 ) const; - void glUniform2ui( GLint location, GLuint v0, GLuint v1 ) const; - void glUniform3ui( GLint location, GLuint v0, GLuint v1, GLuint v2 ) const; - void glUniform4ui( GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) const; - void glUniform1uiv( GLint location, GLsizei count, const GLuint *value ) const; - void glUniform2uiv( GLint location, GLsizei count, const GLuint *value ) const; - void glUniform3uiv( GLint location, GLsizei count, const GLuint *value ) const; - void glUniform4uiv( GLint location, GLsizei count, const GLuint *value ) const; - - // ARB_uniform_buffer_object - void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices) const; - void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params) const; - void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName) const; - GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName) const; - void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params) const; - void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const; - void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) const; - - // ARB_get_program_binary - void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) const; - void glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length) const; - - protected: - ~GL2Extensions() {} - - float _glVersion; - float _glslLanguageVersion; - - bool _isShaderObjectsSupported; - bool _isVertexShaderSupported; - bool _isFragmentShaderSupported; - bool _isLanguage100Supported; - bool _isGeometryShader4Supported; - bool _areTessellationShadersSupported; - bool _isGpuShader4Supported; - bool _isUniformBufferObjectSupported; - bool _isGetProgramBinarySupported; - - typedef void (GL_APIENTRY * BlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha); - typedef void (GL_APIENTRY * DrawBuffersProc)(GLsizei n, const GLenum *bufs); - typedef void (GL_APIENTRY * StencilOpSeparateProc)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); - typedef void (GL_APIENTRY * StencilFuncSeparateProc)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); - typedef void (GL_APIENTRY * StencilMaskSeparateProc)(GLenum face, GLuint mask); - typedef void (GL_APIENTRY * AttachShaderProc)(GLuint program, GLuint shader); - typedef void (GL_APIENTRY * BindAttribLocationProc)(GLuint program, GLuint index, const GLchar *name); - typedef void (GL_APIENTRY * CompileShaderProc)(GLuint shader); - typedef GLuint (GL_APIENTRY * CreateProgramProc)(void); - typedef GLuint (GL_APIENTRY * CreateShaderProc)(GLenum type); - typedef void (GL_APIENTRY * DeleteProgramProc)(GLuint program); - typedef void (GL_APIENTRY * DeleteObjectARBProc)(GLuint program); - typedef void (GL_APIENTRY * DeleteShaderProc)(GLuint shader); - typedef void (GL_APIENTRY * DetachShaderProc)(GLuint program, GLuint shader); - typedef void (GL_APIENTRY * DisableVertexAttribArrayProc)(GLuint index); - typedef void (GL_APIENTRY * EnableVertexAttribArrayProc)(GLuint index); - typedef void (GL_APIENTRY * GetActiveAttribProc)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); - typedef void (GL_APIENTRY * GetActiveUniformProc)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); - typedef void (GL_APIENTRY * GetAttachedShadersProc)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); - typedef GLint (GL_APIENTRY * GetAttribLocationProc)(GLuint program, const GLchar *name); - typedef void (GL_APIENTRY * GetProgramivProc)(GLuint program, GLenum pname, GLint *params); - typedef void (GL_APIENTRY * GetObjectParameterivARBProc)(GLuint program, GLenum pname, GLint *params); - typedef void (GL_APIENTRY * GetProgramInfoLogProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); - typedef void (GL_APIENTRY * GetInfoLogARBProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); - typedef void (GL_APIENTRY * GetShaderivProc)(GLuint shader, GLenum pname, GLint *params); - typedef void (GL_APIENTRY * GetShaderInfoLogProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); - typedef void (GL_APIENTRY * GetShaderSourceProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); - typedef GLint (GL_APIENTRY * GetUniformLocationProc)(GLuint program, const GLchar *name); - typedef void (GL_APIENTRY * GetUniformfvProc)(GLuint program, GLint location, GLfloat *params); - typedef void (GL_APIENTRY * GetUniformivProc)(GLuint program, GLint location, GLint *params); - typedef void (GL_APIENTRY * GetVertexAttribdvProc)(GLuint index, GLenum pname, GLdouble *params); - typedef void (GL_APIENTRY * GetVertexAttribfvProc)(GLuint index, GLenum pname, GLfloat *params); - typedef void (GL_APIENTRY * GetVertexAttribivProc)(GLuint index, GLenum pname, GLint *params); - typedef void (GL_APIENTRY * GetVertexAttribPointervProc)(GLuint index, GLenum pname, GLvoid* *pointer); - typedef GLboolean (GL_APIENTRY * IsProgramProc)(GLuint program); - typedef GLboolean (GL_APIENTRY * IsShaderProc)(GLuint shader); - typedef void (GL_APIENTRY * LinkProgramProc)(GLuint program); - typedef void (GL_APIENTRY * ShaderSourceProc)(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); - typedef void (GL_APIENTRY * UseProgramProc)(GLuint program); - typedef void (GL_APIENTRY * Uniform1fProc)(GLint location, GLfloat v0); - typedef void (GL_APIENTRY * Uniform2fProc)(GLint location, GLfloat v0, GLfloat v1); - typedef void (GL_APIENTRY * Uniform3fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); - typedef void (GL_APIENTRY * Uniform4fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); - typedef void (GL_APIENTRY * Uniform1iProc)(GLint location, GLint v0); - typedef void (GL_APIENTRY * Uniform2iProc)(GLint location, GLint v0, GLint v1); - typedef void (GL_APIENTRY * Uniform3iProc)(GLint location, GLint v0, GLint v1, GLint v2); - typedef void (GL_APIENTRY * Uniform4iProc)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); - typedef void (GL_APIENTRY * Uniform1fvProc)(GLint location, GLsizei count, const GLfloat *value); - typedef void (GL_APIENTRY * Uniform2fvProc)(GLint location, GLsizei count, const GLfloat *value); - typedef void (GL_APIENTRY * Uniform3fvProc)(GLint location, GLsizei count, const GLfloat *value); - typedef void (GL_APIENTRY * Uniform4fvProc)(GLint location, GLsizei count, const GLfloat *value); - typedef void (GL_APIENTRY * Uniform1ivProc)(GLint location, GLsizei count, const GLint *value); - typedef void (GL_APIENTRY * Uniform2ivProc)(GLint location, GLsizei count, const GLint *value); - typedef void (GL_APIENTRY * Uniform3ivProc)(GLint location, GLsizei count, const GLint *value); - typedef void (GL_APIENTRY * Uniform4ivProc)(GLint location, GLsizei count, const GLint *value); - typedef void (GL_APIENTRY * UniformMatrix2fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - typedef void (GL_APIENTRY * UniformMatrix3fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - typedef void (GL_APIENTRY * UniformMatrix4fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - typedef void (GL_APIENTRY * ValidateProgramProc)(GLuint program); - typedef void (GL_APIENTRY * VertexAttrib1dProc)(GLuint index, GLdouble x); - typedef void (GL_APIENTRY * VertexAttrib1dvProc)(GLuint index, const GLdouble *v); - typedef void (GL_APIENTRY * VertexAttrib1fProc)(GLuint index, GLfloat x); - typedef void (GL_APIENTRY * VertexAttrib1fvProc)(GLuint index, const GLfloat *v); - typedef void (GL_APIENTRY * VertexAttrib1sProc)(GLuint index, GLshort x); - typedef void (GL_APIENTRY * VertexAttrib1svProc)(GLuint index, const GLshort *v); - typedef void (GL_APIENTRY * VertexAttrib2dProc)(GLuint index, GLdouble x, GLdouble y); - typedef void (GL_APIENTRY * VertexAttrib2dvProc)(GLuint index, const GLdouble *v); - typedef void (GL_APIENTRY * VertexAttrib2fProc)(GLuint index, GLfloat x, GLfloat y); - typedef void (GL_APIENTRY * VertexAttrib2fvProc)(GLuint index, const GLfloat *v); - typedef void (GL_APIENTRY * VertexAttrib2sProc)(GLuint index, GLshort x, GLshort y); - typedef void (GL_APIENTRY * VertexAttrib2svProc)(GLuint index, const GLshort *v); - typedef void (GL_APIENTRY * VertexAttrib3dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z); - typedef void (GL_APIENTRY * VertexAttrib3dvProc)(GLuint index, const GLdouble *v); - typedef void (GL_APIENTRY * VertexAttrib3fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z); - typedef void (GL_APIENTRY * VertexAttrib3fvProc)(GLuint index, const GLfloat *v); - typedef void (GL_APIENTRY * VertexAttrib3sProc)(GLuint index, GLshort x, GLshort y, GLshort z); - typedef void (GL_APIENTRY * VertexAttrib3svProc)(GLuint index, const GLshort *v); - typedef void (GL_APIENTRY * VertexAttrib4NbvProc)(GLuint index, const GLbyte *v); - typedef void (GL_APIENTRY * VertexAttrib4NivProc)(GLuint index, const GLint *v); - typedef void (GL_APIENTRY * VertexAttrib4NsvProc)(GLuint index, const GLshort *v); - typedef void (GL_APIENTRY * VertexAttrib4NubProc)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); - typedef void (GL_APIENTRY * VertexAttrib4NubvProc)(GLuint index, const GLubyte *v); - typedef void (GL_APIENTRY * VertexAttrib4NuivProc)(GLuint index, const GLuint *v); - typedef void (GL_APIENTRY * VertexAttrib4NusvProc)(GLuint index, const GLushort *v); - typedef void (GL_APIENTRY * VertexAttrib4bvProc)(GLuint index, const GLbyte *v); - typedef void (GL_APIENTRY * VertexAttrib4dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - typedef void (GL_APIENTRY * VertexAttrib4dvProc)(GLuint index, const GLdouble *v); - typedef void (GL_APIENTRY * VertexAttrib4fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - typedef void (GL_APIENTRY * VertexAttrib4fvProc)(GLuint index, const GLfloat *v); - typedef void (GL_APIENTRY * VertexAttrib4ivProc)(GLuint index, const GLint *v); - typedef void (GL_APIENTRY * VertexAttrib4sProc)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); - typedef void (GL_APIENTRY * VertexAttrib4svProc)(GLuint index, const GLshort *v); - typedef void (GL_APIENTRY * VertexAttrib4ubvProc)(GLuint index, const GLubyte *v); - typedef void (GL_APIENTRY * VertexAttrib4uivProc)(GLuint index, const GLuint *v); - typedef void (GL_APIENTRY * VertexAttrib4usvProc)(GLuint index, const GLushort *v); - typedef void (GL_APIENTRY * VertexAttribPointerProc)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); - typedef void (GL_APIENTRY * UniformMatrix2x3fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (GL_APIENTRY * UniformMatrix3x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (GL_APIENTRY * UniformMatrix2x4fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (GL_APIENTRY * UniformMatrix4x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (GL_APIENTRY * UniformMatrix3x4fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (GL_APIENTRY * UniformMatrix4x3fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (GL_APIENTRY * ProgramParameteriProc)( GLuint program, GLenum pname, GLint value ); - typedef void (GL_APIENTRY * FramebufferTextureProc)( GLenum target, GLenum attachment, GLuint texture, GLint level ); - typedef void (GL_APIENTRY * FramebufferTextureLayerProc)( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ); - typedef void (GL_APIENTRY * FramebufferTextureFaceProc)( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face ); - typedef void (GL_APIENTRY * PatchParameteriProc)( GLenum pname, GLint value ); - typedef void (GL_APIENTRY * PatchParameterfvProc)( GLenum pname, const GLfloat* values ); - typedef void (GL_APIENTRY * GetUniformuivProc)( GLuint program, GLint location, GLuint* params ); - typedef void (GL_APIENTRY * BindFragDataLocationProc)( GLuint program, GLuint color, const GLchar* name ); - typedef GLint (GL_APIENTRY * GetFragDataLocationProc)( GLuint program, const GLchar* name ); - typedef void (GL_APIENTRY * Uniform1uiProc)( GLint location, GLuint v0 ); - typedef void (GL_APIENTRY * Uniform2uiProc)( GLint location, GLuint v0, GLuint v1 ); - typedef void (GL_APIENTRY * Uniform3uiProc)( GLint location, GLuint v0, GLuint v1, GLuint v2 ); - typedef void (GL_APIENTRY * Uniform4uiProc)( GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ); - typedef void (GL_APIENTRY * Uniform1uivProc)( GLint location, GLsizei count, const GLuint *value ); - typedef void (GL_APIENTRY * Uniform2uivProc)( GLint location, GLsizei count, const GLuint *value ); - typedef void (GL_APIENTRY * Uniform3uivProc)( GLint location, GLsizei count, const GLuint *value ); - typedef void (GL_APIENTRY * Uniform4uivProc)( GLint location, GLsizei count, const GLuint *value ); - typedef GLuint (GL_APIENTRY * GetHandleProc) (GLenum pname); - typedef void (GL_APIENTRY * GetUniformIndicesProc)(GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); - typedef void (GL_APIENTRY * GetActiveUniformsivProc)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); - typedef void (GL_APIENTRY * GetActiveUniformNameProc)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); - typedef GLuint (GL_APIENTRY * GetUniformBlockIndexProc)(GLuint program, const GLchar *uniformBlockName); - typedef void (GL_APIENTRY * GetActiveUniformBlockivProc)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); - typedef void (GL_APIENTRY * GetActiveUniformBlockNameProc)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); - typedef void (GL_APIENTRY * UniformBlockBindingProc)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); - typedef void (GL_APIENTRY * GetProgramBinaryProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); - typedef void (GL_APIENTRY * ProgramBinaryProc)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); - - BlendEquationSeparateProc _glBlendEquationSeparate; - DrawBuffersProc _glDrawBuffers; - StencilOpSeparateProc _glStencilOpSeparate; - StencilFuncSeparateProc _glStencilFuncSeparate; - StencilMaskSeparateProc _glStencilMaskSeparate; - AttachShaderProc _glAttachShader; - BindAttribLocationProc _glBindAttribLocation; - CompileShaderProc _glCompileShader; - CreateProgramProc _glCreateProgram; - CreateShaderProc _glCreateShader; - DeleteProgramProc _glDeleteProgram; - DeleteShaderProc _glDeleteShader; - DetachShaderProc _glDetachShader; - DisableVertexAttribArrayProc _glDisableVertexAttribArray; - EnableVertexAttribArrayProc _glEnableVertexAttribArray; - GetActiveAttribProc _glGetActiveAttrib; - GetActiveUniformProc _glGetActiveUniform; - GetAttachedShadersProc _glGetAttachedShaders; - GetAttribLocationProc _glGetAttribLocation; - GetProgramivProc _glGetProgramiv; - GetProgramInfoLogProc _glGetProgramInfoLog; - GetShaderivProc _glGetShaderiv; - GetShaderInfoLogProc _glGetShaderInfoLog; - GetShaderSourceProc _glGetShaderSource; - GetUniformLocationProc _glGetUniformLocation; - GetUniformfvProc _glGetUniformfv; - GetUniformivProc _glGetUniformiv; - GetVertexAttribdvProc _glGetVertexAttribdv; - GetVertexAttribfvProc _glGetVertexAttribfv; - GetVertexAttribivProc _glGetVertexAttribiv; - GetVertexAttribPointervProc _glGetVertexAttribPointerv; - IsProgramProc _glIsProgram; - IsShaderProc _glIsShader; - LinkProgramProc _glLinkProgram; - ShaderSourceProc _glShaderSource; - UseProgramProc _glUseProgram; - Uniform1fProc _glUniform1f; - Uniform2fProc _glUniform2f; - Uniform3fProc _glUniform3f; - Uniform4fProc _glUniform4f; - Uniform1iProc _glUniform1i; - Uniform2iProc _glUniform2i; - Uniform3iProc _glUniform3i; - Uniform4iProc _glUniform4i; - Uniform1fvProc _glUniform1fv; - Uniform2fvProc _glUniform2fv; - Uniform3fvProc _glUniform3fv; - Uniform4fvProc _glUniform4fv; - Uniform1ivProc _glUniform1iv; - Uniform2ivProc _glUniform2iv; - Uniform3ivProc _glUniform3iv; - Uniform4ivProc _glUniform4iv; - UniformMatrix2fvProc _glUniformMatrix2fv; - UniformMatrix3fvProc _glUniformMatrix3fv; - UniformMatrix4fvProc _glUniformMatrix4fv; - ValidateProgramProc _glValidateProgram; - VertexAttrib1dProc _glVertexAttrib1d; - VertexAttrib1dvProc _glVertexAttrib1dv; - VertexAttrib1fProc _glVertexAttrib1f; - VertexAttrib1fvProc _glVertexAttrib1fv; - VertexAttrib1sProc _glVertexAttrib1s; - VertexAttrib1svProc _glVertexAttrib1sv; - VertexAttrib2dProc _glVertexAttrib2d; - VertexAttrib2dvProc _glVertexAttrib2dv; - VertexAttrib2fProc _glVertexAttrib2f; - VertexAttrib2fvProc _glVertexAttrib2fv; - VertexAttrib2sProc _glVertexAttrib2s; - VertexAttrib2svProc _glVertexAttrib2sv; - VertexAttrib3dProc _glVertexAttrib3d; - VertexAttrib3dvProc _glVertexAttrib3dv; - VertexAttrib3fProc _glVertexAttrib3f; - VertexAttrib3fvProc _glVertexAttrib3fv; - VertexAttrib3sProc _glVertexAttrib3s; - VertexAttrib3svProc _glVertexAttrib3sv; - VertexAttrib4NbvProc _glVertexAttrib4Nbv; - VertexAttrib4NivProc _glVertexAttrib4Niv; - VertexAttrib4NsvProc _glVertexAttrib4Nsv; - VertexAttrib4NubProc _glVertexAttrib4Nub; - VertexAttrib4NubvProc _glVertexAttrib4Nubv; - VertexAttrib4NuivProc _glVertexAttrib4Nuiv; - VertexAttrib4NusvProc _glVertexAttrib4Nusv; - VertexAttrib4bvProc _glVertexAttrib4bv; - VertexAttrib4dProc _glVertexAttrib4d; - VertexAttrib4dvProc _glVertexAttrib4dv; - VertexAttrib4fProc _glVertexAttrib4f; - VertexAttrib4fvProc _glVertexAttrib4fv; - VertexAttrib4ivProc _glVertexAttrib4iv; - VertexAttrib4sProc _glVertexAttrib4s; - VertexAttrib4svProc _glVertexAttrib4sv; - VertexAttrib4ubvProc _glVertexAttrib4ubv; - VertexAttrib4uivProc _glVertexAttrib4uiv; - VertexAttrib4usvProc _glVertexAttrib4usv; - VertexAttribPointerProc _glVertexAttribPointer; - - GetInfoLogARBProc _glGetInfoLogARB; - GetObjectParameterivARBProc _glGetObjectParameterivARB; - DeleteObjectARBProc _glDeleteObjectARB; - GetHandleProc _glGetHandleARB; - - // GL 2.1 - UniformMatrix2x3fvProc _glUniformMatrix2x3fv; - UniformMatrix3x2fvProc _glUniformMatrix3x2fv; - UniformMatrix2x4fvProc _glUniformMatrix2x4fv; - UniformMatrix4x2fvProc _glUniformMatrix4x2fv; - UniformMatrix3x4fvProc _glUniformMatrix3x4fv; - UniformMatrix4x3fvProc _glUniformMatrix4x3fv; - - // EXT_geometry_shader4 - ProgramParameteriProc _glProgramParameteri; - FramebufferTextureProc _glFramebufferTexture; - FramebufferTextureLayerProc _glFramebufferTextureLayer; - FramebufferTextureFaceProc _glFramebufferTextureFace; - - // ARB_tesselation_shader - PatchParameteriProc _glPatchParameteri; - PatchParameterfvProc _glPatchParameterfv; - - // EXT_gpu_shader4 - GetUniformuivProc _glGetUniformuiv; - BindFragDataLocationProc _glBindFragDataLocation; - GetFragDataLocationProc _glGetFragDataLocation; - Uniform1uiProc _glUniform1ui; - Uniform2uiProc _glUniform2ui; - Uniform3uiProc _glUniform3ui; - Uniform4uiProc _glUniform4ui; - Uniform1uivProc _glUniform1uiv; - Uniform2uivProc _glUniform2uiv; - Uniform3uivProc _glUniform3uiv; - Uniform4uivProc _glUniform4uiv; - - // ARB_uniform_buffer_object - GetUniformIndicesProc _glGetUniformIndices; - GetActiveUniformsivProc _glGetActiveUniformsiv; - GetActiveUniformNameProc _glGetActiveUniformName; - GetUniformBlockIndexProc _glGetUniformBlockIndex; - GetActiveUniformBlockivProc _glGetActiveUniformBlockiv; - GetActiveUniformBlockNameProc _glGetActiveUniformBlockName; - UniformBlockBindingProc _glUniformBlockBinding; - - //ARB_get_program_binary - GetProgramBinaryProc _glGetProgramBinary; - ProgramBinaryProc _glProgramBinary; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/GLBeginEndAdapter b/libs/lib/mac32/include/osg/GLBeginEndAdapter deleted file mode 100644 index 813193c9d41123428dc1f923cdd8cab1896df0bf..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GLBeginEndAdapter +++ /dev/null @@ -1,164 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GLBeginEndAdapter -#define OSG_GLBeginEndAdapter 1 - -#include -#include -#include - -#ifndef GL_TEXTURE0 -#define GL_TEXTURE0 0x84C0 -#endif - -namespace osg { - -// forward declare -class State; - -/** A class adapting OpenGL 1.0 glBegin()/glEnd() style code to vertex array based code */ -class OSG_EXPORT GLBeginEndAdapter -{ - public: - - GLBeginEndAdapter(State* state=0); - - void setState(State* state) { _state = state; } - State* getState() { return _state; } - const State* getState() const { return _state; } - - enum MatrixMode - { - APPLY_LOCAL_MATRICES_TO_VERTICES, - APPLY_LOCAL_MATRICES_TO_MODELVIEW - }; - - void setMatrixMode(MatrixMode mode) { _mode = mode; } - MatrixMode setMatrixMode() const { return _mode; } - - void PushMatrix(); - void PopMatrix(); - - void LoadIdentity(); - void LoadMatrixd(const GLdouble* m); - void MultMatrixd(const GLdouble* m); - - void Translatef(GLfloat x, GLfloat y, GLfloat z) { Translated(x,y,z); } - void Scalef(GLfloat x, GLfloat y, GLfloat z) { Scaled(x,y,z); } - void Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { Rotated(angle,x,y,z); } - - void Translated(GLdouble x, GLdouble y, GLdouble z); - void Scaled(GLdouble x, GLdouble y, GLdouble z); - void Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); - - void Vertex3f(GLfloat x, GLfloat y, GLfloat z); - void Vertex3fv(const GLfloat* v) { Vertex3f(v[0], v[1], v[2]); } - - void Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) - { - _colorAssigned = true; - _color.set(red,green,blue,alpha); - } - - void Color4fv(const GLfloat* c) { Color4f(c[0], c[1], c[2], c[3]); } - void Color4ubv(const GLubyte* c) { const float div = 1.0f/255.0f; Color4f(float(c[0])*div, float(c[1])*div, float(c[2])*div, float(c[3])*div); } - - void Normal3f(GLfloat x, GLfloat y, GLfloat z) - { - _normalAssigned = true; - _normal.set(x,y,z); - } - - void Normal3fv(const GLfloat* n) { Normal3f(n[0], n[1], n[2]); } - - void TexCoord1f(GLfloat x) { MultiTexCoord4f(GL_TEXTURE0, x, 0.0f, 0.0f, 1.0f); } - void TexCoord1fv(const GLfloat* tc) { MultiTexCoord4f(GL_TEXTURE0, tc[0], 0.0f, 0.0f, 1.0f); } - - void TexCoord2f(GLfloat x, GLfloat y) { MultiTexCoord4f(GL_TEXTURE0, x, y, 0.0f, 1.0f); } - void TexCoord2fv(const GLfloat* tc) { MultiTexCoord4f(GL_TEXTURE0, tc[0], tc[1], 0.0f, 1.0f); } - - void TexCoord3f(GLfloat x, GLfloat y, GLfloat z) { MultiTexCoord4f(GL_TEXTURE0, x, y, z, 1.0f); } - void TexCoord3fv(const GLfloat* tc) { MultiTexCoord4f(GL_TEXTURE0, tc[0], tc[1], tc[2], 1.0f); } - - void TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { MultiTexCoord4f(GL_TEXTURE0, x, y, z, w); } - void TexCoord4fv(const GLfloat* tc) { MultiTexCoord4f(GL_TEXTURE0, tc[0], tc[1], tc[2], tc[3]); } - - void MultiTexCoord1f(GLenum target, GLfloat x) { MultiTexCoord4f(target, x, 0.0f, 0.0f, 1.0f); } - void MultiTexCoord1fv(GLenum target, const GLfloat* tc) { MultiTexCoord4f(target, tc[0], 0.0f, 0.0f, 1.0f); } - - void MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y) { MultiTexCoord4f(target, x, y, 0.0f, 1.0f); } - void MultiTexCoord2fv(GLenum target, const GLfloat* tc) { MultiTexCoord4f(target, tc[0],tc[1], 0.0f, 1.0f); } - - void MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z) {MultiTexCoord4f(target, x, y, z, 1.0f); } - void MultiTexCoord3fv(GLenum target, const GLfloat* tc) { MultiTexCoord4f(target, tc[0], tc[1], tc[2], 1.0f); } - - void MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void MultiTexCoord4fv(GLenum target, const GLfloat* tc) { MultiTexCoord4f(target, tc[0], tc[1], tc[2], tc[3]); } - - void VertexAttrib1f(GLuint unit, GLfloat x) { VertexAttrib4f(unit, x, 0.0f, 0.0f, 0.0f); } - void VertexAttrib1fv(GLuint unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], 0.0f, 0.0f, 0.0f); } - - void VertexAttrib2f(GLuint unit, GLfloat x, GLfloat y) { VertexAttrib4f(unit, x, y, 0.0f, 0.0f); } - void VertexAttrib2fv(GLuint unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0],tc[1], 0.0f, 0.0f); } - - void VertexAttrib3f(GLuint unit, GLfloat x, GLfloat y, GLfloat z) {VertexAttrib4f(unit, x, y, z, 0.0f); } - void VertexAttrib3fv(GLuint unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], tc[1], tc[2], 0.0f); } - - void VertexAttrib4f(GLuint unit, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void VertexAttrib4fv(GLuint unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], tc[1], tc[2], tc[3]); } - - void Begin(GLenum mode); - void End(); - - protected: - - State* _state; - - MatrixMode _mode; - - typedef std::list MatrixStack; - MatrixStack _matrixStack; - - bool _normalAssigned; - osg::Vec3f _normal; - - bool _colorAssigned; - osg::Vec4f _color; - - osg::Vec3f _overallNormal; - osg::Vec4f _overallColor; - - typedef std::vector AssignedList; - typedef std::vector VertexList; - - AssignedList _texCoordAssignedList; - VertexList _texCoordList; - - AssignedList _vertexAttribAssignedList; - VertexList _vertexAttribList; - - - typedef std::vector< osg::ref_ptr > VertexArrayList; - - GLenum _primitiveMode; - osg::ref_ptr _vertices; - osg::ref_ptr _normals; - osg::ref_ptr _colors; - VertexArrayList _texCoordsList; - VertexArrayList _vertexAttribsList; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/GLExtensions b/libs/lib/mac32/include/osg/GLExtensions deleted file mode 100644 index 6981004a2768823596a31951b4494a85f095e2f2..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GLExtensions +++ /dev/null @@ -1,155 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GLEXTENSIONS -#define OSG_GLEXTENSIONS 1 - -#include -#include -#include -#include - - -namespace osg { - -/** Return floating-point OpenGL version number. - * Note: Must only be called within a valid OpenGL context, - * undefined behavior may occur otherwise. -*/ -extern OSG_EXPORT float getGLVersionNumber(); - -/** Return true if "extension" is contained in "extensionString". -*/ -extern OSG_EXPORT bool isExtensionInExtensionString(const char *extension, const char *extensionString); - -/** Return true if OpenGL "extension" is supported. - * Note: Must only be called within a valid OpenGL context, - * undefined behavior may occur otherwise. -*/ -extern OSG_EXPORT bool isGLExtensionSupported(unsigned int contextID, const char *extension); - -/** Return true if OpenGL "extension" or minimum OpenGL version number is supported. - * Note: Must only be called within a valid OpenGL context, - * undefined behavior may occur otherwise. -*/ -extern OSG_EXPORT bool isGLExtensionOrVersionSupported(unsigned int contextID, const char *extension, float requiredGlVersion); - -/** Return the address of the specified OpenGL function. - * Return NULL if function not supported by OpenGL library. - * Note, glGLExtensionFuncPtr is declared inline so that the code - * is compiled locally to the calling code. This should get by Windows' - * dumb implementation of having different GL function ptr's for each - * library when linked to it. -*/ -extern OSG_EXPORT void* getGLExtensionFuncPtr(const char *funcName); - -/** Set a list of extensions to disable for different OpenGL renderers. This allows - * OSG applications to work around OpenGL drivers' bugs which are due to problematic extension support. - * The format of the string is: - * "GLRendererString : ExtensionName, ExtensionName; GLRenderString2 : ExtensionName;" - * An example of is : "SUN_XVR1000:GL_EXT_texture_filter_anisotropic" - * The default setting of GLExtensionDisableString is obtained from the OSG_GL_EXTENSION_DISABLE - * environmental variable. -*/ -extern OSG_EXPORT void setGLExtensionDisableString(const std::string& disableString); - -/** Get the list of extensions that are disabled for various OpenGL renderers. */ -extern OSG_EXPORT std::string& getGLExtensionDisableString(); - -/** Return the address of the specified OpenGL function. If not found then - * check a second function name, if this fails then return NULL as function is - * not supported by OpenGL library. This is used for checking something - * like glActiveTexture (which is in OGL1.3) or glActiveTextureARB. -*/ -inline void* getGLExtensionFuncPtr(const char *funcName,const char *fallbackFuncName) -{ - void* ptr = getGLExtensionFuncPtr(funcName); - if (ptr) return ptr; - return getGLExtensionFuncPtr(fallbackFuncName); -} - -/** Return the address of the specified OpenGL function. If not found then - * check a second function name, if this fails then return NULL as function is - * not supported by OpenGL library. This is used for checking something - * like glActiveTexture (which is in OGL1.3) or glActiveTextureARB. -*/ -inline void* getGLExtensionFuncPtr(const char *funcName1, const char *funcName2, const char *funcName3) -{ - void* ptr = getGLExtensionFuncPtr(funcName1); - if (ptr) return ptr; - - ptr = getGLExtensionFuncPtr(funcName2); - if (ptr) return ptr; - - return getGLExtensionFuncPtr(funcName3); -} - -template -T convertPointerType(R src) -{ - T dest; - memcpy(&dest, &src, sizeof(src)); - return dest; -} - -template -bool setGLExtensionFuncPtr(T& t, const char* str1) -{ - void* data = osg::getGLExtensionFuncPtr(str1); - if (data) - { - memcpy(&t, &data, sizeof(T)); - return true; - } - else - { - t = 0; - return false; - } -} - -template -bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2) -{ - void* data = osg::getGLExtensionFuncPtr(str1,str2); - if (data) - { - memcpy(&t, &data, sizeof(T)); - return true; - } - else - { - t = 0; - return false; - } -} - -template -bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2, const char* str3) -{ - void* data = osg::getGLExtensionFuncPtr(str1,str2,str3); - if (data) - { - memcpy(&t, &data, sizeof(T)); - return true; - } - else - { - t = 0; - return false; - } -} - -} - -#endif diff --git a/libs/lib/mac32/include/osg/GLObjects b/libs/lib/mac32/include/osg/GLObjects deleted file mode 100644 index 2c3a522773f368749097eeddd3b9a3547a1ba898..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GLObjects +++ /dev/null @@ -1,42 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GLOBJECTS -#define OSG_GLOBJECTS 1 - -#include - -namespace osg { - -/** Flush all deleted OpenGL objects within the specified availableTime. - * Note, must be called from a thread which has current the graphics context associated with contextID. */ -extern OSG_EXPORT void flushDeletedGLObjects(unsigned int contextID, double currentTime, double& availableTime); - -/** Flush all deleted OpenGL objects. - * Note, must be called from a thread which has current the graphics context associated with contextID. */ -extern OSG_EXPORT void flushAllDeletedGLObjects(unsigned int contextID); - -/** Do a GL delete all OpenGL objects. - * Note, must be called from a thread which has current the graphics context associated with contextID. */ -extern OSG_EXPORT void deleteAllGLObjects(unsigned int contextID); - -/** Discard all OpenGL objects. - * Note, unlike deleteAllObjectObjects discard does not - * do any OpenGL calls so can be called from any thread, but as a consequence it - * also doesn't remove the associated OpenGL resource so discard should only be - * called when the associated graphics context is being/has been closed. */ -extern OSG_EXPORT void discardAllGLObjects(unsigned int contextID); - -} - -#endif diff --git a/libs/lib/mac32/include/osg/GLU b/libs/lib/mac32/include/osg/GLU deleted file mode 100644 index d86bf4d25249f2980e3123bddf64d97f94e92a4a..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GLU +++ /dev/null @@ -1,186 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GLU -#define OSG_GLU 1 - -#include - -namespace osg -{ - -/* Pixel storage modes, used by gluScaleImage */ -struct OSG_EXPORT PixelStorageModes -{ - // sets defaults as per glGet docs in OpenGL red book - PixelStorageModes(); - - // use glGet's to retrieve all the current settings - void retrieveStoreModes(); - - // use glGet's to retrieve all the current 3D settings - void retrieveStoreModes3D(); - - GLint pack_alignment; - GLint pack_row_length; - GLint pack_skip_rows; - GLint pack_skip_pixels; - GLint pack_lsb_first; - GLint pack_swap_bytes; - GLint pack_skip_images; - GLint pack_image_height; - - GLint unpack_alignment; - GLint unpack_row_length; - GLint unpack_skip_rows; - GLint unpack_skip_pixels; - GLint unpack_lsb_first; - GLint unpack_swap_bytes; - GLint unpack_skip_images; - GLint unpack_image_height; -} ; - -extern OSG_EXPORT const GLubyte * gluErrorString (GLenum error); - -/** OSG specific gluScaleImage function that allows you to pass in the PixelStoreModes, which - * enables the code to avoid glGet's that are associated with the conventional gluScaleImage function. - * Avoiding glGet's allows this gluScaleImage function to be called at any time, from any thread, there - * is no need to have a graphics context current.*/ -extern OSG_EXPORT GLint gluScaleImage (PixelStorageModes* psm, GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut); - -/** Traditional GLU gluScaleImage function that sets up the PixelStoreModes automatically by doing glGets.; - * The use of glGet's means that you can only call this function from a thread with a valid graphics context. - * The use of glGet's will also result in lower performance due to the round trip to the OpenGL driver.*/ -extern OSG_EXPORT GLint gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut); - -extern OSG_EXPORT GLint gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); -extern OSG_EXPORT GLint gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data); -extern OSG_EXPORT GLint gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); -extern OSG_EXPORT GLint gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); - -typedef void (GL_APIENTRY * GLTexImage3DProc) ( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - -/** Small variation on normal gluBuild3DMipmapLevels as we pass in the function pointer to glTexImage3D rather than rely on GLU style querry for this functon pointer.*/ -extern OSG_EXPORT GLint gluBuild3DMipmapLevels (GLTexImage3DProc glTextImage3DProc, GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); - -/** Small variation on normal gluBuild3DMipmapLevels as we pass in the function pointer to glTexImage3D rather than rely on GLU style querry for this functon pointer.*/ -extern OSG_EXPORT GLint gluBuild3DMipmaps (GLTexImage3DProc glTextImage3DProc, GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); - -/* ErrorCode */ -#define GLU_INVALID_ENUM 100900 -#define GLU_INVALID_VALUE 100901 -#define GLU_OUT_OF_MEMORY 100902 -#define GLU_INCOMPATIBLE_GL_VERSION 100903 -#define GLU_INVALID_OPERATION 100904 - -/* Boolean */ -#define GLU_FALSE 0 -#define GLU_TRUE 1 - -/* QuadricDrawStyle */ -#define GLU_POINT 100010 -#define GLU_LINE 100011 -#define GLU_FILL 100012 -#define GLU_SILHOUETTE 100013 - -/* QuadricCallback */ -/* GLU_ERROR */ - -/* QuadricNormal */ -#define GLU_SMOOTH 100000 -#define GLU_FLAT 100001 -#define GLU_NONE 100002 - -/* QuadricOrientation */ -#define GLU_OUTSIDE 100020 -#define GLU_INSIDE 100021 - -/* TessCallback */ -#define GLU_TESS_BEGIN 100100 -#define GLU_BEGIN 100100 -#define GLU_TESS_VERTEX 100101 -#define GLU_VERTEX 100101 -#define GLU_TESS_END 100102 -#define GLU_END 100102 -#define GLU_TESS_ERROR 100103 -#define GLU_TESS_EDGE_FLAG 100104 -#define GLU_EDGE_FLAG 100104 -#define GLU_TESS_COMBINE 100105 -#define GLU_TESS_BEGIN_DATA 100106 -#define GLU_TESS_VERTEX_DATA 100107 -#define GLU_TESS_END_DATA 100108 -#define GLU_TESS_ERROR_DATA 100109 -#define GLU_TESS_EDGE_FLAG_DATA 100110 -#define GLU_TESS_COMBINE_DATA 100111 - -/* TessContour */ -#define GLU_CW 100120 -#define GLU_CCW 100121 -#define GLU_INTERIOR 100122 -#define GLU_EXTERIOR 100123 -#define GLU_UNKNOWN 100124 - -/* TessProperty */ -#define GLU_TESS_WINDING_RULE 100140 -#define GLU_TESS_BOUNDARY_ONLY 100141 -#define GLU_TESS_TOLERANCE 100142 - -/* TessError */ -#define GLU_TESS_ERROR1 100151 -#define GLU_TESS_ERROR2 100152 -#define GLU_TESS_ERROR3 100153 -#define GLU_TESS_ERROR4 100154 -#define GLU_TESS_ERROR5 100155 -#define GLU_TESS_ERROR6 100156 -#define GLU_TESS_ERROR7 100157 -#define GLU_TESS_ERROR8 100158 -#define GLU_TESS_MISSING_BEGIN_POLYGON 100151 -#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152 -#define GLU_TESS_MISSING_END_POLYGON 100153 -#define GLU_TESS_MISSING_END_CONTOUR 100154 -#define GLU_TESS_COORD_TOO_LARGE 100155 -#define GLU_TESS_NEED_COMBINE_CALLBACK 100156 - -/* TessWinding */ -#define GLU_TESS_WINDING_ODD 100130 -#define GLU_TESS_WINDING_NONZERO 100131 -#define GLU_TESS_WINDING_POSITIVE 100132 -#define GLU_TESS_WINDING_NEGATIVE 100133 -#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134 - -struct GLUtesselator; -typedef GLUtesselator GLUtesselatorObj; -typedef GLUtesselator GLUtriangulatorObj; - -#define GLU_TESS_MAX_COORD 1.0e150 - -/* Internal convenience typedefs */ -typedef void (GL_APIENTRY * _GLUfuncptr)(); -typedef void (GL_APIENTRY * GLU_TESS_CALLBACK)(); - -extern OSG_EXPORT GLUtesselator* GL_APIENTRY gluNewTess (void); -extern OSG_EXPORT void GL_APIENTRY gluDeleteTess (GLUtesselator* tess); - -extern OSG_EXPORT void GL_APIENTRY gluTessBeginContour (GLUtesselator* tess); -extern OSG_EXPORT void GL_APIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); -extern OSG_EXPORT void GL_APIENTRY gluTessEndContour (GLUtesselator* tess); -extern OSG_EXPORT void GL_APIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ); -extern OSG_EXPORT void GL_APIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data); -extern OSG_EXPORT void GL_APIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data); -extern OSG_EXPORT void GL_APIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); -extern OSG_EXPORT void GL_APIENTRY gluTessEndPolygon (GLUtesselator* tess); -extern OSG_EXPORT void GL_APIENTRY gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value ); - -} - -#endif // __osgGLU_h diff --git a/libs/lib/mac32/include/osg/Geode b/libs/lib/mac32/include/osg/Geode deleted file mode 100644 index c0968689278dbe114004bc1837b3ea1e175bb51e..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Geode +++ /dev/null @@ -1,167 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GEODE -#define OSG_GEODE 1 - -#include -#include -#include - -namespace osg { - -/** A \c Geode is a "geometry node", that is, a leaf node on the scene graph - * that can have "renderable things" attached to it. In OSG, renderable things - * are represented by objects from the \c Drawable class, so a \c Geode is a - * \c Node whose purpose is grouping Drawables. -*/ -class OSG_EXPORT Geode : public Node -{ - public: - - typedef std::vector< ref_ptr > DrawableList; - - Geode(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Geode(const Geode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, Geode); - - virtual Geode* asGeode() { return this; } - virtual const Geode* asGeode() const { return this; } - - /** Add a \c Drawable to the \c Geode. - * If \c drawable is not \c NULL and is not contained in the \c Geode - * then increment its reference count, add it to the drawables list and - * dirty the bounding sphere to force it to be recomputed on the next - * call to \c getBound(). - * @param drawable The \c Drawable to be added to the \c Geode. - * @return \c true for success; \c false otherwise. - */ - virtual bool addDrawable( Drawable *drawable ); - - /** Remove a \c Drawable from the \c Geode. - * Equivalent to removeDrawable(getDrawableIndex(drawable). - * @param drawable The drawable to be removed. - * @return \c true if at least one \c Drawable was removed. \c false - * otherwise. - */ - virtual bool removeDrawable( Drawable *drawable ); - - /** Remove Drawable(s) from the specified position in - * Geode's drawable list. - * @param i The index of the first \c Drawable to remove. - * @param numDrawablesToRemove The number of Drawable to - * remove. - * @return \c true if at least one \c Drawable was removed. \c false - * otherwise. - */ - virtual bool removeDrawables(unsigned int i,unsigned int numDrawablesToRemove=1); - - /** Replace specified Drawable with another Drawable. - * Equivalent to setDrawable(getDrawableIndex(origDraw),newDraw), - * see docs for \c setDrawable() for further details on implementation. - */ - virtual bool replaceDrawable( Drawable *origDraw, Drawable *newDraw ); - - /** Set \c Drawable at position \c i. - * Decrement the reference count origGSet and increments the - * reference count of newGset, and dirty the bounding sphere - * to force it to recompute on next getBound() and returns true. - * If origDrawable is not found then return false and do not - * add newGset. If newGset is NULL then return false and do - * not remove origGset. - * @return \c true if set correctly, \c false on failure - * (if node==NULL || i is out of range). - */ - virtual bool setDrawable( unsigned int i, Drawable* drawable ); - - /** Return the number of Drawables currently attached to the - * \c Geode. - */ - inline unsigned int getNumDrawables() const { return _drawables.size(); } - - /** Return the \c Drawable at position \c i.*/ - inline Drawable* getDrawable( unsigned int i ) { return _drawables[i].get(); } - - /** Return the \c Drawable at position \c i.*/ - inline const Drawable* getDrawable( unsigned int i ) const { return _drawables[i].get(); } - - /** Return \c true if a given \c Drawable is contained within \c Geode.*/ - inline bool containsDrawable(const Drawable* gset) const - { - for (DrawableList::const_iterator itr=_drawables.begin(); - itr!=_drawables.end(); - ++itr) - { - if (itr->get()==gset) return true; - } - return false; - } - - /** Get the index number of \c drawable. - * @return A value between 0 and getNumDrawables()-1 if - * \c drawable is found; if not found, then - * getNumDrawables() is returned. - */ - inline unsigned int getDrawableIndex( const Drawable* drawable ) const - { - for (unsigned int drawableNum=0;drawableNum<_drawables.size();++drawableNum) - { - if (_drawables[drawableNum]==drawable) return drawableNum; - } - return _drawables.size(); // drawable not found. - } - - /** Get the list of drawables.*/ - const DrawableList& getDrawableList() const { return _drawables; } - - /** Compile OpenGL Display List for each drawable.*/ - void compileDrawables(RenderInfo& renderInfo); - - /** Return the Geode's bounding box, which is the union of all the - * bounding boxes of the geode's drawables.*/ - inline const BoundingBox& getBoundingBox() const - { - if(!_boundingSphereComputed) getBound(); - return _bbox; - } - - virtual BoundingSphere computeBound() const; - - /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ - virtual void setThreadSafeRefUnref(bool threadSafe); - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases any associated OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objects - * for all graphics contexts. */ - virtual void releaseGLObjects(osg::State* = 0) const; - - - protected: - - virtual ~Geode(); - - - mutable osg::BoundingBox _bbox; - DrawableList _drawables; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Geometry b/libs/lib/mac32/include/osg/Geometry deleted file mode 100644 index ab24b0cc748285126706c3911caa03bd5f5966ea..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Geometry +++ /dev/null @@ -1,463 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GEOMETRY -#define OSG_GEOMETRY 1 - -#include -#include -#include -#include -#include -#include - -namespace osg { - - -class OSG_EXPORT Geometry : public Drawable -{ - public: - - Geometry(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual Object* cloneType() const { return new Geometry(); } - virtual Object* clone(const CopyOp& copyop) const { return new Geometry(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "Geometry"; } - - virtual Geometry* asGeometry() { return this; } - virtual const Geometry* asGeometry() const { return this; } - - bool empty() const; - - enum AttributeBinding - { - BIND_OFF=0, - BIND_OVERALL, - BIND_PER_PRIMITIVE_SET, - BIND_PER_PRIMITIVE, - BIND_PER_VERTEX - }; - - struct OSG_EXPORT ArrayData - { - ArrayData(): - binding(BIND_OFF), - normalize(GL_FALSE) {} - - ArrayData(const ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - ArrayData(Array* a, AttributeBinding b, GLboolean n = GL_FALSE): - array(a), - indices(0), - binding(b), - normalize(n) {} - - ArrayData(Array* a, IndexArray* i, AttributeBinding b, GLboolean n = GL_FALSE): - array(a), - indices(i), - binding(b), - normalize(n) {} - - ArrayData& operator = (const ArrayData& rhs) - { - array = rhs.array; - indices = rhs.indices; - binding = rhs.binding; - normalize = rhs.normalize; - return *this; - } - - inline bool empty() const { return !array.valid(); } - - ref_ptr array; - ref_ptr indices; - AttributeBinding binding; - GLboolean normalize; - }; - - struct OSG_EXPORT Vec3ArrayData - { - Vec3ArrayData(): - binding(BIND_OFF), - normalize(GL_FALSE) {} - - Vec3ArrayData(const Vec3ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - Vec3ArrayData(Vec3Array* a, AttributeBinding b, GLboolean n = GL_FALSE): - array(a), - indices(0), - binding(b), - normalize(n) {} - - Vec3ArrayData(Vec3Array* a, IndexArray* i, AttributeBinding b, GLboolean n = GL_FALSE): - array(a), - indices(i), - binding(b), - normalize(n) {} - - Vec3ArrayData& operator = (const Vec3ArrayData& rhs) - { - array = rhs.array; - indices = rhs.indices; - binding = rhs.binding; - normalize = rhs.normalize; - return *this; - } - - inline bool empty() const { return !array.valid(); } - - ref_ptr array; - ref_ptr indices; - AttributeBinding binding; - GLboolean normalize; - }; - - /** Static ArrayData which is returned from getTexCoordData(i) const and getVertexAttribData(i) const - * when i is out of range. - */ - static const ArrayData s_InvalidArrayData; - - typedef std::vector< ArrayData > ArrayDataList; - - - void setVertexArray(Array* array); - Array* getVertexArray() { return _vertexData.array.get(); } - const Array* getVertexArray() const { return _vertexData.array.get(); } - - void setVertexData(const ArrayData& arrayData); - ArrayData& getVertexData() { return _vertexData; } - const ArrayData& getVertexData() const { return _vertexData; } - - - void setNormalBinding(AttributeBinding ab); - AttributeBinding getNormalBinding() const { return _normalData.binding; } - - void setNormalArray(Array* array); - Array* getNormalArray() { return _normalData.array.get(); } - const Array* getNormalArray() const { return _normalData.array.get(); } - - void setNormalData(const ArrayData& arrayData); - ArrayData& getNormalData() { return _normalData; } - const ArrayData& getNormalData() const { return _normalData; } - - void setColorBinding(AttributeBinding ab); - AttributeBinding getColorBinding() const { return _colorData.binding; } - - void setColorArray(Array* array); - Array* getColorArray() { return _colorData.array.get(); } - const Array* getColorArray() const { return _colorData.array.get(); } - - void setColorData(const ArrayData& arrayData); - ArrayData& getColorData() { return _colorData; } - const ArrayData& getColorData() const { return _colorData; } - - - void setSecondaryColorBinding(AttributeBinding ab); - AttributeBinding getSecondaryColorBinding() const { return _secondaryColorData.binding; } - - void setSecondaryColorArray(Array* array); - Array* getSecondaryColorArray() { return _secondaryColorData.array.get(); } - const Array* getSecondaryColorArray() const { return _secondaryColorData.array.get(); } - - void setSecondaryColorData(const ArrayData& arrayData); - ArrayData& getSecondaryColorData() { return _secondaryColorData; } - const ArrayData& getSecondaryColorData() const { return _secondaryColorData; } - - - void setFogCoordBinding(AttributeBinding ab); - AttributeBinding getFogCoordBinding() const { return _fogCoordData.binding; } - - void setFogCoordArray(Array* array); - Array* getFogCoordArray() { return _fogCoordData.array.get(); } - const Array* getFogCoordArray() const { return _fogCoordData.array.get(); } - - void setFogCoordData(const ArrayData& arrayData); - ArrayData& getFogCoordData() { return _fogCoordData; } - const ArrayData& getFogCoordData() const { return _fogCoordData; } - - - void setTexCoordArray(unsigned int unit,Array*); - Array* getTexCoordArray(unsigned int unit); - const Array* getTexCoordArray(unsigned int unit) const; - - void setTexCoordData(unsigned int index,const ArrayData& arrayData); - ArrayData& getTexCoordData(unsigned int index); - const ArrayData& getTexCoordData(unsigned int index) const; - - unsigned int getNumTexCoordArrays() const { return static_cast(_texCoordList.size()); } - ArrayDataList& getTexCoordArrayList() { return _texCoordList; } - const ArrayDataList& getTexCoordArrayList() const { return _texCoordList; } - - - - void setVertexAttribArray(unsigned int index,Array* array); - Array *getVertexAttribArray(unsigned int index); - const Array *getVertexAttribArray(unsigned int index) const; - - void setVertexAttribBinding(unsigned int index,AttributeBinding ab); - AttributeBinding getVertexAttribBinding(unsigned int index) const; - - void setVertexAttribNormalize(unsigned int index,GLboolean norm); - GLboolean getVertexAttribNormalize(unsigned int index) const; - - void setVertexAttribData(unsigned int index,const ArrayData& arrayData); - ArrayData& getVertexAttribData(unsigned int index); - const ArrayData& getVertexAttribData(unsigned int index) const; - - unsigned int getNumVertexAttribArrays() const { return static_cast(_vertexAttribList.size()); } - ArrayDataList& getVertexAttribArrayList() { return _vertexAttribList; } - const ArrayDataList& getVertexAttribArrayList() const { return _vertexAttribList; } - - - - typedef std::vector< ref_ptr > PrimitiveSetList; - - void setPrimitiveSetList(const PrimitiveSetList& primitives); - - PrimitiveSetList& getPrimitiveSetList() { return _primitives; } - const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; } - - unsigned int getNumPrimitiveSets() const { return static_cast(_primitives.size()); } - PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); } - const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); } - - /** Add a primitive set to the geometry. */ - bool addPrimitiveSet(PrimitiveSet* primitiveset); - - /** Set a primitive set to the specified position in geometry's primitive set list. */ - bool setPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset); - - /** Insert a primitive set to the specified position in geometry's primitive set list. */ - bool insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset); - - /** Remove primitive set(s) from the specified position in geometry's primitive set list. */ - bool removePrimitiveSet(unsigned int i,unsigned int numElementsToRemove=1); - - /** Get the index number of a primitive set, return a value between - * 0 and getNumPrimitiveSet()-1 if found, if not found then return getNumPrimitiveSet(). - * When checking for a valid find value use if ((value=geometry->getPrimitiveSetIndex(primitive))!=geometry.getNumPrimitiveSet()) - */ - unsigned int getPrimitiveSetIndex(const PrimitiveSet* primitiveset) const; - - - - /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ - void setVertexIndices(IndexArray* array); - IndexArray* getVertexIndices() { return _vertexData.indices.get(); } - const IndexArray* getVertexIndices() const { return _vertexData.indices.get(); } - - /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ - void setNormalIndices(IndexArray* array); - IndexArray* getNormalIndices() { return _normalData.indices.get(); } - const IndexArray* getNormalIndices() const { return _normalData.indices.get(); } - - /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ - void setColorIndices(IndexArray* array); - IndexArray* getColorIndices() { return _colorData.indices.get(); } - const IndexArray* getColorIndices() const { return _colorData.indices.get(); } - - /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ - void setSecondaryColorIndices(IndexArray* array); - IndexArray* getSecondaryColorIndices() { return _secondaryColorData.indices.get(); } - const IndexArray* getSecondaryColorIndices() const { return _secondaryColorData.indices.get(); } - - /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ - void setFogCoordIndices(IndexArray* array); - IndexArray* getFogCoordIndices() { return _fogCoordData.indices.get(); } - const IndexArray* getFogCoordIndices() const { return _fogCoordData.indices.get(); } - - /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ - void setTexCoordIndices(unsigned int unit,IndexArray*); - IndexArray* getTexCoordIndices(unsigned int unit); - const IndexArray* getTexCoordIndices(unsigned int unit) const; - - /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ - void setVertexAttribIndices(unsigned int index,IndexArray* array); - IndexArray* getVertexAttribIndices(unsigned int index); - const IndexArray* getVertexAttribIndices(unsigned int index) const; - - - - - /** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation - method to use OpenGL vertex buffer objects for rendering.*/ - virtual void setUseVertexBufferObjects(bool flag); - - /** Force a recompile on next draw() of any OpenGL display list associated with this geoset.*/ - virtual void dirtyDisplayList(); - - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objects - * for all graphics contexts. */ - virtual void releaseGLObjects(State* state=0) const; - - typedef std::vector ArrayList; - bool getArrayList(ArrayList& arrayList) const; - - typedef std::vector DrawElementsList; - bool getDrawElementsList(DrawElementsList& drawElementsList) const; - - osg::VertexBufferObject* getOrCreateVertexBufferObject(); - - osg::ElementBufferObject* getOrCreateElementBufferObject(); - - - /** Set whether fast paths should be used when supported. */ - void setFastPathHint(bool on) { _fastPathHint = on; } - - /** Get whether fast paths should be used when supported. */ - bool getFastPathHint() const { return _fastPathHint; } - - - /** Return true if OpenGL fast paths will be used with drawing this Geometry. - * Fast paths directly use vertex arrays, and glDrawArrays/glDrawElements so have low CPU overhead. - * With Slow paths the osg::Geometry::drawImplementation has to dynamically assemble OpenGL - * compatible vertex arrays from the osg::Geometry arrays data and then dispatch these to OpenGL, - * so have higher CPU overhead than the Fast paths. - * Use of per primitive bindings or per vertex indexed arrays will drop the rendering path off the fast path. - */ - inline bool areFastPathsUsed() const - { - if (_internalOptimizedGeometry.valid()) - return _internalOptimizedGeometry->areFastPathsUsed(); - else - return _fastPath && _fastPathHint; - } - - bool computeFastPathsUsed(); - - bool verifyBindings() const; - - void computeCorrectBindingsAndArraySizes(); - - /** check whether the arrays, indices, bindings and primitives all match correctly, return false is .*/ - bool verifyArrays(std::ostream& out) const; - - bool suitableForOptimization() const; - - void copyToAndOptimize(Geometry& target); - - - bool containsSharedArrays() const; - - void duplicateSharedArrays(); - - - void computeInternalOptimizedGeometry(); - - void removeInternalOptimizedGeometry() { _internalOptimizedGeometry = 0; } - - void setInternalOptimizedGeometry(osg::Geometry* geometry) { _internalOptimizedGeometry = geometry; } - - osg::Geometry* getInternalOptimizedGeometry() { return _internalOptimizedGeometry.get(); } - - const osg::Geometry* getInternalOptimizedGeometry() const { return _internalOptimizedGeometry.get(); } - - - /** Return the estimated size of GLObjects (display lists/vertex buffer objects) that are associated with this drawable. - * This size is used a hint for reuse of deleted display lists/vertex buffer objects. */ - virtual unsigned int getGLObjectSizeHint() const; - - /** Immediately compile this \c Drawable into an OpenGL Display List/VertexBufferObjects. - * @note Operation is ignored if \c _useDisplayList is \c false or VertexBufferObjects are not used. - */ - virtual void compileGLObjects(RenderInfo& renderInfo) const; - - /** Draw Geometry directly ignoring an OpenGL display list which could be attached. - * This is the internal draw method which does the drawing itself, - * and is the method to override when deriving from Geometry for user-drawn objects. - */ - virtual void drawImplementation(RenderInfo& renderInfo) const; - - /** Return true, osg::Geometry does support accept(Drawable::AttributeFunctor&). */ - virtual bool supports(const Drawable::AttributeFunctor&) const { return true; } - - /** Accept an Drawable::AttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has. */ - virtual void accept(Drawable::AttributeFunctor& af); - - /** Return true, osg::Geometry does support accept(Drawable::ConstAttributeFunctor&). */ - virtual bool supports(const Drawable::ConstAttributeFunctor&) const { return true; } - - /** Accept a Drawable::ConstAttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has. */ - virtual void accept(Drawable::ConstAttributeFunctor& af) const; - - /** Return true, osg::Geometry does support accept(PrimitiveFunctor&). */ - virtual bool supports(const PrimitiveFunctor&) const { return true; } - - /** Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Drawable has. */ - virtual void accept(PrimitiveFunctor& pf) const; - - /** Return true, osg::Geometry does support accept(PrimitiveIndexFunctor&). */ - virtual bool supports(const PrimitiveIndexFunctor&) const { return true; } - - /** Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Drawable has. */ - virtual void accept(PrimitiveIndexFunctor& pf) const; - - - protected: - - Geometry& operator = (const Geometry&) { return *this;} - - virtual ~Geometry(); - - bool verifyBindings(const ArrayData& arrayData) const; - bool verifyBindings(const Vec3ArrayData& arrayData) const; - - void computeCorrectBindingsAndArraySizes(ArrayData& arrayData,const char* arrayName); - void computeCorrectBindingsAndArraySizes(Vec3ArrayData& arrayData,const char* arrayName); - - void addVertexBufferObjectIfRequired(osg::Array* array); - void addElementBufferObjectIfRequired(osg::PrimitiveSet* primitiveSet); - - - PrimitiveSetList _primitives; - ArrayData _vertexData; - ArrayData _normalData; - ArrayData _colorData; - ArrayData _secondaryColorData; - ArrayData _fogCoordData; - ArrayDataList _texCoordList; - ArrayDataList _vertexAttribList; - - mutable bool _fastPath; - bool _fastPathHint; - - ref_ptr _internalOptimizedGeometry; -}; - -/** Convenience function to be used for creating quad geometry with texture coords. - * Tex coords go from left bottom (l,b) to right top (r,t). -*/ -extern OSG_EXPORT Geometry* createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVec,const Vec3& heightVec, float l, float b, float r, float t); - -/** Convenience function to be used for creating quad geometry with texture coords. - * Tex coords go from bottom left (0,0) to top right (s,t). -*/ -inline Geometry* createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVec,const Vec3& heightVec, float s=1.0f, float t=1.0f) -{ - return createTexturedQuadGeometry(corner,widthVec,heightVec, 0.0f, 0.0f, s, t); -} - - -} - -#endif diff --git a/libs/lib/mac32/include/osg/GraphicsContext b/libs/lib/mac32/include/osg/GraphicsContext deleted file mode 100644 index 2b3aa4123cded88d0d14bfd2d125dfa330e10fd9..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GraphicsContext +++ /dev/null @@ -1,530 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GRAPHICSCONTEXT -#define OSG_GRAPHICSCONTEXT 1 - -#include -#include -#include - -#include - -namespace osg { - -// forward declare osg::Camera -class Camera; - -/** Base class for providing Windowing API agnostic access to creating and managing graphics context.*/ -class OSG_EXPORT GraphicsContext : public Object -{ - public: - - struct OSG_EXPORT ScreenIdentifier - { - ScreenIdentifier(); - - ScreenIdentifier(int in_screenNum); - - ScreenIdentifier(const std::string& in_hostName,int in_displayNum, int in_screenNum); - - /** Return the display name in the form hostName::displayNum:screenNum. */ - std::string displayName() const; - - /** Read the DISPLAY environmental variable, and set the ScreenIdentifier accordingly. - * Note, if either of displayNum or screenNum are not defined then -1 is set respectively to - * signify the this parameter has not been set. When parameters are undefined one can call - * call setUndefinedScreenDetalstoDefaultScreen() method after readDISPLAY() to ensure valid values. */ - void readDISPLAY(); - - /** Set the screenIndentifier from the displayName string. - * Note, if either of displayNum or screenNum are not defined then -1 is set respectively to - * signify the this parameter has not been set. When parameters are undefined one can call - * call setUndefinedScreenDetalstoDefaultScreen() method after readDISPLAY() to ensure valid values. */ - void setScreenIdentifier(const std::string& displayName); - - /** Set any undefined displayNum or screenNum values (i.e. -1) to the default display & screen of 0 respectively.*/ - void setUndefinedScreenDetailsToDefaultScreen() - { - if (displayNum<0) displayNum = 0; - if (screenNum<0) screenNum = 0; - } - - std::string hostName; - int displayNum; - int screenNum; - }; - - /** GraphicsContext Traits object provides the specification of what type of graphics context is required.*/ - struct OSG_EXPORT Traits : public osg::Referenced, public ScreenIdentifier - { - Traits(DisplaySettings* ds=0); - - // graphics context original and size - int x; - int y; - int width; - int height; - - // window decoration and behaviour - std::string windowName; - bool windowDecoration; - bool supportsResize; - - // buffer depths, 0 equals off. - unsigned int red; - unsigned int blue; - unsigned int green; - unsigned int alpha; - unsigned int depth; - unsigned int stencil; - - // multi sample parameters - unsigned int sampleBuffers; - unsigned int samples; - - // buffer configuration - bool pbuffer; - bool quadBufferStereo; - bool doubleBuffer; - - // render to texture - GLenum target; - GLenum format; - unsigned int level; - unsigned int face; - unsigned int mipMapGeneration; - - // V-sync - bool vsync; - - // Swap Group - bool swapGroupEnabled; - GLuint swapGroup; - GLuint swapBarrier; - - // use multithreaded OpenGL-engine (OS X only) - bool useMultiThreadedOpenGLEngine; - - // enable cursor - bool useCursor; - - // settings used in set up of graphics context, only presently used by GL3 build of OSG. - std::string glContextVersion; - unsigned int glContextFlags; - unsigned int glContextProfileMask; - - - // shared context - GraphicsContext* sharedContext; - - osg::ref_ptr inheritedWindowData; - - // ask the GraphicsWindow implementation to set the pixel format of an inherited window - bool setInheritedWindowPixelFormat; - - // X11 hint whether to override the window managers window size/position redirection - bool overrideRedirect; - - DisplaySettings::SwapMethod swapMethod; - }; - - /** Simple resolution structure used by WindowingSystemInterface to get and set screen resolution. - * Note the '0' value stands for 'unset'. */ - struct ScreenSettings { - ScreenSettings() : - width(0), - height(0), - refreshRate(0), - colorDepth(0) - {} - ScreenSettings(int width, int height, double refreshRate=0, unsigned int colorDepth=0) : - width(width), - height(height), - refreshRate(refreshRate), - colorDepth(colorDepth) - {} - - int width; - int height; - double refreshRate; ///< Screen refresh rate, in Hz. - unsigned int colorDepth; ///< RGB(A) color buffer depth. - }; - - typedef std::vector ScreenSettingsList; - - /** Callback to be implemented to provide access to Windowing API's ability to create Windows/pbuffers.*/ - struct WindowingSystemInterface : public osg::Referenced - { - virtual unsigned int getNumScreens(const ScreenIdentifier& screenIdentifier = ScreenIdentifier()) = 0; - - virtual void getScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettings & resolution) = 0; - - virtual bool setScreenSettings(const ScreenIdentifier& /*screenIdentifier*/, const ScreenSettings & /*resolution*/) { return false; } - - virtual void enumerateScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettingsList & resolutionList) = 0; - - virtual GraphicsContext* createGraphicsContext(Traits* traits) = 0; - - virtual ~WindowingSystemInterface() {} - - - /** Gets screen resolution without using the ScreenResolution structure. - * \deprecated Provided only for backward compatibility. */ - inline void getScreenResolution(const ScreenIdentifier& screenIdentifier, unsigned int& width, unsigned int& height) - { - ScreenSettings settings; - getScreenSettings(screenIdentifier, settings); - width = settings.width; - height = settings.height; - } - - /** Sets screen resolution without using the ScreenSettings structure. - * \deprecated Provided only for backward compatibility. */ - inline bool setScreenResolution(const ScreenIdentifier& screenIdentifier, unsigned int width, unsigned int height) - { - return setScreenSettings(screenIdentifier, ScreenSettings(width, height)); - } - - /** \deprecated Provided only for backward compatibility. */ - inline bool setScreenRefreshRate(const ScreenIdentifier& screenIdentifier, double refreshRate) - { - ScreenSettings settings; - getScreenSettings(screenIdentifier, settings); - settings.refreshRate = refreshRate; - return setScreenSettings(screenIdentifier, settings); - } - }; - - - /** Set the query the windowing system for screens and create graphics context - this functor should be supplied by the windows toolkit. */ - static void setWindowingSystemInterface(WindowingSystemInterface* wsInterface); - - /** Get the WindowingSystemInterface*/ - static WindowingSystemInterface* getWindowingSystemInterface(); - - /** Create a graphics context for a specified set of traits.*/ - static GraphicsContext* createGraphicsContext(Traits* traits); - - /** Create a contextID for a new graphics context, this contextID is used to set up the osg::State associate with context. - * Automatically increments the usage count of the contextID to 1.*/ - static unsigned int createNewContextID(); - - /** Get the current max ContextID.*/ - static unsigned int getMaxContextID(); - - /** Increment the usage count associate with a contextID. The usage count specifies how many graphics contexts a specific contextID is shared between.*/ - static void incrementContextIDUsageCount(unsigned int contextID); - - /** Decrement the usage count associate with a contextID. Once the contextID goes to 0 the contextID is then free to be reused.*/ - static void decrementContextIDUsageCount(unsigned int contextID); - - typedef std::vector GraphicsContexts; - - /** Get all the registered graphics contexts.*/ - static GraphicsContexts getAllRegisteredGraphicsContexts(); - - /** Get all the registered graphics contexts associated with a specific contextID.*/ - static GraphicsContexts getRegisteredGraphicsContexts(unsigned int contextID); - - /** Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.*/ - static void setCompileContext(unsigned int contextID, GraphicsContext* gc); - - /** Get existing or create a new GraphicsContext to do background compilation for GraphicsContexts associated with specified contextID.*/ - static GraphicsContext* getOrCreateCompileContext(unsigned int contextID); - - /** Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specified contextID.*/ - static GraphicsContext* getCompileContext(unsigned int contextID); - - public: - - /** Add operation to end of OperationQueue.*/ - void add(Operation* operation); - - /** Remove operation from OperationQueue.*/ - void remove(Operation* operation); - - /** Remove named operation from OperationQueue.*/ - void remove(const std::string& name); - - /** Remove all operations from OperationQueue.*/ - void removeAllOperations(); - - /** Run the operations. */ - void runOperations(); - - typedef std::list< ref_ptr > GraphicsOperationQueue; - - /** Get the operations queue, not you must use the OperationsMutex when accessing the queue.*/ - GraphicsOperationQueue& getOperationsQueue() { return _operations; } - - /** Get the operations queue mutex.*/ - OpenThreads::Mutex* getOperationsMutex() { return &_operationsMutex; } - - /** Get the operations queue block used to mark an empty queue, if you end items into the empty queue you must release this block.*/ - osg::RefBlock* getOperationsBlock() { return _operationsBlock.get(); } - - /** Get the current operations that is being run.*/ - Operation* getCurrentOperation() { return _currentOperation.get(); } - - - public: - - /** Get the traits of the GraphicsContext.*/ - inline const Traits* getTraits() const { return _traits.get(); } - - /** Return whether a valid and usable GraphicsContext has been created.*/ - virtual bool valid() const = 0; - - - /** Set the State object which tracks the current OpenGL state for this graphics context.*/ - inline void setState(State* state) { _state = state; } - - /** Get the State object which tracks the current OpenGL state for this graphics context.*/ - inline State* getState() { return _state.get(); } - - /** Get the const State object which tracks the current OpenGL state for this graphics context.*/ - inline const State* getState() const { return _state.get(); } - - - /** Sets the clear color. */ - inline void setClearColor(const Vec4& color) { _clearColor = color; } - - /** Returns the clear color. */ - inline const Vec4& getClearColor() const { return _clearColor; } - - /** Set the clear mask used in glClear(..). - * Defaults to 0 - so no clear is done by default by the GraphicsContext, instead the Camera's attached the GraphicsContext will do the clear. - * GraphicsContext::setClearMask() is useful for when the Camera's Viewports don't conver the whole context, so the context will fill in the gaps. */ - inline void setClearMask(GLbitfield mask) { _clearMask = mask; } - - /** Get the clear mask.*/ - inline GLbitfield getClearMask() const { return _clearMask; } - - /** Do an OpenGL clear of the full graphics context/window. - * Note, must only be called from a thread with this context current.*/ - virtual void clear(); - - double getTimeSinceLastClear() const { return osg::Timer::instance()->delta_s(_lastClearTick, osg::Timer::instance()->tick()); } - - - /** Realize the GraphicsContext.*/ - bool realize(); - - /** close the graphics context. - * close(bool) stops any associated graphics threads, releases the contextID for the GraphicsContext then - * optional calls closeImplementation() to do the actual deletion of the graphics. This call is made optional - * as there are times when the graphics context has already been deleted externally and only the OSG side - * of the its data need to be closed down. */ - void close(bool callCloseImplementation=true); - - /** swap the front and back buffers.*/ - void swapBuffers(); - - /** Return true if the graphics context has been realized and is ready to use.*/ - inline bool isRealized() const { return isRealizedImplementation(); } - - - /** Make this graphics context current. - * Implemented by calling makeCurrentImplementation(). - * Returns true on success. */ - bool makeCurrent(); - - /** Make this graphics context current with specified read context. - * Implemented by calling makeContextCurrentImplementation(). - * Returns true on success. */ - bool makeContextCurrent(GraphicsContext* readContext); - - /** Release the graphics context. - * Returns true on success. */ - bool releaseContext(); - - /** Return true if the current thread has this OpenGL graphics context.*/ - inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThread(); } - - /** Bind the graphics context to associated texture.*/ - inline void bindPBufferToTexture(GLenum buffer) { bindPBufferToTextureImplementation(buffer); } - - - - /** Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.*/ - void createGraphicsThread(); - - /** Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.*/ - void setGraphicsThread(GraphicsThread* gt); - - /** Get the graphics thread assigned the graphics context.*/ - GraphicsThread* getGraphicsThread() { return _graphicsThread.get(); } - - /** Get the const graphics thread assigned the graphics context.*/ - const GraphicsThread* getGraphicsThread() const { return _graphicsThread.get(); } - - - /** Realize the GraphicsContext implementation, - * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ - virtual bool realizeImplementation() = 0; - - /** Return true if the graphics context has been realized, and is ready to use, implementation. - * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ - virtual bool isRealizedImplementation() const = 0; - - /** Close the graphics context implementation. - * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ - virtual void closeImplementation() = 0; - - /** Make this graphics context current implementation. - * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ - virtual bool makeCurrentImplementation() = 0; - - /** Make this graphics context current with specified read context implementation. - * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ - virtual bool makeContextCurrentImplementation(GraphicsContext* readContext) = 0; - - /** Release the graphics context implementation.*/ - virtual bool releaseContextImplementation() = 0; - - /** Pure virtual, Bind the graphics context to associated texture implementation. - * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ - virtual void bindPBufferToTextureImplementation(GLenum buffer) = 0; - - struct SwapCallback : public osg::Referenced - { - virtual void swapBuffersImplementation(GraphicsContext* gc) = 0; - }; - /** Set the swap callback which overrides the - * GraphicsContext::swapBuffersImplementation(), allowing - * developers to provide custom behavior for swap. - * The callback must call - * GraphicsContext::swapBuffersImplementation() */ - void setSwapCallback(SwapCallback* rc) { _swapCallback = rc; } - - /** Get the swap callback which overrides the GraphicsContext::swapBuffersImplementation().*/ - SwapCallback* getSwapCallback() { return _swapCallback.get(); } - - /** Get the const swap callback which overrides the GraphicsContext::swapBuffersImplementation().*/ - const SwapCallback* getSwapCallback() const { return _swapCallback.get(); } - - /** convinience method for handling whether to call swapbuffers callback or the standard context swapBuffersImplementation. - * swapBuffersCallbackOrImplemenation() is called by swapBuffers() and osg::SwapBuffersOperation, end users should normally - * call swapBuffers() rather than swapBuffersCallbackOrImplemenation(). */ - void swapBuffersCallbackOrImplemenation() - { - if (_state.valid()) _state->frameCompleted(); - - if (_swapCallback.valid()) _swapCallback->swapBuffersImplementation(this); - else swapBuffersImplementation(); - } - - /** Swap the front and back buffers implementation. - * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ - virtual void swapBuffersImplementation() = 0; - - - - /** resized method should be called when the underlying window has been resized and the GraphicsWindow and associated Cameras must - be updated to keep in sync with the new size. */ - void resized(int x, int y, int width, int height) - { - if (_resizedCallback.valid()) _resizedCallback->resizedImplementation(this, x, y, width, height); - else resizedImplementation(x, y, width, height); - } - - struct ResizedCallback : public osg::Referenced - { - virtual void resizedImplementation(GraphicsContext* gc, int x, int y, int width, int height) = 0; - }; - - /** Set the resized callback which overrides the GraphicsConext::realizedImplementation(), allow developers to provide custom behavior - * in response to a window being resized.*/ - void setResizedCallback(ResizedCallback* rc) { _resizedCallback = rc; } - - /** Get the resized callback which overrides the GraphicsConext::realizedImplementation().*/ - ResizedCallback* getResizedCallback() { return _resizedCallback.get(); } - - /** Get the const resized callback which overrides the GraphicsConext::realizedImplementation().*/ - const ResizedCallback* getResizedCallback() const { return _resizedCallback.get(); } - - /** resized implementation, by default resizes the viewports and aspect ratios the cameras associated with the graphics Window. */ - virtual void resizedImplementation(int x, int y, int width, int height); - - - typedef std::list< osg::Camera* > Cameras; - - /** Get the the list of cameras associated with this graphics context.*/ - Cameras& getCameras() { return _cameras; } - - /** Get the the const list of cameras associated with this graphics context.*/ - const Cameras& getCameras() const { return _cameras; } - - /** set the default FBO-id, this id will be used when the rendering-backend is finished with RTT FBOs */ - void setDefaultFboId(GLuint i) { _defaultFboId = i; } - - GLuint getDefaultFboId() const { return _defaultFboId; } - - public: - - virtual bool isSameKindAs(const Object* object) const { return dynamic_cast(object)!=0; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "GraphicsContext"; } - - protected: - - GraphicsContext(); - GraphicsContext(const GraphicsContext&, const osg::CopyOp&); - - virtual ~GraphicsContext(); - - virtual Object* cloneType() const { return 0; } - virtual Object* clone(const CopyOp&) const { return 0; } - - /** Register a GraphicsContext.*/ - static void registerGraphicsContext(GraphicsContext* gc); - - /** Unregister a GraphicsContext.*/ - static void unregisterGraphicsContext(GraphicsContext* gc); - - - void addCamera(osg::Camera* camera); - void removeCamera(osg::Camera* camera); - - Cameras _cameras; - - friend class osg::Camera; - - ref_ptr _traits; - ref_ptr _state; - - Vec4 _clearColor; - GLbitfield _clearMask; - - OpenThreads::Thread* _threadOfLastMakeCurrent; - - OpenThreads::Mutex _operationsMutex; - osg::ref_ptr _operationsBlock; - GraphicsOperationQueue _operations; - osg::ref_ptr _currentOperation; - - ref_ptr _graphicsThread; - - ref_ptr _resizedCallback; - ref_ptr _swapCallback; - - Timer_t _lastClearTick; - - GLuint _defaultFboId; -}; - - -} - -#endif diff --git a/libs/lib/mac32/include/osg/GraphicsCostEstimator b/libs/lib/mac32/include/osg/GraphicsCostEstimator deleted file mode 100644 index 88fbc1ecc38d6cee2179ae9e84338ccb42a94f36..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GraphicsCostEstimator +++ /dev/null @@ -1,142 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GRAPHICSCOSTESTIMATOR -#define OSG_GRAPHICSCOSTESTIMATOR - -#include -#include -#include - -namespace osg -{ - -class Geometry; -class Texture; -class Program; -class Node; -class RenderInfo; - -struct ClampedLinearCostFunction1D -{ - ClampedLinearCostFunction1D(double cost0=0.0, double dcost_di=0.0, unsigned int min_input=0): - _cost0(cost0), - _dcost_di(dcost_di), - _min_input(min_input) {} - - void set(double cost0, double dcost_di, unsigned int min_input) - { - _cost0 = cost0; - _dcost_di = dcost_di; - _min_input = min_input; - } - - double operator() (unsigned int input) const - { - return _cost0 + _dcost_di * double(input<=_min_input ? 0u : input-_min_input); - } - double _cost0; - double _dcost_di; - unsigned int _min_input; -}; - -/** Pair of double representing CPU and GPU times in seconds as first and second elements in std::pair. */ -typedef std::pair CostPair; - - -class OSG_EXPORT GeometryCostEstimator : public osg::Referenced -{ -public: - GeometryCostEstimator(); - void setDefaults(); - void calibrate(osg::RenderInfo& renderInfo); - CostPair estimateCompileCost(const osg::Geometry* geometry) const; - CostPair estimateDrawCost(const osg::Geometry* geometry) const; - -protected: - ClampedLinearCostFunction1D _arrayCompileCost; - ClampedLinearCostFunction1D _primtiveSetCompileCost; - - ClampedLinearCostFunction1D _arrayDrawCost; - ClampedLinearCostFunction1D _primtiveSetDrawCost; - - double _displayListCompileConstant; - double _displayListCompileFactor; -}; - -class OSG_EXPORT TextureCostEstimator : public osg::Referenced -{ -public: - TextureCostEstimator(); - void setDefaults(); - void calibrate(osg::RenderInfo& renderInfo); - CostPair estimateCompileCost(const osg::Texture* texture) const; - CostPair estimateDrawCost(const osg::Texture* texture) const; - -protected: - ClampedLinearCostFunction1D _compileCost; - ClampedLinearCostFunction1D _drawCost; -}; - - -class OSG_EXPORT ProgramCostEstimator : public osg::Referenced -{ -public: - ProgramCostEstimator(); - void setDefaults(); - void calibrate(osg::RenderInfo& renderInfo); - CostPair estimateCompileCost(const osg::Program* program) const; - CostPair estimateDrawCost(const osg::Program* program) const; - -protected: - ClampedLinearCostFunction1D _shaderCompileCost; - ClampedLinearCostFunction1D _linkCost; - ClampedLinearCostFunction1D _drawCost; -}; - -class OSG_EXPORT GraphicsCostEstimator : public osg::Referenced -{ -public: - GraphicsCostEstimator(); - - /** set defaults for computing the costs.*/ - void setDefaults(); - - /** calibrate the costs of various compile and draw operations */ - void calibrate(osg::RenderInfo& renderInfo); - - CostPair estimateCompileCost(const osg::Geometry* geometry) const { return _geometryEstimator->estimateCompileCost(geometry); } - CostPair estimateDrawCost(const osg::Geometry* geometry) const { return _geometryEstimator->estimateDrawCost(geometry); } - - CostPair estimateCompileCost(const osg::Texture* texture) const { return _textureEstimator->estimateCompileCost(texture); } - CostPair estimateDrawCost(const osg::Texture* texture) const { return _textureEstimator->estimateDrawCost(texture); } - - CostPair estimateCompileCost(const osg::Program* program) const { return _programEstimator->estimateCompileCost(program); } - CostPair estimateDrawCost(const osg::Program* program) const { return _programEstimator->estimateDrawCost(program); } - - CostPair estimateCompileCost(const osg::Node* node) const; - CostPair estimateDrawCost(const osg::Node* node) const; - -protected: - - virtual ~GraphicsCostEstimator(); - - osg::ref_ptr _geometryEstimator; - osg::ref_ptr _textureEstimator; - osg::ref_ptr _programEstimator; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/GraphicsThread b/libs/lib/mac32/include/osg/GraphicsThread deleted file mode 100644 index 7b67a85547c61c30b8f0961e554b04c6636eb0df..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/GraphicsThread +++ /dev/null @@ -1,136 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GRAPHICSTHREAD -#define OSG_GRAPHICSTHREAD 1 - -#include -#include - -namespace osg { - -class GraphicsContext; - -/** GraphicsThread is a helper class for running OpenGL GraphicsOperation within a single thread assigned to a specific GraphicsContext.*/ -class OSG_EXPORT GraphicsThread : public osg::OperationThread -{ - public: - - GraphicsThread(); - - /** Run does the graphics thread run loop.*/ - virtual void run(); -}; - -struct OSG_EXPORT GraphicsOperation : public Operation -{ - GraphicsOperation(const std::string& name, bool keep): - Operation(name,keep) {} - - /** Override the standard Operation operator and dynamic cast object to a GraphicsContext, - * on success call operation()(GraphicsContext*).*/ - virtual void operator () (Object* object); - - virtual void operator () (GraphicsContext* context) = 0; -}; - - -/** SwapBufferOperation calls swap buffers on the GraphicsContext.*/ -struct OSG_EXPORT SwapBuffersOperation : public GraphicsOperation -{ - SwapBuffersOperation(): - GraphicsOperation("SwapBuffers",true) {} - - virtual void operator () (GraphicsContext* context); -}; - -/** BarrierOperation allows one to synchronize multiple GraphicsThreads with each other.*/ -struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barrier -{ - enum PreBlockOp - { - NO_OPERATION, - GL_FLUSH, - GL_FINISH - }; - - BarrierOperation(int numThreads, PreBlockOp op=NO_OPERATION, bool keep=true): - Operation("Barrier", keep), - OpenThreads::Barrier(numThreads), - _preBlockOp(op) {} - - virtual void release(); - - virtual void operator () (Object* object); - - PreBlockOp _preBlockOp; -}; - -/** ReleaseContext_Block_MakeCurrentOperation releases the context for another thread to acquire, - * then blocks waiting for context to be released, once the block is release the context is re-acquired.*/ -struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public GraphicsOperation, public RefBlock -{ - ReleaseContext_Block_MakeCurrentOperation(): - GraphicsOperation("ReleaseContext_Block_MakeCurrent", false) {} - - virtual void release(); - - virtual void operator () (GraphicsContext* context); -}; - -struct OSG_EXPORT BlockAndFlushOperation : public GraphicsOperation, public OpenThreads::Block -{ - BlockAndFlushOperation(); - - virtual void release(); - - virtual void operator () (GraphicsContext*); -}; - - -struct OSG_EXPORT FlushDeletedGLObjectsOperation : public GraphicsOperation -{ - FlushDeletedGLObjectsOperation(double availableTime, bool keep=false); - - virtual void operator () (GraphicsContext*); - - double _availableTime; -}; - -class OSG_EXPORT RunOperations : public osg::GraphicsOperation -{ -public: - - RunOperations(): - osg::GraphicsOperation("RunOperation",true) {} - - virtual void operator () (osg::GraphicsContext* context); - -}; - -class OSG_EXPORT EndOfDynamicDrawBlock : public OpenThreads::BlockCount, public osg::State::DynamicObjectRenderingCompletedCallback -{ - public: - - EndOfDynamicDrawBlock(unsigned int); - - void completed(osg::State* state); - - protected: - - ~EndOfDynamicDrawBlock() {} -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Group b/libs/lib/mac32/include/osg/Group deleted file mode 100644 index 8bedbc44cacbea22fc73d6e869b6b6a34bfab700..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Group +++ /dev/null @@ -1,172 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_GROUP -#define OSG_GROUP 1 - -#include -#include - -namespace osg { - -typedef std::vector< ref_ptr > NodeList; - -/** General group node which maintains a list of children. - * Children are reference counted. This allows children to be shared - * with memory management handled automatically via osg::Referenced. -*/ -class OSG_EXPORT Group : public Node -{ - public : - - - Group(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - Group(const Group&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, Group); - - virtual Group* asGroup() { return this; } - virtual const Group* asGroup() const { return this; } - - virtual void traverse(NodeVisitor& nv); - - /** Add Node to Group. - * If node is not NULL and is not contained in Group then increment its - * reference count, add it to the child list and dirty the bounding - * sphere to force it to recompute on next getBound() and return true for success. - * Otherwise return false. Scene nodes can't be added as child nodes. - */ - virtual bool addChild( Node *child ); - - /** Insert Node to Group at specific location. - * The new child node is inserted into the child list - * before the node at the specified index. No nodes - * are removed from the group with this operation. - */ - virtual bool insertChild( unsigned int index, Node *child ); - - /** Remove Node from Group. - * If Node is contained in Group then remove it from the child - * list, decrement its reference count, and dirty the - * bounding sphere to force it to recompute on next getBound() and - * return true for success. If Node is not found then return false - * and do not change the reference count of the Node. - * Note, do not override, only override removeChildren(,) is required. - */ - inline bool removeChild( Node *child ) - { - unsigned int pos = getChildIndex(child); - if (pos<_children.size()) return removeChildren(pos,1); - else return false; - } - - /** Remove Node from Group. - * If Node is contained in Group then remove it from the child - * list, decrement its reference count, and dirty the - * bounding sphere to force it to recompute on next getBound() and - * return true for success. If Node is not found then return false - * and do not change the reference count of the Node. - * Note, do not override, only override removeChildren(,) is required. - */ - inline bool removeChild( unsigned int pos, unsigned int numChildrenToRemove=1 ) - { - if (pos<_children.size()) return removeChildren(pos,numChildrenToRemove); - else return false; - } - - /** Remove children from Group. - * Note, must be override by subclasses of Group which add per child attributes.*/ - virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove); - - /** Replace specified Node with another Node. - * Equivalent to setChild(getChildIndex(orignChild),node) - * See docs for setChild for further details on implementation. - */ - virtual bool replaceChild( Node *origChild, Node* newChild ); - - /** Return the number of children nodes. */ - inline unsigned int getNumChildren() const { return static_cast(_children.size()); } - - /** Set child node at position i. - * Return true if set correctly, false on failure (if node==NULL || i is out of range). - * When Set can be successful applied, the algorithm is : decrement the reference count origNode and increment the - * reference count of newNode, and dirty the bounding sphere - * to force it to recompute on next getBound() and return true. - * If origNode is not found then return false and do not - * add newNode. If newNode is NULL then return false and do - * not remove origNode. Also returns false if newChild is a Scene node. - */ - virtual bool setChild( unsigned int i, Node* node ); - - /** Return child node at position i. */ - inline Node* getChild( unsigned int i ) { return _children[i].get(); } - - /** Return child node at position i. */ - inline const Node* getChild( unsigned int i ) const { return _children[i].get(); } - - /** Return true if node is contained within Group. */ - inline bool containsNode( const Node* node ) const - { - - for (NodeList::const_iterator itr=_children.begin(); - itr!=_children.end(); - ++itr) - { - if (itr->get()==node) return true; - } - return false; - } - - /** Get the index number of child, return a value between - * 0 and _children.size()-1 if found, if not found then - * return _children.size(). - */ - inline unsigned int getChildIndex( const Node* node ) const - { - for (unsigned int childNum=0;childNum<_children.size();++childNum) - { - if (_children[childNum]==node) return childNum; - } - return static_cast(_children.size()); // node not found. - } - - /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ - virtual void setThreadSafeRefUnref(bool threadSafe); - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** If State is non-zero, this function releases any associated OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objects - * for all graphics contexts. */ - virtual void releaseGLObjects(osg::State* = 0) const; - - virtual BoundingSphere computeBound() const; - - protected: - - virtual ~Group(); - - virtual void childRemoved(unsigned int /*pos*/, unsigned int /*numChildrenToRemove*/) {} - virtual void childInserted(unsigned int /*pos*/) {} - - NodeList _children; - - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Hint b/libs/lib/mac32/include/osg/Hint deleted file mode 100644 index 63b1d5f1f6526a1b7725dcc4174ee235f64efd0e..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Hint +++ /dev/null @@ -1,81 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_HINT -#define OSG_HINT 1 - -#include - -namespace osg -{ - -class OSG_EXPORT Hint : public StateAttribute -{ -public: - - Hint(): - _target(GL_NONE), - _mode(GL_DONT_CARE) {} - - Hint(GLenum target, GLenum mode): - _target(target), - _mode(mode) {} - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Hint(const Hint& hint,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(hint,copyop), - _target(hint._target), - _mode(hint._mode) {} - - virtual osg::Object* cloneType() const { return new Hint( _target, GL_DONT_CARE ); } - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new Hint(*this,copyop); } - virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "Hint"; } - virtual Type getType() const { return HINT; } - - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(Hint,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_target) - COMPARE_StateAttribute_Parameter(_mode) - - return 0; - } - - /** Return the member identifier within the attribute's class type. Used for light number/clip plane number etc.*/ - virtual unsigned int getMember() const { return static_cast(_target); } - - void setTarget(GLenum target); - inline GLenum getTarget() const { return _target; } - - inline void setMode(GLenum mode) { _mode = mode; } - inline GLenum getMode() const { return _mode; } - - virtual void apply(State& state) const; - -protected: - - - GLenum _target; - GLenum _mode; -}; - - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Image b/libs/lib/mac32/include/osg/Image deleted file mode 100644 index cb099feea2cbd24e04c6bf3921d0f2c960aa9d4f..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Image +++ /dev/null @@ -1,433 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_IMAGE -#define OSG_IMAGE 1 - -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifndef GL_VERSION_1_2 - // 1.2 definitions... - #define GL_BGR 0x80E0 - #define GL_BGRA 0x80E1 - #define GL_UNSIGNED_BYTE_3_3_2 0x8032 - #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 - #define GL_UNSIGNED_SHORT_5_6_5 0x8363 - #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 - #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 - #define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 - #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 - #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 - #define GL_UNSIGNED_INT_8_8_8_8 0x8035 - #define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 - #define GL_UNSIGNED_INT_10_10_10_2 0x8036 - #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#endif - -#ifndef GL_COMPRESSED_ALPHA - #define GL_COMPRESSED_ALPHA 0x84E9 - #define GL_COMPRESSED_LUMINANCE 0x84EA - #define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB - #define GL_COMPRESSED_INTENSITY 0x84EC - #define GL_COMPRESSED_RGB 0x84ED - #define GL_COMPRESSED_RGBA 0x84EE -#endif - - -#ifndef GL_ABGR_EXT -#define GL_ABGR_EXT 0x8000 -#endif - -#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) - #define GL_RED 0x1903 - #define GL_GREEN 0x1904 - #define GL_BLUE 0x1905 - #define GL_DEPTH_COMPONENT 0x1902 - #define GL_STENCIL_INDEX 0x1901 -#endif - -#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GL3_AVAILABLE) - #define GL_BITMAP 0x1A00 - #define GL_COLOR_INDEX 0x1900 - #define GL_INTENSITY12 0x804C - #define GL_INTENSITY16 0x804D - #define GL_INTENSITY4 0x804A - #define GL_INTENSITY8 0x804B - #define GL_LUMINANCE12 0x8041 - #define GL_LUMINANCE12_ALPHA4 0x8046 - #define GL_LUMINANCE12_ALPHA12 0x8047 - #define GL_LUMINANCE16 0x8042 - #define GL_LUMINANCE16_ALPHA16 0x8048 - #define GL_LUMINANCE4 0x803F - #define GL_LUMINANCE4_ALPHA4 0x8043 - #define GL_LUMINANCE6_ALPHA2 0x8044 - #define GL_LUMINANCE8 0x8040 - #define GL_LUMINANCE8_ALPHA8 0x8045 - #define GL_RGBA8 0x8058 - #define GL_PACK_ROW_LENGTH 0x0D02 -#endif - -#ifndef GL_PACK_SKIP_IMAGES - #define GL_PACK_SKIP_IMAGES 0x806B - #define GL_PACK_IMAGE_HEIGHT 0x806C - #define GL_UNPACK_SKIP_IMAGES 0x806D - #define GL_UNPACK_IMAGE_HEIGHT 0x806E -#endif - -namespace osg { - -// forward declare -class NodeVisitor; - -/** Image class for encapsulating the storage texture image data. */ -class OSG_EXPORT Image : public BufferData -{ - - public : - - Image(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - Image(const Image& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual Object* cloneType() const { return new Image(); } - virtual Object* clone(const CopyOp& copyop) const { return new Image(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=0; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "Image"; } - - virtual const GLvoid* getDataPointer() const { return data(); } - virtual unsigned int getTotalDataSize() const { return getTotalSizeInBytesIncludingMipmaps(); } - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const Image& rhs) const; - - void setFileName(const std::string& fileName); - inline const std::string& getFileName() const { return _fileName; } - - enum WriteHint { - NO_PREFERENCE, - STORE_INLINE, - EXTERNAL_FILE - }; - - void setWriteHint(WriteHint writeHint) { _writeHint = writeHint; } - WriteHint getWriteHint() const { return _writeHint; } - - enum AllocationMode { - NO_DELETE, - USE_NEW_DELETE, - USE_MALLOC_FREE - }; - - /** Set the method used for deleting data once it goes out of scope. */ - void setAllocationMode(AllocationMode mode) { _allocationMode = mode; } - - /** Get the method used for deleting data once it goes out of scope. */ - AllocationMode getAllocationMode() const { return _allocationMode; } - - - /** Allocate a pixel block of specified size and type. */ - virtual void allocateImage(int s,int t,int r, - GLenum pixelFormat,GLenum type, - int packing=1); - - - /** Set the image dimensions, format and data. */ - virtual void setImage(int s,int t,int r, - GLint internalTextureformat, - GLenum pixelFormat,GLenum type, - unsigned char* data, - AllocationMode mode, - int packing=1); - - /** Read pixels from current frame buffer at specified position and size, using glReadPixels. - * Create memory for storage if required, reuse existing pixel coords if possible. - */ - virtual void readPixels(int x,int y,int width,int height, - GLenum pixelFormat,GLenum type); - - - /** Read the contents of the current bound texture, handling compressed pixelFormats if present. - * Create memory for storage if required, reuse existing pixel coords if possible. - */ - virtual void readImageFromCurrentTexture(unsigned int contextID, bool copyMipMapsIfAvailable, GLenum type = GL_UNSIGNED_BYTE); - - - /** Scale image to specified size. */ - void scaleImage(int s,int t,int r) { scaleImage(s,t,r, getDataType()); } - - /** Scale image to specified size and with specified data type. */ - virtual void scaleImage(int s,int t,int r, GLenum newDataType); - - /** Copy a source Image into a subpart of this Image at specified position. - * Typically used to copy to an already allocated image, such as creating - * a 3D image from a stack 2D images. - * If this Image is empty then image data is created to - * accomodate the source image in its offset position. - * If source is NULL then no operation happens, this Image is left unchanged. - */ - virtual void copySubImage(int s_offset, int t_offset, int r_offset, const osg::Image* source); - - - enum Origin - { - BOTTOM_LEFT, - TOP_LEFT - }; - - /** Set the origin of the image. - * The default value is BOTTOM_LEFT and is consistent with OpenGL. - * TOP_LEFT is used for imagery that follows standard Imagery convention, such as movies, - * and hasn't been flipped yet. For such images one much flip the t axis of the tex coords. - * to handle this origin position. */ - void setOrigin(Origin origin) { _origin = origin; } - - /** Get the origin of the image.*/ - Origin getOrigin() const { return _origin; } - - - /** Width of image. */ - inline int s() const { return _s; } - - /** Height of image. */ - inline int t() const { return _t; } - - /** Depth of image. */ - inline int r() const { return _r; } - - void setInternalTextureFormat(GLint internalFormat); - inline GLint getInternalTextureFormat() const { return _internalTextureFormat; } - - void setPixelFormat(GLenum pixelFormat); - inline GLenum getPixelFormat() const { return _pixelFormat; } - - void setDataType(GLenum dataType); - inline GLenum getDataType() const { return _dataType; } - - void setPacking(unsigned int packing) { _packing = packing; } - inline unsigned int getPacking() const { return _packing; } - - /** return true of the pixel format is an OpenGL compressed pixel format.*/ - bool isCompressed() const; - - /** Set the pixel aspect ratio, defined as the pixel width divided by the pixel height.*/ - inline void setPixelAspectRatio(float pixelAspectRatio) { _pixelAspectRatio = pixelAspectRatio; } - - /** Get the pixel aspect ratio.*/ - inline float getPixelAspectRatio() const { return _pixelAspectRatio; } - - /** Return the number of bits required for each pixel. */ - inline unsigned int getPixelSizeInBits() const { return computePixelSizeInBits(_pixelFormat,_dataType); } - - /** Return the number of bytes each row of pixels occupies once it has been packed. */ - inline unsigned int getRowSizeInBytes() const { return computeRowWidthInBytes(_s,_pixelFormat,_dataType,_packing); } - - /** Return the number of bytes each image (_s*_t) of pixels occupies. */ - inline unsigned int getImageSizeInBytes() const { return getRowSizeInBytes()*_t; } - - /** Return the number of bytes the whole row/image/volume of pixels occupies. */ - inline unsigned int getTotalSizeInBytes() const { return getImageSizeInBytes()*_r; } - - /** Return the number of bytes the whole row/image/volume of pixels occupies, including all mip maps if included. */ - unsigned int getTotalSizeInBytesIncludingMipmaps() const; - - /** Return true if the Image represent a valid and usable imagery.*/ - bool valid() const { return _s!=0 && _t!=0 && _r!=0 && _data!=0 && _dataType!=0; } - - /** Raw image data. */ - inline unsigned char* data() { return _data; } - - /** Raw const image data. */ - inline const unsigned char* data() const { return _data; } - - - inline unsigned char* data(int column, int row=0,int image=0) - { - if (!_data) return NULL; - return _data+(column*getPixelSizeInBits())/8+row*getRowSizeInBytes()+image*getImageSizeInBytes(); - } - - inline const unsigned char* data(int column, int row=0,int image=0) const - { - if (!_data) return NULL; - return _data+(column*getPixelSizeInBits())/8+row*getRowSizeInBytes()+image*getImageSizeInBytes(); - } - - /** Get the color value for specified texcoord.*/ - Vec4 getColor(unsigned int s,unsigned t=0,unsigned r=0) const; - - /** Get the color value for specified texcoord.*/ - Vec4 getColor(const Vec2& texcoord) const { return getColor(Vec3(texcoord.x(),texcoord.y(),0.0f)); } - - /** Get the color value for specified texcoord.*/ - Vec4 getColor(const Vec3& texcoord) const; - - - /** Flip the image horizontally. */ - void flipHorizontal(); - - /** Flip the image vertically. */ - void flipVertical(); - - - /** Ensure image dimensions are a power of two. - * Mipmapped textures require the image dimensions to be - * power of two and are within the maxiumum texture size for - * the host machine. - */ - void ensureValidSizeForTexturing(GLint maxTextureSize); - - static bool isPackedType(GLenum type); - static GLenum computePixelFormat(GLenum pixelFormat); - static GLenum computeFormatDataType(GLenum pixelFormat); - static unsigned int computeNumComponents(GLenum pixelFormat); - static unsigned int computePixelSizeInBits(GLenum pixelFormat,GLenum type); - static unsigned int computeRowWidthInBytes(int width,GLenum pixelFormat,GLenum type,int packing); - static int computeNearestPowerOfTwo(int s,float bias=0.5f); - static int computeNumberOfMipmapLevels(int s,int t = 1, int r = 1); - - /** Precomputed mipmaps stuff. */ - typedef std::vector< unsigned int > MipmapDataType; - - inline bool isMipmap() const {return !_mipmapData.empty();}; - - unsigned int getNumMipmapLevels() const - { - return static_cast(_mipmapData.size())+1; - }; - - /** Send offsets into data. It is assumed that first mipmap offset (index 0) is 0.*/ - inline void setMipmapLevels(const MipmapDataType& mipmapDataVector) { _mipmapData = mipmapDataVector; } - - inline const MipmapDataType& getMipmapLevels() const { return _mipmapData; } - - inline unsigned int getMipmapOffset(unsigned int mipmapLevel) const - { - if(mipmapLevel == 0) - return 0; - else if (mipmapLevel < getNumMipmapLevels()) - return _mipmapData[mipmapLevel-1]; - return 0; - }; - - inline unsigned char* getMipmapData(unsigned int mipmapLevel) - { - return _data+getMipmapOffset(mipmapLevel); - } - - inline const unsigned char* getMipmapData(unsigned int mipmapLevel) const - { - return _data+getMipmapOffset(mipmapLevel); - } - - /*inline const unsigned char* getMipmapData(unsigned int row, unsigned int column, unsigned int mipmapLevel) const - { - if (!_data) return NULL; - return getMipmapData(mipmapLevel) + (column*getPixelSizeInBits())/8+row*getRowSizeInBytes(); - }*/ - - /** Return true if this image is translucent - i.e. it has alpha values that are less 1.0 (when normalized). */ - virtual bool isImageTranslucent() const; - - /** Set the optional PixelBufferObject used to map the image memory efficiently to graphics memory. */ - void setPixelBufferObject(PixelBufferObject* buffer) { setBufferObject(buffer); } - - /** Get the PixelBufferObject.*/ - PixelBufferObject* getPixelBufferObject() { return dynamic_cast(_bufferObject.get()); } - - /** Get the const PixelBufferObject.*/ - const PixelBufferObject* getPixelBufferObject() const { return dynamic_cast(_bufferObject.get()); } - - /** return whether the update(NodeVisitor* nv) should be required on each frame to enable proper working of osg::Image.*/ - virtual bool requiresUpdateCall() const { return false; } - - /** update method for osg::Image subclasses that update themselves during the update traversal.*/ - virtual void update(NodeVisitor* /*nv*/) {} - - /** convience update callback class that can be attached to StateAttribute (such as Textures) to ensure - * that the Image::update(NodeVisitor*) method is called during the update traversal. This callback - * is automatically attached when Image::requiresUpdateCall() is true (it's false by default.) - */ - struct OSG_EXPORT UpdateCallback : public osg::StateAttributeCallback - { - virtual void operator () (osg::StateAttribute* attr, osg::NodeVisitor* nv); - }; - - /** method for hinting whether to enable or disable focus to images acting as front ends to interactive surfaces such as a vnc or browser window. Return true if handled. */ - virtual bool sendFocusHint(bool /*focus*/) { return false; } - - /** method for sending pointer events to images that are acting as front ends to interactive surfaces such as a vnc or browser window. Return true if handled. */ - virtual bool sendPointerEvent(int /*x*/, int /*y*/, int /*buttonMask*/) { return false; } - - /** method for sending key events to images that are acting as front ends to interactive surfaces such as a vnc or browser window. Return true if handled.*/ - virtual bool sendKeyEvent(int /*key*/, bool /*keyDown*/) { return false; } - - /** method for passing frame information to the custom Image classes, to be called only when objects associated with imagery are not culled.*/ - virtual void setFrameLastRendered(const osg::FrameStamp* /*frameStamp*/) {} - - protected : - - virtual ~Image(); - - Image& operator = (const Image&) { return *this; } - - std::string _fileName; - WriteHint _writeHint; - - - Origin _origin; - - int _s, _t, _r; - GLint _internalTextureFormat; - GLenum _pixelFormat; - GLenum _dataType; - unsigned int _packing; - float _pixelAspectRatio; - - AllocationMode _allocationMode; - unsigned char* _data; - - void deallocateData(); - - void setData(unsigned char* data,AllocationMode allocationMode); - - MipmapDataType _mipmapData; - - ref_ptr _bufferObject; -}; - -class Geode; - -/** Convenience function to be used by image loaders to generate a valid geode - * to return for readNode(). - * Use the image's s and t values to scale the dimensions of the image. -*/ -extern OSG_EXPORT Geode* createGeodeForImage(Image* image); -/** Convenience function to be used by image loaders to generate a valid geode - * to return for readNode(). - * Use the specified s and t values to scale the dimensions of the image. -*/ -extern OSG_EXPORT Geode* createGeodeForImage(Image* image,float s,float t); - -} - -#endif // __SG_IMAGE_H diff --git a/libs/lib/mac32/include/osg/ImageSequence b/libs/lib/mac32/include/osg/ImageSequence deleted file mode 100644 index 94503b741143b14f41ca7a746f6a316f76eae63e..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ImageSequence +++ /dev/null @@ -1,151 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_IMAGESEQUENCE -#define OSG_IMAGESEQUENCE 1 - -#include -#include - -#include -#include - -namespace osg { - -/** - * Image Buffer class. -*/ -class OSG_EXPORT ImageSequence : public ImageStream -{ - public: - ImageSequence(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - ImageSequence(const ImageSequence& ImageSequence, const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual Object* cloneType() const { return new ImageSequence(); } - virtual Object* clone(const CopyOp& copyop) const { return new ImageSequence(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=0; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "ImageSequence"; } - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const Image& rhs) const; - - virtual void setReferenceTime(double t) { _referenceTime = t; } - virtual double getReferenceTime() const { return _referenceTime; } - - virtual void setTimeMultiplier(double tm) { _timeMultiplier = tm; } - virtual double getTimeMultiplier() const { return _timeMultiplier; } - - typedef std::vector< osg::ref_ptr > Images; - typedef std::vector< std::string > FileNames; - - virtual void seek(double time); - - virtual void play(); - - virtual void pause(); - - virtual void rewind(); - - enum Mode - { - PRE_LOAD_ALL_IMAGES, - PAGE_AND_RETAIN_IMAGES, - PAGE_AND_DISCARD_USED_IMAGES - }; - - void setMode(Mode mode); - Mode getMode() const { return _mode; } - - void setLength(double length); - virtual double getLength() const { return _length; } - - - void addImageFile(const std::string& fileName); - - void setImageFile(unsigned int pos, const std::string& fileName); - std::string getImageFile(unsigned int pos) const; - - unsigned int getNumImageFiles() const { return _fileNames.size(); } - - FileNames& getFileNames() { return _fileNames; } - const FileNames& getFileNames() const { return _fileNames; } - - void addImage(osg::Image* image); - - void setImage(int s,int t,int r, - GLint internalTextureformat, - GLenum pixelFormat,GLenum type, - unsigned char* data, - AllocationMode mode, - int packing=1) { Image::setImage(s,t,r,internalTextureformat, pixelFormat, type, data, mode, packing); } - - void setImage(unsigned int pos, osg::Image* image); - Image* getImage(unsigned int pos); - const Image* getImage(unsigned int pos) const; - - unsigned int getNumImages() const { return _images.size(); } - - Images& getImages() { return _images; } - const Images& getImages() const { return _images; } - - /** ImageSequence requires a call to update(NodeVisitor*) during the update traversal so return true.*/ - virtual bool requiresUpdateCall() const { return true; } - - /** update method for osg::Image subclasses that update themselves during the update traversal.*/ - virtual void update(NodeVisitor* nv); - - protected: - - virtual ~ImageSequence() {} - - virtual void applyLoopingMode(); - - void setImageToChild(const osg::Image* image); - - void computeTimePerImage(); - - int imageIndex(double time); - - - double _referenceTime; - double _timeMultiplier; - - Mode _mode; - double _length; - - double _timePerImage; - - mutable OpenThreads::Mutex _mutex; - FileNames _fileNames; - - Images _images; - - typedef std::set< std::string > FilesRequested; - FilesRequested _filesRequested; - - int _previousAppliedImageIndex; - - - bool _seekTimeSet; - double _seekTime; - - - -}; - -} // namespace - -#endif diff --git a/libs/lib/mac32/include/osg/ImageStream b/libs/lib/mac32/include/osg/ImageStream deleted file mode 100644 index 4b4a6d59321227cbb3545bd10621ca7b1b4c793e..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ImageStream +++ /dev/null @@ -1,111 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_IMAGESTREAM -#define OSG_IMAGESTREAM 1 - -#include -#include - -namespace osg { - -/** - * Image Stream class. -*/ -class OSG_EXPORT ImageStream : public Image -{ - public: - ImageStream(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - ImageStream(const ImageStream& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - virtual Object* cloneType() const { return new ImageStream(); } - virtual Object* clone(const CopyOp& copyop) const { return new ImageStream(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=0; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "ImageStream"; } - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const Image& rhs) const; - - enum StreamStatus - { - INVALID, - PLAYING, - PAUSED, - REWINDING - }; - - virtual void seek(double /*time*/) {} - - virtual void play() { _status=PLAYING; } - - virtual void pause() { _status=PAUSED; } - - virtual void rewind() { _status=REWINDING; } - - virtual void quit(bool /*waitForThreadToExit*/ = true) {} - - StreamStatus getStatus() { return _status; } - - - enum LoopingMode - { - NO_LOOPING, - LOOPING - }; - - void setLoopingMode(LoopingMode mode) - { - if (_loopingMode == mode) return; - - _loopingMode = mode; - applyLoopingMode(); - } - - LoopingMode getLoopingMode() const { return _loopingMode; } - - virtual double getCreationTime() const { return HUGE_VAL; } - virtual double getLength() const { return 0.0; } - virtual double getFrameRate() const { return 0.0; } - - virtual void setReferenceTime(double) {} - virtual double getReferenceTime() const { return 0.0; } - - virtual void setTimeMultiplier(double) {} - virtual double getTimeMultiplier() const { return 0.0; } - - virtual void setVolume(float) {} - virtual float getVolume() const { return 0.0f; } - - typedef std::vector< osg::ref_ptr > AudioStreams; - void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; } - AudioStreams& getAudioStreams() { return _audioStreams; } - const AudioStreams& getAudioStreams() const { return _audioStreams; } - - - protected: - virtual void applyLoopingMode() {} - - virtual ~ImageStream() {} - - StreamStatus _status; - LoopingMode _loopingMode; - - AudioStreams _audioStreams; -}; - -} // namespace - -#endif diff --git a/libs/lib/mac32/include/osg/ImageUtils b/libs/lib/mac32/include/osg/ImageUtils deleted file mode 100644 index bd4bd7faf007a89430b983be5a05217f215a5d65..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ImageUtils +++ /dev/null @@ -1,160 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_IMAGEUTILS -#define OSG_IMAGEUTILS 1 - -#include - -#include - -namespace osg { - -template -void _readRow(unsigned int num, GLenum pixelFormat, const T* data,float scale, O& operation) -{ - switch(pixelFormat) - { - case(GL_LUMINANCE): { for(unsigned int i=0;i -void readRow(unsigned int num, GLenum pixelFormat, GLenum dataType, const unsigned char* data, O& operation) -{ - switch(dataType) - { - case(GL_BYTE): _readRow(num,pixelFormat, (const char*)data, 1.0f/128.0f, operation); break; - case(GL_UNSIGNED_BYTE): _readRow(num,pixelFormat, (const unsigned char*)data, 1.0f/255.0f, operation); break; - case(GL_SHORT): _readRow(num,pixelFormat, (const short*) data, 1.0f/32768.0f, operation); break; - case(GL_UNSIGNED_SHORT): _readRow(num,pixelFormat, (const unsigned short*)data, 1.0f/65535.0f, operation); break; - case(GL_INT): _readRow(num,pixelFormat, (const int*) data, 1.0f/2147483648.0f, operation); break; - case(GL_UNSIGNED_INT): _readRow(num,pixelFormat, (const unsigned int*) data, 1.0f/4294967295.0f, operation); break; - case(GL_FLOAT): _readRow(num,pixelFormat, (const float*) data, 1.0f, operation); break; - } -} - -template -void readImage(const osg::Image* image, O& operation) -{ - if (!image) return; - - for(int r=0;rr();++r) - { - for(int t=0;tt();++t) - { - readRow(image->s(), image->getPixelFormat(), image->getDataType(), image->data(0,t,r), operation); - } - } -} - -// example ModifyOperator -// struct ModifyOperator -// { -// inline void luminance(float& l) const {} -// inline void alpha(float& a) const {} -// inline void luminance_alpha(float& l,float& a) const {} -// inline void rgb(float& r,float& g,float& b) const {} -// inline void rgba(float& r,float& g,float& b,float& a) const {} -// }; - - -template -void _modifyRow(unsigned int num, GLenum pixelFormat, T* data,float scale, const M& operation) -{ - float inv_scale = 1.0f/scale; - switch(pixelFormat) - { - case(GL_LUMINANCE): { for(unsigned int i=0;i -void modifyRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned char* data, const M& operation) -{ - switch(dataType) - { - case(GL_BYTE): _modifyRow(num,pixelFormat, (char*)data, 1.0f/128.0f, operation); break; - case(GL_UNSIGNED_BYTE): _modifyRow(num,pixelFormat, (unsigned char*)data, 1.0f/255.0f, operation); break; - case(GL_SHORT): _modifyRow(num,pixelFormat, (short*) data, 1.0f/32768.0f, operation); break; - case(GL_UNSIGNED_SHORT): _modifyRow(num,pixelFormat, (unsigned short*)data, 1.0f/65535.0f, operation); break; - case(GL_INT): _modifyRow(num,pixelFormat, (int*) data, 1.0f/2147483648.0f, operation); break; - case(GL_UNSIGNED_INT): _modifyRow(num,pixelFormat, (unsigned int*) data, 1.0f/4294967295.0f, operation); break; - case(GL_FLOAT): _modifyRow(num,pixelFormat, (float*) data, 1.0f, operation); break; - } -} - -template -void modifyImage(osg::Image* image, const M& operation) -{ - if (!image) return; - - for(int r=0;rr();++r) - { - for(int t=0;tt();++t) - { - modifyRow(image->s(), image->getPixelFormat(), image->getDataType(), image->data(0,t,r), operation); - } - } -} - -/** Compute the min max colour values in the image.*/ -extern OSG_EXPORT bool computeMinMax(const osg::Image* image, osg::Vec4& min, osg::Vec4& max); - -/** Compute the min max colour values in the image.*/ -extern OSG_EXPORT bool offsetAndScaleImage(osg::Image* image, const osg::Vec4& offset, const osg::Vec4& scale); - -/** Compute source image to destination image.*/ -extern OSG_EXPORT bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int width, int height, int depth, - osg::Image* destImage, int dest_s, int dest_t, int dest_r, bool doRescale = false); - -/** Compute the min max colour values in the image.*/ -extern OSG_EXPORT bool clearImageToColor(osg::Image* image, const osg::Vec4& colour); - -typedef std::vector< osg::ref_ptr > ImageList; - -/** Search through the list of Images and find the maximum number of components used amoung the images.*/ -extern OSG_EXPORT unsigned int maximimNumOfComponents(const ImageList& imageList); - -/** create a 3D osg::Image from a list of osg::Image.*/ -extern OSG_EXPORT osg::Image* createImage3D(const ImageList& imageList, - GLenum desiredPixelFormat, - int s_maximumImageSize = 1024, - int t_maximumImageSize = 1024, - int r_maximumImageSize = 1024, - bool resizeToPowerOfTwo = false); - -/** create a 3D osg::Image from a list of osg::Image.*/ -extern OSG_EXPORT osg::Image* createImage3DWithAlpha(const ImageList& imageList, - int s_maximumImageSize = 1024, - int t_maximumImageSize = 1024, - int r_maximumImageSize = 1024, - bool resizeToPowerOfTwo = false); - - -} - - -#endif diff --git a/libs/lib/mac32/include/osg/KdTree b/libs/lib/mac32/include/osg/KdTree deleted file mode 100644 index 2ef9add11f0d8006ad05eeb68dbb6b2829fa42c5..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/KdTree +++ /dev/null @@ -1,198 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_KDTREE -#define OSG_KDTREE 1 - -#include -#include - -#include - -namespace osg -{ - -/** Implementation of a kdtree for Geometry leaves, to enable fast intersection tests.*/ -class OSG_EXPORT KdTree : public osg::Shape -{ - public: - - - KdTree(); - - KdTree(const KdTree& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - - META_Shape(osg, KdTree) - - struct OSG_EXPORT BuildOptions - { - BuildOptions(); - - unsigned int _numVerticesProcessed; - unsigned int _targetNumTrianglesPerLeaf; - unsigned int _maxNumLevels; - }; - - - /** Build the kdtree from the specified source geometry object. - * retun true on success. */ - virtual bool build(BuildOptions& buildOptions, osg::Geometry* geometry); - - struct LineSegmentIntersection - { - LineSegmentIntersection(): - ratio(-1.0), - p0(0), - p1(0), - p2(0), - r0(0.0f), - r1(0.0f), - r2(0.0f), - primitiveIndex(0) {} - - bool operator < (const LineSegmentIntersection& rhs) const { return ratio < rhs.ratio; } - - typedef std::vector IndexList; - typedef std::vector RatioList; - - double ratio; - osg::Vec3d intersectionPoint; - osg::Vec3 intersectionNormal; - - unsigned int p0; - unsigned int p1; - unsigned int p2; - float r0; - float r1; - float r2; - - unsigned int primitiveIndex; - }; - - - typedef std::vector LineSegmentIntersections; - - /** compute the intersection of a line segment and the kdtree, return true if an intersection has been found.*/ - virtual bool intersect(const osg::Vec3d& start, const osg::Vec3d& end, LineSegmentIntersections& intersections) const; - - - typedef int value_type; - - struct KdNode - { - KdNode(): - first(0), - second(0) {} - - KdNode(value_type f, value_type s): - first(f), - second(s) {} - - osg::BoundingBox bb; - - value_type first; - value_type second; - }; - - struct Triangle - { - Triangle(): - p0(0),p1(0),p2(0) {} - - Triangle(unsigned int ip0, unsigned int ip1, unsigned int ip2): - p0(ip0), p1(ip1), p2(ip2) {} - - bool operator < (const Triangle& rhs) const - { - if (p0rhs.p0) return false; - if (p1rhs.p1) return false; - return p2 KdNodeList; - typedef std::vector< Triangle > TriangleList; - - int addNode(const KdNode& node) - { - int num = static_cast(_kdNodes.size()); - _kdNodes.push_back(node); - return num; - } - - KdNode& getNode(int nodeNum) { return _kdNodes[nodeNum]; } - const KdNode& getNode(int nodeNum) const { return _kdNodes[nodeNum]; } - - KdNodeList& getNodes() { return _kdNodes; } - const KdNodeList& getNodes() const { return _kdNodes; } - - void setVertices(osg::Vec3Array* vertices) { _vertices = vertices; } - const osg::Vec3Array* getVertices() const { return _vertices.get(); } - - unsigned int addTriangle(const Triangle& tri) - { - unsigned int num = static_cast(_triangles.size()); - _triangles.push_back(tri); - return num; - } - - Triangle& getTriangle(unsigned int i) { return _triangles[i]; } - const Triangle& getTriangle(unsigned int i) const { return _triangles[i]; } - - TriangleList& getTriangles() { return _triangles; } - const TriangleList& getTriangles() const { return _triangles; } - - - protected: - - osg::ref_ptr _vertices; - KdNodeList _kdNodes; - TriangleList _triangles; - -}; - -class OSG_EXPORT KdTreeBuilder : public osg::NodeVisitor -{ - public: - - KdTreeBuilder(); - - KdTreeBuilder(const KdTreeBuilder& rhs); - - META_NodeVisitor("osg","KdTreeBuilder") - - virtual KdTreeBuilder* clone() { return new KdTreeBuilder(*this); } - - void apply(osg::Geode& geode); - - KdTree::BuildOptions _buildOptions; - - osg::ref_ptr _kdTreePrototype; - - - - protected: - - virtual ~KdTreeBuilder() {} - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/LOD b/libs/lib/mac32/include/osg/LOD deleted file mode 100644 index 732de98193c60637121d9910d20fdb683ad00d1a..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/LOD +++ /dev/null @@ -1,140 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_LOD -#define OSG_LOD 1 - -#include - -namespace osg { - -/** LOD - Level Of Detail group node which allows switching between children - depending on distance from eye point. - Typical uses are for load balancing - objects further away from - the eye point are rendered at a lower level of detail, and at times - of high stress on the graphics pipeline lower levels of detail can - also be chosen by adjusting the viewers's Camera/CullSettings LODScale value. - Each child has a corresponding valid range consisting of a minimum - and maximum distance. Given a distance to the viewer (d), LOD displays - a child if min <= d < max. LOD may display multiple children simultaneously - if their corresponding ranges overlap. Children can be in any order, - and don't need to be sorted by range or amount of detail. If the number of - ranges (m) is less than the number of children (n), then children m+1 through - n are ignored. -*/ -class OSG_EXPORT LOD : public Group -{ - public : - - LOD(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - LOD(const LOD&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, LOD); - - typedef osg::BoundingSphere::vec_type vec_type; - typedef osg::BoundingSphere::value_type value_type; - - virtual void traverse(NodeVisitor& nv); - - virtual bool addChild(Node *child); - - virtual bool addChild(Node *child, float min, float max); - - virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1); - - typedef std::pair MinMaxPair; - typedef std::vector RangeList; - - /** Modes which control how the center of object should be determined when computing which child is active.*/ - enum CenterMode - { - USE_BOUNDING_SPHERE_CENTER, - USER_DEFINED_CENTER - }; - - /** Set how the center of object should be determined when computing which child is active.*/ - void setCenterMode(CenterMode mode) { _centerMode=mode; } - - /** Get how the center of object should be determined when computing which child is active.*/ - CenterMode getCenterMode() const { return _centerMode; } - - /** Sets the object-space point which defines the center of the osg::LOD. - center is affected by any transforms in the hierarchy above the osg::LOD.*/ - inline void setCenter(const vec_type& center) { _centerMode=USER_DEFINED_CENTER; _userDefinedCenter = center; } - - /** return the LOD center point. */ - inline const vec_type& getCenter() const { if (_centerMode==USER_DEFINED_CENTER) return _userDefinedCenter; else return getBound().center(); } - - - /** Set the object-space reference radius of the volume enclosed by the LOD. - * Used to determine the bounding sphere of the LOD in the absence of any children.*/ - inline void setRadius(value_type radius) { _radius = radius; } - - /** Get the object-space radius of the volume enclosed by the LOD.*/ - inline value_type getRadius() const { return _radius; } - - - - /** Modes that control how the range values should be interpreted when computing which child is active.*/ - enum RangeMode - { - DISTANCE_FROM_EYE_POINT, - PIXEL_SIZE_ON_SCREEN - }; - - /** Set how the range values should be interpreted when computing which child is active.*/ - void setRangeMode(RangeMode mode) { _rangeMode = mode; } - - /** Get how the range values should be interpreted when computing which child is active.*/ - RangeMode getRangeMode() const { return _rangeMode; } - - - /** Sets the min and max visible ranges of range of specific child. - Values are floating point distance specified in local objects coordinates.*/ - void setRange(unsigned int childNo, float min,float max); - - /** returns the min visible range for specified child.*/ - inline float getMinRange(unsigned int childNo) const { return _rangeList[childNo].first; } - - /** returns the max visible range for specified child.*/ - inline float getMaxRange(unsigned int childNo) const { return _rangeList[childNo].second; } - - /** returns the number of ranges currently set. - * An LOD which has been fully set up will have getNumChildren()==getNumRanges(). */ - inline unsigned int getNumRanges() const { return _rangeList.size(); } - - /** set the list of MinMax ranges for each child.*/ - inline void setRangeList(const RangeList& rangeList) { _rangeList=rangeList; } - - /** return the list of MinMax ranges for each child.*/ - inline const RangeList& getRangeList() const { return _rangeList; } - - virtual BoundingSphere computeBound() const; - - protected : - virtual ~LOD() {} - - CenterMode _centerMode; - vec_type _userDefinedCenter; - value_type _radius; - - RangeMode _rangeMode; - RangeList _rangeList; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Light b/libs/lib/mac32/include/osg/Light deleted file mode 100644 index 58e4bcf2e7f58f468a43eb70d226d3029f07d405..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Light +++ /dev/null @@ -1,199 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_LIGHT -#define OSG_LIGHT 1 - -#include -#include -#include - -#ifndef GL_LIGHT0 - #define GL_LIGHT0 0x4000 - #define GL_LIGHT1 0x4001 - #define GL_LIGHT2 0x4002 - #define GL_LIGHT3 0x4003 - #define GL_LIGHT4 0x4004 - #define GL_LIGHT5 0x4005 - #define GL_LIGHT6 0x4006 - #define GL_LIGHT7 0x4007 -#endif - -#ifndef GL_LIGHTING - #define GL_LIGHTING 0x0B50 -#endif - -namespace osg { - -/** Light state class which encapsulates OpenGL glLight() functionality. */ -class OSG_EXPORT Light : public StateAttribute -{ - public : - - Light(); - - Light(unsigned int lightnum); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - Light(const Light& light,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(light,copyop), - _lightnum(light._lightnum), - _ambient(light._ambient), - _diffuse(light._diffuse), - _specular(light._specular), - _position(light._position), - _direction(light._direction), - _constant_attenuation(light._constant_attenuation), - _linear_attenuation(light._linear_attenuation), - _quadratic_attenuation(light._quadratic_attenuation), - _spot_exponent(light._spot_exponent), - _spot_cutoff(light._spot_cutoff) {} - - virtual osg::Object* cloneType() const { return new Light(_lightnum); } - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new Light(*this,copyop); } - virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "Light"; } - virtual Type getType() const { return LIGHT; } - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(Light,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_lightnum) - COMPARE_StateAttribute_Parameter(_ambient) - COMPARE_StateAttribute_Parameter(_diffuse) - COMPARE_StateAttribute_Parameter(_specular) - COMPARE_StateAttribute_Parameter(_position) - COMPARE_StateAttribute_Parameter(_direction) - COMPARE_StateAttribute_Parameter(_constant_attenuation) - COMPARE_StateAttribute_Parameter(_linear_attenuation) - COMPARE_StateAttribute_Parameter(_quadratic_attenuation) - COMPARE_StateAttribute_Parameter(_spot_exponent) - COMPARE_StateAttribute_Parameter(_spot_cutoff) - - return 0; // passed all the above comparison macros, must be equal. - } - - virtual unsigned int getMember() const { return _lightnum; } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_LIGHT0+_lightnum); - return true; - } - - - - /** Set which OpenGL light to operate on. */ - void setLightNum(int num); - - /** Get which OpenGL light this osg::Light operates on. */ - int getLightNum() const { return _lightnum; } - - /** Set the ambient component of the light. */ - inline void setAmbient( const Vec4& ambient ) { _ambient = ambient; } - - /** Get the ambient component of the light. */ - inline const Vec4& getAmbient() const { return _ambient; } - - /** Set the diffuse component of the light. */ - inline void setDiffuse( const Vec4& diffuse ) { _diffuse = diffuse; } - - /** Get the diffuse component of the light. */ - inline const Vec4& getDiffuse() const { return _diffuse; } - - /** Set the specular component of the light. */ - inline void setSpecular( const Vec4& specular ) { _specular = specular; } - - /** Get the specular component of the light. */ - inline const Vec4& getSpecular() const { return _specular; } - - /** Set the position of the light. */ - inline void setPosition( const Vec4& position ) { _position = position; } - - /** Get the position of the light. */ - inline const Vec4& getPosition() const { return _position; } - - /** Set the direction of the light. */ - inline void setDirection( const Vec3& direction ) { _direction = direction; } - - /** Get the direction of the light. */ - inline const Vec3& getDirection() const { return _direction; } - - /** Set the constant attenuation of the light. */ - inline void setConstantAttenuation( float constant_attenuation ) { _constant_attenuation = constant_attenuation; } - - /** Get the constant attenuation of the light. */ - inline float getConstantAttenuation() const { return _constant_attenuation; } - - /** Set the linear attenuation of the light. */ - inline void setLinearAttenuation ( float linear_attenuation ) { _linear_attenuation = linear_attenuation; } - - /** Get the linear attenuation of the light. */ - inline float getLinearAttenuation () const { return _linear_attenuation; } - - /** Set the quadratic attenuation of the light. */ - inline void setQuadraticAttenuation ( float quadratic_attenuation ) { _quadratic_attenuation = quadratic_attenuation; } - - /** Get the quadratic attenuation of the light. */ - inline float getQuadraticAttenuation() const { return _quadratic_attenuation; } - - /** Set the spot exponent of the light. */ - inline void setSpotExponent( float spot_exponent ) { _spot_exponent = spot_exponent; } - - /** Get the spot exponent of the light. */ - inline float getSpotExponent() const { return _spot_exponent; } - - /** Set the spot cutoff of the light. */ - inline void setSpotCutoff( float spot_cutoff ) { _spot_cutoff = spot_cutoff; } - - /** Get the spot cutoff of the light. */ - inline float getSpotCutoff() const { return _spot_cutoff; } - - /** Capture the lighting settings of the current OpenGL state - * and store them in this object. - */ - void captureLightState(); - - /** Apply the light's state to the OpenGL state machine. */ - virtual void apply(State& state) const; - - protected : - - virtual ~Light(); - - /** Initialize the light's settings with some decent defaults. */ - void init(); - - int _lightnum; // OpenGL light number - - Vec4 _ambient; // r, g, b, w - Vec4 _diffuse; // r, g, b, w - Vec4 _specular; // r, g, b, w - Vec4 _position; // x, y, z, w - Vec3 _direction; // x, y, z - float _constant_attenuation; // constant - float _linear_attenuation; // linear - float _quadratic_attenuation; // quadratic - float _spot_exponent; // exponent - float _spot_cutoff; // spread -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/LightModel b/libs/lib/mac32/include/osg/LightModel deleted file mode 100644 index 310ef7301cf49abe8fbf7d0ab6c0aed9e8d3ec2b..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/LightModel +++ /dev/null @@ -1,95 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_LIGHTMODEL -#define OSG_LIGHTMODEL 1 - -#include -#include - -namespace osg { - -class OSG_EXPORT LightModel : public StateAttribute -{ - public : - - LightModel(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - LightModel(const LightModel& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(lw,copyop), - _ambient(lw._ambient), - _colorControl(lw._colorControl), - _localViewer(lw._localViewer), - _twoSided(lw._twoSided) {} - - - META_StateAttribute(osg, LightModel, LIGHTMODEL); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(LightModel,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_ambient) - COMPARE_StateAttribute_Parameter(_colorControl) - COMPARE_StateAttribute_Parameter(_localViewer) - COMPARE_StateAttribute_Parameter(_twoSided) - - return 0; // passed all the above comparison macros, must be equal. - } - - - void setAmbientIntensity(const osg::Vec4& ambient) { _ambient = ambient; } - const osg::Vec4& getAmbientIntensity() const { return _ambient; } - - - enum ColorControl - { - SEPARATE_SPECULAR_COLOR, - SINGLE_COLOR - }; - - void setColorControl(ColorControl cc) { _colorControl = cc; } - inline ColorControl getColorControl() const { return _colorControl; } - - - void setLocalViewer(bool localViewer) { _localViewer=localViewer; } - inline bool getLocalViewer() const { return _localViewer; } - - - void setTwoSided(bool twoSided) { _twoSided = twoSided; } - inline bool getTwoSided() const { return _twoSided; } - - - - virtual void apply(State& state) const; - - - protected : - - virtual ~LightModel(); - - osg::Vec4 _ambient; - ColorControl _colorControl; - bool _localViewer; - bool _twoSided; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/LightSource b/libs/lib/mac32/include/osg/LightSource deleted file mode 100644 index 1668760397a5ec2fbbee7cc28c98d1e62b1aca6d..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/LightSource +++ /dev/null @@ -1,93 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_LIGHTSOURCE -#define OSG_LIGHTSOURCE 1 - -#include -#include -#include - -namespace osg { - -/** Leaf Node for defining a light in the scene. */ -class OSG_EXPORT LightSource : public Group -{ - public: - - LightSource(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - LightSource(const LightSource& ls, - const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Group(ls,copyop), - _value(ls._value), - _light(dynamic_cast(copyop(ls._light.get()))), - _referenceFrame(ls._referenceFrame) {} - - META_Node(osg, LightSource); - - enum ReferenceFrame - { - RELATIVE_RF, - ABSOLUTE_RF - }; - - /** Set the light sources's ReferenceFrame, either to be relative to its - * parent reference frame, or relative to an absolute coordinate - * frame. RELATIVE_RF is the default. - * Note: setting the ReferenceFrame to be ABSOLUTE_RF will - * also set the CullingActive flag on the light source, and hence all - * of its parents, to false, thereby disabling culling of it and - * all its parents. This is necessary to prevent inappropriate - * culling, but may impact cull times if the absolute light source is - * deep in the scene graph. It is therefore recommended to only use - * absolute light source at the top of the scene. - */ - void setReferenceFrame(ReferenceFrame rf); - - ReferenceFrame getReferenceFrame() const { return _referenceFrame; } - - /** Set the attached light. */ - void setLight(Light* light); - - /** Get the attached light. */ - inline Light* getLight() { return _light.get(); } - - /** Get the const attached light. */ - inline const Light* getLight() const { return _light.get(); } - - /** Set the GLModes on StateSet associated with the LightSource. */ - void setStateSetModes(StateSet&,StateAttribute::GLModeValue) const; - - /** Set up the local StateSet. */ - void setLocalStateSetModes(StateAttribute::GLModeValue value = StateAttribute::ON); - - /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ - virtual void setThreadSafeRefUnref(bool threadSafe); - - virtual BoundingSphere computeBound() const; - - protected: - - virtual ~LightSource(); - - StateAttribute::GLModeValue _value; - ref_ptr _light; - - ReferenceFrame _referenceFrame; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/LineSegment b/libs/lib/mac32/include/osg/LineSegment deleted file mode 100644 index d368cc6e53829bf0f4216db3fca4cc6a851f2b78..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/LineSegment +++ /dev/null @@ -1,101 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_LINESEGMENT -#define OSG_LINESEGMENT 1 - -#include -#include -#include - -namespace osg { - -/** LineSegment class for representing a line segment. */ -class OSG_EXPORT LineSegment : public Referenced -{ - public: - - typedef Vec3d vec_type; - typedef vec_type::value_type value_type; - - LineSegment() {}; - LineSegment(const LineSegment& seg) : Referenced(),_s(seg._s),_e(seg._e) {} - LineSegment(const vec_type& s,const vec_type& e) : _s(s),_e(e) {} - - LineSegment& operator = (const LineSegment& seg) { _s = seg._s; _e = seg._e; return *this; } - - inline void set(const vec_type& s,const vec_type& e) { _s=s; _e=e; } - - inline vec_type& start() { return _s; } - inline const vec_type& start() const { return _s; } - - inline vec_type& end() { return _e; } - inline const vec_type& end() const { return _e; } - - inline bool valid() const { return _s.valid() && _e.valid() && _s!=_e; } - - /** return true if segment intersects BoundingBox. */ - bool intersect(const BoundingBox& bb) const; - - /** return true if segment intersects BoundingBox - * and return the intersection ratios. - */ - bool intersect(const BoundingBox& bb,float& r1,float& r2) const; - - /** return true if segment intersects BoundingBox - * and return the intersection ratios. - */ - bool intersect(const BoundingBox& bb,double& r1,double& r2) const; - - /** return true if segment intersects BoundingSphere. */ - bool intersect(const BoundingSphere& bs) const; - - /** return true if segment intersects BoundingSphere and return the - * intersection ratio. - */ - bool intersect(const BoundingSphere& bs,float& r1,float& r2) const; - - /** return true if segment intersects BoundingSphere and return the - * intersection ratio. - */ - bool intersect(const BoundingSphere& bs,double& r1,double& r2) const; - - /** return true if segment intersects triangle - * and set ratio long segment. - */ - bool intersect(const Vec3f& v1,const Vec3f& v2,const Vec3f& v3,float& r); - - /** return true if segment intersects triangle - * and set ratio long segment. - */ - bool intersect(const Vec3d& v1,const Vec3d& v2,const Vec3d& v3,double& r); - - - /** post multiply a segment by matrix.*/ - inline void mult(const LineSegment& seg,const Matrix& m) { _s = seg._s*m; _e = seg._e*m; } - /** pre multiply a segment by matrix.*/ - inline void mult(const Matrix& m,const LineSegment& seg) { _s = m*seg._s; _e = m*seg._e; } - - protected: - - virtual ~LineSegment(); - - static bool intersectAndClip(vec_type& s,vec_type& e,const BoundingBox& bb); - - vec_type _s; - vec_type _e; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/LineStipple b/libs/lib/mac32/include/osg/LineStipple deleted file mode 100644 index 1179eaa5a5f3340b7f4b7058fce0223fcada9eb6..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/LineStipple +++ /dev/null @@ -1,83 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_LINESTIPPLE -#define OSG_LINESTIPPLE 1 - -#include - -#ifndef GL_LINE_STIPPLE - #define GL_LINE_STIPPLE 0x0B24 -#endif - -namespace osg { - -class OSG_EXPORT LineStipple : public StateAttribute -{ - public : - - LineStipple(); - - LineStipple(GLint factor, GLushort pattern): - _factor(factor), - _pattern(pattern) {} - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - LineStipple(const LineStipple& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(lw,copyop), - _factor(lw._factor), - _pattern(lw._pattern) {} - - META_StateAttribute(osg, LineStipple, LINESTIPPLE); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // check if the types are equal and then create the rhs variable. - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(LineStipple,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_factor) - COMPARE_StateAttribute_Parameter(_pattern) - - return 0; // passed all the above comparison macros, must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_LINE_STIPPLE); - return true; - } - - void setFactor(GLint factor); - inline GLint getFactor() const { return _factor; } - - void setPattern(GLushort pattern); - inline GLushort getPattern() const { return _pattern; } - - virtual void apply(State& state) const; - - - protected : - - virtual ~LineStipple(); - - GLint _factor; - GLushort _pattern; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/LineWidth b/libs/lib/mac32/include/osg/LineWidth deleted file mode 100644 index 61dc926d8082980c5f33dc92b6aeb237c8c592b7..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/LineWidth +++ /dev/null @@ -1,64 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_LINEWIDTH -#define OSG_LINEWIDTH 1 - -#include - -namespace osg { - -/** LineWidth - encapsulates the OpenGL glLineWidth for setting the width of lines in pixels. */ -class OSG_EXPORT LineWidth : public StateAttribute -{ - public : - - LineWidth(float width=1.0f); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - LineWidth(const LineWidth& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY) : - StateAttribute(lw,copyop), - _width(lw._width) {} - - META_StateAttribute(osg, LineWidth, LINEWIDTH); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // check if the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(LineWidth,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_width) - - return 0; // passed all the above comparison macros, must be equal. - } - - void setWidth(float width); - - inline float getWidth() const { return _width; } - - virtual void apply(State& state) const; - - protected : - - virtual ~LineWidth(); - - float _width; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/LogicOp b/libs/lib/mac32/include/osg/LogicOp deleted file mode 100644 index 37677db9e3b5c139966a219bb815c7257cfb982a..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/LogicOp +++ /dev/null @@ -1,113 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_LOGICOP -#define OSG_LOGICOP 1 - -#include - -#ifndef OSG_GL_FIXED_FUNCTION_AVAILABLE - #define GL_CLEAR 0x1500 - #define GL_SET 0x150F - #define GL_COPY 0x1503 - #define GL_COPY_INVERTED 0x150C - #define GL_NOOP 0x1505 - #define GL_AND 0x1501 - #define GL_NAND 0x150E - #define GL_OR 0x1507 - #define GL_NOR 0x1508 - #define GL_XOR 0x1506 - #define GL_EQUIV 0x1509 - #define GL_AND_REVERSE 0x1502 - #define GL_AND_INVERTED 0x1504 - #define GL_OR_REVERSE 0x150B - #define GL_OR_INVERTED 0x150D - #define GL_COLOR_LOGIC_OP 0x0BF2 -#endif - -namespace osg { - -/** Encapsulates OpenGL LogicOp state. */ -class OSG_EXPORT LogicOp : public StateAttribute -{ - public : - - enum Opcode { - CLEAR = GL_CLEAR, - SET = GL_SET, - COPY = GL_COPY, - COPY_INVERTED = GL_COPY_INVERTED, - NOOP = GL_NOOP, - INVERT = GL_INVERT, - AND = GL_AND, - NAND = GL_NAND, - OR = GL_OR, - NOR = GL_NOR, - XOR = GL_XOR, - EQUIV = GL_EQUIV, - AND_REVERSE = GL_AND_REVERSE, - AND_INVERTED = GL_AND_INVERTED, - OR_REVERSE = GL_OR_REVERSE, - OR_INVERTED = GL_OR_INVERTED - }; - - LogicOp(); - - LogicOp(Opcode opcode); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - LogicOp(const LogicOp& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(trans,copyop), - _opcode(trans._opcode){} - - META_StateAttribute(osg, LogicOp,LOGICOP); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // Check for equal types, then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(LogicOp,sa) - - // Compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_opcode) - - return 0; // Passed all the above comparison macros, so must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_COLOR_LOGIC_OP); - return true; - } - - - inline void setOpcode(Opcode opcode) - { - _opcode = opcode; - } - - inline Opcode getOpcode() const { return _opcode; } - - virtual void apply(State& state) const; - - protected : - - virtual ~LogicOp(); - - Opcode _opcode; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Material b/libs/lib/mac32/include/osg/Material deleted file mode 100644 index 6a2f41a0e289d83d962aa3419050753b3a59990c..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Material +++ /dev/null @@ -1,205 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_MATERIAL -#define OSG_MATERIAL 1 - -#include -#include - -#ifndef OSG_GL_FIXED_FUNCTION_AVAILABLE - #define GL_AMBIENT 0x1200 - #define GL_DIFFUSE 0x1201 - #define GL_SPECULAR 0x1202 - #define GL_EMISSION 0x1600 - #define GL_AMBIENT_AND_DIFFUSE 0x1602 - #define GL_COLOR_MATERIAL 0x0B57 -#endif - -namespace osg { -/** Material - encapsulates OpenGL glMaterial state.*/ -class OSG_EXPORT Material : public StateAttribute -{ - public : - - Material(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - Material(const Material& mat,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(mat,copyop), - _colorMode(mat._colorMode), - _ambientFrontAndBack(mat._ambientFrontAndBack), - _ambientFront(mat._ambientFront), - _ambientBack(mat._ambientBack), - _diffuseFrontAndBack(mat._diffuseFrontAndBack), - _diffuseFront(mat._diffuseFront), - _diffuseBack(mat._diffuseBack), - _specularFrontAndBack(mat._specularFrontAndBack), - _specularFront(mat._specularFront), - _specularBack(mat._specularBack), - _emissionFrontAndBack(mat._emissionFrontAndBack), - _emissionFront(mat._emissionFront), - _emissionBack(mat._emissionBack), - _shininessFrontAndBack(mat._shininessFrontAndBack), - _shininessFront(mat._shininessFront), - _shininessBack(mat._shininessBack) {} - - META_StateAttribute(osg, Material, MATERIAL); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(Material,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_colorMode) - COMPARE_StateAttribute_Parameter(_ambientFrontAndBack) - COMPARE_StateAttribute_Parameter(_ambientFront) - COMPARE_StateAttribute_Parameter(_ambientBack) - COMPARE_StateAttribute_Parameter(_diffuseFrontAndBack) - COMPARE_StateAttribute_Parameter(_diffuseFront) - COMPARE_StateAttribute_Parameter(_diffuseBack) - COMPARE_StateAttribute_Parameter(_specularFrontAndBack) - COMPARE_StateAttribute_Parameter(_specularFront) - COMPARE_StateAttribute_Parameter(_specularBack) - COMPARE_StateAttribute_Parameter(_emissionFrontAndBack) - COMPARE_StateAttribute_Parameter(_emissionFront) - COMPARE_StateAttribute_Parameter(_emissionBack) - COMPARE_StateAttribute_Parameter(_shininessFrontAndBack) - COMPARE_StateAttribute_Parameter(_shininessFront) - COMPARE_StateAttribute_Parameter(_shininessBack) - - return 0; // passed all the above comparison macros, must be equal. - } - - Material& operator = (const Material& rhs); - - virtual bool getModeUsage(StateAttribute::ModeUsage& /*usage*/) const - { - // note, since Material does it's own glEnable/glDisable of GL_COLOR_MATERIAL - // we shouldn't declare usage of that mode, so commenting out the below usage. - // usage.usesMode(GL_COLOR_MATERIAL); - return true; - } - - virtual void apply(State& state) const; - - enum Face { - FRONT = GL_FRONT, - BACK = GL_BACK, - FRONT_AND_BACK = GL_FRONT_AND_BACK - }; - - enum ColorMode { - AMBIENT = GL_AMBIENT, - DIFFUSE = GL_DIFFUSE, - SPECULAR = GL_SPECULAR, - EMISSION = GL_EMISSION, - AMBIENT_AND_DIFFUSE = GL_AMBIENT_AND_DIFFUSE, - OFF - }; - - inline void setColorMode(ColorMode mode) { _colorMode = mode; } - inline ColorMode getColorMode() const { return _colorMode; } - - void setAmbient( Face face, const Vec4& ambient ); - const Vec4& getAmbient(Face face) const; - inline bool getAmbientFrontAndBack() const { return _ambientFrontAndBack; } - - void setDiffuse( Face face, const Vec4& diffuse ); - const Vec4& getDiffuse(Face face) const; - inline bool getDiffuseFrontAndBack() const { return _diffuseFrontAndBack; } - - /** Set specular value of specified face(s) of the material, - * valid specular[0..3] range is 0.0 to 1.0. - */ - void setSpecular( Face face, const Vec4& specular ); - - /** Get the specular value for specified face. */ - const Vec4& getSpecular(Face face) const; - - /** Return whether specular values are equal for front and back faces - * or not. - */ - inline bool getSpecularFrontAndBack() const { return _specularFrontAndBack; } - - /** Set emission value of specified face(s) of the material, - * valid emission[0..3] range is 0.0 to 1.0. - */ - void setEmission( Face face, const Vec4& emission ); - - /** Get the emission value for specified face. */ - const Vec4& getEmission(Face face) const; - - /** Return whether emission values are equal for front and back faces - * or not. - */ - inline bool getEmissionFrontAndBack() const { return _emissionFrontAndBack; } - - /** Set shininess of specified face(s) of the material. - * valid shininess range is 0.0 to 128.0. - */ - void setShininess(Face face, float shininess ); - - /** Get the shininess value for specified face. */ - float getShininess(Face face) const; - - /** Return whether shininess values are equal for front and back faces - * or not. - */ - inline bool getShininessFrontAndBack() const { return _shininessFrontAndBack; } - - /** Set the alpha value of ambient, diffuse, specular and emission - * colors of specified face, to 1-transparency. - * Valid transparency range is 0.0 to 1.0. - */ - void setTransparency(Face face,float trans); - - /** Set the alpha value of ambient, diffuse, specular and emission - * colors. Valid transparency range is 0.0 to 1.0. - */ - void setAlpha(Face face,float alpha); - - protected : - - virtual ~Material(); - - ColorMode _colorMode; - - bool _ambientFrontAndBack; - Vec4 _ambientFront; // r, g, b, w - Vec4 _ambientBack; // r, g, b, w - - bool _diffuseFrontAndBack; - Vec4 _diffuseFront; // r, g, b, w - Vec4 _diffuseBack; // r, g, b, w - - bool _specularFrontAndBack; - Vec4 _specularFront; // r, g, b, w - Vec4 _specularBack; // r, g, b, w - - bool _emissionFrontAndBack; - Vec4 _emissionFront; // r, g, b, w - Vec4 _emissionBack; // r, g, b, w - - bool _shininessFrontAndBack; - float _shininessFront; // values 0 - 128.0 - float _shininessBack; // values 0 - 128.0 - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Math b/libs/lib/mac32/include/osg/Math deleted file mode 100644 index 4b8bb8196d873c6d44f2a68ec4f6e622f4ac5f82..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Math +++ /dev/null @@ -1,254 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef __OSG_MATH -#define __OSG_MATH - -#include - -#include - -//certain math functions were not defined until 10.2 -//so this code checks the version so it can add in workarounds for older versions. -#ifdef __APPLE__ -// Using std::isnan will work for OS X, but use of -// and std:: are not necessarily portible with other systems so -// the include of is isolated here. -#include -#include -#if !defined(MAC_OS_X_VERSION_10_2) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2) - // One extra check to verify the gcc version. - // The assumption is that there is no possible way to use gcc 4+ - // on anything less than 10.3.9. So if gcc 4 is in use, this means - // pre-10.2 support is not intended and we need not define APPLE_PRE_10_2. - // The reason for this extra check is that if the user relies on default - // settings, MAC_OS_X_VERSION_MIN_REQUIRED will be set to 1010 and hit - // this code path, but this is probably not what they want if using gcc 4+. - #if (__GNUC__ < 4) - #define APPLE_PRE_10_2 - #endif -#endif -#endif - -#if defined(_MSC_VER) - #include -#endif - -#if defined (sun) || \ - defined (__APPLE__) || \ - (defined (_AIX) && defined (__GNUC__)) - - #include - - #ifndef acosf - inline float acosf(float value) { return static_cast(acos(value)); } - #endif - - #ifndef asinf - inline float asinf(float value) { return static_cast(asin(value)); } - #endif - - #ifndef cosf - inline float cosf(float value) { return static_cast(cos(value)); } - #endif - - #ifndef sinf - inline float sinf(float value) { return static_cast(sin(value)); } - #endif - - #ifndef logf - inline float logf(float value) { return static_cast(log(value)); } - #endif - - #ifndef powf - inline float powf(float value1,float value2) { return static_cast(pow(value1,value2)); } - #endif - - #ifndef sqrtf - inline float sqrtf(float value) { return static_cast(sqrt(value)); } - #endif - - #ifndef fabsf - inline float fabsf(float value) { return static_cast(fabs(value)); } - #endif - - #ifndef atan2f - inline float atan2f(float value1, float value2) { return static_cast(atan2(value1,value2)); } - #endif - - #ifndef fmodf - inline float fmodf(float value1, float value2) { return static_cast(fmod(value1,value2)); } - #endif - - #ifndef tanf - inline float tanf(float value) { return static_cast(tan(value)); } - #endif - -#endif - - -#if defined (sun) || \ - defined (__hpux) || \ - defined (APPLE_PRE_10_2) || \ - (defined (_AIX) && defined (__GNUC__)) - - #ifndef floorf - inline float floorf(float value) { return static_cast(floor(value)); } - #endif - - #ifndef ceilf - inline float ceilf(float value) { return static_cast(ceil(value)); } - #endif - -#endif - -namespace osg { - -// define the standard trig values -#ifdef PI -#undef PI -#undef PI_2 -#undef PI_4 -#endif -const double PI = 3.14159265358979323846; -const double PI_2 = 1.57079632679489661923; -const double PI_4 = 0.78539816339744830962; -const double LN_2 = 0.69314718055994530942; -const double INVLN_2 = 1.0 / LN_2; - - -/** return the minimum of two values, equivalent to std::min. - * std::min not used because of STL implementation under IRIX not - * containing std::min. -*/ -template -inline T absolute(T v) { return v<(T)0?-v:v; } - -/** return true if float lhs and rhs are equivalent, - * meaning that the difference between them is less than an epsilon value - * which defaults to 1e-6. -*/ -inline bool equivalent(float lhs,float rhs,float epsilon=1e-6) - { float delta = rhs-lhs; return delta<0.0f?delta>=-epsilon:delta<=epsilon; } - -/** return true if double lhs and rhs are equivalent, - * meaning that the difference between them is less than an epsilon value - * which defaults to 1e-6. -*/ -inline bool equivalent(double lhs,double rhs,double epsilon=1e-6) - { double delta = rhs-lhs; return delta<0.0?delta>=-epsilon:delta<=epsilon; } - -/** return the minimum of two values, equivalent to std::min. - * std::min not used because of STL implementation under IRIX not containing - * std::min. -*/ -template -inline T minimum(T lhs,T rhs) { return lhs -inline T maximum(T lhs,T rhs) { return lhs>rhs?lhs:rhs; } - -template -inline T clampTo(T v,T minimum,T maximum) - { return vmaximum?maximum:v; } - -template -inline T clampAbove(T v,T minimum) { return v -inline T clampBelow(T v,T maximum) { return v>maximum?maximum:v; } - -template -inline T clampBetween(T v,T minimum, T maximum) - { return clampBelow(clampAbove(v,minimum),maximum); } - -template -inline T sign(T v) { return v<(T)0?(T)-1:(T)1; } - -template -inline T signOrZero(T v) { return v<(T)0 ? (T)-1 : ( v>(T)0 ? (T)1 : 0 ); } - -template -inline T square(T v) { return v*v; } - -template -inline T signedSquare(T v) { return v<(T)0?-v*v:v*v;; } - -inline float inDegrees(float angle) { return angle*(float)PI/180.0f; } -inline double inDegrees(double angle) { return angle*PI/180.0; } - -template -inline T inRadians(T angle) { return angle; } - -inline float DegreesToRadians(float angle) { return angle*(float)PI/180.0f; } -inline double DegreesToRadians(double angle) { return angle*PI/180.0; } - -inline float RadiansToDegrees(float angle) { return angle*180.0f/(float)PI; } -inline double RadiansToDegrees(double angle) { return angle*180.0/PI; } - -inline float round(float v) { return v>=0.0f?floorf(v+0.5f):ceilf(v-0.5f); } -inline double round(double v) { return v>=0.0?floor(v+0.5):ceil(v-0.5); } - -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MWERKS__) - inline bool isNaN(float v) { return _isnan(v)!=0; } - inline bool isNaN(double v) { return _isnan(v)!=0; } -#else - #if defined(__APPLE__) - inline bool isNaN(float v) { return (std::fpclassify(v) == (int)FP_NAN); } - inline bool isNaN(double v) { return (std::fpclassify(v) == (int)FP_NAN); } - #else - // Need to use to std::isnan to avoid undef problem from - inline bool isNaN(float v) { return isnan(v); } - inline bool isNaN(double v) { return isnan(v); } - #endif -#endif - - -/** compute the volume of a tetrahedron. */ -template -inline float computeVolume(const T& a,const T& b,const T& c,const T& d) -{ - return fabsf(((b-c)^(a-b))*(d-b)); -} - -/** compute the volume of a prism. */ -template -inline float computeVolume(const T& f1,const T& f2,const T& f3, - const T& b1,const T& b2,const T& b3) -{ - return computeVolume(f1,f2,f3,b1)+ - computeVolume(b1,b2,b3,f2)+ - computeVolume(b1,b3,f2,f3); -} - -/** Convert a ascii number to a double, ignoring locale settings.*/ -extern OSG_EXPORT double asciiToDouble(const char* str); - -/** Convert a ascii number to a float, ignoring locale settings.*/ -inline float asciiToFloat(const char* str) { return static_cast(asciiToDouble(str)); } - -/** Detect first ascii POSITIVE number in string and convert to double.*/ -extern OSG_EXPORT double findAsciiToDouble(const char* str); - -/** Detect first ascii POSITIVE number in string and convert to double.*/ -inline float findAsciiToFloat(const char* str) { return static_cast(findAsciiToDouble(str)); } - -} - - -#endif // __OSG_MATH - diff --git a/libs/lib/mac32/include/osg/Matrix b/libs/lib/mac32/include/osg/Matrix deleted file mode 100644 index 0e6d93acd24cc436ff45c1a0610895bfd17f4d94..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Matrix +++ /dev/null @@ -1,34 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_MATRIX -#define OSG_MATRIX 1 - -#include -#include -#include - -namespace osg { - -#ifdef OSG_USE_FLOAT_MATRIX - typedef Matrixf Matrix; - typedef RefMatrixf RefMatrix; -#else - typedef Matrixd Matrix; - typedef RefMatrixd RefMatrix; -#endif - -} //namespace osg - - -#endif diff --git a/libs/lib/mac32/include/osg/MatrixTransform b/libs/lib/mac32/include/osg/MatrixTransform deleted file mode 100644 index f63f9e44019323e56a871b97a15bc09cfaeaf586..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/MatrixTransform +++ /dev/null @@ -1,84 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_MATRIXTRANSFORM -#define OSG_MATRIXTRANSFORM 1 - -#include - -namespace osg { - -/** MatrixTransform - is a subclass of Transform which has an osg::Matrix - * which represents a 4x4 transformation of its children from local coordinates - * into the Transform's parent coordinates. -*/ -class OSG_EXPORT MatrixTransform : public Transform -{ - public : - - - MatrixTransform(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - MatrixTransform(const MatrixTransform&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - MatrixTransform(const Matrix& matix); - - META_Node(osg, MatrixTransform); - - virtual MatrixTransform* asMatrixTransform() { return this; } - virtual const MatrixTransform* asMatrixTransform() const { return this; } - - - /** Set the transform's matrix.*/ - void setMatrix(const Matrix& mat) { _matrix = mat; _inverseDirty=true; dirtyBound(); } - - /** Get the matrix. */ - inline const Matrix& getMatrix() const { return _matrix; } - - /** pre multiply the transform's matrix.*/ - void preMult(const Matrix& mat) { _matrix.preMult(mat); _inverseDirty=true; dirtyBound(); } - - /** post multiply the transform's matrix.*/ - void postMult(const Matrix& mat) { _matrix.postMult(mat); _inverseDirty=true; dirtyBound(); } - - /** Get the inverse matrix. */ - inline const Matrix& getInverseMatrix() const - { - if (_inverseDirty) - { - _inverse.invert(_matrix); - _inverseDirty = false; - } - return _inverse; - } - - virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const; - - virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const; - - - protected : - - virtual ~MatrixTransform(); - - Matrix _matrix; - mutable Matrix _inverse; - mutable bool _inverseDirty; - - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Matrixd b/libs/lib/mac32/include/osg/Matrixd deleted file mode 100644 index eb671c52d8d726ed3200188697911e9b447731fe..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Matrixd +++ /dev/null @@ -1,815 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_MATRIXD -#define OSG_MATRIXD 1 - -#include -#include -#include -#include - -namespace osg { - -class Matrixf; - -class OSG_EXPORT Matrixd -{ - public: - - typedef double value_type; - - inline Matrixd() { makeIdentity(); } - inline Matrixd( const Matrixd& mat) { set(mat.ptr()); } - Matrixd( const Matrixf& mat ); - inline explicit Matrixd( float const * const ptr ) { set(ptr); } - inline explicit Matrixd( double const * const ptr ) { set(ptr); } - inline explicit Matrixd( const Quat& quat ) { makeRotate(quat); } - - Matrixd(value_type a00, value_type a01, value_type a02, value_type a03, - value_type a10, value_type a11, value_type a12, value_type a13, - value_type a20, value_type a21, value_type a22, value_type a23, - value_type a30, value_type a31, value_type a32, value_type a33); - - ~Matrixd() {} - - int compare(const Matrixd& m) const; - - bool operator < (const Matrixd& m) const { return compare(m)<0; } - bool operator == (const Matrixd& m) const { return compare(m)==0; } - bool operator != (const Matrixd& m) const { return compare(m)!=0; } - - inline value_type& operator()(int row, int col) { return _mat[row][col]; } - inline value_type operator()(int row, int col) const { return _mat[row][col]; } - - inline bool valid() const { return !isNaN(); } - inline bool isNaN() const { return osg::isNaN(_mat[0][0]) || osg::isNaN(_mat[0][1]) || osg::isNaN(_mat[0][2]) || osg::isNaN(_mat[0][3]) || - osg::isNaN(_mat[1][0]) || osg::isNaN(_mat[1][1]) || osg::isNaN(_mat[1][2]) || osg::isNaN(_mat[1][3]) || - osg::isNaN(_mat[2][0]) || osg::isNaN(_mat[2][1]) || osg::isNaN(_mat[2][2]) || osg::isNaN(_mat[2][3]) || - osg::isNaN(_mat[3][0]) || osg::isNaN(_mat[3][1]) || osg::isNaN(_mat[3][2]) || osg::isNaN(_mat[3][3]); } - - inline Matrixd& operator = (const Matrixd& rhs) - { - if( &rhs == this ) return *this; - set(rhs.ptr()); - return *this; - } - - Matrixd& operator = (const Matrixf& other); - - inline void set(const Matrixd& rhs) { set(rhs.ptr()); } - - void set(const Matrixf& rhs); - - inline void set(float const * const ptr) - { - value_type* local_ptr = (value_type*)_mat; - for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i]; - } - - inline void set(double const * const ptr) - { - value_type* local_ptr = (value_type*)_mat; - for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i]; - } - - void set(value_type a00, value_type a01, value_type a02,value_type a03, - value_type a10, value_type a11, value_type a12,value_type a13, - value_type a20, value_type a21, value_type a22,value_type a23, - value_type a30, value_type a31, value_type a32,value_type a33); - - value_type * ptr() { return (value_type*)_mat; } - const value_type * ptr() const { return (const value_type *)_mat; } - - bool isIdentity() const - { - return _mat[0][0]==1.0 && _mat[0][1]==0.0 && _mat[0][2]==0.0 && _mat[0][3]==0.0 && - _mat[1][0]==0.0 && _mat[1][1]==1.0 && _mat[1][2]==0.0 && _mat[1][3]==0.0 && - _mat[2][0]==0.0 && _mat[2][1]==0.0 && _mat[2][2]==1.0 && _mat[2][3]==0.0 && - _mat[3][0]==0.0 && _mat[3][1]==0.0 && _mat[3][2]==0.0 && _mat[3][3]==1.0; - } - - void makeIdentity(); - - void makeScale( const Vec3f& ); - void makeScale( const Vec3d& ); - void makeScale( value_type, value_type, value_type ); - - void makeTranslate( const Vec3f& ); - void makeTranslate( const Vec3d& ); - void makeTranslate( value_type, value_type, value_type ); - - void makeRotate( const Vec3f& from, const Vec3f& to ); - void makeRotate( const Vec3d& from, const Vec3d& to ); - void makeRotate( value_type angle, const Vec3f& axis ); - void makeRotate( value_type angle, const Vec3d& axis ); - void makeRotate( value_type angle, value_type x, value_type y, value_type z ); - void makeRotate( const Quat& ); - void makeRotate( value_type angle1, const Vec3f& axis1, - value_type angle2, const Vec3f& axis2, - value_type angle3, const Vec3f& axis3); - void makeRotate( value_type angle1, const Vec3d& axis1, - value_type angle2, const Vec3d& axis2, - value_type angle3, const Vec3d& axis3); - - - /** decompose the matrix into translation, rotation, scale and scale orientation.*/ - void decompose( osg::Vec3f& translation, - osg::Quat& rotation, - osg::Vec3f& scale, - osg::Quat& so ) const; - - /** decompose the matrix into translation, rotation, scale and scale orientation.*/ - void decompose( osg::Vec3d& translation, - osg::Quat& rotation, - osg::Vec3d& scale, - osg::Quat& so ) const; - - - /** Set to an orthographic projection. - * See glOrtho for further details. - */ - void makeOrtho(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Get the orthographic settings of the orthographic projection matrix. - * Note, if matrix is not an orthographic matrix then invalid values - * will be returned. - */ - bool getOrtho(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar) const; - - /** Set to a 2D orthographic projection. - * See glOrtho2D for further details. - */ - inline void makeOrtho2D(double left, double right, - double bottom, double top) - { - makeOrtho(left,right,bottom,top,-1.0,1.0); - } - - - /** Set to a perspective projection. - * See glFrustum for further details. - */ - void makeFrustum(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Get the frustum settings of a perspective projection matrix. - * Note, if matrix is not a perspective matrix then invalid values - * will be returned. - */ - bool getFrustum(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar) const; - - /** Set to a symmetrical perspective projection. - * See gluPerspective for further details. - * Aspect ratio is defined as width/height. - */ - void makePerspective(double fovy, double aspectRatio, - double zNear, double zFar); - - /** Get the frustum settings of a symmetric perspective projection - * matrix. - * Return false if matrix is not a perspective matrix, - * where parameter values are undefined. - * Note, if matrix is not a symmetric perspective matrix then the - * shear will be lost. - * Asymmetric matrices occur when stereo, power walls, caves and - * reality center display are used. - * In these configuration one should use the AsFrustum method instead. - */ - bool getPerspective(double& fovy, double& aspectRatio, - double& zNear, double& zFar) const; - - /** Set the position and orientation to be a view matrix, - * using the same convention as gluLookAt. - */ - void makeLookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up); - - /** Get to the position and orientation of a modelview matrix, - * using the same convention as gluLookAt. - */ - void getLookAt(Vec3f& eye,Vec3f& center,Vec3f& up, - value_type lookDistance=1.0f) const; - - /** Get to the position and orientation of a modelview matrix, - * using the same convention as gluLookAt. - */ - void getLookAt(Vec3d& eye,Vec3d& center,Vec3d& up, - value_type lookDistance=1.0f) const; - - /** invert the matrix rhs, automatically select invert_4x3 or invert_4x4. */ - inline bool invert( const Matrixd& rhs) - { - bool is_4x3 = (rhs._mat[0][3]==0.0 && rhs._mat[1][3]==0.0 && rhs._mat[2][3]==0.0 && rhs._mat[3][3]==1.0); - return is_4x3 ? invert_4x3(rhs) : invert_4x4(rhs); - } - - /** 4x3 matrix invert, not right hand column is assumed to be 0,0,0,1. */ - bool invert_4x3( const Matrixd& rhs); - - /** full 4x4 matrix invert. */ - bool invert_4x4( const Matrixd& rhs); - - /** ortho-normalize the 3x3 rotation & scale matrix */ - void orthoNormalize(const Matrixd& rhs); - - // basic utility functions to create new matrices - inline static Matrixd identity( void ); - inline static Matrixd scale( const Vec3f& sv); - inline static Matrixd scale( const Vec3d& sv); - inline static Matrixd scale( value_type sx, value_type sy, value_type sz); - inline static Matrixd translate( const Vec3f& dv); - inline static Matrixd translate( const Vec3d& dv); - inline static Matrixd translate( value_type x, value_type y, value_type z); - inline static Matrixd rotate( const Vec3f& from, const Vec3f& to); - inline static Matrixd rotate( const Vec3d& from, const Vec3d& to); - inline static Matrixd rotate( value_type angle, value_type x, value_type y, value_type z); - inline static Matrixd rotate( value_type angle, const Vec3f& axis); - inline static Matrixd rotate( value_type angle, const Vec3d& axis); - inline static Matrixd rotate( value_type angle1, const Vec3f& axis1, - value_type angle2, const Vec3f& axis2, - value_type angle3, const Vec3f& axis3); - inline static Matrixd rotate( value_type angle1, const Vec3d& axis1, - value_type angle2, const Vec3d& axis2, - value_type angle3, const Vec3d& axis3); - inline static Matrixd rotate( const Quat& quat); - inline static Matrixd inverse( const Matrixd& matrix); - inline static Matrixd orthoNormal(const Matrixd& matrix); - /** Create an orthographic projection matrix. - * See glOrtho for further details. - */ - inline static Matrixd ortho(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Create a 2D orthographic projection. - * See glOrtho for further details. - */ - inline static Matrixd ortho2D(double left, double right, - double bottom, double top); - - /** Create a perspective projection. - * See glFrustum for further details. - */ - inline static Matrixd frustum(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Create a symmetrical perspective projection. - * See gluPerspective for further details. - * Aspect ratio is defined as width/height. - */ - inline static Matrixd perspective(double fovy, double aspectRatio, - double zNear, double zFar); - - /** Create the position and orientation as per a camera, - * using the same convention as gluLookAt. - */ - inline static Matrixd lookAt(const Vec3f& eye, - const Vec3f& center, - const Vec3f& up); - - /** Create the position and orientation as per a camera, - * using the same convention as gluLookAt. - */ - inline static Matrixd lookAt(const Vec3d& eye, - const Vec3d& center, - const Vec3d& up); - - inline Vec3f preMult( const Vec3f& v ) const; - inline Vec3d preMult( const Vec3d& v ) const; - inline Vec3f postMult( const Vec3f& v ) const; - inline Vec3d postMult( const Vec3d& v ) const; - inline Vec3f operator* ( const Vec3f& v ) const; - inline Vec3d operator* ( const Vec3d& v ) const; - inline Vec4f preMult( const Vec4f& v ) const; - inline Vec4d preMult( const Vec4d& v ) const; - inline Vec4f postMult( const Vec4f& v ) const; - inline Vec4d postMult( const Vec4d& v ) const; - inline Vec4f operator* ( const Vec4f& v ) const; - inline Vec4d operator* ( const Vec4d& v ) const; - -#ifdef USE_DEPRECATED_API - inline void set(const Quat& q) { makeRotate(q); } - inline void get(Quat& q) const { q = getRotate(); } -#endif - - void setRotate(const Quat& q); - /** Get the matrix rotation as a Quat. Note that this function - * assumes a non-scaled matrix and will return incorrect results - * for scaled matrixces. Consider decompose() instead. - */ - Quat getRotate() const; - - void setTrans( value_type tx, value_type ty, value_type tz ); - void setTrans( const Vec3f& v ); - void setTrans( const Vec3d& v ); - - inline Vec3d getTrans() const { return Vec3d(_mat[3][0],_mat[3][1],_mat[3][2]); } - - inline Vec3d getScale() const { - Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); - Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); - Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); - return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); - } - - /** apply a 3x3 transform of v*M[0..2,0..2]. */ - inline static Vec3f transform3x3(const Vec3f& v,const Matrixd& m); - - /** apply a 3x3 transform of v*M[0..2,0..2]. */ - inline static Vec3d transform3x3(const Vec3d& v,const Matrixd& m); - - /** apply a 3x3 transform of M[0..2,0..2]*v. */ - inline static Vec3f transform3x3(const Matrixd& m,const Vec3f& v); - - /** apply a 3x3 transform of M[0..2,0..2]*v. */ - inline static Vec3d transform3x3(const Matrixd& m,const Vec3d& v); - - // basic Matrixd multiplication, our workhorse methods. - void mult( const Matrixd&, const Matrixd& ); - void preMult( const Matrixd& ); - void postMult( const Matrixd& ); - - /** Optimized version of preMult(translate(v)); */ - inline void preMultTranslate( const Vec3d& v ); - inline void preMultTranslate( const Vec3f& v ); - /** Optimized version of postMult(translate(v)); */ - inline void postMultTranslate( const Vec3d& v ); - inline void postMultTranslate( const Vec3f& v ); - - /** Optimized version of preMult(scale(v)); */ - inline void preMultScale( const Vec3d& v ); - inline void preMultScale( const Vec3f& v ); - /** Optimized version of postMult(scale(v)); */ - inline void postMultScale( const Vec3d& v ); - inline void postMultScale( const Vec3f& v ); - - /** Optimized version of preMult(rotate(q)); */ - inline void preMultRotate( const Quat& q ); - /** Optimized version of postMult(rotate(q)); */ - inline void postMultRotate( const Quat& q ); - - inline void operator *= ( const Matrixd& other ) - { if( this == &other ) { - Matrixd temp(other); - postMult( temp ); - } - else postMult( other ); - } - - inline Matrixd operator * ( const Matrixd &m ) const - { - osg::Matrixd r; - r.mult(*this,m); - return r; - } - - protected: - value_type _mat[4][4]; - -}; - -class RefMatrixd : public Object, public Matrixd -{ - public: - - RefMatrixd():Object(false), Matrixd() {} - RefMatrixd( const Matrixd& other) : Object(false), Matrixd(other) {} - RefMatrixd( const Matrixf& other) : Object(false), Matrixd(other) {} - RefMatrixd( const RefMatrixd& other) : Object(other), Matrixd(other) {} - explicit RefMatrixd( Matrixd::value_type const * const def ):Object(false), Matrixd(def) {} - RefMatrixd( Matrixd::value_type a00, Matrixd::value_type a01, Matrixd::value_type a02, Matrixd::value_type a03, - Matrixd::value_type a10, Matrixd::value_type a11, Matrixd::value_type a12, Matrixd::value_type a13, - Matrixd::value_type a20, Matrixd::value_type a21, Matrixd::value_type a22, Matrixd::value_type a23, - Matrixd::value_type a30, Matrixd::value_type a31, Matrixd::value_type a32, Matrixd::value_type a33): - Object(false), - Matrixd(a00, a01, a02, a03, - a10, a11, a12, a13, - a20, a21, a22, a23, - a30, a31, a32, a33) {} - - virtual Object* cloneType() const { return new RefMatrixd(); } - virtual Object* clone(const CopyOp&) const { return new RefMatrixd(*this); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "Matrix"; } - - - protected: - - virtual ~RefMatrixd() {} -}; - - -// static utility methods -inline Matrixd Matrixd::identity(void) -{ - Matrixd m; - m.makeIdentity(); - return m; -} - -inline Matrixd Matrixd::scale(value_type sx, value_type sy, value_type sz) -{ - Matrixd m; - m.makeScale(sx,sy,sz); - return m; -} - -inline Matrixd Matrixd::scale(const Vec3f& v ) -{ - return scale(v.x(), v.y(), v.z() ); -} - -inline Matrixd Matrixd::scale(const Vec3d& v ) -{ - return scale(v.x(), v.y(), v.z() ); -} - -inline Matrixd Matrixd::translate(value_type tx, value_type ty, value_type tz) -{ - Matrixd m; - m.makeTranslate(tx,ty,tz); - return m; -} - -inline Matrixd Matrixd::translate(const Vec3f& v ) -{ - return translate(v.x(), v.y(), v.z() ); -} - -inline Matrixd Matrixd::translate(const Vec3d& v ) -{ - return translate(v.x(), v.y(), v.z() ); -} - -inline Matrixd Matrixd::rotate( const Quat& q ) -{ - return Matrixd(q); -} -inline Matrixd Matrixd::rotate(value_type angle, value_type x, value_type y, value_type z ) -{ - Matrixd m; - m.makeRotate(angle,x,y,z); - return m; -} -inline Matrixd Matrixd::rotate(value_type angle, const Vec3f& axis ) -{ - Matrixd m; - m.makeRotate(angle,axis); - return m; -} -inline Matrixd Matrixd::rotate(value_type angle, const Vec3d& axis ) -{ - Matrixd m; - m.makeRotate(angle,axis); - return m; -} -inline Matrixd Matrixd::rotate( value_type angle1, const Vec3f& axis1, - value_type angle2, const Vec3f& axis2, - value_type angle3, const Vec3f& axis3) -{ - Matrixd m; - m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); - return m; -} -inline Matrixd Matrixd::rotate( value_type angle1, const Vec3d& axis1, - value_type angle2, const Vec3d& axis2, - value_type angle3, const Vec3d& axis3) -{ - Matrixd m; - m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); - return m; -} -inline Matrixd Matrixd::rotate(const Vec3f& from, const Vec3f& to ) -{ - Matrixd m; - m.makeRotate(from,to); - return m; -} -inline Matrixd Matrixd::rotate(const Vec3d& from, const Vec3d& to ) -{ - Matrixd m; - m.makeRotate(from,to); - return m; -} - -inline Matrixd Matrixd::inverse( const Matrixd& matrix) -{ - Matrixd m; - m.invert(matrix); - return m; -} - -inline Matrixd Matrixd::orthoNormal(const Matrixd& matrix) -{ - Matrixd m; - m.orthoNormalize(matrix); - return m; -} - -inline Matrixd Matrixd::ortho(double left, double right, - double bottom, double top, - double zNear, double zFar) -{ - Matrixd m; - m.makeOrtho(left,right,bottom,top,zNear,zFar); - return m; -} - -inline Matrixd Matrixd::ortho2D(double left, double right, - double bottom, double top) -{ - Matrixd m; - m.makeOrtho2D(left,right,bottom,top); - return m; -} - -inline Matrixd Matrixd::frustum(double left, double right, - double bottom, double top, - double zNear, double zFar) -{ - Matrixd m; - m.makeFrustum(left,right,bottom,top,zNear,zFar); - return m; -} - -inline Matrixd Matrixd::perspective(double fovy, double aspectRatio, - double zNear, double zFar) -{ - Matrixd m; - m.makePerspective(fovy,aspectRatio,zNear,zFar); - return m; -} - -inline Matrixd Matrixd::lookAt(const Vec3f& eye, - const Vec3f& center, - const Vec3f& up) -{ - Matrixd m; - m.makeLookAt(eye,center,up); - return m; -} - -inline Matrixd Matrixd::lookAt(const Vec3d& eye, - const Vec3d& center, - const Vec3d& up) -{ - Matrixd m; - m.makeLookAt(eye,center,up); - return m; -} - -inline Vec3f Matrixd::postMult( const Vec3f& v ) const -{ - value_type d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; - return Vec3f( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3])*d, - (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3])*d, - (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3])*d) ; -} - -inline Vec3d Matrixd::postMult( const Vec3d& v ) const -{ - value_type d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; - return Vec3d( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3])*d, - (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3])*d, - (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3])*d) ; -} - -inline Vec3f Matrixd::preMult( const Vec3f& v ) const -{ - value_type d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ; - return Vec3f( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0])*d, - (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1])*d, - (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2])*d); -} - -inline Vec3d Matrixd::preMult( const Vec3d& v ) const -{ - value_type d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ; - return Vec3d( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0])*d, - (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1])*d, - (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2])*d); -} - -inline Vec4f Matrixd::postMult( const Vec4f& v ) const -{ - return Vec4f( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3]*v.w()), - (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3]*v.w()), - (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3]*v.w()), - (_mat[3][0]*v.x() + _mat[3][1]*v.y() + _mat[3][2]*v.z() + _mat[3][3]*v.w())) ; -} -inline Vec4d Matrixd::postMult( const Vec4d& v ) const -{ - return Vec4d( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3]*v.w()), - (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3]*v.w()), - (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3]*v.w()), - (_mat[3][0]*v.x() + _mat[3][1]*v.y() + _mat[3][2]*v.z() + _mat[3][3]*v.w())) ; -} - -inline Vec4f Matrixd::preMult( const Vec4f& v ) const -{ - return Vec4f( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0]*v.w()), - (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1]*v.w()), - (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2]*v.w()), - (_mat[0][3]*v.x() + _mat[1][3]*v.y() + _mat[2][3]*v.z() + _mat[3][3]*v.w())); -} - -inline Vec4d Matrixd::preMult( const Vec4d& v ) const -{ - return Vec4d( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0]*v.w()), - (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1]*v.w()), - (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2]*v.w()), - (_mat[0][3]*v.x() + _mat[1][3]*v.y() + _mat[2][3]*v.z() + _mat[3][3]*v.w())); -} - -inline Vec3f Matrixd::transform3x3(const Vec3f& v,const Matrixd& m) -{ - return Vec3f( (m._mat[0][0]*v.x() + m._mat[1][0]*v.y() + m._mat[2][0]*v.z()), - (m._mat[0][1]*v.x() + m._mat[1][1]*v.y() + m._mat[2][1]*v.z()), - (m._mat[0][2]*v.x() + m._mat[1][2]*v.y() + m._mat[2][2]*v.z())); -} -inline Vec3d Matrixd::transform3x3(const Vec3d& v,const Matrixd& m) -{ - return Vec3d( (m._mat[0][0]*v.x() + m._mat[1][0]*v.y() + m._mat[2][0]*v.z()), - (m._mat[0][1]*v.x() + m._mat[1][1]*v.y() + m._mat[2][1]*v.z()), - (m._mat[0][2]*v.x() + m._mat[1][2]*v.y() + m._mat[2][2]*v.z())); -} - -inline Vec3f Matrixd::transform3x3(const Matrixd& m,const Vec3f& v) -{ - return Vec3f( (m._mat[0][0]*v.x() + m._mat[0][1]*v.y() + m._mat[0][2]*v.z()), - (m._mat[1][0]*v.x() + m._mat[1][1]*v.y() + m._mat[1][2]*v.z()), - (m._mat[2][0]*v.x() + m._mat[2][1]*v.y() + m._mat[2][2]*v.z()) ) ; -} -inline Vec3d Matrixd::transform3x3(const Matrixd& m,const Vec3d& v) -{ - return Vec3d( (m._mat[0][0]*v.x() + m._mat[0][1]*v.y() + m._mat[0][2]*v.z()), - (m._mat[1][0]*v.x() + m._mat[1][1]*v.y() + m._mat[1][2]*v.z()), - (m._mat[2][0]*v.x() + m._mat[2][1]*v.y() + m._mat[2][2]*v.z()) ) ; -} - -inline void Matrixd::preMultTranslate( const Vec3d& v ) -{ - for (unsigned i = 0; i < 3; ++i) - { - double tmp = v[i]; - if (tmp == 0) - continue; - _mat[3][0] += tmp*_mat[i][0]; - _mat[3][1] += tmp*_mat[i][1]; - _mat[3][2] += tmp*_mat[i][2]; - _mat[3][3] += tmp*_mat[i][3]; - } -} - -inline void Matrixd::preMultTranslate( const Vec3f& v ) -{ - for (unsigned i = 0; i < 3; ++i) - { - float tmp = v[i]; - if (tmp == 0) - continue; - _mat[3][0] += tmp*_mat[i][0]; - _mat[3][1] += tmp*_mat[i][1]; - _mat[3][2] += tmp*_mat[i][2]; - _mat[3][3] += tmp*_mat[i][3]; - } -} - -inline void Matrixd::postMultTranslate( const Vec3d& v ) -{ - for (unsigned i = 0; i < 3; ++i) - { - double tmp = v[i]; - if (tmp == 0) - continue; - _mat[0][i] += tmp*_mat[0][3]; - _mat[1][i] += tmp*_mat[1][3]; - _mat[2][i] += tmp*_mat[2][3]; - _mat[3][i] += tmp*_mat[3][3]; - } -} - -inline void Matrixd::postMultTranslate( const Vec3f& v ) -{ - for (unsigned i = 0; i < 3; ++i) - { - float tmp = v[i]; - if (tmp == 0) - continue; - _mat[0][i] += tmp*_mat[0][3]; - _mat[1][i] += tmp*_mat[1][3]; - _mat[2][i] += tmp*_mat[2][3]; - _mat[3][i] += tmp*_mat[3][3]; - } -} - -inline void Matrixd::preMultScale( const Vec3d& v ) -{ - _mat[0][0] *= v[0]; _mat[0][1] *= v[0]; _mat[0][2] *= v[0]; _mat[0][3] *= v[0]; - _mat[1][0] *= v[1]; _mat[1][1] *= v[1]; _mat[1][2] *= v[1]; _mat[1][3] *= v[1]; - _mat[2][0] *= v[2]; _mat[2][1] *= v[2]; _mat[2][2] *= v[2]; _mat[2][3] *= v[2]; -} - -inline void Matrixd::preMultScale( const Vec3f& v ) -{ - _mat[0][0] *= v[0]; _mat[0][1] *= v[0]; _mat[0][2] *= v[0]; _mat[0][3] *= v[0]; - _mat[1][0] *= v[1]; _mat[1][1] *= v[1]; _mat[1][2] *= v[1]; _mat[1][3] *= v[1]; - _mat[2][0] *= v[2]; _mat[2][1] *= v[2]; _mat[2][2] *= v[2]; _mat[2][3] *= v[2]; -} - -inline void Matrixd::postMultScale( const Vec3d& v ) -{ - _mat[0][0] *= v[0]; _mat[1][0] *= v[0]; _mat[2][0] *= v[0]; _mat[3][0] *= v[0]; - _mat[0][1] *= v[1]; _mat[1][1] *= v[1]; _mat[2][1] *= v[1]; _mat[3][1] *= v[1]; - _mat[0][2] *= v[2]; _mat[1][2] *= v[2]; _mat[2][2] *= v[2]; _mat[3][2] *= v[2]; -} - -inline void Matrixd::postMultScale( const Vec3f& v ) -{ - _mat[0][0] *= v[0]; _mat[1][0] *= v[0]; _mat[2][0] *= v[0]; _mat[3][0] *= v[0]; - _mat[0][1] *= v[1]; _mat[1][1] *= v[1]; _mat[2][1] *= v[1]; _mat[3][1] *= v[1]; - _mat[0][2] *= v[2]; _mat[1][2] *= v[2]; _mat[2][2] *= v[2]; _mat[3][2] *= v[2]; -} - -inline void Matrixd::preMultRotate( const Quat& q ) -{ - if (q.zeroRotation()) - return; - Matrixd r; - r.setRotate(q); - preMult(r); -} - -inline void Matrixd::postMultRotate( const Quat& q ) -{ - if (q.zeroRotation()) - return; - Matrixd r; - r.setRotate(q); - postMult(r); -} - -inline Vec3f operator* (const Vec3f& v, const Matrixd& m ) -{ - return m.preMult(v); -} - -inline Vec3d operator* (const Vec3d& v, const Matrixd& m ) -{ - return m.preMult(v); -} - -inline Vec4f operator* (const Vec4f& v, const Matrixd& m ) -{ - return m.preMult(v); -} - -inline Vec4d operator* (const Vec4d& v, const Matrixd& m ) -{ - return m.preMult(v); -} - -inline Vec3f Matrixd::operator* (const Vec3f& v) const -{ - return postMult(v); -} - -inline Vec3d Matrixd::operator* (const Vec3d& v) const -{ - return postMult(v); -} - -inline Vec4f Matrixd::operator* (const Vec4f& v) const -{ - return postMult(v); -} - -inline Vec4d Matrixd::operator* (const Vec4d& v) const -{ - return postMult(v); -} - - -} //namespace osg - - -#endif diff --git a/libs/lib/mac32/include/osg/Matrixf b/libs/lib/mac32/include/osg/Matrixf deleted file mode 100644 index 8a4d3cd7accef3e2c02e2cb09e454d09bb369e13..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Matrixf +++ /dev/null @@ -1,914 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_MATRIXF -#define OSG_MATRIXF 1 - -#include -#include -#include -#include - -namespace osg { - -class Matrixf; - -class OSG_EXPORT Matrixf -{ - public: - - typedef float value_type; - - inline Matrixf() { makeIdentity(); } - inline Matrixf( const Matrixf& mat) { set(mat.ptr()); } - Matrixf( const Matrixd& mat ); - inline explicit Matrixf( float const * const ptr ) { set(ptr); } - inline explicit Matrixf( double const * const ptr ) { set(ptr); } - inline explicit Matrixf( const Quat& quat ) { makeRotate(quat); } - - Matrixf( value_type a00, value_type a01, value_type a02, value_type a03, - value_type a10, value_type a11, value_type a12, value_type a13, - value_type a20, value_type a21, value_type a22, value_type a23, - value_type a30, value_type a31, value_type a32, value_type a33); - - ~Matrixf() {} - - int compare(const Matrixf& m) const; - - bool operator < (const Matrixf& m) const { return compare(m)<0; } - bool operator == (const Matrixf& m) const { return compare(m)==0; } - bool operator != (const Matrixf& m) const { return compare(m)!=0; } - - inline value_type& operator()(int row, int col) { return _mat[row][col]; } - inline value_type operator()(int row, int col) const { return _mat[row][col]; } - - inline bool valid() const { return !isNaN(); } - inline bool isNaN() const { return osg::isNaN(_mat[0][0]) || osg::isNaN(_mat[0][1]) || osg::isNaN(_mat[0][2]) || osg::isNaN(_mat[0][3]) || - osg::isNaN(_mat[1][0]) || osg::isNaN(_mat[1][1]) || osg::isNaN(_mat[1][2]) || osg::isNaN(_mat[1][3]) || - osg::isNaN(_mat[2][0]) || osg::isNaN(_mat[2][1]) || osg::isNaN(_mat[2][2]) || osg::isNaN(_mat[2][3]) || - osg::isNaN(_mat[3][0]) || osg::isNaN(_mat[3][1]) || osg::isNaN(_mat[3][2]) || osg::isNaN(_mat[3][3]); } - - inline Matrixf& operator = (const Matrixf& rhs) - { - if( &rhs == this ) return *this; - set(rhs.ptr()); - return *this; - } - - Matrixf& operator = (const Matrixd& other); - - inline void set(const Matrixf& rhs) { set(rhs.ptr()); } - - void set(const Matrixd& rhs); - - inline void set(float const * const ptr) - { - value_type* local_ptr = (value_type*)_mat; - for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i]; - } - - inline void set(double const * const ptr) - { - value_type* local_ptr = (value_type*)_mat; - for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i]; - } - - void set(value_type a00, value_type a01, value_type a02,value_type a03, - value_type a10, value_type a11, value_type a12,value_type a13, - value_type a20, value_type a21, value_type a22,value_type a23, - value_type a30, value_type a31, value_type a32,value_type a33); - - value_type * ptr() { return (value_type*)_mat; } - const value_type * ptr() const { return (const value_type *)_mat; } - - bool isIdentity() const - { - return _mat[0][0]==1.0f && _mat[0][1]==0.0f && _mat[0][2]==0.0f && _mat[0][3]==0.0f && - _mat[1][0]==0.0f && _mat[1][1]==1.0f && _mat[1][2]==0.0f && _mat[1][3]==0.0f && - _mat[2][0]==0.0f && _mat[2][1]==0.0f && _mat[2][2]==1.0f && _mat[2][3]==0.0f && - _mat[3][0]==0.0f && _mat[3][1]==0.0f && _mat[3][2]==0.0f && _mat[3][3]==1.0f; - } - - void makeIdentity(); - - void makeScale( const Vec3f& ); - void makeScale( const Vec3d& ); - void makeScale( value_type, value_type, value_type ); - - void makeTranslate( const Vec3f& ); - void makeTranslate( const Vec3d& ); - void makeTranslate( value_type, value_type, value_type ); - - void makeRotate( const Vec3f& from, const Vec3f& to ); - void makeRotate( const Vec3d& from, const Vec3d& to ); - void makeRotate( value_type angle, const Vec3f& axis ); - void makeRotate( value_type angle, const Vec3d& axis ); - void makeRotate( value_type angle, value_type x, value_type y, value_type z ); - void makeRotate( const Quat& ); - void makeRotate( value_type angle1, const Vec3f& axis1, - value_type angle2, const Vec3f& axis2, - value_type angle3, const Vec3f& axis3); - void makeRotate( value_type angle1, const Vec3d& axis1, - value_type angle2, const Vec3d& axis2, - value_type angle3, const Vec3d& axis3); - - - /** decompose the matrix into translation, rotation, scale and scale orientation.*/ - void decompose( osg::Vec3f& translation, - osg::Quat& rotation, - osg::Vec3f& scale, - osg::Quat& so ) const; - - /** decompose the matrix into translation, rotation, scale and scale orientation.*/ - void decompose( osg::Vec3d& translation, - osg::Quat& rotation, - osg::Vec3d& scale, - osg::Quat& so ) const; - - - /** Set to an orthographic projection. - * See glOrtho for further details. - */ - void makeOrtho(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Get the orthographic settings of the orthographic projection matrix. - * Note, if matrix is not an orthographic matrix then invalid values - * will be returned. - */ - bool getOrtho(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar) const; - - /** Set to a 2D orthographic projection. - * See glOrtho2D for further details. - */ - inline void makeOrtho2D(double left, double right, - double bottom, double top) - { - makeOrtho(left,right,bottom,top,-1.0,1.0); - } - - - /** Set to a perspective projection. - * See glFrustum for further details. - */ - void makeFrustum(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Get the frustum settings of a perspective projection matrix. - * Note, if matrix is not a perspective matrix then invalid values - * will be returned. - */ - bool getFrustum(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar) const; - - /** Set to a symmetrical perspective projection. - * See gluPerspective for further details. - * Aspect ratio is defined as width/height. - */ - void makePerspective(double fovy, double aspectRatio, - double zNear, double zFar); - - /** Get the frustum settings of a symmetric perspective projection - * matrix. - * Return false if matrix is not a perspective matrix, - * where parameter values are undefined. - * Note, if matrix is not a symmetric perspective matrix then the - * shear will be lost. - * Asymmetric matrices occur when stereo, power walls, caves and - * reality center display are used. - * In these configuration one should use the AsFrustum method instead. - */ - bool getPerspective(double& fovy, double& aspectRatio, - double& zNear, double& zFar) const; - - /** Set the position and orientation to be a view matrix, - * using the same convention as gluLookAt. - */ - void makeLookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up); - - /** Get to the position and orientation of a modelview matrix, - * using the same convention as gluLookAt. - */ - void getLookAt(Vec3f& eye,Vec3f& center,Vec3f& up, - value_type lookDistance=1.0f) const; - - /** Get to the position and orientation of a modelview matrix, - * using the same convention as gluLookAt. - */ - void getLookAt(Vec3d& eye,Vec3d& center,Vec3d& up, - value_type lookDistance=1.0f) const; - - /** invert the matrix rhs, automatically select invert_4x3 or invert_4x4. */ - inline bool invert( const Matrixf& rhs) - { - bool is_4x3 = (rhs._mat[0][3]==0.0f && rhs._mat[1][3]==0.0f && rhs._mat[2][3]==0.0f && rhs._mat[3][3]==1.0f); - return is_4x3 ? invert_4x3(rhs) : invert_4x4(rhs); - } - - /** 4x3 matrix invert, not right hand column is assumed to be 0,0,0,1. */ - bool invert_4x3( const Matrixf& rhs); - - /** full 4x4 matrix invert. */ - bool invert_4x4( const Matrixf& rhs); - - /** ortho-normalize the 3x3 rotation & scale matrix */ - void orthoNormalize(const Matrixf& rhs); - - //basic utility functions to create new matrices - inline static Matrixf identity( void ); - inline static Matrixf scale( const Vec3f& sv); - inline static Matrixf scale( const Vec3d& sv); - inline static Matrixf scale( value_type sx, value_type sy, value_type sz); - inline static Matrixf translate( const Vec3f& dv); - inline static Matrixf translate( const Vec3d& dv); - inline static Matrixf translate( value_type x, value_type y, value_type z); - inline static Matrixf rotate( const Vec3f& from, const Vec3f& to); - inline static Matrixf rotate( const Vec3d& from, const Vec3d& to); - inline static Matrixf rotate( value_type angle, value_type x, value_type y, value_type z); - inline static Matrixf rotate( value_type angle, const Vec3f& axis); - inline static Matrixf rotate( value_type angle, const Vec3d& axis); - inline static Matrixf rotate( value_type angle1, const Vec3f& axis1, - value_type angle2, const Vec3f& axis2, - value_type angle3, const Vec3f& axis3); - inline static Matrixf rotate( value_type angle1, const Vec3d& axis1, - value_type angle2, const Vec3d& axis2, - value_type angle3, const Vec3d& axis3); - inline static Matrixf rotate( const Quat& quat); - inline static Matrixf inverse( const Matrixf& matrix); - inline static Matrixf orthoNormal(const Matrixf& matrix); - - /** Create an orthographic projection matrix. - * See glOrtho for further details. - */ - inline static Matrixf ortho(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Create a 2D orthographic projection. - * See glOrtho for further details. - */ - inline static Matrixf ortho2D(double left, double right, - double bottom, double top); - - /** Create a perspective projection. - * See glFrustum for further details. - */ - inline static Matrixf frustum(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Create a symmetrical perspective projection. - * See gluPerspective for further details. - * Aspect ratio is defined as width/height. - */ - inline static Matrixf perspective(double fovy, double aspectRatio, - double zNear, double zFar); - - /** Create the position and orientation as per a camera, - * using the same convention as gluLookAt. - */ - inline static Matrixf lookAt(const Vec3f& eye, - const Vec3f& center, - const Vec3f& up); - - /** Create the position and orientation as per a camera, - * using the same convention as gluLookAt. - */ - inline static Matrixf lookAt(const Vec3d& eye, - const Vec3d& center, - const Vec3d& up); - - inline Vec3f preMult( const Vec3f& v ) const; - inline Vec3d preMult( const Vec3d& v ) const; - inline Vec3f postMult( const Vec3f& v ) const; - inline Vec3d postMult( const Vec3d& v ) const; - inline Vec3f operator* ( const Vec3f& v ) const; - inline Vec3d operator* ( const Vec3d& v ) const; - inline Vec4f preMult( const Vec4f& v ) const; - inline Vec4d preMult( const Vec4d& v ) const; - inline Vec4f postMult( const Vec4f& v ) const; - inline Vec4d postMult( const Vec4d& v ) const; - inline Vec4f operator* ( const Vec4f& v ) const; - inline Vec4d operator* ( const Vec4d& v ) const; - -#ifdef USE_DEPRECATED_API - inline void set(const Quat& q) { makeRotate(q); } - inline void get(Quat& q) const { q = getRotate(); } -#endif - - void setRotate(const Quat& q); - /** Get the matrix rotation as a Quat. Note that this function - * assumes a non-scaled matrix and will return incorrect results - * for scaled matrixces. Consider decompose() instead. - */ - Quat getRotate() const; - - - void setTrans( value_type tx, value_type ty, value_type tz ); - void setTrans( const Vec3f& v ); - void setTrans( const Vec3d& v ); - - inline Vec3d getTrans() const { return Vec3d(_mat[3][0],_mat[3][1],_mat[3][2]); } - - inline Vec3d getScale() const { - Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); - Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); - Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); - return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); - } - - /** apply a 3x3 transform of v*M[0..2,0..2]. */ - inline static Vec3f transform3x3(const Vec3f& v,const Matrixf& m); - - /** apply a 3x3 transform of v*M[0..2,0..2]. */ - inline static Vec3d transform3x3(const Vec3d& v,const Matrixf& m); - - /** apply a 3x3 transform of M[0..2,0..2]*v. */ - inline static Vec3f transform3x3(const Matrixf& m,const Vec3f& v); - - /** apply a 3x3 transform of M[0..2,0..2]*v. */ - inline static Vec3d transform3x3(const Matrixf& m,const Vec3d& v); - - // basic Matrixf multiplication, our workhorse methods. - void mult( const Matrixf&, const Matrixf& ); - void preMult( const Matrixf& ); - void postMult( const Matrixf& ); - - /** Optimized version of preMult(translate(v)); */ - inline void preMultTranslate( const Vec3d& v ); - inline void preMultTranslate( const Vec3f& v ); - /** Optimized version of postMult(translate(v)); */ - inline void postMultTranslate( const Vec3d& v ); - inline void postMultTranslate( const Vec3f& v ); - - /** Optimized version of preMult(scale(v)); */ - inline void preMultScale( const Vec3d& v ); - inline void preMultScale( const Vec3f& v ); - /** Optimized version of postMult(scale(v)); */ - inline void postMultScale( const Vec3d& v ); - inline void postMultScale( const Vec3f& v ); - - /** Optimized version of preMult(rotate(q)); */ - inline void preMultRotate( const Quat& q ); - /** Optimized version of postMult(rotate(q)); */ - inline void postMultRotate( const Quat& q ); - - inline void operator *= ( const Matrixf& other ) - { if( this == &other ) { - Matrixf temp(other); - postMult( temp ); - } - else postMult( other ); - } - - inline Matrixf operator * ( const Matrixf &m ) const - { - osg::Matrixf r; - r.mult(*this,m); - return r; - } - - /** Multiply by scalar. */ - inline Matrixf operator * (value_type rhs) const - { - return Matrixf( - _mat[0][0]*rhs, _mat[0][1]*rhs, _mat[0][2]*rhs, _mat[0][3]*rhs, - _mat[1][0]*rhs, _mat[1][1]*rhs, _mat[1][2]*rhs, _mat[1][3]*rhs, - _mat[2][0]*rhs, _mat[2][1]*rhs, _mat[2][2]*rhs, _mat[2][3]*rhs, - _mat[3][0]*rhs, _mat[3][1]*rhs, _mat[3][2]*rhs, _mat[3][3]*rhs); - } - - /** Unary multiply by scalar. */ - inline Matrixf& operator *= (value_type rhs) - { - _mat[0][0]*=rhs; - _mat[0][1]*=rhs; - _mat[0][2]*=rhs; - _mat[0][3]*=rhs; - _mat[1][0]*=rhs; - _mat[1][1]*=rhs; - _mat[1][2]*=rhs; - _mat[1][3]*=rhs; - _mat[2][0]*=rhs; - _mat[2][1]*=rhs; - _mat[2][2]*=rhs; - _mat[2][3]*=rhs; - _mat[3][0]*=rhs; - _mat[3][1]*=rhs; - _mat[3][2]*=rhs; - _mat[3][3]*=rhs; - return *this; - } - - /** Divide by scalar. */ - inline Matrixf operator / (value_type rhs) const - { - return Matrixf( - _mat[0][0]/rhs, _mat[0][1]/rhs, _mat[0][2]/rhs, _mat[0][3]/rhs, - _mat[1][0]/rhs, _mat[1][1]/rhs, _mat[1][2]/rhs, _mat[1][3]/rhs, - _mat[2][0]/rhs, _mat[2][1]/rhs, _mat[2][2]/rhs, _mat[2][3]/rhs, - _mat[3][0]/rhs, _mat[3][1]/rhs, _mat[3][2]/rhs, _mat[3][3]/rhs); - } - - /** Unary divide by scalar. */ - inline Matrixf& operator /= (value_type rhs) - { - _mat[0][0]/=rhs; - _mat[0][1]/=rhs; - _mat[0][2]/=rhs; - _mat[0][3]/=rhs; - _mat[1][0]/=rhs; - _mat[1][1]/=rhs; - _mat[1][2]/=rhs; - _mat[1][3]/=rhs; - _mat[2][0]/=rhs; - _mat[2][1]/=rhs; - _mat[2][2]/=rhs; - _mat[2][3]/=rhs; - _mat[3][0]/=rhs; - _mat[3][1]/=rhs; - _mat[3][2]/=rhs; - _mat[3][3]/=rhs; - return *this; - } - - /** Binary vector add. */ - inline Matrixf operator + (const Matrixf& rhs) const - { - return Matrixf( - _mat[0][0] + rhs._mat[0][0], - _mat[0][1] + rhs._mat[0][1], - _mat[0][2] + rhs._mat[0][2], - _mat[0][3] + rhs._mat[0][3], - _mat[1][0] + rhs._mat[1][0], - _mat[1][1] + rhs._mat[1][1], - _mat[1][2] + rhs._mat[1][2], - _mat[1][3] + rhs._mat[1][3], - _mat[2][0] + rhs._mat[2][0], - _mat[2][1] + rhs._mat[2][1], - _mat[2][2] + rhs._mat[2][2], - _mat[2][3] + rhs._mat[2][3], - _mat[3][0] + rhs._mat[3][0], - _mat[3][1] + rhs._mat[3][1], - _mat[3][2] + rhs._mat[3][2], - _mat[3][3] + rhs._mat[3][3]); - } - - /** Unary vector add. Slightly more efficient because no temporary - * intermediate object. - */ - inline Matrixf& operator += (const Matrixf& rhs) - { - _mat[0][0] += rhs._mat[0][0]; - _mat[0][1] += rhs._mat[0][1]; - _mat[0][2] += rhs._mat[0][2]; - _mat[0][3] += rhs._mat[0][3]; - _mat[1][0] += rhs._mat[1][0]; - _mat[1][1] += rhs._mat[1][1]; - _mat[1][2] += rhs._mat[1][2]; - _mat[1][3] += rhs._mat[1][3]; - _mat[2][0] += rhs._mat[2][0]; - _mat[2][1] += rhs._mat[2][1]; - _mat[2][2] += rhs._mat[2][2]; - _mat[2][3] += rhs._mat[2][3]; - _mat[3][0] += rhs._mat[3][0]; - _mat[3][1] += rhs._mat[3][1]; - _mat[3][2] += rhs._mat[3][2]; - _mat[3][3] += rhs._mat[3][3]; - return *this; - } - - protected: - value_type _mat[4][4]; - -}; - -class RefMatrixf : public Object, public Matrixf -{ - public: - - RefMatrixf():Object(false), Matrixf() {} - RefMatrixf( const Matrixf& other) : Object(false), Matrixf(other) {} - RefMatrixf( const Matrixd& other) : Object(false), Matrixf(other) {} - RefMatrixf( const RefMatrixf& other) : Object(other), Matrixf(other) {} - explicit RefMatrixf( Matrixf::value_type const * const def ):Object(false), Matrixf(def) {} - RefMatrixf( Matrixf::value_type a00, Matrixf::value_type a01, Matrixf::value_type a02, Matrixf::value_type a03, - Matrixf::value_type a10, Matrixf::value_type a11, Matrixf::value_type a12, Matrixf::value_type a13, - Matrixf::value_type a20, Matrixf::value_type a21, Matrixf::value_type a22, Matrixf::value_type a23, - Matrixf::value_type a30, Matrixf::value_type a31, Matrixf::value_type a32, Matrixf::value_type a33): - Object(false), - Matrixf(a00, a01, a02, a03, - a10, a11, a12, a13, - a20, a21, a22, a23, - a30, a31, a32, a33) {} - - virtual Object* cloneType() const { return new RefMatrixf(); } - virtual Object* clone(const CopyOp&) const { return new RefMatrixf(*this); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "Matrix"; } - - - protected: - - virtual ~RefMatrixf() {} -}; - - -//static utility methods -inline Matrixf Matrixf::identity(void) -{ - Matrixf m; - m.makeIdentity(); - return m; -} - -inline Matrixf Matrixf::scale(value_type sx, value_type sy, value_type sz) -{ - Matrixf m; - m.makeScale(sx,sy,sz); - return m; -} - -inline Matrixf Matrixf::scale(const Vec3f& v ) -{ - return scale(v.x(), v.y(), v.z() ); -} - -inline Matrixf Matrixf::scale(const Vec3d& v ) -{ - return scale(v.x(), v.y(), v.z() ); -} - -inline Matrixf Matrixf::translate(value_type tx, value_type ty, value_type tz) -{ - Matrixf m; - m.makeTranslate(tx,ty,tz); - return m; -} - -inline Matrixf Matrixf::translate(const Vec3f& v ) -{ - return translate(v.x(), v.y(), v.z() ); -} - -inline Matrixf Matrixf::translate(const Vec3d& v ) -{ - return translate(v.x(), v.y(), v.z() ); -} - -inline Matrixf Matrixf::rotate( const Quat& q ) -{ - return Matrixf(q); -} -inline Matrixf Matrixf::rotate(value_type angle, value_type x, value_type y, value_type z ) -{ - Matrixf m; - m.makeRotate(angle,x,y,z); - return m; -} -inline Matrixf Matrixf::rotate(value_type angle, const Vec3f& axis ) -{ - Matrixf m; - m.makeRotate(angle,axis); - return m; -} -inline Matrixf Matrixf::rotate(value_type angle, const Vec3d& axis ) -{ - Matrixf m; - m.makeRotate(angle,axis); - return m; -} -inline Matrixf Matrixf::rotate( value_type angle1, const Vec3f& axis1, - value_type angle2, const Vec3f& axis2, - value_type angle3, const Vec3f& axis3) -{ - Matrixf m; - m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); - return m; -} -inline Matrixf Matrixf::rotate( value_type angle1, const Vec3d& axis1, - value_type angle2, const Vec3d& axis2, - value_type angle3, const Vec3d& axis3) -{ - Matrixf m; - m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); - return m; -} -inline Matrixf Matrixf::rotate(const Vec3f& from, const Vec3f& to ) -{ - Matrixf m; - m.makeRotate(from,to); - return m; -} -inline Matrixf Matrixf::rotate(const Vec3d& from, const Vec3d& to ) -{ - Matrixf m; - m.makeRotate(from,to); - return m; -} - -inline Matrixf Matrixf::inverse( const Matrixf& matrix) -{ - Matrixf m; - m.invert(matrix); - return m; -} - -inline Matrixf Matrixf::orthoNormal(const Matrixf& matrix) -{ - Matrixf m; - m.orthoNormalize(matrix); - return m; -} - -inline Matrixf Matrixf::ortho(double left, double right, - double bottom, double top, - double zNear, double zFar) -{ - Matrixf m; - m.makeOrtho(left,right,bottom,top,zNear,zFar); - return m; -} - -inline Matrixf Matrixf::ortho2D(double left, double right, - double bottom, double top) -{ - Matrixf m; - m.makeOrtho2D(left,right,bottom,top); - return m; -} - -inline Matrixf Matrixf::frustum(double left, double right, - double bottom, double top, - double zNear, double zFar) -{ - Matrixf m; - m.makeFrustum(left,right,bottom,top,zNear,zFar); - return m; -} - -inline Matrixf Matrixf::perspective(double fovy,double aspectRatio, - double zNear, double zFar) -{ - Matrixf m; - m.makePerspective(fovy,aspectRatio,zNear,zFar); - return m; -} - -inline Matrixf Matrixf::lookAt(const Vec3f& eye,const Vec3f& center,const Vec3f& up) -{ - Matrixf m; - m.makeLookAt(eye,center,up); - return m; -} - -inline Matrixf Matrixf::lookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up) -{ - Matrixf m; - m.makeLookAt(eye,center,up); - return m; -} - -inline Vec3f Matrixf::postMult( const Vec3f& v ) const -{ - value_type d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; - return Vec3f( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3])*d, - (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3])*d, - (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3])*d) ; -} -inline Vec3d Matrixf::postMult( const Vec3d& v ) const -{ - value_type d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; - return Vec3d( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3])*d, - (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3])*d, - (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3])*d) ; -} - -inline Vec3f Matrixf::preMult( const Vec3f& v ) const -{ - value_type d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ; - return Vec3f( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0])*d, - (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1])*d, - (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2])*d); -} -inline Vec3d Matrixf::preMult( const Vec3d& v ) const -{ - value_type d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ; - return Vec3d( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0])*d, - (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1])*d, - (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2])*d); -} - -inline Vec4f Matrixf::postMult( const Vec4f& v ) const -{ - return Vec4f( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3]*v.w()), - (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3]*v.w()), - (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3]*v.w()), - (_mat[3][0]*v.x() + _mat[3][1]*v.y() + _mat[3][2]*v.z() + _mat[3][3]*v.w())) ; -} -inline Vec4d Matrixf::postMult( const Vec4d& v ) const -{ - return Vec4d( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3]*v.w()), - (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3]*v.w()), - (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3]*v.w()), - (_mat[3][0]*v.x() + _mat[3][1]*v.y() + _mat[3][2]*v.z() + _mat[3][3]*v.w())) ; -} - -inline Vec4f Matrixf::preMult( const Vec4f& v ) const -{ - return Vec4f( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0]*v.w()), - (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1]*v.w()), - (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2]*v.w()), - (_mat[0][3]*v.x() + _mat[1][3]*v.y() + _mat[2][3]*v.z() + _mat[3][3]*v.w())); -} -inline Vec4d Matrixf::preMult( const Vec4d& v ) const -{ - return Vec4d( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0]*v.w()), - (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1]*v.w()), - (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2]*v.w()), - (_mat[0][3]*v.x() + _mat[1][3]*v.y() + _mat[2][3]*v.z() + _mat[3][3]*v.w())); -} -inline Vec3f Matrixf::transform3x3(const Vec3f& v,const Matrixf& m) -{ - return Vec3f( (m._mat[0][0]*v.x() + m._mat[1][0]*v.y() + m._mat[2][0]*v.z()), - (m._mat[0][1]*v.x() + m._mat[1][1]*v.y() + m._mat[2][1]*v.z()), - (m._mat[0][2]*v.x() + m._mat[1][2]*v.y() + m._mat[2][2]*v.z())); -} -inline Vec3d Matrixf::transform3x3(const Vec3d& v,const Matrixf& m) -{ - return Vec3d( (m._mat[0][0]*v.x() + m._mat[1][0]*v.y() + m._mat[2][0]*v.z()), - (m._mat[0][1]*v.x() + m._mat[1][1]*v.y() + m._mat[2][1]*v.z()), - (m._mat[0][2]*v.x() + m._mat[1][2]*v.y() + m._mat[2][2]*v.z())); -} - -inline Vec3f Matrixf::transform3x3(const Matrixf& m,const Vec3f& v) -{ - return Vec3f( (m._mat[0][0]*v.x() + m._mat[0][1]*v.y() + m._mat[0][2]*v.z()), - (m._mat[1][0]*v.x() + m._mat[1][1]*v.y() + m._mat[1][2]*v.z()), - (m._mat[2][0]*v.x() + m._mat[2][1]*v.y() + m._mat[2][2]*v.z()) ) ; -} -inline Vec3d Matrixf::transform3x3(const Matrixf& m,const Vec3d& v) -{ - return Vec3d( (m._mat[0][0]*v.x() + m._mat[0][1]*v.y() + m._mat[0][2]*v.z()), - (m._mat[1][0]*v.x() + m._mat[1][1]*v.y() + m._mat[1][2]*v.z()), - (m._mat[2][0]*v.x() + m._mat[2][1]*v.y() + m._mat[2][2]*v.z()) ) ; -} - -inline void Matrixf::preMultTranslate( const Vec3d& v ) -{ - for (unsigned i = 0; i < 3; ++i) - { - double tmp = v[i]; - if (tmp == 0) - continue; - _mat[3][0] += tmp*_mat[i][0]; - _mat[3][1] += tmp*_mat[i][1]; - _mat[3][2] += tmp*_mat[i][2]; - _mat[3][3] += tmp*_mat[i][3]; - } -} - -inline void Matrixf::preMultTranslate( const Vec3f& v ) -{ - for (unsigned i = 0; i < 3; ++i) - { - float tmp = v[i]; - if (tmp == 0) - continue; - _mat[3][0] += tmp*_mat[i][0]; - _mat[3][1] += tmp*_mat[i][1]; - _mat[3][2] += tmp*_mat[i][2]; - _mat[3][3] += tmp*_mat[i][3]; - } -} - -inline void Matrixf::postMultTranslate( const Vec3d& v ) -{ - for (unsigned i = 0; i < 3; ++i) - { - double tmp = v[i]; - if (tmp == 0) - continue; - _mat[0][i] += tmp*_mat[0][3]; - _mat[1][i] += tmp*_mat[1][3]; - _mat[2][i] += tmp*_mat[2][3]; - _mat[3][i] += tmp*_mat[3][3]; - } -} - -inline void Matrixf::postMultTranslate( const Vec3f& v ) -{ - for (unsigned i = 0; i < 3; ++i) - { - float tmp = v[i]; - if (tmp == 0) - continue; - _mat[0][i] += tmp*_mat[0][3]; - _mat[1][i] += tmp*_mat[1][3]; - _mat[2][i] += tmp*_mat[2][3]; - _mat[3][i] += tmp*_mat[3][3]; - } -} - -inline void Matrixf::preMultScale( const Vec3d& v ) -{ - _mat[0][0] *= v[0]; _mat[0][1] *= v[0]; _mat[0][2] *= v[0]; _mat[0][3] *= v[0]; - _mat[1][0] *= v[1]; _mat[1][1] *= v[1]; _mat[1][2] *= v[1]; _mat[1][3] *= v[1]; - _mat[2][0] *= v[2]; _mat[2][1] *= v[2]; _mat[2][2] *= v[2]; _mat[2][3] *= v[2]; -} - -inline void Matrixf::preMultScale( const Vec3f& v ) -{ - _mat[0][0] *= v[0]; _mat[0][1] *= v[0]; _mat[0][2] *= v[0]; _mat[0][3] *= v[0]; - _mat[1][0] *= v[1]; _mat[1][1] *= v[1]; _mat[1][2] *= v[1]; _mat[1][3] *= v[1]; - _mat[2][0] *= v[2]; _mat[2][1] *= v[2]; _mat[2][2] *= v[2]; _mat[2][3] *= v[2]; -} - -inline void Matrixf::postMultScale( const Vec3d& v ) -{ - _mat[0][0] *= v[0]; _mat[1][0] *= v[0]; _mat[2][0] *= v[0]; _mat[3][0] *= v[0]; - _mat[0][1] *= v[1]; _mat[1][1] *= v[1]; _mat[2][1] *= v[1]; _mat[3][1] *= v[1]; - _mat[0][2] *= v[2]; _mat[1][2] *= v[2]; _mat[2][2] *= v[2]; _mat[3][2] *= v[2]; -} - -inline void Matrixf::postMultScale( const Vec3f& v ) -{ - _mat[0][0] *= v[0]; _mat[1][0] *= v[0]; _mat[2][0] *= v[0]; _mat[3][0] *= v[0]; - _mat[0][1] *= v[1]; _mat[1][1] *= v[1]; _mat[2][1] *= v[1]; _mat[3][1] *= v[1]; - _mat[0][2] *= v[2]; _mat[1][2] *= v[2]; _mat[2][2] *= v[2]; _mat[3][2] *= v[2]; -} - - -inline void Matrixf::preMultRotate( const Quat& q ) -{ - if (q.zeroRotation()) - return; - Matrixf r; - r.setRotate(q); - preMult(r); -} - -inline void Matrixf::postMultRotate( const Quat& q ) -{ - if (q.zeroRotation()) - return; - Matrixf r; - r.setRotate(q); - postMult(r); -} - -inline Vec3f operator* (const Vec3f& v, const Matrixf& m ) -{ - return m.preMult(v); -} -inline Vec3d operator* (const Vec3d& v, const Matrixf& m ) -{ - return m.preMult(v); -} -inline Vec4f operator* (const Vec4f& v, const Matrixf& m ) -{ - return m.preMult(v); -} -inline Vec4d operator* (const Vec4d& v, const Matrixf& m ) -{ - return m.preMult(v); -} - -inline Vec3f Matrixf::operator* (const Vec3f& v) const -{ - return postMult(v); -} -inline Vec3d Matrixf::operator* (const Vec3d& v) const -{ - return postMult(v); -} -inline Vec4f Matrixf::operator* (const Vec4f& v) const -{ - return postMult(v); -} -inline Vec4d Matrixf::operator* (const Vec4d& v) const -{ - return postMult(v); -} - - -} //namespace osg - - -#endif diff --git a/libs/lib/mac32/include/osg/MixinVector b/libs/lib/mac32/include/osg/MixinVector deleted file mode 100644 index 0ed454c38a9223f2cca1cc372334058f3bc1f0dc..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/MixinVector +++ /dev/null @@ -1,199 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_MIXIN_VECTOR -#define OSG_MIXIN_VECTOR 1 - -#include - -namespace osg { - -/** MixinVector is a base class that allows inheritance to be used to easily - * emulate derivation from std::vector but without introducing undefined - * behaviour through violation of virtual destructor rules. - * - * @author Neil Groves - */ -template -class MixinVector -{ - typedef typename std::vector vector_type; -public: - typedef typename vector_type::allocator_type allocator_type; - typedef typename vector_type::value_type value_type; - typedef typename vector_type::const_pointer const_pointer; - typedef typename vector_type::pointer pointer; - typedef typename vector_type::const_reference const_reference; - typedef typename vector_type::reference reference; - typedef typename vector_type::const_iterator const_iterator; - typedef typename vector_type::iterator iterator; - typedef typename vector_type::const_reverse_iterator const_reverse_iterator; - typedef typename vector_type::reverse_iterator reverse_iterator; - typedef typename vector_type::size_type size_type; - typedef typename vector_type::difference_type difference_type; - - explicit MixinVector() : _impl() - { - } - - explicit MixinVector(size_type initial_size, const value_type& fill_value = value_type()) - : _impl(initial_size, fill_value) - { - } - - template - MixinVector(InputIterator first, InputIterator last) - : _impl(first, last) - { - } - - MixinVector(const vector_type& other) - : _impl(other) - { - } - - MixinVector(const MixinVector& other) - : _impl(other._impl) - { - } - - MixinVector& operator=(const vector_type& other) - { - _impl = other; - return *this; - } - - MixinVector& operator=(const MixinVector& other) - { - _impl = other._impl; - return *this; - } - - virtual ~MixinVector() {} - - void clear() { _impl.clear(); } - void resize(size_type new_size, const value_type& fill_value = value_type()) { _impl.resize(new_size, fill_value); } - void reserve(size_type new_capacity) { _impl.reserve(new_capacity); } - - void swap(vector_type& other) { _impl.swap(other); } - void swap(MixinVector& other) { _impl.swap(other._impl); } - - bool empty() const { return _impl.empty(); } - size_type size() const { return _impl.size(); } - size_type capacity() const { return _impl.capacity(); } - size_type max_size() const { return _impl.max_size(); } - allocator_type get_allocator() const { return _impl.get_allocator(); } - - const_iterator begin() const { return _impl.begin(); } - iterator begin() { return _impl.begin(); } - const_iterator end() const { return _impl.end(); } - iterator end() { return _impl.end(); } - - const_reverse_iterator rbegin() const { return _impl.rbegin(); } - reverse_iterator rbegin() { return _impl.rbegin(); } - const_reverse_iterator rend() const { return _impl.rend(); } - reverse_iterator rend() { return _impl.rend(); } - - const_reference operator[](size_type index) const { return _impl[index]; } - reference operator[](size_type index) { return _impl[index]; } - - const_reference at(size_type index) const { return _impl.at(index); } - reference at(size_type index) { return _impl.at(index); } - - void assign(size_type count, const value_type& value) { _impl.assign(count, value); } - template - void assign(Iter first, Iter last) { _impl.assign(first, last); } - - void push_back(const value_type& value) { _impl.push_back(value); } - void pop_back() { _impl.pop_back(); } - - iterator erase(iterator where) { return _impl.erase(where); } - iterator erase(iterator first, iterator last) { return _impl.erase(first, last); } - - iterator insert(iterator where, const value_type& value) { return _impl.insert(where, value); } - - template - void insert(iterator where, InputIterator first, InputIterator last) - { - _impl.insert(where, first, last); - } - - void insert(iterator where, size_type count, const value_type& value) - { - _impl.insert(where, count, value); - } - - const_reference back() const { return _impl.back(); } - reference back() { return _impl.back(); } - const_reference front() const { return _impl.front(); } - reference front() { return _impl.front(); } - - vector_type& asVector() { return _impl; } - const vector_type& asVector() const { return _impl; } - - friend inline bool operator==(const MixinVector& left, const MixinVector& right) { return left._impl == right._impl; } - friend inline bool operator==(const MixinVector& left, const std::vector& right) { return left._impl == right; } - friend inline bool operator==(const std::vector& left, const MixinVector& right) { return left == right._impl; } - - friend inline bool operator!=(const MixinVector& left, const MixinVector& right) { return left._impl != right._impl; } - friend inline bool operator!=(const MixinVector& left, const std::vector& right) { return left._impl != right; } - friend inline bool operator!=(const std::vector& left, const MixinVector& right) { return left != right._impl; } - - friend inline bool operator<(const MixinVector& left, const MixinVector& right) { return left._impl < right._impl; } - friend inline bool operator<(const MixinVector& left, const std::vector& right) { return left._impl < right; } - friend inline bool operator<(const std::vector& left, const MixinVector& right) { return left < right._impl; } - - friend inline bool operator>(const MixinVector& left, const MixinVector& right) { return left._impl > right._impl; } - friend inline bool operator>(const MixinVector& left, const std::vector& right) { return left._impl > right; } - friend inline bool operator>(const std::vector& left, const MixinVector& right) { return left > right._impl; } - - friend inline bool operator<=(const MixinVector& left, const MixinVector& right) { return left._impl <= right._impl; } - friend inline bool operator<=(const MixinVector& left, const std::vector& right) { return left._impl <= right; } - friend inline bool operator<=(const std::vector& left, const MixinVector& right) { return left <= right._impl; } - - friend inline bool operator>=(const MixinVector& left, const MixinVector& right) { return left._impl >= right._impl; } - friend inline bool operator>=(const MixinVector& left, const std::vector& right) { return left._impl >= right; } - friend inline bool operator>=(const std::vector& left, const MixinVector& right) { return left >= right._impl; } - -private: - vector_type _impl; -}; - -template inline -void -swap(MixinVector& left, - MixinVector& right) -{ - std::swap(left.asVector(), right.asVector()); -} - -template inline -void -swap(MixinVector& left, - std::vector& right) -{ - std::swap(left.asVector(), right); -} - -template inline -void -swap(std::vector& left, - MixinVector& right) -{ - std::swap(left, right.asVector()); -} - -} // namespace osg - -#endif - diff --git a/libs/lib/mac32/include/osg/Multisample b/libs/lib/mac32/include/osg/Multisample deleted file mode 100644 index 322085a0217576afc099fa85d17b1332326dee2f..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Multisample +++ /dev/null @@ -1,158 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_MULTISAMPLE -#define OSG_MULTISAMPLE 1 - - -#include -#include -#include - - -#ifndef GL_ARB_multisample -#define GL_MULTISAMPLE_ARB 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F -#define GL_SAMPLE_COVERAGE_ARB 0x80A0 -#define GL_SAMPLE_BUFFERS_ARB 0x80A8 -#define GL_SAMPLES_ARB 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB -#define GL_MULTISAMPLE_BIT_ARB 0x20000000 -#endif -#ifndef GL_NV_multisample_filter_hint -#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 -#endif - - -namespace osg { - -/** Multisample - encapsulates the OpenGL Multisample state.*/ -class OSG_EXPORT Multisample : public StateAttribute -{ - public : - - enum Mode - { - FASTEST = GL_FASTEST, - NICEST = GL_NICEST, - DONT_CARE = GL_DONT_CARE - }; - - Multisample(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Multisample(const Multisample& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(trans,copyop), - _coverage(trans._coverage), - _invert(trans._invert), - _mode(trans._mode) {} - - META_StateAttribute(osg, Multisample,MULTISAMPLE); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(Multisample,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_coverage) - COMPARE_StateAttribute_Parameter(_invert) - COMPARE_StateAttribute_Parameter(_mode) - - return 0; // passed all the above comparison macros, must be equal. - } - - void setSampleCoverage(float coverage, bool invert) - { - _coverage = coverage; - _invert = invert; - } - inline void setCoverage(float coverage) { _coverage=coverage; } - inline float getCoverage() const { return _coverage; } - - inline void setInvert(bool invert) { _invert=invert; } - inline bool getInvert() const { return _invert; } - - inline void setHint(Mode mode) { _mode = mode; } - inline Mode getHint() const { return _mode; } - - virtual void apply(State& state) const; - - - /** Extensions class which encapsulates the querying of extensions and - * associated function pointers, and provide convenience wrappers to - * check for the extensions or use the associated functions.*/ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - void setMultisampleSupported(bool flag) { _isMultisampleSupported=flag; } - void setMultisampleFilterHintSupported(bool flag) { _isMultisampleFilterHintSupported=flag; } - bool isMultisampleSupported() const { return _isMultisampleSupported; } - bool isMultisampleFilterHintSupported() const { return _isMultisampleFilterHintSupported; } - - void glSampleCoverage(GLclampf value, GLboolean invert) const; - - protected: - - ~Extensions() {} - - bool _isMultisampleSupported; - bool _isMultisampleFilterHintSupported; - - typedef void (GL_APIENTRY * GLSampleCoverageProc) (GLclampf value, GLboolean invert); - GLSampleCoverageProc _glSampleCoverage; - - }; - - /** Function to call to get the extension of a specified context. - * If the Extension object for that context has not yet been created - * and the 'createIfNotInitalized' flag been set to false then returns NULL. - * If 'createIfNotInitalized' is true then the Extensions object is - * automatically created. However, in this case the extension object will - * only be created with the graphics context associated with ContextID..*/ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions allows users to override the extensions across graphics contexts. - * Typically used when you have different extensions supported across graphics pipes - * but need to ensure that they all use the same low common denominator extensions.*/ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - - - protected : - - virtual ~Multisample(); - - float _coverage; - bool _invert; - Mode _mode; -}; - -} - -#endif - - - diff --git a/libs/lib/mac32/include/osg/Node b/libs/lib/mac32/include/osg/Node deleted file mode 100644 index 242f3e11feb5b70828a3221519c2fe5fad1e7367..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Node +++ /dev/null @@ -1,465 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - - -#ifndef OSG_NODE -#define OSG_NODE 1 - -#include -#include -#include -#include - -#include -#include - - -// forward declare osgTerrrain::Terrain to enable declaration of asTerrain() method. -namespace osgTerrain { -class Terrain; -} - -namespace osg { - -// forcing declare classes to enable declaration of as*() methods. -class NodeVisitor; -class Group; -class Transform; -class Node; -class Switch; -class Geode; - -/** A vector of Nodes pointers which is used to describe the path from a root node to a descendant.*/ -typedef std::vector< Node* > NodePath; - -/** A vector of NodePath, typically used to describe all the paths from a node to the potential root nodes it has.*/ -typedef std::vector< NodePath > NodePathList; - -/** A vector of NodePath, typically used to describe all the paths from a node to the potential root nodes it has.*/ -typedef std::vector< Matrix > MatrixList; - -/** META_Node macro define the standard clone, isSameKindAs, className - * and accept methods. Use when subclassing from Node to make it - * more convenient to define the required pure virtual methods.*/ -#define META_Node(library,name) \ - virtual osg::Object* cloneType() const { return new name (); } \ - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \ - virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } \ - virtual const char* className() const { return #name; } \ - virtual const char* libraryName() const { return #library; } \ - virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } } \ - - -/** Base class for all internal nodes in the scene graph. - Provides interface for most common node operations (Composite Pattern). -*/ -class OSG_EXPORT Node : public Object -{ - public: - - /** Construct a node. - Initialize the parent list to empty, node name to "" and - bounding sphere dirty flag to true.*/ - Node(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Node(const Node&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - /** clone an object of the same type as the node.*/ - virtual Object* cloneType() const { return new Node(); } - - /** return a clone of a node, with Object* return type.*/ - virtual Object* clone(const CopyOp& copyop) const { return new Node(*this,copyop); } - - /** return true if this and obj are of the same kind of object.*/ - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - - /** return the name of the node's library.*/ - virtual const char* libraryName() const { return "osg"; } - - /** return the name of the node's class type.*/ - virtual const char* className() const { return "Node"; } - - /** convert 'this' into a Group pointer if Node is a Group, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual Group* asGroup() { return 0; } - /** convert 'const this' into a const Group pointer if Node is a Group, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual const Group* asGroup() const { return 0; } - - /** Convert 'this' into a Transform pointer if Node is a Transform, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual Transform* asTransform() { return 0; } - - /** convert 'const this' into a const Transform pointer if Node is a Transform, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual const Transform* asTransform() const { return 0; } - - /** Convert 'this' into a Switch pointer if Node is a Switch, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual Switch* asSwitch() { return 0; } - - /** convert 'const this' into a const Switch pointer if Node is a Switch, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual const Switch* asSwitch() const { return 0; } - - /** Convert 'this' into a Geode pointer if Node is a Geode, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual Geode* asGeode() { return 0; } - - /** convert 'const this' into a const Geode pointer if Node is a Geode, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual const Geode* asGeode() const { return 0; } - - /** Convert 'this' into a Transform pointer if Node is a Terrain, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual osgTerrain::Terrain* asTerrain() { return 0; } - - /** convert 'const this' into a const Terrain pointer if Node is a Terrain, otherwise return 0. - * Equivalent to dynamic_cast(this).*/ - virtual const osgTerrain::Terrain* asTerrain() const { return 0; } - - - /** Visitor Pattern : calls the apply method of a NodeVisitor with this node's type.*/ - virtual void accept(NodeVisitor& nv); - /** Traverse upwards : calls parents' accept method with NodeVisitor.*/ - virtual void ascend(NodeVisitor& nv); - /** Traverse downwards : calls children's accept method with NodeVisitor.*/ - virtual void traverse(NodeVisitor& /*nv*/) {} - - /** A vector of osg::Group pointers which is used to store the parent(s) of node.*/ - typedef std::vector ParentList; - - /** Get the parent list of node. */ - inline const ParentList& getParents() const { return _parents; } - - /** Get the a copy of parent list of node. A copy is returned to - * prevent modification of the parent list.*/ - inline ParentList getParents() { return _parents; } - - inline Group* getParent(unsigned int i) { return _parents[i]; } - - /** - * Get a single const parent of node. - * @param i index of the parent to get. - * @return the parent i. - */ - inline const Group* getParent(unsigned int i) const { return _parents[i]; } - - /** - * Get the number of parents of node. - * @return the number of parents of this node. - */ - inline unsigned int getNumParents() const { return static_cast(_parents.size()); } - - /** Get the list of node paths parent paths. - * The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */ - NodePathList getParentalNodePaths(osg::Node* haltTraversalAtNode=0) const; - - /** Get the list of matrices that transform this node from local coordinates to world coordinates. - * The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */ - MatrixList getWorldMatrices(const osg::Node* haltTraversalAtNode=0) const; - - - /** Set update node callback, called during update traversal. */ - void setUpdateCallback(NodeCallback* nc); - - /** Get update node callback, called during update traversal. */ - inline NodeCallback* getUpdateCallback() { return _updateCallback.get(); } - - /** Get const update node callback, called during update traversal. */ - inline const NodeCallback* getUpdateCallback() const { return _updateCallback.get(); } - - /** Convenience method that sets the update callback of the node if it doesn't exist, or nest it into the existing one. */ - inline void addUpdateCallback(NodeCallback* nc) { - if (nc != NULL) { - if (_updateCallback.valid()) _updateCallback->addNestedCallback(nc); - else setUpdateCallback(nc); - } - } - - /** Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found. */ - inline void removeUpdateCallback(NodeCallback* nc) { - if (nc != NULL && _updateCallback.valid()) { - if (_updateCallback == nc) setUpdateCallback(nc->getNestedCallback()); // replace the callback by the nested one - else _updateCallback->removeNestedCallback(nc); - } - } - - /** Get the number of Children of this node which require Update traversal, - * since they have an Update Callback attached to them or their children.*/ - inline unsigned int getNumChildrenRequiringUpdateTraversal() const { return _numChildrenRequiringUpdateTraversal; } - - - /** Set event node callback, called during event traversal. */ - void setEventCallback(NodeCallback* nc); - - /** Get event node callback, called during event traversal. */ - inline NodeCallback* getEventCallback() { return _eventCallback.get(); } - - /** Get const event node callback, called during event traversal. */ - inline const NodeCallback* getEventCallback() const { return _eventCallback.get(); } - - /** Convenience method that sets the event callback of the node if it doesn't exist, or nest it into the existing one. */ - inline void addEventCallback(NodeCallback* nc) { - if (nc != NULL) { - if (_eventCallback.valid()) _eventCallback->addNestedCallback(nc); - else setEventCallback(nc); - } - } - - /** Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found. */ - inline void removeEventCallback(NodeCallback* nc) { - if (nc != NULL && _eventCallback.valid()) { - if (_eventCallback == nc) setEventCallback(nc->getNestedCallback()); // replace the callback by the nested one - else _eventCallback->removeNestedCallback(nc); - } - } - - /** Get the number of Children of this node which require Event traversal, - * since they have an Event Callback attached to them or their children.*/ - inline unsigned int getNumChildrenRequiringEventTraversal() const { return _numChildrenRequiringEventTraversal; } - - - /** Set cull node callback, called during cull traversal. */ - void setCullCallback(NodeCallback* nc) { _cullCallback = nc; } - - /** Get cull node callback, called during cull traversal. */ - inline NodeCallback* getCullCallback() { return _cullCallback.get(); } - - /** Get const cull node callback, called during cull traversal. */ - inline const NodeCallback* getCullCallback() const { return _cullCallback.get(); } - - /** Convenience method that sets the cull callback of the node if it doesn't exist, or nest it into the existing one. */ - inline void addCullCallback(NodeCallback* nc) { - if (nc != NULL) { - if (_cullCallback.valid()) _cullCallback->addNestedCallback(nc); - else setCullCallback(nc); - } - } - - /** Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found. */ - inline void removeCullCallback(NodeCallback* nc) { - if (nc != NULL && _cullCallback.valid()) { - if (_cullCallback == nc) setCullCallback(nc->getNestedCallback()); // replace the callback by the nested one - else _cullCallback->removeNestedCallback(nc); - } - } - - /** Set the view frustum/small feature culling of this node to be active or inactive. - * The default value is true for _cullingActive. Used as a guide - * to the cull traversal.*/ - void setCullingActive(bool active); - - /** Get the view frustum/small feature _cullingActive flag for this node. Used as a guide - * to the cull traversal.*/ - inline bool getCullingActive() const { return _cullingActive; } - - /** Get the number of Children of this node which have culling disabled.*/ - inline unsigned int getNumChildrenWithCullingDisabled() const { return _numChildrenWithCullingDisabled; } - - /** Return true if this node can be culled by view frustum, occlusion or small feature culling during the cull traversal. - * Note, returns true only if no children have culling disabled, and the local _cullingActive flag is true.*/ - inline bool isCullingActive() const { return _numChildrenWithCullingDisabled==0 && _cullingActive && getBound().valid(); } - - /** Get the number of Children of this node which are or have OccluderNode's.*/ - inline unsigned int getNumChildrenWithOccluderNodes() const { return _numChildrenWithOccluderNodes; } - - - /** return true if this node is an OccluderNode or the subgraph below this node are OccluderNodes.*/ - bool containsOccluderNodes() const; - - - /** - * This is a set of bits (flags) that represent the Node. - * The default value is 0xffffffff (all bits set). - * - * The most common use of these is during traversal of the scene graph. - * For instance, when traversing the scene graph the osg::NodeVisitor does a bitwise - * AND of its TraversalMask with the Node#s NodeMask to - * determine if the Node should be processed/traversed. - * - * For example, if a Node has a NodeMask value of 0x02 (only 2nd bit set) - * and the osg::Camera has a CullMask of 0x4 (2nd bit not set) then during cull traversal, - * which takes it's TraversalMask from the Camera's CullMask, the node and any children - * would be ignored and thereby treated as "culled" and thus not rendered. - * Conversely, if the osg::Camera CullMask were 0x3 (2nd bit set) then the node - * would be processed and child Nodes would be examined. - */ - typedef unsigned int NodeMask; - /** Set the node mask.*/ - inline void setNodeMask(NodeMask nm) { _nodeMask = nm; } - /** Get the node Mask.*/ - inline NodeMask getNodeMask() const { return _nodeMask; } - - - - /** Set the node's StateSet.*/ - void setStateSet(osg::StateSet* stateset); - - /** return the node's StateSet, if one does not already exist create it - * set the node and return the newly created StateSet. This ensures - * that a valid StateSet is always returned and can be used directly.*/ - osg::StateSet* getOrCreateStateSet(); - - /** Return the node's StateSet. returns NULL if a stateset is not attached.*/ - inline osg::StateSet* getStateSet() { return _stateset.get(); } - - /** Return the node's const StateSet. Returns NULL if a stateset is not attached.*/ - inline const osg::StateSet* getStateSet() const { return _stateset.get(); } - - - /** A vector of std::string's which are used to describe the object.*/ - typedef std::vector DescriptionList; - - /** Set the list of string descriptions.*/ - void setDescriptions(const DescriptionList& descriptions); - - /** Get the description list of the node.*/ - DescriptionList& getDescriptions(); - - /** Get the const description list of the const node.*/ - const DescriptionList& getDescriptions() const; - - - /** Get a single const description of the const node.*/ - const std::string& getDescription(unsigned int i) const; - - /** Get a single description of the node.*/ - std::string& getDescription(unsigned int i); - - /** Get the number of descriptions of the node.*/ - unsigned int getNumDescriptions() const; - - /** Add a description string to the node.*/ - void addDescription(const std::string& desc); - - - /** Set the initial bounding volume to use when computing the overall bounding volume.*/ - void setInitialBound(const osg::BoundingSphere& bsphere) { _initialBound = bsphere; dirtyBound(); } - - /** Set the initial bounding volume to use when computing the overall bounding volume.*/ - const BoundingSphere& getInitialBound() const { return _initialBound; } - - /** Mark this node's bounding sphere dirty. - Forcing it to be computed on the next call to getBound().*/ - void dirtyBound(); - - /** Get the bounding sphere of node. - Using lazy evaluation computes the bounding sphere if it is 'dirty'.*/ - inline const BoundingSphere& getBound() const - { - if(!_boundingSphereComputed) - { - _boundingSphere = _initialBound; - if (_computeBoundCallback.valid()) - _boundingSphere.expandBy(_computeBoundCallback->computeBound(*this)); - else - _boundingSphere.expandBy(computeBound()); - - _boundingSphereComputed = true; - } - return _boundingSphere; - } - - - /** Compute the bounding sphere around Node's geometry or children. - This method is automatically called by getBound() when the bounding - sphere has been marked dirty via dirtyBound().*/ - virtual BoundingSphere computeBound() const; - - /** Callback to allow users to override the default computation of bounding volume.*/ - struct ComputeBoundingSphereCallback : public osg::Object - { - ComputeBoundingSphereCallback() {} - - ComputeBoundingSphereCallback(const ComputeBoundingSphereCallback&,const CopyOp&) {} - - META_Object(osg,ComputeBoundingSphereCallback); - - virtual BoundingSphere computeBound(const osg::Node&) const { return BoundingSphere(); } - }; - - /** Set the compute bound callback to override the default computeBound.*/ - void setComputeBoundingSphereCallback(ComputeBoundingSphereCallback* callback) { _computeBoundCallback = callback; } - - /** Get the compute bound callback.*/ - ComputeBoundingSphereCallback* getComputeBoundingSphereCallback() { return _computeBoundCallback.get(); } - - /** Get the const compute bound callback.*/ - const ComputeBoundingSphereCallback* getComputeBoundingSphereCallback() const { return _computeBoundCallback.get(); } - - /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ - virtual void setThreadSafeRefUnref(bool threadSafe); - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/); - - /** If State is non-zero, this function releases any associated OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objects - * for all graphics contexts. */ - virtual void releaseGLObjects(osg::State* = 0) const; - - - protected: - - /** Node destructor. Note, is protected so that Nodes cannot - be deleted other than by being dereferenced and the reference - count being zero (see osg::Referenced), preventing the deletion - of nodes which are still in use. This also means that - Nodes cannot be created on stack i.e Node node will not compile, - forcing all nodes to be created on the heap i.e Node* node - = new Node().*/ - virtual ~Node(); - - - - BoundingSphere _initialBound; - ref_ptr _computeBoundCallback; - mutable BoundingSphere _boundingSphere; - mutable bool _boundingSphereComputed; - - void addParent(osg::Group* node); - void removeParent(osg::Group* node); - - ParentList _parents; - friend class osg::Group; - friend class osg::Drawable; - friend class osg::StateSet; - - ref_ptr _updateCallback; - unsigned int _numChildrenRequiringUpdateTraversal; - void setNumChildrenRequiringUpdateTraversal(unsigned int num); - - ref_ptr _eventCallback; - unsigned int _numChildrenRequiringEventTraversal; - void setNumChildrenRequiringEventTraversal(unsigned int num); - - ref_ptr _cullCallback; - - bool _cullingActive; - unsigned int _numChildrenWithCullingDisabled; - void setNumChildrenWithCullingDisabled(unsigned int num); - - unsigned int _numChildrenWithOccluderNodes; - void setNumChildrenWithOccluderNodes(unsigned int num); - - NodeMask _nodeMask; - - ref_ptr _stateset; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/NodeCallback b/libs/lib/mac32/include/osg/NodeCallback deleted file mode 100644 index 949f97ca076e4c30fa122bf64a896ba481045ee2..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/NodeCallback +++ /dev/null @@ -1,98 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_NODECALLBACK -#define OSG_NODECALLBACK 1 - -#include -#include - -namespace osg { - -class Node; -class NodeVisitor; - -class OSG_EXPORT NodeCallback : public virtual Object { - - public : - - - NodeCallback(){} - - NodeCallback(const NodeCallback& nc,const CopyOp&): - _nestedCallback(nc._nestedCallback) {} - - - META_Object(osg,NodeCallback); - - - /** Callback method called by the NodeVisitor when visiting a node.*/ - virtual void operator()(Node* node, NodeVisitor* nv) - { - // note, callback is responsible for scenegraph traversal so - // they must call traverse(node,nv) to ensure that the - // scene graph subtree (and associated callbacks) are traversed. - traverse(node,nv); - } - - /** Call any nested callbacks and then traverse the scene graph. */ - void traverse(Node* node,NodeVisitor* nv); - - void setNestedCallback(NodeCallback* nc) { _nestedCallback = nc; } - NodeCallback* getNestedCallback() { return _nestedCallback.get(); } - const NodeCallback* getNestedCallback() const { return _nestedCallback.get(); } - - inline void addNestedCallback(NodeCallback* nc) - { - if (nc) - { - if (_nestedCallback.valid()) - { - nc->addNestedCallback(_nestedCallback.get()); - _nestedCallback = nc; - } - else - { - _nestedCallback = nc; - } - } - } - - inline void removeNestedCallback(NodeCallback* nc) - { - if (nc) - { - if (_nestedCallback==nc) - { - _nestedCallback = _nestedCallback->getNestedCallback(); - } - else if (_nestedCallback.valid()) - { - _nestedCallback->removeNestedCallback(nc); - } - } - } - - public: - - ref_ptr _nestedCallback; - - protected: - - virtual ~NodeCallback() {} -}; - -} // namespace - -#endif - diff --git a/libs/lib/mac32/include/osg/NodeTrackerCallback b/libs/lib/mac32/include/osg/NodeTrackerCallback deleted file mode 100644 index 3b79bca3e6dc72f034ac47e71540c9a7cf0af58e..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/NodeTrackerCallback +++ /dev/null @@ -1,54 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_NODETRACKERCALLBACK -#define OSG_NODETRACKERCALLBACK 1 - -#include - -#include -#include -#include - -namespace osg -{ - -class OSG_EXPORT NodeTrackerCallback : public NodeCallback -{ - public: - - void setTrackNodePath(const osg::NodePath& nodePath) { _trackNodePath.setNodePath(nodePath); } - - void setTrackNodePath(const ObserverNodePath& nodePath) { _trackNodePath = nodePath; } - - ObserverNodePath& getTrackNodePath() { return _trackNodePath; } - - void setTrackNode(osg::Node* node); - osg::Node* getTrackNode(); - const osg::Node* getTrackNode() const; - - /** Implements the callback. */ - virtual void operator()(Node* node, NodeVisitor* nv); - - /** Update the node to track the nodepath.*/ - void update(osg::Node& node); - - protected: - - ObserverNodePath _trackNodePath; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/NodeVisitor b/libs/lib/mac32/include/osg/NodeVisitor deleted file mode 100644 index fe85bbe7e905e45c78a3194d46f70b6397366f17..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/NodeVisitor +++ /dev/null @@ -1,369 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_NODEVISITOR -#define OSG_NODEVISITOR 1 - -#include -#include -#include - -namespace osg { - -class Billboard; -class ClearNode; -class ClipNode; -class CoordinateSystemNode; -class Geode; -class Group; -class LightSource; -class LOD; -class MatrixTransform; -class OccluderNode; -class OcclusionQueryNode; -class PagedLOD; -class PositionAttitudeTransform; -class Projection; -class ProxyNode; -class Sequence; -class Switch; -class TexGenNode; -class Transform; -class Camera; -class CameraView; - -const unsigned int UNINITIALIZED_FRAME_NUMBER=0xffffffff; - -#define META_NodeVisitor(library,name) \ - virtual const char* libraryName() const { return #library; }\ - virtual const char* className() const { return #name; } - -/** Visitor for type safe operations on osg::Nodes. - Based on GOF's Visitor pattern. The NodeVisitor - is useful for developing type safe operations to nodes - in the scene graph (as per Visitor pattern), and adds to this - support for optional scene graph traversal to allow - operations to be applied to whole scenes at once. The Visitor - pattern uses a technique of double dispatch as a mechanism to - call the appropriate apply(..) method of the NodeVisitor. To - use this feature one must use the Node::accept(NodeVisitor) which - is extended in each Node subclass, rather than the NodeVisitor - apply directly. So use root->accept(myVisitor); instead of - myVisitor.apply(*root). The later method will bypass the double - dispatch and the appropriate NodeVisitor::apply(..) method will - not be called. */ -class OSG_EXPORT NodeVisitor : public virtual Referenced -{ - public: - - enum TraversalMode - { - TRAVERSE_NONE, - TRAVERSE_PARENTS, - TRAVERSE_ALL_CHILDREN, - TRAVERSE_ACTIVE_CHILDREN - }; - - enum VisitorType - { - NODE_VISITOR = 0, - UPDATE_VISITOR, - EVENT_VISITOR, - COLLECT_OCCLUDER_VISITOR, - CULL_VISITOR - }; - - NodeVisitor(TraversalMode tm=TRAVERSE_NONE); - - NodeVisitor(VisitorType type,TraversalMode tm=TRAVERSE_NONE); - - virtual ~NodeVisitor(); - - /** return the library name/namespapce of the visitor's. Should be defined by derived classes.*/ - virtual const char* libraryName() const { return "osg"; } - - /** return the name of the visitor's class type. Should be defined by derived classes.*/ - virtual const char* className() const { return "NodeVisitor"; } - - /** Method to call to reset visitor. Useful if your visitor accumulates - state during a traversal, and you plan to reuse the visitor. - To flush that state for the next traversal: call reset() prior - to each traversal.*/ - virtual void reset() {} - - - /** Set the VisitorType, used to distinguish different visitors during - * traversal of the scene, typically used in the Node::traverse() method - * to select which behaviour to use for different types of traversal/visitors.*/ - inline void setVisitorType(VisitorType type) { _visitorType = type; } - - /** Get the VisitorType.*/ - inline VisitorType getVisitorType() const { return _visitorType; } - - /** Set the traversal number. Typically used to denote the frame count.*/ - inline void setTraversalNumber(unsigned int fn) { _traversalNumber = fn; } - - /** Get the traversal number. Typically used to denote the frame count.*/ - inline unsigned int getTraversalNumber() const { return _traversalNumber; } - - /** Set the FrameStamp that this traversal is associated with.*/ - inline void setFrameStamp(FrameStamp* fs) { _frameStamp = fs; } - - /** Get the FrameStamp that this traversal is associated with.*/ - inline const FrameStamp* getFrameStamp() const { return _frameStamp.get(); } - - - /** Set the TraversalMask of this NodeVisitor. - * The TraversalMask is used by the NodeVisitor::validNodeMask() method - * to determine whether to operate on a node and its subgraph. - * validNodeMask() is called automatically in the Node::accept() method before - * any call to NodeVisitor::apply(), apply() is only ever called if validNodeMask - * returns true. Note, if NodeVisitor::_traversalMask is 0 then all operations - * will be switched off for all nodes. Whereas setting both _traversalMask and - * _nodeMaskOverride to 0xffffffff will allow a visitor to work on all nodes - * regardless of their own Node::_nodeMask state.*/ - inline void setTraversalMask(Node::NodeMask mask) { _traversalMask = mask; } - - /** Get the TraversalMask.*/ - inline Node::NodeMask getTraversalMask() const { return _traversalMask; } - - /** Set the NodeMaskOverride mask. - * Used in validNodeMask() to determine whether to operate on a node or its - * subgraph, by OR'ing NodeVisitor::_nodeMaskOverride with the Node's own Node::_nodeMask. - * Typically used to force on nodes which may have - * been switched off by their own Node::_nodeMask.*/ - inline void setNodeMaskOverride(Node::NodeMask mask) { _nodeMaskOverride = mask; } - - /** Get the NodeMaskOverride mask.*/ - inline Node::NodeMask getNodeMaskOverride() const { return _nodeMaskOverride; } - - /** Method to called by Node and its subclass' Node::accept() method, if the result is true - * it is used to cull operations of nodes and their subgraphs. - * Return true if the result of a bit wise and of the NodeVisitor::_traversalMask - * with the bit or between NodeVistor::_nodeMaskOverride and the Node::_nodeMask. - * default values for _traversalMask is 0xffffffff, _nodeMaskOverride is 0x0, - * and osg::Node::_nodeMask is 0xffffffff. */ - inline bool validNodeMask(const osg::Node& node) const - { - return (getTraversalMask() & (getNodeMaskOverride() | node.getNodeMask()))!=0; - } - - /** Set the traversal mode for Node::traverse() to use when - deciding which children of a node to traverse. If a - NodeVisitor has been attached via setTraverseVisitor() - and the new mode is not TRAVERSE_VISITOR then the attached - visitor is detached. Default mode is TRAVERSE_NONE.*/ - inline void setTraversalMode(TraversalMode mode) { _traversalMode = mode; } - - /** Get the traversal mode.*/ - inline TraversalMode getTraversalMode() const { return _traversalMode; } - - /** - * Set user data, data must be subclassed from Referenced to allow - * automatic memory handling. If your own data isn't directly - * subclassed from Referenced then create an adapter object - * which points to your own objects and handles the memory addressing. - */ - inline void setUserData(Referenced* obj) { _userData = obj; } - - /** Get user data.*/ - inline Referenced* getUserData() { return _userData.get(); } - - /** Get const user data.*/ - inline const Referenced* getUserData() const { return _userData.get(); } - - - /** Method for handling traversal of a nodes. - If you intend to use the visitor for actively traversing - the scene graph then make sure the accept() methods call - this method unless they handle traversal directly.*/ - inline void traverse(Node& node) - { - if (_traversalMode==TRAVERSE_PARENTS) node.ascend(*this); - else if (_traversalMode!=TRAVERSE_NONE) node.traverse(*this); - } - - /** Method called by osg::Node::accept() method before - * a call to the NodeVisitor::apply(..). The back of the list will, - * therefore, be the current node being visited inside the apply(..), - * and the rest of the list will be the parental sequence of nodes - * from the top most node applied down the graph to the current node. - * Note, the user does not typically call pushNodeOnPath() as it - * will be called automatically by the Node::accept() method.*/ - inline void pushOntoNodePath(Node* node) { if (_traversalMode!=TRAVERSE_PARENTS) _nodePath.push_back(node); else _nodePath.insert(_nodePath.begin(),node); } - - /** Method called by osg::Node::accept() method after - * a call to NodeVisitor::apply(..). - * Note, the user does not typically call popFromNodePath() as it - * will be called automatically by the Node::accept() method.*/ - inline void popFromNodePath() { if (_traversalMode!=TRAVERSE_PARENTS) _nodePath.pop_back(); else _nodePath.erase(_nodePath.begin()); } - - /** Get the non const NodePath from the top most node applied down - * to the current Node being visited.*/ - NodePath& getNodePath() { return _nodePath; } - - /** Get the const NodePath from the top most node applied down - * to the current Node being visited.*/ - const NodePath& getNodePath() const { return _nodePath; } - - /** Get the eye point in local coordinates. - * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.*/ - virtual osg::Vec3 getEyePoint() const { return Vec3(0.0f,0.0f,0.0f); } - - /** Get the view point in local coordinates. - * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.*/ - virtual osg::Vec3 getViewPoint() const { return getEyePoint(); } - - /** Get the distance from a point to the eye point, distance value in local coordinate system. - * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. - * If the getDistanceFromEyePoint(pos) is not implemented then a default value of 0.0 is returned.*/ - virtual float getDistanceToEyePoint(const Vec3& /*pos*/, bool /*useLODScale*/) const { return 0.0f; } - - /** Get the distance of a point from the eye point, distance value in the eye coordinate system. - * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. - * If the getDistanceFromEyePoint(pos) is not implemented than a default value of 0.0 is returned.*/ - virtual float getDistanceFromEyePoint(const Vec3& /*pos*/, bool /*useLODScale*/) const { return 0.0f; } - - /** Get the distance from a point to the view point, distance value in local coordinate system. - * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. - * If the getDistanceToViewPoint(pos) is not implemented then a default value of 0.0 is returned.*/ - virtual float getDistanceToViewPoint(const Vec3& /*pos*/, bool /*useLODScale*/) const { return 0.0f; } - - - virtual void apply(Node& node); - - virtual void apply(Geode& node); - virtual void apply(Billboard& node); - - virtual void apply(Group& node); - - virtual void apply(ProxyNode& node); - - virtual void apply(Projection& node); - - virtual void apply(CoordinateSystemNode& node); - - virtual void apply(ClipNode& node); - virtual void apply(TexGenNode& node); - virtual void apply(LightSource& node); - - virtual void apply(Transform& node); - virtual void apply(Camera& node); - virtual void apply(CameraView& node); - virtual void apply(MatrixTransform& node); - virtual void apply(PositionAttitudeTransform& node); - - virtual void apply(Switch& node); - virtual void apply(Sequence& node); - virtual void apply(LOD& node); - virtual void apply(PagedLOD& node); - virtual void apply(ClearNode& node); - virtual void apply(OccluderNode& node); - virtual void apply(OcclusionQueryNode& node); - - - /** Callback for managing database paging, such as generated by PagedLOD nodes.*/ - class DatabaseRequestHandler : public osg::Referenced - { - public: - - DatabaseRequestHandler(): - Referenced(true) {} - - virtual void requestNodeFile(const std::string& fileName, osg::NodePath& nodePath, float priority, const FrameStamp* framestamp, osg::ref_ptr& databaseRequest, const osg::Referenced* options=0) = 0; - - protected: - virtual ~DatabaseRequestHandler() {} - }; - - /** Set the handler for database requests.*/ - void setDatabaseRequestHandler(DatabaseRequestHandler* handler) { _databaseRequestHandler = handler; } - - /** Get the handler for database requests.*/ - DatabaseRequestHandler* getDatabaseRequestHandler() { return _databaseRequestHandler.get(); } - - /** Get the const handler for database requests.*/ - const DatabaseRequestHandler* getDatabaseRequestHandler() const { return _databaseRequestHandler.get(); } - - - /** Callback for managing image paging, such as generated by PagedLOD nodes.*/ - class ImageRequestHandler : public osg::Referenced - { - public: - - ImageRequestHandler(): - Referenced(true) {} - - virtual double getPreLoadTime() const = 0; - - virtual osg::Image* readImageFile(const std::string& fileName) = 0; - - virtual void requestImageFile(const std::string& fileName,osg::Object* attachmentPoint, int attachmentIndex, double timeToMergeBy, const FrameStamp* framestamp) = 0; - - protected: - virtual ~ImageRequestHandler() {} - }; - - /** Set the handler for image requests.*/ - void setImageRequestHandler(ImageRequestHandler* handler) { _imageRequestHandler = handler; } - - /** Get the handler for image requests.*/ - ImageRequestHandler* getImageRequestHandler() { return _imageRequestHandler.get(); } - - /** Get the const handler for image requests.*/ - const ImageRequestHandler* getImageRequestHandler() const { return _imageRequestHandler.get(); } - - - - protected: - - VisitorType _visitorType; - unsigned int _traversalNumber; - - ref_ptr _frameStamp; - - TraversalMode _traversalMode; - Node::NodeMask _traversalMask; - Node::NodeMask _nodeMaskOverride; - - NodePath _nodePath; - - ref_ptr _userData; - - ref_ptr _databaseRequestHandler; - ref_ptr _imageRequestHandler; - -}; - - -/** Convenience functor for assisting visiting of arrays of osg::Node's.*/ -class NodeAcceptOp -{ - public: - - NodeAcceptOp(NodeVisitor& nv):_nv(nv) {} - NodeAcceptOp(const NodeAcceptOp& naop):_nv(naop._nv) {} - - void operator () (Node* node) { node->accept(_nv); } - void operator () (ref_ptr node) { node->accept(_nv); } - - protected: - - NodeAcceptOp& operator = (const NodeAcceptOp&) { return *this; } - - NodeVisitor& _nv; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Notify b/libs/lib/mac32/include/osg/Notify deleted file mode 100644 index b7ad579b42e51e427d06a15ab94e607e50bf1374..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Notify +++ /dev/null @@ -1,145 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_NOTIFY_H -#define OSG_NOTIFY_H 1 - -#include -#include // for NotifyHandler - -#include - -namespace osg { - -/** Range of notify levels from DEBUG_FP through to FATAL, ALWAYS - * is reserved for forcing the absorption of all messages. The - * keywords are also used verbatim when specified by the environmental - * variable OSGNOTIFYLEVEL or OSG_NOTIFY_LEVEL. - * See documentation on osg::notify() for further details. - */ -enum NotifySeverity { - ALWAYS=0, - FATAL=1, - WARN=2, - NOTICE=3, - INFO=4, - DEBUG_INFO=5, - DEBUG_FP=6 -}; - -/** set the notify level, overriding the default or the value set by - * the environmental variable OSGNOTIFYLEVEL or OSG_NOTIFY_LEVEL. - */ -extern OSG_EXPORT void setNotifyLevel(NotifySeverity severity); - -/** get the notify level. */ -extern OSG_EXPORT NotifySeverity getNotifyLevel(); - -/** initialize notify level. */ -extern OSG_EXPORT bool initNotifyLevel(); - -#ifdef OSG_NOTIFY_DISABLED - inline bool isNotifyEnabled(NotifySeverity) { return false; } -#else - /** is notification enabled, given the current setNotifyLevel() setting? */ - extern OSG_EXPORT bool isNotifyEnabled(NotifySeverity severity); -#endif - -/** notify messaging function for providing fatal through to verbose - * debugging messages. Level of messages sent to the console can - * be controlled by setting the NotifyLevel either within your - * application or via the an environmental variable i.e. - * - setenv OSGNOTIFYLEVEL DEBUG (for tsh) - * - export OSGNOTIFYLEVEL=DEBUG (for bourne shell) - * - set OSGNOTIFYLEVEL=DEBUG (for Windows) - * - * All tell the osg to redirect all debugging and more important messages - * to the notification stream (useful for debugging) setting ALWAYS will force - * all messages to be absorbed, which might be appropriate for final - * applications. Default NotifyLevel is NOTICE. Check the enum - * #NotifySeverity for full range of possibilities. To use the notify - * with your code simply use the notify function as a normal file - * stream (like std::cout) i.e - * @code - * osg::notify(osg::DEBUG) << "Hello Bugs!" << std::endl; - * @endcode - * @see setNotifyLevel, setNotifyHandler - */ -extern OSG_EXPORT std::ostream& notify(const NotifySeverity severity); - -inline std::ostream& notify(void) { return notify(osg::INFO); } - -#define OSG_NOTIFY(level) if (osg::isNotifyEnabled(level)) osg::notify(level) -#define OSG_ALWAYS OSG_NOTIFY(osg::ALWAYS) -#define OSG_FATAL OSG_NOTIFY(osg::FATAL) -#define OSG_WARN OSG_NOTIFY(osg::WARN) -#define OSG_NOTICE OSG_NOTIFY(osg::NOTICE) -#define OSG_INFO OSG_NOTIFY(osg::INFO) -#define OSG_DEBUG OSG_NOTIFY(osg::DEBUG_INFO) -#define OSG_DEBUG_FP OSG_NOTIFY(osg::DEBUG_FP) - -/** Handler processing output of notification stream. It acts as a sink to - * notification messages. It is called when notification stream needs to be - * synchronized (i.e. after osg::notify() << std::endl). - * StandardNotifyHandler is used by default, it writes notifications to stderr - * (severity <= WARN) or stdout (severity > WARN). - * Notifications can be redirected to other sinks such as GUI widgets or - * windows debugger (WinDebugNotifyHandler) with custom handlers. - * Use setNotifyHandler to set custom handler. - * Note that osg notification API is not thread safe although notification - * handler is called from many threads. When incorporating handlers into GUI - * widgets you must take care of thread safety on your own. - * @see setNotifyHandler - */ -class OSG_EXPORT NotifyHandler : public osg::Referenced -{ -public: - virtual void notify(osg::NotifySeverity severity, const char *message) = 0; -}; - -/** Set notification handler, by default StandardNotifyHandler is used. - * @see NotifyHandler - */ -extern OSG_EXPORT void setNotifyHandler(NotifyHandler *handler); - -/** Get currrent notification handler. */ -extern OSG_EXPORT NotifyHandler *getNotifyHandler(); - -/** Redirects notification stream to stderr (severity <= WARN) or stdout (severity > WARN). - * The fputs() function is used to write messages to standard files. Note that - * std::out and std::cerr streams are not used. - * @see setNotifyHandler - */ -class OSG_EXPORT StandardNotifyHandler : public NotifyHandler -{ -public: - void notify(osg::NotifySeverity severity, const char *message); -}; - -#if defined(WIN32) && !defined(__CYGWIN__) - -/** Redirects notification stream to windows debugger with use of - * OuputDebugString functions. - * @see setNotifyHandler - */ -class OSG_EXPORT WinDebugNotifyHandler : public NotifyHandler -{ -public: - void notify(osg::NotifySeverity severity, const char *message); -}; - -#endif - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Object b/libs/lib/mac32/include/osg/Object deleted file mode 100644 index 4587967550e1e755b5227b5a4f43b8d07a56cd54..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Object +++ /dev/null @@ -1,267 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_OBJECT -#define OSG_OBJECT 1 - -#include -#include -#include -#include - -#include -#include - -namespace osg { - -// forward declare -class State; -class UserDataContainer; - -#define _ADDQUOTES(def) #def -#define ADDQUOTES(def) _ADDQUOTES(def) - -/** META_Object macro define the standard clone, isSameKindAs and className methods. - * Use when subclassing from Object to make it more convenient to define - * the standard pure virtual clone, isSameKindAs and className methods - * which are required for all Object subclasses.*/ -#define META_Object(library,name) \ - virtual osg::Object* cloneType() const { return new name (); } \ - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \ - virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; } \ - virtual const char* libraryName() const { return #library; }\ - virtual const char* className() const { return #name; } - -/** Base class/standard interface for objects which require IO support, - cloning and reference counting. - Based on GOF Composite, Prototype and Template Method patterns. -*/ -class OSG_EXPORT Object : public Referenced -{ - public: - - - /** Construct an object. Note Object is a pure virtual base class - and therefore cannot be constructed on its own, only derived - classes which override the clone and className methods are - concrete classes and can be constructed.*/ - inline Object():Referenced(),_dataVariance(UNSPECIFIED), _userDataContainer(0) {} - - inline explicit Object(bool threadSafeRefUnref):Referenced(threadSafeRefUnref),_dataVariance(UNSPECIFIED),_userDataContainer(0) {} - - /** Copy constructor, optional CopyOp object can be used to control - * shallow vs deep copying of dynamic data.*/ - Object(const Object&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - /** Clone the type of an object, with Object* return type. - Must be defined by derived classes.*/ - virtual Object* cloneType() const = 0; - - /** Clone an object, with Object* return type. - Must be defined by derived classes.*/ - virtual Object* clone(const CopyOp&) const = 0; - - virtual bool isSameKindAs(const Object*) const { return true; } - - /** return the name of the object's library. Must be defined - by derived classes. The OpenSceneGraph convention is that the - namespace of a library is the same as the library name.*/ - virtual const char* libraryName() const = 0; - - /** return the name of the object's class type. Must be defined - by derived classes.*/ - virtual const char* className() const = 0; - - - /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ - virtual void setThreadSafeRefUnref(bool threadSafe); - - /** Set the name of object using C++ style string.*/ - virtual void setName( const std::string& name ) { _name = name; } - - /** Set the name of object using a C style string.*/ - inline void setName( const char* name ) - { - if (name) setName(std::string(name)); - else setName(std::string()); - } - - /** Get the name of object.*/ - inline const std::string& getName() const { return _name; } - - - enum DataVariance - { - DYNAMIC, - STATIC, - UNSPECIFIED - }; - - /** Set the data variance of this object. - * Can be set to either STATIC for values that do not change over the lifetime of the object, - * or DYNAMIC for values that vary over the lifetime of the object. The DataVariance value - * can be used by routines such as optimization codes that wish to share static data. - * UNSPECIFIED is used to specify that the DataVariance hasn't been set yet. */ - inline void setDataVariance(DataVariance dv) { _dataVariance = dv; } - - /** Get the data variance of this object.*/ - inline DataVariance getDataVariance() const { return _dataVariance; } - - /** Compute the DataVariance based on an assessment of callback etc.*/ - virtual void computeDataVariance() {} - - - /** set the UserDataContainer object.*/ - void setUserDataContainer(osg::UserDataContainer* udc); - - /** get the UserDataContainer attached to this object.*/ - osg::UserDataContainer* getUserDataContainer() { return _userDataContainer; } - - /** get the const UserDataContainer attached to this object.*/ - const osg::UserDataContainer* getUserDataContainer() const { return _userDataContainer; } - - /** Convinience method that returns the UserDataContainer, and if one doesn't already exist creates and assigns - * a DefaultUserDataContainer to the Object and then return this new UserDataContainer.*/ - osg::UserDataContainer* getOrCreateUserDataContainer(); - - - /** - * Set user data, data must be subclassed from Referenced to allow - * automatic memory handling. If your own data isn't directly - * subclassed from Referenced then create an adapter object - * which points to your own object and handles the memory addressing. - */ - virtual void setUserData(Referenced* obj); - - /** Get user data.*/ - virtual Referenced* getUserData(); - - /** Get const user data.*/ - virtual const Referenced* getUserData() const; - - - - /** Convinience method that casts the named UserObject to osg::TemplateValueObject and gets the value. - * To use this template method you need to include the osg/ValueObject header.*/ - template - bool getUserValue(const std::string& name, T& value) const; - - /** Convinience method that creates the osg::TemplateValueObject to store the - * specified value and adds it as a named UserObject. - * To use this template method you need to include the osg/ValueObject header. */ - template - void setUserValue(const std::string& name, const T& value); - - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {} - - /** If State is non-zero, this function releases any associated OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objects - * for all graphics contexts. */ - virtual void releaseGLObjects(osg::State* = 0) const {} - - - protected: - - /** Object destructor. Note, is protected so that Objects cannot - be deleted other than by being dereferenced and the reference - count being zero (see osg::Referenced), preventing the deletion - of nodes which are still in use. This also means that - Nodes cannot be created on stack i.e Node node will not compile, - forcing all nodes to be created on the heap i.e Node* node - = new Node().*/ - virtual ~Object(); - - std::string _name; - DataVariance _dataVariance; - - osg::UserDataContainer* _userDataContainer; - - private: - - /** disallow any copy operator.*/ - Object& operator = (const Object&) { return *this; } -}; - -template -T* clone(const T* t, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) -{ - if (t) - { - osg::ref_ptr obj = t->clone(copyop); - - T* ptr = dynamic_cast(obj.get()); - if (ptr) - { - obj.release(); - return ptr; - } - else - { - OSG_WARN<<"Warning: osg::clone(const T*, osg::CopyOp&) cloned object not of type T, returning NULL."< -T* clone(const T* t, const std::string& name, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) -{ - T* newObject = osg::clone(t, copyop); - if (newObject) - { - newObject->setName(name); - return newObject; - } - else - { - OSG_WARN<<"Warning: osg::clone(const T*, const std::string&, const osg::CopyOp) passed null object to clone, returning NULL."< -T* cloneType(const T* t) -{ - if (t) - { - osg::ref_ptr obj = t->cloneType(); - - T* ptr = dynamic_cast(obj.get()); - if (ptr) - { - obj.release(); - return ptr; - } - else - { - OSG_WARN<<"Warning: osg::cloneType(const T*) cloned object not of type T, returning NULL."< -#include -#include - -namespace osg { - -/** Observer base class for tracking when objects are unreferenced (there reference count goes to 0) and are being deleted.*/ -class OSG_EXPORT Observer -{ - public: - Observer(); - virtual ~Observer(); - - /** objectDeleted is called when the observed object is about to be deleted. The observer will be automatically - * removed from the observerd objects observer set so there is no need for the objectDeleted implementation - * to call removeObserver() on the observed object. */ - virtual void objectDeleted(void*) {} - -}; - -/** Class used by osg::Referenced to track the observers associated with it.*/ -class OSG_EXPORT ObserverSet : public osg::Referenced -{ - public: - - ObserverSet(const Referenced* observedObject); - - Referenced* getObserverdObject() { return _observedObject; } - const Referenced* getObserverdObject() const { return _observedObject; } - - /** "Lock" a Referenced object i.e., protect it from being deleted - * by incrementing its reference count. - * - * returns null if object doesn't exist anymore. */ - Referenced* addRefLock(); - - inline OpenThreads::Mutex* getObserverSetMutex() const { return &_mutex; } - - void addObserver(Observer* observer); - void removeObserver(Observer* observer); - - void signalObjectDeleted(void* ptr); - - typedef std::set Observers; - Observers& getObservers() { return _observers; } - const Observers& getObservers() const { return _observers; } - - protected: - - ObserverSet(const ObserverSet& rhs): osg::Referenced(rhs) {} - ObserverSet& operator = (const ObserverSet& /*rhs*/) { return *this; } - virtual ~ObserverSet(); - - mutable OpenThreads::Mutex _mutex; - Referenced* _observedObject; - Observers _observers; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ObserverNodePath b/libs/lib/mac32/include/osg/ObserverNodePath deleted file mode 100644 index a9a06bc1401064442a0c3a3f16cfe2c50e2c4bf5..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ObserverNodePath +++ /dev/null @@ -1,76 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_OBSERVERNODEPATH -#define OSG_OBSERVERNODEPATH 1 - -#include -#include -#include - -namespace osg { - -typedef std::vector< osg::ref_ptr > RefNodePath; - -/** ObserverNodePath is an observer class for tracking changes to a NodePath, - * that automatically invalidates it when nodes are deleted.*/ -class OSG_EXPORT ObserverNodePath -{ - public: - ObserverNodePath(); - - ObserverNodePath(const ObserverNodePath& rhs); - - ObserverNodePath(const osg::NodePath& nodePath); - - ~ObserverNodePath(); - - ObserverNodePath& operator = (const ObserverNodePath& rhs); - - /** get the NodePath from the first parental chain back to root, plus the specified node.*/ - void setNodePathTo(osg::Node* node); - - void setNodePath(const osg::RefNodePath& nodePath); - - void setNodePath(const osg::NodePath& nodePath); - - void clearNodePath(); - - /** Get a thread safe RefNodePath, return true if NodePath is valid.*/ - bool getRefNodePath(RefNodePath& refNodePath) const; - - /** Get a lightweight NodePath that isn't thread safe but - * may be safely used in single threaded applications, or when - * its known that the NodePath won't be invalidated during usage - * of the NodePath. return true if NodePath is valid.*/ - bool getNodePath(NodePath& nodePath) const; - - bool empty() const - { - OpenThreads::ScopedLock lock(_mutex); - return _nodePath.empty(); - } - - protected: - - void _setNodePath(const osg::NodePath& nodePath); - void _clearNodePath(); - - typedef std::vector< osg::observer_ptr > ObsNodePath; - mutable OpenThreads::Mutex _mutex; - ObsNodePath _nodePath; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/OccluderNode b/libs/lib/mac32/include/osg/OccluderNode deleted file mode 100644 index 5250ad1d955570b73d7367cf62e3f8784f906d71..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/OccluderNode +++ /dev/null @@ -1,59 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_OCCLUDERNODE -#define OSG_OCCLUDERNODE 1 - -#include -#include - -namespace osg { - -/** - * OccluderNode is a Group node which provides hooks for adding - * ConvexPlanarOccluders to the scene. - */ -class OSG_EXPORT OccluderNode : public Group -{ - public : - - OccluderNode(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - OccluderNode(const OccluderNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, OccluderNode); - - - /** Attach a ConvexPlanarOccluder to an OccluderNode.*/ - void setOccluder(ConvexPlanarOccluder* occluder) { _occluder = occluder; } - - /** Get the ConvexPlanarOccluder* attached to a OccluderNode. */ - ConvexPlanarOccluder* getOccluder() { return _occluder.get(); } - - /** Get the const ConvexPlanarOccluder* attached to a OccluderNode.*/ - const ConvexPlanarOccluder* getOccluder() const { return _occluder.get(); } - - /** Overrides Group's computeBound.*/ - virtual BoundingSphere computeBound() const; - - protected : - - virtual ~OccluderNode() {} - - ref_ptr _occluder; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/OcclusionQueryNode b/libs/lib/mac32/include/osg/OcclusionQueryNode deleted file mode 100644 index b45cf3e78a69e1b695d2ed4488d6e0f87f5d693e..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/OcclusionQueryNode +++ /dev/null @@ -1,202 +0,0 @@ -// -// Copyright (C) 2007 Skew Matrix Software LLC (http://www.skew-matrix.com) -// -// This library is open source and may be redistributed and/or modified under -// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or -// (at your option) any later version. The full license is in LICENSE file -// included with this distribution, and on the openscenegraph.org website. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OpenSceneGraph Public License for more details. -// - -#ifndef OSG_OCCLUSION_QUERY_NODE -#define OSG_OCCLUSION_QUERY_NODE 1 - -#include -#include -#include -#include - - -namespace osg { - -// Create and return a StateSet appropriate for performing an occlusion -// query test (disable lighting, texture mapping, etc). Probably some -// room for improvement here. Could disable shaders, for example. -osg::StateSet* initOQState(); - -// Create and return a StateSet for rendering a debug representation of query geometry. -osg::StateSet* initOQDebugState(); - -// TestResult -- stores (per context) results of an occlusion query -// test performed by QueryGeometry. An OcclusionQueryNode has a -// Geode owning a single QueryGeometry that -// draws the occlusion query geometry. QueryGeometry keeps a -// TestResult per context to store the result/status of each query. -// Accessed during the cull and draw traversals. -class TestResult : public osg::Referenced -{ -public: - TestResult() : _init( false ), _id( 0 ), _contextID( 0 ), _active( false ), _numPixels( 0 ) {} - ~TestResult() {} - - bool _init; - - // Query ID for this context. - GLuint _id; - // Context ID owning this query ID. - unsigned int _contextID; - - // Set to true when a query gets issued and set to - // false when the result is retrieved. - mutable bool _active; - - // Result of last query. - GLint _numPixels; -}; - -// QueryGeometry -- A Drawable that performs an occlusion query, -// using its geometric data as the query geometry. -class QueryGeometry : public osg::Geometry -{ -public: - QueryGeometry( const std::string& oqnName=std::string("") ); - ~QueryGeometry(); - - void reset(); - - // TBD implement copy constructor - - virtual void drawImplementation( osg::RenderInfo& renderInfo ) const; - - unsigned int getNumPixels( const osg::Camera* cam ); - - virtual void releaseGLObjects( osg::State* state = 0 ) const; - - static void deleteQueryObject( unsigned int contextID, GLuint handle ); - static void flushDeletedQueryObjects( unsigned int contextID, double currentTime, double& availableTime ); - static void discardDeletedQueryObjects( unsigned int contextID ); - -protected: - typedef std::map< const osg::Camera*, TestResult > ResultMap; - mutable ResultMap _results; - mutable OpenThreads::Mutex _mapMutex; - - // Needed for debug only - std::string _oqnName; -}; - -// This Node performs occlusion query testing on its children. -// You can use it directly to occlusion query test a portion -// of your scene graph, or you can use it implicitly with an -// OcclusionQueryRoot, which places OcclusionQueryNodes where -// needed and acts as a master control. -class OSG_EXPORT OcclusionQueryNode : public osg::Group -{ -public: - OcclusionQueryNode(); - - // Copy constructor using CopyOp to manage deep vs shallow copy. - OcclusionQueryNode( const OcclusionQueryNode& oqn, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ); - - META_Node( osg, OcclusionQueryNode ); - - virtual osg::BoundingSphere computeBound() const; - - virtual void releaseGLObjects( osg::State* state = 0 ) const; - - - // When disabled, OQN doesn't perform occlusion queries, and simply - // renders its children. - void setQueriesEnabled( bool enable=true ); - bool getQueriesEnabled() const { return _enabled; } - - - // Sets/gets the visibility threshold. If the test indicates that - // the number of visible pixels is less than the specified - // threshold, don't draw the actual geometry. - void setVisibilityThreshold( unsigned int pixels ) { _visThreshold = pixels; } - unsigned int getVisibilityThreshold() const { return _visThreshold; } - - // Specifies how many frames to wait before issuing another query. - void setQueryFrameCount( unsigned int frames ) { _queryFrameCount = frames; } - unsigned int getQueryFrameCount() const { return _queryFrameCount; } - - // Indicate whether or not the bounding box used in the occlusion query test - // should be rendered. Handy for debugging and development. - // Should only be called outside of cull/draw. No thread issues. - void setDebugDisplay( bool enable ); - bool getDebugDisplay() const; - - - // Set and get the StateSet used by the OcclusionQueryNode - // when rendering the query geometry. OQN creates its own by - // default, but if you use many OQNs you might want to use - // this method to set all OQNs to use the same StateSet - // for more efficient processing. - void setQueryStateSet( osg::StateSet* ss ); - osg::StateSet* getQueryStateSet(); - const osg::StateSet* getQueryStateSet() const; - - // Set and get the StateSet used by the OcclusionQueryNode - // when rendering the debug query geometry (see setDebugDisplay). - void setDebugStateSet( osg::StateSet* ss ); - osg::StateSet* getDebugStateSet(); - const osg::StateSet* getDebugStateSet() const; - - // For statistics gathering, e.g., by a NodeVisitor. - bool getPassed() const; - - - // These methods are public so that osgUtil::CullVisitor can access them. - // Not intended for application use. - virtual bool getPassed( const osg::Camera* camera, osg::NodeVisitor& nv ); - void traverseQuery( const osg::Camera* camera, osg::NodeVisitor& nv ); - void traverseDebug( osg::NodeVisitor& nv ); - - - // Delete unused query IDs for this contextID. - static void flushDeletedQueryObjects( unsigned int contextID, double currentTime, double& availableTime ); - - // discard all the cached query objects which need to be deleted - // in the OpenGL context related to contextID. - // Note, unlike flush no OpenGL calls are made, instead the handles are all removed. - // this call is useful for when an OpenGL context has been destroyed. - static void discardDeletedQueryObjects( unsigned int contextID ); - -protected: - virtual ~OcclusionQueryNode(); - - virtual void createSupportNodes(); - - osg::ref_ptr< osg::Geode > _queryGeode; - osg::ref_ptr< osg::Geode > _debugGeode; - - bool _enabled; - - // Tracks the last frame number that we performed a query. - // User can set how many times (See setQueryFrameCount). - typedef std::map< const osg::Camera*, unsigned int > FrameCountMap; - FrameCountMap _frameCountMap; - mutable OpenThreads::Mutex _frameCountMutex; - - // For statistics gathering - bool _passed; - - // User-settable variables - unsigned int _visThreshold; - unsigned int _queryFrameCount; - bool _debugBB; - - - // Required to ensure that computeBound() is thread-safe. - mutable OpenThreads::Mutex _computeBoundMutex; -}; - -} - - -#endif diff --git a/libs/lib/mac32/include/osg/OperationThread b/libs/lib/mac32/include/osg/OperationThread deleted file mode 100644 index 6d3ef2c6e82216dde43ff109505e2d267c89e6c0..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/OperationThread +++ /dev/null @@ -1,227 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_OPERATIONTHREAD -#define OSG_OPERATIONTHREAD 1 - -#include -#include - -#include -#include -#include -#include - -#include -#include - -namespace osg { - -class RefBlock : virtual public osg::Referenced, public OpenThreads::Block -{ - public: - - RefBlock(): - osg::Referenced(true) {} - -}; - -class RefBlockCount : virtual public osg::Referenced, public OpenThreads::BlockCount -{ - public: - - RefBlockCount(unsigned blockCount): - osg::Referenced(true), - OpenThreads::BlockCount(blockCount) {} - -}; - -/** Base class for implementing graphics operations.*/ -class Operation : virtual public Referenced -{ - public: - - Operation(const std::string& name, bool keep): - osg::Referenced(true), - _name(name), - _keep(keep) {} - - - /** Set the human readable name of the operation.*/ - void setName(const std::string& name) { _name = name; } - - /** Get the human readable name of the operation.*/ - const std::string& getName() const { return _name; } - - /** Set whether the operation should be kept once its been applied.*/ - void setKeep(bool keep) { _keep = keep; } - - /** Get whether the operation should be kept once its been applied.*/ - bool getKeep() const { return _keep; } - - /** if this operation is a barrier then release it.*/ - virtual void release() {} - - /** Do the actual task of this operation.*/ - virtual void operator () (Object*) = 0; - - protected: - - Operation(): - Referenced(true), - _keep(false) {} - - Operation(const Operation& op): - Referenced(true), - _name(op._name), - _keep(op._keep) {} - - virtual ~Operation() {} - - std::string _name; - bool _keep; -}; - -class OperationThread; - -class OSG_EXPORT OperationQueue : public Referenced -{ - public: - - OperationQueue(); - - /** Get the next operation from the operation queue. - * Return null ref_ptr<> if no operations are left in queue. */ - osg::ref_ptr getNextOperation(bool blockIfEmpty = false); - - /** Return true if the operation queue is empty. */ - bool empty(); - - /** Return the num of pending operations that are sitting in the OperationQueue.*/ - unsigned int getNumOperationsInQueue(); - - /** Add operation to end of OperationQueue, this will be - * executed by the operation thread once this operation gets to the head of the queue.*/ - void add(Operation* operation); - - /** Remove operation from OperationQueue.*/ - void remove(Operation* operation); - - /** Remove named operation from OperationQueue.*/ - void remove(const std::string& name); - - /** Remove all operations from OperationQueue.*/ - void removeAllOperations(); - - /** Run the operations. */ - void runOperations(Object* callingObject=0); - - /** Call release on all operations. */ - void releaseAllOperations(); - - /** Release operations block that is used to block threads that are waiting on an empty operations queue.*/ - void releaseOperationsBlock(); - - typedef std::set OperationThreads; - - /** Get the set of OperationThreads that are sharing this OperationQueue. */ - const OperationThreads& getOperationThreads() const { return _operationThreads; } - - protected: - - virtual ~OperationQueue(); - - friend class OperationThread; - - void addOperationThread(OperationThread* thread); - void removeOperationThread(OperationThread* thread); - - typedef std::list< osg::ref_ptr > Operations; - - OpenThreads::Mutex _operationsMutex; - osg::ref_ptr _operationsBlock; - Operations _operations; - Operations::iterator _currentOperationIterator; - - OperationThreads _operationThreads; -}; - -/** OperationThread is a helper class for running Operation within a single thread.*/ -class OSG_EXPORT OperationThread : public Referenced, public OpenThreads::Thread -{ - public: - OperationThread(); - - void setParent(Object* parent) { _parent = parent; } - - Object* getParent() { return _parent.get(); } - - const Object* getParent() const { return _parent.get(); } - - - /** Set the OperationQueue. */ - void setOperationQueue(OperationQueue* opq); - - /** Get the OperationQueue. */ - OperationQueue* getOperationQueue() { return _operationQueue.get(); } - - /** Get the const OperationQueue. */ - const OperationQueue* getOperationQueue() const { return _operationQueue.get(); } - - - /** Add operation to end of OperationQueue, this will be - * executed by the graphics thread once this operation gets to the head of the queue.*/ - void add(Operation* operation); - - /** Remove operation from OperationQueue.*/ - void remove(Operation* operation); - - /** Remove named operation from OperationQueue.*/ - void remove(const std::string& name); - - /** Remove all operations from OperationQueue.*/ - void removeAllOperations(); - - - /** Get the operation currently being run.*/ - osg::ref_ptr getCurrentOperation() { return _currentOperation; } - - /** Run does the opertion thread run loop.*/ - virtual void run(); - - void setDone(bool done); - - bool getDone() const { return _done; } - - /** Cancel this graphics thread.*/ - virtual int cancel(); - - protected: - - virtual ~OperationThread(); - - observer_ptr _parent; - - bool _done; - - OpenThreads::Mutex _threadMutex; - osg::ref_ptr _operationQueue; - osg::ref_ptr _currentOperation; - -}; - -typedef OperationThread OperationsThread; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/PagedLOD b/libs/lib/mac32/include/osg/PagedLOD deleted file mode 100644 index 3f2711e4fbaf715a451dec27b7ca72209b24d931..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/PagedLOD +++ /dev/null @@ -1,160 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_PagedLOD -#define OSG_PagedLOD 1 - -#include - -namespace osg { - -/** PagedLOD. -*/ -class OSG_EXPORT PagedLOD : public LOD -{ - public : - - PagedLOD(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - PagedLOD(const PagedLOD&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, PagedLOD); - - - - virtual void traverse(NodeVisitor& nv); - - virtual bool addChild(Node *child); - - virtual bool addChild(Node *child, float min, float max); - - virtual bool addChild(Node *child, float min, float max,const std::string& filename, float priorityOffset=0.0f, float priorityScale=1.0f); - - virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1); - - - /** Set the optional database osgDB::Options object to use when loaded children.*/ - void setDatabaseOptions(osg::Referenced* options) { _databaseOptions = options; } - - /** Get the optional database osgDB::Options object used when loaded children.*/ - osg::Referenced* getDatabaseOptions() { return _databaseOptions.get(); } - - /** Get the optional database osgDB::Options object used when loaded children.*/ - const osg::Referenced* getDatabaseOptions() const { return _databaseOptions.get(); } - - - /** Set the database path to prepend to children's filenames.*/ - void setDatabasePath(const std::string& path); - - /** Get the database path used to prepend to children's filenames.*/ - inline const std::string& getDatabasePath() const { return _databasePath; } - - - struct OSG_EXPORT PerRangeData - { - PerRangeData(); - PerRangeData(const PerRangeData& prd); - PerRangeData& operator = (const PerRangeData& prd); - - std::string _filename; - float _priorityOffset; - float _priorityScale; - double _timeStamp; - unsigned int _frameNumber; - unsigned int _frameNumberOfLastReleaseGLObjects; - osg::ref_ptr _databaseRequest; - }; - - typedef std::vector PerRangeDataList; - - void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; } - const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; } - unsigned int getNumFileNames() const { return _perRangeDataList.size(); } - - - void setPriorityOffset(unsigned int childNo, float priorityOffset) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityOffset=priorityOffset; } - float getPriorityOffset(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityOffset; } - unsigned int getNumPriorityOffsets() const { return _perRangeDataList.size(); } - - void setPriorityScale(unsigned int childNo, float priorityScale) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityScale=priorityScale; } - float getPriorityScale(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityScale; } - unsigned int getNumPriorityScales() const { return _perRangeDataList.size(); } - - - void setTimeStamp(unsigned int childNo, double timeStamp) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._timeStamp=timeStamp; } - double getTimeStamp(unsigned int childNo) const { return _perRangeDataList[childNo]._timeStamp; } - unsigned int getNumTimeStamps() const { return _perRangeDataList.size(); } - - void setFrameNumber(unsigned int childNo, unsigned int frameNumber) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._frameNumber=frameNumber; } - unsigned getFrameNumber(unsigned int childNo) const { return _perRangeDataList[childNo]._frameNumber; } - unsigned int getNumFrameNumbers() const { return _perRangeDataList.size(); } - - - /** Return the DatabaseRequest object used by the DatabasePager to keep track of file load requests - * being carried on behalf of the DatabasePager. - * Note, in normal OSG usage you should not set this value yourself, as this will be managed by - * the osgDB::DatabasePager.*/ - osg::ref_ptr& getDatabaseRequest(unsigned int childNo) { return _perRangeDataList[childNo]._databaseRequest; } - - /** Return the const DatabaseRequest object.*/ - const osg::ref_ptr& getDatabaseRequest(unsigned int childNo) const { return _perRangeDataList[childNo]._databaseRequest; } - - - /** Set the frame number of the last time that this PageLOD node was traversed. - * Note, this frame number is automatically set by the traverse() method for all traversals (update, cull etc.). - */ - inline void setFrameNumberOfLastTraversal(unsigned int frameNumber) { _frameNumberOfLastTraversal=frameNumber; } - - /** Get the frame number of the last time that this PageLOD node was traversed.*/ - inline unsigned int getFrameNumberOfLastTraversal() const { return _frameNumberOfLastTraversal; } - - - /** Set the number of children that the PagedLOD must keep around, even if they are older than their expiry time.*/ - inline void setNumChildrenThatCannotBeExpired(unsigned int num) { _numChildrenThatCannotBeExpired = num; } - - /** Get the number of children that the PagedLOD must keep around, even if they are older than their expiry time.*/ - unsigned int getNumChildrenThatCannotBeExpired() const { return _numChildrenThatCannotBeExpired; } - - /** Set wether you want to disable the paging in of external nodes.*/ - void setDisableExternalChildrenPaging(bool flag) { _disableExternalChildrenPaging = flag; } - - bool getDisableExternalChildrenPaging() const { return _disableExternalChildrenPaging; } - - - - /** Remove the children from the PagedLOD which haven't been visited since specified expiry time and expiry frame number. - * The removed children are added to the removeChildren list passed into the method, - * this allows the children to be deleted later at the caller's discretion. - * Return true if children are removed, false otherwise. */ - virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList& removedChildren); - - protected : - - virtual ~PagedLOD(); - - void expandPerRangeDataTo(unsigned int pos); - - ref_ptr _databaseOptions; - std::string _databasePath; - - unsigned int _frameNumberOfLastTraversal; - unsigned int _numChildrenThatCannotBeExpired; - bool _disableExternalChildrenPaging; - - PerRangeDataList _perRangeDataList; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Plane b/libs/lib/mac32/include/osg/Plane deleted file mode 100644 index 4af8c8f274661f318055d79a3cc604ec3c20103c..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Plane +++ /dev/null @@ -1,362 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_PLANE -#define OSG_PLANE 1 - -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace osg { - -/** @brief A plane class. It can be used to represent an infinite plane. - * - * The infinite plane is described by an implicit plane equation a*x+b*y+c*z+d = 0. Though it is not mandatory that - * a^2+b^2+c^2 = 1 is fulfilled in general some methods require it (@see osg::Plane::distance). */ -class OSG_EXPORT Plane -{ - - public: - -#ifdef OSG_USE_FLOAT_PLANE - /** Type of Plane class.*/ - typedef float value_type; - typedef Vec3f Vec3_type; - typedef Vec4f Vec4_type; -#else - /** Type of Plane class.*/ - typedef double value_type; - typedef Vec3d Vec3_type; - typedef Vec4d Vec4_type; -#endif - - /** Number of vector components. */ - enum { num_components = 3 }; - - - /// Default constructor - /** The default constructor initializes all values to zero. - * @warning Although the method osg::Plane::valid() will return true after the default constructors call the plane - * is mathematically invalid! Default data do not describe a valid plane. */ - inline Plane() { _fv[0]=0.0; _fv[1]=0.0; _fv[2]=0.0; _fv[3]=0.0; _lowerBBCorner = 0; _upperBBCorner = 0; } - inline Plane(const Plane& pl) { set(pl); } - /// Constructor - /** The plane is described as a*x+b*y+c*z+d = 0. - * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized. */ - inline Plane(value_type a,value_type b,value_type c,value_type d) { set(a,b,c,d); } - - /// Constructor - /** The plane can also be described as vec*[x,y,z,1]. - * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized. */ - inline Plane(const Vec4f& vec) { set(vec); } - /// Constructor - /** The plane can also be described as vec*[x,y,z,1]. - * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized. */ - inline Plane(const Vec4d& vec) { set(vec); } - - /// Constructor - /** This constructor initializes the internal values directly without any checking or manipulation. - * @param norm The normal of the plane. - * @param d The negative distance from the point of origin to the plane. - * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed normal was not normalized. */ - inline Plane(const Vec3_type& norm,value_type d) { set(norm,d); } - - /// Constructor - /** This constructor calculates from the three points describing an infinite plane the internal values. - * @param v1 Point in the plane. - * @param v2 Point in the plane. - * @param v3 Point in the plane. - * @remark After this constructor call the plane's normal is normalized in case the three points described a mathematically - * valid plane. - * @remark The normal is determined by building the cross product of (v2-v1) ^ (v3-v2). */ - inline Plane(const Vec3_type& v1, const Vec3_type& v2, const Vec3_type& v3) { set(v1,v2,v3); } - - /// Constructor - /** This constructor initializes the internal values directly without any checking or manipulation. - * @param norm The normal of the plane. - * @param point A point of the plane. - * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed normal was not normalized. */ - inline Plane(const Vec3_type& norm, const Vec3_type& point) { set(norm,point); } - - inline Plane& operator = (const Plane& pl) - { - if (&pl==this) return *this; - set(pl); - return *this; - } - - inline void set(const Plane& pl) { _fv[0]=pl._fv[0]; _fv[1]=pl._fv[1]; _fv[2]=pl._fv[2]; _fv[3]=pl._fv[3]; calculateUpperLowerBBCorners(); } - inline void set(value_type a, value_type b, value_type c, value_type d) { _fv[0]=a; _fv[1]=b; _fv[2]=c; _fv[3]=d; calculateUpperLowerBBCorners(); } - - inline void set(const Vec4f& vec) { set(vec[0],vec[1],vec[2],vec[3]); } - inline void set(const Vec4d& vec) { set(vec[0],vec[1],vec[2],vec[3]); } - - inline void set(const Vec3_type& norm, double d) { set(norm[0],norm[1],norm[2],d); } - - inline void set(const Vec3_type& v1, const Vec3_type& v2, const Vec3_type& v3) - { - Vec3_type norm = (v2-v1)^(v3-v2); - value_type length = norm.length(); - if (length>1e-6) norm/= length; - else norm.set(0.0,0.0,0.0); - set(norm[0],norm[1],norm[2],-(v1*norm)); - } - - inline void set(const Vec3_type& norm, const Vec3_type& point) - { - value_type d = -norm[0]*point[0] - norm[1]*point[1] - norm[2]*point[2]; - set(norm[0],norm[1],norm[2],d); - } - - /** flip/reverse the orientation of the plane.*/ - inline void flip() - { - _fv[0] = -_fv[0]; - _fv[1] = -_fv[1]; - _fv[2] = -_fv[2]; - _fv[3] = -_fv[3]; - calculateUpperLowerBBCorners(); - } - - /** This method multiplies the coefficients of the plane equation with a constant factor so that the - * equation a^2+b^2+c^2 = 1 holds. */ - inline void makeUnitLength() - { - value_type inv_length = 1.0 / sqrt(_fv[0]*_fv[0] + _fv[1]*_fv[1]+ _fv[2]*_fv[2]); - _fv[0] *= inv_length; - _fv[1] *= inv_length; - _fv[2] *= inv_length; - _fv[3] *= inv_length; - } - - /** calculate the upper and lower bounding box corners to be used - * in the intersect(BoundingBox&) method for speeding calculations.*/ - inline void calculateUpperLowerBBCorners() - { - _upperBBCorner = (_fv[0]>=0.0?1:0) | - (_fv[1]>=0.0?2:0) | - (_fv[2]>=0.0?4:0); - - _lowerBBCorner = (~_upperBBCorner)&7; - - } - - /// Checks if all internal values describing the plane have valid numbers - /** @warning This method does not check if the plane is mathematically correctly described! - * @remark The only case where all elements have valid numbers and the plane description is invalid occurs if the plane's normal - * is zero. */ - inline bool valid() const { return !isNaN(); } - inline bool isNaN() const { return osg::isNaN(_fv[0]) || osg::isNaN(_fv[1]) || osg::isNaN(_fv[2]) || osg::isNaN(_fv[3]); } - - inline bool operator == (const Plane& plane) const { return _fv[0]==plane._fv[0] && _fv[1]==plane._fv[1] && _fv[2]==plane._fv[2] && _fv[3]==plane._fv[3]; } - - inline bool operator != (const Plane& plane) const { return _fv[0]!=plane._fv[0] || _fv[1]!=plane._fv[1] || _fv[2]!=plane._fv[2] || _fv[3]!=plane._fv[3]; } - - /** A plane is said to be smaller than another plane if the first non-identical element of the internal array is smaller than the - * corresponding element of the other plane. */ - inline bool operator < (const Plane& plane) const - { - if (_fv[0]plane._fv[0]) return false; - else if (_fv[1]plane._fv[1]) return false; - else if (_fv[2]plane._fv[2]) return false; - else return (_fv[3]& vertices) const - { - if (vertices.empty()) return -1; - - int noAbove = 0; - int noBelow = 0; - int noOn = 0; - for(std::vector::const_iterator itr=vertices.begin(); - itr != vertices.end(); - ++itr) - { - float d = distance(*itr); - if (d>0.0f) ++noAbove; - else if (d<0.0f) ++noBelow; - else ++noOn; - } - - if (noAbove>0) - { - if (noBelow>0) return 0; - else return 1; - } - return -1; // treat points on line as outside... - } - - /** intersection test between plane and vertex list - return 1 if the bs is completely above plane, - return 0 if the bs intersects the plane, - return -1 if the bs is completely below the plane.*/ - inline int intersect(const std::vector& vertices) const - { - if (vertices.empty()) return -1; - - int noAbove = 0; - int noBelow = 0; - int noOn = 0; - for(std::vector::const_iterator itr=vertices.begin(); - itr != vertices.end(); - ++itr) - { - double d = distance(*itr); - if (d>0.0) ++noAbove; - else if (d<0.0) ++noBelow; - else ++noOn; - } - - if (noAbove>0) - { - if (noBelow>0) return 0; - else return 1; - } - return -1; // treat points on line as outside... - } - - /** intersection test between plane and bounding sphere. - return 1 if the bs is completely above plane, - return 0 if the bs intersects the plane, - return -1 if the bs is completely below the plane.*/ - inline int intersect(const BoundingSphere& bs) const - { - float d = distance(bs.center()); - - if (d>bs.radius()) return 1; - else if (d<-bs.radius()) return -1; - else return 0; - } - - - /** intersection test between plane and bounding sphere. - return 1 if the bs is completely above plane, - return 0 if the bs intersects the plane, - return -1 if the bs is completely below the plane.*/ - inline int intersect(const BoundingBox& bb) const - { - // if lowest point above plane than all above. - if (distance(bb.corner(_lowerBBCorner))>0.0f) return 1; - - // if highest point is below plane then all below. - if (distance(bb.corner(_upperBBCorner))<0.0f) return -1; - - // d_lower<=0.0f && d_upper>=0.0f - // therefore must be crossing plane. - return 0; - - } - - /** Transform the plane by matrix. Note, this operation carries out - * the calculation of the inverse of the matrix since a plane - * must be multiplied by the inverse transposed to transform it. This - * make this operation expensive. If the inverse has been already - * calculated elsewhere then use transformProvidingInverse() instead. - * See http://www.worldserver.com/turk/computergraphics/NormalTransformations.pdf*/ - inline void transform(const osg::Matrix& matrix) - { - osg::Matrix inverse; - inverse.invert(matrix); - transformProvidingInverse(inverse); - } - - /** Transform the plane by providing a pre inverted matrix. - * see transform for details. */ - inline void transformProvidingInverse(const osg::Matrix& matrix) - { - // note pre multiplications, which effectively transposes matrix. - Vec4_type vec(_fv[0],_fv[1],_fv[2],_fv[3]); - vec = matrix * vec; - set(vec); - makeUnitLength(); - } - - protected: - - /** Vec member variable. */ - value_type _fv[4]; - - // variables cached to optimize calcs against bounding boxes. - unsigned int _upperBBCorner; - unsigned int _lowerBBCorner; - - -}; - -} // end of namespace - -#endif diff --git a/libs/lib/mac32/include/osg/Point b/libs/lib/mac32/include/osg/Point deleted file mode 100644 index e364612bb26d04e2de7668b65a6ecbf4de586520..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Point +++ /dev/null @@ -1,157 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_POINT -#define OSG_POINT 1 - -#include -#include - -#ifndef GL_POINT_SMOOTH - #define GL_POINT_SMOOTH 0x0B10 -#endif - -#ifndef GL_POINT_SMOOTH_HINT - #define GL_POINT_SMOOTH_HINT 0x0C51 -#endif - -namespace osg { - -/** Point - encapsulates the OpenGL point smoothing and size state.*/ -class OSG_EXPORT Point : public StateAttribute -{ - public : - - Point(); - - Point(float size); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Point(const Point& point,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(point,copyop), - _size(point._size), - _fadeThresholdSize(point._fadeThresholdSize), - _distanceAttenuation(point._distanceAttenuation), - _minSize(point._minSize), - _maxSize(point._maxSize) {} - - META_StateAttribute(osg, Point, POINT); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(Point,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_size) - COMPARE_StateAttribute_Parameter(_fadeThresholdSize) - COMPARE_StateAttribute_Parameter(_distanceAttenuation) - COMPARE_StateAttribute_Parameter(_minSize) - COMPARE_StateAttribute_Parameter(_maxSize) - - return 0; // passed all the above comparison macros, must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_POINT_SMOOTH); - return true; - } - - void setSize(float size); - inline float getSize() const { return _size; } - - void setFadeThresholdSize(float fadeThresholdSize); - inline float getFadeThresholdSize() const { return _fadeThresholdSize; } - - void setDistanceAttenuation(const Vec3& distanceAttenuation); - inline const Vec3& getDistanceAttenuation() const { return _distanceAttenuation; } - - void setMinSize(float minSize); - inline float getMinSize() const {return _minSize;} - - void setMaxSize(float maxSize); - inline float getMaxSize() const {return _maxSize;} - - virtual void apply(State& state) const; - - /** Encapsulates queries of extension availability, obtains extension - * function pointers, and provides convenience wrappers for - * calling extension functions. */ - class OSG_EXPORT Extensions : public osg::Referenced - { - public: - Extensions(unsigned int contextID); - - Extensions(const Extensions& rhs); - - void lowestCommonDenominator(const Extensions& rhs); - - void setupGLExtensions(unsigned int contextID); - - void setPointParametersSupported(bool flag) { _isPointParametersSupported=flag; } - bool isPointParametersSupported() const { return _isPointParametersSupported; } - - void setPointSpriteCoordOriginSupported(bool flag) { _isPointSpriteCoordOriginSupported=flag; } - bool isPointSpriteCoordOriginSupported() const { return _isPointSpriteCoordOriginSupported; } - - void glPointParameteri(GLenum pname, GLint param) const; - void glPointParameterf(GLenum pname, GLfloat param) const; - void glPointParameterfv(GLenum pname, const GLfloat *params) const; - - protected: - - ~Extensions() {} - - bool _isPointParametersSupported; - bool _isPointSpriteCoordOriginSupported; - - typedef void (GL_APIENTRY * GLPointParameteriProc) (GLenum pname, GLint param); - typedef void (GL_APIENTRY * GLPointParameterfProc) (GLenum pname, GLfloat param); - typedef void (GL_APIENTRY * GLPointParameterfvProc) (GLenum pname, const GLfloat *params); - - GLPointParameteriProc _glPointParameteri; - GLPointParameterfProc _glPointParameterf; - GLPointParameterfvProc _glPointParameterfv; - - }; - - /** Returns the Extensions object for the given context. - * If createIfNotInitalized is true and the Extensions object doesn't - * exist, getExtensions() creates it on the given context. - * Returns NULL if createIfNotInitalized is false and the Extensions - * object doesn't exist. */ - static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized); - - /** setExtensions() allows users to override the extensions across graphics contexts. - * Typically used when you have different extensions supported across graphics pipes, - * but need to ensure that they all use the same low common denominator extensions. */ - static void setExtensions(unsigned int contextID,Extensions* extensions); - - protected : - - virtual ~Point(); - - float _size; - float _fadeThresholdSize; - Vec3 _distanceAttenuation; - float _minSize; - float _maxSize; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/PointSprite b/libs/lib/mac32/include/osg/PointSprite deleted file mode 100644 index 349fa816b9c2ff51c8e59830b8a2eb053e6ade7b..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/PointSprite +++ /dev/null @@ -1,80 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. - */ - -#ifndef OSG_POINTSPRITE -#define OSG_POINTSPRITE 1 - -#include -#include - -#ifndef GL_ARB_point_sprite -#define GL_POINT_SPRITE_ARB 0x8861 -#define GL_COORD_REPLACE_ARB 0x8862 -#endif - -#ifndef GL_POINT_SPRITE_COORD_ORIGIN -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#endif - -namespace osg { - -/** PointSprite base class which encapsulates enabling of point sprites .*/ -class OSG_EXPORT PointSprite : public osg::StateAttribute { -public: - - PointSprite(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - PointSprite(const PointSprite& ps,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): - StateAttribute(ps,copyop), - _coordOriginMode(ps._coordOriginMode) {} - - - META_StateAttribute(osg, PointSprite, POINTSPRITE); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const; - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_POINT_SPRITE_ARB); - return true; - } - - virtual bool checkValidityOfAssociatedModes(osg::State&) const; - - virtual bool isTextureAttribute() const { return true; } - - virtual void apply(osg::State& state) const; - - static bool isPointSpriteSupported(unsigned int context); - - enum CoordOriginMode { - UPPER_LEFT = GL_UPPER_LEFT, - LOWER_LEFT = GL_LOWER_LEFT - }; - - inline void setCoordOriginMode(CoordOriginMode mode) { _coordOriginMode = mode; } - inline CoordOriginMode getCoordOriginMode() const { return _coordOriginMode; } - -protected: - virtual ~PointSprite(); - - CoordOriginMode _coordOriginMode; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/PolygonMode b/libs/lib/mac32/include/osg/PolygonMode deleted file mode 100644 index 98d5499986e4d37468c0d0ed04ad319a527d7019..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/PolygonMode +++ /dev/null @@ -1,90 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_POLYGONMODE -#define OSG_POLYGONMODE 1 - -#include -#include - -#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) - #define GL_POINT 0x1B00 - #define GL_LINE 0x1B01 - #define GL_FILL 0x1B02 -#endif - -namespace osg { - -/** State Class for setting OpenGL's polygon culling mode. -*/ -class OSG_EXPORT PolygonMode : public StateAttribute -{ - public : - - enum Mode { - POINT = GL_POINT, - LINE = GL_LINE, - FILL = GL_FILL - }; - - enum Face { - FRONT_AND_BACK, - FRONT, - BACK - }; - - PolygonMode(); - - PolygonMode(Face face,Mode mode); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - PolygonMode(const PolygonMode& pm,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(pm,copyop), - _modeFront(pm._modeFront), - _modeBack(pm._modeBack) {} - - META_StateAttribute(osg, PolygonMode, POLYGONMODE); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(PolygonMode,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_modeFront) - COMPARE_StateAttribute_Parameter(_modeBack) - - return 0; // passed all the above comparison macros, must be equal. - } - - void setMode(Face face,Mode mode); - Mode getMode(Face face) const; - - inline bool getFrontAndBack() const { return _modeFront==_modeBack; } - - virtual void apply(State& state) const; - - protected: - - virtual ~PolygonMode(); - - Mode _modeFront; - Mode _modeBack; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/PolygonOffset b/libs/lib/mac32/include/osg/PolygonOffset deleted file mode 100644 index 360fd0490aad1dcf1202323d93ca871c042eb4ce..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/PolygonOffset +++ /dev/null @@ -1,99 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_POLYGONOFFSET -#define OSG_POLYGONOFFSET 1 - -#include - -#ifndef GL_POLYGON_OFFSET_LINE - #define GL_POLYGON_OFFSET_LINE 0x2A02 - #define GL_POLYGON_OFFSET_POINT 0x2A01 -#endif - -namespace osg { - -/** PolygonOffset - encapsulates the OpenGL glPolygonOffset state.*/ -class OSG_EXPORT PolygonOffset : public StateAttribute -{ - public : - - PolygonOffset(); - - PolygonOffset(float factor, float units); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - PolygonOffset(const PolygonOffset& po,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(po,copyop), - _factor(po._factor), - _units(po._units) {} - - META_StateAttribute(osg, PolygonOffset, POLYGONOFFSET); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(PolygonOffset,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_factor) - COMPARE_StateAttribute_Parameter(_units) - - return 0; // passed all the above comparison macros, must be equal. - } - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_POLYGON_OFFSET_FILL); -#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) - usage.usesMode(GL_POLYGON_OFFSET_LINE); - usage.usesMode(GL_POLYGON_OFFSET_POINT); -#endif - return true; - } - - inline void setFactor(float factor) { _factor = factor; } - inline float getFactor() const { return _factor; } - - inline void setUnits(float units) { _units = units; } - inline float getUnits() const { return _units; } - - virtual void apply(State& state) const; - - - static void setFactorMultiplier(float multiplier); - static float getFactorMultiplier(); - - static void setUnitsMultiplier(float multiplier); - static float getUnitsMultiplier(); - - static bool areFactorAndUnitsMultipliersSet(); - - /** Checks with the OpenGL driver to try and pick multiplier appropriate for the hardware. - note, requires a valid graphics context to be current. */ - static void setFactorAndUnitsMultipliersUsingBestGuessForDriver(); - - protected : - - virtual ~PolygonOffset(); - - float _factor; - float _units; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/PolygonStipple b/libs/lib/mac32/include/osg/PolygonStipple deleted file mode 100644 index 5d97205665070657de79d431e6fd97dfaf1b5cbe..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/PolygonStipple +++ /dev/null @@ -1,68 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ -// -*- Mode: c++ -*- - -#ifndef OSG_POLYGONSTIPPLE -#define OSG_POLYGONSTIPPLE 1 - -#include - -#ifndef GL_POLYGON_STIPPLE - #define GL_POLYGON_STIPPLE 0x0B42 -#endif - -namespace osg -{ - -class OSG_EXPORT PolygonStipple : public StateAttribute -{ - public : - - PolygonStipple(); - - PolygonStipple(const GLubyte* mask); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - PolygonStipple(const PolygonStipple& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_StateAttribute(osg, PolygonStipple, POLYGONSTIPPLE); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const StateAttribute& sa) const; - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_POLYGON_STIPPLE); - return true; - } - - /** set the mask up, copying 128 bytes (32x32 bitfield) from mask into the local _mask.*/ - void setMask(const GLubyte* mask); - - /** get a pointer to the mask.*/ - inline const GLubyte* getMask() const {return _mask;} - - - virtual void apply(State& state) const; - - protected : - - virtual ~PolygonStipple(); - - GLubyte _mask[128]; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Polytope b/libs/lib/mac32/include/osg/Polytope deleted file mode 100644 index f70cb5234ee6d375918c26f0d447dcf2f241d1fa..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Polytope +++ /dev/null @@ -1,406 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_POLYTOPE -#define OSG_POLYTOPE 1 - -#include -#include - -namespace osg { - - -/** A Polytope class for representing convex clipping volumes made up of a set of planes. - * When adding planes, their normals should point inwards (into the volume) */ -class OSG_EXPORT Polytope -{ - - public: - - typedef unsigned int ClippingMask; - typedef std::vector PlaneList; - typedef std::vector VertexList; - typedef fast_back_stack MaskStack; - - inline Polytope() {setupMask();} - - inline Polytope(const Polytope& cv) : - _maskStack(cv._maskStack), - _resultMask(cv._resultMask), - _planeList(cv._planeList), - _referenceVertexList(cv._referenceVertexList) {} - - inline Polytope(const PlaneList& pl) : _planeList(pl) {setupMask();} - - inline ~Polytope() {} - - inline void clear() { _planeList.clear(); setupMask(); } - - inline Polytope& operator = (const Polytope& cv) - { - if (&cv==this) return *this; - _maskStack = cv._maskStack; - _resultMask = cv._resultMask; - _planeList = cv._planeList; - _referenceVertexList = cv._referenceVertexList; - return *this; - } - - /** Create a Polytope which is a cube, centered at 0,0,0, with sides of 2 units.*/ - void setToUnitFrustum(bool withNear=true, bool withFar=true) - { - _planeList.clear(); - _planeList.push_back(Plane(1.0,0.0,0.0,1.0)); // left plane. - _planeList.push_back(Plane(-1.0,0.0,0.0,1.0)); // right plane. - _planeList.push_back(Plane(0.0,1.0,0.0,1.0)); // bottom plane. - _planeList.push_back(Plane(0.0,-1.0,0.0,1.0)); // top plane. - if (withNear) _planeList.push_back(Plane(0.0,0.0,1.0,1.0)); // near plane - if (withFar) _planeList.push_back(Plane(0.0,0.0,-1.0,1.0)); // far plane - setupMask(); - } - - /** Create a Polytope which is a equivalent to BoundingBox.*/ - void setToBoundingBox(const BoundingBox& bb) - { - _planeList.clear(); - _planeList.push_back(Plane(1.0,0.0,0.0,-bb.xMin())); // left plane. - _planeList.push_back(Plane(-1.0,0.0,0.0,bb.xMax())); // right plane. - _planeList.push_back(Plane(0.0,1.0,0.0,-bb.yMin())); // bottom plane. - _planeList.push_back(Plane(0.0,-1.0,0.0,bb.yMax())); // top plane. - _planeList.push_back(Plane(0.0,0.0,1.0,-bb.zMin())); // near plane - _planeList.push_back(Plane(0.0,0.0,-1.0,bb.zMax())); // far plane - setupMask(); - } - - inline void setAndTransformProvidingInverse(const Polytope& pt, const osg::Matrix& matrix) - { - _referenceVertexList = pt._referenceVertexList; - - unsigned int resultMask = pt._maskStack.back(); - if (resultMask==0) - { - _maskStack.back() = 0; - _resultMask = 0; - _planeList.clear(); - return; - } - - ClippingMask selector_mask = 0x1; - - unsigned int numActivePlanes = 0; - - // count number of active planes. - PlaneList::const_iterator itr; - for(itr=pt._planeList.begin(); - itr!=pt._planeList.end(); - ++itr) - { - if (resultMask&selector_mask) ++numActivePlanes; - selector_mask <<= 1; - } - - _planeList.resize(numActivePlanes); - _resultMask = 0; - selector_mask = 0x1; - unsigned int index = 0; - for(itr=pt._planeList.begin(); - itr!=pt._planeList.end(); - ++itr) - { - if (resultMask&selector_mask) - { - _planeList[index] = *itr; - _planeList[index++].transformProvidingInverse(matrix); - _resultMask = (_resultMask<<1) | 1; - } - selector_mask <<= 1; - } - - _maskStack.back() = _resultMask; - } - - inline void set(const PlaneList& pl) { _planeList = pl; setupMask(); } - - - inline void add(const osg::Plane& pl) { _planeList.push_back(pl); setupMask(); } - - /** flip/reverse the orientation of all the planes.*/ - inline void flip() - { - for(PlaneList::iterator itr=_planeList.begin(); - itr!=_planeList.end(); - ++itr) - { - itr->flip(); - } - } - - - inline PlaneList& getPlaneList() { return _planeList; } - - inline const PlaneList& getPlaneList() const { return _planeList; } - - - inline void setReferenceVertexList(VertexList& vertices) { _referenceVertexList=vertices; } - - inline VertexList& getReferenceVertexList() { return _referenceVertexList; } - - inline const VertexList& getReferenceVertexList() const { return _referenceVertexList; } - - - inline void setupMask() - { - _resultMask = 0; - for(unsigned int i=0;i<_planeList.size();++i) - { - _resultMask = (_resultMask<<1) | 1; - } - _maskStack.push_back(_resultMask); - } - - inline ClippingMask& getCurrentMask() { return _maskStack.back(); } - - inline ClippingMask getCurrentMask() const { return _maskStack.back(); } - - inline void setResultMask(ClippingMask mask) { _resultMask=mask; } - - inline ClippingMask getResultMask() const { return _resultMask; } - - MaskStack& getMaskStack() { return _maskStack; } - - const MaskStack& getMaskStack() const { return _maskStack; } - - - inline void pushCurrentMask() - { - _maskStack.push_back(_resultMask); - } - - inline void popCurrentMask() - { - _maskStack.pop_back(); - } - - /** Check whether a vertex is contained within clipping set.*/ - inline bool contains(const osg::Vec3& v) const - { - if (!_maskStack.back()) return true; - - unsigned int selector_mask = 0x1; - for(PlaneList::const_iterator itr=_planeList.begin(); - itr!=_planeList.end(); - ++itr) - { - if ((_maskStack.back()&selector_mask) && (itr->distance(v)<0.0f)) return false; - selector_mask <<= 1; - } - return true; - } - - /** Check whether any part of vertex list is contained within clipping set.*/ - inline bool contains(const std::vector& vertices) - { - if (!_maskStack.back()) return true; - - _resultMask = _maskStack.back(); - - for(std::vector::const_iterator vitr = vertices.begin(); - vitr != vertices.end(); - ++vitr) - { - const osg::Vec3& v = *vitr; - bool outside = false; - ClippingMask selector_mask = 0x1; - for(PlaneList::const_iterator itr=_planeList.begin(); - itr!=_planeList.end() && !outside; - ++itr) - { - if ((_maskStack.back()&selector_mask) && (itr->distance(v)<0.0f)) outside = true; - selector_mask <<= 1; - } - - if (!outside) return true; - } - return false; - } - - /** Check whether any part of a bounding sphere is contained within clipping set. - Using a mask to determine which planes should be used for the check, and - modifying the mask to turn off planes which wouldn't contribute to clipping - of any internal objects. This feature is used in osgUtil::CullVisitor - to prevent redundant plane checking.*/ - inline bool contains(const osg::BoundingSphere& bs) - { - if (!_maskStack.back()) return true; - - _resultMask = _maskStack.back(); - ClippingMask selector_mask = 0x1; - - for(PlaneList::const_iterator itr=_planeList.begin(); - itr!=_planeList.end(); - ++itr) - { - if (_resultMask&selector_mask) - { - int res=itr->intersect(bs); - if (res<0) return false; // outside clipping set. - else if (res>0) _resultMask ^= selector_mask; // subsequent checks against this plane not required. - } - selector_mask <<= 1; - } - return true; - } - - /** Check whether any part of a bounding box is contained within clipping set. - Using a mask to determine which planes should be used for the check, and - modifying the mask to turn off planes which wouldn't contribute to clipping - of any internal objects. This feature is used in osgUtil::CullVisitor - to prevent redundant plane checking.*/ - inline bool contains(const osg::BoundingBox& bb) - { - if (!_maskStack.back()) return true; - - _resultMask = _maskStack.back(); - ClippingMask selector_mask = 0x1; - - for(PlaneList::const_iterator itr=_planeList.begin(); - itr!=_planeList.end(); - ++itr) - { - if (_resultMask&selector_mask) - { - int res=itr->intersect(bb); - if (res<0) return false; // outside clipping set. - else if (res>0) _resultMask ^= selector_mask; // subsequent checks against this plane not required. - } - selector_mask <<= 1; - } - return true; - } - - /** Check whether all of vertex list is contained with clipping set.*/ - inline bool containsAllOf(const std::vector& vertices) - { - if (!_maskStack.back()) return false; - - _resultMask = _maskStack.back(); - ClippingMask selector_mask = 0x1; - - for(PlaneList::const_iterator itr=_planeList.begin(); - itr!=_planeList.end(); - ++itr) - { - if (_resultMask&selector_mask) - { - int res=itr->intersect(vertices); - if (res<1) return false; // intersects, or is below plane. - _resultMask ^= selector_mask; // subsequent checks against this plane not required. - } - selector_mask <<= 1; - } - return true; - } - - /** Check whether the entire bounding sphere is contained within clipping set.*/ - inline bool containsAllOf(const osg::BoundingSphere& bs) - { - if (!_maskStack.back()) return false; - - _resultMask = _maskStack.back(); - ClippingMask selector_mask = 0x1; - - for(PlaneList::const_iterator itr=_planeList.begin(); - itr!=_planeList.end(); - ++itr) - { - if (_resultMask&selector_mask) - { - int res=itr->intersect(bs); - if (res<1) return false; // intersects, or is below plane. - _resultMask ^= selector_mask; // subsequent checks against this plane not required. - } - selector_mask <<= 1; - } - return true; - } - - /** Check whether the entire bounding box is contained within clipping set.*/ - inline bool containsAllOf(const osg::BoundingBox& bb) - { - if (!_maskStack.back()) return false; - - _resultMask = _maskStack.back(); - ClippingMask selector_mask = 0x1; - - for(PlaneList::const_iterator itr=_planeList.begin(); - itr!=_planeList.end(); - ++itr) - { - if (_resultMask&selector_mask) - { - int res=itr->intersect(bb); - if (res<1) return false; // intersects, or is below plane. - _resultMask ^= selector_mask; // subsequent checks against this plane not required. - } - selector_mask <<= 1; - } - return true; - } - - - /** Transform the clipping set by matrix. Note, this operations carries out - * the calculation of the inverse of the matrix since a plane must - * be multiplied by the inverse transposed to transform it. This - * makes this operation expensive. If the inverse has been already - * calculated elsewhere then use transformProvidingInverse() instead. - * See http://www.worldserver.com/turk/computergraphics/NormalTransformations.pdf*/ - inline void transform(const osg::Matrix& matrix) - { - osg::Matrix inverse; - inverse.invert(matrix); - transformProvidingInverse(inverse); - } - - /** Transform the clipping set by provide a pre inverted matrix. - * see transform for details. */ - inline void transformProvidingInverse(const osg::Matrix& matrix) - { - if (!_maskStack.back()) return; - - _resultMask = _maskStack.back(); - ClippingMask selector_mask = 0x1; - for(PlaneList::iterator itr=_planeList.begin(); - itr!=_planeList.end(); - ++itr) - { - if (_resultMask&selector_mask) - { - itr->transformProvidingInverse(matrix); - selector_mask <<= 1; - } - } - } - - protected: - - - MaskStack _maskStack; - ClippingMask _resultMask; - PlaneList _planeList; - VertexList _referenceVertexList; - -}; - -} // end of namespace - -#endif diff --git a/libs/lib/mac32/include/osg/PositionAttitudeTransform b/libs/lib/mac32/include/osg/PositionAttitudeTransform deleted file mode 100644 index 00173483233d22c9343dd22317c143fe564a733a..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/PositionAttitudeTransform +++ /dev/null @@ -1,78 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_POSITIONATTITUDETRANSFORM -#define OSG_POSITIONATTITUDETRANSFORM 1 - -#include -#include -#include -#include -#include - -namespace osg { - -/** PositionAttitudeTransform - is a Transform. Sets the coordinate transform - via a Vec3 position and Quat attitude. -*/ -class OSG_EXPORT PositionAttitudeTransform : public Transform -{ - public : - PositionAttitudeTransform(); - - PositionAttitudeTransform(const PositionAttitudeTransform& pat,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - Transform(pat,copyop), - _position(pat._position), - _attitude(pat._attitude), - _scale(pat._scale), - _pivotPoint(pat._pivotPoint) {} - - - META_Node(osg, PositionAttitudeTransform); - - virtual PositionAttitudeTransform* asPositionAttitudeTransform() { return this; } - virtual const PositionAttitudeTransform* asPositionAttitudeTransform() const { return this; } - - inline void setPosition(const Vec3d& pos) { _position = pos; dirtyBound(); } - inline const Vec3d& getPosition() const { return _position; } - - - inline void setAttitude(const Quat& quat) { _attitude = quat; dirtyBound(); } - inline const Quat& getAttitude() const { return _attitude; } - - - inline void setScale(const Vec3d& scale) { _scale = scale; dirtyBound(); } - inline const Vec3d& getScale() const { return _scale; } - - - inline void setPivotPoint(const Vec3d& pivot) { _pivotPoint = pivot; dirtyBound(); } - inline const Vec3d& getPivotPoint() const { return _pivotPoint; } - - - virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const; - virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const; - - - protected : - - virtual ~PositionAttitudeTransform() {} - - Vec3d _position; - Quat _attitude; - Vec3d _scale; - Vec3d _pivotPoint; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/PrimitiveSet b/libs/lib/mac32/include/osg/PrimitiveSet deleted file mode 100644 index 294725ba131b21a82cf0a5197bd9b5537a90858a..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/PrimitiveSet +++ /dev/null @@ -1,565 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_PRIMITIVESET -#define OSG_PRIMITIVESET 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -namespace osg { - -typedef MixinVector VectorGLsizei; -typedef MixinVector VectorGLubyte; -typedef MixinVector VectorGLushort; -typedef MixinVector VectorGLuint; - -class State; - -/** A \c PrimitiveFunctor is used (in conjunction with - * osg::Drawable::accept (PrimitiveFunctor&)) to get access to the - * primitives that compose the things drawn by OSG. - *

If \c osg::Drawable::accept() is called with a \c PrimitiveFunctor - * parameter, the \c Drawable will "pretend" it is drawing itself, but instead - * of calling real OpenGL functions, it will call PrimitiveFunctor's - * member functions that "mimic" the OpenGL calls. - *

Concrete subclasses of \c PrimitiveFunctor must implement these methods - * so that they performs whatever they want. - */ -class PrimitiveFunctor -{ -public: - - virtual ~PrimitiveFunctor() {} - - /** Sets the array of vertices used to describe the primitives. Somehow - * mimics the OpenGL \c glVertexPointer() function. - */ - virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0; - - /** Sets the array of vertices used to describe the primitives. Somehow - * mimics the OpenGL \c glVertexPointer() function. - */ - virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0; - - /** Sets the array of vertices used to describe the primitives. Somehow - * mimics the OpenGL \c glVertexPointer() function. - */ - virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0; - - /** Sets the array of vertices used to describe the primitives. Somehow - * mimics the OpenGL \c glVertexPointer() function. - */ - virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0; - - /** Sets the array of vertices used to describe the primitives. Somehow - * mimics the OpenGL \c glVertexPointer() function. - */ - virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0; - - /** Sets the array of vertices used to describe the primitives. Somehow - * mimics the OpenGL \c glVertexPointer() function. - */ - virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0; - - /// Mimics the OpenGL \c glDrawArrays() function. - virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0; - - /// Mimics the OpenGL \c glDrawElements() function. - virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0; - - /// Mimics the OpenGL \c glDrawElements() function. - virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0; - - /// Mimics the OpenGL \c glDrawElements() function. - virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0; - - /// Mimics the OpenGL \c glBegin() function. - virtual void begin(GLenum mode) = 0; - - /// Mimics the OpenGL \c glVertex() "family of functions". - virtual void vertex(const Vec2& vert) = 0; - - /// Mimics the OpenGL \c glVertex() "family of functions". - virtual void vertex(const Vec3& vert) = 0; - - /// Mimics the OpenGL \c glVertex() "family of functions". - virtual void vertex(const Vec4& vert) = 0; - - /// Mimics the OpenGL \c glVertex() "family of functions". - virtual void vertex(float x,float y) = 0; - - /// Mimics the OpenGL \c glVertex() "family of functions". - virtual void vertex(float x,float y,float z) = 0; - - /// Mimics the OpenGL \c glVertex() "family of functions". - virtual void vertex(float x,float y,float z,float w) = 0; - - /// Mimics the OpenGL \c glEnd() function. - virtual void end() = 0; -}; - -class PrimitiveIndexFunctor -{ -public: - - virtual ~PrimitiveIndexFunctor() {} - - virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0; - virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0; - virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0; - - virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0; - virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0; - virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0; - - virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0; - virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0; - virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0; - virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0; - - virtual void begin(GLenum mode) = 0; - virtual void vertex(unsigned int pos) = 0; - virtual void end() = 0; -}; - -class DrawElements; - -class OSG_EXPORT PrimitiveSet : public BufferData -{ - public: - - enum Type - { - PrimitiveType, - DrawArraysPrimitiveType, - DrawArrayLengthsPrimitiveType, - DrawElementsUBytePrimitiveType, - DrawElementsUShortPrimitiveType, - DrawElementsUIntPrimitiveType - }; - - enum Mode - { - POINTS = GL_POINTS, - LINES = GL_LINES, - LINE_STRIP = GL_LINE_STRIP, - LINE_LOOP = GL_LINE_LOOP, - TRIANGLES = GL_TRIANGLES, - TRIANGLE_STRIP = GL_TRIANGLE_STRIP, - TRIANGLE_FAN = GL_TRIANGLE_FAN, - QUADS = GL_QUADS, - QUAD_STRIP = GL_QUAD_STRIP, - POLYGON = GL_POLYGON, - LINES_ADJACENCY = GL_LINES_ADJACENCY_EXT, - LINE_STRIP_ADJACENCY = GL_LINE_STRIP_ADJACENCY_EXT, - TRIANGLES_ADJACENCY = GL_TRIANGLES_ADJACENCY_EXT, - TRIANGLE_STRIP_ADJACENCY = GL_TRIANGLE_STRIP_ADJACENCY_EXT, - PATCHES = GL_PATCHES - }; - - PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0, int numInstances=0): - _primitiveType(primType), - _numInstances(numInstances), - _mode(mode) {} - - PrimitiveSet(const PrimitiveSet& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - BufferData(prim,copyop), - _primitiveType(prim._primitiveType), - _numInstances(prim._numInstances), - _mode(prim._mode) {} - - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "PrimitiveSet"; } - - Type getType() const { return _primitiveType; } - virtual const GLvoid* getDataPointer() const { return 0; } - virtual unsigned int getTotalDataSize() const { return 0; } - virtual bool supportsBufferObject() const { return false; } - - virtual DrawElements* getDrawElements() { return 0; } - virtual const DrawElements* getDrawElements() const { return 0; } - - void setNumInstances(int n) { _numInstances = n; } - int getNumInstances() const { return _numInstances; } - - void setMode(GLenum mode) { _mode = mode; } - GLenum getMode() const { return _mode; } - - virtual void draw(State& state, bool useVertexBufferObjects) const = 0; - - virtual void accept(PrimitiveFunctor& functor) const = 0; - virtual void accept(PrimitiveIndexFunctor& functor) const = 0; - - virtual unsigned int index(unsigned int pos) const = 0; - virtual unsigned int getNumIndices() const = 0; - virtual void offsetIndices(int offset) = 0; - - virtual unsigned int getNumPrimitives() const; - - virtual void computeRange() const {} - - protected: - - virtual ~PrimitiveSet() {} - - Type _primitiveType; - int _numInstances; - GLenum _mode; -}; - -class OSG_EXPORT DrawArrays : public PrimitiveSet -{ - public: - - DrawArrays(GLenum mode=0): - PrimitiveSet(DrawArraysPrimitiveType,mode), - _first(0), - _count(0) {} - - DrawArrays(GLenum mode, GLint first, GLsizei count, int numInstances=0): - PrimitiveSet(DrawArraysPrimitiveType, mode, numInstances), - _first(first), - _count(count) {} - - DrawArrays(const DrawArrays& da,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - PrimitiveSet(da,copyop), - _first(da._first), - _count(da._count) {} - - virtual Object* cloneType() const { return new DrawArrays(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "DrawArrays"; } - - - void set(GLenum mode,GLint first, GLsizei count) - { - _mode = mode; - _first = first; - _count = count; - } - - void setFirst(GLint first) { _first = first; } - GLint getFirst() const { return _first; } - - void setCount(GLsizei count) { _count = count; } - GLsizei getCount() const { return _count; } - - virtual void draw(State& state, bool useVertexBufferObjects) const; - - virtual void accept(PrimitiveFunctor& functor) const; - virtual void accept(PrimitiveIndexFunctor& functor) const; - - virtual unsigned int getNumIndices() const { return static_cast(_count); } - virtual unsigned int index(unsigned int pos) const { return static_cast(_first)+pos; } - virtual void offsetIndices(int offset) { _first += offset; } - - protected: - - virtual ~DrawArrays() {} - - GLint _first; - GLsizei _count; -}; - -class OSG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorGLsizei -{ - public: - - typedef VectorGLsizei vector_type; - - DrawArrayLengths(GLenum mode=0): - PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), - _first(0) {} - - DrawArrayLengths(const DrawArrayLengths& dal,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - PrimitiveSet(dal,copyop), - vector_type(dal), - _first(dal._first) {} - - DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) : - PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), - vector_type(ptr,ptr+no), - _first(first) {} - - DrawArrayLengths(GLenum mode,GLint first, unsigned int no) : - PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), - vector_type(no), - _first(first) {} - - DrawArrayLengths(GLenum mode,GLint first) : - PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), - vector_type(), - _first(first) {} - - - virtual Object* cloneType() const { return new DrawArrayLengths(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "DrawArrayLengths"; } - - - void setFirst(GLint first) { _first = first; } - GLint getFirst() const { return _first; } - - virtual void draw(State& state, bool useVertexBufferObjects) const; - - virtual void accept(PrimitiveFunctor& functor) const; - virtual void accept(PrimitiveIndexFunctor& functor) const; - - virtual unsigned int getNumIndices() const; - virtual unsigned int index(unsigned int pos) const { return _first+pos; } - virtual void offsetIndices(int offset) { _first += offset; } - - virtual unsigned int getNumPrimitives() const; - - protected: - - virtual ~DrawArrayLengths() {} - - GLint _first; -}; - -class DrawElements : public PrimitiveSet -{ - public: - - DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0): - PrimitiveSet(primType,mode, numInstances) {} - - DrawElements(const DrawElements& copy,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - PrimitiveSet(copy,copyop) {} - - - virtual DrawElements* getDrawElements() { return this; } - virtual const DrawElements* getDrawElements() const { return this; } - - /** Set the ElementBufferObject.*/ - inline void setElementBufferObject(osg::ElementBufferObject* ebo) { setBufferObject(ebo); } - - /** Get the ElementBufferObject. If no EBO is assigned returns NULL*/ - inline osg::ElementBufferObject* getElementBufferObject() { return dynamic_cast(_bufferObject.get()); } - - /** Get the const ElementBufferObject. If no EBO is assigned returns NULL*/ - inline const osg::ElementBufferObject* getElementBufferObject() const { return dynamic_cast(_bufferObject.get()); } - - virtual void reserveElements(unsigned int numIndices) = 0; - virtual void setElement(unsigned int, unsigned int) = 0; - virtual unsigned int getElement(unsigned int) = 0; - virtual void addElement(unsigned int) = 0; - - protected: - - virtual ~DrawElements() {} -}; - -class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte -{ - public: - - typedef VectorGLubyte vector_type; - - DrawElementsUByte(GLenum mode=0): - DrawElements(DrawElementsUBytePrimitiveType,mode) {} - - DrawElementsUByte(const DrawElementsUByte& array, const CopyOp& copyop=CopyOp::SHALLOW_COPY): - DrawElements(array,copyop), - vector_type(array) {} - - /** - * \param no Number of intended elements. This will be the size of the underlying vector. - */ - DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte* ptr, int numInstances=0) : - DrawElements(DrawElementsUBytePrimitiveType,mode,numInstances), - vector_type(ptr,ptr+no) {} - - /** - * \param no Number of intended elements. This will be the size of the underlying vector. - */ - DrawElementsUByte(GLenum mode, unsigned int no) : - DrawElements(DrawElementsUBytePrimitiveType,mode), - vector_type(no) {} - - virtual Object* cloneType() const { return new DrawElementsUByte(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "DrawElementsUByte"; } - - virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); } - virtual unsigned int getTotalDataSize() const { return static_cast(size()); } - virtual bool supportsBufferObject() const { return false; } - - virtual void draw(State& state, bool useVertexBufferObjects) const ; - - virtual void accept(PrimitiveFunctor& functor) const; - virtual void accept(PrimitiveIndexFunctor& functor) const; - - virtual unsigned int getNumIndices() const { return static_cast(size()); } - virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } - virtual void offsetIndices(int offset); - - virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); } - virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; } - virtual unsigned int getElement(unsigned int i) { return (*this)[i]; } - virtual void addElement(unsigned int v) { push_back(GLubyte(v)); } - - protected: - - virtual ~DrawElementsUByte(); -}; - - -class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort -{ - public: - - typedef VectorGLushort vector_type; - - DrawElementsUShort(GLenum mode=0): - DrawElements(DrawElementsUShortPrimitiveType,mode) {} - - DrawElementsUShort(const DrawElementsUShort& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - DrawElements(array,copyop), - vector_type(array) {} - - /** - * \param no Number of intended elements. This will be the size of the underlying vector. - */ - DrawElementsUShort(GLenum mode, unsigned int no, const GLushort* ptr, int numInstances=0) : - DrawElements(DrawElementsUShortPrimitiveType,mode,numInstances), - vector_type(ptr,ptr+no) {} - - /** - * \param no Number of intended elements. This will be the size of the underlying vector. - */ - DrawElementsUShort(GLenum mode, unsigned int no) : - DrawElements(DrawElementsUShortPrimitiveType,mode), - vector_type(no) {} - - template - DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) : - DrawElements(DrawElementsUShortPrimitiveType,mode), - vector_type(first,last) {} - - virtual Object* cloneType() const { return new DrawElementsUShort(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "DrawElementsUShort"; } - - virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); } - virtual unsigned int getTotalDataSize() const { return 2u*static_cast(size()); } - virtual bool supportsBufferObject() const { return false; } - - virtual void draw(State& state, bool useVertexBufferObjects) const; - - virtual void accept(PrimitiveFunctor& functor) const; - virtual void accept(PrimitiveIndexFunctor& functor) const; - - virtual unsigned int getNumIndices() const { return static_cast(size()); } - virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } - virtual void offsetIndices(int offset); - - virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); } - virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; } - virtual unsigned int getElement(unsigned int i) { return (*this)[i]; } - virtual void addElement(unsigned int v) { push_back(GLushort(v)); } - - protected: - - virtual ~DrawElementsUShort(); -}; - -class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint -{ - public: - - typedef VectorGLuint vector_type; - - DrawElementsUInt(GLenum mode=0): - DrawElements(DrawElementsUIntPrimitiveType,mode) {} - - DrawElementsUInt(const DrawElementsUInt& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - DrawElements(array,copyop), - vector_type(array) {} - - /** - * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used. - * \param no Number of intended elements. This will be the size of the underlying vector. - */ - DrawElementsUInt(GLenum mode, unsigned int no, const GLuint* ptr, int numInstances=0) : - DrawElements(DrawElementsUIntPrimitiveType,mode,numInstances), - vector_type(ptr,ptr+no) {} - - /** - * \param no Number of intended elements. This will be the size of the underlying vector. - */ - DrawElementsUInt(GLenum mode, unsigned int no) : - DrawElements(DrawElementsUIntPrimitiveType,mode), - vector_type(no) {} - - template - DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) : - DrawElements(DrawElementsUIntPrimitiveType,mode), - vector_type(first,last) {} - - virtual Object* cloneType() const { return new DrawElementsUInt(); } - virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); } - virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } - virtual const char* libraryName() const { return "osg"; } - virtual const char* className() const { return "DrawElementsUInt"; } - - virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); } - virtual unsigned int getTotalDataSize() const { return 4u*static_cast(size()); } - virtual bool supportsBufferObject() const { return false; } - - virtual void draw(State& state, bool useVertexBufferObjects) const; - - virtual void accept(PrimitiveFunctor& functor) const; - virtual void accept(PrimitiveIndexFunctor& functor) const; - - virtual unsigned int getNumIndices() const { return static_cast(size()); } - virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } - virtual void offsetIndices(int offset); - - virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); } - virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; } - virtual unsigned int getElement(unsigned int i) { return (*this)[i]; } - virtual void addElement(unsigned int v) { push_back(GLuint(v)); } - - protected: - - virtual ~DrawElementsUInt(); -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Program b/libs/lib/mac32/include/osg/Program deleted file mode 100644 index 0d7febfec9bf2082dfba8c57469f4aec89a8a2c8..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Program +++ /dev/null @@ -1,406 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * Copyright (C) 2003-2005 3Dlabs Inc. Ltd. - * Copyright (C) 2004-2005 Nathan Cournia - * Copyright (C) 2008 Zebra Imaging - * Copyright (C) 2010 Vires Simulationstechnologie GmbH - * - * This application is open source and may be redistributed and/or modified - * freely and without restriction, both in commercial and non commercial - * applications, as long as this copyright notice is maintained. - * - * This application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -*/ - -/* file: include/osg/Program - * author: Mike Weiblen 2008-01-02 - * Holger Helmich 2010-10-21 -*/ - -#ifndef OSG_PROGRAM -#define OSG_PROGRAM 1 - -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace osg { - -class State; - - -/////////////////////////////////////////////////////////////////////////// -/** osg::Program is an application-level abstraction of an OpenGL glProgram. - * It is an osg::StateAttribute that, when applied, will activate a - * glProgram for subsequent rendering. - * osg::Shaders containing the actual shader source code are - * attached to a Program, which will then manage the compilation, - * linking, and activation of the GLSL program. - * osg::Program will automatically manage per-context instancing of the - * OpenGL glPrograms, if that is necessary for a particular display - * configuration. - */ - -class OSG_EXPORT Program : public osg::StateAttribute -{ - public: - Program(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Program(const Program& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - - META_StateAttribute(osg, Program, PROGRAM); - - /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ - virtual int compare(const osg::StateAttribute& sa) const; - - /** If enabled, activate our program in the GL pipeline, - * performing any rebuild operations that might be pending. */ - virtual void apply(osg::State& state) const; - - /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ - virtual void setThreadSafeRefUnref(bool threadSafe); - - /** Compile program and associated shaders.*/ - virtual void compileGLObjects(osg::State& state) const; - - /** Resize any per context GLObject buffers to specified size. */ - virtual void resizeGLObjectBuffers(unsigned int maxSize); - - /** release OpenGL objects in specified graphics context if State - object is passed, otherwise release OpenGL objects for all graphics context if - State object pointer NULL.*/ - virtual void releaseGLObjects(osg::State* state=0) const; - - /** Mark our PCSOs as needing relink */ - void dirtyProgram(); - - /** Attach an osg::Shader to this osg::Program. - * Mark Program as needing relink. Return true for success */ - bool addShader( Shader* shader ); - - unsigned int getNumShaders() const { return static_cast(_shaderList.size()); } - - Shader* getShader( unsigned int i ) { return _shaderList[i].get(); } - const Shader* getShader( unsigned int i ) const { return _shaderList[i].get(); } - - /** Remove osg::Shader from this osg::Program. - * Mark Program as needing relink. Return true for success */ - bool removeShader( Shader* shader ); - - /** Set/get GL program parameters */ - void setParameter( GLenum pname, GLint value ); - GLint getParameter( GLenum pname ) const; - - void setParameterfv( GLenum pname, const GLfloat* value ); - const GLfloat* getParameterfv( GLenum pname ) const; - - /** Add an attribute location binding. */ - void addBindAttribLocation( const std::string& name, GLuint index ); - - /** Remove an attribute location binding. */ - void removeBindAttribLocation( const std::string& name ); - - /** Add an frag data location binding. See EXT_gpu_shader4 for BindFragDataLocationEXT */ - void addBindFragDataLocation( const std::string& name, GLuint index ); - - /** Remove an frag data location binding. */ - void removeBindFragDataLocation( const std::string& name ); - - /** Add a uniform block binding to an index target. XXX This - * should not be an attribute of the program. It should be a - * pseudo-uniform that can live in StateSet objects because - * it is cheap to set. */ - void addBindUniformBlock(const std::string& name, GLuint index); - - /** Remove a uniform block binding. */ - void removeBindUniformBlock(const std::string& name); - - /** Simple class for wrapping up the data used in glProgramBinary and glGetProgramBinary. - * On the first run of your application Programs should be assigned an empty ProgramBinary. - * Before your application exits it should retrieve the program binary via - * Program::PerContextProgram::compileProgramBinary and save it to disk. - * When your application is run subsequently, load your binary from disk and use it to set - * the data of a ProgramBinary, and set the ProgramBinary on the associated Program. - * This will typically result in Program::compileGLObjects executing much faster.*/ - class OSG_EXPORT ProgramBinary : public osg::Object - { - public: - - ProgramBinary(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - ProgramBinary(const ProgramBinary& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); - - META_Object(osg, ProgramBinary); - - /** Allocated a data buffer of specified size/*/ - void allocate(unsigned int size); - - /** Assign program binary data, copying the specified data into locally stored data buffer, the original data can then be deleted.*/ - void assign(unsigned int size, const unsigned char* data); - - /** Set the format of the program binary data.*/ - void setFormat(GLenum format) {_format = format;} - - /** Get the format of the program binary data.*/ - GLenum getFormat() const {return _format;} - - /** Get the size of the program binary data.*/ - unsigned int getSize() const { return _data.size(); } - - /** Get a ptr to the program binary data.*/ - unsigned char* getData() { return _data.empty() ? 0 : &(_data.front()); } - - /** Get a const ptr to the program binary data.*/ - const unsigned char* getData() const { return _data.empty() ? 0 : &(_data.front()); } - - protected: - std::vector _data; - GLenum _format; - }; - - - /** Set the Program using a ProgramBinary. If a ProgramBinary is not yet - * available then setting an empty one signals that compileProgramBinary - * will be called later.*/ - void setProgramBinary(ProgramBinary* programBinary) { _programBinary = programBinary; } - - /** Get the Program's ProgramBinary, return NULL if none is assigned. */ - ProgramBinary* getProgramBinary() { return _programBinary.get(); } - - /** Get the const Program's ProgramBinary, return NULL if none is assigned. */ - const ProgramBinary* getProgramBinary() const { return _programBinary.get(); } - - typedef std::map AttribBindingList; - typedef std::map FragDataBindingList; - typedef std::map UniformBlockBindingList; - - const AttribBindingList& getAttribBindingList() const { return _attribBindingList; } - const FragDataBindingList& getFragDataBindingList() const { return _fragDataBindingList; } - const UniformBlockBindingList& getUniformBlockBindingList() const { return _uniformBlockBindingList; } - - /** Return true if this Program represents "fixed-functionality" rendering */ - bool isFixedFunction() const; - - /** Query InfoLog from a glProgram */ - bool getGlProgramInfoLog(unsigned int contextID, std::string& log) const; - - /** Mark internal glProgram for deletion. - * Deletion requests are queued until they can be executed - * in the proper GL context. */ - static void deleteGlProgram(unsigned int contextID, GLuint program); - - /** flush all the cached glPrograms which need to be deleted - * in the OpenGL context related to contextID.*/ - static void flushDeletedGlPrograms(unsigned int contextID,double currentTime, double& availableTime); - - /** discard all the cached glPrograms which need to be deleted - * in the OpenGL context related to contextID. - * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. - * this call is useful for when an OpenGL context has been destroyed. */ - static void discardDeletedGlPrograms(unsigned int contextID); - - struct ActiveVarInfo { - ActiveVarInfo() : _location(-1), _type(Uniform::UNDEFINED), _size(-1) {} - ActiveVarInfo( GLint loc, GLenum type, GLint size ) : _location(loc), _type(type), _size(size) {} - GLint _location; - GLenum _type; - GLint _size; - }; - typedef std::map< unsigned int, ActiveVarInfo > ActiveUniformMap; - typedef std::map< std::string, ActiveVarInfo > ActiveVarInfoMap; - const ActiveUniformMap& getActiveUniforms(unsigned int contextID) const; - const ActiveVarInfoMap& getActiveAttribs(unsigned int contextID) const; - struct UniformBlockInfo - { - UniformBlockInfo() : _index(GL_INVALID_INDEX), _size(0) {} - UniformBlockInfo(GLuint index, GLsizei size) - : _index(index), _size(size) - { - } - GLuint _index; - GLsizei _size; - }; - typedef std::map UniformBlockMap; - const UniformBlockMap& getUniformBlocks(unsigned contextID) const; - public: - - // make PerContextProgram a friend to allow it access Program's protected - // methods and member variables. - class PerContextProgram; - friend class PerContextProgram; - - /** PerContextProgram (PCP) is an OSG-internal encapsulation of glPrograms per-GL context. */ - class OSG_EXPORT PerContextProgram : public osg::Referenced - { - public: - PerContextProgram(const Program* program, unsigned int contextID); - - GLuint getHandle() const {return _glProgramHandle;} - - void requestLink(); - void linkProgram(osg::State& state); - bool validateProgram(); - bool needsLink() const {return _needsLink;} - bool isLinked() const {return _isLinked;} - bool getInfoLog( std::string& infoLog ) const; - - /** Was glProgramBinary called successfully? */ - bool loadedBinary() const {return _loadedBinary;} - - /** Compile a program binary. For this to work setProgramBinary must have - * been called on the osg::Program with an empty ProgramBinary prior to - * compileGLObjects being called. - * compileProgramBinary should be called after the program has been - * "exercised" by rendering with it. The ProgramBinary can then be saved - * to disk for faster subsequent compiling. */ - ProgramBinary* compileProgramBinary(osg::State& state); - - void useProgram() const; - - void resetAppliedUniforms() const - { - for(LastAppliedUniformList::iterator itr=_lastAppliedUniformList.begin(); - itr!=_lastAppliedUniformList.end(); - ++itr) - { - (*itr).first = 0; - (*itr).second = 0; - } - } - - - inline void apply(const Uniform& uniform) const - { - GLint location = getUniformLocation(uniform.getNameID()); - if (location>=0) - { - if ((unsigned int)location>=_lastAppliedUniformList.size()) _lastAppliedUniformList.resize(location+1); - const Uniform* lastAppliedUniform = _lastAppliedUniformList[location].first.get(); - if (lastAppliedUniform != &uniform) - { - // new attribute - uniform.apply(_extensions.get(),location); - _lastAppliedUniformList[location].first = &uniform; - _lastAppliedUniformList[location].second = uniform.getModifiedCount(); - } - else if (_lastAppliedUniformList[location].second != uniform.getModifiedCount()) - { - // existing attribute has been modified - uniform.apply(_extensions.get(),location); - _lastAppliedUniformList[location].first = &uniform; - _lastAppliedUniformList[location].second = uniform.getModifiedCount(); - } - } - } - - const ActiveUniformMap& getActiveUniforms() const {return _uniformInfoMap;} - const ActiveVarInfoMap& getActiveAttribs() const {return _attribInfoMap;} - const UniformBlockMap& getUniformBlocks() const {return _uniformBlockMap; } - inline GLint getUniformLocation( unsigned int uniformNameID ) const { ActiveUniformMap::const_iterator itr = _uniformInfoMap.find(uniformNameID); return (itr!=_uniformInfoMap.end()) ? itr->second._location : -1; } - - /** - * Alternative version of getUniformLocation( unsigned int uniformNameID ) - * retrofited into OSG for backward compatibility with osgCal, - * after uniform ids were refactored from std::strings to GLints in OSG version 2.9.10. - * - * Drawbacks: This method is not particularly fast. It has to access mutexed static - * map of uniform ids. So don't overuse it or your app performance will suffer. - */ - inline GLint getUniformLocation( const std::string & uniformName ) const { return getUniformLocation( Uniform::getNameID( uniformName ) ); } - - inline GLint getAttribLocation( const std::string& name ) const { ActiveVarInfoMap::const_iterator itr = _attribInfoMap.find(name); return (itr!=_attribInfoMap.end()) ? itr->second._location : -1; } - - inline void addShaderToAttach(Shader *shader) - { - _shadersToAttach.push_back(shader); - } - - inline void addShaderToDetach(Shader *shader) - { - _shadersToDetach.push_back(shader); - } - - protected: /*methods*/ - ~PerContextProgram(); - - protected: /*data*/ - /** Pointer to our parent Program */ - const Program* _program; - /** Pointer to this context's extension functions */ - osg::ref_ptr _extensions; - /** Handle to the actual OpenGL glProgram */ - GLuint _glProgramHandle; - /** Does our glProgram need to be linked? */ - bool _needsLink; - /** Is our glProgram successfully linked? */ - bool _isLinked; - /** Was glProgramBinary called successfully? */ - bool _loadedBinary; - const unsigned int _contextID; - - ActiveUniformMap _uniformInfoMap; - ActiveVarInfoMap _attribInfoMap; - UniformBlockMap _uniformBlockMap; - - typedef std::pair, unsigned int> UniformModifiedCountPair; - typedef std::vector LastAppliedUniformList; - mutable LastAppliedUniformList _lastAppliedUniformList; - - typedef std::vector< ref_ptr > ShaderList; - ShaderList _shadersToDetach; - ShaderList _shadersToAttach; - - private: - PerContextProgram(); // disallowed - PerContextProgram(const PerContextProgram&); // disallowed - PerContextProgram& operator=(const PerContextProgram&); // disallowed - }; - - /** Get the PCP for a particular GL context */ - PerContextProgram* getPCP(unsigned int contextID) const; - - protected: /*methods*/ - virtual ~Program(); - - protected: /*data*/ - - mutable osg::buffered_value< osg::ref_ptr > _pcpList; - AttribBindingList _attribBindingList; - FragDataBindingList _fragDataBindingList; - UniformBlockBindingList _uniformBlockBindingList; - - typedef std::vector< ref_ptr > ShaderList; - ShaderList _shaderList; - - osg::ref_ptr _programBinary; - - /** Parameters maintained with glProgramParameteriEXT */ - GLint _geometryVerticesOut; - GLint _geometryInputType; - GLint _geometryOutputType; - - /** Parameter maintained with glPatchParameteri */ - GLint _patchVertices; - - /** Parameter maintained with glPatchParameterfv */ - // todo add tessellation default level - //GLfloat _patchDefaultInnerLevel[2]; - //GLfloat _patchDefaultOuterLevel[4]; - - private: - Program& operator=(const Program&); // disallowed - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Projection b/libs/lib/mac32/include/osg/Projection deleted file mode 100644 index 327fe99992ab00478d15f89ff52ee9f20588af5c..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Projection +++ /dev/null @@ -1,61 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_PROJECTION -#define OSG_PROJECTION 1 - -#include -#include - -namespace osg { - -/** Projection nodes set up the frustum/orthographic projection used when rendering the scene. -*/ -class OSG_EXPORT Projection : public Group -{ - public : - - - Projection(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - Projection(const Projection&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - Projection(const Matrix& matix); - - META_Node(osg, Projection); - - /** Set the transform's matrix.*/ - void setMatrix(const Matrix& mat) { _matrix = mat; } - - /** Get the transform's matrix. */ - inline const Matrix& getMatrix() const { return _matrix; } - - /** preMult transform.*/ - void preMult(const Matrix& mat) { _matrix.preMult(mat); } - - /** postMult transform.*/ - void postMult(const Matrix& mat) { _matrix.postMult(mat); } - - - protected : - - virtual ~Projection(); - - Matrix _matrix; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/ProxyNode b/libs/lib/mac32/include/osg/ProxyNode deleted file mode 100644 index a9d5c233e852c3a7d5d6afa6a2d1a85b296c35a1..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/ProxyNode +++ /dev/null @@ -1,141 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_ProxyNode -#define OSG_ProxyNode 1 - -#include - -namespace osg { - -/** ProxyNode. -*/ -class OSG_EXPORT ProxyNode : public Group -{ - public : - - ProxyNode(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - ProxyNode(const ProxyNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, ProxyNode); - - typedef osg::BoundingSphere::vec_type vec_type; - typedef osg::BoundingSphere::value_type value_type; - - virtual void traverse(NodeVisitor& nv); - - virtual bool addChild(Node *child); - virtual bool addChild(Node *child, const std::string& filename); - - virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove); - - - /** Set the optional database osgDB::Options object to use when loaded children.*/ - void setDatabaseOptions(osg::Referenced* options) { _databaseOptions = options; } - - /** Get the optional database osgDB::Options object used when loaded children.*/ - osg::Referenced* getDatabaseOptions() { return _databaseOptions.get(); } - - /** Get the optional database osgDB::Options object used when loaded children.*/ - const osg::Referenced* getDatabaseOptions() const { return _databaseOptions.get(); } - - - /** Set the database path to prepend to children's filenames.*/ - void setDatabasePath(const std::string& path); - /** Get the database path used to prepend to children's filenames.*/ - inline const std::string& getDatabasePath() const { return _databasePath; } - - void setFileName(unsigned int childNo, const std::string& filename) { expandFileNameListTo(childNo); _filenameList[childNo].first=filename; } - const std::string& getFileName(unsigned int childNo) const { return _filenameList[childNo].first; } - unsigned int getNumFileNames() const { return _filenameList.size(); } - - /** Return the DatabaseRequest object used by the DatabasePager to keep track of file load requests - * being carried on behalf of the DatabasePager. - * Note, in normal OSG usage you should not set this value yourself, as this will be managed by - * the osgDB::DatabasePager.*/ - osg::ref_ptr& getDatabaseRequest(unsigned int childNo) { return _filenameList[childNo].second; } - - /** Return the const DatabaseRequest object.*/ - const osg::ref_ptr& getDatabaseRequest(unsigned int childNo) const { return _filenameList[childNo].second; } - - - /** Modes which control how the center of object should be determined when computed which child is active.*/ - enum CenterMode - { - USE_BOUNDING_SPHERE_CENTER, - USER_DEFINED_CENTER - }; - - /** Set how the center of object should be determined when computed which child is active.*/ - void setCenterMode(CenterMode mode) { _centerMode=mode; } - - /** Get how the center of object should be determined when computed which child is active.*/ - CenterMode getCenterMode() const { return _centerMode; } - - /** Modes which control how the proxynode external reference are loaded.*/ - enum LoadingExternalReferenceMode - { - LOAD_IMMEDIATELY, - DEFER_LOADING_TO_DATABASE_PAGER, - NO_AUTOMATIC_LOADING - }; - - /** Set how the child loading is done.*/ - void setLoadingExternalReferenceMode(LoadingExternalReferenceMode mode) { _loadingExtReference=mode; } - - /** Get the setted mode of loading.*/ - LoadingExternalReferenceMode getLoadingExternalReferenceMode() const { return _loadingExtReference; } - - /** Sets the object-space point which defines the center of the osg::ProxyNode. - center is affected by any transforms in the hierarchy above the osg::ProxyNode.*/ - inline void setCenter(const Vec3& center) { _centerMode=USER_DEFINED_CENTER; _userDefinedCenter = center; } - - /** return the ProxyNode center point. */ - inline const vec_type& getCenter() const { if (_centerMode==USER_DEFINED_CENTER) return _userDefinedCenter; else return getBound().center(); } - - - /** Set the object-space reference radius of the volume enclosed by the ProxyNode. - * Used to determine the bounding sphere of the ProxyNode in the absence of any children.*/ - inline void setRadius(value_type radius) { _radius = radius; } - - /** Get the object-space radius of the volume enclosed by the ProxyNode.*/ - inline value_type getRadius() const { return _radius; } - - virtual BoundingSphere computeBound() const; - - protected : - - virtual ~ProxyNode() {} - - void expandFileNameListTo(unsigned int pos); - - typedef std::pair< std::string, osg::ref_ptr > FileNameDatabaseRequestPair; - typedef std::vector FileNameDatabaseRequestList; - - FileNameDatabaseRequestList _filenameList; - ref_ptr _databaseOptions; - std::string _databasePath; - - LoadingExternalReferenceMode _loadingExtReference; - - CenterMode _centerMode; - vec_type _userDefinedCenter; - value_type _radius; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Quat b/libs/lib/mac32/include/osg/Quat deleted file mode 100644 index eac627893d372acecc667c11afba1a7059c721f3..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Quat +++ /dev/null @@ -1,393 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_QUAT -#define OSG_QUAT 1 - -#include -#include -#include -#include -#include - -namespace osg { - -class Matrixf; -class Matrixd; - -/** A quaternion class. It can be used to represent an orientation in 3D space.*/ -class OSG_EXPORT Quat -{ - - public: - - typedef double value_type; - - value_type _v[4]; // a four-vector - - inline Quat() { _v[0]=0.0; _v[1]=0.0; _v[2]=0.0; _v[3]=1.0; } - - inline Quat( value_type x, value_type y, value_type z, value_type w ) - { - _v[0]=x; - _v[1]=y; - _v[2]=z; - _v[3]=w; - } - - inline Quat( const Vec4f& v ) - { - _v[0]=v.x(); - _v[1]=v.y(); - _v[2]=v.z(); - _v[3]=v.w(); - } - - inline Quat( const Vec4d& v ) - { - _v[0]=v.x(); - _v[1]=v.y(); - _v[2]=v.z(); - _v[3]=v.w(); - } - - inline Quat( value_type angle, const Vec3f& axis) - { - makeRotate(angle,axis); - } - inline Quat( value_type angle, const Vec3d& axis) - { - makeRotate(angle,axis); - } - - inline Quat( value_type angle1, const Vec3f& axis1, - value_type angle2, const Vec3f& axis2, - value_type angle3, const Vec3f& axis3) - { - makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); - } - - inline Quat( value_type angle1, const Vec3d& axis1, - value_type angle2, const Vec3d& axis2, - value_type angle3, const Vec3d& axis3) - { - makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); - } - - inline Quat& operator = (const Quat& v) { _v[0]=v._v[0]; _v[1]=v._v[1]; _v[2]=v._v[2]; _v[3]=v._v[3]; return *this; } - - inline bool operator == (const Quat& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2] && _v[3]==v._v[3]; } - - inline bool operator != (const Quat& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1] || _v[2]!=v._v[2] || _v[3]!=v._v[3]; } - - inline bool operator < (const Quat& v) const - { - if (_v[0]v._v[0]) return false; - else if (_v[1]v._v[1]) return false; - else if (_v[2]v._v[2]) return false; - else return (_v[3] - -#include -#include -#include - -#if !defined(_OPENTHREADS_ATOMIC_USE_MUTEX) -# define _OSG_REFERENCED_USE_ATOMIC_OPERATIONS -#endif - -namespace osg { - -// forward declare, declared after Referenced below. -class DeleteHandler; -class Observer; -class ObserverSet; - -/** template class to help enforce static initialization order. */ -template -struct depends_on -{ - depends_on() { M(); } -}; - -/** Base class for providing reference counted objects.*/ -class OSG_EXPORT Referenced -{ - - public: - - - Referenced(); - - explicit Referenced(bool threadSafeRefUnref); - - Referenced(const Referenced&); - - inline Referenced& operator = (const Referenced&) { return *this; } - - /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ - virtual void setThreadSafeRefUnref(bool threadSafe); - - /** Get whether a mutex is used to ensure ref() and unref() are thread safe.*/ - -#if defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) - bool getThreadSafeRefUnref() const { return true; } -#else - bool getThreadSafeRefUnref() const { return _refMutex!=0; } -#endif - - /** Get the mutex used to ensure thread safety of ref()/unref(). */ -#if defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) - OpenThreads::Mutex* getRefMutex() const { return getGlobalReferencedMutex(); } -#else - OpenThreads::Mutex* getRefMutex() const { return _refMutex; } -#endif - - /** Get the optional global Referenced mutex, this can be shared between all osg::Referenced.*/ - static OpenThreads::Mutex* getGlobalReferencedMutex(); - - /** Increment the reference count by one, indicating that - this object has another pointer which is referencing it.*/ - inline int ref() const; - - /** Decrement the reference count by one, indicating that - a pointer to this object is referencing it. If the - reference count goes to zero, it is assumed that this object - is no longer referenced and is automatically deleted.*/ - inline int unref() const; - - /** Decrement the reference count by one, indicating that - a pointer to this object is referencing it. However, do - not delete it, even if ref count goes to 0. Warning, unref_nodelete() - should only be called if the user knows exactly who will - be responsible for, one should prefer unref() over unref_nodelete() - as the latter can lead to memory leaks.*/ - int unref_nodelete() const; - - /** Return the number of pointers currently referencing this object. */ - inline int referenceCount() const { return _refCount; } - - - /** Get the ObserverSet if one is attached, otherwise return NULL.*/ - ObserverSet* getObserverSet() const - { - #if defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) - return static_cast(_observerSet.get()); - #else - return static_cast(_observerSet); - #endif - } - - /** Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet.*/ - ObserverSet* getOrCreateObserverSet() const; - - /** Add a Observer that is observing this object, notify the Observer when this object gets deleted.*/ - void addObserver(Observer* observer) const; - - /** Remove Observer that is observing this object.*/ - void removeObserver(Observer* observer) const; - - public: - - /** Set whether reference counting should use a mutex for thread safe reference counting.*/ - static void setThreadSafeReferenceCounting(bool enableThreadSafeReferenceCounting); - - /** Get whether reference counting is active.*/ - static bool getThreadSafeReferenceCounting(); - - friend class DeleteHandler; - - /** Set a DeleteHandler to which deletion of all referenced counted objects - * will be delegated.*/ - static void setDeleteHandler(DeleteHandler* handler); - - /** Get a DeleteHandler.*/ - static DeleteHandler* getDeleteHandler(); - - - protected: - - virtual ~Referenced(); - - void signalObserversAndDelete(bool signalDelete, bool doDelete) const; - - void deleteUsingDeleteHandler() const; - -#if defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) - mutable OpenThreads::AtomicPtr _observerSet; - - mutable OpenThreads::Atomic _refCount; -#else - - mutable OpenThreads::Mutex* _refMutex; - - mutable int _refCount; - - mutable void* _observerSet; -#endif -}; - -inline int Referenced::ref() const -{ -#if defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) - return ++_refCount; -#else - if (_refMutex) - { - OpenThreads::ScopedLock lock(*_refMutex); - return ++_refCount; - } - else - { - return ++_refCount; - } -#endif -} - -inline int Referenced::unref() const -{ - int newRef; -#if defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) - newRef = --_refCount; - bool needDelete = (newRef == 0); -#else - bool needDelete = false; - if (_refMutex) - { - OpenThreads::ScopedLock lock(*_refMutex); - newRef = --_refCount; - needDelete = newRef==0; - } - else - { - newRef = --_refCount; - needDelete = newRef==0; - } -#endif - - if (needDelete) - { - signalObserversAndDelete(true,true); - } - return newRef; -} - -// intrusive_ptr_add_ref and intrusive_ptr_release allow -// use of osg Referenced classes with boost::intrusive_ptr -inline void intrusive_ptr_add_ref(Referenced* p) { p->ref(); } -inline void intrusive_ptr_release(Referenced* p) { p->unref(); } - -} - -#endif diff --git a/libs/lib/mac32/include/osg/RenderInfo b/libs/lib/mac32/include/osg/RenderInfo deleted file mode 100644 index cd88467249b3498f048725f71441b28f2f3d59d2..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/RenderInfo +++ /dev/null @@ -1,79 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_RENDERINFO -#define OSG_RENDERINFO 1 - -#include -#include - -namespace osg { - -class RenderInfo -{ -public: - - RenderInfo(): - _view(0) {} - - RenderInfo(const RenderInfo& rhs): - _state(rhs._state), - _view(rhs._view), - _cameras(rhs._cameras), - _userData(rhs._userData) {} - - RenderInfo(State* state, View* view): - _state(state), - _view(view) {} - - RenderInfo& operator = (const RenderInfo& rhs) - { - _state = rhs._state; - _view = rhs._view; - _cameras = rhs._cameras; - _userData = rhs._userData; - return *this; - } - - unsigned int getContextID() const { return _state.valid() ? _state->getContextID() : 0; } - - void setState(State* state) { _state = state; } - State* getState() { return _state.get(); } - const State* getState() const { return _state.get(); } - - void setView(View* view) { _view = view; } - View* getView() { return _view; } - const View* getView() const { return _view; } - - void pushCamera(Camera* camera) { _cameras.push_back(camera); } - void popCamera() { if (!_cameras.empty()) _cameras.pop_back(); } - - Camera* getCurrentCamera() { return _cameras.empty() ? 0 : _cameras.back(); } - - void setUserData(Referenced* userData) { _userData = userData; } - Referenced* getUserData() { return _userData.get(); } - const Referenced* getUserData() const { return _userData.get(); } - -protected: - - typedef std::vector Cameras; - - ref_ptr _state; - View* _view; - Cameras _cameras; - ref_ptr _userData; -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Scissor b/libs/lib/mac32/include/osg/Scissor deleted file mode 100644 index 41c8bcb56c3bdca94ec325f6c4d1c66f614c7709..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Scissor +++ /dev/null @@ -1,110 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSG_Scissor -#define OSG_Scissor 1 - -#include - -namespace osg { - -/** Encapsulate OpenGL glScissor. */ -class OSG_EXPORT Scissor : public StateAttribute -{ - public : - Scissor(); - - Scissor(int x,int y,int width,int height): - _x(x), - _y(y), - _width(width), - _height(height) {} - - - /** Copy constructor using CopyOp to manage deep vs shallow copy. */ - Scissor(const Scissor& vp,const CopyOp& copyop=CopyOp::SHALLOW_COPY): - StateAttribute(vp,copyop), - _x(vp._x), - _y(vp._y), - _width(vp._width), - _height(vp._height) {} - - META_StateAttribute(osg, Scissor, SCISSOR); - - /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ - virtual int compare(const StateAttribute& sa) const - { - // check the types are equal and then create the rhs variable - // used by the COMPARE_StateAttribute_Parameter macros below. - COMPARE_StateAttribute_Types(Scissor,sa) - - // compare each parameter in turn against the rhs. - COMPARE_StateAttribute_Parameter(_x) - COMPARE_StateAttribute_Parameter(_y) - COMPARE_StateAttribute_Parameter(_width) - COMPARE_StateAttribute_Parameter(_height) - - return 0; // passed all the above comparison macros, must be equal. - } - - - virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const - { - usage.usesMode(GL_SCISSOR_TEST); - return true; - } - - inline void setScissor(int x,int y,int width,int height) - { - _x = x; - _y = y; - _width = width; - _height = height; - } - - void getScissor(int& x,int& y,int& width,int& height) const - { - x = _x; - y = _y; - width = _width; - height = _height; - } - - inline int& x() { return _x; } - inline int x() const { return _x; } - - inline int& y() { return _y; } - inline int y() const { return _y; } - - inline int& width() { return _width; } - inline int width() const { return _width; } - - inline int& height() { return _height; } - inline int height() const { return _height; } - - virtual void apply(State& state) const; - - protected: - - virtual ~Scissor(); - - int _x; - int _y; - int _width; - int _height; - -}; - -} - -#endif diff --git a/libs/lib/mac32/include/osg/Sequence b/libs/lib/mac32/include/osg/Sequence deleted file mode 100644 index 0cca0c09522c00007f4f2817666bc20a38dd295a..0000000000000000000000000000000000000000 --- a/libs/lib/mac32/include/osg/Sequence +++ /dev/null @@ -1,252 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Publi