From 9e9494ded090e870e9f9f4c608d4f05361d0e769 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Mon, 11 May 2015 15:34:37 +0800 Subject: [PATCH] Add limited macro for related Physic3D --- cocos/2d/CCScene.cpp | 16 ++++++++-------- cocos/2d/CCScene.h | 8 ++++---- cocos/base/CCDirector.cpp | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cocos/2d/CCScene.cpp b/cocos/2d/CCScene.cpp index cffa555a37..3bc41bc4f5 100644 --- a/cocos/2d/CCScene.cpp +++ b/cocos/2d/CCScene.cpp @@ -37,7 +37,7 @@ THE SOFTWARE. #include "physics/CCPhysicsWorld.h" #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION #include "physics3d/CCPhysics3DWorld.h" #include "physics3d/CCPhysics3DComponent.h" #endif @@ -49,7 +49,7 @@ Scene::Scene() : _physicsWorld(nullptr) #endif { -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION _physics3DWorld = nullptr; _physics3dDebugCamera = nullptr; #endif @@ -71,7 +71,7 @@ Scene::~Scene() #if CC_USE_PHYSICS CC_SAFE_DELETE(_physicsWorld); #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION CC_SAFE_RELEASE(_physics3DWorld); CC_SAFE_RELEASE(_physics3dDebugCamera); #endif @@ -172,7 +172,7 @@ void Scene::render(Renderer* renderer) 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()) { 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) { CC_SAFE_RETAIN(camera); @@ -209,7 +209,7 @@ void Scene::setPhysics3DDebugCamera(Camera* camera) } #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) { Node::addChild(child, zOrder, tag); @@ -250,7 +250,7 @@ bool Scene::initWithPhysics() CC_BREAK_IF(! (_physicsWorld = PhysicsWorld::construct(*this))); #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION Physics3DWorldDes info; //TODO: FIX ME //info.isDebugDrawEnabled = true; @@ -289,7 +289,7 @@ void Scene::addChildToPhysicsWorld(Node* child) } #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION if (_physics3DWorld) { std::function addToPhysicsWorldFunc = nullptr; diff --git a/cocos/2d/CCScene.h b/cocos/2d/CCScene.h index 3671ba1551..0b3701f064 100644 --- a/cocos/2d/CCScene.h +++ b/cocos/2d/CCScene.h @@ -41,7 +41,7 @@ class EventCustom; #if CC_USE_PHYSICS class PhysicsWorld; #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION class Physics3DWorld; #endif /** @@ -139,7 +139,7 @@ protected: private: 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: virtual void addChild(Node* child, int zOrder, int tag) override; virtual void addChild(Node* child, int zOrder, const std::string &name) override; @@ -152,7 +152,7 @@ public: inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; } #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION /** Get the 3d physics world of the scene. * @return The 3d physics world of the scene. * @js NA @@ -181,7 +181,7 @@ protected: PhysicsWorld* _physicsWorld; #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION Physics3DWorld* _physics3DWorld; Camera* _physics3dDebugCamera; // #endif diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index abaff9a2fa..ffc9584afc 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -70,7 +70,7 @@ THE SOFTWARE. #include "physics/CCPhysicsWorld.h" #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION #include "physics3d/CCPhysics3DWorld.h" #endif @@ -298,7 +298,7 @@ void Director::drawScene() physicsWorld->update(_deltaTime, false); } #endif -#if CC_USE_3D_PHYSICS +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION auto physics3DWorld = _runningScene->getPhysics3DWorld(); if (physics3DWorld) {