Add limited macro for related Physic3D

This commit is contained in:
samuele3hu 2015-05-11 15:34:37 +08:00
parent 38b0cf7bf1
commit 9e9494ded0
3 changed files with 14 additions and 14 deletions

View File

@ -37,7 +37,7 @@ THE SOFTWARE.
#include "physics/CCPhysicsWorld.h" #include "physics/CCPhysicsWorld.h"
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
#include "physics3d/CCPhysics3DWorld.h" #include "physics3d/CCPhysics3DWorld.h"
#include "physics3d/CCPhysics3DComponent.h" #include "physics3d/CCPhysics3DComponent.h"
#endif #endif
@ -49,7 +49,7 @@ Scene::Scene()
: _physicsWorld(nullptr) : _physicsWorld(nullptr)
#endif #endif
{ {
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
_physics3DWorld = nullptr; _physics3DWorld = nullptr;
_physics3dDebugCamera = nullptr; _physics3dDebugCamera = nullptr;
#endif #endif
@ -71,7 +71,7 @@ Scene::~Scene()
#if CC_USE_PHYSICS #if CC_USE_PHYSICS
CC_SAFE_DELETE(_physicsWorld); CC_SAFE_DELETE(_physicsWorld);
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
CC_SAFE_RELEASE(_physics3DWorld); CC_SAFE_RELEASE(_physics3DWorld);
CC_SAFE_RELEASE(_physics3dDebugCamera); CC_SAFE_RELEASE(_physics3dDebugCamera);
#endif #endif
@ -172,7 +172,7 @@ void Scene::render(Renderer* renderer)
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
} }
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
if (_physics3DWorld && _physics3DWorld->isDebugDrawEnabled()) if (_physics3DWorld && _physics3DWorld->isDebugDrawEnabled())
{ {
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
@ -200,7 +200,7 @@ void Scene::removeAllChildren()
} }
} }
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
void Scene::setPhysics3DDebugCamera(Camera* camera) void Scene::setPhysics3DDebugCamera(Camera* camera)
{ {
CC_SAFE_RETAIN(camera); CC_SAFE_RETAIN(camera);
@ -209,7 +209,7 @@ void Scene::setPhysics3DDebugCamera(Camera* camera)
} }
#endif #endif
#if (CC_USE_PHYSICS || CC_USE_3D_PHYSICS) #if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION))
void Scene::addChild(Node* child, int zOrder, int tag) void Scene::addChild(Node* child, int zOrder, int tag)
{ {
Node::addChild(child, zOrder, tag); Node::addChild(child, zOrder, tag);
@ -250,7 +250,7 @@ bool Scene::initWithPhysics()
CC_BREAK_IF(! (_physicsWorld = PhysicsWorld::construct(*this))); CC_BREAK_IF(! (_physicsWorld = PhysicsWorld::construct(*this)));
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
Physics3DWorldDes info; Physics3DWorldDes info;
//TODO: FIX ME //TODO: FIX ME
//info.isDebugDrawEnabled = true; //info.isDebugDrawEnabled = true;
@ -289,7 +289,7 @@ void Scene::addChildToPhysicsWorld(Node* child)
} }
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
if (_physics3DWorld) if (_physics3DWorld)
{ {
std::function<void(Node*)> addToPhysicsWorldFunc = nullptr; std::function<void(Node*)> addToPhysicsWorldFunc = nullptr;

View File

@ -41,7 +41,7 @@ class EventCustom;
#if CC_USE_PHYSICS #if CC_USE_PHYSICS
class PhysicsWorld; class PhysicsWorld;
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
class Physics3DWorld; class Physics3DWorld;
#endif #endif
/** /**
@ -139,7 +139,7 @@ protected:
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(Scene); CC_DISALLOW_COPY_AND_ASSIGN(Scene);
#if (CC_USE_PHYSICS || CC_USE_3D_PHYSICS) #if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION))
public: public:
virtual void addChild(Node* child, int zOrder, int tag) override; virtual void addChild(Node* child, int zOrder, int tag) override;
virtual void addChild(Node* child, int zOrder, const std::string &name) override; virtual void addChild(Node* child, int zOrder, const std::string &name) override;
@ -152,7 +152,7 @@ public:
inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; } inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; }
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
/** Get the 3d physics world of the scene. /** Get the 3d physics world of the scene.
* @return The 3d physics world of the scene. * @return The 3d physics world of the scene.
* @js NA * @js NA
@ -181,7 +181,7 @@ protected:
PhysicsWorld* _physicsWorld; PhysicsWorld* _physicsWorld;
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
Physics3DWorld* _physics3DWorld; Physics3DWorld* _physics3DWorld;
Camera* _physics3dDebugCamera; // Camera* _physics3dDebugCamera; //
#endif #endif

View File

@ -70,7 +70,7 @@ THE SOFTWARE.
#include "physics/CCPhysicsWorld.h" #include "physics/CCPhysicsWorld.h"
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
#include "physics3d/CCPhysics3DWorld.h" #include "physics3d/CCPhysics3DWorld.h"
#endif #endif
@ -298,7 +298,7 @@ void Director::drawScene()
physicsWorld->update(_deltaTime, false); physicsWorld->update(_deltaTime, false);
} }
#endif #endif
#if CC_USE_3D_PHYSICS #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
auto physics3DWorld = _runningScene->getPhysics3DWorld(); auto physics3DWorld = _runningScene->getPhysics3DWorld();
if (physics3DWorld) if (physics3DWorld)
{ {