You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(30) |
Oct
(60) |
Nov
(17) |
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(33) |
Feb
(18) |
Mar
(3) |
Apr
(5) |
May
(6) |
Jun
(34) |
Jul
(54) |
Aug
(33) |
Sep
(36) |
Oct
(33) |
Nov
(40) |
Dec
(6) |
2009 |
Jan
(37) |
Feb
(38) |
Mar
(31) |
Apr
(23) |
May
(24) |
Jun
(2) |
Jul
(6) |
Aug
(5) |
Sep
(1) |
Oct
(14) |
Nov
(12) |
Dec
(26) |
2010 |
Jan
(23) |
Feb
(17) |
Mar
(17) |
Apr
(2) |
May
(10) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(2) |
2011 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
From: <and...@us...> - 2008-01-18 05:56:06
|
Revision: 555 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=555&view=rev Author: andy_miller Date: 2008-01-17 21:56:11 -0800 (Thu, 17 Jan 2008) Log Message: ----------- More OgreNewt fixes Modified Paths: -------------- trunk/python-ogre/environment.py Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-01-18 05:50:51 UTC (rev 554) +++ trunk/python-ogre/environment.py 2008-01-18 05:56:11 UTC (rev 555) @@ -624,11 +624,11 @@ ] baseDir = os.path.join(os.getcwd(), base ) buildCmds = [ - #[0, "patch -s -N -i ../../python-ogre/patch/ogrenewt.patch -p0", baseDir], + [0, "patch -s -N -i ../../python-ogre/patch/ogrenewt.patch -p0", baseDir], #[0, "cp SConscript OgreNewt_Main", baseDir], #[0, "rm SConscript", baseDir], [0, "rm -r ./OgreNewt_Main/inc/boost", baseDir], - [0, "scons prefix=%s boost=%s/include/boost-1_34_1" % (PREFIX, PREFIX), baseDir], ##WARNING -- boost include dir name is different than build name (dash not underscore) + [0, "scons prefix=%s boost=%s/include/boost-1_34_1 install" % (PREFIX, PREFIX), baseDir], ##WARNING -- boost include dir name is different than build name (dash not underscore) ] include_dirs = [Config.PATH_Boost This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-18 05:50:46
|
Revision: 554 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=554&view=rev Author: andy_miller Date: 2008-01-17 21:50:51 -0800 (Thu, 17 Jan 2008) Log Message: ----------- Fix for OgreNewt building -- the boost include dir name was wrong -- also change to run gccxml from the installed directory Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_posix.py trunk/python-ogre/environment.py Modified: trunk/python-ogre/PythonOgreConfig_posix.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_posix.py 2008-01-16 13:00:40 UTC (rev 553) +++ trunk/python-ogre/PythonOgreConfig_posix.py 2008-01-18 05:50:51 UTC (rev 554) @@ -27,6 +27,7 @@ # We need to know where to find gccxml...... gccxml_bin = os.path.join(BASE_DIR,'gccxml-build/bin') +gccxml_bin = os.path.join(ROOT_DIR,'bin') # and the Py++ directory as sometimes we need access to the code repository there pyplusplus_install_dir = os.path.join(BASE_DIR,'pygccxml') Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-01-16 13:00:40 UTC (rev 553) +++ trunk/python-ogre/environment.py 2008-01-18 05:50:51 UTC (rev 554) @@ -624,11 +624,11 @@ ] baseDir = os.path.join(os.getcwd(), base ) buildCmds = [ - [0, "patch -s -N -i ../../python-ogre/patch/ogrenewt.patch -p0", baseDir], - [0, "cp SConscript OgreNewt_Main", baseDir], + #[0, "patch -s -N -i ../../python-ogre/patch/ogrenewt.patch -p0", baseDir], + #[0, "cp SConscript OgreNewt_Main", baseDir], #[0, "rm SConscript", baseDir], [0, "rm -r ./OgreNewt_Main/inc/boost", baseDir], - [0, "scons prefix=%s boost=%s/include/%s install" % (PREFIX, PREFIX, boost.base), baseDir], + [0, "scons prefix=%s boost=%s/include/boost-1_34_1" % (PREFIX, PREFIX), baseDir], ##WARNING -- boost include dir name is different than build name (dash not underscore) ] include_dirs = [Config.PATH_Boost This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-16 13:00:36
|
Revision: 553 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=553&view=rev Author: andy_miller Date: 2008-01-16 05:00:40 -0800 (Wed, 16 Jan 2008) Log Message: ----------- NxOgre Updates Modified Paths: -------------- trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.h trunk/python-ogre/ThirdParty/nxogre/NxOgrePose.h trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceStreamPtr.h Modified: trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.cpp =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.cpp 2008-01-16 05:43:04 UTC (rev 552) +++ trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.cpp 2008-01-16 13:00:40 UTC (rev 553) @@ -30,14 +30,14 @@ ////////////////////////////////////////////////////////////////////////////////// -inline NxExtendedVec3 toNxExtendedVec3(const Ogre::Vector3& v) { +NxExtendedVec3 toNxExtendedVec3(const Ogre::Vector3& v) { return NxExtendedVec3(v.x,v.y,v.z); } ////////////////////////////////////////////////////////////////////////////////// // Generates a 8 digit ID, based on groupCount and type of object (typeHash) -inline NxString NxCreateID(unsigned int groupCount, NxString typeHash) { +NxString NxCreateID(unsigned int groupCount, NxString typeHash) { std::stringstream ss; ss << typeHash << "-" << std::hex << (rand() % 1024) << "-" << groupCount; return ss.str(); @@ -45,7 +45,7 @@ ////////////////////////////////////////////////////////////////////////////////// -inline NxMat33 toNxMat33(const Ogre::Matrix3& matrix) { +NxMat33 toNxMat33(const Ogre::Matrix3& matrix) { NxReal* c = new NxReal[9]; c[0] = matrix[0][0]; c[1] = matrix[1][0]; c[2] = matrix[2][0]; @@ -63,7 +63,7 @@ ////////////////////////////////////////////////////////////////////////////////// -inline NxMat34 toNxMat34(const Ogre::Matrix4& matrix) { +NxMat34 toNxMat34(const Ogre::Matrix4& matrix) { NxUnderConstruction; @@ -156,10 +156,10 @@ std::stringstream stream; stream << quat.w << " " << quat.x << " " << quat.y << " " << quat.z; return stream.str(); -} +} //////////////////////////////////////////////////////////////// - + template <typename Type> Type NxFromString(const NxString& string) { @@ -167,8 +167,8 @@ Type val = 0; str >> val; return val; -} - +} + //////////////////////////////////////////////////////////////// template <> @@ -206,7 +206,7 @@ return quaternion; -} +} //////////////////////////////////////////////////////////////// @@ -273,9 +273,9 @@ } //////////////////////////////////////////////////////////////// - -inline Pose NxInterpolate(Pose First, Pose Second, NxReal c) { +Pose NxInterpolate(Pose First, Pose Second, NxReal c) { + Pose r; r.v.x = First.v.x * (1 - c) + Second.v.x * c; @@ -287,5 +287,5 @@ } //////////////////////////////////////////////////////////////// - -}; //End of NxOgre namespace. + +}; //End of NxOgre namespace. Modified: trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.h =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.h 2008-01-16 05:43:04 UTC (rev 552) +++ trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.h 2008-01-16 13:00:40 UTC (rev 553) @@ -87,18 +87,18 @@ @result The rotated vector */ NxVec3 NxExport operator* (const NxQuat&, const NxVec3&); - - - // To Strings - - /** @brief Generic class/integral to String. - @note Uses STL stringstream for conversion. - @example - <code> - NxString str = NxToString<float>(1.2345f); - </code> - @result The converted string - */ + + + // To Strings + + /** @brief Generic class/integral to String. + @note Uses STL stringstream for conversion. + @example + <code> + NxString str = NxToString<float>(1.2345f); + </code> + @result The converted string + */ template <typename Type> NxString NxExport NxToString(const Type& type); @@ -281,8 +281,8 @@ /** @brief Interpolates */ - inline Pose NxExport NxInterpolate(Pose First, Pose Second, NxReal c = 0.5f); + Pose NxExport NxInterpolate(Pose First, Pose Second, NxReal c = 0.5f); }; -#endif +#endif Modified: trunk/python-ogre/ThirdParty/nxogre/NxOgrePose.h =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/NxOgrePose.h 2008-01-16 05:43:04 UTC (rev 552) +++ trunk/python-ogre/ThirdParty/nxogre/NxOgrePose.h 2008-01-16 13:00:40 UTC (rev 553) @@ -52,12 +52,12 @@ void fromMat33(const NxMat33&); NxMat33 toMat33() const; - inline Ogre::Vector3 getVector3() const; - inline NxVec3 getVec3() const; - inline Ogre::Quaternion getQuaternion() const; - inline NxQuat getQuat() const; + Ogre::Vector3 getVector3() const; + NxVec3 getVec3() const; + Ogre::Quaternion getQuaternion() const; + NxQuat getQuat() const; - inline NxString toString() const; + NxString toString() const; //////////////////////////////////////////////////////////////////////////////// @@ -100,4 +100,4 @@ }; -#endif +#endif Modified: trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceStreamPtr.h =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceStreamPtr.h 2008-01-16 05:43:04 UTC (rev 552) +++ trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceStreamPtr.h 2008-01-16 13:00:40 UTC (rev 553) @@ -50,7 +50,7 @@ ResourceStreamPtr(); ResourceStreamPtr(ResourceIdentifier); - ResourceStreamPtr(ResourceIdentifier, void*); + //ResourceStreamPtr(ResourceIdentifier, void*); ResourceStreamPtr(const ResourceStreamPtr& r) : pStream(0), pUseCount(0) @@ -172,4 +172,4 @@ }; // End of namespace -#endif +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-16 05:42:59
|
Revision: 552 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=552&view=rev Author: andy_miller Date: 2008-01-15 21:43:04 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Support for dual NxOgre versions Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/PythonOgreConfig_posix.py trunk/python-ogre/code_generators/nxogre_09/generate_code.py trunk/python-ogre/demos/ogre/Demo_BSP.py trunk/python-ogre/demos/ogre/SampleLoadingBar.py trunk/python-ogre/demos/ogre/quake3settings.cfg trunk/python-ogre/environment.py trunk/python-ogre/setup.py Removed Paths: ------------- trunk/python-ogre/ThirdParty/nxogre/FireState.cpp trunk/python-ogre/ThirdParty/nxogre/FireState.h Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-01-16 05:43:04 UTC (rev 552) @@ -54,8 +54,8 @@ PATH_et = os.path.join(PATH_THIRDPARTY, 'et') PATH_caelum = os.path.join(PATH_THIRDPARTY, 'caelum') PATH_NxOgre= os.path.join(PATH_THIRDPARTY, 'nxogre') +PATH_NxOgre_09= os.path.join(PATH_THIRDPARTY, 'nxogre_0.9') PATH_watermesh= os.path.join(PATH_THIRDPARTY, 'watermesh') -# PATH_NxOgre= os.path.join(BASE_DIR, 'nxogre/NxOgre') PATH_noise= os.path.join(PATH_THIRDPARTY, 'noise') PATH_ofusion= os.path.join(PATH_THIRDPARTY, 'ofusion') PATH_cadunetree= os.path.join(PATH_THIRDPARTY, 'cadunetree') @@ -140,6 +140,7 @@ PATH_INCLUDE_Ogre_CEGUIRenderer = os.path.join( PATH_Ogre, 'samples/Common/CEGUIRenderer/include') PATH_INCLUDE_quickgui = PATH_quickgui PATH_INCLUDE_NxOgre= PATH_NxOgre +PATH_INCLUDE_NxOgre_09= PATH_NxOgre_09 # PATH_INCLUDE_NxOgre= os.path.join(PATH_NxOgre, 'include') PATH_INCLUDE_Bullet= os.path.join(PATH_Bullet, 'src') PATH_INCLUDE_freetype= os.path.join(PATH_INCLUDE_quickgui,'FreeType2.3.5') Modified: trunk/python-ogre/PythonOgreConfig_posix.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_posix.py 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/PythonOgreConfig_posix.py 2008-01-16 05:43:04 UTC (rev 552) @@ -67,6 +67,7 @@ PATH_ofusion= os.path.join(PATH_THIRDPARTY, 'ofusion') PATH_ogrevideoffmpeg = os.path.join(PATH_THIRDPARTY,'ffmpeg') PATH_NxOgre= os.path.join(PATH_THIRDPARTY, 'nxogre') +PATH_NxOgre_09= os.path.join(PATH_THIRDPARTY, 'nxogre_0.9') # PATH_NxOgre= os.path.join(BASE_DIR, 'nxogre/NxOgre') PATH_Bullet= os.path.join(BASE_DIR, 'bullet-2.64') ###PATH_PhysX= os.path.join(BASE_DIR, 'Physx/v2.7.3/SDKs') @@ -149,6 +150,7 @@ PATH_INCLUDE_Ogre_CEGUIRenderer = os.path.join( PATH_Ogre, 'Samples/Common/CEGUIRenderer/include') PATH_INCLUDE_quickgui = PATH_quickgui PATH_INCLUDE_NxOgre= PATH_NxOgre +PATH_INCLUDE_NxOgre_09= PATH_NxOgre_09 # PATH_INCLUDE_NxOgre= os.path.join(PATH_NxOgre, 'include') PATH_INCLUDE_Bullet = os.path.join( PATH_Bullet, 'src') PATH_INCLUDE_betagui = PATH_betagui Deleted: trunk/python-ogre/ThirdParty/nxogre/FireState.cpp =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/FireState.cpp 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/ThirdParty/nxogre/FireState.cpp 2008-01-16 05:43:04 UTC (rev 552) @@ -1 +0,0 @@ -// FireState Deleted: trunk/python-ogre/ThirdParty/nxogre/FireState.h =================================================================== Modified: trunk/python-ogre/code_generators/nxogre_09/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/nxogre_09/generate_code.py 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/code_generators/nxogre_09/generate_code.py 2008-01-16 05:43:04 UTC (rev 552) @@ -631,8 +631,8 @@ # NOTE: If you update the source library code you need to manually delete the cache .XML file # xml_cached_fc = parser.create_cached_source_fc( - os.path.join( environment.nxogre_0.9.root_dir, "python_nxogre.h" ) - , environment.nxogre_0.9.cache_file ) + os.path.join( environment.nxogre_09.root_dir, "python_nxogre.h" ) + , environment.nxogre_09.cache_file ) if os.name == 'nt': defined_symbols = [ 'NxExport','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32', 'GCC_XML']#NXOGRE_EXPORTS' else: @@ -641,7 +641,7 @@ if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') - defined_symbols.append( 'VERSION_' + environment.nxogre_0.9.version ) + defined_symbols.append( 'VERSION_' + environment.nxogre_09.version ) undefined_symbols = [] # @@ -650,7 +650,7 @@ mb = module_builder.module_builder_t( [ xml_cached_fc ] , gccxml_path=environment.gccxml_bin , working_directory=environment.root_dir - , include_paths=environment.nxogre_0.9.include_dirs + , include_paths=environment.nxogre_09.include_dirs , define_symbols=defined_symbols # # , undefine_symbols = undefined_symbols , indexing_suite_version=2 @@ -717,7 +717,7 @@ if cls.name not in NoPropClasses: cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) - common_utils.add_constants( mb, { 'PROJECT_version' : '"%s"' % environment.nxogre_0.9.version.replace("\n", "\\\n") + common_utils.add_constants( mb, { 'PROJECT_version' : '"%s"' % environment.nxogre_09.version.replace("\n", "\\\n") , 'python_version' : '"%s"' % sys.version.replace("\n", "\\\n" ) } ) ## need to create a welcome doc string for this... @@ -730,21 +730,21 @@ # ########################################################################################## extractor = exdoc.doc_extractor("") # I'm excluding the UTFstring docs as lots about nothing - mb.build_code_creator (module_name='_nxogre_0.9_' , doc_extractor= extractor ) + mb.build_code_creator (module_name='_nxogre_09_' , doc_extractor= extractor ) - for inc in environment.nxogre_0.9.include_dirs: + for inc in environment.nxogre_09.include_dirs: mb.code_creator.user_defined_directories.append(inc ) - mb.code_creator.user_defined_directories.append( environment.nxogre_0.9.generated_dir ) - mb.code_creator.replace_included_headers( customization_data.header_files( environment.nxogre_0.9.version ) ) + mb.code_creator.user_defined_directories.append( environment.nxogre_09.generated_dir ) + mb.code_creator.replace_included_headers( customization_data.header_files( environment.nxogre_09.version ) ) - huge_classes = map( mb.class_, customization_data.huge_classes( environment.nxogre_0.9.version ) ) + huge_classes = map( mb.class_, customization_data.huge_classes( environment.nxogre_09.version ) ) - mb.split_module(environment.nxogre_0.9.generated_dir, huge_classes,use_files_sum_repository=False) + mb.split_module(environment.nxogre_09.generated_dir, huge_classes,use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generaated directory.. - common_utils.copyTree ( sourcePath = environment.Config.PATH_NxOgre_0.9, - destPath = environment.nxogre_0.9.generated_dir, + common_utils.copyTree ( sourcePath = environment.Config.PATH_NxOgre_09, + destPath = environment.nxogre_09.generated_dir, recursive=False ) if __name__ == '__main__': Modified: trunk/python-ogre/demos/ogre/Demo_BSP.py =================================================================== --- trunk/python-ogre/demos/ogre/Demo_BSP.py 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/demos/ogre/Demo_BSP.py 2008-01-16 05:43:04 UTC (rev 552) @@ -55,12 +55,12 @@ cf.load("quake3settings.cfg") - self.mQuakePk3 = cf.getSetting("Pak0Location") + self.mQuakePk3 = cf.getSetting("Pak1Location") self.mQuakeLevel = cf.getSetting("Map") sf.Application._setUpResources(self) ogre.ResourceGroupManager.getSingleton().addResourceLocation( - self.mQuakePk3, "Zip", ogre.ResourceGroupManager.getSingleton().getWorldResourceGroupName()) + self.mQuakePk3, "FileSystem", 'General') #ogre.ResourceGroupManager.getSingleton().getWorldResourceGroupName()) # Override scene manager (use indoor instead of generic) def _chooseSceneManager(self): Modified: trunk/python-ogre/demos/ogre/SampleLoadingBar.py =================================================================== --- trunk/python-ogre/demos/ogre/SampleLoadingBar.py 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/demos/ogre/SampleLoadingBar.py 2008-01-16 05:43:04 UTC (rev 552) @@ -38,6 +38,7 @@ # */ def __init__ ( self ): ogre.ResourceGroupListener.__init__(self) + def start(self, window,numGroupsInit = 1, numGroupsLoad = 1,initProportion = 0.70): self.mWindow = window self.mNumGroupsInit = numGroupsInit @@ -82,7 +83,7 @@ # Lets assume script loading is 70% self.mProgressBarInc = self.mProgressBarMaxSize * self.mInitProportion / scriptCount self.mProgressBarInc /= self.mNumGroupsInit - self.mLoadingDescriptionElement.setCaption(ogre.UTFString("Parsing scripts...")) + self.mLoadingDescriptionElement.setCaption(ogre.UTFString("Parsing scripts..")) self.mWindow.update() def scriptParseStarted(self, scriptName): @@ -104,13 +105,15 @@ pass def resourceGroupLoadStarted(self, groupName, resourceCount): + ogre.LogManager.getSingleton().logMessage("GroupLoadStarted " + groupName ) if self.mNumGroupsLoad >0 : self.mProgressBarInc = self.mProgressBarMaxSize * (1-self.mInitProportion) / resourceCount self.mProgressBarInc /= self.mNumGroupsLoad - self.mLoadingDescriptionElement.setCaption(ogre.UTFString("Loading resources...")) + self.mLoadingDescriptionElement.setCaption(ogre.UTFString("Loading resources..")) self.mWindow.update() def resourceLoadStarted(self, resource): + ogre.LogManager.getSingleton().logMessage("GroupLoadEnded" ) self.mLoadingCommentElement.setCaption(ogre.UTFString(resource.getName())) self.mWindow.update() @@ -118,10 +121,12 @@ pass def worldGeometryStageStarted(self, description): + ogre.LogManager.getSingleton().logMessage("StageStarted " + description ) self.mLoadingCommentElement.setCaption(ogre.UTFString(description)) self.mWindow.update() def worldGeometryStageEnded(self): + ogre.LogManager.getSingleton().logMessage("StageEnded") self.mLoadingBarElement.setWidth( self.mLoadingBarElement.getWidth() + self.mProgressBarInc) self.mWindow.update() Modified: trunk/python-ogre/demos/ogre/quake3settings.cfg =================================================================== --- trunk/python-ogre/demos/ogre/quake3settings.cfg 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/demos/ogre/quake3settings.cfg 2008-01-16 05:43:04 UTC (rev 552) @@ -1,3 +1,5 @@ -Pak0Location: ../media/packs/ogretestmap.zip +#Pak0Location: ../media/packs/ogretestmap.zip #Map: maps/q3dm3.bsp -Map: ogretestmap.bsp +#Map: ogretestmap.bsp +Pak1Location: c:/temp/ww +Map: maps/wamphi1.bsp Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/environment.py 2008-01-16 05:43:04 UTC (rev 552) @@ -957,7 +957,36 @@ libs=[ Config.LIB_Boost, 'NxCharacter', 'NxCooking', 'PhysXCore','PhysXLoader','OgreMain' ] ModuleName="NxOgre" +class nxogre_09: + active = True + pythonModule = True + version="0.9" + name='nxogre_09' + parent="ogre/physics" + cflags="" + include_dirs = [ Config.PATH_Boost, + Config.PATH_INCLUDE_Ogre, + Config.PATH_INCLUDE_NxOgre, + ] + for d in Config.PATH_INCLUDE_PhysX: + include_dirs.append( d ) + if os.name == 'nt': + CCFLAGS = ' -DWIN32 -DNxExport="" ' + + else: + CCFLAGS = ' -DNX_LINUX -DLINUX -DNX_DISABLE_FLUIDS ' + lib_dirs = [Config.PATH_LIB_Boost, + Config.PATH_LIB_Ogre_OgreMain, + Config.PATH_LIB_PhysX + ] + CheckIncludes=[] + if os.name =='nt': + libs=[ Config.LIB_Boost, 'NxCharacter', 'NxCooking', 'NxExtensions', 'PhysXLoader','OgreMain' ] + else: + libs=[ Config.LIB_Boost, 'NxCharacter', 'NxCooking', 'PhysXCore','PhysXLoader','OgreMain' ] + ModuleName="NxOgre_09" + class theora: active = True pythonModule = True @@ -1081,7 +1110,7 @@ [0, "tar zxf " + os.path.join(downloadPath, "libogg-1.1.3.tar.gz"), ''], [0, "tar zxf " + os.path.join(downloadPath, "libvorbis-1.2.0.tar.gz"), ''], [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libogg-1.1.3")], - [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libvorbis-1.2.0")], + [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libvorbis-1.2.0")], [0, "sed --in-place -s 's|( ALCvoid )|()|' alc.h",os.path.join(os.getcwd(),"openal-0.0.8","common", "include", "AL")], [0, "aclocal\n./autogen.sh", os.path.join(os.getcwd(),"openal-0.0.8")], [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "openal-0.0.8")] @@ -1334,6 +1363,7 @@ , 'quickgui' : quickgui , 'opcode' : opcode , 'nxogre' : nxogre + , 'nxogre_09' : nxogre_09 , 'bullet' : bullet , 'physx' : physx , 'betagui': betagui Modified: trunk/python-ogre/setup.py =================================================================== --- trunk/python-ogre/setup.py 2008-01-16 05:33:53 UTC (rev 551) +++ trunk/python-ogre/setup.py 2008-01-16 05:43:04 UTC (rev 552) @@ -64,7 +64,7 @@ 'ogre.sound', 'ogre.sound.OgreAL', 'ogre.physics', 'ogre.physics.ODE', 'ogre.physics.OgreRefApp', 'ogre.physics.OgreOde', 'ogre.physics.OgreNewt', 'ogre.physics.Opcode', - 'ogre.physics.bullet','ogre.physics.PhysX','ogre.physics.NxOgre', + 'ogre.physics.bullet','ogre.physics.PhysX','ogre.physics.NxOgre','ogre.physics.NxOgre_09' 'ogre.physics.OgreBulletC', 'ogre.physics.OgreBulletD', 'ogre.addons','ogre.addons.theora', 'ogre.addons.ogrevideoffmpeg', 'ogre.addons.ogredshow', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-16 05:33:48
|
Revision: 551 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=551&view=rev Author: andy_miller Date: 2008-01-15 21:33:53 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Updating NxOgre library to the Bleeding svn rev Added Paths: ----------- trunk/python-ogre/ThirdParty/nxogre/ trunk/python-ogre/ThirdParty/nxogre/FireState.cpp trunk/python-ogre/ThirdParty/nxogre/FireState.h trunk/python-ogre/ThirdParty/nxogre/NxOgre.h trunk/python-ogre/ThirdParty/nxogre/NxOgreActor.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreActor.h trunk/python-ogre/ThirdParty/nxogre/NxOgreActorBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreActorBlueprint.h trunk/python-ogre/ThirdParty/nxogre/NxOgreAnimatedRenderable.h trunk/python-ogre/ThirdParty/nxogre/NxOgreBlueprint.h trunk/python-ogre/ThirdParty/nxogre/NxOgreBody.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreBody.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterSystem.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterSystem.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCloth.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCloth.h trunk/python-ogre/ThirdParty/nxogre/NxOgreClothRaycaster.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreClothRaycaster.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCollisionModel.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCompound.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCompound.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCompoundActor.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCompoundActor.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCompoundActorBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCompoundActorBlueprint.h trunk/python-ogre/ThirdParty/nxogre/NxOgreContactStream.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreContactStream.h trunk/python-ogre/ThirdParty/nxogre/NxOgreContainer.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreContainer.h trunk/python-ogre/ThirdParty/nxogre/NxOgreCooking.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreCooking.h trunk/python-ogre/ThirdParty/nxogre/NxOgreDebugRenderer.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreDebugRenderer.h trunk/python-ogre/ThirdParty/nxogre/NxOgreDominanceGroup.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreDominanceGroup.h trunk/python-ogre/ThirdParty/nxogre/NxOgreEngine.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreEngine.h trunk/python-ogre/ThirdParty/nxogre/NxOgreEnumsBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreEnumsBlueprint.h trunk/python-ogre/ThirdParty/nxogre/NxOgreEnumsDefinesTypedefs.h trunk/python-ogre/ThirdParty/nxogre/NxOgreError.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreError.h trunk/python-ogre/ThirdParty/nxogre/NxOgreExtendedTypes.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreExtendedTypes.h trunk/python-ogre/ThirdParty/nxogre/NxOgreFileResourceSystem.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreFileResourceSystem.h trunk/python-ogre/ThirdParty/nxogre/NxOgreFluid.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreFluid.h trunk/python-ogre/ThirdParty/nxogre/NxOgreFluidMesh.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreFluidMesh.h trunk/python-ogre/ThirdParty/nxogre/NxOgreForceField.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreForceField.h trunk/python-ogre/ThirdParty/nxogre/NxOgreGlobalFunctions.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreGroup.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreGroup.h trunk/python-ogre/ThirdParty/nxogre/NxOgreHash.h trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreHelpers.h trunk/python-ogre/ThirdParty/nxogre/NxOgreIntersection.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreIntersection.h trunk/python-ogre/ThirdParty/nxogre/NxOgreJSON.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreJSON.h trunk/python-ogre/ThirdParty/nxogre/NxOgreJSONCollection.h trunk/python-ogre/ThirdParty/nxogre/NxOgreJSONRead.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreJSONSchema.h trunk/python-ogre/ThirdParty/nxogre/NxOgreJSONWrite.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreJoint.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreJoint.h trunk/python-ogre/ThirdParty/nxogre/NxOgreJointSet1.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreJointSet1.h trunk/python-ogre/ThirdParty/nxogre/NxOgreJointSet2.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreJointSet2.h trunk/python-ogre/ThirdParty/nxogre/NxOgreLegacyCharacter.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreLegacyCharacter.h trunk/python-ogre/ThirdParty/nxogre/NxOgreLegacyCharacterController.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreLegacyCharacterController.h trunk/python-ogre/ThirdParty/nxogre/NxOgreLegacyCharacterHitReport.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreLegacyCharacterHitReport.h trunk/python-ogre/ThirdParty/nxogre/NxOgreLog.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreLog.h trunk/python-ogre/ThirdParty/nxogre/NxOgreMachine.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreMachine.h trunk/python-ogre/ThirdParty/nxogre/NxOgreMaterial.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreMaterial.h trunk/python-ogre/ThirdParty/nxogre/NxOgreMemoryStream.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreMemoryStream.h trunk/python-ogre/ThirdParty/nxogre/NxOgreNodeRenderable.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreNodeRenderable.h trunk/python-ogre/ThirdParty/nxogre/NxOgreNxActorController.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreNxActorController.h trunk/python-ogre/ThirdParty/nxogre/NxOgreNxCharacterController.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreNxCharacterController.h trunk/python-ogre/ThirdParty/nxogre/NxOgreNxSerialiser.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreNxSerialiser.h trunk/python-ogre/ThirdParty/nxogre/NxOgreNxuStreamSerialiser.h trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreNodeRenderable.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreNodeRenderable.h trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreResourceSystem.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreResourceSystem.h trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreSceneRenderer.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreSceneRenderer.h trunk/python-ogre/ThirdParty/nxogre/NxOgreParametersBlueprint.h trunk/python-ogre/ThirdParty/nxogre/NxOgreParams.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreParams.h trunk/python-ogre/ThirdParty/nxogre/NxOgreParticleSystem.h trunk/python-ogre/ThirdParty/nxogre/NxOgrePerformer.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgrePerformer.h trunk/python-ogre/ThirdParty/nxogre/NxOgrePhysXDriver.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgrePhysXDriver.h trunk/python-ogre/ThirdParty/nxogre/NxOgrePose.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgrePose.h trunk/python-ogre/ThirdParty/nxogre/NxOgrePrerequisites.h trunk/python-ogre/ThirdParty/nxogre/NxOgreRaycaster.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreRaycaster.h trunk/python-ogre/ThirdParty/nxogre/NxOgreRemoteDebuggerConnection.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreRemoteDebuggerConnection.h trunk/python-ogre/ThirdParty/nxogre/NxOgreRenderable.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreRenderable.h trunk/python-ogre/ThirdParty/nxogre/NxOgreRenderableSource.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreRenderableSource.h trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceManager.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceManager.h trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceManager_Convex.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceManager_Triangle.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceMesh.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceMesh.h trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceStream.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceStream.h trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceStreamPtr.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceStreamPtr.h trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceSystem.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceSystem.h trunk/python-ogre/ThirdParty/nxogre/NxOgreScene.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreScene.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneBlueprint.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneContactController.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneContactController.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneController.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneController.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneRenderer.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneRenderer.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneSource.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneSource.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneTriggerController.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSceneTriggerController.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSerialiser.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSerialiser.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShape.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShape.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprint.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintConvex.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintConvex.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintMesh.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintMesh.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintPrimitives.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintPrimitives.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintTerrain.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintTerrain.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintWheel.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeBlueprintWheel.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeConvex.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeConvex.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeMesh.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeMesh.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapePrimitives.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapePrimitives.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeTerrain.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeTerrain.h trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeWheel.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreShapeWheel.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSimpleShape.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSimpleShape.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSkeletalRenderable.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSkeleton.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSkeleton.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSoftBody.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreSoftBody.h trunk/python-ogre/ThirdParty/nxogre/NxOgreSpriteRenderable.h trunk/python-ogre/ThirdParty/nxogre/NxOgreStable.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreStable.h trunk/python-ogre/ThirdParty/nxogre/NxOgreState.h trunk/python-ogre/ThirdParty/nxogre/NxOgreStateMachine.h trunk/python-ogre/ThirdParty/nxogre/NxOgreTestIdea.h trunk/python-ogre/ThirdParty/nxogre/NxOgreTesting.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreTesting.h trunk/python-ogre/ThirdParty/nxogre/NxOgreTrigger.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreTrigger.h trunk/python-ogre/ThirdParty/nxogre/NxOgreUserAllocator.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreUserAllocator.h trunk/python-ogre/ThirdParty/nxogre/NxOgreUserData.h trunk/python-ogre/ThirdParty/nxogre/NxOgreUserStream.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreUserStream.h trunk/python-ogre/ThirdParty/nxogre/NxOgreVoxelRenderable.h trunk/python-ogre/ThirdParty/nxogre/NxOgreWheelSet.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreWheelSet.h trunk/python-ogre/ThirdParty/nxogre/NxOgreWorld.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreWorld.h trunk/python-ogre/ThirdParty/nxogre/NxOgreWorldBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre/NxOgreWorldBlueprint.h Added: trunk/python-ogre/ThirdParty/nxogre/FireState.cpp =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/FireState.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/nxogre/FireState.cpp 2008-01-16 05:33:53 UTC (rev 551) @@ -0,0 +1 @@ +// FireState Added: trunk/python-ogre/ThirdParty/nxogre/FireState.h =================================================================== Added: trunk/python-ogre/ThirdParty/nxogre/NxOgre.h =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/NxOgre.h (rev 0) +++ trunk/python-ogre/ThirdParty/nxogre/NxOgre.h 2008-01-16 05:33:53 UTC (rev 551) @@ -0,0 +1,160 @@ +/** @mainpage NxOgre +@section licence Licence + +<pre> +NxOgre a wrapper for the PhysX (formerly Novodex) physics library and the Ogre 3D rendering engine. +Copyright (C) 2005 - 2007 Robin Southern and NxOgre.org http://www.nxogre.org + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +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 GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</pre> + +@section whatisit What is it? +NxOgre is a physics connector library between the physics library PhysX and the Ogre 3D rendering system. +With a help of some short, fast and neat code you can have a quick physics system within your Ogre game +or engine within a matter of minutes. + +@section installing Installing +@subsection Ogre + +The SDK or Source versions will both work with NxOgre. You should have some knowledege with working Ogre. +If you can make a simple application that can show an Ogre head with a movement camera, you can work with +NxOgre. +\n\n +You will need to create an environmental variable called "OGRE_HOME" pointing to the ogremain directory +in your Ogre folder. Normally for SDK users this is automatically created by the installer, but it's work +checking, if you installed Ogre from the source you'll need to create one. + +[1] http://www.ogre3d.org/wiki/index.php/Installing_An_SDK \n +[2] http://www.ogre3d.org/wiki/index.php/Building_From_Source \n + +@subsection PhysX +The PhysX SDK can be downloaded from the Ageia Support Center, a user account is required to download the +SDK. Once your account has been registered (Accounts are processed by hand, so a wait of 1-2 business days +is common), download the PhysX SDK and the SystemSoftware. +\n\n +Install the SystemSoftware first, then the PhysX SDK. I recommend you install the PhysX SDK in the same +parent directory as Ogre. Once the installation is completed, create a Environmental variable called +"<code>PHYSX_DIR</code>" pointing to the PhysX SDK directory. +\n\n +[3] http://devsupport.ageia.com/ \n + +@subsection NxOgre + - Create a "NxOgre" folder, it should be in the parent of your Ogre or nearby + - Using Tortoise SVN or another Subversion client checkout the HEAD repositry + - Go to the parent directory of Ogre and the PhysX SDK i.e. (c:/dev/) + - New Folder, name as NxOgre, and go inside + - File, SVN, SVN Checkout + - Set the URL to http://latest.nxogre.org/nxogre3/ + - Click okay + - Open up the project and compile. + +*/ + +#ifndef __NXOGRE_H__ +#define __NXOGRE_H__ + +/////////////////////////////////////////// + +#include "NxOgreStable.h" +#include "NxOgrePrerequisites.h" +#include "NxOgrePhysXDriver.h" +#include "NxOgreError.h" +#include "NxOgreLog.h" +#include "NxOgreExtendedTypes.h" + +/////////////////////////////////////////// + +#include "NxOgreActor.h" +#include "NxOgreActorBlueprint.h" +#include "NxOgreBody.h" +#include "NxOgreContactStream.h" +#include "NxOgreContainer.h" +#include "NxOgreCooking.h" +#if NX_USE_LEGACY_NXCONTROLLER +# include "NxOgreLegacyCharacter.h" +# include "NxOgreLegacyCharacterController.h" +# include "NxOgreLegacyCharacterHitReport.h" +#else +# include "NxOgreCharacterSystem.h" +# include "NxOgreCharacter.h" +# include "NxOgreCharacterModel.h" +# include "NxOgreCharacterMovementModel.h" +#endif +#include "NxOgreCloth.h" +#include "NxOgreClothRaycaster.h" +#include "NxOgreCompound.h" +#include "NxOgreDebugRenderer.h" +#include "NxOgreDominanceGroup.h" +#include "NxOgreEngine.h" +#include "NxOgreEnumsBlueprint.h" +#include "NxOgreFileResourceSystem.h" +#include "NxOgreFluid.h" +#include "NxOgreFluidMesh.h" +#include "NxOgreForceField.h" +#include "NxOgreGroup.h" +#include "NxOgreHelpers.h" +#include "NxOgreJointSet1.h" +#include "NxOgreJointSet2.h" +#include "NxOgreIntersection.h" +#include "NxOgreMaterial.h" +#include "NxOgreMachine.h" +#include "NxOgreNodeRenderable.h" +#include "NxOgreResourceManager.h" +#include "NxOgreOgreResourceSystem.h" +#include "NxOgreParams.h" +#include "NxOgrePose.h" +#include "NxOgreRaycaster.h" +#include "NxOgreRenderable.h" +#include "NxOgreRenderableSource.h" +#include "NxOgreRemoteDebuggerConnection.h" +#include "NxOgreResourceSystem.h" +#include "NxOgreResourceStreamPtr.h" +#include "NxOgreSerialiser.h" +#include "NxOgreScene.h" +#include "NxOgreSceneBlueprint.h" +#include "NxOgreSceneController.h" +#include "NxOgreSceneContactController.h" +#include "NxOgreSceneRenderer.h" +#include "NxOgreShape.h" +#include "NxOgreShapeBlueprint.h" +#include "NxOgreShapeBlueprintConvex.h" +#include "NxOgreShapeBlueprintMesh.h" +#include "NxOgreShapeBlueprintPrimitives.h" +#include "NxOgreShapeBlueprintTerrain.h" +#include "NxOgreShapeBlueprintWheel.h" +#include "NxOgreShapeConvex.h" +#include "NxOgreShapeMesh.h" +#include "NxOgreShapePrimitives.h" +#include "NxOgreShapeTerrain.h" +#include "NxOgreShapeWheel.h" +#include "NxOgreSimpleShape.h" +#include "NxOgreSoftBody.h" +#include "NxOgreState.h" +#include "NxOgreStateMachine.h" +#include "NxOgreTesting.h" +#include "NxOgreTrigger.h" +#include "NxOgreMemoryStream.h" +#include "NxOgreUserAllocator.h" +#include "NxOgreUserData.h" +#include "NxOgreWheelSet.h" +#include "NxOgreWorld.h" +#include "NxOgreWorldBlueprint.h" + +/////////////////////////////////////////// + +#include "NxOgreOgreSceneRenderer.h" +#include "NxOgreOgreNodeRenderable.h" + +#endif Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreActor.cpp =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/NxOgreActor.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/nxogre/NxOgreActor.cpp 2008-01-16 05:33:53 UTC (rev 551) @@ -0,0 +1,1123 @@ +// +// NxOgre a wrapper for the PhysX (formerly Novodex) physics library and the Ogre 3D rendering engine. +// Copyright (C) 2005 - 2007 Robin Southern and NxOgre.org http://www.nxogre.org +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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 GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// + +#include "NxOgreStable.h" +#include "NxOgreActor.h" +#include "NxOgreActorBlueprint.h" +#include "NxOgreUserData.h" // For NxActorUserData for NxActor +#include "NxOgrePose.h" // For conversions +#include "NxOgreHelpers.h" // For conversions +#include "NxOgreScene.h" // For Actor::mOwner +#include "NxOgreShapeBlueprint.h" // For ShapeBlueprint System +#include "NxOgreDominanceGroup.h" // For Dominance Groups +#include "NxOgreGroup.h" // For ActorGroup and ShapeGroups +#include "NxOgreContainer.h" // For Getting an ActorGroup +#include "NxOgreActorBlueprint.h" // For Quick Duplication. + +#include "OgreStringConverter.h" +#include "OgreRoot.h" +#include "OgreSingleton.h" +#include "OgreMatrix3.h" + +namespace NxOgre { + +////////////////////////////////////////////////////////// + +void ActorParams::setToDefault() { + + + mDensity = 0.0f; + mActorFlags = 0; + mGroupAsIndex = 0; + mGroupAsName = ""; +#if NX_SDK_VERSION_NUMBER >= 272 + mDominanceGroupAsIndex = 0; + mDominanceGroupAsName = ""; +#endif +#if NX_SDK_VERSION_NUMBER >= 260 + mCompartment = NULL; +#endif + mMassLocalPose . id(); + mMassSpaceInertia . zero(); + mLinearVelocity . zero(); + mAngularVelocity . zero(); + mWakeUpCounter = 20.0f * 0.02f; + mMass = 10.0f; + mLinearDamping = 0.0f; + mAngularDamping = 0.05f; + mMaxAngularVelocity = -1.0f; + mBodyFlags = NX_BF_VISUALIZATION; + mBodyFlags |= NX_BF_ENERGY_SLEEP_TEST; + mSleepLinearVelocity = -1.0f; + mSleepAngularVelocity = -1.0f; + mCCDMotionThreshold = 0.0f; + mSolverIterationCount = 4; + mSleepEnergyThreshold = -1.0f; + mSleepDamping = 0.0f; + + mNodeScale = Ogre::Vector3(1,1,1); + mNodeName = ""; + mNodeShadows = true; + mNodePose . id(); + +} + +////////////////////////////////////////////////////////// + +void ActorParams::parse(Parameters P) { + + for (Parameters::iterator p = P.begin(); p != P.end();p++) { + + if ((*p).first == "static") { + if ( (*p).second.substr(0,1) == "y" || (*p).second.substr(0,1) == "Y") { + mMass = 0; + mDensity = 0; + continue; + } + else { + mMass = 10; + mDensity = 0; + } + } + + if ((*p).first == "kinematic") { + if ( (*p).second.substr(0,1) == "y" || (*p).second.substr(0,1) == "Y") { + mBodyFlags |= NX_BF_KINEMATIC; + if (mMass == 0 || mDensity == 0) { + mMass = 1; + mDensity = 0; + } + } + } + + if (Set("density", (*p), mDensity)) continue; + if (Set("group", (*p), mGroupAsName)) continue; + if (Set("group-index", (*p), mGroupAsIndex)) continue; +#if NX_SDK_VERSION_NUMBER >= 272 + if (Set("dominancegroup", (*p), mDominanceGroupAsName)) continue; + if (Set("dominancegroup-index", (*p), mDominanceGroupAsIndex)) continue; +#endif + if (Set("massspaceinertia", (*p), mMassSpaceInertia)) continue; + if (Set("linearvelocity", (*p), mLinearVelocity)) continue; + if (Set("angularvelocity", (*p), mAngularVelocity)) continue; + if (Set("wakeupcounter", (*p), mWakeUpCounter)) continue; + if (Set("mass", (*p), mMass)) continue; + if (Set("lineardamping", (*p), mLinearDamping)) continue; + if (Set("angulardamping", (*p), mAngularDamping)) continue; + if (Set("maxangularvelocity", (*p), mMaxAngularVelocity)) continue; + if (Set("sleepangularvelocity", (*p), mSleepAngularVelocity)) continue; + if (Set("ccdmotionthreshold", (*p), mCCDMotionThreshold)) continue; + if (Set("solveriterationcount", (*p), mSolverIterationCount)) continue; + if (Set("sleepenergythreshold", (*p), mSleepEnergyThreshold)) continue; + if (Set("sleepdamping", (*p), mSleepDamping)) continue; + if (Set("node-scale", (*p), mNodeScale)) continue; + if (Set("node-shadows", (*p), mNodeShadows)) continue; + if (Set("node", (*p), mNodeName)) continue; + if (Set("node-orientation", (*p), mNodePose.q)) continue; + if (Set("node-offset", (*p), mNodePose.v)) continue; + + } + +} + +////////////////////////////////////////////////////////// + +void ActorParams::fromNxActorDesc(NxActorDesc& desc) { + + mDensity = desc.density; + mActorFlags = desc.flags; + mGroupAsIndex = desc.group; +#if NX_SDK_VERSION_NUMBER >= 272 + mDominanceGroupAsIndex = desc.dominanceGroup; +#endif +#if NX_SDK_VERSION_NUMBER >= 260 + mCompartment = desc.compartment; +#endif +} + +////////////////////////////////////////////////////////// + +void ActorParams::fromNxBodyDesc(NxBodyDesc& desc) { + + mMassLocalPose = desc.massLocalPose; + mMassSpaceInertia = desc.massSpaceInertia; + mLinearVelocity = desc.linearVelocity; + mAngularVelocity = desc.angularVelocity; + mWakeUpCounter = desc.wakeUpCounter; + mMass = desc.mass; + mLinearDamping = desc.linearDamping; + mAngularDamping = desc.angularDamping; + mMaxAngularVelocity = desc.maxAngularVelocity; + mBodyFlags = desc.flags; + mSleepLinearVelocity = desc.sleepLinearVelocity; + mSleepAngularVelocity = desc.sleepAngularVelocity; + mCCDMotionThreshold = desc.CCDMotionThreshold; + mSolverIterationCount = desc.solverIterationCount; + mBodyFlags = desc.flags; + mSleepEnergyThreshold = desc.sleepEnergyThreshold; + mSleepDamping = desc.sleepDamping; + +} + +////////////////////////////////////////////////////////// + +Actor::Actor(const NxString& Identifier, Scene* scene, bool isActorBased) : mName(Identifier), mOwner(scene) { + mActor = 0; + if (isActorBased) + mOwner->_registerActor(mName, this); +} + +////////////////////////////////////////////////////////// + +Actor::Actor(const NxString& name, Scene* scene, ShapeBlueprint *shape, const Pose& pose, ActorParams params) +: mName(name), mOwner(scene) { + + if (name.length() == 0) { + mName = NxCreateID(scene->getNbActors(), "Actor"); + } + else { + + std::vector<NxString> splitID = Ogre::StringUtil::split(name, ";", 2); + + NxString identifier; + + if (splitID.size() == 1) { + identifier = name; + } + else { + identifier = splitID[0]; + } + + Ogre::StringUtil::trim(identifier); + + if (identifier.substr(0,1) == ">") { + mName = identifier.substr(1, identifier.length() - 1); + if (scene->getActors()->has(mName)) { + NxThrow_Error("Duplicate Actor with identifier '" + mName + "' found!"); + } + + } + else if (scene->getActors()->has(identifier)) { + // Generate a identifier based on the the suggested name. + // i.e. + // myBody -> myBody 1 + // myBody10 -> myBody 11 + + Actors actors; + scene->getActors()->CopyTo(actors); + + NxU32 highest = 0; + NxString workingName; + for(Actor* a = actors.begin();a = actors.next();) { + if (Ogre::StringUtil::startsWith(a->getName(), identifier, false)) { + workingName = a->getName(); + workingName = workingName.substr(identifier.length(), workingName.length() - identifier.length()); + std::stringstream ss(workingName); + NxU32 current = 0; + ss >> current; + if (current > highest) + highest = current; + } + } + + highest++; + mName = identifier; + mName.append(Ogre::StringConverter::toString(highest)); + } + else { + mName = identifier; + } + } + + _createActor(shape,pose,params); + mOwner->_registerActor(mName, this); +} + +////////////////////////////////////////////////////////// + +Actor::~Actor() { + + mOwner->_unregisterActor(mName); + + if (!isDead()) + _destroyActor(); + +} + +////////////////////////////////////////////////////////// + +void Actor::_createActor(ShapeBlueprint *shape, const Pose& pose, ActorParams params) { + + NxActorDesc ad; + NxBodyDesc bd; + ad.setToDefault(); + bd.setToDefault(); + + mNxActorUserData = new NxActorUserData(this, NxActorUserData::T_Actor); +#if NX_SDK_VERSION_NUMBER >= 260 + ad.compartment = params.mCompartment; +#endif + if (params.mMass == 0) + ad.density = params.mDensity; +#if NX_SDK_VERSION_NUMBER >= 272 + if (params.mDominanceGroupAsIndex != 0) + ad.dominanceGroup = params.mDominanceGroupAsIndex; + else if (params.mDominanceGroupAsName.length() > 0) + ad.dominanceGroup = mOwner->getDominanceGroup(params.mDominanceGroupAsName)->getGroupID(); +#endif + ad.flags = params.mActorFlags; + + ad.globalPose.t = pose.getVec3(); + ad.globalPose.M.fromQuat(pose.getQuat()); + + if (params.mGroupAsIndex != 0) + ad.group = params.mGroupAsIndex; + else if (params.mGroupAsName.length() > 0) + ad.group = mOwner->getActorGroup(params.mGroupAsName)->getGroupID(); + + ad.userData = mNxActorUserData; + + if (params.mDensity == 0 && params.mMass == 0) { + ad.body = NULL; + } + else { + bd.angularDamping = params.mAngularDamping; + bd.angularVelocity = params.mAngularVelocity; + bd.CCDMotionThreshold = params.mCCDMotionThreshold; + bd.flags = params.mBodyFlags; + bd.linearDamping = params.mLinearDamping; + bd.linearVelocity = params.mLinearVelocity; + if (ad.density == 0) + bd.mass = params.mMass; + bd.massLocalPose = params.mMassLocalPose; + bd.massSpaceInertia = params.mMassSpaceInertia; + bd.maxAngularVelocity = params.mMaxAngularVelocity; + bd.sleepAngularVelocity = params.mSleepAngularVelocity; + bd.sleepDamping = params.mSleepDamping; + bd.sleepEnergyThreshold = params.mSleepEnergyThreshold; + bd.sleepLinearVelocity = params.mSleepLinearVelocity; + bd.solverIterationCount = params.mSolverIterationCount; + bd.wakeUpCounter = params.mWakeUpCounter; + ad.body = &bd; + } + + shape->_bindToActorDescription(this, 0, ad.shapes); + + mActor = mOwner->mScene->createActor(ad); + + if (!mActor) { + std::stringstream ss; + ss << "Creation of Actor with the identifier '" << mName << "' failed." << std::endl; + NxThrow_Error(ss.str()); + return; + } + + if (!shape->isShared()) + delete shape; + + NxU32 nbShapes = mActor->getNbShapes(); + NxShape*const* shapes = mActor->getShapes(); + + int i=0; + while (nbShapes--) { + mCollisionModel[i]->_bindNxShapeToShape(shapes[nbShapes]); + i++; + } + +#if (OGRE_VERSION_MAJOR >= 1) && (OGRE_VERSION_MINOR >= 5) + mBirthFrame = Ogre::Root::getSingletonPtr()->getNextFrameNumber() - 1; +#else + mBirthFrame = Ogre::Root::getSingletonPtr()->getCurrentFrameNumber(); +#endif +} + +////////////////////////////////////////////////////////// + +void Actor::_destroyActor() { + mCollisionModel.destroyAllOwned(); + delete mNxActorUserData; + mOwner->mScene->releaseActor(*mActor); + mActor = 0; +} + +////////////////////////////////////////////////////////// + +void Actor::setName(NxString name) { + mOwner->mActors.rename(mName, name); + mName = name; +} + +////////////////////////////////////////////////////////// + +NxString Actor::getName() const { + return mName; +} + +////////////////////////////////////////////////////////// + +NxScene* Actor::getNxScene() { + return mOwner->getNxScene(); +} + +////////////////////////////////////////////////////////// + +Actor* Actor::duplicate(const NxString& name, const Pose& p) { + Blueprints::ActorBlueprint* ab = new Blueprints::ActorBlueprint(); + ab->serialise(this, mOwner); + Actor* a = ab->unserialise(name, mOwner); + a->setGlobalPose(p); + delete ab; + return a; +} + +////////////////////////////////////////////////////////// + +void Actor::setGlobalPose(const Pose& pose) { + mActor->setGlobalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +Pose Actor::getGlobalPose() { + static Pose p; + p.fromMat34(mActor->getGlobalPose()); + return p; +} + +////////////////////////////////////////////////////////// + +Ogre::Quaternion Actor::getGlobalOrientation() { + return NxConvert<Ogre::Quaternion, NxQuat>(mActor->getGlobalOrientationQuat()); +} + +////////////////////////////////////////////////////////// + +void Actor::setGlobalOrientation(const Ogre::Quaternion& quat) { + mActor->setGlobalOrientation(NxConvert<NxQuat, Ogre::Quaternion>(quat)); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getGlobalPosition() { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getGlobalPosition()); +} + +////////////////////////////////////////////////////////// + +void Actor::setGlobalPosition(const Ogre::Vector3& vec) { + mActor->setGlobalPosition(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::moveGlobalPose(const Pose& pose) { + mActor->moveGlobalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +void Actor::moveGlobalPosition(const Ogre::Vector3& vec) { + mActor->moveGlobalPosition(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::moveGlobalOrientation(const Ogre::Quaternion& quat) { + mActor->moveGlobalOrientationQuat(NxConvert<NxQuat, Ogre::Quaternion>(quat)); +} + +//////////////////////////////////////////////////////// + +void Actor::moveTowards(const Pose& p, float force) { + NxVec3 fc = p.v - mActor->getGlobalPosition(); + fc *= force; + fc -= mActor->getPointVelocity(mActor->getGlobalPosition()); + mActor->addForceAtPos(fc, mActor->getGlobalPosition()); +} + +//////////////////////////////////////////////////////// + +#if 0 + +const ShapeBlueprint& Actor::createShapeDescription(const ShapeBlueprint& s) { + NxUnderConstruction; + return s; +} + +////////////////////////////////////////////////////////// + +void Actor::destroyShapeDescription(const ShapeBlueprint&) { + NxUnderConstruction; +} + +////////////////////////////////////////////////////////// + +Ogre::uint Actor::getNbShapeDescriptions() { + return mActor->getNbShapeDescriptions(); +} + +////////////////////////////////////////////////////////// + +std::vector<const ShapeBlueprint&> Actor::getAllShapeDescriptions() { + NxUnderConstruction; + std::vector<const ShapeBlueprint&> s; + return s; +} + +////////////////////////////////////////////////////////// + +ShapeBlueprint Actor::getFirstShapeDescription() { + NxUnderConstruction; + return NULL; +} + +////////////////////////////////////////////////////////// + +ShapeBlueprint Actor::getShapeDescription(Ogre::uint id) { + NxUnderConstruction; + return NULL; +} + +#endif + +////////////////////////////////////////////////////////// + +void Actor::setGroup(ActorGroup* ag) { + mActor->setGroup(ag->getGroupID()); +} + +////////////////////////////////////////////////////////// + +void Actor::setGroup(const NxString& GroupIdentifier) { + mActor->setGroup(mOwner->getActorGroups()->get(GroupIdentifier)->getGroupID()); +} + +////////////////////////////////////////////////////////// + +void Actor::setGroup(NxActorGroup agid) { + mActor->setGroup(agid); +} + +////////////////////////////////////////////////////////// + +ActorGroup* Actor::getGroup() const { + NxActorGroup agid = mActor->getGroup(); + return mOwner->getActorGroupsByIndex()->get(agid); +} + +////////////////////////////////////////////////////////// + +void Actor::raiseActorFlag(NxActorFlag f) { + mActor->raiseActorFlag(f); +} + +////////////////////////////////////////////////////////// + +void Actor::clearActorFlag(NxActorFlag f) { + mActor->clearActorFlag(f); +} + +////////////////////////////////////////////////////////// + +bool Actor::hasActorFlag(NxActorFlag f) const { + return mActor->readActorFlag(f); +} +////////////////////////////////////////////////////////// + +bool Actor::isDynamic() const { + return mActor->isDynamic(); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetLocalPose(const Pose& pose) { + mActor->setCMassOffsetLocalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetLocalPosition(const Ogre::Vector3& vec) { + mActor->setCMassOffsetLocalPosition(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetLocalOrientation(const NxMat33& m) { + mActor->setCMassOffsetLocalOrientation(m); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetLocalOrientation(const Ogre::Matrix3& vec) { + NxUnderConstruction; +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetGlobalPose(const Pose& pose) { + mActor->setCMassOffsetGlobalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetGlobalPosition(const Ogre::Vector3& vec) { + mActor->setCMassOffsetGlobalPosition(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetGlobalOrientation(const NxMat33& m) { + mActor->setCMassOffsetGlobalOrientation(m); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetGlobalOrientation(const Ogre::Matrix3& quat) { + NxUnderConstruction; + NxMat33 m; + mActor->setCMassOffsetGlobalOrientation(m); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassGlobalPose(const Pose& pose) { + mActor->setCMassGlobalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassGlobalPosition(const Ogre::Vector3& vec) { + mActor->setCMassGlobalPosition(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassGlobalOrientation(const Ogre::Quaternion& quat) { + NxUnderConstruction; + NxMat33 m; + mActor->setCMassGlobalOrientation(m); +} +////////////////////////////////////////////////////////// + + +Pose Actor::getCMassLocalPose() const { + Pose pose; + pose.fromMat34(mActor->getCMassLocalPose()); + return pose; +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getCMassLocalPosition() const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getCMassLocalPosition()); +} + +////////////////////////////////////////////////////////// + +Ogre::Quaternion Actor::getCMassLocalOrientation() const { + return NxConvert<Ogre::Quaternion, NxQuat>(mActor->getCMassLocalOrientation()); +} + +////////////////////////////////////////////////////////// + +Pose Actor::getCMassGlobalPose() const { + Pose pose; + pose.fromMat34(mActor->getCMassGlobalPose()); + return pose; +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getCMassGlobalPosition() const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getCMassGlobalPosition()); +} + +////////////////////////////////////////////////////////// + +Ogre::Quaternion Actor::getCMassGlobalOrientation() const { + NxQuat quat; + mActor->getCMassGlobalOrientation().toQuat(quat); + return NxConvert<Ogre::Quaternion, NxQuat>(quat); +} + +////////////////////////////////////////////////////////// + + +void Actor::setMass(NxReal r) { + mActor->setMass(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getMass() const { + return mActor->getMass(); +} + +////////////////////////////////////////////////////////// + + +void Actor::setMassSpaceInertiaTensor(const Ogre::Vector3& vec) { + mActor->setMassSpaceInertiaTensor(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getMassSpaceInertiaTensor() const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getMassSpaceInertiaTensor()); +} + +////////////////////////////////////////////////////////// + +Ogre::Matrix3 Actor::getGlobalInertiaTensor() const { + NxUnderConstruction; + Ogre::Matrix3 m; + return m; +} + +////////////////////////////////////////////////////////// + +Ogre::Matrix3 Actor::getGlobalInertiaTensorInverse() const { + NxUnderConstruction; + Ogre::Matrix3 m; + return m; +} + +////////////////////////////////////////////////////////// + + +void Actor::updateMassFromShapeFromDensity(NxReal r) { + mActor->updateMassFromShapes(r,0); +} + +////////////////////////////////////////////////////////// + +void Actor::updateMassFromShapeAsMass(NxReal r) { + mActor->updateMassFromShapes(0,r); +} + +////////////////////////////////////////////////////////// + +void Actor::setLinearDamping(NxReal r) { + mActor->setLinearDamping(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getLinearDamping() const { + return mActor->getLinearDamping(); +} + +////////////////////////////////////////////////////////// + + +void Actor::setAngularDamping(NxReal r) { + mActor->setAngularDamping(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getAngularDamping() const { + return mActor->getAngularDamping(); +} + +////////////////////////////////////////////////////////// + +void Actor::setLinearVelocity(const Ogre::Vector3& vec) { + mActor->setLinearVelocity(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setAngularVelocity(const Ogre::Vector3& vec) { + mActor->setAngularVelocity(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + + +Ogre::Vector3 Actor::getLinearVelocity() const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getLinearVelocity()); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getAngularVelocity() const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getAngularVelocity()); +} + +////////////////////////////////////////////////////////// + + +void Actor::setMaxAngularVelocity(NxReal r) { + mActor->setMaxAngularVelocity(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getMaxAngularVelocity() const { + return mActor->getMaxAngularVelocity(); +} + +////////////////////////////////////////////////////////// + +void Actor::setCCDMotionThreshold(NxReal r) { + mActor->setCCDMotionThreshold(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getCCDMotionThreshold() const { + return mActor->getCCDMotionThreshold(); +} + +////////////////////////////////////////////////////////// + +void Actor::setLinearMomentum(const Ogre::Vector3& vec) { + mActor->setLinearMomentum(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setAngularMomentum(const Ogre::Vector3& vec) { + mActor->setAngularMomentum(NxConvert<NxVec3, Ogre::Vector3>(vec)); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getLinearMomentum() const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getLinearMomentum()); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getAngularMomentum() const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getAngularMomentum()); +} + +////////////////////////////////////////////////////////// + +void Actor::addForceAtPos(const Ogre::Vector3& force, const Ogre::Vector3& pos, NxForceMode mode, bool wakeup) { + mActor->addForceAtPos(NxConvert<NxVec3, Ogre::Vector3>(force), NxConvert<NxVec3, Ogre::Vector3>(pos), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addForceAtLocalPos(const Ogre::Vector3& force, const Ogre::Vector3& pos, NxForceMode mode, bool wakeup) { + mActor->addForceAtLocalPos(NxConvert<NxVec3, Ogre::Vector3>(force), NxConvert<NxVec3, Ogre::Vector3>(pos), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addLocalForceAtPos(const Ogre::Vector3& force, const Ogre::Vector3& pos, NxForceMode mode, bool wakeup) { + mActor->addLocalForceAtPos(NxConvert<NxVec3, Ogre::Vector3>(force), NxConvert<NxVec3, Ogre::Vector3>(pos), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addLocalForceAtLocalPos(const Ogre::Vector3& force, const Ogre::Vector3& pos, NxForceMode mode, bool wakeup) { + mActor->addLocalForceAtLocalPos(NxConvert<NxVec3, Ogre::Vector3>(force), NxConvert<NxVec3, Ogre::Vector3>(pos), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addForce(const Ogre::Vector3& force, NxForceMode mode, bool wakeup) { + mActor->addForce(NxConvert<NxVec3, Ogre::Vector3>(force), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addForce(const NxVec3& force, NxForceMode mode, bool wakeup) { + mActor->addForce(force, mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addForce(NxReal x, NxReal y, NxReal z, NxForceMode mode, bool wakeup) { + mActor->addForce(NxVec3(x,y,z), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addLocalForce(const Ogre::Vector3& force, NxForceMode mode, bool wakeup) { + mActor->addLocalForce(NxConvert<NxVec3, Ogre::Vector3>(force), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addTorque(const NxVec3& torque, NxForceMode mode, bool wakeup) { + mActor->addTorque(torque, mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addTorque(const Ogre::Vector3& torque, NxForceMode mode, bool wakeup) { + mActor->addTorque(NxConvert<NxVec3, Ogre::Vector3>(torque), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addLocalTorque(const Ogre::Vector3& torque, NxForceMode mode, bool wakeup) { + mActor->addLocalTorque(NxConvert<NxVec3, Ogre::Vector3>(torque), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::computeKineticEnergy() const { + return mActor->computeKineticEnergy(); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getPointVelocity(const Ogre::Vector3& vec) const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getPointVelocity(NxConvert<NxVec3, Ogre::Vector3>(vec))); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getLocalPointVelocity(const Ogre::Vector3& vec) const { + return NxConvert<Ogre::Vector3, NxVec3>(mActor->getLocalPointVelocity(NxConvert<NxVec3, Ogre::Vector3>(vec))); +} + +////////////////////////////////////////////////////////// + +bool Actor::isGroupSleeping() const { + return mActor->isGroupSleeping(); +} + +////////////////////////////////////////////////////////// + +bool Actor::isSleeping() const { + return mActor->isSleeping(); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getSleepLinearVelocity() const { + return mActor->getSleepLinearVelocity(); +} + +////////////////////////////////////////////////////////// + +void Actor::setSleepLinearVelocity(NxReal threshold) { + mActor->setSleepLinearVelocity(threshold); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getSleepAngularVelocity() const { + return mActor->getSleepAngularVelocity(); +} + +////////////////////////////////////////////////////////// + +void Actor::setSleepAngularVelocity(NxReal threshold) { + mActor->setSleepAngularVelocity(threshold); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getSleepEnergyThreshold() const { + return mActor->getSleepEnergyThreshold(); +} + +////////////////////////////////////////////////////////// + +void Actor::setSleepEnergyThreshold(NxReal threshold) { + mActor->setSleepEnergyThreshold(threshold); +} + +////////////////////////////////////////////////////////// + +void Actor::wakeUp(NxReal wakeCounterValue) { + mActor->wakeUp(wakeCounterValue); +} + +////////////////////////////////////////////////////////// + +void Actor::putToSleep() { + mActor->putToSleep(); +} + +////////////////////////////////////////////////////////// + +void Actor::raiseBodyFlag(NxBodyFlag f) { + mActor->raiseBodyFlag(f); +} + +////////////////////////////////////////////////////////// + +void Actor::clearBodyFlag(NxBodyFlag f) { + mActor->clearBodyFlag(f); +} + +////////////////////////////////////////////////////////// + +bool Actor::hasBodyFlag(NxBodyFlag f) const { + return mActor->readBodyFlag(f); +} + +////////////////////////////////////////////////////////// + +void Actor::setSolverIterationCount(NxU32 c) { + mActor->setSolverIterationCount(c); +} + +////////////////////////////////////////////////////////// + +NxU32 Actor::getSolverIterationCount() const { + return mActor->getSolverIterationCount(); +} + +////////////////////////////////////////////////////////// + +#if NX_SUPPORT_SWEEP_API + +NxU32 Actor::linearSweep(const Ogre::Vector3& motion, NxU32 flags, void* userData, NxU32 nbShapeDescriptions, NxSweepQueryHit* shapes, NxUserEntityReport<NxSweepQueryHit>* callback, const NxSweepCache* sweepCache) { + return mActor->linearSweep(NxConvert<NxVec3, Ogre::Vector3>(motion), flags, userData, nbShapeDescriptions, shapes, callback, sweepCache); +} + +#endif + +////////////////////////////////////////////////////////// + +#if NX_SDK_VERSION_NUMBER >= 260 + +Compartment* Actor::getCompartment() const { + NxUnderConstruction; + return NULL; +} + +#endif + +////////////////////////////////////////////////////////// + +Shape* Actor::addShape(ShapeBlueprint* sd) { + + + NxShapeIndex id = mCollisionModel.count(); + sd->_bindToNxActor(this, id); + delete sd; + Shape* s = mCollisionModel.get(id); + + + return s; + +} + +////////////////////////////////////////////////////////// + +void Actor::removeShape(Shape* sh) { + + + for (Shape* shape = mCollisionModel.begin();shape = mCollisionModel.next();) { + if (shape == sh) { + mActor->releaseShape(*sh->getNxShape()); + mCollisionModel.remove(sh->getIndex()); + + if (mDynamicCollisionModel.has(sh->getIndex())) + mDynamicCollisionModel.remove(sh->getIndex()); + + delete shape; + + return; + } + } + +} + +////////////////////////////////////////////////////////// + +void Actor::removeShape(NxShapeIndex id) { + + Shape* shape = mCollisionModel[id]; + + if (shape == 0) + return; + + shape->releaseShape(); + mCollisionModel.remove(id); + + delete shape; +} + +////////////////////////////////////////////////////////// + +NxU32 Actor::getNbShapes() const { + return mCollisionModel.count(); +} + +////////////////////////////////////////////////////////// + +CollisionModel* Actor::getCollisionModel() { + return &mCollisionModel; +} + +////////////////////////////////////////////////////////// + +CollisionModel* Actor::getDynamicCollisionModel() { + return &mDynamicCollisionModel; +} + +////////////////////////////////////////////////////////// + +void* Actor::getNxActorUserData() { + return mActor->userData; +} + +////////////////////////////////////////////////////////// + +NxActorUserData* Actor::getUserData() { + return mNxActorUserData; +} + +////////////////////////////////////////////////////////// + +StringPairList Actor::saveCustom() { + StringPairList l; + l.insert("ActorType", "Actor"); + + return l; +} + +////////////////////////////////////////////////////////// + +void Actor::disable() { + + mActor->raiseActorFlag(NX_AF_DISABLE_COLLISION); + mActor->raiseActorFlag(NX_AF_DISABLE_RESPONSE); + mActor->raiseActorFlag(NX_AF_FLUID_DISABLE_COLLISION); + mActor->raiseBodyFlag(NX_BF_FROZEN); + mActor->raiseBodyFlag(NX_BF_FROZEN_ROT); + mActor->setAngularVelocity(NxVec3(0,0,0)); + mActor->setAngularMomentum(NxVec3(0,0,0)); + mActor->setLinearMomentum(NxVec3(0,0,0)); + mActor->setLinearVelocity(NxVec3(0,0,0)); + +// disableVisualisation(); +} + +////////////////////////////////////////////////////////// + +FixedJoint* Actor::joinWith(Actor* actorB, JointParams jp) { + return mOwner->createFixedJoint(this, actorB, jp); +} + +////////////////////////////////////////////////////////// + +} //End of NxOgre namespace. Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreActor.h =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/NxOgreActor.h (rev 0) +++ trunk/python-ogre/ThirdParty/nxogre/NxOgreActor.h 2008-01-16 05:33:53 UTC (rev 551) @@ -0,0 +1,825 @@ +// +// NxOgre a wrapper for the PhysX (formerly Novodex) physics library and the Ogre 3D rendering engine. +// Copyright (C) 2005 - 2007 Robin Southern and NxOgre.org http://www.nxogre.org +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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 GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// + +#ifndef __NXOGRE_ACTOR_H__ +#define __NXOGRE_ACTOR_H__ + +#include "NxOgrePrerequisites.h" +#include "NxOgreContainer.h" // For: mCollisionList +#include "NxOgreParams.h" +#include "NxOgrePose.h" + +namespace NxOgre { + + /** \page actorparams ActorParams + + String base params are case and space insensitive. + + Examples: + + <code> + "mass: 1" + + "mass: 1, group: myActors" + + "mass: 1, group: myActors, lineardamping: 3" + </code> + + Non-String based params can be used as well, and offer access to some variables of the params + that cannot be converted into a string (pointers, etc.). + + Due to efficency purposes and insane string conversion. With string parameters more than four, + you should work with the non-string based params system. + + <code> + ActorParams params; + params.setToDefault(); + params.mMass = 10; + params.mGroupAsIndex = 1; + </code> + + Is exactly the same as: + + <code> + "mass: 10, group-index: 1" + </code> + + Current Supported String Params + ----------------------------- + + - density (float) + - Description: Density of this Actor. Use this or mass, do not use both. + - Example: "Density: 1.5" + - See: ActorParams::mDensity and NxActorDesc::density for more information. + + - group (string) + - Description: Actor Group name of this actor. Use this or group-index, but not both. + - Example: "group: myGroup" + - See: ActorParams::mGroupAsName + + - group-index (unsigned int) + - Description: Actor Group ID of this actor. Use this or group, but not both. + - Example: "group-index: 0" + - See: ActorParams::mGroupAsIndex + + - dominancegroup (unsigned int) + - Description: Dominance Group ID of this actor. + - Example: "dominancegroup: 0" + - See: ActorParams::mDominanceGroup + + - massspaceinertia (Vector3) + - Description: Mass Space Inertia of this Actor + - Example: "massspaceinertia: 1 0 1" + - See: ActorParams::mMassSpaceInertia + + - linearvelocity (Vector3) + - Description: Linear Velocity of this Actor + - Example: "linearvelocity: 1 0 1" + - See: ActorParams::mLinearVelocity + + - angularvelocity (Vector3) + - Description: Angular Velocity of this Actor + - Example: "angularvelocity: 1 0 1" + - See: ActorParams::mAngularVelocity + + - wakeupcounter (float) + - Description: Wake up time counter + - Example: "wakeupcounter: 1000.0" + - See: ActorParams::mWakeupCounter + + - mass (float) + - Description: Mass of this Actor. Use this or density, do not use both. + - Example: "mass: 10" + - See: ActorParams::mMass and NxBodyDesc::mass for more information. + + - lineardamping (float) + - Description: Linear Damping of the Actor + - Example: "lineardamping: 0.1" + - See: ActorParams::mLinearDamping + + - angulardamping (float) + - Description: Angular Damping of the Actor + - Example: "angulardamping: 0.1" + - See: ActorParams::mAngularDamping + + - maxangularvelocity (float) + - Description: Maximum allowed angular velocity + - Example: "maxangularvelocity: 10" + - See: ActorParams::mMaxAngularVelocity + + - sleepangularvelocity (float) + - Description: Maximum angular velocity at which the Actor can go to sleep. + - Example: "sleepangularvelocity: 20" + - See: ActorParams:mSleepAngularVelocity + + - ccdmotionthreshold (float) + - Description: When CCD is globally enabled, it is still not performed if the + motion distance of all points on the Actor is below this threshold. + - Example: "ccdmotionthreshold: 5" + - See: ActorParams::mCCDMotionThreshold + + - solveriterationcount (unsigned int) + - Description: Number of solver iterations performed when processing joint/contacts + connected to this Actor. + - Example: "solveriterationcount: 5" + - Range: 1 to 255 + - See: ActorParams::mSolverIterationCount + + - sleepenergytheshold (float) + - Description: Threshold for the energy-based sleeping algorithm. Only used when + the NX_BF_ENERGY_SLEEP_TEST flag is set + - Example: "sleepenergythreshold: 0.006" + - See: ActorParams::mSleepEnergyThreshold + + - sleepdamping (float) + - Description: Damping factor for bodies that are about to sleep. + - Example: "sleepdamping: 0.5" + - See: ActorParams::mSleepDamping + + - node-scale (Vector3) + - Applicable to Body and Actors that use a visual representation of the NxActor. + - Description: Scale factor of the SceneNode + - Example: "node-slace: 2 2 2" + - See: ActorParams::mNodeScale + + - node-shadows (bool) + - Applicable to Body and Actors that use a visual representation of the NxActor. + - Description: Apply shadows to the first entity (Body class). See other custom Actors + to see how shadows apply to it. + - Example: "node-shadows: yes" + - See: ActorParams::mNodeShaodws + + - node (string) + - Applicable to Body and Actors that use a visual representation of the NxActor. + - Description: Name of the SceneNode, or name of an existing SceneNode to use (Body only). + - Example: "node: myNodeName" + - See: ActorParams::mNodeName + + */ + + + /** ActorParams + + @see \ref actorparams for the full string argument documentation. + */ + class NxExport ActorParams : public Params { + + public: + + /** @brief Class based params. + @note Faster, less readable and reusable. + @see \ref actorparams + @example + <code> + ActorParams ap; + ap.mMass = 10; + ap.mGroup = "myGroup"; + ..., ap, ... + </code> + + */ + ActorParams() { + setToDefault(); + } + + /** @brief String based params. "mass: 10, group: myGroup" + @note Slower but readable. + @params String of params. + @see \ref actorparams + @example + <code> + ..., "mass: 10, group: myGroup", ... + </code> + */ + ActorParams(const char* p) { + process(p); + } + + /** @brief String based params. "mass: 10, group: myGroup" + @note Slower but readable. + @params + @see \ref actorparams + @example + <code> + ..., "mass: 10, group: myGroup", ... + </code> + */ + ActorParams(NxString p) { + process(p); + } + + /** @brief Set's the Params to default based on NxActorDesc and NxBodyDesc defaults. + */ + void setToDefault(); + + /** @brief Set's the Params based from an NxActorDesc + */ + void fromNxActorDesc(NxActorDesc&... [truncated message content] |
From: <and...@us...> - 2008-01-16 05:28:48
|
Revision: 550 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=550&view=rev Author: andy_miller Date: 2008-01-15 21:28:52 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Cleanup a few extra files Removed Paths: ------------- trunk/python-ogre/ThirdParty/CaelumPrerequisites.h trunk/python-ogre/ThirdParty/NxOgreResourceStreamPtr.h Deleted: trunk/python-ogre/ThirdParty/CaelumPrerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/CaelumPrerequisites.h 2008-01-16 05:26:11 UTC (rev 549) +++ trunk/python-ogre/ThirdParty/CaelumPrerequisites.h 2008-01-16 05:28:52 UTC (rev 550) @@ -1,39 +0,0 @@ -#ifndef CAELUMPREREQUISITES_H -#define CAELUMPREREQUISITES_H - -// Include external headers -#include "Ogre.h" - -#define DllExport - -// Define the version code -#define CAELUM_VERSION_MAIN 0 -#define CAELUM_VERSION_SEC 2 -#define CAELUM_VERSION_TER 1 -#define CAELUM_VERSION = (CAELUM_VERSION_MAIN << 16) | (CAELUM_VERSION_SEC << 8) | CAELUM_VERSION_TER - -namespace caelum { - /// Resource group name for caelum resources. - extern DllExport Ogre::String RESOURCE_GROUP_NAME; - - /* Set a global camera distances modifier for the clipping distance. - This threshold will be substracted from the far clipping distance if applicable, else it will be - added to the near clipping distance (ie, if infinite far clipping distance is used). - */ - const float CAMERA_DISTANCE_MODIFIER = 0; - - // Render grounp for caelum stuff - // It's best to have them all together - enum CaelumRenderQueueGroupId - { - CAELUM_RENDER_QUEUE_STARFIELD = Ogre::RENDER_QUEUE_SKIES_EARLY + 0, - CAELUM_RENDER_QUEUE_SKYDOME = Ogre::RENDER_QUEUE_SKIES_EARLY + 1, - CAELUM_RENDER_QUEUE_SUN = Ogre::RENDER_QUEUE_SKIES_EARLY + 2, - CAELUM_RENDER_QUEUE_CLOUDS = Ogre::RENDER_QUEUE_SKIES_EARLY + 3, - }; -} - -// Log macro -#define LOG(msg) Ogre::LogManager::getSingleton().logMessage(msg); - -#endif //CAELUMPREREQUISITES_H Deleted: trunk/python-ogre/ThirdParty/NxOgreResourceStreamPtr.h =================================================================== --- trunk/python-ogre/ThirdParty/NxOgreResourceStreamPtr.h 2008-01-16 05:26:11 UTC (rev 549) +++ trunk/python-ogre/ThirdParty/NxOgreResourceStreamPtr.h 2008-01-16 05:28:52 UTC (rev 550) @@ -1,175 +0,0 @@ -// -// NxOgre a wrapper for the PhysX (formerly Novodex) physics library and the Ogre 3D rendering engine. -// Copyright (C) 2005 - 2007 Robin Southern and NxOgre.org http://www.nxogre.org -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// 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 GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// - -#ifndef __NXOGRE_RESOURCESTREAMPTR_H__ -#define __NXOGRE_RESOURCESTREAMPTR_H__ - -#include "NxOgrePrerequisites.h" - -namespace NxOgre { - - /** @brief A generic abstract class to read or to write to a Resource, without exacting knowing - what exactly it is. It takes on a SmartPtr role in life, and the resource will be only - deleted from memory when it is no longer used. - - @note All of ResourceStreamPtr code was used from the Ogre SmartPtr class, except for a changed - constructor and removal of template. - - @see Ogre::SmartPtr - */ - class NxExport ResourceStreamPtr { - - protected: - - ResourceStream* pStream; - unsigned int* pUseCount; - - public: - - OGRE_AUTO_SHARED_MUTEX // public to allow external locking - /** Constructor, does not initialise the ResourceStreamPtr. - @remarks - <b>Dangerous!</b> You have to call bind() before using the ResourceStreamPtr. - */ - ResourceStreamPtr(); - - ResourceStreamPtr(ResourceIdentifier); - ResourceStreamPtr(ResourceIdentifier, void*); - - ResourceStreamPtr(const ResourceStreamPtr& r) - : pStream(0), pUseCount(0) - { - // lock & copy other mutex pointer - - OGRE_SET_AUTO_SHARED_MUTEX_NULL - OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME) - { - OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME) - OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME) - pStream = r.pStream; - pUseCount = r.pUseCount; - // Handle zero pointer gracefully to manage STL containers - if(pUseCount) - { - ++(*pUseCount); - } - } - } - - void createStream(ResourceIdentifier); - void destroyStream(); - - ResourceStreamPtr& operator=(const ResourceStreamPtr& r) { - if (pStream == r.pStream) - return *this; - // Swap current data into a local copy - // this ensures we deal with rhs and this being dependent - ResourceStreamPtr tmp(r); - swap(tmp); - return *this; - } - - virtual ~ResourceStreamPtr() { - release(); - } - - ResourceStream& operator*() const { assert(pStream); return *pStream; } - ResourceStream* operator->() const { assert(pStream); return pStream; } - ResourceStream* get() const { return pStream; } - - /** Binds rep to the ResourceStreamPtr. - @remarks - Assumes that the ResourceStreamPtr is uninitialised! - */ - void bind(ResourceStream* rep) { - assert(!pStream && !pUseCount); - OGRE_NEW_AUTO_SHARED_MUTEX - OGRE_LOCK_AUTO_SHARED_MUTEX - pUseCount = new unsigned int(1); - pStream = rep; - } - - bool unique() const { OGRE_LOCK_AUTO_SHARED_MUTEX assert(pUseCount); return *pUseCount == 1; } - unsigned int useCount() const { OGRE_LOCK_AUTO_SHARED_MUTEX assert(pUseCount); return *pUseCount; } - unsigned int* useCountPointer() const { return pUseCount; } - - ResourceStream* getPointer() const { return pStream; } - - bool isNull(void) const { return pStream == 0; } - - void setNull(void) { - if (pStream) - { - // can't scope lock mutex before release incase deleted - release(); - pStream = 0; - pUseCount = 0; - } - } - - protected: - - void release(void) - { - bool destroyThis = false; - - /* If the mutex is not initialized to a non-zero value, then neither is pUseCount nor pStream. - */ - - OGRE_MUTEX_CONDITIONAL(OGRE_AUTO_MUTEX_NAME) - { - // lock own mutex in limited scope (must unlock before destroy) - OGRE_LOCK_AUTO_SHARED_MUTEX - if (pUseCount) - { - if (--(*pUseCount) == 0) - { - destroyThis = true; - } - } - } - if (destroyThis) - destroy(); - - OGRE_SET_AUTO_SHARED_MUTEX_NULL - } - - virtual void destroy(void); - - virtual void swap(ResourceStreamPtr &other) { - std::swap(pStream, other.pStream); - std::swap(pUseCount, other.pUseCount); - #if OGRE_THREAD_SUPPORT - std::swap(OGRE_AUTO_MUTEX_NAME, other.OGRE_AUTO_MUTEX_NAME); - #endif - } - - }; - - bool operator==(ResourceStreamPtr const& a, ResourceStreamPtr const& b){ - return a.get() == b.get(); - } - - bool operator!=(ResourceStreamPtr const& a, ResourceStreamPtr const& b) { - return a.get() != b.get(); - } - -}; // End of namespace - -#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-16 05:26:06
|
Revision: 549 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=549&view=rev Author: andy_miller Date: 2008-01-15 21:26:11 -0800 (Tue, 15 Jan 2008) Log Message: ----------- NxOgre dir rename Added Paths: ----------- trunk/python-ogre/code_generators/nxogre_09/ Removed Paths: ------------- trunk/python-ogre/code_generators/nxogre_0.9/ Copied: trunk/python-ogre/code_generators/nxogre_09 (from rev 548, trunk/python-ogre/code_generators/nxogre_0.9) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-16 05:25:31
|
Revision: 548 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=548&view=rev Author: andy_miller Date: 2008-01-15 21:25:37 -0800 (Tue, 15 Jan 2008) Log Message: ----------- NxOgre 0.9 work Modified Paths: -------------- trunk/python-ogre/code_generators/nxogre/generate_code.py Added Paths: ----------- trunk/python-ogre/code_generators/nxogre_0.9/ trunk/python-ogre/code_generators/nxogre_0.9/customization_data.py trunk/python-ogre/code_generators/nxogre_0.9/generate_code.py trunk/python-ogre/code_generators/nxogre_0.9/hand_made_wrappers.py trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre.h trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_aliases.h trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_sizeof.h trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_sizeof.h.windows trunk/python-ogre/code_generators/nxogre_0.9/register_exceptions.py Modified: trunk/python-ogre/code_generators/nxogre/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/nxogre/generate_code.py 2008-01-16 02:53:00 UTC (rev 547) +++ trunk/python-ogre/code_generators/nxogre/generate_code.py 2008-01-16 05:25:37 UTC (rev 548) @@ -634,9 +634,9 @@ os.path.join( environment.nxogre.root_dir, "python_nxogre.h" ) , environment.nxogre.cache_file ) if os.name == 'nt': - defined_symbols = [ 'NxExport','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32']#NXOGRE_EXPORTS' + defined_symbols = [ 'NxExport','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32', 'GCC_XML']#NXOGRE_EXPORTS' else: - defined_symbols = [ 'LINUX','NX_LINUX', 'NX_DISABLE_FLUIDS', 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY'] + defined_symbols = [ 'LINUX','NX_LINUX', 'NX_DISABLE_FLUIDS', 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'GCC_XML'] if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') Added: trunk/python-ogre/code_generators/nxogre_0.9/customization_data.py =================================================================== --- trunk/python-ogre/code_generators/nxogre_0.9/customization_data.py (rev 0) +++ trunk/python-ogre/code_generators/nxogre_0.9/customization_data.py 2008-01-16 05:25:37 UTC (rev 548) @@ -0,0 +1,13 @@ + +def header_files( version ): + return [ 'NxOgre.h' + ,'NxOgreSkeleton.h' + ,'NxOgreResourceMesh.h' + ,'Ogre.h' + ,'OgrePlugin.h' + ,'NxPhysics.h' + ] + +def huge_classes( version ): + return [] + \ No newline at end of file Added: trunk/python-ogre/code_generators/nxogre_0.9/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/nxogre_0.9/generate_code.py (rev 0) +++ trunk/python-ogre/code_generators/nxogre_0.9/generate_code.py 2008-01-16 05:25:37 UTC (rev 548) @@ -0,0 +1,753 @@ +#!/usr/bin/env python +# ----------------------------------------------------------------------------- +# This source file is part of Python-Ogre and is covered by the LGPL +# For the latest info, see http://python-ogre.org/ +# +# ----------------------------------------------------------------------------- + + +import os, sys, time, shutil + +#add environment to the path +sys.path.append( os.path.join( '..', '..' ) ) +#add common utils to the pass +sys.path.append( '..' ) +sys.path.append( '.' ) + +import environment +import common_utils +import customization_data +import hand_made_wrappers +import register_exceptions + +from pygccxml import parser +from pygccxml import declarations +from pyplusplus import messages +from pyplusplus import module_builder +from pyplusplus import decl_wrappers + +from pyplusplus import function_transformers as ft +from pyplusplus.module_builder import call_policies +from pyplusplus.module_creator import sort_algorithms + +import common_utils.extract_documentation as exdoc +import common_utils.var_checker as varchecker +import common_utils.ogre_properties as ogre_properties + +MAIN_NAMESPACE = 'NxOgre' + +## small helper function +def docit ( general, i, o ): + docs = "Python-Ogre Modified Function Call\\n" + general +"\\n" + docs = docs + "Input: " + i + "\\n" + docs = docs + "Output: " + o + "\\n\\\n" + return docs + +############################################################ +## +## Here is where we manually exclude stuff +## +############################################################ + +def ManualExclude ( mb ): + global_ns = mb.global_ns + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + for c in main_ns.classes(): + if c.decl_string.startswith('::NxOgre::Container<') and '*' not in c.decl_string: + print "EXCLUDING: ", c + c.exclude() + + ### Now some of the functions need to be excluded.. This is too much and could be cut back + ### ie only some of the containers lists fail at compile time + funlist = ['get','has','next','remove'] + if c.decl_string.startswith('::NxOgre::List<'): + for f in funlist: + try: + c.member_function(f).exclude() + print "EXCLUDING: ", c, f + except: + pass + for v in c.variables(allow_empty=True): + if v.access_type != 'public' : + v.exclude() + print "excluded", v, v.access_type + for t in main_ns.typedefs(): + if t.decl_string.startswith('::NxOgre::Container<') and '*' not in t.decl_string: + t.exclude() + print "EXCLUDING: ", t + + # things not yet implemented in the C source.. + excludes=['::NxOgre::Compartment'] + for c in main_ns.classes(): + for m in c.member_functions(allow_empty=True): + for e in excludes: + if e in m.decl_string: + m.exclude() + + # problem with a constructor on Cloth + main_ns.class_('::NxOgre::Cloth').constructor(arg_types=[None,'::NxClothDesc','::NxMeshData',None,None]).exclude() + + # functions specified in the headers but not implemented + main_ns.class_('::NxOgre::Blueprints::ActorBlueprint').member_function('unserialise',arg_types=[None]).exclude() + + +# # # +# # # ### Member Functions + excludes=[ + '::NxOgre::Container<std::string, NxOgre::FluidDrain*>::begin' + ,'::NxOgre::Container<std::string, NxOgre::FluidDrain*>::get' + ,'::NxOgre::Container<std::string, NxOgre::FluidDrain*>::getFirst' + ,'::NxOgre::Container<std::string, NxOgre::FluidDrain*>::next' + ,'::NxOgre::Container<std::string, NxOgre::FluidDrain*>::_begin' + ,'::NxOgre::Container<std::string, NxOgre::FluidDrain*>::_next' + ,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::_begin' + ,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::_next' + ,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::getFirst' + ,'::NxOgre::List<NxOgre::RemoteDebuggerConnection::Camera>::destroyAndEraseAll' + ,'::NxOgre::List<NxOgre::RemoteDebuggerConnection::Camera>::dumpToConsole' + ,'::NxOgre::UserAllocator::realloc' + ,'::NxOgre::Cloth::duplicate' + ,'::NxOgre::ClothRayCaster::getClosestCloth' + ,'::NxOgre::Joint::getBreakableMaxForce' + ,'::NxOgre::Joint::getBreakableMaxTorque' + ,'::NxOgre::Joint::getGlobalAxis' + ,'::NxOgre::Joint::setGlobalAxis' + ,'::NxOgre::JointParams::setSpring' + ,'::NxOgre::JointParams::setMotor' + ,'::NxOgre::JointParams::setLimits' + ,'::NxOgre::JointParams::setJointProjection' + ,'::NxOgre::Scene::addMaterialPairsFromFile' + ,'::NxOgre::Scene::addMaterialPair' + ,'::NxOgre::Fluid::setName' + ,'::NxOgre::Fluid::getNxScene' + ,'::NxOgre::RayCaster::castBounds' + ,'::NxOgre::Scene::getSimType' + ,'::NxOgre::Scene::getGravity' + ,'::NxOgre::Scene::createSphericalJoint' + ,'::NxOgre::Scene::createPrismaticJoint' + ,'::NxOgre::Scene::createFixedJoint' + ,'::NxOgre::Scene::save' + ,'::NxOgre::Scene::batchDestroyActors' + ,'::NxOgre::SimpleIntersection::getResult' + ,'::NxOgre::SoftBody::simulate' + ,'::NxOgre::SoftBody::render' + + ,'::NxOgre::FileResourceSystem::getStream' # takes ::NxOgre::ResourceIdentifier as argument which needs fixing + ,'::NxOgre::OgreResourceSystem::getStream' + ,'::NxOgre::ResourceSystem::getStream' + ,'::NxOgre::RenderableSource::getStringType' # so we don't need a wrapper as it doesn't compile + ,'::NxOgre::RenderableSource::getType' + ,'::NxOgre::UserAllocator::mallocDEBUG' + +# ,'::NxOgre::Blueprints::ActorFactory' # not implemented, only in header.. + ,'::NxOgre::ContactStream::getShape' + ,'::NxOgre::ContactStream::getPatchNormal' + ,'::NxOgre::ContactStream::getPoint' + ,'::NxOgre::ContactStream::getNxActor' + ,'::NxOgre::ContactStream::getActor' + ,'::NxOgre::MemoryStream::skip' + ,'::NxOgre::MemoryStream::seek' + ,'::NxOgre::WheelSet::setMotorTorque' + ,'::NxOgre::WheelSet::setBrakeTorque' + ,'::NxOgre::WheelSet::turn' + ,'::NxOgre::Material::setDirOfAnisotropy' + ,'::NxOgre::OgreNodeRenderable::addSceneNode' +# ,'::NxOgre::ResourceStreamPtr::ResourceStreamPtr' + ,'::NxOgre::MaterialAlias::generateConversionList' + + ] + for e in excludes: + print "excluding ", e + main_ns.member_functions(e).exclude() + + ## this is probably excessive :) + names = ['_begin','_end', '_atEnd', '_next'] + for f in main_ns.member_functions(): + if f.name in names: + print "excluding MF:", f.name, f + f.exclude() + elif f.name.startswith('getActors'): # these return 'Actors' which doesn't exist + print "excluding MF:", f.name + f.exclude() + + ### Free Functions + excludes = [] + for e in excludes: + main_ns.free_functions(e).exclude() + + ## Classes + excludes = [ + 'DistanceJoint' ## constructor issue TOFIX + ,'JointCallback' ## also no suitable/defaul constructor TOFIX + ,'Character' ## defined in header but not very much implementation +# ,'RenderableSource' + ,'ResourceManager' +# ,'ResourceStreamPtr' + ,'::NxOgre::Blueprints::ActorFactory' + ,'State' + ,'MeshResource' + ,'::NxOgre::Serialiser::SerialiserBase' + ] + for e in excludes: + print "Excluding", e + main_ns.class_(e).exclude() +# # # +# # # + ## I have a challenge that Py++ doesn't recognise these classes by full name (perhaps because they are structs?) + ## so I have to look through and match on a class by class basis + excludeName = ['Container<NxOgre::Scene::Renderables, float>' + ,'Container<std::string, NxOgre::Actor*>' + ,'List<NxOgre::CharacterHitReport*>' + ,'List<NxOgre::RemoteDebuggerConnection::Camera>' + ,'List<NxOgre::Blueprints::ActorBlueprint*>' + ,'Container<std::string, NxOgre::Joint*>' + ] + for c in main_ns.classes(): +# print c.decl_string + print ("Checking:",c.name) + if c.name in excludeName: + print ("SPECIAL excluding ", c.name) + c.exclude() + # a temporary fix for container based classes -- still an issue with them though... + # AND this is an overkill -- not all classes need these removed... + if c.decl_string.startswith ('::NxOgre::Container<'): + for f in c.member_functions(allow_empty=True): + if f.name in ['begin','get','next','destroyAndEraseAll','destroyAllOwned','CopyTo']: + f.exclude() + + ### Variables + excludes = ['::NxOgre::WheelSet::mEngine' # desctuctor in WheelSet is protected so can't wrap this.. + ] + for e in excludes: + main_ns.variable(e).exclude() + + ### Typedefs + excludes = [ + ] + for e in excludes: + main_ns.typedefs(e).exclude() + + ### Operators + excludes=['::NxOgre::Container<std::string, NxOgre::FluidDrain*>::operator[]' + ,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::operator[]'] + for e in excludes: + main_ns.operators(e).exclude() + + ### Constructors + for c in main_ns.class_('::NxOgre::Pose').constructors(): ## these hide the working constructors + for a in c.arguments: + if 'NxVec3' in a.type.decl_string or 'NxQuat' in a.type.decl_string: + c.exclude() + break +# # # + +############################################################ +## +## And there are things that manually need to be INCLUDED +## +############################################################ + +def ManualInclude ( mb ): + global_ns = mb.global_ns + main_ns = global_ns.namespace( MAIN_NAMESPACE ) +# for f in main_ns.member_functions(): +# print f +# sys.exit() + c=main_ns.class_('ClothVertex') + c.include() + for m in c.member_functions(): + m.exclude() + c.member_function('getGlobalPosition').include() ## this is the only function implemented + +# # global_ns.namespace( 'Ogre' ).class_('AxisAlignedBox').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Radian').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('SceneNode').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('IndexData').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('SceneManager').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Matrix4').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Degree').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Quaternion').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Node').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Serializer').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('FrameListener').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Matrix3').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Material').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Camera').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('MeshPtr').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('FrameEvent').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Root').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Entity').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('SubMesh').include(already_exposed=True) + + + +############################################################ +## +## And things that need manual fixes, but not necessarly hand wrapped +## +############################################################ +def ManualFixes ( mb ): + + global_ns = mb.global_ns + + # fix issue where the namespace isn't in the default values + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + + for c in main_ns.constructors(): + for a in c.arguments: + if a.default_value and a.default_value.startswith("param"): + t1,t2=a.default_value.split('<') + a.default_value="NxOgre::"+t1+"<NxOgre::"+t2 + elif a.default_value and a.default_value == 'IN_ORDER': + a.default_value = 'NxOgre::NxIterator::IN_ORDER' + for c in main_ns.member_functions(): + for a in c.arguments: + if a.default_value and a.default_value.startswith("param"): + t1,t2=a.default_value.split('<') + a.default_value="NxOgre::"+t1+"<NxOgre::"+t2 + + +############################################################ +## +## And things that need to have their argument and call values fixed. +## ie functions that pass pointers in the argument list and of course we need +## to read the updated values - so instead we pass them back +## as new values in a tuple (ETC ETC) +## +############################################################ + +def ManualTransformations ( mb ): + global_ns = mb.global_ns + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + + def create_output( size ): + return [ ft.output( i ) for i in range( size ) ] +# c = main_ns.mem_fun('::NxOgre::Cloth::raycast') +# c.add_transformation(ft.inout('vertexId')) +# c.documentation = docit('','VertexId is in/out','bool, vertexId') + +# for x in ns.member_functions('::NxOgre::Params::Set'): +# x.add_transformation(ft.inout("arg2")) +# x.documentation = docit ("", "arg2 is an in/out","ret,arg2" ) + +############################################################################### +## +## Now for the AUTOMATIC stuff that should just work +## +############################################################################### + + +def AutoExclude( mb ): + """ Automaticaly exclude a range of things that don't convert well from C++ to Python + """ + global_ns = mb.global_ns + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + + # vars that are static consts but have their values set in the header file are bad + Remove_Static_Consts ( main_ns ) + + ## Exclude protected and private that are not pure virtual + query = ~declarations.access_type_matcher_t( 'public' ) \ + & ~declarations.virtuality_type_matcher_t( declarations.VIRTUALITY_TYPES.PURE_VIRTUAL ) + non_public_non_pure_virtual = main_ns.calldefs( query ) + non_public_non_pure_virtual.exclude() + + #Virtual functions that return reference could not be overriden from Python + query = declarations.virtuality_type_matcher_t( declarations.VIRTUALITY_TYPES.VIRTUAL ) \ + & declarations.custom_matcher_t( lambda decl: declarations.is_reference( decl.return_type ) ) + try: + main_ns.calldefs( query ).virtuality = declarations.VIRTUALITY_TYPES.NOT_VIRTUAL + except: + pass + +def AutoInclude( mb ): + main_ns = mb.global_ns ## doesn't have it's own namespace.. +# # for cls in main_ns.classes(): +# # try: +# # if cls.decl_string[2:4]=='Nx' and cls.decl_string[4].isupper(): +# # cls.include() +# # except: +# # pass +# # ## and we'll need the free functions as well +# # for funcs in main_ns.free_functions (): +# # if funcs.name[0:2]=='Nx' and funcs.name[2].isupper(): +# # funcs.include() +# # +# # for var in main_ns.variables (): +# # # print "checking var ", var.name +# # if len(var.name) > 2: +# # if var.name[0:2]=='Nx' and var.name[2].isupper(): +# # var.include() +# # for var in main_ns.typedefs (): +# # # print "checking typedef ", var.name +# # if len(var.name) > 2: +# # if var.name[0:2]=='Nx' and var.name[2].isupper(): +# # var.include() +# # + + +def AutoFixes ( mb ): + """ now we fix a range of things automatically - typically by going through + the entire name space trying to guess stuff and fix it:) + """ + global_ns = mb.global_ns + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + + # arguments passed as refs but not const are not liked by boost + #Fix_Ref_Not_Const ( main_ns ) + + # Functions that have void pointers in their argument list need to change to unsigned int's +# # Fix_Void_Ptr_Args ( main_ns ) + + # and change functions that return a variety of pointers to instead return unsigned int's + pointee_types=['unsigned int','int', 'float', '::Ogre::Real', '::Ogre::uchar', '::Ogre::uint8', 'unsigned char', 'char'] + ignore_names=['ptr', 'useCountPointer'] # these are function names we know it's cool to exclude + common_utils.Fix_Pointer_Returns ( main_ns, pointee_types, ignore_names ) + + # functions that need to have implicit conversions turned off + ImplicitClasses=[] + common_utils.Fix_Implicit_Conversions ( main_ns, ImplicitClasses ) + + + if os.name =='nt': + Fix_NT( mb ) + elif os.name =='posix': + Fix_Posix( mb ) + + common_utils.Auto_Document( mb, MAIN_NAMESPACE ) + + +############################################################################### +## +## here are the helper functions that do much of the work +## +############################################################################### +def Fix_Posix ( mb ): + """ fixup for posix specific stuff -- note only expect to be called on a posix machine + """ + ## we could do more here if need be... + if sys.platform == 'darwin': + pass + elif sys.platform.startswith ('linux'): + pass + + +def Fix_NT ( mb ): + """ fixup for NT systems + """ + + +def Fix_Implicit_Conversions ( mb ): + """By default we disable explicit conversion, however sometimes it makes sense + """ + return +# for c in mb.classes(): +# if c.name.endswith ('Params'): +# print "Implicit Conversion:", c +# for con in c.constructors(): +# print con.decl_string +# con.allow_implicit_conversion = True + + ImplicitClasses=['::NxOgre::Pose'] + for className in ImplicitClasses: + for c in mb.class_(className).constructors(): + print "Checking", c.decl_string + if "Quat" in c.decl_string or "Real" in c.decl_string: ## exclude quats as cause issues + c.allow_implicit_conversion = False + print "NOT OK" + elif "Vector" in c.decl_string : + c.allow_implicit_conversion = True + print "OK" + else: + print "NOT OK" + for op in mb.class_(className).operators(): + print "Checking **", op.decl_string + + +def Add_Auto_Conversions( mb ): + pass + + +def Set_Call_Policies( mb ): + """ set the return call policies on classes that this hasn't already been done for. + Set the default policy to deal with pointer/reference return types to reference_existing object + """ + mem_funs = mb.calldefs () + mem_funs.create_with_signature = True #Generated code will not compile on + #MSVC 7.1 if function has throw modifier. + for mem_fun in mem_funs: + if mem_fun.call_policies: + continue + if not mem_fun.call_policies and \ + (declarations.is_reference (mem_fun.return_type) or declarations.is_pointer (mem_fun.return_type) ): + mem_fun.call_policies = call_policies.return_value_policy( + call_policies.reference_existing_object ) + + +def Set_Exception(mb): + pass + #~ """We don't exclude Exception, because it contains functionality, that could + #~ be useful to user. But, we will provide automatic exception translator + #~ """ + #~ Exception = mb.namespace( 'Ogre' ).class_( 'Exception' ) + #~ Exception.include() + #~ Exception.mem_fun('what').exclude() # declared with empty throw + #~ Exception.mem_fun('getNumber').exclude() # declared with empty throw + #~ Exception.translate_exception_to_string( 'PyExc_RuntimeError', 'exc.getFullDescription().c_str()' ) + + +def _ReturnUnsignedInt( type_ ): + """helper to return an UnsignedInt call for tranformation functions + """ + return declarations.cpptypes.unsigned_int_t() + +def Fix_Void_Ptr_Args ( mb ): + """ we modify functions that take void *'s in their argument list to instead take + unsigned ints, which allows us to use CTypes buffers + """ + for fun in mb.member_functions(): + arg_position = 0 + for arg in fun.arguments: + if declarations.type_traits.is_void_pointer(arg.type): + fun.add_transformation( ft.modify_type(arg_position,_ReturnUnsignedInt ) ) + fun.documentation = docit ("Modified Input Argument to work with CTypes", + "Argument "+arg.name+ "(pos:" + str(arg_position)\ + +") takes a CTypes.adddressof(xx)", "...") + #print "Fixed Void Ptr", fun, arg_position + break + arg_position +=1 + + ## lets go and look for stuff that might be a problem + pointee_types=['unsigned int',' int ', ' float ', ' Real ', 'uchar', 'uint8', + 'unsigned char'] + + function_names=[] + for fun in mb.member_functions(): + if fun.documentation or fun.ignore: continue ## means it's been tweaked somewhere else + for n in function_names: + if n in fun.name: + print "CHECK :", fun + break + arg_position = 0 + for arg in fun.arguments: + if declarations.is_pointer(arg.type): ## and "const" not in arg.type.decl_string: + for i in pointee_types: + if i in arg.type.decl_string: + print '"',arg.type.decl_string, '"' + print "CHECK ", fun, str(arg_position) + fun.documentation=docit("SUSPECT - MAYBE BROKEN", "....", "...") + break + arg_position +=1 + +## NEED To do the same for constructors + for fun in mb.constructors(): + arg_position = 0 + for arg in fun.arguments: + if declarations.is_pointer(arg.type): ## and "const" not in arg.type.decl_string: + for i in pointee_types: + if i in arg.type.decl_string: + print '"',arg.type.decl_string, '"' + print "Excluding: ", fun + fun.exclude() + break + arg_position +=1 + +def Fix_Pointer_Returns ( mb ): + """ Change out functions that return a variety of pointer to base types and instead + have them return the address the pointer is pointing to (the pointer value) + This allow us to use CTypes to handle in memory buffers from Python + + Also - if documentation has been set then ignore the class/function as it means it's been tweaked else where + """ + pointee_types=['unsigned int','int', 'float', 'unsigned char'] + known_names=[] # these are function names we know it's cool to exclude + for fun in mb.member_functions(): + if declarations.is_pointer (fun.return_type) and not fun.documentation: + for i in pointee_types: + if fun.return_type.decl_string.startswith ( i ) and not fun.documentation: + if not fun.name in known_names: + print "Excluding (function):", fun, "as it returns (pointer)", i + fun.exclude() + for fun in mb.member_operators(): + if declarations.is_pointer (fun.return_type) and not fun.documentation: + for i in pointee_types: + if fun.return_type.decl_string.startswith ( i ) and not fun.documentation: + print "Excluding (operator):", fun + fun.exclude() + + + +def query_containers_with_ptrs(decl): + if not isinstance( decl, declarations.class_types ): + return False + if not decl.indexing_suite: + return False + return declarations.is_pointer( decl.indexing_suite.element_type ) + + +def Remove_Static_Consts ( mb ): + """ linux users have compile problems with vars that are static consts AND have values set in the .h files + we can simply leave these out """ + checker = varchecker.var_checker() + for var in mb.vars(): + if type(var.type) == declarations.cpptypes.const_t: + if checker( var ): + print "Excluding static const ", var + var.exclude() + +# +# the 'main'function +# +def generate_code(): + messages.disable( +# Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X + messages.W1020 + , messages.W1021 + , messages.W1022 + , messages.W1023 + , messages.W1024 + , messages.W1025 + , messages.W1026 + , messages.W1027 + , messages.W1028 + , messages.W1029 + , messages.W1030 + , messages.W1031 + , messages.W1035 + , messages.W1040 + , messages.W1038 + , messages.W1039 + , messages.W1041 + , messages.W1036 # pointer to Python immutable member + , messages.W1033 # unnamed variables + , messages.W1018 # expose unnamed classes + , messages.W1049 # returns reference to local variable + , messages.W1014 # unsupported '=' operator + ) + # + # Use GCCXML to create the controlling XML file. + # If the cache file (../cache/*.xml) doesn't exist it gets created, otherwise it just gets loaded + # NOTE: If you update the source library code you need to manually delete the cache .XML file + # + xml_cached_fc = parser.create_cached_source_fc( + os.path.join( environment.nxogre_0.9.root_dir, "python_nxogre.h" ) + , environment.nxogre_0.9.cache_file ) + if os.name == 'nt': + defined_symbols = [ 'NxExport','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32', 'GCC_XML']#NXOGRE_EXPORTS' + else: + defined_symbols = [ 'LINUX','NX_LINUX', 'NX_DISABLE_FLUIDS', 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'GCC_XML'] + + if environment._USE_THREADS: + defined_symbols.append('BOOST_HAS_THREADS') + defined_symbols.append('BOOST_HAS_WINTHREADS') + defined_symbols.append( 'VERSION_' + environment.nxogre_0.9.version ) + + undefined_symbols = [] + # + # build the core Py++ system from the GCCXML created source + # + mb = module_builder.module_builder_t( [ xml_cached_fc ] + , gccxml_path=environment.gccxml_bin + , working_directory=environment.root_dir + , include_paths=environment.nxogre_0.9.include_dirs + , define_symbols=defined_symbols +# # , undefine_symbols = undefined_symbols + , indexing_suite_version=2 + , cflags=environment.ogre.cflags + ) + # NOTE THE CHANGE HERE + mb.constructors().allow_implicit_conversion = False + ## This module depends on Ogre and physx + mb.register_module_dependency ( environment.ogre.generated_dir ) + mb.register_module_dependency ( environment.physx.generated_dir ) + + mb.BOOST_PYTHON_MAX_ARITY = 25 + mb.classes().always_expose_using_scope = True + + + # + # We filter (both include and exclude) specific classes and functions that we want to wrap + # + global_ns = mb.global_ns + global_ns.exclude() + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + main_ns.include() + + + AutoExclude ( mb ) + ManualExclude ( mb ) + AutoInclude ( mb ) + ManualInclude ( mb ) + # here we fixup functions that expect to modifiy their 'passed' variables + common_utils.Auto_Functional_Transformation ( main_ns ) #, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] ) + ManualTransformations ( mb ) + + AutoFixes ( mb ) + ManualFixes ( mb ) + + # + # We need to tell boost how to handle calling (and returning from) certain functions + # + Set_Call_Policies ( mb.global_ns.namespace (MAIN_NAMESPACE) ) + +# # for op in main_ns.operators(): +# # print "op1", op +# # # if op.allow_implicit_conversion: +# # # print "Implicit conversion on operator ", op +# # print dir(op) +# # for op in main_ns.constructors(): +# # print "con1", op +# # if op.allow_implicit_conversion: +# # print "Implicit conversion on constructor ", op +# # print dir(op) +# # for op in main_ns.free_operators(): +# # print "op2", op +# # # if op.allow_implicit_conversion: +# # # print "Implicit conversion on free operator ", op +# # print dir(op) + + # + # the manual stuff all done here !!! + # + hand_made_wrappers.apply( mb ) + + NoPropClasses = [""] + for cls in main_ns.classes(): + if cls.name not in NoPropClasses: + cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) + + common_utils.add_constants( mb, { 'PROJECT_version' : '"%s"' % environment.nxogre_0.9.version.replace("\n", "\\\n") + , 'python_version' : '"%s"' % sys.version.replace("\n", "\\\n" ) } ) + + ## need to create a welcome doc string for this... + common_utils.add_constants( mb, { '__doc__' : '"NxOgre 0.9 PROJECT DESCRIPTION"' } ) + + + ########################################################################################## + # + # Creating the code. After this step you should not modify/customize declarations. + # + ########################################################################################## + extractor = exdoc.doc_extractor("") # I'm excluding the UTFstring docs as lots about nothing + mb.build_code_creator (module_name='_nxogre_0.9_' , doc_extractor= extractor ) + + for inc in environment.nxogre_0.9.include_dirs: + mb.code_creator.user_defined_directories.append(inc ) + mb.code_creator.user_defined_directories.append( environment.nxogre_0.9.generated_dir ) + mb.code_creator.replace_included_headers( customization_data.header_files( environment.nxogre_0.9.version ) ) + + huge_classes = map( mb.class_, customization_data.huge_classes( environment.nxogre_0.9.version ) ) + + mb.split_module(environment.nxogre_0.9.generated_dir, huge_classes,use_files_sum_repository=False) + + ## now we need to ensure a series of headers and additional source files are + ## copied to the generaated directory.. + common_utils.copyTree ( sourcePath = environment.Config.PATH_NxOgre_0.9, + destPath = environment.nxogre_0.9.generated_dir, + recursive=False ) + +if __name__ == '__main__': + start_time = time.clock() + generate_code() + print 'Source code was updated( %f minutes ).' % ( ( time.clock() - start_time )/60 ) Added: trunk/python-ogre/code_generators/nxogre_0.9/hand_made_wrappers.py =================================================================== --- trunk/python-ogre/code_generators/nxogre_0.9/hand_made_wrappers.py (rev 0) +++ trunk/python-ogre/code_generators/nxogre_0.9/hand_made_wrappers.py 2008-01-16 05:25:37 UTC (rev 548) @@ -0,0 +1,15 @@ +import os +import environment + + + +################################################################################################# +################################################################################################# + +def apply_reg ( class_, code ): + for c in code: + class_.add_registration_code ( c ) + +def apply( mb ): + pass + \ No newline at end of file Added: trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre.h =================================================================== --- trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre.h (rev 0) +++ trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre.h 2008-01-16 05:25:37 UTC (rev 548) @@ -0,0 +1,24 @@ + +#include "NxOgre.h" +#include "NxOgreSkeleton.h" //missing ?? +#include "NxOgreResourceMesh.h" // not included anywhere by default... +#include "Ogre.h" +#include "OgrePlugin.h" +#include <NxPhysics.h> + +// First we create a magic namespace to hold all our aliases +namespace pyplusplus { namespace aliases { + + #include "python_nxogre_aliases.h" +} } + +// then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ +// +namespace python_nxogre{ namespace details{ +inline void instantiate(){ + using namespace NxOgre; + #include "python_nxogre_sizeof.h" + +} } } + + Added: trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_aliases.h =================================================================== --- trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_aliases.h (rev 0) +++ trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_aliases.h 2008-01-16 05:25:37 UTC (rev 548) @@ -0,0 +1,169 @@ +typedef std::vector<NxOgre::Joint::LimitPlane,std::allocator<NxOgre::Joint::LimitPlane> > VectorJointLimitPlane; +typedef std::vector<NxOgre::SimplePlane*,std::allocator<NxOgre::SimplePlane*> > VectorSimplePlane; + +typedef std::vector<float, std::allocator<float> > VectorFloat; +typedef std::vector<std::string, std::allocator<std::string> > VectorString; +typedef std::list<std::string> stdString; +typedef std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > MapPairString; +typedef std::vector<Ogre::Plane, std::allocator<Ogre::Plane> > VectorPlane; +typedef std::vector<Ogre::Vector4, std::allocator<Ogre::Vector4> > VectorVector4; +typedef std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >\ + PairString; + +typedef NxOgre::List<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > ListString; +typedef NxOgre::List<NxOgre::Blueprints::ActorBlueprint*> ListBlueprints; +typedef NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&> ContainerShapeBlueprint; +//typedef NxOgre::Container<std::string, NxOgre::ActorBlueprint> ContainerActorBlueprint; +//typedef NxOgre::Container<NxOgre::Scene::Renderables, float> ContainerSceneRencerables; +typedef std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,float,std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, float> > >\ + MapStrings; +typedef std::map<unsigned, float, std::less<unsigned>, std::allocator<std::pair<unsigned const, float> > >\ + MapUnsignedFloat; +typedef std::vector<NxOgre::Scene*, std::allocator<NxOgre::Scene*> > VectorScene; +typedef std::list<NxOgre::Blueprints::ActorBlueprint*, std::allocator<NxOgre::Blueprints::ActorBlueprint*> > ListBlueprintsActorBlueprint; +typedef std::list<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > >\ + ListPairString; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::DominanceGroup*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::DominanceGroup*>::Containee> > >\ + MapContainerDominanceGroup; + + +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Scene*>::Containee, std::less<std::string> >\ + MapContainerScene; +typedef std::list<NxOgre::CharacterHitReport*, std::allocator<NxOgre::CharacterHitReport*> > ListCharacterHitReportPtr; +typedef std::list<NxOgre::Wheel*, std::allocator<NxOgre::Wheel*> > ListWheelPtr; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Actor*>::Containee, std::less<std::string> >\ + MapContainerActor; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Cloth*>::Containee, std::less<std::string> >\ + MapContainerCloth; +// typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Helper*>::Containee, std::less<std::string> >\ +// MapContainerHelper; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Joint*>::Containee, std::less<std::string> >\ + MapContainerJoint; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Material*>::Containee, std::less<std::string> >\ + MapContainerMaterial; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Character*>::Containee, std::less<std::string> >\ + MapContainerCharacter; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Fluid*>::Containee, std::less<std::string> >\ + MapContainerFluid; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidDrain*>::Containee, std::less<std::string> >\ + MapContainerFluidDrain; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidEmitter*>::Containee, std::less<std::string> >\ + MapContainerFluidEmitter; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::SoftBody*>::Containee, std::less<std::string> >\ + MapContainerSoftBody; + +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::RayCastHit>::Containee, std::less<std::string> >\ + MapContainerRayCastHit; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ShapeGroup*>::Containee, std::less<std::string> >\ + MapContainerShapeGroup; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Trigger*>::Containee, std::less<std::string> >\ + MapContainerTrigger; +typedef std::list<NxOgre::RemoteDebuggerConnection::Camera, std::allocator<NxOgre::RemoteDebuggerConnection::Camera> >\ + ListRemoteDebuggerConnectionCamera; +// typedef std::vector<NxOgre::Summary::Feature> VectorSummaryFeature; +typedef std::map<unsigned, NxOgre::Container<unsigned, NxOgre::Shape*>::Containee, std::less<unsigned> >\ + MapContainerUnsignedShape; +typedef std::map<unsigned, NxOgre::Container<unsigned, NxOgre::ErrorReporter*>::Containee, std::less<unsigned> >\ + MapContainerUnsignedErrorReporter; +typedef std::map<unsigned short, NxOgre::Container<unsigned short, NxOgre::ShapeGroup*>::Containee, std::less<unsigned short> >\ + MapContainerShortShapeGroup; +typedef std::map<unsigned short, NxOgre::Container<unsigned short, NxOgre::ActorGroup*>::Containee, std::less<unsigned short> >\ + MapContainerShortActorGroup; +typedef std::map<unsigned short, NxOgre::Container<unsigned short, NxOgre::Material*>::Containee, std::less<unsigned short> >\ + MapContainerShortMaterial; +typedef std::map<std::string, NxOgre::Container<std::string, unsigned short>::Containee, std::less<std::string> >\ + MapContainerShortString; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ActorGroup*>::Containee, std::less<std::string> >\ + MapContainerActorGroup; + + + + +typedef NxOgre::List<NxOgre::RemoteDebuggerConnection::Camera> ListRemoteCamera; +// this one is protected :( +// typedef std::map<NxOgre::Scene::Renderables, NxOgre::Container<NxOgre::Scene::Renderables, float>::Containee, std::less<NxOgre::Scene::Renderables> >\ +// MapContainerSceneRenderables; + +typedef NxOgre::Container<NxOgre::NxString, NxOgre::RayCastHit> RayCastReport; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Scene*> Scenes; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::ShapeGroup*> ShapeGroups; +// typedef NxOgre::Container<NxOgre::NxCollisionGroup, NxOgre::ShapeGroup*> ShapeGroupsByIndex; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Trigger*> Triggers; +typedef NxOgre::List<NxOgre::Wheel*> Wheels; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Character*> Characters; +typedef NxOgre::List<NxOgre::CharacterHitReport*> CharacterHitReports; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Fluid*> Fluids; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidDrain*> FluidDrains; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidEmitter*> FluidEmitters; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::SoftBody*> SoftBodies; +typedef std::pair<NxOgre::NxString,NxOgre::NxString> Parameter; +typedef std::vector<Parameter> Parameters; +typedef Ogre::String NxString; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Actor*> Actors; + +typedef NxOgre::Container<std::string, NxConvexMesh*> NxConvexMeshes; +typedef NxOgre::Container<std::string, NxTriangleMesh*> NxTriangleMeshes; +typedef NxOgre::Container<std::string, NxOgre::MaterialAlias*> MaterialAliases; + +typedef NxOgre::Container<unsigned int, NxTriangleMesh*> NxTriangleMesheInts; +typedef NxOgre::Container<unsigned int, NxOgre::ResourceSystem*> ResourceSystemInts; +typedef NxOgre::Container<unsigned int, NxOgre::MaterialAlias*> MaterialAliasInts; +typedef NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*> CharacterMovementModelInts; + +// typedef NxOgre::Container<NxOgre::NxString, ::ActorGroup*> ActorGroups; +// typedef NxOgre::Container<NxOgre::NxActorGroup, NxOgre::ActorGroup*> ActorGroupsByIndex; +typedef NxOgre::Container<NxOgre::NxShapeIndex, NxOgre::Shape*> CollisionModel; +//typedef NxOgre::Container<NxOgre::NxShapeIndex, const NxOgre::ShapeDescription&> CollisionDescriptionModel; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Cloth*> Cloths; +typedef NxOgre::Container<NxOgre::NxErrorIndex, NxOgre::ErrorReporter*> ErrorReporterList; +// // typedef NxOgre::Container<NxOgre::NxString, NxOgre::Helper*> Helpers; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Joint*> JointsClass; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Material*> MaterialList; +// typedef NxOgre::Container<NxOgre::NxMaterialIndex, NxOgre::Material*> MaterialListByIndex; +// typedef NxOgre::Container<NxOgre::NxString, NxOgre::NxMaterialIndex> MaterialPair; + +// typedef std::vector<NxOgre::Feature> FeatureSet; +typedef std::map<std::string, NxOgre::Container<std::string, std::string>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, std::string>::Containee> > >\ + MapContainerString; +//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee> > >\ +// MapContainerActorBlueprint; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ForceField*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::ForceField*>::Containee> > >\ + MapContainerForceField; +typedef std::map<unsigned, NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&>::Containee, std::less<unsigned>, std::allocator<std::pair<unsigned const, NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&>::Containee> > >\ + MapContainerShapeBlueprint; +typedef std::vector<unsigned short, std::allocator<unsigned short> > VectorShort; +typedef std::vector<std::pair<Ogre::Vector3, unsigned>, std::allocator<std::pair<Ogre::Vector3, unsigned> > > VectorPairVector3; +typedef std::set<Ogre::Entity*,std::less<Ogre::Entity*>,std::allocator<Ogre::Entity*> > SetEntity; +typedef NxOgre::Material NxOgreMaterial; +typedef std::map<unsigned, NxOgre::Container<unsigned, NxOgre::Joint*>::Containee, std::less<unsigned>, std::allocator<std::pair<unsigned const, NxOgre::Container<unsigned, NxOgre::Joint*>::Containee> > >\ + MapContainerJointContainee; +typedef std::map<unsigned short, NxOgre::Container<unsigned short, NxOgre::DominanceGroup*>::Containee, std::less<unsigned short>, std::allocator<std::pair<unsigned short const, NxOgre::Container<unsigned short, NxOgre::DominanceGroup*>::Containee> > >\ + MapContainerDominanceGroupContainee; + +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::ShapeBlueprint*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::ShapeBlueprint*>::Containee> > >\ + MapContainerShapeBluePrint; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::Machine*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::Machine*>::Containee> > >\ + MapContainerMachine; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::Wheel*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::Wheel*>::Containee> > >\ + MapContainerWheel; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::RenderableSource*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::RenderableSource*>::Containee> > >\ + MapContainerRenderableSource; + +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee> > >\ + MapContainerCharacterMovementModel; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee> > >\ + MapContainerMaterialAlias; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee> > >\ + MapContainerResourceSystem; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxTriangleMesh*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxTriangleMesh*>::Containee> > >\ + MapContainerNxTriangleMesh; + +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee> > >\ + MapStringContainerMaterialAlias; +typedef std::map<std::string, NxOgre::Container<std::string, NxTriangleMesh*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxTriangleMesh*>::Containee> > >\ + MapStringContainerNxTriangleMesh; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee> > >\ + MapStringContainerCharacterMovementModel; +typedef std::map<std::string, NxOgre::Container<std::string, NxConvexMesh*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxConvexMesh*>::Containee> > >\ + MapStringContainerNxConvexMesh; + \ No newline at end of file Added: trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_sizeof.h =================================================================== --- trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_sizeof.h (rev 0) +++ trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_sizeof.h 2008-01-16 05:25:37 UTC (rev 548) @@ -0,0 +1,63 @@ +// sizeof ( NxControllersHit ); +sizeof ( NxBoxShapeDesc ); +sizeof ( NxPlaneShapeDesc ); +sizeof ( NxControllerManager ); +// sizeof ( NxControllerShapeHit ); +sizeof ( NxPruningStructure ); +sizeof ( NxVec3 ); +sizeof ( NxSceneLimits ); +sizeof ( NxWheelShapeDesc ); +// sizeof ( NxController ); +sizeof ( NxUserRaycastReport ); +// sizeof ( NxControllerAction ); +sizeof ( NxWheelShape ); +sizeof ( NxHeightFieldShapeDesc ); +sizeof ( NxClothMesh ); +sizeof ( NxConvexShapeDesc ); +sizeof ( NxMeshData ); +sizeof ( NxFluid ); +sizeof ( NxHeightFieldAxis ); +sizeof ( NxTriangleMeshShapeDesc ); +sizeof ( NxTriangleMesh ); +sizeof ( NxSweepQueryHit ); +sizeof ( NxSphereShapeDesc ); +sizeof ( NxJointType ); +sizeof ( NxPhysicsSDK ); +sizeof ( NxUserAllocator ); +sizeof ( NxHeightField ); +sizeof ( NxUserContactReport ); +//sizeof ( NxOgre::FluidDrain ); +sizeof ( NxImplicitScreenMesh ); +sizeof ( NxMemoryType ); +sizeof ( NxJointState ); +sizeof ( NxBounds3 ); +sizeof ( NxRaycastHit ); +//sizeof ( NxOgre::FluidEmitter ); +sizeof ( NxContactPairFlag ); +sizeof ( NxClothDesc ); +sizeof ( NxContactPair ); +sizeof ( NxForceMode ); +//sizeof ( NxOgre::Compartment ); +sizeof ( NxCombineMode ); +sizeof ( NxExtendedVec3 ); +sizeof ( NxThreadPriority ); +sizeof ( NxConvexMesh ); +sizeof ( NxContactPair ); +sizeof ( NxSceneLimits ); +sizeof ( NxWheelShape ); +// sizeof ( NxUserControllerHitReport ); +sizeof ( NxSceneDesc ); +sizeof ( NxScene ); +sizeof ( NxPhysicsSDK ); +sizeof ( NxShape ); +sizeof ( NxGroupsMask ); +// sizeof ( NxControllersHit ); +sizeof ( JointCallback ); +sizeof ( JointCallback::JointBreakCallback ); +sizeof(std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >); + +sizeof ( std::pair<std::string, std::string> ); + + + + Added: trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_sizeof.h.windows =================================================================== --- trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_sizeof.h.windows (rev 0) +++ trunk/python-ogre/code_generators/nxogre_0.9/python_nxogre_sizeof.h.windows 2008-01-16 05:25:37 UTC (rev 548) @@ -0,0 +1,63 @@ +sizeof ( NxControllersHit ); +sizeof ( NxBoxShapeDesc ); +sizeof ( NxPlaneShapeDesc ); +sizeof ( NxControllerManager ); +sizeof ( NxControllerShapeHit ); +sizeof ( NxPruningStructure ); +sizeof ( NxVec3 ); +sizeof ( NxSceneLimits ); +sizeof ( NxWheelShapeDesc ); +sizeof ( NxController ); +sizeof ( NxUserRaycastReport ); +sizeof ( NxControllerAction ); +sizeof ( NxWheelShape ); +sizeof ( NxHeightFieldShapeDesc ); +sizeof ( NxClothMesh ); +sizeof ( NxConvexShapeDesc ); +sizeof ( NxMeshData ); +sizeof ( NxFluid ); +sizeof ( NxHeightFieldAxis ); +sizeof ( NxTriangleMeshShapeDesc ); +sizeof ( NxTriangleMesh ); +sizeof ( NxSweepQueryHit ); +sizeof ( NxSphereShapeDesc ); +sizeof ( NxJointType ); +sizeof ( NxPhysicsSDK ); +sizeof ( NxUserAllocator ); +sizeof ( NxHeightField ); +sizeof ( NxUserContactReport ); +//sizeof ( NxOgre::FluidDrain ); +sizeof ( NxImplicitScreenMesh ); +sizeof ( NxMemoryType ); +sizeof ( NxJointState ); +sizeof ( NxBounds3 ); +sizeof ( NxRaycastHit ); +//sizeof ( NxOgre::FluidEmitter ); +sizeof ( NxContactPairFlag ); +sizeof ( NxClothDesc ); +sizeof ( NxContactPair ); +sizeof ( NxForceMode ); +//sizeof ( NxOgre::Compartment ); +sizeof ( NxCombineMode ); +sizeof ( NxExtendedVec3 ); +sizeof ( NxThreadPriority ); +sizeof ( NxConvexMesh ); +sizeof ( NxContactPair ); +sizeof ( NxSceneLimits ); +sizeof ( NxWheelShape ); +sizeof ( NxUserControllerHitReport ); +sizeof ( NxSceneDesc ); +sizeof ( NxScene ); +sizeof ( NxPhysicsSDK ); +sizeof ( NxShape ); +sizeof ( NxGroupsMask ); +sizeof ( NxControllersHit ); +sizeof ( JointCallback ); +sizeof ( JointCallback::JointBreakCallback ); +sizeof(std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >); + +sizeof ( std::pair<std::string, std::string> ); + + + + Added: trunk/python-ogre/code_generators/nxogre_0.9/register_exceptions.py =================================================================== --- trunk/python-ogre/code_generators/nxogre_0.9/register_exceptions.py (rev 0) +++ trunk/python-ogre/code_generators/nxogre_0.9/register_exceptions.py 2008-01-16 05:25:37 UTC (rev 548) @@ -0,0 +1,137 @@ +import os +import environment +from string import Template + +base_exception = \ +""" +class OgreException(Exception): + def __init__( self, app_error ): + Exception.__init__( self ) + self._pimpl = app_error + + def __str__( self ): + return self._pimpl.getFullDescription() + + def __getattribute__(self, attr): + my_pimpl = super(OgreException, self).__getattribute__("_pimpl") + try: + return getattr(my_pimpl, attr) + except AttributeError: + return super(OgreException,self).__getattribute__(attr) + +_ogre_.OgreException = OgreException +#this one for backward compatability +_ogre_.Exception = OgreException +_ogre_._Exception_.py_err_class = OgreException +""".strip() + +derived_py_exception = \ +""" +class Ogre${err_class}(OgreException): + def __init__( self, app_error ): + OgreException.__init__( self, app_error ) + + def __getattribute__(self, attr): + return super(Ogre${err_class},self).__getattribute__(attr) + +_ogre_._${err_class}_.py_err_class = Ogre${err_class} +_ogre_.Ogre${err_class} = Ogre${err_class} +""".strip() + +register_translator = """${err_class}_exception_translator();""" + +exception_translator = \ +""" + +struct ${err_class}_exception_translator{ + + typedef Ogre::${err_class} exception_type; + typedef ${err_class}_exception_translator translator_type; + + ${err_class}_exception_translator(){ + bp::converter::registry::push_back( &translator_type::convertible + , &translator_type::construct + , bp::type_id<exception_type>() ); + + bp::register_exception_translator<exception_type>(&translator_type::translate); + } + + static void + translate( const exception_type& err ){ + bp::object pimpl_err( err ); + bp::object pyerr_class = pimpl_err.attr( "py_err_class" ); + bp::object pyerr = pyerr_class( pimpl_err ); + PyErr_SetObject( pyerr_class.ptr(), bp::incref( pyerr.ptr() ) ); + } + + //Sometimes, exceptions should be passed back to the library. + static void* + convertible(PyObject* py_obj){ + if( 1 != PyObject_IsInstance( py_obj, PyExc_Exception ) ){ + return 0; + } + + if( !PyObject_HasAttrString( py_obj, "_pimpl" ) ){ + return 0; + } + + bp::object pyerr( bp::handle<>( bp::borrowed( py_obj ) ) ); + bp::object pimpl = bp::getattr( pyerr, "_pimpl" ); + bp::extract<exception_type> type_checker( pimpl ); + if( !type_checker.check() ){ + return 0; + } + return py_obj; + } + + static void + construct( PyObject* py_obj, bp::converter::rvalue_from_python_stage1_data* data){ + typedef bp::converter::rvalue_from_python_storage<exception_type> storage_t; + + bp::object pyerr( bp::handle<>( bp::borrowed( py_obj ) ) ); + bp::object pimpl = bp::getattr( pyerr, "_pim... [truncated message content] |
From: <and...@us...> - 2008-01-16 02:52:56
|
Revision: 547 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=547&view=rev Author: andy_miller Date: 2008-01-15 18:53:00 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Adding the 0.9 version of NxOgre Added Paths: ----------- trunk/python-ogre/ThirdParty/nxogre_0.9/ trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgre.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActor.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActor.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActorBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActorBlueprint.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreBlueprint.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreBody.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreBody.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCharacter.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCharacter.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCharacterController.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCharacterController.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCharacterHitReport.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCharacterHitReport.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCloth.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCloth.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreClothRaycaster.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreClothRaycaster.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCollisionModel.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCompound.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCompound.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreContainer.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreContainer.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCooking.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreCooking.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreDebugRenderer.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreDebugRenderer.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreDominanceGroup.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreDominanceGroup.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreEnumsBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreEnumsBlueprint.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreError.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreError.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreFluid.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreFluid.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreFluidMesh.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreFluidMesh.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreForceField.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreForceField.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreGlobalFunctions.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreGroup.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreGroup.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreHelper.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreHelper.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreHelpers.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreHelpers.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreIntersection.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreIntersection.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJSON.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJSON.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJSONCollection.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJSONRead.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJSONSchema.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJSONWrite.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJoint.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJoint.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJointSet1.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJointSet1.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJointSet2.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreJointSet2.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreLog.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreLog.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreMaterial.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreMaterial.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreMeshManager.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreMeshManager.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreMotor.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreMotor.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreNxSerialiser.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreNxSerialiser.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreNxuStreamSerialiser.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreParametersBlueprint.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreParams.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreParams.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgrePhysXDriver.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgrePhysXDriver.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgrePose.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgrePose.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgrePrerequisites.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreRaycaster.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreRaycaster.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreRemoteDebuggerConnection.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreRemoteDebuggerConnection.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreScene.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreScene.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSceneBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSceneBlueprint.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSceneContactController.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSceneContactController.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSceneController.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSceneController.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSceneTriggerController.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSceneTriggerController.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSerialiser.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSerialiser.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShape.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShape.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprint.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintConvex.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintConvex.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintMesh.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintMesh.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintPrimitives.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintPrimitives.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintTerrain.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintTerrain.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintWheel.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeBlueprintWheel.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeConvex.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeConvex.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeDescription.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeDescriptionConvex.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeDescriptionMesh.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeDescriptionPrimitives.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeDescriptionTerrain.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeDescriptionWheel.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeMesh.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeMesh.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapePrimitives.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapePrimitives.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeTerrain.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeTerrain.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeWheel.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreShapeWheel.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSimpleShape.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSimpleShape.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSkeleton.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSkeleton.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSoftBody.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSoftBody.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreStable.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreStable.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreState.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreStateMachine.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSummary.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreSummary.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreTesting.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreTesting.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreTrigger.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreTrigger.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreUserAllocator.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreUserAllocator.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreUserData.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreUserStream.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreUserStream.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreWorld.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreWorld.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreWorldBlueprint.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreWorldBlueprint.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/ trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_Asc2Bin.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_Asc2Bin.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_ColladaExport.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_ColladaExport.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_ColladaImport.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_ColladaImport.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_File.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_File.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_Geometry.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_Geometry.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_GraphicsMesh.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_GraphicsMesh.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_PhysicsExport.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_PhysicsExport.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_PhysicsInstantiator.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_PhysicsInstantiator.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_Schema.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_Schema.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_SchemaStream.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_SchemaStream.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_SchemaTypes.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_Streaming.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_Streaming.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_cooking.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_cooking.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_customcopy.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_customcopy.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_helper.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_helper.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_hull.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_hull.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_string.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_string.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_tinystr.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_tinystr.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_tinyxml.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_tinyxml.h trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_tinyxmlerror.cpp trunk/python-ogre/ThirdParty/nxogre_0.9/NxuStream2/NXU_tinyxmlparser.cpp Removed Paths: ------------- trunk/python-ogre/ThirdParty/nxogreOld/ Added: trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgre.h =================================================================== --- trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgre.h (rev 0) +++ trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgre.h 2008-01-16 02:53:00 UTC (rev 547) @@ -0,0 +1,90 @@ +// +// NxOgre a wrapper for the PhysX (formerly Novodex) physics library and the Ogre 3D rendering engine. +// Copyright (C) 2005 - 2007 Robin Southern and NxOgre.org http://www.nxogre.org +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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 GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// + +#ifndef __NXOGRE_H__ +#define __NXOGRE_H__ + +/////////////////////////////////////////// + +#include "NxOgreStable.h" +#include "NxOgrePrerequisites.h" +#include "NxOgrePhysXDriver.h" +#include "NxOgreError.h" +#include "NxOgreLog.h" + +/////////////////////////////////////////// + +#include "NxOgreActor.h" +#include "NxOgreActorBlueprint.h" +#include "NxOgreBody.h" +#include "NxOgreContainer.h" +#include "NxOgreCooking.h" +#include "NxOgreCharacter.h" +#include "NxOgreCharacterController.h" +#include "NxOgreCharacterHitReport.h" +#include "NxOgreCloth.h" +#include "NxOgreClothRaycaster.h" +#include "NxOgreCompound.h" +#include "NxOgreDebugRenderer.h" +#include "NxOgreDominanceGroup.h" +#include "NxOgreEnumsBlueprint.h" +#include "NxOgreFluid.h" +#include "NxOgreFluidMesh.h" +#include "NxOgreForceField.h" +#include "NxOgreGroup.h" +#include "NxOgreHelpers.h" +#include "NxOgreJointSet1.h" +#include "NxOgreJointSet2.h" +#include "NxOgreHelper.h" +#include "NxOgreIntersection.h" +#include "NxOgreMaterial.h" +#include "NxOgreMotor.h" +#include "NxOgreParams.h" +#include "NxOgrePose.h" +#include "NxOgreRaycaster.h" +#include "NxOgreRemoteDebuggerConnection.h" +#include "NxOgreSerialiser.h" +#include "NxOgreScene.h" +#include "NxOgreSceneBlueprint.h" +#include "NxOgreSceneController.h" +#include "NxOgreSceneContactController.h" +#include "NxOgreShape.h" +#include "NxOgreShapeBlueprint.h" +#include "NxOgreShapeBlueprintConvex.h" +#include "NxOgreShapeBlueprintMesh.h" +#include "NxOgreShapeBlueprintPrimitives.h" +#include "NxOgreShapeBlueprintTerrain.h" +#include "NxOgreShapeBlueprintWheel.h" +#include "NxOgreShapeConvex.h" +#include "NxOgreShapeMesh.h" +#include "NxOgreShapePrimitives.h" +#include "NxOgreShapeTerrain.h" +#include "NxOgreShapeWheel.h" +#include "NxOgreSimpleShape.h" +#include "NxOgreSoftBody.h" +#include "NxOgreState.h" +#include "NxOgreStateMachine.h" +#include "NxOgreTesting.h" +#include "NxOgreTrigger.h" +#include "NxOgreUserStream.h" +#include "NxOgreUserAllocator.h" +#include "NxOgreWorld.h" +#include "NxOgreWorldBlueprint.h" + +#endif Added: trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActor.cpp =================================================================== --- trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActor.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActor.cpp 2008-01-16 02:53:00 UTC (rev 547) @@ -0,0 +1,1117 @@ +// +// NxOgre a wrapper for the PhysX (formerly Novodex) physics library and the Ogre 3D rendering engine. +// Copyright (C) 2005 - 2007 Robin Southern and NxOgre.org http://www.nxogre.org +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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 GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// + +#include "NxOgreStable.h" +#include "NxOgreActor.h" +#include "NxOgreActorBlueprint.h" +#include "NxOgreUserData.h" // For NxActorUserData for NxActor +#include "NxOgrePose.h" // For conversions +#include "NxOgreHelpers.h" // For conversions +#include "NxOgreScene.h" // For Actor::mOwner +#include "NxOgreShapeBlueprint.h" // For ShapeBlueprint System +#include "NxOgreDominanceGroup.h" // For Dominance Groups +#include "NxOgreGroup.h" // For ActorGroup and ShapeGroups +#include "NxOgreContainer.h" // For Getting an ActorGroup +#include "NxOgreActorBlueprint.h" // For Quick Duplication. + +namespace NxOgre { + +////////////////////////////////////////////////////////// + +void ActorParams::setToDefault() { + + mDensity = 0.0f; + mActorFlags = 0; + mGroupAsIndex = 0; + mGroupAsName = ""; +#if NX_SDK_VERSION_NUMBER >= 272 + mDominanceGroupAsIndex = 0; + mDominanceGroupAsName = ""; +#endif +#if NX_SDK_VERSION_NUMBER >= 260 + mCompartment = NULL; +#endif + mMassLocalPose . id(); + mMassSpaceInertia . zero(); + mLinearVelocity . zero(); + mAngularVelocity . zero(); + mWakeUpCounter = 20.0f*0.02f; + mMass = 10.0f; + mLinearDamping = 0.0f; + mAngularDamping = 0.05f; + mMaxAngularVelocity = -1.0f; + mBodyFlags = NX_BF_VISUALIZATION; + mSleepLinearVelocity = -1.0f; + mSleepAngularVelocity = -1.0f; + mCCDMotionThreshold = 0.0f; + mSolverIterationCount = 4; + mBodyFlags = NX_BF_ENERGY_SLEEP_TEST; + mSleepEnergyThreshold = -1.0f; + mSleepDamping = 0.0f; + + mNodeScale = Ogre::Vector3(1,1,1); + mNodeName = ""; + mNodeShadows = true; + +} + +////////////////////////////////////////////////////////// + +void ActorParams::parse(Parameters P) { + + for (Parameters::iterator p = P.begin(); p != P.end();p++) { + + if ((*p).first == "static") { + if ( (*p).second.substr(0,1) == "y" || (*p).second.substr(0,1) == "Y") { + mMass = 0; + mDensity = 0; + continue; + } + else { + mMass = 10; + mDensity = 0; + } + } + + if ((*p).first == "kinematic") { + if ( (*p).second.substr(0,1) == "y" || (*p).second.substr(0,1) == "Y") { + mBodyFlags |= NX_BF_KINEMATIC; + if (mMass == 0 || mDensity == 0) { + mMass = 1; + mDensity = 0; + } + } + } + + if (Set("density", (*p), mDensity)) continue; + if (Set("group", (*p), mGroupAsName)) continue; + if (Set("group-index", (*p), mGroupAsIndex)) continue; +#if NX_SDK_VERSION_NUMBER >= 272 + if (Set("dominancegroup", (*p), mDominanceGroupAsName)) continue; + if (Set("dominancegroup-index", (*p), mDominanceGroupAsIndex)) continue; +#endif + if (Set("massspaceinertia", (*p), mMassSpaceInertia)) continue; + if (Set("linearvelocity", (*p), mLinearVelocity)) continue; + if (Set("angularvelocity", (*p), mAngularVelocity)) continue; + if (Set("wakeupcounter", (*p), mWakeUpCounter)) continue; + if (Set("mass", (*p), mMass)) continue; + if (Set("lineardamping", (*p), mLinearDamping)) continue; + if (Set("angulardamping", (*p), mAngularDamping)) continue; + if (Set("maxangularvelocity", (*p), mMaxAngularVelocity)) continue; + if (Set("sleepangularvelocity", (*p), mSleepAngularVelocity)) continue; + if (Set("ccdmotionthreshold", (*p), mCCDMotionThreshold)) continue; + if (Set("solveriterationcount", (*p), mSolverIterationCount)) continue; + if (Set("sleepenergythreshold", (*p), mSleepEnergyThreshold)) continue; + if (Set("sleepdamping", (*p), mSleepDamping)) continue; + if (Set("node-scale", (*p), mNodeScale)) continue; + if (Set("node-shadows", (*p), mNodeShadows)) continue; + if (Set("node", (*p), mNodeName)) continue; + + } + +} + +////////////////////////////////////////////////////////// + +void ActorParams::fromNxActorDesc(NxActorDesc& desc) { + + mDensity = desc.density; + mActorFlags = desc.flags; + mGroupAsIndex = desc.group; +#if NX_SDK_VERSION_NUMBER >= 272 + mDominanceGroupAsIndex = desc.dominanceGroup; +#endif +#if NX_SDK_VERSION_NUMBER >= 260 + mCompartment = desc.compartment; +#endif +} + +////////////////////////////////////////////////////////// + +void ActorParams::fromNxBodyDesc(NxBodyDesc& desc) { + + mMassLocalPose = desc.massLocalPose; + mMassSpaceInertia = desc.massSpaceInertia; + mLinearVelocity = desc.linearVelocity; + mAngularVelocity = desc.angularVelocity; + mWakeUpCounter = desc.wakeUpCounter; + mMass = desc.mass; + mLinearDamping = desc.linearDamping; + mAngularDamping = desc.angularDamping; + mMaxAngularVelocity = desc.maxAngularVelocity; + mBodyFlags = desc.flags; + mSleepLinearVelocity = desc.sleepLinearVelocity; + mSleepAngularVelocity = desc.sleepAngularVelocity; + mCCDMotionThreshold = desc.CCDMotionThreshold; + mSolverIterationCount = desc.solverIterationCount; + mBodyFlags = desc.flags; + mSleepEnergyThreshold = desc.sleepEnergyThreshold; + mSleepDamping = desc.sleepDamping; + +} + +////////////////////////////////////////////////////////// + +Actor::Actor(const NxString& Identifier, Scene* scene, bool isActorBased) : mName(Identifier), mOwner(scene) { + mActor = 0; + if (isActorBased) + mOwner->_registerActor(mName, this); +} + +////////////////////////////////////////////////////////// + +Actor::Actor(const NxString& name, Scene* scene, ShapeBlueprint *shape, const Pose& pose, ActorParams params) : mName(name), mOwner(scene) { + + if (name.length() == 0) { + mName = NxCreateID(scene->getNbActors(), "Actor"); + mVisualIdentifier = NxString(); + } + else { + + std::vector<NxString> splitID = Ogre::StringUtil::split(name, ";", 2); + + NxString identifier; + + if (splitID.size() == 1) { + identifier = name; + mVisualIdentifier = name; + } + else { + identifier = splitID[0]; + mVisualIdentifier = splitID[1]; + Ogre::StringUtil::trim(mVisualIdentifier); + } + + Ogre::StringUtil::trim(identifier); + + if (identifier.substr(0,1) == ">") { + mName = identifier.substr(1, identifier.length() - 1); + if (scene->getActors()->has(mName)) { + NxThrow_Error("Duplicate Actor with identifier '" + mName + "' found!"); + } + + } + else if (scene->getActors()->has(identifier)) { + // Generate a identifier based on the the suggested name. + // i.e. + // myBody -> myBody 1 + // myBody10 -> myBody 11 + + Actors actors; + scene->getActors()->CopyTo(actors); + + NxU32 highest = 0; + NxString workingName; + for(Actor* a = actors.begin();a = actors.next();) { + if (Ogre::StringUtil::startsWith(a->getName(), identifier, false)) { + workingName = a->getName(); + workingName = workingName.substr(identifier.length(), workingName.length() - identifier.length()); + std::stringstream ss(workingName); + NxU32 current = 0; + ss >> current; + if (current > highest) + highest = current; + } + } + + highest++; + mName = identifier; + mName.append(Ogre::StringConverter::toString(highest)); + } + else { + mName = identifier; + } + } + + _createActor(shape,pose,params); + mOwner->_registerActor(mName, this); +} + +////////////////////////////////////////////////////////// + +Actor::~Actor() { + + mOwner->_unregisterActor(mName); + + if (!isDead()) + _destroyActor(); + +} + +////////////////////////////////////////////////////////// + +void Actor::_createActor(ShapeBlueprint *shape, const Pose& pose, ActorParams params) { + + NxActorDesc ad; + NxBodyDesc bd; + ad.setToDefault(); + bd.setToDefault(); + + mNxActorUserData = new NxActorUserData(this, NxActorUserData::T_Actor); +#if NX_SDK_VERSION_NUMBER >= 260 + ad.compartment = params.mCompartment; +#endif + if (params.mMass == 0) + ad.density = params.mDensity; +#if NX_SDK_VERSION_NUMBER >= 272 + if (params.mDominanceGroupAsIndex != 0) + ad.dominanceGroup = params.mDominanceGroupAsIndex; + else if (params.mDominanceGroupAsName.length() > 0) + ad.dominanceGroup = mOwner->getDominanceGroup(params.mDominanceGroupAsName)->getGroupID(); +#endif + ad.flags = params.mActorFlags; + + ad.globalPose.t = pose.getVec3(); + ad.globalPose.M.fromQuat(pose.getQuat()); + + if (params.mGroupAsIndex != 0) + ad.group = params.mGroupAsIndex; + else if (params.mGroupAsName.length() > 0) + ad.group = mOwner->getActorGroup(params.mGroupAsName)->getGroupID(); + + ad.userData = mNxActorUserData; + + if (params.mDensity == 0 && params.mMass == 0) { + ad.body = NULL; + } + else { + bd.angularDamping = params.mAngularDamping; + bd.angularVelocity = params.mAngularVelocity; + bd.CCDMotionThreshold = params.mCCDMotionThreshold; + bd.flags = params.mBodyFlags; + bd.linearDamping = params.mLinearDamping; + bd.linearVelocity = params.mLinearVelocity; + if (ad.density == 0) + bd.mass = params.mMass; + bd.massLocalPose = params.mMassLocalPose; + bd.massSpaceInertia = params.mMassSpaceInertia; + bd.maxAngularVelocity = params.mMaxAngularVelocity; + bd.sleepAngularVelocity = params.mSleepAngularVelocity; + bd.sleepDamping = params.mSleepDamping; + bd.sleepEnergyThreshold = params.mSleepEnergyThreshold; + bd.sleepLinearVelocity = params.mSleepLinearVelocity; + bd.solverIterationCount = params.mSolverIterationCount; + bd.wakeUpCounter = params.mWakeUpCounter; + ad.body = &bd; + } + + shape->_bindToActorDescription(this, 0, ad.shapes); + + mActor = mOwner->mScene->createActor(ad); + + if (!mActor) { + std::stringstream ss; + ss << "Creation of Actor with the identifier '" << mName << "' failed." << std::endl; + NxThrow_Error(ss.str()); + return; + } + + if (!shape->isShared()) + delete shape; + + NxU32 nbShapes = mActor->getNbShapes(); + NxShape*const* shapes = mActor->getShapes(); + + int i=0; + while (nbShapes--) { + mCollisionModel[i]->_bindNxShapeToShape(shapes[nbShapes]); + i++; + } + +#if (OGRE_VERSION_MINOR >= 5) + mBirthFrame = Ogre::Root::getSingletonPtr()->getNextFrameNumber() - 1; +#else + mBirthFrame = Ogre::Root::getSingletonPtr()->getCurrentFrameNumber(); +#endif +} + +////////////////////////////////////////////////////////// + +void Actor::_destroyActor() { + mCollisionModel.destroyAllOwned(); + delete mNxActorUserData; + mOwner->mScene->releaseActor(*mActor); + mActor = 0; +} + +////////////////////////////////////////////////////////// + +void Actor::simulate(float dT) { + shapeSimulate(dT); +} + +////////////////////////////////////////////////////////// + +void Actor::render(float) { + // No. +} + +////////////////////////////////////////////////////////// + +void Actor::shapeSimulate(float t) { + for(Shape* shape = mDynamicCollisionModel.begin();shape = mDynamicCollisionModel.next();) + shape->simulate(t); +} + +////////////////////////////////////////////////////////// + +void Actor::shapeRender(float t) { + for(Shape* shape = mDynamicCollisionModel.begin();shape = mDynamicCollisionModel.next();) + shape->render(t); +} + +////////////////////////////////////////////////////////// + +void Actor::setName(NxString name) { + mOwner->mActors.rename(mName, name); + mName = name; +} + +////////////////////////////////////////////////////////// + +NxString Actor::getName() { + return mName; +} + +////////////////////////////////////////////////////////// + +NxScene* Actor::getNxScene() { + return mOwner->getNxScene(); +} + +////////////////////////////////////////////////////////// + +Actor* Actor::duplicate(const NxString& name, const Pose& p) { + Blueprints::ActorBlueprint* ab = new Blueprints::ActorBlueprint(); + ab->serialise(this, mOwner); + Actor* a = ab->unserialise(name, mOwner); + a->setGlobalPose(p); + delete ab; + return a; +} + +////////////////////////////////////////////////////////// + +void Actor::setGlobalPose(const Pose& pose) { + mActor->setGlobalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +Pose Actor::getGlobalPose() { + static Pose p; + p.fromMat34(mActor->getGlobalPose()); + return p; +} + +////////////////////////////////////////////////////////// + +Ogre::Quaternion Actor::getGlobalOrientation() { + return toQuaternion(mActor->getGlobalOrientationQuat()); +} + +////////////////////////////////////////////////////////// + +void Actor::setGlobalOrientation(const Ogre::Quaternion& quat) { + mActor->setGlobalOrientation(toNxQuat(quat)); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getGlobalPosition() { + return toVector3(mActor->getGlobalPosition()); +} + +////////////////////////////////////////////////////////// + +void Actor::setGlobalPosition(const Ogre::Vector3& vec) { + mActor->setGlobalPosition(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::moveGlobalPose(const Pose& pose) { + mActor->moveGlobalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +void Actor::moveGlobalPosition(const Ogre::Vector3& vec) { + mActor->moveGlobalPosition(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::moveGlobalOrientation(const Ogre::Quaternion& quat) { + mActor->moveGlobalOrientationQuat(toNxQuat(quat)); +} + +//////////////////////////////////////////////////////// + +void Actor::moveTowards(const Pose& p, float force) { + NxVec3 fc = p.v - mActor->getGlobalPosition(); + fc *= force; + fc -= mActor->getPointVelocity(mActor->getGlobalPosition()); + mActor->addForceAtPos(fc, mActor->getGlobalPosition()); +} + +//////////////////////////////////////////////////////// + +#if 0 +const ShapeBlueprint& Actor::createShapeDescription(const ShapeBlueprint& s) { + NxUnderConstruction; + return s; +} + +////////////////////////////////////////////////////////// + +void Actor::destroyShapeDescription(const ShapeBlueprint&) { + NxUnderConstruction; +} + +////////////////////////////////////////////////////////// + +Ogre::uint Actor::getNbShapeDescriptions() { + return mActor->getNbShapeDescriptions(); +} + +////////////////////////////////////////////////////////// + +std::vector<const ShapeBlueprint&> Actor::getAllShapeDescriptions() { + NxUnderConstruction; + std::vector<const ShapeBlueprint&> s; + return s; +} + +////////////////////////////////////////////////////////// + +ShapeBlueprint Actor::getFirstShapeDescription() { + NxUnderConstruction; + return NULL; +} + +////////////////////////////////////////////////////////// + +ShapeBlueprint Actor::getShapeDescription(Ogre::uint id) { + NxUnderConstruction; + return NULL; +} +#endif + +////////////////////////////////////////////////////////// + +void Actor::setGroup(ActorGroup* ag) { + mActor->setGroup(ag->getGroupID()); +} + +////////////////////////////////////////////////////////// + +void Actor::setGroup(const NxString& GroupIdentifier) { + mActor->setGroup(mOwner->getActorGroups()->get(GroupIdentifier)->getGroupID()); +} + +////////////////////////////////////////////////////////// + +void Actor::setGroup(NxActorGroup agid) { + mActor->setGroup(agid); +} + +////////////////////////////////////////////////////////// + +ActorGroup* Actor::getGroup() const { + NxActorGroup agid = mActor->getGroup(); + return mOwner->getActorGroupsByIndex()->get(agid); +} + +////////////////////////////////////////////////////////// + +void Actor::raiseActorFlag(NxActorFlag f) { + mActor->raiseActorFlag(f); +} + +////////////////////////////////////////////////////////// + +void Actor::clearActorFlag(NxActorFlag f) { + mActor->clearActorFlag(f); +} + +////////////////////////////////////////////////////////// + +bool Actor::hasActorFlag(NxActorFlag f) const { + return mActor->readActorFlag(f); +} +////////////////////////////////////////////////////////// + +bool Actor::isDynamic() const { + return mActor->isDynamic(); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetLocalPose(const Pose& pose) { + mActor->setCMassOffsetLocalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetLocalPosition(const Ogre::Vector3& vec) { + mActor->setCMassOffsetLocalPosition(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetLocalOrientation(const NxMat33& m) { + mActor->setCMassOffsetLocalOrientation(m); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetLocalOrientation(const Ogre::Matrix3& vec) { + NxUnderConstruction; + +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetGlobalPose(const Pose& pose) { + mActor->setCMassOffsetGlobalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetGlobalPosition(const Ogre::Vector3& vec) { + mActor->setCMassOffsetGlobalPosition(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetGlobalOrientation(const NxMat33& m) { + mActor->setCMassOffsetGlobalOrientation(m); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassOffsetGlobalOrientation(const Ogre::Matrix3& quat) { + NxUnderConstruction; + NxMat33 m; + mActor->setCMassOffsetGlobalOrientation(m); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassGlobalPose(const Pose& pose) { + mActor->setCMassGlobalPose(pose.toMat34()); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassGlobalPosition(const Ogre::Vector3& vec) { + mActor->setCMassGlobalPosition(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setCMassGlobalOrientation(const Ogre::Quaternion& quat) { + NxUnderConstruction; + NxMat33 m; + mActor->setCMassGlobalOrientation(m); +} +////////////////////////////////////////////////////////// + + +Pose Actor::getCMassLocalPose() const { + Pose pose; + pose.fromMat34(mActor->getCMassLocalPose()); + return pose; +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getCMassLocalPosition() const { + return toVector3(mActor->getCMassLocalPosition()); +} + +////////////////////////////////////////////////////////// + +Ogre::Quaternion Actor::getCMassLocalOrientation() const { + return toQuaternion(mActor->getCMassLocalOrientation()); +} + +////////////////////////////////////////////////////////// + +Pose Actor::getCMassGlobalPose() const { + Pose pose; + pose.fromMat34(mActor->getCMassGlobalPose()); + return pose; +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getCMassGlobalPosition() const { + return toVector3(mActor->getCMassGlobalPosition()); +} + +////////////////////////////////////////////////////////// + +Ogre::Quaternion Actor::getCMassGlobalOrientation() const { + NxQuat quat; + mActor->getCMassGlobalOrientation().toQuat(quat); + return toQuaternion(quat); +} + +////////////////////////////////////////////////////////// + + +void Actor::setMass(NxReal r) { + mActor->setMass(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getMass() const { + return mActor->getMass(); +} + +////////////////////////////////////////////////////////// + + +void Actor::setMassSpaceInertiaTensor(const Ogre::Vector3& vec) { + mActor->setMassSpaceInertiaTensor(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getMassSpaceInertiaTensor() const { + return toVector3(mActor->getMassSpaceInertiaTensor()); +} + +////////////////////////////////////////////////////////// + +Ogre::Matrix3 Actor::getGlobalInertiaTensor() const { + NxUnderConstruction; + Ogre::Matrix3 m; + return m; +} + +////////////////////////////////////////////////////////// + +Ogre::Matrix3 Actor::getGlobalInertiaTensorInverse() const { + NxUnderConstruction; + Ogre::Matrix3 m; + return m; +} + +////////////////////////////////////////////////////////// + + +void Actor::updateMassFromShapeFromDensity(NxReal r) { + mActor->updateMassFromShapes(r,0); +} + +////////////////////////////////////////////////////////// + +void Actor::updateMassFromShapeAsMass(NxReal r) { + mActor->updateMassFromShapes(0,r); +} + +////////////////////////////////////////////////////////// + +void Actor::setLinearDamping(NxReal r) { + mActor->setLinearDamping(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getLinearDamping() const { + return mActor->getLinearDamping(); +} + +////////////////////////////////////////////////////////// + + +void Actor::setAngularDamping(NxReal r) { + mActor->setAngularDamping(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getAngularDamping() const { + return mActor->getAngularDamping(); +} + +////////////////////////////////////////////////////////// + +void Actor::setLinearVelocity(const Ogre::Vector3& vec) { + mActor->setLinearVelocity(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setAngularVelocity(const Ogre::Vector3& vec) { + mActor->setAngularVelocity(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + + +Ogre::Vector3 Actor::getLinearVelocity() const { + return toVector3(mActor->getLinearVelocity()); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getAngularVelocity() const { + return toVector3(mActor->getAngularVelocity()); +} + +////////////////////////////////////////////////////////// + + +void Actor::setMaxAngularVelocity(NxReal r) { + mActor->setMaxAngularVelocity(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getMaxAngularVelocity() const { + return mActor->getMaxAngularVelocity(); +} + +////////////////////////////////////////////////////////// + +void Actor::setCCDMotionThreshold(NxReal r) { + mActor->setCCDMotionThreshold(r); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getCCDMotionThreshold() const { + return mActor->getCCDMotionThreshold(); +} + +////////////////////////////////////////////////////////// + +void Actor::setLinearMomentum(const Ogre::Vector3& vec) { + mActor->setLinearMomentum(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +void Actor::setAngularMomentum(const Ogre::Vector3& vec) { + mActor->setAngularMomentum(toNxVec3(vec)); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getLinearMomentum() const { + return toVector3(mActor->getLinearMomentum()); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getAngularMomentum() const { + return toVector3(mActor->getAngularMomentum()); +} + +////////////////////////////////////////////////////////// + +void Actor::addForceAtPos(const Ogre::Vector3& force, const Ogre::Vector3& pos, NxForceMode mode, bool wakeup) { + mActor->addForceAtPos(toNxVec3(force), toNxVec3(pos), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addForceAtLocalPos(const Ogre::Vector3& force, const Ogre::Vector3& pos, NxForceMode mode, bool wakeup) { + mActor->addForceAtLocalPos(toNxVec3(force), toNxVec3(pos), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addLocalForceAtPos(const Ogre::Vector3& force, const Ogre::Vector3& pos, NxForceMode mode, bool wakeup) { + mActor->addLocalForceAtPos(toNxVec3(force), toNxVec3(pos), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addLocalForceAtLocalPos(const Ogre::Vector3& force, const Ogre::Vector3& pos, NxForceMode mode, bool wakeup) { + mActor->addLocalForceAtLocalPos(toNxVec3(force), toNxVec3(pos), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addForce(const Ogre::Vector3& force, NxForceMode mode, bool wakeup) { + mActor->addForce(toNxVec3(force), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addLocalForce(const Ogre::Vector3& force, NxForceMode mode, bool wakeup) { + mActor->addLocalForce(toNxVec3(force), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addTorque(const Ogre::Vector3& torque, NxForceMode mode, bool wakeup) { + mActor->addTorque(toNxVec3(torque), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +void Actor::addLocalTorque(const Ogre::Vector3& torque, NxForceMode mode, bool wakeup) { + mActor->addLocalTorque(toNxVec3(torque), mode, wakeup); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::computeKineticEnergy() const { + return mActor->computeKineticEnergy(); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getPointVelocity(const Ogre::Vector3& vec) const { + return toVector3(mActor->getPointVelocity(toNxVec3(vec))); +} + +////////////////////////////////////////////////////////// + +Ogre::Vector3 Actor::getLocalPointVelocity(const Ogre::Vector3& vec) const { + return toVector3(mActor->getLocalPointVelocity(toNxVec3(vec))); +} + +////////////////////////////////////////////////////////// + +bool Actor::isGroupSleeping() const { + return mActor->isGroupSleeping(); +} + +////////////////////////////////////////////////////////// + +bool Actor::isSleeping() const { + return mActor->isSleeping(); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getSleepLinearVelocity() const { + return mActor->getSleepLinearVelocity(); +} + +////////////////////////////////////////////////////////// + +void Actor::setSleepLinearVelocity(NxReal threshold) { + mActor->setSleepLinearVelocity(threshold); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getSleepAngularVelocity() const { + return mActor->getSleepAngularVelocity(); +} + +////////////////////////////////////////////////////////// + +void Actor::setSleepAngularVelocity(NxReal threshold) { + mActor->setSleepAngularVelocity(threshold); +} + +////////////////////////////////////////////////////////// + +NxReal Actor::getSleepEnergyThreshold() const { + return mActor->getSleepEnergyThreshold(); +} + +////////////////////////////////////////////////////////// + +void Actor::setSleepEnergyThreshold(NxReal threshold) { + mActor->setSleepEnergyThreshold(threshold); +} + +////////////////////////////////////////////////////////// + +void Actor::wakeUp(NxReal wakeCounterValue) { + mActor->wakeUp(wakeCounterValue); +} + +////////////////////////////////////////////////////////// + +void Actor::putToSleep() { + mActor->putToSleep(); +} + +////////////////////////////////////////////////////////// + +void Actor::raiseBodyFlag(NxBodyFlag f) { + mActor->raiseBodyFlag(f); +} + +////////////////////////////////////////////////////////// + +void Actor::clearBodyFlag(NxBodyFlag f) { + mActor->clearBodyFlag(f); +} + +////////////////////////////////////////////////////////// + +bool Actor::hasBodyFlag(NxBodyFlag f) const { + return mActor->readBodyFlag(f); +} + +////////////////////////////////////////////////////////// + +void Actor::setSolverIterationCount(NxU32 c) { + mActor->setSolverIterationCount(c); +} + +////////////////////////////////////////////////////////// + +NxU32 Actor::getSolverIterationCount() const { + return mActor->getSolverIterationCount(); +} + +////////////////////////////////////////////////////////// + +#if NX_SUPPORT_SWEEP_API + +NxU32 Actor::linearSweep(const Ogre::Vector3& motion, NxU32 flags, void* userData, NxU32 nbShapeDescriptions, NxSweepQueryHit* shapes, NxUserEntityReport<NxSweepQueryHit>* callback, const NxSweepCache* sweepCache) { + return mActor->linearSweep(toNxVec3(motion), flags, userData, nbShapeDescriptions, shapes, callback, sweepCache); +} + +#endif + +////////////////////////////////////////////////////////// + +#if NX_SDK_VERSION_NUMBER >= 260 + +Compartment* Actor::getCompartment() const { + NxUnderConstruction; + return NULL; +} + +#endif + +////////////////////////////////////////////////////////// + +Shape* Actor::addShape(ShapeBlueprint* sd) { + + + NxShapeIndex id = mCollisionModel.count(); + sd->_bindToNxActor(this, id); + delete sd; + Shape* s = mCollisionModel.get(id); + + + return s; + +} + +////////////////////////////////////////////////////////// + +void Actor::removeShape(Shape* sh) { + + + for (Shape* shape = mCollisionModel.begin();shape = mCollisionModel.next();) { + if (shape == sh) { + mActor->releaseShape(*sh->getNxShape()); + mCollisionModel.remove(sh->getIndex()); + + if (mDynamicCollisionModel.has(sh->getIndex())) + mDynamicCollisionModel.remove(sh->getIndex()); + + delete shape; + + return; + } + } + +} + +////////////////////////////////////////////////////////// + +void Actor::removeShape(NxShapeIndex id) { + + Shape* shape = mCollisionModel[id]; + + if (shape == 0) + return; + + shape->releaseShape(); + mCollisionModel.remove(id); + + delete shape; +} + +////////////////////////////////////////////////////////// + +NxU32 Actor::getNbShapes() const { + return mCollisionModel.count(); +} + +////////////////////////////////////////////////////////// + +CollisionModel* Actor::getCollisionModel() { + return &mCollisionModel; +} + +////////////////////////////////////////////////////////// + +CollisionModel* Actor::getDynamicCollisionModel() { + return &mDynamicCollisionModel; +} + +////////////////////////////////////////////////////////// + +void* Actor::getNxActorUserData() { + return mActor->userData; +} + +////////////////////////////////////////////////////////// + +StringPairList Actor::saveCustom() { + StringPairList l; + l.insert("ActorType", "Actor"); + + return l; +} + +////////////////////////////////////////////////////////// + +void Actor::disable() { + mActor->raiseActorFlag(NX_AF_DISABLE_COLLISION); + mActor->raiseActorFlag(NX_AF_DISABLE_RESPONSE); + mActor->raiseActorFlag(NX_AF_FLUID_DISABLE_COLLISION); + mActor->raiseBodyFlag(NX_BF_FROZEN); + mActor->raiseBodyFlag(NX_BF_FROZEN_ROT); + mActor->setAngularVelocity(NxVec3(0,0,0)); + mActor->setAngularMomentum(NxVec3(0,0,0)); + mActor->setLinearMomentum(NxVec3(0,0,0)); + mActor->setLinearVelocity(NxVec3(0,0,0)); + + disableVisualisation(); +} + +////////////////////////////////////////////////////////// + +FixedJoint* Actor::joinWith(Actor* actorB, JointParams jp) { + return mOwner->createFixedJoint(this, actorB, jp); +} + +////////////////////////////////////////////////////////// + +} //End of NxOgre namespace. Added: trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActor.h =================================================================== --- trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActor.h (rev 0) +++ trunk/python-ogre/ThirdParty/nxogre_0.9/NxOgreActor.h 2008-01-16 02:53:00 UTC (rev 547) @@ -0,0 +1,734 @@ +// +// NxOgre a wrapper for the PhysX (formerly Novodex) physics library and the Ogre 3D rendering engine. +// Copyright (C) 2005 - 2007 Robin Southern and NxOgre.org http://www.nxogre.org +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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 GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// + +#ifndef __NXOGRE_ACTOR_H__ +#define __NXOGRE_ACTOR_H__ + +#include "NxOgrePrerequisites.h" +#include "NxOgreContainer.h" // For: mCollisionList +#include "NxOgreParams.h" + +namespace NxOgre { + + /** + \page actorparams ActorParams + + String base params are case and space insensitive. + + Examples: + + <code> + "mass: 1" + + "mass: 1, group: myActors" + + "mass: 1, group: myActors, lineardamping: 3" + </code> + + Non-String based params can be used as well, and offer access to some variables of the params + that cannot be converted into a string (pointers, etc.). + + Due to efficency purposes and insane string conversion. With string parameters more than four, + you should work with the non-string based params system. + + <code> + ActorParams params; + params.setToDefault(); + params.mMass = 10; + params.mGroupAsIndex = 1; + </code> + + Is exactly the same as: + + <code> + "mass: 10, group-index: 1" + </code> + + Current Supported String Params + ----------------------------- + + - density (float) + - Description: Density of this Actor. Use this or mass, do not use both. + - Example: "Density: 1.5" + - See: ActorParams::mDensity and NxActorDesc::density for more information. + + - group (string) + - Description: Actor Group name of this actor. Use this or group-index, but not both. + - Example: "group: myGroup" + - See: ActorParams::mGroupAsName + + - group-index (unsigned int) + - Description: Actor Group ID of this actor. Use this or group, but not both. + - Example: "group-index: 0" + - See: ActorParams::mGroupAsIndex + + - dominancegroup (unsigned int) + - Description: Dominance Group ID of this actor. + - Example: "dominancegroup: 0" + - See: ActorParams::mDominanceGroup + + - massspaceinertia (Vector3) + - Description: Mass Space Inertia of this Actor + - Example: "massspaceinertia: 1 0 1" + - See: ActorParams::mMassSpaceInertia + + - linearvelocity (Vector3) + - Description: Linear Velocity of this Actor + - Example: "linearvelocity: 1 0 1" + - See: ActorParams::mLinearVelocity + + - angularvelocity (Vector3) + - Description: Angular Velocity of this Actor + - Example: "angularvelocity: 1 0 1" + - See: ActorParams::mAngularVelocity + + - wakeupcounter (float) + - Description: Wake up time counter + - Example: "wakeupcounter: 1000.0" + - See: ActorParams::mWakeupCounter + + - mass (float) + - Description: Mass of this Actor. Use this or density, do not use both. + - Example: "mass: 10" + - See: ActorParams::mMass and NxBodyDesc::mass for more information. + + - lineardamping (float) + - Description: Linear Damping of the Actor + - Example: "lineardamping: 0.1" + - See: ActorParams::mLinearDamping + + - angulardamping (float) + - Description: Angular Damping of the Actor + - Example: "angulardamping: 0.1" + - See: ActorParams::mAngularDamping + + - maxangularvelocity (float) + - Description: Maximum allowed angular velocity + - Example: "maxangularvelocity: 10" + - See: ActorParams::mMaxAngularVelocity + + - sleepangularvelocity (float) + - Description: Maximum angular velocity at which the Actor can go to sleep. + - Example: "sleepangularvelocity: 20" + - See: ActorParams:mSleepAngularVelocity + + - ccdmotionthreshold (float) + - Description: When CCD is globally enabled, it is still not performed if the + motion distance of all points on the Actor is below this threshold. + - Example: "ccdmotionthreshold: 5" + - See: ActorParams::mCCDMotionThreshold + + - solveriterationcount (unsigned int) + - Description: Number of solver iterations performed when processing joint/contacts + connected to this Actor. + - Example: "solveriterationcount: 5" + - Range: 1 to 255 + - See: ActorParams::mSolverIterationCount + + - sleepenergytheshold (float) + - Description: Threshold for the energy-based sleeping algorithm. Only used when + the NX_BF_ENERGY_SLEEP_TEST flag is set + - Example: "sleepenergythreshold: 0.006" + - See: ActorParams::mSleepEnergyThreshold + + - sleepdamping (float) + - Description: Damping factor for bodies that are about to sleep. + - Example: "sleepdamping: 0.5" + - See: ActorParams::mSleepDamping + + - node-scale (Vector3) + - Applicable to Body and Actors that use a visual representation of the NxActor. + - Description: Scale factor of the SceneNode + - Example: "node-slace: 2 2 2" + - See: ActorParams::mNodeScale + + - node-shadows (bool) + - Applicable to Body and Actors that use a visual representation of the NxActor. + - Description: Apply shadows to the first entity (Body class). See other custom Actors + to see how shadows apply to it. + - Example: "node-shadows: yes" + - See: ActorParams::mNodeShaodws + + - node (string) + - Applicable to Body and Actors that use a visual representation of the NxActor. + - Description: Name of the SceneNode, or name of an existing SceneNode to use (Body only). + - Example: "node: myNodeName" + - See: ActorParams::mNodeName + + */ + + /** ActorParams + + See \ref actorparams for the full string argument documentation. + */ + class NxExport ActorParams : public Params { + + public: + + + ActorParams(){setToDefault();} + ActorParams(const char* p) {process(p);} + ActorParams(NxString p) {process(p);} + + void setToDefault(); + void parse(Parameters); + void fromNxActorDesc(NxActorDesc&); + void fromNxBodyDesc(NxBodyDesc&); + + //////////////////////////////////////////////////////////////// + +#if NX_SDK_VERSION_NUMBER >= 260 + /// NxCompartment of the Actor to sit in. + /// @todo NxOgre-ify + /// @default NULL + NxCompartment* mCompartment; +#endif + + /// Density, mass must be 0 when density is used. + NxReal mDensity; + +#if NX_SDK_VERSION_NUMBER >= 272 + + /// DominanceGroup (as Name). + /// @default "" + NxString mDominanceGroupAsName; + + /// DominanceGroup (as Index) + /// @default 0 + NxDominanceGroup mDominanceGroupAsIndex; +#endif + + /// Flags for the NxActor + /// @see NxActorFlags + /// @default 0 + NxU32 mActorFlags; + + + /// Group to use as index. GroupAsName must be blank. + /// @default 0 + NxActorGroup mGroupAsIndex; + + + /// Group to use from name. GroupAsIndex must be 0. + /// @default Blank String + NxString mGroupAsName; + + + //////////////////////////////////////////////////////////////// + + + /// Angular Damping + NxReal mAngularDamping; + + + /// Angular Velocity + NxVec3 mAngularVelocity; + + + /// + NxReal mCCDMotionThreshold; + + + /// + NxU32 mBodyFlags; + + + /// + NxReal mLinearDamping; + + + /// + NxVec3 mLinearVelocity; + + + /// Mass of the Actor. When used, make sure density is zero. + NxReal mMass; + + + /// + NxMat34 mMassLocalPose; + + /// + NxVec3 mMassSpaceInertia; + + + /// + NxReal mMaxAngularVelocity; + + /// + NxReal mSleepAngularVelocity; + + + /// + NxReal mSleepDamping; + + + /// + NxReal mSleepEnergyThreshold; + + + /// + NxReal mSleepLinearVelocity; + + + /// + NxU32 mSolverIterationCount; + + + /// + NxReal mWakeUpCounter; + + + //////////////////////////////////////////////////////////////// + + + /// SceneNode for Visual based Actors. If the node already exists then it will use it. + NxString mNodeName; + + /// Scale the SceneNode for Visual based Actors + Ogre::Vector3 mNodeScale; + + /// Set the first Entity of the Visual based Actors to have shadows or not. + bool mNodeShadows; + + + + }; // End of ActorParams class + + class NxExport Actor { + + public: + + Actor(const NxString& Identifier, Scene*, bool isActorBased = true); + Actor(const NxString& Identifier, Scene*, ShapeBlueprint*, const Pose&, ActorParams = ActorParams()); + virtual ~Actor(); + + ////////////////////////////////////////////////////////// + + Scene* getScene() { + return mOwner; + } + + NxScene* getNxScene(); + + ////////////////////////////////////////////////////////// + + virtual bool hasVisualisation() const {return false;} + virtual void simulate(float); + virtual void render(float); + virtual void shapeSimulate(float); + virtual void shapeRender(float); + bool isDead() { return (mActor == NULL); } + + + /** Duplicate this actor + + @param name Name of the new Actor + @param pose Position/Orientation of the new actor. + + @note + This function is rather slow and inefficent when used repeatedly. Use a ActorBlueprint instead to + keep a single blueprint of the actor and create as many as you want from that. + + */ + Actor* duplicate(const NxString& name, const Pose& p); + + ////////////////////////////////////////////////////////// + + void _createActor(ShapeBlueprint*,const Pose&,ActorParams params); + void _destroyActor(); + + NxActor* getNxActor(){return mActor;} + + ////////////////////////////////////////////////////////// + + void setName(NxString); + NxString getName(); + + //////////////////////////////////////////////////////// + + void setGlobalPose(const Pose&); + Pose getGlobalPose(); + + Ogre::Quaternion getGlobalOrientation(); + void setGlobalOrientation(const Ogre::Quaternion&); + + Ogre::Vector3 getGlobalPosition(); + void setGlobalPosition(const Ogre::Vector3&); + + void moveGlobalPose(const Pose&); + void moveGlobalPosition(const Ogre::Vector3&); + void moveGlobalOrientation(const Ogre::Quaternion&); + + void moveTowards(const Pose&, float force = 10.0f); + + ////////////////////////////////////////////////////////// + + Shape* addShape(ShapeBlueprint*); + void removeShape(Shape*); + void removeShape(NxShapeIndex); + NxU32 getNbShapes() const; + CollisionModel* getCollisionModel(); + CollisionModel* getDynamicCollisionModel(); + + ////////////////////////////////////////////////////////// + + void setGroup(ActorGroup*); + void setGroup(const NxString& GroupIdentifier); + void setGroup(NxActorGroup); + ActorGroup* getGroup() const; + + ////////////////////////////////////////////////////////// + + void raiseActorFlag(NxActorFlag); + void clearActorFlag(NxActorFlag); + bool hasActorFlag(NxActorFlag) const; + bool isDynamic() const; + + ////////////////////////////////////////////////////////// + + void setCMassOffsetLocalPose(const Pose&); + void setCMassOffsetLocalPosition(const Ogre::Vector3&); + void setCMassOffsetLocalOrientation(const NxMat33&); + void setCMassOffsetLocalOrientation(const Ogre::Matrix3&); + void setCMassOffsetGlobalPose(const Pose&); + void setCMassOffsetGlobalPosition(const Ogre::Vector3&); + void setCMassOffsetGlobalOrientation(const NxMat33&); + void setCMassOffsetGlobal... [truncated message content] |
From: <and...@us...> - 2008-01-15 15:03:57
|
Revision: 546 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=546&view=rev Author: andy_miller Date: 2008-01-15 07:03:59 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Fixes for Linux Caelum and OgreAL Modified Paths: -------------- trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h trunk/python-ogre/environment.py Modified: trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2008-01-15 06:54:21 UTC (rev 545) +++ trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2008-01-15 15:03:59 UTC (rev 546) @@ -25,7 +25,7 @@ #include "Ogre.h" // Define the dll export qualifier if compiling for Windows -#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 +// #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 // #ifdef CAELUM_LIB // #define DllExport __declspec (dllexport) // #else @@ -37,7 +37,7 @@ // #endif // #else #define DllExport -#endif +// #endif // Define the version code #define CAELUM_VERSION_MAIN 0 Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-01-15 06:54:21 UTC (rev 545) +++ trunk/python-ogre/environment.py 2008-01-15 15:03:59 UTC (rev 546) @@ -1081,7 +1081,8 @@ [0, "tar zxf " + os.path.join(downloadPath, "libogg-1.1.3.tar.gz"), ''], [0, "tar zxf " + os.path.join(downloadPath, "libvorbis-1.2.0.tar.gz"), ''], [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libogg-1.1.3")], - [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libvorbis-1.2.0")], + [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libvorbis-1.2.0")], + [0, "sed --in-place -s 's|( ALCvoid )|()|' alc.h",os.path.join(os.getcwd(),"openal-0.0.8","common", "include", "AL")], [0, "aclocal\n./autogen.sh", os.path.join(os.getcwd(),"openal-0.0.8")], [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "openal-0.0.8")] ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-15 06:54:20
|
Revision: 545 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=545&view=rev Author: andy_miller Date: 2008-01-14 22:54:21 -0800 (Mon, 14 Jan 2008) Log Message: ----------- Cleanup in Naiv Removed Paths: ------------- trunk/python-ogre/code_generators/navi/Navi.h trunk/python-ogre/code_generators/navi/NaviManager.h Deleted: trunk/python-ogre/code_generators/navi/Navi.h =================================================================== --- trunk/python-ogre/code_generators/navi/Navi.h 2008-01-15 06:48:49 UTC (rev 544) +++ trunk/python-ogre/code_generators/navi/Navi.h 2008-01-15 06:54:21 UTC (rev 545) @@ -1,169 +0,0 @@ -/* - This file is part of Navi, a library that allows developers to embed movable - 'Navis' (Dynamic, HTML/JS/CSS-Driven GUI Overlays) within an Ogre3D application. - - Copyright (C) 2007 Adam J. Simmons - http://www.agelessanime.com/Navi/ - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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 GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef __Navi_H__ -#define __Navi_H__ -#if _MSC_VER > 1000 -#pragma once -#endif - -#include "NaviPlatform.h" -#include "NaviManager.h" -#include <llmozlib.h> - -namespace NaviLibrary -{ - /** - * This class is pure private, Navi objects are solely handled by NaviManager - */ - class _NaviExport Navi : public LLEmbeddedBrowserWindowObserver, public Ogre::WindowEventListener, public Ogre::ManualResourceLoader - { - friend class NaviManager; - friend class NaviCompare; - - std::string naviName; - unsigned short naviWidth; - unsigned short naviHeight; - unsigned int winWidth; - unsigned int winHeight; - Ogre::RenderWindow* renderWindow; - bool isWinFocused; - NaviPosition position; - bool movable; - int windowID; - Ogre::Overlay* overlay; - Ogre::PanelOverlayElement* panel; - bool needsUpdate; - unsigned int maxUpdatePS; - bool forceMax; - Ogre::Timer timer; - unsigned long lastUpdateTime; - float opacity; - bool usingMask; - bool ignoringTrans; - float transparent; - bool usingColorKeying; - float keyFuzziness; - unsigned char keyR, keyG, keyB; - float keyFOpacity; - unsigned char keyFillR, keyFillG, keyFillB; - unsigned char* naviCache; - bool isMaterialOnly; - std::vector<NaviEventListener*> eventListeners; -// std::multimap<std::string, NaviDelegate> delegateMap; -// std::multimap<std::string, NaviDelegate>::iterator delegateIter; -// std::pair<std::multimap<std::string, NaviDelegate>::iterator, std::multimap<std::string, NaviDelegate>::iterator> dmBounds; - std::map<std::string, std::vector<std::string> > ensureKeysMap; - std::map<std::string, std::vector<std::string> >::iterator ensureKeysMapIter; - bool okayToDelete; - bool isVisible; - bool fadingOut; - unsigned long fadingOutStart; - unsigned long fadingOutEnd; - bool fadingIn; - unsigned long fadingInStart; - unsigned long fadingInEnd; - bool compensateNPOT; - unsigned short texWidth; - unsigned short texHeight; - size_t texPixelSize; - size_t texPitch; - - - Navi(Ogre::RenderWindow* renderWin, std::string name, std::string homepage, const NaviPosition &naviPosition, - unsigned short width, unsigned short height, bool isMovable, bool visible, unsigned int maxUpdatesPerSec, bool forceMaxUpdate, unsigned short zOrder, float _opacity); - - Navi(Ogre::RenderWindow* renderWin, std::string name, std::string homepage, unsigned short width, unsigned short height, bool visible, - unsigned int maxUpdatesPerSec, bool forceMaxUpdate, float _opacity, Ogre::FilterOptions texFiltering); - - ~Navi(); - - void createOverlay(unsigned short zOrder); - - void createBrowser(Ogre::RenderWindow* renderWin, std::string homepage); - - void createMaterial(Ogre::FilterOptions texFiltering = Ogre::FO_NONE); - - void setMask(std::string maskFileName, std::string groupName); - - void update(); - - void loadResource(Ogre::Resource* resource); - - void moveNavi(int deltaX, int deltaY); - - void navigateTo(std::string url); - - void navigateTo(std::string url, NaviData naviData); - - std::string evaluateJS(const std::string &script); - - void addEventListener(NaviEventListener* newListener); - - void removeEventListener(NaviEventListener* removeListener); - -// void bind(const std::string &naviDataName, const NaviDelegate &callback, const std::vector<std::string> &keys); - -// void unbind(const std::string &naviDataName, const NaviDelegate &callback = NaviDelegate()); - - void setBackgroundColor(float red, float green, float blue); - - void setOpacity(float _opacity); - - void setIgnoreTransparentAreas(bool ignoreTrans, float defineThreshold); - - void setColorKey(const std::string &keyColor, float keyFillOpacity = 0.0, const std::string &keyFillColor = "#000000", float keyFuzzy = 0.0); - - void setDefaultPosition(); - - void hide(bool fade, unsigned short fadeDurationMS); - - void show(bool fade, unsigned short fadeDurationMS); - - bool isPointOverMe(int x, int y); - - bool isPointWithin(int x, int y, int left, int right, int top, int bottom); - - bool isPointOpaqueEnough(int x, int y); - - int getRelativeX(int absX); - - int getRelativeY(int absY); - - void onPageChanged(const EventType& eventIn); - void onNavigateBegin(const EventType& eventIn); - void onNavigateComplete(const EventType& eventIn); - void onUpdateProgress(const EventType& eventIn); - void onStatusTextChange(const EventType& eventIn); - void onLocationChange(const EventType& eventIn); - void onClickLinkHref(const EventType& eventIn); - - void windowMoved(Ogre::RenderWindow* rw); - void windowResized(Ogre::RenderWindow* rw); - void windowClosed(Ogre::RenderWindow* rw); - void windowFocusChange(Ogre::RenderWindow* rw); - - }; - -} - -#endif \ No newline at end of file Deleted: trunk/python-ogre/code_generators/navi/NaviManager.h =================================================================== --- trunk/python-ogre/code_generators/navi/NaviManager.h 2008-01-15 06:48:49 UTC (rev 544) +++ trunk/python-ogre/code_generators/navi/NaviManager.h 2008-01-15 06:54:21 UTC (rev 545) @@ -1,754 +0,0 @@ -/* - This file is part of Navi, a library that allows developers to embed movable - 'Navis' (Dynamic, HTML/JS/CSS-Driven GUI Overlays) within an Ogre3D application. - - Copyright (C) 2007 Adam J. Simmons - http://www.agelessanime.com/Navi/ - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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 GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef __NaviManager_H__ -#define __NaviManager_H__ -#if _MSC_VER > 1000 -#pragma once -#endif - -#include "NaviPlatform.h" -#include "NaviData.h" -#include "NaviEventListener.h" -#include "NaviMouse.h" -//#include "NaviDelegate.h" -#include "NaviUtilities.h" -#include "NaviSingleton.h" -#include <OgrePanelOverlayElement.h> - -namespace NaviLibrary -{ - struct NaviCompare; - - /** - * Enumerates relative positions. Used by NaviManager::NaviPosition - */ - enum RelativePosition - { - Left, - TopLeft, - TopCenter, - TopRight, - Right, - BottomRight, - BottomCenter, - BottomLeft, - Center - }; - - /** - * An object that holds position-data for a Navi. Used by NaviManager::createNavi and NaviManager::setNaviPosition. - */ - class _NaviExport NaviPosition - { - bool usingRelative; - union { - struct { RelativePosition position; short x; short y; } rel; - struct { short left; short top; } abs; - } data; - - friend class Navi; - NaviPosition(); - public: - /** - * Creates a relatively-positioned NaviPosition object. - * - * @param relPosition The position of the Navi in relation to the Render Window - * - * @param offsetLeft How many pixels from the left to offset the Navi from the relative position. - * - * @param offsetTop How many pixels from the top to offset the Navi from the relative position. - */ - NaviPosition(const RelativePosition &relPosition, short offsetLeft = 0, short offsetTop = 0); - - /** - * Creates an absolutely-positioned NaviPosition object. - * - * @param absoluteLeft The number of pixels from the left of the Render Window. - * - * @param absoluteTop The number of pixels from the top of the Render Window. - */ - NaviPosition(short absoluteLeft, short absoluteTop); - }; - - /** - * Enumerates internal mouse button IDs. Used by NaviManager::injectMouseDown, NaviManager::injectMouseUp - */ - enum MouseButtonID - { - LeftMouseButton = 0, - RightMouseButton, - MiddleMouseButton - }; - - /** - * Supreme dictator and Singleton: NaviManager - * - * The class you will need to go to for all your Navi-related needs. - */ - class _NaviExport NaviManager : public Singleton<NaviManager> - { - friend class Navi; // Our very close friend <3 - friend void NaviUtilities::translateLocalProtocols(std::string &strToTranslate); - - bool startedUp; - std::string localNaviDirectory; - std::map<std::string,Navi*> activeNavis; - std::vector<Navi*> boundaryIgnorers; - Navi* focusedNavi; - int hiddenWindowID; - std::map<std::string,Navi*>::iterator iter; - std::vector<Navi*>::iterator bIter; - Ogre::RenderWindow* renderWindow; - int mouseXPos, mouseYPos; - bool mouseButtonRDown; - unsigned short zOrderCounter; - NaviMouse* mouse; - - void focusNavi(int x, int y, Navi* selection = 0); - const std::vector<Navi*>& getNavisAtPoint(int x, int y); - const std::vector<Navi*>& getNavis(); - public: - /** - * Creates the NaviManager and loads the internal LLMozLib library. - * - * @param _renderWindow The Ogre::RenderWindow to render Navis to - * - * @param _localNaviDirectory By default, "local://" means something like: - * "C:\MyApplicationDirectory\NaviLocal\" but by changing - * this parameter, you can change "NaviLocal" to something else. - * - * @throws Ogre::Exception::ERR_INTERNAL_ERROR Throws this when LLMozLib fails initialization - */ - NaviManager(Ogre::RenderWindow* _renderWindow, const std::string &_localNaviDirectory = "NaviLocal"); - - ~NaviManager(); - - /** - * Gets the NaviManager Singleton. - * - * @return A reference to the NaviManager Singleton. - * - * @throws Ogre::Exception::ERR_RT_ASSERTION_FAILED Throws this if NaviManager has not been new'd yet. - */ - static NaviManager& Get(); - - /** - * Gets the NaviManager Singleton as a pointer. - * - * @return A pointer to the NaviManager Singleton. - * - * @throws Ogre::Exception::ERR_RT_ASSERTION_FAILED Throws this if NaviManager has not been new'd yet. - */ - static NaviManager* GetPointer(); - - /** - * Starts up the NaviMouse singleton and returns a pointer to it. - * - * @param visible Whether or not the NaviMouse is visible. Use NaviMouse::show()/hide() later. - */ - NaviMouse* StartupMouse(bool visible = true); - - /** - * Returns the NaviMouse singleton. - * - * @throws Ogre::Exception::ERR_RT_ASSERTION_FAILED Throws this if StartupMouse() is not called prior. - */ - NaviMouse* getMouse(); - - /** - * Gives each active Navi a chance to update, each may or may not update their internal textures - * based on various conditions. - */ - void Update(); - - /** - * Destroys any active Navis and shuts down the LLMozLib library. - */ - void Shutdown(); - - /** - * Creates a Navi. (You MUST call Startup() before this.) - * - * @param naviName The name of the Navi, used to refer to a specific Navi in subsequent calls. - * - * @param homepage The default starting page for a Navi. You may use local:// here to refer to - * the local Navi directory (See NaviManager::Startup) - * - * @param naviPosition The unified position (either relative or absolute) of a Navi. - * See NaviManager::NaviPosition for more information. - * - * @param width The width of the Navi. MUST be a power of 2 (e.g. 128, 256, 512, 1024) - * Technically you may be able to use a number that is divisible by 16 but - * please be mindful of the 2^n texture size limitation of certain video cards - * - * @param height The height of the Navi. MUST be a power of 2 (e.g. 128, 256, 512, 1024) - * Technically you may be able to use a number that is divisible by 16 but - * please be mindful of the 2^n texture size limitation of certain video cards - * - * @param isMovable Whether or not this absolutely positioned Navi is movable (right-click-drag to move) - * - * @param isVisible Whether or not this Navi is visible upon creation. Use NaviManager::showNavi to display - * this Navi later. - * - * @param maxUpdatesPerSec This parameter limits the number of updates per second to a specific - * integer. To use no limiting, leave this parameter as '0'. This limiting is - * useful if, for example, you had some very hyperactive Javascript - * that animated a moving ball. Without update limiting, Navi will try to update - * itself at every possible moment: this is great for very smooth animation but - * bad for the overall framerate. - * - * @param forceMaxUpdate Navi normally only updates when the page has changed, to override this functionality - * set this parameter to 'True' to make Navi 'force update' using the value of the - * parameter 'maxUpdatesPerSec'. This is useful as a work-around for rendering embedded - * Flash applications. Note: if 'maxUpdatesPerSec' is 0, Navi will try to 'force update' - * every single chance it gets (not recommended). - * - * @param zOrder Sets the starting Z-Order for this Navi; Navis with higher Z-Orders will be on top of other - * Navis. To auto-increment this value for every successive Navi, leave this parameter as '0'. - * - * @param opacity Sets the starting Opacity of the Navi. - * Ex. 1.0000 = Fully opaque - * Ex. 0.5000 = Half opaque - * Ex. 0.0000 = Totally transparent - * - * @throws Ogre::Exception::ERR_RT_ASSERTION_FAILED Throws this if NaviManager::Startup is not called prior to this. - */ - void createNavi(const std::string &naviName, const std::string &homepage, const NaviPosition &naviPosition, - unsigned short width, unsigned short height, bool isMovable = true, bool isVisible = true, unsigned int maxUpdatesPerSec = 48, bool forceMaxUpdate = false, - unsigned short zOrder = 0, float opacity = 1.0); - - /** - * Creates a NaviMaterial. (You MUST call Startup() before this.) NaviMaterials are just like Navis except that they lack - * a movable overlay element. Instead, you handle the material and apply it to anything you like. Mouse input for NaviMaterials - * must be injected using the 'injectNaviMaterial...(...)' API calls. - * - * @param naviName The name of the NaviMaterial, used to refer to this specific Navi in subsequent calls. - * - * @param homepage The default starting page for a Navi. You may use local:// here to refer to - * the local Navi directory (See NaviManager::Startup) - * - * @param width The width of the NaviMaterial. MUST be a power of 2 (e.g. 128, 256, 512, 1024) - * Technically you may be able to use a number that is divisible by 16 but - * please be mindful of the 2^n texture size limitation of certain video cards - * - * @param height The height of the NaviMaterial. MUST be a power of 2 (e.g. 128, 256, 512, 1024) - * Technically you may be able to use a number that is divisible by 16 but - * please be mindful of the 2^n texture size limitation of certain video cards - * - * @param isVisible Whether or not this NaviMaterial is visible or not (0% opacity, non-updated). Use - * NaviManager::showNavi to display this NaviMaterial later. - * - * @param maxUpdatesPerSec This parameter limits the number of updates per second to a specific - * integer. To use no limiting, leave this parameter as '0'. This limiting is - * useful if, for example, you had some very hyperactive Javascript - * that animated a moving ball. Without update limiting, Navi will try to update - * itself at every possible moment: this is great for very smooth animation but - * bad for the overall framerate. - * - * @param forceMaxUpdate Navi normally only updates when the page has changed, to override this functionality - * set this parameter to 'True' to make Navi 'force update' using the value of the - * parameter 'maxUpdatesPerSec'. This is useful as a work-around for rendering embedded - * Flash applications. Note: if 'maxUpdatesPerSec' is 0, Navi will try to 'force update' - * every single chance it gets (not recommended). - * - * @param opacity Sets the starting Opacity of the Navi. - * Ex. 1.0000 = Fully opaque - * Ex. 0.5000 = Half opaque - * Ex. 0.0000 = Totally transparent - * - * @param texFiltering The texture filtering to use for this material. If the NaviMaterial is applied to a 3D object, - * anisotropic is the best choice, otherwise set this to none for use in other overlays/GUI elements. - * - * @throws Ogre::Exception::ERR_RT_ASSERTION_FAILED Throws this if NaviManager::Startup is not called prior to this. - */ - std::string createNaviMaterial(const std::string &naviName, const std::string &homepage, unsigned short width, unsigned short height, - bool isVisible = true, unsigned int maxUpdatesPerSec = 48, bool forceMaxUpdate = false, float opacity = 1.0, Ogre::FilterOptions texFiltering = Ogre::FO_ANISOTROPIC); - - /** - * Changes the page of the Navi to a supplied URL String. - * - * @param naviName The name of the Navi to do this to - * - * @param url The URL to navigate to. You may use the "local://" protocol here. - */ - void navigateNaviTo(const std::string &naviName, const std::string &url); - - /** - * Changes the page of the Navi to a supplied URL String and sends NaviData to the page. - * - * @param naviName The name of the Navi to do this to. - * - * @param url The URL to navigate to. You may use the "local://" protocol here. - * - * @param naviData The NaviData to send. - */ - void navigateNaviTo(const std::string &naviName, const std::string &url, const NaviData &naviData); - - /** - * Returns whether or not the page of the Navi can navigate backwards - * - * @param naviName The name of the Navi to do this to. - */ - bool canNavigateBack(const std::string &naviName); - - /** - * Navigates the page of the Navi backwards, if possible - * - * @param naviName The name of the Navi to do this to. - */ - void navigateNaviBack(const std::string &naviName); - - /** - * Returns whether or not the page of the Navi can navigate forwards - * - * @param naviName The name of the Navi to do this to. - */ - bool canNavigateForward(const std::string &naviName); - - /** - * Navigates the page of the Navi forwards, if possible - * - * @param naviName The name of the Navi to do this to. - */ - void navigateNaviForward(const std::string &naviName); - - /** - * If a Navi's page is loading, stops the load - * - * @param naviName The name of the Navi to do this to. - */ - void navigateNaviStop(const std::string &naviName); - - /** - * Evaluates a Javascript string in the context of a Navi page and returns the result. - * - * @param naviName The name of the Navi to do this to. - * - * @param script The Javascript (as a string) to evaluate/execute in the context of the page - * that the Navi is currently on. - * - * @return If it succeeds, this will return the result as a string (regardless of internal - * Javascript datatype), otherwise this returns an empty string. - */ - std::string naviEvaluateJS(const std::string &naviName, const std::string &script); - - /** - * Destroys a Navi. - * - * @param naviName The name of the Navi to do this to. - */ - void destroyNavi(const std::string &naviName); - - /** - * Sets the default color to use between changing pages, the default is White if you never call this. - * - * @param naviName The name of the Navi to do this to. - * - * @param red The Red color value as a float; maximum 1.0, minimum 0.0. - * @param green The Green color value as a float; maximum 1.0, minimum 0.0. - * @param blue The Blue color value as a float; maximum 1.0, minimum 0.0. - */ - void setNaviBackgroundColor(const std::string &naviName, float red = 1.0f, float green = 1.0f, float blue = 1.0f); - - /** - * Sets the default color to use between changing pages, the default is White ("#FFFFFF") if you never call this. - * - * @param naviName The name of the Navi to do this to. - * - * @param hexColor A hex color string in the format of: "#XXXXXX" - */ - void setNaviBackgroundColor(const std::string &naviName, const std::string& hexColor = "#FFFFFF"); - - /** - * Changes the Opacity of a Navi to a provided float. - * - * @param naviName The name of the Navi to do this to. - * - * @param opacity The Opacity value as a float. - * Fully Opaque = 1.0, Fully Transparent = 0.0. - */ - void setNaviOpacity(const std::string &naviName, float opacity = 1.0f); - - /** - * Sets the filename of the Alpha Mask Image. Navi will use the alpha channel values of the provided image - * to mask a Navi dynamically. - * - * @param naviName The name of the Navi to do this to. - * - * @param maskFileName The filename of the Alpha Mask Image. The Alpha Mask Image MUST have a - * width greater than or equal to the Navi width and it MUST have a height - * greater than or equal to the Navi height. Alpha Mask Images larger than - * the Navi will not be stretched, instead Navi will take Alpha values starting - * from the Top-Left corner of the Alpha Mask Image. To reset Navi to use no - * Alpha Mask Image, simply provide an empty String (""). - * - * @param groupName The Resource Group to find the Alpha Mask Image filename. - * - * @throws Ogre::Exception::ERR_INVALIDPARAMS Throws this if the width or height of the Alpha Mask Image is - * less than the width or height of the Navi it is applied to. - */ - void setNaviMask(const std::string &naviName, const std::string &maskFileName, const std::string &groupName = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); - - /** - * Using an alpha-mask/color-keying doesn't just affect the visuals of a Navi; by default, Navis 'ignore' - * mouse movement/clicks over 'transparent' areas of a Navi (Areas with opacity less than 5%). You may - * disable this behavior or redefine the 'transparent' threshold of opacity to something else other - * than 5%. - * - * @param naviName The name of the Navi to do this to. - * - * @param ignoreTrans Whether or not Navis should ignore 'transparent' areas when mouse-picking. - * - * @param defineThreshold Areas with opacity less than this percent will be ignored. Default is 5%. - */ - void setNaviIgnoreTransparent(const std::string &naviName, bool ignoreTrans = true, float defineThreshold = 0.05); - - /** - * Normally, mouse movement is only injected into a specific Navi if the mouse is within the boundaries of - * a Navi and over an opaque area (not transparent). This behavior may be detrimental to certain Navis, for - * example an animated 'dock' with floating icons on a transparent background: the mouse-out event would never - * be invoked on each icon because the Navi only received mouse movement input over opaque areas. Use this function - * to tell a Navi to always inject mouse movement, regardless of boundaries or transparency. - * - * @param naviName The name of the Navi to do this to. - * - * @param ignoreBounds Whether or not this Navi should ignore bounds/transparency when injecting mouse movement. - * - * @note - * The occlusivity of each Navi will still be respected, mouse movement will not be injected if another - * Navi is occluding the Navi you set this on. - */ - void setNaviIgnoreBounds(const std::string &naviName, bool ignoreBounds = true); - - /** - * Using an alpha-mask isn't the only way to achieve transparency of a Navi, you can use color-keying instead or - * at the same time with alpha-masking to achieve the desired result. Color-keying effectively replaces a certain - * color on the Navi page with a custom color/opacity. - * - * @param naviName The name of the Navi to do this to. - * - * @param keyColor The color to replace, as a Hex RGB String (Must be "#XXXXXX" !!). Pass an empty string to - * disable color-keying. - * - * @param keyFillOpacity The opacity of the fill color to replace the key color with, as a percent. - * - * @param keyFillColor The fill color to replace the key color with, as a Hex RGB String (Must be "#XXXXXX" !!) - * - * @param keyFuzziness The amount of 'fuzziness' to use when keying out a color. Increase this to additionally key out - * colors that are similar to the key color. The relative opacity of each 'fuzzy' color will also - * be calculated based on the color distance to the key color. There is some slight overhead when - * using a keyFuzziness other than 0.0, it's best to use this with Navis that don't update too often. - */ - void setNaviColorKey(const std::string &naviName, const std::string &keyColor, float keyFillOpacity = 0.0, const std::string &keyFillColor = "#000000", float keyFuzziness = 0.0); - - /** - * Limits the number of times per second a Navi may update. - * - * @param naviName The name of the Navi to do this to. - * - * @param maxUPS The maximum number of times per second a Navi can update. Set this to '0' to use no update limiting. - * If the current Navi is set to 'Force Max Updates', this value is used as the number of updates per - * second to actually do. - */ - void setMaxUpdatesPerSec(const std::string &naviName, unsigned int maxUPS = 0); - - /** - * Toggles between auto-updating and force-updating. - * - * @param naviName The name of the Navi to do this to. - * - * @param forceMaxUpdate Navi normally only updates when the page has changed, to override this functionality - * set this parameter to 'True' to make Navi 'force update' using the value of the - * parameter 'maxUpdatesPerSec'. This is useful as a work-around for rendering embedded - * Flash applications. Note: if 'maxUpdatesPerSec' is 0, Navi will try to 'force update' - * every single chance it gets (not recommended). Set this to 'False' to make Navi update - * only when the page changes (auto-updating). - */ - void setForceMaxUpdate(const std::string &naviName, bool forceMaxUpdate = false); - - /** - * Moves a movable non-material Navi by relative amounts. - * - * @param naviName The name of the Navi to do this to. - * - * @param deltaX The relative X amount to move the Navi by. Positive amounts move it right. - * - * @param deltaY The relative Y amount to move the Navi by. Positive amounts move it down. - */ - void moveNavi(const std::string &naviName, int deltaX, int deltaY); - - /** - * Sets the default position of a non-material Navi to a new position and subsequently moves - * the Navi to this position. This will work on non-movable non-material Navis. - * - * @param naviName The name of the Navi to do this to. - * - * @param naviPosition The new NaviPosition to set the Navi to. - */ - void setNaviPosition(const std::string &naviName, const NaviPosition &naviPosition); - - /** - * Resets the position of a movable Navi to the position it was created with. - * - * @param naviName The name of the Navi to do this to. - */ - void resetNaviPosition(const std::string &naviName); - - /** - * Resets the positions of all movable Navis to the positions they were created with. - */ - void resetAllPositions(); - - /** - * Hides a Navi. For regular Navis, this also additionally hides its internal overlay. - * - * @param naviName The name of the Navi to do this to. - * - * @param fade Whether or not to fade the Navi down. - * - * @param fadeDurationMS If fading, the number of milliseconds to fade for. - */ - void hideNavi(const std::string &naviName, bool fade = false, unsigned short fadeDurationMS = 300); - - /** - * Shows a Navi. For regular Navis, this also additionally shows its internal overlay. - * - * @param naviName The name of the Navi to do this to. - * - * @param fade Whether or not to fade the Navi up. - * - * @param fadeDurationMS If fading, the number of milliseconds to fade for. - */ - void showNavi(const std::string &naviName, bool fade = false, unsigned short fadeDurationMS = 300); - - /** - * Checks whether or not a Navi is focused/selected. - * - * @return True if a Navi is focused, False otherwise. - */ - bool isAnyNaviFocused(); - - /** - * Gets the name of the currently focused/selected Navi. - * - * @return If a Navi is focused, returns the name of the Navi. Otherwise it returns an empty string (""). - */ - const std::string & getFocusedNaviName(); - - /** - * Gets the name of the Ogre Material that is used internally for a certain Navi. - * - * @param naviName The name of the Navi that you wish to find the Material name of. - * - * @return If the Navi is found, returns the name of the internal Ogre Material, otherwise an empty string is returned. - */ - std::string getNaviMaterialName(const std::string &naviName); - - /** - * Gets a pointer to the Ogre::OverlayContainer (Panel) that is used internally for a certain Navi. - * Please remember that NaviMaterials have no Panel and thus, this function only works with full Navis. - * - * @param naviName The name of the Navi that you wish to retrieve the Panel of - * - * @return If the Navi is found and it is NOT a NaviMaterial, returns a pointer to the Panel, otherwise 0 is returned. - */ - Ogre::PanelOverlayElement* getNaviInternalPanel(const std::string &naviName); - - /** - * Gets the current visibility of the Navi. - * - * @param naviName The name of the Navi to get the visibility of. - * - * @return Whether or not the Navi is visible. Additionally returns false if the Navi is not found. - */ - bool getNaviVisibility(const std::string &naviName); - - /** - * Gets the derived UV's of the Navi's internal material/texture. On certain systems we must compensate for lack of - * NPOT on the videocard by using the next-highest POT texture. Normal Navi's compensate their UV's accordingly - * however NaviMaterials will need to adjust their own by use of this function. - */ - void getDerivedUV(const std::string &naviName, Ogre::Real& u1, Ogre::Real& v1, Ogre::Real& u2, Ogre::Real& v2); - - /** - * Injects absolute mouse coordinates into NaviManager. Used to generally keep track of where the mouse - * is for things like moving Navis around, telling the internal pages of each Navi where the mouse is and - * where the user has clicked, etc. - * - * @param xPos The absolute X-Value of the mouse. - * @param yPos The absolute Y-Value of the mouse. - * - * @return Returns True if the injected coordinate is over a Navi, False otherwise. - */ - bool injectMouseMove(int xPos, int yPos); - - /** - * Injects absolute mouse coordinates (in the Navi's own local coordinate space) into a specific Navi/NaviMaterial. - * - * @param naviName The name of the Navi/NaviMaterial to inject this into. - * @param xPos The absolute X-Value of the mouse, relative to the Navi/NaviMaterial's origin. - * @param yPos The absolute Y-Value of the mouse, relative to the Navi/NaviMaterial's origin. - */ - void injectNaviMouseMove(const std::string &naviName, int xPos, int yPos); - - /** - * Injects mouse wheel events into NaviManager. Used to scroll the focused Navi. - * - * @param relScroll The relative Scroll-Value of the mouse. - * - * @note - * To inject this using OIS: on a OIS::MouseListener::MouseMoved event, simply - * inject "arg.state.Z.rel" of the "MouseEvent". - * - * @return Returns True if the mouse wheel was scrolled while a Navi was focused, False otherwise. - */ - bool injectMouseWheel(int relScroll); - - /** - * Injects mouse wheel events into a specific Navi/NaviMaterial. - * - * @param naviName The name of the Navi/NaviMaterial to inject this into. - * @param relScroll The relative Scroll-Value of the mouse. - * - * @note - * To inject this using OIS: on a OIS::MouseListener::MouseMoved event, simply - * inject "arg.state.Z.rel" of the "MouseEvent". - */ - void injectNaviMouseWheel(const std::string &naviName, int relScroll); - - /** - * Injects mouse down events into NaviManager. Used to know when the user has pressed a mouse button - * and which button they used. - * - * @param buttonID The ID of the button that was pressed. Left = 0, Right = 1, Middle = 2. - * - * @return Returns True if the mouse went down over a Navi, False otherwise. - */ - bool injectMouseDown(int buttonID); - - /** - * Injects mouse down events into a specific Navi/NaviMaterial. - * - * @param naviName The name of the Navi/NaviMaterial to inject this into. - * @param buttonID The ID of the button that was pressed. Left = 0, Right = 1, Middle = 2. - * @param xPos The absolute X-Value of the mouse, relative to the Navi/NaviMaterial's origin. - * @param yPos The absolute Y-Value of the mouse, relative to the Navi/NaviMaterial's origin. - */ - void injectNaviMouseDown(const std::string &naviName, int buttonID, int xPos, int yPos); - - /** - * Injects mouse up events into NaviManager. Used to know when the user has released a mouse button - * and which button they used. - * - * @param buttonID The ID of the button that was released. Left = 0, Right = 1, Middle = 2. - * - * @return Returns True if the mouse went up while a Navi was focused, False otherwise. - */ - bool injectMouseUp(int buttonID); - - /** - * Injects mouse up events into a specific Navi/NaviMaterial. - * - * @param naviName The name of the Navi/NaviMaterial to inject this into. - * @param buttonID The ID of the button that was released. Left = 0, Right = 1, Middle = 2. - * @param xPos The absolute X-Value of the mouse, relative to the Navi/NaviMaterial's origin. - * @param yPos The absolute Y-Value of the mouse, relative to the Navi/NaviMaterial's origin. - */ - void injectNaviMouseUp(const std::string &naviName, int buttonID, int xPos, int yPos); - - /** - * Subscribes a NaviEventListener to listen for events from a certain Navi. - * - * - * @param naviName The name of the Navi to do this to. - * - * @param newListener The address of the NaviEventListener. If you try to add the same - * NaviEventListener twice, subsequent attempts will be ignored. - */ - void addNaviEventListener(const std::string &naviName, NaviEventListener* newListener); - - /** - * Un-subscribes a NaviEventListener from a certain Navi. - * - * @param naviName The name of the Navi to do this to. - * - * @param removeListener The address of the NaviEventListener to remove. - */ - void removeNaviEventListener(const std::string &naviName, NaviEventListener* removeListener); - - /** - * Binds the reception of a NaviData object from a certain Navi to a delegate function (callback). - * - * @param naviName The name of the Navi to receive the NaviData object from. - * - * @param naviDataName The name of the NaviData to bind the callback to. - * - * @param callback The NaviDelegate to bind to. NaviDelegates must return a 'void' and have one argument: 'const NaviData &naviData' - * \code - * // Member function instantiation: - * NaviDelegate(this, &MyClass::myMemberFunction) - * - * // Static function instantiation: - * NaviDelegate(&myStaticFunction) - * \endcode - * - * @param keys An optional string vector containing the keys to ensure. See NaviData::ensure (second overload). - * @note It is highly advised to use the NaviUtilities::Strings typedef to invoke this parameter. - * - * @par - * An example: - * \code - * naviMgr.bind("chat", "messageSent", NaviDelegate(this, &NaviDemo::messageSent), Strings("nick")("message")); - * \endcode - */ -// void bind(const std::string &naviName, const std::string &naviDataName, const NaviDelegate &callback, const std::vector<std::string> &keys = std::vector<std::string>()); - - /** - * Un-binds the reception of a NaviData object from a certain Navi to a delegate function (callback) - * - * @param naviName The name of the Navi to unbind the NaviData from. - * - * @param naviDataName The name of the NaviData to unbind. - * - * @param callback The specific NaviDelegate to unbind. This is optional, if it is left blank, all bindings to - * 'naviDataName' of 'naviName' will be released. - */ -// void unbind(const std::string &naviName, const std::string &naviDataName, const NaviDelegate &callback = NaviDelegate()); - - /** - * Focuses a Navi and pops it to the front of all other Navis. - * - * @param naviName The name of the Navi to focus. - */ - void focusNavi(const std::string &naviName); - - /** - * De-Focuses any currently-focused Navis. This would be useful if you need to disable any auto-key-injection - * (and subsequent display in a focused textbox of a focused Navi) done internally by Gecko. - */ - void deFocusAllNavis(); - }; - -} - -#endif \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-15 06:48:43
|
Revision: 544 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=544&view=rev Author: andy_miller Date: 2008-01-14 22:48:49 -0800 (Mon, 14 Jan 2008) Log Message: ----------- Fixed /MAP option in MSVC build Modified Paths: -------------- trunk/python-ogre/SConstruct Modified: trunk/python-ogre/SConstruct =================================================================== --- trunk/python-ogre/SConstruct 2008-01-15 06:48:00 UTC (rev 543) +++ trunk/python-ogre/SConstruct 2008-01-15 06:48:49 UTC (rev 544) @@ -91,7 +91,7 @@ def get_linkflags(): if environment.isWindows(): #LINKFLAGS = " /NOLOGO /INCREMENTAL:NO /DLL /OPT:NOREF /OPT:NOICF /OPT:NOWIN98 /subsystem:console " # no change - LINKFLAGS = " /MAP:FULL /MAPINFO:EXPORTS /NOLOGO /OPT:REF /INCREMENTAL:NO /DLL /OPT:ICF /subsystem:console " # 7 minutes 25% smaller 16.6 Meg + LINKFLAGS = " /MAP /MAPINFO:EXPORTS /NOLOGO /OPT:REF /INCREMENTAL:NO /DLL /OPT:ICF /subsystem:console " # 7 minutes 25% smaller 16.6 Meg #LINKFLAGS = " /NOLOGO /INCREMENTAL:NO /DLL /subsystem:console " ### LONG Link , 80 minutes - 15.7 meg if environment.isLinux(): if os.sys.platform <> 'darwin': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-15 06:47:55
|
Revision: 543 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=543&view=rev Author: andy_miller Date: 2008-01-14 22:48:00 -0800 (Mon, 14 Jan 2008) Log Message: ----------- QuickGUI code generation improvements Modified Paths: -------------- trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h Modified: trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h =================================================================== --- trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h 2008-01-15 06:47:21 UTC (rev 542) +++ trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h 2008-01-15 06:48:00 UTC (rev 543) @@ -11,3 +11,7 @@ typedef std::vector<QuickGUI::Vertex, std::allocator<QuickGUI::Vertex> > VectorVertex; typedef std::vector<std::string, std::allocator<std::string> > VectorString; typedef std::list<QuickGUI::QuadContainer*, std::allocator<QuickGUI::QuadContainer*> > QuadContainerList; +typedef std::map<std::string, QuickGUI::SkinSet*> MapSkinSets; +typedef std::vector<QuickGUI::ConfigNode*> VectorConfigNode; +typedef std::vector<QuickGUI::TreeItem*> VectorTreeItem; + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-15 06:47:19
|
Revision: 542 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=542&view=rev Author: andy_miller Date: 2008-01-14 22:47:21 -0800 (Mon, 14 Jan 2008) Log Message: ----------- Updated QuickGUI source to rev 313 - fixes display issues on ATI cards Revision Links: -------------- http://python-ogre.svn.sourceforge.net/python-ogre/?rev=313&view=rev Modified Paths: -------------- trunk/python-ogre/ThirdParty/quickgui/QuickGUIConfigScriptParser.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIConfigScriptParser.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIPrerequisites.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h Added Paths: ----------- trunk/python-ogre/ThirdParty/quickgui/QuickGUIRoot.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIRoot.h trunk/python-ogre/ThirdParty/quickgui/QuickGUITree.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUITree.h Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIConfigScriptParser.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIConfigScriptParser.cpp 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIConfigScriptParser.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -2,16 +2,15 @@ //Original author: John Judnich #include "QuickGUIPrecompiledHeaders.h" -#include "OgreScriptLoader.h" - -#include "OgreResourceGroupManager.h" #include "OgreException.h" #include "OgreLogManager.h" +#include "OgrePrerequisites.h" +#include "OgreResourceGroupManager.h" +#include "OgreScriptLoader.h" +#include "QuickGUIConfigScriptParser.h" #include "QuickGUISkinSetManager.h" -#include "QuickGUIConfigScriptParser.h" - using namespace Ogre; namespace QuickGUI { @@ -267,6 +266,7 @@ + ConfigNode::ConfigNode(ConfigNode *parent, const String &name) { ConfigNode::name = name; Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIConfigScriptParser.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIConfigScriptParser.h 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIConfigScriptParser.h 2008-01-15 06:47:21 UTC (rev 542) @@ -4,9 +4,6 @@ #ifndef __QuickGuiSkinSetParser_h_ #define __QuickGuiSkinSetParser_h_ -#include "OgreScriptLoader.h" -#include "OgrePrerequisites.h" - #include "QuickGUIPrerequisites.h" #include "QuickGUIExportDLL.h" Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -111,9 +111,10 @@ delete mScrollPane; mScrollPane = NULL; - mGUIManager->destroyWidget(mRightScrollBar); + removeAndDestroyChild(mRightScrollBar); mRightScrollBar = NULL; - mGUIManager->destroyWidget(mBottomScrollBar); + + removeAndDestroyChild(mBottomScrollBar); mBottomScrollBar = NULL; } } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -67,6 +67,10 @@ if( w == NULL ) return; + // If widget already queued for destruction, return. + if(std::find(mFreeList.begin(),mFreeList.end(),w) != mFreeList.end()) + return; + mFreeList.push_back(w); } @@ -186,6 +190,10 @@ return; } + // If widget already queued for destruction, return. + if(std::find(mFreeList.begin(),mFreeList.end(),w) != mFreeList.end()) + return; + if(w->getParentWidget() != NULL) w->getParentWidget()->removeAndDestroyChild(w); else Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIPrerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIPrerequisites.h 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIPrerequisites.h 2008-01-15 06:47:21 UTC (rev 542) @@ -7,7 +7,7 @@ namespace QuickGUI { ////////////DRAWING///////////// - #define VERTICES_PER_QUAD 4 + #define VERTICES_PER_QUAD 6 class Rect; class Point; Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -32,15 +32,10 @@ mClippingWidget(NULL), mInheritClippingWidget(true), mInheritQuadLayer(true), - mShowWithOwner(true), - mDirectXUsed(false) + mShowWithOwner(true) { mRenderSystem = Ogre::Root::getSingleton().getRenderSystem(); - // Determine if dirext X renderer used. - if(mRenderSystem->getName().find("Direct") != Ogre::String::npos) - mDirectXUsed = true; - _updateVertexColor(); } @@ -168,6 +163,8 @@ Ogre::Real top = -((absDimensions.y * 2) - 1); Ogre::Real bottom = top - (absDimensions.height * 2); + /* Reference code, back when the index buffer was used, and there were 4 vertices per quad. + // TRIANGLE 1 mVertices[0].pos = Ogre::Vector3(left, bottom, 0.f); // left-bottom mVertices[1].pos = Ogre::Vector3(right, bottom, 0.f); // right-bottom @@ -176,9 +173,8 @@ mVertices[2].pos = Ogre::Vector3(right, top, 0.f); // right-top mVertices[3].pos = Ogre::Vector3(left, top, 0.f); // left-top + */ - /* Reference code, back when the index buffer was not used, and there were 6 vertices per quad. - // TRIANGLE 1 mVertices[0].pos = Ogre::Vector3(left,bottom,0); // left-bottom mVertices[1].pos = Ogre::Vector3(right,bottom,0); // right-bottom @@ -188,8 +184,6 @@ mVertices[3].pos = Ogre::Vector3(right,bottom,0); // right-bottom mVertices[4].pos = Ogre::Vector3(right,top,0); // right-top mVertices[5].pos = Ogre::Vector3(left,top,0); // left-top - - */ } void Quad::_notifyAddedToRenderObjectGroup() @@ -243,6 +237,8 @@ { const Ogre::Vector4 actualTextureCoords(mTextureCoordinatesViaClipping); + /* Reference code, back when the index buffer was used, and there were 4 vertices per quad. + // TRIANGLE 1 : bot-left, bot-right, top-left vertices mVertices[0].uv = Ogre::Vector2(actualTextureCoords.x,actualTextureCoords.w); mVertices[1].uv = Ogre::Vector2(actualTextureCoords.z,actualTextureCoords.w); @@ -250,7 +246,7 @@ mVertices[2].uv = Ogre::Vector2(actualTextureCoords.z,actualTextureCoords.y); mVertices[3].uv = Ogre::Vector2(actualTextureCoords.x,actualTextureCoords.y); - /* Reference code, back when the index buffer was not used, and there were 6 vertices per quad. + */ // TRIANGLE 1 : bot-left, bot-right, top-left vertices mVertices[0].uv = Ogre::Vector2(actualTextureCoords.x,actualTextureCoords.w); @@ -260,12 +256,12 @@ mVertices[3].uv = Ogre::Vector2(actualTextureCoords.z,actualTextureCoords.w); mVertices[4].uv = Ogre::Vector2(actualTextureCoords.z,actualTextureCoords.y); mVertices[5].uv = Ogre::Vector2(actualTextureCoords.x,actualTextureCoords.y); - - */ } void Quad::_updateVertexColor() { + /* Reference code, back when the index buffer was used, and there were 4 vertices per quad. + // TRIANGLE 1 mRenderSystem->convertColourValue(mBottomColor,&( mVertices[0].color )); mRenderSystem->convertColourValue(mBottomColor,&( mVertices[1].color )); @@ -273,7 +269,7 @@ mRenderSystem->convertColourValue(mTopColor,&( mVertices[2].color )); mRenderSystem->convertColourValue(mTopColor,&( mVertices[3].color )); - /* Reference code, back when the index buffer was not used, and there were 6 vertices per quad. + */ // TRIANGLE 1 mRenderSystem->convertColourValue(mBottomColor,&( mVertices[0].color )); @@ -283,8 +279,6 @@ mRenderSystem->convertColourValue(mBottomColor,&( mVertices[3].color )); mRenderSystem->convertColourValue(mTopColor,&( mVertices[4].color )); mRenderSystem->convertColourValue(mTopColor,&( mVertices[5].color )); - - */ } void Quad::addToRenderObjectGroup() @@ -525,22 +519,8 @@ void Quad::setTextureCoordinates(const Ogre::Vector4& textureCoordinates) { - // DirectX interprets UV coords from a different location than OpenGL, so - // we have to modify the coordinates to get the same results. -/* if(mDirectXUsed) - { - Ogre::Real xVal = 0.5 / mPixelDimensions.width; - Ogre::Real yVal = 0.5 / mPixelDimensions.height; + mTextureCoordinates = textureCoordinates; - mTextureCoordinates = Ogre::Vector4( - textureCoordinates.x + xVal, - textureCoordinates.y + yVal, - textureCoordinates.z + xVal, - textureCoordinates.w + yVal); - } - else */ - mTextureCoordinates = textureCoordinates; - mTextureCoordsChanged = true; _clip(); Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h 2008-01-15 06:47:21 UTC (rev 542) @@ -104,7 +104,6 @@ GUIManager* mGUIManager; QuadContainer* mQuadContainer; Ogre::RenderSystem* mRenderSystem; - bool mDirectXUsed; Layer mLayer; bool mInheritQuadLayer; Added: trunk/python-ogre/ThirdParty/quickgui/QuickGUIRoot.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIRoot.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIRoot.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -0,0 +1,77 @@ +#include "QuickGUIPrecompiledHeaders.h" + +#include "QuickGUIRoot.h" + +template<> QuickGUI::Root* Ogre::Singleton<QuickGUI::Root>::ms_Singleton = 0; + +namespace QuickGUI +{ + Root::Root() : + mGUIManagerCounter(-1) + { + // Create SkinSetManager + new SkinSetManager(); + } + + Root::~Root() + { + for(std::map<Ogre::String,GUIManager*>::iterator it = mGUIManagers.begin(); it != mGUIManagers.end(); ++it) + delete (*it).second; + mGUIManagers.clear(); + + // Destroy SkinSetManager + delete SkinSetManager::getSingletonPtr(); + } + + Root* Root::getSingletonPtr(void) + { + return ms_Singleton; + } + + Root& Root::getSingleton(void) + { + assert( ms_Singleton ); + return ( *ms_Singleton ); + } + + GUIManager* Root::createGUIManager(const Ogre::String& name, Ogre::Viewport* v) + { + // make sure name does not already exist. + if(mGUIManagers.find(name) != mGUIManagers.end()) + throw Ogre::Exception(Ogre::Exception::ERR_DUPLICATE_ITEM,"A GUIManager with name \"" + name + "\" already exists!","Root::createGUIManager"); + + GUIManager* newGUIManager = new GUIManager(name,v); + mGUIManagers[name] = newGUIManager; + + return newGUIManager; + } + + GUIManager* Root::createGUIManager(Ogre::Viewport* v) + { + ++mGUIManagerCounter; + return createGUIManager("GUIManager" + Ogre::StringConverter::toString(mGUIManagerCounter),v); + } + + void Root::destroyGUIManager(GUIManager* gm) + { + if(gm == NULL) + return; + + destroyGUIManager(gm->getName()); + } + + void Root::destroyGUIManager(const Ogre::String& name) + { + GUIManager* gm = mGUIManagers[name]; + mGUIManagers.erase(mGUIManagers.find(name)); + delete gm; + } + + GUIManager* Root::getGUIManager(const Ogre::String& name) + { + if(mGUIManagers.find(name) == mGUIManagers.end()) + return NULL; + + return mGUIManagers[name]; + } +} Added: trunk/python-ogre/ThirdParty/quickgui/QuickGUIRoot.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIRoot.h (rev 0) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIRoot.h 2008-01-15 06:47:21 UTC (rev 542) @@ -0,0 +1,42 @@ +#ifndef QUICKGUIROOT_H +#define QUICKGUIROOT_H + +#include "QuickGUIExportDLL.h" +#include "QuickGUIManager.h" +#include "QuickGUISkinSetManager.h" + +#include "OgreException.h" +#include "OgrePrerequisites.h" +#include "OgreSingleton.h" +#include "OgreViewport.h" + +#include <map> + +namespace QuickGUI +{ + class _QuickGUIExport Root : + public Ogre::Singleton<Root> + { + public: + Root(); + ~Root(); + + static Root& getSingleton(void); + static Root* getSingletonPtr(void); + + GUIManager* createGUIManager(const Ogre::String& name, Ogre::Viewport* v); + GUIManager* createGUIManager(Ogre::Viewport* v); + + void destroyGUIManager(GUIManager* gm); + void destroyGUIManager(const Ogre::String& name); + + GUIManager* getGUIManager(const Ogre::String& name); + + protected: + int mGUIManagerCounter; + + std::map<Ogre::String,GUIManager*> mGUIManagers; + }; +} + +#endif Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.cpp 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -21,6 +21,9 @@ { _determineExtension(t); + mHorizontalTexelOffset = Ogre::Root::getSingleton().getRenderSystem()->getHorizontalTexelOffset(); + mVerticalTexelOffset = Ogre::Root::getSingleton().getRenderSystem()->getVerticalTexelOffset(); + // if skinset doesn't exists if (loadSkin() == false) { @@ -81,10 +84,10 @@ Ogre::Vector4 texCoord; if (dimension) { - texCoord.x = Ogre::StringConverter::parseReal(dimension->getValues()[0]); - texCoord.y = Ogre::StringConverter::parseReal(dimension->getValues()[1]); - texCoord.z = Ogre::StringConverter::parseReal(dimension->getValues()[2]); - texCoord.w = Ogre::StringConverter::parseReal(dimension->getValues()[3]); + texCoord.x = Ogre::StringConverter::parseReal(dimension->getValues()[0]) + (mHorizontalTexelOffset / mTextureWidth); + texCoord.y = Ogre::StringConverter::parseReal(dimension->getValues()[1]) + (mVerticalTexelOffset / mTextureHeight); + texCoord.z = Ogre::StringConverter::parseReal(dimension->getValues()[2]) + (mHorizontalTexelOffset / mTextureWidth); + texCoord.w = Ogre::StringConverter::parseReal(dimension->getValues()[3]) + (mVerticalTexelOffset / mTextureHeight); } //ConfigNode *rotation = skinRootNode->findChild("rotation"); @@ -109,6 +112,11 @@ return false; } + bool SkinSet::overTransparentPixel(const Ogre::String& skinComponent, int xPos, int yPos) + { + return false; + } + void SkinSet::saveSkin() { ConfigScriptSerializer serializer; Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.h 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.h 2008-01-15 06:47:21 UTC (rev 542) @@ -68,6 +68,10 @@ bool containsImage(Ogre::String textureName); Ogre::String getImageExtension() const; + /* + * Retrieve material used for this Skinset. + */ + Ogre::String getMaterialName() { return mMaterialName; } Ogre::String getSkinName() const; // Return the name of the skin for this SkinSet Ogre::String getTextureName() const; @@ -94,11 +98,17 @@ */ bool loadSkin(); + /** Returns true if the relative coordinates are over a transparent pixel, false otherwise. + @param + skinComponent The name to be embedded Image to query. + @param + xPos The relative position of the horizontal pixel in the image. + @param + yPos The relative position of the vertical pixel in the image. + */ + bool overTransparentPixel(const Ogre::String& skinComponent, int xPos, int yPos); + /* - * Retrieve material used for this Skinset. - */ - Ogre::String getMaterialName() { return mMaterialName; } - /* * set material used for this Skinset. */ void setMaterialName(const Ogre::String& materialName){ mMaterialName = materialName; } @@ -121,6 +131,9 @@ Ogre::uint mTextureWidth; Ogre::uint mTextureHeight; + Ogre::Real mHorizontalTexelOffset; + Ogre::Real mVerticalTexelOffset; + // This map connects individual textures to its UV coordinates, within // the SkinSet Texture. std::map<Ogre::String,Ogre::Vector4> mTextureMap; Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -549,7 +549,7 @@ void Text::selectCharacters(unsigned int startIndex, unsigned int endIndex) { - if( (mCaption.length() == 0) || (startIndex >= mCaption.length()) ) + if( (mCaption.length() == 0) || (startIndex >= static_cast<unsigned int>(mCharacters.size())) ) return; mSelectStart = startIndex; Added: trunk/python-ogre/ThirdParty/quickgui/QuickGUITree.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUITree.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUITree.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -0,0 +1,549 @@ +#include "QuickGUIPrecompiledHeaders.h" +#include "QuickGUIManager.h" +#include "QuickGUITree.h" + +namespace QuickGUI +{ + /** TreeItem Constructor + */ + TreeItem::TreeItem(const std::string &name, const std::string &id, const std::string &skinName, Tree *tree, double iconsize, GUIManager *mGUIManager): + _item(NULL), _parent(NULL), _minus(NULL) , _place(true), mSkinName(skinName), + _name(name), _id(id), _tree(tree), _next(NULL), _previous(NULL), _visible(true), _thumbtails(NULL), _down(false), + _IconSize(iconsize), _guiManager(mGUIManager) + { + _child.clear(); + } + + void TreeItem::setItem(MenuLabel *item) + { + _item = item; + //effects + _item->addEventHandler(Widget::EVENT_MOUSE_ENTER,&TreeItem::onMouseEntersItem,this); + _item->addEventHandler(Widget::EVENT_MOUSE_LEAVE,&TreeItem::onMouseLeavesItem,this); + _item->addEventHandler(Widget::EVENT_MOUSE_BUTTON_DOWN,&TreeItem::onMouseButtonDownItem,this); + _item->addEventHandler(Widget::EVENT_MOUSE_CLICK_DOUBLE, &TreeItem::onMouseClickDouble, this); + } + void TreeItem::onMouseEntersItem(const EventArgs& args) + { + if (_down) + return; + this->getItem()->setSkinComponent(".tree.button.over"); + this->getItem()->setSkin(_item->getSkin()); + } + void TreeItem::onMouseLeavesItem(const EventArgs& args) + { + if (_down) + return; + this->getItem()->setSkinComponent(".tree.button"); + this->getItem()->setSkin(_item->getSkin()); + } + void TreeItem::onMouseButtonDownItem(const EventArgs& args) + { + _down = true; + this->getItem()->setSkinComponent(".tree.button.down"); + this->getItem()->setSkin(_item->getSkin()); + _tree->onItemPushDown(_id); + } + + void TreeItem::onMouseButtonDownItemLeave() + { + _down = false; + this->getItem()->setSkinComponent(".tree.button"); + this->getItem()->setSkin(_item->getSkin()); + } + + void TreeItem::onMouseClickDouble(const EventArgs& args) + { + _place = !_place; + if(_place) + _tree->open(_id); + else + _tree->close(_id); + } + + void TreeItem::onMouseButtonDown(const EventArgs& args) + { + _place = !_place; + + if(_place) + _tree->open(_id); + else + _tree->close(_id); + } + + TreeItem::~TreeItem() + { + //delete from parent child's list + if (_parent) + _parent->removeChild(_id); + + setVisible(false); + _tree->removeAndDestroyChild(_thumbtails); + _tree->removeAndDestroyChild(_minus); + } + + std::vector<TreeItem *> &TreeItem::getChilds() + { + return _child; + } + + void TreeItem::removeChild(const std::string &id) + { + std::vector<TreeItem *>::iterator itb = _child.begin(); + for(; itb != _child.end(); ++itb) + if ((*itb)->getId() == id) + { + _child.erase(itb); + break; + } + } + QuickGUI::Image *TreeItem::addChild(TreeItem *Item) + { + _child.push_back(Item); + if (!_minus) // set image + - + { + Sheet *mSheet = _guiManager->getDefaultSheet(); + _minus = mSheet->createImage(); + _minus->setSkinComponent(".tree.minus"); + _minus->setSize(_IconSize, _IconSize); + _minus->setInheritClippingWidget(true); + _minus->setInheritOpacity(true); + _minus->setInheritQuadLayer(true); + _minus->addEventHandler(Widget::EVENT_MOUSE_BUTTON_DOWN, &TreeItem::onMouseButtonDown, this); + return _minus; + } + return NULL; + } + + void TreeItem::setThumbtails(const std::string &pic) + { + if (!_thumbtails) + { + Sheet *mSheet = _guiManager->getDefaultSheet(); + _thumbtails = mSheet->createImage(); + } + _thumbtails->setMaterial(pic); + _thumbtails->setSize(_IconSize, _IconSize); + if (_thumbtails->getParentSheet()) + _thumbtails->getParentSheet()->removeChild(_thumbtails); + _tree->addChild(_thumbtails); + _thumbtails->setPosition(_item->getXPosition() + (1.5 * _IconSize) / 2, _item->getYPosition() + (_item->getHeight() - _IconSize) / 2); + } + void TreeItem::setYPosition(double y) + { + _item->setYPosition(y); + if (_minus) + _minus->setYPosition(y); + if (_thumbtails) + _thumbtails->setYPosition(y); + } + + void TreeItem::setVisible(bool vis) + { + _visible = vis; + if (_visible) + { + _item->show(); + if (_minus) + _minus->show(); + if (_thumbtails) + _thumbtails->show(); + } + else + { + _item->hide(); + if (_minus) + _minus->hide(); + if (_thumbtails) + _thumbtails->hide(); + } + } + /** Tree Constructor + */ + Tree::Tree(const std::string &name, QuickGUI::GUIManager *mGUIManager, double padding) + : List(name,mGUIManager), _guiManager(mGUIManager), _lastChild(NULL), _iconSize(15), _name(name), _selected(NULL), _padding(padding) + { + // create the root Item + TreeItem *root = new TreeItem("root", "root", "qgui", this, 0, mGUIManager); + _lists["root"] = root; + + MenuLabel *item = addMenuLabel(); + root->setItem(item); + item->setXPosition(0); + item->setYPosition(- item->getHeight()); + root->setLag(-_padding / 2); + } + + Tree::~Tree() + { + std::map<std::string, TreeItem *>::iterator itb = _lists.begin(); + std::map<std::string, TreeItem *>::iterator ite = _lists.end(); + + for (; itb != ite; ++itb) + delete itb->second; + } + + void Tree::deleteChild(TreeItem *me) + { + // delete from List and destroy all childs + std::vector<TreeItem *>::iterator childItr; + for (childItr = me->getChilds().begin(); childItr != me->getChilds().end(); ++childItr) + { + if (!(*childItr)->getChilds().empty()) + { + deleteChild(*childItr); + continue; + } + + WidgetArray::iterator it = mItems.begin(); + while(it != mItems.end()) + { + bool deleted = false; + if ((*childItr) && (*it) == (*childItr)->getItem()) + { + _lists[(*childItr)->getId()] = NULL; + (*childItr)->setParent(NULL); + delete (*childItr); + //mGUIManager->destroyWidget((*it)); + it = mItems.erase(it); + deleted = true; + } + if (!deleted && (*it)== me->getItem()) + { + //mGUIManager->destroyWidget((*it)); + it = mItems.erase(it); + deleted = true; + } + if (!deleted) + ++it; + } + } + _lists[me->getId()] = NULL; + me->setParent(NULL); + delete me; + } + + void Tree::deleteItem(const std::string &id) + { + TreeItem *me = _lists[id]; + TreeItem *prev; + TreeItem *next; + + if (!me || me == _lists["root"]) + return; + + next = _lists[GetLastChild(id)]->getNext(); + prev = me->getPrevious(); + + if (_lastChild == me) + _lastChild = prev; + + if (next) + next->setPrevious(prev); + if (prev) + prev->setNext(next); + + me->getParent()->removeChild(id); + deleteChild(me); + + slideDown(prev); + + resize(); + } + + const std::string Tree::addInList(const std::string &name, const std::string &text, const std::string &parent, const std::string &LoadAfter) + { + TreeItem *par = _lists[parent]; + + if (!par) + return ""; + + // check for unique id; and create Item menulabel + std::string id = createId(name); + TreeItem *child = new TreeItem(name, id, mSkinName, this, _iconSize, _guiManager); + _lists[id] = child; + child->setLag(par->getLag() + 20); + child->setParent(par); + MenuLabel *item = this->addMenuLabel(); + item->setText(text); + item->setHorizontalAlignment(QuickGUI::Label::HA_LEFT); + child->setItem(item); + + // setImage + - + Image *img = par->addChild(child); + if (img) + { + if (img->getParentWidget()) + img->getParentWidget()->removeChild(img); + addChild(img); + img->setPosition(par->getItem()->getPosition().x, par->getItem()->getPosition().y); + img->setSkin(mSkinName, true); + img->appearOverWidget(this); + img->setPosition(par->getItem()->getXPosition() - (_iconSize / 2), par->getItem()->getYPosition() + (par->getItem()->getHeight() - _iconSize) / 2); + } + + + if ((parent == "root" || _lists["root"]->getId() == parent) && LoadAfter.empty()) // if we to add this item under all other + { + item->setXPosition(item->getPosition().x + child->getLag()); + child->setPrevious(_lastChild); + if (_lastChild) + _lastChild->setNext(child); + _lastChild = child; + } + else if (!LoadAfter.empty())// If we add this item after an other + addAfterTreeItem(LoadAfter, child); + else // else we add this item at the bootom of parent + addAfterTreeItem(GetLastChild(parent), child); + if (item->getWidth() == getWidth()) + item->setWidth(getWidth() - (item->getXPosition() + child->getLag())); + + + //look if parent is visible + + if (child->getVisible() && !par->getVisible()) + { + child->setVisible(false); + return id; + } + + //Now we will check if Item is in good place on Y + if (!child->getPrevious()) + return id; + + // try to find the last previous visible item; + TreeItem *previousVisible; + for (previousVisible = child->getPrevious(); previousVisible && !previousVisible->getVisible(); previousVisible = previousVisible->getPrevious()) + ; + if (previousVisible && previousVisible->getVisible()) + child->setYPosition(previousVisible->getItem()->getYPosition() + child->getItem()->getHeight()); + return id; + } + + std::string Tree::createId(const std::string& name) + { + if (_lists.find(name) == _lists.end()) + return name; + std::string id = name + "_0"; + for (unsigned int i = 1; _lists.find(id) != _lists.end(); ++i) + { + id = name + "_"; + std::ostringstream os; + os << i; + id += os.str(); + } + return id; + } + + void Tree::hideTreeItems(const std::string &id) + { + TreeItem *child = _lists[id]; + + if (!child) + return; + + std::vector<TreeItem *>::iterator itb = child->getChilds().begin(); + std::vector<TreeItem *>::iterator ite = child->getChilds().end(); + + for (; itb != ite; ++itb) + if ((*itb)) + { + if ((*itb)->getNext()) + { + (*itb)->getNext()->setYPosition((*itb)->getItem()->getYPosition()); + hideTreeItems((*itb)->getId()); + } + (*itb)->setVisible(false); + + if ((*itb)->getName() == "load_intro") + std::cout << "fait ?\n"; + + if ((itb+1) == ite) + slideUp((*itb)); + } + } + + void Tree::showTreeItems(const std::string &id) + { + TreeItem *child = _lists[id]; + + if (!child) + return; + + std::vector<TreeItem *>::iterator itb = child->getChilds().begin(); + std::vector<TreeItem *>::iterator ite = child->getChilds().end(); + + for (; itb != ite; ++itb) + if ((*itb)) + { + if ((*itb)->getPrevious() && (*itb)->getParent() && !parentIsPlace((*itb))) + (*itb)->setYPosition((*itb)->getPrevious()->getItem()->getYPosition()); + else + { + if ((*itb)->getPrevious()) + (*itb)->setYPosition((*itb)->getPrevious()->getItem()->getYPosition() + (*itb)->getPrevious()->getItem()->getHeight()); + + (*itb)->setVisible(true); + } + showTreeItems((*itb)->getId()); + + if ((itb+1) == ite) + slideDown((*itb)); + } + } + + + void Tree::slideUp(TreeItem *child) + { + if (child && child->getNext()) + { + double y = child->getItem()->getYPosition(); + if (child->getVisible()) + y += child->getItem()->getHeight(); + child->getNext()->setYPosition(y); + slideUp(child->getNext()); + } + } + + void Tree::slideDown(TreeItem *child) + { + // try to find the last previous visible item; + TreeItem *previousVisible; + TreeItem *children; + for (previousVisible = child->getPrevious(); previousVisible && !previousVisible->getVisible(); previousVisible = previousVisible->getPrevious()) + ; + if (!previousVisible) + previousVisible = _lists["root"]; + + for (children = child; children; children = children->getNext()) + { + double y = previousVisible->getItem()->getYPosition(); + if (children->getVisible()) + { + y += previousVisible->getItem()->getHeight(); + children->setYPosition(y); + previousVisible = children; + } + } + } + + void Tree::addAfterTreeItem(const std::string &id, TreeItem *item) + { + TreeItem *before = _lists[id]; + + if (!before) + return; + + if (before->getNext()) + before->getNext()->setPrevious(item); + else + _lastChild = item; + item->setPrevious(before); + item->setNext(before->getNext()); + before->setNext(item); + + item->getItem()->setXPosition(item->getItem()->getXPosition() + item->getLag()); + slideDown(item); + } + + std::string Tree::GetLastChild(const std::string &id, const std::string &parentId) + { + TreeItem *child = _lists[id]; + if (!child) + return std::string(id); + std::string parent = parentId; + + if (parentId.empty()) + parent = id; + + while (child->getNext() && hasParent(child->getNext(), parent)) + child = child->getNext(); + return child->getId(); + } + bool Tree::hasParent(TreeItem *child, const std::string &id) + { + TreeItem *par = child->getParent(); + while (par) + { + if (par->getId() == id) + return true; + par = par->getParent(); + } + return false; + } + bool Tree::parentIsPlace(TreeItem *child) + { + for (TreeItem *parent = child->getParent(); parent; parent = parent->getParent()) + if (!parent->getPlace()) + return false; + return true; + } + void Tree::setThumbtails(const std::string &id, const std::string &pic) + { + TreeItem *it = _lists[id]; + + if (!it) + return; + + it->setThumbtails(pic); + } + + void Tree::onItemPushDown(const std::string &id) + { + if (_selected && _selected != _lists[id]) + _selected->onMouseButtonDownItemLeave(); + _selected = _lists[id]; + } + + const std::string Tree::GetSelectedName() + { + if (_selected) + return _selected->getName(); + return ""; + } + const std::string Tree::GetSelectedID() + { + if (_selected) + return _selected->getId(); + return ""; + } + void Tree::close(const std::string &id) + { + TreeItem *item = _lists[id]; + if (!item || id == "root") + return; + if (item->getChilds().empty()) + return; + + item->setPlace(false); + hideTreeItems(id); + QuickGUI::Image * img = item->getImage(); + img->setSkinComponent(".tree.plus"); + img->setSkin(mSkinName, true); + + resize(); + } + + void Tree::open(const std::string &id) + { + TreeItem *item = _lists[id]; + if (!item || id == "root") + return; + if (item->getChilds().empty()) + return; + + item->setPlace(true); + showTreeItems(id); + QuickGUI::Image * img = item->getImage(); + img->setSkinComponent(".tree.minus"); + img->setSkin(mSkinName, true); + resize(); + } + + void Tree::resize() + { + // for resize scrollbar CHANGE IT !!!!! + //getScrollPane()->manageWidgets(); + setSize(getSize()); + } +} // namespace Added: trunk/python-ogre/ThirdParty/quickgui/QuickGUITree.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUITree.h (rev 0) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUITree.h 2008-01-15 06:47:21 UTC (rev 542) @@ -0,0 +1,165 @@ +#ifndef QUICKGUITREE_H +#define QUICKGUITREE_H + +#include "OgreStringConverter.h" + +#include "QuickGUIPrerequisites.h" +#include "QuickGUIBorder.h" +#include "QuickGUIButton.h" +#include "QuickGUICheckBox.h" +#include "QuickGUIComboBox.h" +#include "QuickGUIConsole.h" +#include "QuickGUIImage.h" +#include "QuickGUIPanel.h" +#include "QuickGUILabelArea.h" +#include "QuickGUINStateButton.h" +#include "QuickGUIProgressBar.h" +#include "QuickGUIScrollPane.h" +#include "QuickGUIText.h" +#include "QuickGUITextBox.h" +#include "QuickGUIHorizontalTrackBar.h" +#include "QuickGUIVerticalTrackBar.h" +#include "QuickGUIWidget.h" + +#include <iostream> +#include <vector> + +using std::vector; +using std::string; +using std::map; + +namespace QuickGUI +{ + class Tree; + class TreeItem; + + /** Represents an Item in the Tree + @remarks + A Tree Widget can hold a number of TreeItems. + */ + class TreeItem + { + public: + /** Constructor + @param + name The name to be given to the TreeItem . + @param + id The id to be given to the TreeItem (must be unique). + @param + skinName The name of the skin to get graphics from + */ + TreeItem(const string &name,const string &id, const string &skinName, Tree *tree, double iconsize, GUIManager *mGuiManager); + ~TreeItem(); + + double getLag(){ return _lag; } + bool getVisible(){ return _visible; } + bool getPlace(){ return _place; } + TreeItem *getParent(){ return _parent; } + vector<TreeItem *> &getChilds(); + string &getName(){ return _name;} + string &getId(){ return _id;} + MenuLabel * getItem() { return _item; } + Image * getImage(){ return _minus; } + Image * getThumbtails(){ return _thumbtails; } + TreeItem *getPrevious(){ return _previous; } + TreeItem *getNext(){ return _next; } + + + void removeChild(const string &name); + void setYPosition(double y); + void setVisible(bool vis); + void setItem(MenuLabel *item); + void setPrevious(TreeItem *pre){ _previous = pre; } + void setNext(TreeItem * next){ _next = next; } + QuickGUI::Image *addChild(TreeItem *Item); + void setParent(TreeItem *Item){ _parent = Item; } + void setLag(double lag){ _lag = lag; } + void setPlace(bool place){ _place = place; } + void setThumbtails(const string &pic); + void onMouseButtonDownItemLeave(); + private: //effects + + void onMouseClickDouble(const EventArgs& args); + void onMouseButtonDown(const EventArgs& args); + void onMouseEntersItem(const EventArgs& args); + void onMouseLeavesItem(const EventArgs& args); + void onMouseButtonDownItem(const EventArgs& args); + + private: + GUIManager * _guiManager; + QuickGUI::Image *_minus; // - + button + QuickGUI::Image *_thumbtails; + TreeItem *_parent; + vector<TreeItem *> _child; + double _lag; + double _IconSize; + bool _place; + bool _visible; + bool _down; + + /* heritage */ + TreeItem *_next; + TreeItem *_previous; + Tree *_tree; + string mSkinName; + string _id; + string _name; + MenuLabel *_item; + }; + + + /** Represents a Tree View Widget + */ + + class _QuickGUIExport Tree : + public List + { + public: + /** Constructor + @param + name The name to be given to the Tree Widget. + @param + mGUIManager + @param + padding ChildTreeItem's left padding inherited from parent TreeItem. Default value 20 + */ + Tree(const string &name, QuickGUI::GUIManager *mGUIManager, double padding = 20); + + const string addInList(const string &name, const string &text, const string &parent = "root", const string &LoadAfter = ""); + void hideTreeItems(const string &name); + void showTreeItems(const string &name); + + void deleteItem(const string &name); + void addAfterTreeItem(const string &name, TreeItem *item); + string GetLastChild(const string &name, const string &parent = ""); + void setThumbtails(const string &name, const string &pic); + void onItemPushDown(const string &name); + const string GetSelectedName(); + const string GetSelectedID(); + void close(const string &id); + void open(const string &id); + ~Tree(); + + private: + bool hasParent(TreeItem *child, const string &name); + bool parentIsPlace(TreeItem *child); + void slideUp(TreeItem *child); + void slideDown(TreeItem *child); + void deleteChild(TreeItem *me); + string createId(const string& name); + void resize(); + + private: + double _padding; + TreeItem *_selected; + string _name; + string _id; + double _iconSize; + TreeItem *_lastChild; + map<string, TreeItem *> _lists; + QuickGUI::GUIManager *_guiManager; + }; +} + +#endif + Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -16,7 +16,6 @@ mRenderSystem = Ogre::Root::getSingleton().getRenderSystem(); mTextureManager = Ogre::TextureManager::getSingletonPtr(); _createVertexBuffer(); - _createIndexBuffer(); // Initialise blending modes to be used. We use these every frame, so we'll set them up now to save time later. mColorBlendMode.blendType = Ogre::LBT_COLOUR; @@ -37,7 +36,6 @@ VertexBuffer::~VertexBuffer() { _destroyVertexBuffer(); - _destroyIndexBuffer(); } void VertexBuffer::_createVertexBuffer() @@ -61,23 +59,6 @@ mRenderOperation.useIndexes = false; } - void VertexBuffer::_createIndexBuffer() - { - mRenderOperation.useIndexes = true; - mRenderOperation.indexData = new Ogre::IndexData(); - mRenderOperation.indexData->indexStart = 0; - - // Create the Index Buffer - size_t indexCount = (mVertexBufferSize / 4) * 6; - - mIndexBuffer = Ogre::HardwareBufferManager::getSingleton( ).createIndexBuffer( - ((mVertexBufferSize > 655534) ? Ogre::HardwareIndexBuffer::IT_32BIT: Ogre::HardwareIndexBuffer::IT_16BIT), - indexCount, - Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE, - false); - mRenderOperation.indexData->indexBuffer = mIndexBuffer; - } - void VertexBuffer::_declareVertexStructure() { Ogre::VertexDeclaration* vd = mRenderOperation.vertexData->vertexDeclaration; @@ -113,13 +94,6 @@ mVertexBuffer.setNull(); } - void VertexBuffer::_destroyIndexBuffer() - { - delete mRenderOperation.indexData; - mRenderOperation.indexData = NULL; - mIndexBuffer.setNull(); - } - void VertexBuffer::_initRenderState() { // make sure we're rendering to the correct viewport @@ -145,7 +119,6 @@ // initialise texture settings mRenderSystem->_setTextureCoordCalculation(0, Ogre::TEXCALC_NONE); mRenderSystem->_setTextureCoordSet(0, 0); - //mRenderSystem->_setTextureUnitFiltering(0, Ogre::FO_NONE, Ogre::FO_NONE, Ogre::FO_NONE); mRenderSystem->_setTextureUnitFiltering(0, Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_POINT); mRenderSystem->_setTextureAddressingMode(0, mTextureAddressMode); mRenderSystem->_setTextureMatrix(0, Ogre::Matrix4::IDENTITY); @@ -173,8 +146,7 @@ */ unsigned int quadCounter = 0; - size_t indexOffset = 0; - mRenderOperation.vertexData->vertexStart = 0; + size_t vertexOffset = 0; for(TextureChangeList::iterator materialChangeIt = mMaterialChangeList.begin(); materialChangeIt != mMaterialChangeList.end(); ++materialChangeIt) { @@ -184,9 +156,8 @@ mRenderOperation.vertexData->vertexCount = textureChangeQuadSize * VERTICES_PER_QUAD; - mRenderOperation.indexData->indexStart = indexOffset; - mRenderOperation.indexData->indexCount = textureChangeQuadSize * 6; - indexOffset += mRenderOperation.indexData->indexCount; + mRenderOperation.vertexData->vertexStart = vertexOffset; + vertexOffset += mRenderOperation.vertexData->vertexCount; } // Render @@ -265,10 +236,8 @@ void VertexBuffer::resizeVertexBuffer( const size_t numberOfVertices ) { _destroyVertexBuffer(); - _destroyIndexBuffer(); mVertexBufferSize = numberOfVertices; _createVertexBuffer(); - _createIndexBuffer(); } void VertexBuffer::setData(QuadList* l) @@ -356,46 +325,5 @@ } mVertexBuffer->unlock(); } - - // Fill Index Buffer - { - // Handles 32bits indexes for really loud UI. - if (mIndexBuffer->getType() == Ogre::HardwareIndexBuffer::IT_32BIT) - { - unsigned int* mIndexBufferPtr = (unsigned int*)mIndexBuffer->lock ( Ogre::HardwareVertexBuffer::HBL_DISCARD ); - unsigned int offset = 0; - for (size_t k = 0; k < quadCount; k++) - { - *mIndexBufferPtr++ = offset + 0; - *mIndexBufferPtr++ = offset + 1; - *mIndexBufferPtr++ = offset + 3; - - *mIndexBufferPtr++ = offset + 1; - *mIndexBufferPtr++ = offset + 2; - *mIndexBufferPtr++ = offset + 3; - - offset += 4; - } - mIndexBuffer->unlock(); - } - else - { - unsigned short* mIndexBufferPtr = (unsigned short*)mIndexBuffer->lock ( Ogre::HardwareVertexBuffer::HBL_DISCARD ); - unsigned short offset = 0; - for (size_t k = 0; k < quadCount; k++) - { - *mIndexBufferPtr++ = offset + 0; - *mIndexBufferPtr++ = offset + 1; - *mIndexBufferPtr++ = offset + 3; - - *mIndexBufferPtr++ = offset + 1; - *mIndexBufferPtr++ = offset + 2; - *mIndexBufferPtr++ = offset + 3; - - offset += 4; - } - mIndexBuffer->unlock(); - } - } } } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.h 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.h 2008-01-15 06:47:21 UTC (rev 542) @@ -63,10 +63,6 @@ Ogre::HardwareVertexBufferSharedPtr mVertexBuffer; size_t mVertexBufferSize; // the maximum number of vertices the buffer can hold. size_t mVertexBufferUsage; // the current number of vertices stored in the buffer. - -#if VERTICES_PER_QUAD == 4 - Ogre::HardwareIndexBufferSharedPtr mIndexBuffer; -#endif // Every RenderSystem::_render(mRenderOperation) constitutes a batch. Ogre::RenderOperation mRenderOperation; @@ -83,7 +79,6 @@ // NOTE: we do not need a _clearVertexBuffer function, since we get new, blank memory when locking with HBL_DISCARD. void _createVertexBuffer(); - void _createIndexBuffer(); /* * Define the size and data types that form a *Vertex*, to be used in the VertexBuffer. @@ -92,8 +87,6 @@ void _declareVertexStructure(); void _destroyVertexBuffer(); void _renderVertexBuffer(); - - void _destroyIndexBuffer(); }; } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp 2008-01-15 06:47:21 UTC (rev 542) @@ -12,6 +12,7 @@ { Widget::Widget(const Ogre::String& name, GUIManager* gm) : mCanResize(false), + mClippingEnabled(true), mClippingWidget(0), mDragXOnly(false), mDragYOnly(false), @@ -440,6 +441,11 @@ mGUIManager->setActiveWidget(this); } + Rect Widget::getActualDimensions() + { + return Rect(getActualPosition(),getActualSize()); + } + Ogre::Real Widget::getActualOpacity() { if((mParentWidget == NULL) || (!mInheritOpacity)) @@ -453,6 +459,16 @@ return getScreenPosition() + getScrollOffset(); } + Size Widget::getActualSize() + { + if( (mParentWidget == NULL) || !mClippingEnabled ) + return mSize; + + Rect r = getDimensions().getIntersection(Rect(mParentWidget->getActualPosition(),mParentWidget->getActualSize())); + + return Size(r.width,r.height); + } + WidgetArray* Widget::getChildWidgetList() { return &mChildWidgets; @@ -494,6 +510,11 @@ return NULL; } + bool Widget::getClippingEnabled() + { + return mClippingEnabled; + } + bool Widget::getGainFocusOnClick() { return mGainFocusOnClick; @@ -1020,12 +1041,15 @@ { if((*it)->getInstanceName() == widgetName) { - WidgetEventArgs args((*it)); - fireEvent(EVENT_CHILD_REMOVED,args); + Widget* w = (*it); (*it)->setQuadContainer(NULL); (*it)->setParent(NULL); mChildWidgets.erase(it); + + WidgetEventArgs args(w); + fireEvent(EVENT_CHILD_REMOVED,args); + return; } } @@ -1048,7 +1072,7 @@ void Widget::removeAndDestroyChild(Widget* w) { - if((w == NULL) || (mGUIManager == NULL) || (std::find(mChildWidgets.begin(),mChildWidgets.end(),w) == mChildWidgets.end())) + if((w == NULL) || (mGUIManager == NULL) || (w->getParentWidget() != this)) return; removeChild(w); @@ -1098,6 +1122,11 @@ } } + void Widget::setClippingEnabled(bool enable) + { + mClippingEnabled = enable; + } + void Widget::setDimensions(const Rect& pixelDimensions) { setPosition(pixelDimensions.x,pixelDimensions.y); Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h 2008-01-13 04:20:34 UTC (rev 541) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h 2008-01-15 06:47:21 UTC (rev 542) @@ -165,7 +165,7 @@ } void addEventHandler(Event EVENT, MemberFunctionSlot* function); - template<typename T> void addEventListener(Event EVENT, void (T::*function)(const EventArgs&), T* obj) + template<typename T> void addEventListener(void (T::*function)(const EventArgs&), T* obj) { mEventListeners.push_back(new MemberFunctionPointer<T>(function,obj)); } @@ -214,6 +214,7 @@ * Sets focus to the widget by firing an activation event. */ virtual void focus(); + Rect getActualDimensions(); Ogre::Real getActualOpacity(); /** * Returns the position of the widget as it would be drawn on the screen. @@ -221,9 +222,11 @@ * getScreenPosition() + getScrollOffset(). */ Point getActualPosition(); + Size getActualSize(); WidgetArray* getChildWidgetList(); Widget* getChildWidget(const Ogre::String& name); Widget* getChildWidget(Type t, unsigned int index); + bool getClippingEnabled(); Rect getDimensions(); GUIManager* getGUIManager(); int getNumberOfHandlers(Event e); @@ -362,6 +365,7 @@ void removeAndDestroyChild(Widget* w); void removeAndDestroyChild(const Ogre::String& widgetName); bool resizingAllowed(); + void setClippingEnabled(bool enable); /** * Manually set the Dimensions of the widget. */ @@ -486,6 +490,7 @@ // PROPERTIES bool mCanResize; + bool mClippingEnabled; Widget* mClippingWidget; bool mInheritClippingWidget; bool mDragXOnly; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-13 04:20:29
|
Revision: 541 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=541&view=rev Author: andy_miller Date: 2008-01-12 20:20:34 -0800 (Sat, 12 Jan 2008) Log Message: ----------- Remove older OgreAL files Removed Paths: ------------- trunk/python-ogre/ThirdParty/ogreal/OgreALOggSoundStream.cpp trunk/python-ogre/ThirdParty/ogreal/OgreALOggSoundStream.h trunk/python-ogre/ThirdParty/ogreal/OgreALSoundStream.cpp trunk/python-ogre/ThirdParty/ogreal/OgreALSoundStream.h Deleted: trunk/python-ogre/ThirdParty/ogreal/OgreALOggSoundStream.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALOggSoundStream.cpp 2008-01-13 00:55:51 UTC (rev 540) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALOggSoundStream.cpp 2008-01-13 04:20:34 UTC (rev 541) @@ -1,295 +0,0 @@ -/*---------------------------------------------------------------------------*\ -** This source file is part of OgreAL ** -** an OpenAL plugin for the Ogre Rendering Engine. ** -** ** -** Copyright 2006 Casey Borders ** -** ** -** OgreAL is free software; you can redistribute it and/or modify it under ** -** the terms of the GNU Lesser General Public License as published by the ** -** Free Software Foundation; either version 2, or (at your option) any later ** -** version. ** -** ** -** The developer really likes screenshots and while he recognises that the ** -** fact that this is an AUDIO plugin means that the fruits of his labor will ** -** never been seen in these images he would like to kindly ask that you send ** -** screenshots of your application using his library to ** -** scr...@mo... ** -** ** -** Please bear in mind that the sending of these screenshots means that you ** -** are agreeing to allow the developer to display them in the media of his ** -** choice. They will, however, be fully credited to the person sending the ** -** email or, if you wish them to be credited differently, please state that ** -** in the body of the email. ** -** ** -** OgreAL 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 GNU General Public License for ** -** more details. ** -** ** -** You should have received a copy of the GNU General Public License along ** -** with OgreAL; see the file LICENSE. If not, write to the ** -** Free Software Foundation, Inc., ** -** 59 Temple Place - Suite 330, ** -** Boston, MA 02111-1307, USA. ** -\*---------------------------------------------------------------------------*/ - -#include "OgreALOggSoundStream.h" -#include "OgreALSoundManager.h" - -namespace OgreAL { - OggSoundStream::OggSoundStream(const Ogre::String& name, const Ogre::String& soundFile, bool loop, AudioFormat format) : - SoundStream(name, soundFile), - mOggFile(0), - mVorbisInfo(0), - mVorbisComment(0) - { - if(!(mOggFile = fopen(soundFile.c_str(), "rb"))) - { - throw Ogre::Exception(1, "Could not open Ogg file.", "OgreAL::OggSound::ctor"); - } - - if(ov_open(mOggFile, &mOggStream, NULL, 0) < 0) - { - fclose(mOggFile); - throw Ogre::Exception(1, "Could not open Ogg stream. ", "OgreAL::OggSound::ctor"); - } - - mVorbisInfo = ov_info(&mOggStream, -1); - - unsigned long channels = mVorbisInfo->channels; - mFreq = mVorbisInfo->rate; - mLoop = loop; - - if(channels == 1) - { - mFormat = AL_FORMAT_MONO16; - // Set BufferSize to 250ms (Frequency * 2 (16bit) divided by 4 (quarter of a second)) - mBufferSize = mFreq >> 1; - // IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ... - mBufferSize -= (mBufferSize % 2); - } - else if(channels == 2) - { - mFormat = AL_FORMAT_STEREO16; - // Set BufferSize to 250ms (Frequency * 4 (16bit stereo) divided by 4 (quarter of a second)) - mBufferSize = mFreq; - // IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ... - mBufferSize -= (mBufferSize % 4); - } - else if(channels == 4) - { - mFormat = alGetEnumValue("AL_FORMAT_QUAD16"); - // Set BufferSize to 250ms (Frequency * 8 (16bit 4-channel) divided by 4 (quarter of a second)) - mBufferSize = mFreq * 2; - // IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ... - mBufferSize -= (mBufferSize % 8); - } - else if(channels == 6) - { - mFormat = alGetEnumValue("AL_FORMAT_51CHN16"); - // Set BufferSize to 250ms (Frequency * 12 (16bit 6-channel) divided by 4 (quarter of a second)) - mBufferSize = mFreq * 3; - // IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ... - mBufferSize -= (mBufferSize % 12); - } - else if(channels == 7) - { - mFormat = alGetEnumValue("AL_FORMAT_61CHN16"); - // Set BufferSize to 250ms (Frequency * 16 (16bit 7-channel) divided by 4 (quarter of a second)) - mBufferSize = mFreq * 4; - // IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ... - mBufferSize -= (mBufferSize % 16); - } - else if(channels == 8) - { - mFormat = alGetEnumValue("AL_FORMAT_71CHN16"); - // Set BufferSize to 250ms (Frequency * 20 (16bit 8-channel) divided by 4 (quarter of a second)) - mBufferSize = mFreq * 5; - // IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ... - mBufferSize -= (mBufferSize % 20); - } - else - { - // Couldn't determine buffer format so log the error and default to mono - Ogre::LogManager::getSingleton().logMessage("!!WARNING!! Could not determine buffer format! Defaulting to MONO"); - - mFormat = AL_FORMAT_MONO16; - // Set BufferSize to 250ms (Frequency * 2 (16bit) divided by 4 (quarter of a second)) - mBufferSize = mFreq >> 1; - // IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ... - mBufferSize -= (mBufferSize % 2); - } - - alGenBuffers(2, mBuffers); - alGenSources(1, &mSource); - checkError(__FUNCTION__); - - if(SoundManager::getSingleton().xRamSupport()) - { - SoundManager::getSingleton().eaxSetBufferMode(2, mBuffers, SoundManager::xRamAccessible); - } - - for(int i = 0; i < 2; i++) - { - if(!stream(mBuffers[i])) - { - throw Ogre::Exception(1, "Could not open Ogg file.", "OgreAL::OggSound::ctor"); - } - } - - alSourceQueueBuffers(mSource, 2, mBuffers); - checkError(__FUNCTION__); - - initSource(); - - // There is an issue with looping Ogg streams in OpenAL - // so we'll do it manually in the update method - alSourcei(mSource, AL_LOOPING, AL_FALSE); - checkError(__FUNCTION__); - } - - OggSoundStream::~OggSoundStream() - { - emptyQueue(); - alDeleteBuffers(2, mBuffers); - ov_clear(&mOggStream); - - mOggFile = 0; - mVorbisInfo = 0; - mVorbisComment = 0; - } - - bool OggSoundStream::play() - { - if(isPlaying()) - { - return true; - } - else if(isStopped()) - { - for(int i = 0; i < 2; i++) - { - if(!stream(mBuffers[i])) return false; - } - - alSourceQueueBuffers(mSource, 2, mBuffers); - alSourcePlay(mSource); - checkError(__FUNCTION__); - return true; - } - else - { - alSourcePlay(mSource); - checkError(__FUNCTION__); - return true; - } - } - - bool OggSoundStream::stop() - { - if(isStopped() || isInitial()) return true; - - int queued; - alGetSourcei(mSource, AL_BUFFERS_QUEUED, &queued); - checkError(__FUNCTION__); - alSourceStop(mSource); - checkError(__FUNCTION__); - alSourceUnqueueBuffers(mSource, queued, mBuffers); - checkError(__FUNCTION__); - - ov_time_seek(&mOggStream, 0); - - return true; - } - - bool OggSoundStream::_updateSound() - { - // Call the parent method to update the position - Sound::_updateSound(); - - // Update the stream - int processed; - bool active = true; - - alGetSourcei(mSource, AL_BUFFERS_PROCESSED, &processed); - checkError(__FUNCTION__); - - while(processed--) - { - ALuint buffer; - - alSourceUnqueueBuffers(mSource, 1, &buffer); - checkError(__FUNCTION__); - - active = stream(buffer); - - alSourceQueueBuffers(mSource, 1, &buffer); - checkError(__FUNCTION__); - - if(!active) - { - if(mLoop) - { - active = true; - ov_time_seek(&mOggStream, 0); - } - else - { - stop(); - } - } - } - - return active; - } - - bool OggSoundStream::stream(ALuint buffer) - { - char *data = new char[mBufferSize]; - int size = 0; - int section; - int result; - - while(size < mBufferSize) - { - result = ov_read(&mOggStream, data+size, mBufferSize-size, 0, 2, 1, §ion); - - if(result > 0) - size += result; - else - if(result < 0) - throw Ogre::Exception(6, "Ogg Error: " + errorToString(result), "OgreAL::OggSoundStream::stream"); - else - break; - } - - checkError(__FUNCTION__); - - if(size == 0) - return false; - - alBufferData(buffer, mFormat, data, size, mFreq); - checkError(__FUNCTION__); - - return true; - } - - Ogre::String OggSoundStream::errorToString(int error) const - { - switch(error) - { - case OV_EREAD: - return Ogre::String("Read from media."); - case OV_ENOTVORBIS: - return Ogre::String("Not Vorbis data."); - case OV_EVERSION: - return Ogre::String("Vorbis version mismatch."); - case OV_EBADHEADER: - return Ogre::String("Invalid Vorbis header."); - case OV_EFAULT: - return Ogre::String("Internal logic fault (bug or heap/stack corruption."); - default: - return Sound::errorToString(error); - } - } -} // Namespace Deleted: trunk/python-ogre/ThirdParty/ogreal/OgreALOggSoundStream.h =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALOggSoundStream.h 2008-01-13 00:55:51 UTC (rev 540) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALOggSoundStream.h 2008-01-13 04:20:34 UTC (rev 541) @@ -1,100 +0,0 @@ -/*---------------------------------------------------------------------------*\ -** This source file is part of OgreAL ** -** an OpenAL plugin for the Ogre Rendering Engine. ** -** ** -** Copyright 2006 Casey Borders ** -** ** -** OgreAL is free software; you can redistribute it and/or modify it under ** -** the terms of the GNU Lesser General Public License as published by the ** -** Free Software Foundation; either version 2, or (at your option) any later ** -** version. ** -** ** -** The developer really likes screenshots and while he recognises that the ** -** fact that this is an AUDIO plugin means that the fruits of his labor will ** -** never been seen in these images he would like to kindly ask that you send ** -** screenshots of your application using his library to ** -** scr...@mo... ** -** ** -** Please bear in mind that the sending of these screenshots means that you ** -** are agreeing to allow the developer to display them in the media of his ** -** choice. They will, however, be fully credited to the person sending the ** -** email or, if you wish them to be credited differently, please state that ** -** in the body of the email. ** -** ** -** OgreAL 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 GNU General Public License for ** -** more details. ** -** ** -** You should have received a copy of the GNU General Public License along ** -** with OgreAL; see the file LICENSE. If not, write to the ** -** Free Software Foundation, Inc., ** -** 59 Temple Place - Suite 330, ** -** Boston, MA 02111-1307, USA. ** -\*---------------------------------------------------------------------------*/ - -#ifndef _OGRE_AL_OGG_SOUND_STREAM_H_ -#define _OGRE_AL_OGG_SOUND_STREAM_H_ - -#include <string> - -#include "ogg/ogg.h" -#include "vorbis/codec.h" -#include "vorbis/vorbisfile.h" -#include "OgreALPrereqs.h" -#include "OgreALSoundStream.h" - -namespace OgreAL { - /** - * OggSoundStream. - * @note - * This object is only to be instantiated using the SoundManager::createSoundStream - * method. - * @remark This is a sound that streams OggVorbis files - * - * @see OgreAL::SoundStream - */ - class OgreAL_Export OggSoundStream : public SoundStream - { - protected: - /* - ** Constructor is protected to enforce the use of the - ** factory via SoundManager::createSound - */ - - /** - * Constructor. - * @param name The name used to reference this sound - * @param soundFile The name of the file to load - * @param loop Should the sound loop once it has played - */ - OggSoundStream(const Ogre::String& name, const Ogre::String& soundFile, bool loop, AudioFormat format); - - public: - /** Standard Destructor. */ - virtual ~OggSoundStream(); - - /** Plays the sound */ - virtual bool play(); - /** Stops the sound */ - virtual bool stop(); - - /// This is called each frame to update the position, direction, etc - virtual bool _updateSound(); - - protected: - /// Maintains the stream but updating with new buffers - bool stream(ALuint buffer); - /// Translate the OpenAL error code to a string - virtual Ogre::String errorToString(int error) const; - - friend class SoundFactory; - - private: - FILE* mOggFile; // file handle - OggVorbis_File mOggStream; // stream handle - vorbis_info* mVorbisInfo; // some formatting data - vorbis_comment* mVorbisComment; // user comments - }; -} // Namespace -#endif Deleted: trunk/python-ogre/ThirdParty/ogreal/OgreALSoundStream.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALSoundStream.cpp 2008-01-13 00:55:51 UTC (rev 540) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALSoundStream.cpp 2008-01-13 04:20:34 UTC (rev 541) @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------------*\ -** This source file is part of OgreAL ** -** an OpenAL plugin for the Ogre Rendering Engine. ** -** ** -** Copyright 2006 Casey Borders ** -** ** -** OgreAL is free software; you can redistribute it and/or modify it under ** -** the terms of the GNU Lesser General Public License as published by the ** -** Free Software Foundation; either version 2, or (at your option) any later ** -** version. ** -** ** -** The developer really likes screenshots and while he recognises that the ** -** fact that this is an AUDIO plugin means that the fruits of his labor will ** -** never been seen in these images he would like to kindly ask that you send ** -** screenshots of your application using his library to ** -** scr...@mo... ** -** ** -** Please bear in mind that the sending of these screenshots means that you ** -** are agreeing to allow the developer to display them in the media of his ** -** choice. They will, however, be fully credited to the person sending the ** -** email or, if you wish them to be credited differently, please state that ** -** in the body of the email. ** -** ** -** OgreAL 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 GNU General Public License for ** -** more details. ** -** ** -** You should have received a copy of the GNU General Public License along ** -** with OgreAL; see the file LICENSE. If not, write to the ** -** Free Software Foundation, Inc., ** -** 59 Temple Place - Suite 330, ** -** Boston, MA 02111-1307, USA. ** -\*---------------------------------------------------------------------------*/ - -#include "OgreALSoundStream.h" -#include "OgreALSoundManager.h" - -namespace OgreAL { - SoundStream::SoundStream() - {} - - SoundStream::SoundStream(const Ogre::String& name, const Ogre::String& fileName) : - Sound(name, fileName) - {} - - SoundStream::~SoundStream() - {} - - void SoundStream::emptyQueue() - { - /* - ** If the sound doens't have a state yet it causes an - ** error when you try to unqueue the buffers! :S - */ - if(isInitial()) play(); - - stop(); - - int queued; - alGetSourcei(mSource, AL_BUFFERS_QUEUED, &queued); - alSourceUnqueueBuffers(mSource, queued, mBuffers); - checkError(__FUNCTION__); - } -} // Namespace Deleted: trunk/python-ogre/ThirdParty/ogreal/OgreALSoundStream.h =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALSoundStream.h 2008-01-13 00:55:51 UTC (rev 540) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALSoundStream.h 2008-01-13 04:20:34 UTC (rev 541) @@ -1,79 +0,0 @@ -/*---------------------------------------------------------------------------*\ -** This source file is part of OgreAL ** -** an OpenAL plugin for the Ogre Rendering Engine. ** -** ** -** Copyright 2006 Casey Borders ** -** ** -** OgreAL is free software; you can redistribute it and/or modify it under ** -** the terms of the GNU Lesser General Public License as published by the ** -** Free Software Foundation; either version 2, or (at your option) any later ** -** version. ** -** ** -** The developer really likes screenshots and while he recognises that the ** -** fact that this is an AUDIO plugin means that the fruits of his labor will ** -** never been seen in these images he would like to kindly ask that you send ** -** screenshots of your application using his library to ** -** scr...@mo... ** -** ** -** Please bear in mind that the sending of these screenshots means that you ** -** are agreeing to allow the developer to display them in the media of his ** -** choice. They will, however, be fully credited to the person sending the ** -** email or, if you wish them to be credited differently, please state that ** -** in the body of the email. ** -** ** -** OgreAL 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 GNU General Public License for ** -** more details. ** -** ** -** You should have received a copy of the GNU General Public License along ** -** with OgreAL; see the file LICENSE. If not, write to the ** -** Free Software Foundation, Inc., ** -** 59 Temple Place - Suite 330, ** -** Boston, MA 02111-1307, USA. ** -\*---------------------------------------------------------------------------*/ - -#ifndef _OGRE_AL_SOUND_STREAM_H_ -#define _OGRE_AL_SOUND_STREAM_H_ - -#include "OgreALPrereqs.h" -#include "OgreALSound.h" - -namespace OgreAL { - /** - * SoundStream. - * @remarks - * SoundStreams are created using the SoundManager::createSoundStream method - * and then can be attached to Ogre::SceneNodes, placed at a point - * in space or placed at an offset relative to the listener. They will then - * be updated by the SoundManager to stream in the sound. - * - * @see Sound - */ - class OgreAL_Export SoundStream : public Sound - { - protected: - /* - ** Constructors are protected to enforce the use of the - ** factory via SoundManager::createSound - */ - - /** Default Constructor. */ - SoundStream(); - /** Normal Constructor. @note Should not be called directly! Use SoundManager::createSoundStream */ - SoundStream(const Ogre::String& name, const Ogre::String& fileName); - - public: - /** Standard Destructor */ - virtual ~SoundStream(); - - protected: - /// Removes any buffers from the queue - virtual void emptyQueue(); - - friend class SoundFactory; - - ALuint mBuffers[2]; - }; -} // Namespace -#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-13 00:55:49
|
Revision: 540 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=540&view=rev Author: andy_miller Date: 2008-01-12 16:55:51 -0800 (Sat, 12 Jan 2008) Log Message: ----------- Further updates for sts::string alais and general cleanup Modified Paths: -------------- trunk/python-ogre/BuildModule.py trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h trunk/python-ogre/code_generators/et/generate_code.py trunk/python-ogre/code_generators/et/python_et_aliases.h trunk/python-ogre/code_generators/et/python_et_sizeof.h trunk/python-ogre/code_generators/particleuniverse/python_particleuniverse_aliases.h trunk/python-ogre/environment.py Modified: trunk/python-ogre/BuildModule.py =================================================================== --- trunk/python-ogre/BuildModule.py 2008-01-12 06:01:54 UTC (rev 539) +++ trunk/python-ogre/BuildModule.py 2008-01-13 00:55:51 UTC (rev 540) @@ -33,14 +33,14 @@ def getClassList (): - """ create a dictionary of classes from the enfironment modules + """ create a dictionary of classes from the environment modules """ dict = {} for c in dir(environment): var = environment.__dict__[c] if isinstance ( var, types.ClassType ) : ## OK so we know it's a class # logger.debug ( "getClassList: Checking %s" % c ) - if hasattr(var, 'active') and hasattr(var, 'pythonModule'): # and it looks like one we can about + if hasattr(var, 'active') and hasattr(var, 'pythonModule'): # and it looks like one we care about # logger.debug ( "getClassList: it's one of ours") dict[c] = var return dict @@ -192,11 +192,11 @@ if classList[ moduleName ].pythonModule == True: generateCode ( classList[ moduleName ] ) else: - exit ( "Module specificed does not generate source code (%s is a supporting module)" % moduleName ) + print ( "Module specificed does not generate source code (%s is a supporting module)" % moduleName ) if options.compilecode : if classList[ moduleName ].pythonModule == True: compileCode ( classList[ moduleName ] ) else: - exit ( "Module specificed does not need compiling (%s is a supporting module)" % moduleName ) + print ( "Module specificed does not need compiling (%s is a supporting module)" % moduleName ) Modified: trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2008-01-12 06:01:54 UTC (rev 539) +++ trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2008-01-13 00:55:51 UTC (rev 540) @@ -26,16 +26,16 @@ // Define the dll export qualifier if compiling for Windows #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - #ifdef CAELUM_LIB - #define DllExport __declspec (dllexport) - #else - #ifdef __MINGW32__ - #define DllExport - #else - #define DllExport __declspec (dllimport) - #endif - #endif -#else +// #ifdef CAELUM_LIB +// #define DllExport __declspec (dllexport) +// #else +// #ifdef __MINGW32__ +// #define DllExport +// #else +// #define DllExport __declspec (dllimport) +// #endif +// #endif +// #else #define DllExport #endif Modified: trunk/python-ogre/code_generators/et/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/et/generate_code.py 2008-01-12 06:01:54 UTC (rev 539) +++ trunk/python-ogre/code_generators/et/generate_code.py 2008-01-13 00:55:51 UTC (rev 540) @@ -66,7 +66,18 @@ if f.return_type.decl_string.startswith("::std::pair"): print "Excluding Class (%s) Function(%s) which return %s. These return List[bool,tuple(x,y,x)] " % (f.name, f.parent, f.return_type) f.exclude() - + std_ns = global_ns.namespace("std") + + excludes=['::ET::SplattingManager::createColourMap', # forces a vector(Ogre::ColourValue) which fails + '::ET::SplattingManager::createBaseTexture' + ] + for e in excludes: + print "excluding function", e + global_ns.member_functions(e).exclude() + +# std_ns.class_('vector<Ogre::ColourValue, std::allocator<Ogre::ColourValue> >').exclude() +# std_ns.class_('vector<Ogre::Image, std::allocator<Ogre::Image> >').exclude() + ############################################################ ## ## And there are things that manually need to be INCLUDED @@ -79,7 +90,8 @@ main_ns = global_ns.namespace( MAIN_NAMESPACE ) else: main_ns = global_ns - + global_ns.namespace( 'Ogre' ).class_('MaterialPtr').include(already_exposed=True) + ############################################################ ## ## And things that need manual fixes, but not necessarly hand wrapped @@ -174,30 +186,30 @@ # the 'main'function # def generate_code(): - messages.disable( -# Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X - messages.W1020 - , messages.W1021 - , messages.W1022 - , messages.W1023 - , messages.W1024 - , messages.W1025 - , messages.W1026 - , messages.W1027 - , messages.W1028 - , messages.W1029 - , messages.W1030 - , messages.W1031 - , messages.W1035 - , messages.W1040 - , messages.W1038 - , messages.W1041 - , messages.W1036 # pointer to Python immutable member - , messages.W1033 # unnamed variables - , messages.W1018 # expose unnamed classes - , messages.W1049 # returns reference to local variable - , messages.W1014 # unsupported '=' operator - ) +# messages.disable( +# # Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X +# messages.W1020 +# , messages.W1021 +# , messages.W1022 +# , messages.W1023 +# , messages.W1024 +# , messages.W1025 +# , messages.W1026 +# , messages.W1027 +# , messages.W1028 +# , messages.W1029 +# , messages.W1030 +# , messages.W1031 +# , messages.W1035 +# , messages.W1040 +# , messages.W1038 +# , messages.W1041 +# , messages.W1036 # pointer to Python immutable member +# , messages.W1033 # unnamed variables +# , messages.W1018 # expose unnamed classes +# , messages.W1049 # returns reference to local variable +# , messages.W1014 # unsupported '=' operator +# ) # # Use GCCXML to create the controlling XML file. # If the cache file (../cache/*.xml) doesn't exist it gets created, otherwise it just gets loaded Modified: trunk/python-ogre/code_generators/et/python_et_aliases.h =================================================================== --- trunk/python-ogre/code_generators/et/python_et_aliases.h 2008-01-12 06:01:54 UTC (rev 539) +++ trunk/python-ogre/code_generators/et/python_et_aliases.h 2008-01-13 00:55:51 UTC (rev 540) @@ -10,18 +10,11 @@ typedef std::pair<bool, float> StdPairBoolFloat; typedef std::pair<bool, std::allocator<Ogre::Vector3> > stdPairBoolVector; -//1 -//typedef std::vector<Ogre::ColourValue, std::allocator<Ogre::ColourValue> > ColourList; -//typedef std::vector<Ogre::Image, std::allocator<Ogre::Image> > ImageList; //2 -//typedef std::vector<Ogre::ColourValue> ColourList; -//typedef std::vector<Ogre::Image> ImageList; +// typedef std::vector<Ogre::ColourValue> ColourList; +// typedef std::vector<Ogre::Image> ImageList; -//3 -// typedef ET::ColourList ColourList; -// typedef ET::ImageList ImageList; - // these are uglys to remove messages in the generate_code output - doesn't impact the generated code :) //typedef std::vector<Ogre::Image> ImageList; Modified: trunk/python-ogre/code_generators/et/python_et_sizeof.h =================================================================== --- trunk/python-ogre/code_generators/et/python_et_sizeof.h 2008-01-12 06:01:54 UTC (rev 539) +++ trunk/python-ogre/code_generators/et/python_et_sizeof.h 2008-01-13 00:55:51 UTC (rev 540) @@ -12,3 +12,5 @@ //sizeof ( ::std::pair<bool, Ogre::Vector3> ); //sizeof (std::pair<bool, Ogre::Vector3> ); sizeof ( std::pair<bool, std::allocator<Ogre::Vector3> > ); +// sizeof ( std::vector<Ogre::ColourValue> ); +// sizeof ( std::vector<Ogre::Image> ); Modified: trunk/python-ogre/code_generators/particleuniverse/python_particleuniverse_aliases.h =================================================================== --- trunk/python-ogre/code_generators/particleuniverse/python_particleuniverse_aliases.h 2008-01-12 06:01:54 UTC (rev 539) +++ trunk/python-ogre/code_generators/particleuniverse/python_particleuniverse_aliases.h 2008-01-13 00:55:51 UTC (rev 540) @@ -1 +1,2 @@ // typedef name nicename; +typedef std::string String; Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-01-12 06:01:54 UTC (rev 539) +++ trunk/python-ogre/environment.py 2008-01-13 00:55:51 UTC (rev 540) @@ -201,8 +201,8 @@ class newton: pythonModule = False active = True - if not os.path.exists( os.path.join(os.getcwd(), 'ogreaddons/ogrenewt')): - os.makedirs ( os.path.join(os.getcwd(), 'ogreaddons/ogrenewt') ) +# if not os.path.exists( os.path.join(os.getcwd(), 'ogreaddons/ogrenewt')): +# os.makedirs ( os.path.join(os.getcwd(), 'ogreaddons/ogrenewt') ) if isLinux(): base = 'newton' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-12 06:01:51
|
Revision: 539 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=539&view=rev Author: andy_miller Date: 2008-01-11 22:01:54 -0800 (Fri, 11 Jan 2008) Log Message: ----------- Verious updates to QuickGUI, OgreForests - fixes to alais std::string to String Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp trunk/python-ogre/ThirdParty/forests/GrassLoader.h trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp trunk/python-ogre/ThirdParty/forests/ImpostorPage.h trunk/python-ogre/ThirdParty/forests/PagedGeometry.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIButton.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIMouseButtonID.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIWindow.cpp trunk/python-ogre/code_generators/et/python_et_aliases.h trunk/python-ogre/code_generators/navi/python_navi_aliases.h trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h trunk/python-ogre/code_generators/ois/generate_code.py trunk/python-ogre/code_generators/ois/python_ois_aliases.h trunk/python-ogre/code_generators/quickgui/generate_code.py trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h trunk/python-ogre/demos/ogre/Demo_Water.py trunk/python-ogre/demos/ogre/plugins.cfg trunk/python-ogre/scripts/updatesource.bat Added Paths: ----------- trunk/python-ogre/ThirdParty/nxogreOld/ Removed Paths: ------------- trunk/python-ogre/ThirdParty/nxogre/ Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-01-12 06:01:54 UTC (rev 539) @@ -6,6 +6,12 @@ module_dir = os.path.abspath(os.path.dirname(__file__) ) BASE_DIR, ignore = os.path.split(module_dir) +# the base of the /usr/... dircetory structure that we are using +ROOT_DIR = os.path.join(BASE_DIR,'root') +LOCAL_LIB = os.path.join(ROOT_DIR,'usr/lib') +LOCAL_INCLUDE = os.path.join(ROOT_DIR, 'usr/include') + + ## path to the root of your boost dir, should have 'libs', 'boost' subdirectories PATH_Boost = os.path.join(BASE_DIR, 'boost') ## Path to your boost_pythonxxxx lib file Modified: trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2008-01-12 06:01:54 UTC (rev 539) @@ -25,19 +25,19 @@ #include "Ogre.h" // Define the dll export qualifier if compiling for Windows -// #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 -// #ifdef CAELUM_LIB -// #define DllExport __declspec (dllexport) -// #else -// #ifdef __MINGW32__ -// #define DllExport -// #else -// #define DllExport __declspec (dllimport) -// #endif -// #endif -// #else +#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 + #ifdef CAELUM_LIB + #define DllExport __declspec (dllexport) + #else + #ifdef __MINGW32__ + #define DllExport + #else + #define DllExport __declspec (dllimport) + #endif + #endif +#else #define DllExport -// #endif +#endif // Define the version code #define CAELUM_VERSION_MAIN 0 Modified: trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -69,6 +69,12 @@ return layer; } +void GrassLoader::deleteLayer(GrassLayer *layer) +{ + layerList.remove(layer); + delete layer; +} + void GrassLoader::frameUpdate() { unsigned long currentTime = windTimer.getMilliseconds(); @@ -632,7 +638,6 @@ return mesh.getPointer(); } - GrassLayer::GrassLayer(PagedGeometry *geom, GrassLoader *ldr) { GrassLayer::geom = geom; Modified: trunk/python-ogre/ThirdParty/forests/GrassLoader.h =================================================================== --- trunk/python-ogre/ThirdParty/forests/GrassLoader.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/forests/GrassLoader.h 2008-01-12 06:01:54 UTC (rev 539) @@ -66,6 +66,11 @@ \see GrassLayer class for more information. */ GrassLayer *addLayer(const Ogre::String &material); + /** \brief Removes and deletes a grass layer from the scene + + This function simply deletes a GrassLayer previously created with addLayer(). */ + void deleteLayer(GrassLayer *layer); + /** \brief Returns a list of added grass layers. This function returns a std::list<GrassLayer*> reference, which contains all grass Modified: trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -274,7 +274,7 @@ if (bbset->getBillboardOrigin() == BBO_CENTER) entityBBCenter = tex->entityCenter; else if (bbset->getBillboardOrigin() == BBO_BOTTOM_CENTER) - entityBBCenter = Vector3(tex->entityCenter.x, -tex->entityCenter.y, tex->entityCenter.z); + entityBBCenter = Vector3(tex->entityCenter.x, tex->entityCenter.y - tex->entityRadius, tex->entityCenter.z); } //------------------------------------------------------------------------------------- Modified: trunk/python-ogre/ThirdParty/forests/ImpostorPage.h =================================================================== --- trunk/python-ogre/ThirdParty/forests/ImpostorPage.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/forests/ImpostorPage.h 2008-01-12 06:01:54 UTC (rev 539) @@ -86,7 +86,7 @@ will be stored in a single texture (8 x 4), so a impostor resolution of 128, for example, results in final texture size of 1024 x 512. - \note Calling this function will have no effect unless it is done before + \warning Calling this function will have no effect unless it is done before any entities are added to any page. */ static void setImpostorResolution(int pixels) { impostorResolution = pixels; } @@ -104,7 +104,7 @@ The default background color is ColourValue(0.0f, 0.3f, 0.0f, 0.0f), or dark green (this color was chosen because the main use of ImpostorPage is for trees, bushes, etc.) - \note Calling this function will have no effect unless it is done before + \warning Calling this function will have no effect unless it is done before any entities are added to any page. Also remember that you may have to delete the old impostor renders (located in your exe's directory) in order for the new ones to be generated. @@ -126,6 +126,9 @@ point of BBO_CENTER works best. \note Only BBO_CENTER and BBO_BOTTOM_CENTER is supported by this function currently. + + \warning Calling this function will have no effect unless it is done before + any entities are added to any page. */ static void setImpostorPivot(Ogre::BillboardOrigin origin); Modified: trunk/python-ogre/ThirdParty/forests/PagedGeometry.h =================================================================== --- trunk/python-ogre/ThirdParty/forests/PagedGeometry.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/forests/PagedGeometry.h 2008-01-12 06:01:54 UTC (rev 539) @@ -536,7 +536,7 @@ void reloadGeometryPage(const Ogre::Vector3 &point); - /** + /* \brief Immediately loads visible geometry. \param maxTime The maximum amount of time (in milliseconds) which cacheGeometry() is allowed to use before returning (roughly). Copied: trunk/python-ogre/ThirdParty/nxogreOld (from rev 538, trunk/python-ogre/ThirdParty/nxogre) Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIButton.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIButton.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIButton.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -31,6 +31,8 @@ { // apply button ".down" texture SkinSet* ss = SkinSetManager::getSingleton().getSkinSet(mSkinName); + if(ss == NULL) + throw Ogre::Exception(Ogre::Exception::ERR_ITEM_NOT_FOUND,"Skin \"" + mSkinName + "\" does not exist! Did you forget to load it using the SkinSetManager?","Button::applyButtonDownTexture"); mQuad->setTextureCoordinates(ss->getTextureCoordinates(mSkinName + mSkinComponent + ".down" + ss->getImageExtension())); } @@ -38,12 +40,16 @@ { // apply button ".over" texture SkinSet* ss = SkinSetManager::getSingleton().getSkinSet(mSkinName); + if(ss == NULL) + throw Ogre::Exception(Ogre::Exception::ERR_ITEM_NOT_FOUND,"Skin \"" + mSkinName + "\" does not exist! Did you forget to load it using the SkinSetManager?","Button::applyButtonOverTexture"); mQuad->setTextureCoordinates(ss->getTextureCoordinates(mSkinName + mSkinComponent + ".over" + ss->getImageExtension())); } void Button::applyDefaultTexture() { SkinSet* ss = SkinSetManager::getSingleton().getSkinSet(mSkinName); + if(ss == NULL) + throw Ogre::Exception(Ogre::Exception::ERR_ITEM_NOT_FOUND,"Skin \"" + mSkinName + "\" does not exist! Did you forget to load it using the SkinSetManager?","Button::applyDefaultTexture"); mQuad->setTextureCoordinates(ss->getTextureCoordinates(mSkinName + mSkinComponent + ss->getImageExtension())); } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -88,18 +88,16 @@ { mScrollPane = dynamic_cast<ScrollPane*>(_createComponent(mInstanceName+".ScrollPane",TYPE_SCROLL_PANE)); mScrollPane->setSize(mSize); -// mScrollPane->setHorizontalSliderMinWidth(20); -// mScrollPane->setVerticalSliderMinHeight(20); + mScrollPane->removeChild(mScrollPane->mRightBar); + // store reference to the scroll bar mRightScrollBar = mScrollPane->mRightBar; - if(mSkinName != "") - mRightScrollBar->setSkin(mSkinName,true); addChild(mRightScrollBar); mRightScrollBar->setPosition(mSize.width - 20,0); + mScrollPane->removeChild(mScrollPane->mBottomBar); + // store reference to the scroll bar mBottomScrollBar = mScrollPane->mBottomBar; - if(mSkinName != "") - mBottomScrollBar->setSkin(mSkinName,true); addChild(mBottomScrollBar); mBottomScrollBar->setPosition(0,mSize.height - 20); Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -12,28 +12,27 @@ mActiveSheet(0), mWidgetContainingMouse(0), mActiveWidget(0), - mClickTimeout(75), mQueueID(Ogre::RENDER_QUEUE_OVERLAY), mMouseCursor(0), mSceneManager(0), mDraggingWidget(false), mDebugString(""), - mUseMouseTimer(false), - mMouseTimer(0), - mDoubleClickTime(700) + mDetermineClickEvents(true), + mClickTime(100), + mDoubleClickTime(400), + mTripleClickTime(400) { mSkinSetManager = SkinSetManager::getSingletonPtr(); mWidgetNames.clear(); - mMouseButtonDown[0] = NULL; - mMouseButtonDown[1] = NULL; - mMouseButtonDown[2] = NULL; - mMouseButtonDown[3] = NULL; - mMouseButtonDown[4] = NULL; - mMouseButtonDown[5] = NULL; - mMouseButtonDown[6] = NULL; - mMouseButtonDown[7] = NULL; + for(int i = 0; i < NUM_MOUSE_BUTTONS; ++i) + { + mMouseButtonDown[i] = NULL; + mTimeOfButtonDown[i] = 0; + mTimeOfClick[i] = 0; + mTimeOfDoubleClick[i] = 0; + } // by default, we support codepoints 9, and 32-166. mSupportedCodePoints.insert(9); @@ -71,60 +70,6 @@ mFreeList.push_back(w); } - void GUIManager::_handleMouseDown(const MouseButtonID& button) - { - MouseEventArgs args(mWidgetContainingMouse); - args.position = mMouseCursor->getPosition(); - args.button = button; - args.keyModifiers = mKeyModifiers; - - // Feature, allowing widgets to be clicked, without transferring focus. Widget will receive - // Mouse Button Down Event. - if(!mWidgetContainingMouse->getGainFocusOnClick()) - { - mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_BUTTON_DOWN,args); - } - - // mActiveWidget is the last widget the user clicked on, ie TextBox, ComboBox, etc. - if( mActiveWidget != mWidgetContainingMouse ) - { - mActiveWidget->fireEvent(Widget::EVENT_LOSE_FOCUS,args); - - // Update active widget reference. - mActiveWidget = mWidgetContainingMouse; - } - - args.widget = mActiveWidget; - args.position = mMouseCursor->getPosition(); - args.button = button; - - mActiveWidget->fireEvent(Widget::EVENT_MOUSE_BUTTON_DOWN,args); - mActiveWidget->fireEvent(Widget::EVENT_GAIN_FOCUS,args); - mActiveWidget->setGrabbed(true); - - // If the user clicked on a widget that is a part of a window, make sure the window is brought to front. - Window* w = mActiveWidget->getParentWindow(); - if( w != NULL ) - w->bringToFront(); - - // Record that the mouse button went down on this widget (non-window) - mMouseButtonDown[args.button] = mActiveWidget; - - mMouseButtonTimings[button] = mTimer->getMilliseconds(); - } - - void GUIManager::_handleMouseUp(const MouseButtonID& button) - { - } - - void GUIManager::_handleMouseClick(const MouseButtonID& button) - { - } - - void GUIManager::_handleMouseDoubleClick(const MouseButtonID& button) - { - } - void GUIManager::_menuOpened(Widget* w) { if(w == NULL) @@ -272,6 +217,11 @@ return mDefaultSheet; } + bool GUIManager::getDetermineClickEvents() + { + return mDetermineClickEvents; + } + MouseCursor* GUIManager::getMouseCursor() { return mMouseCursor; @@ -409,31 +359,67 @@ if( !mMouseCursor->isVisible() ) return false; - bool eventHandled = false; + mTimeOfButtonDown[button] = mTimer->getMilliseconds(); + if(mDetermineClickEvents) + { + if((mTimeOfButtonDown[button] - mTimeOfDoubleClick[button]) <= mTripleClickTime) + { + if(mMouseButtonDown[button] == mWidgetContainingMouse) + return injectMouseTripleClick(button); + } + if((mTimeOfButtonDown[button] - mTimeOfClick[button]) <= mDoubleClickTime) + { + if(mMouseButtonDown[button] == mWidgetContainingMouse) + return injectMouseDoubleClick(button); + } + } - _handleMouseDown(button); - /* - if(mMouseButtonEvents.empty()) + // If we make it here, a simple mouse button down has occurred. + + // Setup event args. + MouseEventArgs args(mWidgetContainingMouse); + args.position = mMouseCursor->getPosition(); + args.button = button; + args.keyModifiers = mKeyModifiers; + + // Feature, allowing widgets to be clicked, without transferring focus. Widget will receive + // Mouse Button Down Event. No widgets will gain or lose focus. + if(!mWidgetContainingMouse->getGainFocusOnClick()) + return mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_BUTTON_DOWN,args); + + bool eventHandlerFired = false; + + // See if focus has changed from one widget to another. + // mActiveWidget is the last widget the user clicked on, ie TextBox, ComboBox, etc. + if( mActiveWidget != mWidgetContainingMouse ) { - mMouseButtonEvents.push_back(Widget::EVENT_MOUSE_BUTTON_DOWN); - mUseMouseTimer = true; - mMouseTimer = 0; - mMouseButtonDown[button] = mWidgetContainingMouse; - return ((mWidgetContainingMouse->getNumberOfHandlers(Widget::EVENT_MOUSE_BUTTON_DOWN) > 0) || - (mWidgetContainingMouse->getNumberOfHandlers(Widget::EVENT_MOUSE_CLICK) > 0) || - (mWidgetContainingMouse->getNumberOfHandlers(Widget::EVENT_MOUSE_CLICK_DOUBLE) > 0)); + if(mActiveWidget->fireEvent(Widget::EVENT_LOSE_FOCUS,args)) + eventHandlerFired = true; + + // Update active widget reference. + mActiveWidget = mWidgetContainingMouse; } - if((mMouseButtonEvents.front() == Widget::EVENT_MOUSE_CLICK) && (mMouseButtonDown[button] != mWidgetContainingMouse)) - return false; + // Fire Gain Focus event. + if(mActiveWidget->fireEvent(Widget::EVENT_GAIN_FOCUS,args)) + eventHandlerFired = true; + mActiveWidget->setGrabbed(true); - if(mMouseButtonEvents.front() == Widget::EVENT_MOUSE_CLICK_DOUBLE) - return false; + if(mActiveWidget->fireEvent(Widget::EVENT_MOUSE_BUTTON_DOWN,args)) + eventHandlerFired = true; - mMouseButtonEvents.push_back(Widget::EVENT_MOUSE_BUTTON_DOWN); - */ + // If the user clicked on a widget that is a part of a window, make sure the window is brought to front. + Window* w = mActiveWidget->getParentWindow(); + if( w != NULL ) + { + w->bringToFront(); + eventHandlerFired = true; + } - return eventHandled; + // Record that the mouse button went down on this widget (non-window) + mMouseButtonDown[button] = mActiveWidget; + + return eventHandlerFired; } bool GUIManager::injectMouseButtonUp(const MouseButtonID& button) @@ -441,8 +427,6 @@ if( !mMouseCursor->isVisible() ) return false; - bool eventHandled = false; - MouseEventArgs args(mActiveWidget); args.position = mMouseCursor->getPosition(); args.button = button; @@ -453,51 +437,87 @@ { mDraggingWidget = false; mActiveWidget->setGrabbed(false); - eventHandled = mActiveWidget->fireEvent(Widget::EVENT_DROPPED,args); - return eventHandled; + return mActiveWidget->fireEvent(Widget::EVENT_DROPPED,args); } + bool eventHandled = false; + // Feature, allowing widgets to be clicked, without transfering focus. Widget will receive // Mouse Button Up and Click Events, if appropriate. if(!mWidgetContainingMouse->getGainFocusOnClick()) { if( mMouseButtonDown[args.button] == mWidgetContainingMouse ) { - eventHandled = mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_BUTTON_UP,args); - // check if time elapsed it within click time. - if( (mTimer->getMilliseconds() - mMouseButtonTimings[button]) < mClickTimeout ) - eventHandled = mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_CLICK,args); + if(mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_BUTTON_UP,args)) + eventHandled = true; + if(mDetermineClickEvents) + { + if((mTimer->getMilliseconds() - mTimeOfButtonDown[button]) <= mClickTime) + { + if(injectMouseClick(button)) + eventHandled = true; + } + } } return eventHandled; } // If the MouseButton was not pressed on this widget, do not register the button being released on the widget - if( mWidgetContainingMouse != mActiveWidget ) - { - if(mActiveWidget->fireEvent(Widget::EVENT_LOSE_FOCUS,args)) - eventHandled = true; + if( mWidgetContainingMouse != mActiveWidget ) + return mActiveWidget->fireEvent(Widget::EVENT_LOSE_FOCUS,args); - return eventHandled; - } - // after this point, we know that the user had mouse button down on this widget, and is now doing mouse button up - args.widget = mActiveWidget; - args.position = mMouseCursor->getPosition(); - args.button = button; - if(mActiveWidget->fireEvent(Widget::EVENT_MOUSE_BUTTON_UP,args)) eventHandled = true; mActiveWidget->setGrabbed(false); - // check if time elapsed it within click time. - if( (mTimer->getMilliseconds() - mMouseButtonTimings[button]) < mClickTimeout ) - if(mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_CLICK,args)) - eventHandled = true; + if(mDetermineClickEvents) + { + if((mTimer->getMilliseconds() - mTimeOfButtonDown[button]) <= mClickTime) + { + if(injectMouseClick(button)) + eventHandled = true; + } + } return eventHandled; } + bool GUIManager::injectMouseClick(const MouseButtonID& button) + { + mTimeOfClick[button] = mTimer->getMilliseconds(); + + MouseEventArgs args(mActiveWidget); + args.position = mMouseCursor->getPosition(); + args.button = button; + args.keyModifiers = mKeyModifiers; + + return mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_CLICK,args); + } + + bool GUIManager::injectMouseDoubleClick(const MouseButtonID& button) + { + mTimeOfDoubleClick[button] = mTimer->getMilliseconds(); + + MouseEventArgs args(mActiveWidget); + args.position = mMouseCursor->getPosition(); + args.button = button; + args.keyModifiers = mKeyModifiers; + + return mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_CLICK_DOUBLE,args); + } + + bool GUIManager::injectMouseTripleClick(const MouseButtonID& button) + { + MouseEventArgs args(mActiveWidget); + args.position = mMouseCursor->getPosition(); + args.button = button; + args.keyModifiers = mKeyModifiers; + + return mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_CLICK_TRIPLE,args); + } + bool GUIManager::injectMouseLeaves(void) { if( !mMouseCursor->isVisible() ) @@ -631,18 +651,6 @@ injectMouseMove(0,0); } - - if(mUseMouseTimer) - mMouseTimer += time; - - if(mMouseTimer >= mDoubleClickTime) - { - // handle events on stack - mMouseButtonEvents.clear(); - - mMouseTimer = 0; - mUseMouseTimer = false; - } } bool GUIManager::isKeyModifierDown(KeyModifier k) @@ -735,13 +743,13 @@ mActiveSheet = s; + MouseEventArgs args(mWidgetContainingMouse); + args.position = mMouseCursor->getPosition(); + // Make sure active widget loses focus. - mActiveWidget->fireEvent(Widget::EVENT_LOSE_FOCUS,EventArgs()); + mActiveWidget->fireEvent(Widget::EVENT_LOSE_FOCUS,args); // Make sure mouse over widget has mouse leave event. - MouseEventArgs args(mWidgetContainingMouse); - args.position = mMouseCursor->getPosition(); - mWidgetContainingMouse->fireEvent(Widget::EVENT_MOUSE_LEAVE,args); // Update the active widget @@ -775,6 +783,11 @@ mDebugString = s; } + void GUIManager::setDetermineClickEvents(bool determine) + { + mDetermineClickEvents = determine; + } + void GUIManager::setRenderQueueID(Ogre::uint8 id) { mQueueID = id; Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.h 2008-01-12 06:01:54 UTC (rev 539) @@ -17,7 +17,6 @@ #include "QuickGUIUtility.h" #include <algorithm> -#include <deque> #include <list> #include <map> #include <set> @@ -97,6 +96,7 @@ * Returns the default sheet, automatically created with the GUI manager. */ Sheet* getDefaultSheet(); + bool getDetermineClickEvents(); MouseCursor* getMouseCursor(); Widget* getMouseOverWidget(); @@ -131,6 +131,9 @@ bool injectMouseButtonDown(const MouseButtonID& button); bool injectMouseButtonUp(const MouseButtonID& button); + bool injectMouseClick(const MouseButtonID& button); + bool injectMouseDoubleClick(const MouseButtonID& button); + bool injectMouseTripleClick(const MouseButtonID& button); /** * Injection when the mouse leaves the primary render window */ @@ -170,6 +173,7 @@ */ void setActiveWidget(Widget* w); void setDebugString(const Ogre::String s); + void setDetermineClickEvents(bool determine); /* * Sets the Render Queue Group to render on. By default, this is RENDER_QUEUE_OVERLAY. */ @@ -228,18 +232,21 @@ // list of widgets to delete on next frame. WidgetArray mFreeList; - bool mUseMouseTimer; - unsigned long mMouseTimer; - unsigned long mDoubleClickTime; - std::deque<Widget::Event> mMouseButtonEvents; + bool mDetermineClickEvents; + // timer used to get time readings. + Ogre::Timer* mTimer; + // Maximum number of milliseconds a click can be performed in. + unsigned long mClickTime; // time from mouse down to mouse up + unsigned long mDoubleClickTime; // time from mouse click to mouse down + unsigned long mTripleClickTime; // time from mouse double click to mouse down + // Store the last time a click was performed. + unsigned long mTimeOfButtonDown[NUM_MOUSE_BUTTONS]; + unsigned long mTimeOfClick[NUM_MOUSE_BUTTONS]; + unsigned long mTimeOfDoubleClick[NUM_MOUSE_BUTTONS]; - // timer used to get time readings - Ogre::Timer* mTimer; - unsigned long mClickTimeout; // max number of milliseconds a click can be performed in - unsigned long mMouseButtonTimings[8]; // Keep track of mouse button down/up and on what widget. This prevents left mouse button down on button A, // moving the mouse to button B, and releasing the left mouse button, causing button B to be pressed. (example) - Widget* mMouseButtonDown[8]; + Widget* mMouseButtonDown[NUM_MOUSE_BUTTONS]; Widget* mWidgetContainingMouse; // Stores reference to last clicked Widget. @@ -266,11 +273,6 @@ GUIManager(const Ogre::String& name, Ogre::Viewport* vp); /** Standard Destructor. */ ~GUIManager(); - - void _handleMouseDown(const MouseButtonID& button); - void _handleMouseUp(const MouseButtonID& button); - void _handleMouseClick(const MouseButtonID& button); - void _handleMouseDoubleClick(const MouseButtonID& button); }; } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIMouseButtonID.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIMouseButtonID.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIMouseButtonID.h 2008-01-12 06:01:54 UTC (rev 539) @@ -2,6 +2,9 @@ #define QUICKGUIMOUSEBUTTONID_H #include "QuickGUIPrerequisites.h" + +#define NUM_MOUSE_BUTTONS (MB_Button7 + 1) + namespace QuickGUI { /* Copied from OISMouse.h */ Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -127,13 +127,15 @@ mScrollPane = dynamic_cast<ScrollPane*>(_createComponent(mInstanceName+".ScrollPane",TYPE_SCROLL_PANE)); mScrollPane->setSize(mSize); + mScrollPane->removeChild(mScrollPane->mRightBar); + // store reference to the scroll bar mRightScrollBar = mScrollPane->mRightBar; - mRightScrollBar->setSkin(mSkinName,true); addChild(mRightScrollBar); mRightScrollBar->setPosition(mSize.width - 20,0); + mScrollPane->removeChild(mScrollPane->mBottomBar); + // store reference to the scroll bar mBottomScrollBar = mScrollPane->mBottomBar; - mBottomScrollBar->setSkin(mSkinName,true); addChild(mBottomScrollBar); mBottomScrollBar->setPosition(0,mSize.height - 20); Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -32,9 +32,15 @@ mClippingWidget(NULL), mInheritClippingWidget(true), mInheritQuadLayer(true), - mShowWithOwner(true) + mShowWithOwner(true), + mDirectXUsed(false) { mRenderSystem = Ogre::Root::getSingleton().getRenderSystem(); + + // Determine if dirext X renderer used. + if(mRenderSystem->getName().find("Direct") != Ogre::String::npos) + mDirectXUsed = true; + _updateVertexColor(); } @@ -519,8 +525,22 @@ void Quad::setTextureCoordinates(const Ogre::Vector4& textureCoordinates) { - mTextureCoordinates = textureCoordinates; + // DirectX interprets UV coords from a different location than OpenGL, so + // we have to modify the coordinates to get the same results. +/* if(mDirectXUsed) + { + Ogre::Real xVal = 0.5 / mPixelDimensions.width; + Ogre::Real yVal = 0.5 / mPixelDimensions.height; + mTextureCoordinates = Ogre::Vector4( + textureCoordinates.x + xVal, + textureCoordinates.y + yVal, + textureCoordinates.z + xVal, + textureCoordinates.w + yVal); + } + else */ + mTextureCoordinates = textureCoordinates; + mTextureCoordsChanged = true; _clip(); Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h 2008-01-12 06:01:54 UTC (rev 539) @@ -104,6 +104,7 @@ GUIManager* mGUIManager; QuadContainer* mQuadContainer; Ogre::RenderSystem* mRenderSystem; + bool mDirectXUsed; Layer mLayer; bool mInheritQuadLayer; Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -129,7 +129,7 @@ q->_notifyAddedToRenderObjectGroup(); mMenuChanged = true; -/* + // check if buffer needs to be resized. const size_t numQuads = static_cast<size_t>(mMenuRenderables.size()); const size_t numVertices = numQuads * VERTICES_PER_QUAD; @@ -144,7 +144,6 @@ mMenuBufferSize.pop_back(); mMenuVertexBuffer->resizeVertexBuffer(mMenuBufferSize.back()); } - */ } int QuadContainer::getOffset() Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.h 2008-01-12 06:01:54 UTC (rev 539) @@ -13,7 +13,7 @@ #include <vector> //vertices per quad = 25 quads initially -#define MIN_VERTEX_BUFFER_SIZE (250*VERTICES_PER_QUAD) +#define MIN_VERTEX_BUFFER_SIZE (25*VERTICES_PER_QUAD) namespace QuickGUI { Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -26,7 +26,6 @@ mBottomBar->setVerticalAnchor(ANCHOR_VERTICAL_BOTTOM); mBottomBar->setShowWithParent(false); mBottomBar->addOnScrollEventHandler(&ScrollPane::onHorizontalScroll,this); - removeChild(mBottomBar); mRightBar = dynamic_cast<VerticalScrollBar*>(_createChild(mInstanceName+".RightScrollBar",TYPE_SCROLLBAR_VERTICAL)); mRightBar->setSize(20,mSize.height - 20); @@ -37,7 +36,6 @@ mRightBar->setVerticalAnchor(ANCHOR_VERTICAL_TOP_BOTTOM); mRightBar->setShowWithParent(false); mRightBar->addOnScrollEventHandler(&ScrollPane::onVerticalScroll,this); - removeChild(mRightBar); } ScrollPane::~ScrollPane() Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -282,7 +282,7 @@ _setCaptionVertical(mCaption); // Make sure the caption matches the visibly displayed text! - mCaption.erase(static_cast<Ogre::UTFString::size_type>(mCharacters.size())); + //mCaption.erase(static_cast<Ogre::UTFString::size_type>(mCharacters.size())); _calculateDimensions(); @@ -560,7 +560,8 @@ // Invert colors of selected characters, and make sure non selected characters are // appropriately colored. - for(unsigned int index = 0; index < mCaption.length(); ++index ) + unsigned int index; + for( index = 0; index < static_cast<unsigned int>(mCharacters.size()); ++index ) { if( (static_cast<int>(index) >= mSelectStart) && (static_cast<int>(index) <= mSelectEnd) ) mCharacters[index]->setColor(mSelectColor); @@ -570,12 +571,22 @@ // set dimensions of background selection quad. Rect dimensions; - Quad* q = mCharacters[mSelectStart]; + + Quad* q; + + // Get the dimensions of the starting position of the selection quad. + q = mCharacters[mSelectStart]; dimensions.x = q->getPosition().x; dimensions.y = q->getPosition().y; - q = mCharacters[mSelectEnd]; + + // Get the dimensions of the ending position of the selection quad. + if(mSelectEnd >= static_cast<int>(mCharacters.size())) + q = mCharacters[index - 1]; + else + q = mCharacters[mSelectEnd]; dimensions.width = (q->getPosition().x + q->getSize().width) - dimensions.x; dimensions.height = (q->getPosition().y + q->getSize().height) - dimensions.y; + mCharacterBackground->setDimensions(dimensions); mCharacterBackground->setVisible(true); } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -224,7 +224,6 @@ // nfz: set up multipass rendering mRenderSystem->setCurrentPassIterationCount(pass->getPassIterationCount()); - //mRenderSystem->_setTexture(0,true,"Examples/Rockwall"); mRenderSystem->_render(mRenderOperation); } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -772,6 +772,15 @@ return mPosition.y; } + bool Widget::hasMouseButtonHandlers() + { + return !(mUserEventHandlers[EVENT_MOUSE_BUTTON_DOWN].empty() && + mUserEventHandlers[EVENT_MOUSE_BUTTON_UP].empty() && + mUserEventHandlers[EVENT_MOUSE_CLICK].empty() && + mUserEventHandlers[EVENT_MOUSE_CLICK_DOUBLE].empty() && + mUserEventHandlers[EVENT_MOUSE_CLICK_TRIPLE].empty()); + } + void Widget::hide() { mGrabbed = false; @@ -1255,10 +1264,19 @@ { SkinSet* ss = SkinSetManager::getSingleton().getSkinSet(skinName); if(ss == NULL) - throw Ogre::Exception(Ogre::Exception::ERR_ITEM_NOT_FOUND,"Skin \"" + skinName + "\" does not exist! Did you forget to load it using the SkinSetManager?","Widget::setSkin"); + throw Ogre::Exception(Ogre::Exception::ERR_ITEM_NOT_FOUND,"Skin \"" + skinName + "\" does not exist! Did you forget to load it using the SkinSetManager?","Widget::setSkin"); + for(WidgetArray::iterator it = mComponents.begin(); it != mComponents.end(); ++it) + (*it)->setSkin(skinName,true); + + if(recursive) + { + for(WidgetArray::iterator it = mChildWidgets.begin(); it != mChildWidgets.end(); ++it) + (*it)->setSkin(skinName,recursive); + } + + // Update reference to skin mSkinName = skinName; - Ogre::String textureName = mSkinName + mSkinComponent + ss->getImageExtension(); if(!ss->containsImage(textureName)) @@ -1276,15 +1294,6 @@ mWidgetImage = new Ogre::Image(i); } - for(WidgetArray::iterator it = mComponents.begin(); it != mComponents.end(); ++it) - (*it)->setSkin(skinName,true); - - if(recursive) - { - for(WidgetArray::iterator it = mChildWidgets.begin(); it != mChildWidgets.end(); ++it) - (*it)->setSkin(skinName,recursive); - } - if(mHideSkin) hideSkin(); } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h 2008-01-12 06:01:54 UTC (rev 539) @@ -92,6 +92,7 @@ EVENT_MOUSE_BUTTON_UP , EVENT_MOUSE_CLICK , EVENT_MOUSE_CLICK_DOUBLE , + EVENT_MOUSE_CLICK_TRIPLE , EVENT_MOUSE_ENTER , EVENT_MOUSE_LEAVE , EVENT_MOUSE_MOVE , @@ -315,6 +316,7 @@ Ogre::Real getWidth(); Ogre::Real getXPosition(); Ogre::Real getYPosition(); + bool hasMouseButtonHandlers(); /** * Sets mVisible to false. Widgets should override this to implement how they handle * hiding. Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIWindow.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIWindow.cpp 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIWindow.cpp 2008-01-12 06:01:54 UTC (rev 539) @@ -46,10 +46,14 @@ mScrollPane = dynamic_cast<ScrollPane*>(_createChild(mInstanceName+".ScrollPane",TYPE_SCROLL_PANE)); mScrollPane->setSize(mSize); + mScrollPane->removeChild(mScrollPane->mRightBar); + // store reference to the scroll bar mRightScrollBar = mScrollPane->mRightBar; addChild(mRightScrollBar); mRightScrollBar->setPosition(mSize.width - 20,0); + mScrollPane->removeChild(mScrollPane->mBottomBar); + // store reference to the scroll bar mBottomScrollBar = mScrollPane->mBottomBar; addChild(mBottomScrollBar); mBottomScrollBar->setPosition(0,mSize.height - 20); Modified: trunk/python-ogre/code_generators/et/python_et_aliases.h =================================================================== --- trunk/python-ogre/code_generators/et/python_et_aliases.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/code_generators/et/python_et_aliases.h 2008-01-12 06:01:54 UTC (rev 539) @@ -1,5 +1,4 @@ - - +typedef std::string String; typedef std::map<std::string, std::string> MapStringString; typedef std::pair<float, float> StdPairFloatFloat; @@ -20,8 +19,8 @@ //typedef std::vector<Ogre::Image> ImageList; //3 -typedef ET::ColourList ColourList; -typedef ET::ImageList ImageList; +// typedef ET::ColourList ColourList; +// typedef ET::ImageList ImageList; // these are uglys to remove messages in the generate_code output - doesn't impact the generated code :) //typedef std::vector<Ogre::Image> ImageList; Modified: trunk/python-ogre/code_generators/navi/python_navi_aliases.h =================================================================== --- trunk/python-ogre/code_generators/navi/python_navi_aliases.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/code_generators/navi/python_navi_aliases.h 2008-01-12 06:01:54 UTC (rev 539) @@ -1,3 +1,4 @@ +typedef std::string String; typedef NaviLibrary::NaviUtilities::InlineVector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >\ InlineVectorString; typedef std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >\ Modified: trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h =================================================================== --- trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h 2008-01-12 06:01:54 UTC (rev 539) @@ -1,5 +1,6 @@ // #include "../ogre/python_ogre_aliases.h" +typedef std::string String; typedef std::list<Ogre::Plane> StdListPlane; typedef std::map< std::string, std::string > StdMapStringString; typedef std::vector< std::string > StdVectorString; Modified: trunk/python-ogre/code_generators/ois/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ois/generate_code.py 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/code_generators/ois/generate_code.py 2008-01-12 06:01:54 UTC (rev 539) @@ -80,6 +80,9 @@ main_ns = global_ns.namespace( MAIN_NAMESPACE ) else: main_ns = global_ns + mb.class_( "Mouse" ).member_function( "getMouseState" ).call_policies =\ + call_policies.return_value_policy( call_policies.reference_existing_object ) + ############################################################ ## Modified: trunk/python-ogre/code_generators/ois/python_ois_aliases.h =================================================================== --- trunk/python-ogre/code_generators/ois/python_ois_aliases.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/code_generators/ois/python_ois_aliases.h 2008-01-12 06:01:54 UTC (rev 539) @@ -1,4 +1,5 @@ // placeholder for any aliaiss that are needed +typedef std::string String; typedef OIS::ParamList ParamList; typedef std::vector<OIS::Axis> AxisVector; //typedef OIS::SupportedEffectList SupportedEffectList; Modified: trunk/python-ogre/code_generators/quickgui/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/quickgui/generate_code.py 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/code_generators/quickgui/generate_code.py 2008-01-12 06:01:54 UTC (rev 539) @@ -96,6 +96,7 @@ ,'::QuickGUI::VerticalScrollBar::getScrollButtonSize' ,'::QuickGUI::Effect::linearInterpolate' ,'::QuickGUI::SkinSet::buildTextureCoordinates' ## has a vector that isn't being exposed correctly + ,'::QuickGUI::Console::setReadOnly' ] for e in excludes: print "excluding function", e Modified: trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h =================================================================== --- trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h 2008-01-12 06:01:54 UTC (rev 539) @@ -1,4 +1,5 @@ // typedef name nicename; +typedef std::string String; typedef std::vector<QuickGUI::Widget*, std::allocator<QuickGUI::Widget*> > VectorWidget; typedef std::vector<unsigned short, std::allocator<unsigned short> > VectorShort; //typedef std::vector<Ogre::Image> VectorImage; Modified: trunk/python-ogre/demos/ogre/Demo_Water.py =================================================================== --- trunk/python-ogre/demos/ogre/Demo_Water.py 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/demos/ogre/Demo_Water.py 2008-01-12 06:01:54 UTC (rev 539) @@ -17,10 +17,8 @@ sys.path.insert(0,'..') import PythonOgreConfig -#include "ExampleApplication.h" import ogre.renderer.OGRE as Ogre import ogre.io.OIS as OIS -#import WaterMesh as WaterMesh import ogre.addons.watermesh as WaterMesh import math import SampleFramework as sf @@ -255,18 +253,17 @@ class WaterListener(sf.FrameListener): def processcircles(self,timeSinceLastFrame): - for i in self.circles : i.animate(timeSinceLastFrame) found = False -# while not found: - for count in range (len(self.circles)): - if self.circles[count].lvl >= 16: - c = self.circles[count] - del self.circles[count] - del c - found = True - break + while not found: + for count in range (len(self.circles)): + if self.circles[count].lvl >= 16: + c = self.circles[count] + del self.circles[count] + del c + found = True + break # # # do : # # # found = False @@ -611,9 +608,9 @@ # ## Create new frame listener def _createFrameListener(self): - self.frameListener = WaterListener(self.renderWindow, self.camera, - self.WaterMesh, self.waterEntity, self) - self.root.addFrameListener(self.frameListener) + self.frameListener = WaterListener(self.renderWindow, self.camera, + self.WaterMesh, self.waterEntity, self) + self.root.addFrameListener(self.frameListener) Modified: trunk/python-ogre/demos/ogre/plugins.cfg =================================================================== --- trunk/python-ogre/demos/ogre/plugins.cfg 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/demos/ogre/plugins.cfg 2008-01-12 06:01:54 UTC (rev 539) @@ -2,18 +2,19 @@ ## Use this for Windows # Define plugin folder -PluginFolder=/home/andy/development/root/usr/lib/OGRE -#Plugin=RenderSystem_GL.dll -#Plugin=RenderSystem_Direct3D9.dll -#Plugin=Plugin_ParticleFX.dll -#Plugin=Plugin_BSPSceneManager.dll -#Plugin=Plugin_OctreeSceneManager.dll -#Plugin=Plugin_CgProgramManager.dll +PluginFolder=../../plugins +#home/andy/development/root/usr/lib/OGRE +Plugin=RenderSystem_GL.dll +Plugin=RenderSystem_Direct3D9.dll +Plugin=Plugin_ParticleFX.dll +Plugin=Plugin_BSPSceneManager.dll +Plugin=Plugin_OctreeSceneManager.dll +Plugin=Plugin_CgProgramManager.dll ## ## NOTE use this for MacOS or Linux - Plugin=RenderSystem_GL - Plugin=Plugin_ParticleFX - Plugin=Plugin_BSPSceneManager - Plugin=Plugin_OctreeSceneManager - Plugin=Plugin_CgProgramManager +# Plugin=RenderSystem_GL +# Plugin=Plugin_ParticleFX +# Plugin=Plugin_BSPSceneManager +# Plugin=Plugin_OctreeSceneManager +# Plugin=Plugin_CgProgramManager Modified: trunk/python-ogre/scripts/updatesource.bat =================================================================== --- trunk/python-ogre/scripts/updatesource.bat 2008-01-11 00:08:48 UTC (rev 538) +++ trunk/python-ogre/scripts/updatesource.bat 2008-01-12 06:01:54 UTC (rev 539) @@ -4,7 +4,7 @@ set _CVS="c:\Program Files\cvsnt\cvs.exe" set _VCBUILD="c:\Program Files\Microsoft Visual Studio 8\vc\vcpackages\vcbuild.exe" set _ROOT=c:\development -set _TP=c:\development\pywork\ThirdParty +set _TP=c:\development\python-ogre\ThirdParty cd %_ROOT%\ogrenew %_CVS% up This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-11 00:09:04
|
Revision: 538 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=538&view=rev Author: andy_miller Date: 2008-01-10 16:08:48 -0800 (Thu, 10 Jan 2008) Log Message: ----------- Updates to the OgreAL library source Modified Paths: -------------- trunk/python-ogre/ThirdParty/ogreal/OgreALPrereqs.h trunk/python-ogre/ThirdParty/ogreal/OgreALSound.cpp trunk/python-ogre/ThirdParty/ogreal/OgreALSound.h trunk/python-ogre/ThirdParty/ogreal/OgreALSoundManager.cpp trunk/python-ogre/ThirdParty/ogreal/OgreALSoundManager.h Modified: trunk/python-ogre/ThirdParty/ogreal/OgreALPrereqs.h =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALPrereqs.h 2008-01-11 00:08:11 UTC (rev 537) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALPrereqs.h 2008-01-11 00:08:48 UTC (rev 538) @@ -42,16 +42,8 @@ #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 # include "al.h" # include "alc.h" - # include "xram.h" - # if OGRE_COMPILER == OGRE_COMPILER_MSVC -// # ifdef OGREAL_EXPORT -// # define OgreAL_Export __declspec(dllexport) -// # else -// # define OgreAL_Export __declspec(dllimport) -// # endif -// # else -// # define OgreAL_Export - # endif + # include "xram.h" + # define OgreAL_Export #elif OGRE_COMPILER == OGRE_COMPILER_GNUC # include "AL/al.h" # include "AL/alc.h" Modified: trunk/python-ogre/ThirdParty/ogreal/OgreALSound.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALSound.cpp 2008-01-11 00:08:11 UTC (rev 537) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALSound.cpp 2008-01-11 00:08:48 UTC (rev 538) @@ -59,6 +59,8 @@ mGain(1.0), mMaxGain(1.0), mMinGain(0.0), + mFadeMode(FADE_NONE), + mFadeTime(0.0), mMaxDistance(3400.0), mRolloffFactor(1.0), mReferenceDistance(150.0), @@ -96,6 +98,8 @@ mPitch(1.0), mGain(1.0), mMaxGain(1.0), mMinGain(0.0), + mFadeMode(FADE_NONE), + mFadeTime(0.0), mMaxDistance(3400.0), mRolloffFactor(1.0), mReferenceDistance(150.0), @@ -133,6 +137,8 @@ mLoop(loop?AL_TRUE:AL_FALSE), mPitch(1.0), mGain(1.0), mMaxGain(1.0), mMinGain(0.0), + mFadeMode(FADE_NONE), + mFadeTime(0.0), mMaxDistance(3400.0), mRolloffFactor(1.0), mReferenceDistance(150.0), @@ -325,6 +331,51 @@ return (state == AL_INITIAL); } + bool Sound::fadeIn(Ogre::Real fadeTime) + { + // Don't interrupt a current fade + if(!isPlaying() && mFadeMode == FADE_NONE) + { + // This won't work as expected when the sound is attached to a node, + // so disallow it. + if(mParentNode) + { + Ogre::LogManager::getSingleton().logMessage("Cannot fade a Sound that is attached to a node"); + return false; + } + + mFadeMode = FADE_IN; + mFadeTime = fadeTime; + mRunning = 0.0; + // Start at min gain.. + setGain(mMinGain); + // ..and play + return play(); + } + return false; + } + + bool Sound::fadeOut(Ogre::Real fadeTime) + { + // Don't interrupt a current fade + if(isPlaying() && mFadeMode == FADE_NONE) + { + // This won't work as expected when the sound is attached to a node, + // so disallow it. + if(mParentNode) + { + Ogre::LogManager::getSingleton().logMessage("Cannot fade a Sound that is attached to a node"); + return false; + } + + mFadeMode = FADE_OUT; + mFadeTime = fadeTime; + mRunning = 0.0; + return true; + } + return false; + } + void Sound::setPitch(Ogre::Real pitch) { if(pitch <= 0) return; @@ -577,6 +628,41 @@ mLocalTransformDirty = false; } + void Sound::_updateFading() + { + if(mFadeMode != FADE_NONE) + { + mRunning += SoundManager::getSingletonPtr()->_getLastDeltaTime(); + // Calculate volume between min and max Gain over fade time + Ogre::Real delta = mMaxGain - mMinGain; + Ogre::Real gain; + + if(mFadeMode == FADE_IN) + { + gain = mMinGain + (delta * mRunning / mFadeTime); + // Clamp & stop if needed + if (gain > mMaxGain) + { + gain = mMaxGain; + mFadeMode = FADE_NONE; + } + } + else if(mFadeMode == FADE_OUT) + { + gain = mMaxGain - (delta * mRunning / mFadeTime); + // Clamp & stop if needed + if(gain < mMinGain) + { + gain = mMinGain; + mFadeMode = FADE_NONE; + } + } + + // Set the adjusted gain + setGain(gain); + } + } + bool Sound::updateSound() { _update(); @@ -588,6 +674,9 @@ alSource3f(mSource, AL_DIRECTION, mDerivedDirection.x, mDerivedDirection.y, mDerivedDirection.z); CheckError(alGetError(), "Failed to set Direction"); + + // Fading + _updateFading(); } return true; Modified: trunk/python-ogre/ThirdParty/ogreal/OgreALSound.h =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALSound.h 2008-01-11 00:08:11 UTC (rev 537) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALSound.h 2008-01-11 00:08:48 UTC (rev 538) @@ -87,6 +87,10 @@ virtual bool isStopped() const; /** Returns true if the source does not have a state yet, otherwise false */ virtual bool isInitial() const; + /** Starts playing the song while fading in.*/ + bool fadeIn(Ogre::Real fadeTime); + /** Fades out, but keeps playing at volume 0, so it can be faded in again.*/ + bool fadeOut(Ogre::Real fadeTime); /** * Sets the pitch multiplier. @@ -376,6 +380,18 @@ private: void _update() const; + void _updateFading(); + + enum FadeMode + { + FADE_NONE, + FADE_IN, + FADE_OUT + }; + + FadeMode mFadeMode; + Ogre::Real mFadeTime; + Ogre::Real mRunning; }; /** Factory object for creating sounds */ Modified: trunk/python-ogre/ThirdParty/ogreal/OgreALSoundManager.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALSoundManager.cpp 2008-01-11 00:08:11 UTC (rev 537) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALSoundManager.cpp 2008-01-11 00:08:48 UTC (rev 538) @@ -64,7 +64,8 @@ mSpeedOfSound(343.3), mMaxNumSources(0), mMajorVersion(0), - mMinorVersion(0) + mMinorVersion(0), + mLastDeltaTime(0.0) { Ogre::LogManager::getSingleton().logMessage("*-*-* OgreAL Initialization"); @@ -385,6 +386,8 @@ bool SoundManager::frameStarted(const Ogre::FrameEvent& evt) { + // Do this before any fading gets updated + mLastDeltaTime = evt.timeSinceLastFrame; updateSounds(); return true; } Modified: trunk/python-ogre/ThirdParty/ogreal/OgreALSoundManager.h =================================================================== --- trunk/python-ogre/ThirdParty/ogreal/OgreALSoundManager.h 2008-01-11 00:08:11 UTC (rev 537) +++ trunk/python-ogre/ThirdParty/ogreal/OgreALSoundManager.h 2008-01-11 00:08:48 UTC (rev 538) @@ -181,8 +181,11 @@ void _removeBufferRef(const Ogre::String& bufferName); /** Adds a BufferRef to the BufferMap to be used later */ void _addBufferRef(const Ogre::String& bufferName, BufferRef buffer); - + /** Used by the fading: returns the time since last frame. */ + Ogre::Real _getLastDeltaTime() const {return mLastDeltaTime;} + /** Requests a dynamically allocated Source. */ SourceRef _requestSource(Sound *sound); + /** Releases a dynamically allocated Source. */ SourceRef _releaseSource(Sound *sound); static const Ogre::String FILE_TYPE; @@ -243,6 +246,8 @@ ALCcontext *mContext; ALCdevice *mDevice; + Ogre::Real mLastDeltaTime; + // Mutex so we can protect against corruption OGREAL_AUTO_MUTEX This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-11 00:08:13
|
Revision: 537 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=537&view=rev Author: andy_miller Date: 2008-01-10 16:08:11 -0800 (Thu, 10 Jan 2008) Log Message: ----------- Code gen issue with OgreAL -- needed std::string to be alaises Modified Paths: -------------- trunk/python-ogre/code_generators/ogreal/python_ogreal_aliases.h Modified: trunk/python-ogre/code_generators/ogreal/python_ogreal_aliases.h =================================================================== --- trunk/python-ogre/code_generators/ogreal/python_ogreal_aliases.h 2008-01-10 08:04:29 UTC (rev 536) +++ trunk/python-ogre/code_generators/ogreal/python_ogreal_aliases.h 2008-01-11 00:08:11 UTC (rev 537) @@ -1,8 +1,9 @@ // typedef xxxxx xxxx; +typedef std::string String; typedef std::map<std::string, std::string> MapStringString; - typedef OgreAL::SoundMap SoundMap; - typedef OgreAL::FormatMap FormatMap; - typedef OgreAL::FormatMapIterator FormatMapIterator; - typedef Ogre::Singleton<OgreAL::SoundManager> SingletonSoundManager; - typedef Ogre::Singleton<OgreAL::Listener> SingletonListener; +typedef OgreAL::SoundMap SoundMap; +typedef OgreAL::FormatMap FormatMap; +typedef OgreAL::FormatMapIterator FormatMapIterator; +typedef Ogre::Singleton<OgreAL::SoundManager> SingletonSoundManager; +typedef Ogre::Singleton<OgreAL::Listener> SingletonListener; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-10 08:04:24
|
Revision: 536 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=536&view=rev Author: andy_miller Date: 2008-01-10 00:04:29 -0800 (Thu, 10 Jan 2008) Log Message: ----------- Try/Except around task spawning and 'unsigned int' include Modified Paths: -------------- trunk/python-ogre/BuildModule.py trunk/python-ogre/code_generators/ogre/generate_code.py Modified: trunk/python-ogre/BuildModule.py =================================================================== --- trunk/python-ogre/BuildModule.py 2008-01-08 15:33:45 UTC (rev 535) +++ trunk/python-ogre/BuildModule.py 2008-01-10 08:04:29 UTC (rev 536) @@ -77,16 +77,20 @@ env["CFLAGS"]="-I"+os.path.join(PREFIX,"include")+ " -L"+os.path.join(PREFIX,"lib") env["CXXFLAGS"]=env["CFLAGS"] env["LDFLAGS"]="-Wl,-rpath='$$ORIGIN/../../lib' -Wl,-rpath='$$ORIGIN' -Wl,-z,origin" - env["PYTHONPATH"]=PREFIX+"/lib/python"+environment.PythonVersionString+"/site-packages" - env["ZZIPLIB_LIBS"]="-lzzip" + env["PYTHONPATH"]=PREFIX+"/lib/python"+environment.PythonVersionString+"/site-packages" + env["ZZIPLIB_LIBS"]="-lzzip" env["PATH"]=PREFIX+"/bin:" + PATH logger.debug ( "Spawning '%s' in '%s'" % (task,cwdin) ) process = subprocess.Popen (task, shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd = cwdin, env=env) - out,err = process.communicate() - returncode = process.returncode + try: + out,err = process.communicate() + returncode = process.returncode + except: + returncode = -1 + if returncode != 0: logger.warning ( "Task Failed" ) logger.debug ( out ) @@ -154,29 +158,29 @@ if len(args) == 0 and not (options.compilecodeall or options.gencodeall): exit("The module to build wasn't specified. Use -h for help") - if options.retrieve==False and options.build==False and options.gencode==False and options.compilecode==False\ + if options.retrieve==False and options.build==False and options.gencode==False and options.compilecode==False\ and options.compilecodeall==False and options.gencodeall==False: exit ( "You need to specific at least one option. Use -h for help") setupLogging(options.logfilename) - logger = logging.getLogger('PythonOgre.BuildModule') + logger = logging.getLogger('PythonOgre.BuildModule') if not os.path.exists( environment.downloadPath ): - os.mkdir ( environment.downloadPath ) - + os.mkdir ( environment.downloadPath ) + if not os.path.exists( environment.Config.ROOT_DIR ): - os.mkdir ( environment.Config.ROOT_DIR ) + os.mkdir ( environment.Config.ROOT_DIR ) if not os.path.exists( os.path.join(environment.Config.ROOT_DIR, 'usr' ) ): - os.mkdir ( os.path.join(environment.Config.ROOT_DIR, 'usr' ) ) - if options.gencodeall or options.compilecodeall: + os.mkdir ( os.path.join(environment.Config.ROOT_DIR, 'usr' ) ) + if options.gencodeall or options.compilecodeall: for name,cls in environment.projects.items(): - if cls.active and cls.pythonModule: - if options.gencodeall: - generateCode( cls ) - if options.compilecodeall: + if cls.active and cls.pythonModule: + if options.gencodeall: + generateCode( cls ) + if options.compilecodeall: compileCode( cls ) - - else: + + else: for moduleName in args: if not classList.has_key( moduleName ): exit("Module specificed was not found (%s is not in environment.py) " % moduleName ) @@ -195,4 +199,4 @@ else: exit ( "Module specificed does not need compiling (%s is a supporting module)" % moduleName ) - + Modified: trunk/python-ogre/code_generators/ogre/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogre/generate_code.py 2008-01-08 15:33:45 UTC (rev 535) +++ trunk/python-ogre/code_generators/ogre/generate_code.py 2008-01-10 08:04:29 UTC (rev 536) @@ -245,8 +245,15 @@ std_ns = global_ns.namespace("std") - std_ns.class_("pair<unsigned int, unsigned int>").include() -# std_ns.class_("pair<unsigned, unsigned>").include() + try: + std_ns.class_("pair<unsigned int, unsigned int>").include() + except: + print "** Failed including unsigned int" + try: + std_ns.class_("pair<unsigned, unsigned>").include() + except: + print "** Failed including unsigned" + std_ns.class_("pair<bool, float>").include() std_ns.class_("pair<Ogre::SharedPtr<Ogre::Resource>, bool>").include() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-08 15:33:41
|
Revision: 535 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=535&view=rev Author: andy_miller Date: 2008-01-08 07:33:45 -0800 (Tue, 08 Jan 2008) Log Message: ----------- Changelog updated.. Modified Paths: -------------- trunk/python-ogre/ChangeLog.txt Modified: trunk/python-ogre/ChangeLog.txt =================================================================== --- trunk/python-ogre/ChangeLog.txt 2008-01-08 12:38:37 UTC (rev 534) +++ trunk/python-ogre/ChangeLog.txt 2008-01-08 15:33:45 UTC (rev 535) @@ -1,3 +1,16 @@ +Janurary 08 2008: Snapshot +========================== +New Modules: +* calunetree -- generates cool trees +* particleuniverse -- very cool particle system + +Updates: +* Quickgui, Caelum, ogreforests +* NxOgre -- using bleeding from the SVN + +Removals: +* dshow no longer complies due to changes in DirectX -- use Theora or ffmpeg for video display + December 02 2007: SVN Update ============================= * Full support for gccxml 0.9 (requires the latest gccxml and Py++) -- main change is in simplification of generated @@ -24,7 +37,7 @@ New helper functions for bone and sceneNode to return them as nodes ( .castAsNode() ). Changes due to using precompiled headers -- python_ogre_precompiled.h is now the primary header which includes boost and python_ogre_masterlist. The masterlist now uses Ogre.h and OgreStableHeaders.h to - include most of the headers, so the missing list is smaller and easier to manage + include most of the headers, so the missing list is smaller and easier to manage There is a newer patch file for the Ogre C++ library that changes certain functions from 'Pure virtual' to 'virtual' as this is required to allow function transformations to work (RenderQueueListener::RenderQueueStarted etc) * ogreal -- updated to SVN r90 * ogrebulletc and ogrebulletd -- updated to latest CVS and using bullet 2.64 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-08 12:38:32
|
Revision: 534 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=534&view=rev Author: andy_miller Date: 2008-01-08 04:38:37 -0800 (Tue, 08 Jan 2008) Log Message: ----------- Various updates for the 1.2 release Modified Paths: -------------- trunk/python-ogre/code_generators/common_utils/extract_documentation.py trunk/python-ogre/code_generators/et/generate_code.py trunk/python-ogre/code_generators/navi/generate_code.py trunk/python-ogre/code_generators/navi/hand_made_wrappers.py trunk/python-ogre/code_generators/navi/python_navi_sizeof.h trunk/python-ogre/code_generators/nxogre/customization_data.py trunk/python-ogre/code_generators/nxogre/generate_code.py trunk/python-ogre/code_generators/nxogre/python_nxogre.h trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h trunk/python-ogre/demos/ogre/Demo_Water.py Modified: trunk/python-ogre/code_generators/common_utils/extract_documentation.py =================================================================== --- trunk/python-ogre/code_generators/common_utils/extract_documentation.py 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/common_utils/extract_documentation.py 2008-01-08 12:38:37 UTC (rev 534) @@ -194,7 +194,10 @@ _str = clean(_str, "@ref", "@see") _str = clean(_str, "\\ref", "@see") _str = clean(_str, "@copydoc", "Ref: ") + _str = clean(_str, "\\verbatim", "" ) + _str = clean(_str, "\\endverbatim", "" ) + _str = clean(_str, "\\sa", "@see") # comment _string in OgreNewt _str = clean(_str, "\\codeblock", "::") _str = clean(_str, "\\code", "::") @@ -246,4 +249,4 @@ print doc_extractor("")(x_decl("myfunc(int x, int y)","c:/development/ocvs/ogrenew/ogremain/include/OgreSceneManager.h",218)) print doc_extractor("")(x_decl("","c:/development/ocvs/ogrenew/ogremain/include/OgreSceneManager.h",223)) - print doc_extractor("")(x_decl("","c:/development/CEGUI-0.5.0/include/CEGUIEvent.h",139)) + print doc_extractor("")(x_decl("","c:/development/CEGUI-0.5.0/include/CEGUIEvent.h",139)) Modified: trunk/python-ogre/code_generators/et/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/et/generate_code.py 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/et/generate_code.py 2008-01-08 12:38:37 UTC (rev 534) @@ -223,7 +223,7 @@ ) # if this module depends on another set it here - ## mb.register_module_dependency ( environment.ogre.generated_dir ) + mb.register_module_dependency ( environment.ogre.generated_dir ) # normally implicit conversions work OK, however they can cause strange things to happen so safer to leave off mb.constructors().allow_implicit_conversion = False Modified: trunk/python-ogre/code_generators/navi/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/navi/generate_code.py 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/navi/generate_code.py 2008-01-08 12:38:37 UTC (rev 534) @@ -96,8 +96,14 @@ c.exclude() ### Variables - excludes = [] +# cls = main_ns.class_('::NaviLibrary::detail::ClosurePtr< void (NaviLibrary::detail::GenericClass::*)(NaviLibrary::NaviData const&), void (*)(NaviLibrary::NaviData const&), void (*)(NaviLibrary::NaviData const&) >') +# cls.variable("ClosureMemPtr").exclude() +# cls.variable("StaticFunction").exclude() +# + + excludes = []# 'FastDelegate1::m_Closure'] for e in excludes: + print "Excluding Var", e main_ns.variable(e).exclude() ### Typedefs @@ -117,7 +123,7 @@ # if 'NxVec3' in a.type.decl_string or 'NxQuat' in a.type.decl_string: # c.exclude() # break - + main_ns.namespace('detail').exclude() ############################################################ ## @@ -201,30 +207,50 @@ main_ns = global_ns.namespace( MAIN_NAMESPACE ) -def AutoFixes ( mb ): +def AutoFixes ( mb, MAIN_NAMESPACE ): """ now we fix a range of things automatically - typically by going through the entire name space trying to guess stuff and fix it:) - """ + """ global_ns = mb.global_ns - main_ns = global_ns.namespace( MAIN_NAMESPACE ) + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns - # arguments passed as refs but not const are not liked by boost - #Fix_Ref_Not_Const ( main_ns ) + # Allow conversion between Vectors/Colourvalue etc and Python lists + Add_Auto_Conversions( mb ) + # Functions that have void pointers in their argument list need to change to unsigned int's - Fix_Void_Ptr_Args ( main_ns ) - + pointee_types=['unsigned int','int', 'float', '::Ogre::Real', '::Ogre::uchar', '::Ogre::uint8', '::Ogre::uint16' + 'unsigned char', 'char', 'bool'] + ignore_names=['Matrices', 'Vertices', 'ExceptionFactory', 'UTFString' ] + ## Now done with auto transform.... +# # # common_utils.Fix_Void_Ptr_Args ( main_ns, pointee_types, ignore_names ) + # and change functions that return a variety of pointers to instead return unsigned int's - Fix_Pointer_Returns ( main_ns ) + pointee_types=['unsigned int','int', 'float', '::Ogre::Real', '::Ogre::uchar', '::Ogre::uint8', 'unsigned char', 'char'] + ignore_names=['ptr', 'useCountPointer'] # these are function names we know it's cool to exclude + common_utils.Fix_Pointer_Returns ( main_ns, pointee_types, ignore_names ) # functions that need to have implicit conversions turned off - Fix_Implicit_Conversions ( main_ns) + ImplicitClasses=[] + common_utils.Fix_Implicit_Conversions ( main_ns, ImplicitClasses ) + # variables that are readonly and mutable need to be changed from 'vars' to properties so there + # is a copy made of the C++ variable before passing into Python + ToFixClasses=[] + knownNonMutable=['unsigned int','int', 'float','::Ogre::Real', '::Ogre::uchar', + '::Ogre::uint8', 'unsigned char', 'char'] + common_utils.Fix_ReadOnly_Vars ( mb, ToFixClasses, knownNonMutable ) + if os.name =='nt': Fix_NT( mb ) elif os.name =='posix': Fix_Posix( mb ) + common_utils.Auto_Document( mb, MAIN_NAMESPACE ) + ############################################################################### ## @@ -456,18 +482,22 @@ main_ns = global_ns.namespace( MAIN_NAMESPACE ) main_ns.include() - - AutoExclude ( mb ) + + common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualExclude ( mb ) - AutoInclude ( mb ) + common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) ManualInclude ( mb ) - # here we fixup functions that expect to modifiy their 'passed' variables + + # here we fixup functions that expect to modifiy their 'passed' variables and are not autmatically fixed ManualTransformations ( mb ) - AutoFixes ( mb ) + AutoFixes ( mb, MAIN_NAMESPACE ) ManualFixes ( mb ) - - + + common_utils.Auto_Functional_Transformation ( main_ns, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] ) + + + # # We need to tell boost how to handle calling (and returning from) certain functions # Modified: trunk/python-ogre/code_generators/navi/hand_made_wrappers.py =================================================================== --- trunk/python-ogre/code_generators/navi/hand_made_wrappers.py 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/navi/hand_made_wrappers.py 2008-01-08 12:38:37 UTC (rev 534) @@ -67,6 +67,6 @@ def apply( mb ): rt = mb.class_( 'NaviManager' ) - rt.add_declaration_code( WRAPPER_DEFINITION_NaviManager ) - apply_reg (rt, WRAPPER_REGISTRATION_NaviManager ) +# # # rt.add_declaration_code( WRAPPER_DEFINITION_NaviManager ) +# # # apply_reg (rt, WRAPPER_REGISTRATION_NaviManager ) \ No newline at end of file Modified: trunk/python-ogre/code_generators/navi/python_navi_sizeof.h =================================================================== --- trunk/python-ogre/code_generators/navi/python_navi_sizeof.h 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/navi/python_navi_sizeof.h 2008-01-08 12:38:37 UTC (rev 534) @@ -1,3 +1,5 @@ +sizeof ( NaviUtilities::Strings ); +sizeof ( NaviUtilities::Args ); Modified: trunk/python-ogre/code_generators/nxogre/customization_data.py =================================================================== --- trunk/python-ogre/code_generators/nxogre/customization_data.py 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/nxogre/customization_data.py 2008-01-08 12:38:37 UTC (rev 534) @@ -2,10 +2,11 @@ def header_files( version ): return [ 'NxOgre.h' ,'NxOgreSkeleton.h' - , 'Ogre.h' - ,'OgrePlugin.h' - ,'NxPhysics.h' - ] + ,'NxOgreResourceMesh.h' + ,'Ogre.h' + ,'OgrePlugin.h' + ,'NxPhysics.h' + ] def huge_classes( version ): return [] Modified: trunk/python-ogre/code_generators/nxogre/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/nxogre/generate_code.py 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/nxogre/generate_code.py 2008-01-08 12:38:37 UTC (rev 534) @@ -86,6 +86,11 @@ # problem with a constructor on Cloth main_ns.class_('::NxOgre::Cloth').constructor(arg_types=[None,'::NxClothDesc','::NxMeshData',None,None]).exclude() + + # functions specified in the headers but not implemented + main_ns.class_('::NxOgre::Blueprints::ActorBlueprint').member_function('unserialise',arg_types=[None]).exclude() + + # # # # # # ### Member Functions excludes=[ @@ -97,48 +102,16 @@ ,'::NxOgre::Container<std::string, NxOgre::FluidDrain*>::_next' ,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::_begin' ,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::_next' - ,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::getFirst' ,'::NxOgre::List<NxOgre::RemoteDebuggerConnection::Camera>::destroyAndEraseAll' ,'::NxOgre::List<NxOgre::RemoteDebuggerConnection::Camera>::dumpToConsole' - - -# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::dumpToConsole' -# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::count' -# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::empty' -# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::insert' -# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::lock' -# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::isLocked' -# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::has' -# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::getFirst' - - ,'::NxOgre::UserAllocator::realloc' -# # # # not yet implemented in source - ,'::NxOgre::WheelSet::attachNewWheel' - ,'::NxOgre::WheelSet::createThreeWheelSet' - ,'::NxOgre::WheelSet::createSixWheelSet' - ,'::NxOgre::Wheel::addEntity' ,'::NxOgre::Cloth::duplicate' ,'::NxOgre::ClothRayCaster::getClosestCloth' ,'::NxOgre::Joint::getBreakableMaxForce' ,'::NxOgre::Joint::getBreakableMaxTorque' ,'::NxOgre::Joint::getGlobalAxis' ,'::NxOgre::Joint::setGlobalAxis' -# # # ,'::NxOgre::Joint::getType' -# ,'::NxOgre::Joint::hasMoreLimitPlanes' -# ,'::NxOgre::Joint::purgeLimitPlanes' -# ,'::NxOgre::Joint::resetLimitPlaneIterator' -# ,'::NxOgre::Joint::addLimitPlane' -# ,'::NxOgre::Joint::setBreakable' -# ,'::NxOgre::Joint::getGlobalAnchor' -# ,'::NxOgre::Joint::setGlobalAnchor' -# ,'::NxOgre::Joint::getState' -# ,'::NxOgre::Joint::getNextLimitPlane' -# ,'::NxOgre::Joint::setLimitPoint' -# ,'::NxOgre::Joint::getLimitPoint' -# ,'::NxOgre::Joint::getActorA' -# ,'::NxOgre::Joint::getActorB' ,'::NxOgre::JointParams::setSpring' ,'::NxOgre::JointParams::setMotor' ,'::NxOgre::JointParams::setLimits' @@ -158,11 +131,30 @@ ,'::NxOgre::SimpleIntersection::getResult' ,'::NxOgre::SoftBody::simulate' ,'::NxOgre::SoftBody::render' - ,'::NxOgre::PhysXDriver::stop' - ,'::NxOgre::PhysXDriver::start' - ,'::NxOgre::PhysXDriver::reset' - ,'::NxOgre::PhysXDriver::hasHardware' - + + ,'::NxOgre::FileResourceSystem::getStream' # takes ::NxOgre::ResourceIdentifier as argument which needs fixing + ,'::NxOgre::OgreResourceSystem::getStream' + ,'::NxOgre::ResourceSystem::getStream' + ,'::NxOgre::RenderableSource::getStringType' # so we don't need a wrapper as it doesn't compile + ,'::NxOgre::RenderableSource::getType' + ,'::NxOgre::UserAllocator::mallocDEBUG' + +# ,'::NxOgre::Blueprints::ActorFactory' # not implemented, only in header.. + ,'::NxOgre::ContactStream::getShape' + ,'::NxOgre::ContactStream::getPatchNormal' + ,'::NxOgre::ContactStream::getPoint' + ,'::NxOgre::ContactStream::getNxActor' + ,'::NxOgre::ContactStream::getActor' + ,'::NxOgre::MemoryStream::skip' + ,'::NxOgre::MemoryStream::seek' + ,'::NxOgre::WheelSet::setMotorTorque' + ,'::NxOgre::WheelSet::setBrakeTorque' + ,'::NxOgre::WheelSet::turn' + ,'::NxOgre::Material::setDirOfAnisotropy' + ,'::NxOgre::OgreNodeRenderable::addSceneNode' +# ,'::NxOgre::ResourceStreamPtr::ResourceStreamPtr' + ,'::NxOgre::MaterialAlias::generateConversionList' + ] for e in excludes: print "excluding ", e @@ -184,18 +176,20 @@ main_ns.free_functions(e).exclude() ## Classes - excludes = ['::NxOgre::BaseCharacterHitReport' - ,'::NxOgre::CharacterHitReport' - ,'::NxOgre::Blueprints::ActorBlueprint' - ,'::NxOgre::Blueprints::ActorFactory' - ,'::NxOgre::Blueprints::WorldBlueprint' - ,'::NxOgre::Serialiser::SerialiserBase' - ,'::NxOgre::UserAllocator' - ,'::NxOgre::State' - - # not yet implemented in source + excludes = [ + 'DistanceJoint' ## constructor issue TOFIX + ,'JointCallback' ## also no suitable/defaul constructor TOFIX + ,'Character' ## defined in header but not very much implementation +# ,'RenderableSource' + ,'ResourceManager' +# ,'ResourceStreamPtr' + ,'::NxOgre::Blueprints::ActorFactory' + ,'State' + ,'MeshResource' + ,'::NxOgre::Serialiser::SerialiserBase' ] for e in excludes: + print "Excluding", e main_ns.class_(e).exclude() # # # # # # @@ -222,13 +216,14 @@ f.exclude() ### Variables - excludes = ['::NxOgre::CharacterController::mHitReports' + excludes = ['::NxOgre::WheelSet::mEngine' # desctuctor in WheelSet is protected so can't wrap this.. ] for e in excludes: main_ns.variable(e).exclude() ### Typedefs - excludes = ['::NxOgre::CharacterHitReports'] + excludes = [ + ] for e in excludes: main_ns.typedefs(e).exclude() @@ -264,26 +259,26 @@ m.exclude() c.member_function('getGlobalPosition').include() ## this is the only function implemented - global_ns.namespace( 'Ogre' ).class_('AxisAlignedBox').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Radian').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('SceneNode').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('IndexData').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('SceneManager').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Matrix4').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Degree').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Quaternion').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Node').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Serializer').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('FrameListener').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Matrix3').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Material').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Camera').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('MeshPtr').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('FrameEvent').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Root').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('Entity').include(already_exposed=True) - global_ns.namespace( 'Ogre' ).class_('SubMesh').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('AxisAlignedBox').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Radian').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('SceneNode').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('IndexData').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('SceneManager').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Matrix4').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Degree').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Quaternion').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Node').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Serializer').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('FrameListener').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Matrix3').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Material').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Camera').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('MeshPtr').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('FrameEvent').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Root').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('Entity').include(already_exposed=True) +# # global_ns.namespace( 'Ogre' ).class_('SubMesh').include(already_exposed=True) @@ -298,6 +293,7 @@ # fix issue where the namespace isn't in the default values main_ns = global_ns.namespace( MAIN_NAMESPACE ) + for c in main_ns.constructors(): for a in c.arguments: if a.default_value and a.default_value.startswith("param"): @@ -327,9 +323,9 @@ def create_output( size ): return [ ft.output( i ) for i in range( size ) ] - c = main_ns.mem_fun('::NxOgre::Cloth::raycast') - c.add_transformation(ft.inout('vertexId')) - c.documentation = docit('','VertexId is in/out','bool, vertexId') +# c = main_ns.mem_fun('::NxOgre::Cloth::raycast') +# c.add_transformation(ft.inout('vertexId')) +# c.documentation = docit('','VertexId is in/out','bool, vertexId') # for x in ns.member_functions('::NxOgre::Params::Set'): # x.add_transformation(ft.inout("arg2")) @@ -402,19 +398,25 @@ #Fix_Ref_Not_Const ( main_ns ) # Functions that have void pointers in their argument list need to change to unsigned int's - Fix_Void_Ptr_Args ( main_ns ) +# # Fix_Void_Ptr_Args ( main_ns ) + + # and change functions that return a variety of pointers to instead return unsigned int's + pointee_types=['unsigned int','int', 'float', '::Ogre::Real', '::Ogre::uchar', '::Ogre::uint8', 'unsigned char', 'char'] + ignore_names=['ptr', 'useCountPointer'] # these are function names we know it's cool to exclude + common_utils.Fix_Pointer_Returns ( main_ns, pointee_types, ignore_names ) - # and change functions that return a variety of pointers to instead return unsigned int's - Fix_Pointer_Returns ( main_ns ) + # functions that need to have implicit conversions turned off + ImplicitClasses=[] + common_utils.Fix_Implicit_Conversions ( main_ns, ImplicitClasses ) - # functions that need to have implicit conversions turned off - Fix_Implicit_Conversions ( main_ns) if os.name =='nt': Fix_NT( mb ) elif os.name =='posix': Fix_Posix( mb ) + common_utils.Auto_Document( mb, MAIN_NAMESPACE ) + ############################################################################### ## @@ -459,7 +461,10 @@ print "OK" else: print "NOT OK" - + for op in mb.class_(className).operators(): + print "Checking **", op.decl_string + + def Add_Auto_Conversions( mb ): pass @@ -629,7 +634,7 @@ os.path.join( environment.nxogre.root_dir, "python_nxogre.h" ) , environment.nxogre.cache_file ) if os.name == 'nt': - defined_symbols = [ 'NXOGRE_EXPORTS','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32'] + defined_symbols = [ 'NxExport','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32']#NXOGRE_EXPORTS' else: defined_symbols = [ 'LINUX','NX_LINUX', 'NX_DISABLE_FLUIDS', 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY'] @@ -675,6 +680,7 @@ AutoInclude ( mb ) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables + common_utils.Auto_Functional_Transformation ( main_ns ) #, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] ) ManualTransformations ( mb ) AutoFixes ( mb ) @@ -685,6 +691,22 @@ # Set_Call_Policies ( mb.global_ns.namespace (MAIN_NAMESPACE) ) +# # for op in main_ns.operators(): +# # print "op1", op +# # # if op.allow_implicit_conversion: +# # # print "Implicit conversion on operator ", op +# # print dir(op) +# # for op in main_ns.constructors(): +# # print "con1", op +# # if op.allow_implicit_conversion: +# # print "Implicit conversion on constructor ", op +# # print dir(op) +# # for op in main_ns.free_operators(): +# # print "op2", op +# # # if op.allow_implicit_conversion: +# # # print "Implicit conversion on free operator ", op +# # print dir(op) + # # the manual stuff all done here !!! # Modified: trunk/python-ogre/code_generators/nxogre/python_nxogre.h =================================================================== --- trunk/python-ogre/code_generators/nxogre/python_nxogre.h 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/nxogre/python_nxogre.h 2008-01-08 12:38:37 UTC (rev 534) @@ -1,6 +1,7 @@ #include "NxOgre.h" #include "NxOgreSkeleton.h" //missing ?? +#include "NxOgreResourceMesh.h" // not included anywhere by default... #include "Ogre.h" #include "OgrePlugin.h" #include <NxPhysics.h> Modified: trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h =================================================================== --- trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h 2008-01-08 12:38:37 UTC (rev 534) @@ -13,7 +13,7 @@ typedef NxOgre::List<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > ListString; typedef NxOgre::List<NxOgre::Blueprints::ActorBlueprint*> ListBlueprints; typedef NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&> ContainerShapeBlueprint; -typedef NxOgre::Container<std::string, NxOgre::ActorBlueprint> ContainerActorBlueprint; +//typedef NxOgre::Container<std::string, NxOgre::ActorBlueprint> ContainerActorBlueprint; //typedef NxOgre::Container<NxOgre::Scene::Renderables, float> ContainerSceneRencerables; typedef std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,float,std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, float> > >\ MapStrings; @@ -35,20 +35,20 @@ MapContainerActor; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Cloth*>::Containee, std::less<std::string> >\ MapContainerCloth; -typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Helper*>::Containee, std::less<std::string> >\ - MapContainerHelper; +// typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Helper*>::Containee, std::less<std::string> >\ +// MapContainerHelper; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Joint*>::Containee, std::less<std::string> >\ MapContainerJoint; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Material*>::Containee, std::less<std::string> >\ MapContainerMaterial; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Character*>::Containee, std::less<std::string> >\ MapContainerCharacter; -//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Fluid*>::Containee, std::less<std::string> >\ -// MapContainerFluid; -//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidDrain*>::Containee, std::less<std::string> >\ -// MapContainerFluidDrain; -//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidEmitter*>::Containee, std::less<std::string> >\ -// MapContainerFluidEmitter; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Fluid*>::Containee, std::less<std::string> >\ + MapContainerFluid; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidDrain*>::Containee, std::less<std::string> >\ + MapContainerFluidDrain; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidEmitter*>::Containee, std::less<std::string> >\ + MapContainerFluidEmitter; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::SoftBody*>::Containee, std::less<std::string> >\ MapContainerSoftBody; @@ -92,21 +92,31 @@ typedef NxOgre::List<NxOgre::Wheel*> Wheels; typedef NxOgre::Container<NxOgre::NxString, NxOgre::Character*> Characters; typedef NxOgre::List<NxOgre::CharacterHitReport*> CharacterHitReports; -//typedef NxOgre::Container<NxOgre::NxString, NxOgre::Fluid*> Fluids; -//typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidDrain*> FluidDrains; -//typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidEmitter*> FluidEmitters; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::Fluid*> Fluids; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidDrain*> FluidDrains; +typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidEmitter*> FluidEmitters; typedef NxOgre::Container<NxOgre::NxString, NxOgre::SoftBody*> SoftBodies; typedef std::pair<NxOgre::NxString,NxOgre::NxString> Parameter; typedef std::vector<Parameter> Parameters; typedef Ogre::String NxString; typedef NxOgre::Container<NxOgre::NxString, NxOgre::Actor*> Actors; + +typedef NxOgre::Container<std::string, NxConvexMesh*> NxConvexMeshes; +typedef NxOgre::Container<std::string, NxTriangleMesh*> NxTriangleMeshes; +typedef NxOgre::Container<std::string, NxOgre::MaterialAlias*> MaterialAliases; + +typedef NxOgre::Container<unsigned int, NxTriangleMesh*> NxTriangleMesheInts; +typedef NxOgre::Container<unsigned int, NxOgre::ResourceSystem*> ResourceSystemInts; +typedef NxOgre::Container<unsigned int, NxOgre::MaterialAlias*> MaterialAliasInts; +typedef NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*> CharacterMovementModelInts; + // typedef NxOgre::Container<NxOgre::NxString, ::ActorGroup*> ActorGroups; // typedef NxOgre::Container<NxOgre::NxActorGroup, NxOgre::ActorGroup*> ActorGroupsByIndex; typedef NxOgre::Container<NxOgre::NxShapeIndex, NxOgre::Shape*> CollisionModel; //typedef NxOgre::Container<NxOgre::NxShapeIndex, const NxOgre::ShapeDescription&> CollisionDescriptionModel; typedef NxOgre::Container<NxOgre::NxString, NxOgre::Cloth*> Cloths; typedef NxOgre::Container<NxOgre::NxErrorIndex, NxOgre::ErrorReporter*> ErrorReporterList; -typedef NxOgre::Container<NxOgre::NxString, NxOgre::Helper*> Helpers; +// // typedef NxOgre::Container<NxOgre::NxString, NxOgre::Helper*> Helpers; typedef NxOgre::Container<NxOgre::NxString, NxOgre::Joint*> JointsClass; typedef NxOgre::Container<NxOgre::NxString, NxOgre::Material*> MaterialList; // typedef NxOgre::Container<NxOgre::NxMaterialIndex, NxOgre::Material*> MaterialListByIndex; @@ -115,8 +125,8 @@ // typedef std::vector<NxOgre::Feature> FeatureSet; typedef std::map<std::string, NxOgre::Container<std::string, std::string>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, std::string>::Containee> > >\ MapContainerString; -typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee> > >\ - MapContainerActorBlueprint; +//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee> > >\ +// MapContainerActorBlueprint; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ForceField*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::ForceField*>::Containee> > >\ MapContainerForceField; typedef std::map<unsigned, NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&>::Containee, std::less<unsigned>, std::allocator<std::pair<unsigned const, NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&>::Containee> > >\ @@ -128,4 +138,32 @@ typedef std::map<unsigned, NxOgre::Container<unsigned, NxOgre::Joint*>::Containee, std::less<unsigned>, std::allocator<std::pair<unsigned const, NxOgre::Container<unsigned, NxOgre::Joint*>::Containee> > >\ MapContainerJointContainee; typedef std::map<unsigned short, NxOgre::Container<unsigned short, NxOgre::DominanceGroup*>::Containee, std::less<unsigned short>, std::allocator<std::pair<unsigned short const, NxOgre::Container<unsigned short, NxOgre::DominanceGroup*>::Containee> > >\ - MapContainerDominanceGroupContainee; + MapContainerDominanceGroupContainee; + +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::ShapeBlueprint*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::ShapeBlueprint*>::Containee> > >\ + MapContainerShapeBluePrint; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::Machine*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::Machine*>::Containee> > >\ + MapContainerMachine; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::Wheel*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::Wheel*>::Containee> > >\ + MapContainerWheel; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::RenderableSource*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::RenderableSource*>::Containee> > >\ + MapContainerRenderableSource; + +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee> > >\ + MapContainerCharacterMovementModel; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee> > >\ + MapContainerMaterialAlias; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee> > >\ + MapContainerResourceSystem; +typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxTriangleMesh*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxTriangleMesh*>::Containee> > >\ + MapContainerNxTriangleMesh; + +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee> > >\ + MapStringContainerMaterialAlias; +typedef std::map<std::string, NxOgre::Container<std::string, NxTriangleMesh*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxTriangleMesh*>::Containee> > >\ + MapStringContainerNxTriangleMesh; +typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee> > >\ + MapStringContainerCharacterMovementModel; +typedef std::map<std::string, NxOgre::Container<std::string, NxConvexMesh*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxConvexMesh*>::Containee> > >\ + MapStringContainerNxConvexMesh; + \ No newline at end of file Modified: trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h =================================================================== --- trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h 2008-01-08 12:38:37 UTC (rev 534) @@ -1,21 +1,21 @@ -sizeof ( NxControllersHit ); +// sizeof ( NxControllersHit ); sizeof ( NxBoxShapeDesc ); sizeof ( NxPlaneShapeDesc ); sizeof ( NxControllerManager ); -sizeof ( NxControllerShapeHit ); +// sizeof ( NxControllerShapeHit ); sizeof ( NxPruningStructure ); sizeof ( NxVec3 ); sizeof ( NxSceneLimits ); sizeof ( NxWheelShapeDesc ); -sizeof ( NxController ); +// sizeof ( NxController ); sizeof ( NxUserRaycastReport ); -sizeof ( NxControllerAction ); +// sizeof ( NxControllerAction ); sizeof ( NxWheelShape ); sizeof ( NxHeightFieldShapeDesc ); sizeof ( NxClothMesh ); sizeof ( NxConvexShapeDesc ); sizeof ( NxMeshData ); -//sizeof ( NxFluid ); +sizeof ( NxFluid ); sizeof ( NxHeightFieldAxis ); sizeof ( NxTriangleMeshShapeDesc ); sizeof ( NxTriangleMesh ); @@ -27,7 +27,7 @@ sizeof ( NxHeightField ); sizeof ( NxUserContactReport ); //sizeof ( NxOgre::FluidDrain ); -//sizeof ( NxImplicitScreenMesh ); +sizeof ( NxImplicitScreenMesh ); sizeof ( NxMemoryType ); sizeof ( NxJointState ); sizeof ( NxBounds3 ); @@ -45,14 +45,15 @@ sizeof ( NxContactPair ); sizeof ( NxSceneLimits ); sizeof ( NxWheelShape ); -sizeof ( NxUserControllerHitReport ); +// sizeof ( NxUserControllerHitReport ); sizeof ( NxSceneDesc ); sizeof ( NxScene ); sizeof ( NxPhysicsSDK ); sizeof ( NxShape ); sizeof ( NxGroupsMask ); -sizeof ( NxControllersHit ); - +// sizeof ( NxControllersHit ); +sizeof ( JointCallback ); +sizeof ( JointCallback::JointBreakCallback ); sizeof(std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >); sizeof ( std::pair<std::string, std::string> ); Modified: trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h =================================================================== --- trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h 2008-01-08 12:38:37 UTC (rev 534) @@ -1,5 +1,8 @@ -#include "../ogre/python_ogre_aliases.h" +// #include "../ogre/python_ogre_aliases.h" +typedef std::list<Ogre::Plane> StdListPlane; +typedef std::map< std::string, std::string > StdMapStringString; +typedef std::vector< std::string > StdVectorString; typedef OgreOde::CircularBuffer<OgreOde::BodyState*> CircularBufferBodyStatePtr; typedef OgreOde::MaintainedList<OgreOde::Geometry> MaintainedListGeometry; Modified: trunk/python-ogre/demos/ogre/Demo_Water.py =================================================================== --- trunk/python-ogre/demos/ogre/Demo_Water.py 2008-01-08 03:38:13 UTC (rev 533) +++ trunk/python-ogre/demos/ogre/Demo_Water.py 2008-01-08 12:38:37 UTC (rev 534) @@ -20,7 +20,8 @@ #include "ExampleApplication.h" import ogre.renderer.OGRE as Ogre import ogre.io.OIS as OIS -import WaterMesh as WaterMesh +#import WaterMesh as WaterMesh +import ogre.addons.watermesh as WaterMesh import math import SampleFramework as sf import random @@ -39,7 +40,7 @@ RAIN_HEIGHT_RANDOM = 5 RAIN_HEIGHT_CONSTANT = 5 -circles_MATERIAL ="Examples/Water/self.circles" +circles_MATERIAL ="Examples/Water/Circles" ## ## Note that this function makes use of CTypes and def ptr casting to access Ogre Library functions @@ -89,172 +90,164 @@ -# /* =========================================================================*/ -# /* WaterCircle class */ -# /* =========================================================================*/ -CIRCLE_SIZE = 500.0 -CIRCLE_TIME = 0.5 -class WaterCircle: - def __init_(self): - self.name = "" -# SceneNode *node -# MeshPtr mesh -# SubMesh *subMesh -# Entity *entity -# Real tm -# static bool first -# ## some buffers shared by all self.circles -# static HardwareVertexBufferSharedPtr posnormVertexBuffer -# static HardwareIndexBufferSharedPtr indexBuffer ## indices for 2 faces -# static HardwareVertexBufferSharedPtr *texcoordsVertexBuffers - -# float *texBufData - self.headNode = None - self.waterOverlay = None - self.particleSystem = None - self.particleEmitter = None - self.sceneMgr = None +# # # # /* =========================================================================*/ +# # # # /* WaterCircle class */ +# # # # /* =========================================================================*/ +# # # CIRCLE_SIZE = 500.0 +# # # CIRCLE_TIME = 0.5 +# # # class WaterCircle: +# # # +# # # +# # # def _prepareMesh(self ): +# # # +# # # mesh = Ogre.MeshManager.getSingleton().createManual(self.name, +# # # Ogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME) +# # # subMesh = mesh.createSubMesh() +# # # subMesh.useSharedVertices=False +# # # numVertices = 4 +# # # first = True +# # # +# # # if (first) : ## first Circle, create some static common data: +# # # first = False +# # # +# # # ## static buffer for position and normals +# # # size = 2 * Ogre.VertexElement.getTypeSize(Ogre.VertexElementType.VET_FLOAT3) ## 6 * float +# # # posnormVertexBuffer = \ +# # # Ogre.HardwareBufferManager.getSingleton().createVertexBuffer( +# # # size, ## size of one vertex data 6 * float +# # # 4, ## number of vertices +# # # Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY, ## usage +# # # False) ## no shadow buffer +# # # posnormBufData = posnormVertexBuffer.lock(Ogre.HardwareBuffer.HBL_DISCARD) +# # # +# # # buf=[] +# # # for i in range(numVertices): +# # # buf.append(((i%2)-0.5)*CIRCLE_SIZE ) ## pos X +# # # buf.append(0) ## pos Y +# # # buf.append(((i/2)-0.5)*CIRCLE_SIZE ) ## pos Z +# # # buf.append(0) ## normal X +# # # buf.append(1) ## normal Y +# # # buf.append(0) ## normal Z +# # # Ogre.setFloat( posnormBufData , buf ) # write unsigned ints... +# # # posnormVertexBuffer.unlock() +# # # +# # # ## static buffers for 16 sets of texture coordinates +# # # texcoordsVertexBuffers = [] +# # # for lvl in range (16): +# # # texcoordsVertexBuffers.append( +# # # Ogre.HardwareBufferManager.getSingleton().createVertexBuffer( +# # # Ogre.VertexElement.getTypeSize(Ogre.VertexElementType.VET_FLOAT2), ## size of one vertex data +# # # numVertices, ## number of vertices +# # # Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY, ## usage +# # # False) ## no shadow buffer +# # # ) +# # # texcoordsBufData = texcoordsVertexBuffers[lvl].lock(Ogre.HardwareBuffer.HBL_DISCARD) +# # # x0 = (lvl % 4) * 0.25 +# # # y0 = (lvl / 4) * 0.25 +# # # y0 = 0.75-y0 ## upside down +# # # # # # # for i in range (4): +# # # # # # # texcoordsBufData[i*2 + 0]= \ +# # # # # # # x0 + 0.25 * (i%2) +# # # # # # # texcoordsBufData[i*2 + 1]= \ +# # # # # # # y0 + 0.25 * (i/2) +# # # +# # # texcoordsVertexBuffers[lvl].unlock() +# # # +# # # +# # # ## Index buffer for 2 faces +# # # faces = [] +# # # faces[:]= (2,1,0,2,3,1) +# # # indexBuffer = \ +# # # Ogre.HardwareBufferManager.getSingleton().createIndexBuffer( +# # # Ogre.HardwareIndexBuffer.IT_16BIT, +# # # 6, +# # # Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY) +# # # # # # # indexBuffer.writeData(0, +# # # # # # # indexBuffer.getSizeInBytes(), +# # # # # # # faces, +# # # # # # # True) ## true? +# # # +# # # +# # # ## Initialize vertex data +# # # subMesh.vertexData = Ogre.VertexData() +# # # subMesh.vertexData.vertexStart = 0 +# # # subMesh.vertexData.vertexCount = 4 +# # # ## first, set vertex buffer bindings +# # # vbind = subMesh.vertexData.vertexBufferBinding +# # # vbind.setBinding(0, posnormVertexBuffer) +# # # vbind.setBinding(1, texcoordsVertexBuffers[0]) +# # # ## now, set vertex buffer declaration +# # # vdecl = subMesh.vertexData.vertexDeclaration +# # # vdecl.addElement(0, 0, Ogre.VET_FLOAT3, Ogre.VES_POSITION) +# # # vdecl.addElement(0, 3*4, Ogre.VET_FLOAT3, Ogre.VES_NORMAL) +# # # vdecl.addElement(1, 0, Ogre.VET_FLOAT2, Ogre.VES_TEXTURE_COORDINATES) +# # # +# # # ## Initialize index data +# # # subMesh.indexData.indexBuffer = indexBuffer +# # # subMesh.indexData.indexStart = 0 +# # # subMesh.indexData.indexCount = 6 +# # # +# # # ## set mesh bounds +# # # circleBounds= Ogre.AxisAlignedBox (-CIRCLE_SIZE/2.0, 0, -CIRCLE_SIZE/2.0, +# # # CIRCLE_SIZE/2.0, 0, CIRCLE_SIZE/2.0) +# # # mesh._setBounds(circleBounds) +# # # mesh.load() +# # # mesh.touch() +# # # +# # # def setTextureLevel(): +# # # subMesh.vertexData.vertexBufferBinding.setBinding(1, texcoordsVertexBuffers[lvl]) +# # # +# # # def __init__( self, name, x, y): +# # # # static HardwareVertexBufferSharedPtr posnormVertexBuffer +# # # # static HardwareIndexBufferSharedPtr indexBuffer ## indices for 2 faces +# # # # static HardwareVertexBufferSharedPtr *texcoordsVertexBuffers +# # # +# # # self.headNode = None +# # # self.waterOverlay = None +# # # self.particleSystem = None +# # # self.particleEmitter = None +# # # self.sceneMgr = None +# # # self.name = name +# # # self._prepareMesh() +# # # +# # # node = self.sceneMgr.getRootSceneNode().createChild(name) +# # # node.translate(x*(PLANE_SIZE/COMPLEXITY), 10, y*(PLANE_SIZE/COMPLEXITY)) +# # # entity = self.sceneMgr.createEntity(name, name) +# # # entity.setMaterialName(self.circles_MATERIAL) +# # # node.attachObject(entity) +# # # tm = 0 +# # # lvl = 0 +# # # setTextureLevel() +# # # +# # # def __del__(self, ): +# # # Ogre.MeshManager.getSingleton().remove(mesh.getHandle()) +# # # self.sceneMgr.destroyEntity(entity.getName()) +# # # self.sceneMgr.getRootSceneNode().removeChildnode.getName() +# # # +# # # def animate(self, timeSinceLastFrame): +# # # lastlvl = lvl +# # # tm += timeSinceLastFrame +# # # lvl = (int) ( (Real)(tm)/CIRCLE_TIME * 16 ) +# # # if (lvl<16 and lvl!=lastlvl) : +# # # setTextureLevel() +# # # +# # # +# # # def clearStaticBuffers(self): +# # # posnormVertexBuffer = Ogre.HardwareVertexBufferSharedPtr() +# # # indexBuffer = Ogre.HardwareIndexBufferSharedPtr() +# # # for i in range (16): +# # # texcoordsVertexBuffers[i] = Ogre.HardwareVertexBufferSharedPtr() +# # # +# # # del texcoordsVertexBuffers +# # # +# # # +# # # # bool WaterCircle.first = True +# # # # HardwareVertexBufferSharedPtr WaterCircle.posnormVertexBuffer = +# # # # HardwareVertexBufferSharedPtr() +# # # # HardwareIndexBufferSharedPtr WaterCircle.indexBuffer = +# # # # HardwareIndexBufferSharedPtr() +# # # # HardwareVertexBufferSharedPtr* WaterCircle.texcoordsVertexBuffers = 0 - _prepareMesh() - - mesh = Ogre.MeshManager.getSingleton().createManual(name, - Ogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME) - subMesh = mesh.createSubMesh() - subMesh.useSharedVertices=False - numVertices = 4 - first = True - - if (first) : ## first Circle, create some static common data: - first = False - - ## static buffer for position and normals - size = 2 * Ogre.VertexElement.getTypeSize(Ogre.VertexElementType.VET_FLOAT3) ## 6 * float - posnormVertexBuffer = \ - Ogre.HardwareBufferManager.getSingleton().createVertexBuffer( - size, ## size of one vertex data 6 * float - 4, ## number of vertices - Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY, ## usage - False) ## no shadow buffer - posnormBufData = posnormVertexBuffer.lock(Ogre.HardwareBuffer.HBL_DISCARD) - - buff=[] - for i in range(numVertices): - buf.append(((i%2)-0.5)*CIRCLE_SIZE ) ## pos X - buf.append(0) ## pos Y - buf.append(((i/2)-0.5)*CIRCLE_SIZE ) ## pos Z - buf.append(0) ## normal X - buf.append(1) ## normal Y - buf.append(0) ## normal Z - Ogre.setFloat( posnormBufData , buff ) # write unsigned ints... - posnormVertexBuffer.unlock() - - ## static buffers for 16 sets of texture coordinates - texcoordsVertexBuffers = [] - for lvl in range (16): - texcoordsVertexBuffers.append( - Ogre.HardwareBufferManager.getSingleton().createVertexBuffer( - Ogre.VertexElement.getTypeSize(Ogre.VertexElementType.VET_FLOAT2), ## size of one vertex data - numVertices, ## number of vertices - Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY, ## usage - False) ## no shadow buffer - ) - texcoordsBufData = texcoordsVertexBuffers[lvl].lock(Ogre.HardwareBuffer.HBL_DISCARD) - x0 = (lvl % 4) * 0.25 - y0 = (lvl / 4) * 0.25 - y0 = 0.75-y0 ## upside down - for i in range (4): - texcoordsBufData[i*2 + 0]= \ - x0 + 0.25 * (i%2) - texcoordsBufData[i*2 + 1]= \ - y0 + 0.25 * (i/2) - - texcoordsVertexBuffers[lvl].unlock() - - - ## Index buffer for 2 faces - faces[6] = (2,1,0, 2,3,1) - indexBuffer = \ - Ogre.HardwareBufferManager.getSingleton().createIndexBuffer( - Ogre.HardwareIndexBuffer.IT_16BIT, - 6, - Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY) - indexBuffer.writeData(0, - indexBuffer.getSizeInBytes(), - faces, - True) ## true? - - - ## Initialize vertex data - subMesh.vertexData = Ogre.VertexData() - subMesh.vertexData.vertexStart = 0 - subMesh.vertexData.vertexCount = 4 - ## first, set vertex buffer bindings - vbind = subMesh.vertexData.vertexBufferBinding - vbind.setBinding(0, posnormVertexBuffer) - vbind.setBinding(1, texcoordsVertexBuffers[0]) - ## now, set vertex buffer declaration - vdecl = subMesh.vertexData.vertexDeclaration - vdecl.addElement(0, 0, Ogre.VET_FLOAT3, VOgre.ES_POSITION) - vdecl.addElement(0, 3*4, Ogre.VET_FLOAT3, Ogre.VES_NORMAL) - vdecl.addElement(1, 0, Ogre.VET_FLOAT2, Ogre.VES_TEXTURE_COORDINATES) - - ## Initialize index data - subMesh.indexData.indexBuffer = indexBuffer - subMesh.indexData.indexStart = 0 - subMesh.indexData.indexCount = 6 - - ## set mesh bounds - circleBounds(-CIRCLE_SIZE/2.0, 0, -CIRCLE_SIZE/2.0, - CIRCLE_SIZE/2.0, 0, CIRCLE_SIZE/2.0) - mesh._setBounds(circleBounds) - mesh.load() - mesh.touch() - - def setTextureLevel(): - subMesh.vertexData.vertexBufferBinding.setBinding(1, texcoordsVertexBuffers[lvl]) - - def WaterCircle( name, x, y): - - self.name = name - _prepareMesh() - node = self.sceneMgr.getRootSceneNode().createChild(name) - node.translate(x*(PLANE_SIZE/COMPLEXITY), 10, y*(PLANE_SIZE/COMPLEXITY)) - entity = self.sceneMgr.createEntity(name, name) - entity.setMaterialName(self.circles_MATERIAL) - node.attachObject(entity) - tm = 0 - lvl = 0 - setTextureLevel() - - def __del__(self, ): - Ogre.MeshManager.getSingleton().remove(mesh.getHandle()) - self.sceneMgr.destroyEntity(entity.getName()) - self.sceneMgr.getRootSceneNode().removeChildnode.getName() - - def animate(self, timeSinceLastFrame): - lastlvl = lvl - tm += timeSinceLastFrame - lvl = (int) ( (Real)(tm)/CIRCLE_TIME * 16 ) - if (lvl<16 and lvl!=lastlvl) : - setTextureLevel() - - - def clearStaticBuffers(self): - posnormVertexBuffer = Ogre.HardwareVertexBufferSharedPtr() - indexBuffer = Ogre.HardwareIndexBufferSharedPtr() - for i in range (16): - texcoordsVertexBuffers[i] = Ogre.HardwareVertexBufferSharedPtr() - - del texcoordsVertexBuffers - - -# bool WaterCircle.first = True -# HardwareVertexBufferSharedPtr WaterCircle.posnormVertexBuffer = -# HardwareVertexBufferSharedPtr() -# HardwareIndexBufferSharedPtr WaterCircle.indexBuffer = -# HardwareIndexBufferSharedPtr() -# HardwareVertexBufferSharedPtr* WaterCircle.texcoordsVertexBuffers = 0 - # /* =========================================================================*/ # /* WaterListener class */ # /* =========================================================================*/ @@ -264,8 +257,17 @@ def processcircles(self,timeSinceLastFrame): for i in self.circles : - self.circles[i].animate(timeSinceLastFrame) - + i.animate(timeSinceLastFrame) + found = False +# while not found: + for count in range (len(self.circles)): + if self.circles[count].lvl >= 16: + c = self.circles[count] + del self.circles[count] + del c + found = True + break + # # # do : # # # found = False # # # for it = self.circles : @@ -310,9 +312,9 @@ if (y>COMPLEXITY-1): y=COMPLEXITY-1 self.WaterMesh.push(x,y,-h) -# circle = self.WaterCircle( "Circle#"+str(self.pindex), x, y) -# self.pindex+=1 -# self.circles.push_back(circle) + circle = WaterMesh.WaterCircle( "Circle#"+str(self.pindex), x, y, self.app.sceneManager) + self.pindex+=1 + self.circles.append(circle) @@ -489,31 +491,32 @@ _macro - ADJUST_RANGE(self.headDepth, OIS.KC_U, OIS.KC_J, 0, 10, 0.5*changeSpeed, self.updateInfoHeadDepth()) - - ADJUST_RANGE(self.WaterMesh.PARAM_C, OIS.KC_2, OIS.KC_1, 0, 10, 0.1*changeSpeed, self.updateInfoParamC()) - - ADJUST_RANGE(self.WaterMesh.PARAM_D, OIS.KC_4, OIS.KC_3, 0.1, 10, 0.1*changeSpeed, self.updateInfoParamD()) - - ADJUST_RANGE(self.WaterMesh.PARAM_U, OIS.KC_6, OIS.KC_5, -2, 10, 0.1*changeSpeed, self.updateInfoParamU()) - - ADJUST_RANGE(self.WaterMesh.PARAM_T, OIS.KC_8, OIS.KC_7, 0, 10, 0.1*changeSpeed, self.updateInfoParamT()) - +# ADJUST_RANGE(self.headDepth, OIS.KC_U, OIS.KC_J, 0, 10, 0.5*changeSpeed, self.updateInfoHeadDepth()) +# +# ADJUST_RANGE(self.WaterMesh.PARAM_C, OIS.KC_2, OIS.KC_1, 0, 10, 0.1*changeSpeed, self.updateInfoParamC()) +# +# ADJUST_RANGE(self.WaterMesh.PARAM_D, OIS.KC_4, OIS.KC_3, 0.1, 10, 0.1*changeSpeed, self.updateInfoParamD()) +# +# ADJUST_RANGE(self.WaterMesh.PARAM_U, OIS.KC_6, OIS.KC_5, -2, 10, 0.1*changeSpeed, self.updateInfoParamU()) +# +# ADJUST_RANGE(self.WaterMesh.PARAM_T, OIS.KC_8, OIS.KC_7, 0, 10, 0.1*changeSpeed, self.updateInfoParamT()) +# self.timeoutDelay-=evt.timeSinceLastFrame if (self.timeoutDelay<=0): self.timeoutDelay = 0 def SWITCH_VALUE(_key,_timeDelay, _macro): - if (self.Keyboard.isKeyDown(_key) and self.timeoutDelay==0) : + res = self.Keyboard.isKeyDown(_key) + if self.Keyboard.isKeyDown(_key) and self.timeoutDelay==0 : self.timeoutDelay = _timeDelay - _macro + _macro () - SWITCH_VALUE(OIS.KC_N, 0.5, self.switchNormals()) + SWITCH_VALUE(OIS.KC_N, 0.5, self.switchNormals) - SWITCH_VALUE(OIS.KC_M, 0.5, self.switchMaterial()) + SWITCH_VALUE(OIS.KC_M, 0.5, self.switchMaterial) - SWITCH_VALUE(OIS.KC_B, 0.5, self.switchSkyBox()) - + SWITCH_VALUE(OIS.KC_B, 0.5, self.switchSkyBox) + self.animateHead(evt.timeSinceLastFrame) self.WaterMesh.updateMesh(evt.timeSinceLastFrame) @@ -527,7 +530,6 @@ ## Just override the mandatory create scene method def _createScene(self): global PLANE_SIZE, MESH_NAME, COMPLEXITY, ENTITY_NAME - print "\n\n\n***********" sceneManager = self.sceneManager camera = self.camera ## Set ambient light @@ -544,7 +546,7 @@ ## self.waterEntity.setMaterialName(MATERIAL_NAME) waterNode = sceneManager.getRootSceneNode().createChildSceneNode() -# waterNode.attachObject(self.waterEntity) + waterNode.attachObject(self.waterEntity) ## Add a head, give it it's own node self.headNode = waterNode.createChildSceneNode() @@ -602,12 +604,11 @@ ## Fast-forward the rain so it looks more natural self.particleSystem.fastForward(20) ## It can't be set in .particle file, and we need it ) -# static_cast<BillboardParticleRenderer*>(self.particleSystem.getRenderer()).setBillboardOrigin(BBO_BOTTOM_CENTER) + self.particleSystem.getRenderer().setBillboardOrigin(Ogre.BBO_BOTTOM_CENTER) - prepareCircleMaterial() - print "\n\n\n***********" + WaterMesh.prepareCircleMaterial() + - # ## Create new frame listener def _createFrameListener(self): self.frameListener = WaterListener(self.renderWindow, self.camera, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-08 03:38:07
|
Revision: 533 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=533&view=rev Author: andy_miller Date: 2008-01-07 19:38:13 -0800 (Mon, 07 Jan 2008) Log Message: ----------- Added --without-icu to the boost configure to fix build issues on some systems Modified Paths: -------------- trunk/python-ogre/demos/ogre/plugins.cfg trunk/python-ogre/environment.py Modified: trunk/python-ogre/demos/ogre/plugins.cfg =================================================================== --- trunk/python-ogre/demos/ogre/plugins.cfg 2008-01-08 02:45:30 UTC (rev 532) +++ trunk/python-ogre/demos/ogre/plugins.cfg 2008-01-08 03:38:13 UTC (rev 533) @@ -2,7 +2,7 @@ ## Use this for Windows # Define plugin folder -#PluginFolder=/Users/andy/development/python-ogre/demos/ogre/ +PluginFolder=/home/andy/development/root/usr/lib/OGRE #Plugin=RenderSystem_GL.dll #Plugin=RenderSystem_Direct3D9.dll #Plugin=Plugin_ParticleFX.dll @@ -13,7 +13,7 @@ ## ## NOTE use this for MacOS or Linux Plugin=RenderSystem_GL -# Plugin=Plugin_ParticleFX -# Plugin=Plugin_BSPSceneManager -# Plugin=Plugin_OctreeSceneManager -## Plugin=Plugin_CgProgramManager + Plugin=Plugin_ParticleFX + Plugin=Plugin_BSPSceneManager + Plugin=Plugin_OctreeSceneManager + Plugin=Plugin_CgProgramManager Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-01-08 02:45:30 UTC (rev 532) +++ trunk/python-ogre/environment.py 2008-01-08 03:38:13 UTC (rev 533) @@ -399,7 +399,7 @@ [0,cp + ' -R '+os.path.join('python-ogre','boost','*') +' ' + base , ''], # need to overwrite the boost with our files [0, sed_ + " 's/BJAM_CONFIG=\"\"/BJAM_CONFIG=release/' boost_1_34_1/configure", '' ], [0, sed_ + " s/'BOOST_PYTHON_MAX_ARITY 15'/'BOOST_PYTHON_MAX_ARITY 19'/ boost_1_34_1/boost/python/detail/preprocessor.hpp", ''], - [0,"./configure --with-libraries=python --prefix=%s" % PREFIX, os.path.join(os.getcwd(), base )], + [0,"./configure --with-libraries=python --prefix=%s --without-icu" % PREFIX, os.path.join(os.getcwd(), base )], [0,'make', os.path.join(os.getcwd(), base )], [0,'make install', os.path.join(os.getcwd(), base )], ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-01-08 02:45:25
|
Revision: 532 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=532&view=rev Author: andy_miller Date: 2008-01-07 18:45:30 -0800 (Mon, 07 Jan 2008) Log Message: ----------- And the library source for cadunetree Added Paths: ----------- trunk/python-ogre/ThirdParty/cadunetree/ trunk/python-ogre/ThirdParty/cadunetree/CTParameters.cpp trunk/python-ogre/ThirdParty/cadunetree/CTParameters.h trunk/python-ogre/ThirdParty/cadunetree/CTPrerequisites.h trunk/python-ogre/ThirdParty/cadunetree/CTSection.cpp trunk/python-ogre/ThirdParty/cadunetree/CTSection.h trunk/python-ogre/ThirdParty/cadunetree/CTSerializer.cpp trunk/python-ogre/ThirdParty/cadunetree/CTSerializer.h trunk/python-ogre/ThirdParty/cadunetree/CTStem.cpp trunk/python-ogre/ThirdParty/cadunetree/CTStem.h trunk/python-ogre/ThirdParty/cadunetree/CaduneTree.h Added: trunk/python-ogre/ThirdParty/cadunetree/CTParameters.cpp =================================================================== --- trunk/python-ogre/ThirdParty/cadunetree/CTParameters.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/cadunetree/CTParameters.cpp 2008-01-08 02:45:30 UTC (rev 532) @@ -0,0 +1,398 @@ +/* +This file is a part of the CaduneTree project, +library used to generate and render trees with OGRE. + +License: +Copyright (c) 2007 Wojciech Cierpucha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include "CTParameters.h" + +namespace CaduneTree { + + const unsigned int Parameters::mMaxLevels = 4; // 4 is a reasonable number, official in v0.6 + + Parameters::Parameters() : mTaper( 1.0f ) { + // First allocate memory for arrays, + 1 because there is an additional root level + mNumVertices = new unsigned char[ mMaxLevels + 1 ]; + mNumBranches = new unsigned char[ mMaxLevels + 1]; + mDownAngle = new float[ mMaxLevels + 1]; + mDownAngleV = new float[ mMaxLevels + 1]; + mRotate = new float[ mMaxLevels + 1]; + mRotateV = new float[ mMaxLevels + 1]; + mLength = new float[ mMaxLevels + 1]; + mLengthV = new float[ mMaxLevels + 1]; + mCurve = new float[ mMaxLevels + 1]; + mCurveBack = new float[ mMaxLevels + 1]; + mCurveV = new float[ mMaxLevels + 1]; + mCurveRes = new unsigned char[ mMaxLevels + 1]; + + // Always set params to default + setDefault(); + } + + Parameters::Parameters( const Parameters& params ) : mTaper( 1.0f ) { + // First allocate memory for arrays + mNumVertices = new unsigned char[ mMaxLevels + 1]; + mNumBranches = new unsigned char[ mMaxLevels + 1]; + mDownAngle = new float[ mMaxLevels + 1]; + mDownAngleV = new float[ mMaxLevels + 1]; + mRotate = new float[ mMaxLevels + 1]; + mRotateV = new float[ mMaxLevels + 1]; + mLength = new float[ mMaxLevels + 1]; + mLengthV = new float[ mMaxLevels + 1]; + mCurve = new float[ mMaxLevels + 1]; + mCurveBack = new float[ mMaxLevels + 1]; + mCurveV = new float[ mMaxLevels + 1]; + mCurveRes = new unsigned char[ mMaxLevels + 1]; + + // General + mShape = params.mShape; + mBaseSize = params.mBaseSize; + mScale = params.mScale; + mScaleV = params.mScaleV; + mNumLevels = params.mNumLevels; + mRatio = params.mRatio; + mRatioPower = params.mRatioPower; + mNumLobes = params.mNumLobes; + mLobeDepth = params.mLobeDepth; + mFlare = params.mFlare; + mScale0 = params.mScale0; + mScale0V = params.mScale0V; + mBarkMaterial = params.mBarkMaterial; + // Leaves + mNumLeaves = params.mNumLeaves; + mLeafScale = params.mLeafScale; + mLeafScaleX = params.mLeafScaleX; + mLeafQuality = params.mLeafQuality; + mLeafLayoutExp = params.mLeafLayoutExp; + mLeafMaterial = params.mLeafMaterial; + // Fronds + mNumFronds = params.mNumFronds; + mFrondScale = params.mFrondScale; + mFrondScaleX = params.mFrondScaleX; + mFrondQuality = params.mFrondQuality; + mFrondMaterial = params.mFrondMaterial; + // + mAttractionUp = params.mAttractionUp; + // Leveled info + for( unsigned int i = 0; i < mMaxLevels + 1; ++i ) { + mNumVertices[ i ] = params.mNumVertices[ i ]; + mNumBranches[ i ] = params.mNumBranches[ i ]; + mDownAngle[ i ] = params.mDownAngle[ i ]; + mDownAngleV[ i ] = params.mDownAngleV[ i ]; + mRotate[ i ] = params.mRotate[ i ]; + mRotateV[ i ] = params.mRotateV[ i ]; + mLength[ i ] = params.mLength[ i ]; + mLengthV[ i ] = params.mLengthV[ i ]; + mCurve[ i ] = params.mCurve[ i ]; + mCurveBack[ i ] = params.mCurveBack[ i ]; + mCurveV[ i ] = params.mCurveV[ i ]; + mCurveRes[ i ] = params.mCurveRes[ i ]; + } + } + + Parameters::~Parameters() { + delete [] mNumVertices; + delete [] mNumBranches; + delete [] mDownAngle; + delete [] mDownAngleV; + delete [] mRotate; + delete [] mRotateV; + delete [] mLength; + delete [] mLengthV; + delete [] mCurve; + delete [] mCurveBack; + delete [] mCurveV; + delete [] mCurveRes; + } + + void Parameters::setDefault() { + // General + mShape = TEND_FLAME; + mBaseSize = 0.3f; + mScale = 13.0f; + mScaleV = 3.0f; + mNumLevels = 2; + mRatio = 0.03f; + mRatioPower = 1.0f; + mNumLobes = 5; + mLobeDepth = 0.2f; + mFlare = 1.4f; + mScale0 = 1.0f; + mScale0V = 0.0f; + mBarkMaterial = "BarkNoLighting"; + // Leaves + mNumLeaves = 4; + mLeafScale = 1.4f; + mLeafScaleX = 1.0f; + mLeafQuality = 1.0f; + mLeafLayoutExp = 4.0f; + mLeafMaterial = "Leaves"; + // Fronds + mNumFronds = 4; + mFrondScale = 1.0f; + mFrondScaleX = 1.0f; + mFrondQuality = 1.0f; + mFrondMaterial = "Frond"; + // + mAttractionUp = 0.5f; + // Trunk - level 0, null not used params + mNumVertices[ 0 ] = 8; + mNumBranches[ 0 ] = 0; + mDownAngle[ 0 ] = 0.0f; + mDownAngleV[ 0 ] = 0.0f; + mRotate[ 0 ] = 0.0f; + mRotateV[ 0 ] = 0.0f; + mLength[ 0 ] = 1.0f; + mLengthV[ 0 ] = 0.0f; + mCurve[ 0 ] = 20.0f; + mCurveBack[ 0 ] = -15.0f; + mCurveV[ 0 ] = 20.0f; + mCurveRes[ 0 ] = 8; + // Level 1 + mNumVertices[ 1 ] = 4; + mNumBranches[ 1 ] = 20; + mDownAngle[ 1 ] = 80.0f; + mDownAngleV[ 1 ] = 5.0f; + mRotate[ 1 ] = 140.0f; + mRotateV[ 1 ] = 0.0f; + mLength[ 1 ] = 0.4f; + mLengthV[ 1 ] = 0.0f; + mCurve[ 1 ] = -30.0f; + mCurveBack[ 1 ] = 0.0f; + mCurveV[ 1 ] = 10.0f; + mCurveRes[ 1 ] = 4; + // Roots + mNumVertices[ mMaxLevels ] = 6; + mNumBranches[ mMaxLevels ] = 6; + mDownAngle[ mMaxLevels ] = 95.0f; + mDownAngleV[ mMaxLevels ] = 5.0f; + mRotate[ mMaxLevels ] = 140.0f; + mRotateV[ mMaxLevels ] = 0.0f; + mLength[ mMaxLevels ] = 0.4f; + mLengthV[ mMaxLevels ] = 0.0f; + mCurve[ mMaxLevels ] = 20.0f; + mCurveBack[ mMaxLevels ] = -5.0f; + mCurveV[ mMaxLevels ] = 5.0f; + mCurveRes[ mMaxLevels ] = 4; + + // Null remainning data + for( unsigned int i = 2; i < mMaxLevels; ++i ) { + mNumVertices[ i ] = 0; + mNumBranches[ i ] = 0; + mDownAngle[ i ] = 0.0f; + mDownAngleV[ i ] = 0.0f; + mRotate[ i ] = 0.0f; + mRotateV[ i ] = 0.0f; + mLength[ i ] = 0.0f; + mLengthV[ i ] = 0.0f; + mCurve[ i ] = 0.0f; + mCurveBack[ i ] = 0.0f; + mCurveV[ i ] = 0.0f; + mCurveRes[ i ] = 0; + } + + } + + Parameters* Parameters::createCopy() const { + Parameters *params = new Parameters; + + // General + params->mShape = mShape; + params->mBaseSize = mBaseSize; + params->mScale = mScale; + params->mScaleV = mScaleV; + params->mNumLevels = mNumLevels; + params->mRatio = mRatio; + params->mRatioPower = mRatioPower; + params->mNumLobes = mNumLobes; + params->mLobeDepth = mLobeDepth; + params->mFlare = mFlare; + params->mScale0 = mScale0; + params->mScale0V = mScale0V; + params->mBarkMaterial = mBarkMaterial; + // Leaves + params->mNumLeaves = mNumLeaves; + params->mLeafScale = mLeafScale; + params->mLeafScaleX = mLeafScaleX; + params->mLeafQuality = mLeafQuality; + params->mLeafLayoutExp = mLeafLayoutExp; + params->mLeafMaterial = mLeafMaterial; + // Fronds + params->mNumFronds = mNumFronds; + params->mFrondScale = mFrondScale; + params->mFrondScaleX = mFrondScaleX; + params->mFrondQuality = mFrondQuality; + params->mFrondMaterial = mFrondMaterial; + // + params->mAttractionUp = mAttractionUp; + // Leveled info + for( unsigned int i = 0; i < mMaxLevels + 1; ++i ) { + params->mNumVertices[ i ] = mNumVertices[ i ]; + params->mNumBranches[ i ] = mNumBranches[ i ]; + params->mDownAngle[ i ] = mDownAngle[ i ]; + params->mDownAngleV[ i ] = mDownAngleV[ i ]; + params->mRotate[ i ] = mRotate[ i ]; + params->mRotateV[ i ] = mRotateV[ i ]; + params->mLength[ i ] = mLength[ i ]; + params->mLengthV[ i ] = mLengthV[ i ]; + params->mCurve[ i ] = mCurve[ i ]; + params->mCurveBack[ i ] = mCurveBack[ i ]; + params->mCurveV[ i ] = mCurveV[ i ]; + params->mCurveRes[ i ] = mCurveRes[ i ]; + } + + return params; + } + + unsigned char Parameters::getCurveRes( unsigned int level ) { + if( level <= mMaxLevels ) + return mCurveRes[ level ]; + return 0; + } + + float Parameters::getCurveV( unsigned int level ) { + if( level <= mMaxLevels ) + return mCurveV[ level ]; + return 0.0f; + } + + float Parameters::getCurveBack( unsigned int level ) { + if( level <= mMaxLevels ) + return mCurveBack[ level ]; + return 0.0f; + } + + float Parameters::getCurve( unsigned int level ) { + if( level <= mMaxLevels ) + return mCurve[ level ]; + return 0.0f; + } + + float Parameters::getLengthV( unsigned int level ) { + if( level <= mMaxLevels ) + return mLengthV[ level ]; + return 0.0f; + } + + float Parameters::getLength( unsigned int level ) { + if( level <= mMaxLevels ) + return mLength[ level ]; + return 0.0f; + } + + float Parameters::getRotateV( unsigned int level ) { + if( level <= mMaxLevels ) + return mRotateV[ level ]; + return 0.0f; + } + + float Parameters::getRotate( unsigned int level ) { + if( level <= mMaxLevels ) + return mRotate[ level ]; + return 0.0f; + } + + float Parameters::getDownAngleV( unsigned int level ) { + if( level <= mMaxLevels ) + return mDownAngleV[ level ]; + return 0.0f; + } + + float Parameters::getDownAngle( unsigned int level ) { + if( level <= mMaxLevels ) + return mDownAngle[ level ]; + return 0.0f; + } + + unsigned char Parameters::getNumBranches( unsigned int level ) { + if( level <= mMaxLevels ) + return mNumBranches[ level ]; + return 0; + } + + unsigned char Parameters::getNumVertices( unsigned int level ) { + if( level <= mMaxLevels ) + return mNumVertices[ level ]; + return 0; + } + + void Parameters::setCurveRes( unsigned int level, unsigned char curveRes ) { + if( level <= mMaxLevels ) + mCurveRes[ level ] = curveRes; + } + + void Parameters::setCurveV( unsigned int level, float curveV ) { + if( level <= mMaxLevels ) + mCurveV[ level ] = curveV; + } + + void Parameters::setCurveBack( unsigned int level, float curveBack ) { + if( level <= mMaxLevels ) + mCurveBack[ level ] = curveBack; + } + + void Parameters::setCurve( unsigned int level, float curve ) { + if( level <= mMaxLevels ) + mCurve[ level ] = curve; + } + + void Parameters::setLengthV( unsigned int level, float lengthV ) { + if( level <= mMaxLevels ) + mLengthV[ level ] = lengthV; + } + + void Parameters::setLength( unsigned int level, float length ) { + if( level <= mMaxLevels ) + mLength[ level ] = length; + } + + void Parameters::setRotateV( unsigned int level, float rotateV ) { + if( level <= mMaxLevels ) + mRotateV[ level ] = rotateV; + } + + void Parameters::setRotate( unsigned int level, float rotate ) { + if( level <= mMaxLevels ) + mRotate[ level ] = rotate; + } + + void Parameters::setDownAngleV( unsigned int level, float downAngleV ) { + if( level <= mMaxLevels ) + mDownAngleV[ level ] = downAngleV; + } + + void Parameters::setDownAngle( unsigned int level, float downAngle ) { + if( level <= mMaxLevels ) + mDownAngle[ level ] = downAngle; + } + + void Parameters::setNumBranches( unsigned int level, unsigned char numBranches ) { + if( level <= mMaxLevels ) + mNumBranches[ level ] = numBranches; + } + + void Parameters::setNumVertices( unsigned int level, unsigned char numVertices ) { + if( level <= mMaxLevels ) + mNumVertices[ level ] = numVertices; + } +} // CaduneTree \ No newline at end of file Added: trunk/python-ogre/ThirdParty/cadunetree/CTParameters.h =================================================================== --- trunk/python-ogre/ThirdParty/cadunetree/CTParameters.h (rev 0) +++ trunk/python-ogre/ThirdParty/cadunetree/CTParameters.h 2008-01-08 02:45:30 UTC (rev 532) @@ -0,0 +1,359 @@ +/* +This file is a part of the CaduneTree project, +library used to generate and render trees with OGRE. + +License: +Copyright (c) 2007 Wojciech Cierpucha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#ifndef _CTParameters_h_ +#define _CTParameters_h_ + +#include "CTPrerequisites.h" +#include <OgreString.h> + +/// @file + +namespace CaduneTree { + + + /// @class Parameters + /// This class describes all parameters used to generate a tree, it allows to keep data for 4 levels of recursion. + /// You can save/load it using Serializer class. + + /// Tree parameters class. + class Parameters { + public: + Parameters(); ///< Constructor sets values to default + Parameters( const Parameters& params ); ///< Copy constructor + ~Parameters(); ///< Destructor cleans up + + /// Serializer has to see private elements + friend class Serializer; + + /// This function is used to set parameters to their default values, which describe a low poly tree + void setDefault(); + /// Create another instance of class Parameters by copying this one + /// @return - new instance of these Parameters + Parameters* createCopy() const; + + /// Set shape + /// @param shape - a ShapeEnum enumeration used to choose one of possible tree shapes + void setShape( ShapeEnum shape ) { mShape = shape; } + /// Set base size + /// @param baseSize - tree's base size, varying from 0 to 1, describing how high level 2 branches start + void setBaseSize( float baseSize ) { mBaseSize = baseSize; } + /// Set scale + /// @param scale - a scale factor + void setScale( float scale ) { mScale = scale; } + /// Set scale variation + /// @param scaleV - scale factor variation + void setScaleV( float scaleV ) { mScaleV = scaleV; } + /// Set number of leaves + /// @param numLevels - number of leaves to set + void setNumLevels( unsigned char numLevels ) { mNumLevels = numLevels; } + /// Set ratio + /// @param ratio - ratio + void setRatio( float ratio ) { mRatio = ratio; } + /// Set ratio power + /// @param ratioPower - ratio power factor + void setRatioPower( float ratioPower ) { mRatioPower = ratioPower; } + /// Set number of lobes + /// @param numLobes - number of lobes + void setNumLobes( unsigned char numLobes ) { mNumLobes = numLobes; } + /// Set depth of lobes + /// @param lobeDepth - depth of lobes + void setLobeDepth( float lobeDepth ) { mLobeDepth = lobeDepth; } + /// Set flare + /// @param flare - flare + void setFlare( float flare ) { mFlare = flare; } + /// Set trunk's scale + /// @param scale0 - 0Scale + void setScale0( float scale0 ) { mScale0 = scale0; } + /// Set trunk's scale variation + /// @param scale0V - 0Scale variation + void setScale0V( float scale0V ) { mScale0V = scale0V; } + /// Set bark material to be used + /// @param barkMaterial - material's name + void setBarkMaterial( Ogre::String barkMaterial ) { mBarkMaterial = barkMaterial; } + /// Set leaf scale + /// @param leafScale - scale factor for leaves + void setLeafScale( float leafScale ) { mLeafScale = leafScale; } + /// Set horizontal leaf scale + /// @param leafScaleX - relative horizontal scale factor for leaves + void setLeafScaleX( float leafScaleX ) { mLeafScaleX = leafScaleX; } + /// Set number of leaves + /// @param numLeaves - number of leaves to set for each branch of last level of recursion + void setNumLeaves( unsigned char numLeaves ) { mNumLeaves = numLeaves; } + /// Set leaf quality factor + /// @param leafQuality - factor used to describe number and size of leaves, useful for LOD + void setLeafQuality( float leafQuality ) { mLeafQuality = leafQuality; } + /// Set leaf layout exponent + /// @param leafLayoutExp - when 1 leaves will be situated linearly across the branch + void setLeafLayoutExp( float leafLayoutExp ) { mLeafLayoutExp = leafLayoutExp; } + /// Set material to be used for leaves + /// @param leafMaterial - material's name + void setLeafMaterial( Ogre::String leafMaterial ) { mLeafMaterial = leafMaterial; } + /// Set frond scale + /// @param frondScale - scale factor for fronds + void setFrondScale( float frondScale ) { mFrondScale = frondScale; } + /// Set horizontal frond scale + /// @param frondScaleX - relative horizontal scale factor for fronds + void setFrondScaleX( float frondScaleX ) { mFrondScaleX = frondScaleX; } + /// Set number of fronds + /// @param numFronds - number of fronds to set for each branch of last level of recursion + void setNumFronds( unsigned char numFronds ) { mNumFronds = numFronds; } + /// Set frond quality factor + /// @param frondQuality - factor used to describe number and size of fronds + void setFrondQuality( float frondQuality ) { mFrondQuality = frondQuality; } + /// Set material to be used for fronds + /// @param frondMaterial - material's name + void setFrondMaterial( Ogre::String frondMaterial ) { mFrondMaterial = frondMaterial; } + /// Set vertical attraction + /// @param attractionUp - vertical attraction + void setAttractionUp( float attractionUp ) { mAttractionUp = attractionUp; } + /// Set number of vertices for given level + /// @param level - desired level + /// @param numVertices - number of vertices to set + void setNumVertices( unsigned int level, unsigned char numVertices ); + /// Set number of branches for given level + /// @param level - desired level + /// @param numBranches - number of branches to set + void setNumBranches( unsigned int level, unsigned char numBranches ); + /// Set down angle + /// @param level - desired level + /// @param downAngle - angle beetwen branch and its parent + void setDownAngle( unsigned int level, float downAngle ); + /// Set down angle variation + /// @param level - desired level + /// @param downAngleV - down angle variation + void setDownAngleV( unsigned int level, float downAngleV ); + /// Set rotate angle + /// @param level - desired level + /// @param rotate - angle to rotate around parent + void setRotate( unsigned int level, float rotate ); + /// Set rotate angle variation + /// @param level - desired level + /// @param rotateV - rotate angle variation + void setRotateV( unsigned int level, float rotateV ); + /// Set length + /// @param level - desired level + /// @param length - length, 1.0 means parent's length, 2.0 double of it, etc. + void setLength( unsigned int level, float length ); + /// Set length variation + /// @param level - desired level + /// @param lengthV - length variation + void setLengthV( unsigned int level, float lengthV ); + /// Set curve + /// @param level - desired level + /// @param curve - angle used to curve the branch + void setCurve( unsigned int level, float curve ); + /// Set back curve + /// @param level - desired level + /// @param curveBack - back curve + void setCurveBack( unsigned int level, float curveBack ); + /// Set curve variation + /// @param level - desired level + /// @param curveV - curve variation + void setCurveV( unsigned int level, float curveV ); + /// Set curve resolution + /// @param level - desired level + /// @param curveRes - number of sections in a branch - resolution + void setCurveRes( unsigned int level, unsigned char curveRes ); + + /// Get maximum number of levels + /// @return constant predefined maximum number of levels + unsigned int getMaxLevels() const { return mMaxLevels; } + + /// Get shape + /// @return - ShapeEnum shape + ShapeEnum getShape() const { return mShape; } + /// Get base size + /// @return - tree's base size, varying from 0 to 1, describing how high level 2 branches start + float getBaseSize() const { return mBaseSize; } + /// Get scale + /// @return - a scale factor + float getScale() const { return mScale; } + /// Get scale variation + /// @return - scale factor variation + float getScaleV() const { return mScaleV; } + /// Get number of levels + /// @return number of levels of recursion in tree + unsigned char getNumLevels() const { return mNumLevels; } + /// Get ratio + /// @return ratio factor + float getRatio() const { return mRatio; } + /// Get ratio power + /// @return ratio power factor + float getRatioPower() const { return mRatioPower; } + /// Get number of lobes + /// @return number of lobes + unsigned char getNumLobes() const { return mNumLobes; } + /// Get lobe depth + /// @return lobes' depth + float getLobeDepth() const { return mLobeDepth; } + /// Get flare + /// @return flare + float getFlare() const { return mFlare; } + /// Get trunk's scale + /// @return trunk's scale factor + float getScale0() const { return mScale0; } + /// Get trunk's scale variation + /// @return trunk's scale factor variation + float getScale0V() const { return mScale0V; } + /// Get bark's material to be used + /// @return bark's material name + Ogre::String getBarkMaterial() const { return mBarkMaterial; } + /// Get leaf scale + /// @return leaf scale + float getLeafScale() const { return mLeafScale; } + /// Get horizontal leaf scale + /// @return horizontal leaf scale, which is applied to leaf scale + float getLeafScaleX() const { return mLeafScaleX; } + /// Get number of leaves + /// @return number of leaves + unsigned char getNumLeaves() const { return mNumLeaves; } + /// Get leaf quality + /// @return leaf quality factor + float getLeafQuality() const { return mLeafQuality; } + /// Get leaf layout exponent - used to determine how leaves are located across branches, use 1.0 to use linear distribution + /// @return leaf layout exponent + float getLeafLayoutExp() const { return mLeafLayoutExp; } + /// Get leaf material + /// @return material's name + Ogre::String getLeafMaterial() const { return mLeafMaterial; } + /// Get frond scale + /// @return frond scale factor + float getFrondScale() const { return mFrondScale; } + /// Get horizontal frond scale + /// @return relative to frond scale, horizontal scale factor + float getFrondScaleX() const { return mFrondScaleX; } + /// Get number of fronds + /// @return number of fronds + unsigned char getNumFronds() const { return mNumFronds; } + /// Get frond quality + /// @return quality factor + float getFrondQuality() const { return mFrondQuality; } + /// Get frond material + /// @return material's name + Ogre::String getFrondMaterial() const { return mFrondMaterial; } + /// Get vertical attraction + /// @return vertical attraction factor + float getAttractionUp() const { return mAttractionUp; } + /// Get tapering parameter (not used, constant for now) + /// @return taper + float getTaper() const { return mTaper; } + + /// Get number of vertices for a specific level + /// @param level - desired level of recursion + /// @return number of vetices + unsigned char getNumVertices( unsigned int level ); // code in .cpp file and check if level < mNumLevels + /// Get number of branches for a specific level + /// @param level - desired level of recursion + /// @return number of branches + unsigned char getNumBranches( unsigned int level ); + /// Get down angle for a specific level + /// @param level - desired level of recursion + /// @return down angle + float getDownAngle( unsigned int level ); + /// Get down angle variation for a specific level + /// @param level - desired level of recursion + /// @return down angle variation + float getDownAngleV( unsigned int level ); + /// Get rotate parameter for a specific level + /// @param level - desired level of recursion + /// @return rotation parameter + float getRotate( unsigned int level ); + /// Get rotate variation parameter for a specific level + /// @param level - desired level of recursion + /// @return rotation variation parameter + float getRotateV( unsigned int level ); + /// Get length for a specific level + /// @param level - desired level of recursion + /// @return length + float getLength( unsigned int level ); + /// Get length variation for a specific level + /// @param level - desired level of recursion + /// @return length variation + float getLengthV( unsigned int level ); + /// Get curve parameter for a specific level + /// @param level - desired level of recursion + /// @return curve parameter + float getCurve( unsigned int level ); + /// Get curve back parameter for a specific level + /// @param level - desired level of recursion + /// @return curve back parameter + float getCurveBack( unsigned int level ); + /// Get curve variation parameter for a specific level + /// @param level - desired level of recursion + /// @return curve variation parameter + float getCurveV( unsigned int level ); + /// Get curve resolution parameter for a specific level + /// @param level - desired level of recursion + /// @return curve resolution parameter + unsigned char getCurveRes( unsigned int level ); + private: + ShapeEnum mShape; + float mBaseSize; + float mScale; + float mScaleV; + unsigned char mNumLevels; + float mRatio; + float mRatioPower; + unsigned char mNumLobes; + float mLobeDepth; + float mFlare; + float mScale0; + float mScale0V; + Ogre::String mBarkMaterial; + float mLeafScale; + float mLeafScaleX; + unsigned char mNumLeaves; + float mLeafQuality; + float mLeafLayoutExp; + Ogre::String mLeafMaterial; + float mFrondScale; + float mFrondScaleX; + unsigned char mNumFronds; + float mFrondQuality; + Ogre::String mFrondMaterial; + float mAttractionUp; + const float mTaper; // constant = 1, at least for now + unsigned char *mNumVertices; + unsigned char *mNumBranches; + float *mDownAngle; + float *mDownAngleV; + float *mRotate; + float *mRotateV; + float *mLength; + float *mLengthV; + float *mCurve; + float *mCurveBack; + float *mCurveV; + unsigned char *mCurveRes; + + /// Predefined maximum number of levels possible + static const unsigned int mMaxLevels; + }; // Parameters + +} // CaduneTree + +#endif \ No newline at end of file Added: trunk/python-ogre/ThirdParty/cadunetree/CTPrerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/cadunetree/CTPrerequisites.h (rev 0) +++ trunk/python-ogre/ThirdParty/cadunetree/CTPrerequisites.h 2008-01-08 02:45:30 UTC (rev 532) @@ -0,0 +1,56 @@ +/* +This file is a part of the CaduneTree project, +library used to generate and render trees with OGRE. + +License: +Copyright (c) 2007 Wojciech Cierpucha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#ifndef _CTPrerequisites_h_ +#define _CTPrerequisites_h_ + +namespace CaduneTree { + + // Class declarations + class Parameters; + class Serializer; + class Section; + class Stem; + + // Enumeration declarations + /// @enum ShapeEnum + /// Enum used to describe possible tree shapes + enum ShapeEnum { + CONICAL = 0, ///< Conical shape + SPHERICAL, ///< Spherical shape + HEMISPHERICAL, ///< Hemispherical shape + CYLINDRICAL, ///< Cylindrical shape + TAPERED_CYLINDRICAL, ///< Tapered cylindrical shape + FLAME, ///< Flame shape + INVERSE_CONICAL, ///< Inverse conical shape + TEND_FLAME, ///< Tend flame shape + //ENVELOPE ///< Envelope shape ---pruning + }; + + +} // CaduneTree + +#endif \ No newline at end of file Added: trunk/python-ogre/ThirdParty/cadunetree/CTSection.cpp =================================================================== --- trunk/python-ogre/ThirdParty/cadunetree/CTSection.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/cadunetree/CTSection.cpp 2008-01-08 02:45:30 UTC (rev 532) @@ -0,0 +1,109 @@ +/* +This file is a part of the CaduneTree project, +library used to generate and render trees with OGRE. + +License: +Copyright (c) 2007 Wojciech Cierpucha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include "CTSection.h" + +namespace CaduneTree { + + Section::Section() { + mOrigin = Ogre::Vector3::ZERO; + mGlobalOrigin = Ogre::Vector3::ZERO; + mOrientation = Ogre::Quaternion::IDENTITY; + mTexVCoord = 0.0f; + } + + Section::~Section() { + + } + + void Section::create( unsigned int numLobes, float lobeDepth, float radius, unsigned int numVertices ) { + float angle = 2 * Ogre::Math::PI / numVertices; + float lobedRadius; + Ogre::Vector3 localVertex; + Ogre::Vector3 globalVertex; + for( unsigned int i = 0; i < numVertices; ++i ) { + lobedRadius = radius * ( 1.0f + lobeDepth * Ogre::Math::Sin( i * numLobes * angle ) ); + localVertex.x = Ogre::Math::Cos( i * angle ) * lobedRadius; + localVertex.y = 0.0f; + localVertex.z = Ogre::Math::Sin( i * angle ) * lobedRadius; + + globalVertex = mOrientation * ( mOrigin + localVertex ) + mGlobalOrigin; + mGlobalVertices.push_back( globalVertex ); + mNormals.push_back( ( mOrientation * localVertex ).normalisedCopy() ); + + mTexUCoords.push_back( ( float ) i / numVertices ); + } + // Additional vertex + mGlobalVertices.push_back( *mGlobalVertices.begin() ); + mNormals.push_back( *mNormals.begin() ); + mTexUCoords.push_back( 1.0f ); + } + + void Section::setGlobalOrigin( const Ogre::Vector3& globalOrigin ) { + mGlobalOrigin = globalOrigin; + } + + void Section::setOrigin( const Ogre::Vector3 &origin ) { + mOrigin = origin; + } + + void Section::setOrientation( const Ogre::Quaternion& orientation ) { + mOrientation = orientation; + } + + void Section::setTexVCoord( float v ) { + mTexVCoord = v; + } + + std::vector< Ogre::Vector3 >* Section::getGlobalVertices() { + return &mGlobalVertices; + } + + std::vector< Ogre::Vector3 >* Section::getNormals() { + return &mNormals; + } + + std::vector< float >* Section::getTexUCoords() { + return &mTexUCoords; + } + + Ogre::Quaternion Section::getOrientation() const { + return mOrientation; + } + + Ogre::Vector3 Section::getOrigin() const { + return mOrigin; + } + + Ogre::Vector3 Section::getGlobalOrigin() const { + return mGlobalOrigin; + } + + float Section::getTexVCoord() const { + return mTexVCoord; + } + +} // CaduneTree \ No newline at end of file Added: trunk/python-ogre/ThirdParty/cadunetree/CTSection.h =================================================================== --- trunk/python-ogre/ThirdParty/cadunetree/CTSection.h (rev 0) +++ trunk/python-ogre/ThirdParty/cadunetree/CTSection.h 2008-01-08 02:45:30 UTC (rev 532) @@ -0,0 +1,74 @@ +/* +This file is a part of the CaduneTree project, +library used to generate and render trees with OGRE. + +License: +Copyright (c) 2007 Wojciech Cierpucha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#ifndef _CTSection_h_ +#define _CTSection_h_ + +#include "CTPrerequisites.h" +#include <Ogre.h> +#include <vector> + +/// @file + +namespace CaduneTree { + + /// @class Section + /// Objects of this type hold information about vertices, their normals and texture coordinates (one set). + /// This is used only internally in methods of Stem class. Thus there is no need to document the code. + + /// Used only internally. + class Section { + public: + Section(); + ~Section(); + + void create( unsigned int numLobes, float lobeDepth, float radius, unsigned int numVertices ); + void setOrientation( const Ogre::Quaternion& orientation ); + void setGlobalOrigin( const Ogre::Vector3& globalOrigin ); + void setOrigin( const Ogre::Vector3& origin ); + void setTexVCoord( float v ); + + std::vector< Ogre::Vector3 >* getGlobalVertices(); + std::vector< Ogre::Vector3 >* getNormals(); + std::vector< float >* getTexUCoords(); + + Ogre::Quaternion getOrientation() const; + Ogre::Vector3 getOrigin() const; + Ogre::Vector3 getGlobalOrigin() const; + float getTexVCoord() const; + private: + Ogre::Vector3 mOrigin; + Ogre::Vector3 mGlobalOrigin; + Ogre::Quaternion mOrientation; + std::vector< Ogre::Vector3 > mGlobalVertices; + std::vector< Ogre::Vector3 > mNormals; + std::vector< float > mTexUCoords; + float mTexVCoord; + }; + +} // CaduneTree + +#endif \ No newline at end of file Added: trunk/python-ogre/ThirdParty/cadunetree/CTSerializer.cpp =================================================================== --- trunk/python-ogre/ThirdParty/cadunetree/CTSerializer.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/cadunetree/CTSerializer.cpp 2008-01-08 02:45:30 UTC (rev 532) @@ -0,0 +1,169 @@ +/* +This file is a part of the CaduneTree project, +library used to generate and render trees with OGRE. + +License: +Copyright (c) 2007 Wojciech Cierpucha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include "CTSerializer.h" +#include "CTParameters.h" +#include <OgreException.h> + +using namespace std; + +namespace CaduneTree { + + void Serializer::exportDefinition( const string &filename, Parameters *params ) { + if( !params ) + throw Ogre::Exception( Ogre::Exception::ERR_INVALIDPARAMS, "Passed Parameters pointer is null", "Serializer::exportDefinition" ); + + ofstream file( filename.c_str(), ios_base::binary ); + + // File header + file << "CTD"; + file << ( char ) 6; + + // General + file.write( ( char* ) ¶ms->mShape, sizeof( ShapeEnum ) ); + file.write( ( char* ) ¶ms->mBaseSize, sizeof( float ) ); + file.write( ( char* ) ¶ms->mScale, sizeof( float ) ); + file.write( ( char* ) ¶ms->mScaleV, sizeof( float ) ); + file.write( ( char* ) ¶ms->mNumLevels, sizeof( unsigned char ) ); + file.write( ( char* ) ¶ms->mRatio, sizeof( float ) ); + file.write( ( char* ) ¶ms->mRatioPower, sizeof( float ) ); + file.write( ( char* ) ¶ms->mNumLobes, sizeof( unsigned char ) ); + file.write( ( char* ) ¶ms->mLobeDepth, sizeof( float ) ); + file.write( ( char* ) ¶ms->mFlare, sizeof( float ) ); + file.write( ( char* ) ¶ms->mScale0, sizeof( float ) ); + file.write( ( char* ) ¶ms->mScale0V, sizeof( float ) ); + file.write( ( char* ) ¶ms->mAttractionUp, sizeof ( float ) ); + // file.write( ( char* ) ¶ms->mBarkMaterial, sizeof( string ) ); + + // Leaves + file.write( ( char* ) ¶ms->mNumLeaves, sizeof( unsigned char ) ); + file.write( ( char* ) ¶ms->mLeafScale, sizeof( float ) ); + file.write( ( char* ) ¶ms->mLeafScaleX, sizeof( float ) ); + file.write( ( char* ) ¶ms->mLeafQuality, sizeof( float ) ); + file.write( ( char* ) ¶ms->mLeafLayoutExp, sizeof( float ) ); + // file.write( ( char* ) ¶ms->mLeafMaterial, sizeof( string ) ); + + // Fronds + file.write( ( char* ) ¶ms->mNumFronds, sizeof( unsigned char ) ); + file.write( ( char* ) ¶ms->mFrondScale, sizeof( float ) ); + file.write( ( char* ) ¶ms->mFrondScaleX, sizeof( float ) ); + file.write( ( char* ) ¶ms->mFrondQuality, sizeof( float ) ); + //file.write( ( char* ) ¶ms->mFrondMaterial, sizeof( string ) ); + + // Branches + for( unsigned int i = 0; i < params->mMaxLevels + 1; ++i ) { + file.write( ( char* ) ¶ms->mNumVertices[ i ], sizeof( unsigned char ) ); + file.write( ( char* ) ¶ms->mNumBranches[ i ], sizeof( unsigned char ) ); + file.write( ( char* ) ¶ms->mDownAngle[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mDownAngleV[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mRotate[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mRotateV[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mLength[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mLengthV[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mCurve[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mCurveBack[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mCurveV[ i ], sizeof( float ) ); + file.write( ( char* ) ¶ms->mCurveRes[ i ], sizeof( unsigned char ) ); + } + // EOF + } + + Parameters* Serializer::importDefinition( const string &filename ) { + Parameters *params = 0; + + ifstream file( filename.c_str(), ios_base::binary ); + char cheader[4]; + file.read( ( char* ) cheader, 3 * sizeof( char ) ); + cheader[3] = '\0'; + string header( cheader ); + if( header != "CTD" ) + throw Ogre::Exception( Ogre::Exception::ERR_FILE_NOT_FOUND, "This is not a proper .ctd file!", "Serializer::importDefinition" ); + + char version; + file.read( ( char* ) &version, sizeof( char ) ); + if( version == 6 ) + params = import006( &file ); + else + throw Ogre::Exception( Ogre::Exception::ERR_FILE_NOT_FOUND, "Not supported CTD file version!", "Serializer::importDefinition" ); + + return params; + } + + Parameters* Serializer::import006( ifstream *file ) { + Parameters *params = new Parameters; + + // General + file->read( ( char* ) ¶ms->mShape, sizeof( ShapeEnum ) ); + file->read( ( char* ) ¶ms->mBaseSize, sizeof( float ) ); + file->read( ( char* ) ¶ms->mScale, sizeof( float ) ); + file->read( ( char* ) ¶ms->mScaleV, sizeof( float ) ); + file->read( ( char* ) ¶ms->mNumLevels, sizeof( unsigned char ) ); + file->read( ( char* ) ¶ms->mRatio, sizeof( float ) ); + file->read( ( char* ) ¶ms->mRatioPower, sizeof( float ) ); + file->read( ( char* ) ¶ms->mNumLobes, sizeof( unsigned char ) ); + file->read( ( char* ) ¶ms->mLobeDepth, sizeof( float ) ); + file->read( ( char* ) ¶ms->mFlare, sizeof( float ) ); + file->read( ( char* ) ¶ms->mScale0, sizeof( float ) ); + file->read( ( char* ) ¶ms->mScale0V, sizeof( float ) ); + file->read( ( char* ) ¶ms->mAttractionUp, sizeof ( float ) ); + // file->read( ( char* ) ¶ms->mBarkMaterial, sizeof( string ) ); + + // Leaves + file->read( ( char* ) ¶ms->mNumLeaves, sizeof( unsigned char ) ); + file->read( ( char* ) ¶ms->mLeafScale, sizeof( float ) ); + file->read( ( char* ) ¶ms->mLeafScaleX, sizeof( float ) ); + file->read( ( char* ) ¶ms->mLeafQuality, sizeof( float ) ); + file->read( ( char* ) ¶ms->mLeafLayoutExp, sizeof( float ) ); + // file->read( ( char* ) ¶ms->mLeafMaterial, sizeof( string ) ); + + // Fronds + file->read( ( char* ) ¶ms->mNumFronds, sizeof( unsigned char ) ); + file->read( ( char* ) ¶ms->mFrondScale, sizeof( float ) ); + file->read( ( char* ) ¶ms->mFrondScaleX, sizeof( float ) ); + file->read( ( char* ) ¶ms->mFrondQuality, sizeof( float ) ); + //file->read( ( char* ) ¶ms->mFrondMaterial, sizeof( string ) ); + + // Branches + for( unsigned int i = 0; i < params->mMaxLevels + 1; ++i ) { + file->read( ( char* ) ¶ms->mNumVertices[ i ], sizeof( unsigned char ) ); + file->read( ( char* ) ¶ms->mNumBranches[ i ], sizeof( unsigned char ) ); + file->read( ( char* ) ¶ms->mDownAngle[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mDownAngleV[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mRotate[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mRotateV[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mLength[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mLengthV[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mCurve[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mCurveBack[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mCurveV[ i ], sizeof( float ) ); + file->read( ( char* ) ¶ms->mCurveRes[ i ], sizeof( unsigned char ) ); + } + // EOF + + return params; + } +} + // CaduneTree \ No newline at end of file Added: trunk/python-ogre/ThirdParty/cadunetree/CTSerializer.h =================================================================== --- trunk/python-ogre/ThirdParty/cadunetree/CTSerializer.h (rev 0) +++ trunk/python-ogre/ThirdParty/cadunetree/CTSerializer.h 2008-01-08 02:45:30 UTC (rev 532) @@ -0,0 +1,58 @@ +/* +This file is a part of the CaduneTree project, +library used to generate and render trees with OGRE. + +License: +Copyright (c) 2007 Wojciech Cierpucha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#ifndef _CTSerializer_h_ +#define _CTSerializer_h_ + +#include "CTPrerequisites.h" +#include <string> +#include <fstream> + +/// @file + +namespace CaduneTree { + + /// @class Serializer + /// Using this class one can import from file (every previous version is supported) parameters, as well as export them (only most current version of file format). + + /// Class used for import and export of parameters. + class Serializer { + public: + /// Export parameters to file + /// @param filename - path to file or file name (only direct) + /// @param params - pointer to Paramaters object, which will be exported + static void exportDefinition( const std::string &filename, Parameters *params ); + /// Import parameters from file + /// @param filename - path to file or file name (only direct) + static Parameters* importDefinition( const std::string &filename ); + private: + /// Import, file format version 0.6 + static Parameters* import006( std::ifstream *file ); + }; + +} // CaduneTree + +#endif \ No newline at end of file Added: trunk/python-ogre/ThirdParty/cadunetree/CTStem.cpp =================================================================== --- trunk/python-ogre/ThirdParty/cadunetree/CTStem.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/cadunetree/CTStem.cpp 2008-01-08 02:45:30 UTC (rev 532) @@ -0,0 +1,584 @@ +/* +This file is a part of the CaduneTree project, +library used to generate and render trees with OGRE. + +License: +Copyright (c) 2007 Wojciech Cierpucha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include "CTStem.h" +#include "CTParameters.h" +#include "CTSection.h" + +using namespace Ogre; + +namespace CaduneTree { + + Stem::Stem( Parameters* params, Stem* parent ) { + if( !params ) + throw Exception( Exception::ERR_INVALIDPARAMS, "Parameters *params == NULL", "Stem::Stem" ); + + mParameters = params; + mParent = parent; + mNumSubStems = 0; + mNumLeaves = 0; + mNumFronds = 0; + mNumVertices = 0; + mNumTriangles = 0; + mLength = 1.0f; + mRadius = 1.0f; + mOffset = 0.0f; + mIsRoot = false; + mIsGrown = false; + } + + Stem::~Stem() { + std::vector< Section* >::iterator i; + for( i = mSections.begin(); i != mSections.end(); ++i ) { + delete *i; + } + mSections.clear(); + + std::list< Stem* >::iterator j; + for( j = mSubStems.begin(); j != mSubStems.end(); ++j ) { + delete *j; + } + mSubStems.clear(); + } + + void Stem::grow( const Quaternion& orientation, const Vector3& origin, float radius, float length, float offset, unsigned char level ) { + if( level >= mParameters->getNumLevels() && !mIsRoot ) + return; + + if( mParameters->getCurveRes( level ) == 0 ) + return; + + mOrigin = origin; + mOrientation = orientation; + + // Locals used + Vector3 localSectionOrigin = Vector3::ZERO; + Vector3 step = Vector3::ZERO; + Vector3 currentOrigin = mOrigin; + Quaternion localOrientation = mOrientation; + Quaternion newLocalOrientation = mOrientation; + Section* section = 0; + float sectionRadius = radius; + float y = 0.0f; + float angle = 0.0f; + float treeScale = mParameters->getScale() + getRandom( mParameters->getScaleV() ); + float trunkLength = treeScale * ( mParameters->getLength( 0 ) + getRandom( mParameters->getLengthV( 0 ) ) ); + float baseLength = mParameters->getBaseSize() * treeScale; + + // Trunk? + if( level == 0 ) { + mLength = trunkLength; + mRadius = mLength * mParameters->getRatio() * ( mParameters->getScale0() + getRandom( mParameters->getScale0V() ) ); + mOffset = 0.0f; + } else { + mRadius = radius; + mLength = length; + mOffset = offset; + } + + // to avoid having empty first block, ie to start from mOrigin + //localSectionOrigin = Vector3( 0.0f, mLength / mParameters->getCurveRes( level ), 0.0f ); + //currentOrigin -= mOrientation * localSectionOrigin; // wow, it works ;) + step = Vector3( 0.0f, mLength / mParameters->getCurveRes( level ), 0.0f ); + + for( unsigned int i = 0; i < mParameters->getCurveRes( level ); ++i ) { + if( !Math::RealEqual( mParameters->getCurveBack( level ), 0.0f ) ) { + if( mParameters->getCurveRes( level ) / ( i + 1 ) < 2 ) + angle = 2.0f * mParameters->getCurve( level ) / mParameters->getCurveRes( level ); + else + angle = 2.0f * mParameters->getCurveBack( level ) / mParameters->getCurveRes( level ); + } + else + angle = mParameters->getCurve( level ) / mParameters->getCurveRes( level ); + + angle += getRandom( mParameters->getCurveV( level ) / mParameters->getCurveRes( level ) ); + + // Calculate vertical attraction + if( level > 1 && !mIsRoot ) { + float decli = Math::ACos( Vector3( newLocalOrientation * Vector3::UNIT_Y ).y ).valueRadians(); + float orien = Math::ACos( Vector3( newLocalOrientation * Vector3::UNIT_Z ).y ).valueRadians(); + // No idea why Weber & Penn used acos and then cos ?! + angle += mParameters->getAttractionUp() * decli * Math::Cos( orien ) / mParameters->getCurveRes( level ); + } + + angle = Math::DegreesToRadians( angle ); + localOrientation.FromAngleAxis( Radian( angle ), Vector3::UNIT_X ); + localOrientation = newLocalOrientation * localOrientation; + + y = mLength * ( ( float ) i / mParameters->getCurveRes( level ) ); + sectionRadius = mRadius * ( 1.0f - Math::Pow( y / mLength, 2 ) ); + + // flaring + if( level == 0 ) { + float y2 = 1.0f - 8.0f * ( ( float ) i / mParameters->getCurveRes( level ) ); + if( y2 < 0.0f ) + y2 = 0.0f; + sectionRadius *= 1.0f + mParameters->getFlare() * ( Math::Pow( 100, y2 ) - 1.0f ) * 0.01f; + } + + section = new Section; + section->setOrientation( localOrientation ); + section->setOrigin( localSectionOrigin ); + section->setGlobalOrigin( currentOrigin ); + section->setTexVCoord( ( float ) 0.1f * mLength * i / mParameters->getCurveRes( level ) ); + + if( level == 0 ) // lobbed? + section->create( mParameters->getNumLobes(), mParameters->getLobeDepth(), sectionRadius, mParameters->getNumVertices( level ) ); + else + section->create( 0, 0.0f, sectionRadius, mParameters->getNumVertices( level ) ); + + mSections.push_back( section ); + + newLocalOrientation = localOrientation; + currentOrigin += localOrientation * step; + } + mEndVertex = currentOrigin + localOrientation * localSectionOrigin; + + // Situate and spawn substems if this is not a root stem + if( !mIsRoot ) + growChildren( level ); + + // Situate leaves and fronds + if( level == mParameters->getNumLevels() - 1 && !mIsRoot ) { + growLeaves( level ); + growFronds( level ); + } + + // this is a trunk stem => grow roots + if( level == 0 ) + growRoots(); + + mIsGrown = true; + } + + void Stem::growChildren( unsigned char level ) { + if( level > mParameters->getNumLevels() ) + return; + + Quaternion rotQuat = Quaternion::IDENTITY; + Quaternion downQuat = Quaternion::IDENTITY; + Section* currentSection = 0; + Vector3 stemOrigin = Vector3::ZERO; + float rotate = getRandom( Math::PI ); + float downAngle = 0.0f; + float treeScale = mParameters->getScale() + getRandom( mParameters->getScaleV() ); + float baseLength = mParameters->getBaseSize() * treeScale; + float lengthChildMax = mParameters->getLength( level + 1 ) + getRandom( mParameters->getLengthV( level + 1 ) ); + float offset = 0.0f; + float length = 1.0f; + float radius = 1.0f; + + if( level == 0 ) + mNumSubStems = mParameters->getNumBranches( level + 1 ); + else if( level == 1 ) + mNumSubStems = ( unsigned int ) mParameters->getNumBranches( level + 1 ) * ( 0.2f + 0.8f * ( mLength / mParent->mLength ) / lengthChildMax ); + else + mNumSubStems = ( unsigned int ) mParameters->getNumBranches( level + 1 ) * ( 1.0f - 0.5f * ( mOffset / mParent->mLength ) ); + + for( unsigned int i = 0; i < mNumSubStems; ++i ) { + if( level == 0 ) + offset = mLength * ( mParameters->getBaseSize() + ( ( i + 1 ) * ( 1.0f - mParameters->getBaseSize() ) / ( mNumSubStems + 1 ) ) ); + else + offset = mLength * ( ( float ) ( i + 1 ) / ( mNumSubStems + 1 ) ); + + currentSection = findSection( offset / mLength, mParameters->getCurveRes( level ) ); + + if( level == 0 ) + length = mLength * lengthChildMax * shapeRatio( mParameters->getShape(), ( mLength - offset ) / ( mLength - ( treeScale * mParameters->getBaseSize() ) ) ); + else + length = lengthChildMax * ( mLength - 0.6f * offset ); + + radius = mRadius * Math::Pow( ( length / mLength ), mParameters->getRatioPower() ); + + // Down angle + if( mParameters->getDownAngleV( level + 1 ) >= 0.0f ) + downAngle = Math::DegreesToRadians( mParameters->getDownAngle( level + 1 ) + getRandom( mParameters->getDownAngleV( level + 1 ) ) ); + else { + float temp = ( level == 0 ) ? mLength - baseLength : mLength; + downAngle = Math::DegreesToRadians( mParameters->getDownAngle( level + 1 ) + getRandom( mParameters->getDownAngleV( level + 1 ) * ( 1.0f - 2.0f * shapeRatio( CONICAL, ( mLength - offset ) / temp ) ) ) ); + } + downQuat.FromAngleAxis( Radian( downAngle ), Vector3::UNIT_X ); + + // Rotate angle + if( mParameters->getRotate( level + 1 ) > 0.0f ) + rotate += Math::DegreesToRadians( mParameters->getRotate( level + 1 ) + getRandom( mParameters->getRotateV( level + 1 ) ) ); + else + rotate += Math::DegreesToRadians( 180.0f + mParameters->getRotate( level + 1 ) + getRandom( mParameters->getRotateV( level + 1 ) ) ); + + if( rotate > Math::TWO_PI ) + rotate -= Math::TWO_PI; + + rotQuat.FromAngleAxis( Radian( rotate ), Vector3::UNIT_Y ); + + + stemOrigin = currentSection->getOrientation() + * Vector3( 0.0f, offset - findSectionIndex( offset / mLength, mParameters->getCurveRes( level ) ) * mLength / mParameters->getCurveRes( level ), 0.0f ) + + currentSection->getGlobalOrigin(); + + // spawn + Stem* child = new Stem( mParameters, this ); + mSubStems.push_back( child ); + child->grow( currentSection->getOrientation() * rotQuat * downQuat, stemOrigin, radius, length, offset, level + 1 ); + } + } + + // TODO - this is almost a copy of growChildren + void Stem::growRoots() { + Quaternion rotQuat = Quaternion::IDENTITY; + Quaternion downQuat = Quaternion::IDENTITY; + Section* currentSection = mSections[0]; + float rotate = getRandom( Math::PI ); + float downAngle = 0.0f; + float treeScale = mParameters->getScale() + getRandom( mParameters->getScaleV() ); + float baseLength = mParameters->getBaseSize() * treeScale; + float lengthChildMax = mParameters->getLength( mParameters->getMaxLevels() ) + getRandom( mParameters->getLengthV( mParameters->getMaxLevels() ) ); + float length = 1.0f; + float radius = 1.0f; + + unsigned int numRoots = mParameters->getNumBranches( mParameters->getMaxLevels() ); + for( unsigned int i = 0; i < numRoots; ++i ) { + length = mLength * lengthChildMax; + radius = 3 * mRadius * Math::Pow( ( length / mLength ), mParameters->getRatioPower() ); + + // Down angle + if( mParameters->getDownAngleV( mParameters->getMaxLevels() ) >= 0.0f ) + downAngle = Math::DegreesToRadians( mParameters->getDownAngle( mParameters->getMaxLevels() ) + getRandom( mParameters->getDownAngleV( mParameters->getMaxLevels() ) ) ); + else { + float temp = mLength - baseLength; + downAngle = Math::DegreesToRadians( mParameters->getDownAngle( mParameters->getMaxLevels() ) + getRandom( mParameters->getDownAngleV( mParameters->getMaxLevels() ) * ( 1.0f - 2.0f * shapeRatio( CONICAL, mLength / temp ) ) ) ); + } + downQuat.FromAngleAxis( Radian( downAngle ), Vector3::UNIT_X ); + + // Rotate angle + if( mParameters->getRotate( mParameters->getMaxLevels() ) > 0.0f ) + rotate += Math::DegreesToRadians( mParameters->getRotate( mParameters->getMaxLevels() ) + getRandom( mParameters->getRotateV( mParameters->getMaxLevels() ) ) ); + else + rotate += Math::DegreesToRadians( 180.0f + mParameters->getRotate( mParameters->getMaxLevels() ) + getRandom( mParameters->getRotateV( mParameters->getMaxLevels() ) ) ); + + if( rotate > Math::TWO_PI ) + rotate -= Math::TWO_PI; + + rotQuat.FromAngleAxis( Radian( rotate ), Vector3::UNIT_Y ); + + // spawn + Stem* child = new Stem( mParameters, this ); + child->mIsRoot = true; + mSubStems.push_back( child ); + child->grow( currentSection->getOrientation() * rotQuat * downQuat, mOrigin, radius, length, 0.0f, mParameters->getMaxLevels() ); + } + } + + void Stem::growLeaves( unsigned char level ) { + float offset = 0.0f; + Section* currentSection = 0; + Vector3 leafPosition = Vector3::ZERO; + + float randomX = 0.0f; + float randomZ = 0.0f; + + mNumLeav... [truncated message content] |
From: <and...@us...> - 2008-01-08 02:44:52
|
Revision: 531 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=531&view=rev Author: andy_miller Date: 2008-01-07 18:44:54 -0800 (Mon, 07 Jan 2008) Log Message: ----------- Added Cadunetree to the modules Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/PythonOgreConfig_posix.py trunk/python-ogre/environment.py trunk/python-ogre/setup.py Added Paths: ----------- trunk/python-ogre/code_generators/cadunetree/ trunk/python-ogre/code_generators/cadunetree/customization_data.py trunk/python-ogre/code_generators/cadunetree/generate_code.py trunk/python-ogre/code_generators/cadunetree/hand_made_wrappers.py trunk/python-ogre/code_generators/cadunetree/python_cadunetree.h trunk/python-ogre/code_generators/cadunetree/python_cadunetree_aliases.h trunk/python-ogre/code_generators/cadunetree/python_cadunetree_sizeof.h trunk/python-ogre/packages_2.5/ogre/addons/cadunetree/ trunk/python-ogre/packages_2.5/ogre/addons/cadunetree/__init__.py Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-01-06 11:30:00 UTC (rev 530) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-01-08 02:44:54 UTC (rev 531) @@ -52,6 +52,7 @@ # PATH_NxOgre= os.path.join(BASE_DIR, 'nxogre/NxOgre') PATH_noise= os.path.join(PATH_THIRDPARTY, 'noise') PATH_ofusion= os.path.join(PATH_THIRDPARTY, 'ofusion') +PATH_cadunetree= os.path.join(PATH_THIRDPARTY, 'cadunetree') PATH_ogrevideoffmpeg = os.path.join(PATH_THIRDPARTY,'ffmpeg') Modified: trunk/python-ogre/PythonOgreConfig_posix.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_posix.py 2008-01-06 11:30:00 UTC (rev 530) +++ trunk/python-ogre/PythonOgreConfig_posix.py 2008-01-08 02:44:54 UTC (rev 531) @@ -30,9 +30,9 @@ # and the Py++ directory as sometimes we need access to the code repository there pyplusplus_install_dir = os.path.join(BASE_DIR,'pygccxml') -SDK = False -if os.sys.platform == 'darwin': # we use the pre built sdk for OSX - SDK = True +SDK = False +if os.sys.platform == 'darwin': # we use the pre built sdk for OSX + SDK = True # # ## Parent directories of the libraries PATH_THIRDPARTY = os.path.join(module_dir, 'ThirdParty' ) @@ -74,6 +74,7 @@ PATH_ffmpeg= os.path.join(BASE_DIR, 'ffmpeg') PATH_navi = os.path.join(BASE_DIR, 'navi','Navi') PATH_particleuniverse = os.path.join(PATH_Ogre, 'PlugIns', 'ParticleUniverse' ) +PATH_cadunetree= os.path.join(PATH_THIRDPARTY, 'cadunetree') ### Added: trunk/python-ogre/code_generators/cadunetree/customization_data.py =================================================================== --- trunk/python-ogre/code_generators/cadunetree/customization_data.py (rev 0) +++ trunk/python-ogre/code_generators/cadunetree/customization_data.py 2008-01-08 02:44:54 UTC (rev 531) @@ -0,0 +1,7 @@ + +def header_files( version ): + return [ 'CaduneTree.h'] + +def huge_classes( version ): + return [] + \ No newline at end of file Added: trunk/python-ogre/code_generators/cadunetree/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/cadunetree/generate_code.py (rev 0) +++ trunk/python-ogre/code_generators/cadunetree/generate_code.py 2008-01-08 02:44:54 UTC (rev 531) @@ -0,0 +1,286 @@ +#!/usr/bin/env python +# ----------------------------------------------------------------------------- +# This source file is part of Python-Ogre and is covered by the LGPL +# For the latest info, see http://python-ogre.org/ +# +# ----------------------------------------------------------------------------- + +## STARTER TEMPLATE.. +## replace cadunetree with lowercase project name +## set MAIN_NAMESPACE +## rename and configure .h files + + +import os, sys, time, shutil + +#add environment to the path +sys.path.append( os.path.join( '..', '..' ) ) +#add common utils to the pass +sys.path.append( '..' ) +sys.path.append( '.' ) + +import environment +import common_utils +import customization_data +import hand_made_wrappers + +from pygccxml import parser +from pygccxml import declarations +from pyplusplus import messages +from pyplusplus import module_builder +from pyplusplus import decl_wrappers + +from pyplusplus import function_transformers as ft +from pyplusplus.module_builder import call_policies +from pyplusplus.module_creator import sort_algorithms + +import common_utils.extract_documentation as exdoc +import common_utils.var_checker as varchecker +import common_utils.ogre_properties as ogre_properties +from common_utils import docit + +MAIN_NAMESPACE = 'CaduneTree' + +############################################################ +## +## Here is where we manually exclude stuff +## +############################################################ + +def ManualExclude ( mb ): + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + +############################################################ +## +## And there are things that manually need to be INCLUDED +## +############################################################ + +def ManualInclude ( mb ): + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + +############################################################ +## +## And things that need manual fixes, but not necessarly hand wrapped +## +############################################################ +def ManualFixes ( mb ): + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + +############################################################ +## +## And things that need to have their argument and call values fixed. +## ie functions that pass pointers in the argument list and of course we need +## to read the updated values - so instead we pass them back +## as new values in a tuple (ETC ETC) +## +############################################################ + +def ManualTransformations ( mb ): + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + + def create_output( size ): + return [ ft.output( i ) for i in range( size ) ] + + +############################################################################### +## +## Now for the AUTOMATIC stuff that should just work +## +############################################################################### + +def AutoFixes ( mb, MAIN_NAMESPACE ): + """ now we fix a range of things automatically - typically by going through + the entire name space trying to guess stuff and fix it:) + """ + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + + # Functions that have void pointers in their argument list need to change to unsigned int's + pointee_types=[] + ignore_names=[] + common_utils.Fix_Void_Ptr_Args ( main_ns ) # , pointee_types, ignore_names ) + + # and change functions that return a variety of pointers to instead return unsigned int's + pointee_types=[] + ignore_names=[] # these are function names we know it's cool to exclude + common_utils.Fix_Pointer_Returns ( main_ns ) # , pointee_types, ignore_names ) + + # functions that need to have implicit conversions turned off + ImplicitClasses=[] + common_utils.Fix_Implicit_Conversions ( main_ns, ImplicitClasses ) + + if os.name =='nt': + Fix_NT( mb ) + elif os.name =='posix': + Fix_Posix( mb ) + + common_utils.Auto_Document( mb, MAIN_NAMESPACE ) + + +############################################################################### +## +## here are the helper functions that do much of the work +## +############################################################################### +def Fix_Posix ( mb ): + """ fixup for posix specific stuff -- note only expect to be called on a posix machine + """ + ## we could do more here if need be... + if sys.platform == 'darwin': + pass + elif sys.platform.startswith ('linux'): + pass + + +def Fix_NT ( mb ): + """ fixup for NT systems + """ + + +# +# the 'main'function +# +def generate_code(): + messages.disable( +# Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X + messages.W1020 + , messages.W1021 + , messages.W1022 + , messages.W1023 + , messages.W1024 + , messages.W1025 + , messages.W1026 + , messages.W1027 + , messages.W1028 + , messages.W1029 + , messages.W1030 + , messages.W1031 + , messages.W1035 + , messages.W1040 + , messages.W1038 + , messages.W1041 + , messages.W1036 # pointer to Python immutable member + , messages.W1033 # unnamed variables + , messages.W1018 # expose unnamed classes + , messages.W1049 # returns reference to local variable + , messages.W1014 # unsupported '=' operator + ) + # + # Use GCCXML to create the controlling XML file. + # If the cache file (../cache/*.xml) doesn't exist it gets created, otherwise it just gets loaded + # NOTE: If you update the source library code you need to manually delete the cache .XML file + # + xml_cached_fc = parser.create_cached_source_fc( + os.path.join( environment.cadunetree.root_dir, "python_cadunetree.h" ) + , environment.cadunetree.cache_file ) + + defined_symbols = [ 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY' ] + defined_symbols.append( 'VERSION_' + environment.cadunetree.version ) + + # + # build the core Py++ system from the GCCXML created source + # + mb = module_builder.module_builder_t( [ xml_cached_fc ] + , gccxml_path=environment.gccxml_bin + , working_directory=environment.root_dir + , include_paths=environment.cadunetree.include_dirs + , define_symbols=defined_symbols + , indexing_suite_version=2 + , cflags=environment.cadunetree.cflags + ) + + # if this module depends on another set it here + mb.register_module_dependency ( environment.ogre.generated_dir ) + + # normally implicit conversions work OK, however they can cause strange things to happen so safer to leave off + mb.constructors().allow_implicit_conversion = False + + mb.BOOST_PYTHON_MAX_ARITY = 25 + mb.classes().always_expose_using_scope = True + + # + # We filter (both include and exclude) specific classes and functions that we want to wrap + # + global_ns = mb.global_ns + global_ns.exclude() + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + main_ns.include() + + common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) + ManualExclude ( mb ) + common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) + ManualInclude ( mb ) + # here we fixup functions that expect to modifiy their 'passed' variables + ManualTransformations ( mb ) + AutoFixes ( mb, MAIN_NAMESPACE ) + ManualFixes ( mb ) + # + # We need to tell boost how to handle calling (and returning from) certain functions + # + common_utils.Set_DefaultCall_Policies ( mb.global_ns.namespace ( MAIN_NAMESPACE ) ) + + # + # the manual stuff all done here !!! + # + hand_made_wrappers.apply( mb ) + + NoPropClasses = [""] + for cls in main_ns.classes(): + if cls.name not in NoPropClasses: + cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) + + common_utils.add_constants( mb, { 'cadunetree_version' : '"%s"' % environment.cadunetree.version.replace("\n", "\\\n") + , 'python_version' : '"%s"' % sys.version.replace("\n", "\\\n" ) } ) + + ## need to create a welcome doc string for this... + common_utils.add_constants( mb, { '__doc__' : '"cadunetree DESCRIPTION"' } ) + + + ########################################################################################## + # + # Creating the code. After this step you should not modify/customize declarations. + # + ########################################################################################## + extractor = exdoc.doc_extractor() # I'm excluding the UTFstring docs as lots about nothing + mb.build_code_creator (module_name='_cadunetree_' , doc_extractor= extractor ) + + for inc in environment.cadunetree.include_dirs: + mb.code_creator.user_defined_directories.append(inc ) + mb.code_creator.user_defined_directories.append( environment.cadunetree.generated_dir ) + mb.code_creator.replace_included_headers( customization_data.header_files( environment.cadunetree.version ) ) + + huge_classes = map( mb.class_, customization_data.huge_classes( environment.cadunetree.version ) ) + + mb.split_module(environment.cadunetree.generated_dir, huge_classes, use_files_sum_repository=False) + + ## now we need to ensure a series of headers and additional source files are + ## copied to the generated directory.. + + common_utils.copyTree ( sourcePath = environment.Config.PATH_cadunetree, + destPath = environment.cadunetree.generated_dir, + recursive=False ) + +if __name__ == '__main__': + start_time = time.clock() + generate_code() + print 'Source code was updated( %f minutes ).' % ( ( time.clock() - start_time )/60 ) Added: trunk/python-ogre/code_generators/cadunetree/hand_made_wrappers.py =================================================================== --- trunk/python-ogre/code_generators/cadunetree/hand_made_wrappers.py (rev 0) +++ trunk/python-ogre/code_generators/cadunetree/hand_made_wrappers.py 2008-01-08 02:44:54 UTC (rev 531) @@ -0,0 +1,15 @@ +import os +import environment + + + +################################################################################################# +################################################################################################# + +def apply_reg ( class_, code ): + for c in code: + class_.add_registration_code ( c ) + +def apply( mb ): + pass + \ No newline at end of file Added: trunk/python-ogre/code_generators/cadunetree/python_cadunetree.h =================================================================== --- trunk/python-ogre/code_generators/cadunetree/python_cadunetree.h (rev 0) +++ trunk/python-ogre/code_generators/cadunetree/python_cadunetree.h 2008-01-08 02:44:54 UTC (rev 531) @@ -0,0 +1,22 @@ + +#include "CTParameters.h" +#include "CTSerializer.h" +//#include "CTSection.h" +#include "CTStem.h" + +// First we create a magic namespace to hold all our aliases +namespace pyplusplus { namespace aliases { + + #include "python_cadunetree_aliases.h" +} } + +// then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ +// +namespace python_cadunetree{ namespace details{ +inline void instantiate(){ + using namespace CaduneTree; + #include "python_cadunetree_sizeof.h" + +} } } + + Added: trunk/python-ogre/code_generators/cadunetree/python_cadunetree_aliases.h =================================================================== --- trunk/python-ogre/code_generators/cadunetree/python_cadunetree_aliases.h (rev 0) +++ trunk/python-ogre/code_generators/cadunetree/python_cadunetree_aliases.h 2008-01-08 02:44:54 UTC (rev 531) @@ -0,0 +1 @@ +// typedef name nicename; Added: trunk/python-ogre/code_generators/cadunetree/python_cadunetree_sizeof.h =================================================================== --- trunk/python-ogre/code_generators/cadunetree/python_cadunetree_sizeof.h (rev 0) +++ trunk/python-ogre/code_generators/cadunetree/python_cadunetree_sizeof.h 2008-01-08 02:44:54 UTC (rev 531) @@ -0,0 +1 @@ +// sizeof ( variable ); Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-01-06 11:30:00 UTC (rev 530) +++ trunk/python-ogre/environment.py 2008-01-08 02:44:54 UTC (rev 531) @@ -137,9 +137,9 @@ unzip = "unzip -o " cvs = "cvs -z3 -q " svn = "svn --non-interactive " - if isMac(): - sed_ = "sed -i '' " - else: + if isMac(): + sed_ = "sed -i '' " + else: sed_ = "sed --in-place " if isMac(): @@ -196,13 +196,13 @@ buildCmds = [ [0,"python setup.py install --prefix=%s" % PREFIX, os.path.join(os.getcwd(),'python-ogre')] - ] + ] class newton: pythonModule = False - active = True + active = True if not os.path.exists( os.path.join(os.getcwd(), 'ogreaddons/ogrenewt')): - os.makedirs ( os.path.join(os.getcwd(), 'ogreaddons/ogrenewt') ) + os.makedirs ( os.path.join(os.getcwd(), 'ogreaddons/ogrenewt') ) if isLinux(): base = 'newton' @@ -210,26 +210,26 @@ [wget, "http://www.newtondynamics.com/downloads/newtonLinux-1.53.tar.gz", downloadPath] ] - buildCmds = [ - [0, "tar zxf " + os.path.join(downloadPath, "newtonLinux-1.53.tar.gz"), ''], - [0,"patch -s -i ./python-ogre/patch/Newton.patch -p0 ", ''], - [0, "cp newtonSDK/sdk/Newton.h %s/include" % PREFIX, ''], - [0, "cp newtonSDK/sdk/*.a %s/lib" % PREFIX, ''], - [0, "cp newtonSDK/sdk/*.a ogreaddons/ogrenewt",''] - ] + buildCmds = [ + [0, "tar zxf " + os.path.join(downloadPath, "newtonLinux-1.53.tar.gz"), ''], + [0,"patch -s -i ./python-ogre/patch/Newton.patch -p0 ", ''], + [0, "cp newtonSDK/sdk/Newton.h %s/include" % PREFIX, ''], + [0, "cp newtonSDK/sdk/*.a %s/lib" % PREFIX, ''], + [0, "cp newtonSDK/sdk/*.a ogreaddons/ogrenewt",''] + ] if isMac(): base = 'newton' source = [ [wget, "http://www.newtondynamics.com/downloads/NewtonMac-1.53.zip", downloadPath] ] - buildCmds = [ - [0, "unzip -q -o " + os.path.join(downloadPath, "NewtonMac-1.53.zip"), ''], - [0,"patch -s -i ./python-ogre/patch/Newton.patch -p0 ", ''], - [0, "cp newtonSDK/sdk/Newton.h %s/include" % PREFIX, ''], - [0, "cp newtonSDK/sdk/*.a %s/lib" % PREFIX, ''], - [0, "cp newtonSDK/sdk/*.a ogreaddons/ogrenewt" , ''] - ] + buildCmds = [ + [0, "unzip -q -o " + os.path.join(downloadPath, "NewtonMac-1.53.zip"), ''], + [0,"patch -s -i ./python-ogre/patch/Newton.patch -p0 ", ''], + [0, "cp newtonSDK/sdk/Newton.h %s/include" % PREFIX, ''], + [0, "cp newtonSDK/sdk/*.a %s/lib" % PREFIX, ''], + [0, "cp newtonSDK/sdk/*.a ogreaddons/ogrenewt" , ''] + ] class pygccxml: pythonModule = False @@ -385,7 +385,7 @@ source = [ [wget,'http://downloads.sourceforge.net/boost/boost-jam-3.1.16.tgz', downloadPath], [wget,'http://downloads.sourceforge.net/boost/boost_1_34_1.tar.gz',downloadPath] - ] + ] buildCmds = [ ## first handle bjam [0, tar + ' zxf ' + os.path.join(downloadPath, bjambase) + '.tgz --overwrite', ''], @@ -473,15 +473,15 @@ source = [ [wget, "http://prdownloads.sourceforge.net/ogre/"+base+".tar.bz2",downloadPath], ] - buildCmds = [ + buildCmds = [ [0, "env >1", ''], [0, tar + " jxf " + os.path.join(downloadPath,base)+".tar.bz2 --overwrite",os.getcwd() ], [0, "patch -s -N -i ./python-ogre/patch/ogre.patch -p0 ", os.getcwd()], [0, "aclocal", os.path.join(os.getcwd(), 'ogrenew')], [0, "./bootstrap", os.path.join(os.getcwd(), 'ogrenew')], - #[1, "import os\nos.environ['ZZIPLIB_LIBS']='-lzzip'", ''], + #[1, "import os\nos.environ['ZZIPLIB_LIBS']='-lzzip'", ''], [0, "./configure --prefix=%s --with-gui=Xt --disable-devil" % PREFIX, os.path.join(os.getcwd(), 'ogrenew')], - #export ZZIPLIB_LIBS="-lzzip" + #export ZZIPLIB_LIBS="-lzzip" [0, "make", os.path.join(os.getcwd(), 'ogrenew')], [0, "make install", os.path.join(os.getcwd(), 'ogrenew')], ] @@ -539,18 +539,18 @@ cflags='' parent = "ogre/io" if isMac(): - source=[] - if isLinux(): - base = "ois-1.0RC1" - source=[ - [wget, "http://prdownloads.sourceforge.net/wgois/ois-1.0RC1.tar.gz", downloadPath] - ] + source=[] + if isLinux(): + base = "ois-1.0RC1" + source=[ + [wget, "http://prdownloads.sourceforge.net/wgois/ois-1.0RC1.tar.gz", downloadPath] + ] buildCmds = [ [0, tar + " zxf " + os.path.join(downloadPath,base)+".tar.gz --overwrite",os.getcwd() ], - [0, "./bootstrap" ,os.path.join(os.getcwd(), base )], - [0,"./configure --prefix=%s --includedir=%s/include" %(PREFIX,PREFIX) ,os.path.join(os.getcwd(), base )], + [0, "./bootstrap" ,os.path.join(os.getcwd(), base )], + [0,"./configure --prefix=%s --includedir=%s/include" %(PREFIX,PREFIX) ,os.path.join(os.getcwd(), base )], [0,'make', os.path.join(os.getcwd(), base )], - [0,'make install', os.path.join(os.getcwd(), base )] + [0,'make install', os.path.join(os.getcwd(), base )] ] if os.name=='nt': if _PreCompiled: @@ -580,10 +580,10 @@ pythonModule = True version = "1.4" name = 'ogrerefapp' - parent = "ogre/physics" - baseDir = os.path.join(os.getcwd(),'ogrenew', 'ReferenceApplication') - source = [] - buildCmds=[ + parent = "ogre/physics" + baseDir = os.path.join(os.getcwd(),'ogrenew', 'ReferenceApplication') + source = [] + buildCmds=[ [0, "aclocal", baseDir], [0, "./bootstrap", baseDir], [0, "./configure --prefix=%s " % PREFIX, baseDir], @@ -613,23 +613,23 @@ pythonModule = True version = "1.0" name = 'ogrenewt' - parent = "ogre/physics" + parent = "ogre/physics" base = 'ogreaddons/ogrenewt' if isWindows(): libs = ['Newton', Config.LIB_Boost, 'OgreNewt_Main', 'OgreMain'] else: - libs = ['Newton', Config.LIB_Boost, 'OgreNewt', 'OgreMain'] + libs = ['Newton', Config.LIB_Boost, 'OgreNewt', 'OgreMain'] source = [ [cvs, " -d :pserver:ano...@cv...:/cvsroot/ogre co -P "+base, os.getcwd()] - ] + ] baseDir = os.path.join(os.getcwd(), base ) - buildCmds = [ - [0, "patch -s -N -i ../../python-ogre/patch/ogrenewt.patch -p0", baseDir], - [0, "cp SConscript OgreNewt_Main", baseDir], - #[0, "rm SConscript", baseDir], - [0, "rm -r ./OgreNewt_Main/inc/boost", baseDir], - [0, "scons prefix=%s boost=%s/include/%s install" % (PREFIX, PREFIX, boost.base), baseDir], - ] + buildCmds = [ + [0, "patch -s -N -i ../../python-ogre/patch/ogrenewt.patch -p0", baseDir], + [0, "cp SConscript OgreNewt_Main", baseDir], + #[0, "rm SConscript", baseDir], + [0, "rm -r ./OgreNewt_Main/inc/boost", baseDir], + [0, "scons prefix=%s boost=%s/include/%s install" % (PREFIX, PREFIX, boost.base), baseDir], + ] include_dirs = [Config.PATH_Boost , Config.PATH_Newton # only one path for Newton @@ -660,23 +660,23 @@ pchincludes = ['boost/python.hpp', 'cegui.h'] libs=[Config.LIB_Boost, 'CEGUIBase', 'OgreMain', 'OgreGUIRenderer' ] else: - libs=[Config.LIB_Boost, 'CEGUIBase', 'OgreMain', 'CEGUIOgreRenderer' ] + libs=[Config.LIB_Boost, 'CEGUIBase', 'OgreMain', 'CEGUIOgreRenderer' ] - if isLinux(): - base = "CEGUI-0.5.0" - source=[ - [wget, "http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.5.0b.tar.gz", downloadPath] - ] + if isLinux(): + base = "CEGUI-0.5.0" + source=[ + [wget, "http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.5.0b.tar.gz", downloadPath] + ] buildCmds = [ [0, tar + " zxf " + os.path.join(downloadPath,base)+"b.tar.gz --overwrite",os.getcwd() ], - [0, "patch -s -N -i ../python-ogre/patch/cegui.patch -p0", os.path.join(os.getcwd(),base)], - [0, "echo 'EMPTY' >>./INSTALL", os.path.join(os.getcwd(),base)], - [0, "echo 'EMPTY' >>./NEWS", os.path.join(os.getcwd(),base)], - [0, "aclocal", os.path.join(os.getcwd(),base)], - [0, "automake" ,os.path.join(os.getcwd(), base )], - [0,"./configure --prefix=%s --enable-freeimage=yes --disable-samples --without-ogre-renderer --includedir=%s/include" %(PREFIX,PREFIX) ,os.path.join(os.getcwd(), base )], + [0, "patch -s -N -i ../python-ogre/patch/cegui.patch -p0", os.path.join(os.getcwd(),base)], + [0, "echo 'EMPTY' >>./INSTALL", os.path.join(os.getcwd(),base)], + [0, "echo 'EMPTY' >>./NEWS", os.path.join(os.getcwd(),base)], + [0, "aclocal", os.path.join(os.getcwd(),base)], + [0, "automake" ,os.path.join(os.getcwd(), base )], + [0,"./configure --prefix=%s --enable-freeimage=yes --disable-samples --without-ogre-renderer --includedir=%s/include" %(PREFIX,PREFIX) ,os.path.join(os.getcwd(), base )], [0,'make', os.path.join(os.getcwd(), base )], - [0,'make install', os.path.join(os.getcwd(), base )] + [0,'make install', os.path.join(os.getcwd(), base )] ] include_dirs = [Config.PATH_Boost @@ -719,16 +719,16 @@ CheckIncludes = ['boost/python.hpp', 'ode/ode.h'] source = [ ["wget", "http://prdownloads.sourceforge.net/opende/ode-src-0.9.zip",downloadPath] - ] + ] baseDir = os.path.join(os.getcwd(),"ode-0.9") - buildCmds = [ - [0, "unzip -q -o "+ os.path.join(downloadPath,"ode-src-0.9.zip"), ''], - [0, "chmod +x autogen.sh", baseDir], - [0, "./autogen.sh", baseDir], - [0, "./configure --prefix=%s --includedir=%s/include" %(PREFIX, PREFIX), baseDir], - [0, "make", baseDir], - [0, "make install", baseDir] - + buildCmds = [ + [0, "unzip -q -o "+ os.path.join(downloadPath,"ode-src-0.9.zip"), ''], + [0, "chmod +x autogen.sh", baseDir], + [0, "./autogen.sh", baseDir], + [0, "./configure --prefix=%s --includedir=%s/include" %(PREFIX, PREFIX), baseDir], + [0, "make", baseDir], + [0, "make install", baseDir] + ] class opcode: active = True @@ -790,16 +790,16 @@ ] source = [ [cvs, " -d :pserver:ano...@cv...:/cvsroot/ogre co -P "+base, os.getcwd()] - ] + ] baseDir = os.path.join(os.getcwd(), base ) - buildCmds = [ - [0, "patch -s -N -i ../../python-ogre/patch/ogreode.patch -p0", baseDir], - [0, "chmod +x autogen.sh", baseDir], - [0, "./autogen.sh", baseDir], - [0, "./configure --prefix=%s" % PREFIX, baseDir], - [0, "make", baseDir], - [0, "make install", baseDir], - ] + buildCmds = [ + [0, "patch -s -N -i ../../python-ogre/patch/ogreode.patch -p0", baseDir], + [0, "chmod +x autogen.sh", baseDir], + [0, "./autogen.sh", baseDir], + [0, "./configure --prefix=%s" % PREFIX, baseDir], + [0, "make", baseDir], + [0, "make install", baseDir], + ] libs=[Config.LIB_Boost, 'OgreMain', 'ode', 'OgreOde_Core', 'OgreOde_Prefab', 'OgreOde_Loader' ] CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19' @@ -1075,16 +1075,16 @@ ["wget", "http://www.openal.org/openal_webstf/downloads/openal-0.0.8.tar.gz",downloadPath], ["wget", "http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz",downloadPath], ["wget", "http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz",downloadPath], - ] - buildCmds = [ - [0, "tar zxf " + os.path.join(downloadPath, "openal-0.0.8.tar.gz"), ''], - [0, "tar zxf " + os.path.join(downloadPath, "libogg-1.1.3.tar.gz"), ''], - [0, "tar zxf " + os.path.join(downloadPath, "libvorbis-1.2.0.tar.gz"), ''], - [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libogg-1.1.3")], - [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libvorbis-1.2.0")], - [0, "aclocal\n./autogen.sh", os.path.join(os.getcwd(),"openal-0.0.8")], - [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "openal-0.0.8")] - ] + ] + buildCmds = [ + [0, "tar zxf " + os.path.join(downloadPath, "openal-0.0.8.tar.gz"), ''], + [0, "tar zxf " + os.path.join(downloadPath, "libogg-1.1.3.tar.gz"), ''], + [0, "tar zxf " + os.path.join(downloadPath, "libvorbis-1.2.0.tar.gz"), ''], + [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libogg-1.1.3")], + [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libvorbis-1.2.0")], + [0, "aclocal\n./autogen.sh", os.path.join(os.getcwd(),"openal-0.0.8")], + [0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "openal-0.0.8")] + ] class ogrevideoffmpeg: @@ -1157,8 +1157,8 @@ active = True pythonModule = True version= "2.64" - name='bullet' - base = "bullet-2.64" + name='bullet' + base = "bullet-2.64" baseDir = os.path.join(os.getcwd(), base) parent = "ogre/physics" libs=[Config.LIB_Boost, 'LibBulletCollision', 'LibBulletDynamics'] @@ -1170,15 +1170,15 @@ include_dirs = [ Config.PATH_Boost , Config.PATH_INCLUDE_Bullet ] - source=[ - [wget, "http://downloads.sourceforge.net/bullet/"+base+".tgz", downloadPath] - ] - buildCmds = [ - [0, "tar zxf " +os.path.join(downloadPath, base)+".tgz", ''], - [0, "cmake . -DCMAKE_INSTALL_PREFIX:PATH=%s" % PREFIX, baseDir], - [0, "make", baseDir], - [0, "find . -name *.a -execdir cp {} %s/lib \;" % PREFIX, baseDir] - ] + source=[ + [wget, "http://downloads.sourceforge.net/bullet/"+base+".tgz", downloadPath] + ] + buildCmds = [ + [0, "tar zxf " +os.path.join(downloadPath, base)+".tgz", ''], + [0, "cmake . -DCMAKE_INSTALL_PREFIX:PATH=%s" % PREFIX, baseDir], + [0, "make", baseDir], + [0, "find . -name *.a -execdir cp {} %s/lib \;" % PREFIX, baseDir] + ] ModuleName = 'bullet' CheckIncludes = ['boost/python.hpp'] @@ -1296,6 +1296,24 @@ CheckIncludes=[] libs=[ Config.LIB_Boost, 'OgreMain' ] ModuleName="ofusion" + +class cadunetree: + active = True + pythonModule = True + version="0.6" + name='cadunetree' + parent="ogre/addons" + cflags = "" + include_dirs = [ Config.PATH_Boost, + Config.PATH_cadunetree + , Config.PATH_INCLUDE_Ogre + ] + lib_dirs = [Config.PATH_LIB_Boost, + Config.PATH_LIB_Ogre_OgreMain + ] + CheckIncludes=[] + libs=[ Config.LIB_Boost, 'OgreMain' ] + ModuleName="cadunetree" ############################################################################################ @@ -1332,6 +1350,7 @@ , 'watermesh' : watermesh , 'ofusion' : ofusion , 'particleuniverse' : particleuniverse + , 'cadunetree' : cadunetree } # @@ -1381,28 +1400,28 @@ if not key.startswith('_'): cls.__dict__[key] = value print "Set %s.%s to %s" % (name, key, value) - + ##CheckPaths( cls, name ) cls.root_dir = os.path.join( root_dir, 'code_generators', name ) cls.dir_name = name + '_' + str(cls.version) cls.generated_dir = os.path.join( generated_dir, cls.dir_name ) cls.cache_file = os.path.join( declarations_cache_dir, cls.dir_name + '_cache.xml' ) - - if isMac(): # On the mac the Ogre library is lined in with the -framework command in scons - try: - cls.libs.remove('OgreMain') - except: - pass - ## and we have a commond set of flags that I will set here... - cls.include_dirs.append(Config.MAC_SDK_INCLUDE) - if not hasattr(cls, 'CCFLAGS'): - cls.CCFLAGS='' - cls.CCFLAGS += Config.MAC_CCFLAGS - if not hasattr(cls, 'cflags'): - cls.cflags='' - cls.cflags += Config.MAC_cflags - + + if isMac(): # On the mac the Ogre library is lined in with the -framework command in scons + try: + cls.libs.remove('OgreMain') + except: + pass + ## and we have a commond set of flags that I will set here... + cls.include_dirs.append(Config.MAC_SDK_INCLUDE) + if not hasattr(cls, 'CCFLAGS'): + cls.CCFLAGS='' + cls.CCFLAGS += Config.MAC_CCFLAGS + if not hasattr(cls, 'cflags'): + cls.cflags='' + cls.cflags += Config.MAC_cflags + if not hasattr (cls, 'ModuleName'): cls.ModuleName = name[0].upper() + name[1:] if not hasattr (cls, 'PydName'): Added: trunk/python-ogre/packages_2.5/ogre/addons/cadunetree/__init__.py =================================================================== --- trunk/python-ogre/packages_2.5/ogre/addons/cadunetree/__init__.py (rev 0) +++ trunk/python-ogre/packages_2.5/ogre/addons/cadunetree/__init__.py 2008-01-08 02:44:54 UTC (rev 531) @@ -0,0 +1 @@ +from _cadunetree_ import * Modified: trunk/python-ogre/setup.py =================================================================== --- trunk/python-ogre/setup.py 2008-01-06 11:30:00 UTC (rev 530) +++ trunk/python-ogre/setup.py 2008-01-08 02:44:54 UTC (rev 531) @@ -71,7 +71,7 @@ 'ogre.addons.plib','ogre.gui.navi', 'ogre.addons.ogreforests', 'ogre.addons.et', 'ogre.addons.caelum', 'ogre.addons.noise', 'ogre.addons.watermesh', 'ogre.addons.ofusion', - 'ogre.addons.particleuniverse' ], + 'ogre.addons.particleuniverse', 'ogre.addons.cadunetree' ], "package_dir": {'': 'packages_'+ PythonVersionString }, "package_data": {'': ['*.pyd', '*.dll', '*.so']} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |