From 43bbec9af34f88893db95aa670b22f6377a5a356 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 21 Aug 2013 07:37:13 +0200 Subject: [PATCH] [DEV] add display --- ege/ElementGame.cpp | 31 +++++++++++++++++++++++++++++++ ege/ElementGame.h | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ege/ElementGame.cpp b/ege/ElementGame.cpp index bf40659..733b97e 100644 --- a/ege/ElementGame.cpp +++ b/ege/ElementGame.cpp @@ -58,6 +58,18 @@ ege::ElementGame::~ElementGame(void) IADisable(); // same ... DynamicDisable(); + if (NULL != m_mesh) { + // release the mesh + ewol::resource::Release(m_mesh); + } + if (NULL != m_body) { + delete(m_body); + m_body = NULL; + } + if (NULL != m_shape) { + delete(m_shape); + m_shape=NULL; + } EGE_DEBUG("Destroy element : uId=" << m_uID); } @@ -405,6 +417,25 @@ void ege::ElementGame::DrawDebug(ewol::Colored3DObject* _draw, const ege::Camera * etk::matScale(vec3(0.05,0.05,0.05))); } +void ege::ElementGame::Draw(int32_t _pass) +{ + if (false == m_elementInPhysicsSystem) { + return; + } + if (_pass==0) { + if( NULL != m_body + && NULL != m_mesh + && m_body->getMotionState() ) { + btScalar mmm[16]; + btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_body->getMotionState(); + myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(mmm); + + mat4 transformationMatrix(mmm); + transformationMatrix.Transpose(); + m_mesh->Draw(transformationMatrix); + } + } +} void ege::ElementGame::DynamicEnable(void) { diff --git a/ege/ElementGame.h b/ege/ElementGame.h index 519da72..b5f01fa 100644 --- a/ege/ElementGame.h +++ b/ege/ElementGame.h @@ -125,7 +125,7 @@ namespace ege * @brief Draw the curent element (can have multiple display) * @param[in] pass Id of the current pass : [0..?] */ - virtual void Draw(int32_t _pass=0) { }; + virtual void Draw(int32_t _pass=0); /** * @brief Draw the current life of the element