From 00045ece2b6b081a5facf608a71fe80ff19e1373 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 19 Jul 2016 21:43:58 +0200 Subject: [PATCH] [DEV] update sharedPtr --- ege/Environement.h | 2 +- ege/Light.cpp | 4 ++-- ege/Light.h | 4 ++-- ege/Material.cpp | 4 ++-- ege/Material.h | 4 ++-- ege/camera/Camera.h | 2 +- ege/camera/View.cpp | 2 +- ege/camera/View.h | 2 +- ege/elements/Element.cpp | 6 +++--- ege/elements/Element.h | 8 ++++---- ege/elements/ElementPhysic.cpp | 8 ++++---- ege/elements/ElementPhysic.h | 6 +++--- ege/physicsShape/PhysicsBox.h | 2 +- ege/physicsShape/PhysicsCapsule.h | 2 +- ege/physicsShape/PhysicsCone.h | 2 +- ege/physicsShape/PhysicsConvexHull.h | 2 +- ege/physicsShape/PhysicsCylinder.h | 2 +- ege/physicsShape/PhysicsShape.h | 2 +- ege/physicsShape/PhysicsSphere.h | 2 +- 19 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ege/Environement.h b/ege/Environement.h index 48d7e07..45f672f 100644 --- a/ege/Environement.h +++ b/ege/Environement.h @@ -229,7 +229,7 @@ namespace ege { void addStaticMeshToDraw(const ememory::SharedPtr& _mesh) { m_listMeshToDrawFirst.push_back(_mesh); } - const std::vector>& getStaticMeshToDraw() { + std::vector>& getStaticMeshToDraw() { return m_listMeshToDrawFirst; } virtual void onChangePropertyStatus(); diff --git a/ege/Light.cpp b/ege/Light.cpp index b8bc9c9..1a7051e 100644 --- a/ege/Light.cpp +++ b/ege/Light.cpp @@ -25,7 +25,7 @@ ege::Light::~Light() { } -void ege::Light::link(const ememory::SharedPtr& _prog, const std::string& _baseName) { +void ege::Light::link(ememory::SharedPtr _prog, const std::string& _baseName) { if (_prog == nullptr) { return; } @@ -36,7 +36,7 @@ void ege::Light::link(const ememory::SharedPtr& _prog, m_GL_specularColor = _prog->getUniform(_baseName+".specularColor"); } -void ege::Light::draw(const ememory::SharedPtr& _prog) { +void ege::Light::draw(ememory::SharedPtr _prog) { _prog->uniform3(m_GL_direction, m_direction); _prog->uniform3(m_GL_halfplane, m_halfplane); _prog->uniform4(m_GL_ambientColor, m_ambientColor); diff --git a/ege/Light.h b/ege/Light.h index 311d49e..f7f07b3 100644 --- a/ege/Light.h +++ b/ege/Light.h @@ -29,8 +29,8 @@ namespace ege { public: Light(); ~Light(); - void link(const ememory::SharedPtr& _prog, const std::string& _baseName); - void draw(const ememory::SharedPtr& _prog); + void link(ememory::SharedPtr _prog, const std::string& _baseName); + void draw(ememory::SharedPtr _prog); void setDirection(const vec3& val) { m_direction = val; } diff --git a/ege/Material.cpp b/ege/Material.cpp index 0c24ec0..1b1ee76 100644 --- a/ege/Material.cpp +++ b/ege/Material.cpp @@ -17,7 +17,7 @@ ege::MaterialGlId::MaterialGlId() : // nothing to do else ... } -void ege::MaterialGlId::link(const ememory::SharedPtr& _prog, const std::string& _baseName) { +void ege::MaterialGlId::link(ememory::SharedPtr _prog, const std::string& _baseName) { if (_prog == nullptr) { return; } @@ -42,7 +42,7 @@ ege::Material::~Material() { } -void ege::Material::draw(const ememory::SharedPtr& _prog, const MaterialGlId& _glID) { +void ege::Material::draw(ememory::SharedPtr _prog, const MaterialGlId& _glID) { EGE_INFO("draw Material : (start)"); _prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor); _prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor); diff --git a/ege/Material.h b/ege/Material.h index 05f4d6b..42b24e1 100644 --- a/ege/Material.h +++ b/ege/Material.h @@ -24,7 +24,7 @@ namespace ege { int32_t m_GL_shininess; int32_t m_GL_texture0; MaterialGlId(); - void link(const ememory::SharedPtr& _prog, const std::string& _baseName); + void link(ememory::SharedPtr _prog, const std::string& _baseName); }; @@ -42,7 +42,7 @@ namespace ege { public: Material(); ~Material(); - void draw(const ememory::SharedPtr& _prog, const ege::MaterialGlId& _glID); + void draw(ememory::SharedPtr _prog, const ege::MaterialGlId& _glID); void setAmbientFactor(const vec4& _val) { m_ambientFactor = _val; } diff --git a/ege/camera/Camera.h b/ege/camera/Camera.h index d0c7495..7149bf6 100644 --- a/ege/camera/Camera.h +++ b/ege/camera/Camera.h @@ -168,7 +168,7 @@ 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(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera) { } + virtual void drawDebug(ememory::SharedPtr _draw, ememory::SharedPtr _camera) { } }; } diff --git a/ege/camera/View.cpp b/ege/camera/View.cpp index 8b2d434..12284f4 100644 --- a/ege/camera/View.cpp +++ b/ege/camera/View.cpp @@ -90,7 +90,7 @@ ege::Ray ege::camera::View::getRayFromScreen(const vec2& _offset) { return out; } -void ege::camera::View::drawDebug(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera) { +void ege::camera::View::drawDebug(ememory::SharedPtr _draw, ememory::SharedPtr _camera) { mat4 mat; if (_camera != sharedFromThis()) { mat.identity(); diff --git a/ege/camera/View.h b/ege/camera/View.h index eed0655..54f448d 100644 --- a/ege/camera/View.h +++ b/ege/camera/View.h @@ -73,7 +73,7 @@ namespace ege { virtual vec3 getViewVector() const; public: virtual ege::Ray getRayFromScreen(const vec2& _offset); - virtual void drawDebug(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera); + virtual void drawDebug(ememory::SharedPtr _draw, ememory::SharedPtr _camera); virtual float getTetha(); virtual float getPsy(); }; diff --git a/ege/elements/Element.cpp b/ege/elements/Element.cpp index 2287de4..cfdca36 100644 --- a/ege/elements/Element.cpp +++ b/ege/elements/Element.cpp @@ -85,7 +85,7 @@ bool ege::Element::loadMesh(const std::string& _meshFileName) { return setMesh(tmpMesh); } -bool ege::Element::setMesh(const ememory::SharedPtr& _mesh) { +bool ege::Element::setMesh(ememory::SharedPtr _mesh) { if (m_mesh != nullptr) { m_mesh.reset(); } @@ -129,7 +129,7 @@ const float lifeHeight = 0.3f; const float lifeWidth = 2.0f; const float lifeYPos = 1.7f; -void ege::Element::drawLife(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera) { +void ege::Element::drawLife(ememory::SharedPtr _draw, ememory::SharedPtr _camera) { if (_draw == nullptr) { return; } @@ -168,7 +168,7 @@ void ege::Element::drawLife(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera) { +void ege::Element::drawDebug(ememory::SharedPtr _draw, ememory::SharedPtr _camera) { m_debugText.clear(); m_debugText.setColor(etk::Color<>(0x00, 0xFF, 0x00, 0xFF)); m_debugText.setPos(vec3(-20,32,0)); diff --git a/ege/elements/Element.h b/ege/elements/Element.h index 52a2421..70aac08 100644 --- a/ege/elements/Element.h +++ b/ege/elements/Element.h @@ -82,12 +82,12 @@ namespace ege { * @note : this remove the shape and the mesh properties. * @return true if no error occured */ - virtual bool setMesh(const ememory::SharedPtr& _mesh); + virtual bool setMesh(ememory::SharedPtr _mesh); /** * @brief get a pointer on the Mesh file. * @return the mesh pointer. */ - inline const ememory::SharedPtr& getMesh() { + inline ememory::SharedPtr getMesh() { return m_mesh; }; protected: @@ -159,7 +159,7 @@ namespace ege { * @brief draw the current life of the element */ // TODO : Remove this ... - virtual void drawLife(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera); + virtual void drawLife(ememory::SharedPtr _draw, ememory::SharedPtr _camera); protected: // For debug only ... @@ -169,7 +169,7 @@ 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(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera); + virtual void drawDebug(ememory::SharedPtr _draw, ememory::SharedPtr _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 ... diff --git a/ege/elements/ElementPhysic.cpp b/ege/elements/ElementPhysic.cpp index 91655c0..472abc0 100644 --- a/ege/elements/ElementPhysic.cpp +++ b/ege/elements/ElementPhysic.cpp @@ -72,9 +72,9 @@ void ege::ElementPhysic::createRigidBody(float _mass) { } -bool ege::ElementPhysic::setMesh(const ememory::SharedPtr& _mesh) { +bool ege::ElementPhysic::setMesh(ememory::SharedPtr _mesh) { EGE_WARNING("Set Mesh"); - if (nullptr!=m_mesh) { + if (m_mesh != nullptr) { removeShape(); } ege::Element::setMesh(_mesh); @@ -170,7 +170,7 @@ const float ege::ElementPhysic::getInvMass() { }; void ege::ElementPhysic::drawShape(const btCollisionShape* _shape, - const ememory::SharedPtr& _draw, + ememory::SharedPtr _draw, mat4 _transformationMatrix, std::vector _tmpVertices) { if( _draw == nullptr @@ -316,7 +316,7 @@ void ege::ElementPhysic::drawShape(const btCollisionShape* _shape, } } -void ege::ElementPhysic::drawDebug(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera) { +void ege::ElementPhysic::drawDebug(ememory::SharedPtr _draw, ememory::SharedPtr _camera) { ege::Element::drawDebug(_draw, _camera); btScalar mmm[16]; btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_body->getMotionState(); diff --git a/ege/elements/ElementPhysic.h b/ege/elements/ElementPhysic.h index 0b43c0c..602a3a2 100644 --- a/ege/elements/ElementPhysic.h +++ b/ege/elements/ElementPhysic.h @@ -76,7 +76,7 @@ namespace ege { */ void removeShape(); public: - virtual bool setMesh(const ememory::SharedPtr& _mesh); + virtual bool setMesh(ememory::SharedPtr _mesh); /** * @brief draw the curent element (can have multiple display) * @param[in] pass Id of the current pass : [0..?] @@ -175,10 +175,10 @@ namespace ege { virtual void onDestroy() {}; virtual const vec3& getPosition(); virtual void setPosition(const vec3& _pos); - virtual void drawDebug(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera); + virtual void drawDebug(ememory::SharedPtr _draw, ememory::SharedPtr _camera); protected: void drawShape(const btCollisionShape* _shape, - const ememory::SharedPtr& _draw, + ememory::SharedPtr _draw, mat4 _transformationMatrix, std::vector _tmpVertices); protected: diff --git a/ege/physicsShape/PhysicsBox.h b/ege/physicsShape/PhysicsBox.h index c544902..e0831d7 100644 --- a/ege/physicsShape/PhysicsBox.h +++ b/ege/physicsShape/PhysicsBox.h @@ -18,7 +18,7 @@ namespace ege { virtual bool parse(const char* _line); virtual void display() {}; public: - virtual enum ege::PhysicsShape::type getType() { + virtual enum ege::PhysicsShape::type getType() const { return ege::PhysicsShape::box; }; private: diff --git a/ege/physicsShape/PhysicsCapsule.h b/ege/physicsShape/PhysicsCapsule.h index 1e4fb21..42858e2 100644 --- a/ege/physicsShape/PhysicsCapsule.h +++ b/ege/physicsShape/PhysicsCapsule.h @@ -19,7 +19,7 @@ namespace ege { virtual bool parse(const char* _line); virtual void display() {}; public: - virtual enum ege::PhysicsShape::type getType() { + virtual enum ege::PhysicsShape::type getType() const { return ege::PhysicsShape::capsule; }; private: diff --git a/ege/physicsShape/PhysicsCone.h b/ege/physicsShape/PhysicsCone.h index 79c5e7b..d888597 100644 --- a/ege/physicsShape/PhysicsCone.h +++ b/ege/physicsShape/PhysicsCone.h @@ -17,7 +17,7 @@ namespace ege { virtual bool parse(const char* _line); virtual void display() {}; public: - virtual enum ege::PhysicsShape::type getType() { + virtual enum ege::PhysicsShape::type getType() const { return ege::PhysicsShape::cone; }; private: diff --git a/ege/physicsShape/PhysicsConvexHull.h b/ege/physicsShape/PhysicsConvexHull.h index a631314..dbd7592 100644 --- a/ege/physicsShape/PhysicsConvexHull.h +++ b/ege/physicsShape/PhysicsConvexHull.h @@ -17,7 +17,7 @@ namespace ege { virtual bool parse(const char* _line); virtual void display() {}; public: - virtual enum ege::PhysicsShape::type getType() { + virtual enum ege::PhysicsShape::type getType() const { return ege::PhysicsShape::convexHull; }; private: diff --git a/ege/physicsShape/PhysicsCylinder.h b/ege/physicsShape/PhysicsCylinder.h index f2e35ee..7d07fac 100644 --- a/ege/physicsShape/PhysicsCylinder.h +++ b/ege/physicsShape/PhysicsCylinder.h @@ -19,7 +19,7 @@ namespace ege { virtual bool parse(const char* _line); virtual void display() {}; public: - virtual enum ege::PhysicsShape::type getType() { + virtual enum ege::PhysicsShape::type getType() const { return ege::PhysicsShape::cylinder; }; private: diff --git a/ege/physicsShape/PhysicsShape.h b/ege/physicsShape/PhysicsShape.h index fa8b2df..3f70b71 100644 --- a/ege/physicsShape/PhysicsShape.h +++ b/ege/physicsShape/PhysicsShape.h @@ -43,7 +43,7 @@ namespace ege { }; public: - virtual enum ege::PhysicsShape::type getType() { + virtual enum ege::PhysicsShape::type getType() const { return ege::PhysicsShape::unknow; }; diff --git a/ege/physicsShape/PhysicsSphere.h b/ege/physicsShape/PhysicsSphere.h index 3fc564e..d135404 100644 --- a/ege/physicsShape/PhysicsSphere.h +++ b/ege/physicsShape/PhysicsSphere.h @@ -19,7 +19,7 @@ namespace ege { virtual bool parse(const char* _line); virtual void display() {}; public: - virtual enum ege::PhysicsShape::type getType() { + virtual enum ege::PhysicsShape::type getType() const { return ege::PhysicsShape::sphere; }; private: