diff --git a/ege/Camera.cpp b/ege/Camera.cpp index e96af28..9d34521 100644 --- a/ege/Camera.cpp +++ b/ege/Camera.cpp @@ -13,18 +13,18 @@ #undef __class__ #define __class__ "Camera" -void ege::Camera::Update(void) +void ege::Camera::update(void) { // Note the view axes of the basic camera is (0,0,-1) // clean matrix : - m_matrix.Identity(); + m_matrix.identity(); // move the world from the camera distance - m_matrix.Translate(vec3(0,0,-m_distance)); + m_matrix.translate(vec3(0,0,-m_distance)); // teta represent the angle from the ground to the axes then 90-teta represent the angle to apply (inverted for the world) - m_matrix.Rotate(vec3(1,0,0), -((M_PI/2.0f-m_angleTeta)*m_offsetFactor) ); - m_matrix.Rotate(vec3(0,0,1), -m_angleZ ); + m_matrix.rotate(vec3(1,0,0), -((M_PI/2.0f-m_angleTeta)*m_offsetFactor) ); + m_matrix.rotate(vec3(0,0,1), -m_angleZ ); // move the camera to the end point of view - m_matrix.Translate(-m_eye); + m_matrix.translate(-m_eye); #if 1 m_calculatedViewVector = vec3(0,0,-1); m_calculatedViewVector = m_calculatedViewVector.rotate(vec3(1,0,0), -((M_PI/2.0f-m_angleTeta)*m_offsetFactor) ); @@ -74,14 +74,14 @@ ege::Camera::Camera(vec3 _eye, float _angleZ, float _angleTeta, float _distance) m_offsetFactor(1.0f), m_forceViewTop(false) { - SetEye(_eye); - SetAngleZ(_angleZ); - SetDistance(_distance); - SetAngleTeta(_angleTeta); - Update(); + setEye(_eye); + setAngleZ(_angleZ); + setDistance(_distance); + setAngleTeta(_angleTeta); + update(); } -void ege::Camera::SetEye(vec3 _eye) +void ege::Camera::setEye(vec3 _eye) { m_eye = _eye; if (m_eye.x() < -1000) { @@ -102,49 +102,49 @@ void ege::Camera::SetEye(vec3 _eye) if (m_eye.z() > 10) { m_eye.setZ(10); } - Update(); + update(); } -void ege::Camera::SetAngleZ(float _angleZ) +void ege::Camera::setAngleZ(float _angleZ) { - if (_angleZ==NAN) { + if (_angleZ == NAN) { EGE_CRITICAL("try to set NAN value for the angle ..."); - } else if (_angleZ==INFINITY) { + } else if (_angleZ == INFINITY) { EGE_CRITICAL("try to set INFINITY value for the angle ..."); } else { m_angleZ = _angleZ; } - Update(); + update(); } -void ege::Camera::SetAngleTeta(float _angleTeta) +void ege::Camera::setAngleTeta(float _angleTeta) { m_angleTeta = etk_avg(M_PI/10.0f, _angleTeta, M_PI/2.0f); - Update(); + update(); } -void ege::Camera::SetDistance(float _distance) +void ege::Camera::setDistance(float _distance) { m_distance = etk_avg(5, _distance, 150); - Update(); + update(); } const float localFactor = 2.0; -void ege::Camera::PeriodicCall(float _step) +void ege::Camera::periodicCall(float _step) { //Note we need to view to the top in 500ms - if (true==m_forceViewTop) { + if (true == m_forceViewTop) { if (0.0f != m_offsetFactor) { m_offsetFactor -= _step*localFactor; m_offsetFactor = etk_avg(0,m_offsetFactor,1); - Update(); + update(); } } else { if (1.0f != m_offsetFactor) { m_offsetFactor += _step*localFactor; m_offsetFactor = etk_avg(0,m_offsetFactor,1); - Update(); + update(); } } } diff --git a/ege/Camera.h b/ege/Camera.h index 9762d53..f5f96b3 100644 --- a/ege/Camera.h +++ b/ege/Camera.h @@ -26,13 +26,13 @@ namespace ege float m_distance; mat4 m_matrix; //!< transformation matrix. /** - * @brief Update the matrix property + * @brief update the matrix property */ - void Update(void); + void update(void); // these element is calculated when we get the mattrix: vec3 m_calculatedOrigin; vec3 m_calculatedViewVector; - float m_offsetFactor; //!< this variable is used to move the camera to the top position of the system ==> automaticly + float m_offsetFactor; //!< this variable is used to move the camera to the top position of the system == > automaticly bool m_forceViewTop; public: /** @@ -44,56 +44,56 @@ namespace ege */ Camera(vec3 _eye=vec3(0,0,0), float _angleZ=0, float _angleTeta=0, float _distance=10); /** - * @brief Set the position of the camera. + * @brief set the position of the camera. * @param[in] pos Position of the camera. */ - void SetEye(vec3 _eye); + void setEye(vec3 _eye); /** - * @brief Get the curent Camera Eye position. + * @brief get the curent Camera Eye position. * @return the current position. */ - const vec3& GetEye(void) const { return m_eye; }; + const vec3& getEye(void) const { return m_eye; }; /** - * @brief Get the curent Camera origin position. + * @brief get the curent Camera origin position. * @return the current position. */ - const vec3& GetOrigin(void) const { return m_calculatedOrigin; }; - const vec3& GetViewVector(void) const { return m_calculatedViewVector; }; + const vec3& getOrigin(void) const { return m_calculatedOrigin; }; + const vec3& getViewVector(void) const { return m_calculatedViewVector; }; /** - * @brief Set the angle on the camera + * @brief set the angle on the camera * @param[in] _angleZ Rotation angle in Z */ - void SetAngleZ(float _angleZ); + void setAngleZ(float _angleZ); /** - * @brief Get the curent Camera angles. + * @brief get the curent Camera angles. * @return the current angles Z. */ - float GetAngleZ(void) const { return m_angleZ; }; + float getAngleZ(void) const { return m_angleZ; }; /** - * @brief Set the angle on the camera + * @brief set the angle on the camera * @param[in] _angleTeta Rotation angle in Teta */ - void SetAngleTeta(float _angleTeta); + void setAngleTeta(float _angleTeta); /** - * @brief Get the curent Camera angles. + * @brief get the curent Camera angles. * @return the current angles Teta. */ - float GetAngleTeta(void) const { return m_angleTeta; }; + float getAngleTeta(void) const { return m_angleTeta; }; /** - * @brief Set the angle on the camera + * @brief set the angle on the camera * @param[in] _distance Distance to the eye */ - void SetDistance(float _distance); + void setDistance(float _distance); /** - * @brief Get the curent Camera angles. + * @brief get the curent Camera angles. * @return the current distance to the eye. */ - float GetDistance(void) const { return m_distance; }; + float getDistance(void) const { return m_distance; }; /** - * @brief Get the transformation matix for the camera. + * @brief get the transformation matix for the camera. * @return the current transformation matrix */ - const mat4& GetMatrix(void) const { return m_matrix; }; + const mat4& getMatrix(void) const { return m_matrix; }; vec3 projectOnZGround(const vec2& _cameraDeltaAngle, float _zValue=0.0f); @@ -102,12 +102,12 @@ namespace ege * @brief It is really needed to call the camera periodicly for performing automatic movement * @param[in] step step time of moving */ - void PeriodicCall(float step); + void periodicCall(float step); /** - * @brief change camera mode of view ==> force to the top view + * @brief change camera mode of view == > force to the top view * @param[in] _newState The new state of this mode... */ - void SetForcingViewTop(bool _newState) { m_forceViewTop = _newState; }; + void setForcingViewTop(bool _newState) { m_forceViewTop = _newState; }; }; }; diff --git a/ege/CollisionShapeCreator.cpp b/ege/CollisionShapeCreator.cpp index 18878e5..11dac89 100644 --- a/ege/CollisionShapeCreator.cpp +++ b/ege/CollisionShapeCreator.cpp @@ -32,13 +32,13 @@ btCollisionShape* ege::collision::CreateShape(const ewol::Mesh* _mesh) if (NULL == _mesh) { return new btEmptyShape();; } - const etk::Vector& physiqueProperty = _mesh->GetPhysicalProperties(); - if (physiqueProperty.Size()==0) { + const etk::Vector& physiqueProperty = _mesh->getPhysicalProperties(); + if (physiqueProperty.size() == 0) { return new btEmptyShape();; } int32_t count = 0; - for (int32_t iii=0; iii1) { outputShape = new btCompoundShape(); } - for (int32_t iii=0; iiiGetType()) { + switch (physiqueProperty[iii]->getType()) { case ewol::PhysicsShape::box : { - const ewol::PhysicsBox* tmpElement = physiqueProperty[iii]->ToBox(); - if (NULL ==tmpElement) { + const ewol::PhysicsBox* tmpElement = physiqueProperty[iii]->toBox(); + if (NULL == tmpElement) { // ERROR ... continue; } - btCollisionShape* tmpShape = new btBoxShape(tmpElement->GetSize()); + btCollisionShape* tmpShape = new btBoxShape(tmpElement->getSize()); if (NULL != tmpShape) { if (outputShape == NULL) { return tmpShape; } else { - vec4 qqq = tmpElement->GetQuaternion(); - const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->GetOrigin()); + vec4 qqq = tmpElement->getQuaternion(); + const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->getOrigin()); outputShape->addChildShape(localTransform, tmpShape); } } break; } case ewol::PhysicsShape::cylinder : { - const ewol::PhysicsCylinder* tmpElement = physiqueProperty[iii]->ToCylinder(); - if (NULL ==tmpElement) { + const ewol::PhysicsCylinder* tmpElement = physiqueProperty[iii]->toCylinder(); + if (NULL == tmpElement) { // ERROR ... continue; } - btCollisionShape* tmpShape = new btCylinderShape(tmpElement->GetSize()); + btCollisionShape* tmpShape = new btCylinderShape(tmpElement->getSize()); if (NULL != tmpShape) { if (outputShape == NULL) { return tmpShape; } else { - vec4 qqq = tmpElement->GetQuaternion(); - const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->GetOrigin()); + vec4 qqq = tmpElement->getQuaternion(); + const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->getOrigin()); outputShape->addChildShape(localTransform, tmpShape); } } break; } case ewol::PhysicsShape::capsule : { - const ewol::PhysicsCapsule* tmpElement = physiqueProperty[iii]->ToCapsule(); - if (NULL ==tmpElement) { + const ewol::PhysicsCapsule* tmpElement = physiqueProperty[iii]->toCapsule(); + if (NULL == tmpElement) { // ERROR ... continue; } - btCollisionShape* tmpShape = new btCapsuleShape(tmpElement->GetRadius(), tmpElement->GetHeight()); + btCollisionShape* tmpShape = new btCapsuleShape(tmpElement->getRadius(), tmpElement->getHeight()); if (NULL != tmpShape) { if (outputShape == NULL) { return tmpShape; } else { - vec4 qqq = tmpElement->GetQuaternion(); - const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->GetOrigin()); + vec4 qqq = tmpElement->getQuaternion(); + const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->getOrigin()); outputShape->addChildShape(localTransform, tmpShape); } } break; } case ewol::PhysicsShape::cone : { - const ewol::PhysicsCone* tmpElement = physiqueProperty[iii]->ToCone(); - if (NULL ==tmpElement) { + const ewol::PhysicsCone* tmpElement = physiqueProperty[iii]->toCone(); + if (NULL == tmpElement) { // ERROR ... continue; } - btCollisionShape* tmpShape = new btConeShape(tmpElement->GetRadius(), tmpElement->GetHeight()); + btCollisionShape* tmpShape = new btConeShape(tmpElement->getRadius(), tmpElement->getHeight()); if (NULL != tmpShape) { if (outputShape == NULL) { return tmpShape; } else { - vec4 qqq = tmpElement->GetQuaternion(); - const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->GetOrigin()); + vec4 qqq = tmpElement->getQuaternion(); + const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->getOrigin()); outputShape->addChildShape(localTransform, tmpShape); } } break; } case ewol::PhysicsShape::sphere : { - const ewol::PhysicsSphere* tmpElement = physiqueProperty[iii]->ToSphere(); - if (NULL ==tmpElement) { + const ewol::PhysicsSphere* tmpElement = physiqueProperty[iii]->toSphere(); + if (NULL == tmpElement) { // ERROR ... continue; } - btCollisionShape* tmpShape = new btSphereShape(tmpElement->GetRadius()); + btCollisionShape* tmpShape = new btSphereShape(tmpElement->getRadius()); if (NULL != tmpShape) { if (outputShape == NULL) { return tmpShape; } else { - vec4 qqq = tmpElement->GetQuaternion(); - const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->GetOrigin()); + vec4 qqq = tmpElement->getQuaternion(); + const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->getOrigin()); outputShape->addChildShape(localTransform, tmpShape); } } break; } case ewol::PhysicsShape::convexHull : { - const ewol::PhysicsConvexHull* tmpElement = physiqueProperty[iii]->ToConvexHull(); - if (NULL ==tmpElement) { + const ewol::PhysicsConvexHull* tmpElement = physiqueProperty[iii]->toConvexHull(); + if (NULL == tmpElement) { // ERROR ... continue; } - btConvexHullShape* tmpShape = new btConvexHullShape(&(tmpElement->GetPointList()[0].x()), tmpElement->GetPointList().Size()); + btConvexHullShape* tmpShape = new btConvexHullShape(&(tmpElement->getPointList()[0].x()), tmpElement->getPointList().size()); if (NULL != tmpShape) { if (outputShape == NULL) { return tmpShape; } else { - vec4 qqq = tmpElement->GetQuaternion(); - const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->GetOrigin()); + vec4 qqq = tmpElement->getQuaternion(); + const btTransform localTransform(btQuaternion(qqq.x(),qqq.y(),qqq.z(),qqq.w()), tmpElement->getOrigin()); outputShape->addChildShape(localTransform, tmpShape); } } @@ -165,7 +165,7 @@ btCollisionShape* ege::collision::CreateShape(const ewol::Mesh* _mesh) break; } } - if (NULL==outputShape) { + if (NULL == outputShape) { return new btEmptyShape(); } return outputShape; diff --git a/ege/ElementGame.cpp b/ege/ElementGame.cpp index aa84048..bcc929c 100644 --- a/ege/ElementGame.cpp +++ b/ege/ElementGame.cpp @@ -1,4 +1,4 @@ -/** + /** * @author Edouard DUPIN * * @copyright 2011, Edouard DUPIN, all right reserved @@ -29,7 +29,7 @@ #undef __class__ #define __class__ "ElementGame" -const etk::UString& ege::ElementGame::GetType(void) const +const etk::UString& ege::ElementGame::getType(void) const { static const etk::UString nameType("----"); return nameType; @@ -53,7 +53,7 @@ ege::ElementGame::ElementGame(ege::Environement& _env) : static uint32_t unique=0; m_uID = unique; EGE_DEBUG("Create element : uId=" << m_uID); - m_debugText.SetFontSize(12); + m_debugText.setFontSize(12); unique++; } @@ -63,8 +63,8 @@ ege::ElementGame::~ElementGame(void) IADisable(); // same ... DynamicDisable(); - RemoveShape(); - ewol::Mesh::Release(m_mesh); + removeShape(); + ewol::Mesh::release(m_mesh); if (NULL != m_body) { delete(m_body); m_body = NULL; @@ -72,7 +72,7 @@ ege::ElementGame::~ElementGame(void) EGE_DEBUG("Destroy element : uId=" << m_uID); } -void ege::ElementGame::RemoveShape(void) +void ege::ElementGame::removeShape(void) { // no shape if (NULL == m_shape) { @@ -80,12 +80,12 @@ void ege::ElementGame::RemoveShape(void) } // need to chek if the shape is the same as the mesh shape ... if (m_mesh == NULL) { - // no mesh ==> standalone shape + // no mesh == > standalone shape delete(m_shape); m_shape=NULL; return; } - if (m_shape != m_mesh->GetShape()) { + if (m_shape != m_mesh->getShape()) { delete(m_shape); m_shape=NULL; return; @@ -95,75 +95,75 @@ void ege::ElementGame::RemoveShape(void) void ege::ElementGame::FunctionFreeShape(void* _pointer) { - if (NULL==_pointer) { + if (NULL == _pointer) { return; } delete(static_cast(_pointer)); } -bool ege::ElementGame::LoadMesh(const etk::UString& _meshFileName) +bool ege::ElementGame::loadMesh(const etk::UString& _meshFileName) { ewol::Mesh* tmpMesh=NULL; - tmpMesh = ewol::Mesh::Keep(_meshFileName); - if(NULL==tmpMesh) { + tmpMesh = ewol::Mesh::keep(_meshFileName); + if(NULL == tmpMesh) { EGE_ERROR("can not load the resources : " << _meshFileName); return false; } - return SetMesh(tmpMesh); + return setMesh(tmpMesh); } -bool ege::ElementGame::SetMesh(ewol::Mesh* _mesh) +bool ege::ElementGame::setMesh(ewol::Mesh* _mesh) { if (NULL!=m_mesh) { - RemoveShape(); - ewol::Mesh::Release(m_mesh); + removeShape(); + ewol::Mesh::release(m_mesh); } m_mesh = _mesh; // auto load the shape : - if (NULL==m_mesh) { + if (NULL == m_mesh) { return true; } - if (NULL != m_mesh->GetShape()) { - m_shape = static_cast(m_mesh->GetShape()); + if (NULL != m_mesh->getShape()) { + m_shape = static_cast(m_mesh->getShape()); return true; } - m_mesh->SetShape(ege::collision::CreateShape(m_mesh)); - m_mesh->SetFreeShapeFunction(&FunctionFreeShape); - m_shape = static_cast(m_mesh->GetShape()); + m_mesh->setShape(ege::collision::CreateShape(m_mesh)); + m_mesh->setFreeShapeFunction(&FunctionFreeShape); + m_shape = static_cast(m_mesh->getShape()); return true; } -bool ege::ElementGame::SetShape(btCollisionShape* _shape) +bool ege::ElementGame::setShape(btCollisionShape* _shape) { - RemoveShape(); + removeShape(); m_shape = _shape; return true; } -float ege::ElementGame::GetLifeRatio(void) +float ege::ElementGame::getLifeRatio(void) { - if (0>=m_life) { + if (0 >= m_life) { return 0; } return m_life/m_lifeMax; } -void ege::ElementGame::SetFireOn(int32_t groupIdSource, int32_t type, float power, const vec3& center) +void ege::ElementGame::setFireOn(int32_t groupIdSource, int32_t type, float power, const vec3& center) { float previousLife = m_life; m_life += power; m_life = etk_avg(0, m_life, m_lifeMax); - if (m_life<=0) { - EGE_DEBUG("[" << GetUID() << "] element is killed ..." << GetType()); + if (m_life <= 0) { + EGE_DEBUG("[" << getUID() << "] element is killed ..." << getType()); } if (m_life!=previousLife) { - OnLifeChange(); + onLifeChange(); } } -void ege::ElementGame::SetPosition(const vec3& pos) +void ege::ElementGame::setPosition(const vec3& pos) { if (NULL!=m_body) { btTransform transformation = m_body->getCenterOfMassTransform(); @@ -172,7 +172,7 @@ void ege::ElementGame::SetPosition(const vec3& pos) } } -const vec3& ege::ElementGame::GetPosition(void) +const vec3& ege::ElementGame::getPosition(void) { // this is to prevent error like segmentation fault ... static vec3 emptyPosition(-1000000,-1000000,-1000000); @@ -182,7 +182,7 @@ const vec3& ege::ElementGame::GetPosition(void) return emptyPosition; }; -const vec3& ege::ElementGame::GetSpeed(void) +const vec3& ege::ElementGame::getSpeed(void) { // this is to prevent error like segmentation fault ... static vec3 emptySpeed(0,0,0); @@ -192,7 +192,7 @@ const vec3& ege::ElementGame::GetSpeed(void) return emptySpeed; }; -const float ege::ElementGame::GetInvMass(void) +const float ege::ElementGame::getInvMass(void) { if (NULL!=m_body) { return m_body->getInvMass(); @@ -201,7 +201,7 @@ const float ege::ElementGame::GetInvMass(void) }; -static void DrawSphere(ewol::Colored3DObject* _draw, +static void drawSphere(ewol::Colored3DObject* _draw, btScalar _radius, int _lats, int _longs, @@ -233,16 +233,16 @@ static void DrawSphere(ewol::Colored3DObject* _draw, vec3 v2 = vec3(x * zr1, y * zr1, z1); vec3 v3 = vec3(x * zr0, y * zr0, z0); - EwolVertices.PushBack(v1); - EwolVertices.PushBack(v2); - EwolVertices.PushBack(v3); + EwolVertices.pushBack(v1); + EwolVertices.pushBack(v2); + EwolVertices.pushBack(v3); - EwolVertices.PushBack(v1); - EwolVertices.PushBack(v3); - EwolVertices.PushBack(v4); + EwolVertices.pushBack(v1); + EwolVertices.pushBack(v3); + EwolVertices.pushBack(v4); } } - _draw->Draw(EwolVertices, _tmpColor, _transformationMatrix); + _draw->draw(EwolVertices, _tmpColor, _transformationMatrix); } const float lifeBorder = 0.1f; @@ -250,45 +250,45 @@ const float lifeHeight = 0.3f; const float lifeWidth = 2.0f; const float lifeYPos = 1.7f; -void ege::ElementGame::DrawLife(ewol::Colored3DObject* _draw, const ege::Camera& _camera) +void ege::ElementGame::drawLife(ewol::Colored3DObject* _draw, const ege::Camera& _camera) { - if (NULL==_draw) { + if (NULL == _draw) { return; } - float ratio = GetLifeRatio(); + float ratio = getLifeRatio(); if (ratio == 1.0f) { return; } - mat4 transformationMatrix = etk::matTranslate(GetPosition()) - * etk::matRotate(vec3(0,0,1),_camera.GetAngleZ()) - * etk::matRotate(vec3(1,0,0),(M_PI/2.0f-_camera.GetAngleTeta())); + mat4 transformationMatrix = etk::matTranslate(getPosition()) + * etk::matRotate(vec3(0,0,1),_camera.getAngleZ()) + * etk::matRotate(vec3(1,0,0),(M_PI/2.0f-_camera.getAngleTeta())); etk::Vector localVertices; - localVertices.PushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos -lifeBorder,0)); - localVertices.PushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); - localVertices.PushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); - localVertices.PushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos -lifeBorder,0)); - localVertices.PushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); - localVertices.PushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos -lifeBorder,0)); + localVertices.pushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos -lifeBorder,0)); + localVertices.pushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); + localVertices.pushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); + localVertices.pushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos -lifeBorder,0)); + localVertices.pushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); + localVertices.pushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos -lifeBorder,0)); etk::Color myColor(0x0000FF99); - _draw->Draw(localVertices, myColor, transformationMatrix, false, false); - localVertices.Clear(); - /** Bounding box ==> model shape **/ - localVertices.PushBack(vec3(-lifeWidth/2.0 ,lifeYPos,0)); - localVertices.PushBack(vec3(-lifeWidth/2.0 ,lifeYPos + lifeHeight,0)); - localVertices.PushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos + lifeHeight,0)); - localVertices.PushBack(vec3(-lifeWidth/2.0 ,lifeYPos,0)); - localVertices.PushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos + lifeHeight,0)); - localVertices.PushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos,0)); + _draw->draw(localVertices, myColor, transformationMatrix, false, false); + localVertices.clear(); + /** Bounding box == > model shape **/ + localVertices.pushBack(vec3(-lifeWidth/2.0 ,lifeYPos,0)); + localVertices.pushBack(vec3(-lifeWidth/2.0 ,lifeYPos + lifeHeight,0)); + localVertices.pushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos + lifeHeight,0)); + localVertices.pushBack(vec3(-lifeWidth/2.0 ,lifeYPos,0)); + localVertices.pushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos + lifeHeight,0)); + localVertices.pushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos,0)); myColor =0x00FF00FF; if (ratio < 0.2f) { myColor = 0xFF0000FF; } else if (ratio < 0.4f) { myColor = 0xDA7B00FF; } - _draw->Draw(localVertices, myColor, transformationMatrix, false, false); + _draw->draw(localVertices, myColor, transformationMatrix, false, false); } -static void DrawShape(const btCollisionShape* _shape, +static void drawShape(const btCollisionShape* _shape, ewol::Colored3DObject* _draw, mat4 _transformationMatrix, etk::Vector _tmpVertices) @@ -299,20 +299,20 @@ static void DrawShape(const btCollisionShape* _shape, } etk::Color tmpColor(1.0, 0.0, 0.0, 0.3); - //EGE_DEBUG(" Draw (6): !btIDebugDraw::DBG_DrawWireframe"); + //EGE_DEBUG(" draw (6): !btIDebugDraw::DBG_DrawWireframe"); int shapetype=_shape->getShapeType(); switch (shapetype) { case SPHERE_SHAPE_PROXYTYPE: { // Sphere collision shape ... - //EGE_DEBUG(" Draw (01): SPHERE_SHAPE_PROXYTYPE"); + //EGE_DEBUG(" draw (01): SPHERE_SHAPE_PROXYTYPE"); const btSphereShape* sphereShape = static_cast(_shape); float radius = sphereShape->getMargin();//radius doesn't include the margin, so draw with margin - DrawSphere(_draw, radius, 10, 10, _transformationMatrix, tmpColor); + drawSphere(_draw, radius, 10, 10, _transformationMatrix, tmpColor); break; } case BOX_SHAPE_PROXYTYPE: { // Box collision shape ... - //EGE_DEBUG(" Draw (02): BOX_SHAPE_PROXYTYPE"); + //EGE_DEBUG(" draw (02): BOX_SHAPE_PROXYTYPE"); const btBoxShape* boxShape = static_cast(_shape); btVector3 halfExtent = boxShape->getHalfExtentsWithMargin(); static int indices[36] = { 0,1,2, 3,2,1, 4,0,6, @@ -327,36 +327,36 @@ static void DrawShape(const btCollisionShape* _shape, vec3(-halfExtent[0],halfExtent[1],-halfExtent[2]), vec3(halfExtent[0],-halfExtent[1],-halfExtent[2]), vec3(-halfExtent[0],-halfExtent[1],-halfExtent[2])}; - _tmpVertices.Clear(); + _tmpVertices.clear(); for (int32_t iii=0 ; iii<36 ; iii+=3) { // normal calculation : //btVector3 normal = (vertices[indices[iii+2]]-vertices[indices[iii]]).cross(vertices[indices[iii+1]]-vertices[indices[iii]]); //normal.normalize (); - _tmpVertices.PushBack(vertices[indices[iii]]); - _tmpVertices.PushBack(vertices[indices[iii+1]]); - _tmpVertices.PushBack(vertices[indices[iii+2]]); + _tmpVertices.pushBack(vertices[indices[iii]]); + _tmpVertices.pushBack(vertices[indices[iii+1]]); + _tmpVertices.pushBack(vertices[indices[iii+2]]); } - _draw->Draw(_tmpVertices, tmpColor, _transformationMatrix); + _draw->draw(_tmpVertices, tmpColor, _transformationMatrix); break; } case CONE_SHAPE_PROXYTYPE: { // Cone collision shape ... - EGE_DEBUG(" Draw (03): CONE_SHAPE_PROXYTYPE"); + EGE_DEBUG(" draw (03): CONE_SHAPE_PROXYTYPE"); break; } case CAPSULE_SHAPE_PROXYTYPE: { // Capsule collision shape ... - EGE_DEBUG(" Draw (04): CAPSULE_SHAPE_PROXYTYPE"); + EGE_DEBUG(" draw (04): CAPSULE_SHAPE_PROXYTYPE"); break; } case CYLINDER_SHAPE_PROXYTYPE: { // Cylinder collision shape ... - EGE_DEBUG(" Draw (05): CYLINDER_SHAPE_PROXYTYPE"); + EGE_DEBUG(" draw (05): CYLINDER_SHAPE_PROXYTYPE"); break; } case CONVEX_HULL_SHAPE_PROXYTYPE: { // Convex Hull collision shape ... - EGE_DEBUG(" Draw (06): CONVEX_HULL_SHAPE_PROXYTYPE"); + EGE_DEBUG(" draw (06): CONVEX_HULL_SHAPE_PROXYTYPE"); if (_shape->isConvex()) { EGE_DEBUG(" shape->isConvex()"); const btConvexPolyhedron* poly = _shape->isPolyhedral() ? ((btPolyhedralConvexShape*) _shape)->getConvexPolyhedron() : 0; @@ -386,7 +386,7 @@ static void DrawShape(const btCollisionShape* _shape, glEnd(); */ } else { - // TODO : Set it back ... + // TODO : set it back ... /* ShapeCache* sc=cache((btConvexShape*)_shape); //glutSolidCube(1.0); @@ -430,65 +430,65 @@ static void DrawShape(const btCollisionShape* _shape, } case COMPOUND_SHAPE_PROXYTYPE: { // Multiple sub element collision shape ... - //EGE_DEBUG(" Draw (07): COMPOUND_SHAPE_PROXYTYPE"); + //EGE_DEBUG(" draw (07): COMPOUND_SHAPE_PROXYTYPE"); const btCompoundShape* compoundShape = static_cast(_shape); - for (int32_t iii=compoundShape->getNumChildShapes()-1;iii>=0;iii--) { + for (int32_t iii=compoundShape->getNumChildShapes()-1;iii >= 0;iii--) { btTransform childTrans = compoundShape->getChildTransform(iii); const btCollisionShape* colShape = compoundShape->getChildShape(iii); btScalar mmm[16]; childTrans.getOpenGLMatrix(mmm); mat4 transformationMatrix(mmm); - transformationMatrix.Transpose(); + transformationMatrix.transpose(); transformationMatrix = _transformationMatrix * transformationMatrix; - DrawShape(colShape, _draw, transformationMatrix, _tmpVertices); + drawShape(colShape, _draw, transformationMatrix, _tmpVertices); } break; } case EMPTY_SHAPE_PROXYTYPE: { // No collision shape ... - //EGE_DEBUG(" Draw (08): EMPTY_SHAPE_PROXYTYPE"); + //EGE_DEBUG(" draw (08): EMPTY_SHAPE_PROXYTYPE"); // nothing to display ... break; } default: { // must be done later ... - EGE_DEBUG(" Draw (09): default"); + EGE_DEBUG(" draw (09): default"); } } } -void ege::ElementGame::DrawDebug(ewol::Colored3DObject* _draw, const ege::Camera& _camera) +void ege::ElementGame::drawDebug(ewol::Colored3DObject* _draw, const ege::Camera& _camera) { - m_debugText.Clear(); - m_debugText.SetColor(0x00FF00FF); - m_debugText.SetPos(vec3(-20,32,0)); - m_debugText.Print(GetType()); - m_debugText.SetPos(vec3(-20,20,0)); - m_debugText.Print(etk::UString("life=(")+etk::UString(GetLifeRatio())); - //m_debugText.Print(etk::UString("Axe=(")+etk::UString(m_tmpAxe.x())+etk::UString(",")+etk::UString(m_tmpAxe.y())+etk::UString(",")+etk::UString(m_tmpAxe.z())+etk::UString(")")); + m_debugText.clear(); + m_debugText.setColor(0x00FF00FF); + m_debugText.setPos(vec3(-20,32,0)); + m_debugText.print(getType()); + m_debugText.setPos(vec3(-20,20,0)); + m_debugText.print(etk::UString("life=(")+etk::UString(getLifeRatio())); + //m_debugText.print(etk::UString("Axe=(")+etk::UString(m_tmpAxe.x())+etk::UString(",")+etk::UString(m_tmpAxe.y())+etk::UString(",")+etk::UString(m_tmpAxe.z())+etk::UString(")")); btScalar mmm[16]; btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_body->getMotionState(); myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(mmm); mat4 transformationMatrix(mmm); - transformationMatrix.Transpose(); + transformationMatrix.transpose(); // note : set the vertice here to prevent multiple allocations... etk::Vector EwolVertices; - DrawShape(m_shape, _draw, transformationMatrix, EwolVertices); + drawShape(m_shape, _draw, transformationMatrix, EwolVertices); - m_debugText.Draw( etk::matTranslate(GetPosition()) - * etk::matRotate(vec3(0,0,1),_camera.GetAngleZ()) - * etk::matRotate(vec3(1,0,0),(M_PI/2.0f-_camera.GetAngleTeta())) + m_debugText.draw( etk::matTranslate(getPosition()) + * etk::matRotate(vec3(0,0,1),_camera.getAngleZ()) + * etk::matRotate(vec3(1,0,0),(M_PI/2.0f-_camera.getAngleTeta())) * etk::matScale(vec3(0.05,0.05,0.05))); } -void ege::ElementGame::Draw(int32_t _pass) +void ege::ElementGame::draw(int32_t _pass) { if (false == m_elementInPhysicsSystem) { return; } - if (_pass==0) { + if (_pass == 0) { if( NULL != m_body && NULL != m_mesh && m_body->getMotionState() ) { @@ -497,8 +497,8 @@ void ege::ElementGame::Draw(int32_t _pass) myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(mmm); mat4 transformationMatrix(mmm); - transformationMatrix.Transpose(); - m_mesh->Draw(transformationMatrix); + transformationMatrix.transpose(); + m_mesh->draw(transformationMatrix); } } } @@ -509,10 +509,10 @@ void ege::ElementGame::DynamicEnable(void) return; } if(NULL!=m_body) { - m_env.GetDynamicWorld()->addRigidBody(m_body); + m_env.getDynamicWorld()->addRigidBody(m_body); } if(NULL!=m_IA) { - m_env.GetDynamicWorld()->addAction(m_IA); + m_env.getDynamicWorld()->addAction(m_IA); } m_elementInPhysicsSystem = true; } @@ -523,12 +523,12 @@ void ege::ElementGame::DynamicDisable(void) return; } if(NULL!=m_IA) { - m_env.GetDynamicWorld()->removeAction(m_IA); + m_env.getDynamicWorld()->removeAction(m_IA); } if(NULL!=m_body) { // Unlink element from the engine - m_env.GetDynamicWorld()->removeRigidBody(m_body); - m_env.GetDynamicWorld()->removeCollisionObject(m_body); + m_env.getDynamicWorld()->removeRigidBody(m_body); + m_env.getDynamicWorld()->removeCollisionObject(m_body); } m_elementInPhysicsSystem = false; } @@ -541,11 +541,11 @@ void ege::ElementGame::IAEnable(void) } m_IA = new localIA(*this); if (NULL == m_IA) { - EGE_ERROR("Can not start the IA ==> allocation error"); + EGE_ERROR("Can not start the IA == > allocation error"); return; } if (true == m_elementInPhysicsSystem) { - m_env.GetDynamicWorld()->addAction(m_IA); + m_env.getDynamicWorld()->addAction(m_IA); } } @@ -556,9 +556,9 @@ void ege::ElementGame::IADisable(void) return; } if (true == m_elementInPhysicsSystem) { - m_env.GetDynamicWorld()->removeAction(m_IA); + m_env.getDynamicWorld()->removeAction(m_IA); } - // Remove IA : + // remove IA : delete(m_IA); m_IA = NULL; } diff --git a/ege/ElementGame.h b/ege/ElementGame.h index b5d54d5..abdc35b 100644 --- a/ege/ElementGame.h +++ b/ege/ElementGame.h @@ -36,12 +36,12 @@ namespace ege protected: ege::Environement& m_env; protected: - btRigidBody* m_body; //!< all the element have a body ==> otherwise it will be not manage with this system... + btRigidBody* m_body; //!< all the element have a body == > otherwise it will be not manage with this system... public: /** * @brief Constructor (when constructer is called just add element that did not change. - * The objest will be stored in a pool of element and keep a second time if needed ==> redure memory allocation, - * when needed, the system will call the Init and un-init function... + * The objest will be stored in a pool of element and keep a second time if needed == > redure memory allocation, + * when needed, the system will call the init and un-init function... */ ElementGame(ege::Environement& _env); /** @@ -49,130 +49,130 @@ namespace ege */ virtual ~ElementGame(void); /** - * @brief Get the element Type description string. + * @brief get the element Type description string. * @return A reference on the descriptive string. */ - virtual const etk::UString& GetType(void) const; + virtual const etk::UString& getType(void) const; /** - * @brief Init the element with the defined properties + * @brief init the element with the defined properties * @param[in] _property Type of the next element * @param[in] _value pointer on the value type * @return true, the element is corectly initialized. */ - virtual bool Init(property_te _property, void* _value) { return false; }; + virtual bool init(property_te _property, void* _value) { return false; }; virtual bool UnInit(void) { return true; }; private: uint32_t m_uID; //!< This is a reference on a basic element ID public: /** - * @brief Get the curent Element Unique ID in the all Game. + * @brief get the curent Element Unique ID in the all Game. * @return The requested Unique ID. */ - inline uint32_t GetUID(void) const { return m_uID; }; + inline uint32_t getUID(void) const { return m_uID; }; private: ewol::Mesh* m_mesh; //!< Mesh of the Element (can be NULL) btCollisionShape* m_shape; //!< shape of the element (set a copy here to have the debug display of it) public: /** * @brief Select a mesh with a specific name. - * @param[in] _meshFileName Filename of the Mesh. + * @param[in] _meshFileName filename of the Mesh. * @note Automaticly load the shape if it is specify in the mesh file * @return true if no error occured */ - bool LoadMesh(const etk::UString& _meshFileName); + bool loadMesh(const etk::UString& _meshFileName); /** - * @brief Set the the Mesh properties. + * @brief set the the Mesh properties. * @param[in] _mesh The mesh pointer. (NULL to force the mesh remove ...) * @note : this remove the shape and the mesh properties. * @return true if no error occured */ - bool SetMesh(ewol::Mesh* _mesh); + bool setMesh(ewol::Mesh* _mesh); /** - * @brief Set the shape properties. + * @brief set the shape properties. * @param[in] _shape The shape pointer. * @note : this remove the shape properties. * @return true if no error occured */ - bool SetShape(btCollisionShape* _shape); + bool setShape(btCollisionShape* _shape); /** - * @brief Get a pointer on the Mesh file. + * @brief get a pointer on the Mesh file. * @return the mesh pointer. */ - inline ewol::Mesh* GetMesh(void) { return m_mesh; }; + inline ewol::Mesh* getMesh(void) { return m_mesh; }; /** - * @brief Get a pointer on the bullet collision shape. + * @brief get a pointer on the bullet collision shape. * @return the collision pointer. */ - inline btCollisionShape* GetShape(void) { return m_shape; }; + inline btCollisionShape* getShape(void) { return m_shape; }; private: /** - * @brief Remove the curent selected shape. + * @brief remove the curent selected shape. */ - void RemoveShape(void); + void removeShape(void); protected: float m_life; //!< Current life of the object float m_lifeMax; //!< Maximum possible life of the element public: /** - * @brief Get the curent life ratio [0..1] + * @brief get the curent life ratio [0..1] * @return The proportionnal life */ - float GetLifeRatio(void); + float getLifeRatio(void); /** * @brief Check if the element is dead. * @return true if the element does not exist anymore, false otherwise. */ - bool IsDead(void) { return (0>=m_life)?true:false; }; + bool isDead(void) { return (0 >= m_life)?true:false; }; /** * @brief Request if the element might be removed from the system - * @return true ==> the object is removed + * @return true == > the object is removed */ - virtual bool NeedToRemove(void) + virtual bool needToRemove(void) { - return IsDead(); + return isDead(); } /** - * @brief Apply a fire on the element at a current power and a specific power. + * @brief apply a fire on the element at a current power and a specific power. * @param[in] groupIdSource Source Id of the group, by default all event arrive at all group, buf some event can not be obviously apply at the ennemy like reparing .... * @param[in] type Type of event on the life propertied * @param[in] power Power of the event (can be >0 for adding life). * @param[in] center Some fire decrease in function of space distance... */ - virtual void SetFireOn(int32_t groupIdSource, int32_t type, float power, const vec3& center=vec3(0,0,0)); + virtual void setFireOn(int32_t groupIdSource, int32_t type, float power, const vec3& center=vec3(0,0,0)); /** * @brief Call chan the element life change */ - virtual void OnLifeChange(void) {} + virtual void onLifeChange(void) {} protected: int32_t m_group; //!< Every element has a generic group public: /** - * @brief Get the Group of the element. + * @brief get the Group of the element. * @return The group ID */ - inline int32_t GetGroup(void) const { return m_group; }; + inline int32_t getGroup(void) const { return m_group; }; /** - * @brief Set the group of the curent element + * @brief set the group of the curent element * @param[in] newGroup The new Group ID of the element. */ - inline void SetGroup(int32_t _newGroup) { m_group=_newGroup; }; + inline void setGroup(int32_t _newGroup) { m_group=_newGroup; }; /** * @brief Can be call tu opdate the list of the element displayed on the scren (example : no display of the hiden triangle) * @param[in] the camera properties * @ note by default nothing to do ... */ - virtual void PreCalculationDraw(const ege::Camera& _camera) { }; + virtual void preCalculationDraw(const ege::Camera& _camera) { }; /** - * @brief Draw the curent element (can have multiple display) + * @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 + * @brief draw the current life of the element */ - virtual void DrawLife(ewol::Colored3DObject* _draw, const ege::Camera& _camera); + virtual void drawLife(ewol::Colored3DObject* _draw, const ege::Camera& _camera); protected: // For debug only ... @@ -182,59 +182,59 @@ namespace ege * @brief Debug display of the current element * @param[in,out] draw Basic system to draw the debug shape and informations */ - virtual void DrawDebug(ewol::Colored3DObject* _draw, const ege::Camera& _camera); + virtual void drawDebug(ewol::Colored3DObject* _draw, const ege::Camera& _camera); /** - * @brief Get the theoric position. Sometimes, the element has move due to an explosion or something else, then its real position in not the one that woult it be at the end ... + * @brief get the theoric position. Sometimes, the element has move due to an explosion or something else, then its real position in not the one that woult it be at the end ... * @return the theoric position */ - virtual vec3 GetPositionTheoric(void) { return GetPosition(); }; + virtual vec3 getPositionTheoric(void) { return getPosition(); }; /** - * @brief Set the current Theoric position of the element - * @param[in] Set the 3D position. + * @brief set the current Theoric position of the element + * @param[in] set the 3D position. */ - virtual void SetPositionTheoric(const vec3& _pos) { } + virtual void setPositionTheoric(const vec3& _pos) { } /** - * @brief Get the current position of the element + * @brief get the current position of the element * @return the 3D position. */ - const vec3& GetPosition(void); + const vec3& getPosition(void); /** - * @brief Set the current position of the element - * @param[in] _pos Set the 3D position. + * @brief set the current position of the element + * @param[in] _pos set the 3D position. */ - void SetPosition(const vec3& _pos); + void setPosition(const vec3& _pos); /** - * @brief Get the current speed of the element + * @brief get the current speed of the element * @return the 3D speed. */ - const vec3& GetSpeed(void); + const vec3& getSpeed(void); /** - * @brief Get the current mass of the element + * @brief get the current mass of the element * @return the mass in kG. */ - const float GetInvMass(void); + const float getInvMass(void); /** - * @brief Event arrive when an element has been remove from the system ==> this permit to keep pointer of ennemy, and not search them every cycle ... + * @brief Event arrive when an element has been remove from the system == > this permit to keep pointer of ennemy, and not search them every cycle ... * @param[in] _removedElement Pointer on the element removed. */ - virtual void ElementIsRemoved(ege::ElementGame* _removedElement) { }; + virtual void elementIsRemoved(ege::ElementGame* _removedElement) { }; protected: - bool m_fixe; //!< Is a fixed element ==> used for placement of every elements + bool m_fixe; //!< is a fixed element == > used for placement of every elements public: /** - * @brief Get the element if it is fixed or not. if the element is fixed this is for tower, and all thing does not really move + * @brief get the element if it is fixed or not. if the element is fixed this is for tower, and all thing does not really move * @return true : The element is fixed. */ - inline bool IsFixed(void) { return m_fixe; }; + inline bool isFixed(void) { return m_fixe; }; protected: - float m_radius; //!< Radius of the element (all element have a radius, if ==0 ==> then ghost ... + float m_radius; //!< Radius of the element (all element have a radius, if == 0 ==> then ghost ... public: /** - * @brief Get the current space needed by the element in the workspace + * @brief get the current space needed by the element in the workspace * @return The dimention needed. */ - inline float GetRadius(void) + inline float getRadius(void) { return m_radius; }; @@ -242,11 +242,11 @@ namespace ege bool m_elementInPhysicsSystem; public: /** - * @brief Set the elment in the physique engine + * @brief set the elment in the physique engine */ void DynamicEnable(void); /** - * @brief Remove this element from the physique engine + * @brief remove this element from the physique engine */ void DynamicDisable(void); private: @@ -275,22 +275,22 @@ namespace ege localIA* m_IA; public: /** - * @brief Enable periodic call Of this object for processing Artificial Intelligence + * @brief enable periodic call Of this object for processing Artificial Intelligence */ void IAEnable(void); /** - * @brief Disable periodic call Of this object for processing Artificial Intelligence + * @brief disable periodic call Of this object for processing Artificial Intelligence */ void IADisable(void); /** - * @brief Periodic call for intelligence artificial. + * @brief periodic call for intelligence artificial. * @param[in] step : step of time in s */ virtual void IAAction(float _step) { }; /** * @brief, call when the element is removed (call only one time */ - virtual void OnDestroy(void) {}; + virtual void onDestroy(void) {}; }; }; diff --git a/ege/Environement.cpp b/ege/Environement.cpp index 98a91dd..d89be27 100644 --- a/ege/Environement.cpp +++ b/ege/Environement.cpp @@ -15,27 +15,27 @@ #define __class__ "Environement" -ege::ElementGame* ege::Environement::GetElementNearest(ege::ElementGame* _sourceRequest, float& _distance) +ege::ElementGame* ege::Environement::getElementNearest(ege::ElementGame* _sourceRequest, float& _distance) { - if (NULL==_sourceRequest) { + if (NULL == _sourceRequest) { return NULL; } - vec3 sourcePosition = _sourceRequest->GetPosition(); + vec3 sourcePosition = _sourceRequest->getPosition(); ege::ElementGame* result = NULL; - for (int32_t iii=0; iiiGetGroup()<=0) { + if (m_listElementGame[iii]->getGroup() <= 0) { continue; } // check if they are in the same group: - if (m_listElementGame[iii]->GetGroup() == _sourceRequest->GetGroup()) { + if (m_listElementGame[iii]->getGroup() == _sourceRequest->getGroup()) { continue; } // check distance ... - vec3 destPosition = m_listElementGame[iii]->GetPosition(); + vec3 destPosition = m_listElementGame[iii]->getPosition(); float distance = btDistance(sourcePosition, destPosition); //EGE_DEBUG("Distance : " << _distance << " >? " << distance << " id=" << iii); if (_distance>distance) { @@ -47,102 +47,102 @@ ege::ElementGame* ege::Environement::GetElementNearest(ege::ElementGame* _source } -void ege::Environement::GetElementNearest(const vec3& _sourcePosition, +void ege::Environement::getElementNearest(const vec3& _sourcePosition, float _distanceMax, etk::Vector& _resultList) { - _resultList.Clear(); + _resultList.clear(); ege::Environement::ResultNearestElement result; result.dist = 99999999999.0f; result.element = NULL; - for (int32_t iii=0; iiiGetPosition(); + vec3 destPosition = result.element->getPosition(); if (_sourcePosition == destPosition) { continue; } result.dist = btDistance(_sourcePosition, destPosition); //EGE_DEBUG("Distance : " << _distance << " >? " << distance << " id=" << iii); if (_distanceMax>result.dist) { - _resultList.PushBack(result); + _resultList.pushBack(result); } } } -void ege::Environement::GetElementNearestFixed(const vec3& _sourcePosition, +void ege::Environement::getElementNearestFixed(const vec3& _sourcePosition, float _distanceMax, etk::Vector& _resultList) { - _resultList.Clear(); + _resultList.clear(); ege::Environement::ResultNearestElement result; result.dist = 99999999999.0f; result.element = NULL; - for (int32_t iii=0; iiiIsFixed()) { + if (false == result.element->isFixed()) { continue; } // check distance ... - vec3 destPosition = result.element->GetPositionTheoric(); + vec3 destPosition = result.element->getPositionTheoric(); result.dist = btDistance(_sourcePosition, destPosition); //EGE_DEBUG("Distance : " << _distance << " >? " << distance << " id=" << iii); - if (_distanceMax<=result.dist) { + if (_distanceMax <= result.dist) { continue; } // try to add the element at the best positions: int32_t jjj; - for (jjj=0; jjj<_resultList.Size(); jjj++) { + for (jjj=0; jjj<_resultList.size(); jjj++) { if (_resultList[jjj].dist>result.dist) { - _resultList.Insert(jjj, result); + _resultList.insert(jjj, result); break; } } // add element at the end : - if (jjj>=_resultList.Size()) { - _resultList.PushBack(result); + if (jjj >= _resultList.size()) { + _resultList.pushBack(result); } } } -static etk::Hash& GetHachTableCreating(void) +static etk::Hash& getHachTableCreating(void) { static etk::Hash s_table; return s_table; } -void ege::Environement::AddCreator(const etk::UString& _type, ege::createElement_tf _creator) +void ege::Environement::addCreator(const etk::UString& _type, ege::createElement_tf _creator) { if (NULL == _creator) { EGE_ERROR("Try to add an empty CREATOR ..."); return; } - if (GetHachTableCreating().Exist(_type)==true) { - GetHachTableCreating()[_type] = _creator; + if (getHachTableCreating().exist(_type) == true) { + getHachTableCreating()[_type] = _creator; return; } - GetHachTableCreating().Add(_type, _creator); + getHachTableCreating().add(_type, _creator); } ege::ElementGame* ege::Environement::CreateElement(const etk::UString& _type, bool _autoAddElement, ege::property_te _property, void* _value) { - if (false==GetHachTableCreating().Exist(_type)) { + if (false == getHachTableCreating().exist(_type)) { EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); return NULL; } - ege::createElement_tf creatorPointer = GetHachTableCreating()[_type]; + ege::createElement_tf creatorPointer = getHachTableCreating()[_type]; if (NULL == creatorPointer) { - EGE_ERROR("NULL pointer creator ==> internal error... '" << _type << "'"); + EGE_ERROR("NULL pointer creator == > internal error... '" << _type << "'"); return NULL; } ege::ElementGame* tmpElement = creatorPointer(*this); @@ -150,14 +150,14 @@ ege::ElementGame* ege::Environement::CreateElement(const etk::UString& _type, bo EGE_ERROR("allocation error '" << _type << "'"); return NULL; } - if (false==tmpElement->Init(_property, _value)) { + if (false == tmpElement->init(_property, _value)) { EGE_ERROR("Init error ... '" << _type << "'"); // remove created element ... delete(tmpElement); return NULL; } - if (_autoAddElement==true) { - AddElementGame(tmpElement); + if (_autoAddElement == true) { + addElementGame(tmpElement); } return tmpElement; } @@ -178,20 +178,20 @@ ege::ElementGame* ege::Environement::CreateElement(const etk::UString& _type, ex } -void ege::Environement::AddElementGame(ege::ElementGame* _newElement) +void ege::Environement::addElementGame(ege::ElementGame* _newElement) { // prevent memory allocation and un allocation ... if (NULL == _newElement) { return; } - for (int32_t iii=0; iiiDynamicEnable(); return; } } - m_listElementGame.PushBack(_newElement); + m_listElementGame.pushBack(_newElement); _newElement->DynamicEnable(); } @@ -200,16 +200,16 @@ void ege::Environement::RmElementGame(ege::ElementGame* _removeElement) if (NULL == _removeElement) { return; } - // inform the element that an element has been removed ==> this permit to keep pointer on elements ... - for (int32_t iii=0; iii this permit to keep pointer on elements ... + for (int32_t iii=0; iiiElementIsRemoved(_removeElement); + m_listElementGame[iii]->elementIsRemoved(_removeElement); } } // ream remove on the element : - for (int32_t iii=0; iiiOnDestroy(); + m_listElementGame[iii]->onDestroy(); m_listElementGame[iii]->DynamicDisable(); m_listElementGame[iii]->UnInit(); delete(m_listElementGame[iii]); @@ -219,70 +219,70 @@ void ege::Environement::RmElementGame(ege::ElementGame* _removeElement) } -void ege::Environement::GetOrderedElementForDisplay(etk::Vector& _resultList, +void ege::Environement::getOrderedElementForDisplay(etk::Vector& _resultList, const vec3& _position, const vec3& _direction) { // remove all unneeded elements (old display...) - _resultList.Clear(); + _resultList.clear(); // basic element result ege::Environement::ResultNearestElement result; result.dist = 99999999999.0f; result.element = NULL; // for all element in the game we chek if it is needed to display it ... - for (int32_t iii=0; iiiGetPosition(); + vec3 destPosition = result.element->getPosition(); vec3 angleView = (destPosition - _position).normalized(); float dotResult=angleView.dot(_direction); - //EGE_DEBUG("Dot position : " << destPosition << " ==> dot=" << dotResult); - if (dotResult<=0.85f) { - // they are not in the camera angle view ... ==> no need to process display + //EGE_DEBUG("Dot position : " << destPosition << " == > dot=" << dotResult); + if (dotResult <= 0.85f) { + // they are not in the camera angle view ... == > no need to process display continue; } result.dist = btDistance(_position, destPosition); if (result.dist>500.0f) { - // The element is realy too far ... ==> no need to display + // The element is realy too far ... == > no need to display continue; } // try to add the element at the best positions: int32_t jjj; - for (jjj=0; jjj<_resultList.Size(); jjj++) { + for (jjj=0; jjj<_resultList.size(); jjj++) { if (_resultList[jjj].dist>result.dist) { - _resultList.Insert(jjj, result); + _resultList.insert(jjj, result); break; } } // add element at the end : - if (jjj>=_resultList.Size()) { - _resultList.PushBack(result); + if (jjj >= _resultList.size()) { + _resultList.pushBack(result); } } } -void ege::Environement::GenerateInteraction(ege::ElementInteraction& _event) +void ege::Environement::generateInteraction(ege::ElementInteraction& _event) { - // inform the element that an element has been removed ==> this permit to keep pointer on elements ... - for (int32_t iii=0; iii this permit to keep pointer on elements ... + for (int32_t iii=0; iiiGetPosition(); + vec3 destPosition = m_listElementGame[iii]->getPosition(); float dist = btDistance(sourcePosition, destPosition); - if (dist==0 || dist>decreasePower) { + if (dist == 0 || dist>decreasePower) { continue; } float inpact = (decreasePower-dist)/decreasePower * power; - g_listElementGame[iii]->SetFireOn(groupIdSource, type, -inpact, sourcePosition); + g_listElementGame[iii]->setFireOn(groupIdSource, type, -inpact, sourcePosition); */ } } diff --git a/ege/Environement.h b/ege/Environement.h index f389060..2c0940b 100644 --- a/ege/Environement.h +++ b/ege/Environement.h @@ -43,20 +43,20 @@ namespace ege { protected: int32_t m_type; public: - int32_t GetType(void) { return m_type; }; + int32_t getType(void) { return m_type; }; protected: int32_t m_groupSource; public: - int32_t GetSourceGroup(void) { return m_groupSource; }; + int32_t getSourceGroup(void) { return m_groupSource; }; protected: etk::Vector m_groupDestination; public: - const etk::Vector& GetDestinationGroup(void) { return m_groupDestination; }; - void AddGroupDestination(int32_t _id) { m_groupDestination.PushBack(_id); }; + const etk::Vector& getDestinationGroup(void) { return m_groupDestination; }; + void addGroupDestination(int32_t _id) { m_groupDestination.pushBack(_id); }; protected: vec3 m_positionSource; public: - const vec3& GetSourcePosition(void) { return m_positionSource; }; + const vec3& getSourcePosition(void) { return m_positionSource; }; public: ElementInteraction(int32_t _type, int32_t _groupSource, const vec3& _pos) : m_type(_type), @@ -64,7 +64,7 @@ namespace ege { m_positionSource(_pos) { }; public: - virtual void ApplyEvent(ege::ElementGame& _element) { }; + virtual void applyEvent(ege::ElementGame& _element) { }; }; class Environement @@ -77,16 +77,16 @@ namespace ege { virtual ~Environement(void) { }; public: /** - * @brief Add a creator element system + * @brief add a creator element system * @param[in] _type Type of the element. * @param[in] _creator Function pointer that reference the element creating. */ - static void AddCreator(const etk::UString& _type, ege::createElement_tf _creator); + static void addCreator(const etk::UString& _type, ege::createElement_tf _creator); /** * @brief Create an element on the curent scene. * @param[in] _type Type of the element that might be created. * @param[in] _description String that describe the content of the element properties. - * @param[in] _autoAddElement this permit to add the element if it is created ==> no more action ... + * @param[in] _autoAddElement this permit to add the element if it is created == > no more action ... * @return NULL if an error occured OR the pointer on the element and it is already added on the system. * @note Pointer is return in case of setting properties on it... */ @@ -102,60 +102,60 @@ namespace ege { float dist; }; /** - * @brief Set the curent world + * @brief set the curent world * @param[in] _newWorld Pointer on the current world */ - void SetDynamicWorld(btDynamicsWorld* _newWorld) { m_dynamicsWorld=_newWorld; }; + void setDynamicWorld(btDynamicsWorld* _newWorld) { m_dynamicsWorld=_newWorld; }; /** - * @brief Get the curent world + * @brief get the curent world * @return pointer on the current world */ - btDynamicsWorld* GetDynamicWorld(void) { return m_dynamicsWorld; }; + btDynamicsWorld* getDynamicWorld(void) { return m_dynamicsWorld; }; /** - * @breif Get a reference on the curent list of element games + * @breif get a reference on the curent list of element games * @return all element list */ - etk::Vector& GetElementGame(void) { return m_listElementGame; }; + etk::Vector& getElementGame(void) { return m_listElementGame; }; /** - * @brief Get the nearest Element + * @brief get the nearest Element * @param[in] _sourceRequest Pointer on the element that request this. - * @param[in] _distance Maximum distance search ==> return the element distance + * @param[in] _distance Maximum distance search == > return the element distance * @return Pointer on the neares element OR NULL */ - ege::ElementGame* GetElementNearest(ege::ElementGame* _sourceRequest, float& _distance); + ege::ElementGame* getElementNearest(ege::ElementGame* _sourceRequest, float& _distance); - void GetElementNearest(const vec3& _sourcePosition, float _distanceMax, etk::Vector& _resultList); - void GetElementNearestFixed(const vec3& _sourcePosition, float _distanceMax, etk::Vector& _resultList); + void getElementNearest(const vec3& _sourcePosition, float _distanceMax, etk::Vector& _resultList); + void getElementNearestFixed(const vec3& _sourcePosition, float _distanceMax, etk::Vector& _resultList); /** - * @brief Add an element on the list availlable. + * @brief add an element on the list availlable. * @param[in] _newElement Element to add. */ - void AddElementGame(ege::ElementGame* _newElement); + void addElementGame(ege::ElementGame* _newElement); /** - * @brief Remove an element on the list availlable. + * @brief remove an element on the list availlable. * @param[in] _removeElement Element to remove. */ void RmElementGame(ege::ElementGame* _removeElement); /** - * @brief Get the element order from the nearest to the farest, and remove all element that are not in the camera angle and axes. + * @brief get the element order from the nearest to the farest, and remove all element that are not in the camera angle and axes. * @param[in,out] _resultList List of the element ordered. * @param[in] _position Camera position in the space. * @param[in] _direction Camera direction of the view. */ - void GetOrderedElementForDisplay(etk::Vector& _resultList, const vec3& _position, const vec3& _direction); + void getOrderedElementForDisplay(etk::Vector& _resultList, const vec3& _position, const vec3& _direction); /** - * @brief Generate an event on all the sub element of the game ==> usefull for explosion, or lazer fire ... + * @brief generate an event on all the sub element of the game == > usefull for explosion, or lazer fire ... * @param[in] _event event that might be apply ... */ - void GenerateInteraction(ege::ElementInteraction& _event); + void generateInteraction(ege::ElementInteraction& _event); private: ege::ParticuleEngine m_particuleEngine; //!< Particule engine properties public: /** - * @brief Get the particule engine reference. + * @brief get the particule engine reference. * @return The requested reference on the engine */ - ege::ParticuleEngine& GetParticuleEngine(void) { return m_particuleEngine; }; + ege::ParticuleEngine& getParticuleEngine(void) { return m_particuleEngine; }; }; }; diff --git a/ege/Particule.cpp b/ege/Particule.cpp index 88ec130..8cb9350 100644 --- a/ege/Particule.cpp +++ b/ege/Particule.cpp @@ -16,6 +16,6 @@ ege::Particule::Particule(ege::ParticuleEngine& _particuleEngine, const char* _p m_particuleEngine(_particuleEngine), m_particuleType(_particuleType) { - m_particuleEngine.Add(this); + m_particuleEngine.add(this); } diff --git a/ege/Particule.h b/ege/Particule.h index bab567f..8c15598 100644 --- a/ege/Particule.h +++ b/ege/Particule.h @@ -33,7 +33,7 @@ namespace ege { /** * @brief Constructor. * @param[in] _particuleEngine reference on the particule engine ... - * @param[in] _particuleType Type of the particule (Set NULL if you did not want to use the respowner ...) + * @param[in] _particuleType Type of the particule (set NULL if you did not want to use the respowner ...) */ Particule(ege::ParticuleEngine& _particuleEngine, const char* _particuleType = NULL); /** @@ -41,37 +41,37 @@ namespace ege { */ virtual ~Particule(void) { }; /** - * @brief Init the particule + * @brief init the particule */ - virtual void Init(void) { }; + virtual void init(void) { }; /** * @brief Un-init the particule */ virtual void UnInit(void) { }; /** - * @brief Update the paticule properties + * @brief update the paticule properties * @param[in] _delta Delta time from the previous call */ - virtual void Update(float _delta) { }; + virtual void update(float _delta) { }; /** - * @brief Draw the current particule + * @brief draw the current particule */ - virtual void Draw(const ege::Camera& _camera) { }; + virtual void draw(const ege::Camera& _camera) { }; /** * @brief Check if the element might be removed * @return true : The element might be removed * @return false : The element might be keeped */ - virtual bool NeedRemove(void) { return false; }; + virtual bool needRemove(void) { return false; }; /** - * @brief Get the type of the particule + * @brief get the type of the particule * @return Type of the current particule */ - const char* GetParticuleType(void) { return m_particuleType; }; + const char* getParticuleType(void) { return m_particuleType; }; /** * @brief When the particule arrive to his end of life, this function is called. */ - virtual void OnEnd(void) {}; + virtual void onEnd(void) {}; }; }; diff --git a/ege/ParticuleEngine.cpp b/ege/ParticuleEngine.cpp index c7f0c22..9904f0f 100644 --- a/ege/ParticuleEngine.cpp +++ b/ege/ParticuleEngine.cpp @@ -20,16 +20,16 @@ ege::ParticuleEngine::ParticuleEngine(ege::Environement& _env) : ege::ParticuleEngine::~ParticuleEngine(void) { - Clear(); + clear(); } -void ege::ParticuleEngine::Add(Particule* _particule) +void ege::ParticuleEngine::add(Particule* _particule) { - if (_particule==NULL) { + if (_particule == NULL) { EGE_ERROR("Try to add particule NULL"); return; } - for (esize_t iii=0; iiiGetParticuleType()==_particuleType) { - Add(m_particuleRemoved[iii]); + if (m_particuleRemoved[iii]->getParticuleType() == _particuleType) { + add(m_particuleRemoved[iii]); ege::Particule* tmpParticule = m_particuleRemoved[iii]; m_particuleRemoved[iii]=NULL; - tmpParticule->Init(); + tmpParticule->init(); return tmpParticule; } } return NULL; } -void ege::ParticuleEngine::Update(float _deltaTime) +void ege::ParticuleEngine::update(float _deltaTime) { if (_deltaTime>(1.0f/60.0f)) { _deltaTime = (1.0f/60.0f); } - for (esize_t iii=0; iiiUpdate(_deltaTime); + m_particuleList[iii]->update(_deltaTime); } // check removing elements - for (esize_t iii=0; iiiNeedRemove()) { - m_particuleList[iii]->OnEnd(); - if (m_particuleList[iii]->GetParticuleType()==NULL) { + if (m_particuleList[iii]->needRemove()) { + m_particuleList[iii]->onEnd(); + if (m_particuleList[iii]->getParticuleType() == NULL) { // Real remove particule ... delete (m_particuleList[iii]); } else { - AddRemoved(m_particuleList[iii]); + addRemoved(m_particuleList[iii]); } m_particuleList[iii] = NULL; } } /* int32_t nbParticule = 0; - for (esize_t iii=0; iiiDraw(_camera); + m_particuleList[iii]->draw(_camera); } } -void ege::ParticuleEngine::Clear(void) +void ege::ParticuleEngine::clear(void) { // clear element not removed - for (esize_t iii=0; iii m_particuleList; //!< all particule created and active etk::Vector m_particuleRemoved; //!< removed particule public: /** - * @brief Clear the particule engine + * @brief clear the particule engine */ - void Clear(void); + void clear(void); /** - * @brief Add a particule in the engine (internal acces only) + * @brief add a particule in the engine (internal acces only) * @param[in] _particule Pointer on the particule to add */ - void Add(Particule* _particule); + void add(Particule* _particule); private: /** - * @brief Add a particule in the removed section ==> this not delete the particule, but just set it in an other list + * @brief add a particule in the removed section == > this not delete the particule, but just set it in an other list * @param[in] _particule Pointer on the particule to add */ - void AddRemoved(Particule* _particule); + void addRemoved(Particule* _particule); public: /** - * @brief Update particule properties + * @brief update particule properties * @param[in] _deltaTime delta time to process */ - void Update(float _deltaTime); + void update(float _deltaTime); /** - * @brief Draw all the active Particule + * @brief draw all the active Particule * @param[in] _camera Reference on the current camera */ - void Draw(const ege::Camera& _camera); + void draw(const ege::Camera& _camera); /** - * @brief Get a particue with his type, we get particule that has been already removed, otherwise, you will create new + * @brief get a particue with his type, we get particule that has been already removed, otherwise, you will create new * @param[in] _particuleType Particule type, this chek only the pointer not the data. * @return NULL, the particule has not been removed from the created pool - * @return The pointer on the requested element (an Init has been done). + * @return The pointer on the requested element (an init has been done). * @note If you did not want to use respawn set type at NULL. */ - Particule* Respown(const char* _particuleType); + Particule* respown(const char* _particuleType); }; }; diff --git a/ege/ParticuleSimple.cpp b/ege/ParticuleSimple.cpp index 3b2a114..d03e693 100644 --- a/ege/ParticuleSimple.cpp +++ b/ege/ParticuleSimple.cpp @@ -16,11 +16,11 @@ ege::ParticuleSimple::ParticuleSimple(ege::ParticuleEngine& _particuleEngine, const char* _particuleType) : Particule(_particuleEngine, _particuleType) { - Init(); + init(); } -void ege::ParticuleSimple::Init(void) +void ege::ParticuleSimple::init(void) { m_lifeFull = 3; m_life = m_lifeFull; @@ -32,13 +32,13 @@ void ege::ParticuleSimple::Init(void) m_scaleExpand = vec3(0,0,0); } -bool ege::ParticuleSimple::NeedRemove(void) +bool ege::ParticuleSimple::needRemove(void) { return m_life<0.0f; } -void ege::ParticuleSimple::Update(float _delta) +void ege::ParticuleSimple::update(float _delta) { //EGE_DEBUG("Life : " << m_life << "-" << _delta); m_life -= _delta; @@ -46,38 +46,38 @@ void ege::ParticuleSimple::Update(float _delta) m_scale += m_scaleExpand*_delta; } -void ege::ParticuleSimple::SetLife(float _life) +void ege::ParticuleSimple::setLife(float _life) { m_lifeFull = _life; m_life = m_lifeFull; } -void ege::ParticuleSimple::SetLevel(float _level) +void ege::ParticuleSimple::setLevel(float _level) { m_level = _level; } -void ege::ParticuleSimple::SetPosition(const vec3& _pos) +void ege::ParticuleSimple::setPosition(const vec3& _pos) { m_pos = _pos; } -void ege::ParticuleSimple::SetAngle(float _angle) +void ege::ParticuleSimple::setAngle(float _angle) { m_angle = _angle; } -void ege::ParticuleSimple::SetMoveSpeed(const vec3& _speed) +void ege::ParticuleSimple::setMoveSpeed(const vec3& _speed) { m_speed = _speed; } -void ege::ParticuleSimple::SetScale(const vec3& _scale) +void ege::ParticuleSimple::setScale(const vec3& _scale) { m_scale = _scale; } -void ege::ParticuleSimple::SetScaleExpend(const vec3& _scaleExpand) +void ege::ParticuleSimple::setScaleExpend(const vec3& _scaleExpand) { m_scaleExpand=_scaleExpand; } diff --git a/ege/ParticuleSimple.h b/ege/ParticuleSimple.h index 3213043..c43ae51 100644 --- a/ege/ParticuleSimple.h +++ b/ege/ParticuleSimple.h @@ -41,10 +41,10 @@ namespace ege { */ virtual ~ParticuleSimple(void) { }; public: // herited elements: - virtual void Update(float _delta); - //virtual void Draw(void) { }; - virtual bool NeedRemove(void); - virtual void Init(void); + virtual void update(float _delta); + //virtual void draw(void) { }; + virtual bool needRemove(void); + virtual void init(void); protected: float m_lifeFull; float m_life; @@ -58,13 +58,13 @@ namespace ege { /** * */ - virtual void SetLife(float _life); - virtual void SetLevel(float _level); - virtual void SetPosition(const vec3& _pos); - virtual void SetAngle(float _angle); - virtual void SetMoveSpeed(const vec3& _speed); - virtual void SetScale(const vec3& _scale); - virtual void SetScaleExpend(const vec3& _scaleExpand); + virtual void setLife(float _life); + virtual void setLevel(float _level); + virtual void setPosition(const vec3& _pos); + virtual void setAngle(float _angle); + virtual void setMoveSpeed(const vec3& _speed); + virtual void setScale(const vec3& _scale); + virtual void setScaleExpend(const vec3& _scaleExpand); }; }; diff --git a/ege/Scene.cpp b/ege/Scene.cpp index 146b755..55e097a 100644 --- a/ege/Scene.cpp +++ b/ege/Scene.cpp @@ -45,24 +45,24 @@ ege::Scene::Scene(bool _setAutoBullet, bool _setAutoCamera) : m_debugMode(false), m_debugDrawing(NULL) { - SetKeyboardRepeate(false); - SetCanHaveFocus(true); - PeriodicCallEnable(); - AddEventId(eventPlayTimeChange); - AddEventId(eventKillEnemy); + setKeyboardRepeate(false); + setCanHaveFocus(true); + periodicCallEnable(); + addEventId(eventPlayTimeChange); + addEventId(eventKillEnemy); - m_debugDrawing = ewol::Colored3DObject::Keep(); + m_debugDrawing = ewol::Colored3DObject::keep(); m_ratioTime = 1.0f; - if (_setAutoBullet==true) { - SetBulletConfig(); + if (_setAutoBullet == true) { + setBulletConfig(); } - if (_setAutoCamera==true) { - SetCamera(); + if (_setAutoCamera == true) { + setCamera(); } } -void ege::Scene::SetBulletConfig(btDefaultCollisionConfiguration* _collisionConfiguration, +void ege::Scene::setBulletConfig(btDefaultCollisionConfiguration* _collisionConfiguration, btCollisionDispatcher* _dispatcher, btBroadphaseInterface* _broadphase, btConstraintSolver* _solver, @@ -100,29 +100,29 @@ void ege::Scene::SetBulletConfig(btDefaultCollisionConfiguration* _collisionConf m_dynamicsWorld->setGravity(btVector3(0,0,0)); } - m_env.SetDynamicWorld(m_dynamicsWorld); + m_env.setDynamicWorld(m_dynamicsWorld); } -void ege::Scene::SetCamera(ege::Camera* _camera) +void ege::Scene::setCamera(ege::Camera* _camera) { if (NULL != _camera) { m_camera = _camera; } else { m_camera = new ege::Camera(vec3(0,0,0), 0, DEG_TO_RAD(45) ,50); // SET THE STATION .. - m_camera->SetEye(vec3(0,0,0)); + m_camera->setEye(vec3(0,0,0)); } } ege::Scene::~Scene(void) { - ewol::Colored3DObject::Release(m_debugDrawing); + ewol::Colored3DObject::release(m_debugDrawing); /* - ewol::resource::Release(m_directDrawObject); + ewol::resource::release(m_directDrawObject); //cleanup in the reverse order of creation/initialization //remove the rigidbodies from the dynamics world and delete them - for (int32_t iii=m_dynamicsWorld->getNumCollisionObjects()-1; iii>=0 ;iii--) { + for (int32_t iii=m_dynamicsWorld->getNumCollisionObjects()-1; iii >= 0 ;iii--) { btCollisionObject* obj = m_dynamicsWorld->getCollisionObjectArray()[iii]; btRigidBody* body = btRigidBody::upcast(obj); if (body && body->getMotionState()) { @@ -141,35 +141,35 @@ ege::Scene::~Scene(void) } -void ege::Scene::OnRegenerateDisplay(void) +void ege::Scene::onRegenerateDisplay(void) { - if (true == NeedRedraw()) { + if (true == needRedraw()) { } } -void ege::Scene::Pause(void) +void ege::Scene::pause(void) { - EGE_DEBUG("Set Pause"); + EGE_DEBUG("Set pause"); m_isRunning = false; } -void ege::Scene::Resume(void) +void ege::Scene::resume(void) { - EGE_DEBUG("Set Resume"); + EGE_DEBUG("Set resume"); m_isRunning = true; } -void ege::Scene::PauseToggle(void) +void ege::Scene::pauseToggle(void) { - if(true==m_isRunning) { - EGE_DEBUG("Set Toggle: Pause"); + if(true == m_isRunning) { + EGE_DEBUG("Set Toggle: pause"); m_isRunning=false; } else { - EGE_DEBUG("Set Toggle: Resume"); + EGE_DEBUG("Set Toggle: resume"); m_isRunning=true; } } @@ -185,54 +185,54 @@ void ege::Scene::PauseToggle(void) #define NUMBER_OF_SUB_PASS (0) -void ege::Scene::OnDraw(void) +void ege::Scene::onDraw(void) { #ifdef SCENE_DISPLAY_SPEED g_counterNbTimeDisplay++; - g_startTime = ewol::GetTime(); + g_startTime = ewol::getTime(); #endif //EGE_DEBUG("Draw (start)"); mat4 tmpMatrix; if (m_dynamicsWorld) { - m_env.GetOrderedElementForDisplay(m_displayElementOrdered, m_camera->GetOrigin(), m_camera->GetViewVector()); - //EGE_DEBUG("DRAW : " << m_displayElementOrdered.Size() << " elements"); + m_env.getOrderedElementForDisplay(m_displayElementOrdered, m_camera->getOrigin(), m_camera->getViewVector()); + //EGE_DEBUG("DRAW : " << m_displayElementOrdered.size() << " elements"); - // TODO : Remove this ==> no more needed ==> checked in the Generate the list of the element ordered - for (int32_t iii=0; iiiPreCalculationDraw(*m_camera); + // TODO : remove this == > no more needed ==> checked in the generate the list of the element ordered + for (int32_t iii=0; iiipreCalculationDraw(*m_camera); } // note : the first pass is done at the reverse way to prevent multiple display od the same point in the screen // (and we remember that the first pass is to display all the non transparent elements) #if 0 // note : We keep this one for the test only ... - for (int32_t iii=0; iii=0; iii--) { + for (int32_t iii=m_displayElementOrdered.size()-1; iii >= 0; iii--) { #endif - m_displayElementOrdered[iii].element->Draw(0); + m_displayElementOrdered[iii].element->draw(0); } // for the other pass the user can draw transparent elements ... - for (int32_t pass=1; pass<=NUMBER_OF_SUB_PASS+1; pass++) { - for (int32_t iii=0; iiiDraw(pass); + for (int32_t pass=1; pass <= NUMBER_OF_SUB_PASS+1; pass++) { + for (int32_t iii=0; iiidraw(pass); } } - for (int32_t iii=0; iiiDrawLife(m_debugDrawing, *m_camera); + for (int32_t iii=0; iiidrawLife(m_debugDrawing, *m_camera); } #ifdef DEBUG if (true == m_debugMode) { - for (int32_t iii=0; iiiDrawDebug(m_debugDrawing, *m_camera); + for (int32_t iii=0; iiidrawDebug(m_debugDrawing, *m_camera); } } #endif } if (NULL!=m_camera) { - m_env.GetParticuleEngine().Draw(*m_camera); + m_env.getParticuleEngine().draw(*m_camera); } #ifdef SCENE_DISPLAY_SPEED - float localTime = (float)(ewol::GetTime() - g_startTime) / 1000.0f; + float localTime = (float)(ewol::getTime() - g_startTime) / 1000.0f; if (localTime>1) { EWOL_ERROR(" scene : " << localTime << "ms " << g_counterNbTimeDisplay); } else { @@ -251,30 +251,30 @@ btRigidBody& btActionInterface::getFixedBody() } -void ege::Scene::PeriodicCall(const ewol::EventTime& _event) +void ege::Scene::periodicCall(const ewol::EventTime& _event) { - float curentDelta=_event.GetDeltaCall(); + float curentDelta=_event.getDeltaCall(); // small hack to change speed ... if (m_ratioTime != 1) { curentDelta *= m_ratioTime; } // check if the processing is availlable if (false == m_isRunning) { - MarkToRedraw(); + markToRedraw(); return; } // update game time: int32_t lastGameTime = m_gameTime; m_gameTime += curentDelta; if (lastGameTime != (int32_t)m_gameTime) { - GenerateEventId(eventPlayTimeChange, m_gameTime); + generateEventId(eventPlayTimeChange, m_gameTime); } //EWOL_DEBUG("Time: m_lastCallTime=" << m_lastCallTime << " deltaTime=" << deltaTime); // update camera positions: if (NULL != m_camera) { - m_camera->PeriodicCall(curentDelta); + m_camera->periodicCall(curentDelta); } //EGE_DEBUG("stepSimulation (start)"); ///step the simulation @@ -283,30 +283,30 @@ void ege::Scene::PeriodicCall(const ewol::EventTime& _event) //optional but useful: debug drawing m_dynamicsWorld->debugDrawWorld(); } - m_env.GetParticuleEngine().Update(curentDelta); - // Remove all element that requested it ... + m_env.getParticuleEngine().update(curentDelta); + // remove all element that requested it ... { int32_t numberEnnemyKilled=0; int32_t victoryPoint=0; - etk::Vector& elementList = m_env.GetElementGame(); - for (int32_t iii=elementList.Size()-1; iii>=0; --iii) { + etk::Vector& elementList = m_env.getElementGame(); + for (int32_t iii=elementList.size()-1; iii >= 0; --iii) { if(NULL != elementList[iii]) { - if (true == elementList[iii]->NeedToRemove()) { - if (elementList[iii]->GetGroup() > 1) { + if (true == elementList[iii]->needToRemove()) { + if (elementList[iii]->getGroup() > 1) { numberEnnemyKilled++; victoryPoint++; } - EGE_DEBUG("[" << elementList[iii]->GetUID() << "] element Removing ... " << elementList[iii]->GetType()); + EGE_DEBUG("[" << elementList[iii]->getUID() << "] element Removing ... " << elementList[iii]->getType()); m_env.RmElementGame(elementList[iii]); } } } if (0 != numberEnnemyKilled) { - GenerateEventId(eventKillEnemy, numberEnnemyKilled); + generateEventId(eventKillEnemy, numberEnnemyKilled); } } - MarkToRedraw(); + markToRedraw(); } #define GAME_Z_NEAR (1) @@ -314,57 +314,57 @@ void ege::Scene::PeriodicCall(const ewol::EventTime& _event) //#define SCENE_BRUT_PERFO_TEST -void ege::Scene::SystemDraw(const ewol::DrawProperty& _displayProp) +void ege::Scene::systemDraw(const ewol::drawProperty& _displayProp) { #ifdef SCENE_BRUT_PERFO_TEST -int64_t tmp___startTime0 = ewol::GetTime(); +int64_t tmp___startTime0 = ewol::getTime(); #endif - ewol::openGL::Push(); - // here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left + ewol::openGL::push(); + // here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left glViewport( m_origin.x(), m_origin.y(), m_size.x(), m_size.y()); #ifdef SCENE_BRUT_PERFO_TEST -float tmp___localTime0 = (float)(ewol::GetTime() - tmp___startTime0) / 1000.0f; +float tmp___localTime0 = (float)(ewol::getTime() - tmp___startTime0) / 1000.0f; EWOL_DEBUG(" SCENE000 : " << tmp___localTime0 << "ms "); -int64_t tmp___startTime1 = ewol::GetTime(); +int64_t tmp___startTime1 = ewol::getTime(); #endif float ratio = m_size.x() / m_size.y(); //EWOL_INFO("ratio : " << ratio); mat4 tmpProjection = etk::matPerspective(m_angleView, ratio, GAME_Z_NEAR, GAME_Z_FAR); #ifdef SCENE_BRUT_PERFO_TEST -float tmp___localTime1 = (float)(ewol::GetTime() - tmp___startTime1) / 1000.0f; +float tmp___localTime1 = (float)(ewol::getTime() - tmp___startTime1) / 1000.0f; EWOL_DEBUG(" SCENE111 : " << tmp___localTime1 << "ms "); -int64_t tmp___startTime2 = ewol::GetTime(); +int64_t tmp___startTime2 = ewol::getTime(); #endif - ewol::openGL::SetCameraMatrix(m_camera->GetMatrix()); - //mat4 tmpMat = tmpProjection * m_camera->GetMatrix(); + ewol::openGL::setCameraMatrix(m_camera->getMatrix()); + //mat4 tmpMat = tmpProjection * m_camera->getMatrix(); // set internal matrix system : - //ewol::openGL::SetMatrix(tmpMat); - ewol::openGL::SetMatrix(tmpProjection); + //ewol::openGL::setMatrix(tmpMat); + ewol::openGL::setMatrix(tmpProjection); #ifdef SCENE_BRUT_PERFO_TEST -float tmp___localTime2 = (float)(ewol::GetTime() - tmp___startTime2) / 1000.0f; +float tmp___localTime2 = (float)(ewol::getTime() - tmp___startTime2) / 1000.0f; EWOL_DEBUG(" SCENE222 : " << tmp___localTime2 << "ms "); #endif #ifdef SCENE_BRUT_PERFO_TEST -int64_t tmp___startTime3 = ewol::GetTime(); +int64_t tmp___startTime3 = ewol::getTime(); #endif - OnDraw(); + onDraw(); #ifdef SCENE_BRUT_PERFO_TEST -float tmp___localTime3 = (float)(ewol::GetTime() - tmp___startTime3) / 1000.0f; +float tmp___localTime3 = (float)(ewol::getTime() - tmp___startTime3) / 1000.0f; EWOL_DEBUG(" SCENE333 : " << tmp___localTime3 << "ms "); -int64_t tmp___startTime4 = ewol::GetTime(); +int64_t tmp___startTime4 = ewol::getTime(); #endif - ewol::openGL::Pop(); + ewol::openGL::pop(); #ifdef SCENE_BRUT_PERFO_TEST -float tmp___localTime4 = (float)(ewol::GetTime() - tmp___startTime4) / 1000.0f; +float tmp___localTime4 = (float)(ewol::getTime() - tmp___startTime4) / 1000.0f; EWOL_DEBUG(" SCENE444 : " << tmp___localTime4 << "ms "); #endif } -vec2 ege::Scene::CalculateDeltaAngle(const vec2& posScreen) +vec2 ege::Scene::calculateDeltaAngle(const vec2& posScreen) { double ratio = m_size.x() / m_size.y(); vec2 pos = vec2(m_size.x()/-2.0, m_size.y()/-2.0) + posScreen; @@ -382,9 +382,9 @@ vec2 ege::Scene::CalculateDeltaAngle(const vec2& posScreen) angleY); } -vec3 ege::Scene::ConvertScreenPositionInMapPosition(const vec2& posScreen) +vec3 ege::Scene::convertScreenPositionInMapPosition(const vec2& posScreen) { - return m_camera->projectOnZGround(CalculateDeltaAngle(posScreen)); + return m_camera->projectOnZGround(calculateDeltaAngle(posScreen)); } diff --git a/ege/Scene.h b/ege/Scene.h index 09dc751..b78dc91 100644 --- a/ege/Scene.h +++ b/ege/Scene.h @@ -51,12 +51,12 @@ namespace ege { * @brief Destructor of the widget classes */ virtual ~Scene(void); - void SetBulletConfig(btDefaultCollisionConfiguration* _collisionConfiguration=NULL, + void setBulletConfig(btDefaultCollisionConfiguration* _collisionConfiguration=NULL, btCollisionDispatcher* _dispatcher=NULL, btBroadphaseInterface* _broadphase=NULL, btConstraintSolver* _solver=NULL, btDynamicsWorld* _dynamicsWorld=NULL); - void SetCamera(ege::Camera* _camera=NULL); + void setCamera(ege::Camera* _camera=NULL); private: float m_gameTime; //!< time of the game running protected: @@ -68,7 +68,7 @@ namespace ege { btConstraintSolver* m_solver; btDynamicsWorld* m_dynamicsWorld; // camera section - ege::Camera* m_camera; //!< Display point of view. + ege::Camera* m_camera; //!< display point of view. // Other elements bool m_isRunning; //!< the display is running (not in pause) float m_ratioTime; //!< Ratio time for the speed of the game ... @@ -76,57 +76,57 @@ namespace ege { etk::Vector m_displayElementOrdered; public: /** - * @brief Set the scene in pause for a while + * @brief set the scene in pause for a while */ - void Pause(void); + void pause(void); /** - * @brief Resume the scene activity + * @brief resume the scene activity */ - void Resume(void); + void resume(void); /** * @brief Toggle between pause and running */ - void PauseToggle(void); + void pauseToggle(void); protected: bool m_debugMode; ewol::Colored3DObject* m_debugDrawing; //!< for the debug draw elements public: /** - * @brief Toggle the debug mode ==> usefull for DEBUG only ... + * @brief Toggle the debug mode == > usefull for DEBUG only ... */ - void DebugToggle(void) { m_debugMode = m_debugMode?false:true; }; + void debugToggle(void) { m_debugMode = m_debugMode?false:true; }; protected: // Derived function virtual void ScenePeriodicCall(int64_t localTime, int32_t deltaTime) { }; public: - vec2 CalculateDeltaAngle(const vec2& posScreen); - vec3 ConvertScreenPositionInMapPosition(const vec2& posScreen); + vec2 calculateDeltaAngle(const vec2& posScreen); + vec3 convertScreenPositionInMapPosition(const vec2& posScreen); /** - * @brief Get the current camera reference for the scene rendering + * @brief get the current camera reference for the scene rendering */ - ege::Camera& GetCamera(void) { return *m_camera; }; + ege::Camera& getCamera(void) { return *m_camera; }; /** - * @brief Set the curent Time Ratio (default 1) + * @brief set the curent Time Ratio (default 1) */ - void SetRatioTime(float newRatio) { m_ratioTime = newRatio; }; + void setRatioTime(float newRatio) { m_ratioTime = newRatio; }; void renderscene(int pass); - void DrawOpenGL(btScalar* m, + void drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color, int32_t debugMode, const btVector3& worldBoundsMin, const btVector3& worldBoundsMax); - void DrawSphere(btScalar radius, int lats, int longs, mat4& transformationMatrix, etk::Color& tmpColor); - void GetElementAroundNewElement(vec3 sourcePosition, etk::Vector& resultList); + void drawSphere(btScalar radius, int lats, int longs, mat4& transformationMatrix, etk::Color& tmpColor); + void getElementAroundNewElement(vec3 sourcePosition, etk::Vector& resultList); protected: // Derived function - virtual void OnDraw(void); + virtual void onDraw(void); public: // Derived function - virtual const char * const GetObjectType(void) { return "ege::Scene"; }; - virtual void SystemDraw(const ewol::DrawProperty& _displayProp); - virtual void OnRegenerateDisplay(void); - virtual void PeriodicCall(const ewol::EventTime& _event); + virtual const char * const getObjectType(void) { return "ege::Scene"; }; + virtual void systemDraw(const ewol::drawProperty& _displayProp); + virtual void onRegenerateDisplay(void); + virtual void periodicCall(const ewol::EventTime& _event); }; }; diff --git a/ege/resource/ParticuleMesh.cpp b/ege/resource/ParticuleMesh.cpp index 7aaafde..0eb2b95 100644 --- a/ege/resource/ParticuleMesh.cpp +++ b/ege/resource/ParticuleMesh.cpp @@ -14,7 +14,7 @@ ege::resource::ParticuleMesh::ParticuleMesh(const etk::UString& _fileName, const ewol::Mesh(_fileName, _shaderName) { if (m_GLprogram != NULL) { - m_GLMainColor = m_GLprogram->GetUniform("EW_mainColor"); + m_GLMainColor = m_GLprogram->getUniform("EW_mainColor"); } } @@ -23,57 +23,57 @@ ege::resource::ParticuleMesh::~ParticuleMesh(void) } -void ege::resource::ParticuleMesh::Draw(mat4& _positionMatrix, +void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix, const etk::Color& _mainColor, bool _enableDepthTest, bool _enableDepthUpdate) { - if (m_GLprogram==NULL) { + if (m_GLprogram == NULL) { EWOL_ERROR("No shader ..."); return; } //EWOL_DEBUG(m_name << " " << m_light); - if (_enableDepthTest==true) { - ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); - if (false==_enableDepthUpdate) { + if (_enableDepthTest == true) { + ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST); + if (false == _enableDepthUpdate) { glDepthMask(GL_FALSE); } } else { - ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); + ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); } - //EWOL_DEBUG(" Display " << m_coord.Size() << " elements" ); - m_GLprogram->Use(); + //EWOL_DEBUG(" display " << m_coord.size() << " elements" ); + m_GLprogram->use(); // set Matrix : translation/positionMatrix - mat4 projMatrix = ewol::openGL::GetMatrix(); - mat4 camMatrix = ewol::openGL::GetCameraMatrix(); + mat4 projMatrix = ewol::openGL::getMatrix(); + mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 tmpMatrix = projMatrix * camMatrix; - m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); - m_GLprogram->UniformMatrix4fv(m_GLMatrixPosition, 1, _positionMatrix.m_mat); + m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix4fv(m_GLMatrixPosition, 1, _positionMatrix.m_mat); vec4 tmpColor(_mainColor.r(), _mainColor.g(), _mainColor.b(), _mainColor.a()); - m_GLprogram->Uniform4(m_GLMainColor, tmpColor); + m_GLprogram->uniform4(m_GLMainColor, tmpColor); // position : - m_GLprogram->SendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES); + m_GLprogram->sendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES); // Texture : - m_GLprogram->SendAttributePointer(m_GLtexture, 2/*u,v*/, m_verticesVBO, MESH_VBO_TEXTURE); + m_GLprogram->sendAttributePointer(m_GLtexture, 2/*u,v*/, m_verticesVBO, MESH_VBO_TEXTURE); // position : - m_GLprogram->SendAttributePointer(m_GLNormal, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES_NORMAL); + m_GLprogram->sendAttributePointer(m_GLNormal, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES_NORMAL); // draw lights : - m_light.Draw(m_GLprogram); + m_light.draw(m_GLprogram); #ifdef DISPLAY_NB_VERTEX_DISPLAYED int32_t nbElementDrawTheoric = 0; int32_t nbElementDraw = 0; #endif - for (esize_t kkk=0; kkkDraw(m_GLprogram, m_GLMaterial); - if (m_checkNormal==false) { - ewol::openGL::DrawElements(GL_TRIANGLES, m_listFaces.GetValue(kkk).m_index); + m_materials[m_listFaces.getKey(kkk)]->draw(m_GLprogram, m_GLMaterial); + if (m_checkNormal == false) { + ewol::openGL::drawElements(GL_TRIANGLES, m_listFaces.getValue(kkk).m_index); #ifdef DISPLAY_NB_VERTEX_DISPLAYED - nbElementDraw += m_listFaces.GetValue(kkk).m_index.Size(); - nbElementDrawTheoric += m_listFaces.GetValue(kkk).m_index.Size(); + nbElementDraw += m_listFaces.getValue(kkk).m_index.size(); + nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size(); #endif } else { mat4 mattttt = (projMatrix * camMatrix) * _positionMatrix; @@ -85,50 +85,50 @@ void ege::resource::ParticuleMesh::Draw(mat4& _positionMatrix, cameraNormal.normalized(); // remove face that is notin the view ... etk::Vector tmpIndexResult; - etk::Vector& tmppFaces = m_listFaces.GetValue(kkk).m_faces; - etk::Vector& tmppIndex = m_listFaces.GetValue(kkk).m_index; + etk::Vector& tmppFaces = m_listFaces.getValue(kkk).m_faces; + etk::Vector& tmppIndex = m_listFaces.getValue(kkk).m_index; if (normalModeFace == m_normalMode) { - for(int32_t iii=0; iii= 0.0f) { - tmpIndexResult.PushBack(iii*3); - tmpIndexResult.PushBack(iii*3+1); - tmpIndexResult.PushBack(iii*3+2); + tmpIndexResult.pushBack(iii*3); + tmpIndexResult.pushBack(iii*3+1); + tmpIndexResult.pushBack(iii*3+2); } } } else { - for(int32_t iii=0; iii= -0.2f) || (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]], cameraNormal) >= -0.2f) || (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]], cameraNormal) >= -0.2f) ) { - tmpIndexResult.PushBack(iii*3); - tmpIndexResult.PushBack(iii*3+1); - tmpIndexResult.PushBack(iii*3+2); + tmpIndexResult.pushBack(iii*3); + tmpIndexResult.pushBack(iii*3+1); + tmpIndexResult.pushBack(iii*3+2); } } } - ewol::openGL::DrawElements(GL_TRIANGLES, tmpIndexResult); + ewol::openGL::drawElements(GL_TRIANGLES, tmpIndexResult); #ifdef DISPLAY_NB_VERTEX_DISPLAYED - nbElementDraw += tmpIndexResult.Size(); - nbElementDrawTheoric += m_listFaces.GetValue(kkk).m_index.Size(); + nbElementDraw += tmpIndexResult.size(); + nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size(); #endif } } #ifdef DISPLAY_NB_VERTEX_DISPLAYED - EWOL_DEBUG(((float)nbElementDraw/(float)nbElementDrawTheoric*100.0f) << "% Request Draw : " << m_listFaces.Size() << ":" << nbElementDraw << "/" << nbElementDrawTheoric << " elements [" << m_name << "]"); + EWOL_DEBUG(((float)nbElementDraw/(float)nbElementDrawTheoric*100.0f) << "% Request draw : " << m_listFaces.size() << ":" << nbElementDraw << "/" << nbElementDrawTheoric << " elements [" << m_name << "]"); #endif - m_GLprogram->UnUse(); - if (_enableDepthTest==true){ - if (false==_enableDepthUpdate) { + m_GLprogram->unUse(); + if (_enableDepthTest == true){ + if (false == _enableDepthUpdate) { glDepthMask(GL_TRUE); } - ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); + ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); } glBindBuffer(GL_ARRAY_BUFFER,0); } -ege::resource::ParticuleMesh* ege::resource::ParticuleMesh::Keep(const etk::UString& _meshName, const etk::UString& _shaderName) +ege::resource::ParticuleMesh* ege::resource::ParticuleMesh::keep(const etk::UString& _meshName, const etk::UString& _shaderName) { - ege::resource::ParticuleMesh* object = static_cast(GetManager().LocalKeep(_meshName)); + ege::resource::ParticuleMesh* object = static_cast(getManager().localKeep(_meshName)); if (NULL != object) { return object; } @@ -137,16 +137,16 @@ ege::resource::ParticuleMesh* ege::resource::ParticuleMesh::Keep(const etk::UStr EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName); return NULL; } - GetManager().LocalAdd(object); + getManager().localAdd(object); return object; } -void ege::resource::ParticuleMesh::Release(ege::resource::ParticuleMesh*& _object) +void ege::resource::ParticuleMesh::release(ege::resource::ParticuleMesh*& _object) { if (_object == NULL) { return; } ewol::Resource* object2 = static_cast(_object); - GetManager().Release(object2); + getManager().release(object2); _object = NULL; } diff --git a/ege/resource/ParticuleMesh.h b/ege/resource/ParticuleMesh.h index 2ae2693..4d476ee 100644 --- a/ege/resource/ParticuleMesh.h +++ b/ege/resource/ParticuleMesh.h @@ -23,21 +23,21 @@ namespace ege ParticuleMesh(const etk::UString& _fileName, const etk::UString& _shaderName); virtual ~ParticuleMesh(void); public: - virtual const char* GetType(void) { return "ege::resource::ParticuleMesh"; }; - virtual void Draw(mat4& _positionMatrix, const etk::Color& _mainColor, bool _enableDepthTest=true, bool _enableDepthUpdate=true); + virtual const char* getType(void) { return "ege::resource::ParticuleMesh"; }; + virtual void draw(mat4& _positionMatrix, const etk::Color& _mainColor, bool _enableDepthTest=true, bool _enableDepthUpdate=true); public: /** - * @brief Keep the resource pointer. + * @brief keep the resource pointer. * @note Never free this pointer by your own... * @param[in] _filename Name of the ewol mesh file. * @return pointer on the resource or NULL if an error occured. */ - static ege::resource::ParticuleMesh* Keep(const etk::UString& _meshName, const etk::UString& _shaderName="DATA:ParticuleMesh.prog"); + static ege::resource::ParticuleMesh* keep(const etk::UString& _meshName, const etk::UString& _shaderName="DATA:ParticuleMesh.prog"); /** - * @brief Release the keeped resources + * @brief release the keeped resources * @param[in,out] reference on the object pointer */ - static void Release(ege::resource::ParticuleMesh*& _object); + static void release(ege::resource::ParticuleMesh*& _object); }; }; };