diff --git a/test/BtPhysTest.cpp b/test/BtPhysTest.cpp
index b7cfdd35..6d863a49 100644
--- a/test/BtPhysTest.cpp
+++ b/test/BtPhysTest.cpp
@@ -37,8 +37,8 @@ using namespace lol;
#define HAVE_PHYS_USE_BULLET
#endif /* HAVE_PHYS_USE_BULLET */
-#include "Physics/LolPhysics.h"
-#include "Physics/EasyPhysics.h"
+#include "Physics/Include/LolPhysics.h"
+#include "Physics/Include/EasyPhysics.h"
#include "PhysicObject.h"
#include "BtPhysTest.h"
diff --git a/test/BtPhysTest.vcxproj b/test/BtPhysTest.vcxproj
index afd33c30..59704e61 100644
--- a/test/BtPhysTest.vcxproj
+++ b/test/BtPhysTest.vcxproj
@@ -37,21 +37,23 @@
-
-
-
+
+
+
+
+
-
+
+
+
{9e62f2fe-3408-4eae-8238-fd84238ceeda}
-
-
{ee203b88-44cf-4859-9d42-7a1f43fecb52}
Application
@@ -72,4 +74,4 @@
-
+
\ No newline at end of file
diff --git a/test/BtPhysTest.vcxproj.filters b/test/BtPhysTest.vcxproj.filters
index 6ef488ad..741a463a 100644
--- a/test/BtPhysTest.vcxproj.filters
+++ b/test/BtPhysTest.vcxproj.filters
@@ -2,21 +2,33 @@
-
- Physics
+
+
+ Physics\Include
-
- Physics
+
+ Physics\Include
-
- Physics
+
+ Physics\Include
+
+
+ Physics\Include
+
+
+ Physics\Include
-
-
- Physics
+
+ Physics\Src
+
+
+ Physics\Src
+
+
+ Physics\Src
@@ -26,5 +38,11 @@
{ccecd634-9321-4c49-9471-e9da50dda6d3}
+
+ {ef37a177-b550-435b-bfb1-a09ca8059137}
+
+
+ {7e5d19e0-b2be-46cc-8fa4-f582ecb4318d}
+
\ No newline at end of file
diff --git a/test/PhysicObject.h b/test/PhysicObject.h
index cdc84e03..cfef2973 100644
--- a/test/PhysicObject.h
+++ b/test/PhysicObject.h
@@ -13,7 +13,9 @@
#include "core.h"
#include "easymesh/easymesh.h"
-#include "Physics/EasyPhysics.h"
+#include "Physics/Include/EasyPhysics.h"
+#include "Physics/Include/EasyCharacterController.h"
+#include "Physics/Include/EasyConstraint.h"
using namespace lol;
using namespace lol::phys;
diff --git a/test/Physics/Include/EasyCharacterController.h b/test/Physics/Include/EasyCharacterController.h
new file mode 100644
index 00000000..0af018e1
--- /dev/null
+++ b/test/Physics/Include/EasyCharacterController.h
@@ -0,0 +1,82 @@
+//
+// Lol Engine
+//
+// Copyright: (c) 2010-2012 Sam Hocevar
+// (c) 2009-2012 Benjamin Huet
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the Do What The Fuck You Want To
+// Public License, Version 2, as published by Sam Hocevar. See
+// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
+//
+
+//
+// The EasyPhysic class
+// ------------------
+//
+
+#if !defined __EASYCHARACTERCONTROLLER_EASYCHARACTERCONTROLLER_H__
+#define __EASYCHARACTERCONTROLLER_EASYCHARACTERCONTROLLER_H__
+
+#ifdef HAVE_PHYS_USE_BULLET
+#include "core.h"
+#include "EasyPhysics.h"
+#include
+#endif
+
+namespace lol
+{
+
+namespace phys
+{
+
+class EasyCharacterController : public EasyPhysic
+{
+
+#ifdef HAVE_PHYS_USE_BULLET
+
+public:
+ EasyCharacterController() :
+ EasyPhysic(),
+ m_character(NULL)
+ {
+ m_up_axis = 1;
+ }
+ ~EasyCharacterController()
+ {
+ delete m_character;
+ }
+
+ virtual void InitBodyToRigid(bool ZeroMassIsKinematic=false);
+ virtual void InitBodyToGhost();
+ virtual void AddToSimulation(class Simulation* current_simulation);
+ virtual void RemoveFromSimulation(class Simulation* current_simulation);
+ virtual void SetMovementForFrame(vec3 const &MoveQuantity);
+
+protected:
+
+ virtual btGhostObject* GetGhostObject();
+
+ btPairCachingGhostObject* m_pair_caching_object;
+ btKinematicCharacterController* m_character;
+
+ float m_step_height;
+ int m_up_axis;
+
+#else // NO PHYSIC IMPLEMENTATION
+
+ virtual void InitBodyToRigid(bool ZeroMassIsKinematic=false) { }
+ virtual void InitBodyToGhost() { }
+ virtual void AddToSimulation(class Simulation* current_simulation) { }
+ virtual void RemoveFromSimulation(class Simulation* current_simulation) { }
+ virtual void SetMovementForFrame(vec3 const &MoveQuantity) { }
+
+#endif // PHYSIC IMPLEMENTATION
+
+};
+
+} /* namespace phys */
+
+} /* namespace lol */
+
+#endif /* __EASYCHARACTERCONTROLLER_EASYCHARACTERCONTROLLER_H__ */
+
diff --git a/test/Physics/EasyPhysics.h b/test/Physics/Include/EasyConstraint.h
similarity index 59%
rename from test/Physics/EasyPhysics.h
rename to test/Physics/Include/EasyConstraint.h
index 22c04f63..9e376d84 100644
--- a/test/Physics/EasyPhysics.h
+++ b/test/Physics/Include/EasyConstraint.h
@@ -14,15 +14,12 @@
// ------------------
//
-#if !defined __EASYPHYSICS_EASYPHYSICS_H__
-#define __EASYPHYSICS_EASYPHYSICS_H__
+#if !defined __EASYCONSTRAINT_EASYCONSTRAINT_H__
+#define __EASYCONSTRAINT_EASYCONSTRAINT_H__
#ifdef HAVE_PHYS_USE_BULLET
#include "core.h"
-#include
-#include
-#include
-#include
+#include "EasyPhysics.h"
#endif
namespace lol
@@ -31,141 +28,6 @@ namespace lol
namespace phys
{
-class EasyPhysic
-{
-
- friend class EasyConstraint;
-
-#ifdef HAVE_PHYS_USE_BULLET
-
-public:
- EasyPhysic();
- ~EasyPhysic();
-
- virtual void SetShapeToBox(lol::vec3& box_size);
- virtual void SetShapeToSphere(float radius);
- virtual void SetShapeToCone(float radius, float height);
- virtual void SetShapeToCylinder(lol::vec3& cyl_size);
- virtual void SetShapeToCapsule(float radius, float height);
-
- virtual bool CanChangeCollisionChannel() { return (m_rigid_body == NULL); }
- virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f)));
- virtual void SetMass(float mass);
- virtual void InitBodyToRigid(bool ZeroMassIsKinematic=false);
- virtual void InitBodyToGhost();
- virtual void AddToSimulation(class Simulation* current_simulation);
- virtual void RemoveFromSimulation(class Simulation* current_simulation);
- virtual mat4 GetTransform();
-
-protected:
- virtual void SetLocalInertia(float mass);
- virtual void SetShapeTo(btCollisionShape* collision_shape);
-
- virtual btGhostObject* GetGhostObject();
-
- btCollisionObject* m_collision_object;
-
- btGhostObject* m_ghost_object;
-
- btRigidBody* m_rigid_body;
- btVector3 m_local_inertia;
-
- btCollisionShape* m_collision_shape;
- btConvexShape* m_convex_shape;
- btMotionState* m_motion_state;
-
-#else // NO PHYSIC IMPLEMENTATION
-
-public:
- EasyPhysic() { }
-
- virtual void SetShapeToBox(lol::vec3& BoxSize) { }
- virtual void SetShapeToSphere(float radius) { }
- virtual void SetShapeToCone(float radius, float height) { }
- virtual void SetShapeToCylinder(lol::vec3& cyl_size) { }
- virtual void SetShapeToCapsule(float radius, float height) { }
-
- virtual bool CanChangeCollisionChannel() { return true; }
- virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { }
- virtual void SetMass(float mass) { }
- virtual void InitBodyToRigid() { }
- virtual void InitBodyToGhost() { }
- virtual void AddToSimulation(class Simulation* current_simulation) { }
- virtual void RemoveFromSimulation(class Simulation* current_simulation) { }
- virtual mat4 GetTransform() { return mat4(1.0f); }
-
- virtual void InitBodyToGhost() { }
-
-#endif // PHYSIC IMPLEMENTATION
-
-public:
- //Sets the collision Group & Mask.
- //Mask can change at runtime, not group !
- virtual bool SetCollisionChannel(int NewGroup, int NewMask)
- {
- if (CanChangeCollisionChannel())
- {
- m_collision_group = (1<
+// (c) 2009-2012 Benjamin Huet
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the Do What The Fuck You Want To
+// Public License, Version 2, as published by Sam Hocevar. See
+// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
+//
+
+//
+// The EasyPhysic class
+// ------------------
+//
+
+#if !defined __EASYPHYSICS_EASYPHYSICS_H__
+#define __EASYPHYSICS_EASYPHYSICS_H__
+
+#ifdef HAVE_PHYS_USE_BULLET
+#include "core.h"
+#include
+#include
+#include
+#endif
+
+namespace lol
+{
+
+namespace phys
+{
+
+class EasyPhysic
+{
+
+ friend class EasyConstraint;
+
+#ifdef HAVE_PHYS_USE_BULLET
+
+public:
+ EasyPhysic();
+ ~EasyPhysic();
+
+ virtual void SetShapeToBox(lol::vec3& box_size);
+ virtual void SetShapeToSphere(float radius);
+ virtual void SetShapeToCone(float radius, float height);
+ virtual void SetShapeToCylinder(lol::vec3& cyl_size);
+ virtual void SetShapeToCapsule(float radius, float height);
+
+ virtual bool CanChangeCollisionChannel() { return (m_rigid_body == NULL); }
+ virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f)));
+ virtual void SetMass(float mass);
+ virtual void InitBodyToRigid(bool ZeroMassIsKinematic=false);
+ virtual void InitBodyToGhost();
+ virtual void AddToSimulation(class Simulation* current_simulation);
+ virtual void RemoveFromSimulation(class Simulation* current_simulation);
+ virtual mat4 GetTransform();
+
+protected:
+ virtual void SetLocalInertia(float mass);
+ virtual void SetShapeTo(btCollisionShape* collision_shape);
+
+ virtual btGhostObject* GetGhostObject();
+
+ btCollisionObject* m_collision_object;
+
+ btGhostObject* m_ghost_object;
+
+ btRigidBody* m_rigid_body;
+ btVector3 m_local_inertia;
+
+ btCollisionShape* m_collision_shape;
+ btConvexShape* m_convex_shape;
+ btMotionState* m_motion_state;
+
+#else // NO PHYSIC IMPLEMENTATION
+
+public:
+ EasyPhysic() { }
+
+ virtual void SetShapeToBox(lol::vec3& BoxSize) { }
+ virtual void SetShapeToSphere(float radius) { }
+ virtual void SetShapeToCone(float radius, float height) { }
+ virtual void SetShapeToCylinder(lol::vec3& cyl_size) { }
+ virtual void SetShapeToCapsule(float radius, float height) { }
+
+ virtual bool CanChangeCollisionChannel() { return true; }
+ virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { }
+ virtual void SetMass(float mass) { }
+ virtual void InitBodyToRigid() { }
+ virtual void InitBodyToGhost() { }
+ virtual void AddToSimulation(class Simulation* current_simulation) { }
+ virtual void RemoveFromSimulation(class Simulation* current_simulation) { }
+ virtual mat4 GetTransform() { return mat4(1.0f); }
+
+ virtual void InitBodyToGhost() { }
+
+#endif // PHYSIC IMPLEMENTATION
+
+public:
+ //Sets the collision Group & Mask.
+ //Mask can change at runtime, not group !
+ virtual bool SetCollisionChannel(int NewGroup, int NewMask)
+ {
+ if (CanChangeCollisionChannel())
+ {
+ m_collision_group = (1<
#include "LolBtPhysicsIntegration.h"
#include "EasyPhysics.h"
+#include "EasyConstraint.h"
#endif
namespace lol
diff --git a/test/Physics/Src/EasyCharacterController.cpp b/test/Physics/Src/EasyCharacterController.cpp
new file mode 100644
index 00000000..d0221f19
--- /dev/null
+++ b/test/Physics/Src/EasyCharacterController.cpp
@@ -0,0 +1,92 @@
+//
+// Lol Engine
+//
+// Copyright: (c) 2010-2012 Sam Hocevar
+// (c) 2009-2012 Cédric Lecacheur
+// (c) 2009-2012 Benjamin Huet
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the Do What The Fuck You Want To
+// Public License, Version 2, as published by Sam Hocevar. See
+// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
+//
+
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "../Include/LolBtPhysicsIntegration.h"
+#include "../Include/LolPhysics.h"
+#include "../Include/EasyCharacterController.h"
+
+namespace lol
+{
+
+namespace phys
+{
+
+#ifdef HAVE_PHYS_USE_BULLET
+
+//-------------------------------------------------------------------------
+//EASY_CHARACTER_CONTROLLER
+//--
+
+//Deactivated for Character controller
+void EasyCharacterController::InitBodyToRigid(bool ZeroMassIsKinematic)
+{
+}
+
+//Return correct Ghost Object
+btGhostObject* EasyCharacterController::GetGhostObject()
+{
+ return new btPairCachingGhostObject();
+}
+
+//Init to Pair caching ghost object, since Character uses that one.
+void EasyCharacterController::InitBodyToGhost()
+{
+ EasyPhysic::InitBodyToGhost();
+
+ m_pair_caching_object = (btPairCachingGhostObject*)m_ghost_object;
+ m_ghost_object->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT | m_ghost_object->getCollisionFlags());
+}
+
+//Add Physic object to the simulation
+void EasyCharacterController::AddToSimulation(class Simulation* current_simulation)
+{
+ EasyPhysic::AddToSimulation(current_simulation);
+
+ btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
+ if (dynamics_world)
+ {
+ if (m_character)
+ delete m_character;
+
+ m_character = new btKinematicCharacterController(m_pair_caching_object, m_convex_shape, m_step_height, m_up_axis);
+ dynamics_world->addAction(m_character);
+ }
+}
+
+//Remove Physic object to the simulation
+void EasyCharacterController::RemoveFromSimulation(class Simulation* current_simulation)
+{
+ EasyPhysic::RemoveFromSimulation(current_simulation);
+
+ btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
+ if (dynamics_world)
+ {
+ if (m_character)
+ dynamics_world->removeAction(m_character);
+ }
+}
+
+//Set movement for this frame
+void EasyCharacterController::SetMovementForFrame(vec3 const &MoveQuantity)
+{
+ m_character->setWalkDirection(LOL2BT_VEC3(MoveQuantity));
+}
+
+#endif // HAVE_PHYS_USE_BULLET
+
+} /* namespace phys */
+
+} /* namespace lol */
diff --git a/test/Physics/Src/EasyConstraint.cpp b/test/Physics/Src/EasyConstraint.cpp
new file mode 100644
index 00000000..fea878a4
--- /dev/null
+++ b/test/Physics/Src/EasyConstraint.cpp
@@ -0,0 +1,38 @@
+#include "../Include/LolBtPhysicsIntegration.h"
+#include "../Include/LolPhysics.h"
+#include "../Include/EasyConstraint.h"
+
+namespace lol
+{
+
+namespace phys
+{
+
+#ifdef HAVE_PHYS_USE_BULLET
+
+//-------------------------------------------------------------------------
+//EASY_CONSTRAINT
+//--
+
+void EasyConstraint::AddToSimulation(class Simulation* current_simulation)
+{
+ btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
+ if (dynamics_world && m_typed_constraint)
+ {
+ dynamics_world->addConstraint(m_typed_constraint, m_disable_a2b_collision);
+ current_simulation->AddToConstraint(this);
+ }
+}
+
+void EasyConstraint::RemoveFromSimulation(class Simulation* current_simulation)
+{
+ btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
+ if (dynamics_world, m_typed_constraint)
+ dynamics_world->removeConstraint(m_typed_constraint);
+}
+
+#endif // HAVE_PHYS_USE_BULLET
+
+} /* namespace phys */
+
+} /* namespace lol */
diff --git a/test/Physics/EasyPhysics.cpp b/test/Physics/Src/EasyPhysics.cpp
similarity index 73%
rename from test/Physics/EasyPhysics.cpp
rename to test/Physics/Src/EasyPhysics.cpp
index 179a8ea1..077a048a 100644
--- a/test/Physics/EasyPhysics.cpp
+++ b/test/Physics/Src/EasyPhysics.cpp
@@ -14,8 +14,8 @@
# include "config.h"
#endif
-#include "LolBtPhysicsIntegration.h"
-#include "LolPhysics.h"
+#include "../Include/LolBtPhysicsIntegration.h"
+#include "../Include/LolPhysics.h"
namespace lol
{
@@ -254,87 +254,6 @@ void EasyPhysic::SetLocalInertia(float mass)
m_local_inertia = btVector3(.0f, .0f, .0f);
}
-//-------------------------------------------------------------------------
-//EASY_CHARACTER_CONTROLLER
-//--
-
-//Deactivated for Character controller
-void EasyCharacterController::InitBodyToRigid(bool ZeroMassIsKinematic)
-{
-}
-
-//Return correct Ghost Object
-btGhostObject* EasyCharacterController::GetGhostObject()
-{
- return new btPairCachingGhostObject();
-}
-
-//Init to Pair caching ghost object, since Character uses that one.
-void EasyCharacterController::InitBodyToGhost()
-{
- EasyPhysic::InitBodyToGhost();
-
- m_pair_caching_object = (btPairCachingGhostObject*)m_ghost_object;
- m_ghost_object->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT | m_ghost_object->getCollisionFlags());
-}
-
-//Add Physic object to the simulation
-void EasyCharacterController::AddToSimulation(class Simulation* current_simulation)
-{
- EasyPhysic::AddToSimulation(current_simulation);
-
- btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
- if (dynamics_world)
- {
- if (m_character)
- delete m_character;
-
- m_character = new btKinematicCharacterController(m_pair_caching_object, m_convex_shape, m_step_height, m_up_axis);
- dynamics_world->addAction(m_character);
- }
-}
-
-//Remove Physic object to the simulation
-void EasyCharacterController::RemoveFromSimulation(class Simulation* current_simulation)
-{
- EasyPhysic::RemoveFromSimulation(current_simulation);
-
- btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
- if (dynamics_world)
- {
- if (m_character)
- dynamics_world->removeAction(m_character);
- }
-}
-
-//Set movement for this frame
-void EasyCharacterController::SetMovementForFrame(vec3 const &MoveQuantity)
-{
- m_character->setWalkDirection(LOL2BT_VEC3(MoveQuantity));
-}
-
-
-//-------------------------------------------------------------------------
-//EASY_CONSTRAINT
-//--
-
-void EasyConstraint::AddToSimulation(class Simulation* current_simulation)
-{
- btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
- if (dynamics_world && m_typed_constraint)
- {
- dynamics_world->addConstraint(m_typed_constraint, m_disable_a2b_collision);
- current_simulation->AddToConstraint(this);
- }
-}
-
-void EasyConstraint::RemoveFromSimulation(class Simulation* current_simulation)
-{
- btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
- if (dynamics_world, m_typed_constraint)
- dynamics_world->removeConstraint(m_typed_constraint);
-}
-
#endif // HAVE_PHYS_USE_BULLET
} /* namespace phys */