mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-29 03:26:38 +00:00 
			
		
		
		
	Merge branch 'master' of git://github.com/zinnschlag/OpenEngine.git
This commit is contained in:
		
						commit
						122e526cba
					
				
					 5 changed files with 31 additions and 31 deletions
				
			
		|  | @ -3,7 +3,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <btBulletDynamicsCommon.h> | #include <btBulletDynamicsCommon.h> | ||||||
| #include <btBulletCollisionCommon.h> | #include <btBulletCollisionCommon.h> | ||||||
| #include <components\nifbullet\bullet_nif_loader.hpp> | #include <components/nifbullet/bullet_nif_loader.hpp> | ||||||
| //#include <apps\openmw\mwworld\world.hpp>
 | //#include <apps\openmw\mwworld\world.hpp>
 | ||||||
| 
 | 
 | ||||||
| namespace OEngine { | namespace OEngine { | ||||||
|  | @ -42,4 +42,4 @@ namespace Physic | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| }} | }} | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| #ifndef OENGINE_CMOTIONSTATE_H | #ifndef OENGINE_CMOTIONSTATE_H | ||||||
| #define OENGINE_CMOTIONSTATE_H | #define OENGINE_CMOTIONSTATE_H | ||||||
| 
 | 
 | ||||||
| #include <BulletDynamics\Dynamics\btRigidBody.h> | #include <BulletDynamics/Dynamics/btRigidBody.h> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| namespace OEngine { | namespace OEngine { | ||||||
|  | @ -49,4 +49,4 @@ namespace Physic | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| }} | }} | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -4,8 +4,8 @@ Copyright (c) 2003-2008 Erwin Coumans  http://bulletphysics.com | ||||||
| 
 | 
 | ||||||
| This software is provided 'as-is', without any express or implied warranty. | 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. | 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,  | Permission is granted to anyone to use this software for any purpose, | ||||||
| including commercial applications, and to alter it and redistribute it freely,  | including commercial applications, and to alter it and redistribute it freely, | ||||||
| subject to the following restrictions: | 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. | 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. | ||||||
|  | @ -17,9 +17,9 @@ subject to the following restrictions: | ||||||
| #define KINEMATIC_CHARACTER_CONTROLLER_H | #define KINEMATIC_CHARACTER_CONTROLLER_H | ||||||
| 
 | 
 | ||||||
| #include "LinearMath/btVector3.h" | #include "LinearMath/btVector3.h" | ||||||
| #include "LinearMath\btQuickprof.h" | #include "LinearMath/btQuickprof.h" | ||||||
| 
 | 
 | ||||||
| #include "BulletDynamics\Character\btCharacterControllerInterface.h" | #include "BulletDynamics/Character/btCharacterControllerInterface.h" | ||||||
| 
 | 
 | ||||||
| #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" | #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" | ||||||
| 
 | 
 | ||||||
|  | @ -46,7 +46,7 @@ public: | ||||||
| private: | private: | ||||||
| 	btPairCachingGhostObject* externalGhostObject;  // use this for querying collisions for sliding and move
 | 	btPairCachingGhostObject* externalGhostObject;  // use this for querying collisions for sliding and move
 | ||||||
|   btPairCachingGhostObject* internalGhostObject;  // and this for recoreving from penetrations
 |   btPairCachingGhostObject* internalGhostObject;  // and this for recoreving from penetrations
 | ||||||
| 	 | 
 | ||||||
| 	btScalar m_verticalVelocity; | 	btScalar m_verticalVelocity; | ||||||
| 	btScalar m_verticalOffset; | 	btScalar m_verticalOffset; | ||||||
| 	btScalar m_fallSpeed; | 	btScalar m_fallSpeed; | ||||||
|  | @ -100,15 +100,15 @@ public: | ||||||
|                                   btScalar recoveringFactor = btScalar( 0.2 ) ); |                                   btScalar recoveringFactor = btScalar( 0.2 ) ); | ||||||
| 
 | 
 | ||||||
| 	~btKinematicCharacterController (); | 	~btKinematicCharacterController (); | ||||||
| 	 | 
 | ||||||
| 
 | 
 | ||||||
| 	///btActionInterface interface
 | 	///btActionInterface interface
 | ||||||
| 	virtual void updateAction( btCollisionWorld* collisionWorld, btScalar deltaTime ) | 	virtual void updateAction( btCollisionWorld* collisionWorld, btScalar deltaTime ) | ||||||
| 	{ | 	{ | ||||||
|     preStep( collisionWorld ); |     preStep( collisionWorld ); | ||||||
| 		playerStep( collisionWorld, deltaTime );  | 		playerStep( collisionWorld, deltaTime ); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	///btActionInterface interface
 | 	///btActionInterface interface
 | ||||||
| 	void debugDraw( btIDebugDraw* debugDrawer ); | 	void debugDraw( btIDebugDraw* debugDrawer ); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| #include "physic.hpp" | #include "physic.hpp" | ||||||
| #include <btBulletDynamicsCommon.h> | #include <btBulletDynamicsCommon.h> | ||||||
| #include <btBulletCollisionCommon.h> | #include <btBulletCollisionCommon.h> | ||||||
| #include <components\nifbullet\bullet_nif_loader.hpp> | #include <components/nifbullet/bullet_nif_loader.hpp> | ||||||
| //#include <apps\openmw\mwworld\world.hpp>
 | //#include <apps\openmw\mwworld\world.hpp>
 | ||||||
| #include "CMotionState.h" | #include "CMotionState.h" | ||||||
| #include "OgreRoot.h" | #include "OgreRoot.h" | ||||||
|  | @ -18,7 +18,7 @@ namespace Physic | ||||||
| 	enum collisiontypes { | 	enum collisiontypes { | ||||||
| 		COL_NOTHING = 0, //<Collide with nothing
 | 		COL_NOTHING = 0, //<Collide with nothing
 | ||||||
| 		COL_WORLD = BIT(0), //<Collide with world objects
 | 		COL_WORLD = BIT(0), //<Collide with world objects
 | ||||||
| 		COL_ACTOR_INTERNAL = BIT(1), //<Collide internal capsule 
 | 		COL_ACTOR_INTERNAL = BIT(1), //<Collide internal capsule
 | ||||||
| 		COL_ACTOR_EXTERNAL = BIT(2) //<collide with external capsule
 | 		COL_ACTOR_EXTERNAL = BIT(2) //<collide with external capsule
 | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
|  | @ -57,7 +57,7 @@ namespace Physic | ||||||
| 		internalGhostObject->setCollisionFlags( btCollisionObject::CF_CHARACTER_OBJECT ); | 		internalGhostObject->setCollisionFlags( btCollisionObject::CF_CHARACTER_OBJECT ); | ||||||
| 
 | 
 | ||||||
| 		mCharacter = new btKinematicCharacterController( externalGhostObject,internalGhostObject,btScalar( 0.4 ),1,0 ); | 		mCharacter = new btKinematicCharacterController( externalGhostObject,internalGhostObject,btScalar( 0.4 ),1,0 ); | ||||||
| 		mCharacter->setUpAxis(btKinematicCharacterController::UpAxis::Z_AXIS); | 		mCharacter->setUpAxis(btKinematicCharacterController::Z_AXIS); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	PhysicActor::~PhysicActor() | 	PhysicActor::~PhysicActor() | ||||||
|  | @ -69,18 +69,18 @@ namespace Physic | ||||||
| 		delete externalCollisionShape; | 		delete externalCollisionShape; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void PhysicActor::setWalkDirection(btVector3& mvt) | 	void PhysicActor::setWalkDirection(const btVector3& mvt) | ||||||
| 	{ | 	{ | ||||||
| 		mCharacter->setWalkDirection( mvt ); | 		mCharacter->setWalkDirection( mvt ); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void PhysicActor::Rotate(btQuaternion& quat) | 	void PhysicActor::Rotate(const btQuaternion& quat) | ||||||
| 	{ | 	{ | ||||||
| 		externalGhostObject->getWorldTransform().setRotation( externalGhostObject->getWorldTransform().getRotation() * quat ); | 		externalGhostObject->getWorldTransform().setRotation( externalGhostObject->getWorldTransform().getRotation() * quat ); | ||||||
| 		internalGhostObject->getWorldTransform().setRotation( internalGhostObject->getWorldTransform().getRotation() * quat ); | 		internalGhostObject->getWorldTransform().setRotation( internalGhostObject->getWorldTransform().getRotation() * quat ); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void PhysicActor::setRotation(btQuaternion& quat) | 	void PhysicActor::setRotation(const btQuaternion& quat) | ||||||
| 	{ | 	{ | ||||||
| 		externalGhostObject->getWorldTransform().setRotation( quat ); | 		externalGhostObject->getWorldTransform().setRotation( quat ); | ||||||
| 		internalGhostObject->getWorldTransform().setRotation( quat ); | 		internalGhostObject->getWorldTransform().setRotation( quat ); | ||||||
|  | @ -96,7 +96,7 @@ namespace Physic | ||||||
| 		return internalGhostObject->getWorldTransform().getRotation(); | 		return internalGhostObject->getWorldTransform().getRotation(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void PhysicActor::setPosition(btVector3& pos) | 	void PhysicActor::setPosition(const btVector3& pos) | ||||||
| 	{ | 	{ | ||||||
| 		internalGhostObject->getWorldTransform().setOrigin(pos); | 		internalGhostObject->getWorldTransform().setOrigin(pos); | ||||||
| 		externalGhostObject->getWorldTransform().setOrigin(pos); | 		externalGhostObject->getWorldTransform().setOrigin(pos); | ||||||
|  | @ -179,7 +179,7 @@ namespace Physic | ||||||
| 		delete solver; | 		delete solver; | ||||||
| 		delete collisionConfiguration; | 		delete collisionConfiguration; | ||||||
| 		delete dispatcher; | 		delete dispatcher; | ||||||
| 		delete broadphase;	 | 		delete broadphase; | ||||||
| 		delete ShapeLoader; | 		delete ShapeLoader; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -239,7 +239,7 @@ namespace Physic | ||||||
| 			RigidBodyMap[name] = NULL; | 			RigidBodyMap[name] = NULL; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	RigidBody* PhysicEngine::getRigidBody(std::string name) | 	RigidBody* PhysicEngine::getRigidBody(std::string name) | ||||||
| 	{ | 	{ | ||||||
| 		RigidBody* body = RigidBodyMap[name]; | 		RigidBody* body = RigidBodyMap[name]; | ||||||
|  | @ -298,14 +298,14 @@ namespace Physic | ||||||
|         { |         { | ||||||
|             if(resultCallback.m_collisionFilterGroup == COL_WORLD) |             if(resultCallback.m_collisionFilterGroup == COL_WORLD) | ||||||
|             { |             { | ||||||
|                 name = static_cast<RigidBody*>(resultCallback.m_collisionObject)->mName; |                 name = dynamic_cast<RigidBody&>(*resultCallback.m_collisionObject).mName; | ||||||
|             } |             } | ||||||
|             if(resultCallback.m_collisionFilterGroup == COL_ACTOR_EXTERNAL || resultCallback.m_collisionFilterGroup == COL_ACTOR_INTERNAL) |             if(resultCallback.m_collisionFilterGroup == COL_ACTOR_EXTERNAL || resultCallback.m_collisionFilterGroup == COL_ACTOR_INTERNAL) | ||||||
|             { |             { | ||||||
|                 name = static_cast<PairCachingGhostObject*>(resultCallback.m_collisionObject)->mName; |                 name = dynamic_cast<PairCachingGhostObject&>(*resultCallback.m_collisionObject).mName; | ||||||
|             } |             } | ||||||
|             d = resultCallback.m_closestHitFraction; |             d = resultCallback.m_closestHitFraction; | ||||||
|         } |         } | ||||||
|         return std::pair<std::string,float>(name,d); |         return std::pair<std::string,float>(name,d); | ||||||
|     } |     } | ||||||
| }}; | }}; | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| #ifndef OENGINE_BULLET_PHYSIC_H | #ifndef OENGINE_BULLET_PHYSIC_H | ||||||
| #define OENGINE_BULLET_PHYSIC_H | #define OENGINE_BULLET_PHYSIC_H | ||||||
| 
 | 
 | ||||||
| #include <BulletDynamics\Dynamics\btRigidBody.h> | #include <BulletDynamics/Dynamics/btRigidBody.h> | ||||||
| #include "BulletCollision/CollisionDispatch/btGhostObject.h" | #include "BulletCollision/CollisionDispatch/btGhostObject.h" | ||||||
| #include <string> | #include <string> | ||||||
| #include <list> | #include <list> | ||||||
|  | @ -35,7 +35,7 @@ namespace Physic | ||||||
| 	struct PhysicEvent; | 	struct PhysicEvent; | ||||||
| 
 | 
 | ||||||
|     /**
 |     /**
 | ||||||
|     *This is just used to be able to name objects.  |     *This is just used to be able to name objects. | ||||||
|     */ |     */ | ||||||
|     class PairCachingGhostObject : public btPairCachingGhostObject |     class PairCachingGhostObject : public btPairCachingGhostObject | ||||||
|     { |     { | ||||||
|  | @ -62,17 +62,17 @@ namespace Physic | ||||||
| 		*I think it's also needed to take time into account. A typical call should look like this: | 		*I think it's also needed to take time into account. A typical call should look like this: | ||||||
| 		*setWalkDirection( mvt * orientation * dt) | 		*setWalkDirection( mvt * orientation * dt) | ||||||
| 		*/ | 		*/ | ||||||
| 		void setWalkDirection(btVector3& mvt); | 		void setWalkDirection(const btVector3& mvt); | ||||||
| 
 | 
 | ||||||
| 		void Rotate(btQuaternion& quat); | 		void Rotate(const btQuaternion& quat); | ||||||
| 
 | 
 | ||||||
| 		void setRotation(btQuaternion& quat); | 		void setRotation(const btQuaternion& quat); | ||||||
| 
 | 
 | ||||||
| 		btVector3 getPosition(void); | 		btVector3 getPosition(void); | ||||||
| 
 | 
 | ||||||
| 		btQuaternion getRotation(void); | 		btQuaternion getRotation(void); | ||||||
| 
 | 
 | ||||||
| 		void setPosition(btVector3& pos); | 		void setPosition(const btVector3& pos); | ||||||
| 
 | 
 | ||||||
| 		btKinematicCharacterController* mCharacter; | 		btKinematicCharacterController* mCharacter; | ||||||
| 
 | 
 | ||||||
|  | @ -208,4 +208,4 @@ namespace Physic | ||||||
| 
 | 
 | ||||||
| }} | }} | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue