This commit is contained in:
Lendemor 2017-08-24 15:54:56 +02:00
commit 93049b41fd
4 changed files with 11 additions and 2 deletions

View File

@ -121,6 +121,7 @@ void Engine::update()
{
m_physicsDebugNode->clearBuffers();
m_world->debugDrawWorld();
getScene()->registerMeshType(m_physicsDebugNode->getFlags());
}
}

View File

@ -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());

View File

@ -2,15 +2,16 @@
#define PHYSICSDEBUGNODE_H
#include "meshnode.h"
#include <SparrowRenderer/mesh.h>
#include <LinearMath/btIDebugDraw.h>
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();
};

View File

@ -209,7 +209,7 @@ public:
DeferredPipeline* pipeline = dynamic_cast<DeferredPipeline*>(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);