[DEV] update to the new ETK allocator wrapper
This commit is contained in:
parent
4a87d37e78
commit
b41fbb70ac
@ -118,13 +118,13 @@ void ege::ElementPhysic::removeShape() {
|
|||||||
// need to chek if the shape is the same as the mesh shape ...
|
// need to chek if the shape is the same as the mesh shape ...
|
||||||
if (m_mesh == nullptr) {
|
if (m_mesh == nullptr) {
|
||||||
// no mesh == > standalone shape
|
// no mesh == > standalone shape
|
||||||
delete(m_shape);
|
ETK_DELETE(btCollisionShape, m_shape);
|
||||||
m_shape=nullptr;
|
m_shape=nullptr;
|
||||||
EGE_WARNING("Remove shape .2.");
|
EGE_WARNING("Remove shape .2.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_shape != m_mesh->getShape()) {
|
if (m_shape != m_mesh->getShape()) {
|
||||||
delete(m_shape);
|
ETK_DELETE(btCollisionShape, m_shape);
|
||||||
m_shape=nullptr;
|
m_shape=nullptr;
|
||||||
EGE_WARNING("Remove shape .3.");
|
EGE_WARNING("Remove shape .3.");
|
||||||
return;
|
return;
|
||||||
@ -136,7 +136,7 @@ void ege::ElementPhysic::FunctionFreeShape(void* _pointer) {
|
|||||||
if (_pointer == nullptr) {
|
if (_pointer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delete(static_cast<btCollisionShape*>(_pointer));
|
ETK_DELETE(btCollisionShape, _pointer);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void ege::ElementPhysic::setPosition(const vec3& _pos) {
|
void ege::ElementPhysic::setPosition(const vec3& _pos) {
|
||||||
@ -389,7 +389,7 @@ void ege::ElementPhysic::iaEnable() {
|
|||||||
// IA already started ...
|
// IA already started ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_IA = new localIA(*this);
|
m_IA = ETK_NEW(localIA, *this);
|
||||||
if (m_IA == nullptr) {
|
if (m_IA == nullptr) {
|
||||||
EGE_ERROR("Can not start the IA == > allocation error");
|
EGE_ERROR("Can not start the IA == > allocation error");
|
||||||
return;
|
return;
|
||||||
@ -408,7 +408,7 @@ void ege::ElementPhysic::iaDisable() {
|
|||||||
//m_env->getPhysicEngine().getDynamicWorld()->removeAction(m_IA);
|
//m_env->getPhysicEngine().getDynamicWorld()->removeAction(m_IA);
|
||||||
}
|
}
|
||||||
// remove IA:
|
// remove IA:
|
||||||
delete(m_IA);
|
ETK_DELETE(localIA, m_IA);
|
||||||
m_IA = nullptr;
|
m_IA = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void ege::physics::Component::generate() {
|
|||||||
tmpElement->getSize().y(),
|
tmpElement->getSize().y(),
|
||||||
tmpElement->getSize().z());
|
tmpElement->getSize().z());
|
||||||
// Create the box shape
|
// Create the box shape
|
||||||
ephysics::BoxShape* shape = new ephysics::BoxShape(halfExtents, 0.0001);
|
ephysics::BoxShape* shape = ETK_NEW(ephysics::BoxShape, halfExtents, 0.0001);
|
||||||
m_listShape.pushBack(shape);
|
m_listShape.pushBack(shape);
|
||||||
// The ephysic use Y as UP ==> ege use Z as UP
|
// The ephysic use Y as UP ==> ege use Z as UP
|
||||||
//orientation = orientation * ephysics::Quaternion(-0.707107, 0, 0, 0.707107);
|
//orientation = orientation * ephysics::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||||
@ -133,7 +133,7 @@ void ege::physics::Component::generate() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Create the Cylinder shape
|
// Create the Cylinder shape
|
||||||
ephysics::CylinderShape* shape = new ephysics::CylinderShape(tmpElement->getRadius(), tmpElement->getSize());
|
ephysics::CylinderShape* shape = ETK_NEW(ephysics::CylinderShape, tmpElement->getRadius(), tmpElement->getSize());
|
||||||
// The ephysic use Y as UP ==> ege use Z as UP
|
// The ephysic use Y as UP ==> ege use Z as UP
|
||||||
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||||
etk::Transform3D transform(it->getOrigin(), orientation);
|
etk::Transform3D transform(it->getOrigin(), orientation);
|
||||||
@ -150,7 +150,7 @@ void ege::physics::Component::generate() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Create the Capsule shape
|
// Create the Capsule shape
|
||||||
ephysics::CapsuleShape* shape = new ephysics::CapsuleShape(tmpElement->getRadius(), tmpElement->getSize());
|
ephysics::CapsuleShape* shape = ETK_NEW(ephysics::CapsuleShape, tmpElement->getRadius(), tmpElement->getSize());
|
||||||
// The ephysic use Y as UP ==> ege use Z as UP
|
// The ephysic use Y as UP ==> ege use Z as UP
|
||||||
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||||
etk::Transform3D transform(it->getOrigin(), orientation);
|
etk::Transform3D transform(it->getOrigin(), orientation);
|
||||||
@ -167,7 +167,7 @@ void ege::physics::Component::generate() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Create the Cone shape
|
// Create the Cone shape
|
||||||
ephysics::ConeShape* shape = new ephysics::ConeShape(tmpElement->getRadius(), tmpElement->getSize());
|
ephysics::ConeShape* shape = ETK_NEW(ephysics::ConeShape, tmpElement->getRadius(), tmpElement->getSize());
|
||||||
// The ephysic use Y as UP ==> ege use Z as UP
|
// The ephysic use Y as UP ==> ege use Z as UP
|
||||||
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||||
etk::Transform3D transform(it->getOrigin(), orientation);
|
etk::Transform3D transform(it->getOrigin(), orientation);
|
||||||
@ -184,7 +184,7 @@ void ege::physics::Component::generate() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Create the box shape
|
// Create the box shape
|
||||||
ephysics::SphereShape* shape = new ephysics::SphereShape(tmpElement->getRadius());
|
ephysics::SphereShape* shape = ETK_NEW(ephysics::SphereShape, tmpElement->getRadius());
|
||||||
// The ephysic use Y as UP ==> ege use Z as UP
|
// The ephysic use Y as UP ==> ege use Z as UP
|
||||||
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||||
etk::Transform3D transform(it->getOrigin(), orientation);
|
etk::Transform3D transform(it->getOrigin(), orientation);
|
||||||
@ -204,18 +204,18 @@ void ege::physics::Component::generate() {
|
|||||||
static const etk::Vector<vec3> vertices = {vec3(-100.0f,-100.0f,-50.0f),vec3(100.0f,-100.0f,-50.0f),vec3(100.0f,100.0f,-50.0f)};
|
static const etk::Vector<vec3> vertices = {vec3(-100.0f,-100.0f,-50.0f),vec3(100.0f,-100.0f,-50.0f),vec3(100.0f,100.0f,-50.0f)};
|
||||||
static const etk::Vector<uint32_t> indices = {0,1,2};
|
static const etk::Vector<uint32_t> indices = {0,1,2};
|
||||||
|
|
||||||
ephysics::TriangleVertexArray* triangleArray = new ephysics::TriangleVertexArray(vertices, indices);
|
ephysics::TriangleVertexArray* triangleArray = ETK_NEW(ephysics::TriangleVertexArray, vertices, indices);
|
||||||
#else
|
#else
|
||||||
ephysics::TriangleVertexArray* triangleArray = new ephysics::TriangleVertexArray(tmpElement->getVertex(), tmpElement->getIndices());
|
ephysics::TriangleVertexArray* triangleArray = ETK_NEW(ephysics::TriangleVertexArray, tmpElement->getVertex(), tmpElement->getIndices());
|
||||||
#endif
|
#endif
|
||||||
// Now that we have a TriangleVertexArray, we need to create a TriangleMesh and add the TriangleVertexArray into it as a subpart.
|
// Now that we have a TriangleVertexArray, we need to create a TriangleMesh and add the TriangleVertexArray into it as a subpart.
|
||||||
// Once this is done, we can create the actual ConcaveMeshShape and add it to the body we want to simulate as in the following example:
|
// Once this is done, we can create the actual ConcaveMeshShape and add it to the body we want to simulate as in the following example:
|
||||||
ephysics::TriangleMesh* triangleMesh = new ephysics::TriangleMesh();
|
ephysics::TriangleMesh* triangleMesh = ETK_NEW(ephysics::TriangleMesh);
|
||||||
// Add the triangle vertex array to the triangle mesh
|
// Add the triangle vertex array to the triangle mesh
|
||||||
triangleMesh->addSubpart(triangleArray);
|
triangleMesh->addSubpart(triangleArray);
|
||||||
// Create the concave mesh shape
|
// Create the concave mesh shape
|
||||||
// TODO : Manage memory leak ...
|
// TODO : Manage memory leak ...
|
||||||
ephysics::ConcaveShape* shape = new ephysics::ConcaveMeshShape(triangleMesh);
|
ephysics::ConcaveShape* shape = ETK_NEW(ephysics::ConcaveMeshShape, triangleMesh);
|
||||||
// The ephysic use Y as UP ==> ege use Z as UP
|
// The ephysic use Y as UP ==> ege use Z as UP
|
||||||
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
etk::Quaternion orientation = it->getOrientation() * etk::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||||
etk::Transform3D transform(it->getOrigin(), it->getOrientation());
|
etk::Transform3D transform(it->getOrigin(), it->getOrientation());
|
||||||
|
@ -94,7 +94,7 @@ ege::physics::Engine::Engine(ege::Environement* _env) :
|
|||||||
// Start engine with no gravity
|
// Start engine with no gravity
|
||||||
vec3 gravity(0.0f, 0.0f, 0.0f);
|
vec3 gravity(0.0f, 0.0f, 0.0f);
|
||||||
// Create the dynamics world
|
// Create the dynamics world
|
||||||
m_dynamicsWorld = new ephysics::DynamicsWorld(gravity);
|
m_dynamicsWorld = ETK_NEW(ephysics::DynamicsWorld, gravity);
|
||||||
if (m_dynamicsWorld != nullptr) {
|
if (m_dynamicsWorld != nullptr) {
|
||||||
// Set the number of iterations of the constraint solver
|
// Set the number of iterations of the constraint solver
|
||||||
m_dynamicsWorld->setNbIterationsVelocitySolver(15);
|
m_dynamicsWorld->setNbIterationsVelocitySolver(15);
|
||||||
@ -105,7 +105,7 @@ ege::physics::Engine::Engine(ege::Environement* _env) :
|
|||||||
ege::physics::Engine::~Engine() {
|
ege::physics::Engine::~Engine() {
|
||||||
if (m_dynamicsWorld != nullptr) {
|
if (m_dynamicsWorld != nullptr) {
|
||||||
m_dynamicsWorld->setEventListener(nullptr);
|
m_dynamicsWorld->setEventListener(nullptr);
|
||||||
delete m_dynamicsWorld;
|
ETK_DELETE(ephysics::DynamicsWorld, m_dynamicsWorld);
|
||||||
m_dynamicsWorld = nullptr;
|
m_dynamicsWorld = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class MainApplication : public ewol::context::Application {
|
|||||||
*/
|
*/
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// second possibility
|
// second possibility
|
||||||
return ewol::run(new MainApplication(), _argc, _argv);
|
return ewol::run(ETK_NEW(appl::MainApplication)(), _argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class MainApplication : public ewol::context::Application {
|
|||||||
*/
|
*/
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// second possibility
|
// second possibility
|
||||||
return ewol::run(new MainApplication(), _argc, _argv);
|
return ewol::run(ETK_NEW(appl::MainApplication)(), _argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class MainApplication : public ewol::context::Application {
|
|||||||
*/
|
*/
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// second possibility
|
// second possibility
|
||||||
return ewol::run(new MainApplication(), _argc, _argv);
|
return ewol::run(ETK_NEW(appl::MainApplication)(), _argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class MainApplication : public ewol::context::Application {
|
|||||||
*/
|
*/
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// second possibility
|
// second possibility
|
||||||
return ewol::run(new MainApplication(), _argc, _argv);
|
return ewol::run(ETK_NEW(appl::MainApplication)(), _argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class MainApplication : public ewol::context::Application {
|
|||||||
*/
|
*/
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// second possibility
|
// second possibility
|
||||||
return ewol::run(new MainApplication(), _argc, _argv);
|
return ewol::run(ETK_NEW(appl::MainApplication)(), _argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class MainApplication : public ewol::context::Application {
|
|||||||
*/
|
*/
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// second possibility
|
// second possibility
|
||||||
return ewol::run(new MainApplication(), _argc, _argv);
|
return ewol::run(ETK_NEW(appl::MainApplication)(), _argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class MainApplication : public ewol::context::Application {
|
|||||||
*/
|
*/
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// second possibility
|
// second possibility
|
||||||
return ewol::run(new MainApplication(), _argc, _argv);
|
return ewol::run(ETK_NEW(appl::MainApplication)(), _argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user