[DEV] ispect why the object is not displayed

This commit is contained in:
Edouard DUPIN 2014-11-14 23:17:57 +01:00
parent 714662d7a9
commit 4b86e2902a
5 changed files with 20 additions and 4 deletions

View File

@ -322,10 +322,12 @@ void ege::ElementPhysic::draw(int32_t _pass) {
if (false == m_elementInPhysicsSystem) {
return;
}
EGE_INFO("draw : " << _pass );
if (_pass == 0) {
if( nullptr != m_body
&& nullptr != m_mesh
&& m_body->getMotionState() ) {
EGE_INFO(" plop ");
btScalar mmm[16];
btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_body->getMotionState();
myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(mmm);

View File

@ -31,6 +31,9 @@ namespace ege {
const vec3& getSize() const {
return m_size;
};
void setSize(const vec3& _size) {
m_size = _size;
}
public:
virtual const ege::PhysicsBox* toBox() const {
return this;

View File

@ -115,6 +115,9 @@ namespace ege {
const std::vector<std::shared_ptr<ege::PhysicsShape>>& getPhysicalProperties() const {
return m_physics;
};
void addPhysicElement(const std::shared_ptr<ege::PhysicsShape>& _shape) {
m_physics.push_back(_shape);
}
private:
void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib
public:

View File

@ -388,7 +388,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
EGE_ERROR("Allocation error when creating physical shape ...");
continue;
}
m_physics.push_back(physics);
addPhysicElement(physics);
EGE_VERBOSE(" " << m_physics.size() << " " << inputDataLine);
currentMode = EMFModuleMeshPhysicsNamed;
} else if (currentMode == EMFModuleMeshPhysicsNamed) {

View File

@ -16,6 +16,7 @@
#include <etk/tool.h>
#include <ege/elements/ElementBase.h>
#include <ege/elements/ElementPhysic.h>
#include <ege/physicsShape/PhysicsBox.h>
#undef __class__
#define __class__ "Windows"
@ -93,16 +94,23 @@ void appl::Windows::init() {
}
myMesh = ege::resource::Mesh::createCube(3);
if (myMesh != nullptr) {
std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env);
//std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
element->setPosition(vec3(50,0,0));
//std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env);
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
element->setPosition(vec3(20,10,10));
element->setMesh(myMesh);
// add physic interface:
std::shared_ptr<ege::PhysicsBox> physic = std::make_shared<ege::PhysicsBox>();
physic->setSize(vec3(3.2,3.2,3.2));
myMesh->addPhysicElement(physic);
m_env->addElement(element);
/*
element = std::make_shared<ege::ElementBase>(m_env);
//std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
element->setPosition(vec3(-50,0,0));
element->setMesh(myMesh);
m_env->addElement(element);
*/
}
}