From 1a97ed92acb2b9e45f6393f21b66dbff63453ab9 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 15 Jul 2016 21:22:11 +0200 Subject: [PATCH] [DEV] update new ememory::SharedPtr --- ege/CollisionShapeCreator.cpp | 4 +-- ege/CollisionShapeCreator.h | 2 +- ege/Environement.cpp | 32 +++++++++---------- ege/Environement.h | 44 +++++++++++++------------- ege/Light.cpp | 4 +-- ege/Light.h | 4 +-- ege/Material.cpp | 6 ++-- ege/Material.h | 6 ++-- ege/Ray.cpp | 8 ++--- ege/Ray.h | 4 +-- ege/camera/Camera.h | 4 +-- ege/camera/View.cpp | 4 +-- ege/camera/View.h | 2 +- ege/elements/Element.cpp | 10 +++--- ege/elements/Element.h | 18 +++++------ ege/elements/ElementBase.cpp | 2 +- ege/elements/ElementBase.h | 2 +- ege/elements/ElementPhysic.cpp | 8 ++--- ege/elements/ElementPhysic.h | 12 +++---- ege/physics/Engine.cpp | 26 +++++++-------- ege/physics/Engine.h | 32 +++++++++---------- ege/physicsShape/PhysicsShape.cpp | 16 +++++----- ege/physicsShape/PhysicsShape.h | 4 +-- ege/resource/Mesh.cpp | 2 +- ege/resource/Mesh.h | 18 +++++------ ege/resource/MeshCube.cpp | 6 ++-- ege/resource/MeshEmf.cpp | 6 ++-- ege/resource/MeshGird.cpp | 6 ++-- ege/resource/tools/icoSphere.cpp | 2 +- ege/resource/tools/icoSphere.h | 2 +- ege/resource/tools/isoSphere.cpp | 2 +- ege/resource/tools/isoSphere.h | 2 +- ege/resource/tools/viewBox.cpp | 2 +- ege/resource/tools/viewBox.h | 2 +- ege/widget/Mesh.h | 2 +- ege/widget/Scene.cpp | 16 +++++----- ege/widget/Scene.h | 8 ++--- sample/CameraPosition/appl/Windows.cpp | 14 ++++---- sample/CameraPosition/appl/Windows.h | 4 +-- sample/CameraPosition/appl/main.cpp | 2 +- sample/Collision/appl/Windows.cpp | 36 ++++++++++----------- sample/Collision/appl/Windows.h | 4 +-- sample/Collision/appl/main.cpp | 2 +- sample/DoubleView/appl/Windows.cpp | 34 ++++++++++---------- sample/DoubleView/appl/Windows.h | 4 +-- sample/DoubleView/appl/main.cpp | 2 +- sample/MeshCreator/appl/Windows.cpp | 24 +++++++------- sample/MeshCreator/appl/Windows.h | 4 +-- sample/MeshCreator/appl/main.cpp | 2 +- sample/RayTest/appl/Windows.cpp | 30 +++++++++--------- sample/RayTest/appl/Windows.h | 6 ++-- sample/RayTest/appl/main.cpp | 2 +- 52 files changed, 250 insertions(+), 250 deletions(-) diff --git a/ege/CollisionShapeCreator.cpp b/ege/CollisionShapeCreator.cpp index 072a00d..0e6b51c 100644 --- a/ege/CollisionShapeCreator.cpp +++ b/ege/CollisionShapeCreator.cpp @@ -22,12 +22,12 @@ // Documentetion of bullet library : // http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes -btCollisionShape* ege::collision::createShape(const std::shared_ptr& _mesh) { +btCollisionShape* ege::collision::createShape(const ememory::SharedPtr& _mesh) { if (_mesh == nullptr) { EGE_DEBUG("Create empty shape (no mesh)"); return new btEmptyShape();; } - const std::vector>& physiqueProperty = _mesh->getPhysicalProperties(); + const std::vector>& physiqueProperty = _mesh->getPhysicalProperties(); if (physiqueProperty.size() == 0) { EGE_DEBUG("Create empty shape (no default shape)"); return new btEmptyShape();; diff --git a/ege/CollisionShapeCreator.h b/ege/CollisionShapeCreator.h index 84fe4a3..f6b03f7 100644 --- a/ege/CollisionShapeCreator.h +++ b/ege/CollisionShapeCreator.h @@ -11,7 +11,7 @@ namespace ege { namespace collision { - btCollisionShape* createShape(const std::shared_ptr& _mesh); + btCollisionShape* createShape(const ememory::SharedPtr& _mesh); } } diff --git a/ege/Environement.cpp b/ege/Environement.cpp index 0bbca76..2661b12 100644 --- a/ege/Environement.cpp +++ b/ege/Environement.cpp @@ -24,12 +24,12 @@ #include #include -std::shared_ptr ege::Environement::getElementNearest(std::shared_ptr _sourceRequest, float& _distance) { +ememory::SharedPtr ege::Environement::getElementNearest(ememory::SharedPtr _sourceRequest, float& _distance) { if (_sourceRequest == nullptr) { return nullptr; } vec3 sourcePosition = _sourceRequest->getPosition(); - std::shared_ptr result = nullptr; + ememory::SharedPtr result = nullptr; for (size_t iii=0; iii ege::Environement::createElement(const std::string& _type, const std::string& _description, bool _autoAddElement) { +ememory::SharedPtr ege::Environement::createElement(const std::string& _type, const std::string& _description, bool _autoAddElement) { if (getHachTableCreating().exist(_type) == false) { EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); return nullptr; @@ -145,7 +145,7 @@ std::shared_ptr ege::Environement::createElement(const std::string EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); return nullptr; } - std::shared_ptr tmpElement = creatorPointer(std::dynamic_pointer_cast(shared_from_this())); + ememory::SharedPtr tmpElement = creatorPointer(ememory::dynamicPointerCast(sharedFromThis())); if (tmpElement == nullptr) { EGE_ERROR("allocation error '" << _type << "'"); return nullptr; @@ -160,7 +160,7 @@ std::shared_ptr ege::Environement::createElement(const std::string return tmpElement; } -std::shared_ptr ege::Environement::createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement) { +ememory::SharedPtr ege::Environement::createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement) { if (getHachTableCreating().exist(_type) == false) { EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); return nullptr; @@ -170,7 +170,7 @@ std::shared_ptr ege::Environement::createElement(const std::string EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); return nullptr; } - std::shared_ptr tmpElement = creatorPointer(std::dynamic_pointer_cast(shared_from_this())); + ememory::SharedPtr tmpElement = creatorPointer(ememory::dynamicPointerCast(sharedFromThis())); if (tmpElement == nullptr) { EGE_ERROR("allocation error '" << _type << "'"); return nullptr; @@ -185,7 +185,7 @@ std::shared_ptr ege::Environement::createElement(const std::string return tmpElement; } -std::shared_ptr ege::Environement::createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement) { +ememory::SharedPtr ege::Environement::createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement) { if (getHachTableCreating().exist(_type) == false) { EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); return nullptr; @@ -195,7 +195,7 @@ std::shared_ptr ege::Environement::createElement(const std::string EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); return nullptr; } - std::shared_ptr tmpElement = creatorPointer(std::dynamic_pointer_cast(shared_from_this())); + ememory::SharedPtr tmpElement = creatorPointer(ememory::dynamicPointerCast(sharedFromThis())); if (tmpElement == nullptr) { EGE_ERROR("allocation error '" << _type << "'"); return nullptr; @@ -210,7 +210,7 @@ std::shared_ptr ege::Environement::createElement(const std::string return tmpElement; } -std::shared_ptr ege::Environement::createElement(const std::string& _type, void* _data, bool _autoAddElement) { +ememory::SharedPtr ege::Environement::createElement(const std::string& _type, void* _data, bool _autoAddElement) { if (getHachTableCreating().exist(_type) == false) { EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); return nullptr; @@ -220,7 +220,7 @@ std::shared_ptr ege::Environement::createElement(const std::string EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); return nullptr; } - std::shared_ptr tmpElement = creatorPointer(std::dynamic_pointer_cast(shared_from_this())); + ememory::SharedPtr tmpElement = creatorPointer(ememory::dynamicPointerCast(sharedFromThis())); if (tmpElement == nullptr) { EGE_ERROR("allocation error '" << _type << "'"); return nullptr; @@ -235,7 +235,7 @@ std::shared_ptr ege::Environement::createElement(const std::string return tmpElement; } -std::shared_ptr ege::Environement::createElement(const std::string& _type, bool _autoAddElement) { +ememory::SharedPtr ege::Environement::createElement(const std::string& _type, bool _autoAddElement) { if (getHachTableCreating().exist(_type) == false) { EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); return nullptr; @@ -245,7 +245,7 @@ std::shared_ptr ege::Environement::createElement(const std::string EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); return nullptr; } - std::shared_ptr tmpElement = creatorPointer(std::dynamic_pointer_cast(shared_from_this())); + ememory::SharedPtr tmpElement = creatorPointer(ememory::dynamicPointerCast(sharedFromThis())); if (tmpElement == nullptr) { EGE_ERROR("allocation error '" << _type << "'"); return nullptr; @@ -260,7 +260,7 @@ std::shared_ptr ege::Environement::createElement(const std::string return tmpElement; } -void ege::Environement::addElement(std::shared_ptr _newElement) { +void ege::Environement::addElement(ememory::SharedPtr _newElement) { // prevent memory allocation and un allocation ... if (_newElement == nullptr) { return; @@ -276,7 +276,7 @@ void ege::Environement::addElement(std::shared_ptr _newElement) { _newElement->dynamicEnable(); } -void ege::Environement::rmElement(std::shared_ptr _removeElement) { +void ege::Environement::rmElement(ememory::SharedPtr _removeElement) { if (_removeElement == nullptr) { return; } @@ -457,11 +457,11 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event) } -void ege::Environement::addCamera(const std::string& _name, const std::shared_ptr& _camera) { +void ege::Environement::addCamera(const std::string& _name, const ememory::SharedPtr& _camera) { m_listCamera.insert(std::make_pair(_name, _camera)); } -std::shared_ptr ege::Environement::getCamera(const std::string& _name) { +ememory::SharedPtr ege::Environement::getCamera(const std::string& _name) { auto cameraIt = m_listCamera.find(_name); if (cameraIt != m_listCamera.end()) { return cameraIt->second; diff --git a/ege/Environement.h b/ege/Environement.h index 6b159a0..48d7e07 100644 --- a/ege/Environement.h +++ b/ege/Environement.h @@ -30,7 +30,7 @@ class btDynamicsWorld; namespace ege { class Element; class Environement; - typedef std::shared_ptr (*createElement_tf)(const std::shared_ptr& _env); + typedef ememory::SharedPtr (*createElement_tf)(const ememory::SharedPtr& _env); enum gameStatus { gameStart, @@ -84,9 +84,9 @@ namespace ege { eproperty::List propertyStatus; //!< the display is running (not in pause) eproperty::Value propertyRatio; //!< Speed ratio private: - //std::shared_ptr m_dynamicsWorld; //!< curent system world description + //ememory::SharedPtr m_dynamicsWorld; //!< curent system world description ege::physics::Engine m_physicEngine; //!< EGE physic engine interface. - std::vector> m_listElement; //!< List of all element added in the Game + std::vector> m_listElement; //!< List of all element added in the Game protected: Environement(); public: @@ -94,25 +94,25 @@ namespace ege { virtual ~Environement() { }; protected: protected: - std::map> m_listCamera; //!< list of all camera in the world + std::map> m_listCamera; //!< list of all camera in the world public: /** * @brief Add a camera in the camera pool. * @param[in] _name Name of the camera. * @param[in] _camera Pointer on the camera to add. */ - void addCamera(const std::string& _name, const std::shared_ptr& _camera); + void addCamera(const std::string& _name, const ememory::SharedPtr& _camera); /** * @brief Get a specific camera. * @param[in] _name Name of the camera. * @return A pointer on the camera requested. */ - std::shared_ptr getCamera(const std::string& _name); + ememory::SharedPtr getCamera(const std::string& _name); /** * @brief Get List of all camera. * @return All the camera registerred. */ - std::map> getCameraList() const { + std::map> getCameraList() const { return m_listCamera; } public: @@ -134,15 +134,15 @@ namespace ege { * @return nullptr 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... */ - std::shared_ptr createElement(const std::string& _type, const std::string& _description, bool _autoAddElement=true); - std::shared_ptr createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement=true); - std::shared_ptr createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement=true); - std::shared_ptr createElement(const std::string& _type, void* _data, bool _autoAddElement=true); - std::shared_ptr createElement(const std::string& _type, bool _autoAddElement=true); + ememory::SharedPtr createElement(const std::string& _type, const std::string& _description, bool _autoAddElement=true); + ememory::SharedPtr createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement=true); + ememory::SharedPtr createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement=true); + ememory::SharedPtr createElement(const std::string& _type, void* _data, bool _autoAddElement=true); + ememory::SharedPtr createElement(const std::string& _type, bool _autoAddElement=true); public: class ResultNearestElement { public: - std::shared_ptr element; + ememory::SharedPtr element; float dist; }; #if 0 @@ -150,14 +150,14 @@ namespace ege { * @brief set the curent world * @param[in] _newWorld Pointer on the current world */ - void setDynamicWorld(const std::shared_ptr& _newWorld) { + void setDynamicWorld(const ememory::SharedPtr& _newWorld) { m_dynamicsWorld=_newWorld; }; /** * @brief get the curent world * @return pointer on the current world */ - std::shared_ptr getDynamicWorld() { + ememory::SharedPtr getDynamicWorld() { return m_dynamicsWorld; }; #endif @@ -168,7 +168,7 @@ namespace ege { * @breif get a reference on the curent list of element games * @return all element list */ - std::vector>& getElement() { + std::vector>& getElement() { return m_listElement; }; /** @@ -177,7 +177,7 @@ namespace ege { * @param[in] _distance Maximum distance search == > return the element distance * @return Pointer on the neares element OR nullptr */ - std::shared_ptr getElementNearest(std::shared_ptr _sourceRequest, float& _distance); + ememory::SharedPtr getElementNearest(ememory::SharedPtr _sourceRequest, float& _distance); void getElementNearest(const vec3& _sourcePosition, float _distanceMax, @@ -189,12 +189,12 @@ namespace ege { * @brief add an element on the list availlable. * @param[in] _newElement Element to add. */ - void addElement(std::shared_ptr _newElement); + void addElement(ememory::SharedPtr _newElement); /** * @brief remove an element on the list availlable. * @param[in] _removeElement Element to remove. */ - void rmElement(std::shared_ptr _removeElement); + void rmElement(ememory::SharedPtr _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. * @param[in,out] _resultList List of the element ordered. @@ -224,12 +224,12 @@ namespace ege { private: void onCallbackPeriodicCall(const ewol::event::Time& _event); protected: - std::vector> m_listMeshToDrawFirst; + std::vector> m_listMeshToDrawFirst; public: - void addStaticMeshToDraw(const std::shared_ptr& _mesh) { + void addStaticMeshToDraw(const ememory::SharedPtr& _mesh) { m_listMeshToDrawFirst.push_back(_mesh); } - const std::vector>& getStaticMeshToDraw() { + const std::vector>& getStaticMeshToDraw() { return m_listMeshToDrawFirst; } virtual void onChangePropertyStatus(); diff --git a/ege/Light.cpp b/ege/Light.cpp index 645a89b..b8bc9c9 100644 --- a/ege/Light.cpp +++ b/ege/Light.cpp @@ -25,7 +25,7 @@ ege::Light::~Light() { } -void ege::Light::link(const std::shared_ptr& _prog, const std::string& _baseName) { +void ege::Light::link(const ememory::SharedPtr& _prog, const std::string& _baseName) { if (_prog == nullptr) { return; } @@ -36,7 +36,7 @@ void ege::Light::link(const std::shared_ptr& _prog, con m_GL_specularColor = _prog->getUniform(_baseName+".specularColor"); } -void ege::Light::draw(const std::shared_ptr& _prog) { +void ege::Light::draw(const 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 5f13d11..311d49e 100644 --- a/ege/Light.h +++ b/ege/Light.h @@ -29,8 +29,8 @@ namespace ege { public: Light(); ~Light(); - void link(const std::shared_ptr& _prog, const std::string& _baseName); - void draw(const std::shared_ptr& _prog); + void link(const ememory::SharedPtr& _prog, const std::string& _baseName); + void draw(const ememory::SharedPtr& _prog); void setDirection(const vec3& val) { m_direction = val; } diff --git a/ege/Material.cpp b/ege/Material.cpp index 005bc07..0c24ec0 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 std::shared_ptr& _prog, const std::string& _baseName) { +void ege::MaterialGlId::link(const ememory::SharedPtr& _prog, const std::string& _baseName) { if (_prog == nullptr) { return; } @@ -42,7 +42,7 @@ ege::Material::~Material() { } -void ege::Material::draw(const std::shared_ptr& _prog, const MaterialGlId& _glID) { +void ege::Material::draw(const 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); @@ -70,7 +70,7 @@ void ege::Material::setTexture0(const std::string& _filename) { ivec2 tmpSize(256, 256); if (_filename != "") { // prevent overloard error : - std::shared_ptr tmpCopy = m_texture0; + ememory::SharedPtr tmpCopy = m_texture0; m_texture0 = ewol::resource::TextureFile::create(_filename, tmpSize); if (m_texture0 == nullptr) { EGE_ERROR("Can not load specific texture : " << _filename); diff --git a/ege/Material.h b/ege/Material.h index bbd2a06..05f4d6b 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 std::shared_ptr& _prog, const std::string& _baseName); + void link(const ememory::SharedPtr& _prog, const std::string& _baseName); }; @@ -36,13 +36,13 @@ namespace ege { vec4 m_specularFactor; float m_shininess; enum gale::openGL::renderMode m_renderMode; // Select Render mode (triangle/Line/point ...) - std::shared_ptr m_texture0; + ememory::SharedPtr m_texture0; public: std::vector m_listIndexFaces; public: Material(); ~Material(); - void draw(const std::shared_ptr& _prog, const ege::MaterialGlId& _glID); + void draw(const ememory::SharedPtr& _prog, const ege::MaterialGlId& _glID); void setAmbientFactor(const vec4& _val) { m_ambientFactor = _val; } diff --git a/ege/Ray.cpp b/ege/Ray.cpp index 84bdbc1..8005222 100644 --- a/ege/Ray.cpp +++ b/ege/Ray.cpp @@ -56,7 +56,7 @@ std::pair ege::Ray::testRay(ege::physics::Engine& _engine) { } -std::pair, std::pair> ege::Ray::testRayObject(ege::physics::Engine& _engine) { +std::pair, std::pair> ege::Ray::testRayObject(ege::physics::Engine& _engine) { vec3 start = m_origin; vec3 stop = m_origin+m_direction*1000.0f; // Start and End are vectors @@ -70,14 +70,14 @@ std::pair, std::pair> ege::Ray::testRay ege::Element* elem = static_cast(rayCallback.m_collisionObject->getUserPointer()); if (elem != nullptr) { EGE_VERBOSE(" hit at point=" << end << " normal=" << normal); - return std::pair, std::pair>(elem->shared_from_this(), std::pair(end,normal)); + return std::pair, std::pair>(elem->sharedFromThis(), std::pair(end,normal)); } EGE_VERBOSE(" Can not get the element pointer"); - return std::pair, std::pair>(nullptr, std::pair(end,normal)); + return std::pair, std::pair>(nullptr, std::pair(end,normal)); } else { EGE_VERBOSE(" No Hit"); } - return std::pair, std::pair>(nullptr, std::pair(vec3(0,0,0),vec3(0,0,0))); + return std::pair, std::pair>(nullptr, std::pair(vec3(0,0,0),vec3(0,0,0))); } vec3 ege::Ray::testRayZeroPlane() { diff --git a/ege/Ray.h b/ege/Ray.h index 8566d53..585c223 100644 --- a/ege/Ray.h +++ b/ege/Ray.h @@ -11,7 +11,7 @@ namespace ege { class Element; }; #include -#include +#include namespace ege { class Ray { @@ -65,7 +65,7 @@ namespace ege { void set(const vec3& _origin, const vec3& _direction); public: std::pair testRay(ege::physics::Engine& _engine); - std::pair, std::pair> testRayObject(ege::physics::Engine& _engine); + std::pair, std::pair> testRayObject(ege::physics::Engine& _engine); vec3 testRayZeroPlane(); }; std::ostream& operator <<(std::ostream& _os, const ege::Ray& _obj); diff --git a/ege/camera/Camera.h b/ege/camera/Camera.h index 72bdf01..d0c7495 100644 --- a/ege/camera/Camera.h +++ b/ege/camera/Camera.h @@ -15,7 +15,7 @@ namespace ege { - class Camera : public std::enable_shared_from_this{ + class Camera : public ememory::EnableSharedFromThis{ public: /** * @brief Constructor. @@ -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 std::shared_ptr& _draw, const std::shared_ptr& _camera) { } + virtual void drawDebug(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera) { } }; } diff --git a/ege/camera/View.cpp b/ege/camera/View.cpp index 0880115..8b2d434 100644 --- a/ege/camera/View.cpp +++ b/ege/camera/View.cpp @@ -90,9 +90,9 @@ ege::Ray ege::camera::View::getRayFromScreen(const vec2& _offset) { return out; } -void ege::camera::View::drawDebug(const std::shared_ptr& _draw, const std::shared_ptr& _camera) { +void ege::camera::View::drawDebug(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera) { mat4 mat; - if (_camera != shared_from_this()) { + if (_camera != sharedFromThis()) { mat.identity(); vec2 angles = tansformPositionToAngle(-getViewVector()); mat.rotate(vec3(0,0,1), angles.x() - M_PI/2.0f); diff --git a/ege/camera/View.h b/ege/camera/View.h index c5034f8..eed0655 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 std::shared_ptr& _draw, const std::shared_ptr& _camera); + virtual void drawDebug(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera); virtual float getTetha(); virtual float getPsy(); }; diff --git a/ege/elements/Element.cpp b/ege/elements/Element.cpp index 6864e66..2287de4 100644 --- a/ege/elements/Element.cpp +++ b/ege/elements/Element.cpp @@ -30,7 +30,7 @@ const std::string& ege::Element::getType() const { } -ege::Element::Element(const std::shared_ptr& _env) : +ege::Element::Element(const ememory::SharedPtr& _env) : m_env(_env), m_uID(0), m_mesh(), @@ -77,7 +77,7 @@ bool ege::Element::unInit() { bool ege::Element::loadMesh(const std::string& _meshFileName) { - std::shared_ptr tmpMesh = ege::resource::Mesh::create(_meshFileName); + ememory::SharedPtr tmpMesh = ege::resource::Mesh::create(_meshFileName); if(tmpMesh == nullptr) { EGE_ERROR("can not load the resources : " << _meshFileName); return false; @@ -85,7 +85,7 @@ bool ege::Element::loadMesh(const std::string& _meshFileName) { return setMesh(tmpMesh); } -bool ege::Element::setMesh(const std::shared_ptr& _mesh) { +bool ege::Element::setMesh(const 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 std::shared_ptr& _draw, const std::shared_ptr& _camera) { +void ege::Element::drawLife(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera) { if (_draw == nullptr) { return; } @@ -168,7 +168,7 @@ void ege::Element::drawLife(const std::shared_ptr& _draw, const std::shared_ptr& _camera) { +void ege::Element::drawDebug(const ememory::SharedPtr& _draw, const 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 040df27..52a2421 100644 --- a/ege/elements/Element.h +++ b/ege/elements/Element.h @@ -25,16 +25,16 @@ #define ELEMENT_SCALE (1.0f/8.0f) namespace ege { - class Element : public std::enable_shared_from_this { + class Element : public ememory::EnableSharedFromThis { protected: - std::shared_ptr m_env; + ememory::SharedPtr m_env; 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... */ - Element(const std::shared_ptr& _env); + Element(const ememory::SharedPtr& _env); /** * @brief Destructor */ @@ -67,7 +67,7 @@ namespace ege { return m_uID; }; protected: - std::shared_ptr m_mesh; //!< Mesh of the Element (can be nullptr) + ememory::SharedPtr m_mesh; //!< Mesh of the Element (can be nullptr) public: /** * @brief Select a mesh with a specific name. @@ -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 std::shared_ptr& _mesh); + virtual bool setMesh(const ememory::SharedPtr& _mesh); /** * @brief get a pointer on the Mesh file. * @return the mesh pointer. */ - inline const std::shared_ptr& getMesh() { + inline const 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 std::shared_ptr& _draw, const std::shared_ptr& _camera); + virtual void drawLife(const ememory::SharedPtr& _draw, const 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 std::shared_ptr& _draw, const std::shared_ptr& _camera); + virtual void drawDebug(const ememory::SharedPtr& _draw, const 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 ... @@ -192,7 +192,7 @@ namespace ege { * @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(std::shared_ptr _removedElement) { }; + virtual void elementIsRemoved(ememory::SharedPtr _removedElement) { }; protected: bool m_fixe; //!< is a fixed element == > used for placement of every elements public: diff --git a/ege/elements/ElementBase.cpp b/ege/elements/ElementBase.cpp index c51c8ca..7f666bb 100644 --- a/ege/elements/ElementBase.cpp +++ b/ege/elements/ElementBase.cpp @@ -8,7 +8,7 @@ #include #include -ege::ElementBase::ElementBase(const std::shared_ptr& _env) : +ege::ElementBase::ElementBase(const ememory::SharedPtr& _env) : ege::Element(_env), m_position(0,0,0) { diff --git a/ege/elements/ElementBase.h b/ege/elements/ElementBase.h index 71657be..2da3e10 100644 --- a/ege/elements/ElementBase.h +++ b/ege/elements/ElementBase.h @@ -16,7 +16,7 @@ namespace ege { * 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... */ - ElementBase(const std::shared_ptr& _env); + ElementBase(const ememory::SharedPtr& _env); /** * @brief Destructor */ diff --git a/ege/elements/ElementPhysic.cpp b/ege/elements/ElementPhysic.cpp index ca0c46e..91655c0 100644 --- a/ege/elements/ElementPhysic.cpp +++ b/ege/elements/ElementPhysic.cpp @@ -29,7 +29,7 @@ const std::string& ege::ElementPhysic::getType() const { } -ege::ElementPhysic::ElementPhysic(const std::shared_ptr& _env, bool _autoRigidBody) ://, float _mass) : +ege::ElementPhysic::ElementPhysic(const ememory::SharedPtr& _env, bool _autoRigidBody) ://, float _mass) : ege::Element(_env), m_body(nullptr), m_shape(nullptr), @@ -72,7 +72,7 @@ void ege::ElementPhysic::createRigidBody(float _mass) { } -bool ege::ElementPhysic::setMesh(const std::shared_ptr& _mesh) { +bool ege::ElementPhysic::setMesh(const ememory::SharedPtr& _mesh) { EGE_WARNING("Set Mesh"); if (nullptr!=m_mesh) { removeShape(); @@ -170,7 +170,7 @@ const float ege::ElementPhysic::getInvMass() { }; void ege::ElementPhysic::drawShape(const btCollisionShape* _shape, - const std::shared_ptr& _draw, + const 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 std::shared_ptr& _draw, const std::shared_ptr& _camera) { +void ege::ElementPhysic::drawDebug(const ememory::SharedPtr& _draw, const 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 a8b7c5b..0b43c0c 100644 --- a/ege/elements/ElementPhysic.h +++ b/ege/elements/ElementPhysic.h @@ -43,7 +43,7 @@ namespace ege { * @param[in] _env glabal ege environement * @param[in] _autoRigidBody add a basic rigid body (not availlable after befor setting a shape) */ - ElementPhysic(const std::shared_ptr& _env, bool _autoRigidBody=true); + ElementPhysic(const ememory::SharedPtr& _env, bool _autoRigidBody=true); /** * @brief Destructor */ @@ -76,7 +76,7 @@ namespace ege { */ void removeShape(); public: - virtual bool setMesh(const std::shared_ptr& _mesh); + virtual bool setMesh(const ememory::SharedPtr& _mesh); /** * @brief draw the curent element (can have multiple display) * @param[in] pass Id of the current pass : [0..?] @@ -86,7 +86,7 @@ namespace ege { /** * @brief draw the current life of the element */ - // virtual void drawLife(const std::shared_ptr& _draw, const std::shared_ptr& _camera); + // virtual void drawLife(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera); // TODO : Remove this ... protected: vec3 m_theoricPosition; @@ -175,10 +175,10 @@ namespace ege { virtual void onDestroy() {}; virtual const vec3& getPosition(); virtual void setPosition(const vec3& _pos); - virtual void drawDebug(const std::shared_ptr& _draw, const std::shared_ptr& _camera); + virtual void drawDebug(const ememory::SharedPtr& _draw, const ememory::SharedPtr& _camera); protected: void drawShape(const btCollisionShape* _shape, - const std::shared_ptr& _draw, + const ememory::SharedPtr& _draw, mat4 _transformationMatrix, std::vector _tmpVertices); protected: @@ -202,7 +202,7 @@ namespace ege { * @param[in] _point Position of the impact in the global world * @param[in] _normal Normal of the impact */ - virtual void onCollisionDetected(const std::shared_ptr& _obj, const vec3& _point, const vec3& _normal) {}; + virtual void onCollisionDetected(const ememory::SharedPtr& _obj, const vec3& _point, const vec3& _normal) {}; }; } diff --git a/ege/physics/Engine.cpp b/ege/physics/Engine.cpp index 9f78849..a335f75 100644 --- a/ege/physics/Engine.cpp +++ b/ege/physics/Engine.cpp @@ -40,10 +40,10 @@ static bool handleContactsProcess(btManifoldPoint& _point, btCollisionObject* _b } EGE_VERBOSE("collision process between " << elem0->getUID() << " && " << elem1->getUID() << " pos=" << _point.getPositionWorldOnA() << " norm=" << _point.m_normalWorldOnB); if (elem0->getCollisionDetectionStatus() == true) { - elem0->onCollisionDetected(elem1->shared_from_this(), _point.getPositionWorldOnA(), -_point.m_normalWorldOnB); + elem0->onCollisionDetected(elem1->sharedFromThis(), _point.getPositionWorldOnA(), -_point.m_normalWorldOnB); } if (elem1->getCollisionDetectionStatus() == true) { - elem1->onCollisionDetected(elem0->shared_from_this(), _point.getPositionWorldOnA(), _point.m_normalWorldOnB); + elem1->onCollisionDetected(elem0->sharedFromThis(), _point.getPositionWorldOnA(), _point.m_normalWorldOnB); } return true; } @@ -65,39 +65,39 @@ ege::physics::Engine::~Engine() { */ } -void ege::physics::Engine::setBulletConfig(std::shared_ptr _collisionConfiguration, - std::shared_ptr _dispatcher, - std::shared_ptr _broadphase, - std::shared_ptr _solver, - std::shared_ptr _dynamicsWorld) { +void ege::physics::Engine::setBulletConfig(ememory::SharedPtr _collisionConfiguration, + ememory::SharedPtr _dispatcher, + ememory::SharedPtr _broadphase, + ememory::SharedPtr _solver, + ememory::SharedPtr _dynamicsWorld) { if (_collisionConfiguration != nullptr) { m_collisionConfiguration = _collisionConfiguration; } else { - m_collisionConfiguration = std::make_shared(); + m_collisionConfiguration = ememory::makeShared(); } ///use the default collision dispatcher. if (_dispatcher != nullptr) { m_dispatcher = _dispatcher; } else { - m_dispatcher = std::make_shared(m_collisionConfiguration.get()); + m_dispatcher = ememory::makeShared(m_collisionConfiguration.get()); } if (_broadphase != nullptr) { m_broadphase = _broadphase; } else { - m_broadphase = std::make_shared(); + m_broadphase = ememory::makeShared(); } ///the default constraint solver. if (_solver != nullptr) { m_solver = _solver; } else { - m_solver = std::make_shared(); + m_solver = ememory::makeShared(); } if (_dynamicsWorld != nullptr) { m_dynamicsWorld = _dynamicsWorld; } else { - m_dynamicsWorld = std::make_shared(m_dispatcher.get(),m_broadphase.get(),m_solver.get(),m_collisionConfiguration.get()); + m_dynamicsWorld = ememory::makeShared(m_dispatcher.get(),m_broadphase.get(),m_solver.get(),m_collisionConfiguration.get()); // By default we set no gravity m_dynamicsWorld->setGravity(btVector3(0,0,0)); } @@ -127,7 +127,7 @@ std::vector ege::physics::Engine::getList for (int j=0;jgetContactPoint(j); if (pt.getDistance()<0.f) { - out.push_back(collisionPoints(elem0->shared_from_this(), elem1->shared_from_this(), pt.getPositionWorldOnA(), pt.getPositionWorldOnB(), pt.m_normalWorldOnB)); + out.push_back(collisionPoints(elem0->sharedFromThis(), elem1->sharedFromThis(), pt.getPositionWorldOnA(), pt.getPositionWorldOnB(), pt.m_normalWorldOnB)); } } } diff --git a/ege/physics/Engine.h b/ege/physics/Engine.h index 528efe0..7b4ea88 100644 --- a/ege/physics/Engine.h +++ b/ege/physics/Engine.h @@ -41,31 +41,31 @@ namespace ege { class Engine { private: ///this is the most important class - std::shared_ptr m_collisionConfiguration; - std::shared_ptr m_dispatcher; - std::shared_ptr m_broadphase; - std::shared_ptr m_solver; - std::shared_ptr m_dynamicsWorld; + ememory::SharedPtr m_collisionConfiguration; + ememory::SharedPtr m_dispatcher; + ememory::SharedPtr m_broadphase; + ememory::SharedPtr m_solver; + ememory::SharedPtr m_dynamicsWorld; public: Engine(); ~Engine(); - void setBulletConfig(std::shared_ptr _collisionConfiguration=nullptr, - std::shared_ptr _dispatcher=nullptr, - std::shared_ptr _broadphase=nullptr, - std::shared_ptr _solver=nullptr, - std::shared_ptr _dynamicsWorld=nullptr); + void setBulletConfig(ememory::SharedPtr _collisionConfiguration=nullptr, + ememory::SharedPtr _dispatcher=nullptr, + ememory::SharedPtr _broadphase=nullptr, + ememory::SharedPtr _solver=nullptr, + ememory::SharedPtr _dynamicsWorld=nullptr); /** * @brief set the curent world * @param[in] _newWorld Pointer on the current world */ - void setDynamicWorld(const std::shared_ptr& _newWorld) { + void setDynamicWorld(const ememory::SharedPtr& _newWorld) { m_dynamicsWorld=_newWorld; }; /** * @brief get the curent world * @return pointer on the current world */ - std::shared_ptr getDynamicWorld() { + ememory::SharedPtr getDynamicWorld() { return m_dynamicsWorld; }; public: @@ -73,13 +73,13 @@ namespace ege { //! @not_in_doc class collisionPoints { public: - std::shared_ptr elem1; - std::shared_ptr elem2; + ememory::SharedPtr elem1; + ememory::SharedPtr elem2; vec3 positionElem1; vec3 positionElem2; vec3 normalElem2; - collisionPoints(const std::shared_ptr& _elem1, - const std::shared_ptr& _elem2, + collisionPoints(const ememory::SharedPtr& _elem1, + const ememory::SharedPtr& _elem2, const vec3& _pos1, const vec3& _pos2, const vec3& _normal) : diff --git a/ege/physicsShape/PhysicsShape.cpp b/ege/physicsShape/PhysicsShape.cpp index be604d1..4a4f12a 100644 --- a/ege/physicsShape/PhysicsShape.cpp +++ b/ege/physicsShape/PhysicsShape.cpp @@ -13,21 +13,21 @@ #include -std::shared_ptr ege::PhysicsShape::create(const std::string& _name) { - std::shared_ptr tmpp = nullptr; +ememory::SharedPtr ege::PhysicsShape::create(const std::string& _name) { + ememory::SharedPtr tmpp = nullptr; std::string name = etk::tolower(_name); if (name == "box") { - tmpp = std::make_shared(); + tmpp = ememory::makeShared(); } else if (name == "sphere") { - tmpp = std::make_shared(); + tmpp = ememory::makeShared(); } else if (name == "cone") { - tmpp = std::make_shared(); + tmpp = ememory::makeShared(); } else if (name == "cylinder") { - tmpp = std::make_shared(); + tmpp = ememory::makeShared(); } else if (name == "capsule") { - tmpp = std::make_shared(); + tmpp = ememory::makeShared(); } else if (name == "convexhull") { - tmpp = std::make_shared(); + tmpp = ememory::makeShared(); } else { EGE_ERROR("Create an unknow element : '" << _name << "' availlable : [BOX,SPHERE,CONE,CYLINDER,CAPSULE,CONVEXHULL]"); return nullptr; diff --git a/ege/physicsShape/PhysicsShape.h b/ege/physicsShape/PhysicsShape.h index ba77004..fa8b2df 100644 --- a/ege/physicsShape/PhysicsShape.h +++ b/ege/physicsShape/PhysicsShape.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include namespace ege { @@ -22,7 +22,7 @@ namespace ege { class PhysicsShape { public: - static std::shared_ptr create(const std::string& _name); + static ememory::SharedPtr create(const std::string& _name); public: enum type { unknow, diff --git a/ege/resource/Mesh.cpp b/ege/resource/Mesh.cpp index 5a8b896..0775125 100644 --- a/ege/resource/Mesh.cpp +++ b/ege/resource/Mesh.cpp @@ -430,7 +430,7 @@ void ege::resource::Mesh::createIcoSphere(const std::string& _materialName,float } -void ege::resource::Mesh::addMaterial(const std::string& _name, std::shared_ptr _data) { +void ege::resource::Mesh::addMaterial(const std::string& _name, ememory::SharedPtr _data) { if (_data == nullptr) { EGE_ERROR(" can not add material with null pointer"); return; diff --git a/ege/resource/Mesh.h b/ege/resource/Mesh.h index fc956cd..fce6c61 100644 --- a/ege/resource/Mesh.h +++ b/ege/resource/Mesh.h @@ -29,11 +29,11 @@ namespace ege { namespace resource { class Mesh : public gale::Resource { public: - static std::shared_ptr createGrid(int32_t _lineCount, + static ememory::SharedPtr createGrid(int32_t _lineCount, const vec3& _position=vec3(0,0,0), float _size=1.0f, const std::string& _materialName="basics"); - static std::shared_ptr createCube(float _size=1.0f, + static ememory::SharedPtr createCube(float _size=1.0f, const std::string& _materialName="basics", const etk::Color& _color=etk::color::white); public: @@ -49,7 +49,7 @@ namespace ege { enum normalMode m_normalMode; // select the normal mode of display bool m_checkNormal; //!< when enable, this check the normal of the mesh before sending it at the 3d card protected: - std::shared_ptr m_GLprogram; + ememory::SharedPtr m_GLprogram; int32_t m_GLPosition; int32_t m_GLMatrix; int32_t m_GLMatrixPosition; @@ -67,11 +67,11 @@ namespace ege { std::vector m_listFacesNormal; //!< List of all Face normal, when calculated std::vector m_listVertexNormal; //!< List of all Face normal, when calculated etk::Hash m_listFaces; //!< List of all Face for the mesh - etk::Hash> m_materials; - std::vector> m_physics; //!< collision shape module ... (independent of bullet lib) + etk::Hash> m_materials; + std::vector> m_physics; //!< collision shape module ... (independent of bullet lib) void clean(); protected: - std::shared_ptr m_verticesVBO; + ememory::SharedPtr m_verticesVBO; protected: Mesh(); void init(const std::string& _fileName="---", const std::string& _shaderName="DATA:textured3D2.prog"); @@ -97,7 +97,7 @@ namespace ege { bool loadOBJ(const std::string& _fileName); bool loadEMF(const std::string& _fileName); public: - void addMaterial(const std::string& _name, std::shared_ptr _data); + void addMaterial(const std::string& _name, ememory::SharedPtr _data); public: /** * @brief set the check of normal position befor sending it to the openGl card @@ -113,10 +113,10 @@ namespace ege { bool getCheckNormal() { return m_checkNormal; }; - const std::vector>& getPhysicalProperties() const { + const std::vector>& getPhysicalProperties() const { return m_physics; }; - void addPhysicElement(const std::shared_ptr& _shape) { + void addPhysicElement(const ememory::SharedPtr& _shape) { m_physics.push_back(_shape); } private: diff --git a/ege/resource/MeshCube.cpp b/ege/resource/MeshCube.cpp index 4a9603e..5b676d2 100644 --- a/ege/resource/MeshCube.cpp +++ b/ege/resource/MeshCube.cpp @@ -7,11 +7,11 @@ #include #include -std::shared_ptr ege::resource::Mesh::createCube(float _size, const std::string& _materialName, const etk::Color& _color) { +ememory::SharedPtr ege::resource::Mesh::createCube(float _size, const std::string& _materialName, const etk::Color& _color) { EGE_ERROR(" create a cube _size=" << _size << " _materialName=" << _materialName << " _color=" << _color); - std::shared_ptr out = ege::resource::Mesh::create("---", "DATA:color3.prog"); + ememory::SharedPtr out = ege::resource::Mesh::create("---", "DATA:color3.prog"); if (out != nullptr) { - std::shared_ptr material = std::make_shared(); + ememory::SharedPtr material = ememory::makeShared(); // set the element material properties : material->setAmbientFactor(vec4(1,1,1,1)); material->setDiffuseFactor(vec4(0,0,0,1)); diff --git a/ege/resource/MeshEmf.cpp b/ege/resource/MeshEmf.cpp index c47914b..a4e680e 100644 --- a/ege/resource/MeshEmf.cpp +++ b/ege/resource/MeshEmf.cpp @@ -171,9 +171,9 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) { int32_t meshFaceMaterialID = -1; // material global param : std::string materialName = ""; - std::shared_ptr material; + ememory::SharedPtr material; // physical shape: - std::shared_ptr physics; + ememory::SharedPtr physics; while (1) { int32_t level = countIndent(fileName); if (level == 0) { @@ -416,7 +416,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) { materialName = ""; material = nullptr; } - material = std::make_shared(); + material = ememory::makeShared(); materialName = inputDataLine; currentMode = EMFModuleMaterialNamed; EGE_VERBOSE(" "<< materialName); diff --git a/ege/resource/MeshGird.cpp b/ege/resource/MeshGird.cpp index c935747..3fe8f8c 100644 --- a/ege/resource/MeshGird.cpp +++ b/ege/resource/MeshGird.cpp @@ -7,10 +7,10 @@ #include #include -std::shared_ptr ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const std::string& _materialName) { - std::shared_ptr out = ege::resource::Mesh::create("---", "DATA:color3.prog"); +ememory::SharedPtr ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const std::string& _materialName) { + ememory::SharedPtr out = ege::resource::Mesh::create("---", "DATA:color3.prog"); if (out != nullptr) { - std::shared_ptr material = std::make_shared(); + ememory::SharedPtr material = ememory::makeShared(); // set the element material properties : material->setAmbientFactor(vec4(1,1,1,1)); material->setDiffuseFactor(vec4(0,0,0,1)); diff --git a/ege/resource/tools/icoSphere.cpp b/ege/resource/tools/icoSphere.cpp index 59268e9..5d37487 100644 --- a/ege/resource/tools/icoSphere.cpp +++ b/ege/resource/tools/icoSphere.cpp @@ -30,7 +30,7 @@ static int32_t addUV(std::vector& _listUV, int32_t _uvId, float _add) { return _listUV.size()-1; } -void ege::icoSphere::create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, +void ege::icoSphere::create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, const std::string& _materialName, float _size, int32_t _recursionLevel) { /* 5 diff --git a/ege/resource/tools/icoSphere.h b/ege/resource/tools/icoSphere.h index 51887e2..bb18dda 100644 --- a/ege/resource/tools/icoSphere.h +++ b/ege/resource/tools/icoSphere.h @@ -12,7 +12,7 @@ namespace ege { namespace icoSphere { - void create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, + void create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, const std::string& _materialName, float _size, int32_t _recursionLevel); } } diff --git a/ege/resource/tools/isoSphere.cpp b/ege/resource/tools/isoSphere.cpp index 1cdbaad..ecb1f59 100644 --- a/ege/resource/tools/isoSphere.cpp +++ b/ege/resource/tools/isoSphere.cpp @@ -7,7 +7,7 @@ #include #include -void ege::isoSphere::create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, +void ege::isoSphere::create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, const std::string& _materialName, int32_t _recursionLevel) { _recursionLevel = std::max(_recursionLevel, 3); float size = 1.0f; diff --git a/ege/resource/tools/isoSphere.h b/ege/resource/tools/isoSphere.h index 53deabc..acea0d3 100644 --- a/ege/resource/tools/isoSphere.h +++ b/ege/resource/tools/isoSphere.h @@ -12,7 +12,7 @@ namespace ege { namespace isoSphere { - void create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, + void create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, const std::string& _materialName, int32_t _recursionLevel); } } diff --git a/ege/resource/tools/viewBox.cpp b/ege/resource/tools/viewBox.cpp index ab49cec..fd0fba2 100644 --- a/ege/resource/tools/viewBox.cpp +++ b/ege/resource/tools/viewBox.cpp @@ -9,7 +9,7 @@ -void ege::viewBox::create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, +void ege::viewBox::create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, const std::string& _materialName, float _size) { // This is the direct generation basis on the .obj system /* diff --git a/ege/resource/tools/viewBox.h b/ege/resource/tools/viewBox.h index 10fdf45..e36fba2 100644 --- a/ege/resource/tools/viewBox.h +++ b/ege/resource/tools/viewBox.h @@ -12,7 +12,7 @@ namespace ege { namespace viewBox { - void create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, + void create(etk::Hash>& _materials, etk::Hash& _listFaces, std::vector& _listVertex, std::vector& _listUV, const std::string& _materialName, float _size); } } diff --git a/ege/widget/Mesh.h b/ege/widget/Mesh.h index 687b2f4..4b0c30a 100644 --- a/ege/widget/Mesh.h +++ b/ege/widget/Mesh.h @@ -20,7 +20,7 @@ namespace ege { private: // mesh name : std::string m_meshName; - std::shared_ptr m_object; + ememory::SharedPtr m_object; // mesh display properties: vec3 m_position; vec3 m_angle; diff --git a/ege/widget/Scene.cpp b/ege/widget/Scene.cpp index 190cb1f..ca8f0c7 100644 --- a/ege/widget/Scene.cpp +++ b/ege/widget/Scene.cpp @@ -26,7 +26,7 @@ #include namespace etk { - template<> std::string to_string >(const std::shared_ptr& _value) { + template<> std::string to_string >(const ememory::SharedPtr& _value) { return "{{ERROR}}"; } }; @@ -89,14 +89,14 @@ void ege::widget::Scene::onDraw() { } // get camera : - std::shared_ptr camera = m_env->getCamera(m_cameraName); + ememory::SharedPtr camera = m_env->getCamera(m_cameraName); if (camera == nullptr) { EGE_ERROR(" can not get camera named: '" << m_cameraName << "'"); return; } //EGE_DEBUG("Draw (start)"); mat4 tmpMatrix; - std::shared_ptr world = m_env->getPhysicEngine().getDynamicWorld(); + ememory::SharedPtr world = m_env->getPhysicEngine().getDynamicWorld(); if (world != nullptr) { m_env->getOrderedElementForDisplay(m_displayElementOrdered, camera->getEye(), camera->getViewVector()); @@ -123,7 +123,7 @@ void ege::widget::Scene::onDraw() { m_displayElementOrdered[iii].element->drawDebug(m_debugDrawProperty, camera); } // Draw debug ... (Camera) - std::map> listCamera = m_env->getCameraList(); + std::map> listCamera = m_env->getCameraList(); for (auto &itCam : listCamera) { if (itCam.second != nullptr) { itCam.second->drawDebug(m_debugDrawProperty, camera); @@ -172,7 +172,7 @@ void ege::widget::Scene::systemDraw(const ewol::DrawProperty& _displayProp) { // here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left gale::openGL::setViewPort(m_origin, m_size); // configure render with the camera... - std::shared_ptr camera = m_env->getCamera(m_cameraName); + ememory::SharedPtr camera = m_env->getCamera(m_cameraName); if (camera != nullptr) { camera->configureOpenGL(); } @@ -191,7 +191,7 @@ void ege::widget::Scene::setCamera(const std::string& _cameraName) { } m_cameraName = _cameraName; // Update camera aspect ratio: - std::shared_ptr camera = m_env->getCamera(m_cameraName); + ememory::SharedPtr camera = m_env->getCamera(m_cameraName); if (camera != nullptr) { camera->setSceenSize(m_size); } @@ -200,12 +200,12 @@ void ege::widget::Scene::setCamera(const std::string& _cameraName) { void ege::widget::Scene::calculateSize() { ewol::Widget::calculateSize(); // Update camera aspect ratio: - std::shared_ptr camera = m_env->getCamera(m_cameraName); + ememory::SharedPtr camera = m_env->getCamera(m_cameraName); if (camera != nullptr) { camera->setSceenSize(m_size); } } #include -template class esignal::ISignal>; +template class esignal::ISignal>; diff --git a/ege/widget/Scene.h b/ege/widget/Scene.h index dbae741..962cb8e 100644 --- a/ege/widget/Scene.h +++ b/ege/widget/Scene.h @@ -35,13 +35,13 @@ namespace ege { class Scene : public ewol::Widget { public: // signals - esignal::ISignal/*, std::shared_ptr*/> signalDisplayDebug; //!< emit a signal to the application to draw the debug (@ref setDebugPhysic) + esignal::ISignal/*, ememory::SharedPtr*/> signalDisplayDebug; //!< emit a signal to the application to draw the debug (@ref setDebugPhysic) // properties eproperty::Value propertyDebugPhysic; //!< display Physic Debug eproperty::Value propertyDebugApplication; //!< display Application Debug protected: - std::shared_ptr m_env; - std::shared_ptr m_debugDrawProperty; + ememory::SharedPtr m_env; + ememory::SharedPtr m_debugDrawProperty; public: protected: /** @@ -51,7 +51,7 @@ namespace ege { Scene(); void init(); public: - void setEnv(std::shared_ptr _env) { + void setEnv(ememory::SharedPtr _env) { m_env = _env; } public: diff --git a/sample/CameraPosition/appl/Windows.cpp b/sample/CameraPosition/appl/Windows.cpp index 25f49de..a29c8d1 100644 --- a/sample/CameraPosition/appl/Windows.cpp +++ b/sample/CameraPosition/appl/Windows.cpp @@ -23,10 +23,10 @@ appl::Windows::Windows() { } -static std::shared_ptr createViewBoxStar() { - std::shared_ptr out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); +static ememory::SharedPtr createViewBoxStar() { + ememory::SharedPtr out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); if (out != nullptr) { - std::shared_ptr material = std::make_shared(); + ememory::SharedPtr material = ememory::makeShared(); // set the element material properties : material->setAmbientFactor(vec4(1,1,1,1)); material->setDiffuseFactor(vec4(0,0,0,1)); @@ -65,14 +65,14 @@ static std::shared_ptr createViewBoxStar() { void appl::Windows::init() { ewol::widget::Windows::init(); - getObjectManager().periodicCall.connect(shared_from_this(), &appl::Windows::onCallbackPeriodicUpdateCamera); + getObjectManager().periodicCall.connect(sharedFromThis(), &appl::Windows::onCallbackPeriodicUpdateCamera); m_env = ege::Environement::create(); // Create basic Camera - m_camera = std::make_shared(vec3(30,30,-100), vec3(0,0,0)); + m_camera = ememory::makeShared(vec3(30,30,-100), vec3(0,0,0)); m_env->addCamera("basic", m_camera); - std::shared_ptr tmpWidget = ege::widget::Scene::create(); + ememory::SharedPtr tmpWidget = ege::widget::Scene::create(); if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -82,7 +82,7 @@ void appl::Windows::init() { tmpWidget->setCamera("basic"); setSubWidget(tmpWidget); } - std::shared_ptr myMesh; + ememory::SharedPtr myMesh; // Create an external box : myMesh = createViewBoxStar(); if (myMesh != nullptr) { diff --git a/sample/CameraPosition/appl/Windows.h b/sample/CameraPosition/appl/Windows.h index 8c569e2..8bdb00c 100644 --- a/sample/CameraPosition/appl/Windows.h +++ b/sample/CameraPosition/appl/Windows.h @@ -14,8 +14,8 @@ namespace appl { class Windows : public ewol::widget::Windows { private: - std::shared_ptr m_env; - std::shared_ptr m_camera; + ememory::SharedPtr m_env; + ememory::SharedPtr m_camera; protected: Windows(); void init(); diff --git a/sample/CameraPosition/appl/main.cpp b/sample/CameraPosition/appl/main.cpp index d46cc3c..e0b1f4c 100644 --- a/sample/CameraPosition/appl/main.cpp +++ b/sample/CameraPosition/appl/main.cpp @@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application { _context.getFontDefault().setUseExternal(true); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); - std::shared_ptr basicWindows = appl::Windows::create(); + ememory::SharedPtr basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); diff --git a/sample/Collision/appl/Windows.cpp b/sample/Collision/appl/Windows.cpp index e16a45a..b76b71a 100644 --- a/sample/Collision/appl/Windows.cpp +++ b/sample/Collision/appl/Windows.cpp @@ -26,10 +26,10 @@ appl::Windows::Windows() { } -static std::shared_ptr createViewBoxStar() { - std::shared_ptr out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); +static ememory::SharedPtr createViewBoxStar() { + ememory::SharedPtr out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); if (out != nullptr) { - std::shared_ptr material = std::make_shared(); + ememory::SharedPtr material = ememory::makeShared(); // set the element material properties : material->setAmbientFactor(vec4(1,1,1,1)); material->setDiffuseFactor(vec4(0,0,0,1)); @@ -68,15 +68,15 @@ static std::shared_ptr createViewBoxStar() { void appl::Windows::init() { ewol::widget::Windows::init(); - getObjectManager().periodicCall.connect(shared_from_this(), &appl::Windows::onCallbackPeriodicCheckCollision); + getObjectManager().periodicCall.connect(sharedFromThis(), &appl::Windows::onCallbackPeriodicCheckCollision); m_env = ege::Environement::create(); // Create basic Camera - m_camera = std::make_shared(vec3(30,30,-100), vec3(0,0,0)); + m_camera = ememory::makeShared(vec3(30,30,-100), vec3(0,0,0)); m_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy))); m_env->addCamera("basic", m_camera); - std::shared_ptr tmpWidget = ege::widget::Scene::create(); + ememory::SharedPtr tmpWidget = ege::widget::Scene::create(); if (tmpWidget == nullptr) { APPL_CRITICAL("Can not allocate widget ==> display might be in error"); } else { @@ -87,7 +87,7 @@ void appl::Windows::init() { setSubWidget(tmpWidget); } - std::shared_ptr myMesh; + ememory::SharedPtr myMesh; // Create an external box : myMesh = createViewBoxStar(); if (myMesh != nullptr) { @@ -100,10 +100,10 @@ void appl::Windows::init() { } myMesh = ege::resource::Mesh::createCube(3); if (myMesh != nullptr) { - //std::shared_ptr element = std::make_shared(m_env); - std::shared_ptr element = std::make_shared(m_env); + //ememory::SharedPtr element = ememory::makeShared(m_env); + ememory::SharedPtr element = ememory::makeShared(m_env); // add physic interface: - std::shared_ptr physic = std::make_shared(); + ememory::SharedPtr physic = ememory::makeShared(); physic->setSize(vec3(3.2,3.2,3.2)); myMesh->addPhysicElement(physic); @@ -116,11 +116,11 @@ void appl::Windows::init() { } myMesh = ege::resource::Mesh::createCube(3); if (myMesh != nullptr) { - //element = std::make_shared(m_env); - std::shared_ptr element = std::make_shared(m_env); + //element = ememory::makeShared(m_env); + ememory::SharedPtr element = ememory::makeShared(m_env); // add physic interface: - std::shared_ptr physic = std::make_shared(); + ememory::SharedPtr physic = ememory::makeShared(); physic->setRadius(4.5f); myMesh->addPhysicElement(physic); @@ -140,11 +140,11 @@ void appl::Windows::init() { namespace appl { class ElementHerit : public ege::ElementPhysic { public: - ElementHerit(const std::shared_ptr& _env, bool _autoRigidBody=true) : + ElementHerit(const ememory::SharedPtr& _env, bool _autoRigidBody=true) : ege::ElementPhysic(_env, _autoRigidBody) { setCollisionDetectionStatus(true); } - virtual void onCollisionDetected(const std::shared_ptr& _obj, const vec3& _point, const vec3& _normal) { + virtual void onCollisionDetected(const ememory::SharedPtr& _obj, const vec3& _point, const vec3& _normal) { APPL_WARNING("[" << getUID() << "] collision : pos=" << _point << " norm=" <<_normal); } }; @@ -158,11 +158,11 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) { vec2 pos = relativePosition(_event.getPos()); ege::Ray ray = m_camera->getRayFromScreenPosition(pos, m_size); - std::shared_ptr myMesh; + ememory::SharedPtr myMesh; myMesh = ege::resource::Mesh::createCube(1, "basics", etk::color::green); if (myMesh != nullptr) { - std::shared_ptr element = std::make_shared(m_env); - std::shared_ptr physic = std::make_shared(); + ememory::SharedPtr element = ememory::makeShared(m_env); + ememory::SharedPtr physic = ememory::makeShared(); physic->setSize(vec3(1.01,1.01,1.01)); myMesh->addPhysicElement(physic); element->setMesh(myMesh); diff --git a/sample/Collision/appl/Windows.h b/sample/Collision/appl/Windows.h index 1a34278..78df1fc 100644 --- a/sample/Collision/appl/Windows.h +++ b/sample/Collision/appl/Windows.h @@ -15,8 +15,8 @@ namespace appl { class Windows : public ewol::widget::Windows { private: - std::shared_ptr m_env; - std::shared_ptr m_camera; + ememory::SharedPtr m_env; + ememory::SharedPtr m_camera; protected: Windows(); void init(); diff --git a/sample/Collision/appl/main.cpp b/sample/Collision/appl/main.cpp index d46cc3c..e0b1f4c 100644 --- a/sample/Collision/appl/main.cpp +++ b/sample/Collision/appl/main.cpp @@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application { _context.getFontDefault().setUseExternal(true); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); - std::shared_ptr basicWindows = appl::Windows::create(); + ememory::SharedPtr basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); diff --git a/sample/DoubleView/appl/Windows.cpp b/sample/DoubleView/appl/Windows.cpp index 18e772f..b31436f 100644 --- a/sample/DoubleView/appl/Windows.cpp +++ b/sample/DoubleView/appl/Windows.cpp @@ -26,10 +26,10 @@ appl::Windows::Windows() { } -static std::shared_ptr createViewBoxStar() { - std::shared_ptr out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); +static ememory::SharedPtr createViewBoxStar() { + ememory::SharedPtr out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); if (out != nullptr) { - std::shared_ptr material = std::make_shared(); + ememory::SharedPtr material = ememory::makeShared(); // set the element material properties : material->setAmbientFactor(vec4(1,1,1,1)); material->setDiffuseFactor(vec4(0,0,0,1)); @@ -70,26 +70,26 @@ void appl::Windows::init() { m_env = ege::Environement::create(); // Create basic Camera - m_camera = std::make_shared(vec3(30,30,-100), vec3(0,0,0)); + m_camera = ememory::makeShared(vec3(30,30,-100), vec3(0,0,0)); m_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy))); m_env->addCamera("basic", m_camera); // Create basic Camera - std::shared_ptr camera2 = std::make_shared(vec3(100,0,0), vec3(0,0,0)); + ememory::SharedPtr camera2 = ememory::makeShared(vec3(100,0,0), vec3(0,0,0)); m_env->addCamera("front", camera2); // Create basic Camera - std::shared_ptr camera3 = std::make_shared(vec3(20,20,100), vec3(0,0,0)); + ememory::SharedPtr camera3 = ememory::makeShared(vec3(20,20,100), vec3(0,0,0)); m_env->addCamera("top", camera3); // Create basic Camera - std::shared_ptr camera4 = std::make_shared(vec3(0,100,0), vec3(0,0,0)); + ememory::SharedPtr camera4 = ememory::makeShared(vec3(0,100,0), vec3(0,0,0)); m_env->addCamera("left", camera4); - std::shared_ptr tmpSizerVert = ewol::widget::Sizer::create(); + ememory::SharedPtr tmpSizerVert = ewol::widget::Sizer::create(); if (tmpSizerVert == nullptr) { APPL_CRITICAL("Can not allocate widget ==> display might be in error"); } else { tmpSizerVert->propertyMode.set(ewol::widget::Sizer::modeVert); setSubWidget(tmpSizerVert); - std::shared_ptr tmpWidget = ege::widget::Scene::create(); + ememory::SharedPtr tmpWidget = ege::widget::Scene::create(); if (tmpWidget == nullptr) { APPL_CRITICAL("Can not allocate widget ==> display might be in error"); } else { @@ -99,7 +99,7 @@ void appl::Windows::init() { tmpWidget->setCamera("basic"); tmpSizerVert->subWidgetAdd(tmpWidget); } - std::shared_ptr tmpSizerHori = ewol::widget::Sizer::create(); + ememory::SharedPtr tmpSizerHori = ewol::widget::Sizer::create(); if (tmpSizerHori == nullptr) { APPL_CRITICAL("Can not allocate widget ==> display might be in error"); } else { @@ -128,7 +128,7 @@ void appl::Windows::init() { } } - std::shared_ptr myMesh; + ememory::SharedPtr myMesh; // Create an external box : myMesh = createViewBoxStar(); if (myMesh != nullptr) { @@ -141,10 +141,10 @@ void appl::Windows::init() { } myMesh = ege::resource::Mesh::createCube(3); if (myMesh != nullptr) { - //std::shared_ptr element = std::make_shared(m_env); - std::shared_ptr element = std::make_shared(m_env); + //ememory::SharedPtr element = ememory::makeShared(m_env); + ememory::SharedPtr element = ememory::makeShared(m_env); // add physic interface: - std::shared_ptr physic = std::make_shared(); + ememory::SharedPtr physic = ememory::makeShared(); physic->setSize(vec3(3.2,3.2,3.2)); myMesh->addPhysicElement(physic); @@ -156,11 +156,11 @@ void appl::Windows::init() { } myMesh = ege::resource::Mesh::createCube(3); if (myMesh != nullptr) { - //element = std::make_shared(m_env); - std::shared_ptr element = std::make_shared(m_env); + //element = ememory::makeShared(m_env); + ememory::SharedPtr element = ememory::makeShared(m_env); // add physic interface: - std::shared_ptr physic = std::make_shared(); + ememory::SharedPtr physic = ememory::makeShared(); physic->setRadius(4.5f); myMesh->addPhysicElement(physic); diff --git a/sample/DoubleView/appl/Windows.h b/sample/DoubleView/appl/Windows.h index b3fc66e..5857749 100644 --- a/sample/DoubleView/appl/Windows.h +++ b/sample/DoubleView/appl/Windows.h @@ -15,8 +15,8 @@ namespace appl { class Windows : public ewol::widget::Windows { private: - std::shared_ptr m_env; - std::shared_ptr m_camera; + ememory::SharedPtr m_env; + ememory::SharedPtr m_camera; protected: Windows(); void init(); diff --git a/sample/DoubleView/appl/main.cpp b/sample/DoubleView/appl/main.cpp index d46cc3c..e0b1f4c 100644 --- a/sample/DoubleView/appl/main.cpp +++ b/sample/DoubleView/appl/main.cpp @@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application { _context.getFontDefault().setUseExternal(true); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); - std::shared_ptr basicWindows = appl::Windows::create(); + ememory::SharedPtr basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); diff --git a/sample/MeshCreator/appl/Windows.cpp b/sample/MeshCreator/appl/Windows.cpp index dc8452f..cc176fe 100644 --- a/sample/MeshCreator/appl/Windows.cpp +++ b/sample/MeshCreator/appl/Windows.cpp @@ -22,10 +22,10 @@ appl::Windows::Windows() { propertyTitle.setDirectCheck("example ege: MeshCreator"); } -static std::shared_ptr createViewBoxStar() { - std::shared_ptr out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog"); +static ememory::SharedPtr createViewBoxStar() { + ememory::SharedPtr out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog"); if (out != nullptr) { - std::shared_ptr material = std::make_shared(); + ememory::SharedPtr material = ememory::makeShared(); // set the element material properties : material->setAmbientFactor(vec4(1,1,1,1)); material->setDiffuseFactor(vec4(0,0,0,1)); @@ -57,10 +57,10 @@ static std::shared_ptr createViewBoxStar() { return out; } -static std::shared_ptr createMars() { - std::shared_ptr out = ege::resource::Mesh::create("---"); +static ememory::SharedPtr createMars() { + ememory::SharedPtr out = ege::resource::Mesh::create("---"); if (out != nullptr) { - std::shared_ptr material = std::make_shared(); + ememory::SharedPtr material = ememory::makeShared(); material->setAmbientFactor(vec4(0.112f,0.112f,0.112f,1.0f)); material->setDiffuseFactor(vec4(0.512f,0.512f,0.512f,1.0f)); material->setSpecularFactor(vec4(0.5f,0.5f,0.5f,1.0f)); @@ -77,14 +77,14 @@ static std::shared_ptr createMars() { void appl::Windows::init() { ewol::widget::Windows::init(); - getObjectManager().periodicCall.connect(shared_from_this(), &appl::Windows::onCallbackPeriodicUpdateCamera); + getObjectManager().periodicCall.connect(sharedFromThis(), &appl::Windows::onCallbackPeriodicUpdateCamera); m_env = ege::Environement::create(); // Create basic Camera - m_camera = std::make_shared(vec3(30,30,-100), vec3(50,0,0)); + m_camera = ememory::makeShared(vec3(30,30,-100), vec3(50,0,0)); m_env->addCamera("basic", m_camera); - std::shared_ptr tmpWidget = ege::widget::Scene::create(); + ememory::SharedPtr tmpWidget = ege::widget::Scene::create(); if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -95,7 +95,7 @@ void appl::Windows::init() { setSubWidget(tmpWidget); } // Create an external box : - std::shared_ptr myMesh = createViewBoxStar(); + ememory::SharedPtr myMesh = createViewBoxStar(); if (myMesh != nullptr) { m_env->addStaticMeshToDraw(myMesh); } @@ -106,8 +106,8 @@ void appl::Windows::init() { if (true) { myMesh = createMars(); if (myMesh != nullptr) { - std::shared_ptr element = std::make_shared(m_env); - //std::shared_ptr element = std::make_shared(m_env); + ememory::SharedPtr element = ememory::makeShared(m_env); + //ememory::SharedPtr element = ememory::makeShared(m_env); element->setPosition(vec3(50,0,0)); element->setMesh(myMesh); m_env->addElement(element); diff --git a/sample/MeshCreator/appl/Windows.h b/sample/MeshCreator/appl/Windows.h index 8c569e2..8bdb00c 100644 --- a/sample/MeshCreator/appl/Windows.h +++ b/sample/MeshCreator/appl/Windows.h @@ -14,8 +14,8 @@ namespace appl { class Windows : public ewol::widget::Windows { private: - std::shared_ptr m_env; - std::shared_ptr m_camera; + ememory::SharedPtr m_env; + ememory::SharedPtr m_camera; protected: Windows(); void init(); diff --git a/sample/MeshCreator/appl/main.cpp b/sample/MeshCreator/appl/main.cpp index d46cc3c..e0b1f4c 100644 --- a/sample/MeshCreator/appl/main.cpp +++ b/sample/MeshCreator/appl/main.cpp @@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application { _context.getFontDefault().setUseExternal(true); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); - std::shared_ptr basicWindows = appl::Windows::create(); + ememory::SharedPtr basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); diff --git a/sample/RayTest/appl/Windows.cpp b/sample/RayTest/appl/Windows.cpp index 6e8c432..2643661 100644 --- a/sample/RayTest/appl/Windows.cpp +++ b/sample/RayTest/appl/Windows.cpp @@ -26,10 +26,10 @@ appl::Windows::Windows() : propertyTitle.setDirectCheck("example ege: RayTest"); } -static std::shared_ptr createViewBoxStar() { - std::shared_ptr out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); +static ememory::SharedPtr createViewBoxStar() { + ememory::SharedPtr out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); if (out != nullptr) { - std::shared_ptr material = std::make_shared(); + ememory::SharedPtr material = ememory::makeShared(); // set the element material properties : material->setAmbientFactor(vec4(1,1,1,1)); material->setDiffuseFactor(vec4(0,0,0,1)); @@ -69,11 +69,11 @@ void appl::Windows::init() { m_env = ege::Environement::create(); // Create basic Camera - m_camera = std::make_shared(vec3(30,30,-100), vec3(0,0,0)); + m_camera = ememory::makeShared(vec3(30,30,-100), vec3(0,0,0)); m_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy))); m_env->addCamera("basic", m_camera); - std::shared_ptr tmpWidget = ege::widget::Scene::create(); + ememory::SharedPtr tmpWidget = ege::widget::Scene::create(); if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -82,9 +82,9 @@ void appl::Windows::init() { tmpWidget->propertyFill.set(bvec2(true,true)); tmpWidget->setCamera("basic"); setSubWidget(tmpWidget); - tmpWidget->signalDisplayDebug.connect(shared_from_this(), &appl::Windows::onCallbackDisplayDebug); + tmpWidget->signalDisplayDebug.connect(sharedFromThis(), &appl::Windows::onCallbackDisplayDebug); } - std::shared_ptr myMesh; + ememory::SharedPtr myMesh; // Create an external box : myMesh = createViewBoxStar(); if (myMesh != nullptr) { @@ -97,10 +97,10 @@ void appl::Windows::init() { } myMesh = ege::resource::Mesh::createCube(3); if (myMesh != nullptr) { - //std::shared_ptr element = std::make_shared(m_env); - std::shared_ptr element = std::make_shared(m_env); + //ememory::SharedPtr element = ememory::makeShared(m_env); + ememory::SharedPtr element = ememory::makeShared(m_env); // add physic interface: - std::shared_ptr physic = std::make_shared(); + ememory::SharedPtr physic = ememory::makeShared(); physic->setSize(vec3(3.2,3.2,3.2)); myMesh->addPhysicElement(physic); @@ -112,11 +112,11 @@ void appl::Windows::init() { } myMesh = ege::resource::Mesh::createCube(3); if (myMesh != nullptr) { - //element = std::make_shared(m_env); - std::shared_ptr element = std::make_shared(m_env); + //element = ememory::makeShared(m_env); + ememory::SharedPtr element = ememory::makeShared(m_env); // add physic interface: - std::shared_ptr physic = std::make_shared(); + ememory::SharedPtr physic = ememory::makeShared(); physic->setRadius(4.5f); myMesh->addPhysicElement(physic); @@ -140,7 +140,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) { m_ray = ray; APPL_DEBUG("pos=" << pos << " ray = " << ray); m_destination = ray.testRay(m_env->getPhysicEngine()); - std::pair, std::pair> result = ray.testRayObject(m_env->getPhysicEngine()); + std::pair, std::pair> result = ray.testRayObject(m_env->getPhysicEngine()); if (result.first != nullptr) { APPL_INFO("Select Object :" << result.first->getUID()); } @@ -170,7 +170,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) { return false; } -void appl::Windows::onCallbackDisplayDebug(const std::shared_ptr& _obj) { +void appl::Windows::onCallbackDisplayDebug(const ememory::SharedPtr& _obj) { mat4 mat; mat.identity(); // Display ray line diff --git a/sample/RayTest/appl/Windows.h b/sample/RayTest/appl/Windows.h index 4185ebf..65e8481 100644 --- a/sample/RayTest/appl/Windows.h +++ b/sample/RayTest/appl/Windows.h @@ -15,8 +15,8 @@ namespace appl { class Windows : public ewol::widget::Windows { private: - std::shared_ptr m_env; - std::shared_ptr m_camera; + ememory::SharedPtr m_env; + ememory::SharedPtr m_camera; protected: Windows(); void init(); @@ -25,7 +25,7 @@ namespace appl { virtual ~Windows() { }; private: bool onEventInput(const ewol::event::Input& _event); - void onCallbackDisplayDebug(const std::shared_ptr& _obj); + void onCallbackDisplayDebug(const ememory::SharedPtr& _obj); ege::Ray m_ray; float m_angleTetha; float m_anglePsy; diff --git a/sample/RayTest/appl/main.cpp b/sample/RayTest/appl/main.cpp index d46cc3c..e0b1f4c 100644 --- a/sample/RayTest/appl/main.cpp +++ b/sample/RayTest/appl/main.cpp @@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application { _context.getFontDefault().setUseExternal(true); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); - std::shared_ptr basicWindows = appl::Windows::create(); + ememory::SharedPtr basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");