diff --git a/ege/CollisionShapeCreator.cpp b/ege/CollisionShapeCreator.cpp index d2174cd..0521eb4 100644 --- a/ege/CollisionShapeCreator.cpp +++ b/ege/CollisionShapeCreator.cpp @@ -24,13 +24,13 @@ btCollisionShape* ege::collision::createShape(const ememory::SharedPtr& _mesh) { if (_mesh == nullptr) { - EGE_DEBUG("Create empty shape (no mesh)"); + EGE_ERROR("Create empty shape (no mesh)"); return new btEmptyShape();; } const std::vector>& physiqueProperty = _mesh->getPhysicalProperties(); if (physiqueProperty.size() == 0) { - EGE_DEBUG("Create empty shape (no default shape)"); - return new btEmptyShape();; + EGE_ERROR("Create empty shape (no default shape)"); + return new btEmptyShape(); } int32_t count = 0; for (size_t iii=0; iii1) { - EGE_DEBUG("Create complexe shape"); + EGE_ERROR("Create complexe shape"); outputShape = new btCompoundShape(); } else { - EGE_DEBUG("Create simple shape"); + EGE_ERROR("Create simple shape"); + //outputShape = new btCompoundShape(); } for (size_t iii=0; iiigetType()) { case ege::PhysicsShape::box : { - EGE_DEBUG(" Box"); + EGE_ERROR(" Box"); const ege::PhysicsBox* tmpElement = physiqueProperty[iii]->toBox(); if (tmpElement == nullptr) { - // ERROR ... + EGE_ERROR(" Box ==> can not cast in BOX"); continue; } btCollisionShape* tmpShape = new btBoxShape(tmpElement->getSize()); @@ -76,7 +77,7 @@ btCollisionShape* ege::collision::createShape(const ememory::SharedPtrtoCylinder(); if (tmpElement == nullptr) { - // ERROR ... + EGE_ERROR(" Cylinder ==> can not cast in Cylinder"); continue; } btCollisionShape* tmpShape = new btCylinderShape(tmpElement->getSize()); @@ -95,7 +96,7 @@ btCollisionShape* ege::collision::createShape(const ememory::SharedPtrtoCapsule(); if (tmpElement == nullptr) { - // ERROR ... + EGE_ERROR(" Capsule ==> can not cast in Capsule"); continue; } btCollisionShape* tmpShape = new btCapsuleShape(tmpElement->getRadius(), tmpElement->getHeight()); @@ -114,7 +115,7 @@ btCollisionShape* ege::collision::createShape(const ememory::SharedPtrtoCone(); if (tmpElement == nullptr) { - // ERROR ... + EGE_ERROR(" Cone ==> can not cast in Cone"); continue; } btCollisionShape* tmpShape = new btConeShape(tmpElement->getRadius(), tmpElement->getHeight()); @@ -133,7 +134,7 @@ btCollisionShape* ege::collision::createShape(const ememory::SharedPtrtoSphere(); if (tmpElement == nullptr) { - // ERROR ... + EGE_ERROR(" Sphere ==> can not cast in Sphere"); continue; } btCollisionShape* tmpShape = new btSphereShape(tmpElement->getRadius()); @@ -152,7 +153,7 @@ btCollisionShape* ege::collision::createShape(const ememory::SharedPtrtoConvexHull(); if (tmpElement == nullptr) { - // ERROR ... + EGE_ERROR(" convexHull ==> can not cast in convexHull"); continue; } btConvexHullShape* tmpShape = new btConvexHullShape(&(tmpElement->getPointList()[0].x()), tmpElement->getPointList().size()); diff --git a/ege/elements/ElementPhysic.cpp b/ege/elements/ElementPhysic.cpp index d371e06..928cf7e 100644 --- a/ege/elements/ElementPhysic.cpp +++ b/ege/elements/ElementPhysic.cpp @@ -60,9 +60,11 @@ void ege::ElementPhysic::createRigidBody(float _mass) { startTransform.setIdentity(); vec3 localInertia(0,0,0); //rigidbody is dynamic if and only if mass is non zero, otherwise static - if (_mass != 0.0f && getShape()!=nullptr) { + if ( _mass != 0.0f + && getShape()!=nullptr) { getShape()->calculateLocalInertia(_mass, localInertia); } + EGE_ERROR("Create The RIGID body ..."); //using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects btDefaultMotionState* motionState = new btDefaultMotionState(startTransform); btRigidBody::btRigidBodyConstructionInfo rbInfo(_mass, motionState, getShape(), localInertia); @@ -355,12 +357,15 @@ void ege::ElementPhysic::draw(int32_t _pass) { if( m_body != nullptr && m_mesh != nullptr && m_body->getMotionState() ) { - //EGE_INFO("element pos = " << getPosition()); + EGE_INFO("element pos = " << getPosition()); btScalar mmm[16]; btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_body->getMotionState(); myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(mmm); - mat4 transformationMatrix(mmm); + + EGE_INFO(" mat = " << mat4(mmm)); + //mat4 transformationMatrix(mmm); + mat4 transformationMatrix = mat4(mmm) * etk::matScale(vec3(20,20,20)); transformationMatrix.transpose(); m_mesh->draw(transformationMatrix); } diff --git a/sample/LowPoly/appl/Windows.hpp b/sample/LowPoly/appl/Windows.hpp index e76a23e..c105b4b 100644 --- a/sample/LowPoly/appl/Windows.hpp +++ b/sample/LowPoly/appl/Windows.hpp @@ -18,7 +18,7 @@ namespace appl { ememory::SharedPtr m_camera; protected: Windows(); - void init(); + void init() override; public: DECLARE_FACTORY(Windows); virtual ~Windows() { };