[DEV] add display

This commit is contained in:
Edouard DUPIN 2013-08-21 07:37:13 +02:00
parent c741f6e1c8
commit 43bbec9af3
2 changed files with 32 additions and 1 deletions

View File

@ -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)
{

View File

@ -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