Compare commits

..

62 Commits

Author SHA1 Message Date
Paul MARTZ
b186f703ab Final tag for 2.8.4. Renaming release candidate 3 as the final release. 2011-04-11 18:32:08 +00:00
Paul MARTZ
249d7c5e7a Tagging 2.8.4 RC3. 2011-04-07 01:59:46 +00:00
Paul MARTZ
18d9206a5e 2.8 branch, from Sukender: Fixes output file names for VS2010 builds so that Windows DLLs contain the SO version number. 2011-04-07 01:58:09 +00:00
Robert Osfield
eddbbe28fa Fixed build against latest ffmpeg versions 2011-03-28 18:15:53 +00:00
Paul MARTZ
71eb974c1b Bump version# to 2.8.4. 2011-03-28 15:41:25 +00:00
Paul MARTZ
f4be375ab8 2.8 branch: Merging r11354 from trunk to fix OpenThreads CMake INSTALL target issues in VS2010. 2011-03-28 02:38:46 +00:00
Paul MARTZ
38b454f824 2.8 branch: Enabling VS2010 builds. 2011-03-28 02:32:58 +00:00
Paul MARTZ
fb91677fce 2.8 branch: Removing non-existant Qt examples. 2010-04-03 16:01:09 +00:00
Paul MARTZ
dab855f141 2.8 branch: Improvements for building COLLADA. CMake only, does not change the actual COLLADA plugin (it's same as 2.8.2). Merged in this commit: r9759, r9952, r10336, r10626, and r10637. 2010-04-01 21:29:09 +00:00
Paul MARTZ
01b510865f 2.8 branch: This change brings the PNG plugin up to sync with trunk head. It adds the OSG_CPP_EXCEPTIONS_AVAILABLE CMake option and adds PNG plugin compatibility with multiple versions of libPNG. Merged from trunk: 10763 and 11121. 2010-04-01 17:41:08 +00:00
Paul MARTZ
6c08cc5937 2.8 branch: Updated XCode project file. 2010-03-31 23:27:59 +00:00
Paul MARTZ
7f3fe7baed 2.8 branch: Fix multiply defined symbols in static link by qualifying FBX and 3DS plugin symbols with namespaces. 2010-03-31 20:22:17 +00:00
Paul MARTZ
ae233b9392 2.8 branch: Fixes for mingw build. Merges 10963 and 10965 from trunk. 2010-03-30 15:23:18 +00:00
Paul MARTZ
1712176900 2.8 branch: Merging 11286 from trunk. "Added a compile test for pthread_setaffinity_np to workaround problem with the FreeBSD pthread lib containing the function but the pthread.h header not containing it." 2010-03-25 20:02:30 +00:00
Paul MARTZ
967e2b7926 2.8 branch: (2nd attempt. Previous commit appears to have been a no-op.) Merging 11289 from trunk to add pixel format getter to GraphicsWindowCocoa. 2010-03-25 19:56:50 +00:00
Paul MARTZ
64d4e6a913 2.8 branch: Merging 11289 from trunk to add pixel format getter to GraphicsWindowCocoa. 2010-03-25 19:46:38 +00:00
Paul MARTZ
ae33aeed8a 2.8 branch: Updated XCode project file from Stephan, includes ply plugin. 2010-03-25 19:37:22 +00:00
Paul MARTZ
49bf375b68 2.8 branch: Fix for 64bit OS X compiles. Merged r10006 from trunk. 2010-03-23 15:00:24 +00:00
Paul MARTZ
40a0c1cde2 2.8 branch: From Stephan Huber: Adding updated XCode project file. 2010-03-23 14:49:51 +00:00
Paul MARTZ
bfd9ec30ca 2.8 branch: Removing outdated OpenThreads folder, per Stephan Huber's request. 2010-03-23 14:46:14 +00:00
Paul MARTZ
599715e1d1 2.8 branch: Fix animations. This is a merge of r10362. 2010-03-23 02:07:10 +00:00
Paul MARTZ
3fc3fc060f 2.8 branch: OpenThreads fix for OSX. Merged 10927 from trunk. 2010-03-22 22:24:42 +00:00
Paul MARTZ
29199a9a68 2.8 branch. Merge r9904 from trunk (req'd for OS X). 2010-03-22 15:24:18 +00:00
Paul MARTZ
b8a76a0ce0 2.8 branch. 2nd attempt: The main point of this commit is to eliminate static initializers for OS X. Merges: 9894, 11207, 11263, and 11273. 2010-03-22 15:09:17 +00:00
Paul MARTZ
a927748a73 2.8 branch: Hm, mysteriously, the ply plugin seems to be missing changes that were previously merged. This commit brings them up to date with svn trunk as of r11237. 2010-03-22 14:55:52 +00:00
Paul MARTZ
5d53cb13d5 2.8 branch: Change "Matrices" to "Materials" in StatsHandler. This change was made on trunk in 10601, but 10601 was too extensive to merge onto the 2.8 branch. 2010-03-21 22:15:45 +00:00
Paul MARTZ
aa3766ca70 2.8 branch: Back out r11267. This is a reverse merge of r9894, r11207, and r11263. 2010-03-21 21:21:59 +00:00
Paul MARTZ
b5743c1c9f 2.8 branch. The main point of this commit is to eliminate static initializers for OS X. Merges: 9894, 11207, and 11263. 2010-03-21 20:45:30 +00:00
Paul MARTZ
894800115c 2.8 branch: Added convenience macros to Version header. This is a merge of r10173 from trunk. 2010-03-21 20:28:17 +00:00
Paul MARTZ
0574e17eaa 2.8 branch: Updating wrappers. 2010-03-21 00:35:14 +00:00
Paul MARTZ
9e1362445c 2.8 branch: Mergine recent changes to FBX. Revisions in this commit: r11251, r11252, r11262. 2010-03-20 23:19:35 +00:00
Paul MARTZ
a1af64be80 2.8 branch: Fix for FBX plugin on OS X. 2010-03-19 18:21:22 +00:00
Paul MARTZ
f02caa5371 2.8 branch: This is a simple copy from trunk, no fancy merges, just to get the osgmovie example up to date. Effectively, this is osgmovie as of trunk rev up to and including r10963. 2010-03-19 16:57:12 +00:00
Paul MARTZ
6d1a94c785 2.8 branch: Merge r11182 from trunk to update the FindQuickTime.cmake script. 2010-03-19 16:03:47 +00:00
Paul MARTZ
1163ebb25b 2.8 branch: Add up-to-date ffmpeg plugin. This commint merges the following revisions from trunk: 9910, 9912, 9933, 9948, 9960, 9965, 9968-9969, 9990, 10030, 10053, 10082, 10161, 10391-10392, 10408, 10414, 10422, 10538, 10809, 10851, 10892, 10925, 10961, 11165, and 11177. 2010-03-19 15:56:12 +00:00
Paul MARTZ
4563195a18 2.8 branch: Updated FindInventor.cmake from trunk revision 11033. 2010-03-18 16:18:46 +00:00
Paul MARTZ
00ca996576 2.8 branch: This is a merge of 9855 to remove the reference to the src/osgPlugins/OpenAL directory. 2010-03-17 20:55:30 +00:00
Paul MARTZ
7ab4faeae1 2.8 branch: Merge revision 10520 from trunk to fix memory leaks. 2010-03-17 20:47:50 +00:00
Paul MARTZ
4e90ccb13a 2.8 branch: This is part II of the backport of the 3ds plugin to the 2.8 branch. It includes these revisions from trunk: 10128, 10805, 10853, 10914, 10932, 10938, 10941-10942, 10945, 11056, 11123, 11173, 11180, 11194, and 11203. After merging these revisions, the 3ds code was modified to use the old-style osg::notify (instead of the new OSG_NOTIFY). 2010-03-17 19:47:56 +00:00
Paul MARTZ
5c70f4828f 2.8 branch: This is part II of the new ply plugin. This commit merges the following trunk revisions: 10088, 10149, and 11237 2010-03-17 19:02:38 +00:00
Paul MARTZ
bdcba7220c 2.8 branch: This adds the new ffmpeh plugin, up to a point. Further changes look messy, but will try to merge them. Revisions merged in this commit: 9816-9818, 9826-9827, 9837-9843, 9847, 9850, 9854, 9856-9857, 9860-9861, 9865, 9869, and 9885. 2010-03-17 17:41:14 +00:00
Paul MARTZ
cfa9c3682f 2.8 branch: This is part I of an attempt to add the new ply plugin and also bring the 3ds plugin up to date (writer capability, etc). Revisions merged from trunk in this commit: 10012, 10013, 10014, 10040, 10041, 10079, 10080, 9906, 10057, and 10076. 2010-03-17 16:59:50 +00:00
Paul MARTZ
8f8f217ee7 2.8 branch: Updates for dds and OpenFlight plugins. Revisions merged from trunk in this commit: 9959, 10084, 10264, 10283, 10440, 10491, 10761, and 11159. 2010-03-17 14:59:25 +00:00
Paul MARTZ
ec0faff644 2.8 branch: Minor bug fixes for ac and 3dc plugins. Merges these revisions from trunk: 10010, 10758, and 11175. 2010-03-17 14:33:47 +00:00
Paul MARTZ
201e73c3c1 2.8 branch: Fix issue with osgDB::concatPaths. This commit merges svn trunk revision 10818 to the 2.8 branch. 2010-03-16 21:07:33 +00:00
Paul MARTZ
cb3868872e 2.8 branch: Latest Inventor plugin. Revisions from trunk included in this commit: 11032 and 11034. 2010-03-15 20:06:25 +00:00
Paul MARTZ
9f45b89722 2010-03-15 19:45:02 +00:00
Paul MARTZ
18b8d05d1f 2.8 branch: Enhancement and bug fixes for OcclusionQueryNode. Revisions merged from trunk include: 10933 and 11127. 2010-03-15 19:34:42 +00:00
Paul MARTZ
ae10c4ef89 2.8 branch: THis change brings the quicktime plugin up to date with current svn head trunk. Revisions merged from trunk in the commit include: 9769, 9932, 10788, 10891, 11019, and 11035. 2010-03-15 19:06:05 +00:00
Paul MARTZ
6222373479 2.8 branch: Backport latest ImageIO plugin from trunk. This commit includes the following svn trunk revisions: 9880, 10623, 10854, and 10855. 2010-03-15 17:48:28 +00:00
Paul MARTZ
5be809ab04 2.8 branch: Support for OS X 10.6. Several changes to GraphicsWIndowCocoa and DarwinUtils. The following trunk revisions were merged in this commit: 9879, 9895, 10208, 10340, 10417, 10456, 10622, 10858, and 10887. 2010-03-15 17:20:43 +00:00
Paul MARTZ
da79cd85e4 Merge 11009 to 2.8 branch (just examples directory). 2010-03-13 23:08:16 +00:00
Paul MARTZ
211764ca2d 2.8 branch: Updates to osgAnimation examples. 2010-03-13 23:01:27 +00:00
Paul MARTZ
8041a24a4f 2.8 branch: Additional fix for FBX usage of 2.8-style osgDB::ReaderWriter::Options. 2010-03-13 22:26:17 +00:00
Paul MARTZ
b011470dfe Backport FBX plugin to 2.8 branch. Modified FBX to use the old osgDB::ReaderWriter::Options namespace. This commit includes a merge of r11111 (osgDB UTF mods). 2010-03-13 22:20:15 +00:00
Paul MARTZ
3155b1722c Merge 11009 to 2.8 branch, but only the parts applicable to the bvh plugin to get it to build with current osgAnimation. 2010-03-13 21:43:43 +00:00
Paul MARTZ
40fc0eb263 Merge 10671-10672 to 2.8 branch. This is a continuration of the backport of osgAnimation. (Note prev rev log message should read "11206" not "11026".) 2010-03-13 21:38:17 +00:00
Paul MARTZ
38e68ed7f1 2.8 branch: backport of osgAnimation from svn head 11026. 2010-03-13 20:55:16 +00:00
Paul MARTZ
15fd3bdcc2 2.8 branch: Bump revision number to 2.8.3, so version to 65. 2010-03-13 18:10:28 +00:00
Paul MARTZ
1858366514 Merge 10664 to 2.8 branch (MSFBO workaround for OS X). 2010-03-13 18:09:26 +00:00
Robert Osfield
241efbaa33 From Tom Moore, "Parens were being returned when the bracket keys were typed. The fix
is easy and the original code looks like a typo"
2009-08-20 16:06:50 +00:00
Robert Osfield
5c6c51c887 From Colin McDonald, "
The bsp & mdl plugins have calls to atof() without including the
associated <stdlib.h> header.  This breaks the build on my Solaris setup.

Rather than adding the missing <stdlib.h> include, I have changed the
atof() calls to osg::asciiToDouble().  This is the same as was done
throughout the other plugins recently, for locale independance.

I've attached updates to the svn trunk, the fix is also appropriate for
the 2.8.* branch."
2009-08-20 15:14:41 +00:00
582 changed files with 68514 additions and 24040 deletions

View File

@@ -30,8 +30,8 @@ PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 2)
SET(OPENSCENEGRAPH_MINOR_VERSION 8)
SET(OPENSCENEGRAPH_PATCH_VERSION 2)
SET(OPENSCENEGRAPH_SOVERSION 55)
SET(OPENSCENEGRAPH_PATCH_VERSION 4)
SET(OPENSCENEGRAPH_SOVERSION 65)
# set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number
@@ -265,6 +265,8 @@ MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
################################################################################
# Set Config file
@@ -295,6 +297,7 @@ FIND_PACKAGE(Inventor)
FIND_PACKAGE(Jasper)
FIND_PACKAGE(OpenEXR)
FIND_PACKAGE(COLLADA)
FIND_PACKAGE(FBX)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(Xine)
FIND_PACKAGE(OpenVRML)
@@ -304,7 +307,12 @@ FIND_PACKAGE(CURL)
FIND_PACKAGE(ITK)
FIND_PACKAGE(LibVNCServer)
FIND_PACKAGE(OurDCMTK)
FIND_PACKAGE(OpenAL)
FIND_PACKAGE(XUL)
FIND_PACKAGE(FFmpeg)
# Include macro utilities here
INCLUDE(OsgMacroUtils)
#use pkg-config to find various modues
INCLUDE(FindPkgConfig OPTIONAL)
@@ -491,8 +499,16 @@ ENDIF(NOT MSVC)
#
# On CMake 2.6.x use the newly minted CMAKE_LIBRARY_OUTPUT_DIRECTORY,
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY & CMAKE_RUNTIME_OUTPUT_DIRECTORY
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
#
# CMake >= 2.8.1 changed the output directory algorithm (See doc).
# Here we also set per-configuration directories (CMAKE_*_OUTPUT_DIRECTORY_<CONFIG>), or else binaries are generated in /bin/Debug and /bin/Release, etc. with MSVC and Xcode.
# (Doc reads "multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory").
# The workaround for 2.6.x (adding "../" as an output prefix for each target) seem to have no effect in >=2.8.1, so there is no need to change this.
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 5)
# If CMake < 2.6.0
SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
ELSE()
# If CMake >= 2.6.0
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
@@ -501,10 +517,22 @@ IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
ELSE(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
ENDIF(WIN32)
ELSE(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
ENDIF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
# Testing CMAKE_VERSION is possible in >= 2.6.4 only
BUILDER_VERSION_GREATER(2 8 0)
IF(VALID_BUILDER_VERSION) # If CMake >= 2.8.1
FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES}) # For each configuration (Debug, Release, MinSizeRel... and/or anything the user chooses)
STRING(TOUPPER "${CONF}" CONF) # Go uppercase (DEBUG, RELEASE...)
SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}")
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}")
IF(WIN32)
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}")
ELSE()
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}")
ENDIF()
ENDFOREACH()
ENDIF(VALID_BUILDER_VERSION)
ENDIF()
#SET(INSTALL_BINDIR OpenSceneGraph/bin)
#SET(INSTALL_INCDIR OpenSceneGraph/include)
@@ -606,7 +634,7 @@ ELSE (DYNAMIC_OPENSCENEGRAPH)
SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
ENDIF(DYNAMIC_OPENSCENEGRAPH)
INCLUDE(OsgMacroUtils)
# OSG Core
ADD_SUBDIRECTORY(src)

View File

@@ -15,6 +15,17 @@
SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory")
IF(APPLE)
SET(COLLADA_BUILDNAME "mac")
ELSEIF(MINGW)
SET(COLLADA_BUILDNAME "mingw")
ELSEIF(MSVC90)
SET(COLLADA_BUILDNAME "vc9")
ELSE(APPLE)
SET(COLLADA_BUILDNAME "vc8")
ENDIF(APPLE)
FIND_PATH(COLLADA_INCLUDE_DIR dae.h
${COLLADA_DOM_ROOT}/include
$ENV{COLLADA_DIR}/include
@@ -37,10 +48,10 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
)
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
NAMES collada_dom collada14dom libcollada14dom21
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4
$ENV{COLLADA_DIR}/build/vc8-1.4
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
@@ -62,10 +73,10 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
)
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
NAMES collada_dom-d collada14dom-d libcollada14dom21-d
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/build/vc8-1.4-d
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
@@ -87,10 +98,10 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
NAMES libcollada14dom21-s
NAMES libcollada14dom21-s libcollada14dom22-s
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4
$ENV{COLLADA_DIR}/build/vc8-1.4
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
@@ -112,10 +123,10 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd
NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd libcollada14dom22-sd
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/build/vc8-1.4-d
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
@@ -136,8 +147,6 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
/usr/freeware/lib64
)
IF(COLLADA_STATIC_LIBRARY)
# find extra libraries that the static linking requires
FIND_PACKAGE(LibXml2)
@@ -168,105 +177,80 @@ IF(COLLADA_STATIC_LIBRARY)
ENDIF(WIN32)
ENDIF(ZLIB_FOUND)
IF(WIN32)
FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY
NAMES pcrecpp
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY
NAMES pcrecpp
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY_DEBUG
NAMES pcrecpp-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY_DEBUG
NAMES pcrecpp-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRE_LIBRARY
NAMES pcre
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRE_LIBRARY
NAMES pcre
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRE_LIBRARY_DEBUG
NAMES pcre-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRE_LIBRARY_DEBUG
NAMES pcre-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY
NAMES minizip
PATHS
${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
${COLLADA_DOM_ROOT}/external-libs/minizip/mac
)
FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY
NAMES minizip
PATHS
${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
${COLLADA_DOM_ROOT}/external-libs/minizip/mac
)
FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY_DEBUG
NAMES minizip-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
${COLLADA_DOM_ROOT}/external-libs/minizip/mac
)
FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY_DEBUG
NAMES minizip-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
${COLLADA_DOM_ROOT}/external-libs/minizip/mac
)
ENDIF(WIN32)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
NAMES libboost_filesystem boost_filesystem
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
ENDIF(COLLADA_STATIC_LIBRARY)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
NAMES libboost_filesystem-d boost_filesystem-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
NAMES libboost_system boost_system
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
IF(WIN32)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
NAMES libboost_filesystem
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
NAMES libboost_system-d boost_system-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
NAMES libboost_filesystem-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
NAMES libboost_system
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
NAMES libboost_system-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_PATH(COLLADA_BOOST_INCLUDE_DIR boost/filesystem/convenience.hpp
${COLLADA_DOM_ROOT}/external-libs/boost
)
ENDIF(WIN32)
ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
SET(COLLADA_FOUND "NO")
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)

View File

@@ -0,0 +1,51 @@
# Locate FBX
# This module defines:
# FBX_INCLUDE_DIR, where to find the headers
#
# FBX_LIBRARY, FBX_LIBRARY_DEBUG
# FBX_FOUND
#
# $FBX_DIR is an environment variable that would
# correspond to the ./configure --prefix=$FBX_DIR
IF(WIN32)
SET(FBX_ROOT "$ENV{PROGRAMFILES}/Autodesk/FBX/FbxSdk/2010.2" CACHE PATH "Location of FBX SDK directory")
ELSE(WIN32)
SET(FBX_ROOT $ENV{FBX_DIR} CACHE PATH "Location of FBX SDK directory")
ENDIF(WIN32)
IF(APPLE)
SET(FBX_LIBNAME "libfbxsdk_gcc4_ub")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
SET(FBX_LIBNAME "libfbxsdk_gcc4")#TODO: libs are provided for GCC 3.4 & 4.0 in both 32 and 64 bit versions, but I don't know how to confgure that here.
ELSEIF(MSVC71)
SET(FBX_LIBNAME "fbxsdk_md2003")
ELSEIF(MSVC80)
SET(FBX_LIBNAME "fbxsdk_md2005")
ELSEIF(MSVC90 OR MSVC_VER>1500)
SET(FBX_LIBNAME "fbxsdk_md2008")
ENDIF(APPLE)
IF(CMAKE_CL_64)
SET(FBX_LIBNAME ${FBX_LIBNAME}_amd64)
ENDIF(CMAKE_CL_64)
IF(APPLE)
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME})
ELSE(APPLE)
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
ENDIF(APPLE)
FIND_PATH(FBX_INCLUDE_DIR fbxsdk.h
${FBX_ROOT}/include
)
FIND_LIBRARY(FBX_LIBRARY ${FBX_LIBNAME} ${FBX_ROOT}/lib)
FIND_LIBRARY(FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG} ${FBX_ROOT}/lib)
IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
SET(FBX_FOUND "YES")
ELSE(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
SET(FBX_FOUND "NO")
ENDIF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)

View File

@@ -0,0 +1,165 @@
# Locate ffmpeg
# This module defines
# FFMPEG_LIBRARIES
# FFMPEG_FOUND, if false, do not try to link to ffmpeg
# FFMPEG_INCLUDE_DIR, where to find the headers
#
# $FFMPEG_DIR is an environment variable that would
# correspond to the ./configure --prefix=$FFMPEG_DIR
#
# Created by Robert Osfield.
#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
#In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg
#We have to search the path which contain the header.h (usefull for old version)
#and search the path which contain the libname/header.h (usefull for new version)
#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code)
# (in new version case, use by ffmpeg header)
#and ${FFMPEG_libname_INCLUDE_DIRS/libname} (in new version case, use by osg plugin code)
# Macro to find header and lib directories
# example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
MACRO(FFMPEG_FIND varname shortname headername)
# old version of ffmpeg put header in $prefix/include/[ffmpeg]
# so try to find header in include directory
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
PATHS
${FFMPEG_ROOT}/include
$ENV{FFMPEG_DIR}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
PATH_SUFFIXES ffmpeg
DOC "Location of FFMPEG Headers"
)
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ${headername}
PATHS
${FFMPEG_ROOT}/include
$ENV{FFMPEG_DIR}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
PATH_SUFFIXES ffmpeg
DOC "Location of FFMPEG Headers"
)
FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
NAMES ${shortname}
PATHS
${FFMPEG_ROOT}/lib
$ENV{FFMPEG_DIR}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
DOC "Location of FFMPEG Libraries"
)
IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
SET(FFMPEG_${varname}_FOUND 1)
ENDIF(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
ENDMACRO(FFMPEG_FIND)
SET(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG")
# find stdint.h
IF(WIN32)
FIND_PATH(FFMPEG_STDINT_INCLUDE_DIR stdint.h
PATHS
${FFMPEG_ROOT}/include
$ENV{FFMPEG_DIR}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
PATH_SUFFIXES ffmpeg
DOC "Location of FFMPEG stdint.h Header"
)
IF (FFMPEG_STDINT_INCLUDE_DIR)
SET(STDINT_OK TRUE)
ENDIF()
ELSE()
SET(STDINT_OK TRUE)
ENDIF()
FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here.
SET(FFMPEG_FOUND "NO")
# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional.
IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND STDINT_OK)
SET(FFMPEG_FOUND "YES")
SET(FFMPEG_INCLUDE_DIRS
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavutil
)
IF (${FFMPEG_STDINT_INCLUDE_DIR})
SET(FFMPEG_INCLUDE_DIRS
${FFMPEG_INCLUDE_DIRS}
${FFMPEG_STDINT_INCLUDE_DIR}
${FFMPEG_STDINT_INCLUDE_DIR}/libavformat
${FFMPEG_STDINT_INCLUDE_DIR}/libavdevice
${FFMPEG_STDINT_INCLUDE_DIR}/libavcodec
${FFMPEG_STDINT_INCLUDE_DIR}/libavutil
)
ENDIF()
SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
# Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, it will be added if found later.
SET(FFMPEG_LIBRARIES
${FFMPEG_LIBAVFORMAT_LIBRARIES}
${FFMPEG_LIBAVDEVICE_LIBRARIES}
${FFMPEG_LIBAVCODEC_LIBRARIES}
${FFMPEG_LIBAVUTIL_LIBRARIES})
ELSE ()
# MESSAGE(STATUS "Could not find FFMPEG")
ENDIF()

View File

@@ -1,10 +1,41 @@
# - Locate Inventor
#
# Find Open Inventor
#
# This module defines:
# INVENTOR_FOUND, if false, do not try to link against Inventor.
# INVENTOR_INCLUDE_DIR, where to find headers.
# INVENTOR_LIBRARY, the library to link against.
# INVENTOR_LIBRARY_DEBUG, the debug library to link against.
# INVENTOR_SOWIN_LIBRARY, the SoWin library - window binding library for Inventor
# INVENTOR_SOWIN_LIBRARY, the SoWin debug library
# INVENTOR_SOXT_LIBRARY, the SoXt library - window binding library for Inventor
# INVENTOR_SOXT_LIBRARY, the SoXt debug library
#
#
# Inventor
#
# notes:
# - Coin is honored over SGI Inventor
# - Coin is detected by coin-config script, COINDIR environment variable,
# and finally standard system locations are searched
# - SGI Inventor is searched at standard system locations only
#
# coin-config tells much of Coin instalation (if present)
execute_process (COMMAND coin-config --prefix
OUTPUT_VARIABLE COIN_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
# try to find Inventor includes (priority paths)
FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
${COIN_PREFIX}/include
$ENV{COINDIR}/include
NO_DEFAULT_PATH
)
# try to find Inventor includes (regular paths)
FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
/usr/local/include
/usr/include
@@ -12,52 +43,164 @@ FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
/opt/local/include
/opt/csw/include
/opt/include
$ENV{COINDIR}/include
)
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES coin2 Coin
PATHS
# default Inventor lib search paths
SET(INVENTOR_LIB_SEARCH_PATH
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
$ENV{COINDIR}/lib
)
IF(NOT INVENTOR_LIBRARY)
# If we can't find libCoin try libInventor
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES Inventor
PATHS
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
)
ENDIF(NOT INVENTOR_LIBRARY)
# try to find Coin release lib (priority paths)
FIND_LIBRARY(INVENTOR_LIBRARY_RELEASE
NAMES coin5 coin4 coin3 coin2 coin1 Coin
PATHS ${COIN_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find Coin release lib (regular paths)
FIND_LIBRARY(INVENTOR_LIBRARY_RELEASE
NAMES coin5 coin4 coin3 coin2 coin1 Coin
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find SGI Inventor lib
FIND_LIBRARY(INVENTOR_LIBRARY_RELEASE
NAMES Inventor
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find Coin debug lib (priority paths)
FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG
NAMES coin2d
PATHS
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
$ENV{COINDIR}/lib
NAMES coin5d coin4d coin3d coin2d coin1d
PATHS ${COIN_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
IF(NOT INVENTOR_LIBRARY_DEBUG)
IF(INVENTOR_LIBRARY)
SET(INVENTOR_LIBRARY_DEBUG ${INVENTOR_LIBRARY})
ENDIF(INVENTOR_LIBRARY)
ENDIF(NOT INVENTOR_LIBRARY_DEBUG)
# try to find Coin debug lib (regular paths)
FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG
NAMES coin5d coin4d coin3d coin2d coin1d
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# set release to debug if only debug found
IF(NOT INVENTOR_LIBRARY_RELEASE AND INVENTOR_LIBRARY_DEBUG)
SET(INVENTOR_LIBRARY_RELEASE ${INVENTOR_LIBRARY_DEBUG})
ENDIF(NOT INVENTOR_LIBRARY_RELEASE AND INVENTOR_LIBRARY_DEBUG)
# set debug to release (if only release found)
IF(NOT INVENTOR_LIBRARY_DEBUG AND INVENTOR_LIBRARY_RELEASE)
SET(INVENTOR_LIBRARY_DEBUG ${INVENTOR_LIBRARY_RELEASE})
ENDIF(NOT INVENTOR_LIBRARY_DEBUG AND INVENTOR_LIBRARY_RELEASE)
# INVENTOR_LIBRARY
IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
SET(INVENTOR_LIBRARY
optimized ${INVENTOR_LIBRARY_RELEASE}
debug ${INVENTOR_LIBRARY_DEBUG})
ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
SET(INVENTOR_LIBRARY
${INVENTOR_LIBRARY_RELEASE})
ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
# set INVENTOR_FOUND appropriately
SET(INVENTOR_FOUND "NO")
IF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
SET(INVENTOR_FOUND "YES")
ENDIF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
#
# SoWin
#
# notes: SoWin is searched by COINDIR environment variable
# (as expected to be located at Windows platform)
# try to find SoWin lib (priority paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY
NAMES sowin1
PATHS $ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoWin lib (regular paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY
NAMES sowin1
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find SoWin debug lib (priority paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY_DEBUG
NAMES sowin1d
PATHS $ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoWin debug lib (regular paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY_DEBUG
NAMES sowin1d
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# SoWin debug library defaults to non-debug lib
IF(NOT INVENTOR_SOWIN_LIBRARY_DEBUG)
IF(INVENTOR_SOWIN_LIBRARY)
SET(INVENTOR_SOWIN_LIBRARY_DEBUG INVENTOR_SOWIN_LIBRARY)
ENDIF(INVENTOR_SOWIN_LIBRARY)
ENDIF(NOT INVENTOR_SOWIN_LIBRARY_DEBUG)
#
# SoXt
#
# notes:
# - SoXt is detected by soxt-config script (as expected by
# Coin's SoXt on Linux/Unix) and on standard system locations
# - SGI's InventorXt support is missing now
#
# soxt-config tells much of SoXt instalation (if present)
execute_process (COMMAND soxt-config --prefix
OUTPUT_VARIABLE SOXT_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
# try to find SoXt lib (priority paths)
FIND_LIBRARY(INVENTOR_SOXT_LIBRARY
NAMES soxt1 SoXt
PATHS ${SOXT_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoXt lib (regular paths)
FIND_LIBRARY(INVENTOR_SOXT_LIBRARY
NAMES soxt1 SoXt
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find SoXt debug lib (priority paths)
FIND_LIBRARY(INVENTOR_SOXT_LIBRARY_DEBUG
NAMES soxt1d
PATHS ${SOXT_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoXt debug lib (regular paths)
FIND_LIBRARY(INVENTOR_SOXT_LIBRARY_DEBUG
NAMES soxt1d
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# SoXt debug library defaults to non-debug lib
IF(NOT INVENTOR_SOXT_LIBRARY_DEBUG)
IF(INVENTOR_SOXT_LIBRARY)
SET(INVENTOR_SOXT_LIBRARY_DEBUG INVENTOR_SOXT_LIBRARY)
ENDIF(INVENTOR_SOXT_LIBRARY)
ENDIF(NOT INVENTOR_SOXT_LIBRARY_DEBUG)

View File

@@ -15,7 +15,7 @@
IF(APPLE)
FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime/QuickTime.h)
FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime)
ELSE(APPLE)
ELSE()
FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime.h
$ENV{QUICKTIME_DIR}/include
$ENV{QUICKTIME_DIR}
@@ -39,11 +39,24 @@ ELSE(APPLE)
PATH_SUFFIXES lib64 lib
)
FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime)
ENDIF(APPLE)
ENDIF()
SET(QUICKTIME_FOUND "NO")
IF(QUICKTIME_LIBRARY AND QUICKTIME_INCLUDE_DIR)
SET(QUICKTIME_FOUND "YES")
ENDIF(QUICKTIME_LIBRARY AND QUICKTIME_INCLUDE_DIR)
ENDIF()
IF(APPLE)
#Quicktime is not supported under 64bit OSX build so we need to detect it and disable it.
#First check to see if we are running with a native 64-bit compiler (10.6 default) and implicit arch
IF(NOT CMAKE_OSX_ARCHITECTURES AND CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(QUICKTIME_FOUND "NO")
ELSE()
#Otherwise check to see if 64-bit is explicitly called for.
LIST(FIND CMAKE_OSX_ARCHITECTURES "x86_64" has64Compile)
IF(NOT has64Compile EQUAL -1)
SET(QUICKTIME_FOUND "NO")
ENDIF()
ENDIF()
ENDIF()

View File

@@ -9,6 +9,36 @@
# the content of this library for linking when in debugging
#######################################################################################################
# VALID_BUILDER_VERSION: used for replacing CMAKE_VERSION (available in v2.6.3 RC9) and VERSION_GREATER/VERSION_LESS (available in 2.6.2 RC4).
# This can be replaced by "IF(${CMAKE_VERSION} VERSION_LESS "x.y.z")" from 2.6.4.
SET(VALID_BUILDER_VERSION OFF)
MACRO(BUILDER_VERSION_GREATER MAJOR_VER MINOR_VER PATCH_VER)
SET(VALID_BUILDER_VERSION OFF)
IF(CMAKE_MAJOR_VERSION GREATER ${MAJOR_VER})
SET(VALID_BUILDER_VERSION ON)
ELSEIF(CMAKE_MAJOR_VERSION EQUAL ${MAJOR_VER})
IF(CMAKE_MINOR_VERSION GREATER ${MINOR_VER})
SET(VALID_BUILDER_VERSION ON)
ELSEIF(CMAKE_MINOR_VERSION EQUAL ${MINOR_VER})
IF(CMAKE_PATCH_VERSION GREATER ${PATCH_VER})
SET(VALID_BUILDER_VERSION ON)
ENDIF(CMAKE_PATCH_VERSION GREATER ${PATCH_VER})
ENDIF()
ENDIF()
ENDMACRO(BUILDER_VERSION_GREATER MAJOR_VER MINOR_VER PATCH_VER)
# CMAKE24: if CMake version is <2.6.0.
SET(CMAKE24 OFF)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} LESS 5)
SET(CMAKE24 ON)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} LESS 5)
# CMAKE_VERSION_TEST: Define whether "IF(${CMAKE_VERSION} VERSION_LESS "x.y.z")" can be used or not.
BUILDER_VERSION_GREATER(2 6 3)
SET(CMAKE_VERSION_TEST ${VALID_BUILDER_VERSION}) # >= 2.6.4
SET(VALID_BUILDER_VERSION OFF)
MACRO(LINK_WITH_VARIABLES TRGTNAME)
FOREACH(varname ${ARGN})
@@ -21,9 +51,9 @@ MACRO(LINK_WITH_VARIABLES TRGTNAME)
ENDMACRO(LINK_WITH_VARIABLES TRGTNAME)
MACRO(LINK_INTERNAL TRGTNAME)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
IF(NOT CMAKE24)
TARGET_LINK_LIBRARIES(${TRGTNAME} ${ARGN})
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
ELSE(NOT CMAKE24)
FOREACH(LINKLIB ${ARGN})
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
#when using versioned names, the .dll name differ from .lib name, there is a problem with that:
@@ -36,7 +66,7 @@ MACRO(LINK_INTERNAL TRGTNAME)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
ENDFOREACH(LINKLIB)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
ENDIF(NOT CMAKE24)
ENDMACRO(LINK_INTERNAL TRGTNAME)
MACRO(LINK_EXTERNAL TRGTNAME)
@@ -116,6 +146,44 @@ ENDMACRO(SETUP_LINK_LIBRARIES)
# this is the common set of command for all the plugins
#
# Sets the output directory property for CMake >= 2.6.0, giving an output path RELATIVE to default one
MACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
BUILDER_VERSION_GREATER(2 8 0)
IF(NOT VALID_BUILDER_VERSION)
# If CMake <= 2.8.0 (Testing CMAKE_VERSION is possible in >= 2.6.4)
IF(MSVC_IDE)
# Using the "prefix" hack
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../${RELATIVE_OUTDIR}/")
ELSE(MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${RELATIVE_OUTDIR}/")
ENDIF(MSVC_IDE)
ELSE(NOT VALID_BUILDER_VERSION)
# Using the output directory properties
# Global properties (All generators but VS & Xcode)
FILE(TO_CMAKE_PATH TMPVAR "CMAKE_ARCHIVE_OUTPUT_DIRECTORY/${RELATIVE_OUTDIR}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${TMPVAR}")
FILE(TO_CMAKE_PATH TMPVAR "CMAKE_RUNTIME_OUTPUT_DIRECTORY/${RELATIVE_OUTDIR}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TMPVAR}")
FILE(TO_CMAKE_PATH TMPVAR "CMAKE_LIBRARY_OUTPUT_DIRECTORY/${RELATIVE_OUTDIR}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TMPVAR}")
# Per-configuration property (VS, Xcode)
FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES}) # For each configuration (Debug, Release, MinSizeRel... and/or anything the user chooses)
STRING(TOUPPER "${CONF}" CONF) # Go uppercase (DEBUG, RELEASE...)
# We use "FILE(TO_CMAKE_PATH", to create nice looking paths
FILE(TO_CMAKE_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}}/${RELATIVE_OUTDIR}" TMPVAR)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES "ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${TMPVAR}")
FILE(TO_CMAKE_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}}/${RELATIVE_OUTDIR}" TMPVAR)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES "RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${TMPVAR}")
FILE(TO_CMAKE_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}}/${RELATIVE_OUTDIR}" TMPVAR)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES "LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${TMPVAR}")
ENDFOREACH(CONF ${CMAKE_CONFIGURATION_TYPES})
ENDIF(NOT VALID_BUILDER_VERSION)
ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
MACRO(SETUP_PLUGIN PLUGIN_NAME)
SET(TARGET_NAME ${PLUGIN_NAME} )
@@ -152,13 +220,10 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
ENDIF(NOT UNIX)
ELSE(NOT MSVC)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
IF(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
ELSE(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../${OSG_PLUGINS}/")
ENDIF(NOT MSVC_IDE)
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
IF(NOT CMAKE24)
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "${OSG_PLUGINS}") # Sets the ouput to be /osgPlugin-X.X.X ; also ensures the /Debug /Release are removed
ELSE(NOT CMAKE24)
IF(OSG_MSVC_VERSIONED_DLL)
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
@@ -181,7 +246,8 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
ENDIF(OSG_MSVC_VERSIONED_DLL)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
ENDIF(NOT CMAKE24)
ENDIF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
@@ -257,7 +323,7 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME})
IF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../")
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "") # Ensure the /Debug /Release are removed
ENDIF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
SETUP_LINK_LIBRARIES()
@@ -341,10 +407,19 @@ MACRO(HANDLE_MSVC_DLL)
ELSE(${ARGC} GREATER 1)
SET(LIB_SOVERSION ${OPENSCENEGRAPH_SOVERSION})
ENDIF(${ARGC} GREATER 1)
SET_OUTPUT_DIR_PROPERTY_260(${LIB_NAME} "") # Ensure the /Debug /Release are removed
IF(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../bin/${LIB_PREFIX}${LIB_SOVERSION}-")
IF (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
IF (NOT CMAKE24)
BUILDER_VERSION_GREATER(2 8 0)
IF(NOT VALID_BUILDER_VERSION)
# If CMake < 2.8.1
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
ELSE(NOT VALID_BUILDER_VERSION)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "${LIB_PREFIX}${LIB_SOVERSION}-")
ENDIF(NOT VALID_BUILDER_VERSION)
ELSE (NOT CMAKE24)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
SET(NEW_LIB_NAME "${OUTPUT_BINDIR}/${LIB_PREFIX}${LIB_SOVERSION}-${LIB_NAME}")
ADD_CUSTOM_COMMAND(
TARGET ${LIB_NAME}
@@ -354,9 +429,19 @@ MACRO(HANDLE_MSVC_DLL)
COMMAND ${CMAKE_COMMAND} -E remove "${NEW_LIB_NAME}.lib"
COMMAND ${CMAKE_COMMAND} -E remove "${NEW_LIB_NAME}.exp"
)
ENDIF (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
ELSE(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
ENDIF (NOT CMAKE24)
ELSE(NOT MSVC_IDE)
IF (NOT CMAKE24)
BUILDER_VERSION_GREATER(2 8 0)
IF(NOT VALID_BUILDER_VERSION)
# If CMake < 2.8.1
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
ELSE(NOT VALID_BUILDER_VERSION)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "${LIB_PREFIX}${LIB_SOVERSION}-")
ENDIF(NOT VALID_BUILDER_VERSION)
ELSE (NOT CMAKE24)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
ENDIF (NOT CMAKE24)
ENDIF(NOT MSVC_IDE)
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")

View File

@@ -1,17 +1,3 @@
2009-10-21 15:45:55 -0600 paulmartz
* Add CMake-controllable option to avoid doing a glBlitFramebuffer
into depth to resolve multisampling. This works arouns a hang on
OS X with NVIDIA GeForce 8800 and v1.5.49 drivers.
2009-07-28 00:13:31 robert
* Release OpenSceneGraph-2.8.2
2009-07-28 06:13 robert
* ChangeLog: Updated ChangeLog
2009-07-28 06:02 robert
* CMakeLists.txt, NEWS.txt, README.txt: Updated dates for 2.8.2

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>OpenThreads</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.OpenThreads.OpenThreads</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.2.0</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>

View File

@@ -1,449 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
00DAF8AA0BBE1A0E00EFEB98 /* Block in Headers */ = {isa = PBXBuildFile; fileRef = 00DAF8A70BBE1A0E00EFEB98 /* Block */; settings = {ATTRIBUTES = (Public, ); }; };
00DAF8AB0BBE1A0F00EFEB98 /* ReadWriteMutex in Headers */ = {isa = PBXBuildFile; fileRef = 00DAF8A80BBE1A0E00EFEB98 /* ReadWriteMutex */; settings = {ATTRIBUTES = (Public, ); }; };
00DAF8AC0BBE1A0F00EFEB98 /* ReentrantMutex in Headers */ = {isa = PBXBuildFile; fileRef = 00DAF8A90BBE1A0E00EFEB98 /* ReentrantMutex */; settings = {ATTRIBUTES = (Public, ); }; };
8D07F2BE0486CC7A007CD1D0 /* OpenThreads_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32BAE0B70371A74B00C91783 /* OpenThreads_Prefix.pch */; };
8D07F2C00486CC7A007CD1D0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8D07F2C40486CC7A007CD1D0 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB77AAFE841565C02AAC07 /* Carbon.framework */; };
BE11833405D6FE3900EB53E5 /* PThreadBarrierPrivateData.h in Headers */ = {isa = PBXBuildFile; fileRef = BE11832C05D6FE3800EB53E5 /* PThreadBarrierPrivateData.h */; };
BE11833605D6FE3900EB53E5 /* PThreadConditionPrivateData.h in Headers */ = {isa = PBXBuildFile; fileRef = BE11832E05D6FE3800EB53E5 /* PThreadConditionPrivateData.h */; };
BE11833805D6FE3900EB53E5 /* PThreadMutexPrivateData.h in Headers */ = {isa = PBXBuildFile; fileRef = BE11833005D6FE3800EB53E5 /* PThreadMutexPrivateData.h */; };
BE11833905D6FE3900EB53E5 /* PThreadPrivateData.h in Headers */ = {isa = PBXBuildFile; fileRef = BE11833105D6FE3800EB53E5 /* PThreadPrivateData.h */; };
BE11835105D7022C00EB53E5 /* PThread.c++ in Sources */ = {isa = PBXBuildFile; fileRef = BE11832A05D6FE3800EB53E5 /* PThread.c++ */; };
BE11835205D7022C00EB53E5 /* PThreadBarrier.c++ in Sources */ = {isa = PBXBuildFile; fileRef = BE11832B05D6FE3800EB53E5 /* PThreadBarrier.c++ */; };
BE11835405D7022C00EB53E5 /* PThreadCondition.c++ in Sources */ = {isa = PBXBuildFile; fileRef = BE11832D05D6FE3800EB53E5 /* PThreadCondition.c++ */; };
BE11835605D7022C00EB53E5 /* PThreadMutex.c++ in Sources */ = {isa = PBXBuildFile; fileRef = BE11832F05D6FE3800EB53E5 /* PThreadMutex.c++ */; };
BE11837D05D7083B00EB53E5 /* Barrier in Headers */ = {isa = PBXBuildFile; fileRef = BE11836E05D7082A00EB53E5 /* Barrier */; settings = {ATTRIBUTES = (Public, ); }; };
BE11837E05D7083B00EB53E5 /* Condition in Headers */ = {isa = PBXBuildFile; fileRef = BE11836F05D7082A00EB53E5 /* Condition */; settings = {ATTRIBUTES = (Public, ); }; };
BE11837F05D7083B00EB53E5 /* Exports in Headers */ = {isa = PBXBuildFile; fileRef = BE11837005D7082A00EB53E5 /* Exports */; settings = {ATTRIBUTES = (Public, ); }; };
BE11838005D7083B00EB53E5 /* Mutex in Headers */ = {isa = PBXBuildFile; fileRef = BE11837105D7082A00EB53E5 /* Mutex */; settings = {ATTRIBUTES = (Public, ); }; };
BE11838105D7083B00EB53E5 /* ScopedLock in Headers */ = {isa = PBXBuildFile; fileRef = BE11837205D7082A00EB53E5 /* ScopedLock */; settings = {ATTRIBUTES = (Public, ); }; };
BE11838205D7083B00EB53E5 /* Thread in Headers */ = {isa = PBXBuildFile; fileRef = BE11837305D7082A00EB53E5 /* Thread */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
00DAF8A70BBE1A0E00EFEB98 /* Block */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = Block; path = ../../include/OpenThreads/Block; sourceTree = SOURCE_ROOT; };
00DAF8A80BBE1A0E00EFEB98 /* ReadWriteMutex */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = ReadWriteMutex; path = ../../include/OpenThreads/ReadWriteMutex; sourceTree = SOURCE_ROOT; };
00DAF8A90BBE1A0E00EFEB98 /* ReentrantMutex */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = ReentrantMutex; path = ../../include/OpenThreads/ReentrantMutex; sourceTree = SOURCE_ROOT; };
089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
08FB77AAFE841565C02AAC07 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
32BAE0B70371A74B00C91783 /* OpenThreads_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenThreads_Prefix.pch; sourceTree = SOURCE_ROOT; };
8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D07F2C80486CC7A007CD1D0 /* OpenThreads.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OpenThreads.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE11832A05D6FE3800EB53E5 /* PThread.c++ */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = "PThread.c++"; path = "../../src/OpenThreads/pthreads/PThread.c++"; sourceTree = SOURCE_ROOT; };
BE11832B05D6FE3800EB53E5 /* PThreadBarrier.c++ */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = "PThreadBarrier.c++"; path = "../../src/OpenThreads/pthreads/PThreadBarrier.c++"; sourceTree = SOURCE_ROOT; };
BE11832C05D6FE3800EB53E5 /* PThreadBarrierPrivateData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PThreadBarrierPrivateData.h; path = ../../src/OpenThreads/pthreads/PThreadBarrierPrivateData.h; sourceTree = SOURCE_ROOT; };
BE11832D05D6FE3800EB53E5 /* PThreadCondition.c++ */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = "PThreadCondition.c++"; path = "../../src/OpenThreads/pthreads/PThreadCondition.c++"; sourceTree = SOURCE_ROOT; };
BE11832E05D6FE3800EB53E5 /* PThreadConditionPrivateData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PThreadConditionPrivateData.h; path = ../../src/OpenThreads/pthreads/PThreadConditionPrivateData.h; sourceTree = SOURCE_ROOT; };
BE11832F05D6FE3800EB53E5 /* PThreadMutex.c++ */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = "PThreadMutex.c++"; path = "../../src/OpenThreads/pthreads/PThreadMutex.c++"; sourceTree = SOURCE_ROOT; };
BE11833005D6FE3800EB53E5 /* PThreadMutexPrivateData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PThreadMutexPrivateData.h; path = ../../src/OpenThreads/pthreads/PThreadMutexPrivateData.h; sourceTree = SOURCE_ROOT; };
BE11833105D6FE3800EB53E5 /* PThreadPrivateData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PThreadPrivateData.h; path = ../../src/OpenThreads/pthreads/PThreadPrivateData.h; sourceTree = SOURCE_ROOT; };
BE11836E05D7082A00EB53E5 /* Barrier */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; name = Barrier; path = ../../include/OpenThreads/Barrier; sourceTree = SOURCE_ROOT; };
BE11836F05D7082A00EB53E5 /* Condition */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; name = Condition; path = ../../include/OpenThreads/Condition; sourceTree = SOURCE_ROOT; };
BE11837005D7082A00EB53E5 /* Exports */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; name = Exports; path = ../../include/OpenThreads/Exports; sourceTree = SOURCE_ROOT; };
BE11837105D7082A00EB53E5 /* Mutex */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; name = Mutex; path = ../../include/OpenThreads/Mutex; sourceTree = SOURCE_ROOT; };
BE11837205D7082A00EB53E5 /* ScopedLock */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; name = ScopedLock; path = ../../include/OpenThreads/ScopedLock; sourceTree = SOURCE_ROOT; };
BE11837305D7082A00EB53E5 /* Thread */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; name = Thread; path = ../../include/OpenThreads/Thread; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D07F2C30486CC7A007CD1D0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D07F2C40486CC7A007CD1D0 /* Carbon.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
034768DDFF38A45A11DB9C8B /* Products */ = {
isa = PBXGroup;
children = (
8D07F2C80486CC7A007CD1D0 /* OpenThreads.framework */,
);
name = Products;
sourceTree = "<group>";
};
0867D691FE84028FC02AAC07 /* OpenThreads */ = {
isa = PBXGroup;
children = (
BE11833F05D7005800EB53E5 /* Header */,
08FB77ACFE841707C02AAC07 /* Source */,
089C1665FE841158C02AAC07 /* Resources */,
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
034768DDFF38A45A11DB9C8B /* Products */,
);
name = OpenThreads;
sourceTree = "<group>";
};
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
08FB77AAFE841565C02AAC07 /* Carbon.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
089C1665FE841158C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8D07F2C70486CC7A007CD1D0 /* Info.plist */,
089C1666FE841158C02AAC07 /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
08FB77ACFE841707C02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
BE11832A05D6FE3800EB53E5 /* PThread.c++ */,
BE11832B05D6FE3800EB53E5 /* PThreadBarrier.c++ */,
BE11832C05D6FE3800EB53E5 /* PThreadBarrierPrivateData.h */,
BE11832D05D6FE3800EB53E5 /* PThreadCondition.c++ */,
BE11832E05D6FE3800EB53E5 /* PThreadConditionPrivateData.h */,
BE11832F05D6FE3800EB53E5 /* PThreadMutex.c++ */,
BE11833005D6FE3800EB53E5 /* PThreadMutexPrivateData.h */,
BE11833105D6FE3800EB53E5 /* PThreadPrivateData.h */,
32BAE0B70371A74B00C91783 /* OpenThreads_Prefix.pch */,
);
name = Source;
sourceTree = "<group>";
};
BE11833F05D7005800EB53E5 /* Header */ = {
isa = PBXGroup;
children = (
BE11835905D7027D00EB53E5 /* OpenThreads */,
);
name = Header;
sourceTree = "<group>";
};
BE11835905D7027D00EB53E5 /* OpenThreads */ = {
isa = PBXGroup;
children = (
BE11836E05D7082A00EB53E5 /* Barrier */,
00DAF8A70BBE1A0E00EFEB98 /* Block */,
BE11836F05D7082A00EB53E5 /* Condition */,
BE11837005D7082A00EB53E5 /* Exports */,
BE11837105D7082A00EB53E5 /* Mutex */,
00DAF8A80BBE1A0E00EFEB98 /* ReadWriteMutex */,
00DAF8A90BBE1A0E00EFEB98 /* ReentrantMutex */,
BE11837205D7082A00EB53E5 /* ScopedLock */,
BE11837305D7082A00EB53E5 /* Thread */,
);
name = OpenThreads;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
8D07F2BD0486CC7A007CD1D0 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
00DAF8AA0BBE1A0E00EFEB98 /* Block in Headers */,
00DAF8AB0BBE1A0F00EFEB98 /* ReadWriteMutex in Headers */,
00DAF8AC0BBE1A0F00EFEB98 /* ReentrantMutex in Headers */,
BE11837D05D7083B00EB53E5 /* Barrier in Headers */,
BE11837E05D7083B00EB53E5 /* Condition in Headers */,
BE11837F05D7083B00EB53E5 /* Exports in Headers */,
BE11838005D7083B00EB53E5 /* Mutex in Headers */,
BE11838105D7083B00EB53E5 /* ScopedLock in Headers */,
BE11838205D7083B00EB53E5 /* Thread in Headers */,
8D07F2BE0486CC7A007CD1D0 /* OpenThreads_Prefix.pch in Headers */,
BE11833405D6FE3900EB53E5 /* PThreadBarrierPrivateData.h in Headers */,
BE11833605D6FE3900EB53E5 /* PThreadConditionPrivateData.h in Headers */,
BE11833805D6FE3900EB53E5 /* PThreadMutexPrivateData.h in Headers */,
BE11833905D6FE3900EB53E5 /* PThreadPrivateData.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8D07F2BC0486CC7A007CD1D0 /* OpenThreads */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0011012F0873634F0015C576 /* Build configuration list for PBXNativeTarget "OpenThreads" */;
buildPhases = (
8D07F2BD0486CC7A007CD1D0 /* Headers */,
8D07F2BF0486CC7A007CD1D0 /* Resources */,
8D07F2C10486CC7A007CD1D0 /* Sources */,
8D07F2C30486CC7A007CD1D0 /* Frameworks */,
8D07F2C50486CC7A007CD1D0 /* Rez */,
);
buildRules = (
);
dependencies = (
);
name = OpenThreads;
productInstallPath = "$(HOME)/Library/Frameworks";
productName = OpenThreads;
productReference = 8D07F2C80486CC7A007CD1D0 /* OpenThreads.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 001101330873634F0015C576 /* Build configuration list for PBXProject "OpenThreads" */;
hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* OpenThreads */;
productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
projectDirPath = "";
targets = (
8D07F2BC0486CC7A007CD1D0 /* OpenThreads */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D07F2BF0486CC7A007CD1D0 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D07F2C00486CC7A007CD1D0 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXRezBuildPhase section */
8D07F2C50486CC7A007CD1D0 /* Rez */ = {
isa = PBXRezBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXRezBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D07F2C10486CC7A007CD1D0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BE11835105D7022C00EB53E5 /* PThread.c++ in Sources */,
BE11835205D7022C00EB53E5 /* PThreadBarrier.c++ in Sources */,
BE11835405D7022C00EB53E5 /* PThreadCondition.c++ in Sources */,
BE11835605D7022C00EB53E5 /* PThreadMutex.c++ in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C1666FE841158C02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C1667FE841158C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
001101300873634F0015C576 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
DEBUGGING_SYMBOLS = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_ENABLE_TRIGRAPHS = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = OpenThreads_Prefix.pch;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = NO;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
LIBRARY_STYLE = Dynamic;
MACH_O_TYPE = mh_dylib;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-seg1addr",
0x1FF00000,
);
PRODUCT_NAME = OpenThreads;
SECTORDER_FLAGS = "";
SYMROOT = ../OpenSceneGraph/build;
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
WRAPPER_EXTENSION = framework;
ZERO_LINK = YES;
};
name = Development;
};
001101310873634F0015C576 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_ENABLE_TRIGRAPHS = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = OpenThreads_Prefix.pch;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = NO;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
LIBRARY_STYLE = Dynamic;
MACH_O_TYPE = mh_dylib;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-seg1addr",
0x1FF00000,
);
PRODUCT_NAME = OpenThreads;
SECTORDER_FLAGS = "";
STRIP_INSTALLED_PRODUCT = YES;
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
WRAPPER_EXTENSION = framework;
ZERO_LINK = NO;
};
name = Deployment;
};
001101320873634F0015C576 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_ENABLE_TRIGRAPHS = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = OpenThreads_Prefix.pch;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = NO;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
LIBRARY_STYLE = Dynamic;
MACH_O_TYPE = mh_dylib;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-seg1addr",
0x1FF00000,
);
PRODUCT_NAME = OpenThreads;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
WRAPPER_EXTENSION = framework;
};
name = Default;
};
001101340873634F0015C576 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_AUTO_VECTORIZATION = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
HEADER_SEARCH_PATHS = (
../../include,
"$(inherited)",
);
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
STRIP_STYLE = "non-global";
};
name = Development;
};
001101350873634F0015C576 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
DEPLOYMENT_POSTPROCESSING = YES;
GCC_AUTO_VECTORIZATION = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = s;
HEADER_SEARCH_PATHS = ../../include;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
STRIP_STYLE = "non-global";
};
name = Deployment;
};
001101360873634F0015C576 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_AUTO_VECTORIZATION = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 3;
HEADER_SEARCH_PATHS = ../../include;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
STRIP_STYLE = "non-global";
};
name = Default;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0011012F0873634F0015C576 /* Build configuration list for PBXNativeTarget "OpenThreads" */ = {
isa = XCConfigurationList;
buildConfigurations = (
001101300873634F0015C576 /* Development */,
001101310873634F0015C576 /* Deployment */,
001101320873634F0015C576 /* Default */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Default;
};
001101330873634F0015C576 /* Build configuration list for PBXProject "OpenThreads" */ = {
isa = XCConfigurationList;
buildConfigurations = (
001101340873634F0015C576 /* Development */,
001101350873634F0015C576 /* Deployment */,
001101360873634F0015C576 /* Default */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Default;
};
/* End XCConfigurationList section */
};
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
}

View File

@@ -1,5 +0,0 @@
//
// Prefix header for all source files of the 'OpenThreads' target in the 'OpenThreads' project.
//
//#include <Carbon/Carbon.h>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildVersion</key>
<string>38</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>ProjectName</key>
<string>CarbonProjectTemplates</string>
<key>SourceVersion</key>
<string>140000</string>
</dict>
</plist>

View File

@@ -57,7 +57,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osglogicop)
ADD_SUBDIRECTORY(osglogo)
ADD_SUBDIRECTORY(osgmanipulator)
ADD_SUBDIRECTORY(osgmemorytest)
ADD_SUBDIRECTORY(osgmotionblur)
ADD_SUBDIRECTORY(osgmovie)
ADD_SUBDIRECTORY(osgmultiplerendertargets)
@@ -108,10 +107,10 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgtexture3D)
ADD_SUBDIRECTORY(osgtexturerectangle)
ADD_SUBDIRECTORY(osgthirdpersonview)
ADD_SUBDIRECTORY(osgunittests)
ADD_SUBDIRECTORY(osgvertexprogram)
ADD_SUBDIRECTORY(osgvolume)
ADD_SUBDIRECTORY(osgwindows)
ADD_SUBDIRECTORY(osganimationhardware)
ADD_SUBDIRECTORY(osganimationtimeline)
ADD_SUBDIRECTORY(osganimationnode)
ADD_SUBDIRECTORY(osganimationmakepath)
@@ -135,6 +134,11 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgwidgettable)
ADD_SUBDIRECTORY(osgwidgetwindow)
IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(osgunittests)
ADD_SUBDIRECTORY(osgmemorytest)
ENDIF()
ADD_SUBDIRECTORY(osgpdf)
IF (BUILD_OSG_WRAPPERS)
@@ -161,9 +165,13 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerWX)
ENDIF(wxWidgets_FOUND)
IF (QT_FOUND AND QT_QTOPENGL_LIBRARY)
ADD_SUBDIRECTORY(osgviewerQT)
ENDIF(QT_FOUND AND QT_QTOPENGL_LIBRARY)
IF (QT_FOUND)
OPTION(BUILD_QT_EXAMPLES "Enable the build of the examples that depend on Qt" ON)
IF (BUILD_QT_EXAMPLES AND QT_QTOPENGL_LIBRARY)
ADD_SUBDIRECTORY(osgviewerQT)
ENDIF()
ENDIF()
IF (FLTK_FOUND)
ADD_SUBDIRECTORY(osgviewerFLTK)

View File

@@ -0,0 +1,3 @@
SET(TARGET_SRC osganimationhardware.cpp )
SET(TARGET_ADDED_LIBRARIES osgAnimation )
SETUP_EXAMPLE(osganimationhardware)

View File

@@ -0,0 +1,264 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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.
*/
#include <iostream>
#include <osgDB/ReadFile>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/StateSetManipulator>
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TerrainManipulator>
#include <osg/Drawable>
#include <osg/MatrixTransform>
#include <osgAnimation/BasicAnimationManager>
#include <osgAnimation/RigGeometry>
#include <osgAnimation/RigTransformHardware>
#include <osgAnimation/AnimationManagerBase>
#include <osgAnimation/BoneMapVisitor>
#include <sstream>
static unsigned int getRandomValueinRange(unsigned int v)
{
return static_cast<unsigned int>((rand() * 1.0 * v)/(RAND_MAX-1));
}
osg::ref_ptr<osg::Program> program;
// show how to override the default RigTransformHardware for customized usage
struct MyRigTransformHardware : public osgAnimation::RigTransformHardware
{
void operator()(osgAnimation::RigGeometry& geom)
{
if (_needInit)
if (!init(geom))
return;
computeMatrixPaletteUniform(geom.getMatrixFromSkeletonToGeometry(), geom.getInvMatrixFromSkeletonToGeometry());
}
bool init(osgAnimation::RigGeometry& geom)
{
osg::Vec3Array* pos = dynamic_cast<osg::Vec3Array*>(geom.getVertexArray());
if (!pos) {
osg::notify(osg::WARN) << "RigTransformHardware no vertex array in the geometry " << geom.getName() << std::endl;
return false;
}
if (!geom.getSkeleton()) {
osg::notify(osg::WARN) << "RigTransformHardware no skeleting set in geometry " << geom.getName() << std::endl;
return false;
}
osgAnimation::BoneMapVisitor mapVisitor;
geom.getSkeleton()->accept(mapVisitor);
osgAnimation::BoneMap bm = mapVisitor.getBoneMap();
if (!createPalette(pos->size(),bm, geom.getVertexInfluenceSet().getVertexToBoneList()))
return false;
int attribIndex = 11;
int nbAttribs = getNumVertexAttrib();
// use a global program for all avatar
if (!program.valid()) {
program = new osg::Program;
program->setName("HardwareSkinning");
if (!_shader.valid())
_shader = osg::Shader::readShaderFile(osg::Shader::VERTEX,"shaders/skinning.vert");
if (!_shader.valid()) {
osg::notify(osg::WARN) << "RigTransformHardware can't load VertexShader" << std::endl;
return false;
}
// replace max matrix by the value from uniform
{
std::string str = _shader->getShaderSource();
std::string toreplace = std::string("MAX_MATRIX");
std::size_t start = str.find(toreplace);
std::stringstream ss;
ss << getMatrixPaletteUniform()->getNumElements();
str.replace(start, toreplace.size(), ss.str());
_shader->setShaderSource(str);
osg::notify(osg::INFO) << "Shader " << str << std::endl;
}
program->addShader(_shader.get());
for (int i = 0; i < nbAttribs; i++)
{
std::stringstream ss;
ss << "boneWeight" << i;
program->addBindAttribLocation(ss.str(), attribIndex + i);
osg::notify(osg::INFO) << "set vertex attrib " << ss.str() << std::endl;
}
}
for (int i = 0; i < nbAttribs; i++)
{
std::stringstream ss;
ss << "boneWeight" << i;
geom.setVertexAttribData(attribIndex + i, osg::Geometry::ArrayData(getVertexAttrib(i),osg::Geometry::BIND_PER_VERTEX));
}
osg::ref_ptr<osg::StateSet> ss = new osg::StateSet;
ss->addUniform(getMatrixPaletteUniform());
ss->addUniform(new osg::Uniform("nbBonesPerVertex", getNumBonesPerVertex()));
ss->setAttributeAndModes(program.get());
geom.setStateSet(ss.get());
_needInit = false;
return true;
}
};
struct SetupRigGeometry : public osg::NodeVisitor
{
bool _hardware;
SetupRigGeometry( bool hardware = true) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _hardware(hardware) {}
void apply(osg::Geode& geode)
{
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
apply(*geode.getDrawable(i));
}
void apply(osg::Drawable& geom)
{
if (_hardware) {
osgAnimation::RigGeometry* rig = dynamic_cast<osgAnimation::RigGeometry*>(&geom);
if (rig)
rig->setRigTransformImplementation(new MyRigTransformHardware);
}
#if 0
if (geom.getName() != std::string("BoundingBox")) // we disable compute of bounding box for all geometry except our bounding box
geom.setComputeBoundingBoxCallback(new osg::Drawable::ComputeBoundingBoxCallback);
// geom.setInitialBound(new osg::Drawable::ComputeBoundingBoxCallback);
#endif
}
};
osg::Group* createCharacterInstance(osg::Group* character, bool hardware)
{
osg::ref_ptr<osg::Group> c ;
if (hardware)
c = osg::clone(character, osg::CopyOp::DEEP_COPY_ALL & ~osg::CopyOp::DEEP_COPY_PRIMITIVES & ~osg::CopyOp::DEEP_COPY_ARRAYS);
else
c = osg::clone(character, osg::CopyOp::DEEP_COPY_ALL);
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(c->getUpdateCallback());
osgAnimation::BasicAnimationManager* anim = dynamic_cast<osgAnimation::BasicAnimationManager*>(animationManager);
const osgAnimation::AnimationList& list = animationManager->getAnimationList();
int v = getRandomValueinRange(list.size());
if (list[v]->getName() == std::string("MatIpo_ipo")) {
anim->playAnimation(list[v].get());
v = (v + 1)%list.size();
}
anim->playAnimation(list[v].get());
SetupRigGeometry switcher(hardware);
c->accept(switcher);
return c.release();
}
int main (int argc, char* argv[])
{
std::cerr << "This example works better with nathan.osg" << std::endl;
osg::ArgumentParser psr(&argc, argv);
osgViewer::Viewer viewer(psr);
bool hardware = true;
int maxChar = 10;
while (psr.read("--software")) { hardware = false; }
while (psr.read("--number", maxChar)) {}
osg::ref_ptr<osg::Group> root = dynamic_cast<osg::Group*>(osgDB::readNodeFiles(psr));
if (!root)
{
std::cout << psr.getApplicationName() <<": No data loaded" << std::endl;
return 1;
}
{
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
if(!animationManager)
{
osg::notify(osg::FATAL) << "no AnimationManagerBase found, updateCallback need to animate elements" << std::endl;
return 1;
}
}
osg::ref_ptr<osg::Group> scene = new osg::Group;
// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
// add the thread model handler
viewer.addEventHandler(new osgViewer::ThreadingHandler);
// add the window size toggle handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
// add the help handler
viewer.addEventHandler(new osgViewer::HelpHandler(psr.getApplicationUsage()));
// add the LOD Scale handler
viewer.addEventHandler(new osgViewer::LODScaleHandler);
// add the screen capture handler
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
viewer.setSceneData(scene.get());
viewer.realize();
double xChar = maxChar;
double yChar = xChar * 9.0/16;
for (double i = 0.0; i < xChar; i++) {
for (double j = 0.0; j < yChar; j++) {
osg::ref_ptr<osg::Group> c = createCharacterInstance(root.get(), hardware);
osg::MatrixTransform* tr = new osg::MatrixTransform;
tr->setMatrix(osg::Matrix::translate( 2.0 * (i - xChar * .5),
0.0,
2.0 * (j - yChar * .5)));
tr->addChild(c.get());
scene->addChild(tr);
}
}
std::cout << "created " << xChar * yChar << " instance" << std::endl;
return viewer.run();
}

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -18,14 +18,19 @@
#include <osg/Geode>
#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
#include <osgDB/WriteFile>
#include <osgUtil/SmoothingVisitor>
#include <osg/io_utils>
#include <osgAnimation/Bone>
#include <osgAnimation/Skeleton>
#include <osgAnimation/RigGeometry>
#include <osgAnimation/Skinning>
#include <osgAnimation/BasicAnimationManager>
#include <osgAnimation/UpdateMatrixTransform>
#include <osgAnimation/UpdateBone>
#include <osgAnimation/StackedTransform>
#include <osgAnimation/StackedTranslateElement>
#include <osgAnimation/StackedRotateAxisElement>
osg::Geode* createAxis()
{
@@ -59,8 +64,9 @@ osg::Geode* createAxis()
osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
{
osgAnimation::RigGeometry* geometry = new osgAnimation::RigGeometry;
osgAnimation::RigGeometry* riggeometry = new osgAnimation::RigGeometry;
osg::Geometry* geometry = new osg::Geometry;
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array());
geometry->setVertexArray (vertices.get());
@@ -120,7 +126,8 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, array->size(), &array->front()));
geometry->setUseDisplayList( false );
return geometry;
riggeometry->setSourceGeometry(geometry);
return riggeometry;
}
@@ -164,22 +171,27 @@ int main (int argc, char* argv[])
osg::ref_ptr<osgAnimation::Skeleton> skelroot = new osgAnimation::Skeleton;
skelroot->setDefaultUpdateCallback();
osg::ref_ptr<osgAnimation::Bone> root = new osgAnimation::Bone;
{
root->setBindMatrixInBoneSpace(osg::Matrix::identity());
root->setBindMatrixInBoneSpace(osg::Matrix::translate(-1,0,0));
root->setName("root");
root->setDefaultUpdateCallback();
}
root->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(-1,0,0)));
root->setName("root");
osgAnimation::UpdateBone* pRootUpdate = new osgAnimation::UpdateBone("root");
pRootUpdate->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate",osg::Vec3(-1,0,0)));
root->setUpdateCallback(pRootUpdate);
osg::ref_ptr<osgAnimation::Bone> right0 = new osgAnimation::Bone;
right0->setBindMatrixInBoneSpace(osg::Matrix::translate(1,0,0));
right0->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(0,0,0)));
right0->setName("right0");
right0->setDefaultUpdateCallback("right0");
osgAnimation::UpdateBone* pRight0Update = new osgAnimation::UpdateBone("right0");
pRight0Update->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate", osg::Vec3(1,0,0)));
pRight0Update->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("rotate", osg::Vec3(0,0,1), 0));
right0->setUpdateCallback(pRight0Update);
osg::ref_ptr<osgAnimation::Bone> right1 = new osgAnimation::Bone;
right1->setBindMatrixInBoneSpace(osg::Matrix::translate(1,0,0));
right1->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(1,0,0)));
right1->setName("right1");
right1->setDefaultUpdateCallback("right1");
osgAnimation::UpdateBone* pRight1Update = new osgAnimation::UpdateBone("right1");
pRight1Update->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate", osg::Vec3(1,0,0)));
pRight1Update->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("rotate", osg::Vec3(0,0,1), 0));
right1->setUpdateCallback(pRight1Update);
root->addChild(right0.get());
right0->addChild(right1.get());
@@ -191,33 +203,27 @@ int main (int argc, char* argv[])
osgAnimation::Animation* anim = new osgAnimation::Animation;
{
osgAnimation::QuatKeyframeContainer* keys0 = new osgAnimation::QuatKeyframeContainer;
osg::Quat rotate;
rotate.makeRotate(osg::PI_2, osg::Vec3(0,0,1));
keys0->push_back(osgAnimation::QuatKeyframe(0,osg::Quat(0,0,0,1)));
keys0->push_back(osgAnimation::QuatKeyframe(3,rotate));
keys0->push_back(osgAnimation::QuatKeyframe(6,rotate));
osgAnimation::QuatSphericalLinearSampler* sampler = new osgAnimation::QuatSphericalLinearSampler;
osgAnimation::FloatKeyframeContainer* keys0 = new osgAnimation::FloatKeyframeContainer;
keys0->push_back(osgAnimation::FloatKeyframe(0,0));
keys0->push_back(osgAnimation::FloatKeyframe(3,osg::PI_2));
keys0->push_back(osgAnimation::FloatKeyframe(6,osg::PI_2));
osgAnimation::FloatLinearSampler* sampler = new osgAnimation::FloatLinearSampler;
sampler->setKeyframeContainer(keys0);
// osgAnimation::AnimationUpdateCallback* cb = dynamic_cast<osgAnimation::AnimationUpdateCallback*>(right0->getUpdateCallback());
osgAnimation::QuatSphericalLinearChannel* channel = new osgAnimation::QuatSphericalLinearChannel(sampler);
channel->setName("quaternion");
osgAnimation::FloatLinearChannel* channel = new osgAnimation::FloatLinearChannel(sampler);
channel->setName("rotate");
channel->setTargetName("right0");
anim->addChannel(channel);
}
{
osgAnimation::QuatKeyframeContainer* keys1 = new osgAnimation::QuatKeyframeContainer;
osg::Quat rotate;
rotate.makeRotate(osg::PI_2, osg::Vec3(0,0,1));
keys1->push_back(osgAnimation::QuatKeyframe(0,osg::Quat(0,0,0,1)));
keys1->push_back(osgAnimation::QuatKeyframe(3,osg::Quat(0,0,0,1)));
keys1->push_back(osgAnimation::QuatKeyframe(6,rotate));
osgAnimation::QuatSphericalLinearSampler* sampler = new osgAnimation::QuatSphericalLinearSampler;
osgAnimation::FloatKeyframeContainer* keys1 = new osgAnimation::FloatKeyframeContainer;
keys1->push_back(osgAnimation::FloatKeyframe(0,0));
keys1->push_back(osgAnimation::FloatKeyframe(3,0));
keys1->push_back(osgAnimation::FloatKeyframe(6,osg::PI_2));
osgAnimation::FloatLinearSampler* sampler = new osgAnimation::FloatLinearSampler;
sampler->setKeyframeContainer(keys1);
osgAnimation::QuatSphericalLinearChannel* channel = new osgAnimation::QuatSphericalLinearChannel(sampler);
//osgAnimation::AnimationUpdateCallback* cb = dynamic_cast<osgAnimation::AnimationUpdateCallback*>(right1->getUpdateCallback());
channel->setName("quaternion");
osgAnimation::FloatLinearChannel* channel = new osgAnimation::FloatLinearChannel(sampler);
channel->setName("rotate");
channel->setTargetName("right1");
anim->addChannel(channel);
}
@@ -246,7 +252,7 @@ int main (int argc, char* argv[])
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
skelroot->addChild(geode);
osg::ref_ptr<osg::Vec3Array> src = dynamic_cast<osg::Vec3Array*>(geom->getVertexArray());
osg::ref_ptr<osg::Vec3Array> src = dynamic_cast<osg::Vec3Array*>(geom->getSourceGeometry()->getVertexArray());
geom->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
geom->setDataVariance(osg::Object::DYNAMIC);
@@ -261,6 +267,7 @@ int main (int argc, char* argv[])
viewer.frame();
}
osgDB::writeNodeFile(*scene, "skinning.osg");
return 0;
}

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -22,7 +22,8 @@
#include <osgAnimation/BasicAnimationManager>
#include <osgAnimation/Channel>
#include <osgAnimation/UpdateCallback>
#include <osgAnimation/UpdateMatrixTransform>
#include <osgAnimation/StackedTranslateElement>
using namespace osgAnimation;
@@ -74,7 +75,9 @@ int main (int argc, char* argv[])
osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform();
trans->setName("AnimatedNode");
trans->setDataVariance(osg::Object::DYNAMIC);
trans->setUpdateCallback(new osgAnimation::UpdateTransform("AnimatedCallback"));
osgAnimation::UpdateMatrixTransform* updatecb = new osgAnimation::UpdateMatrixTransform("AnimatedCallback");
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("position"));
trans->setUpdateCallback(updatecb);
trans->setMatrix(osg::Matrix::identity());
trans->addChild (geode.get());

View File

@@ -26,15 +26,19 @@
#include <osgAnimation/Bone>
#include <osgAnimation/Skeleton>
#include <osgAnimation/RigGeometry>
#include <osgAnimation/Skinning>
#include <osgAnimation/Timeline>
#include <osgAnimation/AnimationManagerBase>
#include <osgAnimation/TimelineAnimationManager>
#include <osgAnimation/ActionStripAnimation>
#include <osgAnimation/ActionBlendIn>
#include <osgAnimation/ActionBlendOut>
#include <osgAnimation/ActionAnimation>
struct NoseBegin : public osgAnimation::Action::Callback
{
virtual void operator()(osgAnimation::Action* action)
virtual void operator()(osgAnimation::Action* action, osgAnimation::ActionVisitor* nv)
{
std::cout << "sacrebleu, it scratches my nose, let me scratch it" << std::endl;
std::cout << "process NoseBegin call back " << action->getName() << std::endl << std::endl;
@@ -43,7 +47,7 @@ struct NoseBegin : public osgAnimation::Action::Callback
struct NoseEnd : public osgAnimation::Action::Callback
{
virtual void operator()(osgAnimation::Action* action)
virtual void operator()(osgAnimation::Action* action, osgAnimation::ActionVisitor* nv)
{
std::cout << "shhhrt shrrrrt shhhhhhrrrrt, haaa it's better"<< std::endl;
std::cout << "process NoseEnd call back " << action->getName() << std::endl << std::endl;
@@ -52,9 +56,9 @@ struct NoseEnd : public osgAnimation::Action::Callback
struct ExampleTimelineUsage : public osgGA::GUIEventHandler
{
osg::ref_ptr<osgAnimation::StripAnimation> _mainLoop;
osg::ref_ptr<osgAnimation::StripAnimation> _scratchHead;
osg::ref_ptr<osgAnimation::StripAnimation> _scratchNose;
osg::ref_ptr<osgAnimation::ActionStripAnimation> _mainLoop;
osg::ref_ptr<osgAnimation::ActionStripAnimation> _scratchHead;
osg::ref_ptr<osgAnimation::ActionStripAnimation> _scratchNose;
osg::ref_ptr<osgAnimation::TimelineAnimationManager> _manager;
bool _releaseKey;
@@ -69,14 +73,14 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
for (osgAnimation::AnimationList::const_iterator it = list.begin(); it != list.end(); it++)
map[(*it)->getName()] = *it;
_mainLoop = new osgAnimation::StripAnimation(map["Idle_Main"].get(),0.0,0.0);
_mainLoop = new osgAnimation::ActionStripAnimation(map["Idle_Main"].get(),0.0,0.0);
_mainLoop->setLoop(0); // means forever
_scratchHead = new osgAnimation::StripAnimation(map["Idle_Head_Scratch.02"].get(),0.2,0.3);
_scratchHead = new osgAnimation::ActionStripAnimation(map["Idle_Head_Scratch.02"].get(),0.2,0.3);
_scratchHead->setLoop(1); // one time
map["Idle_Nose_Scratch.01"]->setDuration(10.0); // set this animation duration to 10 seconds
_scratchNose = new osgAnimation::StripAnimation(map["Idle_Nose_Scratch.01"].get(),0.2,0.3);
_scratchNose = new osgAnimation::ActionStripAnimation(map["Idle_Nose_Scratch.01"].get(),0.2,0.3);
_scratchNose->setLoop(1); // one time
// add the main loop at priority 0 at time 0.

View File

@@ -1,7 +1,19 @@
#this file is automatically generated
# INCLUDE_DIRECTORIES( ${OPENAL_INCLUDE_DIR} )
# SET(TARGET_EXTERNAL_LIBRARIES ${OPENAL_LIBRARY} alut)
IF (SDL_FOUND)
SET(TARGET_EXTERNAL_LIBRARIES ${SDL_LIBRARY} )
INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR} )
ADD_DEFINITIONS(-DUSE_SDL)
IF (MINGW)
SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} winmm dinput ddraw dxguid)
ENDIF()
ENDIF(SDL_FOUND)
SET(TARGET_SRC osgmovie.cpp )
SET(TARGET_ADDED_LIBRARIES osgGA )
#### end var setup ###
SETUP_EXAMPLE(osgmovie)

View File

@@ -43,7 +43,7 @@ class MovieEventHandler : public osgGA::GUIEventHandler
{
public:
MovieEventHandler():_playToggle(true),_trackMouse(false) {}
MovieEventHandler():_trackMouse(false) {}
void setMouseTracking(bool track) { _trackMouse = track; }
bool getMouseTracking() const { return _trackMouse; }
@@ -116,9 +116,9 @@ protected:
};
bool _playToggle;
bool _trackMouse;
ImageStreamList _imageStreamList;
unsigned int _seekIncr;
};
@@ -211,17 +211,16 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
itr!=_imageStreamList.end();
++itr)
{
_playToggle = !_playToggle;
if ( _playToggle )
osg::ImageStream::StreamStatus playToggle = (*itr)->getStatus();
if (playToggle != osg::ImageStream::PLAYING)
{
// playing, so pause
std::cout<<"Play"<<std::endl;
std::cout<< (*itr).get() << " Play"<<std::endl;
(*itr)->play();
}
else
{
// playing, so pause
std::cout<<"Pause"<<std::endl;
std::cout<< (*itr).get() << " Pause"<<std::endl;
(*itr)->pause();
}
}
@@ -233,12 +232,29 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
itr!=_imageStreamList.end();
++itr)
{
std::cout<<"Restart"<<std::endl;
std::cout<< (*itr).get() << " Restart"<<std::endl;
(*itr)->rewind();
(*itr)->play();
}
return true;
}
else if (ea.getKey()=='>')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
std::cout<<"Seeking"<<std::endl;
if(_seekIncr > 3) _seekIncr = 0;
double length = (*itr)->getLength();
double t_pos = (length/4.0f)*_seekIncr;
//(*itr)->rewind();
(*itr)->seek(t_pos);
(*itr)->play();
_seekIncr++;
}
return true;
}
else if (ea.getKey()=='L')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
@@ -247,17 +263,53 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
{
if ( (*itr)->getLoopingMode() == osg::ImageStream::LOOPING)
{
std::cout<<"Toggle Looping Off"<<std::endl;
std::cout<< (*itr).get() << " Toggle Looping Off"<<std::endl;
(*itr)->setLoopingMode( osg::ImageStream::NO_LOOPING );
}
else
{
std::cout<<"Toggle Looping On"<<std::endl;
std::cout<< (*itr).get() << " Toggle Looping On"<<std::endl;
(*itr)->setLoopingMode( osg::ImageStream::LOOPING );
}
}
return true;
}
else if (ea.getKey()=='+')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
double tm = (*itr)->getTimeMultiplier();
tm += 0.1;
(*itr)->setTimeMultiplier(tm);
std::cout << (*itr).get() << " Increase speed rate "<< (*itr)->getTimeMultiplier() << std::endl;
}
return true;
}
else if (ea.getKey()=='-')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
double tm = (*itr)->getTimeMultiplier();
tm -= 0.1;
(*itr)->setTimeMultiplier(tm);
std::cout << (*itr).get() << " Decrease speed rate "<< (*itr)->getTimeMultiplier() << std::endl;
}
return true;
}
else if (ea.getKey()=='o')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
std::cout<< (*itr).get() << " Frame rate "<< (*itr)->getFrameRate() <<std::endl;
}
return true;
}
return false;
}
@@ -272,6 +324,10 @@ void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
usage.addKeyboardMouseBinding("p","Play/Pause movie");
usage.addKeyboardMouseBinding("r","Restart movie");
usage.addKeyboardMouseBinding("l","Toggle looping of movie");
usage.addKeyboardMouseBinding("+","Increase speed of movie");
usage.addKeyboardMouseBinding("-","Decrease speed of movie");
usage.addKeyboardMouseBinding("o","Display frame rate of movie");
usage.addKeyboardMouseBinding(">","Advance the movie using seek");
}
@@ -320,6 +376,33 @@ osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,flo
}
}
#if USE_SDL
class SDLAudioSink : public osg::AudioSink
{
public:
SDLAudioSink(osg::AudioStream* audioStream):
_started(false),
_paused(false),
_audioStream(audioStream) {}
~SDLAudioSink();
virtual void play();
virtual void pause();
virtual void stop();
virtual bool playing() const { return _started && !_paused; }
bool _started;
bool _paused;
osg::observer_ptr<osg::AudioStream> _audioStream;
};
#endif
int main(int argc, char** argv)
{
// use an ArgumentParser object to manage the program arguments.
@@ -425,6 +508,13 @@ int main(int argc, char** argv)
osg::Vec3 bottomright = pos;
bool xyPlane = fullscreen;
bool useAudioSink = false;
while(arguments.read("--audio")) { useAudioSink = true; }
#if USE_SDL
unsigned int numAudioStreamsEnabled = 0;
#endif
for(int i=1;i<arguments.argc();++i)
{
@@ -432,18 +522,50 @@ int main(int argc, char** argv)
{
osg::Image* image = osgDB::readImageFile(arguments[i]);
osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
if (imagestream) imagestream->play();
if (imagestream)
{
osg::ImageStream::AudioStreams& audioStreams = imagestream->getAudioStreams();
if (useAudioSink && !audioStreams.empty())
{
osg::AudioStream* audioStream = audioStreams[0].get();
osg::notify(osg::NOTICE)<<"AudioStream read ["<<audioStream->getName()<<"]"<<std::endl;
#if USE_SDL
if (numAudioStreamsEnabled==0)
{
audioStream->setAudioSink(new SDLAudioSink(audioStream));
++numAudioStreamsEnabled;
}
#endif
}
imagestream->play();
}
if (image)
{
osg::notify(osg::NOTICE)<<"image->s()"<<image->s()<<" image-t()="<<image->t()<<std::endl;
osg::notify(osg::NOTICE)<<"image->s()"<<image->s()<<" image-t()="<<image->t()<<" aspectRatio="<<image->getPixelAspectRatio()<<std::endl;
geode->addDrawable(myCreateTexturedQuadGeometry(pos,image->s(),image->t(),image, useTextureRectangle, xyPlane, flip));
float width = image->s() * image->getPixelAspectRatio();
float height = image->t();
bottomright = pos + osg::Vec3(static_cast<float>(image->s()),static_cast<float>(image->t()),0.0f);
osg::ref_ptr<osg::Drawable> drawable = myCreateTexturedQuadGeometry(pos, width, height,image, useTextureRectangle, xyPlane, flip);
if (image->isImageTranslucent())
{
osg::notify(osg::NOTICE)<<"Transparent movie, enabling blending."<<std::endl;
if (xyPlane) pos.y() += image->t()*1.05f;
else pos.z() += image->t()*1.05f;
drawable->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);
drawable->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
}
geode->addDrawable(drawable.get());
bottomright = pos + osg::Vec3(width,height,0.0f);
if (xyPlane) pos.y() += height*1.05f;
else pos.z() += height*1.05f;
}
else
{
@@ -484,8 +606,44 @@ int main(int argc, char** argv)
if (fullscreen)
{
viewer.realize();
viewer.getCamera()->setClearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
float screenAspectRatio = 1280.0f/1024.0f;
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (wsi)
{
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
screenAspectRatio = float(width) / float(height);
}
float modelAspectRatio = (bottomright.x()-topleft.x())/(bottomright.y()-topleft.y());
viewer.getCamera()->setViewMatrix(osg::Matrix::identity());
osg::Vec3 center = (bottomright + topleft)*0.5f;
osg::Vec3 dx(bottomright.x()-center.x(), 0.0f, 0.0f);
osg::Vec3 dy(0.0f, topleft.y()-center.y(), 0.0f);
float ratio = modelAspectRatio/screenAspectRatio;
if (ratio>1.0f)
{
// use model width as the control on model size.
bottomright = center + dx - dy * ratio;
topleft = center - dx + dy * ratio;
}
else
{
// use model height as the control on model size.
bottomright = center + dx / ratio - dy;
topleft = center - dx / ratio + dy;
}
viewer.getCamera()->setProjectionMatrixAsOrtho2D(topleft.x(),bottomright.x(),topleft.y(),bottomright.y());
while(!viewer.done())
@@ -501,3 +659,83 @@ int main(int argc, char** argv)
}
}
#if USE_SDL
#include "SDL.h"
static void soundReadCallback(void * user_data, uint8_t * data, int datalen)
{
SDLAudioSink * sink = reinterpret_cast<SDLAudioSink*>(user_data);
osg::ref_ptr<osg::AudioStream> as = sink->_audioStream.get();
if (as.valid())
{
as->consumeAudioBuffer(data, datalen);
}
}
SDLAudioSink::~SDLAudioSink()
{
stop();
}
void SDLAudioSink::play()
{
if (_started)
{
if (_paused)
{
SDL_PauseAudio(0);
_paused = false;
}
return;
}
_started = true;
_paused = false;
osg::notify(osg::NOTICE)<<"SDLAudioSink()::startPlaying()"<<std::endl;
osg::notify(osg::NOTICE)<<" audioFrequency()="<<_audioStream->audioFrequency()<<std::endl;
osg::notify(osg::NOTICE)<<" audioNbChannels()="<<_audioStream->audioNbChannels()<<std::endl;
osg::notify(osg::NOTICE)<<" audioSampleFormat()="<<_audioStream->audioSampleFormat()<<std::endl;
SDL_AudioSpec specs = { 0 };
SDL_AudioSpec wanted_specs = { 0 };
wanted_specs.freq = _audioStream->audioFrequency();
wanted_specs.format = AUDIO_S16SYS;
wanted_specs.channels = _audioStream->audioNbChannels();
wanted_specs.silence = 0;
wanted_specs.samples = 1024;
wanted_specs.callback = soundReadCallback;
wanted_specs.userdata = this;
if (SDL_OpenAudio(&wanted_specs, &specs) < 0)
throw "SDL_OpenAudio() failed (" + std::string(SDL_GetError()) + ")";
SDL_PauseAudio(0);
}
void SDLAudioSink::pause()
{
if (_started)
{
SDL_PauseAudio(1);
_paused = true;
}
}
void SDLAudioSink::stop()
{
if (_started)
{
if (!_paused) SDL_PauseAudio(1);
SDL_CloseAudio();
osg::notify(osg::NOTICE)<<"~SDLAudioSink() destructor, but still playing"<<std::endl;
}
}
#endif

View File

@@ -1,20 +1,25 @@
SET(TARGET_EXTERNAL_LIBRARIES ${SDL_LIBRARY} )
IF("${SDL_LIBRARY}" MATCHES "SDLmain")
# Found a precompiled SDLmain library.
SET(TARGET_SRC osgviewerSDL.cpp)
ELSE("${SDL_LIBRARY}" MATCHES "SDLmain")
ELSE()
# No SDLmain has been found.
# Depending on platform, code may need to be provided for SDLmain.
IF(APPLE)
SET(TARGET_SRC osgviewerSDL.cpp SDLMainForMacOSX.m SDLMainForMacOSX.h)
ELSE(APPLE)
ELSE()
# Unhandled case. No libsdlmain has been found and no code substitute.
# Depending on platform (or SDL version),
# this may or may not link successfully.
SET(TARGET_SRC osgviewerSDL.cpp)
ENDIF(APPLE)
ENDIF("${SDL_LIBRARY}" MATCHES "SDLmain")
SET(TARGET_EXTERNAL_LIBRARIES ${SDLMAIN_LIBRARY} ${TARGET_EXTERNAL_LIBRARIES} )
ENDIF()
ENDIF()
SET(TARGET_EXTERNAL_LIBRARIES ${SDL_LIBRARY} )
IF (MINGW)
SET(TARGET_EXTERNAL_LIBRARIES mingw32 ${TARGET_EXTERNAL_LIBRARIES} winmm dinput ddraw dxguid)
ENDIF()
INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR} )

View File

@@ -17,17 +17,17 @@
#include <OpenThreads/Config>
#include <OpenThreads/Exports>
#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS) && defined(__i386__)
#define _OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES
#if defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
# include <libkern/OSAtomic.h>
# 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
# define _OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES
#elif defined(_OPENTHREADS_ATOMIC_USE_SUN)
# include <atomic.h>
# include "Mutex"
# include "ScopedLock"
#elif defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
# include <libkern/OSAtomic.h>
# define _OPENTHREADS_ATOMIC_USE_LIBRARY_ROUTINES
#elif defined(_OPENTHREADS_ATOMIC_USE_MUTEX)
# include "Mutex"
# include "ScopedLock"

85
include/osg/AudioStream Normal file
View File

@@ -0,0 +1,85 @@
/* -*-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 <osg/Image>
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<const AudioStream*>(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

View File

@@ -24,12 +24,15 @@ 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.*/
@@ -52,6 +55,7 @@ class OSG_EXPORT CopyOp
DEEP_COPY_PRIMITIVES = 1<<8,
DEEP_COPY_SHAPES = 1<<9,
DEEP_COPY_UNIFORMS = 1<<10,
DEEP_COPY_CALLBACKS = 1<<11,
DEEP_COPY_ALL = 0x7FFFFFFF
};
@@ -72,6 +76,8 @@ class OSG_EXPORT CopyOp
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:

View File

@@ -185,6 +185,9 @@ class OSG_EXPORT Image : public Object
void setPacking(unsigned int packing) { _packing = packing; }
inline unsigned int getPacking() const { return _packing; }
inline void setPixelAspectRatio(float pixelAspectRatio) { _pixelAspectRatio = pixelAspectRatio; }
inline float getPixelAspectRatio() const { return _pixelAspectRatio; }
/** Return the number of bits required for each pixel. */
inline unsigned int getPixelSizeInBits() const { return computePixelSizeInBits(_pixelFormat,_dataType); }
@@ -346,6 +349,7 @@ class OSG_EXPORT Image : public Object
GLenum _pixelFormat;
GLenum _dataType;
unsigned int _packing;
float _pixelAspectRatio;
AllocationMode _allocationMode;
unsigned char* _data;

View File

@@ -105,7 +105,7 @@ class OSG_EXPORT ImageSequence : public ImageStream
virtual void update(NodeVisitor* nv);
struct OSG_EXPORT UpdateCallback : public osg::StateAttribute::Callback
struct OSG_EXPORT UpdateCallback : public osg::StateAttributeCallback
{
virtual void operator () (osg::StateAttribute* attr, osg::NodeVisitor* nv);
};

View File

@@ -15,6 +15,7 @@
#define OSG_IMAGESTREAM 1
#include <osg/Image>
#include <osg/AudioStream>
namespace osg {
@@ -77,7 +78,8 @@ class OSG_EXPORT ImageStream : public Image
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; }
@@ -86,6 +88,11 @@ class OSG_EXPORT ImageStream : public Image
virtual void setVolume(float) {}
virtual float getVolume() const { return 0.0f; }
typedef std::vector< osg::ref_ptr<osg::AudioStream> > AudioStreams;
void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; }
AudioStreams& getAudioStreams() { return _audioStreams; }
const AudioStreams& getAudioStreams() const { return _audioStreams; }
protected:
@@ -95,6 +102,8 @@ class OSG_EXPORT ImageStream : public Image
StreamStatus _status;
LoopingMode _loopingMode;
AudioStreams _audioStreams;
};
} // namespace

View File

@@ -18,6 +18,8 @@
#include <osg/NodeCallback>
#include <osg/observer_ptr>
#include <iterator>
namespace osg
{

View File

@@ -88,7 +88,7 @@ public:
// These methods are public so that osgUtil::CullVisitor can access them.
// Not intended for application use.
bool getPassed( const osg::Camera* camera, float distanceToEyePoint );
bool getPassed( const osg::Camera* camera, osg::NodeVisitor& nv );
void traverseQuery( const osg::Camera* camera, osg::NodeVisitor& nv );
void traverseDebug( osg::NodeVisitor& nv );

View File

@@ -449,6 +449,12 @@ class DrawElements : public PrimitiveSet
{
if (_ebo.valid()) _ebo->releaseGLObjects(state);
}
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:
@@ -526,6 +532,11 @@ class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte
_rangeModifiedCount = _modifiedCount;
}
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();
@@ -601,6 +612,11 @@ class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort
_rangeModifiedCount = _modifiedCount;
}
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();
@@ -676,6 +692,11 @@ class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint
_rangeModifiedCount = _modifiedCount;
}
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();

View File

@@ -16,6 +16,7 @@
#include <osg/Export>
#include <osg/Object>
#include <osg/StateAttributeCallback>
#include <osg/GL>
#include <typeinfo>
@@ -190,7 +191,9 @@ class OSG_EXPORT StateAttribute : public Object
StateAttribute();
StateAttribute(const StateAttribute& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
Object(sa,copyop) {}
Object(sa,copyop),
_updateCallback(copyop(sa._updateCallback.get()))
{}
/** Clone the type of an attribute, with Object* return type.
@@ -281,37 +284,28 @@ class OSG_EXPORT StateAttribute : public Object
// default to no black listed GLMode's associated with use of the StateAttribute.
return true;
}
struct Callback : public virtual osg::Object
{
Callback() {}
Callback(const Callback&,const CopyOp&) {}
META_Object(osg,Callback);
/** do customized update code.*/
virtual void operator () (StateAttribute*, NodeVisitor*) {}
};
// provide callback for backwards compatibility.
typedef osg::StateAttributeCallback Callback;
/** Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.*/
void setUpdateCallback(Callback* uc);
void setUpdateCallback(StateAttributeCallback* uc);
/** Get the non const UpdateCallback.*/
Callback* getUpdateCallback() { return _updateCallback.get(); }
StateAttributeCallback* getUpdateCallback() { return _updateCallback.get(); }
/** Get the const UpdateCallback.*/
const Callback* getUpdateCallback() const { return _updateCallback.get(); }
const StateAttributeCallback* getUpdateCallback() const { return _updateCallback.get(); }
/** Set the EventCallback which allows users to attach customize the updating of an object during the Event traversal.*/
void setEventCallback(Callback* ec);
void setEventCallback(StateAttributeCallback* ec);
/** Get the non const EventCallback.*/
Callback* getEventCallback() { return _eventCallback.get(); }
StateAttributeCallback* getEventCallback() { return _eventCallback.get(); }
/** Get the const EventCallback.*/
const Callback* getEventCallback() const { return _eventCallback.get(); }
const StateAttributeCallback* getEventCallback() const { return _eventCallback.get(); }
/** apply the OpenGL state attributes.
@@ -343,8 +337,8 @@ class OSG_EXPORT StateAttribute : public Object
ParentList _parents;
friend class osg::StateSet;
ref_ptr<Callback> _updateCallback;
ref_ptr<Callback> _eventCallback;
ref_ptr<StateAttributeCallback> _updateCallback;
ref_ptr<StateAttributeCallback> _eventCallback;
};
}

View File

@@ -0,0 +1,39 @@
/* -*-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_STATEATTRIBUTECALLBACK
#define OSG_STATEATTRIBUTECALLBACK 1
#include <osg/Export>
#include <osg/Object>
namespace osg {
class StateAttribute;
class NodeVisitor;
class OSG_EXPORT StateAttributeCallback : public virtual osg::Object
{
public:
StateAttributeCallback() {}
StateAttributeCallback(const StateAttributeCallback&,const CopyOp&) {}
META_Object(osg,StateAttributeCallback);
/** do customized update code.*/
virtual void operator () (StateAttribute*, NodeVisitor*) {}
};
}
#endif

View File

@@ -21,8 +21,20 @@ extern "C" {
#define OPENSCENEGRAPH_MAJOR_VERSION 2
#define OPENSCENEGRAPH_MINOR_VERSION 8
#define OPENSCENEGRAPH_PATCH_VERSION 2
#define OPENSCENEGRAPH_SOVERSION 55
#define OPENSCENEGRAPH_PATCH_VERSION 4
#define OPENSCENEGRAPH_SOVERSION 65
/** convinience macro that can be used to decide whether a feature is present or not i.e.
* #if OSG_MIN_VERSION_REQUIRED(2,9,5)
* your code here
* #endif
*/
#define OSG_MIN_VERSION_REQUIRED(MAJOR, MINOR, PATCH) ((OPENSCENEGRAPH_MAJOR_VERSION>MAJOR) || (OPENSCENEGRAPH_MAJOR_VERSION==MAJOR && (OPENSCENEGRAPH_MINOR_VERSION>MINOR || (OPENSCENEGRAPH_MINOR_VERSION==MINOR && OPENSCENEGRAPH_PATCH_VERSION>=PATCH))))
#define OSG_VERSION_LESS_THAN(MAJOR, MINOR, PATCH) ((OPENSCENEGRAPH_MAJOR_VERSION<MAJOR) || (OPENSCENEGRAPH_MAJOR_VERSION==MAJOR && (OPENSCENEGRAPH_MINOR_VERSION<MINOR || (OPENSCENEGRAPH_MINOR_VERSION==MINOR && OPENSCENEGRAPH_PATCH_VERSION<PATCH))))
#define OSG_VERSION_LESS_OR_EQUAL(MAJOR, MINOR, PATCH) ((OPENSCENEGRAPH_MAJOR_VERSION<MAJOR) || (OPENSCENEGRAPH_MAJOR_VERSION==MAJOR && (OPENSCENEGRAPH_MINOR_VERSION<MINOR || (OPENSCENEGRAPH_MINOR_VERSION==MINOR && OPENSCENEGRAPH_PATCH_VERSION<=PATCH))))
#define OSG_VERSION_GREATER_THAN(MAJOR, MINOR, PATCH) ((OPENSCENEGRAPH_MAJOR_VERSION>MAJOR) || (OPENSCENEGRAPH_MAJOR_VERSION==MAJOR && (OPENSCENEGRAPH_MINOR_VERSION>MINOR || (OPENSCENEGRAPH_MINOR_VERSION==MINOR && OPENSCENEGRAPH_PATCH_VERSION>PATCH))))
#define OSG_VERSION_GREATER_OR_EQUAL(MAJOR, MINOR, PATCH) ((OPENSCENEGRAPH_MAJOR_VERSION>MAJOR) || (OPENSCENEGRAPH_MAJOR_VERSION==MAJOR && (OPENSCENEGRAPH_MINOR_VERSION>MINOR || (OPENSCENEGRAPH_MINOR_VERSION==MINOR && OPENSCENEGRAPH_PATCH_VERSION>=PATCH))))
/**
* osgGetVersion() returns the library version number.

147
include/osgAnimation/Action Normal file
View File

@@ -0,0 +1,147 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_ACTION_H
#define OSGANIMATION_ACTION_H
#include <osgAnimation/Export>
#include <osgAnimation/Animation>
#include <osgAnimation/ActionVisitor>
#include <osgAnimation/FrameAction>
#include <iostream>
#define META_Action(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<const name *>(obj)!=NULL; } \
virtual const char* className() const { return #name; } \
virtual const char* libraryName() const { return #library; } \
virtual void accept(osgAnimation::ActionVisitor& nv) { nv.apply(*this); } \
namespace osgAnimation
{
class OSGANIMATION_EXPORT Action : public osg::Object
{
public:
class Callback : public osg::Object
{
public:
Callback(){}
Callback(const Callback& nc,const osg::CopyOp&) :
_nestedCallback(nc._nestedCallback) {}
META_Object(osgAnimation,Callback);
virtual void operator()(Action* action, osgAnimation::ActionVisitor* nv) {}
Callback* getNestedCallback() { return _nestedCallback.get(); }
void addNestedCallback(Callback* callback)
{
if (callback) {
if (_nestedCallback.valid())
_nestedCallback->addNestedCallback(callback);
else
_nestedCallback = callback;
}
}
void removeCallback(Callback* cb)
{
if (!cb)
return;
if (_nestedCallback.get() == cb)
_nestedCallback = _nestedCallback->getNestedCallback();
else if (_nestedCallback.valid())
_nestedCallback->removeCallback(cb);
}
protected:
osg::ref_ptr<Callback> _nestedCallback;
};
typedef std::map<unsigned int, osg::ref_ptr<Callback> > FrameCallback;
META_Action(osgAnimation, Action);
Action();
Action(const Action&,const osg::CopyOp&);
void setCallback(double when, Callback* callback)
{
setCallback(static_cast<unsigned int>(floor(when*_fps)), callback);
}
void setCallback(unsigned int frame, Callback* callback)
{
if (_framesCallback[frame].valid())
_framesCallback[frame]->addNestedCallback(callback);
else
_framesCallback[frame] = callback;
}
Callback* getCallback(unsigned int frame)
{
if (_framesCallback.find(frame) == _framesCallback.end())
return 0;
return _framesCallback[frame].get();
}
void removeCallback(Callback*);
Callback* getFrameCallback(unsigned int frame);
Callback* getFrameCallback(double time);
unsigned int getFramesPerSecond() const { return _fps; }
void setNumFrames(unsigned int numFrames) { _numberFrame = numFrames;}
void setDuration(double duration) { _numberFrame = static_cast<unsigned int>(floor(duration * _fps)); }
unsigned int getNumFrames() const { return _numberFrame;}
double getDuration() const { return _numberFrame * 1.0 / _fps; }
// 0 means infini else it's the number of loop
virtual void setLoop(int nb) { _loop = nb; }
virtual unsigned int getLoop() const { return _loop;}
// get the number of loop, the frame relative to loop.
// return true if in range, and false if out of range.
bool evaluateFrame(unsigned int frame, unsigned int& resultframe, unsigned int& nbloop );
virtual void traverse(ActionVisitor& visitor) {}
//virtual void evaluate(unsigned int frame);
protected:
FrameCallback _framesCallback;
double _speed;
unsigned int _fps;
unsigned int _numberFrame;
unsigned int _loop;
enum Status
{
Play,
Stop
};
Status _state;
};
}
#endif

View File

@@ -0,0 +1,41 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_ACTION_ANIMATION_H
#define OSGANIMATION_ACTION_ANIMATION_H
#include <osgAnimation/Action>
#include <osgAnimation/Export>
namespace osgAnimation {
class OSGANIMATION_EXPORT ActionAnimation : public Action
{
public:
META_Action(osgAnimation, ActionAnimation);
ActionAnimation();
ActionAnimation(const ActionAnimation& a, const osg::CopyOp& c);
ActionAnimation(Animation* animation);
void updateAnimation(unsigned int frame, int priority);
Animation* getAnimation() { return _animation.get(); }
protected:
osg::ref_ptr<Animation> _animation;
};
}
#endif

View File

@@ -0,0 +1,44 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_ACTION_BLENDIN_H
#define OSGANIMATION_ACTION_BLENDIN_H
#include <osgAnimation/Action>
#include <osgAnimation/Export>
namespace osgAnimation {
/// blend in from 0 to weight in duration
class OSGANIMATION_EXPORT ActionBlendIn : public Action
{
public:
META_Action(osgAnimation, ActionBlendIn);
ActionBlendIn();
ActionBlendIn(const ActionBlendIn& a, const osg::CopyOp& c);
ActionBlendIn(Animation* animation, double duration, double weight);
double getWeight() const { return _weight;}
Animation* getAnimation() { return _animation.get(); }
void computeWeight(unsigned int frame);
protected:
double _weight;
osg::ref_ptr<Animation> _animation;
};
}
#endif

View File

@@ -0,0 +1,45 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_ACTION_BLENDOUT_H
#define OSGANIMATION_ACTION_BLENDOUT_H
#include <osgAnimation/Action>
#include <osgAnimation/Export>
namespace osgAnimation {
/// blend out from weight to 0 in duration
class OSGANIMATION_EXPORT ActionBlendOut : public Action
{
public:
META_Action(osgAnimation, ActionBlendOut);
ActionBlendOut();
ActionBlendOut(const ActionBlendOut& a, const osg::CopyOp& c);
ActionBlendOut(Animation* animation, double duration);
Animation* getAnimation() { return _animation.get(); }
double getWeight() const { return _weight;}
void computeWeight(unsigned int frame);
protected:
double _weight;
osg::ref_ptr<Animation> _animation;
};
}
#endif

View File

@@ -0,0 +1,41 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_ACTION_CALLBACK_H
#define OSGANIMATION_ACTION_CALLBACK_H
#include <osgAnimation/Export>
#include <osgAnimation/Action>
namespace osgAnimation
{
/** Callback used to run new action on the timeline.*/
class OSGANIMATION_EXPORT RunAction : public Action::Callback
{
public:
RunAction(Action* a, int priority = 0) : _action(a), _priority(priority) {}
virtual void operator()(Action* action, ActionVisitor* visitor);
Action* getAction() const { return _action.get(); }
int getPriority() const { return _priority; }
protected:
osg::ref_ptr<Action> _action;
int _priority;
};
}
#endif

View File

@@ -0,0 +1,57 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_ACTION_STRIPANIMATION_H
#define OSGANIMATION_ACTION_STRIPANIMATION_H
#include <osgAnimation/Action>
#include <osgAnimation/Export>
#include <osgAnimation/FrameAction>
#include <osgAnimation/ActionBlendIn>
#include <osgAnimation/ActionBlendOut>
#include <osgAnimation/ActionAnimation>
namespace osgAnimation
{
// encapsulate animation with blend in blend out for classic usage
class OSGANIMATION_EXPORT ActionStripAnimation : public Action
{
public:
META_Action(osgAnimation, ActionStripAnimation);
ActionStripAnimation() {}
ActionStripAnimation(const ActionStripAnimation& a, const osg::CopyOp& c);
ActionStripAnimation(Animation* animation, double blendInDuration = 0.0, double blendOutDuration = 0.0, double blendInWeightTarget = 1.0 );
ActionAnimation* getAnimation();
ActionBlendIn* getBlendIn();
ActionBlendOut* getBlendOut();
const ActionAnimation* getAnimation() const;
const ActionBlendIn* getBlendIn() const;
const ActionBlendOut* getBlendOut() const;
unsigned int getBlendOutStartFrame() const;
unsigned int getLoop() const;
void setLoop(unsigned int loop);
void traverse(ActionVisitor& visitor);
protected:
typedef std::pair<unsigned int, osg::ref_ptr<ActionBlendOut> > FrameBlendOut;
osg::ref_ptr<ActionBlendIn> _blendIn;
FrameBlendOut _blendOut;
osg::ref_ptr<ActionAnimation> _animation;
};
}
#endif

View File

@@ -0,0 +1,117 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_ACTIONVISITOR_H
#define OSGANIMATION_ACTIONVISITOR_H
#include <vector>
#include <osgAnimation/Export>
#include <osg/Referenced>
#include <osgAnimation/FrameAction>
namespace osgAnimation
{
class Timeline;
class Action;
class ActionBlendIn;
class ActionBlendOut;
class ActionAnimation;
class ActionStripAnimation;
#define META_ActionVisitor(library,name) \
virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; }
class OSGANIMATION_EXPORT ActionVisitor : public osg::Referenced
{
public:
META_ActionVisitor(osgAnimation, ActionVisitor);
ActionVisitor();
void traverse(Action& visitor);
void pushFrameActionOnStack(const FrameAction& fa);
void popFrameAction();
void pushTimelineOnStack(Timeline* tm);
void popTimeline();
Timeline* getCurrentTimeline();
void setCurrentLayer(int layer) { _currentLayer = layer;}
int getCurrentLayer() const { return _currentLayer; }
const std::vector<FrameAction>& getStackedFrameAction() const { return _stackFrameAction; }
virtual void apply(Action& action);
virtual void apply(Timeline& tm);
virtual void apply(ActionBlendIn& action);
virtual void apply(ActionBlendOut& action);
virtual void apply(ActionAnimation& action);
virtual void apply(ActionStripAnimation& action);
protected:
std::vector<FrameAction> _stackFrameAction;
std::vector<Timeline*> _stackTimeline;
int _currentLayer;
};
class OSGANIMATION_EXPORT UpdateActionVisitor : public osgAnimation::ActionVisitor
{
protected:
unsigned int _frame;
unsigned int _currentAnimationPriority;
public:
META_ActionVisitor(osgAnimation, UpdateActionVisitor);
UpdateActionVisitor();
void setFrame(unsigned int frame) { _frame = frame;}
bool isActive(Action& action) const;
unsigned int getLocalFrame() const;
void apply(Timeline& action);
void apply(Action& action);
void apply(ActionBlendIn& action);
void apply(ActionBlendOut& action);
void apply(ActionAnimation& action);
void apply(ActionStripAnimation& action);
};
class OSGANIMATION_EXPORT ClearActionVisitor : public osgAnimation::ActionVisitor
{
public:
enum ClearType {
BEFORE_FRAME,
AFTER_FRAME
};
META_ActionVisitor(osgAnimation, ClearActionVisitor);
ClearActionVisitor(ClearType type = BEFORE_FRAME);
void setFrame(unsigned int frame) { _frame = frame;}
void apply(Timeline& action);
void apply(Action& action);
protected:
unsigned int _frame;
std::vector<osg::ref_ptr<Action> > _remove;
ClearType _clearType;
};
}
#endif

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -31,7 +31,7 @@ namespace osgAnimation
META_Object(osgAnimation, Animation)
Animation() : _duration(0), _weight(0), _startTime(0), _playmode(LOOP) {}
Animation(const osgAnimation::Animation& anim, const osg::CopyOp&);
Animation(const osgAnimation::Animation&, const osg::CopyOp&);
enum PlayMode
{
@@ -71,10 +71,12 @@ namespace osgAnimation
void setWeight (float weight);
float getWeight() const;
bool update (float time);
bool update (float time, int priority = 0);
void resetTargets();
void setPlaymode (PlayMode mode) { _playmode = mode; }
PlayMode getPlayMode() const { return _playmode; }
void setStartTime(float time) { _startTime = time;}
float getStartTime() const { return _startTime;}

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -12,9 +12,10 @@
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGANIMATION_ANIMATION_MANAGER_BASE_H
#define OSGANIMATION_ANIMATION_MANAGER_BASE_H
#ifndef OSGANIMATION_ANIMATION_MANAGER_BASE
#define OSGANIMATION_ANIMATION_MANAGER_BASE 1
#include <osgAnimation/LinkVisitor>
#include <osgAnimation/Animation>
#include <osgAnimation/Export>
#include <osg/FrameStamp>
@@ -33,7 +34,8 @@ namespace osgAnimation
AnimationManagerBase(const AnimationManagerBase& b, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY);
virtual ~AnimationManagerBase();
virtual void buildTargetReference();
virtual void registerAnimation (Animation* animation);
virtual void registerAnimation (Animation*);
virtual void unregisterAnimation (Animation*);
virtual void link(osg::Node* subgraph);
virtual void update(double t) = 0;
virtual bool needToLink() const;
@@ -42,16 +44,26 @@ namespace osgAnimation
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
/// Operation that must be done each frame
/** Reset the value of targets
this Operation must be done each frame */
void clearTargets();
void normalizeTargets();
LinkVisitor* getOrCreateLinkVisitor();
void setLinkVisitor(LinkVisitor*);
/// set a flag to define the behaviour
void setAutomaticLink(bool);
bool isAutomaticLink() const;
void dirty();
protected:
osg::ref_ptr<LinkVisitor> _linker;
AnimationList _animations;
TargetSet _targets;
bool _needToLink;
bool _automaticLink;
};
}
#endif

View File

@@ -0,0 +1,72 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_ANIMATION_UPDATE_CALLBACK
#define OSGANIMATION_ANIMATION_UPDATE_CALLBACK 1
#include <osg/Object>
#include <osgAnimation/Channel>
#include <osgAnimation/Animation>
#include <string>
namespace osgAnimation
{
class AnimationUpdateCallbackBase : public virtual osg::Object
{
public:
virtual bool link(Channel* channel) = 0;
virtual int link(Animation* animation) = 0;
};
template <class T>
class AnimationUpdateCallback : public AnimationUpdateCallbackBase, public T
{
public:
AnimationUpdateCallback() {}
AnimationUpdateCallback(const std::string& name) { T::setName(name);}
AnimationUpdateCallback(const AnimationUpdateCallback& apc,const osg::CopyOp& copyop): T(apc, copyop) {}
META_Object(osgAnimation, AnimationUpdateCallback<T>);
const std::string& getName() const { return T::getName(); }
bool link(Channel* channel) { return 0; }
int link(Animation* animation)
{
if (T::getName().empty())
{
osg::notify(osg::WARN) << "An update callback has no name, it means it could link only with \"\" named Target, often an error, discard" << std::endl;
return 0;
}
int nbLinks = 0;
for (ChannelList::iterator it = animation->getChannels().begin();
it != animation->getChannels().end();
++it)
{
std::string targetName = (*it)->getTargetName();
if (targetName == T::getName())
{
AnimationUpdateCallbackBase* a = this;
a->link((*it).get());
nbLinks++;
}
}
return nbLinks;
}
};
}
#endif

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -10,39 +10,26 @@
* 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.
*/
*
* Authors:
* Cedric Pinson <cedric.pinson@plopbyte.net>
* Michael Platings <mplatings@pixelpower.com>
*/
#ifndef OSGANIMATION_BONE_H
#define OSGANIMATION_BONE_H
#ifndef OSGANIMATION_BONE
#define OSGANIMATION_BONE 1
#include <osg/Transform>
#include <osg/Quat>
#include <osg/Vec3>
#include <osg/Node>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Notify>
#include <osg/io_utils>
#include <osg/MatrixTransform>
#include <osgAnimation/Export>
#include <osgAnimation/Target>
#include <osgAnimation/Sampler>
#include <osgAnimation/Channel>
#include <osgAnimation/Keyframe>
#include <osgAnimation/UpdateCallback>
#include <osgAnimation/Animation>
#include <osgAnimation/AnimationManagerBase>
#include <osgAnimation/VertexInfluence>
namespace osgAnimation
{
// A bone can't have more than one parent Bone, so sharing a part of Bone's hierarchy
// has not sense. You can share the entire hierarchie but not only a part of
class OSGANIMATION_EXPORT Bone : public osg::Transform
// makes no sense. You can share the entire hierarchy but not only a part of it.
class OSGANIMATION_EXPORT Bone : public osg::MatrixTransform
{
public:
typedef osg::ref_ptr<Bone> PointerType;
typedef std::map<std::string, PointerType > BoneMap;
typedef osg::Matrix MatrixType;
META_Node(osgAnimation, Bone);
@@ -51,230 +38,24 @@ namespace osgAnimation
void setDefaultUpdateCallback(const std::string& name = "");
struct BoneMapVisitor : public osg::NodeVisitor
{
BoneMap _map;
BoneMapVisitor(): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
META_NodeVisitor("osgAnimation","BoneMapVisitor")
void apply(osg::Node&) { return; }
void apply(osg::Transform& node)
{
Bone* bone = dynamic_cast<Bone*>(&node);
if (bone)
{
_map[bone->getName()] = bone;
traverse(node);
}
}
};
struct FindNearestParentAnimationManager : public osg::NodeVisitor
{
osg::ref_ptr<osgAnimation::AnimationManagerBase> _manager;
FindNearestParentAnimationManager() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS) {}
void apply(osg::Node& node)
{
if (_manager.valid())
return;
osg::NodeCallback* callback = node.getUpdateCallback();
while (callback)
{
_manager = dynamic_cast<osgAnimation::AnimationManagerBase*>(callback);
if (_manager.valid())
return;
callback = callback->getNestedCallback();
}
traverse(node);
}
};
class OSGANIMATION_EXPORT UpdateBone : public AnimationUpdateCallback
{
public:
osg::ref_ptr<osgAnimation::Vec3Target> _position;
osg::ref_ptr<osgAnimation::QuatTarget> _quaternion;
osg::ref_ptr<osgAnimation::Vec3Target> _scale;
public:
META_Object(osgAnimation, UpdateBone);
UpdateBone(const UpdateBone& apc,const osg::CopyOp& copyop);
UpdateBone(const std::string& name = "")
{
setName(name);
_quaternion = new osgAnimation::QuatTarget;
_position = new osgAnimation::Vec3Target;
_scale = new osgAnimation::Vec3Target;
}
void update(osgAnimation::Bone& bone)
{
bone.setTranslation(_position->getValue());
bone.setRotation(_quaternion->getValue());
bone.setScale(_scale->getValue());
bone.dirtyBound();
}
bool needLink() const
{
// the idea is to return true if nothing is linked
return !((_position->getCount() + _quaternion->getCount() + _scale->getCount()) > 3);
}
bool link(osgAnimation::Channel* channel)
{
if (channel->getName().find("quaternion") != std::string::npos)
{
osgAnimation::QuatSphericalLinearChannel* qc = dynamic_cast<osgAnimation::QuatSphericalLinearChannel*>(channel);
if (qc)
{
qc->setTarget(_quaternion.get());
return true;
}
}
else if (channel->getName().find("position") != std::string::npos)
{
osgAnimation::Vec3LinearChannel* vc = dynamic_cast<osgAnimation::Vec3LinearChannel*>(channel);
if (vc)
{
vc->setTarget(_position.get());
return true;
}
}
else if (channel->getName().find("scale") != std::string::npos)
{
osgAnimation::Vec3LinearChannel* vc = dynamic_cast<osgAnimation::Vec3LinearChannel*>(channel);
if (vc)
{
vc->setTarget(_scale.get());
return true;
}
}
else
{
std::cerr << "Channel " << channel->getName() << " does not contain a valid symbolic name for this class" << std::endl;
}
return false;
}
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
{
Bone* b = dynamic_cast<Bone*>(node);
if (b && !_manager.valid())
{
FindNearestParentAnimationManager finder;
if (b->getParents().size() > 1)
{
osg::notify(osg::WARN) << "A Bone should not have multi parent ( " << b->getName() << " ) has parents ";
osg::notify(osg::WARN) << "( " << b->getParents()[0]->getName();
for (int i = 1; i < (int)b->getParents().size(); i++)
osg::notify(osg::WARN) << ", " << b->getParents()[i]->getName();
osg::notify(osg::WARN) << ")" << std::endl;
return;
}
b->getParents()[0]->accept(finder);
if (!finder._manager.valid())
{
osg::notify(osg::WARN) << "Warning can't update Bone, path to parent AnimationManagerBase not found" << std::endl;
return;
}
_manager = finder._manager.get();
}
updateLink();
update(*b);
}
traverse(node,nv);
}
};
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const;
virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const;
Bone* getBoneParent();
const Bone* getBoneParent() const;
void setTranslation(const osg::Vec3& trans) { _position = trans;}
void setRotation(const osg::Quat& quat) { _rotation = quat;}
void setScale(const osg::Vec3& scale) { _scale = scale;}
const osg::Vec3& getTranslation() const { return _position;}
const osg::Quat& getRotation() const { return _rotation;}
osg::Matrix getMatrixInBoneSpace() const { return (osg::Matrix(getRotation())) * osg::Matrix::translate(getTranslation()) * _bindInBoneSpace;}
const osg::Matrix& getBindMatrixInBoneSpace() const { return _bindInBoneSpace; }
const osg::Matrix& getMatrixInBoneSpace() const { return getMatrix();}
const osg::Matrix& getMatrixInSkeletonSpace() const { return _boneInSkeletonSpace; }
const osg::Matrix& getInvBindMatrixInSkeletonSpace() const { return _invBindInSkeletonSpace;}
void setMatrixInSkeletonSpace(const osg::Matrix& matrix) { _boneInSkeletonSpace = matrix; }
void setBindMatrixInBoneSpace(const osg::Matrix& matrix)
{
_bindInBoneSpace = matrix;
_needToRecomputeBindMatrix = true;
}
inline bool needToComputeBindMatrix() { return _needToRecomputeBindMatrix;}
virtual void computeBindMatrix();
bool needLink() const;
void setNeedToComputeBindMatrix(bool state) { _needToRecomputeBindMatrix = state; }
/** 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 );
BoneMap getBoneMap();
void setInvBindMatrixInSkeletonSpace(const osg::Matrix& matrix) { _invBindInSkeletonSpace = matrix; }
protected:
osg::Vec3 _position;
osg::Quat _rotation;
osg::Vec3 _scale;
// flag to recompute bind pose
bool _needToRecomputeBindMatrix;
// bind data
osg::Matrix _bindInBoneSpace;
osg::Matrix _invBindInSkeletonSpace;
// bone updated
osg::Matrix _boneInSkeletonSpace;
};
inline bool Bone::computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const
{
if (_referenceFrame==RELATIVE_RF)
matrix.preMult(getMatrixInBoneSpace());
else
matrix = getMatrixInBoneSpace();
return true;
}
inline bool Bone::computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const
{
if (_referenceFrame==RELATIVE_RF)
matrix.postMult(osg::Matrix::inverse(getMatrixInBoneSpace()));
else
matrix = osg::Matrix::inverse(getMatrixInBoneSpace());
return true;
}
typedef std::map<std::string, osg::ref_ptr<Bone> > BoneMap;
}
#endif

View File

@@ -0,0 +1,42 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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.
*
* Authors:
* Cedric Pinson <cedric.pinson@plopbyte.net>
*/
#ifndef OSGANIMATION_BONEMAP_VISITOR
#define OSGANIMATION_BONEMAP_VISITOR 1
#include <osgAnimation/Export>
#include <osgAnimation/Bone>
#include <osg/NodeVisitor>
namespace osgAnimation
{
class OSGANIMATION_EXPORT BoneMapVisitor : public osg::NodeVisitor
{
public:
META_NodeVisitor("osgAnimation","BoneMapVisitor")
BoneMapVisitor();
void apply(osg::Node&);
void apply(osg::Transform& node);
const BoneMap& getBoneMap() const;
protected:
BoneMap _map;
};
}
#endif

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -10,7 +10,11 @@
* 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.
*/
*
* Authors:
* Cedric Pinson <cedric.pinson@plopbyte.net>
* Michael Platings <mplatings@pixelpower.com>
*/
#ifndef OSGANIMATION_CHANNEL_H
#define OSGANIMATION_CHANNEL_H
@@ -29,11 +33,14 @@ namespace osgAnimation
public:
Channel();
Channel(const Channel& channel);
virtual ~Channel();
virtual Channel* clone() const = 0;
virtual void update(float time) = 0;
virtual void update(float time, float weight, int priority) = 0;
virtual void reset() = 0;
virtual Target* getTarget() = 0;
virtual bool setTarget(Target*) = 0;
const std::string& getName() const;
void setName(const std::string& name);
@@ -44,17 +51,18 @@ namespace osgAnimation
const std::string& getTargetName() const;
void setTargetName(const std::string& name);
float getWeight() const;
void setWeight(float w);
virtual Sampler* getSampler() = 0;
virtual const Sampler* getSampler() const = 0;
// create a keyframe container from current target value
// with one key only, can be used for debug or to create
// easily a default channel from an existing one
virtual bool createKeyframeContainerFromTargetValue() = 0;
protected:
std::string _targetName;
std::string _name;
float _weight;
};
@@ -66,8 +74,19 @@ namespace osgAnimation
typedef typename SamplerType::UsingType UsingType;
typedef TemplateTarget<UsingType> TargetType;
typedef TemplateKeyframeContainer<typename SamplerType::KeyframeType> KeyframeContainerType;
Channel* clone() const { return new TemplateChannel<SamplerType>(*this); }
TemplateChannel (SamplerType* s = 0,TargetType* target = 0)
TemplateChannel (const TemplateChannel& channel) :
Channel(channel)
{
if (channel.getTargetTyped())
_target = new TargetType(*channel.getTargetTyped());
if (channel.getSamplerTyped())
_sampler = new SamplerType(*channel.getSamplerTyped());
}
TemplateChannel (SamplerType* s = 0,TargetType* target = 0)
{
if (target)
_target = target;
@@ -76,20 +95,42 @@ namespace osgAnimation
_sampler = s;
}
virtual bool createKeyframeContainerFromTargetValue()
{
if (!_target.valid()) // no target it does not make sense to do it
{
return false;
}
// create a key from current target value
typename KeyframeContainerType::KeyType key(0, _target->getValue());
// recreate the keyframe container
getOrCreateSampler()->setKeyframeContainer(0);
getOrCreateSampler()->getOrCreateKeyframeContainer();
// add the key
_sampler->getKeyframeContainerTyped()->push_back(key);
return true;
}
virtual ~TemplateChannel() {}
virtual void update(float time)
virtual void update(float time, float weight, int priority)
{
// skip if weight == 0
if (_weight < 1e-4)
if (weight < 1e-4)
return;
typename SamplerType::UsingType value;
_sampler->getValueAt(time, value);
_target->update(_weight, value);
_target->update(weight, value, priority);
}
virtual void reset() { _target->reset(); }
virtual Target* getTarget() { return _target.get();}
virtual bool setTarget(Target* target)
{
_target = dynamic_cast<TargetType*>(target);
return _target.get() == target;
}
SamplerType* getOrCreateSampler()
SamplerType* getOrCreateSampler()
{
if (!_sampler.valid())
_sampler = new SamplerType;
@@ -104,6 +145,7 @@ namespace osgAnimation
void setSampler(SamplerType* sampler) { _sampler = sampler; }
TargetType* getTargetTyped() { return _target.get(); }
const TargetType* getTargetTyped() const { return _target.get(); }
void setTarget(TargetType* target) { _target = target; }
virtual float getStartTime() const { return _sampler->getStartTime(); }
@@ -116,13 +158,21 @@ namespace osgAnimation
typedef std::vector<osg::ref_ptr<osgAnimation::Channel> > ChannelList;
typedef TemplateChannel<DoubleStepSampler> DoubleStepChannel;
typedef TemplateChannel<FloatStepSampler> FloatStepChannel;
typedef TemplateChannel<Vec2StepSampler> Vec2StepChannel;
typedef TemplateChannel<Vec3StepSampler> Vec3StepChannel;
typedef TemplateChannel<Vec4StepSampler> Vec4StepChannel;
typedef TemplateChannel<QuatStepSampler> QuatStepChannel;
typedef TemplateChannel<DoubleLinearSampler> DoubleLinearChannel;
typedef TemplateChannel<FloatLinearSampler> FloatLinearChannel;
typedef TemplateChannel<Vec2LinearSampler> Vec2LinearChannel;
typedef TemplateChannel<Vec3LinearSampler> Vec3LinearChannel;
typedef TemplateChannel<Vec4LinearSampler> Vec4LinearChannel;
typedef TemplateChannel<QuatSphericalLinearSampler> QuatSphericalLinearChannel;
typedef TemplateChannel<MatrixLinearSampler> MatrixLinearChannel;
typedef TemplateChannel<FloatCubicBezierSampler> FloatCubicBezierChannel;
typedef TemplateChannel<DoubleCubicBezierSampler> DoubleCubicBezierChannel;

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -12,38 +12,61 @@
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGANIMATION_CUBIC_BEZIER_H
#define OSGANIMATION_CUBIC_BEZIER_H
#ifndef OSGANIMATION_CUBIC_BEZIER
#define OSGANIMATION_CUBIC_BEZIER 1
#include <osg/Vec2>
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/Quat>
namespace osgAnimation
{
template <class T>
struct TemplateCubicBezier
class TemplateCubicBezier
{
T mPoint[3];
const T& getP0() const { return mPoint[0];}
const T& getP1() const { return mPoint[1];}
const T& getP2() const { return mPoint[2];}
TemplateCubicBezier(const T& v0, const T& v1, const T& v2)
{
mPoint[0] = v0;
mPoint[1] = v1;
mPoint[2] = v2;
}
public:
TemplateCubicBezier() {}
const T& getPosition() const { return mPoint[0];}
const T& getTangentPoint1() const { return mPoint[1];}
const T& getTangentPoint2() const { return mPoint[2];}
};
TemplateCubicBezier(const T& p, const T& i, const T& o) : _position(p), _controlPointIn(i), _controlPointOut(o)
{
}
// Constructor with value only
TemplateCubicBezier(const T& p) : _position(p), _controlPointIn(p), _controlPointOut(p)
{
}
const T& getPosition() const { return _position;}
const T& getControlPointIn() const { return _controlPointIn;}
const T& getControlPointOut() const { return _controlPointOut;}
T& getPosition() { return _position;}
T& getControlPointIn() { return _controlPointIn;}
T& getControlPointOut() { return _controlPointOut;}
void setPosition(const T& v) {_position = v;}
void setControlPointIn(const T& v) {_controlPointIn = v;}
void setControlPointOut(const T& v) {_controlPointOut = v;}
// steaming operators.
friend std::ostream& operator << (std::ostream& output, const TemplateCubicBezier<T>& tcb)
{
output << tcb._position << " "
<< tcb._controlPointIn << " "
<< tcb._controlPointOut;
return output; // to enable cascading
}
friend std::istream& operator >> (std::istream& input, TemplateCubicBezier<T>& tcb)
{
input >> tcb._position >> tcb._controlPointIn >> tcb._controlPointOut;
return input;
}
protected:
T _position, _controlPointIn, _controlPointOut;
};
typedef TemplateCubicBezier<float> FloatCubicBezier;
typedef TemplateCubicBezier<double> DoubleCubicBezier;

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -10,10 +10,10 @@
* 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 OSGANIMATION_EASE_MOTION_H
#define OSGANIMATION_EASE_MOTION_H
#ifndef OSGANIMATION_EASE_MOTION
#define OSGANIMATION_EASE_MOTION 1
#include <osg/Referenced>
#include <osg/ref_ptr>
@@ -21,9 +21,8 @@
#include <osg/Math>
#include <vector>
namespace osgAnimation {
namespace osgAnimation
{
struct OutBounceFunction
{
inline static void getValueAt(float t, float& result)
@@ -76,14 +75,12 @@ namespace osgAnimation {
}
};
/// Linear function
struct LinearFunction
{
inline static void getValueAt(float t, float& result) { result = t;}
};
/// Quad function
struct OutQuadFunction
{
@@ -94,46 +91,47 @@ namespace osgAnimation {
{
inline static void getValueAt(float t, float& result) { result = t*t;}
};
struct InOutQuadFunction
{
inline static void getValueAt(float t, float& result)
{
t = t * 2.0;
if (t < 1.0)
{
t *= 2.0;
if (t < 1.0)
result = 0.5 * t * t;
else
{
t = t - 1.0;
result = - 0.5 * t * ( t - 2) - 1;
t -= 1.0;
result = - 0.5 * (t * ( t - 2) - 1);
}
}
};
/// Cubic function
struct OutCubicFunction
{
inline static void getValueAt(float t, float& result) { t = t-1.0; result = t*t*t + 1;}
};
struct InCubicFunction
{
inline static void getValueAt(float t, float& result) { result = t*t*t;}
};
struct InOutCubicFunction
{
inline static void getValueAt(float t, float& result)
{
t = t * 2;
if (t < 1.0)
result = 0.5 * t * t * t;
t *= 2.0f;
if (t < 1.0f)
result = 0.5f * t * t * t;
else {
t = t - 2;
result = 0.5 * t * t * t + 2;
t -= 2.0f;
result = 0.5 * (t * t * t + 2.0f);
}
}
};
/// Quart function
struct InQuartFunction
{
@@ -160,7 +158,191 @@ namespace osgAnimation {
}
};
/// Elastic function
struct OutElasticFunction
{
inline static void getValueAt(float t, float& result)
{
result = pow(2.0f, -10.0f * t) * sinf((t - 0.3f / 4.0f) * (2.0f * osg::PI) / 0.3f) + 1.0f;
}
};
struct InElasticFunction
{
inline static void getValueAt(float t, float& result)
{
OutElasticFunction::getValueAt(1.0f - t, result);
result = 1.0f - result;
}
};
struct InOutElasticFunction
{
inline static void getValueAt(float t, float& result)
{
t *= 2.0f;
if (t < 1.0f)
{
t -= 1.0f;
result = -0.5 * (1.0f * pow(2.0f, 10.0f * t) * sinf((t - 0.45f / 4.0f) * (2.0f * osg::PI) / 0.45f));
}
else
{
t -= 1.0f;
result = pow(2.0f, -10.0f * t) * sinf((t - 0.45f / 4.0f) * (2.0f * osg::PI) / 0.45f) * 0.5f + 1.0f;
}
}
};
// Sine function
struct OutSineFunction
{
inline static void getValueAt(float t, float& result)
{
result = sinf(t * (osg::PI / 2.0f));
}
};
struct InSineFunction
{
inline static void getValueAt(float t, float& result)
{
result = -cosf(t * (osg::PI / 2.0f)) + 1.0f;
}
};
struct InOutSineFunction
{
inline static void getValueAt(float t, float& result)
{
result = -0.5f * (cosf((osg::PI * t)) - 1.0f);
}
};
// Back function
struct OutBackFunction
{
inline static void getValueAt(float t, float& result)
{
t -= 1.0f;
result = t * t * ((1.70158 + 1.0f) * t + 1.70158) + 1.0f;
}
};
struct InBackFunction
{
inline static void getValueAt(float t, float& result)
{
result = t * t * ((1.70158 + 1.0f) * t - 1.70158);
}
};
struct InOutBackFunction
{
inline static void getValueAt(float t, float& result)
{
float s = 1.70158 * 1.525f;
t *= 2.0f;
if (t < 1.0f)
{
result = 0.5f * (t * t * ((s + 1.0f) * t - s));
}
else
{
float p = t -= 2.0f;
result = 0.5f * ((p) * t * ((s + 1.0f) * t + s) + 2.0f);
}
}
};
// Circ function
struct OutCircFunction
{
inline static void getValueAt(float t, float& result)
{
t -= 1.0f;
result = sqrt(1.0f - t * t);
}
};
struct InCircFunction
{
inline static void getValueAt(float t, float& result)
{
result = -(sqrt(1.0f - (t * t)) - 1.0f);
}
};
struct InOutCircFunction
{
inline static void getValueAt(float t, float& result)
{
t *= 2.0f;
if (t < 1.0f)
{
result = -0.5f * (sqrt(1.0f - t * t) - 1.0f);
}
else
{
t -= 2.0f;
result = 0.5f * (sqrt(1 - t * t) + 1.0f);
}
}
};
// Expo function
struct OutExpoFunction
{
inline static void getValueAt(float t, float& result)
{
if(t == 1.0f)
{
result = 0.0f;
}
else
{
result = -powf(2.0f, -10.0f * t) + 1.0f;
}
}
};
struct InExpoFunction
{
inline static void getValueAt(float t, float& result)
{
if(t == 0.0f)
{
result = 0.0f;
}
else
{
result = powf(2.0f, 10.0f * (t - 1.0f));
}
}
};
struct InOutExpoFunction
{
inline static void getValueAt(float t, float& result)
{
if(t == 0.0f || t == 1.0f)
{
result = 0.0f;
}
else
{
t *= 2.0f;
if(t < 1.0f)
{
result = 0.5f * powf(2.0f, 10.0f * (t - 1.0f));
}
else
{
result = 0.5f * (-powf(2.0f, -10.0f * (t - 1.0f)) + 2.0f);
}
}
}
};
class Motion : public osg::Referenced
{
@@ -278,7 +460,7 @@ namespace osgAnimation {
osg::notify(osg::WARN) << "CompositeMotion::getValueInNormalizedRange no Motion in the CompositeMotion, add motion to have result" << std::endl;
return;
}
for (MotionList::const_iterator it = _motions.begin(); it != _motions.end(); it++)
for (MotionList::const_iterator it = _motions.begin(); it != _motions.end(); ++it)
{
const Motion* motion = static_cast<const Motion*>(it->get());
float durationInRange = motion->getDuration() / getDuration();
@@ -314,13 +496,35 @@ namespace osgAnimation {
typedef MathMotionTemplate<InQuartFunction> InQuartMotion;
typedef MathMotionTemplate<InOutQuartFunction> InOutQuartMotion;
// bounce
typedef MathMotionTemplate<OutBounceFunction > OutBounceMotion;
typedef MathMotionTemplate<InBounceFunction> InBounceMotion;
typedef MathMotionTemplate<InOutBounceFunction> InOutBounceMotion;
// elastic
typedef MathMotionTemplate<OutElasticFunction > OutElasticMotion;
typedef MathMotionTemplate<InElasticFunction > InElasticMotion;
typedef MathMotionTemplate<InOutElasticFunction > InOutElasticMotion;
// sine
typedef MathMotionTemplate<OutSineFunction > OutSineMotion;
typedef MathMotionTemplate<InSineFunction > InSineMotion;
typedef MathMotionTemplate<InOutSineFunction > InOutSineMotion;
// back
typedef MathMotionTemplate<OutBackFunction > OutBackMotion;
typedef MathMotionTemplate<InBackFunction > InBackMotion;
typedef MathMotionTemplate<InOutBackFunction > InOutBackMotion;
// circ
typedef MathMotionTemplate<OutCircFunction > OutCircMotion;
typedef MathMotionTemplate<InCircFunction > InCircMotion;
typedef MathMotionTemplate<InOutCircFunction > InOutCircMotion;
// expo
typedef MathMotionTemplate<OutExpoFunction > OutExpoMotion;
typedef MathMotionTemplate<InExpoFunction > InExpoMotion;
typedef MathMotionTemplate<InOutExpoFunction > InOutExpoMotion;
}
#endif

View File

@@ -0,0 +1,26 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_FRAMEACTION_H
#define OSGANIMATION_FRAMEACTION_H
#include <map>
#include <osg/ref_ptr>
namespace osgAnimation
{
class Action;
typedef std::pair<unsigned int, osg::ref_ptr<Action> > FrameAction;
}
#endif

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -10,13 +10,16 @@
* 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.
*/
*
* Authors:
* Cedric Pinson <cedric.pinson@plopbyte.net>
* Michael Platings <mplatings@pixelpower.com>
*/
#ifndef OSGANIMATION_INTERPOLATOR_H
#define OSGANIMATION_INTERPOLATOR_H
#ifndef OSGANIMATION_INTERPOLATOR
#define OSGANIMATION_INTERPOLATOR 1
#include <osg/Notify>
#include <osgAnimation/Interpolator>
#include <osgAnimation/Keyframe>
namespace osgAnimation
@@ -61,6 +64,32 @@ namespace osgAnimation
};
template <class TYPE, class KEY=TYPE>
class TemplateStepInterpolator : public TemplateInterpolatorBase<TYPE,KEY>
{
public:
TemplateStepInterpolator() {}
void getValue(const TemplateKeyframeContainer<KEY>& keyframes, float time, TYPE& result) const
{
if (time >= keyframes.back().getTime())
{
result = keyframes.back().getValue();
return;
}
else if (time <= keyframes.front().getTime())
{
result = keyframes.front().getValue();
return;
}
int i = getKeyIndexFromTime(keyframes,time);
result = keyframes[i].getValue();
}
};
template <class TYPE, class KEY=TYPE>
class TemplateLinearInterpolator : public TemplateInterpolatorBase<TYPE,KEY>
{
@@ -176,14 +205,22 @@ namespace osgAnimation
float t2 = t * t;
TYPE v0 = keyframes[i].getValue().getPosition() * one_minus_t3;
TYPE v1 = keyframes[i].getValue().getTangentPoint1() * (3.0 * t * one_minus_t2);
TYPE v2 = keyframes[i].getValue().getTangentPoint2() * (3.0 * t2 * one_minus_t);
TYPE v1 = keyframes[i].getValue().getControlPointIn() * (3.0 * t * one_minus_t2);
TYPE v2 = keyframes[i].getValue().getControlPointOut() * (3.0 * t2 * one_minus_t);
TYPE v3 = keyframes[i+1].getValue().getPosition() * (t2 * t);
result = v0 + v1 + v2 + v3;
}
};
typedef TemplateStepInterpolator<double, double> DoubleStepInterpolator;
typedef TemplateStepInterpolator<float, float> FloatStepInterpolator;
typedef TemplateStepInterpolator<osg::Vec2, osg::Vec2> Vec2StepInterpolator;
typedef TemplateStepInterpolator<osg::Vec3, osg::Vec3> Vec3StepInterpolator;
typedef TemplateStepInterpolator<osg::Vec3, Vec3Packed> Vec3PackedStepInterpolator;
typedef TemplateStepInterpolator<osg::Vec4, osg::Vec4> Vec4StepInterpolator;
typedef TemplateStepInterpolator<osg::Quat, osg::Quat> QuatStepInterpolator;
typedef TemplateLinearInterpolator<double, double> DoubleLinearInterpolator;
typedef TemplateLinearInterpolator<float, float> FloatLinearInterpolator;
typedef TemplateLinearInterpolator<osg::Vec2, osg::Vec2> Vec2LinearInterpolator;
@@ -191,6 +228,7 @@ namespace osgAnimation
typedef TemplateLinearInterpolator<osg::Vec3, Vec3Packed> Vec3PackedLinearInterpolator;
typedef TemplateLinearInterpolator<osg::Vec4, osg::Vec4> Vec4LinearInterpolator;
typedef TemplateSphericalLinearInterpolator<osg::Quat, osg::Quat> QuatSphericalLinearInterpolator;
typedef TemplateLinearInterpolator<osg::Matrixf, osg::Matrixf> MatrixLinearInterpolator;
typedef TemplateCubicBezierInterpolator<float, FloatCubicBezier > FloatCubicBezierInterpolator;
typedef TemplateCubicBezierInterpolator<double, DoubleCubicBezier> DoubleCubicBezierInterpolator;

View File

@@ -23,6 +23,7 @@
#include <osg/Vec4>
#include <osg/Vec3>
#include <osg/Vec2>
#include <osg/Matrixf>
namespace osgAnimation
{
@@ -98,6 +99,9 @@ namespace osgAnimation
typedef TemplateKeyframe<float> FloatKeyframe;
typedef TemplateKeyframeContainer<float> FloatKeyframeContainer;
typedef TemplateKeyframe<double> DoubleKeyframe;
typedef TemplateKeyframeContainer<double> DoubleKeyframeContainer;
typedef TemplateKeyframe<osg::Vec2> Vec2Keyframe;
typedef TemplateKeyframeContainer<osg::Vec2> Vec2KeyframeContainer;
@@ -111,17 +115,24 @@ namespace osgAnimation
typedef TemplateKeyframe<osg::Quat> QuatKeyframe;
typedef TemplateKeyframeContainer<osg::Quat> QuatKeyframeContainer;
typedef TemplateKeyframe<osg::Matrixf> MatrixKeyframe;
typedef TemplateKeyframeContainer<osg::Matrixf> MatrixKeyframeContainer;
typedef TemplateKeyframe<Vec3Packed> Vec3PackedKeyframe;
typedef TemplateKeyframeContainer<Vec3Packed> Vec3PackedKeyframeContainer;
typedef TemplateKeyframe<FloatCubicBezier> FloatCubicBezierKeyframe;
typedef TemplateKeyframeContainer<FloatCubicBezier> FloatCubicBezierKeyframeContainer;
typedef TemplateKeyframe<DoubleCubicBezier> DoubleCubicBezierKeyframe;
typedef TemplateKeyframeContainer<DoubleCubicBezier> DoubleCubicBezierKeyframeContainer;
typedef TemplateKeyframe<Vec2CubicBezier> Vec2CubicBezierKeyframe;
typedef TemplateKeyframeContainer<Vec2CubicBezier> Vec2CubicBezierKeyframeContainer;
typedef TemplateKeyframe<Vec3CubicBezier> Vec3CubicBezierKeyframe;
typedef TemplateKeyframeContainer<Vec3CubicBezier> Vec3CubicBezierKeyframeContainer;
typedef TemplateKeyframe<Vec4CubicBezier> Vec4CubicBezierKeyframe;
typedef TemplateKeyframeContainer<Vec4CubicBezier> Vec4CubicBezierKeyframeContainer;

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -16,37 +16,39 @@
#define OSGANIMATION_NODE_VISITOR_H
#include <osg/NodeVisitor>
#include <osg/StateSet>
#include <osgAnimation/Animation>
#include <osgAnimation/UpdateCallback>
namespace osgAnimation
{
class AnimationUpdateCallbackBase;
struct LinkVisitor : public osg::NodeVisitor
/** This class is instancied by the AnimationManagerBase, it will link animation target to updatecallback that have the same name
*/
class OSGANIMATION_EXPORT LinkVisitor : public osg::NodeVisitor
{
public:
LinkVisitor();
META_NodeVisitor("osgAnimation","LinkVisitor");
void apply(osg::Node& node);
void apply(osg::Geode& node);
AnimationList& getAnimationList();
void reset();
unsigned int getNbLinkedTarget() const { return _nbLinkedTarget; }
protected:
void handle_stateset(osg::StateSet* stateset);
void link(osgAnimation::AnimationUpdateCallbackBase* cb);
// animation list to link
AnimationList _animations;
// number of success link done
unsigned int _nbLinkedTarget;
LinkVisitor(Animation* animation) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { _animations.push_back(animation); _nbLinkedTarget = 0;}
LinkVisitor(const AnimationList& animations) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { _animations = animations; _nbLinkedTarget = 0;}
META_NodeVisitor("osgAnimation","LinkVisitor")
void apply(osg::Node& node)
{
osgAnimation::AnimationUpdateCallback* cb = dynamic_cast<osgAnimation::AnimationUpdateCallback*>(node.getUpdateCallback());
if (cb)
{
int result = 0;
for (int i = 0; i < (int)_animations.size(); i++)
{
result += cb->link(_animations[i].get());
_nbLinkedTarget += result;
}
std::cout << "LinkVisitor links " << result << " for \"" << cb->getName() << '"' << std::endl;
}
traverse(node);
}
};
}

View File

@@ -0,0 +1,154 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* 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 OSGANIMATION_MORPHGEOMETRY_H
#define OSGANIMATION_MORPHGEOMETRY_H
#include <osgAnimation/Export>
#include <osgAnimation/AnimationUpdateCallback>
#include <osg/Geometry>
namespace osgAnimation
{
class OSGANIMATION_EXPORT MorphGeometry : public osg::Geometry
{
public:
enum Method {
NORMALIZED,
RELATIVE
};
class MorphTarget
{
protected:
osg::ref_ptr<osg::Geometry> _geom;
float _weight;
public:
MorphTarget(osg::Geometry* geom, float w = 1.0) : _geom(geom), _weight(w) {}
void setWeight(float weight) { _weight = weight; }
const float getWeight() const { return _weight; }
osg::Geometry* getGeometry() { return _geom.get(); }
const osg::Geometry* getGeometry() const { return _geom.get(); }
void setGeometry(osg::Geometry* geom) { _geom = geom; }
};
typedef std::vector<MorphTarget> MorphTargetList;
struct UpdateVertex : public osg::Drawable::UpdateCallback
{
virtual void update(osg::NodeVisitor*, osg::Drawable* drw)
{
MorphGeometry* geom = dynamic_cast<MorphGeometry*>(drw);
if (!geom)
return;
geom->transformSoftwareMethod();
}
};
MorphGeometry();
MorphGeometry(const osg::Geometry& b);
MorphGeometry(const MorphGeometry& b, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual osg::Object* cloneType() const { return new MorphGeometry(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new MorphGeometry(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const MorphGeometry*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osgAnimation"; }
virtual const char* className() const { return "MorphGeometry"; }
virtual void transformSoftwareMethod();
/** Set the morphing method. */
void setMethod(Method method) { _method = method; }
/** Get the morphing method. */
inline Method getMethod() const { return _method; }
/** Set flag for morphing normals. */
void setMorphNormals(bool morphNormals) { _morphNormals = morphNormals; }
/** Get the flag for morphing normals. */
inline bool getMorphNormals() const { return _morphNormals; }
/** Add a \c MorphTarget to the \c MorphGeometry.
* If \c MorphTarget is not \c NULL and is not contained in the \c MorphGeometry
* then increment its reference count, add it to the MorphTargets list and
* dirty the bounding sphere to force it to be recomputed on the next
* call to \c getBound().
* @param morphTarget The \c MorphTarget to be added to the \c MorphGeometry.
* @param weight The weight to be added to the \c MorphGeometry.
* @return \c true for success; \c false otherwise.
*/
virtual void addMorphTarget( osg::Geometry *morphTarget, float weight = 1.0 ) { _morphTargets.push_back(MorphTarget(morphTarget, weight)); _dirty = true; }
void setWeight(unsigned int index, float morphWeight)
{
if (index < _morphTargets.size())
{
_morphTargets[index].setWeight(morphWeight);
dirty();
}
}
/** Set the MorphGeometry dirty.*/
void dirty() { _dirty = true; }
/** Get the list of MorphTargets.*/
const MorphTargetList& getMorphTargetList() const { return _morphTargets; }
/** Get the list of MorphTargets. Warning if you modify this array you will have to call dirty() */
MorphTargetList& getMorphTargetList() { return _morphTargets; }
/** Return the \c MorphTarget at position \c i.*/
inline const MorphTarget& getMorphTarget( unsigned int i ) const { return _morphTargets[i]; }
/** Return the \c MorphTarget at position \c i.*/
inline MorphTarget& getMorphTarget( unsigned int i ) { return _morphTargets[i]; }
protected:
/// Do we need to recalculate the morphed geometry?
bool _dirty;
Method _method;
MorphTargetList _morphTargets;
std::vector<osg::Vec3> _positionSource;
std::vector<osg::Vec3> _normalSource;
/// Do we also morph between normals?
bool _morphNormals;
};
class OSGANIMATION_EXPORT UpdateMorph : public AnimationUpdateCallback<osg::NodeCallback>
{
protected:
std::map<int, osg::ref_ptr<osgAnimation::FloatTarget> > _weightTargets;
public:
META_Object(osgAnimation, UpdateMorph);
UpdateMorph(const std::string& name = "");
UpdateMorph(const UpdateMorph& apc,const osg::CopyOp& copyop);
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
bool needLink() const;
bool link(osgAnimation::Channel* channel);
};
}
#endif

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -16,8 +16,9 @@
#define OSGANIMATION_RIGGEOMETRY_H
#include <osgAnimation/Export>
#include <osgAnimation/Skinning>
#include <osgAnimation/Skeleton>
#include <osgAnimation/RigTransform>
#include <osgAnimation/VertexInfluence>
#include <osg/Geometry>
namespace osgAnimation
@@ -28,49 +29,63 @@ namespace osgAnimation
public:
RigGeometry();
RigGeometry(const osg::Geometry& b);
// RigGeometry(const osg::Geometry& b);
RigGeometry(const RigGeometry& b, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Object(osgAnimation, RigGeometry);
void setInfluenceMap(osgAnimation::VertexInfluenceMap* vertexInfluenceMap) { _vertexInfluenceMap = vertexInfluenceMap; }
const osgAnimation::VertexInfluenceMap* getInfluenceMap() const { return _vertexInfluenceMap.get();}
osgAnimation::VertexInfluenceMap* getInfluenceMap() { return _vertexInfluenceMap.get();}
void setInfluenceMap(VertexInfluenceMap* vertexInfluenceMap) { _vertexInfluenceMap = vertexInfluenceMap; }
const VertexInfluenceMap* getInfluenceMap() const { return _vertexInfluenceMap.get();}
VertexInfluenceMap* getInfluenceMap() { return _vertexInfluenceMap.get();}
const Skeleton* getSkeleton() const;
Skeleton* getSkeleton();
// will be used by the update callback to init correctly the rig mesh
void setSkeleton(Skeleton*);
void setNeedToComputeMatrix(bool state) { _needToComputeMatrix = state;}
bool getNeedToComputeMatrix() const { return _needToComputeMatrix;}
void buildVertexSet();
void buildTransformer(Skeleton* root);
// this build the internal database about vertex influence and bones
void buildVertexInfluenceSet();
const VertexInfluenceSet& getVertexInfluenceSet() const;
void computeMatrixFromRootSkeleton();
virtual void transformSoftwareMethod();
const osgAnimation::VertexInfluenceSet& getVertexInfluenceSet() const { return _vertexInfluenceSet;}
const std::vector<osg::Vec3>& getPositionSource() const { return _positionSource;}
const std::vector<osg::Vec3>& getNormalSource() const { return _normalSource;}
// set implementation of rig method
void setRigTransformImplementation(RigTransform*);
RigTransform* getRigTransformImplementation();
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
void update();
const osg::Matrix& getMatrixFromSkeletonToGeometry() const;
const osg::Matrix& getInvMatrixFromSkeletonToGeometry() const;
osg::Geometry* getSourceGeometry();
const osg::Geometry* getSourceGeometry() const;
void setSourceGeometry(osg::Geometry* geometry);
void copyFrom(osg::Geometry& from);
protected:
osg::ref_ptr<osg::Geometry> _geometry;
osg::ref_ptr<RigTransform> _rigTransformImplementation;
std::vector<osg::Vec3> _positionSource;
std::vector<osg::Vec3> _normalSource;
osgAnimation::VertexInfluenceSet _vertexInfluenceSet;
osg::ref_ptr<osgAnimation::VertexInfluenceMap> _vertexInfluenceMap;
osgAnimation::TransformVertexFunctor _transformVertexes;
VertexInfluenceSet _vertexInfluenceSet;
osg::ref_ptr<VertexInfluenceMap> _vertexInfluenceMap;
osg::Matrix _matrixFromSkeletonToGeometry;
osg::Matrix _invMatrixFromSkeletonToGeometry;
osg::observer_ptr<Skeleton> _root;
bool _needToComputeMatrix;
struct FindNearestParentSkeleton : public osg::NodeVisitor
{
osg::ref_ptr<osgAnimation::Skeleton> _root;
osg::ref_ptr<Skeleton> _root;
FindNearestParentSkeleton() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS) {}
void apply(osg::Transform& node)
{
@@ -89,7 +104,7 @@ namespace osgAnimation
RigGeometry* geom = dynamic_cast<RigGeometry*>(drw);
if (!geom)
return;
if (!geom->getSkeleton() && !geom->getParents().empty())
if (!geom->getSkeleton() && !geom->getParents().empty())
{
FindNearestParentSkeleton finder;
if (geom->getParents().size() > 1)
@@ -97,9 +112,12 @@ namespace osgAnimation
geom->getParents()[0]->accept(finder);
if (!finder._root.valid())
{
osg::notify(osg::WARN) << "A RigGeometry did not find a parent skeleton for RigGeomtry ( " << geom->getName() << " )" << std::endl;
return;
geom->buildVertexSet();
geom->buildTransformer(finder._root.get());
}
geom->buildVertexInfluenceSet();
geom->setSkeleton(finder._root.get());
}
if (!geom->getSkeleton())
@@ -107,34 +125,10 @@ namespace osgAnimation
if (geom->getNeedToComputeMatrix())
geom->computeMatrixFromRootSkeleton();
geom->transformSoftwareMethod();
geom->update();
}
};
/** BuildVertexTransformerVisitor is used to setup RigGeometry drawable
* throw a subgraph.
*/
struct BuildVertexTransformerVisitor : public osg::NodeVisitor
{
osg::ref_ptr<Skeleton> _root;
BuildVertexTransformerVisitor(Skeleton* root): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { _root = root;}
META_NodeVisitor("osgAnimation","BuildVertexTransformerVisitor")
void apply(osg::Geode& node)
{
int num = node.getNumDrawables();
for (int i = 0; i < num; i++) {
RigGeometry* geom = dynamic_cast<RigGeometry*>(node.getDrawable(i));
if (geom)
{
geom->buildVertexSet();
geom->buildTransformer(_root.get());
}
}
}
};
};
}

View File

@@ -0,0 +1,36 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_RIGTRANSFORM
#define OSGANIMATION_RIGTRANSFORM 1
#include <osg/Referenced>
namespace osgAnimation
{
class RigGeometry;
class RigTransform : public osg::Referenced
{
public:
RigTransform() {}
virtual ~RigTransform() {}
virtual void operator()(RigGeometry& geometry) {}
};
}
#endif

View File

@@ -0,0 +1,85 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_RIG_TRANSFORM_HARDWARE
#define OSGANIMATION_RIG_TRANSFORM_HARDWARE 1
#include <osgAnimation/Export>
#include <osgAnimation/RigTransform>
#include <osgAnimation/VertexInfluence>
#include <osgAnimation/Bone>
#include <osg/Matrix>
#include <osg/Array>
namespace osgAnimation
{
class RigGeometry;
/// This class manage format for hardware skinning
class OSGANIMATION_EXPORT RigTransformHardware : public RigTransform
{
public:
typedef osg::Matrix MatrixType;
typedef osgAnimation::Bone BoneType;
typedef std::vector<osg::ref_ptr<osg::Vec4Array> > BoneWeightAttribList;
typedef std::vector<osg::ref_ptr<BoneType> > BonePalette;
typedef std::vector<osg::Matrix> MatrixPalette;
struct IndexWeightEntry
{
int _boneIndex;
float _boneWeight;
IndexWeightEntry() { _boneIndex = 0; _boneWeight = 0;}
IndexWeightEntry(int index, float weight) { _boneIndex = index; _boneWeight = weight;}
int getIndex() const { return _boneIndex; }
float getWeight() const { return _boneWeight; }
};
typedef std::vector<std::vector<IndexWeightEntry> > VertexIndexWeightList;
RigTransformHardware();
osg::Vec4Array* getVertexAttrib(int index);
int getNumVertexAttrib();
osg::Uniform* getMatrixPaletteUniform();
void computeMatrixPaletteUniform(const osg::Matrix& transformFromSkeletonToGeometry, const osg::Matrix& invTransformFromSkeletonToGeometry);
int getNumBonesPerVertex() const;
int getNumVertexes() const;
bool createPalette(int nbVertexes, BoneMap boneMap, const VertexInfluenceSet::VertexIndexToBoneWeightMap& vertexIndexToBoneWeightMap);
virtual void operator()(RigGeometry&);
void setShader(osg::Shader*);
protected:
bool init(RigGeometry&);
BoneWeightAttribList createVertexAttribList();
osg::Uniform* createVertexUniform();
int _bonesPerVertex;
int _nbVertexes;
VertexIndexWeightList _vertexIndexMatrixWeightList;
BonePalette _bonePalette;
BoneWeightAttribList _boneWeightAttribArrays;
osg::ref_ptr<osg::Uniform> _uniformMatrixPalette;
osg::ref_ptr<osg::Shader> _shader;
bool _needInit;
};
}
#endif

View File

@@ -0,0 +1,172 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_RIGTRANSFORM_SOFTWARE
#define OSGANIMATION_RIGTRANSFORM_SOFTWARE 1
#include <osgAnimation/Export>
#include <osgAnimation/RigTransform>
#include <osgAnimation/Bone>
#include <osgAnimation/VertexInfluence>
#include <osg/observer_ptr>
namespace osgAnimation
{
class RigGeometry;
/// This class manage format for hardware skinning
class OSGANIMATION_EXPORT RigTransformSoftware : public RigTransform
{
public:
RigTransformSoftware();
virtual void operator()(RigGeometry&);
class BoneWeight
{
public:
BoneWeight(Bone* bone, float weight) : _bone(bone), _weight(weight) {}
const Bone* getBone() const { return _bone.get(); }
float getWeight() const { return _weight; }
void setWeight(float w) { _weight = w; }
protected:
osg::observer_ptr<Bone> _bone;
float _weight;
};
typedef std::vector<BoneWeight> BoneWeightList;
typedef std::vector<int> VertexList;
class UniqBoneSetVertexSet
{
public:
BoneWeightList& getBones() { return _bones; }
VertexList& getVertexes() { return _vertexes; }
void resetMatrix()
{
_result.set(0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 1);
}
void accummulateMatrix(const osg::Matrix& invBindMatrix, const osg::Matrix& matrix, osg::Matrix::value_type weight)
{
osg::Matrix m = invBindMatrix * matrix;
osg::Matrix::value_type* ptr = m.ptr();
osg::Matrix::value_type* ptrresult = _result.ptr();
ptrresult[0] += ptr[0] * weight;
ptrresult[1] += ptr[1] * weight;
ptrresult[2] += ptr[2] * weight;
ptrresult[4] += ptr[4] * weight;
ptrresult[5] += ptr[5] * weight;
ptrresult[6] += ptr[6] * weight;
ptrresult[8] += ptr[8] * weight;
ptrresult[9] += ptr[9] * weight;
ptrresult[10] += ptr[10] * weight;
ptrresult[12] += ptr[12] * weight;
ptrresult[13] += ptr[13] * weight;
ptrresult[14] += ptr[14] * weight;
}
void computeMatrixForVertexSet()
{
if (_bones.empty())
{
osg::notify(osg::WARN) << this << " RigTransformSoftware::UniqBoneSetVertexSet no bones found" << std::endl;
_result = osg::Matrix::identity();
return;
}
resetMatrix();
int size = _bones.size();
for (int i = 0; i < size; i++)
{
const Bone* bone = _bones[i].getBone();
if (!bone)
{
osg::notify(osg::WARN) << this << " RigTransformSoftware::computeMatrixForVertexSet Warning a bone is null, skip it" << std::endl;
continue;
}
const osg::Matrix& invBindMatrix = bone->getInvBindMatrixInSkeletonSpace();
const osg::Matrix& matrix = bone->getMatrixInSkeletonSpace();
osg::Matrix::value_type w = _bones[i].getWeight();
accummulateMatrix(invBindMatrix, matrix, w);
}
}
const osg::Matrix& getMatrix() const { return _result;}
protected:
BoneWeightList _bones;
VertexList _vertexes;
osg::Matrix _result;
};
template <class V> void compute(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst)
{
// the result of matrix mult should be cached to be used for vertexes transform and normal transform and maybe other computation
int size = _boneSetVertexSet.size();
for (int i = 0; i < size; i++)
{
UniqBoneSetVertexSet& uniq = _boneSetVertexSet[i];
uniq.computeMatrixForVertexSet();
osg::Matrix matrix = transform * uniq.getMatrix() * invTransform;
const VertexList& vertexes = uniq.getVertexes();
int vertexSize = vertexes.size();
for (int j = 0; j < vertexSize; j++)
{
int idx = vertexes[j];
dst[idx] = src[idx] * matrix;
}
}
}
template <class V> void computeNormal(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst)
{
int size = _boneSetVertexSet.size();
for (int i = 0; i < size; i++)
{
UniqBoneSetVertexSet& uniq = _boneSetVertexSet[i];
uniq.computeMatrixForVertexSet();
osg::Matrix matrix = transform * uniq.getMatrix() * invTransform;
const VertexList& vertexes = uniq.getVertexes();
int vertexSize = vertexes.size();
for (int j = 0; j < vertexSize; j++)
{
int idx = vertexes[j];
dst[idx] = osg::Matrix::transform3x3(src[idx],matrix);
}
}
}
protected:
bool init(RigGeometry&);
void initVertexSetFromBones(const BoneMap& map, const VertexInfluenceSet::UniqVertexSetToBoneSetList& influence);
std::vector<UniqBoneSetVertexSet> _boneSetVertexSet;
bool _needInit;
};
}
#endif

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -10,7 +10,11 @@
* 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.
*/
*
* Authors:
* Cedric Pinson <cedric.pinson@plopbyte.net>
* Michael Platings <mplatings@pixelpower.com>
*/
#ifndef OSGANIMATION_SAMPLER_H
#define OSGANIMATION_SAMPLER_H
@@ -108,12 +112,21 @@ namespace osgAnimation
};
typedef TemplateSampler<DoubleStepInterpolator> DoubleStepSampler;
typedef TemplateSampler<FloatStepInterpolator> FloatStepSampler;
typedef TemplateSampler<Vec2StepInterpolator> Vec2StepSampler;
typedef TemplateSampler<Vec3StepInterpolator> Vec3StepSampler;
typedef TemplateSampler<Vec4StepInterpolator> Vec4StepSampler;
typedef TemplateSampler<QuatStepInterpolator> QuatStepSampler;
typedef TemplateSampler<DoubleLinearInterpolator> DoubleLinearSampler;
typedef TemplateSampler<FloatLinearInterpolator> FloatLinearSampler;
typedef TemplateSampler<Vec2LinearInterpolator> Vec2LinearSampler;
typedef TemplateSampler<Vec3LinearInterpolator> Vec3LinearSampler;
typedef TemplateSampler<Vec4LinearInterpolator> Vec4LinearSampler;
typedef TemplateSampler<QuatSphericalLinearInterpolator> QuatSphericalLinearSampler;
typedef TemplateSampler<MatrixLinearInterpolator> MatrixLinearSampler;
typedef TemplateSampler<FloatCubicBezierInterpolator> FloatCubicBezierSampler;
typedef TemplateSampler<DoubleCubicBezierInterpolator> DoubleCubicBezierSampler;
typedef TemplateSampler<Vec2CubicBezierInterpolator> Vec2CubicBezierSampler;

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -12,33 +12,36 @@
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGANIMATION_SKELETON_H
#define OSGANIMATION_SKELETON_H
#ifndef OSGANIMATION_SKELETON
#define OSGANIMATION_SKELETON 1
#include <osg/MatrixTransform>
#include <osgAnimation/Bone>
#include <osgAnimation/Export>
#include <osg/MatrixTransform>
namespace osgAnimation
{
class OSGANIMATION_EXPORT Skeleton : public Bone
class OSGANIMATION_EXPORT Skeleton : public osg::MatrixTransform
{
public:
META_Node(osgAnimation, Skeleton);
struct OSGANIMATION_EXPORT UpdateSkeleton : public osg::NodeCallback
class OSGANIMATION_EXPORT UpdateSkeleton : public osg::NodeCallback
{
public:
META_Object(osgAnimation, UpdateSkeleton);
UpdateSkeleton() {}
UpdateSkeleton(const UpdateSkeleton& us, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY) : osg::NodeCallback(us, copyop) {}
UpdateSkeleton();
UpdateSkeleton(const UpdateSkeleton&, const osg::CopyOp&);
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
bool needToValidate() const;
protected:
bool _needValidate;
};
Skeleton(const Skeleton& b, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY) : Bone(b,copyop) {}
Skeleton();
void setDefaultUpdateCallback(void);
void computeBindMatrix() { _invBindInSkeletonSpace = osg::Matrix::inverse(_bindInBoneSpace); }
Skeleton(const Skeleton&, const osg::CopyOp&);
void setDefaultUpdateCallback();
};
}

View File

@@ -0,0 +1,54 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_STACKED_MATRIX_ELEMENT
#define OSGANIMATION_STACKED_MATRIX_ELEMENT 1
#include <osg/Object>
#include <osgAnimation/Export>
#include <osgAnimation/StackedTransformElement>
#include <osgAnimation/Target>
namespace osgAnimation
{
class OSGANIMATION_EXPORT StackedMatrixElement : public StackedTransformElement
{
public:
META_Object(osgAnimation, StackedMatrixElement);
StackedMatrixElement();
StackedMatrixElement(const StackedMatrixElement&, const osg::CopyOp&);
StackedMatrixElement(const std::string& name, const osg::Matrix& matrix);
StackedMatrixElement(const osg::Matrix& matrix);
void applyToMatrix(osg::Matrix& matrix) const { matrix = _matrix * matrix; }
osg::Matrix getAsMatrix() const { return _matrix; }
const osg::Matrix& getMatrix() const { return _matrix;}
void setMatrix(const osg::Matrix& matrix) { _matrix = matrix;}
bool isIdentity() const { return _matrix.isIdentity(); }
void update();
virtual Target* getOrCreateTarget();
virtual Target* getTarget() {return _target.get();}
virtual const Target* getTarget() const {return _target.get();}
protected:
osg::Matrix _matrix;
osg::ref_ptr<MatrixTarget> _target;
};
}
#endif

View File

@@ -0,0 +1,54 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_STACKED_QUATERNION_ELEMENT
#define OSGANIMATION_STACKED_QUATERNION_ELEMENT 1
#include <osgAnimation/Export>
#include <osgAnimation/StackedTransformElement>
#include <osgAnimation/Target>
namespace osgAnimation
{
class OSGANIMATION_EXPORT StackedQuaternionElement : public StackedTransformElement
{
public:
META_Object(osgAnimation, StackedQuaternionElement);
StackedQuaternionElement();
StackedQuaternionElement(const StackedQuaternionElement&, const osg::CopyOp&);
StackedQuaternionElement(const std::string&, const osg::Quat& q = osg::Quat(0,0,0,1));
StackedQuaternionElement(const osg::Quat&);
void applyToMatrix(osg::Matrix& matrix) const;
osg::Matrix getAsMatrix() const;
bool isIdentity() const;
void update();
const osg::Quat& getQuaternion() const;
void setQuaternion(const osg::Quat&);
virtual Target* getOrCreateTarget();
virtual Target* getTarget();
virtual const Target* getTarget() const;
protected:
osg::Quat _quaternion;
osg::ref_ptr<QuatTarget> _target;
};
}
#endif

View File

@@ -0,0 +1,59 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_STACKED_ROTATE_AXIS_ELEMENT
#define OSGANIMATION_STACKED_ROTATE_AXIS_ELEMENT 1
#include <osgAnimation/Export>
#include <osgAnimation/StackedTransformElement>
#include <osgAnimation/Target>
#include <osg/Vec3>
namespace osgAnimation
{
class OSGANIMATION_EXPORT StackedRotateAxisElement : public StackedTransformElement
{
public:
META_Object(osgAnimation, StackedRotateAxisElement);
StackedRotateAxisElement();
StackedRotateAxisElement(const StackedRotateAxisElement&, const osg::CopyOp&);
StackedRotateAxisElement(const std::string& name, const osg::Vec3& axis, double angle);
StackedRotateAxisElement(const osg::Vec3& axis, double angle);
void applyToMatrix(osg::Matrix& matrix) const;
osg::Matrix getAsMatrix() const;
bool isIdentity() const { return (_angle == 0); }
void update();
const osg::Vec3& getAxis() const;
const double getAngle() const;
void setAxis(const osg::Vec3&);
void setAngle(const double&);
virtual Target* getOrCreateTarget();
virtual Target* getTarget() {return _target.get();}
virtual const Target* getTarget() const {return _target.get();}
protected:
osg::Vec3 _axis;
double _angle;
osg::ref_ptr<FloatTarget> _target;
};
}
#endif

View File

@@ -0,0 +1,56 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_STACKED_SCALE_ELEMENT
#define OSGANIMATION_STACKED_SCALE_ELEMENT 1
#include <osg/Object>
#include <osgAnimation/Export>
#include <osgAnimation/StackedTransformElement>
#include <osgAnimation/Target>
namespace osgAnimation
{
class OSGANIMATION_EXPORT StackedScaleElement : public StackedTransformElement
{
public:
META_Object(osgAnimation, StackedScaleElement)
StackedScaleElement();
StackedScaleElement(const StackedScaleElement&, const osg::CopyOp&);
StackedScaleElement(const std::string& name, const osg::Vec3& scale = osg::Vec3(1,1,1));
StackedScaleElement(const osg::Vec3& scale);
void applyToMatrix(osg::Matrix& matrix) const;
osg::Matrix getAsMatrix() const;
bool isIdentity() const;
void update();
const osg::Vec3& getScale() const;
void setScale(const osg::Vec3& scale);
virtual Target* getOrCreateTarget();
virtual Target* getTarget();
virtual const Target* getTarget() const;
protected:
osg::Vec3 _scale;
osg::ref_ptr<Vec3Target> _target;
};
}
#endif

View File

@@ -0,0 +1,42 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_STACKED_TRANSFORM
#define OSGANIMATION_STACKED_TRANSFORM 1
#include <osg/MixinVector>
#include <osgAnimation/Export>
#include <osgAnimation/StackedTransformElement>
namespace osgAnimation
{
class OSGANIMATION_EXPORT StackedTransform : public osg::MixinVector<osg::ref_ptr<StackedTransformElement> >
{
public:
StackedTransform();
StackedTransform(const StackedTransform&, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
void update();
const osg::Matrix& getMatrix() const;
protected:
osg::Matrix _matrix;
};
}
#endif

View File

@@ -0,0 +1,42 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_STACKED_TRANSFORM_ELEMENT
#define OSGANIMATION_STACKED_TRANSFORM_ELEMENT 1
#include <osgAnimation/Export>
#include <osg/Object>
#include <osg/Matrix>
namespace osgAnimation
{
class Target;
class OSGANIMATION_EXPORT StackedTransformElement : public osg::Object
{
public:
StackedTransformElement() {}
StackedTransformElement(const StackedTransformElement& rhs, const osg::CopyOp& c) : osg::Object(rhs, c) {}
virtual void applyToMatrix(osg::Matrix& matrix) const = 0;
virtual osg::Matrix getAsMatrix() const = 0;
virtual bool isIdentity() const = 0;
virtual void update() = 0;
virtual Target* getOrCreateTarget() {return 0;}
virtual Target* getTarget() {return 0;}
virtual const Target* getTarget() const {return 0;}
};
}
#endif

View File

@@ -0,0 +1,54 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_STACKED_TRANSLATE_ELEMENT
#define OSGANIMATION_STACKED_TRANSLATE_ELEMENT 1
#include <osgAnimation/Export>
#include <osgAnimation/StackedTransformElement>
#include <osgAnimation/Target>
namespace osgAnimation
{
class OSGANIMATION_EXPORT StackedTranslateElement : public StackedTransformElement
{
public:
META_Object(osgAnimation, StackedTranslateElement);
StackedTranslateElement();
StackedTranslateElement(const StackedTranslateElement&, const osg::CopyOp&);
StackedTranslateElement(const std::string&, const osg::Vec3& translate = osg::Vec3(0,0,0));
StackedTranslateElement(const osg::Vec3& translate);
void applyToMatrix(osg::Matrix& matrix) const;
osg::Matrix getAsMatrix() const;
bool isIdentity() const;
void update();
const osg::Vec3& getTranslate() const;
void setTranslate(const osg::Vec3& );
virtual Target* getOrCreateTarget();
virtual Target* getTarget();
virtual const Target* getTarget() const;
protected:
osg::Vec3 _translate;
osg::ref_ptr<Vec3Target> _target;
};
}
#endif

View File

@@ -0,0 +1,113 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <mornifle@plopbyte.net>
*
* 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 OSGANIMATION_STATSHANDLER_H
#define OSGANIMATION_STATSHANDLER_H
#include <osgAnimation/Timeline>
#include <osgGA/GUIEventHandler>
#include <osgViewer/ViewerBase>
#include <osgViewer/Viewer>
#include <osgText/Text>
namespace osgAnimation
{
#if 0
struct StatAction
{
std::string _name;
osg::ref_ptr<osg::Group> _group;
osg::ref_ptr<osg::Geode> _label;
osg::ref_ptr<osg::MatrixTransform> _graph;
osg::ref_ptr<osgText::Text> _textLabel;
void init(osg::Stats* stats, const std::string& name, const osg::Vec3& pos, float width, float heigh, const osg::Vec4& color);
void setPosition(const osg::Vec3& pos);
void setAlpha(float v);
};
#endif
/** Event handler for adding on screen stats reporting to Viewers.*/
class OSGANIMATION_EXPORT StatsHandler : public osgGA::GUIEventHandler
{
public:
StatsHandler();
enum StatsType
{
NO_STATS = 0,
FRAME_RATE = 1,
LAST = 2
};
void setKeyEventTogglesOnScreenStats(int key) { _keyEventTogglesOnScreenStats = key; }
int getKeyEventTogglesOnScreenStats() const { return _keyEventTogglesOnScreenStats; }
void setKeyEventPrintsOutStats(int key) { _keyEventPrintsOutStats = key; }
int getKeyEventPrintsOutStats() const { return _keyEventPrintsOutStats; }
double getBlockMultiplier() const { return _blockMultiplier; }
void reset();
osg::Camera* getCamera() { return _camera.get(); }
const osg::Camera* getCamera() const { return _camera.get(); }
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
/** Get the keyboard and mouse usage of this manipulator.*/
virtual void getUsage(osg::ApplicationUsage& usage) const;
protected:
void setUpHUDCamera(osgViewer::ViewerBase* viewer);
osg::Geometry* createBackgroundRectangle(const osg::Vec3& pos, const float width, const float height, osg::Vec4& color);
osg::Geometry* createGeometry(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numBlocks);
osg::Geometry* createFrameMarkers(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numBlocks);
osg::Geometry* createTick(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numTicks);
osg::Node* createCameraTimeStats(const std::string& font, osg::Vec3& pos, float startBlocks, bool acquireGPUStats, float characterSize, osg::Stats* viewerStats, osg::Camera* camera);
void setUpScene(osgViewer::Viewer* viewer);
int _keyEventTogglesOnScreenStats;
int _keyEventPrintsOutStats;
int _statsType;
bool _initialized;
osg::ref_ptr<osg::Camera> _camera;
osg::ref_ptr<osg::Switch> _switch;
osg::ref_ptr<osg::Group> _group;
unsigned int _frameRateChildNum;
unsigned int _numBlocks;
double _blockMultiplier;
float _statsWidth;
float _statsHeight;
// std::map<std::string, StatAction > _actions;
};
}
#endif

View File

@@ -0,0 +1,53 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_STATSVISITOR_H
#define OSGANIMATION_STATSVISITOR_H
#include <osgAnimation/Export>
#include <osgAnimation/ActionVisitor>
#include <osg/Stats>
#include <vector>
namespace osgAnimation
{
class OSGANIMATION_EXPORT StatsActionVisitor : public osgAnimation::UpdateActionVisitor
{
protected:
osg::ref_ptr<osg::Stats> _stats;
std::vector<std::string> _channels;
public:
META_ActionVisitor(osgAnimation, StatsActionVisitor);
StatsActionVisitor();
StatsActionVisitor(osg::Stats* stats, unsigned int frame);
void reset();
const std::vector<std::string>& getChannels() const { return _channels; }
osg::Stats* getStats() { return _stats.get(); }
void setStats(osg::Stats* stats) { _stats = stats; }
void setFrame(unsigned int frame) { _frame = frame; }
void apply(Timeline& action);
void apply(Action& action);
void apply(ActionBlendIn& action);
void apply(ActionBlendOut& action);
void apply(ActionAnimation& action);
void apply(ActionStripAnimation& action);
};
}
#endif

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -34,15 +34,14 @@ namespace osgAnimation
public:
Target();
virtual ~Target();
virtual void normalize() = 0;
float getWeight() const { return _weight; }
void reset() { _weight = 0;}
virtual ~Target() {}
void reset() { _weight = 0; _priorityWeight = 0; }
int getCount() const { return referenceCount(); }
float getWeight() const { return _weight; }
protected:
void addWeight(float w) { _weight += w; }
float _weight;
float _priorityWeight;
int _lastPriority;
};
@@ -51,75 +50,78 @@ namespace osgAnimation
{
public:
TemplateTarget() {}
TemplateTarget() : _target() {}
TemplateTarget(const T& v) { setValue(v); }
TemplateTarget(const TemplateTarget& v) { setValue(v.getValue()); }
void update(float weight, const T& val)
inline void lerp(float t, const T& a, const T& b);
/**
* The priority is used to detect a change of priority
* It's important to update animation target in priority
* order. eg:
* all animation with priority 1
* all animation with priority 0
* all animation with priority -1
* ...
*/
void update(float weight, const T& val, int priority)
{
if (!_weight)
_target = val * weight;
if (_weight || _priorityWeight)
{
if (_lastPriority != priority)
{
// change in priority
// add to weight with the same previous priority cumulated weight
_weight += _priorityWeight * (1.0 - _weight);
_priorityWeight = 0;
_lastPriority = priority;
}
_priorityWeight += weight;
float t = (1.0 - _weight) * weight / _priorityWeight;
lerp(t, _target, val);
}
else
{
weight = (1.0 - _weight) * weight;
_target += val * weight;
_priorityWeight = weight;
_lastPriority = priority;
_target = val;
}
addWeight(weight);
}
const T& getValue() const { return _target;}
const T& getValue() const { return _target; }
void normalize()
{
float weightSummed = getWeight();
if (fabs(weightSummed) < 1e-4 || fabs(weightSummed-1) < 1e-4)
return;
(_target) /= weightSummed;
}
void setValue(const T& value) { _target = value;}
void setValue(const T& value) { _target = value; }
protected:
T _target;
};
// Target Specialisation for Quaternions
template <>
class TemplateTarget< osg::Quat > : public Target
template <class T>
inline void TemplateTarget<T>::lerp(float t, const T& a, const T& b)
{
public:
TemplateTarget () {}
_target = a * (1.0f - t) + b * t;
}
const osg::Quat& getValue() const { return _target;}
void update(float weight, const osg::Quat& val)
{
if (!_weight)
_target = val * weight;
else
{
weight = (1.0 - _weight) * weight;
_target += val * weight;
}
addWeight(weight);
}
// maybe normalize could be non virtual and put on ITarget
void normalize()
template <>
inline void TemplateTarget<osg::Quat>::lerp(float t, const osg::Quat& a, const osg::Quat& b)
{
if (a.asVec4() * b.asVec4() < 0.0)
{
float weightSummed = getWeight();
if (fabs(weightSummed) < 1e-4 || fabs(weightSummed-1.0) < 1e-4)
return;
(_target) /= weightSummed;
_target = a * (1.0f - t) + b * -t;
}
else
{
_target = a * (1.0f - t) + b * t;
}
void setValue(const osg::Quat& value) { _target = value;}
protected:
osg::Quat::value_type len2 = _target.length2();
if ( len2 != 1.0 && len2 != 0.0)
_target *= 1.0/sqrt(len2);
}
osg::Quat _target;
};
typedef TemplateTarget<osg::Matrixf> MatrixTarget;
typedef TemplateTarget<osg::Quat> QuatTarget;
typedef TemplateTarget<osg::Vec3> Vec3Target;
typedef TemplateTarget<osg::Vec4> Vec4Target;

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -12,180 +12,88 @@
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGANIMATION_TIMELINE_H
#define OSGANIMATION_TIMELINE_H
#ifndef OSGANIMATION_TIMELINE
#define OSGANIMATION_TIMELINE 1
#include <osgAnimation/Export>
#include <osg/Object>
#include <map>
#include <vector>
#include <osg/observer_ptr>
#include <osg/Notify>
#include <osg/Group>
#include <osgAnimation/Animation>
#include <osg/Stats>
#include <osgAnimation/Action>
#include <osgAnimation/FrameAction>
#include <osgAnimation/AnimationManagerBase>
#include <osgAnimation/StatsVisitor>
namespace osgAnimation
{
class Action : public osg::Object
class OSGANIMATION_EXPORT Timeline : public Action
{
public:
class Callback : public osg::Object
{
public:
Callback(){}
Callback(const Callback&,const osg::CopyOp&) {}
Timeline();
Timeline(const Timeline& nc,const osg::CopyOp& op = osg::CopyOp::SHALLOW_COPY);
META_Object(osgAnimation,Callback);
virtual void operator()(Action* /*action*/) {}
void addNestedCallback(Callback* callback)
{
if (_nested.valid())
_nested->addNestedCallback(callback);
else
_nested = callback;
}
META_Action(osgAnimation, Timeline);
protected:
osg::ref_ptr<Callback> _nested;
};
typedef std::map<unsigned int, osg::ref_ptr<Callback> > FrameCallback;
META_Object(osgAnimation, Action);
Action()
{
_numberFrame = 25;
_fps = 25;
_speed = 1.0;
_loop = 1;
}
Action(const Action&,const osg::CopyOp&) {}
void setCallback(double when, Callback* callback)
{
setCallback(static_cast<unsigned int>(floor(when*_fps)), callback);
}
void setCallback(unsigned int frame, Callback* callback)
{
if (_framesCallback[frame].valid())
_framesCallback[frame]->addNestedCallback(callback);
else
_framesCallback[frame] = callback;
}
Callback* getCallback(unsigned int frame)
{
if (_framesCallback.find(frame) == _framesCallback.end())
return 0;
return _framesCallback[frame].get();
}
void setNumFrames(unsigned int numFrames) { _numberFrame = numFrames;}
void setDuration(double duration) { _numberFrame = static_cast<unsigned int>(floor(duration * _fps)); }
unsigned int getNumFrames() const { return _numberFrame;}
double getDuration() const { return _numberFrame * 1.0 / _fps; }
// 0 means infini else it's the number of loop
virtual void setLoop(int nb) { _loop = nb; }
virtual unsigned int getLoop() const { return _loop;}
// get the number of loop, the frame relative to loop.
// return true if in range, and false if out of range.
bool evaluateFrame(unsigned int frame, unsigned int& resultframe, unsigned int& nbloop )
{
nbloop = frame / getNumFrames();
resultframe = frame;
if (frame > getNumFrames()-1)
{
if (!getLoop())
resultframe = frame % getNumFrames();
else
{
if (nbloop >= getLoop())
return false;
else
resultframe = frame % getNumFrames();
}
}
return true;
}
virtual void evaluate(unsigned int frame)
{
unsigned int frameInAction;
unsigned int loopDone;
if (!evaluateFrame(frame, frameInAction, loopDone))
osg::notify(osg::DEBUG_INFO) << getName() << " Action frame " << frameInAction << " finished" << std::endl;
else
osg::notify(osg::DEBUG_INFO) << getName() << " Action frame " << frame << " relative to loop " << frameInAction << " no loop " << loopDone<< std::endl;
}
virtual void evaluateCallback(unsigned int frame)
{
unsigned int frameInAction;
unsigned int loopDone;
if (!evaluateFrame(frame, frameInAction, loopDone))
return;
frame = frameInAction;
if (_framesCallback.find(frame) != _framesCallback.end())
{
std::cout << getName() << " evaluate callback " << _framesCallback[frame]->getName() << " at " << frame << std::endl;
(*_framesCallback[frame])(this);
}
}
protected:
FrameCallback _framesCallback;
double _speed;
unsigned int _fps;
unsigned int _numberFrame;
unsigned int _loop;
enum State
enum TimelineStatus
{
Play,
Stop
};
State _state;
};
TimelineStatus getStatus() const { return _state; }
class Timeline : public osg::Object
{
protected:
typedef std::pair<unsigned int, osg::ref_ptr<Action> > FrameAction;
typedef std::vector<FrameAction> ActionList;
typedef std::map<int, ActionList> ActionLayers;
enum State
{
Play,
Stop
};
const ActionList& getActionLayer(int i) { return _actions[i];}
unsigned int getCurrentFrame() const { return _currentFrame;}
double getCurrentTime() const { return _currentFrame * 1.0 / _fps;}
void play() { _state = Play; }
void gotoFrame(unsigned int frame) { _currentFrame = frame; }
void stop() { _state = Stop; }
bool getEvaluating() const { return _evaluating;}
bool isActive(Action* activeAction);
void removeAction(Action* action);
virtual void addActionAt(unsigned int frame, Action* action, int priority = 0);
virtual void addActionAt(double t, Action* action, int priority = 0);
void addActionNow(Action* action, int priority = 0);
void clearActions();
virtual void update(double simulationTime);
void setLastFrameEvaluated(unsigned int frame) { _previousFrameEvaluated = frame; }
void setEvaluating(bool state) { _evaluating = state;}
void traverse(ActionVisitor& visitor);
void setStats(osg::Stats* stats);
osg::Stats* getStats();
void collectStats(bool state);
osgAnimation::StatsActionVisitor* getStatsVisitor();
const ActionLayers& getActionLayers() const { return _actions; }
void processPendingOperation();
void setAnimationManager(AnimationManagerBase*);
protected:
osg::observer_ptr<AnimationManagerBase> _animationManager;
ActionLayers _actions;
double _lastUpdate;
double _speed;
unsigned int _currentFrame;
unsigned int _fps;
unsigned int _numberFrame;
unsigned int _previousFrameEvaluated;
bool _loop;
bool _initFirstFrame;
State _state;
TimelineStatus _state;
bool _collectStats;
osg::ref_ptr<osg::Stats> _stats;
osg::ref_ptr<osgAnimation::StatsActionVisitor> _statsVisitor;
// to manage pending operation
bool _evaluating;
@@ -202,331 +110,9 @@ namespace osgAnimation
CommandList _addActionOperations;
ActionList _removeActionOperations;
void setEvaluating(bool state) { _evaluating = state;}
void processPendingOperation()
{
// process all pending add action operation
while( !_addActionOperations.empty())
{
internalAddAction(_addActionOperations.back()._priority, _addActionOperations.back()._action);
_addActionOperations.pop_back();
}
// process all pending remove action operation
while( !_removeActionOperations.empty())
{
internalRemoveAction(_removeActionOperations.back().second.get());
_removeActionOperations.pop_back();
}
}
void internalRemoveAction(Action* action)
{
for (ActionLayers::iterator it = _actions.begin(); it != _actions.end(); it++)
{
ActionList& fa = it->second;
for (unsigned int i = 0; i < fa.size(); i++)
if (fa[i].second.get() == action)
{
fa.erase(fa.begin() + i);
return;
}
}
}
void internalAddAction(int priority, const FrameAction& ftl)
{
_actions[priority].push_back(ftl);
}
void internalRemoveAction(Action* action);
void internalAddAction(int priority, const FrameAction& ftl);
public:
META_Object(osgAnimation, Timeline);
Timeline();
Timeline(const Timeline& nc,const osg::CopyOp& op = osg::CopyOp::SHALLOW_COPY);
State getStatus() const { return _state; }
const ActionList& getActionLayer(int i)
{
return _actions[i];
}
unsigned int getCurrentFrame() const { return _currentFrame;}
double getCurrentTime() const { return _currentFrame * 1.0 / _fps;}
void play() { _state = Play; }
void gotoFrame(unsigned int frame) { _currentFrame = frame; }
void stop() { _state = Stop; }
bool getEvaluating() const { return _evaluating;}
bool isActive(Action* activeAction)
{
// update from high priority to low priority
for( ActionLayers::iterator iterAnim = _actions.begin(); iterAnim != _actions.end(); ++iterAnim )
{
// update all animation
ActionList& list = iterAnim->second;
for (unsigned int i = 0; i < list.size(); i++)
{
Action* action = list[i].second.get();
if (action == activeAction)
{
unsigned int firstFrame = list[i].first;
// check if current frame of timeline hit an action interval
if (_currentFrame >= firstFrame &&
_currentFrame < (firstFrame + action->getNumFrames()) )
return true;
}
}
}
return false;
}
void removeAction(Action* action)
{
if (getEvaluating())
_removeActionOperations.push_back(FrameAction(0, action));
else
internalRemoveAction(action);
}
virtual void addActionAt(unsigned int frame, Action* action, int priority = 0)
{
if (getEvaluating())
_addActionOperations.push_back(Command(priority,FrameAction(frame, action)));
else
internalAddAction(priority, FrameAction(frame, action));
}
virtual void addActionAt(double t, Action* action, int priority = 0)
{
unsigned int frame = static_cast<unsigned int>(floor(t * _fps));
addActionAt(frame, action, priority);
}
virtual void evaluate(unsigned int frame)
{
setEvaluating(true);
osg::notify(osg::DEBUG_INFO) << getName() << " evaluate frame " << _currentFrame << std::endl;
// update from high priority to low priority
for( ActionLayers::reverse_iterator iterAnim = _actions.rbegin(); iterAnim != _actions.rend(); ++iterAnim )
{
// update all animation
ActionList& list = iterAnim->second;
for (unsigned int i = 0; i < list.size(); i++)
{
unsigned int firstFrame = list[i].first;
Action* action = list[i].second.get();
// check if current frame of timeline hit an action interval
if (frame >= firstFrame &&
frame < (firstFrame + action->getNumFrames()) )
action->evaluate(frame - firstFrame);
}
}
setEvaluating(false);
// evaluate callback after updating all animation
evaluateCallback(frame);
_previousFrameEvaluated = frame;
}
virtual void evaluateCallback(unsigned int frame)
{
// update from high priority to low priority
for( ActionLayers::reverse_iterator iterAnim = _actions.rbegin(); iterAnim != _actions.rend(); ++iterAnim )
{
// update all animation
ActionList& list = iterAnim->second;
for (unsigned int i = 0; i < list.size(); i++)
{
unsigned int firstFrame = list[i].first;
Action* action = list[i].second.get();
// check if current frame of timeline hit an action interval
if (frame >= firstFrame &&
frame < (firstFrame + action->getNumFrames()) )
action->evaluateCallback(frame - firstFrame);
}
}
processPendingOperation();
}
virtual void update(double simulationTime)
{
// first time we call update we generate one frame
if (!_initFirstFrame)
{
_lastUpdate = simulationTime;
_initFirstFrame = true;
evaluate(_currentFrame);
}
// find the number of frame pass since the last update
double delta = (simulationTime - _lastUpdate);
double nbframes = delta * _fps * _speed;
unsigned int nb = static_cast<unsigned int>(floor(nbframes));
for (unsigned int i = 0; i < nb; i++)
{
if (_state == Play)
_currentFrame++;
evaluate(_currentFrame);
}
if (nb)
{
_lastUpdate += ((double)nb) / _fps;
}
}
};
// blend in from 0 to weight in duration
class BlendIn : public Action
{
double _weight;
osg::ref_ptr<Animation> _animation;
public:
BlendIn(Animation* animation, double duration, double weight)
{
_animation = animation;
_weight = weight;
float d = duration * _fps;
setNumFrames(static_cast<unsigned int>(floor(d)) + 1);
setName("BlendIn");
}
double getWeight() const { return _weight;}
virtual void evaluate(unsigned int frame)
{
Action::evaluate(frame);
// frame + 1 because the start is 0 and we want to start the blend in at the first
// frame.
double ratio = ( (frame+1) * 1.0 / (getNumFrames()) );
double w = _weight;
if (frame < getNumFrames() -1 ) // the last frame we set the target weight the user asked
w = _weight * ratio;
_animation->setWeight(w);
}
};
// blend in from 0 to weight in duration
class BlendOut : public Action
{
double _weight;
osg::ref_ptr<Animation> _animation;
public:
BlendOut(Animation* animation, double duration)
{
_animation = animation;
float d = duration * _fps;
setNumFrames(static_cast<unsigned int>(floor(d) + 1));
_weight = 1.0;
setName("BlendOut");
}
double getWeight() const { return _weight;}
virtual void evaluate(unsigned int frame)
{
Action::evaluate(frame);
// frame + 1 because the start is 0 and we want to start the blend in at the first
// frame.
double ratio = ( (frame+1) * 1.0 / (getNumFrames()) );
double w = 0.0;
if (frame < getNumFrames() -1 ) // the last frame we set the target weight the user asked
w = _weight * (1.0-ratio);
_animation->setWeight(w);
}
};
class ActionAnimation : public Action
{
public:
ActionAnimation(Animation* animation) : _animation(animation)
{
setDuration(animation->getDuration());
setName(animation->getName());
}
virtual void evaluate(unsigned int frame)
{
Action::evaluate(frame);
_animation->update(frame * 1.0/_fps);
}
Animation* getAnimation() { return _animation.get(); }
protected:
osg::ref_ptr<Animation> _animation;
};
// encapsulate animation with blend in blend out for classic usage
class StripAnimation : public Action
{
protected:
typedef std::pair<unsigned int, osg::ref_ptr<Action> > FrameAction;
public:
StripAnimation(Animation* animation, double blendInDuration, double blendOutDuration, double blendInWeightTarget = 1.0 )
{
_blendIn = new BlendIn(animation, blendInDuration, blendInWeightTarget);
_animation = new ActionAnimation(animation);
unsigned int start = static_cast<unsigned int>(floor((_animation->getDuration() - blendOutDuration) * _fps));
_blendOut = FrameAction(start, new BlendOut(animation, blendOutDuration));
setName(animation->getName() + "_Strip");
_blendIn->setName(_animation->getName() + "_" + _blendIn->getName());
_blendOut.second->setName(_animation->getName() + "_" + _blendOut.second->getName());
setDuration(animation->getDuration());
}
ActionAnimation* getActionAnimation() { return _animation.get(); }
BlendIn* getBlendIn() { return _blendIn.get(); }
BlendOut* getBlendOut() { return dynamic_cast<BlendOut*>(_blendOut.second.get()); }
const ActionAnimation* getActionAnimation() const { return _animation.get(); }
const BlendIn* getBlendIn() const { return _blendIn.get(); }
const BlendOut* getBlendOut() const { return dynamic_cast<BlendOut*>(_blendOut.second.get()); }
unsigned int getLoop() const { return _animation->getLoop(); }
void setLoop(unsigned int loop)
{
_animation->setLoop(loop);
if (!loop)
setDuration(-1);
else
setDuration(loop * _animation->getDuration());
// duration changed re evaluate the blendout duration
unsigned int start = static_cast<unsigned int>(floor((getDuration() - _blendOut.second->getDuration()) * _fps));
_blendOut = FrameAction(start, _blendOut.second);
}
virtual void evaluate(unsigned int frame)
{
if (frame > getNumFrames() - 1)
return;
Action::evaluate(frame);
if (frame < _blendIn->getNumFrames())
_blendIn->evaluate(frame);
if (frame >= _blendOut.first)
_blendOut.second->evaluate(frame - _blendOut.first);
_animation->evaluate(frame);
}
protected:
osg::ref_ptr<BlendIn> _blendIn;
FrameAction _blendOut;
osg::ref_ptr<ActionAnimation> _animation;
};
class RunAction : public Action::Callback
{
protected:
osg::ref_ptr<Timeline> _tm;
osg::ref_ptr<Action> _action;
public:
RunAction(Timeline* tm, Action* a) : _tm(tm), _action(a) {}
virtual void operator()(Action* /*action*/)
{
_tm->addActionAt(_tm->getCurrentFrame(), _action.get()); // warning we are trsversing the vector
}
};

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -10,10 +10,10 @@
* 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 OSGANIMATION_TIMELINE_ANIMATION_MANAGER_H
#define OSGANIMATION_TIMELINE_ANIMATION_MANAGER_H
#ifndef OSGANIMATION_TIMELINE_ANIMATION_MANAGER
#define OSGANIMATION_TIMELINE_ANIMATION_MANAGER 1
#include <osgAnimation/Export>
#include <osgAnimation/AnimationManagerBase>
@@ -23,21 +23,21 @@
namespace osgAnimation
{
class OSGANIMATION_EXPORT TimelineAnimationManager : public AnimationManagerBase
{
protected:
osg::ref_ptr<Timeline> _timeline;
class OSGANIMATION_EXPORT TimelineAnimationManager : public AnimationManagerBase
{
protected:
osg::ref_ptr<Timeline> _timeline;
public:
META_Object(osgAnimation, TimelineAnimationManager);
TimelineAnimationManager();
TimelineAnimationManager(const AnimationManagerBase& manager);
TimelineAnimationManager(const TimelineAnimationManager& nc,const osg::CopyOp&);
public:
META_Object(osgAnimation, TimelineAnimationManager);
TimelineAnimationManager();
TimelineAnimationManager(const AnimationManagerBase& manager);
TimelineAnimationManager(const TimelineAnimationManager& nc,const osg::CopyOp&);
Timeline* getTimeline() { return _timeline.get(); }
const Timeline* getTimeline() const { return _timeline.get(); }
void update(double time);
};
Timeline* getTimeline() { return _timeline.get(); }
const Timeline* getTimeline() const { return _timeline.get(); }
void update(double time);
};
}

View File

@@ -0,0 +1,36 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_UPDATE_BONE
#define OSGANIMATION_UPDATE_BONE 1
#include <osgAnimation/Export>
#include <osgAnimation/UpdateMatrixTransform>
namespace osgAnimation
{
class OSGANIMATION_EXPORT UpdateBone : public UpdateMatrixTransform
{
public:
META_Object(osgAnimation, UpdateBone);
UpdateBone(const std::string& name = "");
UpdateBone(const UpdateBone&,const osg::CopyOp&);
void operator()(osg::Node* node, osg::NodeVisitor* nv);
};
}
#endif

View File

@@ -0,0 +1,46 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_UPDATE_MATERIAL
#define OSGANIMATION_UPDATE_MATERIAL 1
#include <osgAnimation/AnimationUpdateCallback>
#include <osgAnimation/Export>
#include <osg/StateAttribute>
#include <osg/Material>
namespace osgAnimation
{
class OSGANIMATION_EXPORT UpdateMaterial : public AnimationUpdateCallback<osg::StateAttributeCallback>
{
protected:
osg::ref_ptr<Vec4Target> _diffuse;
public:
META_Object(osgAnimation, UpdateMaterial);
UpdateMaterial(const std::string& name = "");
UpdateMaterial(const UpdateMaterial& apc,const osg::CopyOp& copyop);
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator () (osg::StateAttribute*, osg::NodeVisitor*);
void update(osg::Material& material);
bool link(Channel* channel);
Vec4Target* getDiffuse();
};
}
#endif

View File

@@ -0,0 +1,48 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 OSGANIMATION_UPDATE_MATRIX_TRANSFORM
#define OSGANIMATION_UPDATE_MATRIX_TRANSFORM 1
#include <osgAnimation/Export>
#include <osgAnimation/AnimationUpdateCallback>
#include <osgAnimation/StackedTransform>
#include <osg/NodeCallback>
namespace osgAnimation
{
class OSGANIMATION_EXPORT UpdateMatrixTransform : public AnimationUpdateCallback<osg::NodeCallback>
{
public:
META_Object(osgAnimation, UpdateMatrixTransform);
UpdateMatrixTransform(const std::string& name = "");
UpdateMatrixTransform(const UpdateMatrixTransform& apc,const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
// Callback method called by the NodeVisitor when visiting a node.
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
virtual bool link(osgAnimation::Channel* channel);
StackedTransform& getStackedTransforms() { return _transforms;}
const StackedTransform& getStackedTransforms() const { return _transforms;}
protected:
StackedTransform _transforms;
};
}
#endif

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -12,8 +12,8 @@
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGANIMATION_VERTEX_INFLUENCES_H
#define OSGANIMATION_VERTEX_INFLUENCES_H
#ifndef OSGANIMATION_VERTEX_INFLUENCE
#define OSGANIMATION_VERTEX_INFLUENCE 1
#include <osg/Object>
#include <osgAnimation/Export>
@@ -38,8 +38,6 @@ namespace osgAnimation
std::string _name;
};
// typedef std::map<std::string, VertexInfluence> VertexInfluenceMap;
class VertexInfluenceMap : public std::map<std::string, VertexInfluence> , public osg::Object
{
public:
@@ -52,7 +50,7 @@ namespace osgAnimation
// this class manage VertexInfluence database by mesh
// reference bones per vertex ...
class VertexInfluenceSet
class OSGANIMATION_EXPORT VertexInfluenceSet
{
public:
typedef std::vector<VertexInfluence> BoneToVertexList;
@@ -73,7 +71,7 @@ namespace osgAnimation
typedef std::vector<BoneWeight> BoneWeightList;
typedef std::map<int,BoneWeightList> VertexIndexToBoneWeightMap;
class UniqVertexSetToBoneSet
class UniqVertexSetToBoneSet
{
public:
void setBones(BoneWeightList& bones) { _bones = bones;}
@@ -88,14 +86,12 @@ namespace osgAnimation
typedef std::vector<UniqVertexSetToBoneSet> UniqVertexSetToBoneSetList;
const UniqVertexSetToBoneSetList& getUniqVertexSetToBoneSetList() const { return _uniqVertexSetToBoneSet;}
void addVertexInfluence(const VertexInfluence& v) { _bone2Vertexes.push_back(v); }
void addVertexInfluence(const VertexInfluence& v);
void buildVertex2BoneList();
void buildUniqVertexSetToBoneSetList();
void clear()
{
_bone2Vertexes.clear();
_uniqVertexSetToBoneSet.clear();
}
void clear();
const VertexIndexToBoneWeightMap& getVertexToBoneList() const;
protected:
BoneToVertexList _bone2Vertexes;
VertexIndexToBoneWeightMap _vertex2Bones;

View File

@@ -38,6 +38,15 @@ extern OSGDB_EXPORT std::string convertUTF16toUTF8(const wchar_t* s);
extern OSGDB_EXPORT std::wstring convertUTF8toUTF16(const std::string& s);
extern OSGDB_EXPORT std::wstring convertUTF8toUTF16(const char* s);
extern OSGDB_EXPORT std::string convertStringFromCurrentCodePageToUTF8(const char* source, unsigned sourceLength);
extern OSGDB_EXPORT std::string convertStringFromUTF8toCurrentCodePage(const char* source, unsigned sourceLength);
extern OSGDB_EXPORT std::string convertStringFromCurrentCodePageToUTF8(const std::string& s);
extern OSGDB_EXPORT std::string convertStringFromCurrentCodePageToUTF8(const char* s);
extern OSGDB_EXPORT std::string convertStringFromUTF8toCurrentCodePage(const std::string& s);
extern OSGDB_EXPORT std::string convertStringFromUTF8toCurrentCodePage(const char* s);
}
#endif

View File

@@ -46,6 +46,12 @@ extern OSGDB_EXPORT bool makeDirectory( const std::string &directoryPath );
// Make a new directory for a given file.
extern OSGDB_EXPORT bool makeDirectoryForFile( const std::string &filePath );
// Get current working directory.
extern OSGDB_EXPORT std::string getCurrentWorkingDirectory( void );
// Set current working directory.
extern OSGDB_EXPORT bool setCurrentWorkingDirectory( const std::string &newCurrentWorkingDirectory );
/** return true if a file exists. */
extern OSGDB_EXPORT bool fileExists(const std::string& filename);
@@ -96,7 +102,7 @@ inline FilePathList& getLibraryFilePathList() { return osgDB::Registry::instance
extern OSGDB_EXPORT std::string findLibraryFile(const std::string& filename,CaseSensitivity caseSensitivity=CASE_SENSITIVE);
/** convert a string containing a list of paths delimited either with ';' (Windows) or ':' (All other platforms) into FilePath representation.*/
/** convert a string containing a list of paths delimited either with ';' (Windows) or ':' (All other platforms) into FilePath representation.*/
extern OSGDB_EXPORT void convertStringPathIntoFilePathList(const std::string& paths,FilePathList& filepath);
extern OSGDB_EXPORT void appendPlatformSpecificLibraryFilePaths(FilePathList& filepath);

View File

@@ -125,7 +125,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
_databasePaths(options._databasePaths),
_objectCacheHint(options._objectCacheHint),
_buildKdTreesHint(options._buildKdTreesHint),
_pluginData(options._pluginData){}
_pluginData(options._pluginData),
_pluginStringData(options._pluginStringData){}
META_Object(osgDB,Options);
@@ -182,6 +183,26 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
/** Remove a value from the PluginData */
void removePluginData(const std::string& s) const { _pluginData.erase(s); }
/** Sets a plugindata value PluginData with a string */
void setPluginStringData(const std::string& s, const std::string& v) const { _pluginStringData[s] = v; }
/** Get a string from the PluginStrData */
std::string getPluginStringData(const std::string& s) { return _pluginStringData[s]; }
/** Get a value from the PluginData */
const std::string getPluginStringData(const std::string& s) const
{
PluginStringDataMap::const_iterator itr = _pluginStringData.find(s);
return (itr == _pluginStringData.end()) ? std::string("") : itr->second;
}
/** Remove a value from the PluginData */
void removePluginStringData(const std::string& s) const { _pluginStringData.erase(s); }
protected:
virtual ~Options() {}
@@ -194,6 +215,9 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
typedef std::map<std::string,void*> PluginDataMap;
mutable PluginDataMap _pluginData;
typedef std::map<std::string,std::string> PluginStringDataMap;
mutable PluginStringDataMap _pluginStringData;
};

View File

@@ -426,18 +426,21 @@ class OSGDB_EXPORT Registry : public osg::Referenced
* for that object in the cache to specified time.
* This would typically be called once per frame by applications which are doing database paging,
* and need to prune objects that are no longer required.
* Time value is time in seconds.*/
void updateTimeStampOfObjectsInCacheWithExternalReferences(double currentTime);
* The time used is taken from the FrameStamp::getReferenceTime().*/
void updateTimeStampOfObjectsInCacheWithExternalReferences(const osg::FrameStamp& frameStamp);
/** Removed object in the cache which have a time stamp at or before the specified expiry time.
* This would typically be called once per frame by applications which are doing database paging,
* and need to prune objects that are no longer required, and called after the a called
* after the call to updateTimeStampOfObjectsInCacheWithExternalReferences(currentTime).
* Note, the currentTime is not the expiryTime, one would typically set the expiry time
* to a fixed amount of time before currentTime, such as expiryTime = currentTime-10.0.
* Time value is time in seconds.*/
void removeExpiredObjectsInCache(double expiryTime);
* after the call to updateTimeStampOfObjectsInCacheWithExternalReferences(frameStamp).*/
void removeExpiredObjectsInCache(const osg::FrameStamp& frameStamp);
/** set hint to viewer code calling removeExpiredObjectsInCache to specify how long it should give before expiring objects in Registry cache,*/
void setExpiryDelay(double expiryDelay) { _expiryDelay = expiryDelay; }
double getExpiryDelay() const { return _expiryDelay; }
/** Remove all objects in the cache regardless of having external references or expiry times.*/
void clearObjectCache();
@@ -591,6 +594,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
FilePathList _dataFilePath;
FilePathList _libraryFilePath;
double _expiryDelay;
ObjectCache _objectCache;
OpenThreads::Mutex _objectCacheMutex;

View File

@@ -19,6 +19,8 @@
#include <osg/Quat>
#include <osg/observer_ptr>
#include <iterator>
namespace osgGA{
class OSGGA_EXPORT NodeTrackerManipulator : public MatrixManipulator

View File

@@ -224,7 +224,7 @@ namespace osgIntrospection
// returns the actual pointed type if applicable
virtual const Type* ptype() const { return 0; }
// returns whether the data is a null pointer
virtual bool nullptr() const = 0;
virtual bool isnullptr() const = 0;
Instance_base *inst_;
Instance_base *_ref_inst;
@@ -237,9 +237,9 @@ namespace osgIntrospection
{
Instance_box(): Instance_box_base(), nullptr_(false) {}
Instance_box(const T &d, bool nullptr = false)
Instance_box(const T &d, bool isnullptr = false)
: Instance_box_base(),
nullptr_(nullptr)
nullptr_(isnullptr)
{
Instance<T> *vl = new Instance<T>(d);
inst_ = vl;
@@ -267,7 +267,7 @@ namespace osgIntrospection
return &typeof(T);
}
virtual bool nullptr() const
virtual bool isnullptr() const
{
return nullptr_;
}
@@ -322,7 +322,7 @@ namespace osgIntrospection
return &typeofvalue(*static_cast<Instance<T> *>(inst_)->_data);
}
virtual bool nullptr() const
virtual bool isnullptr() const
{
return static_cast<Instance<T> *>(inst_)->_data == 0;
}
@@ -428,7 +428,7 @@ namespace osgIntrospection
inline bool Value::isNullPointer() const
{
return _inbox->nullptr();
return _inbox->isnullptr();
}
}

View File

@@ -39,11 +39,12 @@ class OSGVIEWER_EXPORT Scene : public osg::Referenced
osgDB::DatabasePager* getDatabasePager() { return _databasePager.get(); }
const osgDB::DatabasePager* getDatabasePager() const { return _databasePager.get(); }
void setImagePager(osgDB::ImagePager* ip);
osgDB::ImagePager* getImagePager() { return _imagePager.get(); }
const osgDB::ImagePager* getImagePager() const { return _imagePager.get(); }
void updateSceneGraph(osg::NodeVisitor& updateVisitor);
/** Get the Scene object that has the specified node assigned to it.
* return 0 if no Scene has yet been assigned the specified node.*/

View File

@@ -19,7 +19,7 @@
#ifndef OSGVIEWER_GRAPHICSWINDOWCARBON
#define OSGVIEWER_GRAPHICSWINDOWCARBON 1
#ifdef __APPLE__
#if defined (__APPLE__) && (!__LP64__)
#include <osgViewer/GraphicsWindow>
#include <Carbon/Carbon.h>
@@ -142,15 +142,14 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
// get the pixelformat
AGLPixelFormat getAGLPixelFormat() { return _pixelFormat; }
void adaptResize(int x, int y, int w, int h);
protected:
void init();
void transformMouseXY(float& x, float& y);
void transformMouseXY(float& x, float& y);
bool _valid;

View File

@@ -16,7 +16,7 @@
#ifndef OSGVIEWER_PIXELBUFFERCARBON
#define OSGVIEWER_PIXELBUFFERCARBON 1
#ifdef __APPLE__
#if defined (__APPLE__) && (!__LP64__)
#include <osg/GraphicsContext>
#include <osgViewer/Export>
@@ -34,12 +34,12 @@ class OSGVIEWER_EXPORT PixelBufferCarbon : public osg::GraphicsContext
PixelBufferCarbon(osg::GraphicsContext::Traits* traits):
_valid(false),
_initialized(false),
_initialized(false),
_realized(false),
_pixelformat(0),
_pixelformat(0),
_pbuffer(0),
_context(0)
{
{
_traits = traits;
init();
@@ -91,16 +91,16 @@ class OSGVIEWER_EXPORT PixelBufferCarbon : public osg::GraphicsContext
/** Swap the front and back buffers.*/
virtual void swapBuffersImplementation();
static AGLPixelFormat createPixelFormat(osg::GraphicsContext::Traits* traits);
AGLContext getAGLContext() { return _context; }
static AGLPixelFormat createPixelFormat(osg::GraphicsContext::Traits* traits);
AGLContext getAGLContext() { return _context; }
public:
protected:
~PixelBufferCarbon();
@@ -110,10 +110,10 @@ class OSGVIEWER_EXPORT PixelBufferCarbon : public osg::GraphicsContext
bool _valid;
bool _initialized;
bool _realized;
AGLPixelFormat _pixelformat;
AGLPbuffer _pbuffer;
AGLContext _context;
AGLPixelFormat _pixelformat;
AGLPbuffer _pbuffer;
AGLContext _context;
};

View File

@@ -0,0 +1,53 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-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.
*/
#ifndef OSGVIEWER_GRAPHICSHANDLECOCOA
#define OSGVIEWER_GRAPHICSHANDLECOCOA 1
#include <osgViewer/Export>
#ifdef __OBJC__
@class NSOpenGLContext;
#else
class NSOpenGLContext;
#endif
namespace osgViewer
{
/** Class to encapsulate platform-specific OpenGL context handle variables.
* Derived osg::GraphicsContext classes can inherit from this class to
* share OpenGL resources.*/
class OSGVIEWER_EXPORT GraphicsHandleCocoa
{
public:
GraphicsHandleCocoa():
_context(0) {}
/** Set native AGL graphics context.*/
inline void setNSOpenGLContext(NSOpenGLContext* context) { _context = context; }
/** Get native AGL graphics context.*/
inline NSOpenGLContext* getNSOpenGLContext() const { return _context; }
protected:
NSOpenGLContext* _context;
};
}
#endif

View File

@@ -0,0 +1,203 @@
/* -*-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.
*/
/* Note, elements of GraphicsWindowX11 have used Prodcer/RenderSurface_X11.cpp as both
* a guide to use of X11/GLX and copiying directly in the case of setBorder().
* These elements are license under OSGPL as above, with Copyright (C) 2001-2004 Don Burns.
*/
#ifndef OSGVIEWER_GRAPHICSWINDOWCOCOA
#define OSGVIEWER_GRAPHICSWINDOWCOCOA 1
#ifdef __APPLE__
#ifdef __OBJC__
@class GraphicsWindowCocoaWindow;
@class GraphicsWindowCocoaGLView;
@class NSOpenGLContext;
@class NSOpenGLPixelFormat;
@class NSWindow;
@class NSView;
#else
class GraphicsWindowCocoaGLView;
class GraphicsWindowCocoaWindow;
class NSOpenGLContext;
class NSOpenGLPixelFormat;
class NSWindow;
class NSView;
#endif
#include <osgViewer/GraphicsWindow>
#include <osgViewer/api/Cocoa/GraphicsHandleCocoa>
// we may not include any cocoa-header here, because this will pollute the name-sapce and tend to compile-errors
namespace osgViewer
{
class GraphicsWindowCocoa : public osgViewer::GraphicsWindow, public osgViewer::GraphicsHandleCocoa
{
public:
class Implementation;
GraphicsWindowCocoa(osg::GraphicsContext::Traits* traits):
osgViewer::GraphicsWindow(),
osgViewer::GraphicsHandleCocoa(),
_valid(false),
_initialized(false),
_realized(false),
_closeRequested(false),
_checkForEvents(true),
_ownsWindow(true),
_currentCursor(RightArrowCursor),
_window(NULL)
{
_traits = traits;
init();
if (valid())
{
setState( new osg::State );
getState()->setGraphicsContext(this);
if (_traits.valid() && _traits->sharedContext)
{
getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
incrementContextIDUsageCount( getState()->getContextID() );
}
else
{
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
}
}
}
virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const GraphicsWindowCocoa*>(object)!=0; }
virtual const char* libraryName() const { return "osgViewer"; }
virtual const char* className() const { return "GraphicsWindowCarbon"; }
virtual bool valid() const { return _valid; }
/** Realise the GraphicsContext.*/
virtual bool realizeImplementation();
/** Return true if the graphics context has been realised and is ready to use.*/
virtual bool isRealizedImplementation() const { return _realized; }
/** Close the graphics context.*/
virtual void closeImplementation();
/** Make this graphics context current.*/
virtual bool makeCurrentImplementation();
/** Release the graphics context.*/
virtual bool releaseContextImplementation();
/** Swap the front and back buffers.*/
virtual void swapBuffersImplementation();
/** Check to see if any events have been generated.*/
virtual void checkEvents();
/** Set Window decoration.*/
virtual bool setWindowDecorationImplementation(bool flag);
/** Get focus.*/
virtual void grabFocus();
/** Get focus on if the pointer is in this window.*/
virtual void grabFocusIfPointerInWindow();
bool requestClose() { bool b = _closeRequested; _closeRequested = true; return b; }
virtual void resizedImplementation(int x, int y, int width, int height);
virtual bool setWindowRectangleImplementation(int x, int y, int width, int height);
virtual void setWindowName (const std::string & name);
virtual void useCursor(bool cursorOn);
virtual void setCursor(MouseCursor mouseCursor);
/** WindowData is used to pass in the Cocoa window handle attached the GraphicsContext::Traits structure. */
class WindowData : public osg::Referenced
{
public:
enum Options { CreateOnlyView = 1, CheckForEvents = 2, PoseAsStandaloneApp = 4};
WindowData(unsigned int options)
: _createOnlyView(options & CreateOnlyView),
_checkForEvents(options & CheckForEvents),
_poseAsStandaloneApp(options & PoseAsStandaloneApp),
_view(NULL)
{
}
inline NSView* getCreatedNSView() { return _view; }
bool createOnlyView() const { return _createOnlyView; }
bool checkForEvents() const { return _checkForEvents; }
bool poseAsStandaloneApp() const { return _poseAsStandaloneApp; }
protected:
inline void setCreatedNSView(NSView* view) { _view = view; }
private:
bool _createOnlyView, _checkForEvents, _poseAsStandaloneApp;
NSView* _view;
friend class GraphicsWindowCocoa;
};
NSOpenGLContext* getContext() { return _context; }
GraphicsWindowCocoaWindow* getWindow() { return _window; }
NSOpenGLPixelFormat* getPixelFormat() { return _pixelformat; }
void setVSync(bool f);
/** adapts a resize / move of the window, coords in global screen space */
void adaptResize(int x, int y, int w, int h);
protected:
void init();
void transformMouseXY(float& x, float& y);
void setupNSWindow(NSWindow* win);
virtual ~GraphicsWindowCocoa();
bool _valid;
bool _initialized;
bool _realized;
bool _useWindowDecoration;
private:
bool _closeRequested, _checkForEvents,_ownsWindow;
MouseCursor _currentCursor;
GraphicsWindowCocoaWindow* _window;
GraphicsWindowCocoaGLView* _view;
NSOpenGLContext* _context;
NSOpenGLPixelFormat* _pixelformat;
bool _updateContext;
};
}
#endif
#endif

View File

@@ -0,0 +1,115 @@
/* -*-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 OSGVIEWER_PIXELBUFFERCOCOA
#define OSGVIEWER_PIXELBUFFERCOCOA 1
#ifdef __APPLE__
#include <osg/GraphicsContext>
#include <osgViewer/Export>
#include <osgViewer/api/Cocoa/GraphicsHandleCocoa>
namespace osgViewer
{
class OSGVIEWER_EXPORT PixelBufferCocoa : public osg::GraphicsContext, public osgViewer::GraphicsHandleCocoa
{
public:
struct Implementation;
PixelBufferCocoa(osg::GraphicsContext::Traits* traits):
osg::GraphicsContext(),
osgViewer::GraphicsHandleCocoa(),
_valid(false),
_initialized(false),
_realized(false),
_context(NULL)
{
_traits = traits;
init();
if (valid())
{
setState( new osg::State );
getState()->setGraphicsContext(this);
if (_traits.valid() && _traits->sharedContext)
{
getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
incrementContextIDUsageCount( getState()->getContextID() );
}
else
{
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
}
}
}
virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const PixelBufferCocoa*>(object)!=0; }
virtual const char* libraryName() const { return "osgViewer"; }
virtual const char* className() const { return "PixelBufferCarbon"; }
virtual bool valid() const { return _valid; }
/** Realise the GraphicsContext.*/
virtual bool realizeImplementation();
/** Return true if the graphics context has been realised and is ready to use.*/
virtual bool isRealizedImplementation() const { return _realized; }
/** Close the graphics context.*/
virtual void closeImplementation();
/** Make this graphics context current.*/
virtual bool makeCurrentImplementation();
/** Make this graphics context current with specified read context implementation. */
virtual bool makeContextCurrentImplementation(osg::GraphicsContext* readContext);
/** Release the graphics context.*/
virtual bool releaseContextImplementation();
/** Bind the graphics context to associated texture implementation.*/
virtual void bindPBufferToTextureImplementation( GLenum buffer );
/** Swap the front and back buffers.*/
virtual void swapBuffersImplementation();
NSOpenGLContext* getContext() { return _context; }
public:
protected:
~PixelBufferCocoa();
void init();
bool _valid;
bool _initialized;
bool _realized;
NSOpenGLContext* _context;
};
}
#endif
#endif

View File

@@ -30,6 +30,7 @@ ENDIF(OPENTHREADS_SONAMES)
SET(CMAKE_REQUIRED_LIBRARIES_SAFE "${CMAKE_REQUIRED_LIBRARIES}")
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
CHECK_FUNCTION_EXISTS(pthread_yield HAVE_PTHREAD_YIELD)
IF(HAVE_PTHREAD_YIELD)
ADD_DEFINITIONS(-DHAVE_PTHREAD_YIELD)
@@ -64,16 +65,33 @@ IF(HAVE_PTHREAD_GETCONCURRENCY)
ENDIF(HAVE_PTHREAD_GETCONCURRENCY)
CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP)
IF(HAVE_PTHREAD_SETAFFINITY_NP)
# double check that pthread_setaffinity_np is available as FreeBSD header doesn't contain required function
CHECK_CXX_SOURCE_COMPILES("
#include <pthread.h>
int main() {
cpu_set_t cpumask;
CPU_ZERO( &cpumask );
CPU_SET( 0, &cpumask );
pthread_setaffinity_np( pthread_self(), sizeof(cpumask), &cpumask);
return 0;
}" COMPILES_PTHREAD_SETAFFINITY_NP)
IF (NOT COMPILES_PTHREAD_SETAFFINITY_NP)
SET(HAVE_PTHREAD_SETAFFINITY_NP OFF)
ENDIF()
ENDIF()
IF(HAVE_PTHREAD_SETAFFINITY_NP)
ADD_DEFINITIONS(-DHAVE_PTHREAD_SETAFFINITY_NP)
ELSE(HAVE_PTHREAD_SETAFFINITY_NP)
CHECK_CXX_SOURCE_COMPILES("
#include <sched.h>
int main() {
cpu_set_t cpumask;
sched_setaffinity( 0, sizeof(cpumask), &cpumask );
return 0;
}" HAVE_THREE_PARAM_SCHED_SETAFFINITY)
#include <sched.h>
int main() {
cpu_set_t cpumask;
sched_setaffinity( 0, sizeof(cpumask), &cpumask );
return 0;
}" HAVE_THREE_PARAM_SCHED_SETAFFINITY)
IF(HAVE_THREE_PARAM_SCHED_SETAFFINITY)
ADD_DEFINITIONS(-DHAVE_THREE_PARAM_SCHED_SETAFFINITY)
ELSE(HAVE_THREE_PARAM_SCHED_SETAFFINITY)

30
src/osg/AudioStream.cpp Normal file
View File

@@ -0,0 +1,30 @@
/* -*-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.
*/
#include <osg/AudioStream>
using namespace osg;
AudioSink::AudioSink() :
_delay(0.0)
{
}
AudioStream::AudioStream()
{
}
AudioStream::AudioStream(const AudioStream& audio,const CopyOp& copyop):
osg::Object(audio, copyop)
{
}

View File

@@ -25,6 +25,7 @@ SET(LIB_PUBLIC_HEADERS
${HEADER_PATH}/ApplicationUsage
${HEADER_PATH}/ArgumentParser
${HEADER_PATH}/Array
${HEADER_PATH}/AudioStream
${HEADER_PATH}/AutoTransform
${HEADER_PATH}/Billboard
${HEADER_PATH}/BlendColor
@@ -137,6 +138,7 @@ SET(LIB_PUBLIC_HEADERS
${HEADER_PATH}/ShapeDrawable
${HEADER_PATH}/State
${HEADER_PATH}/StateAttribute
${HEADER_PATH}/StateAttributeCallback
${HEADER_PATH}/StateSet
${HEADER_PATH}/Stats
${HEADER_PATH}/Stencil
@@ -193,6 +195,7 @@ ADD_LIBRARY(${LIB_NAME}
ApplicationUsage.cpp
ArgumentParser.cpp
Array.cpp
AudioStream.cpp
AutoTransform.cpp
Billboard.cpp
BlendColor.cpp

View File

@@ -18,6 +18,7 @@
#include <osg/Array>
#include <osg/PrimitiveSet>
#include <osg/Shape>
#include <osg/StateAttribute>
using namespace osg;
@@ -65,3 +66,37 @@ StateAttribute* CopyOp::operator() (const StateAttribute* attr) const
}
NodeCallback* CopyOp::operator() (const NodeCallback* nc) const
{
if (nc && _flags&DEEP_COPY_CALLBACKS)
{
// deep copy the full chain of callback
osg::NodeCallback* first = dynamic_cast<osg::NodeCallback*>(nc->clone(*this));
first->setNestedCallback(0);
nc = nc->getNestedCallback();
while (nc)
{
osg::NodeCallback* ucb = dynamic_cast<osg::NodeCallback*>(nc->clone(*this));
ucb->setNestedCallback(0);
first->addNestedCallback(ucb);
nc = nc->getNestedCallback();
}
return first;
}
else
return const_cast<NodeCallback*>(nc);
}
StateAttributeCallback* CopyOp::operator() (const StateAttributeCallback* sc) const
{
if (sc && _flags&DEEP_COPY_CALLBACKS)
{
// deep copy the full chain of callback
StateAttributeCallback* cb = dynamic_cast<StateAttributeCallback*>(sc->clone(*this));
return cb;
}
else
return const_cast<StateAttributeCallback*>(sc);
}

View File

@@ -31,6 +31,7 @@
#include <map>
#include <sstream>
#include <algorithm>
#include <iterator>
using namespace osg;

View File

@@ -33,23 +33,21 @@ using namespace osg;
using namespace std;
Image::Image()
:Object(true)
:Object(true),
_fileName(""),
_writeHint(NO_PREFERENCE),
_origin(BOTTOM_LEFT),
_s(0), _t(0), _r(0),
_internalTextureFormat(0),
_pixelFormat(0),
_dataType(0),
_packing(4),
_pixelAspectRatio(1.0),
_allocationMode(USE_NEW_DELETE),
_data(0L),
_modifiedCount(0)
{
setDataVariance(STATIC);
_fileName = "";
_writeHint = NO_PREFERENCE;
_origin = BOTTOM_LEFT;
_s = _t = _r = 0;
_internalTextureFormat = 0;
_pixelFormat = (unsigned int)0;
_dataType = (unsigned int)0;
_packing = 4;
_allocationMode = USE_NEW_DELETE;
_data = (unsigned char *)0L;
_modifiedCount = 0;
}
Image::Image(const Image& image,const CopyOp& copyop):
@@ -62,6 +60,7 @@ Image::Image(const Image& image,const CopyOp& copyop):
_pixelFormat(image._pixelFormat),
_dataType(image._dataType),
_packing(image._packing),
_pixelAspectRatio(image._pixelAspectRatio),
_data(0L),
_modifiedCount(image._modifiedCount),
_mipmapData(image._mipmapData)

View File

@@ -32,7 +32,8 @@ ImageStream::ImageStream():
ImageStream::ImageStream(const ImageStream& image,const CopyOp& copyop):
Image(image,copyop),
_status(image._status),
_loopingMode(image._loopingMode)
_loopingMode(image._loopingMode),
_audioStreams(image._audioStreams)
{
}

View File

@@ -74,10 +74,10 @@ Node::Node(const Node& node,const CopyOp& copyop):
_boundingSphere(node._boundingSphere),
_boundingSphereComputed(node._boundingSphereComputed),
_parents(), // leave empty as parentList is managed by Group.
_updateCallback(node._updateCallback),
_updateCallback(copyop(node._updateCallback.get())),
_numChildrenRequiringUpdateTraversal(0), // assume no children yet.
_numChildrenRequiringEventTraversal(0), // assume no children yet.
_cullCallback(node._cullCallback),
_cullCallback(copyop(node._cullCallback.get())),
_cullingActive(node._cullingActive),
_numChildrenWithCullingDisabled(0), // assume no children yet.
_numChildrenWithOccluderNodes(0),

View File

@@ -527,8 +527,6 @@ OcclusionQueryNode::OcclusionQueryNode()
_queryFrameCount( 5 ),
_debugBB( false )
{
setDataVariance( osg::Object::DYNAMIC );
// OQN has two Geode member variables, one for doing the
// query and one for rendering the debug geometry.
// Create and initialize them.
@@ -554,29 +552,49 @@ OcclusionQueryNode::OcclusionQueryNode( const OcclusionQueryNode& oqn, const osg
bool
OcclusionQueryNode::getPassed( const osg::Camera* camera, float distanceToEyePoint )
OcclusionQueryNode::getPassed( const osg::Camera* camera, osg::NodeVisitor& nv )
{
if ( !_enabled )
// Queries are not enabled. The caller should be osgUtil::CullVisitor,
// return true to traverse the subgraphs.
return true;
// In the future, we could hold a reference directly to the QueryDrawable
// to avoid the dynamic_cast.
QueryGeometry* qg = dynamic_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) );
if (qg == NULL)
{
// Two situations where we want to simply do a regular traversal:
// 1) it's the first frame for this camers
// 2) we haven't rendered for an abnormally long time (probably because we're an out-of-range LOD child)
// In these cases, assume we're visible to avoid blinking.
OpenThreads::ScopedLock<OpenThreads::Mutex> lock( _frameCountMutex );
const int& lastQueryFrame( _frameCountMap[ camera ] );
if( ( lastQueryFrame == 0 ) ||
( (nv.getTraversalNumber() - lastQueryFrame) > (_queryFrameCount + 1) ) )
return true;
}
if (_queryGeode->getDrawable( 0 ) == NULL)
{
osg::notify( osg::FATAL ) <<
"osgOQ: OcclusionQueryNode: No QueryGeometry." << std::endl;
// Something's broke. Return true so we at least render correctly.
return true;
}
QueryGeometry* qg = static_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) );
// If the distance to the bounding sphere shell is positive, retrieve
// the results. Others (we're inside the BS shell) we are considered
// Get the near plane for the upcoming distance calculation.
float nearPlane;
const osg::Matrix& proj( camera->getProjectionMatrix() );
if( ( proj(3,3) != 1. ) || ( proj(2,3) != 0. ) || ( proj(1,3) != 0. ) || ( proj(0,3) != 0.) )
nearPlane = proj(3,2) / (proj(2,2)-1.); // frustum / perspective
else
nearPlane = (proj(3,2)+1.) / proj(2,2); // ortho
// If the distance from the near plane to the bounding sphere shell is positive, retrieve
// the results. Otherwise (near plane inside the BS shell) we are considered
// to have passed and don't need to retrieve the query.
const osg::BoundingSphere& bs = getBound();
float distance = distanceToEyePoint - bs._radius;
float distanceToEyePoint = nv.getDistanceToEyePoint( bs._center, false );
float distance = distanceToEyePoint - nearPlane - bs._radius;
_passed = ( distance <= 0.f );
if (!_passed)
{
@@ -641,10 +659,10 @@ OcclusionQueryNode::computeBound() const
(*v)[6] = osg::Vec3( bb._min.x(), bb._max.y(), bb._max.z() );
(*v)[7] = osg::Vec3( bb._max.x(), bb._max.y(), bb._max.z() );
osg::Geometry* geom = dynamic_cast< osg::Geometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) );
osg::Geometry* geom = static_cast< osg::Geometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) );
geom->setVertexArray( v.get() );
geom = dynamic_cast< osg::Geometry* >( nonConstThis->_debugGeode->getDrawable( 0 ) );
geom = static_cast< osg::Geometry* >( nonConstThis->_debugGeode->getDrawable( 0 ) );
geom->setVertexArray( v.get() );
}
@@ -798,10 +816,13 @@ OcclusionQueryNode::createSupportNodes()
void
OcclusionQueryNode::releaseGLObjects( osg::State* state ) const
{
// Query object discard and deletion is handled by QueryGeometry support class.
OcclusionQueryNode* nonConstThis = const_cast< OcclusionQueryNode* >( this );
QueryGeometry* qg = dynamic_cast< QueryGeometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) );
qg->releaseGLObjects( state );
if(_queryGeode->getDrawable( 0 ) != NULL)
{
// Query object discard and deletion is handled by QueryGeometry support class.
OcclusionQueryNode* nonConstThis = const_cast< OcclusionQueryNode* >( this );
QueryGeometry* qg = static_cast< QueryGeometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) );
qg->releaseGLObjects( state );
}
}
void

View File

@@ -42,7 +42,7 @@ void StateAttribute::removeParent(osg::StateSet* object)
}
void StateAttribute::setUpdateCallback(Callback* uc)
void StateAttribute::setUpdateCallback(StateAttributeCallback* uc)
{
osg::notify(osg::INFO)<<"StateAttribute::Setting Update callbacks"<<std::endl;
@@ -69,7 +69,7 @@ void StateAttribute::setUpdateCallback(Callback* uc)
}
}
void StateAttribute::setEventCallback(Callback* ec)
void StateAttribute::setEventCallback(StateAttributeCallback* ec)
{
osg::notify(osg::INFO)<<"StateAttribute::Setting Event callbacks"<<std::endl;

View File

@@ -1671,7 +1671,7 @@ void StateSet::runUpdateCallbacks(osg::NodeVisitor* nv)
itr!=_attributeList.end();
++itr)
{
StateAttribute::Callback* callback = itr->second.first->getUpdateCallback();
StateAttributeCallback* callback = itr->second.first->getUpdateCallback();
if (callback) (*callback)(itr->second.first.get(),nv);
}
@@ -1684,7 +1684,7 @@ void StateSet::runUpdateCallbacks(osg::NodeVisitor* nv)
itr!=attributeList.end();
++itr)
{
StateAttribute::Callback* callback = itr->second.first->getUpdateCallback();
StateAttributeCallback* callback = itr->second.first->getUpdateCallback();
if (callback) (*callback)(itr->second.first.get(),nv);
}
}
@@ -1745,7 +1745,7 @@ void StateSet::runEventCallbacks(osg::NodeVisitor* nv)
itr!=_attributeList.end();
++itr)
{
StateAttribute::Callback* callback = itr->second.first->getEventCallback();
StateAttributeCallback* callback = itr->second.first->getEventCallback();
if (callback) (*callback)(itr->second.first.get(),nv);
}
@@ -1758,7 +1758,7 @@ void StateSet::runEventCallbacks(osg::NodeVisitor* nv)
itr!=attributeList.end();
++itr)
{
StateAttribute::Callback* callback = itr->second.first->getEventCallback();
StateAttributeCallback* callback = itr->second.first->getEventCallback();
if (callback) (*callback)(itr->second.first.get(),nv);
}
}

Some files were not shown because too many files have changed in this diff Show More