From: <me...@us...> - 2009-03-05 22:13:43
|
Revision: 2662 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2662&view=rev Author: melven2 Date: 2009-03-05 22:13:38 +0000 (Thu, 05 Mar 2009) Log Message: ----------- -added Visual Studio project files (you can still create them directly with cmake) -added some minor fixes (no real changes, I suppose it only prevents compiler warnings/errors) (thanks to Timm from the development team of Rastullahs Lockenpracht) Modified Paths: -------------- branches/ogrenewt/newton20/Mac/English.lproj/InfoPlist.strings branches/ogrenewt/newton20/inc/OgreNewt_BodyInAABBIterator.h branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h Added Paths: ----------- branches/ogrenewt/newton20/OgreNewt.sln branches/ogrenewt/newton20/OgreNewt.vcproj branches/ogrenewt/newton20/OgreNewt_vc2008.sln branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj Modified: branches/ogrenewt/newton20/Mac/English.lproj/InfoPlist.strings =================================================================== --- branches/ogrenewt/newton20/Mac/English.lproj/InfoPlist.strings 2009-03-05 19:19:06 UTC (rev 2661) +++ branches/ogrenewt/newton20/Mac/English.lproj/InfoPlist.strings 2009-03-05 22:13:38 UTC (rev 2662) @@ -1,3 +1,4 @@ -/* Localized versions of Info.plist keys */ - -CFBundleName = "OgreNewt"; +\xFF\xFE/ |
From: <me...@us...> - 2009-03-09 20:19:17
|
Revision: 2665 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2665&view=rev Author: melven2 Date: 2009-03-09 20:18:50 +0000 (Mon, 09 Mar 2009) Log Message: ----------- -some bugs fixed -added demos with cmake project files for linux; the demos seem to work (except the vehicle) Modified Paths: -------------- branches/ogrenewt/newton20/CMakeLists.txt branches/ogrenewt/newton20/Mac/English.lproj/InfoPlist.strings branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_BodyInAABBIterator.h branches/ogrenewt/newton20/inc/OgreNewt_ContactJoint.h branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp branches/ogrenewt/newton20/src/OgreNewt_Body.cpp branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp branches/ogrenewt/newton20/src/OgreNewt_Vehicle.cpp Added Paths: ----------- branches/ogrenewt/newton20/demos/ branches/ogrenewt/newton20/demos/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo01_TheBasics/ branches/ogrenewt/newton20/demos/Demo01_TheBasics/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo01_TheBasics/demo01.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/ branches/ogrenewt/newton20/demos/Demo02_Joints/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo02_Joints/demo02.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.h branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorMatCallback.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorMatCallback.h branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/demo03.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/ branches/ogrenewt/newton20/demos/Demo04_Raycasting/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo04_Raycasting/demo04.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.h branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/demo05.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/demo06.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo07_CustomJoints/MyCustomBallSocket.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/MyCustomBallSocket.h branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo07_CustomJoints/demo07.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h branches/ogrenewt/newton20/demos/Demo08_RagdollExample/demo08.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/zombie_model/ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/zombie_model/readme.txt branches/ogrenewt/newton20/demos/Demo08_RagdollExample/zombie_model/zombie.blend branches/ogrenewt/newton20/demos/Demo08_RagdollExample/zombie_model/zombie.jpg branches/ogrenewt/newton20/demos/Demo08_RagdollExample/zombie_model/zombie02.ms3d branches/ogrenewt/newton20/demos/bin/ branches/ogrenewt/newton20/demos/bin/plugins.cfg branches/ogrenewt/newton20/demos/bin/resources.cfg branches/ogrenewt/newton20/demos/cmake/ branches/ogrenewt/newton20/demos/cmake/FindCEGUI.cmake branches/ogrenewt/newton20/demos/cmake/FindCEGUIOGRE.cmake branches/ogrenewt/newton20/demos/cmake/FindOGRE.cmake branches/ogrenewt/newton20/demos/cmake/FindOIS.cmake branches/ogrenewt/newton20/demos/cmake/FindOgreNewt.cmake branches/ogrenewt/newton20/demos/media/ branches/ogrenewt/newton20/demos/media/GUI/ branches/ogrenewt/newton20/demos/media/GUI/fonts/ branches/ogrenewt/newton20/demos/media/GUI/fonts/Font.xsd branches/ogrenewt/newton20/demos/media/GUI/fonts/bluehigh.ttf branches/ogrenewt/newton20/demos/media/GUI/fonts/bluehighway-10.font branches/ogrenewt/newton20/demos/media/GUI/fonts/impact.font branches/ogrenewt/newton20/demos/media/GUI/fonts/impact.ttf branches/ogrenewt/newton20/demos/media/GUI/imagesets/ branches/ogrenewt/newton20/demos/media/GUI/imagesets/Imageset.xsd branches/ogrenewt/newton20/demos/media/GUI/imagesets/TaharezLook.imageset branches/ogrenewt/newton20/demos/media/GUI/imagesets/TaharezLook.tga branches/ogrenewt/newton20/demos/media/GUI/schemes/ branches/ogrenewt/newton20/demos/media/GUI/schemes/GUIScheme.xsd branches/ogrenewt/newton20/demos/media/GUI/schemes/TaharezLook.looknfeel branches/ogrenewt/newton20/demos/media/GUI/schemes/TaharezLookSkin.scheme branches/ogrenewt/newton20/demos/media/GUI/schemes/TaharezLookWidgetAliases.scheme branches/ogrenewt/newton20/demos/media/materials/ branches/ogrenewt/newton20/demos/media/materials/scripts/ branches/ogrenewt/newton20/demos/media/materials/scripts/example.material branches/ogrenewt/newton20/demos/media/materials/scripts/zombie.material branches/ogrenewt/newton20/demos/media/materials/textures/ branches/ogrenewt/newton20/demos/media/materials/textures/BeachStones.jpg branches/ogrenewt/newton20/demos/media/materials/textures/BumpyMetal.jpg branches/ogrenewt/newton20/demos/media/materials/textures/ZOMBIE.JPG branches/ogrenewt/newton20/demos/media/materials/textures/conveyor.png branches/ogrenewt/newton20/demos/media/materials/textures/dirt01.jpg branches/ogrenewt/newton20/demos/media/materials/textures/rockwall.tga branches/ogrenewt/newton20/demos/media/models/ branches/ogrenewt/newton20/demos/media/models/ZOMBIE-Armature.skeleton branches/ogrenewt/newton20/demos/media/models/zombie.mesh branches/ogrenewt/newton20/demos/media/models/zombie_rag_hull.xml branches/ogrenewt/newton20/demos/media/models/zombie_rag_primitives.xml branches/ogrenewt/newton20/demos/media/ms3d/ branches/ogrenewt/newton20/demos/media/ms3d/simple_terrain.ms3d branches/ogrenewt/newton20/demos/media/packs/ branches/ogrenewt/newton20/demos/media/packs/OgreCore.zip branches/ogrenewt/newton20/demos/media/packs/cubemapsJS.zip branches/ogrenewt/newton20/demos/media/primitives/ branches/ogrenewt/newton20/demos/media/primitives/box.mesh branches/ogrenewt/newton20/demos/media/primitives/cap_cap.mesh branches/ogrenewt/newton20/demos/media/primitives/cap_mid.mesh branches/ogrenewt/newton20/demos/media/primitives/cone.mesh branches/ogrenewt/newton20/demos/media/primitives/cylinder.mesh branches/ogrenewt/newton20/demos/media/primitives/ellipsoid.mesh branches/ogrenewt/newton20/demos/media/primitives/simple_terrain.mesh branches/ogrenewt/newton20/demos/media/primitives/wheel.mesh branches/ogrenewt/newton20/demos/tinyxml/ branches/ogrenewt/newton20/demos/tinyxml/tinystr.cpp branches/ogrenewt/newton20/demos/tinyxml/tinystr.h branches/ogrenewt/newton20/demos/tinyxml/tinyxml.cpp branches/ogrenewt/newton20/demos/tinyxml/tinyxml.h branches/ogrenewt/newton20/demos/tinyxml/tinyxmlerror.cpp branches/ogrenewt/newton20/demos/tinyxml/tinyxmlparser.cpp Modified: branches/ogrenewt/newton20/CMakeLists.txt =================================================================== --- branches/ogrenewt/newton20/CMakeLists.txt 2009-03-09 14:23:51 UTC (rev 2664) +++ branches/ogrenewt/newton20/CMakeLists.txt 2009-03-09 20:18:50 UTC (rev 2665) @@ -70,6 +70,7 @@ SET(OgreNewt_LIB_SRCS src/OgreNewt_BasicJoints.cpp +src/OgreNewt_BasicFrameListener.cpp src/OgreNewt_Body.cpp src/OgreNewt_BodyInAABBIterator.cpp src/OgreNewt_Collision.cpp Modified: branches/ogrenewt/newton20/Mac/English.lproj/InfoPlist.strings =================================================================== --- branches/ogrenewt/newton20/Mac/English.lproj/InfoPlist.strings 2009-03-09 14:23:51 UTC (rev 2664) +++ branches/ogrenewt/newton20/Mac/English.lproj/InfoPlist.strings 2009-03-09 20:18:50 UTC (rev 2665) @@ -1,4 +1,3 @@ -\xFF\xFE/ |
From: <me...@us...> - 2009-03-17 13:41:54
|
Revision: 2666 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2666&view=rev Author: melven2 Date: 2009-03-17 13:41:37 +0000 (Tue, 17 Mar 2009) Log Message: ----------- -fixed some vc project files -fixed typo (was World::CollisionUpdate() instead of World::collisionUpdate() ) -only include necessary ogre-headers -replaced tabs by whitespaces Modified Paths: -------------- branches/ogrenewt/newton20/Mac/OgreNewt.xcodeproj/project.pbxproj branches/ogrenewt/newton20/OgreNewt.vcproj branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h branches/ogrenewt/newton20/inc/OgreNewt_Body.h branches/ogrenewt/newton20/inc/OgreNewt_BodyInAABBIterator.h branches/ogrenewt/newton20/inc/OgreNewt_Collision.h branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h branches/ogrenewt/newton20/inc/OgreNewt_ContactCallback.h branches/ogrenewt/newton20/inc/OgreNewt_ContactJoint.h branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h branches/ogrenewt/newton20/inc/OgreNewt_Joint.h branches/ogrenewt/newton20/inc/OgreNewt_MaterialID.h branches/ogrenewt/newton20/inc/OgreNewt_MaterialPair.h branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h branches/ogrenewt/newton20/inc/OgreNewt_Tools.h branches/ogrenewt/newton20/inc/OgreNewt_Vehicle.h branches/ogrenewt/newton20/inc/OgreNewt_World.h branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp branches/ogrenewt/newton20/src/OgreNewt_Body.cpp branches/ogrenewt/newton20/src/OgreNewt_Collision.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionSerializer.cpp branches/ogrenewt/newton20/src/OgreNewt_ContactJoint.cpp branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp branches/ogrenewt/newton20/src/OgreNewt_Joint.cpp branches/ogrenewt/newton20/src/OgreNewt_MaterialID.cpp branches/ogrenewt/newton20/src/OgreNewt_MaterialPair.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp branches/ogrenewt/newton20/src/OgreNewt_Tools.cpp branches/ogrenewt/newton20/src/OgreNewt_Vehicle.cpp branches/ogrenewt/newton20/src/OgreNewt_World.cpp Modified: branches/ogrenewt/newton20/Mac/OgreNewt.xcodeproj/project.pbxproj =================================================================== --- branches/ogrenewt/newton20/Mac/OgreNewt.xcodeproj/project.pbxproj 2009-03-09 20:18:50 UTC (rev 2665) +++ branches/ogrenewt/newton20/Mac/OgreNewt.xcodeproj/project.pbxproj 2009-03-17 13:41:37 UTC (rev 2666) @@ -9,25 +9,25 @@ /* Begin PBXBuildFile section */ 444EA9A30BD0D33B00C6D4A0 /* Ogre.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 444EA9A20BD0D33B00C6D4A0 /* Ogre.framework */; }; 444EA9A70BD0D35800C6D4A0 /* libnewton32.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 444EA9A60BD0D35800C6D4A0 /* libnewton32.a */; }; - 487D45C30F47388600D1D69F /* OgreNewt.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45AF0F47388600D1D69F /* OgreNewt.h */; }; - 487D45C50F47388600D1D69F /* OgreNewt_BasicJoints.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B10F47388600D1D69F /* OgreNewt_BasicJoints.h */; }; - 487D45C60F47388600D1D69F /* OgreNewt_Body.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B20F47388600D1D69F /* OgreNewt_Body.h */; }; - 487D45C70F47388600D1D69F /* OgreNewt_BodyInAABBIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B30F47388600D1D69F /* OgreNewt_BodyInAABBIterator.h */; }; - 487D45C80F47388600D1D69F /* OgreNewt_Collision.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B40F47388600D1D69F /* OgreNewt_Collision.h */; }; - 487D45C90F47388600D1D69F /* OgreNewt_CollisionPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B50F47388600D1D69F /* OgreNewt_CollisionPrimitives.h */; }; - 487D45CA0F47388600D1D69F /* OgreNewt_CollisionSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B60F47388600D1D69F /* OgreNewt_CollisionSerializer.h */; }; - 487D45CB0F47388600D1D69F /* OgreNewt_ContactCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B70F47388600D1D69F /* OgreNewt_ContactCallback.h */; }; - 487D45CC0F47388600D1D69F /* OgreNewt_ContactJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B80F47388600D1D69F /* OgreNewt_ContactJoint.h */; }; - 487D45CD0F47388600D1D69F /* OgreNewt_Debugger.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B90F47388600D1D69F /* OgreNewt_Debugger.h */; }; - 487D45CE0F47388600D1D69F /* OgreNewt_Joint.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BA0F47388600D1D69F /* OgreNewt_Joint.h */; }; - 487D45CF0F47388600D1D69F /* OgreNewt_MaterialID.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BB0F47388600D1D69F /* OgreNewt_MaterialID.h */; }; - 487D45D00F47388600D1D69F /* OgreNewt_MaterialPair.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BC0F47388600D1D69F /* OgreNewt_MaterialPair.h */; }; - 487D45D10F47388600D1D69F /* OgreNewt_PlayerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BD0F47388600D1D69F /* OgreNewt_PlayerController.h */; }; - 487D45D20F47388600D1D69F /* OgreNewt_Prerequisites.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BE0F47388600D1D69F /* OgreNewt_Prerequisites.h */; }; - 487D45D30F47388600D1D69F /* OgreNewt_RayCast.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BF0F47388600D1D69F /* OgreNewt_RayCast.h */; }; - 487D45D40F47388600D1D69F /* OgreNewt_Tools.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45C00F47388600D1D69F /* OgreNewt_Tools.h */; }; - 487D45D50F47388600D1D69F /* OgreNewt_Vehicle.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45C10F47388600D1D69F /* OgreNewt_Vehicle.h */; }; - 487D45D60F47388600D1D69F /* OgreNewt_World.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45C20F47388600D1D69F /* OgreNewt_World.h */; }; + 483369830F65C26A005979BF /* OgreNewt.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45AF0F47388600D1D69F /* OgreNewt.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369840F65C26A005979BF /* OgreNewt_BasicJoints.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B10F47388600D1D69F /* OgreNewt_BasicJoints.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369850F65C26A005979BF /* OgreNewt_Body.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B20F47388600D1D69F /* OgreNewt_Body.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369860F65C26A005979BF /* OgreNewt_BodyInAABBIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B30F47388600D1D69F /* OgreNewt_BodyInAABBIterator.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369870F65C26A005979BF /* OgreNewt_Collision.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B40F47388600D1D69F /* OgreNewt_Collision.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369880F65C26A005979BF /* OgreNewt_CollisionPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B50F47388600D1D69F /* OgreNewt_CollisionPrimitives.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369890F65C26A005979BF /* OgreNewt_CollisionSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B60F47388600D1D69F /* OgreNewt_CollisionSerializer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4833698A0F65C26A005979BF /* OgreNewt_ContactCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B70F47388600D1D69F /* OgreNewt_ContactCallback.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4833698B0F65C26A005979BF /* OgreNewt_ContactJoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B80F47388600D1D69F /* OgreNewt_ContactJoint.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4833698C0F65C26A005979BF /* OgreNewt_Debugger.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45B90F47388600D1D69F /* OgreNewt_Debugger.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4833698D0F65C26A005979BF /* OgreNewt_Joint.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BA0F47388600D1D69F /* OgreNewt_Joint.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4833698E0F65C26A005979BF /* OgreNewt_MaterialID.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BB0F47388600D1D69F /* OgreNewt_MaterialID.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4833698F0F65C26A005979BF /* OgreNewt_MaterialPair.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BC0F47388600D1D69F /* OgreNewt_MaterialPair.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369900F65C26A005979BF /* OgreNewt_PlayerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BD0F47388600D1D69F /* OgreNewt_PlayerController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369910F65C26A005979BF /* OgreNewt_Prerequisites.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BE0F47388600D1D69F /* OgreNewt_Prerequisites.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369920F65C26A005979BF /* OgreNewt_RayCast.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45BF0F47388600D1D69F /* OgreNewt_RayCast.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369930F65C26A005979BF /* OgreNewt_Tools.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45C00F47388600D1D69F /* OgreNewt_Tools.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369940F65C26A005979BF /* OgreNewt_Vehicle.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45C10F47388600D1D69F /* OgreNewt_Vehicle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 483369950F65C26A005979BF /* OgreNewt_World.h in Headers */ = {isa = PBXBuildFile; fileRef = 487D45C20F47388600D1D69F /* OgreNewt_World.h */; settings = {ATTRIBUTES = (Public, ); }; }; 487D45EA0F47389A00D1D69F /* OgreNewt_BasicJoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 487D45D80F47389A00D1D69F /* OgreNewt_BasicJoints.cpp */; }; 487D45EB0F47389A00D1D69F /* OgreNewt_Body.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 487D45D90F47389A00D1D69F /* OgreNewt_Body.cpp */; }; 487D45EC0F47389A00D1D69F /* OgreNewt_BodyInAABBIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 487D45DA0F47389A00D1D69F /* OgreNewt_BodyInAABBIterator.cpp */; }; @@ -49,6 +49,18 @@ 8D07F2C00486CC7A007CD1D0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + 4833699F0F65C516005979BF /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 444EA9A20BD0D33B00C6D4A0 /* Ogre.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogre.framework; path = /Library/Frameworks/Ogre.framework; sourceTree = "<absolute>"; }; @@ -198,25 +210,25 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 487D45C30F47388600D1D69F /* OgreNewt.h in Headers */, - 487D45C50F47388600D1D69F /* OgreNewt_BasicJoints.h in Headers */, - 487D45C60F47388600D1D69F /* OgreNewt_Body.h in Headers */, - 487D45C70F47388600D1D69F /* OgreNewt_BodyInAABBIterator.h in Headers */, - 487D45C80F47388600D1D69F /* OgreNewt_Collision.h in Headers */, - 487D45C90F47388600D1D69F /* OgreNewt_CollisionPrimitives.h in Headers */, - 487D45CA0F47388600D1D69F /* OgreNewt_CollisionSerializer.h in Headers */, - 487D45CB0F47388600D1D69F /* OgreNewt_ContactCallback.h in Headers */, - 487D45CC0F47388600D1D69F /* OgreNewt_ContactJoint.h in Headers */, - 487D45CD0F47388600D1D69F /* OgreNewt_Debugger.h in Headers */, - 487D45CE0F47388600D1D69F /* OgreNewt_Joint.h in Headers */, - 487D45CF0F47388600D1D69F /* OgreNewt_MaterialID.h in Headers */, - 487D45D00F47388600D1D69F /* OgreNewt_MaterialPair.h in Headers */, - 487D45D10F47388600D1D69F /* OgreNewt_PlayerController.h in Headers */, - 487D45D20F47388600D1D69F /* OgreNewt_Prerequisites.h in Headers */, - 487D45D30F47388600D1D69F /* OgreNewt_RayCast.h in Headers */, - 487D45D40F47388600D1D69F /* OgreNewt_Tools.h in Headers */, - 487D45D50F47388600D1D69F /* OgreNewt_Vehicle.h in Headers */, - 487D45D60F47388600D1D69F /* OgreNewt_World.h in Headers */, + 483369830F65C26A005979BF /* OgreNewt.h in Headers */, + 483369840F65C26A005979BF /* OgreNewt_BasicJoints.h in Headers */, + 483369850F65C26A005979BF /* OgreNewt_Body.h in Headers */, + 483369860F65C26A005979BF /* OgreNewt_BodyInAABBIterator.h in Headers */, + 483369870F65C26A005979BF /* OgreNewt_Collision.h in Headers */, + 483369880F65C26A005979BF /* OgreNewt_CollisionPrimitives.h in Headers */, + 483369890F65C26A005979BF /* OgreNewt_CollisionSerializer.h in Headers */, + 4833698A0F65C26A005979BF /* OgreNewt_ContactCallback.h in Headers */, + 4833698B0F65C26A005979BF /* OgreNewt_ContactJoint.h in Headers */, + 4833698C0F65C26A005979BF /* OgreNewt_Debugger.h in Headers */, + 4833698D0F65C26A005979BF /* OgreNewt_Joint.h in Headers */, + 4833698E0F65C26A005979BF /* OgreNewt_MaterialID.h in Headers */, + 4833698F0F65C26A005979BF /* OgreNewt_MaterialPair.h in Headers */, + 483369900F65C26A005979BF /* OgreNewt_PlayerController.h in Headers */, + 483369910F65C26A005979BF /* OgreNewt_Prerequisites.h in Headers */, + 483369920F65C26A005979BF /* OgreNewt_RayCast.h in Headers */, + 483369930F65C26A005979BF /* OgreNewt_Tools.h in Headers */, + 483369940F65C26A005979BF /* OgreNewt_Vehicle.h in Headers */, + 483369950F65C26A005979BF /* OgreNewt_World.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -232,6 +244,7 @@ 8D07F2C10486CC7A007CD1D0 /* Sources */, 8D07F2C30486CC7A007CD1D0 /* Frameworks */, 8D07F2C50486CC7A007CD1D0 /* Rez */, + 4833699F0F65C516005979BF /* CopyFiles */, ); buildRules = ( ); Modified: branches/ogrenewt/newton20/OgreNewt.vcproj =================================================================== --- branches/ogrenewt/newton20/OgreNewt.vcproj 2009-03-09 20:18:50 UTC (rev 2665) +++ branches/ogrenewt/newton20/OgreNewt.vcproj 2009-03-17 13:41:37 UTC (rev 2666) @@ -55,6 +55,7 @@ AdditionalIncludeDirectories=".\inc;..\NewtonSDK\sdk;..\ogrenew\OgreMain\include;..\boost\include" PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC" ExceptionHandling="1" + RuntimeLibrary="3" RuntimeTypeInfo="true" AssemblerListingLocation="Debug" ObjectFile="$(IntDir)\" Modified: branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj =================================================================== --- branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj 2009-03-09 20:18:50 UTC (rev 2665) +++ branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj 2009-03-17 13:41:37 UTC (rev 2666) @@ -53,9 +53,11 @@ <Tool Name="VCCLCompilerTool" AdditionalOptions=" /Zm1000" + Optimization="0" AdditionalIncludeDirectories=".\inc;..\NewtonSDK\sdk;..\ogrenew\OgreMain\include;..\boost\include" PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC" ExceptionHandling="1" + RuntimeLibrary="3" RuntimeTypeInfo="true" AssemblerListingLocation="Debug" ObjectFile="$(IntDir)\" Modified: branches/ogrenewt/newton20/inc/OgreNewt.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt.h 2009-03-09 20:18:50 UTC (rev 2665) +++ branches/ogrenewt/newton20/inc/OgreNewt.h 2009-03-17 13:41:37 UTC (rev 2666) @@ -1,18 +1,19 @@ /* - OgreNewt library + OgreNewt library - connects Ogre with the Newton Game Dynamics physics library + connects Ogre with the Newton Game Dynamics physics library - by Walaber (http://walaber.com) + by Walaber (http://walaber.com) + some changes by melven - main header file. + main header file. - current version: 2.00 ( I only raised the version number to indicate that this is for Newton2.0! ) + current version: 2.00 ( I only raised the version number to indicate that this is for Newton2.0! ) - Newton version: 2.0 beta (31.01.2009) + Newton version: 2.0 beta (31.01.2009) - Ogre version: Shoggoth (1.6.x) + Ogre version: Shoggoth (1.6.x) */ @@ -42,16 +43,16 @@ /*! \mainpage OgreNewt Library version 2.00 - \section into_sec Introduction + \section into_sec Introduction - OgreNewt is an OOP wrapper for integrating the Newton Dynamics Physics SDK with OGRE. + OgreNewt is an OOP wrapper for integrating the Newton Dynamics Physics SDK with OGRE. \section problems Problems and missing features in this version Problems and missing features in this version - PlayerController not finished - the convexcast seems to have difficulties with more than one contact (I've segfault when debugging it with the OgreNewt::Debugger...) - I added a hack, it only creates one contact at the maximum at the moment! + I added a hack, it only creates one contact at the maximum at the moment! <-- this is probably due to an error in newton - this library supports the newton functions for multithreading but there are several functions/classes in this library itself, that are not thread safe (I don't need multiple threads) especially the world-updates are not threadsafe in ogre (see newton forum, someone posted a solution there!) @@ -60,12 +61,12 @@ - I didn't test several features: - vehicle - joints - - collsions-serializer + - collision-serializer - treecollision raycastcallback - shared pointers for collisions (atm CollisionPtr := Collision*, but should be Ogre::SharedPtr<Collision>, but there was some problem...) - \section new New in this version + \section new New in this version New in this version - this version uses cmake > 2.6.2! @@ -86,77 +87,77 @@ - a lot of minor changes and functions added and renamed - previous changes... - - updated to Newton version 2.0!! Many big improvements and changes to the library, and OgreNewt now supports it. - - several interface-breaking changes: - - updated to support multithreading support now native to Newton. - - MomentOfInertia namespace and helper functions removed entirely. Newton can now calculate inertia and center of - mass automatically, use ConvexCollision::calculateInertialMatrix, and multiply by objects Mass. - - Body::attachToNode has been renamed to attachNode, better implying the relationship between the body and the Ogre::Node. - - BodyIterator class has been upgraded to use boost::function, allowing the same callback flexibility as other callbacks. + previous changes... + - updated to Newton version 2.0!! Many big improvements and changes to the library, and OgreNewt now supports it. + - several interface-breaking changes: + - updated to support multithreading support now native to Newton. + - MomentOfInertia namespace and helper functions removed entirely. Newton can now calculate inertia and center of + mass automatically, use ConvexCollision::calculateInertialMatrix, and multiply by objects Mass. + - Body::attachToNode has been renamed to attachNode, better implying the relationship between the body and the Ogre::Node. + - BodyIterator class has been upgraded to use boost::function, allowing the same callback flexibility as other callbacks. - - bug fix - fixed problem with TreeCollisionSceneParser that wasn't adjusting to different scales properly. - - optimization - fixed several classes to only write debug data to the LOG when compiled in DEBUG mode: - - Custom2DJonit - - BasicFrameListener - - added the concept of "face-winding" to all TreeCollision classes. should not cause any breaking changes to code, but allows more flexibility to change the "direction" of a face in treecollisions. - - OgreNewt and it's demos are now fully compatible with Ogre 1.4.x (Eihort). - - Addition of script files for compiling under linux (Scons) - - slight modification to the ContactCallback class to allow access to Newton structures from the outside. - - some cosmetic changes to make the wrapper compile more easily under Linux and other non-windows platforms. - - updated to work with the release version of Ogre dagon (1.2) - - updated to work with version 1.53 of Newton - - raycast now has an optional pre-filter to ignore specific bodies from the raycast. - - various other clean-up! - - moved callback system to much more OOP-friendly "boost::function" system. callbacks can now be instance-specific member functions! - - several other small fixes to project files, etc. - - automatic convex hull generation system added to supplementary ragdoll class (see demo08). - - documentation updated. - - updated to Newton version 1.5 - - added this documentation! - - added buoyancy functionality. - - New Buoyancy demo. - - New Ragdoll demo, using a seperate class to implement ragdoll functionality. - - added basic classes for CustomJoints, and a simple demo showing how they work. - - added several prebuilt custom joints, including pulleys and gears, and a general 2D joint. - - added calculateInertialMatrix to ConvexCollision class. - - added set/getCenterOfMass to Body class - - changed angle-related functions in BasicJoint classes to use Ogre::Radian instead of Ogre::Real. - - added ConvexModifierCollision class, which allows for arbitrarily scaled collision primitives. - - added several low-level collision functions, see the CollisionTools namespace. - - fixed errors causing run-time crash on Slider and Universal joints. - - added LeaveWorldCallback functionality to World class. + - bug fix - fixed problem with TreeCollisionSceneParser that wasn't adjusting to different scales properly. + - optimization - fixed several classes to only write debug data to the LOG when compiled in DEBUG mode: + - Custom2DJonit + - BasicFrameListener + - added the concept of "face-winding" to all TreeCollision classes. should not cause any breaking changes to code, but allows more flexibility to change the "direction" of a face in treecollisions. + - OgreNewt and it's demos are now fully compatible with Ogre 1.4.x (Eihort). + - Addition of script files for compiling under linux (Scons) + - slight modification to the ContactCallback class to allow access to Newton structures from the outside. + - some cosmetic changes to make the wrapper compile more easily under Linux and other non-windows platforms. + - updated to work with the release version of Ogre dagon (1.2) + - updated to work with version 1.53 of Newton + - raycast now has an optional pre-filter to ignore specific bodies from the raycast. + - various other clean-up! + - moved callback system to much more OOP-friendly "boost::function" system. callbacks can now be instance-specific member functions! + - several other small fixes to project files, etc. + - automatic convex hull generation system added to supplementary ragdoll class (see demo08). + - documentation updated. + - updated to Newton version 1.5 + - added this documentation! + - added buoyancy functionality. + - New Buoyancy demo. + - New Ragdoll demo, using a seperate class to implement ragdoll functionality. + - added basic classes for CustomJoints, and a simple demo showing how they work. + - added several prebuilt custom joints, including pulleys and gears, and a general 2D joint. + - added calculateInertialMatrix to ConvexCollision class. + - added set/getCenterOfMass to Body class + - changed angle-related functions in BasicJoint classes to use Ogre::Radian instead of Ogre::Real. + - added ConvexModifierCollision class, which allows for arbitrarily scaled collision primitives. + - added several low-level collision functions, see the CollisionTools namespace. + - fixed errors causing run-time crash on Slider and Universal joints. + - added LeaveWorldCallback functionality to World class. - \section install Installation + \section install Installation - OgreNewt comes with a project for MSVC++ 7.1 and MSVC++ 8.0 (2005). unfortunately I have no other IDE's or compilers setup on my system, so I - cannot provide any other projects. the MSVC solution should build out of the box, assuming you take a few things into - consideration. + OgreNewt comes with a project for MSVC++ 7.1 and MSVC++ 8.0 (2005). unfortunately I have no other IDE's or compilers setup on my system, so I + cannot provide any other projects. the MSVC solution should build out of the box, assuming you take a few things into + consideration. - unzip this in the ogreaddons directory alongside your "ogrenew" directory. to compile correctly, it also assumes you have the Newton SDK installed in another - directory alongside this one called "NewtonSDK". + unzip this in the ogreaddons directory alongside your "ogrenew" directory. to compile correctly, it also assumes you have the Newton SDK installed in another + directory alongside this one called "NewtonSDK". - for example something like this: + for example something like this: - - c:/programming/Ogre/ogrenew <- ogre installation - - c:/programming/Ogre/ogreaddons/OgreNewt <- OgreNewt main directory. - - c:/programming/NewtonSDK <- Newton SDK. - - c:/programming/tinyxml <- tinyxml library (needed for ragdoll demo only) + - c:/programming/Ogre/ogrenew <- ogre installation + - c:/programming/Ogre/ogreaddons/OgreNewt <- OgreNewt main directory. + - c:/programming/NewtonSDK <- Newton SDK. + - c:/programming/tinyxml <- tinyxml library (needed for ragdoll demo only) - \section compiling Compiling + \section compiling Compiling - OgreNewt compiles by default to a static library for linking to your project. However you can also compile OgreNewt into a dynamic DLL on the - Windows platform by using the Debug_DLL and Release_DLL solution build configurations in the MSVC solutions. + OgreNewt compiles by default to a static library for linking to your project. However you can also compile OgreNewt into a dynamic DLL on the + Windows platform by using the Debug_DLL and Release_DLL solution build configurations in the MSVC solutions. - \section license License + \section license License - OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. + OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. - well, that's about it! - have fun! + well, that's about it! + have fun! - -walaber + -walaber */ Modified: branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h 2009-03-09 20:18:50 UTC (rev 2665) +++ branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h 2009-03-17 13:41:37 UTC (rev 2666) @@ -1,23 +1,24 @@ /* - OgreNewt Library + OgreNewt Library - Ogre implementation of Newton Game Dynamics SDK + Ogre implementation of Newton Game Dynamics SDK - OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. + OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. - by Walaber + by Walaber + some changes by melven - "BasicFrameListener" + "BasicFrameListener" - this is a simple Ogre FrameListener that will update the Newton world you supply it - with, at a desired framerate, using a simple time-slicer. this means the simulation - should run at the same speed regardless of the actual framerate. set the update_framerate - to a higher value for a more accurate simluation. + this is a simple Ogre FrameListener that will update the Newton world you supply it + with, at a desired framerate, using a simple time-slicer. this means the simulation + should run at the same speed regardless of the actual framerate. set the update_framerate + to a higher value for a more accurate simluation. - NOTE: update_framerate must be a value between [60,600] + NOTE: update_framerate must be a value between [60,600] */ #ifndef _INCLUDE_OGRENEWT_BASICFRAMELISTENER @@ -25,7 +26,7 @@ #include "OgreNewt_Prerequisites.h" -// using OIS (an Ogre 1.4.x dependency) for input. +// using OIS (an Ogre dependency) for input. #define OIS_DYNAMIC_LIB #include <OIS/OIS.h> @@ -37,34 +38,34 @@ //! simple frame listener to update the physics. /*! - updates the Newton World at the specified rate, with time-slicing, and - also implements a simple debug view, press F3 to render Newto world with lines in 3D view. + updates the Newton World at the specified rate, with time-slicing, and + also implements a simple debug view, press F3 to render Newto world with lines in 3D view. */ - class _OgreNewtExport BasicFrameListener : public Ogre::FrameListener + class _OgreNewtExport BasicFrameListener : public Ogre::FrameListener { protected: - OgreNewt::World* m_World; + OgreNewt::World* m_World; - int desired_framerate; - Ogre::Real m_update, m_elapsed; + int desired_framerate; + Ogre::Real m_update, m_elapsed; public: - BasicFrameListener(Ogre::RenderWindow* win, Ogre::SceneManager* mgr, OgreNewt::World* W, int update_framerate = 60); - ~BasicFrameListener(void); + BasicFrameListener(Ogre::RenderWindow* win, Ogre::SceneManager* mgr, OgreNewt::World* W, int update_framerate = 60); + ~BasicFrameListener(void); - bool frameStarted(const Ogre::FrameEvent &evt); + bool frameStarted(const Ogre::FrameEvent &evt); private: - OIS::InputManager* mInputManager; - OIS::Keyboard* mKeyboard; + OIS::InputManager* mInputManager; + OIS::Keyboard* mKeyboard; }; -} // end NAMESPACE OgreNewt +} // end NAMESPACE OgreNewt #endif /* _INCLUDE_OGRENEWT_BASICFRAMELISTENER */ Modified: branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h 2009-03-09 20:18:50 UTC (rev 2665) +++ branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h 2009-03-17 13:41:37 UTC (rev 2666) @@ -1,11 +1,12 @@ /* - OgreNewt Library + OgreNewt Library - Ogre implementation of Newton Game Dynamics SDK + Ogre implementation of Newton Game Dynamics SDK - OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. + OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. - by Walaber + by Walaber + some changes by melven */ #ifndef _INCLUDE_OGRENEWT_BASICJOINTS @@ -25,49 +26,49 @@ //! Ball and Socket joint. /*! - simple ball and socket joint, with limits. + simple ball and socket joint, with limits. */ class _OgreNewtExport BallAndSocket : public Joint { public: - //! custom ballandsocket callback function. - /*! - use the setCallback() function to assign your custom function to the joint. - */ - typedef void(*BallAndSocketCallback)( BallAndSocket* me, Ogre::Real timestep ); + //! custom ballandsocket callback function. + /*! + use the setCallback() function to assign your custom function to the joint. + */ + typedef void(*BallAndSocketCallback)( BallAndSocket* me, Ogre::Real timestep ); - //! constructor - /*! - \param world pointer to the OgreNewt::World - \param child pointer to the child rigid body. - \param parent pointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint) - \param pos position of the joint in global space - */ - BallAndSocket( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos ); - - //! destructor. - ~BallAndSocket(); + //! constructor + /*! + \param world pointer to the OgreNewt::World + \param child pointer to the child rigid body. + \param parent pointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint) + \param pos position of the joint in global space + */ + BallAndSocket( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos ); + + //! destructor. + ~BallAndSocket(); - //! retrieve the current joint angle - Ogre::Vector3 getJointAngle() const; + //! retrieve the current joint angle + Ogre::Vector3 getJointAngle() const; - //! retrieve the current joint omega - Ogre::Vector3 getJointOmega() const; + //! retrieve the current joint omega + Ogre::Vector3 getJointOmega() const; - //! retrieve the current joint force. - /*! - This can be used to find the "stress" on the joint. you can do special effects like break the joint if the force exceedes some value, etc. - */ - Ogre::Vector3 getJointForce() const; + //! retrieve the current joint force. + /*! + This can be used to find the "stress" on the joint. you can do special effects like break the joint if the force exceedes some value, etc. + */ + Ogre::Vector3 getJointForce() const; - //! set limits for the joints rotation - /*! - \param pin pin direction in global space - \param maxCone max angle for "swing" (in radians) - \param maxTwist max angle for "twist" (in radians) - */ - void setLimits( const Ogre::Vector3& pin, Ogre::Radian maxCone, Ogre::Radian maxTwist ) const { NewtonBallSetConeLimits( m_joint, &pin.x, (float)maxCone.valueRadians(), (float)maxTwist.valueRadians() ); } + //! set limits for the joints rotation + /*! + \param pin pin direction in global space + \param maxCone max angle for "swing" (in radians) + \param maxTwist max angle for "twist" (in radians) + */ + void setLimits( const Ogre::Vector3& pin, Ogre::Radian maxCone, Ogre::Radian maxTwist ) const { NewtonBallSetConeLimits( m_joint, &pin.x, (float)maxCone.valueRadians(), (float)maxTwist.valueRadians() ); } //! set callback function void setCallback(BallAndSocketCallback *callback) {m_callback = callback;} @@ -84,423 +85,415 @@ //! hinge joint. /*! - simple hinge joint. implement motors/limits through a callback. + simple hinge joint. implement motors/limits through a callback. */ class _OgreNewtExport Hinge : public Joint { public: - //! custom hinge callback function. - /*! - use the setCallback() function to assign your custom function to the joint. - */ - typedef void(*HingeCallback)( Hinge* me ); + //! custom hinge callback function. + /*! + use the setCallback() function to assign your custom function to the joint. + */ + typedef void(*HingeCallback)( Hinge* me ); - //! constructor - /*! - \param world pointer to the OgreNewt::World - \param child pointer to the child rigid body. - \param parent pointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint) - \param pin direction of the joint pin in global space - */ - Hinge( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos, const Ogre::Vector3& pin ); + //! constructor + /*! + \param world pointer to the OgreNewt::World + \param child pointer to the child rigid body. + \param parent pointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint) + \param pin direction of the joint pin in global space + */ + Hinge( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos, const Ogre::Vector3& pin ); - //! destructor - ~Hinge(); + //! destructor + ~Hinge(); - //! retrieve the angle around the pin. - Ogre::Radian getJointAngle() const { return Ogre::Radian(NewtonHingeGetJointAngle( m_joint )); } + //! retrieve the angle around the pin. + Ogre::Radian getJointAngle() const { return Ogre::Radian(NewtonHingeGetJointAngle( m_joint )); } - //! retrieve the rotational velocity around the pin. - Ogre::Real getJointOmega() const { return (Ogre::Real)NewtonHingeGetJointOmega( m_joint ); } + //! retrieve the rotational velocity around the pin. + Ogre::Real getJointOmega() const { return (Ogre::Real)NewtonHingeGetJointOmega( m_joint ); } - //! get the force on the joint. - Ogre::Vector3 getJointForce() const; + //! get the force on the joint. + Ogre::Vector3 getJointForce() const; - //! set a custom callback for controlling this joint. - /*! - Joint callbacks allow you to make complex joint behavior such as limits or motors. just make a custom static function that - accepts a pointer to a OgreNewt::BasicJoints::Hinge as the single parameter. this function will be called automatically every - time you upate the World. - */ - void setCallback( HingeCallback callback ) { m_callback = callback; } + //! set a custom callback for controlling this joint. + /*! + Joint callbacks allow you to make complex joint behavior such as limits or motors. just make a custom static function that + accepts a pointer to a OgreNewt::BasicJoints::Hinge as the single parameter. this function will be called automatically every + time you upate the World. + */ + void setCallback( HingeCallback callback ) { m_callback = callback; } - ////////// CALLBACK COMMANDS /////////// - // the following commands are only valid from inside a hinge callback function + ////////// CALLBACK COMMANDS /////////// + // the following commands are only valid from inside a hinge callback function - //! set acceleration around the joint pin - /*! - This command is only valid when used inside a custom Hinge callback. - */ - void setCallbackAccel( Ogre::Real accel ); + //! set acceleration around the joint pin + /*! + This command is only valid when used inside a custom Hinge callback. + */ + void setCallbackAccel( Ogre::Real accel ); - //! set minimum joint friction. - /*! - This command is only valid when used inside a custom Hinge callback. - */ - void setCallbackFrictionMin( Ogre::Real min ); + //! set minimum joint friction. + /*! + This command is only valid when used inside a custom Hinge callback. + */ + void setCallbackFrictionMin( Ogre::Real min ); - //! set maximum joint friction - /*! - This command is only valid when used inside a custom Hinge callback. - */ - void setCallbackFrictionMax( Ogre::Real max ); + //! set maximum joint friction + /*! + This command is only valid when used inside a custom Hinge callback. + */ + void setCallbackFrictionMax( Ogre::Real max ); - //! get the current physics timestep. - /*! - This command is only valid when used inside a custom Hinge callback. - */ - Ogre::Real getCallbackTimestep() const; + //! get the current physics timestep. + /*! + This command is only valid when used inside a custom Hinge callback. + */ + Ogre::Real getCallbackTimestep() const; - //! calculate the acceleration neccesary to stop the joint at the specified angle. - /*! - For implementing joint limits. - This command is only valid when used inside a custom Hinge callback. - */ - Ogre::Real calculateStopAlpha( Ogre::Radian angle ) const; + //! calculate the acceleration neccesary to stop the joint at the specified angle. + /*! + For implementing joint limits. + This command is only valid when used inside a custom Hinge callback. + */ + Ogre::Real calculateStopAlpha( Ogre::Radian angle ) const; protected: - //! newton callback, used internally. - static unsigned _CDECL newtonCallback( const NewtonJoint* hinge, NewtonHingeSliderUpdateDesc* desc ); + //! newton callback, used internally. + static unsigned _CDECL newtonCallback( const NewtonJoint* hinge, NewtonHingeSliderUpdateDesc* desc ); - HingeCallback m_callback; - NewtonHingeSliderUpdateDesc* m_desc; + HingeCallback m_callback; + NewtonHingeSliderUpdateDesc* m_desc; - unsigned m_retval; - - + unsigned m_retval; }; //! slider joint. /*! - simple slider joint. implement motors/limits through a callback. + simple slider joint. implement motors/limits through a callback. */ class _OgreNewtExport Slider : public Joint { public: - //! custom slider callback function. - /*! - use the setCallback() function to assign your custom function to the joint. - */ - typedef void(*SliderCallback)( Slider* me ); + //! custom slider callback function. + /*! + use the setCallback() function to assign your custom function to the joint. + */ + typedef void(*SliderCallback)( Slider* me ); - //! constructor - /*! - \param world pointer to the OgreNewt::World - \param child pointer to the child rigid body. - \param parent pointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint) - \param pin direction of the joint pin in global space - */ - Slider( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos, const Ogre::Vector3& pin ); + //! constructor + /*! + \param world pointer to the OgreNewt::World + \param child pointer to the child rigid body. + \param parent pointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint) + \param pin direction of the joint pin in global space + */ + Slider( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos, const Ogre::Vector3& pin ); - //! destructor. - ~Slider(); + //! destructor. + ~Slider(); - //! get position of child along the pin - Ogre::Real getJointPosit() const { return (Ogre::Real)NewtonSliderGetJointPosit( m_joint ); } + //! get position of child along the pin + Ogre::Real getJointPosit() const { return (Ogre::Real)NewtonSliderGetJointPosit( m_joint ); } - //! get rotational velocity along the pin - Ogre::Real getJointVeloc() const { return (Ogre::Real)NewtonSliderGetJointVeloc( m_joint ); } + //! get rotational velocity along the pin + Ogre::Real getJointVeloc() const { return (Ogre::Real)NewtonSliderGetJointVeloc( m_joint ); } - //! get force on the joint. - Ogre::Vector3 getJointForce() const; + //! get force on the joint. + Ogre::Vector3 getJointForce() const; - //! set a custom callback for controlling this joint. - /*! - Joint callbacks allow you to make complex joint behavior such as limits or motors. just make a custom static function that - accepts a pointer to a OgreNewt::BasicJoints::Slider as the single parameter. this function will be called automatically every - time you upate the World. - */ - void setCallback( SliderCallback callback ) { m_callback = callback; } + //! set a custom callback for controlling this joint. + /*! + Joint callbacks allow you to make complex joint behavior such as limits or motors. just make a custom static function that + accepts a pointer to a OgreNewt::BasicJoints::Slider as the single parameter. this function will be called automatically every + time you upate the World. + */ + void setCallback( SliderCallback callback ) { m_callback = callback; } - ////////// CALLBACK COMMANDS /////////// - // the following commands are only valid from inside a hinge callback function + ////////// CALLBACK COMMANDS /////////// + // the following commands are only valid from inside a hinge callback function - //! set the acceleration along the pin. - /*! - This command is only valid when used inside a custom Slider callback. - */ - void setCallbackAccel( Ogre::Real accel ); + //! set the acceleration along the pin. + /*! + This command is only valid when used inside a custom Slider callback. + */ + void setCallbackAccel( Ogre::Real accel ); - //! set minimum friction for the joint - /*! - This command is only valid when used inside a custom Slider callback. - */ - void setCallbackFrictionMin( Ogre::Real min ); + //! set minimum friction for the joint + /*! + This command is only valid when used inside a custom Slider callback. + */ + void setCallbackFrictionMin( Ogre::Real min ); - //! set maximum friction for the joint. - /*! - This command is only valid when used inside a custom Slider callback. - */ - void setCallbackFrictionMax( Ogre::Real max ); + //! set maximum friction for the joint. + /*! + This command is only valid when used inside a custom Slider callback. + */ + void setCallbackFrictionMax( Ogre::Real max ); - //! get current physics timestep. - /*! - This command is only valid when used inside a custom Slider callback. - */ - Ogre::Real getCallbackTimestep() const; + //! get current physics timestep. + /*! + This command is only valid when used inside a custom Slider callback. + */ + Ogre::Real getCallbackTimestep() const; - //! calculate the acceleration neccesary to stop the joint at the specified distance. - /*! - For implementing joint limits. - This command is only valid when used inside a custom Slider callback. - */ - Ogre::Real calculateStopAccel( Ogre::Real dist ) const; + //! calculate the acceleration neccesary to stop the joint at the specified distance. + /*! + For implementing joint limits. + This command is only valid when used inside a custom Slider callback. + */ + Ogre::Real calculateStopAccel( Ogre::Real dist ) const; protected: - //! newton callback. used internally. - static unsigned _CDECL newtonCallback( const NewtonJoint* slider, NewtonHingeSliderUpdateDesc* desc ); + //! newton callback. used internally. + static unsigned _CDECL newtonCallback( const NewtonJoint* slider, NewtonHingeSliderUpdateDesc* desc ); - SliderCallback m_callback; - NewtonHingeSliderUpdateDesc* m_desc; + SliderCallback m_callback; + NewtonHingeSliderUpdateDesc* m_desc; - unsigned m_retval; - + unsigned m_retval; }; -//! this class represents a Universal joint. +//! this class represents a Universal joint. /*! - simple universal joint. implement motors/limits through a callback. + simple universal joint. implement motors/limits through a callback. */ class _OgreNewtExport Universal : public Joint { public: - - //! custom universal callback function. - /*! - use the setCallback() function to assign your custom function to the joint. - */ - typedef void(*UniversalCallback)( Universal* me ); + + //! custom universal callback function. + /*! + use the setCallback() function to assign your custom function to the joint. + */ + typedef void(*UniversalCallback)( Universal* me ); - //! constructor - /*! - \param world pointer to the OgreNewt::World - \param child pointer to the child rigid body. - \param parent pointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint) - \param pos position of the joint in global space - \param pin0 direction of the first axis of rotation in global space - \param pin1 direction of the second axis of rotation in global space - */ - Universal( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos, const Ogre::Vector3& pin0, const Ogre::Vector3& pin1 ); + //! constructor + /*! + \param world pointer to the OgreNewt::World + \param child pointer to the child rigid body. + \param parent pointer to the parent rigid body. pass NULL to make the world itself the parent (aka a rigid joint) + \param pos position of the joint in global space + \param pin0 direction of the first axis of rotation in global space + \param pin1 direction of the second axis of rotation in global space + */ + Universal( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos, const Ogre::Vector3& pin0, const Ogre::Vector3& pin1 ); - //! destructor - ~Universal(); + //! destructor + ~Universal(); - //! get the angle around pin0. - Ogre::Radian getJointAngle0() const { return Ogre::Radian(NewtonUniversalGetJointAngle0( m_joint )); } + //! get the angle around pin0. + Ogre::Radian getJointAngle0() const { return Ogre::Radian(NewtonUniversalGetJointAngle0( m_joint )); } - //! get the angle around pin1. - Ogre::Radian getJointAngle1() const { return Ogre::Radian(NewtonUniversalGetJointAngle1( m_joint )); } + //! get the angle around pin1. + Ogre::Radian getJointAngle1() const { return Ogre::Radian(NewtonUniversalGetJointAngle1( m_joint )); } - //! get the rotational velocity around pin0. - Ogre::Real getJointOmega0() const { return (Ogre::Real)NewtonUniversalGetJointOmega0( m_joint ); } + //! get the rotational velocity around pin0. + Ogre::Real getJointOmega0() const { return (Ogre::Real)NewtonUniversalGetJointOmega0( m_joint ); } - //! get the rotational velocity around pin1. - Ogre::Real getJointOmega1() const { return (Ogre::Real)NewtonUniversalGetJointOmega1( m_joint ); } + //! get the rotational velocity around pin1. + Ogre::Real getJointOmega1() const { return (Ogre::Real)NewtonUniversalGetJointOmega1( m_joint ); } - //! get the force on the joint. - Ogre::Vector3 getJointForce() const; + //! get the force on the joint. + Ogre::Vector3 getJointForce() const; - //! set a custom callback for controlling this joint. - /*! - Joint callbacks allow you to make complex joint behavior such as limits or motors. just make a custom static function that - accepts a pointer to a OgreNewt::BasicJoints::Universal as the single parameter. this function will be called automatically every - time you upate the World. - */ - void setCallback( UniversalCallback callback ) { m_callback = callback; } + //! set a custom callback for controlling this joint. + /*! + Joint callbacks allow you to make complex joint behavior such as limits or motors. just make a custom static function that + accepts a pointer to a OgreNewt::BasicJoints::Universal as the single parameter. this function will be called automatically every + time you upate the World. + */ + void setCallback( UniversalCallback callback ) { m_callback = callback; } - ////////// CALLBACK COMMANDS /////////// - // the following commands are only valid from inside a hinge callback function + ////////// CALLBACK COMMANDS /////////// + // the following commands are only valid from inside a hinge callback function - //! set the acceleration around a particular pin. - /* - this function can only be called from within a custom callback. - \param accel desired acceleration - \param axis which pin to use (0 or 1) - */ - void setCallbackAccel( Ogre::Real accel, unsigned axis ); + //! set the acceleration around a particular pin. + /* + this function can only be called from within a custom callback. + \param accel desired acceleration + \param axis which pin to use (0 or 1) + */ + void setCallbackAccel( Ogre::Real accel, unsigned axis ); - //! set the minimum friction around a particular pin - /* - this function can only be called from within a custom callback. - \param min minimum friction - \param axis which pin to use (0 or 1) - */ - void setCallbackFrictionMin( Ogre::Real min, unsigned axis ); + //! set the minimum friction around a particular pin + /* + this function can only be called from within a custom callback. + \param min minimum friction + \param axis which pin to use (0 or 1) + */ + void setCallbackFrictionMin( Ogre::Real min, unsigned axis ); - //! set the maximum friction around a particular pin. - /* - this function can only be called from within a custom callback. - \param max maximum friction - \param axis which pin to use (0 or 1) - */ - void setCallbackFrictionMax( Ogre::Real max, unsigned axis ); + //! set the maximum friction around a particular pin. + /* + this function can only be called from within a custom callback. + \param max maximum friction + \param axis which pin to use (0 or 1) + */ + void setCallbackFrictionMax( Ogre::Real max, unsigned axis ); - //! get the current phsics timestep. - /* - this function can only be called from within a custom callback. - */ - Ogre::Real getCallbackTimestep() const; + //! get the current phsics timestep. + /* + this function can only be called from within a custom callback. + */ + Ogre::Real getCallbackTimestep() const; - //! calculate the acceleration neccesary to stop the joint at the specified angle on pin 0. - /*! - For implementing joint limits. - This command is only valid when used inside a custom callback. - */ - Ogre::Real calculateStopAlpha0( Ogre::Real angle ) const; + //! calculate the acceleration neccesary to stop the joint at the specified angle on pin 0. + /*! + For implementing joint limits. + This command is only valid when used inside a custom callback. + */ + Ogre::Real calculateStopAlpha0( Ogre::Real angle ) const; - //! calculate the acceleration neccesary to stop the joint at the specified angle on pin 1. - /*! - For implementing joint limits. - This command is only valid when used inside a custom callback. - */ - Ogre::Real calculateStopAlpha1( Ogre::Real angle ) const; + //! calculate the acceleration neccesary to stop the joint at the specified angle on pin 1. + /*! + For implementing joint limits. + This command is only valid when used inside a custom callback. + */ + Ogre::Real calculateStopAlpha1( Ogre::Real angle ) const; protected: - - //! newton callback. used internally. - static unsigned _CDECL newtonCallback( const NewtonJoint* universal, NewtonHingeSliderUpdateDesc* desc ); + + //! newton callback. used internally. + static unsigned _CDECL newtonCallback( const NewtonJoint* universal, NewtonHingeSliderUpdateDesc* desc ); - UniversalCallback m_callback; - NewtonHingeSliderUpdateDesc* m_desc; + UniversalCallback m_callback; + NewtonHingeSliderUpdateDesc* m_desc; - unsigned m_retval; - - - + unsigned m_retval; }; //! UpVector joint. /*! - simple upvector joint. upvectors remove all rotation except for a single pin. useful for character controllers, etc. + simple upvector joint. upvectors remove all rotation except for a single pin. useful for character controllers, etc. */ class _OgreNewtExport UpVector : public Joint { public: - //! constructor - /* - \param world pointer to the OgreNewt::World. - \param body pointer to the body to apply the upvector to. - \param pin direction of the upvector in global space. - */ - UpVector( const World* world, const Body* body, const Ogre::Vector3& pin ); + //! constructor + /* + \param world pointer to the OgreNewt::World. + \param body pointer to the body to apply the upvector to. + \param pin direction of the upvector in global space. + */ + UpVector( const World* world, const Body* body, const Ogre::Vector3& pin ); - //! destructor - ~UpVector(); + //! destructor + ~UpVector(); - //! set the pin direction. - /* - by calling this function in realtime, you can effectively "animate" the pin. - */ - void setPin( const Ogre::Vector3& pin ) const { NewtonUpVectorSetPin( m_joint, &pin.x ); } + //! set the pin direction. + /* + by calling this function in realtime, you can effectively "animate" the pin. + */ + void setPin( const Ogre::Vector3& pin ) const { NewtonUpVectorSetPin( m_joint, &pin.x ); } - //! get the current pin direction. - Ogre::Vector3 getPin() const; - - + //! get the current pin direction. + Ogre::Vector3 getPin() const; }; -} // end NAMESPACE BasicJoints +} // end NAMESPACE BasicJoints //! namespace for pre-built custom joints namespace PrebuiltCustomJoints { - //! Custom2DJoint class - /*! - This class represents a joint that limits movement to a plane, and rotation only around the normal of that - plane. This can be used to create simple 2D simulations. it also supports limits and acceleration for spinning. - This joint has been used in a few projects, but is not 100% fully-tested. - */ - class _OgreNewtExport Custom2DJoint : public OgreNewt::CustomJoint - { - public: - //! constructor - Custom2DJoint( const OgreNewt::Body* body, const Ogre::Vector3& pin ); + //! Custom2DJoint class + /*! + This class represents a joint that limits movement to a plane, and rotation only around the normal of that + plane. This can be used to create simple 2D simulations. it also supports limits and acceleration for spinning. + This joint has been used in a few projects, but is not 100% fully-tested. + */ + class _OgreNewtExport Custom2DJoint : public OgreNewt::CustomJoint + { + public: + //! constructor + Custom2DJoint( const OgreNewt::Body* body, const Ogre::Vector3& pin ); - //! destructor - ~Custom2DJoint() {} + //! destructor + ~Custom2DJoint() {} - //! overloaded function that applies the actual constraint. - void submitConstraint( Ogre::Real timeStep, int threadIndex ); + //! overloaded function that applies the actual constraint. + void submitConstraint( Ogre::Real timeStep, int threadIndex ); - //! get the current angle of the joint. - Ogre::Radian getAngle() const { return mAngle; } + //! get the current angle of the joint. + Ogre::Radian getAngle() const { return mAngle; } - //! set rotational limits for the joint. - void setLimits( Ogre::Degree min, Ogre::Degree max ) { mMin = min, mMax = max; } - - //! sets whether to enable limits or not for the joint. - void setLimitsOn( bool onoff ) { mLimitsOn = onoff; } + //! set rotational limits for the joint. + void setLimits( Ogre::Degree min, Ogre::Degree max ) { mMin = min, mMax = max; } + + //! sets whether to enable limits or not for the joint. + void setLimitsOn( bool onoff ) { mLimitsOn = onoff; } - //! returns whether limits are turned on or off for the joint. - bool getLimitsOn() const { return mLimitsOn; } + //! returns whether limits are turned on or off for the joint. + bool getLimitsOn() const { return mLimitsOn; } - //! adds rotational acceleration to the joint (like a motor) - void addAccel( Ogre::Real accel ) { mAccel = accel; } + //! adds rotational acceleration to the joint (like a motor) + void addAccel( Ogre::Real accel ) { mAccel = accel; } - //! resets the joint angle to 0. this simply sets the internal variable to zero. - //! you might want to call this for example after resetting a body. - void resetAngle() { mAngle = Ogre::Radian(0.0f); } + //! resets the joint angle to 0. this simply sets the internal variable to zero. + //! you might want to call this for example after resetting a body. + void resetAngle() { mAngle = Ogre::Radian(0.0f); } - //! get the pin. - Ogre::Vector3 getPin() { return mPin; } + /... [truncated message content] |
From: <me...@us...> - 2009-03-20 11:43:02
|
Revision: 2668 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2668&view=rev Author: melven2 Date: 2009-03-20 11:42:58 +0000 (Fri, 20 Mar 2009) Log Message: ----------- -changed debugger font -fixed demos (RagDoll now working nicely) Modified Paths: -------------- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/media/GUI/fonts/impact.font branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp Added Paths: ----------- branches/ogrenewt/newton20/demos/media/GUI/fonts/bluehighway-10.fontdef Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -89,12 +89,12 @@ { // this is our custom frame listener for this app, that lets us shoot cylinders with the space bar, move // the camera, etc. - mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World);//, msnCam ); + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); // this is a basic frame listener included with OgreNewt that does nothing but update the // physics at a set framerate for you. complex project will want more control, but this // works for simple demos like this. feel free to look at the source to see how it works. - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 120 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -8,6 +8,10 @@ m_World = W; // msnCam = ncam; mSceneMgr = mgr; + + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); } OgreNewtonFrameListener::~OgreNewtonFrameListener(void) @@ -104,6 +108,19 @@ timer -= evt.timeSinceLastFrame; + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -144,7 +144,7 @@ mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 60 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -7,6 +7,10 @@ { m_World = W; mSceneMgr = mgr; + + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); } OgreNewtonFrameListener::~OgreNewtonFrameListener(void) @@ -87,7 +91,22 @@ timer -= evt.timeSinceLastFrame; + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -119,7 +119,7 @@ mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 60 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -7,6 +7,10 @@ { m_World = W; mSceneMgr = mgr; + + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); } OgreNewtonFrameListener::~OgreNewtonFrameListener(void) @@ -82,7 +86,22 @@ timer -= evt.timeSinceLastFrame; + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -150,7 +150,7 @@ mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 60 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -18,6 +18,10 @@ mDragLineNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mDragLine = new Ogre::ManualObject( "__DRAG_LINES__" ); + + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); } OgreNewtonFrameListener::~OgreNewtonFrameListener(void) @@ -155,7 +159,22 @@ + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -85,7 +85,7 @@ mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World, msnCam, mCar ); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 60 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -8,6 +8,10 @@ mSceneMgr = mgr; mCar = car; + + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); } OgreNewtonFrameListener::~OgreNewtonFrameListener(void) @@ -120,7 +124,22 @@ if (!mKeyboard->isKeyDown( OIS::KC_R )) { mR = false; } + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) { if (mCar) Modified: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -167,7 +167,7 @@ mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 60 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -18,6 +18,10 @@ mDragLineNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mDragLine = new Ogre::ManualObject( "__DRAG_LINES__" ); + + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); } OgreNewtonFrameListener::~OgreNewtonFrameListener(void) @@ -150,7 +154,22 @@ + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -145,7 +145,7 @@ mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 60 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -7,6 +7,10 @@ { m_World = W; mSceneMgr = mgr; + + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); } OgreNewtonFrameListener::~OgreNewtonFrameListener(void) @@ -86,7 +90,22 @@ timer -= evt.timeSinceLastFrame; + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -82,7 +82,7 @@ mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 60 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -8,6 +8,10 @@ m_World = W; mSceneMgr = mgr; + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); + ////////////////////////////// // setup the ragdoll model here. mRagEntity = mSceneMgr->createEntity( "RAGDOLL_ENTITY", "zombie.mesh" ); @@ -131,7 +135,7 @@ mK1 = true; // spawn the ragdoll. this is the version that is made up of simple primitives. - mRagdoll = new RagDoll( "../../media/models/zombie_rag_primitives.xml", m_World, mRagNode ); + mRagdoll = new RagDoll( "../media/models/zombie_rag_primitives.xml", m_World, mRagNode ); mRagEntity->getAnimationState( "LOOP" )->setEnabled( false ); } @@ -140,7 +144,7 @@ mK2 = true; // spawn the ragdoll. this is the version that uses auto-hull generation for very accurate collision shapes. - mRagdoll = new RagDoll( "../../media/models/zombie_rag_hull.xml", m_World, mRagNode ); + mRagdoll = new RagDoll( "../media/models/zombie_rag_hull.xml", m_World, mRagNode ); mRagEntity->getAnimationState( "LOOP" )->setEnabled( false ); } @@ -150,7 +154,7 @@ if (!mKeyboard->isKeyDown( OIS::KC_2 )) { mK2 = false; } - if (mKeyboard->isKeyDown( OIS::KC_F3 )) + if (mKeyboard->isKeyDown( OIS::KC_F2 )) { mRagEntity->setVisible( false ); } @@ -160,8 +164,23 @@ } + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Added: branches/ogrenewt/newton20/demos/media/GUI/fonts/bluehighway-10.fontdef =================================================================== --- branches/ogrenewt/newton20/demos/media/GUI/fonts/bluehighway-10.fontdef (rev 0) +++ branches/ogrenewt/newton20/demos/media/GUI/fonts/bluehighway-10.fontdef 2009-03-20 11:42:58 UTC (rev 2668) @@ -0,0 +1,7 @@ +BlueHighway-10 +{ + type truetype + source bluehigh.ttf + size 10 + resolution 96 +} Modified: branches/ogrenewt/newton20/demos/media/GUI/fonts/impact.font =================================================================== --- branches/ogrenewt/newton20/demos/media/GUI/fonts/impact.font 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/demos/media/GUI/fonts/impact.font 2009-03-20 11:42:58 UTC (rev 2668) @@ -1,2 +1,2 @@ <?xml version="1.0" ?> -<Font Name="Impact" Filename="../../Media/GUI/fonts/impact.ttf" Type="Dynamic" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/> \ No newline at end of file +<Font Name="Impact" Filename="../media/GUI/fonts/impact.ttf" Type="Dynamic" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/> Modified: branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h 2009-03-20 11:42:58 UTC (rev 2668) @@ -26,10 +26,6 @@ #include "OgreNewt_Prerequisites.h" -// using OIS (an Ogre dependency) for input. -#define OIS_DYNAMIC_LIB -#include <OIS/OIS.h> - namespace OgreNewt { @@ -51,16 +47,10 @@ public: - BasicFrameListener(Ogre::RenderWindow* win, Ogre::SceneManager* mgr, OgreNewt::World* W, int update_framerate = 60); + BasicFrameListener(Ogre::RenderWindow* win, OgreNewt::World* W, int update_framerate = 60); ~BasicFrameListener(void); bool frameStarted(const Ogre::FrameEvent &evt); - -private: - - OIS::InputManager* mInputManager; - OIS::Keyboard* mKeyboard; - }; Modified: branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -13,7 +13,7 @@ namespace OgreNewt { -BasicFrameListener::BasicFrameListener( Ogre::RenderWindow* win, Ogre::SceneManager* mgr, OgreNewt::World* W, int update_framerate) : +BasicFrameListener::BasicFrameListener( Ogre::RenderWindow* win, OgreNewt::World* W, int update_framerate) : FrameListener() { m_World = W; @@ -21,23 +21,6 @@ m_update = (Ogre::Real)(1.0f / (Ogre::Real)desired_framerate); m_elapsed = 0.0f; - - // add the standard debug viewer. - W->getDebugger().init( mgr ); - - OIS::ParamList pl; - size_t windowHnd = 0; - std::ostringstream windowHndStr; - - win->getCustomAttribute("WINDOW", &windowHnd); - windowHndStr << windowHnd; - pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str())); - - mInputManager = OIS::InputManager::createInputSystem( pl ); - - //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) - mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, false )); - } BasicFrameListener::~BasicFrameListener(void) @@ -86,20 +69,6 @@ Ogre::LogManager::getSingleton().logMessage(" Newton updates this loop: "+Ogre::StringConverter::toString(count)); #endif - ///////////////////////////////////////////////////////////// - // DEBUGGER - mKeyboard->capture(); - - if (mKeyboard->isKeyDown(OIS::KC_F3)) - { - m_World->getDebugger().showDebugInformation(); - } - else - { - m_World->getDebugger().hideDebugInformation(); - } - - return true; } Modified: branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp 2009-03-20 09:39:56 UTC (rev 2667) +++ branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp 2009-03-20 11:42:58 UTC (rev 2668) @@ -227,7 +227,7 @@ } else { - data->m_text = new OgreNewt::OgreAddons::MovableText( oss_name.str(), oss_info.str(), "VeraSerifBold-16",0.2); + data->m_text = new OgreNewt::OgreAddons::MovableText( oss_name.str(), oss_info.str(), "BlueHighway-10",0.5); data->m_text->setLocalTranslation(bod->getAABB().getMaximum().y/2*Ogre::Vector3::UNIT_Y+Ogre::Vector3::UNIT_Y*0.1); data->m_text->setTextAlignment( OgreNewt::OgreAddons::MovableText::H_LEFT, OgreNewt::OgreAddons::MovableText::V_ABOVE ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <me...@us...> - 2009-03-29 17:00:38
|
Revision: 2677 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2677&view=rev Author: melven2 Date: 2009-03-29 17:00:34 +0000 (Sun, 29 Mar 2009) Log Message: ----------- some bug fixes added parameter tolerance to some CollisionPrimitives Modified Paths: -------------- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h 2009-03-24 23:18:46 UTC (rev 2676) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h 2009-03-29 17:00:34 UTC (rev 2677) @@ -8,7 +8,9 @@ #include <OgreNewt.h> #include <Ogre.h> +#ifndef TIXML_USE_STL #define TIXML_USE_STL +#endif #include <tinyxml.h> Modified: branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-03-24 23:18:46 UTC (rev 2676) +++ branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-03-29 17:00:34 UTC (rev 2677) @@ -219,9 +219,10 @@ \param node pointer to an Ogre::SceneNode with a single entity attached \param orient orientation offset of the primitive \param pos position offset of the primitive + \parem tolerance a tolerance passed to newton */ ConvexHull( const World* world, Ogre::Entity* ent, - const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); + const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO, Ogre::Real tolerance = 0.001f ); /*! Overloaded constructor. pass a pointer to an array of vertices and the hull will be made from that. @@ -230,9 +231,10 @@ \param vertcount number ot vetices in the array \param orient orientation offset of the primitive \param pos position offset of the primitive + \param tolerance a tolerance passed to newton */ ConvexHull( const World* world, const Ogre::Vector3* verts, int vertcount, - const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); + const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO, Ogre::Real tolerance = 0.001f ); //! destructor ~ConvexHull() {} @@ -416,9 +418,10 @@ \param size Ogre::Vector3 size. \param orient orientation offset of the primitive \param pos position offset of the primitive + \param tolerance a tolerance passed to newton */ Pyramid( const World* world, const Ogre::Vector3& size, - const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); + const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO, Ogre::Real tolerance = 0.001f ); //! destructor ~Pyramid() {} Modified: branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp 2009-03-24 23:18:46 UTC (rev 2676) +++ branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp 2009-03-29 17:00:34 UTC (rev 2677) @@ -2,7 +2,7 @@ #include "OgreNewt_Debugger.h" #include "OgreNewt_World.h" -#ifdef __APPLE_ +#ifdef __APPLE__ # include <Ogre/OgreFrameListener.h> # include <Ogre/OgreRenderWindow.h> #else Modified: branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp 2009-03-24 23:18:46 UTC (rev 2676) +++ branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp 2009-03-29 17:00:34 UTC (rev 2677) @@ -2,6 +2,14 @@ #include "OgreNewt_World.h" #include "OgreNewt_Body.h" +#ifdef __APPLE__ +# include <Ogre/OgreLogManager.h> +# include <Ogre/OgreStringConverter.h> +#else +# include <OgreLogManager.h> +# include <OgreStringConverter.h> +#endif + namespace OgreNewt { Modified: branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp 2009-03-24 23:18:46 UTC (rev 2676) +++ branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp 2009-03-29 17:00:34 UTC (rev 2677) @@ -118,7 +118,7 @@ ConvexHull::ConvexHull(const World* world) : ConvexCollision( world ) {} - ConvexHull::ConvexHull( const World* world, Ogre::Entity* obj, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) + ConvexHull::ConvexHull( const World* world, Ogre::Entity* obj, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance ) : ConvexCollision( world ) { Ogre::Vector3 scale(1.0,1.0,1.0); @@ -232,7 +232,7 @@ OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); //okay, let's try making the ConvexHull! - m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), (int)total_verts, (float*)&vertices[0].x, sizeof(Ogre::Vector3), 0.001f, &matrix[0] ); + m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), (int)total_verts, (float*)&vertices[0].x, sizeof(Ogre::Vector3), tolerance, &matrix[0] ); delete []vertices; @@ -240,13 +240,13 @@ // OgreNewt::CollisionPrimitives::ConvexHull - ConvexHull::ConvexHull( const World* world, const Ogre::Vector3* verts, int vertcount, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) + ConvexHull::ConvexHull( const World* world, const Ogre::Vector3* verts, int vertcount, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance ) : ConvexCollision( world ) { float matrix[16]; OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); //make the collision primitive. - m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), vertcount, (float*)&verts[0].x, sizeof(Ogre::Vector3), 0.001f, &matrix[0]); + m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), vertcount, (float*)&verts[0].x, sizeof(Ogre::Vector3), tolerance, &matrix[0]); } @@ -741,7 +741,7 @@ Pyramid::Pyramid(const World* world) : ConvexCollision( world ) {} - Pyramid::Pyramid( const World* world, const Ogre::Vector3& size, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) + Pyramid::Pyramid( const World* world, const Ogre::Vector3& size, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance ) : ConvexCollision( world ) { float matrix[16]; @@ -770,7 +770,7 @@ vertices [idx++] = 0.0f; //make the collision primitive. - m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), 5, vertices, sizeof(float)*3, 0.001f, &matrix[0]); + m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), 5, vertices, sizeof(float)*3, tolerance, &matrix[0]); delete []vertices; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <me...@us...> - 2009-04-02 10:22:56
|
Revision: 2678 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2678&view=rev Author: melven2 Date: 2009-04-02 10:22:46 +0000 (Thu, 02 Apr 2009) Log Message: ----------- -fixed error when destroying OgreNewt::World and OgreNewt::Debugger Modified Paths: -------------- branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h branches/ogrenewt/newton20/inc/OgreNewt_World.h branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp branches/ogrenewt/newton20/src/OgreNewt_World.cpp Modified: branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h 2009-03-29 17:00:34 UTC (rev 2677) +++ branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h 2009-04-02 10:22:46 UTC (rev 2678) @@ -17,6 +17,11 @@ #include "OgreNewt_Tools.h" +namespace Ogre +{ + class ManualObject; +} + namespace OgreNewt { @@ -128,7 +133,10 @@ //! clear debug data cache fo bodies (m_cachemap) void clearBodyDebugDataCache(); + typedef std::list<Ogre::ManualObject*> ManualObjectList; + ManualObjectList mRecordedRaycastObjects; + private: //! this function is declared private, so nobody can use it! Debugger() {} Modified: branches/ogrenewt/newton20/inc/OgreNewt_World.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_World.h 2009-03-29 17:00:34 UTC (rev 2677) +++ branches/ogrenewt/newton20/inc/OgreNewt_World.h 2009-04-02 10:22:46 UTC (rev 2678) @@ -209,7 +209,7 @@ /*! * the debugger needs to be initialized (Debugger::init(...) ) in order to work correctly */ - Debugger& getDebugger() const {return m_debugger;} + Debugger& getDebugger() const {return *m_debugger;} protected: @@ -220,7 +220,7 @@ BodyInAABBIterator m_bodyInAABBIterator; - mutable Debugger m_debugger; + mutable Debugger* m_debugger; private: Modified: branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp 2009-03-29 17:00:34 UTC (rev 2677) +++ branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp 2009-04-02 10:22:46 UTC (rev 2678) @@ -58,18 +58,16 @@ void Debugger::deInit() { + clearBodyDebugDataCache(); if (m_debugnode) { m_debugnode->setListener(NULL); - m_debugnode->removeAllChildren(); + m_debugnode->removeAndDestroyAllChildren(); m_debugnode->getParentSceneNode()->removeAndDestroyChild( m_debugnode->getName() ); m_debugnode = NULL; } - clearBodyDebugDataCache(); - - clearRaycastsRecorded(); if( m_raycastsnode ) { @@ -84,15 +82,14 @@ { if(node == m_debugnode) { + m_debugnode = NULL; clearBodyDebugDataCache(); - m_debugnode = NULL; } if(node == m_raycastsnode) { - //!TODO: check this... this accesses the node, I'm not shure if this is allowed in this function + m_raycastsnode = NULL; clearRaycastsRecorded(); - m_raycastsnode = NULL; } } @@ -104,9 +101,11 @@ Ogre::ManualObject* mo = it->second.m_lines; if( mo ) delete mo; + OgreNewt::OgreAddons::MovableText *text = it->second.m_text; + if( text ) + delete text; } m_cachemap.clear(); - } @@ -136,6 +135,9 @@ Ogre::ManualObject* mo = it->second.m_lines; if( mo ) delete mo; + OgreNewt::OgreAddons::MovableText *text = it->second.m_text; + if( text ) + delete text; } } m_cachemap.swap(newmap); @@ -299,13 +301,20 @@ { if( m_raycastsnode ) { +/* while( m_raycastsnode->numAttachedObjects() > 0 ) { delete m_raycastsnode->detachObject((unsigned short)0); } +*/ + m_raycastsnode->removeAndDestroyAllChildren(); + } - m_raycastsnode->detachAllObjects(); + for(ManualObjectList::iterator it = mRecordedRaycastObjects.begin(); it != mRecordedRaycastObjects.end(); it++) + { + delete (*it); } + mRecordedRaycastObjects.clear(); } void Debugger::stopRaycastRecording() @@ -330,6 +339,7 @@ std::ostringstream oss; oss << "__OgreNewt__Raycast_Debugger__Lines__Raycastline__" << i++ << "__"; Ogre::ManualObject *line = new Ogre::ManualObject(oss.str()); + mRecordedRaycastObjects.push_back(line); line->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST ); line->colour(m_raycol); @@ -350,6 +360,7 @@ std::ostringstream oss; oss << "__OgreNewt__Raycast_Debugger__Lines__Convexcastlines__" << i++ << "__"; Ogre::ManualObject *line = new Ogre::ManualObject(oss.str()); + mRecordedRaycastObjects.push_back(line); line->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST ); line->colour(m_convexcol); @@ -402,6 +413,7 @@ std::ostringstream oss; oss << "__OgreNewt__Raycast_Debugger__Lines__DiscardedBody__" << i++ << "__"; Ogre::ManualObject *line = new Ogre::ManualObject(oss.str()); + mRecordedRaycastObjects.push_back(line); line->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST ); line->colour(m_prefilterdiscardedcol); @@ -427,6 +439,7 @@ std::ostringstream oss; oss << "__OgreNewt__Raycast_Debugger__Lines__HitBody__" << i++ << "__"; Ogre::ManualObject *line = new Ogre::ManualObject(oss.str()); + mRecordedRaycastObjects.push_back(line); line->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST ); line->colour(m_hitbodycol); Modified: branches/ogrenewt/newton20/src/OgreNewt_World.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_World.cpp 2009-03-29 17:00:34 UTC (rev 2677) +++ branches/ogrenewt/newton20/src/OgreNewt_World.cpp 2009-04-02 10:22:46 UTC (rev 2678) @@ -8,8 +8,7 @@ // Constructor World::World() : - m_bodyInAABBIterator(this), - m_debugger(this) + m_bodyInAABBIterator(this) { m_limits = Ogre::AxisAlignedBox(Ogre::Vector3(-100,-100,-100), Ogre::Vector3(100,100,100)); @@ -26,16 +25,30 @@ m_defaultMatID = new OgreNewt::MaterialID( this, NewtonMaterialGetDefaultGroupID( m_world ) ); m_leaveCallback = NULL; + + m_debugger = new Debugger(this); } // Destructor World::~World() { + if (m_debugger) + { + delete m_debugger; + m_debugger = NULL; + } + if (m_defaultMatID) + { delete m_defaultMatID; + m_defaultMatID = NULL; + } if (m_world) + { NewtonDestroy( m_world ); + m_world = NULL; + } } // update This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <me...@us...> - 2009-04-06 13:05:58
|
Revision: 2680 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2680&view=rev Author: melven2 Date: 2009-04-06 13:05:42 +0000 (Mon, 06 Apr 2009) Log Message: ----------- added scale as a parameter for CollisionPrimitives::ConvexHull Modified Paths: -------------- branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp Modified: branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-04-05 14:41:55 UTC (rev 2679) +++ branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-04-06 13:05:42 UTC (rev 2680) @@ -214,15 +214,17 @@ //! constructor /*! - Overloaded constructor. pass a SceneNode*, and it will use the vertex data from the first attached object. + Overloaded constructor. pass an Entity*, and it will use its vertex data. if it is attached to Node*, the collision + will be scaled apperently (entity->getParentNode()->getScale()) \param world pointer to the OgreNewt::World \param node pointer to an Ogre::SceneNode with a single entity attached \param orient orientation offset of the primitive \param pos position offset of the primitive \parem tolerance a tolerance passed to newton + \param forceScale if set to something else then (0,0,0), the value of this argument will be used as scale instead of the parent-node's scale */ ConvexHull( const World* world, Ogre::Entity* ent, - const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO, Ogre::Real tolerance = 0.001f ); + const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO, Ogre::Real tolerance = 0.001f , const Ogre::Vector3& forceScale = Ogre::Vector3::ZERO); /*! Overloaded constructor. pass a pointer to an array of vertices and the hull will be made from that. Modified: branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp 2009-04-05 14:41:55 UTC (rev 2679) +++ branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp 2009-04-06 13:05:42 UTC (rev 2680) @@ -118,7 +118,7 @@ ConvexHull::ConvexHull(const World* world) : ConvexCollision( world ) {} - ConvexHull::ConvexHull( const World* world, Ogre::Entity* obj, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance ) : ConvexCollision( world ) + ConvexHull::ConvexHull( const World* world, Ogre::Entity* obj, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance, const Ogre::Vector3& forceScale ) : ConvexCollision( world ) { Ogre::Vector3 scale(1.0,1.0,1.0); @@ -127,9 +127,11 @@ //Ogre::Entity* obj = (Ogre::Entity*)node->getAttachedObject(0); Ogre::MeshPtr mesh = obj->getMesh(); - // get scale, if attached to node - Ogre::Node * node = obj->getParentNode(); - if (node) scale = node->getScale(); + + // get scale, if attached to node + Ogre::Node * node = obj->getParentNode(); + if (node) scale = node->getScale(); + if (forceScale != Ogre::Vector3::ZERO) scale = forceScale; //find number of submeshes unsigned short sub = mesh->getNumSubMeshes(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <me...@us...> - 2009-05-18 17:21:17
|
Revision: 2691 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2691&view=rev Author: melven2 Date: 2009-05-18 17:21:05 +0000 (Mon, 18 May 2009) Log Message: ----------- interface breaking changes! -use sharedptrs for collisions -use Ogre::Any for userdata values -set position and orientation of a node attached to a body correctly, when the the node derives position/orientation from its parent -make OgreNewt export the (internally used) MovableText-class -updated the demos -create the correct OgreNewt collisionprimitive type when importing collisions and some other minor changes Modified Paths: -------------- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorMatCallback.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h branches/ogrenewt/newton20/inc/OgreNewt_Body.h branches/ogrenewt/newton20/inc/OgreNewt_BodyInAABBIterator.h branches/ogrenewt/newton20/inc/OgreNewt_Collision.h branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h branches/ogrenewt/newton20/inc/OgreNewt_ContactCallback.h branches/ogrenewt/newton20/inc/OgreNewt_ContactJoint.h branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h branches/ogrenewt/newton20/inc/OgreNewt_Joint.h branches/ogrenewt/newton20/inc/OgreNewt_MaterialID.h branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h branches/ogrenewt/newton20/inc/OgreNewt_Tools.h branches/ogrenewt/newton20/inc/OgreNewt_Vehicle.h branches/ogrenewt/newton20/inc/OgreNewt_World.h branches/ogrenewt/newton20/src/OgreNewt_Body.cpp branches/ogrenewt/newton20/src/OgreNewt_Collision.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionSerializer.cpp branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp branches/ogrenewt/newton20/src/OgreNewt_Tools.cpp Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -55,13 +55,15 @@ // here's where we make a collision shape for the physics. note that we use the same size as // above. - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Cylinder(m_World, 2.5, 5); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder(m_World, 2.5, 5)); // now we make a new rigid body based on this collision shape. OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR // we`re done with the collision shape, we can delete it now. delete col; +#endif // now we "attach" the rigid body to the scene node that holds the visual object, and set it's // original position and orientation. all rigid bodies default to mass=0 (static, immobile), so Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -80,17 +80,20 @@ //ent->setNormaliseNormals(true); // again, make the collision shape. - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Cylinder(m_World, 1, 1); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder(m_World, 1, 1)); // then make the rigid body. OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR //no longer need the collision shape object delete col; +#endif body->setMassMatrix( 10.0, 10.0*inertia ); + body->setCenterOfMass(offset); // attach to the scene node. body->attachNode( node ); Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -74,8 +74,10 @@ // SceneNodes (parsing all children), and add collision for all meshes in the tree. OgreNewt::CollisionPrimitives::TreeCollisionSceneParser* stat_col = new OgreNewt::CollisionPrimitives::TreeCollisionSceneParser( m_World ); stat_col->parseScene( floornode, true ); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, stat_col ); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, OgreNewt::CollisionPtr(stat_col) ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete stat_col; +#endif bod->attachNode( floornode ); bod->setPositionOrientation( Ogre::Vector3(0.0,-20.0,0.0), Ogre::Quaternion::IDENTITY ); @@ -160,7 +162,7 @@ box1node->setScale( size ); // box1->setNormaliseNormals(true); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Box( m_World, size ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); @@ -171,10 +173,13 @@ Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif bod->attachNode( box1node ); bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); bod->setStandardForceCallback(); box1->setMaterialName( "Simple/BumpyMetal" ); Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -74,12 +74,17 @@ ent->setMaterialName( "Simple/dirt01" ); // ent->setNormaliseNormals(true); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); body->setMassMatrix( 10.0, 10.0*inertia ); + body->setCenterOfMass(offset); body->attachNode( node ); body->setStandardForceCallback(); body->setPositionOrientation( pos, camorient ); Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -16,7 +16,7 @@ { // build a conveyor belt object. first create the basic visual object. mSceneMgr = mgr; - mDir = dir; + mDir = dir.normalisedCopy(); mSpeed = speed; mNode = mgr->getRootSceneNode()->createChildSceneNode(); @@ -27,15 +27,21 @@ mNode->setScale( size ); // create the collision object for the conveyor belt. - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Box( world, size ); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size )); mBody = new OgreNewt::Body( world, col, conveyorType ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif mBody->setMassMatrix( 0.0, Ogre::Vector3(0,0,0) ); mBody->attachNode( mNode ); mBody->setMaterialGroupID( conveyorMat ); +#ifndef OGRENEWT_NO_OGRE_ANY + mBody->setUserData( Ogre::Any(this) ); +#else mBody->setUserData( this ); +#endif mBody->setPositionOrientation( pos, orient ); mNode->setPosition( pos ); Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorMatCallback.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorMatCallback.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorMatCallback.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -29,13 +29,21 @@ if (body0->getType() == mConveyorID) { +#ifndef OGRENEWT_NO_OGRE_ANY + belt = Ogre::any_cast<ConveyorBelt*>(body0->getUserData()); +#else belt = (ConveyorBelt*)body0->getUserData(); +#endif object = body1; } if (body1->getType() == mConveyorID) { +#ifndef OGRENEWT_NO_OGRE_ANY + belt = Ogre::any_cast<ConveyorBelt*>(body1->getUserData()); +#else belt = (ConveyorBelt*)body1->getUserData(); +#endif object = body0; } @@ -47,8 +55,15 @@ for( OgreNewt::Contact contact = contactJoint.getFirstContact(); contact; contact = contact.getNext() ) { contact.rotateTangentDirections( thedir ); - Ogre::Vector3 result_accel = (thedir * belt->getSpeed()) - object->getVelocity(); - contact.setTangentAcceleration( result_accel.length(), 0 ); + Ogre::Vector3 contactPos, contactNorm; + contact.getPositionAndNormal(contactPos, contactNorm); + Ogre::Vector3 objectPos; + Ogre::Quaternion objectOri; + object->getPositionOrientation(objectPos, objectOri); + Ogre::Vector3 objectContactPointVel = object->getVelocity() + (contactPos - objectPos)*object->getOmega(); + Ogre::Real result_accel = belt->getSpeed() - thedir.dotProduct(objectContactPointVel); + result_accel *= 10; // looks nicer + contact.setTangentAcceleration( result_accel, 0 ); } } } Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -79,9 +79,13 @@ floor->setCastShadows( false ); //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true ); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + //floornode->setScale( siz ); bod->attachNode( floornode ); bod->setPositionOrientation( Ogre::Vector3(0.0,-10.0,0.0), Ogre::Quaternion::IDENTITY ); @@ -109,7 +113,9 @@ mMatPairDefaultConveyor = new OgreNewt::MaterialPair( m_World, mMatDefault, mMatConveyor ); mConveyorCallback = new ConveyorMatCallback( BT_CONVEYOR ); mMatPairDefaultConveyor->setContactCallback( mConveyorCallback ); - mMatPairDefaultConveyor->setDefaultFriction( 1.5, 1.4 ); + mMatPairDefaultConveyor->setDefaultSoftness( 0.8 ); + mMatPairDefaultConveyor->setDefaultElasticity( 0.05 ); + mMatPairDefaultConveyor->setDefaultFriction( 0.9, 0.8 ); } Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -68,14 +68,18 @@ ent->setMaterialName( "Simple/BumpyMetal" ); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Box( m_World, size ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif body->setMassMatrix( mass, mass*inertia ); + body->setCenterOfMass(offset); body->attachNode( node ); body->setStandardForceCallback(); body->setPositionOrientation( Ogre::Vector3(-5,8,0), Ogre::Quaternion::IDENTITY ); Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -75,9 +75,11 @@ //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true ); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif //floornode->setScale( siz ); bod->attachNode( floornode ); @@ -174,7 +176,7 @@ box1node->attachObject( box1 ); box1node->setScale( size ); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Box( m_World, size ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); @@ -184,10 +186,13 @@ Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif bod->attachNode( box1node ); bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); bod->setStandardForceCallback(); box1->setMaterialName( "Simple/BumpyMetal" ); Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -114,7 +114,12 @@ Ogre::Vector3 localpt = bodorient.Inverse() * (globalpt - bodpos); // now we need to save this point to apply the spring force, I'm using the userData of the bodies in this example. + // (where is it used? probably not needed here...) +#ifndef OGRENEWT_NO_OGRE_ANY + info.mBody->setUserData( Ogre::Any(this) ); +#else info.mBody->setUserData( this ); +#endif // now change the force callback from the standard one to the one that applies the spring (drag) force. // this is an example of binding a callback to a member of a specific class. in previous versions of OgreNewt you were Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -172,6 +172,7 @@ bod->attachNode( box1node ); bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); bod->setStandardForceCallback(); box1->setMaterialName( "Simple/BumpyMetal" ); Modified: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -75,9 +75,11 @@ //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true ); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif //floornode->setScale( siz ); bod->attachNode( floornode ); @@ -191,7 +193,7 @@ box1node->attachObject( box1 ); box1node->setScale( size ); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Box( m_World, size ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); @@ -200,11 +202,13 @@ // calculate the inertia based on box formula and mass Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); - +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif bod->attachNode( box1node ); bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); bod->setStandardForceCallback(); box1->setMaterialName( "Simple/BumpyMetal" ); Modified: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -114,8 +114,14 @@ Ogre::Vector3 localpt = bodorient.Inverse() * (globalpt - bodpos); // now we need to save this point to apply the spring force, I'm using the userData of the bodies in this example. + // (where is it used? probably not needed here...) +#ifndef OGRENEWT_NO_OGRE_ANY + info.mBody->setUserData( Ogre::Any(this) ); +#else info.mBody->setUserData( this ); +#endif + // now change the force callback from the standard one to the one that applies the spring (drag) force. info.mBody->setCustomForceAndTorqueCallback<OgreNewtonFrameListener>( &OgreNewtonFrameListener::dragCallback, this ); Modified: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -75,8 +75,10 @@ // SceneNodes (parsing all children), and add collision for all meshes in the tree. OgreNewt::CollisionPrimitives::TreeCollisionSceneParser* stat_col = new OgreNewt::CollisionPrimitives::TreeCollisionSceneParser( m_World ); stat_col->parseScene( floornode, true ); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, stat_col ); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, OgreNewt::CollisionPtr(stat_col) ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete stat_col; +#endif bod->attachNode( floornode ); bod->setPositionOrientation( Ogre::Vector3(0.0,-20.0,0.0), Ogre::Quaternion::IDENTITY ); @@ -160,7 +162,7 @@ box1node->attachObject( box1 ); box1node->setScale( size ); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Box( m_World, size ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); @@ -170,11 +172,13 @@ // calculate the inertia based on box formula and mass Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); - +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif bod->attachNode( box1node ); bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); bod->setStandardForceCallback(); box1->setMaterialName( "Simple/BumpyMetal" ); Modified: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -73,18 +73,23 @@ ent->setMaterialName( "Simple/dirt01" ); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); body->setMassMatrix( 10.0, 10.0*inertia ); + body->setCenterOfMass(offset); body->attachNode( node ); body->setStandardForceCallback(); body->setPositionOrientation( pos, camorient ); body->setVelocity( (dir * 50.0) ); timer = 0.2; + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif } } Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -49,9 +49,11 @@ floor->setCastShadows( false ); //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true ); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif //floornode->setScale( siz ); bod->attachNode( floornode ); @@ -97,7 +99,7 @@ box1node->attachObject( box1 ); box1node->setScale( size ); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Box( m_World, size ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); @@ -108,10 +110,13 @@ Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; +#endif bod->attachNode( box1node ); bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); bod->setStandardForceCallback(); box1->setMaterialName( "Simple/BumpyMetal" ); Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -87,18 +87,23 @@ ent->setMaterialName( "Simple/dirt01" ); - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); Ogre::Vector3 inertia, offset; col->calculateInertialMatrix(inertia, offset); body->setMassMatrix( 10.0, 10.0*inertia ); + body->setCenterOfMass(offset); body->attachNode( node ); body->setStandardForceCallback(); body->setPositionOrientation( pos, camorient ); body->setVelocity( (dir * 50.0) ); timer = 0.2; + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif } } timer -= evt.timeSinceLastFrame; Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp 2009-05-18 17:21:05 UTC (rev 2691) @@ -8,7 +8,11 @@ mParent = parent; mOgreBone = ogreBone; - OgreNewt::ConvexCollision* col = NULL; +#ifndef OGRENEWT_NO_COLLISION_SHAREDPTR + OgreNewt::ConvexCollisionPtr col; +#else + OgreNewt::ConvexCollisionPtr col = NULL; +#endif // in the case of the cylindrical primitives, they need to be rotated to align the main axis with the direction vector. Ogre::Quaternion orient = Ogre::Quaternion::IDENTITY; @@ -32,23 +36,23 @@ switch (shape) { case RagDoll::RagBone::BS_BOX: - col = new OgreNewt::CollisionPrimitives::Box( world, size ); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size )); break; case RagDoll::RagBone::BS_CAPSULE: - col = new OgreNewt::CollisionPrimitives::Capsule( world, size.y, size.x, orient, pos ); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Capsule( world, size.y, size.x, orient, pos )); break; case RagDoll::RagBone::BS_CONE: - col = new OgreNewt::CollisionPrimitives::Cone( world, size.y, size.x, orient, pos ); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cone( world, size.y, size.x, orient, pos )); break; case RagDoll::RagBone::BS_CYLINDER: - col = new OgreNewt::CollisionPrimitives::Cylinder( world, size.y, size.x, orient, pos ); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder( world, size.y, size.x, orient, pos )); break; case RagDoll::RagBone::BS_ELLIPSOID: - col = new OgreNewt::CollisionPrimitives::Ellipsoid( world, size ); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( world, size )); break; case RagDoll::RagBone::BS_CONVEXHULL: @@ -56,24 +60,31 @@ break; default: - col = new OgreNewt::CollisionPrimitives::Box( world, size ); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size )); break; } mBody = new OgreNewt::Body( world, col ); - mBody->setUserData( this ); +#ifndef OGRENEWT_NO_OGRE_ANY + mBody->setUserData( Ogre::Any(this) ); +#else + mBody->setUserData( this ); +#endif mBody->setStandardForceCallback(); Ogre::Vector3 inertia; - Ogre::Vector3 com; - col->calculateInertialMatrix( inertia, com ); + Ogre::Vector3 offset; + col->calculateInertialMatrix( inertia, offset ); mBody->setMassMatrix( mass, inertia * mass ); - mBody->setCenterOfMass( com ); + mBody->setCenterOfMass( offset ); mBody->setCustomTransformCallback( RagDoll::_placementCallback ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif } @@ -86,7 +97,11 @@ void RagDoll::RagBone::_hingeCallback( OgreNewt::BasicJoints::Hinge* me ) { +#ifndef OGRENEWT_NO_OGRE_ANY + RagDoll::RagBone* bone = Ogre::any_cast<RagDoll::RagBone*>(me->getUserData()); +#else RagDoll::RagBone* bone = (RagDoll::RagBone*)me->getUserData(); +#endif Ogre::Degree angle = me->getJointAngle(); Ogre::Degree lim1( bone->getLimit1() ); @@ -107,7 +122,7 @@ } -OgreNewt::ConvexCollision* RagDoll::RagBone::_makeConvexHull( OgreNewt::World* world, Ogre::MeshPtr mesh, Ogre::Real minWeight ) +OgreNewt::ConvexCollisionPtr RagDoll::RagBone::_makeConvexHull( OgreNewt::World* world, Ogre::MeshPtr mesh, Ogre::Real minWeight ) { std::vector< Ogre::Vector3 > vertexVector; @@ -197,7 +212,7 @@ } ////////////////////////////////////////////////////////////////////////////////// - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::ConvexHull( world, verts, numVerts ); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::ConvexHull( world, verts, numVerts )); delete []verts; @@ -390,7 +405,11 @@ case RagDoll::JT_HINGE: joint = new OgreNewt::BasicJoints::Hinge( child->getBody()->getWorld(), child->getBody(), parent->getBody(), pos, pin ); ((OgreNewt::BasicJoints::Hinge*)joint)->setCallback( RagBone::_hingeCallback ); - joint->setUserData( child ); +#ifndef OGRENEWT_NO_OGRE_ANY + joint->setUserData( Ogre::Any(child) ); +#else + joint->setUserData( child ); +#endif child->setLimits( limit1, limit2 ); break; } @@ -400,7 +419,11 @@ void RagDoll::_placementCallback( OgreNewt::Body* me, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, int threadindex ) { +#ifndef OGRENEWT_NO_OGRE_ANY + RagDoll::RagBone* bone = Ogre::any_cast<RagDoll::RagBone*>(me->getUserData()); +#else RagDoll::RagBone* bone = (RagDoll::RagBone*)me->getUserData(); +#endif RagDoll* doll = bone->getDoll(); // is this the root bone? Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -63,7 +63,7 @@ private: - OgreNewt::ConvexCollision* _makeConvexHull( OgreNewt::World* world, Ogre::MeshPtr mesh, Ogre::Real minWeight ); + OgreNewt::ConvexCollisionPtr _makeConvexHull( OgreNewt::World* world, Ogre::MeshPtr mesh, Ogre::Real minWeight ); // pointer to the doll to which this bone belongs. RagDoll* mDoll; Modified: branches/ogrenewt/newton20/inc/OgreNewt.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -64,13 +64,14 @@ - joints - collision-serializer - treecollision raycastcallback - - shared pointers for collisions (atm CollisionPtr := Collision*, but should be Ogre::SharedPtr<Collision>, but there was some problem...) \section new New in this version New in this version - this version uses cmake > 2.6.2! + - shared pointers for collisions, if you don't want to use shared pointers define OGRENEWT_NO_COLLISION_SHAREDPTR + - uses Ogre::Any instead of void* as userdata, if you want to use void* define OGRENEWT_NO_OGRE_ANY - several interface-breaking changes: - the ContactCallback passes a ContactJoint as argument that can be used to iterate through all contacts (the callback is not called for each contact any more, but for each pair of colliding bodies!) Modified: branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -29,9 +29,7 @@ namespace OgreNewt { -class World; - //! simple frame listener to update the physics. /*! updates the Newton World at the specified rate, with time-slicing, and Modified: branches/ogrenewt/newton20/inc/OgreNewt_Body.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -20,17 +20,12 @@ #include "OgreNewt_Prerequisites.h" #include "OgreNewt_MaterialID.h" #include "OgreNewt_Collision.h" -#include <boost/function.hpp> -#include <boost/bind.hpp> // OgreNewt namespace. all functions and classes use this namespace. namespace OgreNewt { -class World; -class MaterialID; - /* CLASS DEFINITION: @@ -82,7 +77,7 @@ \param col pointer to an OgreNewt::Collision object that represents the shape of the rigid body. \param bodytype simple integer value used to identify the type of rigid body, useful for determining bodies in callbacks. */ - Body( const World* W, const OgreNewt::Collision* col, int bodytype = 0 ); + Body( const World* W, const OgreNewt::CollisionPtr& col, int bodytype = 0 ); //! destructor ~Body(); @@ -92,10 +87,18 @@ you can use this to store a pointer to a parent class, etc. then inside one of the many callbacks, you can get the pointer using this "userData" system. */ +#ifndef OGRENEWT_NO_OGRE_ANY + void setUserData( const Ogre::Any& data ) { m_userdata = data; } +#else void setUserData( void* data ) { m_userdata = data; } +#endif //! retrieve pointer to previously set user data. +#ifndef OGRENEWT_NO_OGRE_ANY + const Ogre::Any& getUserData() const { return m_userdata; } +#else void* getUserData() const { return m_userdata; } +#endif //! get a pointer to the NewtonBody object /*! @@ -260,7 +263,7 @@ This can be used to change the collision shape of a body mid-simulation. for example making the collision for a character smaller when crouching, etc. \param col pointer to the new OgreNewt::Collision shape. */ - void setCollision( const OgreNewt::Collision* col ); + void setCollision( const OgreNewt::CollisionPtr& col ); //! set whether the body should "sleep" when equilibruim is reached. /*! @@ -275,7 +278,7 @@ //void setFreezeThreshold( Ogre::Real speed, Ogre::Real omega, int framecount ) { NewtonBodySetFreezeTreshold( m_body, (float)speed, (float)omega, framecount ); } //! get a pointer to the OgreNewt::Collision for this body - const OgreNewt::Collision* getCollision() const; + const OgreNewt::CollisionPtr& getCollision() const; //! get a pointer to the Material assigned to this body. const OgreNewt::MaterialID* getMaterialGroupID() const; @@ -398,7 +401,7 @@ /*! * usually it is also possible to get this via: body->getCollision()->getCollisionPrimitiveType() */ - CollisionPrimitive getCollisionPrimitiveType() const { return Collision::getCollisionPrimitiveType(getNewtonCollision()); } + CollisionPrimitiveType getCollisionPrimitiveType() const { return Collision::getCollisionPrimitiveType(getNewtonCollision()); } //! Returns the Newton Collision for this Body /*! @@ -408,20 +411,23 @@ protected: - NewtonBody* m_body; - const Collision* m_collision; - const MaterialID* m_matid; - const World* m_world; + NewtonBody* m_body; + OgreNewt::CollisionPtr m_collision; + const MaterialID* m_matid; + const World* m_world; - - void* m_userdata; +#ifndef OGRENEWT_NO_OGRE_ANY + Ogre::Any m_userdata; +#else + void* m_userdata; +#endif - int m_type; - Ogre::Node* m_node; + int m_type; + Ogre::Node* m_node; - ForceCallback m_forcecallback; - TransformCallback m_transformcallback; - buoyancyPlaneCallback m_buoyancycallback; + ForceCallback m_forcecallback; + TransformCallback m_transformcallback; + buoyancyPlaneCallback m_buoyancycallback; private: Modified: branches/ogrenewt/newton20/inc/OgreNewt_BodyInAABBIterator.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_BodyInAABBIterator.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_BodyInAABBIterator.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -15,17 +15,12 @@ #include "OgreNewt_Prerequisites.h" -#include <boost/function.hpp> -#include <boost/bind.hpp> // OgreNewt namespace. all functions and classes use this namespace. namespace OgreNewt { -class World; -class Body; - //! Iterate through all bodies in a specific AABB in the world. /*! this class is an easy way to loop through all bodies in an AABB in the world, performing some kind of action. Modified: branches/ogrenewt/newton20/inc/OgreNewt_Collision.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Collision.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_Collision.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -14,30 +14,28 @@ #include "OgreNewt_Prerequisites.h" -#include "OgreNewt_World.h" -#include "OgreNewt_CollisionSerializer.h" + // OgreNewt namespace. all functions and classes use this namespace. namespace OgreNewt { -class World; -enum _OgreNewtExport CollisionPrimitive +enum _OgreNewtExport CollisionPrimitiveType { - BoxPrimitive = SERIALIZE_ID_BOX, - ConePrimitive = SERIALIZE_ID_CONE, - EllipsoidPrimitive = SERIALIZE_ID_SPHERE, - CapsulePrimitive = SERIALIZE_ID_CAPSULE, - CylinderPrimitive = SERIALIZE_ID_CYLINDER, - CompoundCollisionPrimitive = SERIALIZE_ID_COMPOUND, - ConvexHullPrimitive = SERIALIZE_ID_CONVEXHULL, - ConvexHullModifierPrimitive = SERIALIZE_ID_CONVEXMODIFIER, - ChamferCylinderPrimitive = SERIALIZE_ID_CHAMFERCYLINDER, - TreeCollisionPrimitive = SERIALIZE_ID_TREE, - NullPrimitive = SERIALIZE_ID_NULL, - HeighFieldPrimitive = SERIALIZE_ID_HEIGHTFIELD, - ScenePrimitive = SERIALIZE_ID_SCENE + BoxPrimitiveType = SERIALIZE_ID_BOX, + ConePrimitiveType = SERIALIZE_ID_CONE, + EllipsoidPrimitiveType = SERIALIZE_ID_SPHERE, + CapsulePrimitiveType = SERIALIZE_ID_CAPSULE, + CylinderPrimitiveType = SERIALIZE_ID_CYLINDER, + CompoundCollisionPrimitiveType = SERIALIZE_ID_COMPOUND, + ConvexHullPrimitiveType = SERIALIZE_ID_CONVEXHULL, + ConvexHullModifierPrimitiveType = SERIALIZE_ID_CONVEXMODIFIER, + ChamferCylinderPrimitiveType = SERIALIZE_ID_CHAMFERCYLINDER, + TreeCollisionPrimitiveType = SERIALIZE_ID_TREE, + NullPrimitiveType = SERIALIZE_ID_NULL, + HeighFieldPrimitiveType = SERIALIZE_ID_HEIGHTFIELD, + ScenePrimitiveType = SERIALIZE_ID_SCENE }; /* @@ -82,20 +80,21 @@ unsigned getUserID() const { return NewtonCollisionGetUserID( m_col ); } //! make unique - void makeUnique() { NewtonCollisionMakeUnique( m_world->getNewtonWorld(), m_col ); } + void makeUnique(); //! get the Axis-Aligned Bounding Box for this collision shape. Ogre::AxisAlignedBox getAABB( const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ) const; //! Returns the Collisiontype for this Collision - CollisionPrimitive getCollisionPrimitiveType() const { return getCollisionPrimitiveType( m_col ); } + CollisionPrimitiveType getCollisionPrimitiveType() const { return getCollisionPrimitiveType( m_col ); } //! Returns the Collisiontype for the given Newton-Collision - static CollisionPrimitive getCollisionPrimitiveType(const NewtonCollision *col); + static CollisionPrimitiveType getCollisionPrimitiveType(const NewtonCollision *col); //! friend functions for the Serializer - friend void CollisionSerializer::exportCollision(const Collision* collision, const Ogre::String& filename); - friend void CollisionSerializer::importCollision(Ogre::DataStreamPtr& stream, Collision* pDest); + friend class OgreNewt::CollisionSerializer; + //friend void CollisionSerializer::exportCollision(const CollisionPtr& collision, const Ogre::String& filename); + //friend CollisionPtr CollisionSerializer::importCollision(Ogre::DataStreamPtr& stream, OgreNewt::World* world); protected: @@ -104,9 +103,8 @@ }; -//typedef Ogre::SharedPtr<Collision> CollisionPtr; -typedef Collision* CollisionPtr; + //! represents a collision shape that is explicitly convex. class _OgreNewtExport ConvexCollision : public Collision { @@ -135,14 +133,31 @@ }; +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR +typedef Collision* CollisionPtr; +typedef ConvexCollision* ConvexCollisionPtr; +#else +typedef boost::shared_ptr<Collision> CollisionPtr; +typedef boost::shared_ptr<ConvexCollision> ConvexCollisionPtr; +#endif + + + //! represents a scalable collision shape. -class _OgreNewtExport ConvexModifierCollision : public Collision +class _OgreNewtExport ConvexModifierCollision : public ConvexCollision { public: //! constructor - ConvexModifierCollision( const OgreNewt::World* world, const OgreNewt::Collision* col ); + /*! + Create a 'blank' box collision object. Can be used for CollisionSerializer::importCollision + \param world pointer to the OgreNewt::World + */ + ConvexModifierCollision( const OgreNewt::World* world ); + //! constructor + ConvexModifierCollision( const OgreNewt::World* world, const OgreNewt::ConvexCollisionPtr col ); + //! destructor ~ConvexModifierCollision(); Modified: branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -264,7 +264,7 @@ /*! Create a tree collision object. \param world pointer to the OgreNewt::World - \param node pointer to an Ogre::SceneNode with a single entity attached. + \param ent pointer to an Ogre::Entitiy, if it is attached to a node, the scale of the parent node is used \param optimize bool whether you want to optimize the collision or not. */ TreeCollision( const World* world, Ogre::Entity* ent, bool optimize, FaceWinding fw = FW_DEFAULT ); @@ -388,7 +388,7 @@ \param world pointer to the OgreNewt::World \param col_array std::vector of pointers to existing collision objects. */ - CompoundCollision( const World* world, std::vector<OgreNewt::Collision*> col_array ); + CompoundCollision( const World* world, std::vector<OgreNewt::CollisionPtr> col_array ); //! destructor ~CompoundCollision() {} Modified: branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -14,12 +14,11 @@ #include "OgreNewt_Prerequisites.h" +#include "OgreNewt_Collision.h" // OgreNewt namespace. all functions and classes use this namespace. namespace OgreNewt { - class Collision; - /*! This class can be used to (de)serialize a Collision. Pre-building a Collision and serializing from a tool, then deserializing it at runtime may be more efficient than building the Collision on the fly, especially for complex objects. @@ -37,13 +36,13 @@ /*! Serialize the Collision to a file with the given name. */ - void exportCollision(const Collision* collision, const Ogre::String& filename); + void exportCollision(const OgreNewt::CollisionPtr& collision, const Ogre::String& filename); /*! Deserialize the Collision from a DataStream. this will create a NEW Collision object */ - void importCollision(Ogre::DataStreamPtr& stream, Collision* pDest); + OgreNewt::CollisionPtr importCollision(Ogre::DataStreamPtr& stream, OgreNewt::World* world); private: /*! Modified: branches/ogrenewt/newton20/inc/OgreNewt_ContactCallback.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_ContactCallback.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_ContactCallback.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -20,7 +20,6 @@ namespace OgreNewt { -class Body; //! custom contact behavior /*! Modified: branches/ogrenewt/newton20/inc/OgreNewt_ContactJoint.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_ContactJoint.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_ContactJoint.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -20,8 +20,6 @@ namespace OgreNewt { -class Contact; -class MaterialPair; //! with this class you can iterate through all contacts /*! Modified: branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_Debugger.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -25,10 +25,6 @@ namespace OgreNewt { - class World; - class Body; - class MaterialID; - class Collision; //! For viewing the Newton rigid bodies visually. /*! @@ -90,7 +86,7 @@ void addRay(const Ogre::Vector3 &startpt, const Ogre::Vector3 &endpt); //! this function is used internally - void addConvexRay(const OgreNewt::Collision* col, const Ogre::Vector3 &startpt, const Ogre::Quaternion &colori, const Ogre::Vector3 &endpt); + void addConvexRay(const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3 &startpt, const Ogre::Quaternion &colori, const Ogre::Vector3 &endpt); //! this function is used internally void addDiscardedBody(const OgreNewt::Body* body); @@ -117,8 +113,12 @@ struct BodyDebugData { - BodyDebugData() : m_lastcol(NULL), m_node(NULL), m_lines(NULL), m_text(NULL), m_updated(false) {} - const Collision* m_lastcol; + BodyDebugData() : +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + m_lastcol(NULL), +#endif + m_node(NULL), m_lines(NULL), m_text(NULL), m_updated(false) {} + CollisionPtr m_lastcol; Ogre::SceneNode* m_node; Ogre::ManualObject* m_lines; OgreNewt::OgreAddons::MovableText* m_text; Modified: branches/ogrenewt/newton20/inc/OgreNewt_Joint.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Joint.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_Joint.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -20,8 +20,6 @@ namespace OgreNewt { -class World; -class Body; //! base class for all joints. /*! @@ -71,22 +69,35 @@ /*! user data can be used to connect this class to other user classes through the use of this general pointer. */ - void setUserData( void* ptr ) { m_userdata = ptr; } +#ifndef OGRENEWT_NO_OGRE_ANY + void setUserData( const Ogre::Any& data ) { m_userdata = data; } +#else + void setUserData( void* data ) { m_userdata = data; } +#endif //! get user data for this joint /*! user data can be used to connect this class to other user classes through the use of this general pointer. */ +#ifndef OGRENEWT_NO_OGRE_ANY + const Ogre::Any& getUserData() const { return m_userdata; } +#else void* getUserData() const { return m_userdata; } +#endif - + protected: NewtonJoint* m_joint; const OgreNewt::World* m_world; - void* m_userdata; +#ifndef OGRENEWT_NO_OGRE_ANY + Ogre::Any m_userdata; +#else + void* m_userdata; +#endif + static void _CDECL destructor( const NewtonJoint* me ); }; Modified: branches/ogrenewt/newton20/inc/OgreNewt_MaterialID.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_MaterialID.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_MaterialID.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -19,7 +19,6 @@ namespace OgreNewt { -class World; //! represents a material class _OgreNewtExport MaterialID @@ -32,11 +31,6 @@ */ MaterialID( const World* world ); - /*! - Overloaded constructor, sets the internal ID manually. should not be used by the end-user. - */ - MaterialID( const World* world, int ID ); - //! destructor ~MaterialID(); @@ -45,6 +39,14 @@ protected: + friend class OgreNewt::World; + + /*! + Overloaded constructor, sets the internal ID manually. should not be used by the end-user. + */ + MaterialID( const World* world, int ID ); + +private: int id; const OgreNewt::World* m_world; Modified: branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -21,9 +21,6 @@ namespace OgreNewt { -class Collision; -class ConvexCollision; - //! PlayerController /*! this class implements a player-controller based on the code of the CustomPlayerController-class in the Newton-CustomJoints library @@ -85,9 +82,9 @@ Ogre::Vector3 m_upVector; bool m_isInJumpState; - OgreNewt::ConvexCollision* m_verticalSensorShape; - OgreNewt::ConvexCollision* m_horizontalSensorShape; - OgreNewt::ConvexCollision* m_dynamicsSensorShape; + OgreNewt::ConvexCollisionPtr m_verticalSensorShape; + OgreNewt::ConvexCollisionPtr m_horizontalSensorShape; + OgreNewt::ConvexCollisionPtr m_dynamicsSensorShape; virtual bool convexStaticCastPreFilter(OgreNewt::Body *body); virtual bool convexDynamicCastPreFilter(OgreNewt::Body *body); @@ -133,7 +130,7 @@ public: StaticConvexCast(PlayerController *pc) : m_parent(pc) {} - void go(const OgreNewt::Collision* col, const Ogre::Vector3& startpt, + void go(const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int thread) { go(m_parent->getControlledBody()->getWorld(), col, startpt, colori, endpt, maxcontactscount, thread); @@ -150,7 +147,7 @@ public: DynamicConvexCast(PlayerController *pc) : m_parent(pc) {} - void go(const OgreNewt::Collision* col, const Ogre::Vector3& startpt, + void go(const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int thread) { go(m_parent->getControlledBody()->getWorld(), col, startpt, colori, endpt, maxcontactscount, thread); @@ -167,7 +164,7 @@ public: AllBodyConvexCast(PlayerController *pc) : m_parent(pc) {} - void go(const OgreNewt::Collision* col, const Ogre::Vector3& startpt, + void go(const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int thread) { go(m_parent->getControlledBody()->getWorld(), col, startpt, colori, endpt, maxcontactscount, thread); Modified: branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -22,6 +22,9 @@ # include <Ogre/OgreRenderable.h> # include <Ogre/OgreNode.h> # include <Ogre/OgreFrameListener.h> +# ifndef OGRENEWT_NO_OGRE_ANY +# include <Ogre/OgreAny.h> +# endif #else #include <OgreVector3.h> #include <OgreQuaternion.h> @@ -29,9 +32,17 @@ #include <OgreRenderable.h> #include <OgreNode.h> #include <OgreFrameListener.h> +# ifndef OGRENEWT_NO_OGRE_ANY +# include <OgreAny.h> +# endif #endif #include <Newton.h> +#include <boost/function.hpp> +#include <boost/bind.hpp> +#ifndef OGRENEWT_NO_COLLISION_SHAREDPTR +# include <boost/shared_ptr.hpp> +#endif #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 # define _CDECL _cdecl @@ -47,5 +58,28 @@ # define _CDECL #endif + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR +#warning "the option OGRENEWT_NO_COLLISION_SHAREDPTR is set" +#endif + +#ifdef OGRENEWT_NO_OGRE_ANY +#warning "the option OGRENEWT_NO_OGRE_ANY is set" +#endif + +namespace OgreNewt +{ + class World; + class MaterialID; + class Joint; + class Contact; + class MaterialPair; + class Body; + class Collision; + class CollisionSerializer; + class ConvexCollision; + class Debugger; +} + #endif Modified: branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -21,8 +21,6 @@ namespace OgreNewt { -class World; -class Body; //! general raycast /*! @@ -186,7 +184,7 @@ \param maxcontactscount maximum number of contacts that should be saved, set to 0 if you only need the distance to the first intersection */ - void go( const OgreNewt::World* world, const OgreNewt::Collision* col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int threadIndex); + void go( const OgreNewt::World* world, const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int threadIndex); //! user callback pre-filter function. /*! @@ -254,7 +252,7 @@ \param endpt ending point of ray in global space \param maxcontactscount maximum number of contacts that should be saved */ - BasicConvexcast( const OgreNewt::World* world, const OgreNewt::Collision* col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int threadIndex); + BasicConvexcast( const OgreNewt::World* world, const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int threadIndex); //! destuctor. ~BasicConvexcast(); Modified: branches/ogrenewt/newton20/inc/OgreNewt_Tools.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Tools.h 2009-04-27 23:06:24 UTC (rev 2690) +++ branches/ogrenewt/newton20/inc/OgreNewt_Tools.h 2009-05-18 17:21:05 UTC (rev 2691) @@ -14,12 +14,12 @@ #include "OgreNewt_Prerequisites.h" +#include "OgreNewt_Collision.h" namespace OgreNewt { - class World; - class Collision; + //! set of handy convertors. namespace Converters { @@ -70,7 +70,7 @@ \param retnormal returned normal on the collision primitive in global space */ _OgreNewtExport int CollisionPointDistance( const OgreNewt::World* world, const Ogre::Vector3& globalpt, - const OgreNewt::Collision* col, const Ogre::Quaternion& colorient, const Ogre::Vector3& colpos, + const OgreNewt::CollisionPtr& col, const Ogre::Quaternion& colorient, const Ogre::Vector3& colpos, Ogre::Vector3& retpt, Ogre::Vector3& retnormal, int threadIndex ); @@ -88,8 +88,8 @@ \param retPosB returned position on collision primitive B \param retNorm returned collision normal */ - _OgreNewtExport int CollisionClosestPoint( const OgreNewt::World* world, const OgreNewt::Collision* colA, const Ogre::Quaternion& colOrientA, const Ogre::Vector3& colPosA, - const OgreNewt::Collision* colB, const Ogre::Quaternion& colOrientB, const Ogre::Vector3& colPosB, + _OgreNewtExport int CollisionClosestPoint( const OgreNewt::World* world, const OgreNewt::CollisionPtr& colA, const Ogre::Quaternion& colOrientA, const Ogre::Vector3& colPosA, + const OgreNewt::CollisionPtr& colB, const Ogre::Quaternion& colOrientB, const Ogre::Vector3& colPosB, Ogre::Vector3& retPosA, Ogre::Vector3& retPosB, Ogre::Vector3& retNorm, int threadIndex ); @@ -110,8 +110,8 @@ \param retPenetrations returned penetrations for each contact. */ _OgreNewtExport int CollisionCollide( const OgreNewt::World* world, int maxSize, - const OgreNewt::Collision* colA, const Ogre::Quaternion& colOrientA, const Ogre::Vector3& colPosA, - const OgreNewt::Collision* colB, const Ogre::Quaternion& colOrientB, const Ogre::Vector3& colPosB, + const OgreNewt::CollisionP... [truncated message content] |
From: <me...@us...> - 2009-08-01 20:10:01
|
Revision: 2722 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2722&view=rev Author: melven2 Date: 2009-08-01 20:09:43 +0000 (Sat, 01 Aug 2009) Log Message: ----------- -updated to newton 2.04 -interface changes (concerning collisions) -some multithreading fixes and the linux version now uses pthreads -probably very unstable (I didn't have much time), so use the revision 2676 instead with an older version of newton 2.0 beta Revision Links: -------------- http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2676&view=rev Modified Paths: -------------- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h branches/ogrenewt/newton20/inc/OgreNewt_Body.h branches/ogrenewt/newton20/inc/OgreNewt_Collision.h branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h branches/ogrenewt/newton20/inc/OgreNewt_World.h branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp branches/ogrenewt/newton20/src/OgreNewt_Body.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_World.cpp Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -55,7 +55,7 @@ // here's where we make a collision shape for the physics. note that we use the same size as // above. - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder(m_World, 2.5, 5)); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder(m_World, 2.5, 5, 0)); // now we make a new rigid body based on this collision shape. OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonFrameListener.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -80,7 +80,7 @@ //ent->setNormaliseNormals(true); // again, make the collision shape. - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder(m_World, 1, 1)); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder(m_World, 1, 1, 0)); // then make the rigid body. OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); @@ -125,6 +125,10 @@ debug.stopRaycastRecording(); } + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -73,7 +73,7 @@ // using the new "SceneParser" TreeCollision primitive. this will automatically parse an entire tree of // SceneNodes (parsing all children), and add collision for all meshes in the tree. OgreNewt::CollisionPrimitives::TreeCollisionSceneParser* stat_col = new OgreNewt::CollisionPrimitives::TreeCollisionSceneParser( m_World ); - stat_col->parseScene( floornode, true ); + stat_col->parseScene( floornode, true, 0 ); OgreNewt::Body* bod = new OgreNewt::Body( m_World, OgreNewt::CollisionPtr(stat_col) ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete stat_col; @@ -162,7 +162,7 @@ box1node->setScale( size ); // box1->setNormaliseNormals(true); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -74,7 +74,7 @@ ent->setMaterialName( "Simple/dirt01" ); // ent->setNormaliseNormals(true); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1), 0 )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR @@ -112,6 +112,10 @@ + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ConveyorBelt.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -27,7 +27,7 @@ mNode->setScale( size ); // create the collision object for the conveyor belt. - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size )); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size, 0 )); mBody = new OgreNewt::Body( world, col, conveyorType ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -79,7 +79,7 @@ floor->setCastShadows( false ); //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true )); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR @@ -125,7 +125,7 @@ mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 600 ); mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -68,7 +68,7 @@ ent->setMaterialName( "Simple/BumpyMetal" ); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); Ogre::Vector3 inertia, offset; @@ -106,6 +106,10 @@ + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -75,7 +75,7 @@ //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true )); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; @@ -176,7 +176,7 @@ box1node->attachObject( box1 ); box1node->setScale( size ); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -180,6 +180,10 @@ + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -48,7 +48,7 @@ floor->setCastShadows( false ); //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floornode, false ); + OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floornode, false, 0 ); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); delete col; Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -74,7 +74,7 @@ ent->setMaterialName( "Simple/dirt01" ); - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) ); + OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1), 0 ); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcSphereSolid( 10.0, 1.0 ); @@ -140,6 +140,10 @@ + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) { if (mCar) Modified: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -75,7 +75,7 @@ //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true )); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; @@ -193,7 +193,7 @@ box1node->attachObject( box1 ); box1node->setScale( size ); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); Modified: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonFrameListener.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -165,7 +165,7 @@ { debug.showDebugInformation(); debug.startRaycastRecording(); - debug.clearRaycastsRecorded(); + //debug.clearRaycastsRecorded(); } else { @@ -176,6 +176,10 @@ + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; @@ -214,12 +218,15 @@ Ogre::Vector3 dragForce = ((campt - bodpt) * mass * 8.0) - me->getVelocity(); // draw a 3D line between these points for visual effect :) + /* remove3DLine(); mDragLine->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST ); mDragLine->position( campt ); mDragLine->position( bodpt ); + // ---------------------------- I get an error here using multithreading... ------------------------------- mDragLine->end(); mDragLineNode->attachObject( mDragLine ); + */ // Add the force! Modified: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -74,7 +74,7 @@ // using the new "SceneParser" TreeCollision primitive. this will automatically parse an entire tree of // SceneNodes (parsing all children), and add collision for all meshes in the tree. OgreNewt::CollisionPrimitives::TreeCollisionSceneParser* stat_col = new OgreNewt::CollisionPrimitives::TreeCollisionSceneParser( m_World ); - stat_col->parseScene( floornode, true ); + stat_col->parseScene( floornode, true, 0 ); OgreNewt::Body* bod = new OgreNewt::Body( m_World, OgreNewt::CollisionPtr(stat_col) ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete stat_col; @@ -162,7 +162,7 @@ box1node->attachObject( box1 ); box1node->setScale( size ); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); Modified: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonFrameListener.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -73,7 +73,7 @@ ent->setMaterialName( "Simple/dirt01" ); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1), 0 )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); Ogre::Vector3 inertia, offset; @@ -111,6 +111,10 @@ + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonApplication.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -49,7 +49,7 @@ floor->setCastShadows( false ); //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true )); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; @@ -99,7 +99,7 @@ box1node->attachObject( box1 ); box1node->setScale( size ); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/OgreNewtonFrameListener.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -87,7 +87,7 @@ ent->setMaterialName( "Simple/dirt01" ); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1) )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1), 0 )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); Ogre::Vector3 inertia, offset; @@ -185,6 +185,8 @@ + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) return false; Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Ragdoll.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -36,23 +36,23 @@ switch (shape) { case RagDoll::RagBone::BS_BOX: - col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size )); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size, 0 )); break; case RagDoll::RagBone::BS_CAPSULE: - col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Capsule( world, size.y, size.x, orient, pos )); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Capsule( world, size.y, size.x, 0, orient, pos )); break; case RagDoll::RagBone::BS_CONE: - col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cone( world, size.y, size.x, orient, pos )); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cone( world, size.y, size.x, 0, orient, pos )); break; case RagDoll::RagBone::BS_CYLINDER: - col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder( world, size.y, size.x, orient, pos )); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder( world, size.y, size.x, 0, orient, pos )); break; case RagDoll::RagBone::BS_ELLIPSOID: - col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( world, size )); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( world, size, 0 )); break; case RagDoll::RagBone::BS_CONVEXHULL: @@ -60,7 +60,7 @@ break; default: - col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size )); + col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( world, size, 0 )); break; } @@ -212,7 +212,7 @@ } ////////////////////////////////////////////////////////////////////////////////// - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::ConvexHull( world, verts, numVerts )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::ConvexHull( world, verts, numVerts, 0 )); delete []verts; Modified: branches/ogrenewt/newton20/inc/OgreNewt.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt.h 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/inc/OgreNewt.h 2009-08-01 20:09:43 UTC (rev 2722) @@ -9,9 +9,9 @@ main header file. - current version: 2.00 ( I only raised the version number to indicate that this is for Newton2.0! ) + current version: 2.04.0 - Newton version: 2.0 beta (31.01.2009) + Newton version: 2.04 (beta) Ogre version: Shoggoth (1.6.x) @@ -41,7 +41,7 @@ #include "OgreNewt_BodyInAABBIterator.h" #include "OgreNewt_Debugger.h" -/*! \mainpage OgreNewt Library version 2.00 +/*! \mainpage OgreNewt Library version 2.04.0 (for newton version 2.04) \section into_sec Introduction @@ -69,6 +69,11 @@ \section new New in this version New in this version + - first attempts to support multithreading + - update the nodes of the bodies after the newton world update, because Ogre doesn't support multithreaded access to nodes + - linux: added a pthread-mutex for Ogre in OgreNewt::World, so it can be used for access to Ogre from multiple threads + - updated to newton 2.04 -- interface breaking changes (not compatible with newton 2.03!) + - set the collision id when creating a collision - this version uses cmake > 2.6.2! - shared pointers for collisions, if you don't want to use shared pointers define OGRENEWT_NO_COLLISION_SHAREDPTR - uses Ogre::Any instead of void* as userdata, if you want to use void* define OGRENEWT_NO_OGRE_ANY Modified: branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h 2009-08-01 20:09:43 UTC (rev 2722) @@ -490,6 +490,28 @@ Ogre::Quaternion mLocalOrient1; }; + //! CustomDryRollingFriction + /*! + * This joint is usefully to simulate the rolling friction of a rolling ball over a flat surface. + * Normally this is not important for non spherical objects, but for games like poll, pinball, bolling, golf + * or any other where the movement of balls is the main objective the rolling friction is a real big problem. + */ + /* // not tested yet + class _OgreNewtExport CustomDryRollingFriction : public OgreNewt::CustomJoint + { + public: + CustomDryRollingFriction( OgreNewt::Body* child, Ogre::Real radius, Ogre::Real rollingFrictionCoefficient ); + ~CustomDryRollingFriction(); + + void submitConstraint( Ogre::Real timestep, int threadIndex ); + + private: + Ogre::Real mFrictionCoefficient; + Ogre::Real mFrictionTorque; + OgreNewt::Body* mChild; + }; + */ + } // end NAMESPACE PrebuiltCustomJoints Modified: branches/ogrenewt/newton20/inc/OgreNewt_Body.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-08-01 20:09:43 UTC (rev 2722) @@ -179,8 +179,9 @@ generally in a physics engine you shouldn't directly set the location/rotation of a Body, because this defies physics laws. this command exists to set up bodies initially. \param orient quaternion representing body orientation in world space. \param pos vector representing body position in world space. + \param threadIndex only set the thread-index if you don't want the node to be updated immediatly but queued (Ogre doesn't support modifying nodes from several threads) */ - void setPositionOrientation( const Ogre::Vector3& pos, const Ogre::Quaternion& orient ); + void setPositionOrientation( const Ogre::Vector3& pos, const Ogre::Quaternion& orient , int threadIndex = -1); //! set the mass and inertia for the body. /*! @@ -409,6 +410,21 @@ */ NewtonCollision *getNewtonCollision() const { return NewtonBodyGetCollision( m_body ); } + //! Call this to signify that the position/orientation of the attached node needs to be updated + /*! + * This function actually adds this body to a list of bodies that need to be updated. This is done automaticalle after the next world update + * using the updateNode method. + * This function is needed for multithreading support + * \param forceNodeUpdate even request an update if there's already an update request + */ + void requestNodeUpdate(int threadIndex, bool forceNodeUpdate = false); + + //! Return if an node update was requested + bool isNodeUpdateNeeded() const {return m_nodeupdateneeded;} + + //! update the position of the node (if attached) and sets m_nodeupdateneeded to false + void updateNode(); + protected: NewtonBody* m_body; @@ -424,6 +440,7 @@ int m_type; Ogre::Node* m_node; + bool m_nodeupdateneeded; ForceCallback m_forcecallback; TransformCallback m_transformcallback; Modified: branches/ogrenewt/newton20/inc/OgreNewt_Collision.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Collision.h 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/inc/OgreNewt_Collision.h 2009-08-01 20:09:43 UTC (rev 2722) @@ -69,12 +69,13 @@ */ const World* getWorld() const {return m_world;} - //! set a user ID for collision callback identification - /*! - you can set different IDs for each piece in a compound collision object, and then use these IDs in a collision callback to - determine which part is currently colliding. - */ - void setUserID( unsigned id ) const { NewtonCollisionSetUserID( m_col, id); } +// this is not possible any more (since newton 2.04), you can only set the id when creating the collision +// //! set a user ID for collision callback identification +// /*! +// you can set different IDs for each piece in a compound collision object, and then use these IDs in a collision callback to +// determine which part is currently colliding. +// */ +// void setUserID( unsigned id ) const { NewtonCollisionSetUserID( m_col, id); } //! get user ID, for collision callback identification unsigned getUserID() const { return NewtonCollisionGetUserID( m_col ); } Modified: branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-08-01 20:09:43 UTC (rev 2722) @@ -15,6 +15,7 @@ #include "OgreNewt_Prerequisites.h" #include "OgreNewt_Collision.h" +#include "OgreNewt_MaterialID.h" // OgreNewt namespace. all functions and classes use this namespace. @@ -54,10 +55,11 @@ /*! \param world pointer to OgreNewt::World \param size vector representing width, height, depth + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive */ - Box( const World* world, const Ogre::Vector3& size, + Box( const World* world, const Ogre::Vector3& size, int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); //! destructor @@ -80,10 +82,11 @@ for a sphere, pass the same radius for all 3 axis. \param world pointer to OgreNewt::World \param size vector representing radius for all 3 axis + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive */ - Ellipsoid(const World* world, const Ogre::Vector3& size, + Ellipsoid(const World* world, const Ogre::Vector3& size, int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); //! destructor @@ -107,10 +110,11 @@ \param world pointer to OgreNewt::World \param radius radius of the cylinder (Y and Z axis) \param height height of the cylinder (X axis) + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive */ - Cylinder( const World* world, Ogre::Real radius, Ogre::Real height, + Cylinder( const World* world, Ogre::Real radius, Ogre::Real height, int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); //! destructor @@ -134,10 +138,11 @@ \param world pointer to OgreNewt::World \param radius radius of the capsule (Y and Z axis) \param height height of the capsule (X axis) + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive */ - Capsule( const World* world, Ogre::Real radius, Ogre::Real height, + Capsule( const World* world, Ogre::Real radius, Ogre::Real height, int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); //! destructor @@ -161,10 +166,11 @@ \param world pointer to OgreNewt::World \param radius radius of the cone (Y and Z axis) \param height height of the cone (X axis) + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive */ - Cone( const World* world, Ogre::Real radius, Ogre::Real height, + Cone( const World* world, Ogre::Real radius, Ogre::Real height, int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); //! destructor @@ -188,10 +194,11 @@ \param world pointer to OgreNewt::World \param radius radius of the chamfer cylinder (Y and Z axis) \param height height of the chamfer cylinder (X axis) + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive */ - ChamferCylinder( const World* world, Ogre::Real radius, Ogre::Real height, + ChamferCylinder( const World* world, Ogre::Real radius, Ogre::Real height, int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); //! destructor @@ -215,15 +222,16 @@ //! constructor /*! Overloaded constructor. pass an Entity*, and it will use its vertex data. if it is attached to Node*, the collision - will be scaled apperently (entity->getParentNode()->getScale()) + will be scaled apperently (entity->getParentNode()->getScale()), but if the scale changes, you need to adopt your collision by yourself \param world pointer to the OgreNewt::World - \param node pointer to an Ogre::SceneNode with a single entity attached + \param ent pointer to an Ogre::Entity + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive \parem tolerance a tolerance passed to newton \param forceScale if set to something else then (0,0,0), the value of this argument will be used as scale instead of the parent-node's scale */ - ConvexHull( const World* world, Ogre::Entity* ent, + ConvexHull( const World* world, Ogre::Entity* ent, int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO, Ogre::Real tolerance = 0.001f , const Ogre::Vector3& forceScale = Ogre::Vector3::ZERO); /*! @@ -231,11 +239,12 @@ \param world pointer to the OgreNewt::World \param verts pointer to an array of Ogre::Vector3's that contain vertex position data \param vertcount number ot vetices in the array + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive \param tolerance a tolerance passed to newton */ - ConvexHull( const World* world, const Ogre::Vector3* verts, int vertcount, + ConvexHull( const World* world, const Ogre::Vector3* verts, int vertcount,int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO, Ogre::Real tolerance = 0.001f ); //! destructor @@ -266,8 +275,9 @@ \param world pointer to the OgreNewt::World \param ent pointer to an Ogre::Entitiy, if it is attached to a node, the scale of the parent node is used \param optimize bool whether you want to optimize the collision or not. + \param id an id for this shape, can be received with collision->getUserId() */ - TreeCollision( const World* world, Ogre::Entity* ent, bool optimize, FaceWinding fw = FW_DEFAULT ); + TreeCollision( const World* world, Ogre::Entity* ent, bool optimize, int id, FaceWinding fw = FW_DEFAULT ); //! constructor /*! @@ -279,8 +289,9 @@ \param vertices pointer to array of vertices (positions only). \param indices pointer to array of indices. \param optimize bool whether you want to optimize the collision or not. + \param id an id for this shape, can be received with collision->getUserId() */ - TreeCollision( const World* world, int numVertices, int numIndices, const float *vertices, const int *indices, bool optimize, FaceWinding fw = FW_DEFAULT); + TreeCollision( const World* world, int numVertices, int numIndices, const float *vertices, const int *indices, bool optimize, int id, FaceWinding fw = FW_DEFAULT); //! constructor /*! @@ -291,14 +302,15 @@ \param vertices pointer to array of Ogre::Vector3 vertices (positions only) \param indexData pointer to Ogre::IndexData for the mesh \param optimize bool whether you want to optimize the collision or not. + \param id an id for this shape, can be received with collision->getUserId() */ - TreeCollision( const World* world, int numVertices, Ogre::Vector3* vertices, Ogre::IndexData* indexData, bool optimize, FaceWinding fw = FW_DEFAULT); + TreeCollision( const World* world, int numVertices, Ogre::Vector3* vertices, Ogre::IndexData* indexData, bool optimize, int id, FaceWinding fw = FW_DEFAULT); //! destructor virtual ~TreeCollision() {} //! start a tree collision creation - void start(); + void start(int id); //! add a poly to the tree collision /*! @@ -345,7 +357,7 @@ ~TreeCollisionSceneParser() {} //! parse the scene. - void parseScene( Ogre::SceneNode* startNode, bool optimize = true, FaceWinding fw = FW_DEFAULT ); + void parseScene( Ogre::SceneNode* startNode, int id, bool optimize = true, FaceWinding fw = FW_DEFAULT ); protected: @@ -418,11 +430,12 @@ /*! \param world pointer to the OgreNewt::World \param size Ogre::Vector3 size. + \param id an id for this shape, can be received with collision->getUserId() \param orient orientation offset of the primitive \param pos position offset of the primitive \param tolerance a tolerance passed to newton */ - Pyramid( const World* world, const Ogre::Vector3& size, + Pyramid( const World* world, const Ogre::Vector3& size, int id, const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO, Ogre::Real tolerance = 0.001f ); //! destructor Modified: branches/ogrenewt/newton20/inc/OgreNewt_World.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_World.h 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/inc/OgreNewt_World.h 2009-08-01 20:09:43 UTC (rev 2722) @@ -11,6 +11,9 @@ #ifndef _INCLUDE_OGRENEWT_WORLD #define _INCLUDE_OGRENEWT_WORLD +#ifndef WIN32 +#include <pthread.h> +#endif #include "OgreNewt_Prerequisites.h" #include "OgreNewt_BodyInAABBIterator.h" @@ -64,7 +67,7 @@ public: //! Standard Constructor, creates the world. - World(); + World( NewtonAllocMemory newtonAlloc = NULL, NewtonFreeMemory newtonFree = NULL ); //! Standard Destructor, destroys the world. ~World(); @@ -127,6 +130,13 @@ */ void setPlatformArchitecture( int mode ) { NewtonSetPlatformArchitecture( m_world, mode ); } + //! get the architecture used for physics calculations. + /*! + \param description returns a description-string for the currently used mode + \return int representing the current mode + */ + int getPlatformArchitecture(Ogre::String& description) { char desc[265]; int mode = NewtonGetPlatformArchitecture( m_world, desc ); description = desc; return mode;} + //! get the number of bodies in the simulation. /*! returns the number of bodies in the simulation. @@ -139,17 +149,20 @@ //! multithread settings void setMultithreadSolverOnSingleIsland( int mode ) { NewtonSetMultiThreadSolverOnSingleIsland( m_world, mode ); } - //! set the number of threads for the physics simulation to use. + //! get multithread settings + int getMultithreadSolverOnSingleIsland( ) const { return NewtonGetMultiThreadSolverOnSingleIsland( m_world ); } + + //! set the number of threads for the physics simulation to use, don't do this while world update void setThreadCount(int threads) { NewtonSetThreadsCount( m_world, threads ); } //! get the number of threads the simulation is using. int getThreadCount() const { return NewtonGetThreadsCount( m_world ); } //! notify an entrance to a critical section of code. - void criticalSectionLock() { NewtonWorldCriticalSectionLock( m_world ); } + void criticalSectionLock() const { NewtonWorldCriticalSectionLock( m_world ); } //! notify the exit of a critical section of code. - void cricicalSectionUnlock() { NewtonWorldCriticalSectionUnlock( m_world ); } + void criticalSectionUnlock() const { NewtonWorldCriticalSectionUnlock( m_world ); } //! set minimum framerate void setMinimumFrameRate( Ogre::Real frame ) { NewtonSetMinimumFrameRate( m_world, frame ); } @@ -205,17 +218,50 @@ */ Debugger& getDebugger() const {return *m_debugger;} + //! adds an update request for the body, this means that after the next world update the function body->updateNode will be called, if the bodie needs updating + void addBodyUpdateNodeRequest( int threadIndex, OgreNewt::Body* body ) const ; + + +#ifndef WIN32 + //! notify an entrance to a critical section of code concerning Ogre (and only concerning Ogre!) + /*! + * This function is only used in OgreNewt and can be used by the user, it is independent of Ogre's own thread support... + */ + void ogreCriticalSectionLock() const { pthread_mutex_lock(&m_ogreMutex); } + + //! notify the exit of a critical section of code concerning Ogre (and only concerning Ogre!) + /*! + * This function is only used in OgreNewt and can be used by the user, it is independent of Ogre's own thread support... + */ + void ogreCriticalSectionUnlock() const { pthread_mutex_unlock(&m_ogreMutex); } + + //! notify an entrance to a critical section of code concerning Ogre (and only concerning Ogre!) + /*! + * This function is only used in OgreNewt and can be used by the user, it is independent of Ogre's own thread support... + * \return true if not already locked + */ + // bool ogreCriticalSectionTryLock() const { return (EBUSY != pthread_mutex_trylock(&m_ogreMutex)); } +#endif + protected: NewtonWorld* m_world; MaterialID* m_defaultMatID; LeaveWorldCallback m_leaveCallback; - + BodyInAABBIterator m_bodyInAABBIterator; + typedef std::vector< OgreNewt::Body* > BodyVector; + typedef std::vector< BodyVector > BodyVectorVector; + mutable BodyVectorVector m_bodyUpdateNodeRequests; + mutable Debugger* m_debugger; +#ifndef WIN32 + mutable pthread_mutex_t m_ogreMutex; +#endif + private: static void _CDECL newtonLeaveWorld( const NewtonBody* body, int threadIndex ); Modified: branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -604,8 +604,53 @@ addAngularRow( angle, globalOrient0 * Ogre::Vector3::UNIT_X ); } +/* +CustomDryRollingFriction::CustomDryRollingFriction( OgreNewt::Body* child, Ogre::Real radius, Ogre::Real rollingFrictionCoefficient ) : + OgreNewt::CustomJoint(1, child, NULL), + mChild(child) +{ + Ogre::Real mass; + Ogre::Vector3 inertia; + child->getMassMatrix( mass, inertia ); + mFrictionCoefficient = rollingFrictionCoefficient; + mFrictionTorque = inertia.x * radius; +} + +CustomDryRollingFriction::~CustomDryRollingFriction() +{ +} + + +// copied from CustomDryRollingFriction joint in newton +void CustomDryRollingFriction::submitConstraint( Ogre::Real timestep, int threadIndex ) +{ + Ogre::Vector3 omega; + Ogre::Real omegaMag; + Ogre::Real torqueFriction; + + + omega = mChild->getOmega(); + omegaMag = omega.length(); + + if( omegaMag > 0.1f ) + { + addAngularRow(Ogre::Radian(0), omega.normalisedCopy()); + setRowAcceleration( -omegaMag/timestep ); + torqueFriction = mFrictionTorque*mFrictionCoefficient; + setRowMinimumFriction(-torqueFriction); + setRowMaximumFriction(torqueFriction); + } + else + { + mChild->setOmega(omega*0.2f); + } + +} +*/ + + } // end NAMESPACE PrebuiltCustomJoints Modified: branches/ogrenewt/newton20/src/OgreNewt_Body.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Body.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/src/OgreNewt_Body.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -23,6 +23,8 @@ m_transformcallback = NULL; m_buoyancycallback = NULL; + m_nodeupdateneeded = false; + m_body = NewtonCreateBody( m_world->getNewtonWorld(), col->getNewtonCollision() ); NewtonBodySetUserData( m_body, this ); @@ -100,8 +102,7 @@ void Body::standardTransformCallback( OgreNewt::Body* me, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, int threadIndex ) { - me->m_node->setOrientation( orient ); - me->m_node->setPosition( pos ); + me->requestNodeUpdate(threadIndex); } @@ -140,11 +141,16 @@ m_node = node; if (m_body) { - setCustomTransformCallback( &Body::standardTransformCallback ); + if( m_node ) + setCustomTransformCallback( &Body::standardTransformCallback ); + else + setCustomTransformCallback( NULL ); + + updateNode(); } } -void Body::setPositionOrientation( const Ogre::Vector3& pos, const Ogre::Quaternion& orient ) +void Body::setPositionOrientation( const Ogre::Vector3& pos, const Ogre::Quaternion& orient, int threadIndex) { if (m_body) { @@ -155,8 +161,10 @@ if (m_node) { - m_node->setOrientation( orient ); - m_node->setPosition( pos ); + if( threadIndex != -1 ) + requestNodeUpdate(threadIndex); + else + updateNode(); } } } @@ -342,7 +350,10 @@ Ogre::Quaternion bodyorient; getPositionOrientation( bodypos, bodyorient ); - Ogre::Vector3 topoint = pos - bodypos; + Ogre::Vector3 localMassCenter = getCenterOfMass(); + Ogre::Vector3 globalMassCenter = bodyorient * localMassCenter; + + Ogre::Vector3 topoint = pos - bodypos - globalMassCenter; Ogre::Vector3 torque = topoint.crossProduct( force ); addForce( force ); @@ -371,7 +382,41 @@ return NULL; } +void Body::requestNodeUpdate( int threadIndex, bool forceNodeUpdate ) +{ + if( !m_node ) + return; + if( m_nodeupdateneeded && !forceNodeUpdate ) + return; + + m_nodeupdateneeded = true; + + m_world->addBodyUpdateNodeRequest( threadIndex, this ); +} + +void Body::updateNode() +{ + m_nodeupdateneeded = false; + + if( !m_node ) + return; + + Ogre::Vector3 pos; + Ogre::Quaternion orient; + getPositionOrientation(pos, orient); + +#ifndef WIN32 + m_world->ogreCriticalSectionLock(); +#endif + m_node->setPosition(pos); + m_node->setOrientation(orient); +#ifndef WIN32 + m_world->ogreCriticalSectionUnlock(); +#endif +} + + // -------------------------------------------------------------------------------------- Modified: branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp 2009-07-25 11:11:25 UTC (rev 2721) +++ branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp 2009-08-01 20:09:43 UTC (rev 2722) @@ -30,13 +30,13 @@ Box::Box(const World* world) : ConvexCollision( world ) {} - Box::Box( const World* world, const Ogre::Vector3& size, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) + Box::Box( const World* world, const Ogre::Vector3& size, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) { float matrix[16]; OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); - m_col = NewtonCreateBox( m_world->getNewtonWorld(), (float)size.x, (float)size.y, (float)size.z, &matrix[0] ); + m_col = NewtonCreateBox( m_world->getNewtonWorld(), (float)size.x, (float)size.y, (float)size.z, id, &matrix[0] ); } @@ -45,13 +45,13 @@ Ellipsoid::Ellipsoid(const World* world) : ConvexCollision( world ) {} - Ellipsoid::Ellipsoid( const World* world, const Ogre::Vector3& size, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) + Ellipsoid::Ellipsoid( const World* world, const Ogre::Vector3& size, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) { float matrix[16]; OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); - m_col = NewtonCreateSphere( m_world->getNewtonWorld(), (float)size.x, (float)size.y, (float)size.z, &matrix[0] ); + m_col = NewtonCreateSphere( m_world->getNewtonWorld(), (float)size.x, (float)size.y, (float)size.z, id, &matrix[0] ); } @@ -59,14 +59,14 @@ Cylinder::Cylinder(const World* world) : ConvexCollision( world ) {} - Cylinder::Cylinder( const World* world, Ogre::Real radius, Ogre::Real height, + Cylinder::Cylinder( const World* world, Ogre::Real radius, Ogre::Real height, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) { float matrix[16]; OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); - m_col = NewtonCreateCylinder( m_world->getNewtonWorld(), (float)radius, (float)height, &matrix[0] ); + m_col = NewtonCreateCylinder( m_world->getNewtonWorld(), (float)radius, (float)height, id, &matrix[0] ); } @@ -74,14 +74,14 @@ Capsule::Capsule(const World* world) : ConvexCollision( world ) {} - Capsule::Capsule( const World* world, Ogre::Real radius, Ogre::Real height, + Capsule::Capsule( const World* world, Ogre::Real radius, Ogre::Real height, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) { float matrix[16]; OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); - m_col = NewtonCreateCapsule( m_world->getNewtonWorld(), (float)radius, (float)height, &matrix[0] ); + m_col = NewtonCreateCapsule( m_world->getNewtonWorld(), (float)radius, (float)height, id, &matrix[0] ); } @@ -89,28 +89,28 @@ Cone::Cone(const World* world) : ConvexCollision( world ) {} - Cone::Cone( const World* world, Ogre::Real radius, Ogre::Real height, + Cone::Cone( const World* world, Ogre::Real radius, Ogre::Real height, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) { float matrix[16]; OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); - m_col = NewtonCreateCone( m_world->getNewtonWorld(), (float)radius, (float)height, &matrix[0] ); + m_col = NewtonCreateCone( m_world->getNewtonWorld(), (float)radius, (float)height, id, &matrix[0] ); } // OgreNewt::CollisionPrimitives::ChamferCylinder ChamferCylinder::ChamferCylinder(const World* world) : ConvexCollision( world ) {} - ChamferCylinder::ChamferCylinder( const World* world, Ogre::Real radius, Ogre::Real height, + ChamferCylinder::ChamferCylinder( const World* world, Ogre::Real radius, Ogre::Real height, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) : ConvexCollision( world ) { float matrix[16]; OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); - m_col = NewtonCreateChamferCylinder( m_world->getNewtonWorld(), (float)radius, (float)height, &matrix[0] ); + m_col = NewtonCreateChamferCylinder( m_world->getNewtonWorld(), (float)radius, (float)height, id, &matrix[0] ); } @@ -119,7 +119,7 @@ ConvexHull::ConvexHull(const World* world) : ConvexCollision( world ) {} - ConvexHull::ConvexHull( const World* world, Ogre::Entity* obj, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance, const Ogre::Vector3& forceScale ) : ConvexCollision( world ) + ConvexHull::ConvexHull( const World* world, Ogre::Entity* obj, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance, const Ogre::Vector3& forceScale ) : ConvexCollision( world ) { Ogre::Vector3 scale(1.0,1.0,1.0); @@ -235,7 +235,7 @@ OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); //okay, let's try making the ConvexHull! - m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), (int)total_verts, (float*)&vertices[0].x, sizeof(Ogre::Vector3), tolerance, &matrix[0] ); + m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), (int)total_verts, (float*)&vertices[0].x, sizeof(Ogre::Vector3), tolerance, id, &matrix[0] ); delete []vertices; @@ -243,13 +243,13 @@ // OgreNewt::CollisionPrimitives::ConvexHull - ConvexHull::ConvexHull( const World* world, const Ogre::Vector3* verts, int vertcount, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance ) : ConvexCollision( world ) + ConvexHull::ConvexHull( const World* world, const Ogre::Vector3* verts, int vertcount, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance ) : ConvexCollision( world ) { float matrix[16]; OgreNewt::Converters::QuatPosToMatrix( orient, pos, &matrix[0] ); //make the collision primitive. - m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), vertcount, (float*)&verts[0].x, sizeof(Ogre::Vector3), tolerance, &matrix[0]); + m_col = NewtonCreateConvexHull( m_world->getNewtonWorld(), vertcount, (float*)&verts[0].x, sizeof(Ogre::Vector3), tolerance, id, &matrix[0]); } @@ -260,11 +260,11 @@ } - TreeCollision::TreeCollision( const World* world, Ogre::Entity* obj, bool optimize, FaceWinding fw ) : Collision( world ) + TreeCollision::TreeCollision( const World* world, Ogre::Entity* obj, bool optimize, int id, FaceWinding fw ) : Collision( world ) { Ogre::Vector3 scale; - start(); + start(id); Ogre::MeshPtr mesh = obj->getMesh(); @@ -394,9 +394,9 @@ } - TreeCollision::TreeCollision(const OgreNewt::World *world, int numVertices, int numIndices, const float *vertices, const int *indices, bool optimize, FaceWinding fw) : OgreNewt::Collision( world ) + TreeCollision::TreeCollision(const OgreNewt::World *world, int numVertices, int numIndices, const float *vertices, const int *indices, bool optimize, int id, FaceWinding fw) : OgreNewt::Collision( world ) { - start(); + start(id); int numPolys = numIndices / 3; @@ -435,9 +435,9 @@ } - TreeCollision::TreeCollision( const World* world, int numVertices, Ogre::Vector3* vertices, Ogre::IndexData* indexData, bool optimize, FaceWinding fw) : Collision( world ) + TreeCollision::TreeCollision( const World* world, int numVertices, Ogre::Vector3* vertices, Ogre::IndexData* indexData, bool optimize, int id, FaceWinding fw) : Collision( world ) { - start(); + start(id); unsigned int numPolys = indexData->indexCount / 3; Ogre::HardwareIndexBufferSharedPtr hwIndexBuffer=indexData->indexBuffer; @@ -499,9 +499,9 @@ } - void TreeCollision::start() + void TreeCollision::start(int id) { - m_col = NewtonCreateTreeCollision( m_world->getNewtonWorld() ); + m_col = NewtonCreateTreeCollision( m_world->getNewtonWorld(), id ); NewtonTreeCollisionBeginBuild( m_col ); } @@ -546,11 +546,11 @@ { } - void TreeCollisionSceneParser::parseScene( Ogre::SceneNode *startNode, bool optimize, FaceWinding fw) + void TreeCollisionSceneParser::parseScene( Ogre::SceneNode *startNode, int id, bool optimize, FaceWinding fw) { count = 0; - start(); + start(id); // parse the individual nodes. Ogre::Quaternion rootOrient = Ogre::Quaternion::IDE... [truncated message content] |
From: <me...@us...> - 2009-08-21 13:25:47
|
Revision: 2727 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2727&view=rev Author: melven2 Date: 2009-08-21 13:25:38 +0000 (Fri, 21 Aug 2009) Log Message: ----------- -updated to newton 2.07 -interface breaking changes (shape id parameter) -added player controller demo (player controller is NOT working yet) and did some work on the player controller -CustomJoint: - added globalToLocal function - added feedbackCollector callback Modified Paths: -------------- branches/ogrenewt/newton20/demos/CMakeLists.txt branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_Collision.h branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h branches/ogrenewt/newton20/inc/OgreNewt_Joint.h branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h branches/ogrenewt/newton20/src/OgreNewt_Collision.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp branches/ogrenewt/newton20/src/OgreNewt_Joint.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp Added Paths: ----------- branches/ogrenewt/newton20/Demo09_PlayerController/ branches/ogrenewt/newton20/Demo09_PlayerController/CMakeLists.txt branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonApplication.cpp branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonApplication.h branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonFrameListener.h branches/ogrenewt/newton20/Demo09_PlayerController/demo09.cpp Added: branches/ogrenewt/newton20/Demo09_PlayerController/CMakeLists.txt =================================================================== --- branches/ogrenewt/newton20/Demo09_PlayerController/CMakeLists.txt (rev 0) +++ branches/ogrenewt/newton20/Demo09_PlayerController/CMakeLists.txt 2009-08-21 13:25:38 UTC (rev 2727) @@ -0,0 +1,5 @@ +ADD_EXECUTABLE(Demo09_PlayerController demo09.cpp OgreNewtonApplication.cpp OgreNewtonFrameListener.cpp) + +TARGET_LINK_LIBRARIES(Demo09_PlayerController ${OGRE_LIBRARIES} ${CEGUI_LIBRARIES} ${OGRENEWT_LIBRARIES} ${OIS_LIBRARIES} ${CEGUIOGRE_LIBRARIES}) + +#INSTALL(TARGETS Demo09_PlayerController RUNTIME DESTINATION ${CMAKE_SOURCE_DIR}/bin) Added: branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonApplication.cpp (rev 0) +++ branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonApplication.cpp 2009-08-21 13:25:38 UTC (rev 2727) @@ -0,0 +1,239 @@ +/* + OgreNewt library - connecting Ogre and Newton! + + Demo09_PlayerController +*/ +#include "OgreNewtonApplication.h" +#include "OgreNewtonFrameListener.h" + +#include <OgreNewt.h> +#include <OgreNewt_BasicFrameListener.h> + + +OgreNewtonApplication::OgreNewtonApplication(void) +{ + // create OgreNewt world. + m_World = new OgreNewt::World(); + mPlayer = NULL; + + mEntityCount = 0; + +} + +OgreNewtonApplication::~OgreNewtonApplication(void) +{ + // destroy world. + if( mPlayer ) + delete mPlayer; + delete m_World; +} + + + +void OgreNewtonApplication::createScene() +{ + + // setup CEGUI + mGUIRenderer = new CEGUI::OgreCEGUIRenderer( mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr ); + new CEGUI::System( mGUIRenderer ); + + // load up CEGUI stuff... + try + { + using namespace CEGUI; + CEGUI::Logger::getSingleton().setLoggingLevel( CEGUI::Informative ); + + CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme"); + CEGUI::System::getSingleton().setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow"); + CEGUI::System::getSingleton().setDefaultFont((CEGUI::utf8*)"BlueHighway-10"); + + CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().createWindow( (CEGUI::utf8*)"DefaultWindow", (CEGUI::utf8*)"root_wnd" ); + CEGUI::System::getSingleton().setGUISheet( sheet ); + + //makeGUI(); + //setupGUI(); + + } + catch (CEGUI::Exception) + {} + + + // sky box. + mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); + + // shadows on! + mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_ADDITIVE ); + + + // floor object! + Entity* floor; + SceneNode* floornode; + floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); + floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); + floornode->attachObject( floor ); + floor->setMaterialName( "Simple/BeachStones" ); + floor->setCastShadows( false ); + + + + + //Ogre::Vector3 siz(100.0, 10.0, 100.0); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + //floornode->setScale( siz ); + bod->attachNode( floornode ); + bod->setPositionOrientation( Ogre::Vector3(0.0,-10.0,0.0), Ogre::Quaternion::IDENTITY ); + + + // make a simple rope. + Ogre::Vector3 size(3,1.0,1.0); + Ogre::Vector3 pos(0,1,0); + Ogre::Quaternion orient = Ogre::Quaternion::IDENTITY; + + // loop through, making bodies and connecting them. + OgreNewt::Body* parent = NULL; + OgreNewt::Body* child = NULL; + + for (int x=0;x<8;x++) + { + // make the next box. + child = makeSimpleBox(size, pos, orient); + + // now make a new joint connecting this to the last box. + OgreNewt::Joint* joint; + + // make the joint right between the bodies... + + + if (parent) + { + joint = new OgreNewt::BasicJoints::BallAndSocket( m_World, child, parent, pos-Ogre::Vector3(size.x/2,0,0) ); + } + else + { + // no parent, this is the first joint, so just pass NULL as the parent, to stick it to the "world" + joint = new OgreNewt::BasicJoints::BallAndSocket( m_World, child, NULL, pos-Ogre::Vector3(size.x/2,0,0) ); + } + + // offset pos a little more. + pos += Ogre::Vector3(size.x,0,0); + + // save the last body for the next loop! + parent = child; + } + + for (int i=0; i<15;i++) + { + pos = Ogre::Vector3( 10-rand()%20, 4+rand()%2, 10-rand()%20 ); + size = Ogre::Vector3( 1+rand()%3, 1+rand()%3, 1+rand()%3 ); + + OgreNewt::Body* bod = makeSimpleBox( size, pos, orient ); + } + + makePlayer(); + + + // position camera + mCamera->setPosition(0.0, -3.0, 23.0); + + //make a light + Ogre::Light* light; + + light = mSceneMgr->createLight( "Light1" ); + light->setType( Ogre::Light::LT_POINT ); + light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); + + + +} + + +void OgreNewtonApplication::createFrameListener() +{ + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World, mPlayer); + mRoot->addFrameListener(mFrameListener); + + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); + mRoot->addFrameListener(mNewtonListener); +} + +void OgreNewtonApplication::destroyScene() +{ + CEGUI::System* sys = CEGUI::System::getSingletonPtr(); + delete sys; + + // CEGUI Cleanup + delete mGUIRenderer; +} + + +OgreNewt::Body* OgreNewtonApplication::makeSimpleBox( Ogre::Vector3& size, Ogre::Vector3& pos, Ogre::Quaternion& orient ) +{ + Entity* box1; + SceneNode* box1node; + + box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "box.mesh" ); + box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + box1node->attachObject( box1 ); + box1node->setScale( size ); + + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + + + // base mass on the size of the object. + Ogre::Real mass = size.x * size.y * size.z * 2.5; + // calculate the inertia based on box formula and mass + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + bod->attachNode( box1node ); + bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + box1->setMaterialName( "Simple/BumpyMetal" ); + + + bod->setPositionOrientation( pos, orient ); + + return bod; +} + +void OgreNewtonApplication::makePlayer() +{ + Entity* ellipsoid; + SceneNode* node; + + ellipsoid = mSceneMgr->createEntity( "PlayerControllerEntity", "ellipsoid.mesh"); + node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + node->attachObject( ellipsoid ); + node->setScale(Ogre::Vector3(1,2.5,1)); + + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,2.5,1), 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + bod->attachNode(node); + bod->setMassMatrix( 50, 50*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + ellipsoid->setMaterialName("Simple/dirt01"); + + bod->setPositionOrientation(Ogre::Vector3(0,20,20), Ogre::Quaternion::IDENTITY); + + mPlayer = new OgreNewt::PlayerController(bod, 0.4); +} + Added: branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonApplication.h =================================================================== --- branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonApplication.h (rev 0) +++ branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonApplication.h 2009-08-21 13:25:38 UTC (rev 2727) @@ -0,0 +1,47 @@ +#pragma once + + +#include <ExampleApplication.h> +#include <OgreNewt.h> + +// CEGUI has issues with the Ogre memory manager, this seems to fix it for now. +//#include <OgreNoMemoryMacros.h> +#include <CEGUI/CEGUI.h> +//#include <OgreMemoryMacros.h> + + +#include <OgreCEGUIRenderer.h> +#include <OgreCEGUIResourceProvider.h> + + + + +class OgreNewtonApplication : + public ExampleApplication +{ +public: + OgreNewtonApplication(void); + ~OgreNewtonApplication(void); + +protected: + void createFrameListener(); + void createScene(); + + void destroyScene(); + + // our custom function to simplify making simpe dynamics rigid body boxes. + OgreNewt::Body* makeSimpleBox( Ogre::Vector3& size, Ogre::Vector3& pos, Ogre::Quaternion& orient ); + + void makePlayer(); + +private: + OgreNewt::World* m_World; + OgreNewt::PlayerController *mPlayer; + + Ogre::FrameListener* mNewtonListener; + + int mEntityCount; + + CEGUI::OgreCEGUIRenderer* mGUIRenderer; +}; + Added: branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonFrameListener.cpp (rev 0) +++ branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonFrameListener.cpp 2009-08-21 13:25:38 UTC (rev 2727) @@ -0,0 +1,79 @@ +#include "OgreNewtonFrameListener.h" + + +//#include <OgreNoMemoryMacros.h> +#include <CEGUI/CEGUI.h> +//#include <OgreMemoryMacros.h> + + +OgreNewtonFrameListener::OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, OgreNewt::PlayerController *player) : + ExampleFrameListener(win,cam) +{ + m_World = W; + mSceneMgr = mgr; + mPlayer = player; + + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); +} + +OgreNewtonFrameListener::~OgreNewtonFrameListener(void) +{ +} + +bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) +{ + mKeyboard->capture(); + mMouse->capture(); + + + + // player movement uhjk zi + Ogre::Real forwardSpeed, sideSpeed; + Ogre::Radian heading; + mPlayer->getVelocity(forwardSpeed, sideSpeed, heading); + forwardSpeed = 0; + sideSpeed = 0; + if(mKeyboard->isKeyDown(OIS::KC_U)) + forwardSpeed += 6.0; + if(mKeyboard->isKeyDown(OIS::KC_J)) + forwardSpeed -= 5.0; + if(mKeyboard->isKeyDown(OIS::KC_H)) + sideSpeed -= 5.0; + if(mKeyboard->isKeyDown(OIS::KC_K)) + sideSpeed += 5.0; + if(mKeyboard->isKeyDown(OIS::KC_Z)) + heading += Degree(90)/60.0; + if(mKeyboard->isKeyDown(OIS::KC_I)) + heading -= Degree(90)/60.0; + + mPlayer->setVelocity(forwardSpeed, sideSpeed, heading); + + + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + //debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + //debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + +debug.startRaycastRecording(); + + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) + return false; + + return true; +} + Added: branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonFrameListener.h =================================================================== --- branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonFrameListener.h (rev 0) +++ branches/ogrenewt/newton20/Demo09_PlayerController/OgreNewtonFrameListener.h 2009-08-21 13:25:38 UTC (rev 2727) @@ -0,0 +1,69 @@ +#pragma once +#include "ExampleFrameListener.h" +#include <OgreNewt.h> +#include <OIS.h> +#include <CEGUI.h> + + +class OgreNewtonFrameListener : + public ExampleFrameListener, + public OIS::KeyListener, + public OIS::MouseListener +{ +protected: + OgreNewt::World* m_World; + SceneManager* mSceneMgr; + int count; + OgreNewt::PlayerController* mPlayer; +public: + OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, OgreNewt::PlayerController* player); + ~OgreNewtonFrameListener(void); + + bool frameStarted(const FrameEvent &evt); + + bool mouseMoved (const OIS::MouseEvent &e) + { + CEGUI::System::getSingleton().injectMouseMove( e.state.X.rel, e.state.Y.rel ); + return true; + } + + bool keyPressed( const OIS::KeyEvent &arg ) + { + CEGUI::System::getSingleton().injectKeyDown( arg.key ); + CEGUI::System::getSingleton().injectChar( arg.text ); + return true; + } + + bool keyReleased( const OIS::KeyEvent &arg ) + { + CEGUI::System::getSingleton().injectKeyUp( arg.key ); + return true; + } + + bool mousePressed (const OIS::MouseEvent &e, OIS::MouseButtonID id) + { + CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id)); + return true; + } + + bool mouseReleased (const OIS::MouseEvent &e, OIS::MouseButtonID id) + { + CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id)); + return true; + } + +protected: + CEGUI::MouseButton convertOISMouseButtonToCegui(int id) + { + switch (id) + { + case 0: return CEGUI::LeftButton; + case 1: return CEGUI::RightButton; + case 2: return CEGUI::MiddleButton; + case 3: return CEGUI::X1Button; + default: return CEGUI::LeftButton; + } + + } +}; + Added: branches/ogrenewt/newton20/Demo09_PlayerController/demo09.cpp =================================================================== --- branches/ogrenewt/newton20/Demo09_PlayerController/demo09.cpp (rev 0) +++ branches/ogrenewt/newton20/Demo09_PlayerController/demo09.cpp 2009-08-21 13:25:38 UTC (rev 2727) @@ -0,0 +1,33 @@ + +/* + Demo09_PlayerController + + by melven +*/ + +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#endif + +#include "OgreNewtonApplication.h" + + +#ifdef WIN32 +INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) +#else +int main(int argc, char**argv) +#endif +{ + // Create application object + OgreNewtonApplication app; + + try { + app.go(); + } catch( Ogre::Exception& e ) { + printf( "An Error HAS OCCURED: %s", e.getFullDescription().c_str() ); + } + + return 0; +} + Modified: branches/ogrenewt/newton20/demos/CMakeLists.txt =================================================================== --- branches/ogrenewt/newton20/demos/CMakeLists.txt 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/demos/CMakeLists.txt 2009-08-21 13:25:38 UTC (rev 2727) @@ -62,5 +62,6 @@ ADD_SUBDIRECTORY(Demo06_SimpleBuoyancy) ADD_SUBDIRECTORY(Demo07_CustomJoints) ADD_SUBDIRECTORY(Demo08_RagdollExample) +ADD_SUBDIRECTORY(Demo09_PlayerController) PRINT_ENABLED_FEATURES() Modified: branches/ogrenewt/newton20/inc/OgreNewt.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt.h 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/inc/OgreNewt.h 2009-08-21 13:25:38 UTC (rev 2727) @@ -1,172 +1,176 @@ -/* - OgreNewt library - - connects Ogre with the Newton Game Dynamics physics library - - - by Walaber (http://walaber.com) - some changes by melven - - main header file. - - current version: 2.04.0 - - Newton version: 2.04 (beta) - - Ogre version: Shoggoth (1.6.x) - -*/ - -#ifndef _INCLUDE_OGRENEWT_ -#define _INCLUDE_OGRENEWT_ - - -#include "OgreNewt_World.h" -#include "OgreNewt_Collision.h" -#include "OgreNewt_Body.h" -#include "OgreNewt_CollisionPrimitives.h" -#include "OgreNewt_CollisionSerializer.h" -#include "OgreNewt_MaterialID.h" -#include "OgreNewt_MaterialPair.h" -#include "OgreNewt_ContactCallback.h" -#include "OgreNewt_ContactJoint.h" -#include "OgreNewt_Vehicle.h" -#include "OgreNewt_PlayerController.h" -#include "OgreNewt_RayCast.h" - -#include "OgreNewt_Joint.h" -#include "OgreNewt_BasicJoints.h" - -#include "OgreNewt_Tools.h" -#include "OgreNewt_BodyInAABBIterator.h" -#include "OgreNewt_Debugger.h" - -/*! \mainpage OgreNewt Library version 2.04.0 (for newton version 2.04) - - \section into_sec Introduction - - OgreNewt is an OOP wrapper for integrating the Newton Dynamics Physics SDK with OGRE. - - \section problems Problems and missing features in this version - - Problems and missing features in this version - - HeightFieldCollision - - PlayerController not finished - - the convexcast seems to have difficulties with more than one contact (I've segfault when debugging it with the OgreNewt::Debugger...) - I added a hack, it only creates one contact at the maximum at the moment! <-- this is probably due to an error in newton - - this library supports the newton functions for multithreading but there are several functions/classes in this - library itself, that are not thread safe (I don't need multiple threads) - especially the world-updates are not threadsafe in ogre (see newton forum, someone posted a solution there!) - - the copied MovableText class (in Tools::OgreAddons) seems to have some graphics error (it's used - to show the debugging information above each body) - - I didn't test several features: - - vehicle - - joints - - collision-serializer - - treecollision raycastcallback - - - \section new New in this version - - New in this version - - first attempts to support multithreading - - update the nodes of the bodies after the newton world update, because Ogre doesn't support multithreaded access to nodes - - linux: added a pthread-mutex for Ogre in OgreNewt::World, so it can be used for access to Ogre from multiple threads - - updated to newton 2.04 -- interface breaking changes (not compatible with newton 2.03!) - - set the collision id when creating a collision - - this version uses cmake > 2.6.2! - - shared pointers for collisions, if you don't want to use shared pointers define OGRENEWT_NO_COLLISION_SHAREDPTR - - uses Ogre::Any instead of void* as userdata, if you want to use void* define OGRENEWT_NO_OGRE_ANY - - several interface-breaking changes: - - the ContactCallback passes a ContactJoint as argument that can be used to iterate through all contacts - (the callback is not called for each contact any more, but for each pair of colliding bodies!) - - added a lots of new simple "iterators": - - for Bodies use body = World->getFirstBody() and body = body->getNext() - - for the - - BodyIterator renamed to BodyInAABBIterator, it does now only iterate through bodies in a specific AABB - - removed "Singleton-classes", the debugger and the BodyInAABBIterator are now part of a World - (call world->getDebugger() / world->getBodyInAABBIterator() to use these classes!) - - added support for trigger-volumes (ConvexCollision::setAsTriggerVolume ...) - - added support for convexcasts - - added additional debugging features: - - raycast/convexcast debugging - - information about each body as billboard above it - - a lot of minor changes and functions added and renamed - - - previous changes... - - updated to Newton version 2.0!! Many big improvements and changes to the library, and OgreNewt now supports it. - - several interface-breaking changes: - - updated to support multithreading support now native to Newton. - - MomentOfInertia namespace and helper functions removed entirely. Newton can now calculate inertia and center of - mass automatically, use ConvexCollision::calculateInertialMatrix, and multiply by objects Mass. - - Body::attachToNode has been renamed to attachNode, better implying the relationship between the body and the Ogre::Node. - - BodyIterator class has been upgraded to use boost::function, allowing the same callback flexibility as other callbacks. - - - bug fix - fixed problem with TreeCollisionSceneParser that wasn't adjusting to different scales properly. - - optimization - fixed several classes to only write debug data to the LOG when compiled in DEBUG mode: - - Custom2DJonit - - BasicFrameListener - - added the concept of "face-winding" to all TreeCollision classes. should not cause any breaking changes to code, but allows more flexibility to change the "direction" of a face in treecollisions. - - OgreNewt and it's demos are now fully compatible with Ogre 1.4.x (Eihort). - - Addition of script files for compiling under linux (Scons) - - slight modification to the ContactCallback class to allow access to Newton structures from the outside. - - some cosmetic changes to make the wrapper compile more easily under Linux and other non-windows platforms. - - updated to work with the release version of Ogre dagon (1.2) - - updated to work with version 1.53 of Newton - - raycast now has an optional pre-filter to ignore specific bodies from the raycast. - - various other clean-up! - - moved callback system to much more OOP-friendly "boost::function" system. callbacks can now be instance-specific member functions! - - several other small fixes to project files, etc. - - automatic convex hull generation system added to supplementary ragdoll class (see demo08). - - documentation updated. - - updated to Newton version 1.5 - - added this documentation! - - added buoyancy functionality. - - New Buoyancy demo. - - New Ragdoll demo, using a seperate class to implement ragdoll functionality. - - added basic classes for CustomJoints, and a simple demo showing how they work. - - added several prebuilt custom joints, including pulleys and gears, and a general 2D joint. - - added calculateInertialMatrix to ConvexCollision class. - - added set/getCenterOfMass to Body class - - changed angle-related functions in BasicJoint classes to use Ogre::Radian instead of Ogre::Real. - - added ConvexModifierCollision class, which allows for arbitrarily scaled collision primitives. - - added several low-level collision functions, see the CollisionTools namespace. - - fixed errors causing run-time crash on Slider and Universal joints. - - added LeaveWorldCallback functionality to World class. - - \section install Installation - - OgreNewt comes with a project for MSVC++ 7.1 and MSVC++ 8.0 (2005). unfortunately I have no other IDE's or compilers setup on my system, so I - cannot provide any other projects. the MSVC solution should build out of the box, assuming you take a few things into - consideration. - - unzip this in the ogreaddons directory alongside your "ogrenew" directory. to compile correctly, it also assumes you have the Newton SDK installed in another - directory alongside this one called "NewtonSDK". - - for example something like this: - - - c:/programming/Ogre/ogrenew <- ogre installation - - c:/programming/Ogre/ogreaddons/OgreNewt <- OgreNewt main directory. - - c:/programming/NewtonSDK <- Newton SDK. - - c:/programming/tinyxml <- tinyxml library (needed for ragdoll demo only) - - \section compiling Compiling - - OgreNewt compiles by default to a static library for linking to your project. However you can also compile OgreNewt into a dynamic DLL on the - Windows platform by using the Debug_DLL and Release_DLL solution build configurations in the MSVC solutions. - - \section license License - - OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. - - - well, that's about it! - have fun! - - -walaber - -*/ - -#endif - +/* + OgreNewt library + + connects Ogre with the Newton Game Dynamics physics library + + + by Walaber (http://walaber.com) + some changes by melven + + main header file. + + current version: 2.07.0 + + Newton version: 2.07 (beta) + + Ogre version: Shoggoth (1.6.x) + +*/ + +#ifndef _INCLUDE_OGRENEWT_ +#define _INCLUDE_OGRENEWT_ + + +#include "OgreNewt_World.h" +#include "OgreNewt_Collision.h" +#include "OgreNewt_Body.h" +#include "OgreNewt_CollisionPrimitives.h" +#include "OgreNewt_CollisionSerializer.h" +#include "OgreNewt_MaterialID.h" +#include "OgreNewt_MaterialPair.h" +#include "OgreNewt_ContactCallback.h" +#include "OgreNewt_ContactJoint.h" +#include "OgreNewt_Vehicle.h" +#include "OgreNewt_PlayerController.h" +#include "OgreNewt_RayCast.h" + +#include "OgreNewt_Joint.h" +#include "OgreNewt_BasicJoints.h" + +#include "OgreNewt_Tools.h" +#include "OgreNewt_BodyInAABBIterator.h" +#include "OgreNewt_Debugger.h" + +/*! \mainpage OgreNewt Library version 2.07.0 (for newton version 2.07) + + \section into_sec Introduction + + OgreNewt is an OOP wrapper for integrating the Newton Dynamics Physics SDK with OGRE. + + \section problems Problems and missing features in this version + + Problems and missing features in this version + - HeightFieldCollision + - PlayerController not finished + - player controller demo needs to be improved + - this library supports the newton functions for multithreading but there are several functions/classes in this + library itself, that are not thread safe (I don't need multiple threads) + - the copied MovableText class (in Tools::OgreAddons) seems to have some graphics error (it's used + to show the debugging information above each body) + - I didn't test several features: + - vehicle + - joints + - treecollision raycastcallback + + + \section new New in this version + + New in this version + - added player controller demo + - updated to newton 2.07 -- interface breaking changes! + - added shape-id parameters for collisions (you need to set the shape id if you create the collision, cannot be changed later) + - CustomJoint: + - added globalToLocal function + - feedbackCollector callback + - first attempts to support multithreading + - update the nodes of the bodies after the newton world update, because Ogre doesn't support multithreaded access to nodes + - linux: added a pthread-mutex for Ogre in OgreNewt::World, so it can be used for access to Ogre from multiple threads + - updated to newton 2.04 -- interface breaking changes (not compatible with newton 2.03!) + - set the collision id when creating a collision + - this version uses cmake > 2.6.2! + - shared pointers for collisions, if you don't want to use shared pointers define OGRENEWT_NO_COLLISION_SHAREDPTR + - uses Ogre::Any instead of void* as userdata, if you want to use void* define OGRENEWT_NO_OGRE_ANY + - several interface-breaking changes: + - the ContactCallback passes a ContactJoint as argument that can be used to iterate through all contacts + (the callback is not called for each contact any more, but for each pair of colliding bodies!) + - added a lots of new simple "iterators": + - for Bodies use body = World->getFirstBody() and body = body->getNext() + - for the + - BodyIterator renamed to BodyInAABBIterator, it does now only iterate through bodies in a specific AABB + - removed "Singleton-classes", the debugger and the BodyInAABBIterator are now part of a World + (call world->getDebugger() / world->getBodyInAABBIterator() to use these classes!) + - added support for trigger-volumes (ConvexCollision::setAsTriggerVolume ...) + - added support for convexcasts + - more than one contacts are now supported (removed the hack that prevented a segfault due to an error in newton) + - added additional debugging features: + - raycast/convexcast debugging + - information about each body as billboard above it + - a lot of minor changes and functions added and renamed + + + previous changes... + - updated to Newton version 2.0!! Many big improvements and changes to the library, and OgreNewt now supports it. + - several interface-breaking changes: + - updated to support multithreading support now native to Newton. + - MomentOfInertia namespace and helper functions removed entirely. Newton can now calculate inertia and center of + mass automatically, use ConvexCollision::calculateInertialMatrix, and multiply by objects Mass. + - Body::attachToNode has been renamed to attachNode, better implying the relationship between the body and the Ogre::Node. + - BodyIterator class has been upgraded to use boost::function, allowing the same callback flexibility as other callbacks. + + - bug fix - fixed problem with TreeCollisionSceneParser that wasn't adjusting to different scales properly. + - optimization - fixed several classes to only write debug data to the LOG when compiled in DEBUG mode: + - Custom2DJonit + - BasicFrameListener + - added the concept of "face-winding" to all TreeCollision classes. should not cause any breaking changes to code, but allows more flexibility to change the "direction" of a face in treecollisions. + - OgreNewt and it's demos are now fully compatible with Ogre 1.4.x (Eihort). + - Addition of script files for compiling under linux (Scons) + - slight modification to the ContactCallback class to allow access to Newton structures from the outside. + - some cosmetic changes to make the wrapper compile more easily under Linux and other non-windows platforms. + - updated to work with the release version of Ogre dagon (1.2) + - updated to work with version 1.53 of Newton + - raycast now has an optional pre-filter to ignore specific bodies from the raycast. + - various other clean-up! + - moved callback system to much more OOP-friendly "boost::function" system. callbacks can now be instance-specific member functions! + - several other small fixes to project files, etc. + - automatic convex hull generation system added to supplementary ragdoll class (see demo08). + - documentation updated. + - updated to Newton version 1.5 + - added this documentation! + - added buoyancy functionality. + - New Buoyancy demo. + - New Ragdoll demo, using a seperate class to implement ragdoll functionality. + - added basic classes for CustomJoints, and a simple demo showing how they work. + - added several prebuilt custom joints, including pulleys and gears, and a general 2D joint. + - added calculateInertialMatrix to ConvexCollision class. + - added set/getCenterOfMass to Body class + - changed angle-related functions in BasicJoint classes to use Ogre::Radian instead of Ogre::Real. + - added ConvexModifierCollision class, which allows for arbitrarily scaled collision primitives. + - added several low-level collision functions, see the CollisionTools namespace. + - fixed errors causing run-time crash on Slider and Universal joints. + - added LeaveWorldCallback functionality to World class. + + \section install Installation + + OgreNewt comes with a project for MSVC++ 7.1 and MSVC++ 8.0 (2005). unfortunately I have no other IDE's or compilers setup on my system, so I + cannot provide any other projects. the MSVC solution should build out of the box, assuming you take a few things into + consideration. + + unzip this in the ogreaddons directory alongside your "ogrenew" directory. to compile correctly, it also assumes you have the Newton SDK installed in another + directory alongside this one called "NewtonSDK". + + for example something like this: + + - c:/programming/Ogre/ogrenew <- ogre installation + - c:/programming/Ogre/ogreaddons/OgreNewt <- OgreNewt main directory. + - c:/programming/NewtonSDK <- Newton SDK. + - c:/programming/tinyxml <- tinyxml library (needed for ragdoll demo only) + + \section compiling Compiling + + OgreNewt compiles by default to a static library for linking to your project. However you can also compile OgreNewt into a dynamic DLL on the + Windows platform by using the Debug_DLL and Release_DLL solution build configurations in the MSVC solutions. + + \section license License + + OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. + + + well, that's about it! + have fun! + + -walaber + +*/ + +#endif + Modified: branches/ogrenewt/newton20/inc/OgreNewt_Collision.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Collision.h 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/inc/OgreNewt_Collision.h 2009-08-21 13:25:38 UTC (rev 2727) @@ -157,7 +157,7 @@ ConvexModifierCollision( const OgreNewt::World* world ); //! constructor - ConvexModifierCollision( const OgreNewt::World* world, const OgreNewt::ConvexCollisionPtr col ); + ConvexModifierCollision( const OgreNewt::World* world, const OgreNewt::ConvexCollisionPtr col, int id ); //! destructor ~ConvexModifierCollision(); Modified: branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/inc/OgreNewt_CollisionPrimitives.h 2009-08-21 13:25:38 UTC (rev 2727) @@ -399,8 +399,9 @@ collision shapes. \param world pointer to the OgreNewt::World \param col_array std::vector of pointers to existing collision objects. + \param id an id for this shape, can be received with collision->getUserId() */ - CompoundCollision( const World* world, std::vector<OgreNewt::CollisionPtr> col_array ); + CompoundCollision( const World* world, std::vector<OgreNewt::CollisionPtr> col_array, int id ); //! destructor ~CompoundCollision() {} Modified: branches/ogrenewt/newton20/inc/OgreNewt_Joint.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Joint.h 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/inc/OgreNewt_Joint.h 2009-08-21 13:25:38 UTC (rev 2727) @@ -125,6 +125,8 @@ //! must be over-written for a functioning joint. virtual void submitConstraint( Ogre::Real timeStep, int threadIndex ) = 0; + //! can be overwritten, empty as default + virtual void feedbackCollector( Ogre::Real timeSte, int threadIndex ) {} //! find the local orientation and position of the joint with regards to the 2 bodies in the joint. void pinAndDirToLocal( const Ogre::Vector3& pinpt, const Ogre::Vector3& pindir, Ogre::Quaternion& localOrient0, Ogre::Vector3& localPos0, Ogre::Quaternion& localOrient1, Ogre::Vector3& localPos1 ) const; @@ -132,6 +134,9 @@ //! find the global orientation and position of the joint with regards to the a body in the joint. void localToGlobal( const Ogre::Quaternion& localOrient, const Ogre::Vector3& localPos, Ogre::Quaternion& globalOrient, Ogre::Vector3& globalPos, int bodyIndex = 0 ) const; + //! find the local orientation and position of the joint with regards to the a body in the joint. + void globalToLocal( const Ogre::Quaternion& localOrient, const Ogre::Vector3& localPos, Ogre::Quaternion& globalOrient, Ogre::Vector3& globalPos, int bodyIndex = 0 ) const; + //! add a linear row to the constraint. void addLinearRow( const Ogre::Vector3& pt0, const Ogre::Vector3& pt1, const Ogre::Vector3& dir ) const; @@ -177,6 +182,7 @@ //! newton callback. used internally. static void _CDECL newtonSubmitConstraint( const NewtonJoint* me, float timeStep, int threadIndex ); static void _CDECL newtonGetInfo( const NewtonJoint* me, NewtonJointRecord* info ); + static void _CDECL newtonFeedbackCollector( const NewtonJoint* me, float timeStep, int threadIndex ); }; Modified: branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h 2009-08-21 13:25:38 UTC (rev 2727) @@ -28,25 +28,44 @@ class _OgreNewtExport PlayerController : public CustomJoint { public: + //! state of the player + enum PlayerState + { + PS_ONLAND, + PS_ONFREEFALL, + PS_ONILLEGALRAMP + }; + + typedef std::vector<OgreNewt::Body*> BodyVector; + //! constructor - PlayerController(OgreNewt::Body* child); + /*! + * \param localFrame this is the player frame in global Space (x: side, y: up, -z forward) + */ + PlayerController(OgreNewt::Body* child, Ogre::Real stairHeight, Ogre::Real kinematicCushion = 1.0f/64.0f, const Ogre::Matrix3& localFrame = Ogre::Matrix3::IDENTITY); virtual ~PlayerController(); //! get controlled body OgreNewt::Body* getControlledBody() const {return m_body;} //! set the characters velocity, the -Speed-values can be negative, sideSpeed positiv means move to the right, heading is in absolute space - void setVelocity(Ogre::Real forwardSpeed, Ogre::Real sideSpeed, Ogre::Degree heading); + void setVelocity(Ogre::Real forwardSpeed, Ogre::Real sideSpeed, Ogre::Radian heading); //! get currently set velocity void getVelocity(Ogre::Real &forwardSpeed, Ogre::Real& sideSpeed, Ogre::Radian& heading) const; //! set maximum step height (as absolute value) - void setMaxStepHeight(Ogre::Real maxStepHeight); + void setStairHeight(Ogre::Real stairHeight); //! get currently set maximum step height - Ogre::Real getMaxStepHeight() const; + Ogre::Real getStairHeight() const; + //! set kinematic cushion + void setKinematicCushion(Ogre::Real cushion); + + //! get currently set kinematic cushioin + Ogre::Real getKinematicCushion() const; + //! set maximum slope void setMaxSlope(Ogre::Radian maxSlope); @@ -59,120 +78,96 @@ //! get currently set restitution Ogre::Real getRestitution() const; - // not supported yet - // set up-vector pin - //void setPinVector(Ogre::Vector3 upVector); - // get currently set up-vector pin - //Ogre::Vector3 getPinVector() const; + //! retrieve player state + PlayerState getPlayerState() const; - //! is the body currently in the air (jumpin?) - bool isInJumpState() const; + //! set player state, use this only in order to reset the player + void setPlayerState(PlayerState state); - //! can be overwritten to specify if a body can be pushed away by this character - virtual bool canPushBody(const OgreNewt::Body *hitBody) const {return true;} - //! overwritten function from CustomJoint, must *NOT* be overwritten virtual void submitConstraint( Ogre::Real timestep, int threadindex ); + //! overwritten function from CustomJoint, must *NOT* be overwritten + virtual void feedbackCollector( Ogre::Real timestep, int threadindex ); + + //! udate player controller geometry, call this if the shape of the controlled body has changed... + void updateGeometry(); + protected: OgreNewt::Body *m_body; // we need this again, because in the joint it's constant! - Ogre::Real m_forwardSpeed, m_sideSpeed, m_maxStepHeight, m_restitution; + Ogre::Matrix4 m_localFrame; + Ogre::Real m_forwardSpeed, m_sideSpeed, m_stairHeight, m_restitution, m_kinematicCushion, m_maxRadius; Ogre::Radian m_heading, m_maxSlope; - Ogre::Vector3 m_upVector; - bool m_isInJumpState; - OgreNewt::ConvexCollisionPtr m_verticalSensorShape; - OgreNewt::ConvexCollisionPtr m_horizontalSensorShape; - OgreNewt::ConvexCollisionPtr m_dynamicsSensorShape; + PlayerState m_playerState; + Ogre::Vector3 m_gravity; + OgreNewt::ConvexCollisionPtr m_bodySensorShape; + OgreNewt::ConvexCollisionPtr m_stairSensorShape; + OgreNewt::ConvexCollisionPtr m_bodyFloorSensorShape; - virtual bool convexStaticCastPreFilter(OgreNewt::Body *body); - virtual bool convexDynamicCastPreFilter(OgreNewt::Body *body); - virtual bool convexAllBodyCastPreFilter(OgreNewt::Body *body); - virtual bool findFloorCastPreFilter(OgreNewt::Body *body); + virtual bool convexStaticCastPreFilter(OgreNewt::Body *body, BodyVector filterBodies); + virtual bool convexAllBodyCastPreFilter(OgreNewt::Body *body, BodyVector filterBodies); - // helper function, used internally - void getPlayerHeightAndRadius(Ogre::Real &height, Ogre::Real &radius); - // parameters for the updateSenesorShapes-function, these are set in the constructor! Ogre::Real m_staticRadiusFactor, m_dynamicRadiusFactor, m_floorFinderRadiusFactor, m_maxPlayerHeightPaddFactor; - int m_sensorShapeSegments; - // internal values, only used in updateSensorShapes! - Ogre::Real m_lastPlayerHeight, m_lastPlayerRadius, m_lastSensorHeight; - // helper function - void updateSensorShapes(); // other parameters + int m_sensorShapeSegments; int m_maxCollisionsIteration; int m_maxContactsCount; // variables used in submitConstraint Ogre::Quaternion m_lastOri; -private: - // we need overloaded versions of the raycasts... - class FindFloorRaycast : public OgreNewt::BasicRaycast - { - public: - FindFloorRaycast(PlayerController *pc, const Ogre::Vector3& startpt, const Ogre::Vector3& endpt, bool sorted) : - BasicRaycast(pc->getControlledBody()->getWorld(), startpt, endpt, sorted), - m_parent(pc) - {} - virtual bool userPreFilterCallback(OgreNewt::Body* body) {return m_parent->findFloorCastPreFilter(body);} - private: - OgreNewt::PlayerController* m_parent; - }; + // kinematic motion: (called from feedbackCollector) + void playerOnLand( Ogre::Real timestep, int threadindex ); + void playerOnFreeFall( Ogre::Real timestep, int threadindex ); + void playerOnIllegalRamp( Ogre::Real timestep, int threadindex ); + // calculate velocity (see if the player can move there etc) + Ogre::Vector3 calculateVelocity(const Ogre::Vector3& targetVel, Ogre::Real timestep, const Ogre::Vector3& upDir, Ogre::Real elevation, int threadindex); + + +private: + // we need overloaded versions of the raycasts... class StaticConvexCast : public OgreNewt::BasicConvexcast { public: StaticConvexCast(PlayerController *pc) : m_parent(pc) {} void go(const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, - const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int thread) + const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int thread, BodyVector filterBodies = BodyVector()) { + m_filterBodies = filterBodies; go(m_parent->getControlledBody()->getWorld(), col, startpt, colori, endpt, maxcontactscount, thread); } - virtual bool userPreFilterCallback(OgreNewt::Body* body) {return m_parent->convexStaticCastPreFilter(body);} + virtual bool userPreFilterCallback(OgreNewt::Body* body) {return m_parent->convexStaticCastPreFilter(body, m_filterBodies);} private: OgreNewt::PlayerController* m_parent; + BodyVector m_filterBodies; using BasicConvexcast::go; }; - class DynamicConvexCast : public OgreNewt::BasicConvexcast - { - public: - DynamicConvexCast(PlayerController *pc) : m_parent(pc) {} - - void go(const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, - const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int thread) - { - go(m_parent->getControlledBody()->getWorld(), col, startpt, colori, endpt, maxcontactscount, thread); - } - - virtual bool userPreFilterCallback(OgreNewt::Body* body) {return m_parent->convexDynamicCastPreFilter(body);} - private: - OgreNewt::PlayerController* m_parent; - using BasicConvexcast::go; - }; - class AllBodyConvexCast : public OgreNewt::BasicConvexcast { public: AllBodyConvexCast(PlayerController *pc) : m_parent(pc) {} void go(const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, - const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int thread) + const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int thread, BodyVector filterBodies = BodyVector()) { + m_filterBodies = filterBodies; go(m_parent->getControlledBody()->getWorld(), col, startpt, colori, endpt, maxcontactscount, thread); } - virtual bool userPreFilterCallback(OgreNewt::Body* body) {return m_parent->convexAllBodyCastPreFilter(body);} + virtual bool userPreFilterCallback(OgreNewt::Body* body) {return m_parent->convexAllBodyCastPreFilter(body, m_filterBodies);} private: OgreNewt::PlayerController* m_parent; + BodyVector m_filterBodies; using BasicConvexcast::go; }; }; Modified: branches/ogrenewt/newton20/src/OgreNewt_Collision.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Collision.cpp 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/src/OgreNewt_Collision.cpp 2009-08-21 13:25:38 UTC (rev 2727) @@ -70,9 +70,9 @@ { } -ConvexModifierCollision::ConvexModifierCollision(const World* world, const ConvexCollisionPtr col) : ConvexCollision(world) +ConvexModifierCollision::ConvexModifierCollision(const World* world, const ConvexCollisionPtr col, int id) : ConvexCollision(world) { - m_col = NewtonCreateConvexHullModifier( world->getNewtonWorld(), col->getNewtonCollision() ); + m_col = NewtonCreateConvexHullModifier( world->getNewtonWorld(), col->getNewtonCollision(), id ); } ConvexModifierCollision::~ConvexModifierCollision() Modified: branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp 2009-08-21 13:25:38 UTC (rev 2727) @@ -720,7 +720,7 @@ CompoundCollision::CompoundCollision(const World* world) : Collision( world ) {} - CompoundCollision::CompoundCollision( const World* world, std::vector<OgreNewt::CollisionPtr> col_array ) : Collision( world ) + CompoundCollision::CompoundCollision( const World* world, std::vector<OgreNewt::CollisionPtr> col_array, int id ) : Collision( world ) { //get the number of elements. unsigned int num = col_array.size(); @@ -733,7 +733,7 @@ array[i] = (NewtonCollision*)col_array[i]->getNewtonCollision(); } - m_col = NewtonCreateCompoundCollision( world->getNewtonWorld(), num, array ); + m_col = NewtonCreateCompoundCollision( world->getNewtonWorld(), num, array, id ); delete[] array; Modified: branches/ogrenewt/newton20/src/OgreNewt_Joint.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Joint.cpp 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/src/OgreNewt_Joint.cpp 2009-08-21 13:25:38 UTC (rev 2727) @@ -62,6 +62,7 @@ NewtonJointSetUserData (m_joint, this); NewtonJointSetDestructor (m_joint, destructor); + NewtonUserJointSetFeedbackCollectorCallback( m_joint, CustomJoint::newtonFeedbackCollector ); } @@ -118,8 +119,32 @@ globalOrient = bodyOrient * localOrient; } - +void CustomJoint::globalToLocal( const Ogre::Quaternion& globalOrient, const Ogre::Vector3& globalPos, Ogre::Quaternion& localOrient, Ogre::Vector3& localPos, int bodyIndex ) const +{ + localOrient = Ogre::Quaternion::IDENTITY; + localPos= Ogre::Vector3::ZERO; + + const Body* bdy = NULL; + if (bodyIndex == 0) + bdy = m_body0; + else if (m_body1) + bdy = m_body1; + + Ogre::Quaternion bodyOrient = Ogre::Quaternion::IDENTITY; + Ogre::Vector3 bodyPos = Ogre::Vector3::ZERO; + + if (bdy) + bdy->getPositionOrientation( bodyPos, bodyOrient ); + + Ogre::Quaternion bodyOrientInv = bodyOrient.Inverse(); + + localOrient = bodyOrientInv * globalOrient; + localPos = bodyOrientInv * (globalPos - bodyPos); +} + + + void CustomJoint::addLinearRow( const Ogre::Vector3& pt0, const Ogre::Vector3& pt1, const Ogre::Vector3& dir ) const { NewtonUserJointAddLinearRow( m_joint, &pt0.x, &pt1.x, &dir.x ); @@ -187,7 +212,14 @@ j->submitConstraint( (Ogre::Real)timeStep, threadIndex ); } +void _CDECL CustomJoint::newtonFeedbackCollector( const NewtonJoint* me, float timeStep, int threadIndex ) +{ + CustomJoint* j = (CustomJoint*)NewtonJointGetUserData( me ); + j->feedbackCollector( (Ogre::Real)timeStep, threadIndex ); +} + + void _CDECL CustomJoint::newtonGetInfo(const NewtonJoint *me, NewtonJointRecord *info) { CustomJoint* j = (CustomJoint*)NewtonJointGetUserData( me ); Modified: branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp 2009-08-18 17:32:16 UTC (rev 2726) +++ branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp 2009-08-21 13:25:38 UTC (rev 2727) @@ -1,700 +1,680 @@ -#include "OgreNewt_PlayerController.h" -#include "OgreNewt_Tools.h" -#include "OgreNewt_Collision.h" -#include "OgreNewt_CollisionPrimitives.h" -#include "OgreNewt_World.h" - -#include <vector> -#include <iostream> - -namespace OgreNewt -{ - -PlayerController::PlayerController(OgreNewt::Body * child) : - CustomJoint(6, child, NULL), - m_body(child) -{ - // initialize some non settable parameters - m_maxCollisionsIteration = 8; - m_maxContactsCount = 16; - // initialize settable values - m_forwardSpeed = 0; - m_sideSpeed = 0; - m_heading = Ogre::Radian(0); - Ogre::Real playerHeight, playerRadius; - getPlayerHeightAndRadius(playerHeight, playerRadius); - m_maxStepHeight = playerHeight / 4; - m_maxSlope = Ogre::Degree(45); - m_restitution = 0; - m_upVector = Ogre::Vector3::UNIT_Y; - m_isInJumpState = false; - - Ogre::Vector3 pos; - m_body->getPositionOrientation(pos, m_lastOri); - - - - // initialize sensor-shape parameters - m_staticRadiusFactor = 1.125f; - m_dynamicRadiusFactor = 1.5f; - m_floorFinderRadiusFactor = 1.0f; - m_maxPlayerHeightPaddFactor = 0.01f; - m_sensorShapeSegments = 32; -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - m_verticalSensorShape = NULL; - m_horizontalSensorShape = NULL; - m_dynamicsSensorShape = NULL; -#endif - - - updateSensorShapes(); -} - -PlayerController::~PlayerController() -{ -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - if( m_verticalSensorShape ) - delete m_verticalSensorShape; - if( m_horizontalSensorShape ) - delete m_horizontalSensorShape; - if( m_dynamicsSensorShape ) - delete m_dynamicsSensorShape; -#endif -} - -void PlayerController::updateSensorShapes() -{ - Ogre::Real newPlayerRadius, newPlayerHeight, newSensorHeight; - // is this the first time, this function gets calles? - if( m_verticalSensorShape == NULL ) - { - // initialize values, so they aren't arbitrary! - m_lastPlayerRadius = newPlayerRadius = 0; - m_lastPlayerHeight = newPlayerHeight = 0; - m_lastSensorHeight = newSensorHeight = 0; - } - - // calculate new Values: - getPlayerHeightAndRadius(newPlayerHeight, newPlayerRadius); - newPlayerHeight += newPlayerHeight * m_maxPlayerHeightPaddFactor; - newSensorHeight = (newPlayerHeight - m_maxStepHeight) * 0.5f; - - - // do we need to update the shapes? - if( m_verticalSensorShape == NULL || - abs( newPlayerHeight - m_lastPlayerHeight ) > 0.04f || - abs( newSensorHeight - m_lastSensorHeight ) > 0.04f || - abs( newPlayerRadius - m_lastPlayerRadius ) > 0.04f ) - { -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - // delete old ones - if( m_verticalSensorShape ) - delete m_verticalSensorShape; - if( m_horizontalSensorShape ) - delete m_horizontalSensorShape; - if( m_dynamicsSensorShape ) - delete m_dynamicsSensorShape; -#endif - - m_lastPlayerRadius = newPlayerRadius; - m_lastSensorHeight = newSensorHeight; - m_lastPlayerHeight = newPlayerHeight; - - - Ogre::Vector3 *dynamicsSensorPoints = new Ogre::Vector3[m_sensorShapeSegments*2]; - Ogre::Vector3 *verticalSensorPoints = new Ogre::Vector3[m_sensorShapeSegments*2]; - Ogre::Vector3 *horizontalSensorPoints = new Ogre::Vector3[m_sensorShapeSegments*2]; - - for( int i = 0; i < m_sensorShapeSegments; i++) - { - Ogre::Real x, z; - x = m_lastPlayerRadius * Ogre::Math::Cos( Ogre::Degree( 360.0f * i / m_sensorShapeSegments ) ); - z = m_lastPlayerRadius * Ogre::Math::Sin( Ogre::Degree( 360.0f * i / m_sensorShapeSegments ) ); - - dynamicsSensorPoints[i].x = x * m_dynamicRadiusFactor; - dynamicsSensorPoints[i].y = m_lastPlayerHeight * 0.45f; - dynamicsSensorPoints[i].z = z * m_dynamicRadiusFactor; - dynamicsSensorPoints[i + m_sensorShapeSegments].x = dynamicsSensorPoints[i].x; - dynamicsSensorPoints[i + m_sensorShapeSegments].y = -dynamicsSensorPoints[i].y; - dynamicsSensorPoints[i + m_sensorShapeSegments].z = dynamicsSensorPoints[i].z; - verticalSensorPoints[i].x = x * m_floorFinderRadiusFactor; - verticalSensorPoints[i].y = m_lastSensorHeight; - verticalSensorPoints[i].z = z * m_floorFinderRadiusFactor; - verticalSensorPoints[i + m_sensorShapeSegments].x = verticalSensorPoints[i].x; - verticalSensorPoints[i + m_sensorShapeSegments].y = -verticalSensorPoints[i].y; - verticalSensorPoints[i + m_sensorShapeSegments].z = verticalSensorPoints[i].z; - horizontalSensorPoints[i].x = x * m_staticRadiusFactor; - horizontalSensorPoints[i].y = m_lastSensorHeight; - horizontalSensorPoints[i].z = z * m_staticRadiusFactor; - horizontalSensorPoints[i + m_sensorShapeSegments].x = horizontalSensorPoints[i].x; - horizontalSensorPoints[i + m_sensorShapeSegments].y = -horizontalSensorPoints[i].y; - horizontalSensorPoints[i + m_sensorShapeSegments].z = horizontalSensorPoints[i].z; - } - - m_verticalSensorShape = ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::ConvexHull(m_body->getWorld(), verticalSensorPoints, 2*m_sensorShapeSegments, 0)); - m_horizontalSensorShape = ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::ConvexHull(m_body->getWorld(), horizontalSensorPoints, 2*m_sensorShapeSegments, 0)); - m_dynamicsSensorShape = ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::ConvexHull(m_body->getWorld(), dynamicsSensorPoints, 2*m_sensorShapeSegments, 0)); - - delete[] dynamicsSensorPoints; - delete[] verticalSensorPoints; - delete[] horizontalSensorPoints; - } - -} - - -void PlayerController::getPlayerHeightAndRadius(Ogre::Real &height, Ogre::Real &radius) -{ - Ogre::AxisAlignedBox aab = m_body->getAABB(); - height = aab.getMaximum().y - aab.getMinimum().y; - - Ogre::Real rx = aab.getMaximum().x - aab.getMinimum().x; - Ogre::Real rz = aab.getMaximum().z - aab.getMinimum().z; - radius = std::max(rx,rz) / 2.0f; - - //! TODO: the aabb seems to be too big (see newton forum faq!) -} - - -bool PlayerController::convexStaticCastPreFilter(OgreNewt::Body *body) -{ - Ogre::Real mass; - Ogre::Vector3 inertia; - body->getMassMatrix(mass, inertia); - - return (mass == 0.0f && body != m_body); -} - - -bool PlayerController::convexDynamicCastPreFilter(OgreNewt::Body *body) -{ - Ogre::Real mass; - Ogre::Vector3 inertia; - body->getMassMatrix(mass, inertia); - - return (mass > 0.0f && body != m_body); -} - - -bool PlayerController::convexAllBodyCastPreFilter(OgreNewt::Body *body) -{ - return (body != m_body); -} - - -bool PlayerController::findFloorCastPreFilter(OgreNewt::Body *body) -{ - return (body != m_body); -} - - -void PlayerController::setVelocity(Ogre::Real forwardSpeed, Ogre::Real sideSpeed, Ogre::Degree heading) -{ - m_forwardSpeed = forwardSpeed; - m_sideSpeed = sideSpeed; - m_heading = heading; - m_body->unFreeze(); -} - -/* -// helper class -class HitBodyCache : public BasicConvexcast::ConvexcastContactInfo -{ - public: - Ogre::Vector3 mVel; - Ogre::Vector3 mOmega; - HitBodyCache() {} - HitBodyCache(const BasicConvexcast::ConvexcastContactInfo& info) : - BasicConvexcast::ConvexcastContactInfo(info) - { - mVel = mBody->getVelocity(); - mOmega = mBody->getOmega(); - } -}; - -// helper class -class HitBodyVector : public std::vector<HitBodyCache> -{ - public: - void getCollidingBodiesFromConvexcast(const BasicConvexcast& cast) - { - // find first contact with each body and cache it - ... [truncated message content] |
From: <me...@us...> - 2009-08-22 14:28:46
|
Revision: 2728 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2728&view=rev Author: melven2 Date: 2009-08-22 14:28:37 +0000 (Sat, 22 Aug 2009) Log Message: ----------- -some changes in the xcode-project file and the cmake files -PlayerController seems to work now (will still have some bugs!) -ConvexCast: added "NormalOnHitPoint" Modified Paths: -------------- branches/ogrenewt/newton20/Mac/OgreNewt.xcodeproj/project.pbxproj branches/ogrenewt/newton20/cmake/FindNewton.cmake branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp Modified: branches/ogrenewt/newton20/Mac/OgreNewt.xcodeproj/project.pbxproj =================================================================== --- branches/ogrenewt/newton20/Mac/OgreNewt.xcodeproj/project.pbxproj 2009-08-21 13:25:38 UTC (rev 2727) +++ branches/ogrenewt/newton20/Mac/OgreNewt.xcodeproj/project.pbxproj 2009-08-22 14:28:37 UTC (rev 2728) @@ -46,6 +46,7 @@ 487D45F90F47389A00D1D69F /* OgreNewt_Vehicle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 487D45E70F47389A00D1D69F /* OgreNewt_Vehicle.cpp */; }; 487D45FA0F47389A00D1D69F /* OgreNewt_World.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 487D45E80F47389A00D1D69F /* OgreNewt_World.cpp */; }; 48A94EC50F476C1700252666 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 48A94EC10F476B1400252666 /* libc.dylib */; }; + 48FF24380FC9A27B00E71D4D /* libboost_system-mt.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 48FF24370FC9A27B00E71D4D /* libboost_system-mt.dylib */; }; 8D07F2C00486CC7A007CD1D0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; /* End PBXBuildFile section */ @@ -103,6 +104,7 @@ 487D45E80F47389A00D1D69F /* OgreNewt_World.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OgreNewt_World.cpp; path = ../src/OgreNewt_World.cpp; sourceTree = SOURCE_ROOT; }; 48A94EBE0F476A8700252666 /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/i686-apple-darwin9/4.0.1/libstdc++.dylib"; sourceTree = SDKROOT; }; 48A94EC10F476B1400252666 /* libc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libc.dylib; path = usr/lib/libc.dylib; sourceTree = SDKROOT; }; + 48FF24370FC9A27B00E71D4D /* libboost_system-mt.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libboost_system-mt.dylib"; path = "/opt/local/lib/libboost_system-mt.dylib"; sourceTree = "<absolute>"; }; 8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D07F2C80486CC7A007CD1D0 /* OgreNewt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OgreNewt.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -115,6 +117,7 @@ 444EA9A30BD0D33B00C6D4A0 /* Ogre.framework in Frameworks */, 444EA9A70BD0D35800C6D4A0 /* libnewton32.a in Frameworks */, 48A94EC50F476C1700252666 /* libc.dylib in Frameworks */, + 48FF24380FC9A27B00E71D4D /* libboost_system-mt.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -132,12 +135,11 @@ 0867D691FE84028FC02AAC07 /* OgreNewt */ = { isa = PBXGroup; children = ( + 48FF24370FC9A27B00E71D4D /* libboost_system-mt.dylib */, 08FB77ACFE841707C02AAC07 /* Source */, 089C1665FE841158C02AAC07 /* Resources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 034768DDFF38A45A11DB9C8B /* Products */, - 48A94EBE0F476A8700252666 /* libstdc++.dylib */, - 48A94EC10F476B1400252666 /* libc.dylib */, ); name = OgreNewt; sourceTree = "<group>"; @@ -145,6 +147,8 @@ 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( + 48A94EC10F476B1400252666 /* libc.dylib */, + 48A94EBE0F476A8700252666 /* libstdc++.dylib */, 444EA9A60BD0D35800C6D4A0 /* libnewton32.a */, 444EA9A20BD0D33B00C6D4A0 /* Ogre.framework */, ); @@ -351,16 +355,8 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = ""; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/Ogre.framework/Headers, - /usr/local/include, - ); INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - /usr/local/lib, - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - ); LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SDKROOT)/usr/lib/i686-apple-darwin9/4.0.1\""; LIBRARY_STYLE = DYNAMIC; MACH_O_TYPE = mh_dylib; @@ -386,13 +382,8 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = ""; - HEADER_SEARCH_PATHS = /usr/local/include; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - /usr/local/lib, - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - ); LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SDKROOT)/usr/lib/i686-apple-darwin9/4.0.1\""; LIBRARY_STYLE = DYNAMIC; MACH_O_TYPE = mh_dylib; @@ -409,9 +400,20 @@ 4FADC24708B4156D00ABE55E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = /Library/Frameworks/Ogre.framework/Headers; + HEADER_SEARCH_PATHS = ( + /opt/local/include, + /usr/local/include, + /Library/Frameworks/Ogre.framework/Headers, + ); + LIBRARY_SEARCH_PATHS = ( + /opt/local/lib, + /usr/local/lib, + /usr/lib, + ); PREBINDING = NO; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; @@ -420,12 +422,20 @@ 4FADC24808B4156D00ABE55E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( + /opt/local/include, /usr/local/include, /Library/Frameworks/Ogre.framework/Headers, ); + LIBRARY_SEARCH_PATHS = ( + /opt/local/lib, + /usr/local/lib, + /usr/lib, + ); PREBINDING = NO; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; Modified: branches/ogrenewt/newton20/cmake/FindNewton.cmake =================================================================== --- branches/ogrenewt/newton20/cmake/FindNewton.cmake 2009-08-21 13:25:38 UTC (rev 2727) +++ branches/ogrenewt/newton20/cmake/FindNewton.cmake 2009-08-22 14:28:37 UTC (rev 2728) @@ -20,6 +20,7 @@ ELSE(WIN32) SET(NEWTON_INCLUDE_SEARCH_DIRS /usr/include + /usr/include/newtonSDK /usr/local/include /opt/newton/include /opt/include INTERNAL) Modified: branches/ogrenewt/newton20/inc/OgreNewt.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt.h 2009-08-21 13:25:38 UTC (rev 2727) +++ branches/ogrenewt/newton20/inc/OgreNewt.h 2009-08-22 14:28:37 UTC (rev 2728) @@ -1,176 +1,178 @@ -/* - OgreNewt library - - connects Ogre with the Newton Game Dynamics physics library - - - by Walaber (http://walaber.com) - some changes by melven - - main header file. - - current version: 2.07.0 - - Newton version: 2.07 (beta) - - Ogre version: Shoggoth (1.6.x) - -*/ - -#ifndef _INCLUDE_OGRENEWT_ -#define _INCLUDE_OGRENEWT_ - - -#include "OgreNewt_World.h" -#include "OgreNewt_Collision.h" -#include "OgreNewt_Body.h" -#include "OgreNewt_CollisionPrimitives.h" -#include "OgreNewt_CollisionSerializer.h" -#include "OgreNewt_MaterialID.h" -#include "OgreNewt_MaterialPair.h" -#include "OgreNewt_ContactCallback.h" -#include "OgreNewt_ContactJoint.h" -#include "OgreNewt_Vehicle.h" -#include "OgreNewt_PlayerController.h" -#include "OgreNewt_RayCast.h" - -#include "OgreNewt_Joint.h" -#include "OgreNewt_BasicJoints.h" - -#include "OgreNewt_Tools.h" -#include "OgreNewt_BodyInAABBIterator.h" -#include "OgreNewt_Debugger.h" - -/*! \mainpage OgreNewt Library version 2.07.0 (for newton version 2.07) - - \section into_sec Introduction - - OgreNewt is an OOP wrapper for integrating the Newton Dynamics Physics SDK with OGRE. - - \section problems Problems and missing features in this version - - Problems and missing features in this version - - HeightFieldCollision - - PlayerController not finished - - player controller demo needs to be improved - - this library supports the newton functions for multithreading but there are several functions/classes in this - library itself, that are not thread safe (I don't need multiple threads) - - the copied MovableText class (in Tools::OgreAddons) seems to have some graphics error (it's used - to show the debugging information above each body) - - I didn't test several features: - - vehicle - - joints - - treecollision raycastcallback - - - \section new New in this version - - New in this version - - added player controller demo - - updated to newton 2.07 -- interface breaking changes! - - added shape-id parameters for collisions (you need to set the shape id if you create the collision, cannot be changed later) - - CustomJoint: - - added globalToLocal function - - feedbackCollector callback - - first attempts to support multithreading - - update the nodes of the bodies after the newton world update, because Ogre doesn't support multithreaded access to nodes - - linux: added a pthread-mutex for Ogre in OgreNewt::World, so it can be used for access to Ogre from multiple threads - - updated to newton 2.04 -- interface breaking changes (not compatible with newton 2.03!) - - set the collision id when creating a collision - - this version uses cmake > 2.6.2! - - shared pointers for collisions, if you don't want to use shared pointers define OGRENEWT_NO_COLLISION_SHAREDPTR - - uses Ogre::Any instead of void* as userdata, if you want to use void* define OGRENEWT_NO_OGRE_ANY - - several interface-breaking changes: - - the ContactCallback passes a ContactJoint as argument that can be used to iterate through all contacts - (the callback is not called for each contact any more, but for each pair of colliding bodies!) - - added a lots of new simple "iterators": - - for Bodies use body = World->getFirstBody() and body = body->getNext() - - for the - - BodyIterator renamed to BodyInAABBIterator, it does now only iterate through bodies in a specific AABB - - removed "Singleton-classes", the debugger and the BodyInAABBIterator are now part of a World - (call world->getDebugger() / world->getBodyInAABBIterator() to use these classes!) - - added support for trigger-volumes (ConvexCollision::setAsTriggerVolume ...) - - added support for convexcasts - - more than one contacts are now supported (removed the hack that prevented a segfault due to an error in newton) - - added additional debugging features: - - raycast/convexcast debugging - - information about each body as billboard above it - - a lot of minor changes and functions added and renamed - - - previous changes... - - updated to Newton version 2.0!! Many big improvements and changes to the library, and OgreNewt now supports it. - - several interface-breaking changes: - - updated to support multithreading support now native to Newton. - - MomentOfInertia namespace and helper functions removed entirely. Newton can now calculate inertia and center of - mass automatically, use ConvexCollision::calculateInertialMatrix, and multiply by objects Mass. - - Body::attachToNode has been renamed to attachNode, better implying the relationship between the body and the Ogre::Node. - - BodyIterator class has been upgraded to use boost::function, allowing the same callback flexibility as other callbacks. - - - bug fix - fixed problem with TreeCollisionSceneParser that wasn't adjusting to different scales properly. - - optimization - fixed several classes to only write debug data to the LOG when compiled in DEBUG mode: - - Custom2DJonit - - BasicFrameListener - - added the concept of "face-winding" to all TreeCollision classes. should not cause any breaking changes to code, but allows more flexibility to change the "direction" of a face in treecollisions. - - OgreNewt and it's demos are now fully compatible with Ogre 1.4.x (Eihort). - - Addition of script files for compiling under linux (Scons) - - slight modification to the ContactCallback class to allow access to Newton structures from the outside. - - some cosmetic changes to make the wrapper compile more easily under Linux and other non-windows platforms. - - updated to work with the release version of Ogre dagon (1.2) - - updated to work with version 1.53 of Newton - - raycast now has an optional pre-filter to ignore specific bodies from the raycast. - - various other clean-up! - - moved callback system to much more OOP-friendly "boost::function" system. callbacks can now be instance-specific member functions! - - several other small fixes to project files, etc. - - automatic convex hull generation system added to supplementary ragdoll class (see demo08). - - documentation updated. - - updated to Newton version 1.5 - - added this documentation! - - added buoyancy functionality. - - New Buoyancy demo. - - New Ragdoll demo, using a seperate class to implement ragdoll functionality. - - added basic classes for CustomJoints, and a simple demo showing how they work. - - added several prebuilt custom joints, including pulleys and gears, and a general 2D joint. - - added calculateInertialMatrix to ConvexCollision class. - - added set/getCenterOfMass to Body class - - changed angle-related functions in BasicJoint classes to use Ogre::Radian instead of Ogre::Real. - - added ConvexModifierCollision class, which allows for arbitrarily scaled collision primitives. - - added several low-level collision functions, see the CollisionTools namespace. - - fixed errors causing run-time crash on Slider and Universal joints. - - added LeaveWorldCallback functionality to World class. - - \section install Installation - - OgreNewt comes with a project for MSVC++ 7.1 and MSVC++ 8.0 (2005). unfortunately I have no other IDE's or compilers setup on my system, so I - cannot provide any other projects. the MSVC solution should build out of the box, assuming you take a few things into - consideration. - - unzip this in the ogreaddons directory alongside your "ogrenew" directory. to compile correctly, it also assumes you have the Newton SDK installed in another - directory alongside this one called "NewtonSDK". - - for example something like this: - - - c:/programming/Ogre/ogrenew <- ogre installation - - c:/programming/Ogre/ogreaddons/OgreNewt <- OgreNewt main directory. - - c:/programming/NewtonSDK <- Newton SDK. - - c:/programming/tinyxml <- tinyxml library (needed for ragdoll demo only) - - \section compiling Compiling - - OgreNewt compiles by default to a static library for linking to your project. However you can also compile OgreNewt into a dynamic DLL on the - Windows platform by using the Debug_DLL and Release_DLL solution build configurations in the MSVC solutions. - - \section license License - - OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. - - - well, that's about it! - have fun! - - -walaber - -*/ - -#endif - +/* + OgreNewt library + + connects Ogre with the Newton Game Dynamics physics library + + + by Walaber (http://walaber.com) + some changes by melven + + main header file. + + current version: 2.07.0 + + Newton version: 2.07 (beta) + + Ogre version: Shoggoth (1.6.x) + +*/ + +#ifndef _INCLUDE_OGRENEWT_ +#define _INCLUDE_OGRENEWT_ + + +#include "OgreNewt_World.h" +#include "OgreNewt_Collision.h" +#include "OgreNewt_Body.h" +#include "OgreNewt_CollisionPrimitives.h" +#include "OgreNewt_CollisionSerializer.h" +#include "OgreNewt_MaterialID.h" +#include "OgreNewt_MaterialPair.h" +#include "OgreNewt_ContactCallback.h" +#include "OgreNewt_ContactJoint.h" +#include "OgreNewt_Vehicle.h" +#include "OgreNewt_PlayerController.h" +#include "OgreNewt_RayCast.h" + +#include "OgreNewt_Joint.h" +#include "OgreNewt_BasicJoints.h" + +#include "OgreNewt_Tools.h" +#include "OgreNewt_BodyInAABBIterator.h" +#include "OgreNewt_Debugger.h" + +/*! \mainpage OgreNewt Library version 2.07.0 (for newton version 2.07) + + \section into_sec Introduction + + OgreNewt is an OOP wrapper for integrating the Newton Dynamics Physics SDK with OGRE. + + \section problems Problems and missing features in this version + + Problems and missing features in this version + - HeightFieldCollision + - PlayerController not finished + - player controller demo needs to be improved + - this library supports the newton functions for multithreading but there are several functions/classes in this + library itself, that are not thread safe (I don't need multiple threads) + - the copied MovableText class (in Tools::OgreAddons) seems to have some graphics error (it's used + to show the debugging information above each body) + - I didn't test several features: + - vehicle + - joints + - treecollision raycastcallback + + + \section new New in this version + + New in this version + - ConvexCast: + - added "NormalOnHitPoint" + - added player controller demo + - updated to newton 2.07 -- interface breaking changes! + - added shape-id parameters for collisions (you need to set the shape id if you create the collision, cannot be changed later) + - CustomJoint: + - added globalToLocal function + - feedbackCollector callback + - first attempts to support multithreading + - update the nodes of the bodies after the newton world update, because Ogre doesn't support multithreaded access to nodes + - linux: added a pthread-mutex for Ogre in OgreNewt::World, so it can be used for access to Ogre from multiple threads + - updated to newton 2.04 -- interface breaking changes (not compatible with newton 2.03!) + - set the collision id when creating a collision + - this version uses cmake > 2.6.2! + - shared pointers for collisions, if you don't want to use shared pointers define OGRENEWT_NO_COLLISION_SHAREDPTR + - uses Ogre::Any instead of void* as userdata, if you want to use void* define OGRENEWT_NO_OGRE_ANY + - several interface-breaking changes: + - the ContactCallback passes a ContactJoint as argument that can be used to iterate through all contacts + (the callback is not called for each contact any more, but for each pair of colliding bodies!) + - added a lots of new simple "iterators": + - for Bodies use body = World->getFirstBody() and body = body->getNext() + - for the + - BodyIterator renamed to BodyInAABBIterator, it does now only iterate through bodies in a specific AABB + - removed "Singleton-classes", the debugger and the BodyInAABBIterator are now part of a World + (call world->getDebugger() / world->getBodyInAABBIterator() to use these classes!) + - added support for trigger-volumes (ConvexCollision::setAsTriggerVolume ...) + - added support for convexcasts + - more than one contacts are now supported (removed the hack that prevented a segfault due to an error in newton) + - added additional debugging features: + - raycast/convexcast debugging + - information about each body as billboard above it + - a lot of minor changes and functions added and renamed + + + previous changes... + - updated to Newton version 2.0!! Many big improvements and changes to the library, and OgreNewt now supports it. + - several interface-breaking changes: + - updated to support multithreading support now native to Newton. + - MomentOfInertia namespace and helper functions removed entirely. Newton can now calculate inertia and center of + mass automatically, use ConvexCollision::calculateInertialMatrix, and multiply by objects Mass. + - Body::attachToNode has been renamed to attachNode, better implying the relationship between the body and the Ogre::Node. + - BodyIterator class has been upgraded to use boost::function, allowing the same callback flexibility as other callbacks. + + - bug fix - fixed problem with TreeCollisionSceneParser that wasn't adjusting to different scales properly. + - optimization - fixed several classes to only write debug data to the LOG when compiled in DEBUG mode: + - Custom2DJonit + - BasicFrameListener + - added the concept of "face-winding" to all TreeCollision classes. should not cause any breaking changes to code, but allows more flexibility to change the "direction" of a face in treecollisions. + - OgreNewt and it's demos are now fully compatible with Ogre 1.4.x (Eihort). + - Addition of script files for compiling under linux (Scons) + - slight modification to the ContactCallback class to allow access to Newton structures from the outside. + - some cosmetic changes to make the wrapper compile more easily under Linux and other non-windows platforms. + - updated to work with the release version of Ogre dagon (1.2) + - updated to work with version 1.53 of Newton + - raycast now has an optional pre-filter to ignore specific bodies from the raycast. + - various other clean-up! + - moved callback system to much more OOP-friendly "boost::function" system. callbacks can now be instance-specific member functions! + - several other small fixes to project files, etc. + - automatic convex hull generation system added to supplementary ragdoll class (see demo08). + - documentation updated. + - updated to Newton version 1.5 + - added this documentation! + - added buoyancy functionality. + - New Buoyancy demo. + - New Ragdoll demo, using a seperate class to implement ragdoll functionality. + - added basic classes for CustomJoints, and a simple demo showing how they work. + - added several prebuilt custom joints, including pulleys and gears, and a general 2D joint. + - added calculateInertialMatrix to ConvexCollision class. + - added set/getCenterOfMass to Body class + - changed angle-related functions in BasicJoint classes to use Ogre::Radian instead of Ogre::Real. + - added ConvexModifierCollision class, which allows for arbitrarily scaled collision primitives. + - added several low-level collision functions, see the CollisionTools namespace. + - fixed errors causing run-time crash on Slider and Universal joints. + - added LeaveWorldCallback functionality to World class. + + \section install Installation + + OgreNewt comes with a project for MSVC++ 7.1 and MSVC++ 8.0 (2005). unfortunately I have no other IDE's or compilers setup on my system, so I + cannot provide any other projects. the MSVC solution should build out of the box, assuming you take a few things into + consideration. + + unzip this in the ogreaddons directory alongside your "ogrenew" directory. to compile correctly, it also assumes you have the Newton SDK installed in another + directory alongside this one called "NewtonSDK". + + for example something like this: + + - c:/programming/Ogre/ogrenew <- ogre installation + - c:/programming/Ogre/ogreaddons/OgreNewt <- OgreNewt main directory. + - c:/programming/NewtonSDK <- Newton SDK. + - c:/programming/tinyxml <- tinyxml library (needed for ragdoll demo only) + + \section compiling Compiling + + OgreNewt compiles by default to a static library for linking to your project. However you can also compile OgreNewt into a dynamic DLL on the + Windows platform by using the Debug_DLL and Release_DLL solution build configurations in the MSVC solutions. + + \section license License + + OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. + + + well, that's about it! + have fun! + + -walaber + +*/ + +#endif + Modified: branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h 2009-08-21 13:25:38 UTC (rev 2727) +++ branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h 2009-08-22 14:28:37 UTC (rev 2728) @@ -227,12 +227,13 @@ class _OgreNewtExport ConvexcastContactInfo { public: - //Ogre::Real mDistance; //!< dist from point1 of the raycast, in range [0,1]. - OgreNewt::Body* mBody; //!< pointer to body intersected with - int mCollisionID; //!< collision ID of the primitive hit by the ray (for compound collision bodies) - Ogre::Vector3 mContactNormal; //!< normal of intersection. - Ogre::Vector3 mContactPoint; //!< point of the contact in global space - Ogre::Real mContactPenetration; //!< contact penetration at collision point + //Ogre::Real mDistance; //!< dist from point1 of the raycast, in range [0,1]. + OgreNewt::Body* mBody; //!< pointer to body intersected with + int mCollisionID; //!< collision ID of the primitive hit by the ray (for compound collision bodies) + Ogre::Vector3 mContactNormal; //!< normal of intersection. + Ogre::Vector3 mContactNormalOnHitPoint; //!< surface normal at the surface of the hit body + Ogre::Vector3 mContactPoint; //!< point of the contact in global space + Ogre::Real mContactPenetration; //!< contact penetration at collision point ConvexcastContactInfo(); ~ConvexcastContactInfo(); Modified: branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp 2009-08-21 13:25:38 UTC (rev 2727) +++ branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp 2009-08-22 14:28:37 UTC (rev 2728) @@ -284,7 +284,6 @@ { m_recordraycasts = true; m_markhitbodies = markhitbodies; - clearRaycastsRecorded(); } bool Debugger::isRaycastRecording() Modified: branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp 2009-08-21 13:25:38 UTC (rev 2727) +++ branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp 2009-08-22 14:28:37 UTC (rev 2728) @@ -127,8 +127,7 @@ Ogre::Vector3 inertia; body->getMassMatrix(mass, inertia); - //if( mass != 0.0f || body == m_body ) - if( body == m_body ) + if( mass != 0.0f || body == m_body ) return false; for( int i = 0; i < filterBodies.size(); i++ ) @@ -500,7 +499,7 @@ targetVel -= m_gravity*timestep; Ogre::Vector3 floorNormal = staticConvexCast.getInfoAt(0).mContactNormal; Ogre::Vector3 gravityForce = m_gravity - floorNormal*(floorNormal.dotProduct(m_gravity)); - targetVel -= floorNormal * floorNormal.dotProduct(m_gravity) + gravityForce * timestep; + targetVel += gravityForce*timestep - floorNormal * floorNormal.dotProduct(targetVel); } // make sure the body velocity will not penetrate other bodies @@ -586,8 +585,8 @@ Ogre::Vector3 floorNormal = allBodyConvexCast.getInfoAt(0).mContactNormal; - isFuturePosInRamp = upDir.angleBetween(floorNormal) > m_maxSlope; - if( !isFuturePosInRamp ) + isFuturePosInRamp = upDir.angleBetween(floorNormal) < m_maxSlope; + if( isFuturePosInRamp ) { AllBodyConvexCast allBodyConvexCast2(this); Ogre::Vector3 castStart2, castTarget2; @@ -599,7 +598,7 @@ allBodyConvexCast2.go(m_bodyFloorSensorShape, castStart2, ori, castTarget2, 1, threadIndex, filterBodies); - if( distanceToFirstHit < allBodyConvexCast2.getDistanceToFirstHit() && allBodyConvexCast2.getContactsCount() > 0 ) + if( distanceToFirstHit >= allBodyConvexCast2.getDistanceToFirstHit() && allBodyConvexCast2.getContactsCount() > 0 ) { setPlayerState(PS_ONILLEGALRAMP); } @@ -610,7 +609,7 @@ int iterations, contactCount = 1; Ogre::Vector3 savedTargetVel; savedTargetVel = targetVel; - for( iterations = 0; iterations < m_maxCollisionsIteration && contactCount; iterations++ ) + for( iterations = 0; (iterations < m_maxCollisionsIteration) && contactCount; iterations++ ) { Ogre::Real projectVel; Ogre::Vector3 castStart3, castTarget3; @@ -658,14 +657,14 @@ targetVel = targetVel1; distanceToFirstHit = 0.0f; step = Ogre::Vector3::ZERO; - pos -= upDir*m_kinematicCushion; + castStart -= upDir*m_kinematicCushion; } } } } - Ogre::Vector3 newPos = pos + (castTarget - castStart)*distanceToFirstHit + upDir*m_kinematicCushion; + Ogre::Vector3 newPos = castStart + (castTarget - castStart)*distanceToFirstHit + upDir*m_kinematicCushion; newPos -= step; m_body->setPositionOrientation(newPos, ori); Modified: branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp 2009-08-21 13:25:38 UTC (rev 2727) +++ branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp 2009-08-22 14:28:37 UTC (rev 2728) @@ -312,6 +312,9 @@ info.mContactNormal.x = mReturnInfoList[hitnum].m_normal[0]; info.mContactNormal.y = mReturnInfoList[hitnum].m_normal[1]; info.mContactNormal.z = mReturnInfoList[hitnum].m_normal[2]; + info.mContactNormalOnHitPoint.x = mReturnInfoList[hitnum].m_normalOnHitPoint[0]; + info.mContactNormalOnHitPoint.y = mReturnInfoList[hitnum].m_normalOnHitPoint[1]; + info.mContactNormalOnHitPoint.z = mReturnInfoList[hitnum].m_normalOnHitPoint[2]; info.mContactPoint.x = mReturnInfoList[hitnum].m_point[0]; info.mContactPoint.y = mReturnInfoList[hitnum].m_point[1]; info.mContactPoint.z = mReturnInfoList[hitnum].m_point[2]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <me...@us...> - 2009-11-27 21:08:40
|
Revision: 2758 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2758&view=rev Author: melven2 Date: 2009-11-27 21:08:26 +0000 (Fri, 27 Nov 2009) Log Message: ----------- removed CollisionTools::CollisionCalculateAABB (because there's col->getAABB() ) and added a function to calculate the correct AABB CollisionTools::CollisionCalculateFittingAABB Modified Paths: -------------- branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_Collision.h branches/ogrenewt/newton20/inc/OgreNewt_Tools.h branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_Tools.cpp Modified: branches/ogrenewt/newton20/inc/OgreNewt.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt.h 2009-11-16 07:53:46 UTC (rev 2757) +++ branches/ogrenewt/newton20/inc/OgreNewt.h 2009-11-27 21:08:26 UTC (rev 2758) @@ -66,6 +66,8 @@ \section new New in this version New in this version + - removed CollisionTools::CollisionCalculateAABB (because there's col->getAABB() ) and added a function to calculate the correct AABB + CollisionTools::CollisionCalculateFittingAABB - ConvexCast: - added "NormalOnHitPoint" - added player controller demo Modified: branches/ogrenewt/newton20/inc/OgreNewt_Collision.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Collision.h 2009-11-16 07:53:46 UTC (rev 2757) +++ branches/ogrenewt/newton20/inc/OgreNewt_Collision.h 2009-11-27 21:08:26 UTC (rev 2758) @@ -84,6 +84,9 @@ void makeUnique(); //! get the Axis-Aligned Bounding Box for this collision shape. + /*! + * \warning The returned AABB can be too large! If you need an AABB that fits exactly use the OgreNewt::CollisionTools::CalculateFittingAABB function + */ Ogre::AxisAlignedBox getAABB( const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, const Ogre::Vector3& pos = Ogre::Vector3::ZERO ) const; //! Returns the Collisiontype for this Collision Modified: branches/ogrenewt/newton20/inc/OgreNewt_Tools.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Tools.h 2009-11-16 07:53:46 UTC (rev 2757) +++ branches/ogrenewt/newton20/inc/OgreNewt_Tools.h 2009-11-27 21:08:26 UTC (rev 2758) @@ -163,10 +163,15 @@ \param orient world orientation of the collision. \param pos world position of the collision. */ - _OgreNewtExport Ogre::AxisAlignedBox CollisionCalculateAABB( const OgreNewt::CollisionPtr& col, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ); + _OgreNewtExport Ogre::AxisAlignedBox CollisionCalculateFittingAABB( const OgreNewt::CollisionPtr& col, + const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY, + const Ogre::Vector3& pos = Ogre::Vector3::ZERO ); - } // end namespace "ColliionTools" + //! Get a vertex of the collision in the given direction + _OgreNewtExport Ogre::Vector3 CollisionSupportVertex( const OgreNewt::CollisionPtr& col, const Ogre::Vector3& dir ); + } // end namespace "CollisionTools" + namespace Springs { Modified: branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp 2009-11-16 07:53:46 UTC (rev 2757) +++ branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp 2009-11-27 21:08:26 UTC (rev 2758) @@ -47,9 +47,9 @@ { m_localFrame.setScale( Ogre::Vector3::UNIT_SCALE ); m_localFrame.setTrans( m_body->getCenterOfMass() ); - Ogre::AxisAlignedBox playerAabb = m_body->getCollision()->getAABB( m_localFrame.extractQuaternion() ); + Ogre::AxisAlignedBox playerAabb = CollisionTools::CollisionCalculateFittingAABB( m_body->getCollision(), m_localFrame.extractQuaternion() ); Ogre::Real playerHeight = playerAabb.getSize().y; - Ogre::Real playerRadius = std::max(playerAabb.getSize().x, playerAabb.getSize().z); + Ogre::Real playerRadius = std::max(playerAabb.getSize().x, playerAabb.getSize().z) / 2.0f; m_maxRadius = playerRadius + m_kinematicCushion; @@ -577,15 +577,13 @@ } else { - if( distanceToFirstHit <= 1.0e-3f ) - ; - else + if( distanceToFirstHit > 1.0e-3f ) { bool isFuturePosInRamp; Ogre::Vector3 floorNormal = allBodyConvexCast.getInfoAt(0).mContactNormal; - isFuturePosInRamp = upDir.angleBetween(floorNormal) < m_maxSlope; + isFuturePosInRamp = upDir.angleBetween(floorNormal) > m_maxSlope; if( isFuturePosInRamp ) { AllBodyConvexCast allBodyConvexCast2(this); @@ -636,7 +634,7 @@ floorNormal = allBodyConvexCast3.getInfoAt(0).mContactNormal; filterBodies.push_back(allBodyConvexCast3.getInfoAt(0).mBody); - if( upDir.angleBetween( floorNormal ) < m_maxSlope ) + if( upDir.angleBetween( floorNormal ) > m_maxSlope ) contactCount = 1; else contactCount = 0; Modified: branches/ogrenewt/newton20/src/OgreNewt_Tools.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Tools.cpp 2009-11-16 07:53:46 UTC (rev 2757) +++ branches/ogrenewt/newton20/src/OgreNewt_Tools.cpp 2009-11-27 21:08:26 UTC (rev 2758) @@ -202,17 +202,35 @@ return NewtonCollisionRayCast( col->getNewtonCollision(), &startPt.x, &endPt.x, &retNorm.x, &retColID ); } - Ogre::AxisAlignedBox CollisionCalculateAABB( const OgreNewt::CollisionPtr& col, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) + Ogre::AxisAlignedBox CollisionCalculateFittingAABB( const OgreNewt::CollisionPtr& col, const Ogre::Quaternion& orient, const Ogre::Vector3& pos ) { - float matrix[16]; - Converters::QuatPosToMatrix( orient, pos, matrix ); - Ogre::Vector3 min, max; + Ogre::Vector3 max, min; - NewtonCollisionCalculateAABB( col->getNewtonCollision(), matrix, &min.x, &max.x ); + for( int i = 0; i < 3; i++ ) + { + Ogre::Vector3 currentDir, supportVertex; - return Ogre::AxisAlignedBox( min, max ); + currentDir = Ogre::Vector3::ZERO; + currentDir[i] = 1; + currentDir = orient*currentDir; + supportVertex = CollisionSupportVertex( col, currentDir ) - pos; + max[i] = supportVertex.dotProduct(currentDir); + + currentDir *= -1.0f; + supportVertex = CollisionSupportVertex( col, currentDir ) - pos; + min[i] = -supportVertex.dotProduct(currentDir); + } + + return Ogre::AxisAlignedBox(min, max); } + Ogre::Vector3 CollisionSupportVertex( const OgreNewt::CollisionPtr& col, const Ogre::Vector3& dir ) + { + Ogre::Vector3 ret; + NewtonCollisionSupportVertex( col->getNewtonCollision(), &dir.x, &ret.x ); + return ret; + } + } // end namespace "CollisionTools" namespace Springs This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <me...@us...> - 2009-11-27 21:57:58
|
Revision: 2759 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2759&view=rev Author: melven2 Date: 2009-11-27 21:57:51 +0000 (Fri, 27 Nov 2009) Log Message: ----------- added a destructor callback for OgreNewt::Joint and OgreNewt::Body (because these can be destroyed indirectly through newton callbacks!) Modified Paths: -------------- branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_Body.h branches/ogrenewt/newton20/inc/OgreNewt_Joint.h branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h branches/ogrenewt/newton20/inc/OgreNewt_Vehicle.h branches/ogrenewt/newton20/src/OgreNewt_Body.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp Modified: branches/ogrenewt/newton20/inc/OgreNewt.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt.h 2009-11-27 21:08:26 UTC (rev 2758) +++ branches/ogrenewt/newton20/inc/OgreNewt.h 2009-11-27 21:57:51 UTC (rev 2759) @@ -66,6 +66,7 @@ \section new New in this version New in this version + - added a destructor callback for OgreNewt::Joint and OgreNewt::Body (because these can be destroyed indirectly through newton callbacks!) - removed CollisionTools::CollisionCalculateAABB (because there's col->getAABB() ) and added a function to calculate the correct AABB CollisionTools::CollisionCalculateFittingAABB - ConvexCast: Modified: branches/ogrenewt/newton20/inc/OgreNewt_Body.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-11-27 21:08:26 UTC (rev 2758) +++ branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-11-27 21:57:51 UTC (rev 2759) @@ -35,7 +35,7 @@ this class represents a NewtonBody rigid body! */ //! main class for all Rigid Bodies in the system. -class _OgreNewtExport Body +class _OgreNewtExport Body : public _DestructorCallback<Body> { public: //! custom force callback. Modified: branches/ogrenewt/newton20/inc/OgreNewt_Joint.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Joint.h 2009-11-27 21:08:26 UTC (rev 2758) +++ branches/ogrenewt/newton20/inc/OgreNewt_Joint.h 2009-11-27 21:57:51 UTC (rev 2759) @@ -25,7 +25,7 @@ /*! this class is inherited by all other specific joint types. */ -class _OgreNewtExport Joint +class _OgreNewtExport Joint : public _DestructorCallback<Joint> { public: Modified: branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h 2009-11-27 21:08:26 UTC (rev 2758) +++ branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h 2009-11-27 21:57:51 UTC (rev 2759) @@ -79,6 +79,64 @@ class CollisionSerializer; class ConvexCollision; class Debugger; + + + //! helper class: OgreNewt-classes can derive from this class to implement a destructor-callback + /*! + * Consider the following example: + * You delete a body thats part of joint, so newton deletes the joint, then you could still have a pointer to that joint. Using this pointer will fail, + * thats why you need a way to get to know, when an object gets deleted... + */ + template<class DerivedClass> + class _DestructorCallback + { + public: + //! destructor callback + /*! + * This function is called, when the object is destroyed. It's only argument is a pointer to the instance currently destroyed + * @warning the pointer to the destroyed class instance is already invalid (the class is already destroyed!) + */ + typedef boost::function<void(DerivedClass*)> DestructorCallbackFunction; + + //! constructor + _DestructorCallback() : m_callback(NULL) {} + + //! destructor + virtual ~_DestructorCallback() + { + if( m_callback ) + m_callback((DerivedClass*)(this)); + } + + //! remove any destructor callback + void removeDestructorCallback() {m_callback = NULL;} + + //! set the destructor callback + /*! + * + * This specifies a custom callback that's called when this class is destroyed. If you are using a standard non-member function, + * or a static member function, you can simply pass a pointer to the function here.. like this: + * setDestructorCallback( &myCallbackFunction ); + * + * If you want to bind to a class member, you also need to pass a pointer to the class itself, using the boost::bind system, like so: + * setDestructorCallback( boost::bind( &MyClass::myCallback, (MyClass*)classInstance, _1 ) ); (from outside the class) or: + * setDestructorCallback( boost::bind( &MyClass::myCallback, this, _1 ) ); (from inside the class). + * + * You can also use: + * setDestructorCallback<>( &MyClass::myCallback, (MyClass*)classInstance ); (from outside the class) or: + * setDestructorCallback<>( &MyClass::myCallback, this ); (from inside the class). + * Note: Notice the "<>" after the function name. + * + */ + void setDestructorCallback( DestructorCallbackFunction fun ) { m_callback = fun; } + template<class c> void setDestructorCallback( boost::function<void(c*, DerivedClass*)> callback, c *instancedClassPointer ) + { + setDestructorCallback( boost::bind(callback, instancedClassPointer, _1) ); + } + private: + DestructorCallbackFunction m_callback; + + }; } #endif Modified: branches/ogrenewt/newton20/inc/OgreNewt_Vehicle.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Vehicle.h 2009-11-27 21:08:26 UTC (rev 2758) +++ branches/ogrenewt/newton20/inc/OgreNewt_Vehicle.h 2009-11-27 21:57:51 UTC (rev 2759) @@ -25,7 +25,7 @@ /*! this class represents a basic vehicle, meant to be inherited by the user, with functionality added. */ - class _OgreNewtExport Vehicle + class _OgreNewtExport Vehicle : public _DestructorCallback<Vehicle> { public: Modified: branches/ogrenewt/newton20/src/OgreNewt_Body.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Body.cpp 2009-11-27 21:08:26 UTC (rev 2758) +++ branches/ogrenewt/newton20/src/OgreNewt_Body.cpp 2009-11-27 21:57:51 UTC (rev 2759) @@ -351,9 +351,9 @@ getPositionOrientation( bodypos, bodyorient ); Ogre::Vector3 localMassCenter = getCenterOfMass(); - Ogre::Vector3 globalMassCenter = bodyorient * localMassCenter; + Ogre::Vector3 globalMassCenter = bodypos + bodyorient * localMassCenter; - Ogre::Vector3 topoint = pos - bodypos - globalMassCenter; + Ogre::Vector3 topoint = pos - globalMassCenter; Ogre::Vector3 torque = topoint.crossProduct( force ); addForce( force ); Modified: branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp 2009-11-27 21:08:26 UTC (rev 2758) +++ branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp 2009-11-27 21:57:51 UTC (rev 2759) @@ -265,15 +265,18 @@ Ogre::Quaternion ori; Ogre::Real invMass; Ogre::Vector3 invInertia; - Ogre::Vector3 frontDir, upDir, strafeDir; + Ogre::Vector3 localFrontDir, localUpDir, localStrafeDir, globalFrontDir, globalUpDir, globalStrafeDir; m_body->getInvMass(invMass, invInertia); m_body->getPositionOrientation(pos,ori); Ogre::Quaternion localFrameRotation = m_localFrame.extractQuaternion(); - frontDir = localFrameRotation * Ogre::Vector3::NEGATIVE_UNIT_Z; - upDir = localFrameRotation * Ogre::Vector3::UNIT_Y; - strafeDir = localFrameRotation * Ogre::Vector3::UNIT_X; + localFrontDir = localFrameRotation * Ogre::Vector3::NEGATIVE_UNIT_Z; + localUpDir = localFrameRotation * Ogre::Vector3::UNIT_Y; + localStrafeDir = localFrameRotation * Ogre::Vector3::UNIT_X; + globalFrontDir = ori*localFrontDir; + globalUpDir = ori*localUpDir; + globalStrafeDir = ori*localStrafeDir; @@ -283,8 +286,7 @@ // if the body has rotated by some amount, there will be a plane of rotation - Ogre::Vector3 realUp = ori*(localFrameRotation*Ogre::Vector3::UNIT_Y); - Ogre::Vector3 lateralDir = realUp.crossProduct(upDir); + Ogre::Vector3 lateralDir = globalUpDir.crossProduct(localUpDir); Ogre::Real mag = lateralDir.length(); if( mag > 1.0e-3f) { @@ -297,14 +299,14 @@ // in theory only one correction is needed, but this produces instability as the body may move sideway. // a lateral correction prevent this from happening. - Ogre::Vector3 frontDir = lateralDir.crossProduct(upDir); + Ogre::Vector3 frontDir = lateralDir.crossProduct(globalUpDir); addAngularRow(Ogre::Radian(0), lateralDir); } else { // if the angle error is very small then two angular correction along the plane axis do the trick - addAngularRow( Ogre::Radian(0), strafeDir ); - addAngularRow( Ogre::Radian(0), frontDir ); + addAngularRow( Ogre::Radian(0), globalStrafeDir ); + addAngularRow( Ogre::Radian(0), globalFrontDir ); } @@ -313,7 +315,7 @@ if( m_playerState == PS_ONLAND ) { Ogre::Vector3 vel = m_body->getVelocity(); - Ogre::Vector3 desiredVel = frontDir* m_forwardSpeed + upDir * (vel.dotProduct(upDir)) + strafeDir * m_sideSpeed; + Ogre::Vector3 desiredVel = globalFrontDir* m_forwardSpeed + globalUpDir * (vel.dotProduct(globalUpDir)) + globalStrafeDir * m_sideSpeed; m_body->setVelocity(desiredVel); } @@ -525,7 +527,7 @@ Ogre::Vector3 newPos; newPos = castStart + (castTarget - castStart)*dist - step + upDir * m_kinematicCushion; - m_body->setPositionOrientation(pos, ori); + m_body->setPositionOrientation(newPos, ori); Ogre::Vector3 floorNormal = allBodyConvexCast.getInfoAt(0).mContactNormal; @@ -596,7 +598,7 @@ allBodyConvexCast2.go(m_bodyFloorSensorShape, castStart2, ori, castTarget2, 1, threadIndex, filterBodies); - if( distanceToFirstHit >= allBodyConvexCast2.getDistanceToFirstHit() && allBodyConvexCast2.getContactsCount() > 0 ) + if( distanceToFirstHit >= allBodyConvexCast2.getDistanceToFirstHit() || allBodyConvexCast2.getContactsCount() == 0 ) { setPlayerState(PS_ONILLEGALRAMP); } @@ -623,7 +625,7 @@ castStart3 = pos + step + upDir*(m_stairHeight - m_kinematicCushion); castTarget3 = castStart3 - upDir*2.0f * m_stairHeight; - allBodyConvexCast3.go(m_bodyFloorSensorShape, castStart3, ori, castTarget3, 1, threadIndex, filterBodies); + allBodyConvexCast3.go(m_bodyFloorSensorShape, castStart3, ori, castTarget3, 1, threadIndex); contactCount = allBodyConvexCast3.getContactsCount(); if( contactCount > 0 ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <me...@us...> - 2009-11-27 22:02:59
|
Revision: 2760 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2760&view=rev Author: melven2 Date: 2009-11-27 22:02:48 +0000 (Fri, 27 Nov 2009) Log Message: ----------- -updated some comments (version number) -added new demo for player controller (it's not finished yet!) Modified Paths: -------------- branches/ogrenewt/newton20/inc/OgreNewt.h Added Paths: ----------- branches/ogrenewt/newton20/demos/Demo09_PlayerController/ branches/ogrenewt/newton20/demos/Demo09_PlayerController/CMakeLists.txt branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo09_PlayerController/demo09.cpp Added: branches/ogrenewt/newton20/demos/Demo09_PlayerController/CMakeLists.txt =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/CMakeLists.txt (rev 0) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/CMakeLists.txt 2009-11-27 22:02:48 UTC (rev 2760) @@ -0,0 +1,5 @@ +ADD_EXECUTABLE(Demo09_PlayerController demo09.cpp OgreNewtonApplication.cpp OgreNewtonFrameListener.cpp) + +TARGET_LINK_LIBRARIES(Demo09_PlayerController ${OGRE_LIBRARIES} ${CEGUI_LIBRARIES} ${OGRENEWT_LIBRARIES} ${OIS_LIBRARIES} ${CEGUIOGRE_LIBRARIES}) + +#INSTALL(TARGETS Demo09_PlayerController RUNTIME DESTINATION ${CMAKE_SOURCE_DIR}/bin) Added: branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp (rev 0) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp 2009-11-27 22:02:48 UTC (rev 2760) @@ -0,0 +1,258 @@ +/* + OgreNewt library - connecting Ogre and Newton! + + Demo09_PlayerController +*/ +#include "OgreNewtonApplication.h" +#include "OgreNewtonFrameListener.h" + +#include <OgreNewt.h> +#include <OgreNewt_BasicFrameListener.h> + + +OgreNewtonApplication::OgreNewtonApplication(void) +{ + // create OgreNewt world. + m_World = new OgreNewt::World(); + mPlayer = NULL; + + mEntityCount = 0; + +} + +OgreNewtonApplication::~OgreNewtonApplication(void) +{ + // destroy world. + if( mPlayer ) + delete mPlayer; + delete m_World; +} + + + +void OgreNewtonApplication::createScene() +{ + + // setup CEGUI + mGUIRenderer = new CEGUI::OgreCEGUIRenderer( mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr ); + new CEGUI::System( mGUIRenderer ); + + // load up CEGUI stuff... + try + { + using namespace CEGUI; + CEGUI::Logger::getSingleton().setLoggingLevel( CEGUI::Informative ); + + CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme"); + CEGUI::System::getSingleton().setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow"); + CEGUI::System::getSingleton().setDefaultFont((CEGUI::utf8*)"BlueHighway-10"); + + CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().createWindow( (CEGUI::utf8*)"DefaultWindow", (CEGUI::utf8*)"root_wnd" ); + CEGUI::System::getSingleton().setGUISheet( sheet ); + + //makeGUI(); + //setupGUI(); + + } + catch (CEGUI::Exception) + {} + + + // sky box. + mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); + + // shadows on! + mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_ADDITIVE ); + + + // floor object! + Entity* floor; + SceneNode* floornode; + floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); + floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); + floornode->attachObject( floor ); + floor->setMaterialName( "Simple/BeachStones" ); + floor->setCastShadows( false ); + + + + + //Ogre::Vector3 siz(100.0, 10.0, 100.0); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + //floornode->setScale( siz ); + bod->attachNode( floornode ); + bod->setPositionOrientation( Ogre::Vector3(0.0,-10.0,0.0), Ogre::Quaternion::IDENTITY ); + + + // make a simple rope. + Ogre::Vector3 size(3,1.0,1.0); + Ogre::Vector3 pos(0,1,0); + Ogre::Quaternion orient = Ogre::Quaternion::IDENTITY; + + // loop through, making bodies and connecting them. + OgreNewt::Body* parent = NULL; + OgreNewt::Body* child = NULL; + + for (int x=0;x<8;x++) + { + // make the next box. + child = makeSimpleBox(size, pos, orient); + + // now make a new joint connecting this to the last box. + OgreNewt::Joint* joint; + + // make the joint right between the bodies... + + + if (parent) + { + joint = new OgreNewt::BasicJoints::BallAndSocket( m_World, child, parent, pos-Ogre::Vector3(size.x/2,0,0) ); + } + else + { + // no parent, this is the first joint, so just pass NULL as the parent, to stick it to the "world" + joint = new OgreNewt::BasicJoints::BallAndSocket( m_World, child, NULL, pos-Ogre::Vector3(size.x/2,0,0) ); + } + + // offset pos a little more. + pos += Ogre::Vector3(size.x,0,0); + + // save the last body for the next loop! + parent = child; + } + + for (int i=0; i<15;i++) + { + pos = Ogre::Vector3( 10-rand()%20, 4+rand()%2, 10-rand()%20 ); + size = Ogre::Vector3( 1+rand()%3, 1+rand()%3, 1+rand()%3 ); + + OgreNewt::Body* bod = makeSimpleBox( size, pos, orient ); + } + + + // player playground + + bod = NULL; + for( int i = 0; i < 20; i++ ) + { + bod = makeSimpleBox( Ogre::Vector3(4.0, 0.4, 1.0), Ogre::Vector3(15.0, -10.0+i*0.4, -2.0-i*0.4), Ogre::Quaternion::IDENTITY); + bod->setMassMatrix(0, Ogre::Vector3::ZERO); + } + + bod = makeSimpleBox( Ogre::Vector3(10.0, 0.4, 10.0), Ogre::Vector3(-17.0, -8.0, -15.0), Ogre::Quaternion(Ogre::Degree(60), Ogre::Vector3::UNIT_X)); + bod->setMassMatrix(0, Ogre::Vector3::ZERO); + + bod = makeSimpleBox( Ogre::Vector3(10.0, 0.4, 10.0), Ogre::Vector3(-27.0, -8.5, -15.0), Ogre::Quaternion(Ogre::Degree(20), Ogre::Vector3::UNIT_X)); + bod->setMassMatrix(0, Ogre::Vector3::ZERO); + + bod = makeSimpleBox( Ogre::Vector3(10.0, 0.4, 10.0), Ogre::Vector3(-37.0, -8.0, -15.0), Ogre::Quaternion(Ogre::Degree(80), Ogre::Vector3::UNIT_Y) * Ogre::Quaternion(Ogre::Degree(50), Ogre::Vector3::UNIT_X)); + bod->setMassMatrix(0, Ogre::Vector3::ZERO); + + makePlayer(); + + + // position camera + mCamera->setPosition(0.0, -3.0, 23.0); + + //make a light + Ogre::Light* light; + + light = mSceneMgr->createLight( "Light1" ); + light->setType( Ogre::Light::LT_POINT ); + light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); + + + +} + + +void OgreNewtonApplication::createFrameListener() +{ + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World, mPlayer); + mRoot->addFrameListener(mFrameListener); + + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); + mRoot->addFrameListener(mNewtonListener); +} + +void OgreNewtonApplication::destroyScene() +{ + CEGUI::System* sys = CEGUI::System::getSingletonPtr(); + delete sys; + + // CEGUI Cleanup + delete mGUIRenderer; +} + + +OgreNewt::Body* OgreNewtonApplication::makeSimpleBox( const Ogre::Vector3& size, const Ogre::Vector3& pos, const Ogre::Quaternion& orient ) +{ + Entity* box1; + SceneNode* box1node; + + box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "box.mesh" ); + box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + box1node->attachObject( box1 ); + box1node->setScale( size ); + + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + + + // base mass on the size of the object. + Ogre::Real mass = size.x * size.y * size.z * 2.5; + // calculate the inertia based on box formula and mass + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + bod->attachNode( box1node ); + bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + box1->setMaterialName( "Simple/BumpyMetal" ); + + + bod->setPositionOrientation( pos, orient ); + + return bod; +} + +void OgreNewtonApplication::makePlayer() +{ + Entity* ellipsoid; + SceneNode* node; + + ellipsoid = mSceneMgr->createEntity( "PlayerControllerEntity", "ellipsoid.mesh"); + node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + node->attachObject( ellipsoid ); + node->setScale(Ogre::Vector3(1,2.5,1)); + + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,2.5,1), 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + bod->attachNode(node); + bod->setMassMatrix( 50, 50*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + ellipsoid->setMaterialName("Simple/dirt01"); + + bod->setPositionOrientation(Ogre::Vector3(0,20,20), Ogre::Quaternion::IDENTITY); + + mPlayer = new OgreNewt::PlayerController(bod, 0.4); +} + Added: branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.h =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.h (rev 0) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.h 2009-11-27 22:02:48 UTC (rev 2760) @@ -0,0 +1,47 @@ +#pragma once + + +#include <ExampleApplication.h> +#include <OgreNewt.h> + +// CEGUI has issues with the Ogre memory manager, this seems to fix it for now. +//#include <OgreNoMemoryMacros.h> +#include <CEGUI/CEGUI.h> +//#include <OgreMemoryMacros.h> + + +#include <OgreCEGUIRenderer.h> +#include <OgreCEGUIResourceProvider.h> + + + + +class OgreNewtonApplication : + public ExampleApplication +{ +public: + OgreNewtonApplication(void); + ~OgreNewtonApplication(void); + +protected: + void createFrameListener(); + void createScene(); + + void destroyScene(); + + // our custom function to simplify making simpe dynamics rigid body boxes. + OgreNewt::Body* makeSimpleBox( const Ogre::Vector3& size, const Ogre::Vector3& pos, const Ogre::Quaternion& orient ); + + void makePlayer(); + +private: + OgreNewt::World* m_World; + OgreNewt::PlayerController *mPlayer; + + Ogre::FrameListener* mNewtonListener; + + int mEntityCount; + + CEGUI::OgreCEGUIRenderer* mGUIRenderer; +}; + Added: branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.cpp (rev 0) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.cpp 2009-11-27 22:02:48 UTC (rev 2760) @@ -0,0 +1,78 @@ +#include "OgreNewtonFrameListener.h" + + +//#include <OgreNoMemoryMacros.h> +#include <CEGUI/CEGUI.h> +//#include <OgreMemoryMacros.h> + + +OgreNewtonFrameListener::OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, OgreNewt::PlayerController *player) : + ExampleFrameListener(win,cam) +{ + m_World = W; + mSceneMgr = mgr; + mPlayer = player; + + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); +} + +OgreNewtonFrameListener::~OgreNewtonFrameListener(void) +{ +} + +bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) +{ + mKeyboard->capture(); + mMouse->capture(); + + + + // player movement uhjk zi + Ogre::Real forwardSpeed, sideSpeed; + Ogre::Radian heading; + mPlayer->getVelocity(forwardSpeed, sideSpeed, heading); + forwardSpeed = 0; + sideSpeed = 0; + if(mKeyboard->isKeyDown(OIS::KC_U)) + forwardSpeed += 6.0; + if(mKeyboard->isKeyDown(OIS::KC_J)) + forwardSpeed -= 5.0; + if(mKeyboard->isKeyDown(OIS::KC_H)) + sideSpeed -= 5.0; + if(mKeyboard->isKeyDown(OIS::KC_K)) + sideSpeed += 5.0; + if(mKeyboard->isKeyDown(OIS::KC_Z)) + heading += Degree(90)/60.0; + if(mKeyboard->isKeyDown(OIS::KC_I)) + heading -= Degree(90)/60.0; + + mPlayer->setVelocity(forwardSpeed, sideSpeed, heading); + + + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + debug.showDebugInformation(); + } + else + { + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + debug.hideDebugInformation(); + } + + + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) + return false; + + return true; +} + Added: branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.h =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.h (rev 0) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.h 2009-11-27 22:02:48 UTC (rev 2760) @@ -0,0 +1,69 @@ +#pragma once +#include "ExampleFrameListener.h" +#include <OgreNewt.h> +#include <OIS.h> +#include <CEGUI.h> + + +class OgreNewtonFrameListener : + public ExampleFrameListener, + public OIS::KeyListener, + public OIS::MouseListener +{ +protected: + OgreNewt::World* m_World; + SceneManager* mSceneMgr; + int count; + OgreNewt::PlayerController* mPlayer; +public: + OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, OgreNewt::PlayerController* player); + ~OgreNewtonFrameListener(void); + + bool frameStarted(const FrameEvent &evt); + + bool mouseMoved (const OIS::MouseEvent &e) + { + CEGUI::System::getSingleton().injectMouseMove( e.state.X.rel, e.state.Y.rel ); + return true; + } + + bool keyPressed( const OIS::KeyEvent &arg ) + { + CEGUI::System::getSingleton().injectKeyDown( arg.key ); + CEGUI::System::getSingleton().injectChar( arg.text ); + return true; + } + + bool keyReleased( const OIS::KeyEvent &arg ) + { + CEGUI::System::getSingleton().injectKeyUp( arg.key ); + return true; + } + + bool mousePressed (const OIS::MouseEvent &e, OIS::MouseButtonID id) + { + CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id)); + return true; + } + + bool mouseReleased (const OIS::MouseEvent &e, OIS::MouseButtonID id) + { + CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id)); + return true; + } + +protected: + CEGUI::MouseButton convertOISMouseButtonToCegui(int id) + { + switch (id) + { + case 0: return CEGUI::LeftButton; + case 1: return CEGUI::RightButton; + case 2: return CEGUI::MiddleButton; + case 3: return CEGUI::X1Button; + default: return CEGUI::LeftButton; + } + + } +}; + Added: branches/ogrenewt/newton20/demos/Demo09_PlayerController/demo09.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/demo09.cpp (rev 0) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/demo09.cpp 2009-11-27 22:02:48 UTC (rev 2760) @@ -0,0 +1,33 @@ + +/* + Demo09_PlayerController + + by melven +*/ + +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#endif + +#include "OgreNewtonApplication.h" + + +#ifdef WIN32 +INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) +#else +int main(int argc, char**argv) +#endif +{ + // Create application object + OgreNewtonApplication app; + + try { + app.go(); + } catch( Ogre::Exception& e ) { + printf( "An Error HAS OCCURED: %s", e.getFullDescription().c_str() ); + } + + return 0; +} + Modified: branches/ogrenewt/newton20/inc/OgreNewt.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt.h 2009-11-27 21:57:51 UTC (rev 2759) +++ branches/ogrenewt/newton20/inc/OgreNewt.h 2009-11-27 22:02:48 UTC (rev 2760) @@ -9,9 +9,9 @@ main header file. - current version: 2.07.0 + current version: 2.07.1 - Newton version: 2.07 (beta) + Newton version: at least 2.07 (beta) Ogre version: Shoggoth (1.6.x) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kal...@us...> - 2009-12-06 13:10:05
|
Revision: 2761 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2761&view=rev Author: kallaspriit Date: 2009-12-06 13:09:56 +0000 (Sun, 06 Dec 2009) Log Message: ----------- Added new Visual Studio 9 project files that include the demos and are set up using the following enviroment variables: "OGRE_HOME" - ogre home directory (i compiled Ogre myself, the directories may not be correct with precompiled version) "BOOST_HOME" - boost directory "NEWTON_HOME" - NGD install directory "OGRENEWT_HOME" - OgreNewt root directory With these set correctly, everything should compile and run out of the box without changing anything. The directories are set up relative to self-compiled Ogre 1.6. and was tested with NGD 2.10. See the updated INSTALL.TXT for more information. Also fixed BasicFrameListener to compile in debug mode (was missing logging includes). Modified Paths: -------------- branches/ogrenewt/newton20/INSTALL.TXT branches/ogrenewt/newton20/OgreNewt.sln branches/ogrenewt/newton20/OgreNewt.vcproj branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp branches/ogrenewt/newton20/src/OgreNewt_World.cpp Added Paths: ----------- branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj branches/ogrenewt/newton20/demos/Demo09_PlayerController/Demo09_PlayerController.vcproj branches/ogrenewt/newton20/demos/bin/Debug/ branches/ogrenewt/newton20/demos/bin/Debug/plugins.cfg branches/ogrenewt/newton20/demos/bin/Debug/resources.cfg branches/ogrenewt/newton20/demos/bin/Release/ branches/ogrenewt/newton20/demos/bin/Release/plugins.cfg branches/ogrenewt/newton20/demos/bin/Release/resources.cfg Removed Paths: ------------- branches/ogrenewt/newton20/Demo09_PlayerController/ branches/ogrenewt/newton20/OgreNewt_vc2008.sln branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj branches/ogrenewt/newton20/demos/bin/plugins.cfg branches/ogrenewt/newton20/demos/bin/resources.cfg Property Changed: ---------------- branches/ogrenewt/newton20/ branches/ogrenewt/newton20/demos/ branches/ogrenewt/newton20/demos/Demo01_TheBasics/ branches/ogrenewt/newton20/demos/Demo02_Joints/ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/ branches/ogrenewt/newton20/demos/Demo04_Raycasting/ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/ branches/ogrenewt/newton20/demos/Demo09_PlayerController/ Property changes on: branches/ogrenewt/newton20 ___________________________________________________________________ Added: svn:ignore + *.ncb *.suo *.user lib obj Modified: branches/ogrenewt/newton20/INSTALL.TXT =================================================================== --- branches/ogrenewt/newton20/INSTALL.TXT 2009-11-27 22:02:48 UTC (rev 2760) +++ branches/ogrenewt/newton20/INSTALL.TXT 2009-12-06 13:09:56 UTC (rev 2761) @@ -1,21 +1,41 @@ -To compile and install this library you need cmake > 2.6.2 (http://www.cmake.org/) +To compile and install this library with CMAKE, you need version > 2.6.2 (http://www.cmake.org/). +There is a solution for VS 2008. -On Windows: - install cmake and then use cmake to create project files for Visual Studio +You also need: +- Ogre (tested with 1.6) - http://ogre3d.org +- Newton Game Dynamics (tested with 2.11) - http://www.newtondynamics.com/forum (see the beta thread for latest) +- Boost (tested with 1.40.0) - http://bost.org -On *nix: - if you have installed cmake, you can do: +1. On Windows: + 1) Using Visual Studio 2008 + Just use the solution provided and before compiling, set the following environment variables: + "OGRE_HOME" - ogre home directory (i compiled Ogre myself, the directories may not be correct with precompiled version) + "BOOST_HOME" - boost directory (get the latest from http://boost.org) + "NEWTON_HOME" - NGD install directory + "OGRENEWT_HOME" - OgreNewt root directory + If set properly, everything should compile and work out of the box, even the dll's are automaticly copied. + - mkdir build - cd build - cmake .. - make + 2) Using something else + a) Try your luck with cmake, it wont currently work 100%. If someone fixes cmake files for windows, then please + let us know on OgreNewt forums (http://www.ogre3d.org/addonforums/viewforum.php?f=4). + b) Make your own project files for your IDE, preferably using the same environment variables and we could add + this to SVN, write on forums + +2. On *nix: + If you have installed cmake, you can do: + > mkdir build + > cd build + > cmake .. + > make + To install the library type (as root) - make install + > make install or - sudo make install + > sudo make install +Visit the forum if you have problems or have new project files to share :) \ No newline at end of file Modified: branches/ogrenewt/newton20/OgreNewt.sln =================================================================== --- branches/ogrenewt/newton20/OgreNewt.sln 2009-11-27 22:02:48 UTC (rev 2760) +++ branches/ogrenewt/newton20/OgreNewt.sln 2009-12-06 13:09:56 UTC (rev 2761) @@ -1,7 +1,42 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OgreNewt", "OgreNewt.vcproj", "{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo01_TheBasics", "demos\Demo01_TheBasics\Demo01_TheBasics.vcproj", "{59D5ADD4-9669-468E-B687-F461BB7F4112}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo02_Joints", "demos\Demo02_Joints\Demo02_Joints.vcproj", "{5BAB7340-BEDB-408A-96B1-296785399531}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo03_CollisionCallbacks", "demos\Demo03_CollisionCallbacks\Demo03_CollisionCallbacks.vcproj", "{E575CBC2-5A60-45CC-B2F8-74E2719A8114}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo04_Raycasting", "demos\Demo04_Raycasting\Demo04_Raycasting.vcproj", "{8A31E25D-CC48-401E-9936-748453D06D3C}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo06_SimpleBuoyancy", "demos\Demo06_SimpleBuoyancy\Demo06_SimpleBuoyancy.vcproj", "{118B989E-1929-4173-99F5-B3C214879241}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo07_CustomJoints", "demos\Demo07_CustomJoints\Demo07_CustomJoints.vcproj", "{730565C2-A2C2-4D8B-89D4-ED062FD22B8C}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo09_PlayerController", "demos\Demo09_PlayerController\Demo09_PlayerController.vcproj", "{2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -12,6 +47,34 @@ {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Debug|Win32.Build.0 = Debug|Win32 {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|Win32.ActiveCfg = Release|Win32 {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|Win32.Build.0 = Release|Win32 + {59D5ADD4-9669-468E-B687-F461BB7F4112}.Debug|Win32.ActiveCfg = Debug|Win32 + {59D5ADD4-9669-468E-B687-F461BB7F4112}.Debug|Win32.Build.0 = Debug|Win32 + {59D5ADD4-9669-468E-B687-F461BB7F4112}.Release|Win32.ActiveCfg = Release|Win32 + {59D5ADD4-9669-468E-B687-F461BB7F4112}.Release|Win32.Build.0 = Release|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Debug|Win32.ActiveCfg = Debug|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Debug|Win32.Build.0 = Debug|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Release|Win32.ActiveCfg = Release|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Release|Win32.Build.0 = Release|Win32 + {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Debug|Win32.ActiveCfg = Debug|Win32 + {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Debug|Win32.Build.0 = Debug|Win32 + {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Release|Win32.ActiveCfg = Release|Win32 + {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Release|Win32.Build.0 = Release|Win32 + {8A31E25D-CC48-401E-9936-748453D06D3C}.Debug|Win32.ActiveCfg = Debug|Win32 + {8A31E25D-CC48-401E-9936-748453D06D3C}.Debug|Win32.Build.0 = Debug|Win32 + {8A31E25D-CC48-401E-9936-748453D06D3C}.Release|Win32.ActiveCfg = Release|Win32 + {8A31E25D-CC48-401E-9936-748453D06D3C}.Release|Win32.Build.0 = Release|Win32 + {118B989E-1929-4173-99F5-B3C214879241}.Debug|Win32.ActiveCfg = Debug|Win32 + {118B989E-1929-4173-99F5-B3C214879241}.Debug|Win32.Build.0 = Debug|Win32 + {118B989E-1929-4173-99F5-B3C214879241}.Release|Win32.ActiveCfg = Release|Win32 + {118B989E-1929-4173-99F5-B3C214879241}.Release|Win32.Build.0 = Release|Win32 + {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Debug|Win32.ActiveCfg = Debug|Win32 + {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Debug|Win32.Build.0 = Debug|Win32 + {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Release|Win32.ActiveCfg = Release|Win32 + {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Release|Win32.Build.0 = Release|Win32 + {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Debug|Win32.ActiveCfg = Debug|Win32 + {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Debug|Win32.Build.0 = Debug|Win32 + {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|Win32.ActiveCfg = Release|Win32 + {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: branches/ogrenewt/newton20/OgreNewt.vcproj =================================================================== --- branches/ogrenewt/newton20/OgreNewt.vcproj 2009-11-27 22:02:48 UTC (rev 2760) +++ branches/ogrenewt/newton20/OgreNewt.vcproj 2009-12-06 13:09:56 UTC (rev 2761) @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="8,00" + Version="9,00" Name="OgreNewt" ProjectGUID="{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" RootNamespace="OgreNewt" Keyword="Win32Proj" + TargetFrameworkVersion="131072" > <Platforms> <Platform @@ -18,7 +19,7 @@ <Configuration Name="Debug|Win32" OutputDirectory="lib" - IntermediateDirectory="OgreNewt.dir\Debug" + IntermediateDirectory="obj\debug" ConfigurationType="2" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" @@ -52,14 +53,14 @@ <Tool Name="VCCLCompilerTool" AdditionalOptions=" /Zm1000 -O0 -g3 -fno-inline" - AdditionalIncludeDirectories=".\inc;..\NewtonSDK\sdk;..\ogrenew\OgreMain\include;..\boost\include" - PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" + PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC;WIN32" ExceptionHandling="1" RuntimeLibrary="3" RuntimeTypeInfo="true" AssemblerListingLocation="Debug" ObjectFile="$(IntDir)\" - ProgramDataBaseFileName="./Debug/OgreNewt.pdb" + ProgramDataBaseFileName=".\lib\OgreNewt_d.pdb" WarningLevel="3" CompileAs="2" /> @@ -81,9 +82,11 @@ OutputFile="./lib/OgreNewt_d.dll" Version="2.0" LinkIncremental="2" - AdditionalLibraryDirectories="../ogrenew/lib;../boost/lib;../NewtonSDK/sdk/x32/dll_vs7" + AdditionalLibraryDirectories=""$(OGRE_HOME)/lib";"$(BOOST_HOME)/libs";"$(NEWTON_HOME)/sdk/x32/dll_vs9"" GenerateManifest="true" ProgramDatabaseFile=".\lib\OgreNewt_d.pdb" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" ImportLibrary=".\lib\OgreNewt_d.lib" /> <Tool @@ -105,16 +108,14 @@ Name="VCAppVerifierTool" /> <Tool - Name="VCWebDeploymentTool" - /> - <Tool Name="VCPostBuildEventTool" + CommandLine="copy $(OutDir)\OgreNewt_d.dll demos\bin\Debug\OgreNewt_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll demos\bin\Debug\OgreMain_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll demos\bin\Debug\OIS_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll demos\bin\Debug\Plugin_CgProgramManager_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll demos\bin\Debug\RenderSystem_Direct3D9_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll demos\bin\Debug\RenderSystem_GL_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\OgreGUIRenderer_d.dll demos\bin\Debug\OgreGUIRenderer_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIBase_d.dll demos\bin\Debug\CEGUIBase_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIExpatParser_d.dll demos\bin\Debug\CEGUIExpatParser_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll demos\bin\Debug\cg.dll
copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Debug\newton.dll
" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="lib" - IntermediateDirectory="OgreNewt.dir\Release" + IntermediateDirectory="obj/release" ConfigurationType="2" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" @@ -150,14 +151,14 @@ AdditionalOptions=" /Zm1000" Optimization="2" InlineFunctionExpansion="2" - AdditionalIncludeDirectories=".\inc;..\NewtonSDK\sdk;..\ogrenew\OgreMain\include;..\boost\include" - PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" + PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC;WIN32" ExceptionHandling="1" RuntimeLibrary="2" RuntimeTypeInfo="true" AssemblerListingLocation="Release" ObjectFile="$(IntDir)\" - ProgramDataBaseFileName="./Release/OgreNewt.pdb" + ProgramDataBaseFileName=".\lib\OgreNewt.pdb" WarningLevel="3" CompileAs="2" /> @@ -179,9 +180,11 @@ OutputFile="./lib/OgreNewt.dll" Version="2.0" LinkIncremental="1" - AdditionalLibraryDirectories="../ogrenew/lib;../boost/lib;../NewtonSDK/sdk/x32/dll_vs7" + AdditionalLibraryDirectories=""$(OGRE_HOME)/lib";"$(BOOST_HOME)/libs";"$(NEWTON_HOME)/sdk/x32/dll_vs9"" GenerateManifest="true" ProgramDatabaseFile="lib\OgreNewt.pdb" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" ImportLibrary="lib\OgreNewt.lib" /> <Tool @@ -203,10 +206,8 @@ Name="VCAppVerifierTool" /> <Tool - Name="VCWebDeploymentTool" - /> - <Tool Name="VCPostBuildEventTool" + CommandLine="copy $(OutDir)\OgreNewt.dll demos\bin\Release\OgreNewt.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll demos\bin\Release\OgreMain.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll demos\bin\Release\OIS.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll demos\bin\Release\Plugin_CgProgramManager.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll demos\bin\Release\RenderSystem_Direct3D9.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll demos\bin\Release\RenderSystem_GL.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\OgreGUIRenderer.dll demos\bin\Release\OgreGUIRenderer.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\CEGUIBase.dll demos\bin\Release\CEGUIBase.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\CEGUIExpatParser.dll demos\bin\Release\CEGUIExpatParser.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\cg.dll demos\bin\Release\cg.dll
copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Release\newton.dll
" /> </Configuration> </Configurations> @@ -217,6 +218,10 @@ Name="Source Files" > <File + RelativePath=".\src\OgreNewt_BasicFrameListener.cpp" + > + </File> + <File RelativePath=".\src\OgreNewt_BasicJoints.cpp" > </File> Deleted: branches/ogrenewt/newton20/OgreNewt_vc2008.sln =================================================================== --- branches/ogrenewt/newton20/OgreNewt_vc2008.sln 2009-11-27 22:02:48 UTC (rev 2760) +++ branches/ogrenewt/newton20/OgreNewt_vc2008.sln 2009-12-06 13:09:56 UTC (rev 2761) @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OgreNewt", "OgreNewt_vc2008.vcproj", "{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Debug|Win32.ActiveCfg = Debug|Win32 - {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Debug|Win32.Build.0 = Debug|Win32 - {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|Win32.ActiveCfg = Release|Win32 - {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal Deleted: branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj =================================================================== --- branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj 2009-11-27 22:02:48 UTC (rev 2760) +++ branches/ogrenewt/newton20/OgreNewt_vc2008.vcproj 2009-12-06 13:09:56 UTC (rev 2761) @@ -1,375 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9,00" - Name="OgreNewt" - ProjectGUID="{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" - RootNamespace="OgreNewt" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="lib" - IntermediateDirectory="OgreNewt.dir\Debug" - ConfigurationType="2" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="false" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - PreprocessorDefinitions="WIN32,_WINDOWS,CMAKE_INTDIR=\"Debug\",_OGRENEWT_EXPORTS" - MkTypLibCompatible="false" - TargetEnvironment="1" - GenerateStublessProxies="true" - TypeLibraryName="$(InputName).tlb" - OutputDirectory="$(IntDir)" - HeaderFileName="$(InputName).h" - DLLDataFileName="" - InterfaceIdentifierFileName="$(InputName)_i.c" - ProxyFileName="$(InputName)_p.c" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions=" /Zm1000" - Optimization="0" - AdditionalIncludeDirectories=".\inc;..\NewtonSDK\sdk;..\ogrenew\OgreMain\include;..\boost\include" - PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC" - ExceptionHandling="1" - RuntimeLibrary="3" - RuntimeTypeInfo="true" - AssemblerListingLocation="Debug" - ObjectFile="$(IntDir)\" - ProgramDataBaseFileName="./Debug/OgreNewt.pdb" - WarningLevel="3" - CompileAs="2" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="WIN32,_WINDOWS,CMAKE_INTDIR=\"Debug\",_OGRENEWT_EXPORTS" - AdditionalIncludeDirectories=".\OgreNewt\inc;" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalOptions=" /STACK:10000000 /machine:I386 /debug" - AdditionalDependencies="$(NOINHERIT) kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib newton.lib OgreMain_d.lib" - OutputFile="./lib/OgreNewt_d.dll" - Version="2.0" - LinkIncremental="2" - AdditionalLibraryDirectories="../ogrenew/lib;../boost/lib;..\NewtonSDK\sdk\x32\dll_vs9" - GenerateManifest="true" - ProgramDatabaseFile=".\lib\OgreNewt_d.pdb" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - ImportLibrary=".\lib\OgreNewt_d.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="lib" - IntermediateDirectory="OgreNewt.dir\Release" - ConfigurationType="2" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="false" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - PreprocessorDefinitions="WIN32,_WINDOWS,NDEBUG,CMAKE_INTDIR=\"Release\",_OGRENEWT_EXPORTS" - MkTypLibCompatible="false" - TargetEnvironment="1" - GenerateStublessProxies="true" - TypeLibraryName="$(InputName).tlb" - OutputDirectory="$(IntDir)" - HeaderFileName="$(InputName).h" - DLLDataFileName="" - InterfaceIdentifierFileName="$(InputName)_i.c" - ProxyFileName="$(InputName)_p.c" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions=" /Zm1000" - Optimization="2" - InlineFunctionExpansion="2" - AdditionalIncludeDirectories=".\inc;..\NewtonSDK\sdk;..\ogrenew\OgreMain\include;..\boost\include" - PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC" - ExceptionHandling="1" - RuntimeLibrary="2" - RuntimeTypeInfo="true" - AssemblerListingLocation="Release" - ObjectFile="$(IntDir)\" - ProgramDataBaseFileName="./Release/OgreNewt.pdb" - WarningLevel="3" - CompileAs="2" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="WIN32,_WINDOWS,NDEBUG,CMAKE_INTDIR=\"Release\",_OGRENEWT_EXPORTS" - AdditionalIncludeDirectories=".\inc;" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalOptions=" /STACK:10000000 /machine:I386" - AdditionalDependencies="$(NOINHERIT) kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib newton.lib OgreMain.lib" - OutputFile="./lib/OgreNewt.dll" - Version="2.0" - LinkIncremental="1" - AdditionalLibraryDirectories="../ogrenew/lib;../boost/lib;..\NewtonSDK\sdk\x32\dll_vs9" - GenerateManifest="true" - ProgramDatabaseFile="lib\OgreNewt.pdb" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - ImportLibrary="lib\OgreNewt.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - > - <File - RelativePath=".\src\OgreNewt_BasicJoints.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_Body.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_BodyInAABBIterator.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_Collision.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_CollisionPrimitives.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_CollisionSerializer.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_ContactCallback.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_ContactJoint.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_Debugger.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_Joint.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_MaterialID.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_MaterialPair.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_PlayerController.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_RayCast.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_Tools.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_Vehicle.cpp" - > - </File> - <File - RelativePath=".\src\OgreNewt_World.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - > - <File - RelativePath=".\inc\OgreNewt.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_BasicFrameListener.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_BasicJoints.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_Body.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_BodyInAABBIterator.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_Collision.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_CollisionPrimitives.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_CollisionSerializer.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_ContactCallback.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_ContactJoint.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_Debugger.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_Joint.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_MaterialID.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_MaterialPair.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_PlayerController.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_Prerequisites.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_RayCast.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_Tools.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_Vehicle.h" - > - </File> - <File - RelativePath=".\inc\OgreNewt_World.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> Property changes on: branches/ogrenewt/newton20/demos ___________________________________________________________________ Added: svn:ignore + obj Property changes on: branches/ogrenewt/newton20/demos/Demo01_TheBasics ___________________________________________________________________ Added: svn:ignore + *.user Added: branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj (rev 0) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj 2009-12-06 13:09:56 UTC (rev 2761) @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="Demo01_TheBasics" + ProjectGUID="{59D5ADD4-9669-468E-B687-F461BB7F4112}" + RootNamespace="Demo01_TheBasics" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreNewt_d.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreNewt.lib" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\demo01.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonApplication.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\OgreNewtonApplication.h" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: branches/ogrenewt/newton20/demos/Demo02_Joints ___________________________________________________________________ Added: svn:ignore + *.user Added: branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj (rev 0) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj 2009-12-06 13:09:56 UTC (rev 2761) @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="Demo02_Joints" + ProjectGUID="{5BAB7340-BEDB-408A-96B1-296785399531}" + RootNamespace="Demo02_Joints" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreNewt_d.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreNewt.lib" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\demo02.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonApplication.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\OgreNewtonApplication.h" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks ___________________________________________________________________ Added: svn:ignore + *.user Added: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj (rev 0) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj 2009-12-06 13:09:56 UTC (rev 2761) @@ -0,0 +1,231 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="Demo03_CollisionCallbacks" + ProjectGUID="{E575CBC2-5A60-45CC-B2F8-74E2719A8114}" + RootNamespace="Demo03_CollisionCallbacks" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreNewt_d.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreNewt.lib" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\ConveyorBelt.cpp" + > + </File> + <File + RelativePath=".\ConveyorMatCallback.cpp" + > + </File> + <File + RelativePath=".\demo03.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonApplication.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\ConveyorBelt.h" + > + </File> + <File + RelativePath=".\ConveyorMatCallback.h" + > + </File> + <File + RelativePath=".\OgreNewtonApplication.h" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: branches/ogrenewt/newton20/demos/Demo04_Raycasting ___________________________________________________________________ Added: svn:ignore + *.user Added: branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj (rev 0) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj 2009-12-06 13:09:56 UTC (rev 2761) @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="Demo04_Raycasting" + ProjectGUID="{8A31E25D-CC48-401E-9936-748453D06D3C}" + RootNamespace="Demo04_Raycasting" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreGUIRenderer_d.lib CEGUIBase_d.lib OgreNewt_d.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreGUIRenderer.lib CEGUIBase.lib OgreNewt.lib" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\demo04.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonApplication.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\OgreNewtonApplication.h" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy ___________________________________________________________________ Added: svn:ignore + *.user Added: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj (rev 0) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj 2009-12-06 13:09:56 UTC (rev 2761) @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="Demo06_SimpleBuoyancy" + ProjectGUID="{118B989E-1929-4173-99F5-B3C214879241}" + RootNamespace="Demo06_SimpleBuoyancy" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreGUIRenderer_d.lib CEGUIBase_d.lib OgreNewt_d.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreGUIRenderer.lib CEGUIBase.lib OgreNewt.lib" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\demo06.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonApplication.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\OgreNewtonApplication.h" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: branches/ogrenewt/newton20/demos/Demo07_CustomJoints ___________________________________________________________________ Added: svn:ignore + *.user Added: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj (rev 0) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj 2009-12-06 13:09:56 UTC (rev 2761) @@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="Demo07_CustomJoints" + ProjectGUID="{730565C2-A2C2-4D8B-89D4-ED062FD22B8C}" + RootNamespace="Demo07_CustomJoints" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + ... [truncated message content] |
From: <kal...@us...> - 2009-12-06 18:46:02
|
Revision: 2762 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2762&view=rev Author: kallaspriit Date: 2009-12-06 18:45:53 +0000 (Sun, 06 Dec 2009) Log Message: ----------- Got demo 8 - ragdoll example - to work and added it to the solution. Modified Paths: -------------- branches/ogrenewt/newton20/OgreNewt.sln branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj Added Paths: ----------- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj.kallaspriit.Priit Kallas.user branches/ogrenewt/newton20/demos/tinyxml/inc/ branches/ogrenewt/newton20/demos/tinyxml/inc/tinystr.h branches/ogrenewt/newton20/demos/tinyxml/inc/tinyxml.h branches/ogrenewt/newton20/demos/tinyxml/lib/ branches/ogrenewt/newton20/demos/tinyxml/lib/tinyxml_STL.lib branches/ogrenewt/newton20/demos/tinyxml/lib/tinyxmld_STL.lib Removed Paths: ------------- branches/ogrenewt/newton20/demos/tinyxml/tinystr.cpp branches/ogrenewt/newton20/demos/tinyxml/tinystr.h branches/ogrenewt/newton20/demos/tinyxml/tinyxml.cpp branches/ogrenewt/newton20/demos/tinyxml/tinyxml.h branches/ogrenewt/newton20/demos/tinyxml/tinyxmlerror.cpp branches/ogrenewt/newton20/demos/tinyxml/tinyxmlparser.cpp Property Changed: ---------------- branches/ogrenewt/newton20/demos/bin/Debug/ Modified: branches/ogrenewt/newton20/OgreNewt.sln =================================================================== --- branches/ogrenewt/newton20/OgreNewt.sln 2009-12-06 13:09:56 UTC (rev 2761) +++ branches/ogrenewt/newton20/OgreNewt.sln 2009-12-06 18:45:53 UTC (rev 2762) @@ -37,6 +37,11 @@ {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo08_RagdollExample", "demos\Demo08_RagdollExample\Demo08_RagdollExample.vcproj", "{9559CC7B-8F04-47BC-9A66-97084B4F1CC6}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -75,6 +80,10 @@ {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Debug|Win32.Build.0 = Debug|Win32 {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|Win32.ActiveCfg = Release|Win32 {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|Win32.Build.0 = Release|Win32 + {9559CC7B-8F04-47BC-9A66-97084B4F1CC6}.Debug|Win32.ActiveCfg = Debug|Win32 + {9559CC7B-8F04-47BC-9A66-97084B4F1CC6}.Debug|Win32.Build.0 = Debug|Win32 + {9559CC7B-8F04-47BC-9A66-97084B4F1CC6}.Release|Win32.ActiveCfg = Release|Win32 + {9559CC7B-8F04-47BC-9A66-97084B4F1CC6}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj 2009-12-06 13:09:56 UTC (rev 2761) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj 2009-12-06 18:45:53 UTC (rev 2762) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml;." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml\inc;." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,8 +117,8 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";"$(ProjectDir)\tinyxml";." - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;TIXML_USE_STL" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml\inc;." + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" @@ -136,10 +136,10 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreGUIRenderer.lib CEGUIBase.lib OgreNewt.lib" + AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreGUIRenderer.lib CEGUIBase.lib OgreNewt.lib tinyxml_STL.lib odbc32.lib odbccp32.lib" LinkIncremental="1" - AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" - IgnoreDefaultLibraryNames="MSVCRT;LIBCMT" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9";..\tinyxml\lib" + IgnoreDefaultLibraryNames="" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" @@ -193,26 +193,6 @@ RelativePath=".\Ragdoll.cpp" > </File> - <Filter - Name="tinyxml" - > - <File - RelativePath=".\tinyxml\tinystr.cpp" - > - </File> - <File - RelativePath=".\tinyxml\tinyxml.cpp" - > - </File> - <File - RelativePath=".\tinyxml\tinyxmlerror.cpp" - > - </File> - <File - RelativePath=".\tinyxml\tinyxmlparser.cpp" - > - </File> - </Filter> </Filter> <Filter Name="Header Files" @@ -231,18 +211,6 @@ RelativePath=".\Ragdoll.h" > </File> - <Filter - Name="tinyxml" - > - <File - RelativePath=".\tinyxml\tinystr.h" - > - </File> - <File - RelativePath=".\tinyxml\tinyxml.h" - > - </File> - </Filter> </Filter> <Filter Name="Resource Files" Added: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj.kallaspriit.Priit Kallas.user =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj.kallaspriit.Priit Kallas.user (rev 0) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj.kallaspriit.Priit Kallas.user 2009-12-06 18:45:53 UTC (rev 2762) @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioUserFile + ProjectType="Visual C++" + Version="9,00" + ShowAllFiles="false" + > + <Configurations> + <Configuration + Name="Debug|Win32" + > + <DebugSettings + Command="$(TargetPath)" + WorkingDirectory="" + CommandArguments="" + Attach="false" + DebuggerType="3" + Remote="1" + RemoteMachine="KALLASPRIIT" + RemoteCommand="" + HttpUrl="" + PDBPath="" + SQLDebugging="" + Environment="" + EnvironmentMerge="true" + DebuggerFlavor="" + MPIRunCommand="" + MPIRunArguments="" + MPIRunWorkingDirectory="" + ApplicationCommand="" + ApplicationArguments="" + ShimCommand="" + MPIAcceptMode="" + MPIAcceptFilter="" + /> + </Configuration> + <Configuration + Name="Release|Win32" + > + <DebugSettings + Command="$(TargetPath)" + WorkingDirectory="" + CommandArguments="" + Attach="false" + DebuggerType="3" + Remote="1" + RemoteMachine="KALLASPRIIT" + RemoteCommand="" + HttpUrl="" + PDBPath="" + SQLDebugging="" + Environment="" + EnvironmentMerge="true" + DebuggerFlavor="" + MPIRunCommand="" + MPIRunArguments="" + MPIRunWorkingDirectory="" + ApplicationCommand="" + ApplicationArguments="" + ShimCommand="" + MPIAcceptMode="" + MPIAcceptFilter="" + /> + </Configuration> + </Configurations> +</VisualStudioUserFile> Property changes on: branches/ogrenewt/newton20/demos/bin/Debug ___________________________________________________________________ Added: svn:ignore + *.dll *.exe *.ilk *.pdb Added: branches/ogrenewt/newton20/demos/tinyxml/inc/tinystr.h =================================================================== --- branches/ogrenewt/newton20/demos/tinyxml/inc/tinystr.h (rev 0) +++ branches/ogrenewt/newton20/demos/tinyxml/inc/tinystr.h 2009-12-06 18:45:53 UTC (rev 2762) @@ -0,0 +1,319 @@ +/* +www.sourceforge.net/projects/tinyxml +Original file by Yves Berquin. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +/* + * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005. + * + * - completely rewritten. compact, clean, and fast implementation. + * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems) + * - fixed reserve() to work as per specification. + * - fixed buggy compares operator==(), operator<(), and operator>() + * - fixed operator+=() to take a const ref argument, following spec. + * - added "copy" constructor with length, and most compare operators. + * - added swap(), clear(), size(), capacity(), operator+(). + */ + +#ifndef TIXML_USE_STL + +#ifndef TIXML_STRING_INCLUDED +#define TIXML_STRING_INCLUDED + +#include <assert.h> +#include <string.h> + +/* The support for explicit isn't that universal, and it isn't really + required - it is used to check that the TiXmlString class isn't incorrectly + used. Be nice to old compilers and macro it here: +*/ +#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + #define TIXML_EXPLICIT explicit +#elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + #define TIXML_EXPLICIT explicit +#else + #define TIXML_EXPLICIT +#endif + + +/* + TiXmlString is an emulation of a subset of the std::string template. + Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. + Only the member functions relevant to the TinyXML project have been implemented. + The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase + a string and there's no more room, we allocate a buffer twice as big as we need. +*/ +class TiXmlString +{ + public : + // The size type used + typedef size_t size_type; + + // Error value for find primitive + static const size_type npos; // = -1; + + + // TiXmlString empty constructor + TiXmlString () : rep_(&nullrep_) + { + } + + // TiXmlString copy constructor + TiXmlString ( const TiXmlString & copy) : rep_(0) + { + init(copy.length()); + memcpy(start(), copy.data(), length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) + { + init( static_cast<size_type>( strlen(copy) )); + memcpy(start(), copy, length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) + { + init(len); + memcpy(start(), str, len); + } + + // TiXmlString destructor + ~TiXmlString () + { + quit(); + } + + // = operator + TiXmlString& operator = (const char * copy) + { + return assign( copy, (size_type)strlen(copy)); + } + + // = operator + TiXmlString& operator = (const TiXmlString & copy) + { + return assign(copy.start(), copy.length()); + } + + + // += operator. Maps to append + TiXmlString& operator += (const char * suffix) + { + return append(suffix, static_cast<size_type>( strlen(suffix) )); + } + + // += operator. Maps to append + TiXmlString& operator += (char single) + { + return append(&single, 1); + } + + // += operator. Maps to append + TiXmlString& operator += (const TiXmlString & suffix) + { + return append(suffix.data(), suffix.length()); + } + + + // Convert a TiXmlString into a null-terminated char * + const char * c_str () const { return rep_->str; } + + // Convert a TiXmlString into a char * (need not be null terminated). + const char * data () const { return rep_->str; } + + // Return the length of a TiXmlString + size_type length () const { return rep_->size; } + + // Alias for length() + size_type size () const { return rep_->size; } + + // Checks if a TiXmlString is empty + bool empty () const { return rep_->size == 0; } + + // Return capacity of string + size_type capacity () const { return rep_->capacity; } + + + // single char extraction + const char& at (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // [] operator + char& operator [] (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // find a char in a string. Return TiXmlString::npos if not found + size_type find (char lookup) const + { + return find(lookup, 0); + } + + // find a char in a string from an offset. Return TiXmlString::npos if not found + size_type find (char tofind, size_type offset) const + { + if (offset >= length()) return npos; + + for (const char* p = c_str() + offset; *p != '\0'; ++p) + { + if (*p == tofind) return static_cast< size_type >( p - c_str() ); + } + return npos; + } + + void clear () + { + //Lee: + //The original was just too strange, though correct: + // TiXmlString().swap(*this); + //Instead use the quit & re-init: + quit(); + init(0,0); + } + + /* Function to reserve a big amount of data when we know we'll need it. Be aware that this + function DOES NOT clear the content of the TiXmlString if any exists. + */ + void reserve (size_type cap); + + TiXmlString& assign (const char* str, size_type len); + + TiXmlString& append (const char* str, size_type len); + + void swap (TiXmlString& other) + { + Rep* r = rep_; + rep_ = other.rep_; + other.rep_ = r; + } + + private: + + void init(size_type sz) { init(sz, sz); } + void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } + char* start() const { return rep_->str; } + char* finish() const { return rep_->str + rep_->size; } + + struct Rep + { + size_type size, capacity; + char str[1]; + }; + + void init(size_type sz, size_type cap) + { + if (cap) + { + // Lee: the original form: + // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap)); + // doesn't work in some cases of new being overloaded. Switching + // to the normal allocation, although use an 'int' for systems + // that are overly picky about structure alignment. + const size_type bytesNeeded = sizeof(Rep) + cap; + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); + rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); + + rep_->str[ rep_->size = sz ] = '\0'; + rep_->capacity = cap; + } + else + { + rep_ = &nullrep_; + } + } + + void quit() + { + if (rep_ != &nullrep_) + { + // The rep_ is really an array of ints. (see the allocator, above). + // Cast it back before delete, so the compiler won't incorrectly call destructors. + delete [] ( reinterpret_cast<int*>( rep_ ) ); + } + } + + Rep * rep_; + static Rep nullrep_; + +} ; + + +inline bool operator == (const TiXmlString & a, const TiXmlString & b) +{ + return ( a.length() == b.length() ) // optimization on some platforms + && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare +} +inline bool operator < (const TiXmlString & a, const TiXmlString & b) +{ + return strcmp(a.c_str(), b.c_str()) < 0; +} + +inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } +inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } +inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } +inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } + +inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } +inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } +inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } +inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } + +TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); +TiXmlString operator + (const TiXmlString & a, const char* b); +TiXmlString operator + (const char* a, const TiXmlString & b); + + +/* + TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. + Only the operators that we need for TinyXML have been developped. +*/ +class TiXmlOutStream : public TiXmlString +{ +public : + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const TiXmlString & in) + { + *this += in; + return *this; + } + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const char * in) + { + *this += in; + return *this; + } + +} ; + +#endif // TIXML_STRING_INCLUDED +#endif // TIXML_USE_STL Added: branches/ogrenewt/newton20/demos/tinyxml/inc/tinyxml.h =================================================================== --- branches/ogrenewt/newton20/demos/tinyxml/inc/tinyxml.h (rev 0) +++ branches/ogrenewt/newton20/demos/tinyxml/inc/tinyxml.h 2009-12-06 18:45:53 UTC (rev 2762) @@ -0,0 +1,1802 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#ifndef TINYXML_INCLUDED +#define TINYXML_INCLUDED + +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4530 ) +#pragma warning( disable : 4786 ) +#endif + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +// Help out windows: +#if defined( _DEBUG ) && !defined( DEBUG ) +#define DEBUG +#endif + +#ifdef TIXML_USE_STL + #include <string> + #include <iostream> + #include <sstream> + #define TIXML_STRING std::string +#else + #include "tinystr.h" + #define TIXML_STRING TiXmlString +#endif + +// Deprecated library function hell. Compilers want to use the +// new safe versions. This probably doesn't fully address the problem, +// but it gets closer. There are too many compilers for me to fully +// test. If you get compilation troubles, undefine TIXML_SAFE +#define TIXML_SAFE + +#ifdef TIXML_SAFE + #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + // Microsoft visual studio, version 2005 and higher. + #define TIXML_SNPRINTF _snprintf_s + #define TIXML_SNSCANF _snscanf_s + #define TIXML_SSCANF sscanf_s + #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + //#pragma message( "Using _sn* functions." ) + #define TIXML_SNPRINTF _snprintf + #define TIXML_SNSCANF _snscanf + #define TIXML_SSCANF sscanf + #elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + //#warning( "Using sn* functions." ) + #define TIXML_SNPRINTF snprintf + #define TIXML_SNSCANF snscanf + #define TIXML_SSCANF sscanf + #else + #define TIXML_SSCANF sscanf + #endif +#endif + +class TiXmlDocument; +class TiXmlElement; +class TiXmlComment; +class TiXmlUnknown; +class TiXmlAttribute; +class TiXmlText; +class TiXmlDeclaration; +class TiXmlParsingData; + +const int TIXML_MAJOR_VERSION = 2; +const int TIXML_MINOR_VERSION = 5; +const int TIXML_PATCH_VERSION = 3; + +/* Internal structure for tracking location of items + in the XML file. +*/ +struct TiXmlCursor +{ + TiXmlCursor() { Clear(); } + void Clear() { row = col = -1; } + + int row; // 0 based. + int col; // 0 based. +}; + + +/** + If you call the Accept() method, it requires being passed a TiXmlVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves + are simple called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, <b>no children of this node or its sibilings</b> will be Visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. + + You should never change the document from a callback. + + @sa TiXmlNode::Accept() +*/ +class TiXmlVisitor +{ +public: + virtual ~TiXmlVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } + /// Visit a document. + virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } + + /// Visit an element. + virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } + /// Visit an element. + virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } + + /// Visit a declaration + virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } + /// Visit a text node + virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } + /// Visit a comment node + virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } + /// Visit an unknow node + virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } +}; + +// Only used by Attribute::Query functions +enum +{ + TIXML_SUCCESS, + TIXML_NO_ATTRIBUTE, + TIXML_WRONG_TYPE +}; + + +// Used by the parsing routines. +enum TiXmlEncoding +{ + TIXML_ENCODING_UNKNOWN, + TIXML_ENCODING_UTF8, + TIXML_ENCODING_LEGACY +}; + +const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; + +/** TiXmlBase is a base class for every class in TinyXml. + It does little except to establish that TinyXml classes + can be printed and provide some utility functions. + + In XML, the document and elements can contain + other elements and other types of nodes. + + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) + + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) + + A Decleration contains: Attributes (not on tree) + @endverbatim +*/ +class TiXmlBase +{ + friend class TiXmlNode; + friend class TiXmlElement; + friend class TiXmlDocument; + +public: + TiXmlBase() : userData(0) {} + virtual ~TiXmlBase() {} + + /** All TinyXml classes can print themselves to a filestream + or the string class (TiXmlString in non-STL mode, std::string + in STL mode.) Either or both cfile and str can be null. + + This is a formatted print, and will insert + tabs and newlines. + + (For an unformatted stream, use the << operator.) + */ + virtual void Print( FILE* cfile, int depth ) const = 0; + + /** The world does not agree on whether white space should be kept or + not. In order to make everyone happy, these global, static functions + are provided to set whether or not TinyXml will condense all white space + into a single space or not. The default is to condense. Note changing this + value is not thread safe. + */ + static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } + + /// Return the current white space setting. + static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } + + /** Return the position, in the original source file, of this node or attribute. + The row and column are 1-based. (That is the first row and first column is + 1,1). If the returns values are 0 or less, then the parser does not have + a row and column value. + + Generally, the row and column value will be set when the TiXmlDocument::Load(), + TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set + when the DOM was created from operator>>. + + The values reflect the initial load. Once the DOM is modified programmatically + (by adding or changing nodes and attributes) the new values will NOT update to + reflect changes in the document. + + There is a minor performance cost to computing the row and column. Computation + can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. + + @sa TiXmlDocument::SetTabSize() + */ + int Row() const { return location.row + 1; } + int Column() const { return location.col + 1; } ///< See Row() + + void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. + void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. + const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. + + // Table that returs, for a given lead byte, the total number of bytes + // in the UTF-8 sequence. + static const int utf8ByteTable[256]; + + virtual const char* Parse( const char* p, + TiXmlParsingData* data, + TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; + + /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, + or they will be transformed into entities! + */ + static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); + + enum + { + TIXML_NO_ERROR = 0, + TIXML_ERROR, + TIXML_ERROR_OPENING_FILE, + TIXML_ERROR_OUT_OF_MEMORY, + TIXML_ERROR_PARSING_ELEMENT, + TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, + TIXML_ERROR_READING_ELEMENT_VALUE, + TIXML_ERROR_READING_ATTRIBUTES, + TIXML_ERROR_PARSING_EMPTY, + TIXML_ERROR_READING_END_TAG, + TIXML_ERROR_PARSING_UNKNOWN, + TIXML_ERROR_PARSING_COMMENT, + TIXML_ERROR_PARSING_DECLARATION, + TIXML_ERROR_DOCUMENT_EMPTY, + TIXML_ERROR_EMBEDDED_NULL, + TIXML_ERROR_PARSING_CDATA, + TIXML_ERROR_DOCUMENT_TOP_ONLY, + + TIXML_ERROR_STRING_COUNT + }; + +protected: + + static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + } + inline static bool IsWhiteSpace( int c ) + { + if ( c < 256 ) + return IsWhiteSpace( (char) c ); + return false; // Again, only truly correct for English/Latin...but usually works. + } + + #ifdef TIXML_USE_STL + static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); + static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); + #endif + + /* Reads an XML name into the string provided. Returns + a pointer just past the last character of the name, + or 0 if the function has an error. + */ + static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); + + /* Reads text. Returns a pointer past the given end tag. + Wickedly complex options, but it keeps the (sensitive) code in one place. + */ + static const char* ReadText( const char* in, // where to start + TIXML_STRING* text, // the string read + bool ignoreWhiteSpace, // whether to keep the white space + const char* endTag, // what ends this text + bool ignoreCase, // whether to ignore case in the end tag + TiXmlEncoding encoding ); // the current encoding + + // If an entity has been found, transform it into a character. + static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); + + // Get a character, while interpreting entities. + // The length can be from 0 to 4 bytes. + inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) + { + assert( p ); + if ( encoding == TIXML_ENCODING_UTF8 ) + { + *length = utf8ByteTable[ *((const unsigned char*)p) ]; + assert( *length >= 0 && *length < 5 ); + } + else + { + *length = 1; + } + + if ( *length == 1 ) + { + if ( *p == '&' ) + return GetEntity( p, _value, length, encoding ); + *_value = *p; + return p+1; + } + else if ( *length ) + { + //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), + // and the null terminator isn't needed + for( int i=0; p[i] && i<*length; ++i ) { + _value[i] = p[i]; + } + return p + (*length); + } + else + { + // Not valid text. + return 0; + } + } + + // Return true if the next characters in the stream are any of the endTag sequences. + // Ignore case only works for english, and should only be relied on when comparing + // to English words: StringEqual( p, "version", true ) is fine. + static bool StringEqual( const char* p, + const char* endTag, + bool ignoreCase, + TiXmlEncoding encoding ); + + static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; + + TiXmlCursor location; + + /// Field containing a generic user pointer + void* userData; + + // None of these methods are reliable for any language except English. + // Good for approximation, not great for accuracy. + static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); + static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); + inline static int ToLower( int v, TiXmlEncoding encoding ) + { + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( v < 128 ) return tolower( v ); + return v; + } + else + { + return tolower( v ); + } + } + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + +private: + TiXmlBase( const TiXmlBase& ); // not implemented. + void operator=( const TiXmlBase& base ); // not allowed. + + struct Entity + { + const char* str; + unsigned int strLength; + char chr; + }; + enum + { + NUM_ENTITY = 5, + MAX_ENTITY_LENGTH = 6 + + }; + static Entity entity[ NUM_ENTITY ]; + static bool condenseWhiteSpace; +}; + + +/** The parent class for everything in the Document Object Model. + (Except for attributes). + Nodes have siblings, a parent, and children. A node can be + in a document, or stand on its own. The type of a TiXmlNode + can be queried, and it can be cast to its more defined type. +*/ +class TiXmlNode : public TiXmlBase +{ + friend class TiXmlDocument; + friend class TiXmlElement; + +public: + #ifdef TIXML_USE_STL + + /** An input stream operator, for every class. Tolerant of newlines and + formatting, but doesn't expect them. + */ + friend std::istream& operator >> (std::istream& in, TiXmlNode& base); + + /** An output stream operator, for every class. Note that this outputs + without any newlines or formatting, as opposed to Print(), which + includes tabs and new lines. + + The operator<< and operator>> are not completely symmetric. Writing + a node to a stream is very well defined. You'll get a nice stream + of output, without any extra whitespace or newlines. + + But reading is not as well defined. (As it always is.) If you create + a TiXmlElement (for example) and read that from an input stream, + the text needs to define an element or junk will result. This is + true of all input streams, but it's worth keeping in mind. + + A TiXmlDocument will read nodes until it reads a root element, and + all the children of that root element. + */ + friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); + + /// Appends the XML node or attribute to a std::string. + friend std::string& operator<< (std::string& out, const TiXmlNode& base ); + + #endif + + /** The types of XML nodes supported by TinyXml. (All the + unsupported types are picked up by UNKNOWN.) + */ + enum NodeType + { + DOCUMENT, + ELEMENT, + COMMENT, + UNKNOWN, + TEXT, + DECLARATION, + TYPECOUNT + }; + + virtual ~TiXmlNode(); + + /** The meaning of 'value' changes for the specific type of + TiXmlNode. + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + + The subclasses will wrap this function. + */ + const char *Value() const { return value.c_str (); } + + #ifdef TIXML_USE_STL + /** Return Value() as a std::string. If you only use STL, + this is more efficient than calling Value(). + Only available in STL mode. + */ + const std::string& ValueStr() const { return value; } + #endif + + const TIXML_STRING& ValueTStr() const { return value; } + + /** Changes the value of the node. Defined as: + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + void SetValue(const char * _value) { value = _value;} + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Delete all the children of this node. Does not affect 'this'. + void Clear(); + + /// One step up the DOM. + TiXmlNode* Parent() { return parent; } + const TiXmlNode* Parent() const { return parent; } + + const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. + TiXmlNode* FirstChild() { return firstChild; } + const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. + /// The first child of this node with the matching 'value'. Will be null if none found. + TiXmlNode* FirstChild( const char * _value ) { + // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) + // call the method, cast the return back to non-const. + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); + } + const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. + TiXmlNode* LastChild() { return lastChild; } + + const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. + TiXmlNode* LastChild( const char * _value ) { + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. + #endif + + /** An alternate way to walk the children of a node. + One way to iterate over nodes is: + @verbatim + for( child = parent->FirstChild(); child; child = child->NextSibling() ) + @endverbatim + + IterateChildren does the same thing with the syntax: + @verbatim + child = 0; + while( child = parent->IterateChildren( child ) ) + @endverbatim + + IterateChildren takes the previous child as input and finds + the next one. If the previous child is null, it returns the + first. IterateChildren will return null when done. + */ + const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); + } + + /// This flavor of IterateChildren searches for children with a particular 'value' + const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + #endif + + /** Add a new node related to this. Adds a child past the LastChild. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); + + + /** Add a new node related to this. Adds a child past the LastChild. + + NOTE: the node to be added is passed by pointer, and will be + henceforth owned (and deleted) by tinyXml. This method is efficient + and avoids an extra copy, but should be used with care as it + uses a different memory model than the other insert functions. + + @sa InsertEndChild + */ + TiXmlNode* LinkEndChild( TiXmlNode* addThis ); + + /** Add a new node related to this. Adds a child before the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); + + /** Add a new node related to this. Adds a child after the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); + + /** Replace a child of this node. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); + + /// Delete a child of this node. + bool RemoveChild( TiXmlNode* removeThis ); + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling() const { return prev; } + TiXmlNode* PreviousSibling() { return prev; } + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling( const char * ) const; + TiXmlNode* PreviousSibling( const char *_prev ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Navigate to a sibling node. + const TiXmlNode* NextSibling() const { return next; } + TiXmlNode* NextSibling() { return next; } + + /// Navigate to a sibling node with the given 'value'. + const TiXmlNode* NextSibling( const char * ) const; + TiXmlNode* NextSibling( const char* _next ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement() const; + TiXmlElement* NextSiblingElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement( const char * ) const; + TiXmlElement* NextSiblingElement( const char *_next ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement() const; + TiXmlElement* FirstChildElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); + } + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement( const char * _value ) const; + TiXmlElement* FirstChildElement( const char * _value ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /** Query the type (as an enumerated value, above) of this node. + The possible types are: DOCUMENT, ELEMENT, COMMENT, + UNKNOWN, TEXT, and DECLARATION. + */ + int Type() const { return type; } + + /** Return a pointer to the Document this node lives in. + Returns null if not in a document. + */ + const TiXmlDocument* GetDocument() const; + TiXmlDocument* GetDocument() { + return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); + } + + /// Returns true if this node has no children. + bool NoChildren() const { return !firstChild; } + + virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + /** Create an exact duplicate of this node and return it. The memory must be deleted + by the caller. + */ + virtual TiXmlNode* Clone() const = 0; + + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. + + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( TiXmlVisitor* visitor ) const = 0; + +protected: + TiXmlNode( NodeType _type ); + + // Copy to the allocated object. Shared functionality between Clone, Copy constructor, + // and the assignment operator. + void CopyTo( TiXmlNode* target ) const; + + #ifdef TIXML_USE_STL + // The real work of the input operator. + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; + #endif + + // Figure out what is at *p, and parse it. Returns null if it is not an xml node. + TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); + + TiXmlNode* parent; + NodeType type; + + TiXmlNode* firstChild; + TiXmlNode* lastChild; + + TIXML_STRING value; + + TiXmlNode* prev; + TiXmlNode* next; + +private: + TiXmlNode( const TiXmlNode& ); // not implemented. + void operator=( const TiXmlNode& base ); // not allowed. +}; + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not TiXmlNodes, since they are not + part of the tinyXML document object model. There are other + suggested ways to look at this problem. +*/ +class TiXmlAttribute : public TiXmlBase +{ + friend class TiXmlAttributeSet; + +public: + /// Construct an empty attribute. + TiXmlAttribute() : TiXmlBase() + { + document = 0; + prev = next = 0; + } + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlAttribute( const std::string& _name, const std::string& _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + #endif + + /// Construct an attribute with a name and value. + TiXmlAttribute( const char * _name, const char * _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + + const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. + const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. + #ifdef TIXML_USE_STL + const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. + #endif + int IntValue() const; ///< Return the value of this attribute, converted to an integer. + double DoubleValue() const; ///< Return the value of this attribute, converted to a double. + + // Get the tinyxml string representation + const TIXML_STRING& NameTStr() const { return name; } + + /** QueryIntValue examines the value string. It is an alternative to the + IntValue() method with richer error checking. + If the value is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. + + A specialized but useful call. Note that for success it returns 0, + which is the opposite of almost all other TinyXml calls. + */ + int QueryIntValue( int* _value ) const; + /// QueryDoubleValue examines the value string. See QueryIntValue(). + int QueryDoubleValue( double* _value ) const; + + void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. + void SetValue( const char* _value ) { value = _value; } ///< Set the value. + + void SetIntValue( int _value ); ///< Set the value from an integer. + void SetDoubleValue( double _value ); ///< Set the value from a double. + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetName( const std::string& _name ) { name = _name; } + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Get the next sibling attribute in the DOM. Returns null at end. + const TiXmlAttribute* Next() const; + TiXmlAttribute* Next() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + } + + /// Get the previous sibling attribute in the DOM. Returns null at beginning. + const TiXmlAttribute* Previous() const; + TiXmlAttribute* Previous() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + } + + bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } + bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } + bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + + /* Attribute parsing starts: first letter of the name + returns: the next char after the value end quote + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + // Prints this Attribute to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } + void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + + // [internal use] + // Set the document pointer so the attribute can report errors. + void SetDocument( TiXmlDocument* doc ) { document = doc; } + +private: + TiXmlAttribute( const TiXmlAttribute& ); // not implemented. + void operator=( const TiXmlAttribute& base ); // not allowed. + + TiXmlDocument* document; // A pointer back to a document, for error reporting. + TIXML_STRING name; + TIXML_STRING value; + TiXmlAttribute* prev; + TiXmlAttribute* next; +}; + + +/* A class used to manage a group of attributes. + It is only used internally, both by the ELEMENT and the DECLARATION. + + The set can be changed transparent to the Element and Declaration + classes that use it, but NOT transparent to the Attribute + which has to implement a next() and previous() method. Which makes + it a bit problematic and prevents the use of STL. + + This version is implemented with circular lists because: + - I like circular lists + - it demonstrates some independence from the (typical) doubly linked list. +*/ +class TiXmlAttributeSet +{ +public: + TiXmlAttributeSet(); + ~TiXmlAttributeSet(); + + void Add( TiXmlAttribute* attribute ); + void Remove( TiXmlAttribute* attribute ); + + const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + + const TiXmlAttribute* Find( const char* _name ) const; + TiXmlAttribute* Find( const char* _name ) { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) ); + } + #ifdef TIXML_USE_STL + const TiXmlAttribute* Find( const std::string& _name ) const; + TiXmlAttribute* Find( const std::string& _name ) { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) ); + } + + #endif + +private: + //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), + //*ME: this class must be also use a hidden/disabled copy-constructor !!! + TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed + void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) + + TiXmlAttribute sentinel; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class TiXmlElement : public TiXmlNode +{ +public: + /// Construct an element. + TiXmlElement (const char * in_value); + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlElement( const std::string& _value ); + #endif + + TiXmlElement( const TiXmlElement& ); + + void operator=( const TiXmlElement& base ); + + virtual ~TiXmlElement(); + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + */ + const char* Attribute( const char* name ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an integer, + the integer value will be put in the return 'i', if 'i' + is non-null. + */ + const char* Attribute( const char* name, int* i ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an double, + the double value will be put in the return 'd', if 'd' + is non-null. + */ + const char* Attribute( const char* name, double* d ) const; + + /** QueryIntAttribute examines the attribute - it is an alternative to the + Attribute() method with richer error checking. + If the attribute is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. If the attribute + does not exist, then TIXML_NO_ATTRIBUTE is returned. + */ + int QueryIntAttribute( const char* name, int* _value ) const; + /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). + int QueryDoubleAttribute( const char* name, double* _value ) const; + /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). + int QueryFloatAttribute( const char* name, float* _value ) const { + double d; + int result = QueryDoubleAttribute( name, &d ); + if ( result == TIXML_SUCCESS ) { + *_value = (float)d; + } + return result; + } + + #ifdef TIXML_USE_STL + /** Template form of the attribute query which will try to read the + attribute into the specified type. Very easy, very powerful, but + be careful to make sure to call this with the correct type. + + NOTE: This method doesn't work correctly for 'string' types. + + @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE + */ + template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + + std::stringstream sstream( node->ValueStr() ); + sstream >> *outValue; + if ( !sstream.fail() ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; + } + /* + This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string" + but template specialization is hard to get working cross-compiler. Leaving the bug for now. + + // The above will fail for std::string because the space character is used as a seperator. + // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string + template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + *outValue = node->ValueStr(); + return TIXML_SUCCESS; + } + */ + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, const char * _value ); + + #ifdef TIXML_USE_STL + const std::string* Attribute( const std::string& name ) const; + const std::string* Attribute( const std::string& name, int* i ) const; + const std::string* Attribute( const std::string& name, double* d ) const; + int QueryIntAttribute( const std::string& name, int* _value ) const; + int QueryDoubleAttribute( const std::string& name, double* _value ) const; + + /// STL std::string form. + void SetAttribute( const std::string& name, const std::string& _value ); + ///< STL std::string form. + void SetAttribute( const std::string& name, int _value ); + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char * name, int value ); + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetDoubleAttribute( const char * name, double value ); + + /** Deletes an attribute with the given name. + */ + void RemoveAttribute( const char * name ); + #ifdef TIXML_USE_STL + void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. + #endif + + const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. + TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } + const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. + TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the TiXmlText child + and accessing it directly. + + If the first child of 'this' is a TiXmlText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + <foo>This is text</foo> + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + <foo><b>This is text</b></foo> + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + <foo>This is <b>text</b></foo> + @endverbatim + GetText() will return "This is ". + + WARNING: GetText() accesses a child node - don't become confused with the + similarly named TiXmlHandle::Te... [truncated message content] |
From: <kal...@us...> - 2009-12-09 23:35:39
|
Revision: 2765 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2765&view=rev Author: kallaspriit Date: 2009-12-09 23:35:24 +0000 (Wed, 09 Dec 2009) Log Message: ----------- Updated project files to work with both self-compiled and pre-built Ogre 1.6.4 SDK. Modified Paths: -------------- branches/ogrenewt/newton20/OgreNewt.vcproj branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj branches/ogrenewt/newton20/demos/Demo09_PlayerController/Demo09_PlayerController.vcproj Added Paths: ----------- branches/ogrenewt/newton20/OgreNewt.suo Property Changed: ---------------- branches/ogrenewt/newton20/ Property changes on: branches/ogrenewt/newton20 ___________________________________________________________________ Modified: svn:ignore - *.ncb *.suo *.user lib obj + *.ncb *.user lib obj Added: branches/ogrenewt/newton20/OgreNewt.suo =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/OgreNewt.suo ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogrenewt/newton20/OgreNewt.vcproj =================================================================== --- branches/ogrenewt/newton20/OgreNewt.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/OgreNewt.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -53,7 +53,7 @@ <Tool Name="VCCLCompilerTool" AdditionalOptions=" /Zm1000 -O0 -g3 -fno-inline" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(OGRE_HOME)\include";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC;WIN32" ExceptionHandling="1" RuntimeLibrary="3" @@ -109,7 +109,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="copy $(OutDir)\OgreNewt_d.dll demos\bin\Debug\OgreNewt_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll demos\bin\Debug\OgreMain_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll demos\bin\Debug\OIS_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll demos\bin\Debug\Plugin_CgProgramManager_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll demos\bin\Debug\RenderSystem_Direct3D9_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll demos\bin\Debug\RenderSystem_GL_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\OgreGUIRenderer_d.dll demos\bin\Debug\OgreGUIRenderer_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIBase_d.dll demos\bin\Debug\CEGUIBase_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIExpatParser_d.dll demos\bin\Debug\CEGUIExpatParser_d.dll
copy $(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll demos\bin\Debug\cg.dll
copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Debug\newton.dll
" + CommandLine="copy $(OutDir)\OgreNewt_d.dll demos\bin\Debug\OgreNewt_d.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" "demos\bin\Debug\OgreMain_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" "demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" "demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" "demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" "demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreGUIRenderer_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreGUIRenderer_d.dll" "demos\bin\Debug\OgreGUIRenderer_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIBase_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIBase_d.dll" "demos\bin\Debug\CEGUIBase_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIExpatParser_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIExpatParser_d.dll" "demos\bin\Debug\CEGUIExpatParser_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" "demos\bin\Debug\cg.dll"

if exist "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" "demos\bin\Debug\OgreMain_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OIS_d.dll" copy "$(OGRE_HOME)\bin\debug\OIS_d.dll" demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OgreGUIRenderer_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreGUIRenderer_d.dll" demos\bin\Debug\OgreGUIRenderer_d.dll"
if exist "$(OGRE_HOME)\bin\debug\CEGUIBase_d.dll" copy "$(OGRE_HOME)\bin\debug\CEGUIBase_d.dll" demos\bin\Debug\CEGUIBase_d.dll"
if exist "$(OGRE_HOME)\bin\debug\CEGUIExpatParser_d.dll" copy "$(OGRE_HOME)\bin\debug\CEGUIExpatParser_d.dll" demos\bin\Debug\CEGUIExpatParser_d.dll"
if exist "$(OGRE_HOME)\bin\debug\cg.dll" copy "$(OGRE_HOME)\bin\debug\cg.dll" demos\bin\Debug\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Debug\newton.dll
" /> </Configuration> <Configuration @@ -151,7 +151,7 @@ AdditionalOptions=" /Zm1000" Optimization="2" InlineFunctionExpansion="2" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(OGRE_HOME)\include";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC;WIN32" ExceptionHandling="1" RuntimeLibrary="2" @@ -207,7 +207,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="copy $(OutDir)\OgreNewt.dll demos\bin\Release\OgreNewt.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll demos\bin\Release\OgreMain.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll demos\bin\Release\OIS.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll demos\bin\Release\Plugin_CgProgramManager.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll demos\bin\Release\RenderSystem_Direct3D9.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll demos\bin\Release\RenderSystem_GL.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\OgreGUIRenderer.dll demos\bin\Release\OgreGUIRenderer.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\CEGUIBase.dll demos\bin\Release\CEGUIBase.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\CEGUIExpatParser.dll demos\bin\Release\CEGUIExpatParser.dll
copy $(OGRE_HOME)\Samples\Common\bin\Release\cg.dll demos\bin\Release\cg.dll
copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Release\newton.dll
" + CommandLine="copy $(OutDir)\OgreNewt.dll demos\bin\Release\OgreNewt.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" "demos\bin\Release\OgreMain.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" "demos\bin\Release\OIS.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" "demos\bin\Release\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" "demos\bin\Release\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" "demos\bin\Release\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreGUIRenderer.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreGUIRenderer.dll" "demos\bin\Release\OgreGUIRenderer.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIBase.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIBase.dll" "demos\bin\Release\CEGUIBase.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIExpatParser.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIExpatParser.dll" "demos\bin\Release\CEGUIExpatParser.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" "demos\bin\Release\cg.dll"

if exist "$(OGRE_HOME)\bin\release\OgreMain.dll" copy "$(OGRE_HOME)\bin\release\OgreMain.dll" "demos\bin\Release\OgreMain.dll"
if exist "$(OGRE_HOME)\bin\release\OIS.dll" copy "$(OGRE_HOME)\bin\release\OIS.dll" "demos\bin\Release\OIS.dll"
if exist "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" "demos\bin\Release\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" "demos\bin\Release\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" "demos\bin\Release\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\bin\release\OgreGUIRenderer.dll" copy "$(OGRE_HOME)\bin\release\OgreGUIRenderer.dll" "demos\bin\Release\OgreGUIRenderer.dll"
if exist "$(OGRE_HOME)\bin\release\CEGUIBase.dll" copy "$(OGRE_HOME)\bin\release\CEGUIBase.dll" "demos\bin\Release\CEGUIBase.dll"
if exist "$(OGRE_HOME)\bin\release\CEGUIExpatParser.dll" copy "$(OGRE_HOME)\bin\release\CEGUIExpatParser.dll" "demos\bin\Release\CEGUIExpatParser.dll"
if exist "$(OGRE_HOME)\bin\release\cg.dll" copy "$(OGRE_HOME)\bin\release\cg.dll" "demos\bin\Release\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Release\newton.dll
" /> </Configuration> </Configurations> Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" Modified: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" Modified: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml;." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml;." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml;." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml;." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" Modified: branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/demos/Demo08_RagdollExample/Demo08_RagdollExample.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml\inc;." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml\inc;." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml\inc;." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";..\tinyxml\inc;." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" Modified: branches/ogrenewt/newton20/demos/Demo09_PlayerController/Demo09_PlayerController.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/Demo09_PlayerController.vcproj 2009-12-06 19:23:44 UTC (rev 2764) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/Demo09_PlayerController.vcproj 2009-12-09 23:35:24 UTC (rev 2765) @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\include\OIS";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\CEGUI";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRENEWT_HOME)\inc";." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kal...@us...> - 2009-12-10 10:22:21
|
Revision: 2766 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2766&view=rev Author: kallaspriit Date: 2009-12-10 10:22:07 +0000 (Thu, 10 Dec 2009) Log Message: ----------- Updated to NGD 2.12, no real changes. Modified Paths: -------------- branches/ogrenewt/newton20/INSTALL.TXT branches/ogrenewt/newton20/OgreNewt.suo Modified: branches/ogrenewt/newton20/INSTALL.TXT =================================================================== --- branches/ogrenewt/newton20/INSTALL.TXT 2009-12-09 23:35:24 UTC (rev 2765) +++ branches/ogrenewt/newton20/INSTALL.TXT 2009-12-10 10:22:07 UTC (rev 2766) @@ -2,8 +2,8 @@ There is a solution for VS 2008. You also need: -- Ogre (tested with 1.6) - http://ogre3d.org -- Newton Game Dynamics (tested with 2.11) - http://www.newtondynamics.com/forum (see the beta thread for latest) +- Ogre (tested with 1.6.4) - http://ogre3d.org +- Newton Game Dynamics (tested with 2.12) - http://www.newtondynamics.com/forum (see the beta thread for latest) - Boost (tested with 1.40.0) - http://bost.org 1. On Windows: Modified: branches/ogrenewt/newton20/OgreNewt.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kal...@us...> - 2009-12-26 10:50:30
|
Revision: 2767 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2767&view=rev Author: kallaspriit Date: 2009-12-26 10:50:16 +0000 (Sat, 26 Dec 2009) Log Message: ----------- Changes by Julio Jerez - support for the NGD joint-library - player controller uses the joint-library - updated picking, now uses kinematic controller and convex cast for exact placement - many more smaller updates Modified Paths: -------------- branches/ogrenewt/newton20/OgreNewt.sln branches/ogrenewt/newton20/OgreNewt.suo branches/ogrenewt/newton20/OgreNewt.vcproj branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj branches/ogrenewt/newton20/demos/Demo01_TheBasics/demo01.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/Demo03_CollisionCallbacks.vcproj branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/Demo04_Raycasting.vcproj branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.h branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/Demo06_SimpleBuoyancy.vcproj branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj branches/ogrenewt/newton20/demos/Demo07_CustomJoints/MyCustomBallSocket.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/MyCustomBallSocket.h branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo09_PlayerController/Demo09_PlayerController.vcproj branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/bin/Debug/resources.cfg branches/ogrenewt/newton20/demos/bin/Release/resources.cfg branches/ogrenewt/newton20/demos/media/materials/scripts/example.material branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h branches/ogrenewt/newton20/inc/OgreNewt_BodyInAABBIterator.h branches/ogrenewt/newton20/inc/OgreNewt_Collision.h branches/ogrenewt/newton20/inc/OgreNewt_Joint.h branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h branches/ogrenewt/newton20/inc/OgreNewt_Tools.h branches/ogrenewt/newton20/inc/OgreNewt_World.h branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp branches/ogrenewt/newton20/src/OgreNewt_Body.cpp branches/ogrenewt/newton20/src/OgreNewt_BodyInAABBIterator.cpp branches/ogrenewt/newton20/src/OgreNewt_Collision.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionPrimitives.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionSerializer.cpp branches/ogrenewt/newton20/src/OgreNewt_ContactCallback.cpp branches/ogrenewt/newton20/src/OgreNewt_ContactJoint.cpp branches/ogrenewt/newton20/src/OgreNewt_Debugger.cpp branches/ogrenewt/newton20/src/OgreNewt_Joint.cpp branches/ogrenewt/newton20/src/OgreNewt_MaterialID.cpp branches/ogrenewt/newton20/src/OgreNewt_MaterialPair.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp branches/ogrenewt/newton20/src/OgreNewt_Tools.cpp branches/ogrenewt/newton20/src/OgreNewt_Vehicle.cpp branches/ogrenewt/newton20/src/OgreNewt_World.cpp Added Paths: ----------- branches/ogrenewt/newton20/demos/Demo01_TheBasics/Ogre.log branches/ogrenewt/newton20/demos/media/materials/textures/newtonLogo.tga branches/ogrenewt/newton20/demos/media/primitives/castle.material branches/ogrenewt/newton20/demos/media/primitives/castle.mesh branches/ogrenewt/newton20/demos/media/primitives/playground.material branches/ogrenewt/newton20/demos/media/primitives/playground.mesh branches/ogrenewt/newton20/demos/media/primitives/textures/ branches/ogrenewt/newton20/demos/media/primitives/textures/032-01a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/032-01b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/032-03a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/032-03b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/032-04c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/032-04d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/064-01b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/064-01c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/064-02b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/064-02c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/064-03b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/064-04b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/096-01c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/128-01a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/128-03a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/128-comb1.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/256-03a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/GrassAndDirt.tga branches/ogrenewt/newton20/demos/media/primitives/textures/block01a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block01b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block01c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block01d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block02a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block02b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block02c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block02d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block06a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/block06b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/brickwall.tga branches/ogrenewt/newton20/demos/media/primitives/textures/grate1a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/grate1a.tga branches/ogrenewt/newton20/demos/media/primitives/textures/jumppad1ab.TGA branches/ogrenewt/newton20/demos/media/primitives/textures/jumppad1ab.blend.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/jumppad1ab.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/jumppadsmall_b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_064-02b.blend.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_064-02b1.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_064-02w.blend.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_064-02w1.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_b064-01a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_b064-01b.blend.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_b064-01b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_b064-01c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_b064-01y.blend.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_v192-01b.blend.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/lig_v192-01ba.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/nnk05stone.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/npoolorange.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/nunuktelep.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/nunuktelep2.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/s128-02a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/s128-02b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/sand1b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/stone03a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/stone03c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/stone03d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/stone04a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/stone04d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/stone05a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-01a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-01c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-01d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-02a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-02b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-02c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-02d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-03b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v064-03e.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v096-01c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v128-01a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v128-02a.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v128-02b.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v128-02d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v128-03c.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/v128-04d.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/wood.tga branches/ogrenewt/newton20/demos/media/primitives/textures/zbatcula-logo.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/zbighouse-logo.jpg branches/ogrenewt/newton20/inc/OgreNewt_ConvexCast.h branches/ogrenewt/newton20/inc/OgreNewt_Stdafx.h branches/ogrenewt/newton20/src/OgreNewt_ConvexCast.cpp branches/ogrenewt/newton20/src/OgreNewt_Stdafx.cpp Modified: branches/ogrenewt/newton20/OgreNewt.sln =================================================================== --- branches/ogrenewt/newton20/OgreNewt.sln 2009-12-10 10:22:07 UTC (rev 2766) +++ branches/ogrenewt/newton20/OgreNewt.sln 2009-12-26 10:50:16 UTC (rev 2767) @@ -2,12 +2,12 @@ # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OgreNewt", "OgreNewt.vcproj", "{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo01_TheBasics", "demos\Demo01_TheBasics\Demo01_TheBasics.vcproj", "{59D5ADD4-9669-468E-B687-F461BB7F4112}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo02_Joints", "demos\Demo02_Joints\Demo02_Joints.vcproj", "{5BAB7340-BEDB-408A-96B1-296785399531}" ProjectSection(ProjectDependencies) = postProject {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo02_Joints", "demos\Demo02_Joints\Demo02_Joints.vcproj", "{5BAB7340-BEDB-408A-96B1-296785399531}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo01_TheBasics", "demos\Demo01_TheBasics\Demo01_TheBasics.vcproj", "{59D5ADD4-9669-468E-B687-F461BB7F4112}" ProjectSection(ProjectDependencies) = postProject {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} EndProjectSection @@ -37,53 +37,62 @@ {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo08_RagdollExample", "demos\Demo08_RagdollExample\Demo08_RagdollExample.vcproj", "{9559CC7B-8F04-47BC-9A66-97084B4F1CC6}" - ProjectSection(ProjectDependencies) = postProject - {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Debug|Win32.ActiveCfg = Debug|Win32 {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Debug|Win32.Build.0 = Debug|Win32 + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Debug|x64.ActiveCfg = Debug|Win32 {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|Win32.ActiveCfg = Release|Win32 {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|Win32.Build.0 = Release|Win32 + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|x64.ActiveCfg = Release|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Debug|Win32.ActiveCfg = Debug|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Debug|Win32.Build.0 = Debug|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Debug|x64.ActiveCfg = Debug|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Release|Win32.ActiveCfg = Release|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Release|Win32.Build.0 = Release|Win32 + {5BAB7340-BEDB-408A-96B1-296785399531}.Release|x64.ActiveCfg = Release|Win32 {59D5ADD4-9669-468E-B687-F461BB7F4112}.Debug|Win32.ActiveCfg = Debug|Win32 {59D5ADD4-9669-468E-B687-F461BB7F4112}.Debug|Win32.Build.0 = Debug|Win32 + {59D5ADD4-9669-468E-B687-F461BB7F4112}.Debug|x64.ActiveCfg = Debug|Win32 {59D5ADD4-9669-468E-B687-F461BB7F4112}.Release|Win32.ActiveCfg = Release|Win32 {59D5ADD4-9669-468E-B687-F461BB7F4112}.Release|Win32.Build.0 = Release|Win32 - {5BAB7340-BEDB-408A-96B1-296785399531}.Debug|Win32.ActiveCfg = Debug|Win32 - {5BAB7340-BEDB-408A-96B1-296785399531}.Debug|Win32.Build.0 = Debug|Win32 - {5BAB7340-BEDB-408A-96B1-296785399531}.Release|Win32.ActiveCfg = Release|Win32 - {5BAB7340-BEDB-408A-96B1-296785399531}.Release|Win32.Build.0 = Release|Win32 + {59D5ADD4-9669-468E-B687-F461BB7F4112}.Release|x64.ActiveCfg = Release|Win32 {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Debug|Win32.ActiveCfg = Debug|Win32 {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Debug|Win32.Build.0 = Debug|Win32 + {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Debug|x64.ActiveCfg = Debug|Win32 {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Release|Win32.ActiveCfg = Release|Win32 {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Release|Win32.Build.0 = Release|Win32 + {E575CBC2-5A60-45CC-B2F8-74E2719A8114}.Release|x64.ActiveCfg = Release|Win32 {8A31E25D-CC48-401E-9936-748453D06D3C}.Debug|Win32.ActiveCfg = Debug|Win32 {8A31E25D-CC48-401E-9936-748453D06D3C}.Debug|Win32.Build.0 = Debug|Win32 + {8A31E25D-CC48-401E-9936-748453D06D3C}.Debug|x64.ActiveCfg = Debug|Win32 {8A31E25D-CC48-401E-9936-748453D06D3C}.Release|Win32.ActiveCfg = Release|Win32 {8A31E25D-CC48-401E-9936-748453D06D3C}.Release|Win32.Build.0 = Release|Win32 + {8A31E25D-CC48-401E-9936-748453D06D3C}.Release|x64.ActiveCfg = Release|Win32 {118B989E-1929-4173-99F5-B3C214879241}.Debug|Win32.ActiveCfg = Debug|Win32 {118B989E-1929-4173-99F5-B3C214879241}.Debug|Win32.Build.0 = Debug|Win32 + {118B989E-1929-4173-99F5-B3C214879241}.Debug|x64.ActiveCfg = Debug|Win32 {118B989E-1929-4173-99F5-B3C214879241}.Release|Win32.ActiveCfg = Release|Win32 {118B989E-1929-4173-99F5-B3C214879241}.Release|Win32.Build.0 = Release|Win32 + {118B989E-1929-4173-99F5-B3C214879241}.Release|x64.ActiveCfg = Release|Win32 {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Debug|Win32.ActiveCfg = Debug|Win32 {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Debug|Win32.Build.0 = Debug|Win32 + {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Debug|x64.ActiveCfg = Debug|Win32 {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Release|Win32.ActiveCfg = Release|Win32 {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Release|Win32.Build.0 = Release|Win32 + {730565C2-A2C2-4D8B-89D4-ED062FD22B8C}.Release|x64.ActiveCfg = Release|Win32 {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Debug|Win32.ActiveCfg = Debug|Win32 {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Debug|Win32.Build.0 = Debug|Win32 + {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Debug|x64.ActiveCfg = Debug|Win32 {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|Win32.ActiveCfg = Release|Win32 {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|Win32.Build.0 = Release|Win32 - {9559CC7B-8F04-47BC-9A66-97084B4F1CC6}.Debug|Win32.ActiveCfg = Debug|Win32 - {9559CC7B-8F04-47BC-9A66-97084B4F1CC6}.Debug|Win32.Build.0 = Debug|Win32 - {9559CC7B-8F04-47BC-9A66-97084B4F1CC6}.Release|Win32.ActiveCfg = Release|Win32 - {9559CC7B-8F04-47BC-9A66-97084B4F1CC6}.Release|Win32.Build.0 = Release|Win32 + {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: branches/ogrenewt/newton20/OgreNewt.suo =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/OgreNewt.vcproj =================================================================== --- branches/ogrenewt/newton20/OgreNewt.vcproj 2009-12-10 10:22:07 UTC (rev 2766) +++ branches/ogrenewt/newton20/OgreNewt.vcproj 2009-12-26 10:50:16 UTC (rev 2767) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="9,00" + Version="9.00" Name="OgreNewt" ProjectGUID="{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" RootNamespace="OgreNewt" @@ -52,16 +52,18 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalOptions=" /Zm1000 -O0 -g3 -fno-inline" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(OGRE_HOME)\include";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(NEWTON_HOME)\sdk\dMath";"$(NEWTON_HOME)\sdk\dCustomJoints";"$(OGRE_HOME)\include";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC;WIN32" ExceptionHandling="1" RuntimeLibrary="3" RuntimeTypeInfo="true" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="OgreNewt_Stdafx.h" AssemblerListingLocation="Debug" ObjectFile="$(IntDir)\" ProgramDataBaseFileName=".\lib\OgreNewt_d.pdb" WarningLevel="3" + DebugInformationFormat="3" CompileAs="2" /> <Tool @@ -78,12 +80,13 @@ <Tool Name="VCLinkerTool" AdditionalOptions=" /STACK:10000000 /machine:I386 /debug" - AdditionalDependencies="$(NOINHERIT) kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib newton.lib OgreMain_d.lib" + AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib newton.lib dMath_d.lib JointLibrary_d.lib OgreMain_d.lib $(NOINHERIT)" OutputFile="./lib/OgreNewt_d.dll" Version="2.0" - LinkIncremental="2" - AdditionalLibraryDirectories=""$(OGRE_HOME)/lib";"$(BOOST_HOME)/libs";"$(NEWTON_HOME)/sdk/x32/dll_vs9"" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(OGRE_HOME)/lib";"$(BOOST_HOME)/libs";"$(NEWTON_HOME)/sdk/x32";"$(NEWTON_HOME)/sdk/x32/dll_vs9"" GenerateManifest="true" + GenerateDebugInformation="true" ProgramDatabaseFile=".\lib\OgreNewt_d.pdb" RandomizedBaseAddress="1" DataExecutionPrevention="0" @@ -109,7 +112,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="copy $(OutDir)\OgreNewt_d.dll demos\bin\Debug\OgreNewt_d.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" "demos\bin\Debug\OgreMain_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" "demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" "demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" "demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" "demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreGUIRenderer_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreGUIRenderer_d.dll" "demos\bin\Debug\OgreGUIRenderer_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIBase_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIBase_d.dll" "demos\bin\Debug\CEGUIBase_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIExpatParser_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIExpatParser_d.dll" "demos\bin\Debug\CEGUIExpatParser_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" "demos\bin\Debug\cg.dll"

if exist "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" "demos\bin\Debug\OgreMain_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OIS_d.dll" copy "$(OGRE_HOME)\bin\debug\OIS_d.dll" demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OgreGUIRenderer_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreGUIRenderer_d.dll" demos\bin\Debug\OgreGUIRenderer_d.dll"
if exist "$(OGRE_HOME)\bin\debug\CEGUIBase_d.dll" copy "$(OGRE_HOME)\bin\debug\CEGUIBase_d.dll" demos\bin\Debug\CEGUIBase_d.dll"
if exist "$(OGRE_HOME)\bin\debug\CEGUIExpatParser_d.dll" copy "$(OGRE_HOME)\bin\debug\CEGUIExpatParser_d.dll" demos\bin\Debug\CEGUIExpatParser_d.dll"
if exist "$(OGRE_HOME)\bin\debug\cg.dll" copy "$(OGRE_HOME)\bin\debug\cg.dll" demos\bin\Debug\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Debug\newton.dll
" + CommandLine="copy $(OutDir)\OgreNewt_d.dll demos\bin\Debug\OgreNewt_d.dll


if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" "demos\bin\Debug\OgreMain_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" "demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" "demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" "demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" "demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreGUIRenderer_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreGUIRenderer_d.dll" "demos\bin\Debug\OgreGUIRenderer_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIBase_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIBase_d.dll" "demos\bin\Debug\CEGUIBase_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIExpatParser_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\CEGUIExpatParser_d.dll" "demos\bin\Debug\CEGUIExpatParser_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" "demos\bin\Debug\cg.dll"

if exist "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" "demos\bin\Debug\OgreMain_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OIS_d.dll" copy "$(OGRE_HOME)\bin\debug\OIS_d.dll" demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OgreGUIRenderer_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreGUIRenderer_d.dll" demos\bin\Debug\OgreGUIRenderer_d.dll"
if exist "$(OGRE_HOME)\bin\debug\CEGUIBase_d.dll" copy "$(OGRE_HOME)\bin\debug\CEGUIBase_d.dll" demos\bin\Debug\CEGUIBase_d.dll"
if exist "$(OGRE_HOME)\bin\debug\CEGUIExpatParser_d.dll" copy "$(OGRE_HOME)\bin\debug\CEGUIExpatParser_d.dll" demos\bin\Debug\CEGUIExpatParser_d.dll"
if exist "$(OGRE_HOME)\bin\debug\cg.dll" copy "$(OGRE_HOME)\bin\debug\cg.dll" demos\bin\Debug\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Debug\newton.dll
copy $(NEWTON_HOME)\sdk\x32\JointLibrary_d.dll demos\bin\Debug\JointLibrary_d.dll

" /> </Configuration> <Configuration @@ -151,15 +154,18 @@ AdditionalOptions=" /Zm1000" Optimization="2" InlineFunctionExpansion="2" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(OGRE_HOME)\include";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(NEWTON_HOME)\sdk\dMath";"$(NEWTON_HOME)\sdk\dCustomJoints";"$(OGRE_HOME)\include";"$(OGRE_HOME)\OgreMain\include";"$(BOOST_HOME)";.\inc" PreprocessorDefinitions="_OGRENEWT_EXPORTS;_OGRENEWT_DYNAMIC;WIN32" ExceptionHandling="1" RuntimeLibrary="2" RuntimeTypeInfo="true" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="OgreNewt_Stdafx.h" AssemblerListingLocation="Release" ObjectFile="$(IntDir)\" ProgramDataBaseFileName=".\lib\OgreNewt.pdb" WarningLevel="3" + DebugInformationFormat="3" CompileAs="2" /> <Tool @@ -176,12 +182,13 @@ <Tool Name="VCLinkerTool" AdditionalOptions=" /STACK:10000000 /machine:I386" - AdditionalDependencies="$(NOINHERIT) kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib newton.lib OgreMain.lib" + AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib newton.lib dMath.lib JointLibrary.lib OgreMain.lib $(NOINHERIT)" OutputFile="./lib/OgreNewt.dll" Version="2.0" LinkIncremental="1" - AdditionalLibraryDirectories=""$(OGRE_HOME)/lib";"$(BOOST_HOME)/libs";"$(NEWTON_HOME)/sdk/x32/dll_vs9"" + AdditionalLibraryDirectories=""$(OGRE_HOME)/lib";"$(BOOST_HOME)/libs";"$(NEWTON_HOME)/sdk/x32";"$(NEWTON_HOME)/sdk/x32/dll_vs9"" GenerateManifest="true" + GenerateDebugInformation="true" ProgramDatabaseFile="lib\OgreNewt.pdb" RandomizedBaseAddress="1" DataExecutionPrevention="0" @@ -207,7 +214,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="copy $(OutDir)\OgreNewt.dll demos\bin\Release\OgreNewt.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" "demos\bin\Release\OgreMain.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" "demos\bin\Release\OIS.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" "demos\bin\Release\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" "demos\bin\Release\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" "demos\bin\Release\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreGUIRenderer.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreGUIRenderer.dll" "demos\bin\Release\OgreGUIRenderer.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIBase.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIBase.dll" "demos\bin\Release\CEGUIBase.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIExpatParser.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIExpatParser.dll" "demos\bin\Release\CEGUIExpatParser.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" "demos\bin\Release\cg.dll"

if exist "$(OGRE_HOME)\bin\release\OgreMain.dll" copy "$(OGRE_HOME)\bin\release\OgreMain.dll" "demos\bin\Release\OgreMain.dll"
if exist "$(OGRE_HOME)\bin\release\OIS.dll" copy "$(OGRE_HOME)\bin\release\OIS.dll" "demos\bin\Release\OIS.dll"
if exist "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" "demos\bin\Release\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" "demos\bin\Release\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" "demos\bin\Release\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\bin\release\OgreGUIRenderer.dll" copy "$(OGRE_HOME)\bin\release\OgreGUIRenderer.dll" "demos\bin\Release\OgreGUIRenderer.dll"
if exist "$(OGRE_HOME)\bin\release\CEGUIBase.dll" copy "$(OGRE_HOME)\bin\release\CEGUIBase.dll" "demos\bin\Release\CEGUIBase.dll"
if exist "$(OGRE_HOME)\bin\release\CEGUIExpatParser.dll" copy "$(OGRE_HOME)\bin\release\CEGUIExpatParser.dll" "demos\bin\Release\CEGUIExpatParser.dll"
if exist "$(OGRE_HOME)\bin\release\cg.dll" copy "$(OGRE_HOME)\bin\release\cg.dll" "demos\bin\Release\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Release\newton.dll
" + CommandLine="copy $(OutDir)\OgreNewt.dll demos\bin\Release\OgreNewt.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" "demos\bin\Release\OgreMain.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" "demos\bin\Release\OIS.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" "demos\bin\Release\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" "demos\bin\Release\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" "demos\bin\Release\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreGUIRenderer.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreGUIRenderer.dll" "demos\bin\Release\OgreGUIRenderer.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIBase.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIBase.dll" "demos\bin\Release\CEGUIBase.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIExpatParser.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\CEGUIExpatParser.dll" "demos\bin\Release\CEGUIExpatParser.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" "demos\bin\Release\cg.dll"

if exist "$(OGRE_HOME)\bin\release\OgreMain.dll" copy "$(OGRE_HOME)\bin\release\OgreMain.dll" "demos\bin\Release\OgreMain.dll"
if exist "$(OGRE_HOME)\bin\release\OIS.dll" copy "$(OGRE_HOME)\bin\release\OIS.dll" "demos\bin\Release\OIS.dll"
if exist "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" "demos\bin\Release\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" "demos\bin\Release\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" "demos\bin\Release\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\bin\release\OgreGUIRenderer.dll" copy "$(OGRE_HOME)\bin\release\OgreGUIRenderer.dll" "demos\bin\Release\OgreGUIRenderer.dll"
if exist "$(OGRE_HOME)\bin\release\CEGUIBase.dll" copy "$(OGRE_HOME)\bin\release\CEGUIBase.dll" "demos\bin\Release\CEGUIBase.dll"
if exist "$(OGRE_HOME)\bin\release\CEGUIExpatParser.dll" copy "$(OGRE_HOME)\bin\release\CEGUIExpatParser.dll" "demos\bin\Release\CEGUIExpatParser.dll"
if exist "$(OGRE_HOME)\bin\release\cg.dll" copy "$(OGRE_HOME)\bin\release\cg.dll" "demos\bin\Release\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll demos\bin\Release\newton.dll
copy $(NEWTON_HOME)\sdk\x32\JointLibrary.dll demos\bin\Release\JointLibrary.dll
" /> </Configuration> </Configurations> @@ -254,6 +261,10 @@ > </File> <File + RelativePath=".\src\OgreNewt_ConvexCast.cpp" + > + </File> + <File RelativePath=".\src\OgreNewt_Debugger.cpp" > </File> @@ -278,6 +289,26 @@ > </File> <File + RelativePath=".\src\OgreNewt_Stdafx.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + </File> + <File RelativePath=".\src\OgreNewt_Tools.cpp" > </File> @@ -334,6 +365,10 @@ > </File> <File + RelativePath=".\inc\OgreNewt_ConvexCast.h" + > + </File> + <File RelativePath=".\inc\OgreNewt_Debugger.h" > </File> @@ -362,6 +397,10 @@ > </File> <File + RelativePath=".\inc\OgreNewt_Stdafx.h" + > + </File> + <File RelativePath=".\inc\OgreNewt_Tools.h" > </File> Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj 2009-12-10 10:22:07 UTC (rev 2766) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/Demo01_TheBasics.vcproj 2009-12-26 10:50:16 UTC (rev 2767) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1257"?> <VisualStudioProject ProjectType="Visual C++" - Version="9,00" + Version="9.00" Name="Demo01_TheBasics" ProjectGUID="{59D5ADD4-9669-468E-B687-F461BB7F4112}" RootNamespace="Demo01_TheBasics" @@ -41,14 +41,14 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\OIS";..\..\inc;." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - DebugInformationFormat="4" + DebugInformationFormat="3" /> <Tool Name="VCManagedResourceCompilerTool" @@ -62,8 +62,8 @@ <Tool Name="VCLinkerTool" AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreNewt_d.lib" - LinkIncremental="2" - AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + LinkIncremental="1" + AdditionalLibraryDirectories="..\..\lib;"$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\OIS";..\..\inc;." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -138,7 +138,7 @@ Name="VCLinkerTool" AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreNewt.lib" LinkIncremental="1" - AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + AdditionalLibraryDirectories="..\..\lib;"$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" Added: branches/ogrenewt/newton20/demos/Demo01_TheBasics/Ogre.log =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/Ogre.log (rev 0) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/Ogre.log 2009-12-26 10:50:16 UTC (rev 2767) @@ -0,0 +1,31 @@ +18:05:12: Creating resource group General +18:05:12: Creating resource group Internal +18:05:12: Creating resource group Autodetect +18:05:12: SceneManagerFactory for type 'DefaultSceneManager' registered. +18:05:12: Registering ResourceManager for type Material +18:05:12: Registering ResourceManager for type Mesh +18:05:12: Registering ResourceManager for type Skeleton +18:05:12: MovableObjectFactory for type 'ParticleSystem' registered. +18:05:12: OverlayElementFactory for type Panel registered. +18:05:12: OverlayElementFactory for type BorderPanel registered. +18:05:12: OverlayElementFactory for type TextArea registered. +18:05:12: Registering ResourceManager for type Font +18:05:12: ArchiveFactory for archive type FileSystem registered. +18:05:12: ArchiveFactory for archive type Zip registered. +18:05:12: FreeImage version: 3.10.0 +18:05:12: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details +18:05:12: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2 +18:05:12: DDS codec registering +18:05:12: Registering ResourceManager for type HighLevelGpuProgram +18:05:12: Registering ResourceManager for type Compositor +18:05:12: MovableObjectFactory for type 'Entity' registered. +18:05:12: MovableObjectFactory for type 'Light' registered. +18:05:12: MovableObjectFactory for type 'BillboardSet' registered. +18:05:12: MovableObjectFactory for type 'ManualObject' registered. +18:05:12: MovableObjectFactory for type 'BillboardChain' registered. +18:05:12: MovableObjectFactory for type 'RibbonTrail' registered. +18:05:12: OGRE EXCEPTION(6:FileNotFoundException): 'plugins.cfg' file not found! in ConfigFile::load at c:\ogre\ogremain\src\ogreconfigfile.cpp (line 84) +18:05:12: plugins.cfg not found, automatic plugin loading disabled. +18:05:12: *-*-* OGRE Initialising +18:05:12: *-*-* Version 1.6.4 (Shoggoth) +18:05:12: OGRE EXCEPTION(6:FileNotFoundException): 'resources.cfg' file not found! in ConfigFile::load at c:\ogre\ogremain\src\ogreconfigfile.cpp (line 84) Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/demo01.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/demo01.cpp 2009-12-10 10:22:07 UTC (rev 2766) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/demo01.cpp 2009-12-26 10:50:16 UTC (rev 2767) @@ -22,7 +22,7 @@ #endif { // Create application object - OgreNewtonApplication app; + OgreNewtonApplication app; try { app.go(); Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj 2009-12-10 10:22:07 UTC (rev 2766) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/Demo02_Joints.vcproj 2009-12-26 10:50:16 UTC (rev 2767) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1257"?> <VisualStudioProject ProjectType="Visual C++" - Version="9,00" + Version="9.00" Name="Demo02_Joints" ProjectGUID="{5BAB7340-BEDB-408A-96B1-296785399531}" RootNamespace="Demo02_Joints" @@ -41,14 +41,14 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\OIS";..\..\inc;." PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - DebugInformationFormat="4" + DebugInformationFormat="3" /> <Tool Name="VCManagedResourceCompilerTool" @@ -62,8 +62,8 @@ <Tool Name="VCLinkerTool" AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreNewt_d.lib" - LinkIncremental="2" - AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + LinkIncremental="1" + AdditionalLibraryDirectories="..\..\lib;"$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1" @@ -117,7 +117,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\include\OIS";"$(OGRENEWT_HOME)\inc";." + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\OIS";..\..\inc;." PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -138,7 +138,7 @@ Name="VCLinkerTool" AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreNewt.lib" LinkIncremental="1" - AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + AdditionalLibraryDirectories="..\..\lib;"$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-12-10 10:22:07 UTC (rev 2766) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-12-26 10:50:16 UTC (rev 2767) @@ -1,191 +1,353 @@ -/* - OgreNewt library - connecting Ogre and Newton! - - Demo02_Joints - basic demo that shows how to connect rigid bodies via joints. -*/ - -#include "OgreNewtonApplication.h" -#include "OgreNewtonFrameListener.h" - -#include <OgreNewt.h> -#include <OgreNewt_BasicFrameListener.h> - - - -OgreNewtonApplication::OgreNewtonApplication(void) -{ - // create OgreNewt world. - m_World = new OgreNewt::World(); - - mEntityCount = 0; - -} - -OgreNewtonApplication::~OgreNewtonApplication(void) -{ - // destroy world. - delete m_World; -} - - - -void OgreNewtonApplication::createScene() -{ - // sky box. - mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); - - // shadows on! - mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_ADDITIVE ); - - - // floor object! - Entity* floor; - SceneNode* floornode; - floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); - floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); - floornode->attachObject( floor ); - floor->setMaterialName( "Simple/BeachStones" ); - - floor->setCastShadows( false ); - - //------------------------------------------------------------- - // add some other objects. - Entity* floor2; - SceneNode* floornode2; - floor2 = mSceneMgr->createEntity("Floor2", "simple_terrain.mesh" ); - floornode2 = floornode->createChildSceneNode( "FloorNode2" ); - floornode2->attachObject( floor2 ); - floor2->setMaterialName( "Simple/BeachStones" ); - floor2->setCastShadows( false ); - floornode2->setPosition( Ogre::Vector3(80.0f, 0.0f, 0.0f) ); - - Entity* floor3; - SceneNode* floornode3; - floor3 = mSceneMgr->createEntity("Floor3", "simple_terrain.mesh" ); - floornode3 = floornode->createChildSceneNode( "FloorNode3" ); - floornode3->attachObject( floor3 ); - floor3->setMaterialName( "Simple/BeachStones" ); - floor3->setCastShadows( false ); - floornode3->setPosition( Ogre::Vector3(-80.0f, -5.0f, 0.0f) ); - floornode3->setOrientation( Ogre::Quaternion( Ogre::Degree(15.0f), Ogre::Vector3::UNIT_Z ) ); - //------------------------------------------------------------- - - // using the new "SceneParser" TreeCollision primitive. this will automatically parse an entire tree of - // SceneNodes (parsing all children), and add collision for all meshes in the tree. - OgreNewt::CollisionPrimitives::TreeCollisionSceneParser* stat_col = new OgreNewt::CollisionPrimitives::TreeCollisionSceneParser( m_World ); - stat_col->parseScene( floornode, true, 0 ); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, OgreNewt::CollisionPtr(stat_col) ); -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - delete stat_col; -#endif - - bod->attachNode( floornode ); - bod->setPositionOrientation( Ogre::Vector3(0.0,-20.0,0.0), Ogre::Quaternion::IDENTITY ); - - - - // make a simple rope. - Ogre::Vector3 size(3,1.5,1.5); - Ogre::Vector3 pos(0,3,0); - Ogre::Quaternion orient = Ogre::Quaternion::IDENTITY; - - // loop through, making bodies and connecting them. - OgreNewt::Body* parent = NULL; - OgreNewt::Body* child = NULL; - - for (int x=0;x<5;x++) - { - // make the next box. - child = makeSimpleBox(size, pos, orient); - - // now make a new joint connecting this to the last box. - OgreNewt::Joint* joint; - - // make the joint right between the bodies... - - - if (parent) - { - joint = new OgreNewt::BasicJoints::BallAndSocket( m_World, child, parent, pos-Ogre::Vector3(size.x/2,0,0) ); - } - else - { - // no parent, this is the first joint, so just pass NULL as the parent, to stick it to the "world" - joint = new OgreNewt::BasicJoints::BallAndSocket( m_World, child, NULL, pos-Ogre::Vector3(size.x/2,0,0) ); - } - - // offset pos a little more. - pos += Ogre::Vector3(size.x,0,0); - - // save the last body for the next loop! - parent = child; - } - - - - - - - // position camera - mCamera->setPosition(0.0, -3.0, 0.0); - - //make a light - Ogre::Light* light; - - light = mSceneMgr->createLight( "Light1" ); - light->setType( Ogre::Light::LT_POINT ); - light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); - - - -} - - -void OgreNewtonApplication::createFrameListener() -{ - mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); - mRoot->addFrameListener(mFrameListener); - - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); -} - - -OgreNewt::Body* OgreNewtonApplication::makeSimpleBox( Ogre::Vector3& size, Ogre::Vector3& pos, Ogre::Quaternion& orient ) -{ - Entity* box1; - SceneNode* box1node; - - box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "box.mesh" ); - box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - box1node->attachObject( box1 ); - box1node->setScale( size ); -// box1->setNormaliseNormals(true); - - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); - - - // base mass on the size of the object. - Ogre::Real mass = size.x * size.y * size.z * 2.5; - - // calculate the inertia based on box formula and mass - Ogre::Vector3 inertia, offset; - col->calculateInertialMatrix(inertia, offset); - -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - delete col; -#endif - - bod->attachNode( box1node ); - bod->setMassMatrix( mass, mass*inertia ); - bod->setCenterOfMass(offset); - bod->setStandardForceCallback(); - - box1->setMaterialName( "Simple/BumpyMetal" ); - - - bod->setPositionOrientation( pos, orient ); - - return bod; -} +/* + OgreNewt library - connecting Ogre and Newton! + + Demo02_Joints - basic demo that shows how to connect rigid bodies via joints. +*/ + +#include "OgreNewtonApplication.h" +#include "OgreNewtonFrameListener.h" + +#include <OgreNewt.h> +#include <OgreNewt_BasicFrameListener.h> + + + +OgreNewtonApplication::OgreNewtonApplication(void) +{ + // create OgreNewt world. + m_World = new OgreNewt::World(); + + mEntityCount = 0; + +} + +OgreNewtonApplication::~OgreNewtonApplication(void) +{ + // destroy world. + delete m_World; +} + + + + + +void OgreNewtonApplication::createFrameListener() +{ + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); + mRoot->addFrameListener(mFrameListener); + + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); + mRoot->addFrameListener(mNewtonListener); +} + + +OgreNewt::Body* OgreNewtonApplication::makeSimpleBox( Ogre::Vector3& size, Ogre::Vector3& pos, Ogre::Quaternion& orient ) +{ + Entity* box1; + SceneNode* box1node; + + box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "box.mesh" ); + box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + box1node->attachObject( box1 ); + box1node->setScale( size ); +// box1->setNormaliseNormals(true); + + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + + + // base mass on the size of the object. + Ogre::Real mass = size.x * size.y * size.z * 2.5; + + // calculate the inertia based on box formula and mass + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + bod->attachNode( box1node ); + bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + box1->setMaterialName( "Simple/BumpyMetal" ); + + + bod->setPositionOrientation( pos, orient ); + + return bod; +} + + +OgreNewt::Body* OgreNewtonApplication::makeSimpleShere( Ogre::Vector3& size, Ogre::Vector3& pos, Ogre::Quaternion& orient ) +{ + Entity* box1; + SceneNode* box1node; + + box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "ellipsoid.mesh" ); + box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + box1node->attachObject( box1 ); + box1node->setScale( size ); + + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, size, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + + // base mass on the size of the object. + Ogre::Real mass = size.x * size.y * size.z * 2.5; + + // calculate the inertia based on box formula and mass + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + bod->attachNode( box1node ); + bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + box1->setMaterialName( "Simple/BumpyMetal" ); + + + bod->setPositionOrientation( pos, orient ); + + return bod; +} + + + +//static void AddSimpleRobot (dVector position, SceneManager* scene, NewtonWorld* nWorld) +void OgreNewtonApplication::SimpleRobot (Ogre::Vector3 pos, Ogre::Vector3 size) +{ + Ogre::Real radius; + OgreNewt::Body* robotBody; + OgreNewt::Body* leftWheel; + OgreNewt::Body* rightWheel; + OgreNewt::Body* frontWheel; + OgreNewt::Joint* joint; + + radius = 0.25f; + Ogre::Quaternion orient (Ogre::Quaternion::IDENTITY); + + // find location above the ground + Ogre::Vector3 start(pos.x, 1000.0f, pos.z); + Ogre::Vector3 end(pos.x, -1000.0f, pos.z); + OgreNewt::BasicRaycast castRay (m_World, start, end, true); + OgreNewt::BasicRaycast::BasicRaycastInfo info = castRay.getFirstHit(); + + // place contraction at some location in above the floor + pos.y = 2 * size.y + start.y + (end.y - start.y) * info.mDistance; + + // create the robot body + robotBo... [truncated message content] |
From: <kal...@us...> - 2009-12-26 14:46:07
|
Revision: 2769 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2769&view=rev Author: kallaspriit Date: 2009-12-26 14:45:47 +0000 (Sat, 26 Dec 2009) Log Message: ----------- Added OgreNewt::Body::getForceTorqueCallback(). Modified Paths: -------------- branches/ogrenewt/newton20/OgreNewt.suo branches/ogrenewt/newton20/inc/OgreNewt_Body.h Modified: branches/ogrenewt/newton20/OgreNewt.suo =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/inc/OgreNewt_Body.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-12-26 10:53:40 UTC (rev 2768) +++ branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-12-26 14:45:47 UTC (rev 2769) @@ -161,6 +161,12 @@ //! remove any force callbacks. void removeForceAndTorqueCallback() { NewtonBodySetForceAndTorqueCallback( m_body, NULL ); m_forcecallback = NULL; } + //! returns currect force-torque callback + ForceCallback getForceTorqueCallback() + { + return m_forcecallback; + } + //! set a custom transform callback. /* sets a custom transform callback for the rigid body. see the docs on setCustomForceAndTorqueCallback for a description of how to use this function. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kal...@us...> - 2009-12-26 16:15:37
|
Revision: 2770 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2770&view=rev Author: kallaspriit Date: 2009-12-26 16:15:26 +0000 (Sat, 26 Dec 2009) Log Message: ----------- Included Minimal OgreNewt Application Project as a demo that is entirely stand-alone and does not use the example framework. See http://www.ogre3d.org/wiki/index.php/OgreNewt_Minimal_Simple_Application_Project for more information. Modified Paths: -------------- branches/ogrenewt/newton20/OgreNewt.sln branches/ogrenewt/newton20/OgreNewt.suo Added Paths: ----------- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/INSTALL.txt branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.suo branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.vcproj branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/Application.h branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/FirstPersonCameraController.h branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/MouseCursor.h branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/Picker.h branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/PrimitiveFactory.h branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/ScreenWriter.h branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/bluehigh.ttf branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/consolas.ttf branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/debug.fontdef branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/gui/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/gui/cursor.png branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/materials/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/materials/scripts/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/materials/scripts/debug.material branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/meshes/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/meshes/sandbox.mesh branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/box.mesh branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/chamfercylinder.mesh branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/cone.mesh branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/cylinder.mesh branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/ellipsoid.mesh branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Application.cpp branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/FirstPersonCameraController.cpp branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/MouseCursor.cpp branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Picker.cpp branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/PrimitiveFactory.cpp branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/ScreenWriter.cpp branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/main.cpp Modified: branches/ogrenewt/newton20/OgreNewt.sln =================================================================== --- branches/ogrenewt/newton20/OgreNewt.sln 2009-12-26 14:45:47 UTC (rev 2769) +++ branches/ogrenewt/newton20/OgreNewt.sln 2009-12-26 16:15:26 UTC (rev 2770) @@ -37,6 +37,11 @@ {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinimalOgreNewt", "demos\MinimalOgreNewtApplication\MinimalOgreNewt.vcproj", "{44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -93,6 +98,12 @@ {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|Win32.ActiveCfg = Release|Win32 {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|Win32.Build.0 = Release|Win32 {2C1C0690-C7DD-4800-9E3F-52E3C3FF7F33}.Release|x64.ActiveCfg = Release|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Debug|Win32.ActiveCfg = Debug|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Debug|Win32.Build.0 = Debug|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Debug|x64.ActiveCfg = Debug|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|Win32.ActiveCfg = Release|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|Win32.Build.0 = Release|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: branches/ogrenewt/newton20/OgreNewt.suo =================================================================== (Binary files differ) Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/INSTALL.txt =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/INSTALL.txt (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/INSTALL.txt 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,62 @@ +INSTALLATION + +This package includes the release build, so you can see what you are dealing with. Debug build and +dll's are not included. + +1. Get Ogre + - http://www.ogre3d.org/ + - Get precompiled libraries + - Or compile yourself + - Set enviroment variable "OGRE_HOME" to ogre home directory + > for example "C:\Ogre3D" + > includes will be searched in $(OGRE_HOME)\OgreMain\include + +2. Get latest Boost C++ libraries + - http://www.boost.org/ + - Just install anywhere + - Set enviroment variable "BOOST_HOME" to boost directory + > for example "C:\Boost" + +3. Get Newton Game Dynamics + - http://newtondynamics.com/forum/ + > there is a "Newton 2 BETA" link at the top, this may change in the future, but you'll find it + - Install it + - Set enviroment variable "NEWTON_HOME" to install directory + > for example "C:\NDG\2.15" + +4. Get OgreNewt + - Latest can be downloaded from SVN at https://svn.ogre3d.org/svnroot/ogreaddons/branches/ogrenewt/newton20 + > you can't download from this url using your browser, you need to use SVN client + > for example, use GUI SVN client TortoiseSVN (http://tortoisesvn.tigris.org/) + > google how to use it, basically just download and istall it, make a folder for ogrenewt, right click the + folder, choose "SVN Checkout...", enter the SVN url above and do the checkout. + - The OgreNewt Visual studio project is a bit messed up, you can use the one that comes with this project + in "ogrenewt" directory. Just copy the solution and project files to the folder you checked out ogrenewt, + overwrite existing files and open the solution. The modified project uses the enviroment variables you + defined above so everything should compile without any changes to the project (may not be the case if you + did not compile Ogre yourself, you might have to change the include and library directories). + - Set enviroment variable "OGRENEWT_HOME" to OgreNewt root directory + > for example "C:\Ogre3D\Addons\OgreNewt" + +5. Copy DLLs + - If everything is set up right, the dll's will be automaticly copied to the right location, if not: + - Copy OgreMain.dll, Plugin_CgProgramManager.dll, Plugin_OctreeSceneManager.dll, RenderSystem_Direct3D9.dll, + RenderSystem_GL.dll from OGRE_HOME\lib directory to this projects' root directory + - Copy OgreMain_d.dll, Plugin_CgProgramManager_d.dll, Plugin_OctreeSceneManager_d.dll, RenderSystem_Direct3D9_d.dll, + RenderSystem_GL_d.dll from OGRE_HOME\lib directory to this projects' root directory if you also want to + use debug mode + - Copy cg.dll and OIS.dll from OGRE_HOME\Samples\Common\bin\Release (and OIS_d.dll from OGRE_HOME\Samples\Common\bin\Debug + for debug) to project root directory + - Copy newton.dll from NEWTON_HOME\sdk\x32\dll_vs9 to project root directory + - Copy OgreNewt.dll (and OgreNewt_d.dll for debug) from OGRENEWT_HOME\lib to project root directory + +6. Compile the application + - Open NGD.sln, choose Release or Debug configuration and hit Compile (F7) + - Release configuration compiles to release.exe and debug to.. you guessed it, debug.exe + - If I got this tutorial right and you did everything correctly, it should compile out of the box and work! + +7. Experiment + - The code provided is pretty much the minimum for a working application with input and debugging + - No Ogre sample framework is used + - The code has not been organised to great depth to make the learning curve simpler. You can modify it to + use better organization, state managment and so on. \ No newline at end of file Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinimalOgreNewt", "MinimalOgreNewt.vcproj", "{44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Debug|Win32.ActiveCfg = Debug|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Debug|Win32.Build.0 = Debug|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|Win32.ActiveCfg = Release|Win32 + {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.suo =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.suo ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.vcproj (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.vcproj 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,251 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="MinimalOgreNewt" + ProjectGUID="{44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}" + RootNamespace="NGD" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="." + IntermediateDirectory="obj\debug" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy $(OGRENEWT_HOME)\lib\OgreNewt_d.dll $(OutDir)\OgreNewt_d.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" "$(OutDir)\OgreMain_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" "$(OutDir)\OIS_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" "$(OutDir)\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" "$(OutDir)\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" "$(OutDir)\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" "$(OutDir)\cg.dll"

if exist "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" "$(OutDir)\OgreMain_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OIS_d.dll" copy "$(OGRE_HOME)\bin\debug\OIS_d.dll" demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\bin\debug\cg.dll" copy "$(OGRE_HOME)\bin\debug\cg.dll" demos\bin\Debug\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll $(OutDir)\newton.dll
copy $(NEWTON_HOME)\sdk\x32\JointLibrary_d.dll $(OutDir)\JointLibrary_d.dll
" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";.\include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;OIS_DYNAMIC_LIB" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreNewt_d.lib" + OutputFile="$(OutDir)\debug.exe" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="." + IntermediateDirectory="obj\release" + ConfigurationType="1" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy $(OGRENEWT_HOME)\lib\OgreNewt.dll $(OutDir)\OgreNewt.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" "$(OutDir)\OgreMain.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" "$(OutDir)\OIS.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" "$(OutDir)\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" "$(OutDir)\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" "$(OutDir)\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" "$(OutDir)\cg.dll"

if exist "$(OGRE_HOME)\bin\release\OgreMain.dll" copy "$(OGRE_HOME)\bin\release\OgreMain.dll" "$(OutDir)\OgreMain.dll"
if exist "$(OGRE_HOME)\bin\release\OIS.dll" copy "$(OGRE_HOME)\bin\release\OIS.dll" "$(OutDir)\OIS.dll"
if exist "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" "$(OutDir)\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" "$(OutDir)\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" "$(OutDir)\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\bin\release\cg.dll" copy "$(OGRE_HOME)\bin\release\cg.dll" "$(OutDir)\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll $(OutDir)\newton.dll
copy $(NEWTON_HOME)\sdk\x32\JointLibrary.dll $(OutDir)\JointLibrary.dll
" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";.\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;OIS_DYNAMIC_LIB;" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreNewt.lib" + OutputFile="$(OutDir)\release.exe" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\source\Application.cpp" + > + </File> + <File + RelativePath=".\source\FirstPersonCameraController.cpp" + > + </File> + <File + RelativePath=".\source\main.cpp" + > + </File> + <File + RelativePath=".\source\MouseCursor.cpp" + > + </File> + <File + RelativePath=".\source\Picker.cpp" + > + </File> + <File + RelativePath=".\source\PrimitiveFactory.cpp" + > + </File> + <File + RelativePath=".\source\ScreenWriter.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\include\Application.h" + > + </File> + <File + RelativePath=".\include\FirstPersonCameraController.h" + > + </File> + <File + RelativePath=".\include\MouseCursor.h" + > + </File> + <File + RelativePath=".\include\Picker.h" + > + </File> + <File + RelativePath=".\include\PrimitiveFactory.h" + > + </File> + <File + RelativePath=".\include\ScreenWriter.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/Application.h =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/Application.h (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/Application.h 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,76 @@ +#ifndef APPLICATION_H +#define APPLICATION_H + +#include "MouseCursor.h" +#include "ScreenWriter.h" +#include "Picker.h" +#include "PrimitiveFactory.h" +#include "FirstPersonCameraController.h" + +#include <OgreRoot.h> +#include <OgreRenderWindow.h> +#include <OgreSceneManager.h> +#include <OgreCamera.h> +#include <OgreWindowEventUtilities.h> + +#include <OIS.h> + +#include <OgreNewt.h> +#include <OgreNewt_BasicFrameListener.h> + +class Application : public OIS::MouseListener, public OIS::KeyListener, public Ogre::WindowEventListener +{ +public: + Application(); + ~Application(); + + bool initialise(); + bool setup(); + void run(); + + bool mouseMoved(const OIS::MouseEvent &evt); + bool mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID); + bool mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID); + + bool keyPressed(const OIS::KeyEvent &evt); + bool keyReleased(const OIS::KeyEvent &evt); + + void windowMoved(Ogre::RenderWindow* rw) {}; + void windowFocusChange(Ogre::RenderWindow* rw) {}; + void windowResized(Ogre::RenderWindow* rw); + void windowClosed(Ogre::RenderWindow* rw); + +private: + Ogre::Root* ogre; + Ogre::RenderWindow* window; + Ogre::SceneManager* sceneManager; + Ogre::Camera* camera; + Ogre::Viewport* viewport; + + OIS::InputManager* ois; + OIS::Mouse* mouse; + OIS::Keyboard* keyboard; + + MouseCursor* cursor; + ScreenWriter* debug; + Picker* picker; + PrimitiveFactory* factory; + FirstPersonCameraController* firstPersonCameraController; + + OgreNewt::World* world; + OgreNewt::MaterialPair* defaultMaterialPair; + + int desiredPhysicsFramerate; + int lastFPS; + + unsigned long lastFrameTime; + unsigned long lastFrameDuration; + + Ogre::Real physicsTimeAccumulator; + Ogre::Real physicsUpdateStep; + + bool running; + bool debuggerActive; +}; + +#endif \ No newline at end of file Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/FirstPersonCameraController.h =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/FirstPersonCameraController.h (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/FirstPersonCameraController.h 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,31 @@ +#ifndef FIRST_PERSON_CAMERA_CONTROLLER_H +#define FIRST_PERSON_CAMERA_CONTROLLER_H + +#include <OgreSceneManager.h> + +#include <OIS.h> + +class FirstPersonCameraController +{ +public: + FirstPersonCameraController(Ogre::SceneManager* sceneManager, Ogre::Real moveSpeed = 10.0f, Ogre::Real rotationSpeed = 0.25f); + void update(OIS::Keyboard* keyboard, OIS::Mouse* mouse, unsigned long lastFrameDuration); + void setPosition(Ogre::Vector3 position); + void getPositionOrientation(Ogre::Vector3& position, Ogre::Quaternion& orientation); + +private: + Ogre::SceneManager* sceneManager; + + Ogre::SceneNode* cameraNode; + Ogre::SceneNode* cameraYawNode; + Ogre::SceneNode* cameraPitchNode; + Ogre::SceneNode* cameraRollNode; + + Ogre::Vector3 cameraTranslation; + Ogre::Real cameraMoveSpeed; + Ogre::Degree cameraRotationSpeed; + Ogre::Radian cameraRotationX; + Ogre::Radian cameraRotationY; +}; + +#endif Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/MouseCursor.h =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/MouseCursor.h (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/MouseCursor.h 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,52 @@ +#ifndef MOUSECURSOR_H +#define MOUSECURSOR_H + +#include <OgrePanelOverlayElement.h> +#include <OgreTexture.h> +#include <OgreMaterialManager.h> +#include <OgreOverlayManager.h> + +class MouseCursor : public Ogre::Singleton<MouseCursor> +{ +public: + MouseCursor(); + ~MouseCursor(); + + struct Position + { + Position() { + X = 0; + Y = 0; + normalisedX = 0.0f; + normalisedY = 0.0f; + } + + int X; + int Y; + float normalisedX; + float normalisedY; + }; + + void setImage(const Ogre::String& filename); + void setWindowDimensions(unsigned int width, unsigned int height); + void setVisible(bool visible); + void updatePosition(int x, int y); + + Position getPosition() { return position; }; + + static MouseCursor& getSingleton(void); + static MouseCursor* getSingletonPtr(void); + +private: + Ogre::Real clamp(Ogre::Real a, Ogre::Real min, Ogre::Real max); + + Ogre::Overlay* guiOverlay; + Ogre::OverlayContainer* cursorContainer; + Ogre::TexturePtr texture; + Ogre::MaterialPtr material; + Ogre::Real windowWidth; + Ogre::Real windowHeight; + Position position; +}; + +#endif \ No newline at end of file Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/Picker.h =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/Picker.h (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/Picker.h 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,47 @@ +#ifndef PICKER_H +#define PICKER_H + +#include <OgreNewt.h> +#include <OgreSceneManager.h> + +#include <OIS.h> + +class Picker : public Ogre::Singleton<Picker> +{ +public: + Picker(); + ~Picker(); + + void init(Ogre::SceneManager* sceneManager, OgreNewt::World* world, OIS::Keyboard* keyboard, OIS::Mouse* mouse, int maxDistance = 2000, int forceMultiplier = 10); + void deInit(); + void update(Ogre::Camera* camera); + + void dragCallback(OgreNewt::Body* body, Ogre::Real timeStep, int threadIndex); + + static Picker& getSingleton(void); + static Picker* getSingletonPtr(void); + +private: + Ogre::SceneManager* sceneManager; + Ogre::Camera* camera; + Ogre::SceneNode* dragLineNode; + Ogre::ManualObject* dragLineObject; + Ogre::Vector3 dragPoint; + Ogre::Real dragDist; + + OIS::Keyboard* keyboard; + OIS::Mouse* mouse; + + OgreNewt::World* world; + OgreNewt::Body* dragBody; + OgreNewt::Body::ForceCallback previousForceTorqueCallback; + + bool active; + bool dragging; + int maxDistance; + int forceMultiplier; + + void removeLine(); +}; + +#endif // PICKER_H Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/PrimitiveFactory.h =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/PrimitiveFactory.h (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/PrimitiveFactory.h 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,76 @@ +#ifndef PRIMITIVEFACTORY_H +#define PRIMITIVEFACTORY_H + +#include <OgreNewt.h> +#include <Ogre.h> + +#include <map> + +class PrimitiveFactory : public Ogre::Singleton<PrimitiveFactory> +{ +public: + PrimitiveFactory(OgreNewt::World* world, Ogre::SceneManager* sceneManager, Ogre::String defaultMaterialName = "Debug/Blue"); + ~PrimitiveFactory(); + + typedef std::map<Ogre::String, OgreNewt::Body*> BodyMap; + + OgreNewt::Body* createBox(Ogre::String name = "", Ogre::String material = "", Ogre::Real mass = 1.0f, Ogre::Vector3 position = Ogre::Vector3::ZERO, Ogre::Vector3 scale = Ogre::Vector3::UNIT_SCALE, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY, OgreNewt::MaterialID* materialId = NULL, int objectId = 0, Ogre::String mesh = "box.mesh"); + OgreNewt::Body* createBox(Ogre::SceneNode* sourceNode, float mass = 1.0f, OgreNewt::MaterialID* materialId = NULL, int objectId = 0); + OgreNewt::Body* getBox(Ogre::String name); + + OgreNewt::Body* createEllipsoid(Ogre::String name = "", Ogre::String material = "", Ogre::Real mass = 1.0f, Ogre::Vector3 position = Ogre::Vector3::ZERO, Ogre::Vector3 scale = Ogre::Vector3::UNIT_SCALE, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY, OgreNewt::MaterialID* materialId = NULL, int objectId = 0, Ogre::String mesh = "ellipsoid.mesh"); + OgreNewt::Body* createEllipsoid(Ogre::SceneNode* sourceNode, float mass = 1.0f, OgreNewt::MaterialID* materialId = NULL, int objectId = 0); + OgreNewt::Body* getEllipsoid(Ogre::String name); + + OgreNewt::Body* createCylinder(Ogre::String name = "", Ogre::String material = "", Ogre::Real mass = 1.0f, Ogre::Vector3 position = Ogre::Vector3::ZERO, float radius = 0.5f, float height = 1.0f, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY, OgreNewt::MaterialID* materialId = NULL, int objectId = 0, Ogre::String mesh = "cylinder.mesh"); + OgreNewt::Body* createCylinder(Ogre::SceneNode* sourceNode, float mass = 1.0f, OgreNewt::MaterialID* materialId = NULL, int objectId = 0); + OgreNewt::Body* getCylinder(Ogre::String name); + + OgreNewt::Body* createChamferCylinder(Ogre::String name = "", Ogre::String material = "", Ogre::Real mass = 1.0f, Ogre::Vector3 position = Ogre::Vector3::ZERO, float radius = 0.5f, float height = 1.0f, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY, OgreNewt::MaterialID* materialId = NULL, int objectId = 0, Ogre::String mesh = "chamfercylinder.mesh"); + OgreNewt::Body* createChamferCylinder(Ogre::SceneNode* sourceNode, float mass = 1.0f, OgreNewt::MaterialID* materialId = NULL, int objectId = 0); + OgreNewt::Body* getChamferCylinder(Ogre::String name); + + OgreNewt::Body* createCone(Ogre::String name = "", Ogre::String material = "", Ogre::Real mass = 1.0f, Ogre::Vector3 position = Ogre::Vector3::ZERO, float radius = 0.5f, float height = 1.0f, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY, OgreNewt::MaterialID* materialId = NULL, int objectId = 0, Ogre::String mesh = "cone.mesh"); + OgreNewt::Body* createCone(Ogre::SceneNode* sourceNode, float mass = 1.0f, OgreNewt::MaterialID* materialId = NULL, int objectId = 0); + OgreNewt::Body* getCone(Ogre::String name); + + OgreNewt::Body* createConvexHull(Ogre::String mesh, Ogre::String name = "", Ogre::String material = "", Ogre::Real mass = 1.0f, Ogre::Vector3 position = Ogre::Vector3::ZERO, Ogre::Vector3 scale = Ogre::Vector3::UNIT_SCALE, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY, OgreNewt::MaterialID* materialId = NULL, int objectId = 0); + OgreNewt::Body* createConvexHull(Ogre::SceneNode* sourceNode, float mass = 1.0f, OgreNewt::MaterialID* materialId = NULL, int objectId = 0); + OgreNewt::Body* getConvexHull(Ogre::String name); + + OgreNewt::Body* createTreeCollision(Ogre::String mesh, Ogre::String name = "", Ogre::String material = "", Ogre::Vector3 position = Ogre::Vector3::ZERO, Ogre::Vector3 scale = Ogre::Vector3::UNIT_SCALE, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY, OgreNewt::MaterialID* materialId = NULL, int objectId = 0, bool optimize = true); + OgreNewt::Body* createTreeCollision(Ogre::SceneNode* sourceNode, OgreNewt::MaterialID* materialId = NULL, int objectId = 0, bool optimize = true); + OgreNewt::Body* getTreeCollision(Ogre::String name); + + BodyMap getBoxes() { return boxes; }; + BodyMap getEllipsoids() { return ellipsoids; }; + BodyMap getCylinders() { return cylinders; }; + BodyMap getChamferCylinders() { return chamferCylinders; }; + BodyMap getCones() { return chamferCylinders; }; + BodyMap getConvexHulls() { return convexHulls; }; + BodyMap getTreeCollisions() { return treeCollisions; }; + + OgreNewt::Body* getBody(Ogre::String name); + + static PrimitiveFactory& getSingleton(void); + static PrimitiveFactory* getSingletonPtr(void); + +private: + Ogre::SceneNode* createNode(Ogre::String mesh, Ogre::String name, Ogre::String material, Ogre::Vector3 position, Ogre::Vector3 scale, Ogre::Quaternion orientation); + + OgreNewt::World* world; + Ogre::SceneManager* sceneManager; + Ogre::String defaultMaterialName; + + int generatedObjectCount; + + BodyMap boxes; + BodyMap ellipsoids; + BodyMap cylinders; + BodyMap chamferCylinders; + BodyMap cones; + BodyMap convexHulls; + BodyMap treeCollisions; +}; + +#endif \ No newline at end of file Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/ScreenWriter.h =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/ScreenWriter.h (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/include/ScreenWriter.h 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,77 @@ +#ifndef SCREEN_WRITER_H +#define SCREEN_WRITER_H + +#include <Ogre.h> +#include <OgreTextAreaOverlayElement.h> + +#include <string> +#include <map> + +class ScreenWriter : public Ogre::Singleton<ScreenWriter> +{ +public: + struct Entry + { + Entry() + { + x = 0; + y = 0; + size = 1.0f; + } + + float x; + float y; + float size; + + std::string text; + }; + + typedef std::vector<Entry> Strings; + + ScreenWriter(int windowWidth = 800, int windowHeight = 600); + ~ScreenWriter(); + + void init(); + void updateWindowExtents(int winWidth, int winHeight); + + void write(float x, float y, const char*, ...); + void write(float x, float y, Ogre::String, ...); + void write(float x, float y, float size, const char*, ...); + void write(Entry& entry); + + void begin(float x, float y, float size); + void write(const char*, ...); + + void removeVerticalAt(float x); + + void update(); + + static ScreenWriter& getSingleton(void); + static ScreenWriter* getSingletonPtr(void); + +private: + Strings texts; + + float defaultSize; + + int windowWidth; + int windowHeight; + + Ogre::Overlay* overlay; + Ogre::OverlayContainer* panel; + + enum { MAX_TEXT_AREAS = 50 }; + + Ogre::TextAreaOverlayElement* textAreas[MAX_TEXT_AREAS]; + + struct Context + { + Context(); + + float x; + float y; + float size; + } context; +}; + +#endif // SCREEN_WRITER_H Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/bluehigh.ttf =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/bluehigh.ttf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/consolas.ttf =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/consolas.ttf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/debug.fontdef =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/debug.fontdef (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/fonts/debug.fontdef 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,14 @@ +DebugText +{ + type truetype + source consolas.ttf + size 12 + resolution 72 +} +BlueHighway-10 +{ + type truetype + source bluehigh.ttf + size 32 + resolution 72 +} \ No newline at end of file Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/gui/cursor.png =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/gui/cursor.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/materials/scripts/debug.material =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/materials/scripts/debug.material (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/materials/scripts/debug.material 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,41 @@ +material Debug/Blue +{ + technique + { + pass + { + ambient 0.25 0.35 0.45 + diffuse 0.25 0.35 0.45 + specular 0.45 0.45 0.45 10 + emissive 0 0 0 + } + } +} + +material Debug/Green +{ + technique + { + pass + { + ambient 0.309804 0.443137 0.243137 + diffuse 0.309804 0.443137 0.243137 + specular 0.45 0.45 0.45 10 + emissive 0 0 0 + } + } +} + +material Debug/Red +{ + technique + { + pass + { + ambient 0.439216 0.0392157 0.0392157 + diffuse 1 0 0 + specular 0.22549 0.22549 0.22549 10 + emissive 0 0 0 + } + } +} \ No newline at end of file Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/meshes/sandbox.mesh =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/meshes/sandbox.mesh ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/box.mesh =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/box.mesh ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/chamfercylinder.mesh =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/chamfercylinder.mesh ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/cone.mesh =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/cone.mesh ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/cylinder.mesh =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/cylinder.mesh ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/ellipsoid.mesh =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/ellipsoid.mesh ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Application.cpp =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Application.cpp (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Application.cpp 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,457 @@ +#include "Application.h" + +#include <OgreWindowEventUtilities.h> +#include <OgreEntity.h> +#include <OgreRenderSystem.h> + +Application::Application() +{ + // Make all the used pointers NULL + ogre = NULL; + window = NULL; + sceneManager = NULL; + camera = NULL; + viewport = NULL; + ois = NULL; + mouse = NULL; + keyboard = NULL; + cursor = NULL; + debug = NULL; + picker = NULL; + factory = NULL; + firstPersonCameraController = NULL; + world = NULL; + defaultMaterialPair = NULL; + + // Set desired framerate and variables used for stepping the physics + desiredPhysicsFramerate = 60; + lastFPS = 0; + lastFrameDuration = 0; + physicsUpdateStep = 1.0f / static_cast<float>(desiredPhysicsFramerate); + physicsTimeAccumulator = 0.0f; + + // Application is not yet running and debugger is not activated by default + running = false; + debuggerActive = false; +} + +Application::~Application() +{ + // Clean everything up in reverse order these were created + if (defaultMaterialPair) + { + delete defaultMaterialPair; + defaultMaterialPair = NULL; + } + + if (factory) + { + delete factory; + factory = NULL; + } + + if (picker) + { + delete picker; + picker = NULL; + } + + if (world) + { + world->getDebugger().deInit(); + + delete world; + world = NULL; + } + + if (firstPersonCameraController) + { + delete firstPersonCameraController; + firstPersonCameraController = NULL; + } + + if (debug) + { + delete debug; + debug = NULL; + } + + if (cursor) + { + delete cursor; + cursor = NULL; + } + + if (mouse) + { + ois->destroyInputObject(mouse); + mouse = NULL; + } + + if (keyboard) + { + ois->destroyInputObject(keyboard); + keyboard = NULL; + } + + if (ois) + { + ois->destroyInputObject(mouse); + mouse = NULL; + + ois->destroyInputObject(keyboard); + keyboard = NULL; + + OIS::InputManager::destroyInputSystem(ois); + ois = NULL; + } + + if (ogre) + { + delete ogre; + ogre = NULL; + } +} + +bool Application::initialise() +{ + // Initialise Ogre and load plugins based on debug mode + ogre = new Ogre::Root("", "ogre.cfg", "ogre.log"); + +#ifdef _DEBUG + ogre->loadPlugin("RenderSystem_Direct3D9_d"); + ogre->loadPlugin("RenderSystem_GL_d"); + ogre->loadPlugin("Plugin_CgProgramManager_d"); +#else + ogre->loadPlugin("RenderSystem_Direct3D9"); + ogre->loadPlugin("RenderSystem_GL"); + ogre->loadPlugin("Plugin_CgProgramManager"); +#endif; + + // Show the configuration dialog, exit if user cancels + if (!ogre->showConfigDialog()) + { + return false; + } + + // Initialise Ogre and start listening window events + window = ogre->initialise(true, "OgreNewt Minimal Application"); + Ogre::WindowEventUtilities::addWindowEventListener(window, this); + + // Add used resource groups + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/gui", "FileSystem", "General"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/materials/scripts", "FileSystem", "General"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/fonts", "FileSystem", "General"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/primitives", "FileSystem", "General"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/meshes", "FileSystem", "General"); + + // Initialise the resource groups + Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General"); + + // Create a generic scene manager + sceneManager = ogre->createSceneManager(Ogre::ST_GENERIC); + + // Create a camera + camera = sceneManager->createCamera("camera"); + camera->setNearClipDistance(0.1f); + camera->setFarClipDistance(250.0f); + + // Create a first person camera controller + firstPersonCameraController = new FirstPersonCameraController(sceneManager); + + // Add main viewport and set its background colour + viewport = window->addViewport(camera); + viewport->setBackgroundColour(Ogre::ColourValue(0.5f, 0.5f, 0.5f)); + + // Set camera aspect ratio based on viewport size + camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()) / Ogre::Real(viewport->getActualHeight())); + + // Get window handle, needed for OIS + unsigned long windowHandle; + window->getCustomAttribute("WINDOW", &windowHandle); + + // Feed OIS window handle needed to capture events + OIS::ParamList oisParameters; + oisParameters.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(windowHandle))); + + // Create an OIS input system + ois = OIS::InputManager::createInputSystem(oisParameters); + + // Create mouse and keyboard, joystick can be made in the same manner + mouse = static_cast<OIS::Mouse*>(ois->createInputObject(OIS::OISMouse, true)); + keyboard = static_cast<OIS::Keyboard*>(ois->createInputObject(OIS::OISKeyboard, true)); + + // Start listening for mouse and keyboard events + mouse->setEventCallback(this); + keyboard->setEventCallback(this); + + // Create a custom mouse cursor that uses Ogre overlays + cursor = new MouseCursor(); + cursor->setImage("cursor.png"); + cursor->setWindowDimensions(window->getWidth(), window->getHeight()); + cursor->setVisible(true); + + // Create and initialize a debug screenwriter, that enables writing simple text on screen + debug = new ScreenWriter(viewport->getActualWidth(), viewport->getActualHeight()); + debug->init(); + + // Tell mouse the size of out window + const OIS::MouseState& mouseState = mouse->getMouseState(); + mouseState.width = window->getWidth(); + mouseState.height = window->getHeight(); + + // Create a new OgreNewt physics world and set some basic configuration options, initialise debugger + world = new OgreNewt::World(); + world->setWorldSize(Ogre::Vector3(-250, -250, -250), Ogre::Vector3(250, 250, 250)); + world->setSolverModel(1); + world->setThreadCount(1); + world->getDebugger().init(sceneManager); + + // Create a new picker, hold down CTRL to use it + picker = new Picker(); + picker->init(sceneManager, world, keyboard, mouse, 250, 10); + + // Create a primitive factory, use singleton to access it later + factory = new PrimitiveFactory(world, sceneManager); + + // Create default material pair + const OgreNewt::MaterialID* defaultMaterialId = world->getDefaultMaterialID(); + defaultMaterialPair = new OgreNewt::MaterialPair(world, defaultMaterialId, defaultMaterialId); + + // Set default material settings + defaultMaterialPair->setDefaultElasticity(0.4f); + defaultMaterialPair->setDefaultSoftness(0.05f); + defaultMaterialPair->setDefaultFriction(0.9f, 0.6f); + defaultMaterialPair->setDefaultCollidable(1); + defaultMaterialPair->setContinuousCollisionMode(0); + + // Write some help info on the screen + debug->write(-280, 20, "F1 - Toggle debug display"); + debug->write(-280, 36, "Hold CTRL - Show cursor and pick"); + debug->write(-280, 52, "Hold SHIFT - Move faster"); + debug->write(-280, 68, "Hold SHIFT - Move faster"); + debug->write(-280, 84, "SPACE - Throw a sphere"); + + return true; +} + +bool Application::setup() +{ + // Set the ammount and colour of ambient light in the scene + sceneManager->setAmbientLight(Ogre::ColourValue(0.35f, 0.35f, 0.35f)); + + // Set camera position + firstPersonCameraController->setPosition(Ogre::Vector3(0, 2, 20)); + + // Create a point-light + Ogre::Light* light = sceneManager->createLight("Light"); + light->setType(Ogre::Light::LT_POINT); + light->setPosition(Ogre::Vector3(100, 150, 100)); + + // Create a body out of an Ogre node + Ogre::Entity* entity = sceneManager->createEntity("Cylinder", "cylinder.mesh"); + entity->setMaterialName("Debug/Red"); + Ogre::SceneNode* node = sceneManager->getRootSceneNode()->createChildSceneNode("Cylinder"); + node->attachObject(entity); + node->setScale(Ogre::Vector3(12, 1, 5)); + node->setPosition(Ogre::Vector3(0, 0.5f, 0)); + PrimitiveFactory::getSingleton().createCylinder(node, 100); + + // Create static tree-collision using the factory + OgreNewt::Body* sandbox = PrimitiveFactory::getSingleton().createTreeCollision("sandbox.mesh", "sandbox", "Debug/Green", Ogre::Vector3::ZERO, Ogre::Vector3::UNIT_SCALE, Ogre::Quaternion::IDENTITY, NULL, 0, false); + + for (int x = 0; x < 10; x++) + { + for (int y = 0; y < 10; y++) + { + // Create some boxes using the factory + PrimitiveFactory::getSingleton().createBox("", (((x % 2 == 0) ^ (y % 2 == 0)) ? "Debug/Blue" : "Debug/Red"), 1.0f, Ogre::Vector3(x - 4.5f, y + 1.5f, 0.0f)); + } + } + + + // Create a body manually + entity = sceneManager->createEntity("Ellipsoid", "ellipsoid.mesh"); + entity->setMaterialName("Debug/Blue"); + entity->setCastShadows(true); + node = sceneManager->getRootSceneNode()->createChildSceneNode("Ellipsoid"); + node->attachObject(entity); + node->setScale(Ogre::Vector3(5, 5, 5)); + + OgreNewt::ConvexCollisionPtr collision = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid(world, node->getScale() / 2, 1)); + OgreNewt::Body* body = new OgreNewt::Body(world, collision); + body->attachNode(node); + body->setPositionOrientation(Ogre::Vector3(0.0f, 5.0f, -10.0f), Ogre::Quaternion::IDENTITY); + + Ogre::Vector3 inertia, centerOfMass; + collision->calculateInertialMatrix(inertia, centerOfMass); + body->setMassMatrix(1.0f, inertia * 1.0f); + body->setCenterOfMass(centerOfMass); + body->setStandardForceCallback(); + + return true; +} + +void Application::run() +{ + // Mark the application running + running = true; + + while (running) + { + // Pump window messages for nice behaviour + Ogre::WindowEventUtilities::messagePump(); + + // Capture input + mouse->capture(); + keyboard->capture(); + + // Get frame rendertime in milliseconds + unsigned long currentFrameTime = ogre->getTimer()->getMilliseconds(); + lastFrameDuration = currentFrameTime - lastFrameTime; + lastFrameTime = currentFrameTime; + + // Add last frame duration to accumulator that uses seconds + physicsTimeAccumulator += lastFrameDuration / 1000.0f; + + // Check whether there is any reason to step the physics + if (physicsTimeAccumulator > physicsUpdateStep) + { + // Lets make maximum of 5 physics updates + if (physicsTimeAccumulator < physicsUpdateStep * 5) + { + while (physicsTimeAccumulator >= physicsUpdateStep) + { + // Update the physics world and substract from the accumulator + world->update(physicsUpdateStep); + physicsTimeAccumulator -= physicsUpdateStep; + } + } + else + { + // Too many steps, just update once and clear accumulator to prevent total slowdown + world->update(physicsTimeAccumulator); + physicsTimeAccumulator = 0.0f; + } + } + + // Check whether CTRL is being held down + if (keyboard->isKeyDown(OIS::KC_LCONTROL) || keyboard->isKeyDown(OIS::KC_RCONTROL)) + { + // If so, make the cursor visible and enable picking + cursor->setVisible(true); + picker->update(camera); + } + else + { + // Hide the cursor and update first person camera + cursor->setVisible(false); + + firstPersonCameraController->update(keyboard, mouse, lastFrameDuration); + + Ogre::Vector3 newCameraPosition; + Ogre::Quaternion newCameraOrientation; + + firstPersonCameraController->getPositionOrientation(newCameraPosition, newCameraOrientation); + + camera->setPosition(newCameraPosition); + camera->setOrientation(newCameraOrientation); + } + + if (debuggerActive) + { + // Show the debug display if active (F1 to toggle) + world->getDebugger().showDebugInformation(); + } + + // Write current FPS + debug->write(20, 20, "FPS: " + Ogre::StringConverter::toString(window->getStatistics().lastFPS)); + + // Update the screenwriter + debug->update(); + + // Render a frame + ogre->renderOneFrame(); + } +} + +bool Application::mouseMoved(const OIS::MouseEvent &evt) +{ + if(cursor != NULL) + { + // Update cursor position + cursor->updatePosition(evt.state.X.abs, evt.state.Y.abs); + } + + return true; +} + +bool Application::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID) +{ + return true; +} + +bool Application::mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID) +{ + return true; +} + +bool Application::keyPressed(const OIS::KeyEvent &evt) +{ + return true; +} + +bool Application::keyReleased(const OIS::KeyEvent &evt) +{ + if (evt.key == OIS::KC_ESCAPE) + { + // Request shutdown + running = false; + } + else if (evt.key == OIS::KC_F1) + { + // Toggle debug display + if (debuggerActive) + { + debuggerActive = false; + world->getDebugger().hideDebugInformation(); + } + else + { + debuggerActive = true; + } + } + else if (evt.key == OIS::KC_SPACE) + { + // Make a sphere and add impulse in the direction of the camera + OgreNewt::Body* ball = PrimitiveFactory::getSingleton().createEllipsoid(); + ball->setPositionOrientation(camera->getPosition(), camera->getOrientation()); + ball->setContinuousCollisionMode(1); + ball->addImpulse(camera->getDirection() * 100.0f, camera->getPosition()); + } + + return true; +} + +void Application::windowResized(Ogre::RenderWindow* rw) +{ + if (mouse) + { + // Notify OIS of new window size + const OIS::MouseState& mouseState = mouse->getMouseState(); + mouseState.width = rw->getWidth(); + mouseState.height = rw->getHeight(); + } + + if (cursor) + { + // Also notify the cursor + cursor->setWindowDimensions(rw->getWidth(), rw->getHeight()); + } +} + +void Application::windowClosed(Ogre::RenderWindow* rw) +{ + // Request shutdown when renderwindow is closed + running = false; +} \ No newline at end of file Added: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/FirstPersonCameraController.cpp =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/FirstPersonCameraController.cpp (rev 0) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/FirstPersonCameraController.cpp 2009-12-26 16:15:26 UTC (rev 2770) @@ -0,0 +1,127 @@ +#include "FirstPersonCameraController.h" + +FirstPersonCameraController::FirstPersonCameraController(Ogre::SceneManager* sceneManager, Ogre::Real moveSpeed, Ogre::Real rotationSpeed) +{ + this->sceneManager = sceneManager; + + cameraNode = sceneManager->getRootSceneNode()->createChildSceneNode(); + cameraYawNode = cameraNode->createChildSceneNode(); + cameraPitchNode = cameraYawNode->createChildSceneNode(); + cameraRollNode = cameraPitchNode->createChildSceneNode(); + + cameraTranslation = Ogre::Vector3::ZERO; + cameraMoveSpeed = moveSpeed; + cameraRotationSpeed = Ogre::Degree(rotationSpeed); + cameraRotationX = 0.0; + cameraRotationY = 0.0; +} + +void FirstPersonCameraController::update(OIS::Keyboard* keyboard, OIS::Mouse* mouse, unsigned long lastFrameDuration) +{ + cameraTranslation = Ogre::Vector3::ZERO; + Ogre::Real realCameraMoveSpeed = cameraMoveSpeed * ((float)lastFrameDuration / 1000.0f); + + if(keyboard->isKeyDown(OIS::KC_LSHIFT)) + { + realCameraMoveSpeed *= 10.0; + } + + if(keyboard->isKeyDown(OIS::KC_RSHIFT)) + { + realCameraMoveSpeed *= 10.0; + } + + if(keyboard->isKeyDown(OIS::KC_PGUP)) + { + cameraTranslation.y += realCameraMoveSpeed; + } + + if(keyboard->isKeyDown(OIS::KC_PGDOWN)) + { + cameraTranslation.y -= realCameraMoveSpeed; + } + + if(keyboard->isKeyDown(OIS::KC_W)) + { + cameraTranslation.z -= realCameraMoveSpeed; + } + + if(keyboard->isKeyDown(OIS::KC_S)) + { + cameraTranslation.z += realCameraMoveSpeed; + } + + if(keyboard->isKeyDown(OIS::KC_A)) + { + cameraTranslation.x -= realCameraMoveSpeed; + } + + if(keyboard->isKeyDown(OIS::KC_D)) + { + cameraTranslation.x += realCameraMoveSpeed; + } + + if(keyboard->isKeyDown(OIS::KC_Q)) + { + cameraRotationX += cameraRotationSpeed; + } + + if(keyboard->isKeyDown(OIS::KC_E)) + { + cameraRotationX -= cameraRotationSpeed; + } + + if(keyboard->isKeyDown(OIS::KC_O)) + { + cameraRotationX = 0; + cameraRotationY = 0; + } + + const OIS::MouseState &ms = mouse->getMouseState(); + + if(ms.buttonDown(OIS::MB_Right)) + { + cameraTranslation.x += ms.X.rel * realCameraMoveSpeed; + cameraTranslation.y -= ms.Y.rel * realCameraMoveSpeed; + } + else + { + cameraRotationX = Ogre::Degree(-ms.X.rel * cameraRotationSpeed); + cameraRotationY = Ogre::Degree(-ms.Y.rel * cameraRotationSpeed); + } + + Ogre::Real pitchAngle; + Ogre::Real pitchAngleSign; + + cameraYawNode->yaw(cameraRotationX); + cameraPitchNode->pitch(cameraRotationY); + + cameraNode->translate(cameraYawNode->getOrientation() * cameraPitchNode->getOrientation() * cameraTranslation, Ogre::SceneNode::TS_LOCAL); + + pitchAngle = (2 * Ogre::Degree(Ogre::Math::ACos(cameraPitchNode->getOrientation().w)).valueDegrees()); + + pitchAngleSign = cameraPitchNode->getOrientation().x; + + if(pitchAngle > 90.0f) + { + if(pitchAngleSign > 0) + { + cameraPitchNode->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f), Ogre::Math::Sqrt(0.5f), 0, 0)); + } + else if (pitchAngleSign < 0) + { + cameraPitchNode->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f), -Ogre::Math::Sqrt(0.5f), 0, 0)); + } + } +} + +void FirstPersonCameraController::setPosition(Ogre::Vector3 position) +{ + cameraNode->setPosition(position); +} + +void FirstPersonCameraController::getPositionOrientation(Ogre::Vector3& position, Ogre::Quaternion& o... [truncated message content] |
From: <kal...@us...> - 2009-12-28 09:48:06
|
Revision: 2773 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2773&view=rev Author: kallaspriit Date: 2009-12-28 09:47:53 +0000 (Mon, 28 Dec 2009) Log Message: ----------- Updated the Minimal OgreNewt Application demo. Modified Paths: -------------- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.suo branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Application.cpp branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/PrimitiveFactory.cpp branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp Modified: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln 2009-12-26 17:31:51 UTC (rev 2772) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln 2009-12-28 09:47:53 UTC (rev 2773) @@ -2,7 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinimalOgreNewt", "MinimalOgreNewt.vcproj", "{44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OgreNewt", "C:\Ogre3D\Addons\OgreNewt\OgreNewt.vcproj", "{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -13,6 +18,10 @@ {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Debug|Win32.Build.0 = Debug|Win32 {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|Win32.ActiveCfg = Release|Win32 {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|Win32.Build.0 = Release|Win32 + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Debug|Win32.ActiveCfg = Debug|Win32 + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Debug|Win32.Build.0 = Debug|Win32 + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|Win32.ActiveCfg = Release|Win32 + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.suo =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Application.cpp =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Application.cpp 2009-12-26 17:31:51 UTC (rev 2772) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/Application.cpp 2009-12-28 09:47:53 UTC (rev 2773) @@ -289,6 +289,31 @@ body->setCenterOfMass(centerOfMass); body->setStandardForceCallback(); + + // Lets create a simple vehicle-like object + Ogre::Vector3 pos(0, 1, 8); + + // Create two frame parts + OgreNewt::Body* rearFrame = PrimitiveFactory::getSingleton().createBox("RearFrame", "Debug/Blue", 600, pos + Ogre::Vector3(0.0f, 0.0f, 1.5f), Ogre::Vector3(2.0f, 1.0f, 2.75f)); + OgreNewt::Body* frontFrame = PrimitiveFactory::getSingleton().createBox("FrontFrame", "Debug/Blue", 600, pos + Ogre::Vector3(0.0f, 0.0f, -1.5f), Ogre::Vector3(2.0f, 1.0f, 2.75f)); + + // Create the wheels + OgreNewt::Body* wheelRR = PrimitiveFactory::getSingleton().createCylinder("WheelRR", "Debug/Red", 20, pos + Ogre::Vector3(1.35f, 0.0f, 2.0f), 1.0f, 0.6f, Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Z)); + OgreNewt::Body* wheelRL = PrimitiveFactory::getSingleton().createCylinder("WheelRL", "Debug/Red", 20, pos + Ogre::Vector3(-1.35f, 0.0f, 2.0f), 1.0f, 0.6f, Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Z)); + OgreNewt::Body* wheelFR = PrimitiveFactory::getSingleton().createCylinder("WheelFR", "Debug/Red", 20, pos + Ogre::Vector3(1.35f, 0.0f, -2.0f), 1.0f, 0.6f, Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Z)); + OgreNewt::Body* wheelFL = PrimitiveFactory::getSingleton().createCylinder("WheelFL", "Debug/Red", 20, pos + Ogre::Vector3(-1.35f, 0.0f, -2.0f), 1.0f, 0.6f, Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Z)); + + // Create hinges to attach the wheels to the frame + OgreNewt::Joint* wheelRRhinge = new OgreNewt::Hinge(wheelRR, rearFrame, pos + Ogre::Vector3(1.35f, 0.0f, 2.0f), Ogre::Vector3::UNIT_X); + OgreNewt::Joint* wheelRLhinge = new OgreNewt::Hinge(wheelRL, rearFrame, pos + Ogre::Vector3(-1.35f, 0.0f, 2.0f), Ogre::Vector3::UNIT_X); + OgreNewt::Joint* wheelFRhinge = new OgreNewt::Hinge(wheelFR, frontFrame, pos + Ogre::Vector3(1.35f, 0.0f, -2.0f), Ogre::Vector3::UNIT_X); + OgreNewt::Joint* wheelFLhinge = new OgreNewt::Hinge(wheelFL, frontFrame, pos + Ogre::Vector3(-1.35f, 0.0f, -2.0f), Ogre::Vector3::UNIT_X); + + // Create a center hinge to attach the two frames and apply some limits + OgreNewt::Hinge* centerHinge = new OgreNewt::Hinge(frontFrame, rearFrame, pos, Ogre::Vector3::UNIT_Z); + centerHinge->enableLimits(true); + centerHinge->setLimits(Ogre::Degree(-60), Ogre::Degree(60)); + return true; } Modified: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/PrimitiveFactory.cpp =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/PrimitiveFactory.cpp 2009-12-26 17:31:51 UTC (rev 2772) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/source/PrimitiveFactory.cpp 2009-12-28 09:47:53 UTC (rev 2773) @@ -223,7 +223,7 @@ OgreNewt::Body* PrimitiveFactory::createCylinder(Ogre::String name, Ogre::String material, Ogre::Real mass, Ogre::Vector3 position, float radius, float height, Ogre::Quaternion orientation, OgreNewt::MaterialID* materialId, int objectId, Ogre::String mesh) { - Ogre::Vector3 scale(radius * 2, radius * 2, height); + Ogre::Vector3 scale(radius * 2, height, radius * 2); Ogre::SceneNode* node = createNode(mesh, name, material, position, scale, orientation); Modified: branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h 2009-12-26 17:31:51 UTC (rev 2772) +++ branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h 2009-12-28 09:47:53 UTC (rev 2773) @@ -89,7 +89,7 @@ void enableLimits(bool state); //! set minimum and maximum hinge limits. - void setLimis(Ogre::Radian minAngle, Ogre::Radian maxAngle); + void setLimits(Ogre::Radian minAngle, Ogre::Radian maxAngle); }; Modified: branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp 2009-12-26 17:31:51 UTC (rev 2772) +++ branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp 2009-12-28 09:47:53 UTC (rev 2773) @@ -71,7 +71,7 @@ } -void Hinge::setLimis(Ogre::Radian minAngle, Ogre::Radian maxAngle) +void Hinge::setLimits(Ogre::Radian minAngle, Ogre::Radian maxAngle) { CustomHinge* joint = (CustomHinge*) GetSupportJoint(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kal...@us...> - 2009-12-28 20:07:16
|
Revision: 2774 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2774&view=rev Author: kallaspriit Date: 2009-12-28 20:07:05 +0000 (Mon, 28 Dec 2009) Log Message: ----------- Updated project configurations. Julio updated player controller demo. Modified Paths: -------------- branches/ogrenewt/newton20/OgreNewt.suo branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.suo branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.vcproj branches/ogrenewt/newton20/demos/bin/Debug/resources.cfg branches/ogrenewt/newton20/demos/bin/Release/resources.cfg branches/ogrenewt/newton20/demos/media/primitives/box.mesh branches/ogrenewt/newton20/demos/media/primitives/ellipsoid.mesh Added Paths: ----------- branches/ogrenewt/newton20/demos/bin/Debug/Demo_MinimalOgreNewt.bat branches/ogrenewt/newton20/demos/bin/Release/Demo_MinimalOgreNewt.bat branches/ogrenewt/newton20/demos/media/materials/scripts/chiropteradm.material branches/ogrenewt/newton20/demos/media/materials/scripts/primitives.material branches/ogrenewt/newton20/demos/media/models/chiropteradm.mesh branches/ogrenewt/newton20/demos/media/primitives/textures/BumpyMetal.jpg branches/ogrenewt/newton20/demos/media/primitives/textures/blinkyde.tga branches/ogrenewt/newton20/demos/media/primitives/textures/carpet4_w.tga branches/ogrenewt/newton20/demos/media/primitives/textures/floor_.tga branches/ogrenewt/newton20/demos/media/primitives/textures/icon.tga branches/ogrenewt/newton20/demos/media/primitives/textures/newtonLogo.tga branches/ogrenewt/newton20/demos/media/primitives/textures/oldmetal.tga branches/ogrenewt/newton20/demos/media/primitives/textures/ornament1_.tga branches/ogrenewt/newton20/demos/media/primitives/textures/ornament2_.tga branches/ogrenewt/newton20/demos/media/primitives/textures/tiles.tga branches/ogrenewt/newton20/demos/media/primitives/textures/wall_4.tga branches/ogrenewt/newton20/demos/media/primitives/textures/wall_7.tga branches/ogrenewt/newton20/demos/media/primitives/textures/wall_8.tga branches/ogrenewt/newton20/demos/media/primitives/textures/wall_9.tga branches/ogrenewt/newton20/demos/media/primitives/textures/wall_p.tga branches/ogrenewt/newton20/demos/media/primitives/textures/wall_w.tga Removed Paths: ------------- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/INSTALL.txt Modified: branches/ogrenewt/newton20/OgreNewt.suo =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-12-28 09:47:53 UTC (rev 2773) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) @@ -89,7 +89,7 @@ box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "ellipsoid.mesh" ); box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); box1node->attachObject( box1 ); - box1node->setScale( size ); + box1node->setScale( size * (1.0f / 0.5f)); OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, size, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); @@ -230,7 +230,7 @@ // create a hinge with limits joint = new OgreNewt::Hinge( child, parent, pos+Ogre::Vector3(size.x/2, 0, 0), Ogre::Vector3(0, 1, 0)); joint->enableLimits(true); - joint->setLimis(minAngle, maxAngle); + joint->setLimits(minAngle, maxAngle); // offset pos a little more. pos -= Ogre::Vector3(size.x,0,0); Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-12-28 09:47:53 UTC (rev 2773) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-12-28 20:07:05 UTC (rev 2774) @@ -99,7 +99,7 @@ ent->setMaterialName( "Simple/dirt01" ); // ent->setNormaliseNormals(true); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1), 0 )); + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(0.5f, 0.5f, 0.5f), 0 )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR Modified: branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp 2009-12-28 09:47:53 UTC (rev 2773) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) @@ -1,258 +1,205 @@ -/* - OgreNewt library - connecting Ogre and Newton! - - Demo09_PlayerController -*/ -#include "OgreNewtonApplication.h" -#include "OgreNewtonFrameListener.h" - -#include <OgreNewt.h> -#include <OgreNewt_BasicFrameListener.h> - - -OgreNewtonApplication::OgreNewtonApplication(void) -{ - // create OgreNewt world. - m_World = new OgreNewt::World(); - mPlayer = NULL; - - mEntityCount = 0; - -} - -OgreNewtonApplication::~OgreNewtonApplication(void) -{ - // destroy world. - if( mPlayer ) - delete mPlayer; - delete m_World; -} - - - -void OgreNewtonApplication::createScene() -{ - - // setup CEGUI - mGUIRenderer = new CEGUI::OgreCEGUIRenderer( mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr ); - new CEGUI::System( mGUIRenderer ); - - // load up CEGUI stuff... - try - { - using namespace CEGUI; - CEGUI::Logger::getSingleton().setLoggingLevel( CEGUI::Informative ); - - CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme"); - CEGUI::System::getSingleton().setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow"); - CEGUI::System::getSingleton().setDefaultFont((CEGUI::utf8*)"BlueHighway-10"); - - CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().createWindow( (CEGUI::utf8*)"DefaultWindow", (CEGUI::utf8*)"root_wnd" ); - CEGUI::System::getSingleton().setGUISheet( sheet ); - - //makeGUI(); - //setupGUI(); - - } - catch (CEGUI::Exception) - {} - - - // sky box. - mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); - - // shadows on! - mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_ADDITIVE ); - - - // floor object! - Entity* floor; - SceneNode* floornode; - floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); - floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); - floornode->attachObject( floor ); - floor->setMaterialName( "Simple/BeachStones" ); - floor->setCastShadows( false ); - - - - - //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - delete col; -#endif - - //floornode->setScale( siz ); - bod->attachNode( floornode ); - bod->setPositionOrientation( Ogre::Vector3(0.0,-10.0,0.0), Ogre::Quaternion::IDENTITY ); - - - // make a simple rope. - Ogre::Vector3 size(3,1.0,1.0); - Ogre::Vector3 pos(0,1,0); - Ogre::Quaternion orient = Ogre::Quaternion::IDENTITY; - - // loop through, making bodies and connecting them. - OgreNewt::Body* parent = NULL; - OgreNewt::Body* child = NULL; -/* - for (int x=0;x<8;x++) - { - // make the next box. - child = makeSimpleBox(size, pos, orient); - - // now make a new joint connecting this to the last box. - OgreNewt::Joint* joint; - - // make the joint right between the bodies... - - - if (parent) - { - joint = new OgreNewt::BallAndSocket( child, parent, pos-Ogre::Vector3(size.x/2,0,0) ); - } - else - { - // no parent, this is the first joint, so just pass NULL as the parent, to stick it to the "world" - joint = new OgreNewt::BallAndSocket( child, NULL, pos-Ogre::Vector3(size.x/2,0,0) ); - } - - // offset pos a little more. - pos += Ogre::Vector3(size.x,0,0); - - // save the last body for the next loop! - parent = child; - } - - for (int i=0; i<15;i++) - { - pos = Ogre::Vector3( 10-rand()%20, 4+rand()%2, 10-rand()%20 ); - size = Ogre::Vector3( 1+rand()%3, 1+rand()%3, 1+rand()%3 ); - - OgreNewt::Body* bod = makeSimpleBox( size, pos, orient ); - } - - - // player playground - - bod = NULL; - for( int i = 0; i < 20; i++ ) - { - bod = makeSimpleBox( Ogre::Vector3(4.0, 0.4, 1.0), Ogre::Vector3(15.0, -10.0+i*0.4, -2.0-i*0.4), Ogre::Quaternion::IDENTITY); - bod->setMassMatrix(0, Ogre::Vector3::ZERO); - } - - bod = makeSimpleBox( Ogre::Vector3(10.0, 0.4, 10.0), Ogre::Vector3(-17.0, -8.0, -15.0), Ogre::Quaternion(Ogre::Degree(60), Ogre::Vector3::UNIT_X)); - bod->setMassMatrix(0, Ogre::Vector3::ZERO); - - bod = makeSimpleBox( Ogre::Vector3(10.0, 0.4, 10.0), Ogre::Vector3(-27.0, -8.5, -15.0), Ogre::Quaternion(Ogre::Degree(20), Ogre::Vector3::UNIT_X)); - bod->setMassMatrix(0, Ogre::Vector3::ZERO); - - bod = makeSimpleBox( Ogre::Vector3(10.0, 0.4, 10.0), Ogre::Vector3(-37.0, -8.0, -15.0), Ogre::Quaternion(Ogre::Degree(80), Ogre::Vector3::UNIT_Y) * Ogre::Quaternion(Ogre::Degree(50), Ogre::Vector3::UNIT_X)); - bod->setMassMatrix(0, Ogre::Vector3::ZERO); -*/ - makePlayer(); - - - // position camera - mCamera->setPosition(0.0, -3.0, 23.0); - - //make a light - Ogre::Light* light; - - light = mSceneMgr->createLight( "Light1" ); - light->setType( Ogre::Light::LT_POINT ); - light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); - - - -} - - -void OgreNewtonApplication::createFrameListener() -{ - mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World, mPlayer); - mRoot->addFrameListener(mFrameListener); - - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); -} - -void OgreNewtonApplication::destroyScene() -{ - CEGUI::System* sys = CEGUI::System::getSingletonPtr(); - delete sys; - - // CEGUI Cleanup - delete mGUIRenderer; -} - - -OgreNewt::Body* OgreNewtonApplication::makeSimpleBox( const Ogre::Vector3& size, const Ogre::Vector3& pos, const Ogre::Quaternion& orient ) -{ - Entity* box1; - SceneNode* box1node; - - box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "box.mesh" ); - box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - box1node->attachObject( box1 ); - box1node->setScale( size ); - - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); - - - // base mass on the size of the object. - Ogre::Real mass = size.x * size.y * size.z * 2.5; - // calculate the inertia based on box formula and mass - Ogre::Vector3 inertia, offset; - col->calculateInertialMatrix(inertia, offset); - -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - delete col; -#endif - - bod->attachNode( box1node ); - bod->setMassMatrix( mass, mass*inertia ); - bod->setCenterOfMass(offset); - bod->setStandardForceCallback(); - - box1->setMaterialName( "Simple/BumpyMetal" ); - - - bod->setPositionOrientation( pos, orient ); - - return bod; -} - -void OgreNewtonApplication::makePlayer() -{ - Entity* ellipsoid; - SceneNode* node; - - ellipsoid = mSceneMgr->createEntity( "PlayerControllerEntity", "ellipsoid.mesh"); - node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - node->attachObject( ellipsoid ); - node->setScale(Ogre::Vector3(1,2.5,1)); - - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,2.5,1), 0 )); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); - Ogre::Vector3 inertia, offset; - col->calculateInertialMatrix(inertia, offset); -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - delete col; -#endif - bod->attachNode(node); - bod->setMassMatrix( 50, 50*inertia ); - bod->setCenterOfMass(offset); - bod->setStandardForceCallback(); - - ellipsoid->setMaterialName("Simple/dirt01"); - - bod->setPositionOrientation(Ogre::Vector3(0,20,20), Ogre::Quaternion::IDENTITY); - - mPlayer = new OgreNewt::PlayerController(bod, 0.4); -} - +/* + OgreNewt library - connecting Ogre and Newton! + + Demo09_PlayerController +*/ +#include "OgreNewtonApplication.h" +#include "OgreNewtonFrameListener.h" + +#include <OgreNewt.h> +#include <OgreNewt_BasicFrameListener.h> + + +OgreNewtonApplication::OgreNewtonApplication(void) +{ + // create OgreNewt world. + m_World = new OgreNewt::World(); + mPlayer = NULL; + + mEntityCount = 0; + +} + +OgreNewtonApplication::~OgreNewtonApplication(void) +{ + // destroy world. + if( mPlayer ) + delete mPlayer; + delete m_World; +} + + + +void OgreNewtonApplication::createScene() +{ + + // setup CEGUI + mGUIRenderer = new CEGUI::OgreCEGUIRenderer( mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr ); + new CEGUI::System( mGUIRenderer ); + + // load up CEGUI stuff... + try + { + using namespace CEGUI; + CEGUI::Logger::getSingleton().setLoggingLevel( CEGUI::Informative ); + + CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme"); + CEGUI::System::getSingleton().setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow"); + CEGUI::System::getSingleton().setDefaultFont((CEGUI::utf8*)"BlueHighway-10"); + + CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().createWindow( (CEGUI::utf8*)"DefaultWindow", (CEGUI::utf8*)"root_wnd" ); + CEGUI::System::getSingleton().setGUISheet( sheet ); + + //makeGUI(); + //setupGUI(); + + } + catch (CEGUI::Exception) + {} + + + // sky box. + mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); + + // shadows on! + mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_ADDITIVE ); + + + // floor object! + Entity* floor; + SceneNode* floornode; + //floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); + floor = mSceneMgr->createEntity("Floor", "castle.mesh" ); +// floor = mSceneMgr->createEntity("Floor", "chiropteradm.mesh" ); +// floor = mSceneMgr->createEntity("Floor", "playground.mesh" ); + + floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); + floornode->attachObject( floor ); +// floor->setMaterialName( "Simple/BeachStones" ); + floor->setCastShadows( false ); + + + + //Ogre::Vector3 siz(100.0, 10.0, 100.0); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + //floornode->setScale( siz ); + bod->attachNode( floornode ); + bod->setPositionOrientation( Ogre::Vector3(0.0f, 0.0f, 0.0f), Ogre::Quaternion::IDENTITY ); + + makePlayer(); + + // position camera + mCamera->setPosition(0.0f, 1.0f, 0.0f); + + + // set the near and far clip plane + mCamera->setNearClipDistance(0.2f); + mCamera->setFarClipDistance(1000.0f); + + + //make a light + Ogre::Light* light; + + light = mSceneMgr->createLight( "Light1" ); + light->setType( Ogre::Light::LT_POINT ); + light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); +} + + +void OgreNewtonApplication::createFrameListener() +{ + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World, mPlayer); + mRoot->addFrameListener(mFrameListener); + + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); + mRoot->addFrameListener(mNewtonListener); +} + +void OgreNewtonApplication::destroyScene() +{ + CEGUI::System* sys = CEGUI::System::getSingletonPtr(); + delete sys; + + // CEGUI Cleanup + delete mGUIRenderer; +} + + +OgreNewt::Body* OgreNewtonApplication::makeSimpleBox( const Ogre::Vector3& size, const Ogre::Vector3& pos, const Ogre::Quaternion& orient ) +{ + Entity* box1; + SceneNode* box1node; + + box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "box.mesh" ); + box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + box1node->attachObject( box1 ); + box1node->setScale( size ); + + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + + + // base mass on the size of the object. + Ogre::Real mass = size.x * size.y * size.z * 2.5; + // calculate the inertia based on box formula and mass + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + bod->attachNode( box1node ); + bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + box1->setMaterialName( "Simple/BumpyMetal" ); + + + bod->setPositionOrientation( pos, orient ); + + return bod; +} + +void OgreNewtonApplication::makePlayer() +{ + Entity* ellipsoid; + SceneNode* node; + + ellipsoid = mSceneMgr->createEntity( "PlayerControllerEntity", "ellipsoid.mesh"); + node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + node->attachObject( ellipsoid ); + Ogre::Vector3 size (1.0, 2.5, 1.0f); + node->setScale(size); + + OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, size * 0.5f, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + bod->attachNode(node); + bod->setMassMatrix( 50, 50*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + ellipsoid->setMaterialName("Simple/dirt01"); + +// bod->setPositionOrientation(Ogre::Vector3(0,20,20), Ogre::Quaternion::IDENTITY); +// bod->setPositionOrientation(Ogre::Vector3(6.74f, -6.0f, -8.2f), Ogre::Quaternion::IDENTITY); + bod->setPositionOrientation(Ogre::Vector3(0.0f, 1.0f, 0.0f), Ogre::Quaternion::IDENTITY); + + // set teh play to alway be actibe + bod->setAutoSleep(0); + mPlayer = new OgreNewt::PlayerController(bod, 0.4); + + +} + Deleted: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/INSTALL.txt =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/INSTALL.txt 2009-12-28 09:47:53 UTC (rev 2773) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/INSTALL.txt 2009-12-28 20:07:05 UTC (rev 2774) @@ -1,62 +0,0 @@ -INSTALLATION - -This package includes the release build, so you can see what you are dealing with. Debug build and -dll's are not included. - -1. Get Ogre - - http://www.ogre3d.org/ - - Get precompiled libraries - - Or compile yourself - - Set enviroment variable "OGRE_HOME" to ogre home directory - > for example "C:\Ogre3D" - > includes will be searched in $(OGRE_HOME)\OgreMain\include - -2. Get latest Boost C++ libraries - - http://www.boost.org/ - - Just install anywhere - - Set enviroment variable "BOOST_HOME" to boost directory - > for example "C:\Boost" - -3. Get Newton Game Dynamics - - http://newtondynamics.com/forum/ - > there is a "Newton 2 BETA" link at the top, this may change in the future, but you'll find it - - Install it - - Set enviroment variable "NEWTON_HOME" to install directory - > for example "C:\NDG\2.15" - -4. Get OgreNewt - - Latest can be downloaded from SVN at https://svn.ogre3d.org/svnroot/ogreaddons/branches/ogrenewt/newton20 - > you can't download from this url using your browser, you need to use SVN client - > for example, use GUI SVN client TortoiseSVN (http://tortoisesvn.tigris.org/) - > google how to use it, basically just download and istall it, make a folder for ogrenewt, right click the - folder, choose "SVN Checkout...", enter the SVN url above and do the checkout. - - The OgreNewt Visual studio project is a bit messed up, you can use the one that comes with this project - in "ogrenewt" directory. Just copy the solution and project files to the folder you checked out ogrenewt, - overwrite existing files and open the solution. The modified project uses the enviroment variables you - defined above so everything should compile without any changes to the project (may not be the case if you - did not compile Ogre yourself, you might have to change the include and library directories). - - Set enviroment variable "OGRENEWT_HOME" to OgreNewt root directory - > for example "C:\Ogre3D\Addons\OgreNewt" - -5. Copy DLLs - - If everything is set up right, the dll's will be automaticly copied to the right location, if not: - - Copy OgreMain.dll, Plugin_CgProgramManager.dll, Plugin_OctreeSceneManager.dll, RenderSystem_Direct3D9.dll, - RenderSystem_GL.dll from OGRE_HOME\lib directory to this projects' root directory - - Copy OgreMain_d.dll, Plugin_CgProgramManager_d.dll, Plugin_OctreeSceneManager_d.dll, RenderSystem_Direct3D9_d.dll, - RenderSystem_GL_d.dll from OGRE_HOME\lib directory to this projects' root directory if you also want to - use debug mode - - Copy cg.dll and OIS.dll from OGRE_HOME\Samples\Common\bin\Release (and OIS_d.dll from OGRE_HOME\Samples\Common\bin\Debug - for debug) to project root directory - - Copy newton.dll from NEWTON_HOME\sdk\x32\dll_vs9 to project root directory - - Copy OgreNewt.dll (and OgreNewt_d.dll for debug) from OGRENEWT_HOME\lib to project root directory - -6. Compile the application - - Open NGD.sln, choose Release or Debug configuration and hit Compile (F7) - - Release configuration compiles to release.exe and debug to.. you guessed it, debug.exe - - If I got this tutorial right and you did everything correctly, it should compile out of the box and work! - -7. Experiment - - The code provided is pretty much the minimum for a working application with input and debugging - - No Ogre sample framework is used - - The code has not been organised to great depth to make the learning curve simpler. You can modify it to - use better organization, state managment and so on. \ No newline at end of file Modified: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln 2009-12-28 09:47:53 UTC (rev 2773) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.sln 2009-12-28 20:07:05 UTC (rev 2774) @@ -6,7 +6,7 @@ {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OgreNewt", "C:\Ogre3D\Addons\OgreNewt\OgreNewt.vcproj", "{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OgreNewt", "..\..\OgreNewt.vcproj", "{C28C7710-76B1-4FFD-A85A-9AEFDA25EE64}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Modified: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.suo =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.vcproj 2009-12-28 09:47:53 UTC (rev 2773) +++ branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/MinimalOgreNewt.vcproj 2009-12-28 20:07:05 UTC (rev 2774) @@ -19,13 +19,13 @@ <Configuration Name="Debug|Win32" OutputDirectory="." - IntermediateDirectory="obj\debug" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" ConfigurationType="1" CharacterSet="2" > <Tool Name="VCPreBuildEventTool" - CommandLine="copy $(OGRENEWT_HOME)\lib\OgreNewt_d.dll $(OutDir)\OgreNewt_d.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" "$(OutDir)\OgreMain_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" "$(OutDir)\OIS_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" "$(OutDir)\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" "$(OutDir)\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" "$(OutDir)\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" "$(OutDir)\cg.dll"

if exist "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" "$(OutDir)\OgreMain_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OIS_d.dll" copy "$(OGRE_HOME)\bin\debug\OIS_d.dll" demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\bin\debug\cg.dll" copy "$(OGRE_HOME)\bin\debug\cg.dll" demos\bin\Debug\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll $(OutDir)\newton.dll
copy $(NEWTON_HOME)\sdk\x32\JointLibrary_d.dll $(OutDir)\JointLibrary_d.dll
" + CommandLine="copy ..\..\lib\OgreNewt_d.dll $(OutDir)\OgreNewt_d.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OgreMain_d.dll" "$(OutDir)\OgreMain_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\OIS_d.dll" "$(OutDir)\OIS_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\Plugin_CgProgramManager_d.dll" "$(OutDir)\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_Direct3D9_d.dll" "$(OutDir)\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\RenderSystem_GL_d.dll" "$(OutDir)\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Debug\cg.dll" "$(OutDir)\cg.dll"

if exist "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" copy "$(OGRE_HOME)\bin\debug\OgreMain_d.dll" "$(OutDir)\OgreMain_d.dll"
if exist "$(OGRE_HOME)\bin\debug\OIS_d.dll" copy "$(OGRE_HOME)\bin\debug\OIS_d.dll" demos\bin\Debug\OIS_d.dll"
if exist "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" copy "$(OGRE_HOME)\bin\debug\Plugin_CgProgramManager_d.dll" demos\bin\Debug\Plugin_CgProgramManager_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_Direct3D9_d.dll" demos\bin\Debug\RenderSystem_Direct3D9_d.dll"
if exist "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" copy "$(OGRE_HOME)\bin\debug\RenderSystem_GL_d.dll" demos\bin\Debug\RenderSystem_GL_d.dll"
if exist "$(OGRE_HOME)\bin\debug\cg.dll" copy "$(OGRE_HOME)\bin\debug\cg.dll" demos\bin\Debug\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll $(OutDir)\newton.dll
copy $(NEWTON_HOME)\sdk\x32\JointLibrary_d.dll $(OutDir)\JointLibrary_d.dll
" /> <Tool Name="VCCustomBuildTool" @@ -42,7 +42,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";.\include" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";..\..\inc;.\include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;OIS_DYNAMIC_LIB" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -64,8 +64,8 @@ Name="VCLinkerTool" AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreNewt_d.lib" OutputFile="$(OutDir)\debug.exe" - LinkIncremental="2" - AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + LinkIncremental="1" + AdditionalLibraryDirectories="..\..\lib;"$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1" @@ -95,14 +95,14 @@ <Configuration Name="Release|Win32" OutputDirectory="." - IntermediateDirectory="obj\release" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" ConfigurationType="1" CharacterSet="2" WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" - CommandLine="copy $(OGRENEWT_HOME)\lib\OgreNewt.dll $(OutDir)\OgreNewt.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" "$(OutDir)\OgreMain.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" "$(OutDir)\OIS.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" "$(OutDir)\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" "$(OutDir)\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" "$(OutDir)\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" "$(OutDir)\cg.dll"

if exist "$(OGRE_HOME)\bin\release\OgreMain.dll" copy "$(OGRE_HOME)\bin\release\OgreMain.dll" "$(OutDir)\OgreMain.dll"
if exist "$(OGRE_HOME)\bin\release\OIS.dll" copy "$(OGRE_HOME)\bin\release\OIS.dll" "$(OutDir)\OIS.dll"
if exist "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" "$(OutDir)\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" "$(OutDir)\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" "$(OutDir)\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\bin\release\cg.dll" copy "$(OGRE_HOME)\bin\release\cg.dll" "$(OutDir)\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll $(OutDir)\newton.dll
copy $(NEWTON_HOME)\sdk\x32\JointLibrary.dll $(OutDir)\JointLibrary.dll
" + CommandLine="copy ..\..\lib\OgreNewt.dll $(OutDir)\OgreNewt.dll

if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OgreMain.dll" "$(OutDir)\OgreMain.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\OIS.dll" "$(OutDir)\OIS.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\Plugin_CgProgramManager.dll" "$(OutDir)\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_Direct3D9.dll" "$(OutDir)\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\RenderSystem_GL.dll" "$(OutDir)\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" copy "$(OGRE_HOME)\Samples\Common\bin\Release\cg.dll" "$(OutDir)\cg.dll"

if exist "$(OGRE_HOME)\bin\release\OgreMain.dll" copy "$(OGRE_HOME)\bin\release\OgreMain.dll" "$(OutDir)\OgreMain.dll"
if exist "$(OGRE_HOME)\bin\release\OIS.dll" copy "$(OGRE_HOME)\bin\release\OIS.dll" "$(OutDir)\OIS.dll"
if exist "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" copy "$(OGRE_HOME)\bin\release\Plugin_CgProgramManager.dll" "$(OutDir)\Plugin_CgProgramManager.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_Direct3D9.dll" "$(OutDir)\RenderSystem_Direct3D9.dll"
if exist "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" copy "$(OGRE_HOME)\bin\release\RenderSystem_GL.dll" "$(OutDir)\RenderSystem_GL.dll"
if exist "$(OGRE_HOME)\bin\release\cg.dll" copy "$(OGRE_HOME)\bin\release\cg.dll" "$(OutDir)\cg.dll"

copy $(NEWTON_HOME)\sdk\x32\dll_vs9\newton.dll $(OutDir)\newton.dll
copy $(NEWTON_HOME)\sdk\x32\JointLibrary.dll $(OutDir)\JointLibrary.dll
" /> <Tool Name="VCCustomBuildTool" @@ -120,7 +120,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRENEWT_HOME)\inc";.\include" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";..\..\inc;.\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;OIS_DYNAMIC_LIB;" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -142,7 +142,7 @@ AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreNewt.lib" OutputFile="$(OutDir)\release.exe" LinkIncremental="1" - AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(OGRENEWT_HOME)\lib";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + AdditionalLibraryDirectories="..\..\lib;"$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" Added: branches/ogrenewt/newton20/demos/bin/Debug/Demo_MinimalOgreNewt.bat =================================================================== --- branches/ogrenewt/newton20/demos/bin/Debug/Demo_MinimalOgreNewt.bat (rev 0) +++ branches/ogrenewt/newton20/demos/bin/Debug/Demo_MinimalOgreNewt.bat 2009-12-28 20:07:05 UTC (rev 2774) @@ -0,0 +1,2 @@ +cd ..\..\MinimalOgreNewtApplication +debug.exe \ No newline at end of file Modified: branches/ogrenewt/newton20/demos/bin/Debug/resources.cfg =================================================================== --- branches/ogrenewt/newton20/demos/bin/Debug/resources.cfg 2009-12-28 09:47:53 UTC (rev 2773) +++ branches/ogrenewt/newton20/demos/bin/Debug/resources.cfg 2009-12-28 20:07:05 UTC (rev 2774) @@ -3,6 +3,7 @@ FileSystem=../../media/GUI/schemes FileSystem=../../media/GUI/imagesets FileSystem=../../media/GUI/fonts + FileSystem=../../media/fonts FileSystem=../../media/materials/scripts FileSystem=../../media/materials/textures Added: branches/ogrenewt/newton20/demos/bin/Release/Demo_MinimalOgreNewt.bat =================================================================== --- branches/ogrenewt/newton20/demos/bin/Release/Demo_MinimalOgreNewt.bat (rev 0) +++ branches/ogrenewt/newton20/demos/bin/Release/Demo_MinimalOgreNewt.bat 2009-12-28 20:07:05 UTC (rev 2774) @@ -0,0 +1,2 @@ +cd ..\..\MinimalOgreNewtApplication +release.exe \ No newline at end of file Modified: branches/ogrenewt/newton20/demos/bin/Release/resources.cfg =================================================================== --- branches/ogrenewt/newton20/demos/bin/Release/resources.cfg 2009-12-28 09:47:53 UTC (rev 2773) +++ branches/ogrenewt/newton20/demos/bin/Release/resources.cfg 2009-12-28 20:07:05 UTC (rev 2774) @@ -3,6 +3,7 @@ FileSystem=../../media/GUI/schemes FileSystem=../../media/GUI/imagesets FileSystem=../../media/GUI/fonts + FileSystem=../../media/fonts FileSystem=../../media/materials/scripts FileSystem=../../media/materials/textures Added: branches/ogrenewt/newton20/demos/media/materials/scripts/chiropteradm.material =================================================================== --- branches/ogrenewt/newton20/demos/media/materials/scripts/chiropteradm.material (rev 0) +++ branches/ogrenewt/newton20/demos/media/materials/scripts/chiropteradm.material 2009-12-28 20:07:05 UTC (rev 2774) @@ -0,0 +1,1178 @@ + +material chiropteradm000 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture lig_b064-01b.jpg + } + } + + } + +} + +material chiropteradm001 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-01d.jpg + } + } + + } + +} + +material chiropteradm002 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 064-03b.jpg + } + } + + } + +} + +material chiropteradm003 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture lig_064-02w1.jpg + } + } + + } + +} + +material chiropteradm004 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture stone03a.jpg + } + } + + } + +} + +material chiropteradm005 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block02a.jpg + } + } + + } + +} + +material chiropteradm006 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 064-04b.jpg + } + } + + } + +} + +material chiropteradm007 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 032-04c.jpg + } + } + + } + +} + +material chiropteradm008 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-03b.jpg + } + } + + } + +} + +material chiropteradm009 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-02a.jpg + } + } + + } + +} + +material chiropteradm010 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture stone04d.jpg + } + } + + } + +} + +material chiropteradm011 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block01a.jpg + } + } + + } + +} + +material chiropteradm012 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-02c.jpg + } + } + + } + +} + +material chiropteradm013 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture lig_b064-01c.jpg + } + } + + } + +} + +material chiropteradm014 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-02b.jpg + } + } + + } + +} + +material chiropteradm015 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v128-02d.jpg + } + } + + } + +} + +material chiropteradm016 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v128-02a.jpg + } + } + + } + +} + +material chiropteradm017 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture stone05a.jpg + } + } + + } + +} + +material chiropteradm018 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 032-01a.jpg + } + } + + } + +} + +material chiropteradm019 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-03e.jpg + } + } + + } + +} + +material chiropteradm020 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v128-04d.jpg + } + } + + } + +} + +material chiropteradm021 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v128-01a.jpg + } + } + + } + +} + +material chiropteradm022 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture s128-02a.jpg + } + } + + } + +} + +material chiropteradm023 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 128-01a.jpg + } + } + + } + +} + +material chiropteradm024 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 032-01b.jpg + } + } + + } + +} + +material chiropteradm025 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block02b.jpg + } + } + + } + +} + +material chiropteradm026 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 128-comb1.jpg + } + } + + } + +} + +material chiropteradm027 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block02c.jpg + } + } + + } + +} + +material chiropteradm028 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture s128-02b.jpg + } + } + + } + +} + +material chiropteradm029 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block01d.jpg + } + } + + } + +} + +material chiropteradm030 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture grate1a.jpg + } + } + + } + +} + +material chiropteradm031 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v128-03c.jpg + } + } + + } + +} + +material chiropteradm032 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture lig_v192-01ba.jpg + } + } + + } + +} + +material chiropteradm033 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 032-03b.jpg + } + } + + } + +} + +material chiropteradm034 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture stone03d.jpg + } + } + + } + +} + +material chiropteradm035 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 032-04d.jpg + } + } + + } + +} + +material chiropteradm036 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture zbighouse-logo.jpg + } + } + + } + +} + +material chiropteradm037 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block01c.jpg + } + } + + } + +} + +material chiropteradm038 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block02d.jpg + } + } + + } + +} + +material chiropteradm039 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture nnk05stone.jpg + } + } + + } + +} + +material chiropteradm040 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 032-03a.jpg + } + } + + } + +} + +material chiropteradm041 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-02d.jpg + } + } + + } + +} + +material chiropteradm042 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v096-01c.jpg + } + } + + } + +} + +material chiropteradm043 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture sand1b.jpg + } + } + + } + +} + +material chiropteradm044 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v128-02b.jpg + } + } + + } + +} + +material chiropteradm045 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 256-03a.jpg + } + } + + } + +} + +material chiropteradm046 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block01b.jpg + } + } + + } + +} + +material chiropteradm047 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-01a.jpg + } + } + + } + +} + +material chiropteradm048 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture stone03c.jpg + } + } + + } + +} + +material chiropteradm049 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block06b.jpg + } + } + + } + +} + +material chiropteradm050 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture lig_064-02b1.jpg + } + } + + } + +} + +material chiropteradm051 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 096-01c.jpg + } + } + + } + +} + +material chiropteradm052 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 064-02c.jpg + } + } + + } + +} + +material chiropteradm053 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture v064-01c.jpg + } + } + + } + +} + +material chiropteradm054 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture stone04a.jpg + } + } + + } + +} + +material chiropteradm055 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture zbatcula-logo.jpg + } + } + + } + +} + +material chiropteradm056 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture lig_b064-01a.jpg + } + } + + } + +} + +material chiropteradm057 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 128-03a.jpg + } + } + + } + +} + +material chiropteradm058 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 064-01b.jpg + } + } + + } + +} + +material chiropteradm059 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture block06a.jpg + } + } + + } + +} + +material chiropteradm060 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 064-01c.jpg + } + } + + } + +} + +material chiropteradm061 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture 064-02b.jpg + } + } + + } + +} Added: branches/ogrenewt/newton20/demos/media/materials/scripts/primitives.material =================================================================== --- branches/ogrenewt/newton20/demos/media/materials/scripts/primitives.material (rev 0) +++ branches/ogrenewt/newton20/demos/media/materials/scripts/primitives.material 2009-12-28 20:07:05 UTC (rev 2774) @@ -0,0 +1,38 @@ +material ellipsoid000 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture wood.tga + } + } + + } + +} + + +material box000 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture BumpyMetal.jpg + } + } + + } + +} \ No newline at end of file Added: branches/ogrenewt/newton20/demos/media/models/chiropteradm.mesh =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/models/chiropteradm.mesh ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogrenewt/newton20/demos/media/primitives/box.mesh =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/demos/media/primitives/ellipsoid.mesh =================================================================== (Binary files differ) Added: branches/ogrenewt/newton20/demos/media/primitives/textures/BumpyMetal.jpg =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/BumpyMetal.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/blinkyde.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/blinkyde.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/carpet4_w.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/carpet4_w.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/floor_.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/floor_.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/icon.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/icon.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/newtonLogo.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/newtonLogo.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/oldmetal.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/oldmetal.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/ornament1_.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/ornament1_.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/ornament2_.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/ornament2_.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/tiles.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/tiles.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_4.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_4.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_7.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_7.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_8.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_8.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_9.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_9.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_p.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_p.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_w.tga =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/primitives/textures/wall_w.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kal...@us...> - 2009-12-30 15:20:31
|
Revision: 2775 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2775&view=rev Author: kallaspriit Date: 2009-12-30 15:20:22 +0000 (Wed, 30 Dec 2009) Log Message: ----------- Many updates by Julio to OgreNewt core and player controller Modified Paths: -------------- branches/ogrenewt/newton20/OgreNewt.suo branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/box.mesh branches/ogrenewt/newton20/demos/media/materials/scripts/primitives.material branches/ogrenewt/newton20/demos/media/models/chiropteradm.mesh branches/ogrenewt/newton20/demos/media/packs/OgreCore.zip branches/ogrenewt/newton20/demos/media/primitives/box.mesh branches/ogrenewt/newton20/demos/media/primitives/castle.mesh branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h branches/ogrenewt/newton20/inc/OgreNewt_Body.h branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h branches/ogrenewt/newton20/inc/OgreNewt_Joint.h branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h branches/ogrenewt/newton20/inc/OgreNewt_World.h branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp branches/ogrenewt/newton20/src/OgreNewt_Body.cpp branches/ogrenewt/newton20/src/OgreNewt_CollisionSerializer.cpp branches/ogrenewt/newton20/src/OgreNewt_Joint.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_World.cpp Added Paths: ----------- branches/ogrenewt/newton20/demos/media/materials/scripts/box.material branches/ogrenewt/newton20/demos/media/materials/scripts/ellipsoid.material branches/ogrenewt/newton20/demos/media/materials/textures/cursor.png Property Changed: ---------------- branches/ogrenewt/newton20/demos/bin/Debug/ branches/ogrenewt/newton20/demos/bin/Release/ Modified: branches/ogrenewt/newton20/OgreNewt.suo =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo01_TheBasics/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -89,14 +89,14 @@ void OgreNewtonApplication::createFrameListener() { + // this is a basic frame listener included with OgreNewt that does nothing but update the + // physics at a set framerate for you. complex project will want more control, but this + // works for simple demos like this. feel free to look at the source to see how it works. + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); + // this is our custom frame listener for this app, that lets us shoot cylinders with the space bar, move // the camera, etc. mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - - // this is a basic frame listener included with OgreNewt that does nothing but update the - // physics at a set framerate for you. complex project will want more control, but this - // works for simple demos like this. feel free to look at the source to see how it works. - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -33,11 +33,11 @@ void OgreNewtonApplication::createFrameListener() { + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -11,17 +11,21 @@ timer = 0.0f; OgreNewt::Debugger &debug(m_World->getDebugger()); debug.init(mgr); + } OgreNewtonFrameListener::~OgreNewtonFrameListener(void) { } -void OgreNewtonFrameListener::moveCamera() -{ + +bool OgreNewtonFrameListener::frameRenderingQueued(const FrameEvent& evt) +{ + return true; } + bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) { Real timestep; @@ -29,11 +33,6 @@ Ogre::Root* root = Singleton<Ogre::Root>::getSingletonPtr(); -// static long firstTime = root->getTimer()->getMicrosecondsCPU(); -// long newTime = root->getTimer()->getMicrosecondsCPU(); -// timestep = Real (newTime - firstTime) / 1.0e6f; -// firstTime = newTime; - timestep = evt.timeSinceLastFrame; Vector3 trans (0.0, 0.0, - speed * timestep); Vector3 strafe (speed * timestep, 0.0, 0.0); @@ -42,21 +41,20 @@ mMouse->capture(); if (mMouse->getMouseState().buttonDown(OIS::MB_Left)) { - static Real pitch (0.0); - static Real yaw (0.0); + static Ogre::Real pitch (0.0); + static Ogre::Real yaw (0.0); Real rate = (45.0f * 3.1416f/ 180.0f) * timestep; - - int yawDir = mMouse->getMouseState().X.rel; -// yawDir = (yawDir > 1) ? yawDir : ((yawDir < -1) ? yawDir : 0); + + Ogre::Real yawDir = mMouse->getMouseState().X.rel; yaw += yawDir * rate; - int pitchDir = mMouse->getMouseState().Y.rel; -// pitchDir = (pitchDir > 1) ? pitchDir : ((pitchDir < -1) ? pitchDir : 0); + Ogre::Real pitchDir = mMouse->getMouseState().Y.rel; pitch += pitchDir * rate; if (pitch > 80.0f * 3.1416f/ 180.0f) pitch = 80.0f * 3.1416f/ 180.0f; if (pitch < -80.0f * 3.1416f/ 180.0f) pitch = -80.0f * 3.1416f/ 180.0f; + // save the camera orientation; Matrix3 matrix; matrix.FromEulerAnglesZYX (Radian (0.0f), Radian (yaw), Radian (pitch)); mCamera->setOrientation (Quaternion (matrix)); @@ -136,13 +134,12 @@ } - - if (mKeyboard->isKeyDown(OIS::KC_T)) m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); - if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) - return false; - - return true; + + return mKeyboard->isKeyDown(OIS::KC_ESCAPE) ? false : true; } + + + Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.h =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -11,14 +11,15 @@ OgreNewt::World* m_World; SceneManager* mSceneMgr; int count; - float timer; + Ogre::Real timer; public: OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W); ~OgreNewtonFrameListener(void); + bool frameRenderingQueued(const FrameEvent& evt); bool frameStarted(const FrameEvent &evt); - virtual void moveCamera(); + }; Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -123,10 +123,10 @@ void OgreNewtonApplication::createFrameListener() { + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 600 ); - mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -28,11 +28,11 @@ void OgreNewtonApplication::createFrameListener() { + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); } void OgreNewtonApplication::destroyScene() @@ -78,7 +78,6 @@ box1->setMaterialName( materialName ); - return bod; } Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -65,97 +65,6 @@ { } -void OgreNewtonFrameListener::moveCamera() -{ -} - - - -bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) -{ - // make sure we still have the input devices (they are destroyed when the window is closed) - if (!mInputManager) { - return false; - } - - mKeyboard->capture(); - mMouse->capture(); - - Real timestep = evt.timeSinceLastFrame; - - // ---------------------------------------- - // CAMERA CONTROLS - // ---------------------------------------- - if (!mousePick ()) { - // only move mouse cursor when the mouse left key is down - static Real pitch (0.0); - static Real yaw (0.0); - if (mMouse->getMouseState().buttonDown(OIS::MB_Left)) { - - Real rate = (30.0f * 3.1416f/ 180.0f) * timestep; - - int yawDir = mMouse->getMouseState().X.rel; - yaw += yawDir * rate; - - int pitchDir = mMouse->getMouseState().Y.rel; - pitch += pitchDir * rate; - if (pitch > 80.0f * 3.1416f/ 180.0f) pitch = 80.0f * 3.1416f/ 180.0f; - if (pitch < -80.0f * 3.1416f/ 180.0f) pitch = -80.0f * 3.1416f/ 180.0f; - - Matrix3 matrix; - matrix.FromEulerAnglesZYX (Radian (0.0f), Radian (yaw), Radian (pitch)); - mCamera->setOrientation (Quaternion (matrix)); - } - } - - Vector3 trans (0.0, 0.0, -10.0f * timestep); - Vector3 strafe (5.0f * timestep, 0.0, 0.0); - if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W) ) - mCamera->moveRelative(trans); - - if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S) ) - mCamera->moveRelative(trans * -1.0); - - if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A) ) - mCamera->moveRelative(strafe * -1.0); - - if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) - mCamera->moveRelative(strafe); - - - // ---------------------------------------- - // DRAGGING! - // ---------------------------------------- -/* - OgreNewt::Debugger& debug(m_World->getDebugger()); - if (mKeyboard->isKeyDown(OIS::KC_F3)) - { - debug.showDebugInformation(); - debug.startRaycastRecording(); - debug.clearRaycastsRecorded(); - } - else - { - debug.hideDebugInformation(); - debug.clearRaycastsRecorded(); - debug.stopRaycastRecording(); - } - - - - if (mKeyboard->isKeyDown(OIS::KC_T)) - m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); - - - if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) - return false; -*/ - return true; -} - - - - void OgreNewtonFrameListener::remove3DLine() { mDragLineNode->detachAllObjects(); @@ -163,8 +72,6 @@ } - - bool OgreNewtonFrameListener::mousePick () { int mouseKey1; @@ -172,7 +79,7 @@ Ogre::Real MAX_FRICTION_ANGULAR_GRAVITY = 15.0f; Ogre::Real MAX_FRICTION_LINEAR_ACCELERATION = 100.0f; -// mouseKey1 = mMouse->getMouseState().buttonDown(OIS::MB_Left) || mMouse->getMouseState().buttonDown(OIS::MB_Right); + // mouseKey1 = mMouse->getMouseState().buttonDown(OIS::MB_Left) || mMouse->getMouseState().buttonDown(OIS::MB_Right); mouseKey1 = mMouse->getMouseState().buttonDown(OIS::MB_Left); if (mouseKey1) { if (!mDragging) { @@ -248,3 +155,95 @@ return mPickBodyController ? true : false; } + + +bool OgreNewtonFrameListener::frameRenderingQueued(const FrameEvent& evt) +{ + return true; +} + +bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) +{ + // make sure we still have the input devices (they are destroyed when the window is closed) + if (!mInputManager) { + return false; + } + + mKeyboard->capture(); + mMouse->capture(); + + Real timestep = evt.timeSinceLastFrame; + + // ---------------------------------------- + // CAMERA CONTROLS + // ---------------------------------------- + if (!mousePick ()) { + // only move mouse cursor when the mouse left key is down + static Real pitch (0.0); + static Real yaw (0.0); + if (mMouse->getMouseState().buttonDown(OIS::MB_Left)) { + + Real rate = (30.0f * 3.1416f/ 180.0f) * timestep; + + int yawDir = mMouse->getMouseState().X.rel; + yaw += yawDir * rate; + + int pitchDir = mMouse->getMouseState().Y.rel; + pitch += pitchDir * rate; + if (pitch > 80.0f * 3.1416f/ 180.0f) pitch = 80.0f * 3.1416f/ 180.0f; + if (pitch < -80.0f * 3.1416f/ 180.0f) pitch = -80.0f * 3.1416f/ 180.0f; + + Matrix3 matrix; + matrix.FromEulerAnglesZYX (Radian (0.0f), Radian (yaw), Radian (pitch)); + mCamera->setOrientation (Quaternion (matrix)); + } + } + + Vector3 trans (0.0, 0.0, -10.0f * timestep); + Vector3 strafe (5.0f * timestep, 0.0, 0.0); + if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W) ) + mCamera->moveRelative(trans); + + if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S) ) + mCamera->moveRelative(trans * -1.0); + + if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A) ) + mCamera->moveRelative(strafe * -1.0); + + if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) + mCamera->moveRelative(strafe); + + + // ---------------------------------------- + // DRAGGING! + // ---------------------------------------- +/* + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + +*/ + + return mKeyboard->isKeyDown(OIS::KC_ESCAPE) ? false : true; +} + + + + + + + + Modified: branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.h =================================================================== --- branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo04_Raycasting/OgreNewtonFrameListener.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -31,6 +31,7 @@ ~OgreNewtonFrameListener(void); bool frameStarted(const FrameEvent &evt); + bool frameRenderingQueued(const FrameEvent& evt); bool mousePick (); @@ -40,7 +41,7 @@ return true; } - void OgreNewtonFrameListener::moveCamera(); + bool keyPressed( const OIS::KeyEvent &arg ) { Modified: branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -166,11 +166,11 @@ void OgreNewtonApplication::createFrameListener() { + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); } void OgreNewtonApplication::destroyScene() Modified: branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -144,11 +144,11 @@ void OgreNewtonApplication::createFrameListener() { + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); mRoot->addFrameListener(mFrameListener); - - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); } Modified: branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -68,20 +68,42 @@ // floor object! Entity* floor; SceneNode* floornode; - //floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); - floor = mSceneMgr->createEntity("Floor", "castle.mesh" ); -// floor = mSceneMgr->createEntity("Floor", "chiropteradm.mesh" ); -// floor = mSceneMgr->createEntity("Floor", "playground.mesh" ); + +// const char *levelName = "simple_terrain.mesh"; +// const char *levelName = "castle.mesh"; + const char *levelName = "chiropteradm.mesh"; +// const char *levelName = "playground.mesh"; + + floor = mSceneMgr->createEntity("Floor", levelName ); floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); floornode->attachObject( floor ); -// floor->setMaterialName( "Simple/BeachStones" ); floor->setCastShadows( false ); + //Ogre::Vector3 siz(100.0, 10.0, 100.0); - //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); + char serializeCollisionName[256]; + strcpy (serializeCollisionName, levelName); + strtok (serializeCollisionName, "."); + strcat (serializeCollisionName, ".col"); + + + FILE* file = fopen (serializeCollisionName, "rb"); + if (!file) { + // serialize the mesh so that next time loads faster + OgreNewt::CollisionSerializer saveLevelCollision; + OgreNewt::CollisionPtr tmpSphape = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); + saveLevelCollision.exportCollision(tmpSphape, serializeCollisionName); + file = fopen (serializeCollisionName, "rb"); + } + + // load level collision from serialized file + FileHandleDataStream streamFile (file); + OgreNewt::CollisionSerializer loadLevelCollision; + OgreNewt::CollisionPtr col = loadLevelCollision.importCollision(streamFile, m_World); + fclose (file); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR delete col; @@ -113,11 +135,13 @@ void OgreNewtonApplication::createFrameListener() { + // It is important that the Physics update is updated before anything + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World, mPlayer); mRoot->addFrameListener(mFrameListener); - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); } void OgreNewtonApplication::destroyScene() Modified: branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -1,78 +1,117 @@ -#include "OgreNewtonFrameListener.h" - - -//#include <OgreNoMemoryMacros.h> -#include <CEGUI/CEGUI.h> -//#include <OgreMemoryMacros.h> - - -OgreNewtonFrameListener::OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, OgreNewt::PlayerController *player) : - ExampleFrameListener(win,cam) -{ - m_World = W; - mSceneMgr = mgr; - mPlayer = player; - - OgreNewt::Debugger &debug(m_World->getDebugger()); - debug.init(mgr); -} - -OgreNewtonFrameListener::~OgreNewtonFrameListener(void) -{ -} - -bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) -{ - mKeyboard->capture(); - mMouse->capture(); - - - - // player movement uhjk zi - Ogre::Real forwardSpeed, sideSpeed; - Ogre::Radian heading; - mPlayer->getVelocity(forwardSpeed, sideSpeed, heading); - forwardSpeed = 0; - sideSpeed = 0; - if(mKeyboard->isKeyDown(OIS::KC_U)) - forwardSpeed += 6.0; - if(mKeyboard->isKeyDown(OIS::KC_J)) - forwardSpeed -= 5.0; - if(mKeyboard->isKeyDown(OIS::KC_H)) - sideSpeed -= 5.0; - if(mKeyboard->isKeyDown(OIS::KC_K)) - sideSpeed += 5.0; - if(mKeyboard->isKeyDown(OIS::KC_Z)) - heading += Degree(90)/60.0; - if(mKeyboard->isKeyDown(OIS::KC_I)) - heading -= Degree(90)/60.0; - - mPlayer->setVelocity(forwardSpeed, sideSpeed, heading); - - - OgreNewt::Debugger& debug(m_World->getDebugger()); - if (mKeyboard->isKeyDown(OIS::KC_F3)) - { - debug.startRaycastRecording(); - debug.clearRaycastsRecorded(); - debug.showDebugInformation(); - } - else - { - debug.clearRaycastsRecorded(); - debug.stopRaycastRecording(); - debug.hideDebugInformation(); - } - - - - if (mKeyboard->isKeyDown(OIS::KC_T)) - m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); - - - if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) - return false; - - return true; -} - +#include "OgreNewtonFrameListener.h" + + +//#include <OgreNoMemoryMacros.h> +#include <CEGUI/CEGUI.h> +//#include <OgreMemoryMacros.h> + + +OgreNewtonFrameListener::OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, OgreNewt::PlayerController *player) : + ExampleFrameListener(win,cam) +{ + m_World = W; + mSceneMgr = mgr; + mPlayer = player; + cameraPitchAngle = 0.0f; + + // set the external view distance to 3 meters + m_cameraMode = 1; + m_cameraKeyState = false; + m_extenalViewDist = 5.0f; + + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); +} + +OgreNewtonFrameListener::~OgreNewtonFrameListener(void) +{ +} + + +bool OgreNewtonFrameListener::frameRenderingQueued(const FrameEvent& evt) +{ + return true; +} + + +bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) +{ + mKeyboard->capture(); + mMouse->capture(); + + // player movement + Ogre::Real forwardSpeed, sideSpeed; + Ogre::Radian heading; + mPlayer->getVelocity(forwardSpeed, sideSpeed, heading); + forwardSpeed = 0; + sideSpeed = 0; + + // set player velocity from the user + if(mKeyboard->isKeyDown(OIS::KC_W)) + forwardSpeed += 8.0; + if(mKeyboard->isKeyDown(OIS::KC_S)) + forwardSpeed -= 5.0; + if(mKeyboard->isKeyDown(OIS::KC_A)) + sideSpeed -= 5.0; + if(mKeyboard->isKeyDown(OIS::KC_D)) + sideSpeed += 5.0; + + if (!m_cameraKeyState && mKeyboard->isKeyDown(OIS::KC_SPACE)) { + m_cameraMode = !m_cameraMode; + } + m_cameraKeyState = mKeyboard->isKeyDown(OIS::KC_SPACE); + + Real timestep = evt.timeSinceLastFrame; + Real rate = (60.0f * 3.1416f/ 180.0f) * timestep; + + // calculate the camera Pitch Angle + int pitchDir = mMouse->getMouseState().Y.rel; + cameraPitchAngle += pitchDir * rate; + if (cameraPitchAngle > 80.0f * 3.1416f/ 180.0f) cameraPitchAngle = 80.0f * 3.1416f/ 180.0f; + if (cameraPitchAngle < -80.0f * 3.1416f/ 180.0f) cameraPitchAngle = -80.0f * 3.1416f/ 180.0f; + Ogre::Quaternion pitch (Ogre::Radian(cameraPitchAngle), Ogre::Vector3 (1, 0, 0)); + + + int yawDir = mMouse->getMouseState().X.rel; + heading += Ogre::Radian(yawDir * rate); + mPlayer->setVelocity(forwardSpeed, sideSpeed, heading); + + Ogre::Vector3 posit; + Ogre::Quaternion orient; + OgreNewt::Body* playerBody = mPlayer->getBody0(); +// playerBody->getPositionOrientation (posit, orient); + playerBody->getVisualPositionOrientation (posit, orient); + + orient = orient * pitch; + if (m_cameraMode) { + // place the camera on external view + posit += orient * Ogre::Vector3 (0, 0, m_extenalViewDist); + } + + // move eye point to be about the players head + posit.y += mPlayer->getPlayerHeight() * 0.75f; + + mCamera->setPosition(posit); + mCamera->setOrientation(orient); + + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + debug.showDebugInformation(); + } + else + { + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + debug.hideDebugInformation(); + } + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + + + return mKeyboard->isKeyDown(OIS::KC_ESCAPE) ? false : true; +} + Modified: branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.h =================================================================== --- branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonFrameListener.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -13,13 +13,19 @@ protected: OgreNewt::World* m_World; SceneManager* mSceneMgr; - int count; + + + int m_cameraMode; + bool m_cameraKeyState; + Real cameraPitchAngle; + Real m_extenalViewDist; OgreNewt::PlayerController* mPlayer; public: OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, OgreNewt::PlayerController* player); ~OgreNewtonFrameListener(void); bool frameStarted(const FrameEvent &evt); + bool frameRenderingQueued(const FrameEvent& evt); bool mouseMoved (const OIS::MouseEvent &e) { @@ -47,8 +53,7 @@ } bool mouseReleased (const OIS::MouseEvent &e, OIS::MouseButtonID id) - { - CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id)); + { CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id)); return true; } @@ -63,7 +68,6 @@ case 3: return CEGUI::X1Button; default: return CEGUI::LeftButton; } - } }; Modified: branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/box.mesh =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/bin/Debug ___________________________________________________________________ Modified: svn:ignore - *.dll *.exe *.ilk *.log *.pdb ogre.cfg + *.col *.dll *.exe *.ilk *.log *.pdb ogre.cfg Property changes on: branches/ogrenewt/newton20/demos/bin/Release ___________________________________________________________________ Modified: svn:ignore - *.dll *.exe *.log *.pdb ogre.cfg + *.col *.dll *.exe *.log *.pdb ogre.cfg Added: branches/ogrenewt/newton20/demos/media/materials/scripts/box.material =================================================================== --- branches/ogrenewt/newton20/demos/media/materials/scripts/box.material (rev 0) +++ branches/ogrenewt/newton20/demos/media/materials/scripts/box.material 2009-12-30 15:20:22 UTC (rev 2775) @@ -0,0 +1,19 @@ + +material box000 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture newtonLogo.tga + } + } + + } + +} Added: branches/ogrenewt/newton20/demos/media/materials/scripts/ellipsoid.material =================================================================== --- branches/ogrenewt/newton20/demos/media/materials/scripts/ellipsoid.material (rev 0) +++ branches/ogrenewt/newton20/demos/media/materials/scripts/ellipsoid.material 2009-12-30 15:20:22 UTC (rev 2775) @@ -0,0 +1,19 @@ + +material ellipsoid000 +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 1 + diffuse 0.7 0.7 0.7 1 + + texture_unit + { + texture wood.tga + } + } + + } + +} Modified: branches/ogrenewt/newton20/demos/media/materials/scripts/primitives.material =================================================================== --- branches/ogrenewt/newton20/demos/media/materials/scripts/primitives.material 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/demos/media/materials/scripts/primitives.material 2009-12-30 15:20:22 UTC (rev 2775) @@ -18,21 +18,3 @@ } -material box000 -{ - technique - { - pass - { - ambient 0.2 0.2 0.2 1 - diffuse 0.7 0.7 0.7 1 - - texture_unit - { - texture BumpyMetal.jpg - } - } - - } - -} \ No newline at end of file Added: branches/ogrenewt/newton20/demos/media/materials/textures/cursor.png =================================================================== (Binary files differ) Property changes on: branches/ogrenewt/newton20/demos/media/materials/textures/cursor.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogrenewt/newton20/demos/media/models/chiropteradm.mesh =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/demos/media/packs/OgreCore.zip =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/demos/media/primitives/box.mesh =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/demos/media/primitives/castle.mesh =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/inc/OgreNewt_BasicFrameListener.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -40,8 +40,8 @@ protected: OgreNewt::World* m_World; - int desired_framerate; - Ogre::Real m_update, m_elapsed; +// int desired_framerate; +// Ogre::Real m_update, m_elapsed; public: Modified: branches/ogrenewt/newton20/inc/OgreNewt_Body.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/inc/OgreNewt_Body.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -48,7 +48,8 @@ */ typedef boost::function<void(OgreNewt::Body*, float timeStep, int threadIndex)> ForceCallback; - //! custom transform callback. +#if 0 + //! custom transform callback. /*! This function is called from within the OgreNewt::World::update() command for all Rigid Bodies, after all collision and forces have been resolved. this command is intended to allow the user to align a visual object with the new position and @@ -56,7 +57,9 @@ create your own for special cases. you are passed a quaternion (orientation) and vector (position) of the rigid body in world space. */ - typedef boost::function<void(OgreNewt::Body*, const Ogre::Quaternion&, const Ogre::Vector3&, int threadIndex)> TransformCallback; + //typedef boost::function<void(OgreNewt::Body*, const Ogre::Quaternion&, const Ogre::Vector3&, int threadIndex)> TransformCallback; + //typedef boost::function<void(OgreNewt::Body*, int threadIndex)> TransformCallback; +#endif //! buoyancy plane callback @@ -161,24 +164,26 @@ //! remove any force callbacks. void removeForceAndTorqueCallback() { NewtonBodySetForceAndTorqueCallback( m_body, NULL ); m_forcecallback = NULL; } - //! returns currect force-torque callback + //! returns correct force-torque callback ForceCallback getForceTorqueCallback() { return m_forcecallback; } +#if 0 //! set a custom transform callback. /* sets a custom transform callback for the rigid body. see the docs on setCustomForceAndTorqueCallback for a description of how to use this function. */ void setCustomTransformCallback( TransformCallback callback ); - template<class c> void setCustomTransformCallback( boost::function<void(c*, OgreNewt::Body*, const Ogre::Quaternion&, const Ogre::Vector3&, int)> callback, c *instancedClassPointer ) + template<class c> void setCustomTransformCallback( boost::function<void(c*, OgreNewt::Body*, int)> callback, c *instancedClassPointer ) { - setCustomTransformCallback( boost::bind(callback, instancedClassPointer, _1, _2, _3, _4) ); + setCustomTransformCallback( boost::bind(callback, instancedClassPointer, _1, _2) ); } //! remove any transform callbacks. void removeTransformCallback() { m_transformcallback = NULL; } +#endif //! position and orient the body arbitrarily. /*! @@ -299,6 +304,13 @@ //! get position and orientation in form of an Ogre::Vector(position) and Ogre::Quaternion(orientation) void getPositionOrientation( Ogre::Vector3& pos, Ogre::Quaternion& orient ) const; + //! get the node position and orientation in form of an Ogre::Vector(position) and Ogre::Quaternion(orientation) + /*! + this function should be used for calculating Render matrix render or anything related to render time + */ + void getVisualPositionOrientation( Ogre::Vector3& pos, Ogre::Quaternion& orient ) const; + + //! get the axis-aligned bounding box for this body. Ogre::AxisAlignedBox getAABB() const; @@ -416,6 +428,7 @@ */ NewtonCollision *getNewtonCollision() const { return NewtonBodyGetCollision( m_body ); } +#if 0 //! Call this to signify that the position/orientation of the attached node needs to be updated /*! * This function actually adds this body to a list of bodies that need to be updated. This is done automaticalle after the next world update @@ -427,9 +440,16 @@ //! Return if an node update was requested bool isNodeUpdateNeeded() const {return m_nodeupdateneeded;} +#endif + //! Return if an node update was requested + bool isNodeUpdateNeeded() const {return m_nodeupdateneeded;} + + //! Set this body to for visual node update + void SetNodeUpdateState(bool state) {m_nodeupdateneeded = state;} + //! update the position of the node (if attached) and sets m_nodeupdateneeded to false - void updateNode(); + void updateNode(Ogre::Real interpolatParam); protected: @@ -437,6 +457,14 @@ OgreNewt::CollisionPtr m_collision; const MaterialID* m_matid; const World* m_world; + + Ogre::Vector3 m_nodePosit; + Ogre::Vector3 m_curPosit; + Ogre::Vector3 m_prevPosit; + Ogre::Quaternion m_nodeRotation; + Ogre::Quaternion m_curRotation; + Ogre::Quaternion m_prevRotation; + #ifndef OGRENEWT_NO_OGRE_ANY Ogre::Any m_userdata; @@ -449,7 +477,7 @@ bool m_nodeupdateneeded; ForceCallback m_forcecallback; - TransformCallback m_transformcallback; +// TransformCallback m_transformcallback; buoyancyPlaneCallback m_buoyancycallback; private: @@ -461,12 +489,11 @@ static int _CDECL newtonBuoyancyCallback( const int collisionID, void* context, const float* globalSpaceMatrix, float* globalSpacePlane ); - // standard gravity force callback. static void standardForceCallback( Body* me, float timeStep, int threadIndex ); // standard transform callback. - static void standardTransformCallback( Body* me, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, int threadIndex ); + // static void standardTransformCallback( Body* me, int threadIndex ); }; Modified: branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/inc/OgreNewt_CollisionSerializer.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -42,7 +42,8 @@ Deserialize the Collision from a DataStream. this will create a NEW Collision object */ - OgreNewt::CollisionPtr importCollision(Ogre::DataStreamPtr& stream, OgreNewt::World* world); +// OgreNewt::CollisionPtr importCollision(Ogre::DataStreamPtr& stream, OgreNewt::World* world); + OgreNewt::CollisionPtr importCollision(Ogre::DataStream& stream, OgreNewt::World* world); private: /*! Modified: branches/ogrenewt/newton20/inc/OgreNewt_Joint.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Joint.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/inc/OgreNewt_Joint.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -42,7 +42,13 @@ //! must be define for a functioning joint. virtual void submitConstraint( Ogre::Real timeStep, int threadIndex ) {}; + //! get the pointer to the first rigid body + Body* getBody0 () const; + + //! get the pointer to the first rigid body + Body* getBody1 () const; + #if 0 //! returns collision state /*! @@ -128,92 +134,6 @@ NewtonCustomJoint* m_joint; }; - - -#if 0 - - - //! CustomJoint - /*! - this class represents a basic class for creating user-defined joints. this class must be inherited to create discreet joints. - */ - class _OgreNewtExport CustomJoint : public Joint - { - - public: - - //! constructor - CustomJoint( unsigned int maxDOF, const Body* body0, const Body* body1 ); - - //! destructor - virtual ~CustomJoint(); - - //! must be over-written for a functioning joint. - virtual void submitConstraint( Ogre::Real timeStep, int threadIndex ) = 0; - - //! can be overwritten, empty as default - virtual void feedbackCollector( Ogre::Real timeSte, int threadIndex ) {} - - //! find the local orientation and position of the joint with regards to the 2 bodies in the joint. - void pinAndDirToLocal( const Ogre::Vector3& pinpt, const Ogre::Vector3& pindir, Ogre::Quaternion& localOrient0, Ogre::Vector3& localPos0, Ogre::Quaternion& localOrient1, Ogre::Vector3& localPos1 ) const; - - //! find the global orientation and position of the joint with regards to the a body in the joint. - void localToGlobal( const Ogre::Quaternion& localOrient, const Ogre::Vector3& localPos, Ogre::Quaternion& globalOrient, Ogre::Vector3& globalPos, int bodyIndex = 0 ) const; - - //! find the local orientation and position of the joint with regards to the a body in the joint. - void globalToLocal( const Ogre::Quaternion& localOrient, const Ogre::Vector3& localPos, Ogre::Quaternion& globalOrient, Ogre::Vector3& globalPos, int bodyIndex = 0 ) const; - - //! add a linear row to the constraint. - void addLinearRow( const Ogre::Vector3& pt0, const Ogre::Vector3& pt1, const Ogre::Vector3& dir ) const; - - //! add an angular row to the constraint. - void addAngularRow( Ogre::Radian relativeAngleError, const Ogre::Vector3& dir ) const; - - //! set the general jacobian rows directly. - void addGeneralRow( const Ogre::Vector3& linear0, const Ogre::Vector3& angular0, const Ogre::Vector3& linear1, const Ogre::Vector3& angular1 ) const; - - //! set row minimum friction - void setRowMinimumFriction( Ogre::Real friction ) const; - - //! set row maximum friction - void setRowMaximumFriction( Ogre::Real friction ) const; - - //! set row acceleration - void setRowAcceleration( Ogre::Real accel ) const; - - //! set row stiffness - void setRowStiffness( Ogre::Real stiffness ) const; - - //! apply a spring to this row, allowing for joints with spring behaviour in 1 or more DoF's - /*! - \param springK float spring constant. - \param springD float natural rest state distance of the spring. - */ - void setRowSpringDamper( Ogre::Real springK, Ogre::Real springD ) const; - - //! retrieve the force acting on the current row. - Ogre::Real getRowForce( int row ) const { return NewtonUserJointGetRowForce( m_joint, row ); } - - //! pin vector to arbitrary quaternion utility function. - Ogre::Quaternion grammSchmidt( const Ogre::Vector3& pin ) const; - - protected: - - unsigned int m_maxDOF; - - const OgreNewt::Body* m_body0; - const OgreNewt::Body* m_body1; - - private: - //! newton callback. used internally. - static void _CDECL newtonSubmitConstraint( const NewtonJoint* me, float timeStep, int threadIndex ); - static void _CDECL newtonGetInfo( const NewtonJoint* me, NewtonJointRecord* info ); - static void _CDECL newtonFeedbackCollector( const NewtonJoint* me, float timeStep, int threadIndex ); - - }; - -#endif - } // end NAMESPACE OgreNewt Modified: branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -49,12 +49,8 @@ //! set the characters velocity, the -Speed-values can be negative, sideSpeed positive means move to the right, heading is in absolute space void setVelocity(Ogre::Real forwardSpeed, Ogre::Real sideSpeed, Ogre::Radian heading); - - //! get controlled body - OgreNewt::Body* getControlledBody() const {return m_body;} - - protected: - Body *m_body; // we need this again, because in the joint it's constant! + //! get the Player height + Ogre::Real getPlayerHeight() const; }; } // end NAMESPACE OgreNewt Modified: branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/inc/OgreNewt_Prerequisites.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -1,143 +1,146 @@ -/* - OgreNewt Library - - Ogre implementation of Newton Game Dynamics SDK - - OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. - - by Walaber - some changes by melven - -*/ - - -#ifndef __INCLUDE_OGRENEWT_PREREQ__ -#define __INCLUDE_OGRENEWT_PREREQ__ - -#ifdef __APPLE__ -# include <Carbon/Carbon.h> -# include <Ogre/OgreVector3.h> -# include <Ogre/OgreQuaternion.h> -# include <Ogre/OgreMovableObject.h> -# include <Ogre/OgreRenderable.h> -# include <Ogre/OgreNode.h> -# include <Ogre/OgreFrameListener.h> -# ifndef OGRENEWT_NO_OGRE_ANY -# include <Ogre/OgreAny.h> -# endif -#else -#include <OgreVector3.h> -#include <OgreQuaternion.h> -#include <OgreMovableObject.h> -#include <OgreRenderable.h> -#include <OgreNode.h> -#include <OgreFrameListener.h> -# ifndef OGRENEWT_NO_OGRE_ANY -# include <OgreAny.h> -# endif -#endif - -#include <Newton.h> -#include <boost/function.hpp> -#include <boost/bind.hpp> -#ifndef OGRENEWT_NO_COLLISION_SHAREDPTR -# include <boost/shared_ptr.hpp> -#endif - -#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 -# define _CDECL _cdecl -# if defined( _OGRENEWT_EXPORTS ) && defined( _OGRENEWT_DYNAMIC ) -# define _OgreNewtExport __declspec( dllexport ) -# elif defined( _OGRENEWT_DYNAMIC ) -# define _OgreNewtExport __declspec( dllimport ) -# else -# define _OgreNewtExport -# endif -#else // Linux / Mac OSX etc -# define _OgreNewtExport -# define _CDECL -#endif - - -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR -#warning "the option OGRENEWT_NO_COLLISION_SHAREDPTR is set" -#endif - -#ifdef OGRENEWT_NO_OGRE_ANY -#warning "the option OGRENEWT_NO_OGRE_ANY is set" -#endif - -namespace OgreNewt -{ - class World; - class MaterialID; - class Joint; - class Contact; - class MaterialPair; - class Body; - class Collision; - class CollisionSerializer; - class ConvexCollision; - class Debugger; - - - //! helper class: OgreNewt-classes can derive from this class to implement a destructor-callback - /*! - * Consider the following example: - * You delete a body thats part of joint, so newton deletes the joint, then you could still have a pointer to that joint. Using this pointer will fail, - * thats why you need a way to get to know, when an object gets deleted... - */ - template<class DerivedClass> - class _DestructorCallback - { - public: - //! destructor callback - /*! - * This function is called, when the object is destroyed. It's only argument is a pointer to the instance currently destroyed - * @warning the pointer to the destroyed class instance is already invalid (the class is already destroyed!) - */ - typedef boost::function<void(DerivedClass*)> DestructorCallbackFunction; - - //! constructor - _DestructorCallback() : m_callback(NULL) {} - - //! destructor - virtual ~_DestructorCallback() - { - if( m_callback ) - m_callback((DerivedClass*)(this)); - } - - //! remove any destructor callback - void removeDestructorCallback() {m_callback = NULL;} - - //! set the destructor callback - /*! - * - * This specifies a custom callback that's called when this class is destroyed. If you are using a standard non-member function, - * or a static member function, you can simply pass a pointer to the function here.. like this: - * setDestructorCallback( &myCallbackFunction ); - * - * If you want to bind to a class member, you also need to pass a pointer to the class itself, using the boost::bind system, like so: - * setDestructorCallback( boost::bind( &MyClass::myCallback, (MyClass*)classInstance, _1 ) ); (from outside the class) or: - * setDestructorCallback( boost::bind( &MyClass::myCallback, this, _1 ) ); (from inside the class). - * - * You can also use: - * setDestructorCallback<>( &MyClass::myCallback, (MyClass*)classInstance ); (from outside the class) or: - * setDestructorCallback<>( &MyClass::myCallback, this ); (from inside the class). - * Note: Notice the "<>" after the function name. - * - */ - void setDestructorCallback( DestructorCallbackFunction fun ) { m_callback = fun; } - template<class c> void setDestructorCallback( boost::function<void(c*, DerivedClass*)> callback, c *instancedClassPointer ) - { - setDestructorCallback( boost::bind(callback, instancedClassPointer, _1) ); - } - private: - DestructorCallbackFunction m_callback; - - }; -} - -#endif - +/* + OgreNewt Library + + Ogre implementation of Newton Game Dynamics SDK + + OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way. + + by Walaber + some changes by melven + +*/ + + +#ifndef __INCLUDE_OGRENEWT_PREREQ__ +#define __INCLUDE_OGRENEWT_PREREQ__ + +#ifdef __APPLE__ +# include <Carbon/Carbon.h> +# include <Ogre/OgreVector3.h> +# include <Ogre/OgreQuaternion.h> +# include <Ogre/OgreMovableObject.h> +# include <Ogre/OgreRenderable.h> +# include <Ogre/OgreNode.h> +# include <Ogre/OgreFrameListener.h> +# ifndef OGRENEWT_NO_OGRE_ANY +# include <Ogre/OgreAny.h> +# endif +#else +#include <OgreVector3.h> +#include <OgreQuaternion.h> +#include <OgreMovableObject.h> +#include <OgreRenderable.h> +#include <OgreNode.h> +#include <OgreFrameListener.h> +# ifndef OGRENEWT_NO_OGRE_ANY +# include <OgreAny.h> +# endif +#endif + +#include <Newton.h> +#include <boost/function.hpp> +#include <boost/bind.hpp> +#ifndef OGRENEWT_NO_COLLISION_SHAREDPTR +# include <boost/shared_ptr.hpp> +#endif + +#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 +# define _CDECL _cdecl +# if defined( _OGRENEWT_EXPORTS ) && defined( _OGRENEWT_DYNAMIC ) +# define _OgreNewtExport __declspec( dllexport ) +# elif defined( _OGRENEWT_DYNAMIC ) +# define _OgreNewtExport __declspec( dllimport ) +# else +# define _OgreNewtExport +# endif +#else // Linux / Mac OSX etc +# define _OgreNewtExport +# define _CDECL +#endif + + + + + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR +#warning "the option OGRENEWT_NO_COLLISION_SHAREDPTR is set" +#endif + +#ifdef OGRENEWT_NO_OGRE_ANY +#warning "the option OGRENEWT_NO_OGRE_ANY is set" +#endif + +namespace OgreNewt +{ + class World; + class MaterialID; + class Joint; + class Contact; + class MaterialPair; + class Body; + class Collision; + class CollisionSerializer; + class ConvexCollision; + class Debugger; + + + //! helper class: OgreNewt-classes can derive from this class to implement a destructor-callback + /*! + * Consider the following example: + * You delete a body thats part of joint, so newton deletes the joint, then you could still have a pointer to that joint. Using this pointer will fail, + * thats why you need a way to get to know, when an object gets deleted... + */ + template<class DerivedClass> + class _DestructorCallback + { + public: + //! destructor callback + /*! + * This function is called, when the object is destroyed. It's only argument is a pointer to the instance currently destroyed + * @warning the pointer to the destroyed class instance is already invalid (the class is already destroyed!) + */ + typedef boost::function<void(DerivedClass*)> DestructorCallbackFunction; + + //! constructor + _DestructorCallback() : m_callback(NULL) {} + + //! destructor + virtual ~_DestructorCallback() + { + if( m_callback ) + m_callback((DerivedClass*)(this)); + } + + //! remove any destructor callback + void removeDestructorCallback() {m_callback = NULL;} + + //! set the destructor callback + /*! + * + * This specifies a custom callback that's called when this class is destroyed. If you are using a standard non-member function, + * or a static member function, you can simply pass a pointer to the function here.. like this: + * setDestructorCallback( &myCallbackFunction ); + * + * If you want to bind to a class member, you also need to pass a pointer to the class itself, using the boost::bind system, like so: + * setDestructorCallback( boost::bind( &MyClass::myCallback, (MyClass*)classInstance, _1 ) ); (from outside the class) or: + * setDestructorCallback( boost::bind( &MyClass::myCallback, this, _1 ) ); (from inside the class). + * + * You can also use: + * setDestructorCallback<>( &MyClass::myCallback, (MyClass*)classInstance ); (from outside the class) or: + * setDestructorCallback<>( &MyClass::myCallback, this ); (from inside the class). + * Note: Notice the "<>" after the function name. + * + */ + void setDestructorCallback( DestructorCallbackFunction fun ) { m_callback = fun; } + template<class c> void setDestructorCallback( boost::function<void(c*, DerivedClass*)> callback, c *instancedClassPointer ) + { + setDestructorCallback( boost::bind(callback, instancedClassPointer, _1) ); + } + private: + DestructorCallbackFunction m_callback; + + }; +} + +#endif + Modified: branches/ogrenewt/newton20/inc/OgreNewt_World.h =================================================================== --- branches/ogrenewt/newton20/inc/OgreNewt_World.h 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/inc/OgreNewt_World.h 2009-12-30 15:20:22 UTC (rev 2775) @@ -70,7 +70,7 @@ public: //! Standard Constructor, creates the world. - World(); + World(Ogre::Real desiredFps = 100.0f, int maxUpdatesPerFrames = 2); //! Standard Destructor, destroys the world. ~World(); @@ -97,6 +97,15 @@ */ void invalidateCache() { NewtonInvalidateCache( m_world ); } + //! set simulation frames per and max updated per updates + /*! + this function set the update rate of the simulation + plus the maximum number of update per frame the simulation can execute in order to catch up. + */ + void SetUpdateFPS(Ogre::Real desiredFps, int maxUpdatesPerFrames); + + + //! retrieves a pointer to the NewtonWorld /*! in most cases you shouldn't need this... but in case you want to implement something not yet in the library, you can use this to get a pointer to the NewtonWorld object. @@ -163,7 +172,7 @@ int getMultithreadSolverOnSingleIsland( ) const { return NewtonGetMultiThreadSolverOnSingleIsland( m_world ); } //! set the number of threads for the physics simulation to use, don't do this while world update - void setThreadCount(int threads) { NewtonSetThreadsCount( m_world, threads ); } + void setThreadCount(int threads); //! get the number of threads the simulation is using. int getThreadCount() const { return NewtonGetThreadsCount( m_world ); } @@ -229,7 +238,7 @@ Debugger& getDebugger() const {return *m_debugger;} //! adds an update request for the body, this means that after the next world update the function body->updateNode will be called, if the bodie needs updating - void addBodyUpdateNodeRequest( int threadIndex, OgreNewt::Body* body ) const ; + void addBodyUpdateNodeRequest( int threadIndex, OgreNewt::Body* body ) const ; #ifndef WIN32 @@ -255,6 +264,13 @@ protected: + int m_maxTicksPerFrames; + Ogre::Real m_timestep; + Ogre::Real m_invTimestep; + Ogre::Real m_timeAcumulator; + + + NewtonWorld* m_world; MaterialID* m_defaultMatID; @@ -264,7 +280,7 @@ typedef std::vector< OgreNewt::Body* > BodyVector; typedef std::vector< BodyVector > BodyVectorVector; - mutable BodyVectorVector m_bodyUpdateNodeRequests; + mutable BodyVectorVector m_bodyUpdateNodeRequests; mutable Debugger* m_debugger; Modified: branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -23,10 +23,9 @@ FrameListener() { m_World = W; - desired_framerate = update_framerate; - m_update = (Ogre::Real)(1.0f / (Ogre::Real)desired_framerate); - m_elapsed = 0.0f; + // set the game fps + m_World->SetUpdateFPS(update_framerate, 5); } BasicFrameListener::~BasicFrameListener(void) @@ -35,46 +34,7 @@ bool BasicFrameListener::frameStarted(const Ogre::FrameEvent &evt) { - m_elapsed += evt.timeSinceLastFrame; - -#ifdef _DEBUG - Ogre::LogManager::getSingleton().logMessage(" Newton Frame Listener... m_elapsed: "+Ogre::StringConverter::toString(m_elapsed)+ - " m_update:"+Ogre::StringConverter::toString(m_update)); -#endif - - int count = 0; - - // loop through and update as many times as necessary (up to 10 times maximum). - if ((m_elapsed > m_update) && (m_elapsed < (m_update * 10)) ) - { - while (m_elapsed > m_update) - { - m_World->update( m_update ); - m_elapsed -= m_update; - count++; - } - } - else - { - if (m_elapsed < (m_update)) - { - // not enough time has passed this loop, so ignore for now. - } - else - { - // too much time has passed (would require more than 10 updates!), so just update once and reset. - // this often happens on the first frame of a game, where assets and other things were loading, then - // the elapsed time since the last drawn frame is very long. - m_World->update( m_elapsed ); - count++; - m_elapsed = 0.0f; // reset the elapsed time so we don't become "eternally behind". - } - } - -#ifdef _DEBUG - Ogre::LogManager::getSingleton().logMessage(" Newton updates this loop: "+Ogre::StringConverter::toString(count)); -#endif - + m_World->update (evt.timeSinceLastFrame); return true; } Modified: branches/ogrenewt/newton20/src/OgreNewt_Body.cpp =================================================================== --- branches/ogrenewt/newton20/src/OgreNewt_Body.cpp 2009-12-28 20:07:05 UTC (rev 2774) +++ branches/ogrenewt/newton20/src/OgreNewt_Body.cpp 2009-12-30 15:20:22 UTC (rev 2775) @@ -21,7 +21,7 @@ m_userdata = NULL; m_forcecallback = NULL; - m_transformcallback = NULL; +// m_transformcallback = NULL; m_buoyancycallback = NULL; m_nodeupdateneeded = false; @@ -30,6 +30,7 @@ NewtonBodySetUserData( m_body, this ); NewtonBodySetDestructorCallback( m_body, newtonDestructor ); + NewtonBodySetTransformCallback( m_body, newtonTransformCallback ); } Body::~Body() @@ -65,19 +66,31 @@ // transform callback void _CDECL ... [truncated message content] |
From: <kal...@us...> - 2010-01-01 17:46:56
|
Revision: 2776 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2776&view=rev Author: kallaspriit Date: 2010-01-01 17:46:46 +0000 (Fri, 01 Jan 2010) Log Message: ----------- Updated custom joints demo and started raycast car implementation, by Julio. Modified Paths: -------------- branches/ogrenewt/newton20/OgreNewt.sln branches/ogrenewt/newton20/OgreNewt.suo branches/ogrenewt/newton20/OgreNewt.vcproj branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.h branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.h branches/ogrenewt/newton20/demos/Demo07_CustomJoints/Demo07_CustomJoints.vcproj branches/ogrenewt/newton20/demos/Demo07_CustomJoints/OgreNewtonApplication.cpp branches/ogrenewt/newton20/demos/Demo09_PlayerController/OgreNewtonApplication.cpp branches/ogrenewt/newton20/inc/OgreNewt.h branches/ogrenewt/newton20/inc/OgreNewt_BasicJoints.h branches/ogrenewt/newton20/inc/OgreNewt_Joint.h branches/ogrenewt/newton20/inc/OgreNewt_PlayerController.h branches/ogrenewt/newton20/inc/OgreNewt_RayCast.h branches/ogrenewt/newton20/inc/OgreNewt_Vehicle.h branches/ogrenewt/newton20/inc/OgreNewt_World.h branches/ogrenewt/newton20/src/OgreNewt_BasicFrameListener.cpp branches/ogrenewt/newton20/src/OgreNewt_BasicJoints.cpp branches/ogrenewt/newton20/src/OgreNewt_Body.cpp branches/ogrenewt/newton20/src/OgreNewt_ConvexCast.cpp branches/ogrenewt/newton20/src/OgreNewt_Joint.cpp branches/ogrenewt/newton20/src/OgreNewt_PlayerController.cpp branches/ogrenewt/newton20/src/OgreNewt_RayCast.cpp branches/ogrenewt/newton20/src/OgreNewt_Vehicle.cpp branches/ogrenewt/newton20/src/OgreNewt_World.cpp Added Paths: ----------- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Demo05_SimpleVehicle.vcproj branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Demo05_SimpleVehicle.vcproj.Julio-PC.Julio.user branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Ogre.log branches/ogrenewt/newton20/demos/Demo07_CustomJoints/MyCustomMotorizedHinge.cpp branches/ogrenewt/newton20/demos/Demo07_CustomJoints/MyCustomMotorizedHinge.h branches/ogrenewt/newton20/demos/MinimalOgreNewtApplication/media/primitives/box.material branches/ogrenewt/newton20/demos/media/materials/scripts/castle.material branches/ogrenewt/newton20/demos/media/materials/scripts/f1Body.material branches/ogrenewt/newton20/demos/media/materials/scripts/f1Body.skl branches/ogrenewt/newton20/demos/media/materials/scripts/f1Tire.material branches/ogrenewt/newton20/demos/media/materials/scripts/jeepBody.material branches/ogrenewt/newton20/demos/media/materials/scripts/jeepBody.skl branches/ogrenewt/newton20/demos/media/materials/scripts/jeepTire.material branches/ogrenewt/newton20/demos/media/materials/scripts/playground.material branches/ogrenewt/newton20/demos/media/materials/scripts/track.material branches/ogrenewt/newton20/demos/media/models/f1Body.mesh branches/ogrenewt/newton20/demos/media/models/f1Tire.mesh branches/ogrenewt/newton20/demos/media/models/jeepBody.mesh branches/ogrenewt/newton20/demos/media/models/jeepTire.mesh branches/ogrenewt/newton20/demos/media/models/track.mesh branches/ogrenewt/newton20/demos/media/primitives/textures/Asphalt1.tga branches/ogrenewt/newton20/demos/media/primitives/textures/cabrio_tex.tga branches/ogrenewt/newton20/demos/media/primitives/textures/ferrari_body_tex.tga branches/ogrenewt/newton20/demos/media/primitives/textures/ferrari_tire_tex.tga branches/ogrenewt/newton20/demos/media/primitives/textures/lav_tire.tga branches/ogrenewt/newton20/inc/OgreNewt_RayCastVehicle.h branches/ogrenewt/newton20/src/OgreNewt_RayCastVehicle.cpp Removed Paths: ------------- branches/ogrenewt/newton20/demos/media/primitives/castle.material branches/ogrenewt/newton20/demos/media/primitives/playground.material Modified: branches/ogrenewt/newton20/OgreNewt.sln =================================================================== --- branches/ogrenewt/newton20/OgreNewt.sln 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/OgreNewt.sln 2010-01-01 17:46:46 UTC (rev 2776) @@ -42,6 +42,11 @@ {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo05_SimpleVehicle", "demos\Demo05_SimpleVehicle\Demo05_SimpleVehicle.vcproj", "{0F61AA2F-57FC-409F-B697-E2300FF26473}" + ProjectSection(ProjectDependencies) = postProject + {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} = {C28C7710-76B1-4FFD-A85A-9AEFDA25EE64} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -104,6 +109,12 @@ {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|Win32.ActiveCfg = Release|Win32 {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|Win32.Build.0 = Release|Win32 {44F65D14-7093-4B8F-BE0F-95D5D31CFBBC}.Release|x64.ActiveCfg = Release|Win32 + {0F61AA2F-57FC-409F-B697-E2300FF26473}.Debug|Win32.ActiveCfg = Debug|Win32 + {0F61AA2F-57FC-409F-B697-E2300FF26473}.Debug|Win32.Build.0 = Debug|Win32 + {0F61AA2F-57FC-409F-B697-E2300FF26473}.Debug|x64.ActiveCfg = Debug|Win32 + {0F61AA2F-57FC-409F-B697-E2300FF26473}.Release|Win32.ActiveCfg = Release|Win32 + {0F61AA2F-57FC-409F-B697-E2300FF26473}.Release|Win32.Build.0 = Release|Win32 + {0F61AA2F-57FC-409F-B697-E2300FF26473}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: branches/ogrenewt/newton20/OgreNewt.suo =================================================================== (Binary files differ) Modified: branches/ogrenewt/newton20/OgreNewt.vcproj =================================================================== --- branches/ogrenewt/newton20/OgreNewt.vcproj 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/OgreNewt.vcproj 2010-01-01 17:46:46 UTC (rev 2776) @@ -289,6 +289,10 @@ > </File> <File + RelativePath=".\src\OgreNewt_RayCastVehicle.cpp" + > + </File> + <File RelativePath=".\src\OgreNewt_Stdafx.cpp" > <FileConfiguration @@ -397,6 +401,10 @@ > </File> <File + RelativePath=".\inc\OgreNewt_RayCastVehicle.h" + > + </File> + <File RelativePath=".\inc\OgreNewt_Stdafx.h" > </File> Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonApplication.cpp 2010-01-01 17:46:46 UTC (rev 2776) @@ -52,7 +52,7 @@ box1node->setScale( size ); // box1->setNormaliseNormals(true); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); + OgreNewt::ConvexCollisionPtr col (new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 )); OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); Modified: branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/demos/Demo02_Joints/OgreNewtonFrameListener.cpp 2010-01-01 17:46:46 UTC (rev 2776) @@ -97,7 +97,8 @@ ent->setMaterialName( "Simple/dirt01" ); // ent->setNormaliseNormals(true); - OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(0.5f, 0.5f, 0.5f), 0 )); +// OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(0.5f, 0.5f, 0.5f), 0 )); + OgreNewt::ConvexCollisionPtr col (new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(0.5f, 0.5f, 0.5f), 0 )); OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); #ifdef OGRENEWT_NO_COLLISION_SHAREDPTR Modified: branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/demos/Demo03_CollisionCallbacks/OgreNewtonApplication.cpp 2010-01-01 17:46:46 UTC (rev 2776) @@ -1,132 +1,137 @@ -/* - OgreNewt library - connecting Ogre and Newton! - - Demo03_CollisionCallbacks - the material system in Newton is extremely powerful. by assigning - materials to bodies, you can define all kinds of specific behavior when objects collide. you can use - material callbacks to create hot spots, or make sound effects, or spawn particles, etc. this example - uses a conveyor belt as an example. look at the conveyorMatCallback to see how it's implemented. -*/ -#include "OgreNewtonApplication.h" -#include "OgreNewtonFrameListener.h" - -#include <OgreNewt.h> -#include <OgreNewt_BasicFrameListener.h> - - - -OgreNewtonApplication::OgreNewtonApplication(void) -{ - m_World = new OgreNewt::World(); - -} - -OgreNewtonApplication::~OgreNewtonApplication(void) -{ - std::vector<ConveyorBelt*>::iterator it; - for (it=mBelts.begin(); it!=mBelts.end(); it++) - { - ConveyorBelt* belt = (*it); - delete belt; - } - - delete m_World; -} - - - -void OgreNewtonApplication::createScene() -{ - - // sky box. - mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); - - // shadows on. - mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_MODULATIVE ); - - createMaterials(); - - // lets make a few conveyor belt objects. - ConveyorBelt* belt = new ConveyorBelt(); - Ogre::String name("ConveyorBelt1"); - Ogre::Vector3 size(15,0.3,3); - Ogre::Vector3 dir(1,0,0); - Ogre::Real speed(2.0); - Ogre::Vector3 pos(0,2,0); - Ogre::Quaternion orient(Ogre::Quaternion::IDENTITY); - belt->init( name, mSceneMgr, m_World, size, dir, speed, pos, orient, mMatConveyor, BT_CONVEYOR ); - mBelts.push_back( belt ); - - - belt = new ConveyorBelt(); - name = Ogre::String("ConveyorBelt2"); - size = Ogre::Vector3(23,0.3,4); - dir = Ogre::Vector3(-1,0,0); - speed = Ogre::Real(6.0); - pos = Ogre::Vector3(3,-1,0); - orient = Ogre::Quaternion(Ogre::Quaternion::IDENTITY); - belt->init( name, mSceneMgr, m_World, size, dir, speed, pos, orient, mMatConveyor, BT_CONVEYOR ); - mBelts.push_back( belt ); - - - // floor object! - Entity* floor; - SceneNode* floornode; -// floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); - floor = mSceneMgr->createEntity("Floor", "playground.mesh" ); - floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); - floornode->attachObject( floor ); -// floor->setMaterialName( "Simple/BeachStones" ); - - floor->setCastShadows( false ); - - //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); - -#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR - delete col; -#endif - - //floornode->setScale( siz ); - bod->attachNode( floornode ); - bod->setPositionOrientation( Ogre::Vector3(0.0,-10.0,0.0), Ogre::Quaternion::IDENTITY ); - - - // position camera - mCamera->setPosition(0.0, 2.0, 0.0); - - //make a light - Ogre::Light* light; - - light = mSceneMgr->createLight( "Light1" ); - light->setType( Ogre::Light::LT_POINT ); - light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); - - - -} - -void OgreNewtonApplication::createMaterials() -{ - mMatDefault = m_World->getDefaultMaterialID(); - mMatConveyor = new OgreNewt::MaterialID( m_World ); - - mMatPairDefaultConveyor = new OgreNewt::MaterialPair( m_World, mMatDefault, mMatConveyor ); - mConveyorCallback = new ConveyorMatCallback( BT_CONVEYOR ); - mMatPairDefaultConveyor->setContactCallback( mConveyorCallback ); - mMatPairDefaultConveyor->setDefaultSoftness( 0.8 ); - mMatPairDefaultConveyor->setDefaultElasticity( 0.05 ); - mMatPairDefaultConveyor->setDefaultFriction( 0.9, 0.8 ); - -} - - -void OgreNewtonApplication::createFrameListener() -{ - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); - mRoot->addFrameListener(mNewtonListener); - - mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); - mRoot->addFrameListener(mFrameListener); -} - +/* + OgreNewt library - connecting Ogre and Newton! + + Demo03_CollisionCallbacks - the material system in Newton is extremely powerful. by assigning + materials to bodies, you can define all kinds of specific behavior when objects collide. you can use + material callbacks to create hot spots, or make sound effects, or spawn particles, etc. this example + uses a conveyor belt as an example. look at the conveyorMatCallback to see how it's implemented. +*/ +#include "OgreNewtonApplication.h" +#include "OgreNewtonFrameListener.h" + +#include <OgreNewt.h> +#include <OgreNewt_BasicFrameListener.h> + + + +OgreNewtonApplication::OgreNewtonApplication(void) +{ + m_World = new OgreNewt::World(); + +} + +OgreNewtonApplication::~OgreNewtonApplication(void) +{ + std::vector<ConveyorBelt*>::iterator it; + for (it=mBelts.begin(); it!=mBelts.end(); it++) + { + ConveyorBelt* belt = (*it); + delete belt; + } + + delete m_World; +} + + + +void OgreNewtonApplication::createScene() +{ + + // sky box. + mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); + + // shadows on. + mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_MODULATIVE ); + + createMaterials(); + + // lets make a few conveyor belt objects. + ConveyorBelt* belt = new ConveyorBelt(); + Ogre::String name("ConveyorBelt1"); + Ogre::Vector3 size(15,0.3,3); + Ogre::Vector3 dir(1,0,0); + Ogre::Real speed(2.0); + Ogre::Vector3 pos(0,2,0); + Ogre::Quaternion orient(Ogre::Quaternion::IDENTITY); + belt->init( name, mSceneMgr, m_World, size, dir, speed, pos, orient, mMatConveyor, BT_CONVEYOR ); + mBelts.push_back( belt ); + + + belt = new ConveyorBelt(); + name = Ogre::String("ConveyorBelt2"); + size = Ogre::Vector3(23,0.3,4); + dir = Ogre::Vector3(-1,0,0); + speed = Ogre::Real(6.0); + pos = Ogre::Vector3(3,-1,0); + orient = Ogre::Quaternion(Ogre::Quaternion::IDENTITY); + belt->init( name, mSceneMgr, m_World, size, dir, speed, pos, orient, mMatConveyor, BT_CONVEYOR ); + mBelts.push_back( belt ); + + + // floor object! + Entity* floor; + SceneNode* floornode; +// floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); + floor = mSceneMgr->createEntity("Floor", "playground.mesh" ); + floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); + floornode->attachObject( floor ); +// floor->setMaterialName( "Simple/BeachStones" ); + + floor->setCastShadows( false ); + + //Ogre::Vector3 siz(100.0, 10.0, 100.0); + OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); + +#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR + delete col; +#endif + + //floornode->setScale( siz ); + bod->attachNode( floornode ); + bod->setPositionOrientation( Ogre::Vector3(0.0,-10.0,0.0), Ogre::Quaternion::IDENTITY ); + + + // position camera + mCamera->setPosition(0.0, 2.0, 0.0); + + // set the near and far clip plane + mCamera->setNearClipDistance(0.2f); + mCamera->setFarClipDistance(1000.0f); + + + //make a light + Ogre::Light* light; + + light = mSceneMgr->createLight( "Light1" ); + light->setType( Ogre::Light::LT_POINT ); + light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); + + + +} + +void OgreNewtonApplication::createMaterials() +{ + mMatDefault = m_World->getDefaultMaterialID(); + mMatConveyor = new OgreNewt::MaterialID( m_World ); + + mMatPairDefaultConveyor = new OgreNewt::MaterialPair( m_World, mMatDefault, mMatConveyor ); + mConveyorCallback = new ConveyorMatCallback( BT_CONVEYOR ); + mMatPairDefaultConveyor->setContactCallback( mConveyorCallback ); + mMatPairDefaultConveyor->setDefaultSoftness( 0.8 ); + mMatPairDefaultConveyor->setDefaultElasticity( 0.05 ); + mMatPairDefaultConveyor->setDefaultFriction( 0.9, 0.8 ); + +} + + +void OgreNewtonApplication::createFrameListener() +{ + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); + + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); + mRoot->addFrameListener(mFrameListener); +} + Added: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Demo05_SimpleVehicle.vcproj =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Demo05_SimpleVehicle.vcproj (rev 0) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Demo05_SimpleVehicle.vcproj 2010-01-01 17:46:46 UTC (rev 2776) @@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="Demo05_SimpleVehicle" + ProjectGUID="{0F61AA2F-57FC-409F-B697-E2300FF26473}" + RootNamespace="Demo09_PlayerController" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\OIS";..\..\inc;." + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain_d.lib OIS_d.lib OgreGUIRenderer_d.lib CEGUIBase_d.lib OgreNewt_d.lib" + LinkIncremental="1" + AdditionalLibraryDirectories="..\..\lib;"$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Debug";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)\$(ProjectName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""$(NEWTON_HOME)\sdk";"$(BOOST_HOME)\";"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\include";"$(OGRE_HOME)\Samples\Common\CEGUIRenderer\include";"$(OGRE_HOME)\Samples\Common\include";"$(OGRE_HOME)\samples\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Dependencies\include\ois";"$(OGRE_HOME)\Dependencies\include\CEGUI";"$(OGRE_HOME)\include\OIS";..\..\inc;." + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="newton.lib OgreMain.lib OIS.lib OgreGUIRenderer.lib CEGUIBase.lib OgreNewt.lib" + LinkIncremental="1" + AdditionalLibraryDirectories="..\..\lib;"$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\Release";"$(NEWTON_HOME)\sdk\x32\dll_vs9"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\demo05.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonApplication.cpp" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.cpp" + > + </File> + <File + RelativePath=".\SimpleVehicle.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\OgreNewtonApplication.h" + > + </File> + <File + RelativePath=".\OgreNewtonFrameListener.h" + > + </File> + <File + RelativePath=".\SimpleVehicle.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Demo05_SimpleVehicle.vcproj.Julio-PC.Julio.user =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Demo05_SimpleVehicle.vcproj.Julio-PC.Julio.user (rev 0) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Demo05_SimpleVehicle.vcproj.Julio-PC.Julio.user 2010-01-01 17:46:46 UTC (rev 2776) @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="windows-1257"?> +<VisualStudioUserFile + ProjectType="Visual C++" + Version="9.00" + ShowAllFiles="false" + > + <Configurations> + <Configuration + Name="Debug|Win32" + > + <DebugSettings + Command="$(TargetPath)" + WorkingDirectory="$(TargetDir)" + CommandArguments="" + Attach="false" + DebuggerType="3" + Remote="1" + RemoteMachine="JULIO-PC" + RemoteCommand="" + HttpUrl="" + PDBPath="" + SQLDebugging="" + Environment="" + EnvironmentMerge="true" + DebuggerFlavor="0" + MPIRunCommand="" + MPIRunArguments="" + MPIRunWorkingDirectory="" + ApplicationCommand="" + ApplicationArguments="" + ShimCommand="" + MPIAcceptMode="" + MPIAcceptFilter="" + /> + </Configuration> + <Configuration + Name="Release|Win32" + > + <DebugSettings + Command="$(TargetPath)" + WorkingDirectory="$(TargetDir)" + CommandArguments="" + Attach="false" + DebuggerType="3" + Remote="1" + RemoteMachine="JULIO-PC" + RemoteCommand="" + HttpUrl="" + PDBPath="" + SQLDebugging="" + Environment="" + EnvironmentMerge="true" + DebuggerFlavor="0" + MPIRunCommand="" + MPIRunArguments="" + MPIRunWorkingDirectory="" + ApplicationCommand="" + ApplicationArguments="" + ShimCommand="" + MPIAcceptMode="" + MPIAcceptFilter="" + /> + </Configuration> + </Configurations> +</VisualStudioUserFile> Added: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Ogre.log =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Ogre.log (rev 0) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/Ogre.log 2010-01-01 17:46:46 UTC (rev 2776) @@ -0,0 +1,31 @@ +12:29:39: Creating resource group General +12:29:39: Creating resource group Internal +12:29:39: Creating resource group Autodetect +12:29:39: SceneManagerFactory for type 'DefaultSceneManager' registered. +12:29:39: Registering ResourceManager for type Material +12:29:39: Registering ResourceManager for type Mesh +12:29:39: Registering ResourceManager for type Skeleton +12:29:39: MovableObjectFactory for type 'ParticleSystem' registered. +12:29:39: OverlayElementFactory for type Panel registered. +12:29:39: OverlayElementFactory for type BorderPanel registered. +12:29:39: OverlayElementFactory for type TextArea registered. +12:29:39: Registering ResourceManager for type Font +12:29:39: ArchiveFactory for archive type FileSystem registered. +12:29:39: ArchiveFactory for archive type Zip registered. +12:29:39: FreeImage version: 3.10.0 +12:29:39: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details +12:29:39: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2 +12:29:39: DDS codec registering +12:29:39: Registering ResourceManager for type HighLevelGpuProgram +12:29:39: Registering ResourceManager for type Compositor +12:29:39: MovableObjectFactory for type 'Entity' registered. +12:29:39: MovableObjectFactory for type 'Light' registered. +12:29:39: MovableObjectFactory for type 'BillboardSet' registered. +12:29:39: MovableObjectFactory for type 'ManualObject' registered. +12:29:39: MovableObjectFactory for type 'BillboardChain' registered. +12:29:39: MovableObjectFactory for type 'RibbonTrail' registered. +12:29:39: OGRE EXCEPTION(6:FileNotFoundException): 'plugins.cfg' file not found! in ConfigFile::load at c:\ogre\ogremain\src\ogreconfigfile.cpp (line 84) +12:29:39: plugins.cfg not found, automatic plugin loading disabled. +12:29:39: *-*-* OGRE Initialising +12:29:39: *-*-* Version 1.6.4 (Shoggoth) +12:29:39: OGRE EXCEPTION(6:FileNotFoundException): 'resources.cfg' file not found! in ConfigFile::load at c:\ogre\ogremain\src\ogreconfigfile.cpp (line 84) Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonApplication.cpp 2010-01-01 17:46:46 UTC (rev 2776) @@ -1,91 +1,192 @@ -/* - OgreNewt library - connecting Ogre and Newton! - - Demo05_SimpleVehicle - how to use the vehicle classes to make a simple vehicle in OgreNewt. -*/ - -#include "OgreNewtonApplication.h" -#include "OgreNewtonFrameListener.h" - -#include <OgreNewt.h> -#include <OgreNewt_BasicFrameListener.h> - - -OgreNewtonApplication::OgreNewtonApplication(void) -{ - // create OgreNewt world. - m_World = new OgreNewt::World(); - -} - -OgreNewtonApplication::~OgreNewtonApplication(void) -{ - // destroy world. - delete m_World; -} - - - -void OgreNewtonApplication::createScene() -{ - // sky box. - mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); - - // shadows on! - mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_ADDITIVE ); - - - // floor object! this time we'll scale it slightly to make it more vehicle-friendly :P - Ogre::Vector3 size(2.0,0.5,2.0); - Entity* floor; - SceneNode* floornode; - floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" ); - floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); - floornode->attachObject( floor ); - floor->setMaterialName( "Simple/BeachStones" ); - floornode->setScale(size); - - floor->setCastShadows( false ); - - //Ogre::Vector3 siz(100.0, 10.0, 100.0); - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floornode, false, 0 ); - OgreNewt::Body* bod = new OgreNewt::Body( m_World, col ); - delete col; - - bod->attachNode( floornode ); - bod->setPositionOrientation( Ogre::Vector3(0.0,-2.0,0.0), Ogre::Quaternion::IDENTITY ); - - - - // here's where we make the simple vehicle. everything is taken care of in the constuctor. - mCar = new SimpleVehicle( mSceneMgr, m_World, Ogre::Vector3(0,-0.5,0), Ogre::Quaternion(Ogre::Quaternion::IDENTITY) ); - - - - // position camera - msnCam = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - msnCam->attachObject( mCamera ); - mCamera->setPosition(0.0, 0.0, 0.0); - msnCam->setPosition( 0.0, 1.0, 20.0); - - //make a light - Ogre::Light* light; - - light = mSceneMgr->createLight( "Light1" ); - light->setType( Ogre::Light::LT_POINT ); - light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); - - - -} - - -void OgreNewtonApplication::createFrameListener() -{ - mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World, msnCam, mCar ); - mRoot->addFrameListener(mFrameListener); - - mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 60 ); - mRoot->addFrameListener(mNewtonListener); -} - +/* + OgreNewt library - connecting Ogre and Newton! + + Demo05_SimpleVehicle - how to use the vehicle classes to make a simple vehicle in OgreNewt. +*/ + +#include "OgreNewtonApplication.h" +#include "OgreNewtonFrameListener.h" + +#include <OgreNewt.h> +#include <OgreNewt_BasicFrameListener.h> + + +OgreNewtonApplication::OgreNewtonApplication(void) +{ + // create OgreNewt world. + m_World = new OgreNewt::World(); + +} + +OgreNewtonApplication::~OgreNewtonApplication(void) +{ + // destroy world. + delete m_World; +} + + +static SimpleVehicle::CAR_CONFIG raceCar = +{ + "f1Body.mesh", + + // FL_TIRE + {"f1Tire.mesh", {-0.743107f, -0.023629f, -1.279540f}, {0.70710552f, 0.0f, 0.70710552f, 0.0f}}, + + // FR_TIRE + {"f1Tire.mesh", { 0.741849f, -0.023629f, -1.279540,}, {0.70710552f, 0.0f, -0.70710552f, 0.0f}}, + + // RR_tire + {"f1Tire.mesh", { 0.725642f, -0.023618f, 1.717240f}, {0.70710552f, 0.0f, -0.70710552f, 0.0f}}, + + // RL_tire + {"f1Tire.mesh", {-0.725644f, -0.023618f, 1.717240f}, {0.70710552f, 0.0f, 0.70710552f, 0.0f}}, +}; + + + +static SimpleVehicle::CAR_CONFIG Jeep = +{ + "jeepBody.mesh", + + // FL_TIRE + {"jeepTire.mesh", {-0.625456f, -0.296697f, -1.235474f}, {0.70710552f, 0.0f, 0.70710552f, 0.0f}}, + + // FR_TIRE + {"jeepTire.mesh", { 0.625456f, -0.296697f, -1.235474f}, {0.70710552f, 0.0f, 0.70710552f, 0.0f}}, + + // RR_tire + {"jeepTire.mesh", { 0.625456f, -0.296697f, 0.818093f}, {0.70710552f, 0.0f, 0.70710552f, 0.0f}}, + + // RL_tire + {"jeepTire.mesh", {-0.625456f, -0.296697f, 0.818093f}, {0.70710552f, 0.0f, 0.70710552f, 0.0f}}, +}; + +class CarPlacementRaycast: public OgreNewt::BasicRaycast +{ + public: + CarPlacementRaycast(OgreNewt::Body* car, Ogre::Vector3& location) + :OgreNewt::BasicRaycast () + { + // ignore go as if will no do the user filter correctly + Ogre::Vector3 start (location); + Ogre::Vector3 end (location); + + start.y += 100.0f; + end.y -= 100.0f; + + // re-cast the ray this time filtering the car body + m_myBody = car; + go (car->getWorld(), start, end, true); + + OgreNewt::BasicRaycast::BasicRaycastInfo info = getFirstHit(); + m_elevation = 0.5f + start.y + (end.y - start.y) * info.mDistance; + } + + // skip the car body + virtual bool userPreFilterCallback( OgreNewt::Body* body ) + { + // ray form casting hi own body + return (body != m_myBody); + } + + Ogre::Real m_elevation; + OgreNewt::Body* m_myBody; + +}; + + +void OgreNewtonApplication::createScene() +{ + // sky box. + mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox"); + + // shadows on! + mSceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_STENCIL_ADDITIVE ); + + + // floor object! this time we'll scale it slightly to make it more vehicle-friendly :P + Ogre::Vector3 size(2.0,0.5,2.0); + Entity* floor; + SceneNode* floornode; + const char *levelName = "track.mesh"; +// const char *levelName = "simple_terrain.mesh"; + + floor = mSceneMgr->createEntity("Floor", levelName ); + floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" ); + floornode->attachObject( floor ); +// floor->setMaterialName( "Simple/BeachStones" ); + floornode->setScale(size); + floor->setCastShadows( false ); + + char serializeCollisionName[256]; + strcpy (serializeCollisionName, levelName); + strtok (serializeCollisionName, "."); + strcat (serializeCollisionName, ".col"); + + FILE* file = fopen (serializeCollisionName, "rb"); + if (!file) { + // serialize the mesh so that next time loads faster + OgreNewt::CollisionSerializer saveLevelCollision; + OgreNewt::CollisionPtr tmpSphape = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 )); + saveLevelCollision.exportCollision(tmpSphape, serializeCollisionName); + file = fopen (serializeCollisionName, "rb"); + } + + // load level collision from serialized file + FileHandleDataStream streamFile (file); + OgreNewt::CollisionSerializer loadLevelCollision; + OgreNewt::CollisionPtr col = loadLevelCollision.importCollision(streamFile, m_World); + fclose (file); + OgreNewt::Body* bod = new OgreNewt::Body( m_World, OgreNewt::CollisionPtr(col)); + bod->attachNode( floornode ); +// bod->setPositionOrientation( Ogre::Vector3(0.0,-2.0,0.0), Ogre::Quaternion::IDENTITY ); + + + + // here's where we make the simple vehicle. everything is taken care of in the constructor. + mCar = SimpleVehicle::create (&raceCar, mSceneMgr, m_World); +// mCar = SimpleVehicle::create (&Jeep, mSceneMgr, m_World); + + // position the car above the ground; + Ogre::Vector3 location (0.0f, 0.0f, 0.0); + CarPlacementRaycast castRay (mCar->getBody0(), location); + location.y = castRay.m_elevation + 0.5f; + mCar->getBody0()->setPositionOrientation (location, Ogre::Quaternion(Ogre::Quaternion::IDENTITY)); + + + // position camera +// msnCam = mSceneMgr->getRootSceneNode()->createChildSceneNode(); +// msnCam->attachObject( mCamera ); + + location.y += 0.0f; + location.z += 10.0f; + mCamera->setPosition(location); +// msnCam->setPosition( 0.0, 1.0, 20.0); + + // set the near and far clip plane + mCamera->setNearClipDistance(0.2f); + mCamera->setFarClipDistance(1000.0f); + + + //make a light + Ogre::Light* light; + + light = mSceneMgr->createLight( "Light1" ); + light->setType( Ogre::Light::LT_POINT ); + light->setPosition( Ogre::Vector3(0.0, 100.0, 100.0) ); + + + +} + + +void OgreNewtonApplication::createFrameListener() +{ +// mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World, msnCam, mCar ); + mFrameListener = new OgreNewtonFrameListener( mWindow, mCamera, mSceneMgr, m_World); + mRoot->addFrameListener(mFrameListener); + + mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, m_World, 100 ); + mRoot->addFrameListener(mNewtonListener); +} + Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.cpp 2010-01-01 17:46:46 UTC (rev 2776) @@ -1,157 +1,160 @@ -#include "OgreNewtonFrameListener.h" - - -OgreNewtonFrameListener::OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, SimpleVehicle* car) : - ExampleFrameListener(win,cam) -{ - m_World = W; - mSceneMgr = mgr; - - mCar = car; - - timer = 0.0f; - OgreNewt::Debugger &debug(m_World->getDebugger()); - debug.init(mgr); -} - -OgreNewtonFrameListener::~OgreNewtonFrameListener(void) -{ -} - -bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) -{ - Vector3 trans, strafe, vec; - Quaternion quat; - - quat = mCamera->getOrientation(); - - vec = Vector3(0.0,0.0,-0.5); - trans = quat * vec; - - vec = Vector3(0.5,0.0,0.0); - strafe = quat * vec; - - mKeyboard->capture(); - mMouse->capture(); - - mCamera->pitch( Degree(mMouse->getMouseState().Y.rel * -0.5) ); - mCamera->setFixedYawAxis(true); - mCamera->yaw( Degree(mMouse->getMouseState().X.rel * -0.5) ); - - if (mKeyboard->isKeyDown(OIS::KC_UP)) - mCamera->moveRelative(trans); - - if (mKeyboard->isKeyDown(OIS::KC_DOWN)) - mCamera->moveRelative(trans * -1.0); - - if (mKeyboard->isKeyDown(OIS::KC_LEFT)) - mCamera->moveRelative(strafe * -1.0); - - if (mKeyboard->isKeyDown(OIS::KC_RIGHT)) - mCamera->moveRelative(strafe); - - - if (mKeyboard->isKeyDown(OIS::KC_SPACE)) - { - if (timer <= 0.0) - { - Ogre::Vector3 dir, vec; - Ogre::Quaternion camorient = mCamera->getDerivedOrientation(); - vec = Ogre::Vector3(0,0,-1); - - dir = camorient * vec; - - Entity* ent; - SceneNode* node; - Ogre::String name; - Ogre::Vector3 pos = mCamera->getDerivedPosition(); - - name = "Body "+Ogre::StringConverter::toString( count++ ); - - ent = mSceneMgr->createEntity( name, "ellipsoid.mesh" ); - node = mSceneMgr->getRootSceneNode()->createChildSceneNode( name ); - node->attachObject( ent ); - - ent->setMaterialName( "Simple/dirt01" ); - - OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1), 0 ); - OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); - - Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcSphereSolid( 10.0, 1.0 ); - body->setMassMatrix( 10.0, inertia ); - body->attachToNode( node ); - body->setStandardForceCallback(); - body->setPositionOrientation( pos, camorient ); - body->setVelocity( (dir * 50.0) ); - - timer = 0.2; - } - } - - timer -= evt.timeSinceLastFrame; - - // --------------------------------------------------------- - // -- VEHICLE CONTORLS - // --------------------------------------------------------- - Ogre::Real torque = 0.0; - Ogre::Degree steering(0.0); - - if (mKeyboard->isKeyDown(OIS::KC_W)) - torque += 600.0; - - if (mKeyboard->isKeyDown(OIS::KC_S)) - torque -= 600.0; - - if (mKeyboard->isKeyDown(OIS::KC_A)) - steering += Ogre::Degree(30); - - if (mKeyboard->isKeyDown(OIS::KC_D)) - steering -= Ogre::Degree(30); - - //update the vehicle! - mCar->setTorqueSteering( torque, steering ); - - if ((mKeyboard->isKeyDown(OIS::KC_R)) && (!mR)) - { - mR = true; - // rebuild the vehicle - if (mCar) - { - delete mCar; - mCar = new SimpleVehicle( mSceneMgr, m_World, Ogre::Vector3(0,Ogre::Math::UnitRandom() * 10.0,0), Ogre::Quaternion(Ogre::Quaternion::IDENTITY) ); - } - } - if (!mKeyboard->isKeyDown( OIS::KC_R )) { mR = false; } - - - OgreNewt::Debugger& debug(m_World->getDebugger()); - if (mKeyboard->isKeyDown(OIS::KC_F3)) - { - debug.showDebugInformation(); - debug.startRaycastRecording(); - debug.clearRaycastsRecorded(); - } - else - { - debug.hideDebugInformation(); - debug.clearRaycastsRecorded(); - debug.stopRaycastRecording(); - } - - - - if (mKeyboard->isKeyDown(OIS::KC_T)) - m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); - - - if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) - { - if (mCar) - delete mCar; - - return false; - } - - return true; -} - +#include "OgreNewtonFrameListener.h" + + +//OgreNewtonFrameListener::OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, SimpleVehicle* car) : +OgreNewtonFrameListener::OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W) : + ExampleFrameListener(win,cam) +{ + m_World = W; + mSceneMgr = mgr; + +// mCar = car; + + timer = 0.0f; + OgreNewt::Debugger &debug(m_World->getDebugger()); + debug.init(mgr); +} + +OgreNewtonFrameListener::~OgreNewtonFrameListener(void) +{ +} + +bool OgreNewtonFrameListener::frameStarted(const FrameEvent &evt) +{ + Vector3 trans, strafe, vec; + Quaternion quat; + + quat = mCamera->getOrientation(); + + vec = Vector3(0.0,0.0,-0.5); + trans = quat * vec; + + vec = Vector3(0.5,0.0,0.0); + strafe = quat * vec; + + mKeyboard->capture(); + mMouse->capture(); + + mCamera->pitch( Degree(mMouse->getMouseState().Y.rel * -0.5) ); + mCamera->setFixedYawAxis(true); + mCamera->yaw( Degree(mMouse->getMouseState().X.rel * -0.5) ); + + if (mKeyboard->isKeyDown(OIS::KC_UP)) + mCamera->moveRelative(trans); + + if (mKeyboard->isKeyDown(OIS::KC_DOWN)) + mCamera->moveRelative(trans * -1.0); + + if (mKeyboard->isKeyDown(OIS::KC_LEFT)) + mCamera->moveRelative(strafe * -1.0); + + if (mKeyboard->isKeyDown(OIS::KC_RIGHT)) + mCamera->moveRelative(strafe); + + + if (mKeyboard->isKeyDown(OIS::KC_SPACE)) + { + if (timer <= 0.0) + { + Ogre::Vector3 dir, vec; + Ogre::Quaternion camorient = mCamera->getDerivedOrientation(); + vec = Ogre::Vector3(0,0,-1); + + dir = camorient * vec; + + Entity* ent; + SceneNode* node; + Ogre::String name; + Ogre::Vector3 pos = mCamera->getDerivedPosition(); + + name = "Body "+Ogre::StringConverter::toString( count++ ); + + ent = mSceneMgr->createEntity( name, "ellipsoid.mesh" ); + node = mSceneMgr->getRootSceneNode()->createChildSceneNode( name ); + node->attachObject( ent ); + + ent->setMaterialName( "Simple/dirt01" ); + +// OgreNewt::CollisionPtr col = new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(1,1,1), 0 ); + OgreNewt::ConvexCollisionPtr col (new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, Ogre::Vector3(0.5f, 0.5f, 0.5f), 0 )); + OgreNewt::Body* body = new OgreNewt::Body( m_World, col ); + + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); + body->setMassMatrix (1.0, 1.0*inertia ); + body->setCenterOfMass(offset); + body->attachNode( node ); + body->setStandardForceCallback(); + body->setPositionOrientation( pos, camorient ); + body->setVelocity( (dir * 50.0) ); + + timer = 0.2; + } + } + + timer -= evt.timeSinceLastFrame; + + // --------------------------------------------------------- + // -- VEHICLE CONTORLS + // --------------------------------------------------------- + Ogre::Real torque = 0.0; + Ogre::Degree steering(0.0); + + if (mKeyboard->isKeyDown(OIS::KC_W)) + torque += 600.0; + + if (mKeyboard->isKeyDown(OIS::KC_S)) + torque -= 600.0; + + if (mKeyboard->isKeyDown(OIS::KC_A)) + steering += Ogre::Degree(30); + + if (mKeyboard->isKeyDown(OIS::KC_D)) + steering -= Ogre::Degree(30); + + //update the vehicle! +// mCar->setTorqueSteering( torque, steering ); + + if ((mKeyboard->isKeyDown(OIS::KC_R)) && (!mR)) + { +// mR = true; +// // rebuild the vehicle +// if (mCar) +// { +// delete mCar; +// mCar = new SimpleVehicle( mSceneMgr, m_World, Ogre::Vector3(0,Ogre::Math::UnitRandom() * 10.0,0), Ogre::Quaternion(Ogre::Quaternion::IDENTITY) ); +// } + } + if (!mKeyboard->isKeyDown( OIS::KC_R )) { mR = false; } + + + OgreNewt::Debugger& debug(m_World->getDebugger()); + if (mKeyboard->isKeyDown(OIS::KC_F3)) + { + debug.showDebugInformation(); + debug.startRaycastRecording(); + debug.clearRaycastsRecorded(); + } + else + { + debug.hideDebugInformation(); + debug.clearRaycastsRecorded(); + debug.stopRaycastRecording(); + } + + + + if (mKeyboard->isKeyDown(OIS::KC_T)) + m_World->setThreadCount( m_World->getThreadCount() % 2 + 1); + + + if (mKeyboard->isKeyDown(OIS::KC_ESCAPE)) + { +// if (mCar) +// delete mCar; + return false; + } + + return true; +} + Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.h =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.h 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/OgreNewtonFrameListener.h 2010-01-01 17:46:46 UTC (rev 2776) @@ -15,10 +15,11 @@ float timer; bool mR; - SimpleVehicle* mCar; +// SimpleVehicle* mCar; public: - OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, SimpleVehicle* car); +// OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W, SimpleVehicle* car); + OgreNewtonFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, OgreNewt::World* W); ~OgreNewtonFrameListener(void); bool frameStarted(const FrameEvent &evt); Modified: branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp =================================================================== --- branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp 2009-12-30 15:20:22 UTC (rev 2775) +++ branches/ogrenewt/newton20/demos/Demo05_SimpleVehicle/SimpleVehicle.cpp 2010-01-01 17:46:46 UTC (rev 2776) @@ -1,186 +1,290 @@ -#include "SimpleVehicle.h" - -int SimpleVehicle::mEntityCount = 5; - -// SimpleVehicle constructor. this creates and sets up the entire vehicle! -SimpleVehicle::SimpleVehicle(Ogre::SceneManager* mgr, OgreNewt::World* world, Ogre::Vector3& position, Ogre::Quaternion& orient) : OgreNewt::Vehicle() -{ - // save the scene manager - mSceneMgr = mgr; - mWorld = world; - - - // first thing we need to do is create the rigid body for the main chassis. - Ogre::Vector3 size(5,1.2,2); - OgreNewt::Body* bod = makeSimpleBox(size, position, orient); - - //now that we have defined the chassis, we can call the "init()" function. this is a helper function that - // simply sets up some internal wiring of the vehicle class that makes eveything work :) it also calls the virtual - // function "setup" to finish building the vehicle. - // you pass this function the body to be used as the main chassis, and the up direction of the world (for suspension purposes). - init( bod, Ogre::Vector3(0,1,0) ); - - // the above function calls our "setup" function, which takes care of the rest of the vehicle setup. - -} - - -// virtual function - setup(). this actually builds the tires, etc. -void SimpleVehicle::setup() -{ - // okay, we have the main chassis all setup. let's do a few things to it: - m_chassis->setStandardForceCallback(); - // we don't want the vehicle to freeze, because we'll be unable to control it. - m_chassis->setAutoFreeze(0); - - - // okay, let's add tires! - // all offsets here are in local space of the vehicle. - Ogre::Vector3 offset(1.8,-1.6,0.87); - - int tireNum = 0; - for (int x=-1;x<=1;x+=2) - { - for (int z=-1;z<=1;z+=2) - { - - // okay, let's create the tire itself. we'll use the OgreNewt::Vehicle::Tire class for this. most of the - // parameters are self-explanatory... try changing some of them to see what happens. - Ogre::Quaternion tireorient = Ogre::Quaternion(Ogre::Degree(0), Ogre::Vector3::UNIT_Y); - Ogre::Vector3 tirepos = offset * Ogre::Vector3(x,0.5f,z); - Ogre::Vector3 pin(0,0,x); - Ogre::Real mass = 15.0; - Ogre::Real width = 0.3; - Ogre::Real radius = 0.5; - Ogre::Real susShock = 30.0; - Ogre::Real susSpring = 200.0; - Ogre::Real susLength = 1.2; - bool steering; - - - // first, load the visual mesh that represents the tire. - Ogre::Entity* ent = mSceneMgr->createEntity("Tire"+Ogre::StringConverter::toString(mEntityCount++), "wheel.mesh"); - // make a scene node for the tire. - Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - node->attachObject( ent ); - node->setScale( Ogre::Vector3(radius, radius, width) ); - - if (x > 0) - steering = true; - else - steering = false; - - // create the actual tire! - SimpleTire* tire = new SimpleTire(this, tireorient, tirepos, pin, mass, width, radius, - susShock, susSpring, susLength, 0, steering); - - // attach the tire to the node. - tire->attachToNode( node ); - - } - } - -} - - -SimpleVehicle::SimpleTire::~SimpleTire() -{ - // destroy entity, and scene node. - Ogre::Entity* ent = (Ogre::Entity*)m_node->getAttachedObject(static_cast<unsigned short>(0)); - m_node->detachAllObjects(); - m_node->getCreator()->destroyEntity( ent ); - m_node->getParentSceneNode()->removeAndDestroyChild( m_node->getName() ); -} - -SimpleVehicle::~SimpleVehicle(void) -{ - std::vector< SimpleTire* > toDelete; - - // delete tire objects. - for (SimpleTire* tire = (SimpleTire*)getFirstTire(); tire; tire=(SimpleTire*)getNextTire(tire)) - { - toDelete.push_back( tire ); - } - - while (!toDelete.empty()) - { - SimpleTire* tire = toDelete.back(); - delete tire; - toDelete.pop_back(); - } - - // finally, destroy entity and node from chassis. - Ogre::Entity* ent = (Ogre::Entity*)((Ogre::SceneNode*)m_chassis->getOgreNode())->getAttachedObject(static_cast<unsigned short>(0)); - ((Ogre::SceneNode*)m_chassis->getOgreNode())->detachAllObjects(); - ((Ogre::SceneNode*)m_chassis->getOgreNode())->getCreator()->destroyEntity( ent ); - ((Ogre::SceneNode*)m_chassis->getOgreNode())->getParentSceneNode()->removeAndDestroyChild( m_chassis->getOgreNode()->getName() ); - - destroy(); -} - - - -// This is the important callback, which is the meat of controlling the vehicle. -void SimpleVehicle::userCallback() -{ - - // foop through wheels, adding torque and steering, and updating their positions. - for (SimpleTire* tire = (SimpleTire*)getFirstTire(); tire; tire=(SimpleTire*)getNextTire(tire)) - { - // set the torque and steering! non-steering tires get the torque. - - // is this a steering tire? - if (tire->mSteeringTire) - tire->setSteeringAngle( mSteering ); - else - tire->setTorque( mTorque ); - - // finally, this command updates the location of the visual mesh. - tire->updateNode(); - } - -} - - - - - - - -OgreNewt::Body* SimpleVehicle::makeSimpleBox( Ogre::Vector3& size, Ogre::Vector3& pos, Ogre::Quaternion& orient ) -{ - Ogre::Entity* box1; - Ogre::SceneNode* box1node; - - box1 = mSceneMgr->createEntity( "Entity"+Ogre::StringConverter::toString(mEntityCount++), "box.mesh" ); - box1node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - box1node->attachObject( box1 ); - box1node->setScale( size ); - - OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Box( mWorld, size ); - OgreNewt::Body* bod = new OgreNewt::Body( mWorld, col ); - - - // base mass on the size of the object. - Ogre::Real mass = size.x * size.y * size.z * 100.0; - // calculate the inertia based on box formula and mass - Ogre::Vector3 inertia, offset; - col->calculateInertialMatrix(inertia, offset); - - delete col; - - - bod->attachNode( box1node ); - bod->setMassMatrix( mass, mass*inertia ); - bod->setCenterOfMass(offset); - bod->setStandardForceCallback(); - - box1->setMaterialName( "Simple/BumpyMetal" ); - box1->setNormaliseNormals(true); - - - bod->setPositionOrientation( pos, orient ); - - return bod; -} - +#include "SimpleVehicle.h" + + + + + +int SimpleVehicle::mEntityCount = 0; + +SimpleVehicle* SimpleVehicle::create (CAR_CONFIG* config, Ogre::SceneManager* mgr, OgreNewt::World* world) +{ + SimpleVehicle* car; + Ogre::Entity* carEnt; + OgreNewt::Body* carBody; + Ogre::SceneNode* parentNode; + + // create the main car body + carEnt = mgr->createEntity( "CarEntity" + Ogre::StringConverter::toString(mEntityCount++), config->m_name); + parentNode = mgr->getRootSceneNode()->createChildSceneNode(); + parentNode->attachObject (carEnt); + + + OgreNewt::ConvexCollisionPtr col (new OgreNewt::CollisionPrimitives::ConvexHull (world, carEnt, 0)); + carBody = new OgreNewt::Body (world, col); + + // base mass on the size of the object. + Ogre::Real mass = 100.0f; + // calculate the inertia based on box formula and mass + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); + + carBody->attachNode (parentNode); + carBody->setMassMatrix (mass, mass*inertia); + carBody->setCenterOfMass (offset); + carBody->setStandardForceCallback(); + + // create the car joint; + car = new SimpleVehicle (carBody, 4); + + + // create and attach all tires + CAR_CONFIG::TIRE* tireGeo = &config->front_right; + for (int i = 0; i < 4; i ++) { + Ogre::Entity* tireEnt; + Ogre::SceneNode* tireNode; + tireEnt = mgr->createEntity( "CarEntity" + Ogre::StringConverter::toString(mEntityCount++), tireGeo[i].meshName); + Ogre::Vector3 posit (tireGeo[i].m_posit[0], tireGeo[i].m_posit[1], tireGeo[i].m_posit[2]); + Ogre::Quaternion rotation (tireGeo[i].m_rotation[0], tireGeo[i].m_rotation[1], tireGeo[i].m_rotation[2], tireGeo[i].m_rotation[3]); + tireNode = (Ogre::SceneNode*) parentNode->createChild (posit, rotation ); + tireNode->attachObject (tireEnt); + } + + + return car; +} + +// SimpleVehicle constructor. this creates and sets up the entire vehicle! +SimpleVehicle::SimpleVehicle(OgreNewt::Body* carBody, int maxTiresCount) + :RayCastVehicle(carBody, maxTiresCount) +{ + + // save the scene manager +// mSceneMgr = mgr; +// mWorld = world; + + + // first thing we need to do is create the rigid body for the main chassis. +// Ogre::Vector3 size(5,1.2,2); +// OgreNewt::Body* bod = makeSimpleBox(size, position, orient); +// OgreNewt::Body* bod = makeBody (carMesh, mgr); + +/* + //now that we have defined the chassis, we can call the "init()" function. this is a helper function that + // simply sets up some internal wiring of the vehicle class that makes eveything work :) it also calls the virtual + // function "setup" to finish building the vehicle. + // you pass this function the body to be used as the main chassis, and the up direction of the world (for suspension purposes). + init( bod, Ogre::Vector3(0,1,0) ); + + // the above function calls our "setup" function, which takes care of the rest of the vehicle setup. +*/ +} + +SimpleVehicle::~SimpleVehicle(void) +{ +/* + std::vector< SimpleTire* > toDelete; + + // delete tire objects. + for (SimpleTire* tire = (SimpleTire*)getFirstTire(); tire; tire=(SimpleTire*)getNextTire(tire)) + { + toDelete.push_back( tire ); + } + + while (!toDelete.empty()) + { + SimpleTire* tire = toDelete.back(); + delete tire; + toDelete.pop_back(); + } + + // finally, destroy entity and node from chassis. + Ogre::Entity* ent = (Ogre::Entity*)((Ogre::SceneNode*)m_chassis->getOgreNode())->getAttachedObject(static_cast<unsigned short>(0)); + ((Ogre::SceneNode*)m_chassis->getOgreNode())->detachAllObjects(); + ((Ogre::SceneNode*)m_chassis->getOgreNode())->getCreator()->destroyEntity( ent ); + ((Ogre::SceneNode*)m_chassis->getOgreNode())->getParentSceneNode()->removeAndDestroyChild( m_chassis->getOgreNode()->getName() ); + + destroy(); +*/ +} + +/* +OgreNewt::Body* SimpleVehicle::makeBody (const char* carMesh, Ogre::SceneManager* mgr) const +{ + Ogre::Entity* box1; + Ogre::SceneNode* box1node; + + box1 = mgr->createEntity( "CarEntity"+Ogre::StringConverter::toString(mEntityCount++), carMesh); + box1node = mgr->getRootSceneNode()->createChildSceneNode(); + box1node->attachObject (box1); + +Ogre::Vector3 pos(mEntityCount * 3, 0, 0); +box1node->setPosition(pos); +// box1node->setScale( size ); + + OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::Box( mWorld, size ); + OgreNewt::Body* bod = new OgreNewt::Body( mWorld, col ); + + // base mass on the size of the object. + Ogre::Real mass = size.x * size.y * size.z * 100.0; + // calculate the inertia based on box formula and mass + Ogre::Vector3 inertia, offset; + col->calculateInertialMatrix(inertia, offset); + + delete col; + + + bod->attachNode( box1node ); + bod->setMassMatrix( mass, mass*inertia ); + bod->setCenterOfMass(offset); + bod->setStandardForceCallback(); + + box1->setMaterialName( "Simple/BumpyMetal" ); + box1->setNormaliseNormals(true); + + + bod->setPositionOrientation( pos, orient ); + + return bod; + + return NULL; +} +*/ + + +#if 0 + +// virtual function - setup(). this actually builds the tires, etc. +void SimpleVehicle::setup() +{ + // okay, we have the main chassis all setup. let's do a few things to it: + m_chassis->setStandardForceCallback(); + // we don't want the vehicle to freeze, because we'll be unable to control it. + m_chassis->setAutoFreeze(0); + + + // okay, let's add tires! + // all offsets here are in local space of the vehicle. + Ogre::Vector3 offset(1.8,-1.6,0.87); + + int tireNum = 0; + for (int x=-1;x<=1;x+=2) + { + for (int z=-1;z<=1;z+=2) + { + + // okay, let's create the tire itself. we'll use the OgreNewt::Vehicle::Tire class for this. most of the + // parameters are self-explanatory... try changing some of them to see what happens. + Ogre::Quaternion tireorient = Ogre::Quaternion(Ogre::Degree(0), Ogre::Vector3::UNIT_Y); + Ogre::Vector3 tirepos = offset * Ogre::Vector3(x,0.5f,z); + Ogre::Vector3 pin(0,0,x); + Ogre::Real mass = 15.0; + Ogre::Real width = 0.3; + Ogre::Real radius = 0.5; + Ogre::Real susShock = 30.0; + Ogre::Real susSpring = 200.0; + Ogre::Real susLength = 1.2; + bool steering; + + + // first, load the visual mesh that represents the tire. + Ogre::Entity* ent = mSceneMgr->createEntity("Tire"+Ogre::StringConverter::toString(mEntityCount++), "wheel.mesh"); + // make a scene node for the tire. + Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + node->attachObject( ent ); + node->setScale( Ogre::Vector3(radius, radius, width) ); + + if (x > 0) + steering = true; + else + steering = false; + + // create the actual tire! + SimpleTire* tire = new SimpleTire(this, tireorient, tirepos, pin, mass, width, radius, + susShock, susSpring, susLength, 0, steering); + + // attach the tire to the node. + tire->attachToNode( node ); + + } + } + +} + + +SimpleVehicle::SimpleTire::~SimpleTire() +{ + // destroy entity, and scene node. + Ogre::Entity* ent = (Ogre::Entity*)m_node->getAttachedObject(static_cast<unsigned short>(0)); + m_node->detachAllObjects(); + m_node->getCreator()->destroyEntity( ent ); + m_node->getParentSceneNode()->removeAndDestroyChild( m_node->getName() ); +} + + + + +// This is the important callback, which is the meat of controlling the vehicle. +void SimpleVehicle::userCallback() +{ + + // foop through wheels, adding torque and steering, and updating their positions. + for (SimpleTire* tire = (SimpleTire*)getFirstTire(); tire; tire=(SimpleTire*)getNextTire(tire)) + { + // set the torque and steering! non-steering tires get the torque. + + // is this a steering tire? + if (tire->mSteeringTire) + tire->setSteeringAngle( mSteering ); + else + tire->setTorque( mTorque ); + + // finally, this command updates the location of the visual mesh. + tire->updateNode(); + } + +} + + ... [truncated message content] |