Browse Source

physics: always activate Bullet and remove dead code.

undefined
Sam Hocevar 11 years ago
parent
commit
b45c1dc7fe
15 changed files with 1 additions and 162 deletions
  1. +0
    -7
      build/vs2010/Lol.Core.Vars.props
  2. +0
    -3
      build/vs2010/config-build.xml
  3. +0
    -7
      build/vs2012/Lol.Core.Vars.props
  4. +0
    -4
      test/btphystest.cpp
  5. +0
    -4
      test/nacl_phystest.cpp
  6. +0
    -5
      test/physics/bulletcharactercontroller.cpp
  7. +0
    -4
      test/physics/bulletcharactercontroller.h
  8. +0
    -4
      test/physics/easycharactercontroller.cpp
  9. +0
    -15
      test/physics/easycharactercontroller.h
  10. +1
    -4
      test/physics/easyconstraint.cpp
  11. +0
    -32
      test/physics/easyconstraint.h
  12. +0
    -4
      test/physics/easyphysics.cpp
  13. +0
    -47
      test/physics/easyphysics.h
  14. +0
    -4
      test/physics/lolbtphysicsintegration.h
  15. +0
    -18
      test/physics/lolphysics.h

+ 0
- 7
build/vs2010/Lol.Core.Vars.props View File

@@ -20,13 +20,6 @@
<Win32Defines>HAVE_SDL_H;USE_SDL;$(Win32Defines)</Win32Defines>
<Win32Defines>USE_SDL_MIXER;USE_SDL_IMAGE;$(Win32Defines)</Win32Defines>

<!-- BulletPhysics -->
<BtPhysDir>$(ExternalDir)\bullet-2.80-rev2531</BtPhysDir>
<BtPhysIncludes>$(BtPhysDir)\include;$(BtPhysDir)\include\bullet</BtPhysIncludes>
<Win32Defines Condition="'$(UseBullet)'=='true'">HAVE_PHYS_USE_BULLET;$(Win32Defines)</Win32Defines>
<Ps3Defines Condition="'$(UseBullet)'=='true'">HAVE_PHYS_USE_BULLET;$(Ps3Defines)</Ps3Defines>
<XboxDefines Condition="'$(UseBullet)'=='true'">HAVE_PHYS_USE_BULLET;$(XboxDefines)</XboxDefines>

<!-- GTK+ & GtkGl -->
<GtkDir>$(ExternalDir)\gtk-2.22.1</GtkDir>
<GtkGlDir>$(ExternalDir)\gtkglarea-2.0.1</GtkGlDir>


+ 0
- 3
build/vs2010/config-build.xml View File

@@ -9,8 +9,5 @@
<!-- Use OpenGL instead of Direct3D? -->
<UseOpenGL>true</UseOpenGL>

<!-- Use Bullet for our physics solver? -->
<UseBullet>true</UseBullet>

</PropertyGroup>
</Project>

+ 0
- 7
build/vs2012/Lol.Core.Vars.props View File

@@ -20,13 +20,6 @@
<Win32Defines>HAVE_SDL_H;USE_SDL;$(Win32Defines)</Win32Defines>
<Win32Defines>USE_SDL_MIXER;USE_SDL_IMAGE;$(Win32Defines)</Win32Defines>

<!-- BulletPhysics -->
<BtPhysDir>$(ExternalDir)\bullet-2.80-rev2531</BtPhysDir>
<BtPhysIncludes>$(BtPhysDir)\include;$(BtPhysDir)\include\bullet</BtPhysIncludes>
<Win32Defines Condition="'$(UseBullet)'=='true'">HAVE_PHYS_USE_BULLET;$(Win32Defines)</Win32Defines>
<Ps3Defines Condition="'$(UseBullet)'=='true'">HAVE_PHYS_USE_BULLET;$(Ps3Defines)</Ps3Defines>
<XboxDefines Condition="'$(UseBullet)'=='true'">HAVE_PHYS_USE_BULLET;$(XboxDefines)</XboxDefines>

<!-- GTK+ & GtkGl -->
<GtkDir>$(ExternalDir)\gtk-2.22.1</GtkDir>
<GtkGlDir>$(ExternalDir)\gtkglarea-2.0.1</GtkGlDir>


+ 0
- 4
test/btphystest.cpp View File

@@ -14,10 +14,6 @@

using namespace lol;

#ifndef HAVE_PHYS_USE_BULLET
#define HAVE_PHYS_USE_BULLET
#endif /* HAVE_PHYS_USE_BULLET */

#include "physics/lolphysics.h"
#include "physics/easyphysics.h"



+ 0
- 4
test/nacl_phystest.cpp View File

@@ -14,10 +14,6 @@

using namespace lol;

#ifndef HAVE_PHYS_USE_BULLET
#define HAVE_PHYS_USE_BULLET
#endif /* HAVE_PHYS_USE_BULLET */

//#include "physics/lolphysics.h"
//#include "physics/easyphysics.h"



+ 0
- 5
test/physics/bulletcharactercontroller.cpp View File

@@ -16,7 +16,6 @@

#define USE_LOL_CTRLR_CHARAC

#ifdef HAVE_PHYS_USE_BULLET
#include "core.h"
#include <stdio.h>
#include "lolbtphysicsintegration.h"
@@ -30,8 +29,6 @@
//#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
//#include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
//#include "LinearMath/btDefaultMotionState.h"
#endif //HAVE_PHYS_USE_BULLET


namespace lol
{
@@ -40,7 +37,6 @@ namespace phys
{

#ifdef USE_LOL_CTRLR_CHARAC
#ifdef HAVE_PHYS_USE_BULLET

//When called, will try to remove Character controller from its collision.
bool BulletKinematicCharacterController::RecoverFromPenetration(btCollisionWorld* CollisionWorld)
@@ -238,7 +234,6 @@ void BulletKinematicCharacterController::Jump()
m_was_jumping = true;
}

#endif // HAVE_PHYS_USE_BULLET
#endif // USE_LOL_CTRLR_CHARAC

} /* namespace phys */


+ 0
- 4
test/physics/bulletcharactercontroller.h View File

@@ -18,11 +18,9 @@
#if !defined __BULLETCHARACTERCONTROLLER_BULLETCHARACTERCONTROLLER_H__
#define __BULLETCHARACTERCONTROLLER_BULLETCHARACTERCONTROLLER_H__

#ifdef HAVE_PHYS_USE_BULLET
#include "core.h"
#include "easyphysics.h"
//#include "BulletDynamics\Character\btCharacterControllerInterface.h"
#endif

#define USE_LOL_CTRLR_CHARAC

@@ -33,7 +31,6 @@ namespace lol
{

#ifdef USE_LOL_CTRLR_CHARAC
#ifdef HAVE_PHYS_USE_BULLET

//SweepCallback used for Swweep Tests.
class ClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback
@@ -278,7 +275,6 @@ namespace lol
vec3 m_velocity;
};

#endif // HAVE_PHYS_USE_BULLET
#endif // USE_LOL_CTRLR_CHARAC

} /* namespace phys */


+ 0
- 4
test/physics/easycharactercontroller.cpp View File

@@ -24,8 +24,6 @@ namespace lol
namespace phys
{

#ifdef HAVE_PHYS_USE_BULLET

//-------------------------------------------------------------------------
//EASY_CHARACTER_CONTROLLER
//--
@@ -146,8 +144,6 @@ void EasyCharacterController::TickGame(float seconds)
}
}

#endif // HAVE_PHYS_USE_BULLET

} /* namespace phys */

} /* namespace lol */

+ 0
- 15
test/physics/easycharactercontroller.h View File

@@ -20,12 +20,10 @@
#if !defined __EASYCHARACTERCONTROLLER_EASYCHARACTERCONTROLLER_H__
#define __EASYCHARACTERCONTROLLER_EASYCHARACTERCONTROLLER_H__

#ifdef HAVE_PHYS_USE_BULLET
#include "core.h"
#include "easyphysics.h"
#include "bulletcharactercontroller.h"
#include <BulletDynamics/Character/btKinematicCharacterController.h>
#endif

namespace lol
{
@@ -40,8 +38,6 @@ class EasyCharacterController : public EasyPhysic,
friend class Simulation;
friend class EasyPhysic;

#ifdef HAVE_PHYS_USE_BULLET

public:
EasyCharacterController(WorldEntity* NewOwnerEntity) :
EasyPhysic(NewOwnerEntity),
@@ -101,17 +97,6 @@ protected:
//----
vec3 m_walk_velocity;
vec3 m_current_velocity;

#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 */


+ 1
- 4
test/physics/easyconstraint.cpp View File

@@ -13,8 +13,6 @@ namespace lol
namespace phys
{

#ifdef HAVE_PHYS_USE_BULLET

//-------------------------------------------------------------------------
//EASY_CONSTRAINT
//--
@@ -39,8 +37,7 @@ void EasyConstraint::RemoveFromSimulation(class Simulation* current_simulation)
}
}

#endif // HAVE_PHYS_USE_BULLET

} /* namespace phys */

} /* namespace lol */


+ 0
- 32
test/physics/easyconstraint.h View File

@@ -17,10 +17,8 @@
#if !defined __EASYCONSTRAINT_EASYCONSTRAINT_H__
#define __EASYCONSTRAINT_EASYCONSTRAINT_H__

#ifdef HAVE_PHYS_USE_BULLET
#include "core.h"
#include "easyphysics.h"
#endif

namespace lol
{
@@ -34,8 +32,6 @@ class EasyConstraint
friend class Simulation;
friend class EasyPhysic;

#ifdef HAVE_PHYS_USE_BULLET

public:
EasyConstraint() :
m_typed_constraint(NULL),
@@ -133,34 +129,6 @@ private:
btConeTwistConstraint* m_cone_twist_constraint;
btGeneric6DofConstraint* m_6dof_constraint;

#else // NO PHYSIC IMPLEMENTATION

public:
EasyConstraint() :
m_a_physobj(NULL),
m_b_physobj(NULL),
m_a_transform(lol::mat4(1.f)),
m_b_transform(lol::mat4(1.f)),
m_using_ref_a(false),
m_disable_a2b_collision(false)
{
}

private:

void AddToSimulation(class Simulation* current_simulation) { }
void RemoveFromSimulation(class Simulation* current_simulation) { }

//check if Init can be done
bool CanProceedWithInit() { return false; }
void CustomInitConstraintToPoint2Point() { }
void CustomInitConstraintToHinge() { }
void CustomInitConstraintToSlider() { }
void CustomInitConstraintToConeTwist() { }
void CustomInitConstraintTo6Dof() { }

#endif // PHYSIC IMPLEMENTATION

public:
void InitConstraintToPoint2Point() { if (CanProceedWithInit()) CustomInitConstraintToPoint2Point(); }
void InitConstraintToHinge() { if (CanProceedWithInit()) CustomInitConstraintToHinge(); }


+ 0
- 4
test/physics/easyphysics.cpp View File

@@ -23,8 +23,6 @@ namespace lol
namespace phys
{

#ifdef HAVE_PHYS_USE_BULLET

//-------------------------------------------------------------------------
//EASY_PHYSIC
//--
@@ -425,8 +423,6 @@ void EasyPhysic::SetLocalInertia(float mass)
m_local_inertia = btVector3(.0f, .0f, .0f);
}

#endif // HAVE_PHYS_USE_BULLET

} /* namespace phys */

} /* namespace lol */

+ 0
- 47
test/physics/easyphysics.h View File

@@ -17,12 +17,10 @@
#if !defined __EASYPHYSICS_EASYPHYSICS_H__
#define __EASYPHYSICS_EASYPHYSICS_H__

#ifdef HAVE_PHYS_USE_BULLET
#include "core.h"
#include <bullet/btBulletDynamicsCommon.h>
#include <bullet/btBulletCollisionCommon.h>
#include <bullet/BulletCollision/CollisionDispatch/btGhostObject.h>
#endif //HAVE_PHYS_USE_BULLET

namespace lol
{
@@ -36,8 +34,6 @@ class EasyPhysic
friend class Simulation;
friend class EasyConstraint;

#ifdef HAVE_PHYS_USE_BULLET

public:
EasyPhysic(WorldEntity* NewOwnerEntity);
~EasyPhysic();
@@ -93,49 +89,6 @@ protected:
btConvexShape* m_convex_shape;
btMotionState* m_motion_state;

#else // NO PHYSIC IMPLEMENTATION

public:
EasyPhysic(WorldEntity* NewOwnerEntity) { m_owner_entity = NewOwnerEntity; }

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 mat4 GetTransform() { return mat4(1.0f); }
virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { }
private:
virtual void BaseTransformChanged(const lol::mat4& PreviousMatrix, const lol::mat4& NewMatrix) { }
public:
virtual void SetMass(float mass) { }
virtual float GetMass() { return .0f; }
virtual void SetHitRestitution(float hit_restitution) { }
virtual void InitBodyToRigid() { }
virtual void InitBodyToGhost() { }
virtual void AddToSimulation(class Simulation* current_simulation) { }
virtual void RemoveFromSimulation(class Simulation* current_simulation) { }

//Force/Impulse functions
virtual void AddImpulse(const lol::vec3& impulse) { }
virtual void AddImpulse(const lol::vec3& impulse, const lol::vec3& rel_pos) { }
virtual void AddImpulseTorque(const lol::vec3& torque) { }
virtual void AddForce(const lol::vec3& force) { }
virtual void AddForce(const lol::vec3& force, const lol::vec3& rel_pos) { }
virtual void AddForceTorque(const lol::vec3& torque) { }

//Movements getter
lol::vec3 GetLinearVelocity() const { return lol::vec3(.0f); }
lol::vec3 GetLinearForce() const { return lol::vec3(.0f); }
lol::vec3 GetAngularVelocity() const { return lol::vec3(.0f); }
lol::vec3 GetAngularForce() const { return lol::vec3(.0f); }

virtual void InitBodyToGhost() { }

#endif // PHYSIC IMPLEMENTATION

public:
//Sets the collision Group & Mask.
//Mask can change at runtime, not group !


+ 0
- 4
test/physics/lolbtphysicsintegration.h View File

@@ -28,8 +28,6 @@ namespace lol
#define GAMEGROUP_EZP_CHAR_CTRLR GAMEGROUP_AFTER_0
#define GAMEGROUP_SIMULATION GAMEGROUP_AFTER_1

#ifdef HAVE_PHYS_USE_BULLET

#define LOL2BT_UNIT 1.0f
#define BT2LOL_UNIT 1.0f

@@ -46,8 +44,6 @@ namespace lol
#define LOL2BT_QUAT(ELEMENT) btQuaternion((ELEMENT).x, (ELEMENT).y, (ELEMENT).z, (ELEMENT).w)
#define BT2LOL_QUAT(ELEMENT) lol::quat((ELEMENT).getW(), BT2LOL_VEC3((ELEMENT).getAxis())

#endif // HAVE_PHYS_USE_BULLET

} /* namespace lol */

#endif /* __LOLBTPHYSICSINTEGRATION_H__ */


+ 0
- 18
test/physics/lolphysics.h View File

@@ -8,7 +8,6 @@
#if !defined __LOLPHYSICS_H__
#define __LOLPHYSICS_H__

#ifdef HAVE_PHYS_USE_BULLET
#include <cstring>
#include <bullet/btBulletDynamicsCommon.h>
#include <bullet/btBulletCollisionCommon.h>
@@ -16,7 +15,6 @@
#include "lolbtphysicsintegration.h"
#include "easyphysics.h"
#include "easyconstraint.h"
#endif

namespace lol
{
@@ -80,7 +78,6 @@ public:

char const *GetName() { return "<Simulation>"; }

#ifdef HAVE_PHYS_USE_BULLET
public:
void Init()
{
@@ -267,21 +264,6 @@ private:
// The world.
btDiscreteDynamicsWorld* m_dynamics_world;

#else // NO PHYSIC IMPLEMENTATION

public:
void Init() { }
void TickGame(float seconds) { }
bool RayHits(RayCastResult& HitResult, eRaycastType RaycastType, const vec3& RayFrom, const vec3& RayTo, EasyPhysic* SourceCaster=NULL) { return false; }
void Exit() { }
private:
void CustomSetContinuousDetection(bool ShouldUseCCD) { }
void CustomSetGravity(vec3 &NewGravity) { }
void CustomSetWorldLimit(vec3 &NewWorldMin, vec3 &NewWorldMax) { }
void CustomSetTimestep(float NewTimestep) { }

#endif // PHYSIC IMPLEMENTATION

public:
//Main logic :
//The Set*() functions do the all-lib-independent data storage.


Loading…
Cancel
Save