From 69b84faf58ddceeca14baa99ebc3d06778ff233c Mon Sep 17 00:00:00 2001 From: Anselme Date: Thu, 24 Aug 2017 15:54:08 +0200 Subject: [PATCH] fixed the pysicsDebugNode --- src/engine.cpp | 1 + src/scene/physicsdebugnode.cpp | 5 +++++ src/scene/physicsdebugnode.h | 5 ++++- src/test/main.cpp | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/engine.cpp b/src/engine.cpp index 1c1dd5c..5266503 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -121,6 +121,7 @@ void Engine::update() { m_physicsDebugNode->clearBuffers(); m_world->debugDrawWorld(); + getScene()->registerMeshType(m_physicsDebugNode->getFlags()); } } diff --git a/src/scene/physicsdebugnode.cpp b/src/scene/physicsdebugnode.cpp index d12f02c..e13b50b 100644 --- a/src/scene/physicsdebugnode.cpp +++ b/src/scene/physicsdebugnode.cpp @@ -17,6 +17,11 @@ PhysicsDebugNode::PhysicsDebugNode() : m_geometry.mesh->updateFlags(); } +PhysicsDebugNode::~PhysicsDebugNode() +{ + delete m_geometry.mesh; +} + void PhysicsDebugNode::drawLine(const btVector3& from, const btVector3& to, const btVector3& color) { glm::vec3 glColor(color.x(), color.y(), color.z()); diff --git a/src/scene/physicsdebugnode.h b/src/scene/physicsdebugnode.h index 2d2b43a..038b859 100644 --- a/src/scene/physicsdebugnode.h +++ b/src/scene/physicsdebugnode.h @@ -2,15 +2,16 @@ #define PHYSICSDEBUGNODE_H #include "meshnode.h" +#include #include class PhysicsDebugNode : public MeshNode, public btIDebugDraw { - Mesh* m_debugMesh; int m_debugMode; public: PhysicsDebugNode(); + ~PhysicsDebugNode(); virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color); @@ -26,6 +27,8 @@ public: virtual void setDebugMode(int debugMode) { m_debugMode = debugMode; } virtual int getDebugMode() const { return m_debugMode; } + unsigned int getFlags() { m_geometry.mesh->getFlags(); } + void clearBuffers(); }; diff --git a/src/test/main.cpp b/src/test/main.cpp index 2b33b19..4627756 100644 --- a/src/test/main.cpp +++ b/src/test/main.cpp @@ -209,7 +209,7 @@ public: DeferredPipeline* pipeline = dynamic_cast(scene->getPipeline()); pipeline->setSkybox(RESOURCE_GET(Texture, "skybox")); - DirectionnalLight* sun = new DirectionnalLight(glm::vec3(5, 8, -2), glm::vec3(0.9f)); + DirectionnalLight* sun = new DirectionnalLight(glm::vec3(5, 8, -2), glm::vec3(4.f)); LightNode *sunLight = new LightNode(sun); scene->getRootObject()->addChild(ambientLight);