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] |