[DEV] update new ememory::SharedPtr

This commit is contained in:
Edouard DUPIN 2016-07-15 21:22:11 +02:00
parent bf2c8bdc8c
commit 1a97ed92ac
52 changed files with 250 additions and 250 deletions

View File

@ -22,12 +22,12 @@
// Documentetion of bullet library : // Documentetion of bullet library :
// http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes // http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes
btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resource::Mesh>& _mesh) { btCollisionShape* ege::collision::createShape(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
if (_mesh == nullptr) { if (_mesh == nullptr) {
EGE_DEBUG("Create empty shape (no mesh)"); EGE_DEBUG("Create empty shape (no mesh)");
return new btEmptyShape();; return new btEmptyShape();;
} }
const std::vector<std::shared_ptr<ege::PhysicsShape>>& physiqueProperty = _mesh->getPhysicalProperties(); const std::vector<ememory::SharedPtr<ege::PhysicsShape>>& physiqueProperty = _mesh->getPhysicalProperties();
if (physiqueProperty.size() == 0) { if (physiqueProperty.size() == 0) {
EGE_DEBUG("Create empty shape (no default shape)"); EGE_DEBUG("Create empty shape (no default shape)");
return new btEmptyShape();; return new btEmptyShape();;

View File

@ -11,7 +11,7 @@
namespace ege { namespace ege {
namespace collision { namespace collision {
btCollisionShape* createShape(const std::shared_ptr<ege::resource::Mesh>& _mesh); btCollisionShape* createShape(const ememory::SharedPtr<ege::resource::Mesh>& _mesh);
} }
} }

View File

@ -24,12 +24,12 @@
#include <btBulletDynamicsCommon.h> #include <btBulletDynamicsCommon.h>
#include <BulletCollision/CollisionDispatch/btCollisionObject.h> #include <BulletCollision/CollisionDispatch/btCollisionObject.h>
std::shared_ptr<ege::Element> ege::Environement::getElementNearest(std::shared_ptr<ege::Element> _sourceRequest, float& _distance) { ememory::SharedPtr<ege::Element> ege::Environement::getElementNearest(ememory::SharedPtr<ege::Element> _sourceRequest, float& _distance) {
if (_sourceRequest == nullptr) { if (_sourceRequest == nullptr) {
return nullptr; return nullptr;
} }
vec3 sourcePosition = _sourceRequest->getPosition(); vec3 sourcePosition = _sourceRequest->getPosition();
std::shared_ptr<ege::Element> result = nullptr; ememory::SharedPtr<ege::Element> result = nullptr;
for (size_t iii=0; iii<m_listElement.size() ; iii++) { for (size_t iii=0; iii<m_listElement.size() ; iii++) {
// chack nullptr pointer // chack nullptr pointer
if (m_listElement[iii] == nullptr) { if (m_listElement[iii] == nullptr) {
@ -135,7 +135,7 @@ void ege::Environement::addCreator(const std::string& _type, ege::createElement_
} }
std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string& _type, const std::string& _description, bool _autoAddElement) { ememory::SharedPtr<ege::Element> ege::Environement::createElement(const std::string& _type, const std::string& _description, bool _autoAddElement) {
if (getHachTableCreating().exist(_type) == false) { if (getHachTableCreating().exist(_type) == false) {
EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
return nullptr; return nullptr;
@ -145,7 +145,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'");
return nullptr; return nullptr;
} }
std::shared_ptr<ege::Element> tmpElement = creatorPointer(std::dynamic_pointer_cast<ege::Environement>(shared_from_this())); ememory::SharedPtr<ege::Element> tmpElement = creatorPointer(ememory::dynamicPointerCast<ege::Environement>(sharedFromThis()));
if (tmpElement == nullptr) { if (tmpElement == nullptr) {
EGE_ERROR("allocation error '" << _type << "'"); EGE_ERROR("allocation error '" << _type << "'");
return nullptr; return nullptr;
@ -160,7 +160,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
return tmpElement; return tmpElement;
} }
std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement) { ememory::SharedPtr<ege::Element> ege::Environement::createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement) {
if (getHachTableCreating().exist(_type) == false) { if (getHachTableCreating().exist(_type) == false) {
EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
return nullptr; return nullptr;
@ -170,7 +170,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'");
return nullptr; return nullptr;
} }
std::shared_ptr<ege::Element> tmpElement = creatorPointer(std::dynamic_pointer_cast<ege::Environement>(shared_from_this())); ememory::SharedPtr<ege::Element> tmpElement = creatorPointer(ememory::dynamicPointerCast<ege::Environement>(sharedFromThis()));
if (tmpElement == nullptr) { if (tmpElement == nullptr) {
EGE_ERROR("allocation error '" << _type << "'"); EGE_ERROR("allocation error '" << _type << "'");
return nullptr; return nullptr;
@ -185,7 +185,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
return tmpElement; return tmpElement;
} }
std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement) { ememory::SharedPtr<ege::Element> ege::Environement::createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement) {
if (getHachTableCreating().exist(_type) == false) { if (getHachTableCreating().exist(_type) == false) {
EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
return nullptr; return nullptr;
@ -195,7 +195,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'");
return nullptr; return nullptr;
} }
std::shared_ptr<ege::Element> tmpElement = creatorPointer(std::dynamic_pointer_cast<ege::Environement>(shared_from_this())); ememory::SharedPtr<ege::Element> tmpElement = creatorPointer(ememory::dynamicPointerCast<ege::Environement>(sharedFromThis()));
if (tmpElement == nullptr) { if (tmpElement == nullptr) {
EGE_ERROR("allocation error '" << _type << "'"); EGE_ERROR("allocation error '" << _type << "'");
return nullptr; return nullptr;
@ -210,7 +210,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
return tmpElement; return tmpElement;
} }
std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string& _type, void* _data, bool _autoAddElement) { ememory::SharedPtr<ege::Element> ege::Environement::createElement(const std::string& _type, void* _data, bool _autoAddElement) {
if (getHachTableCreating().exist(_type) == false) { if (getHachTableCreating().exist(_type) == false) {
EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
return nullptr; return nullptr;
@ -220,7 +220,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'");
return nullptr; return nullptr;
} }
std::shared_ptr<ege::Element> tmpElement = creatorPointer(std::dynamic_pointer_cast<ege::Environement>(shared_from_this())); ememory::SharedPtr<ege::Element> tmpElement = creatorPointer(ememory::dynamicPointerCast<ege::Environement>(sharedFromThis()));
if (tmpElement == nullptr) { if (tmpElement == nullptr) {
EGE_ERROR("allocation error '" << _type << "'"); EGE_ERROR("allocation error '" << _type << "'");
return nullptr; return nullptr;
@ -235,7 +235,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
return tmpElement; return tmpElement;
} }
std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string& _type, bool _autoAddElement) { ememory::SharedPtr<ege::Element> ege::Environement::createElement(const std::string& _type, bool _autoAddElement) {
if (getHachTableCreating().exist(_type) == false) { if (getHachTableCreating().exist(_type) == false) {
EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
return nullptr; return nullptr;
@ -245,7 +245,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'"); EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'");
return nullptr; return nullptr;
} }
std::shared_ptr<ege::Element> tmpElement = creatorPointer(std::dynamic_pointer_cast<ege::Environement>(shared_from_this())); ememory::SharedPtr<ege::Element> tmpElement = creatorPointer(ememory::dynamicPointerCast<ege::Environement>(sharedFromThis()));
if (tmpElement == nullptr) { if (tmpElement == nullptr) {
EGE_ERROR("allocation error '" << _type << "'"); EGE_ERROR("allocation error '" << _type << "'");
return nullptr; return nullptr;
@ -260,7 +260,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
return tmpElement; return tmpElement;
} }
void ege::Environement::addElement(std::shared_ptr<ege::Element> _newElement) { void ege::Environement::addElement(ememory::SharedPtr<ege::Element> _newElement) {
// prevent memory allocation and un allocation ... // prevent memory allocation and un allocation ...
if (_newElement == nullptr) { if (_newElement == nullptr) {
return; return;
@ -276,7 +276,7 @@ void ege::Environement::addElement(std::shared_ptr<ege::Element> _newElement) {
_newElement->dynamicEnable(); _newElement->dynamicEnable();
} }
void ege::Environement::rmElement(std::shared_ptr<ege::Element> _removeElement) { void ege::Environement::rmElement(ememory::SharedPtr<ege::Element> _removeElement) {
if (_removeElement == nullptr) { if (_removeElement == nullptr) {
return; 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<ege::Camera>& _camera) { void ege::Environement::addCamera(const std::string& _name, const ememory::SharedPtr<ege::Camera>& _camera) {
m_listCamera.insert(std::make_pair(_name, _camera)); m_listCamera.insert(std::make_pair(_name, _camera));
} }
std::shared_ptr<ege::Camera> ege::Environement::getCamera(const std::string& _name) { ememory::SharedPtr<ege::Camera> ege::Environement::getCamera(const std::string& _name) {
auto cameraIt = m_listCamera.find(_name); auto cameraIt = m_listCamera.find(_name);
if (cameraIt != m_listCamera.end()) { if (cameraIt != m_listCamera.end()) {
return cameraIt->second; return cameraIt->second;

View File

@ -30,7 +30,7 @@ class btDynamicsWorld;
namespace ege { namespace ege {
class Element; class Element;
class Environement; class Environement;
typedef std::shared_ptr<ege::Element> (*createElement_tf)(const std::shared_ptr<ege::Environement>& _env); typedef ememory::SharedPtr<ege::Element> (*createElement_tf)(const ememory::SharedPtr<ege::Environement>& _env);
enum gameStatus { enum gameStatus {
gameStart, gameStart,
@ -84,9 +84,9 @@ namespace ege {
eproperty::List<enum gameStatus> propertyStatus; //!< the display is running (not in pause) eproperty::List<enum gameStatus> propertyStatus; //!< the display is running (not in pause)
eproperty::Value<float> propertyRatio; //!< Speed ratio eproperty::Value<float> propertyRatio; //!< Speed ratio
private: private:
//std::shared_ptr<btDynamicsWorld> m_dynamicsWorld; //!< curent system world description //ememory::SharedPtr<btDynamicsWorld> m_dynamicsWorld; //!< curent system world description
ege::physics::Engine m_physicEngine; //!< EGE physic engine interface. ege::physics::Engine m_physicEngine; //!< EGE physic engine interface.
std::vector<std::shared_ptr<ege::Element>> m_listElement; //!< List of all element added in the Game std::vector<ememory::SharedPtr<ege::Element>> m_listElement; //!< List of all element added in the Game
protected: protected:
Environement(); Environement();
public: public:
@ -94,25 +94,25 @@ namespace ege {
virtual ~Environement() { }; virtual ~Environement() { };
protected: protected:
protected: protected:
std::map<std::string, std::shared_ptr<ege::Camera>> m_listCamera; //!< list of all camera in the world std::map<std::string, ememory::SharedPtr<ege::Camera>> m_listCamera; //!< list of all camera in the world
public: public:
/** /**
* @brief Add a camera in the camera pool. * @brief Add a camera in the camera pool.
* @param[in] _name Name of the camera. * @param[in] _name Name of the camera.
* @param[in] _camera Pointer on the camera to add. * @param[in] _camera Pointer on the camera to add.
*/ */
void addCamera(const std::string& _name, const std::shared_ptr<ege::Camera>& _camera); void addCamera(const std::string& _name, const ememory::SharedPtr<ege::Camera>& _camera);
/** /**
* @brief Get a specific camera. * @brief Get a specific camera.
* @param[in] _name Name of the camera. * @param[in] _name Name of the camera.
* @return A pointer on the camera requested. * @return A pointer on the camera requested.
*/ */
std::shared_ptr<ege::Camera> getCamera(const std::string& _name); ememory::SharedPtr<ege::Camera> getCamera(const std::string& _name);
/** /**
* @brief Get List of all camera. * @brief Get List of all camera.
* @return All the camera registerred. * @return All the camera registerred.
*/ */
std::map<std::string, std::shared_ptr<ege::Camera>> getCameraList() const { std::map<std::string, ememory::SharedPtr<ege::Camera>> getCameraList() const {
return m_listCamera; return m_listCamera;
} }
public: 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. * @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... * @note Pointer is return in case of setting properties on it...
*/ */
std::shared_ptr<ege::Element> createElement(const std::string& _type, const std::string& _description, bool _autoAddElement=true); ememory::SharedPtr<ege::Element> createElement(const std::string& _type, const std::string& _description, bool _autoAddElement=true);
std::shared_ptr<ege::Element> createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement=true); ememory::SharedPtr<ege::Element> createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement=true);
std::shared_ptr<ege::Element> createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement=true); ememory::SharedPtr<ege::Element> createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement=true);
std::shared_ptr<ege::Element> createElement(const std::string& _type, void* _data, bool _autoAddElement=true); ememory::SharedPtr<ege::Element> createElement(const std::string& _type, void* _data, bool _autoAddElement=true);
std::shared_ptr<ege::Element> createElement(const std::string& _type, bool _autoAddElement=true); ememory::SharedPtr<ege::Element> createElement(const std::string& _type, bool _autoAddElement=true);
public: public:
class ResultNearestElement { class ResultNearestElement {
public: public:
std::shared_ptr<ege::Element> element; ememory::SharedPtr<ege::Element> element;
float dist; float dist;
}; };
#if 0 #if 0
@ -150,14 +150,14 @@ namespace ege {
* @brief set the curent world * @brief set the curent world
* @param[in] _newWorld Pointer on the current world * @param[in] _newWorld Pointer on the current world
*/ */
void setDynamicWorld(const std::shared_ptr<btDynamicsWorld>& _newWorld) { void setDynamicWorld(const ememory::SharedPtr<btDynamicsWorld>& _newWorld) {
m_dynamicsWorld=_newWorld; m_dynamicsWorld=_newWorld;
}; };
/** /**
* @brief get the curent world * @brief get the curent world
* @return pointer on the current world * @return pointer on the current world
*/ */
std::shared_ptr<btDynamicsWorld> getDynamicWorld() { ememory::SharedPtr<btDynamicsWorld> getDynamicWorld() {
return m_dynamicsWorld; return m_dynamicsWorld;
}; };
#endif #endif
@ -168,7 +168,7 @@ namespace ege {
* @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 * @return all element list
*/ */
std::vector<std::shared_ptr<ege::Element>>& getElement() { std::vector<ememory::SharedPtr<ege::Element>>& getElement() {
return m_listElement; return m_listElement;
}; };
/** /**
@ -177,7 +177,7 @@ namespace ege {
* @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 nullptr * @return Pointer on the neares element OR nullptr
*/ */
std::shared_ptr<ege::Element> getElementNearest(std::shared_ptr<ege::Element> _sourceRequest, float& _distance); ememory::SharedPtr<ege::Element> getElementNearest(ememory::SharedPtr<ege::Element> _sourceRequest, float& _distance);
void getElementNearest(const vec3& _sourcePosition, void getElementNearest(const vec3& _sourcePosition,
float _distanceMax, float _distanceMax,
@ -189,12 +189,12 @@ namespace ege {
* @brief add an element on the list availlable. * @brief add an element on the list availlable.
* @param[in] _newElement Element to add. * @param[in] _newElement Element to add.
*/ */
void addElement(std::shared_ptr<ege::Element> _newElement); void addElement(ememory::SharedPtr<ege::Element> _newElement);
/** /**
* @brief remove an element on the list availlable. * @brief remove an element on the list availlable.
* @param[in] _removeElement Element to remove. * @param[in] _removeElement Element to remove.
*/ */
void rmElement(std::shared_ptr<ege::Element> _removeElement); void rmElement(ememory::SharedPtr<ege::Element> _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,out] _resultList List of the element ordered.
@ -224,12 +224,12 @@ namespace ege {
private: private:
void onCallbackPeriodicCall(const ewol::event::Time& _event); void onCallbackPeriodicCall(const ewol::event::Time& _event);
protected: protected:
std::vector<std::shared_ptr<ege::resource::Mesh>> m_listMeshToDrawFirst; std::vector<ememory::SharedPtr<ege::resource::Mesh>> m_listMeshToDrawFirst;
public: public:
void addStaticMeshToDraw(const std::shared_ptr<ege::resource::Mesh>& _mesh) { void addStaticMeshToDraw(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
m_listMeshToDrawFirst.push_back(_mesh); m_listMeshToDrawFirst.push_back(_mesh);
} }
const std::vector<std::shared_ptr<ege::resource::Mesh>>& getStaticMeshToDraw() { const std::vector<ememory::SharedPtr<ege::resource::Mesh>>& getStaticMeshToDraw() {
return m_listMeshToDrawFirst; return m_listMeshToDrawFirst;
} }
virtual void onChangePropertyStatus(); virtual void onChangePropertyStatus();

View File

@ -25,7 +25,7 @@ ege::Light::~Light() {
} }
void ege::Light::link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName) { void ege::Light::link(const ememory::SharedPtr<gale::resource::Program>& _prog, const std::string& _baseName) {
if (_prog == nullptr) { if (_prog == nullptr) {
return; return;
} }
@ -36,7 +36,7 @@ void ege::Light::link(const std::shared_ptr<gale::resource::Program>& _prog, con
m_GL_specularColor = _prog->getUniform(_baseName+".specularColor"); m_GL_specularColor = _prog->getUniform(_baseName+".specularColor");
} }
void ege::Light::draw(const std::shared_ptr<gale::resource::Program>& _prog) { void ege::Light::draw(const ememory::SharedPtr<gale::resource::Program>& _prog) {
_prog->uniform3(m_GL_direction, m_direction); _prog->uniform3(m_GL_direction, m_direction);
_prog->uniform3(m_GL_halfplane, m_halfplane); _prog->uniform3(m_GL_halfplane, m_halfplane);
_prog->uniform4(m_GL_ambientColor, m_ambientColor); _prog->uniform4(m_GL_ambientColor, m_ambientColor);

View File

@ -29,8 +29,8 @@ namespace ege {
public: public:
Light(); Light();
~Light(); ~Light();
void link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName); void link(const ememory::SharedPtr<gale::resource::Program>& _prog, const std::string& _baseName);
void draw(const std::shared_ptr<gale::resource::Program>& _prog); void draw(const ememory::SharedPtr<gale::resource::Program>& _prog);
void setDirection(const vec3& val) { void setDirection(const vec3& val) {
m_direction = val; m_direction = val;
} }

View File

@ -17,7 +17,7 @@ ege::MaterialGlId::MaterialGlId() :
// nothing to do else ... // nothing to do else ...
} }
void ege::MaterialGlId::link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName) { void ege::MaterialGlId::link(const ememory::SharedPtr<gale::resource::Program>& _prog, const std::string& _baseName) {
if (_prog == nullptr) { if (_prog == nullptr) {
return; return;
} }
@ -42,7 +42,7 @@ ege::Material::~Material() {
} }
void ege::Material::draw(const std::shared_ptr<gale::resource::Program>& _prog, const MaterialGlId& _glID) { void ege::Material::draw(const ememory::SharedPtr<gale::resource::Program>& _prog, const MaterialGlId& _glID) {
EGE_INFO("draw Material : (start)"); EGE_INFO("draw Material : (start)");
_prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor); _prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor); _prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
@ -70,7 +70,7 @@ void ege::Material::setTexture0(const std::string& _filename) {
ivec2 tmpSize(256, 256); ivec2 tmpSize(256, 256);
if (_filename != "") { if (_filename != "") {
// prevent overloard error : // prevent overloard error :
std::shared_ptr<ewol::resource::Texture> tmpCopy = m_texture0; ememory::SharedPtr<ewol::resource::Texture> tmpCopy = m_texture0;
m_texture0 = ewol::resource::TextureFile::create(_filename, tmpSize); m_texture0 = ewol::resource::TextureFile::create(_filename, tmpSize);
if (m_texture0 == nullptr) { if (m_texture0 == nullptr) {
EGE_ERROR("Can not load specific texture : " << _filename); EGE_ERROR("Can not load specific texture : " << _filename);

View File

@ -24,7 +24,7 @@ namespace ege {
int32_t m_GL_shininess; int32_t m_GL_shininess;
int32_t m_GL_texture0; int32_t m_GL_texture0;
MaterialGlId(); MaterialGlId();
void link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName); void link(const ememory::SharedPtr<gale::resource::Program>& _prog, const std::string& _baseName);
}; };
@ -36,13 +36,13 @@ namespace ege {
vec4 m_specularFactor; vec4 m_specularFactor;
float m_shininess; float m_shininess;
enum gale::openGL::renderMode m_renderMode; // Select Render mode (triangle/Line/point ...) enum gale::openGL::renderMode m_renderMode; // Select Render mode (triangle/Line/point ...)
std::shared_ptr<ewol::resource::Texture> m_texture0; ememory::SharedPtr<ewol::resource::Texture> m_texture0;
public: public:
std::vector<uint32_t> m_listIndexFaces; std::vector<uint32_t> m_listIndexFaces;
public: public:
Material(); Material();
~Material(); ~Material();
void draw(const std::shared_ptr<gale::resource::Program>& _prog, const ege::MaterialGlId& _glID); void draw(const ememory::SharedPtr<gale::resource::Program>& _prog, const ege::MaterialGlId& _glID);
void setAmbientFactor(const vec4& _val) { void setAmbientFactor(const vec4& _val) {
m_ambientFactor = _val; m_ambientFactor = _val;
} }

View File

@ -56,7 +56,7 @@ std::pair<vec3,vec3> ege::Ray::testRay(ege::physics::Engine& _engine) {
} }
std::pair<std::shared_ptr<ege::Element>, std::pair<vec3,vec3>> ege::Ray::testRayObject(ege::physics::Engine& _engine) { std::pair<ememory::SharedPtr<ege::Element>, std::pair<vec3,vec3>> ege::Ray::testRayObject(ege::physics::Engine& _engine) {
vec3 start = m_origin; vec3 start = m_origin;
vec3 stop = m_origin+m_direction*1000.0f; vec3 stop = m_origin+m_direction*1000.0f;
// Start and End are vectors // Start and End are vectors
@ -70,14 +70,14 @@ std::pair<std::shared_ptr<ege::Element>, std::pair<vec3,vec3>> ege::Ray::testRay
ege::Element* elem = static_cast<ege::Element*>(rayCallback.m_collisionObject->getUserPointer()); ege::Element* elem = static_cast<ege::Element*>(rayCallback.m_collisionObject->getUserPointer());
if (elem != nullptr) { if (elem != nullptr) {
EGE_VERBOSE(" hit at point=" << end << " normal=" << normal); EGE_VERBOSE(" hit at point=" << end << " normal=" << normal);
return std::pair<std::shared_ptr<ege::Element>, std::pair<vec3,vec3>>(elem->shared_from_this(), std::pair<vec3,vec3>(end,normal)); return std::pair<ememory::SharedPtr<ege::Element>, std::pair<vec3,vec3>>(elem->sharedFromThis(), std::pair<vec3,vec3>(end,normal));
} }
EGE_VERBOSE(" Can not get the element pointer"); EGE_VERBOSE(" Can not get the element pointer");
return std::pair<std::shared_ptr<ege::Element>, std::pair<vec3,vec3>>(nullptr, std::pair<vec3,vec3>(end,normal)); return std::pair<ememory::SharedPtr<ege::Element>, std::pair<vec3,vec3>>(nullptr, std::pair<vec3,vec3>(end,normal));
} else { } else {
EGE_VERBOSE(" No Hit"); EGE_VERBOSE(" No Hit");
} }
return std::pair<std::shared_ptr<ege::Element>, std::pair<vec3,vec3>>(nullptr, std::pair<vec3,vec3>(vec3(0,0,0),vec3(0,0,0))); return std::pair<ememory::SharedPtr<ege::Element>, std::pair<vec3,vec3>>(nullptr, std::pair<vec3,vec3>(vec3(0,0,0),vec3(0,0,0)));
} }
vec3 ege::Ray::testRayZeroPlane() { vec3 ege::Ray::testRayZeroPlane() {

View File

@ -11,7 +11,7 @@ namespace ege {
class Element; class Element;
}; };
#include <ege/physics/Engine.h> #include <ege/physics/Engine.h>
#include <memory> #include <ememory/memory.h>
namespace ege { namespace ege {
class Ray { class Ray {
@ -65,7 +65,7 @@ namespace ege {
void set(const vec3& _origin, const vec3& _direction); void set(const vec3& _origin, const vec3& _direction);
public: public:
std::pair<vec3,vec3> testRay(ege::physics::Engine& _engine); std::pair<vec3,vec3> testRay(ege::physics::Engine& _engine);
std::pair<std::shared_ptr<ege::Element>, std::pair<vec3,vec3>> testRayObject(ege::physics::Engine& _engine); std::pair<ememory::SharedPtr<ege::Element>, std::pair<vec3,vec3>> testRayObject(ege::physics::Engine& _engine);
vec3 testRayZeroPlane(); vec3 testRayZeroPlane();
}; };
std::ostream& operator <<(std::ostream& _os, const ege::Ray& _obj); std::ostream& operator <<(std::ostream& _os, const ege::Ray& _obj);

View File

@ -15,7 +15,7 @@
namespace ege { namespace ege {
class Camera : public std::enable_shared_from_this<Camera>{ class Camera : public ememory::EnableSharedFromThis<Camera>{
public: public:
/** /**
* @brief Constructor. * @brief Constructor.
@ -168,7 +168,7 @@ namespace ege {
* @brief Debug display of the current element * @brief Debug display of the current element
* @param[in,out] draw Basic system to draw the debug shape and informations * @param[in,out] draw Basic system to draw the debug shape and informations
*/ */
virtual void drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) { } virtual void drawDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera) { }
}; };
} }

View File

@ -90,9 +90,9 @@ ege::Ray ege::camera::View::getRayFromScreen(const vec2& _offset) {
return out; return out;
} }
void ege::camera::View::drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) { void ege::camera::View::drawDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera) {
mat4 mat; mat4 mat;
if (_camera != shared_from_this()) { if (_camera != sharedFromThis()) {
mat.identity(); mat.identity();
vec2 angles = tansformPositionToAngle(-getViewVector()); vec2 angles = tansformPositionToAngle(-getViewVector());
mat.rotate(vec3(0,0,1), angles.x() - M_PI/2.0f); mat.rotate(vec3(0,0,1), angles.x() - M_PI/2.0f);

View File

@ -73,7 +73,7 @@ namespace ege {
virtual vec3 getViewVector() const; virtual vec3 getViewVector() const;
public: public:
virtual ege::Ray getRayFromScreen(const vec2& _offset); virtual ege::Ray getRayFromScreen(const vec2& _offset);
virtual void drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera); virtual void drawDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera);
virtual float getTetha(); virtual float getTetha();
virtual float getPsy(); virtual float getPsy();
}; };

View File

@ -30,7 +30,7 @@ const std::string& ege::Element::getType() const {
} }
ege::Element::Element(const std::shared_ptr<ege::Environement>& _env) : ege::Element::Element(const ememory::SharedPtr<ege::Environement>& _env) :
m_env(_env), m_env(_env),
m_uID(0), m_uID(0),
m_mesh(), m_mesh(),
@ -77,7 +77,7 @@ bool ege::Element::unInit() {
bool ege::Element::loadMesh(const std::string& _meshFileName) { bool ege::Element::loadMesh(const std::string& _meshFileName) {
std::shared_ptr<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::create(_meshFileName); ememory::SharedPtr<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::create(_meshFileName);
if(tmpMesh == nullptr) { if(tmpMesh == nullptr) {
EGE_ERROR("can not load the resources : " << _meshFileName); EGE_ERROR("can not load the resources : " << _meshFileName);
return false; return false;
@ -85,7 +85,7 @@ bool ege::Element::loadMesh(const std::string& _meshFileName) {
return setMesh(tmpMesh); return setMesh(tmpMesh);
} }
bool ege::Element::setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh) { bool ege::Element::setMesh(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
if (m_mesh != nullptr) { if (m_mesh != nullptr) {
m_mesh.reset(); m_mesh.reset();
} }
@ -129,7 +129,7 @@ const float lifeHeight = 0.3f;
const float lifeWidth = 2.0f; const float lifeWidth = 2.0f;
const float lifeYPos = 1.7f; const float lifeYPos = 1.7f;
void ege::Element::drawLife(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) { void ege::Element::drawLife(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera) {
if (_draw == nullptr) { if (_draw == nullptr) {
return; return;
} }
@ -168,7 +168,7 @@ void ege::Element::drawLife(const std::shared_ptr<ewol::resource::Colored3DObjec
#endif #endif
} }
void ege::Element::drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) { void ege::Element::drawDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera) {
m_debugText.clear(); m_debugText.clear();
m_debugText.setColor(etk::Color<>(0x00, 0xFF, 0x00, 0xFF)); m_debugText.setColor(etk::Color<>(0x00, 0xFF, 0x00, 0xFF));
m_debugText.setPos(vec3(-20,32,0)); m_debugText.setPos(vec3(-20,32,0));

View File

@ -25,16 +25,16 @@
#define ELEMENT_SCALE (1.0f/8.0f) #define ELEMENT_SCALE (1.0f/8.0f)
namespace ege { namespace ege {
class Element : public std::enable_shared_from_this<Element> { class Element : public ememory::EnableSharedFromThis<Element> {
protected: protected:
std::shared_ptr<ege::Environement> m_env; ememory::SharedPtr<ege::Environement> m_env;
public: public:
/** /**
* @brief Constructor (when constructer is called just add element that did not change. * @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, * 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... * when needed, the system will call the init and un-init function...
*/ */
Element(const std::shared_ptr<ege::Environement>& _env); Element(const ememory::SharedPtr<ege::Environement>& _env);
/** /**
* @brief Destructor * @brief Destructor
*/ */
@ -67,7 +67,7 @@ namespace ege {
return m_uID; return m_uID;
}; };
protected: protected:
std::shared_ptr<ege::resource::Mesh> m_mesh; //!< Mesh of the Element (can be nullptr) ememory::SharedPtr<ege::resource::Mesh> m_mesh; //!< Mesh of the Element (can be nullptr)
public: public:
/** /**
* @brief Select a mesh with a specific name. * @brief Select a mesh with a specific name.
@ -82,12 +82,12 @@ namespace ege {
* @note : this remove the shape and the mesh properties. * @note : this remove the shape and the mesh properties.
* @return true if no error occured * @return true if no error occured
*/ */
virtual bool setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh); virtual bool setMesh(const ememory::SharedPtr<ege::resource::Mesh>& _mesh);
/** /**
* @brief get a pointer on the Mesh file. * @brief get a pointer on the Mesh file.
* @return the mesh pointer. * @return the mesh pointer.
*/ */
inline const std::shared_ptr<ege::resource::Mesh>& getMesh() { inline const ememory::SharedPtr<ege::resource::Mesh>& getMesh() {
return m_mesh; return m_mesh;
}; };
protected: protected:
@ -159,7 +159,7 @@ namespace ege {
* @brief draw the current life of the element * @brief draw the current life of the element
*/ */
// TODO : Remove this ... // TODO : Remove this ...
virtual void drawLife(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera); virtual void drawLife(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera);
protected: protected:
// For debug only ... // For debug only ...
@ -169,7 +169,7 @@ namespace ege {
* @brief Debug display of the current element * @brief Debug display of the current element
* @param[in,out] draw Basic system to draw the debug shape and informations * @param[in,out] draw Basic system to draw the debug shape and informations
*/ */
virtual void drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera); virtual void drawDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<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 ...
@ -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 ... * @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. * @param[in] _removedElement Pointer on the element removed.
*/ */
virtual void elementIsRemoved(std::shared_ptr<ege::Element> _removedElement) { }; virtual void elementIsRemoved(ememory::SharedPtr<ege::Element> _removedElement) { };
protected: 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: public:

View File

@ -8,7 +8,7 @@
#include <ege/elements/ElementBase.h> #include <ege/elements/ElementBase.h>
#include <ege/debug.h> #include <ege/debug.h>
ege::ElementBase::ElementBase(const std::shared_ptr<ege::Environement>& _env) : ege::ElementBase::ElementBase(const ememory::SharedPtr<ege::Environement>& _env) :
ege::Element(_env), ege::Element(_env),
m_position(0,0,0) { m_position(0,0,0) {

View File

@ -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, * 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... * when needed, the system will call the init and un-init function...
*/ */
ElementBase(const std::shared_ptr<ege::Environement>& _env); ElementBase(const ememory::SharedPtr<ege::Environement>& _env);
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -29,7 +29,7 @@ const std::string& ege::ElementPhysic::getType() const {
} }
ege::ElementPhysic::ElementPhysic(const std::shared_ptr<ege::Environement>& _env, bool _autoRigidBody) ://, float _mass) : ege::ElementPhysic::ElementPhysic(const ememory::SharedPtr<ege::Environement>& _env, bool _autoRigidBody) ://, float _mass) :
ege::Element(_env), ege::Element(_env),
m_body(nullptr), m_body(nullptr),
m_shape(nullptr), m_shape(nullptr),
@ -72,7 +72,7 @@ void ege::ElementPhysic::createRigidBody(float _mass) {
} }
bool ege::ElementPhysic::setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh) { bool ege::ElementPhysic::setMesh(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
EGE_WARNING("Set Mesh"); EGE_WARNING("Set Mesh");
if (nullptr!=m_mesh) { if (nullptr!=m_mesh) {
removeShape(); removeShape();
@ -170,7 +170,7 @@ const float ege::ElementPhysic::getInvMass() {
}; };
void ege::ElementPhysic::drawShape(const btCollisionShape* _shape, void ege::ElementPhysic::drawShape(const btCollisionShape* _shape,
const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw,
mat4 _transformationMatrix, mat4 _transformationMatrix,
std::vector<vec3> _tmpVertices) { std::vector<vec3> _tmpVertices) {
if( _draw == nullptr if( _draw == nullptr
@ -316,7 +316,7 @@ void ege::ElementPhysic::drawShape(const btCollisionShape* _shape,
} }
} }
void ege::ElementPhysic::drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) { void ege::ElementPhysic::drawDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera) {
ege::Element::drawDebug(_draw, _camera); ege::Element::drawDebug(_draw, _camera);
btScalar mmm[16]; btScalar mmm[16];
btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_body->getMotionState(); btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_body->getMotionState();

View File

@ -43,7 +43,7 @@ namespace ege {
* @param[in] _env glabal ege environement * @param[in] _env glabal ege environement
* @param[in] _autoRigidBody add a basic rigid body (not availlable after befor setting a shape) * @param[in] _autoRigidBody add a basic rigid body (not availlable after befor setting a shape)
*/ */
ElementPhysic(const std::shared_ptr<ege::Environement>& _env, bool _autoRigidBody=true); ElementPhysic(const ememory::SharedPtr<ege::Environement>& _env, bool _autoRigidBody=true);
/** /**
* @brief Destructor * @brief Destructor
*/ */
@ -76,7 +76,7 @@ namespace ege {
*/ */
void removeShape(); void removeShape();
public: public:
virtual bool setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh); virtual bool setMesh(const ememory::SharedPtr<ege::resource::Mesh>& _mesh);
/** /**
* @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..?] * @param[in] pass Id of the current pass : [0..?]
@ -86,7 +86,7 @@ namespace ege {
/** /**
* @brief draw the current life of the element * @brief draw the current life of the element
*/ */
// virtual void drawLife(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera); // virtual void drawLife(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera);
// TODO : Remove this ... // TODO : Remove this ...
protected: protected:
vec3 m_theoricPosition; vec3 m_theoricPosition;
@ -175,10 +175,10 @@ namespace ege {
virtual void onDestroy() {}; virtual void onDestroy() {};
virtual const vec3& getPosition(); virtual const vec3& getPosition();
virtual void setPosition(const vec3& _pos); virtual void setPosition(const vec3& _pos);
virtual void drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera); virtual void drawDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ege::Camera>& _camera);
protected: protected:
void drawShape(const btCollisionShape* _shape, void drawShape(const btCollisionShape* _shape,
const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw,
mat4 _transformationMatrix, mat4 _transformationMatrix,
std::vector<vec3> _tmpVertices); std::vector<vec3> _tmpVertices);
protected: protected:
@ -202,7 +202,7 @@ namespace ege {
* @param[in] _point Position of the impact in the global world * @param[in] _point Position of the impact in the global world
* @param[in] _normal Normal of the impact * @param[in] _normal Normal of the impact
*/ */
virtual void onCollisionDetected(const std::shared_ptr<ege::Element>& _obj, const vec3& _point, const vec3& _normal) {}; virtual void onCollisionDetected(const ememory::SharedPtr<ege::Element>& _obj, const vec3& _point, const vec3& _normal) {};
}; };
} }

View File

@ -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); EGE_VERBOSE("collision process between " << elem0->getUID() << " && " << elem1->getUID() << " pos=" << _point.getPositionWorldOnA() << " norm=" << _point.m_normalWorldOnB);
if (elem0->getCollisionDetectionStatus() == true) { 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) { 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; return true;
} }
@ -65,39 +65,39 @@ ege::physics::Engine::~Engine() {
*/ */
} }
void ege::physics::Engine::setBulletConfig(std::shared_ptr<btDefaultCollisionConfiguration> _collisionConfiguration, void ege::physics::Engine::setBulletConfig(ememory::SharedPtr<btDefaultCollisionConfiguration> _collisionConfiguration,
std::shared_ptr<btCollisionDispatcher> _dispatcher, ememory::SharedPtr<btCollisionDispatcher> _dispatcher,
std::shared_ptr<btBroadphaseInterface> _broadphase, ememory::SharedPtr<btBroadphaseInterface> _broadphase,
std::shared_ptr<btConstraintSolver> _solver, ememory::SharedPtr<btConstraintSolver> _solver,
std::shared_ptr<btDynamicsWorld> _dynamicsWorld) { ememory::SharedPtr<btDynamicsWorld> _dynamicsWorld) {
if (_collisionConfiguration != nullptr) { if (_collisionConfiguration != nullptr) {
m_collisionConfiguration = _collisionConfiguration; m_collisionConfiguration = _collisionConfiguration;
} else { } else {
m_collisionConfiguration = std::make_shared<btDefaultCollisionConfiguration>(); m_collisionConfiguration = ememory::makeShared<btDefaultCollisionConfiguration>();
} }
///use the default collision dispatcher. ///use the default collision dispatcher.
if (_dispatcher != nullptr) { if (_dispatcher != nullptr) {
m_dispatcher = _dispatcher; m_dispatcher = _dispatcher;
} else { } else {
m_dispatcher = std::make_shared<btCollisionDispatcher>(m_collisionConfiguration.get()); m_dispatcher = ememory::makeShared<btCollisionDispatcher>(m_collisionConfiguration.get());
} }
if (_broadphase != nullptr) { if (_broadphase != nullptr) {
m_broadphase = _broadphase; m_broadphase = _broadphase;
} else { } else {
m_broadphase = std::make_shared<btDbvtBroadphase>(); m_broadphase = ememory::makeShared<btDbvtBroadphase>();
} }
///the default constraint solver. ///the default constraint solver.
if (_solver != nullptr) { if (_solver != nullptr) {
m_solver = _solver; m_solver = _solver;
} else { } else {
m_solver = std::make_shared<btSequentialImpulseConstraintSolver>(); m_solver = ememory::makeShared<btSequentialImpulseConstraintSolver>();
} }
if (_dynamicsWorld != nullptr) { if (_dynamicsWorld != nullptr) {
m_dynamicsWorld = _dynamicsWorld; m_dynamicsWorld = _dynamicsWorld;
} else { } else {
m_dynamicsWorld = std::make_shared<btDiscreteDynamicsWorld>(m_dispatcher.get(),m_broadphase.get(),m_solver.get(),m_collisionConfiguration.get()); m_dynamicsWorld = ememory::makeShared<btDiscreteDynamicsWorld>(m_dispatcher.get(),m_broadphase.get(),m_solver.get(),m_collisionConfiguration.get());
// By default we set no gravity // By default we set no gravity
m_dynamicsWorld->setGravity(btVector3(0,0,0)); m_dynamicsWorld->setGravity(btVector3(0,0,0));
} }
@ -127,7 +127,7 @@ std::vector<ege::physics::Engine::collisionPoints> ege::physics::Engine::getList
for (int j=0;j<numContacts;j++) { for (int j=0;j<numContacts;j++) {
btManifoldPoint& pt = contactManifold->getContactPoint(j); btManifoldPoint& pt = contactManifold->getContactPoint(j);
if (pt.getDistance()<0.f) { 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));
} }
} }
} }

View File

@ -41,31 +41,31 @@ namespace ege {
class Engine { class Engine {
private: private:
///this is the most important class ///this is the most important class
std::shared_ptr<btDefaultCollisionConfiguration> m_collisionConfiguration; ememory::SharedPtr<btDefaultCollisionConfiguration> m_collisionConfiguration;
std::shared_ptr<btCollisionDispatcher> m_dispatcher; ememory::SharedPtr<btCollisionDispatcher> m_dispatcher;
std::shared_ptr<btBroadphaseInterface> m_broadphase; ememory::SharedPtr<btBroadphaseInterface> m_broadphase;
std::shared_ptr<btConstraintSolver> m_solver; ememory::SharedPtr<btConstraintSolver> m_solver;
std::shared_ptr<btDynamicsWorld> m_dynamicsWorld; ememory::SharedPtr<btDynamicsWorld> m_dynamicsWorld;
public: public:
Engine(); Engine();
~Engine(); ~Engine();
void setBulletConfig(std::shared_ptr<btDefaultCollisionConfiguration> _collisionConfiguration=nullptr, void setBulletConfig(ememory::SharedPtr<btDefaultCollisionConfiguration> _collisionConfiguration=nullptr,
std::shared_ptr<btCollisionDispatcher> _dispatcher=nullptr, ememory::SharedPtr<btCollisionDispatcher> _dispatcher=nullptr,
std::shared_ptr<btBroadphaseInterface> _broadphase=nullptr, ememory::SharedPtr<btBroadphaseInterface> _broadphase=nullptr,
std::shared_ptr<btConstraintSolver> _solver=nullptr, ememory::SharedPtr<btConstraintSolver> _solver=nullptr,
std::shared_ptr<btDynamicsWorld> _dynamicsWorld=nullptr); ememory::SharedPtr<btDynamicsWorld> _dynamicsWorld=nullptr);
/** /**
* @brief set the curent world * @brief set the curent world
* @param[in] _newWorld Pointer on the current world * @param[in] _newWorld Pointer on the current world
*/ */
void setDynamicWorld(const std::shared_ptr<btDynamicsWorld>& _newWorld) { void setDynamicWorld(const ememory::SharedPtr<btDynamicsWorld>& _newWorld) {
m_dynamicsWorld=_newWorld; m_dynamicsWorld=_newWorld;
}; };
/** /**
* @brief get the curent world * @brief get the curent world
* @return pointer on the current world * @return pointer on the current world
*/ */
std::shared_ptr<btDynamicsWorld> getDynamicWorld() { ememory::SharedPtr<btDynamicsWorld> getDynamicWorld() {
return m_dynamicsWorld; return m_dynamicsWorld;
}; };
public: public:
@ -73,13 +73,13 @@ namespace ege {
//! @not_in_doc //! @not_in_doc
class collisionPoints { class collisionPoints {
public: public:
std::shared_ptr<ege::Element> elem1; ememory::SharedPtr<ege::Element> elem1;
std::shared_ptr<ege::Element> elem2; ememory::SharedPtr<ege::Element> elem2;
vec3 positionElem1; vec3 positionElem1;
vec3 positionElem2; vec3 positionElem2;
vec3 normalElem2; vec3 normalElem2;
collisionPoints(const std::shared_ptr<ege::Element>& _elem1, collisionPoints(const ememory::SharedPtr<ege::Element>& _elem1,
const std::shared_ptr<ege::Element>& _elem2, const ememory::SharedPtr<ege::Element>& _elem2,
const vec3& _pos1, const vec3& _pos1,
const vec3& _pos2, const vec3& _pos2,
const vec3& _normal) : const vec3& _normal) :

View File

@ -13,21 +13,21 @@
#include <ege/physicsShape/PhysicsSphere.h> #include <ege/physicsShape/PhysicsSphere.h>
std::shared_ptr<ege::PhysicsShape> ege::PhysicsShape::create(const std::string& _name) { ememory::SharedPtr<ege::PhysicsShape> ege::PhysicsShape::create(const std::string& _name) {
std::shared_ptr<ege::PhysicsShape> tmpp = nullptr; ememory::SharedPtr<ege::PhysicsShape> tmpp = nullptr;
std::string name = etk::tolower(_name); std::string name = etk::tolower(_name);
if (name == "box") { if (name == "box") {
tmpp = std::make_shared<ege::PhysicsBox>(); tmpp = ememory::makeShared<ege::PhysicsBox>();
} else if (name == "sphere") { } else if (name == "sphere") {
tmpp = std::make_shared<ege::PhysicsSphere>(); tmpp = ememory::makeShared<ege::PhysicsSphere>();
} else if (name == "cone") { } else if (name == "cone") {
tmpp = std::make_shared<ege::PhysicsCone>(); tmpp = ememory::makeShared<ege::PhysicsCone>();
} else if (name == "cylinder") { } else if (name == "cylinder") {
tmpp = std::make_shared<ege::PhysicsCylinder>(); tmpp = ememory::makeShared<ege::PhysicsCylinder>();
} else if (name == "capsule") { } else if (name == "capsule") {
tmpp = std::make_shared<ege::PhysicsCapsule>(); tmpp = ememory::makeShared<ege::PhysicsCapsule>();
} else if (name == "convexhull") { } else if (name == "convexhull") {
tmpp = std::make_shared<ege::PhysicsConvexHull>(); tmpp = ememory::makeShared<ege::PhysicsConvexHull>();
} else { } else {
EGE_ERROR("Create an unknow element : '" << _name << "' availlable : [BOX,SPHERE,CONE,CYLINDER,CAPSULE,CONVEXHULL]"); EGE_ERROR("Create an unknow element : '" << _name << "' availlable : [BOX,SPHERE,CONE,CYLINDER,CAPSULE,CONVEXHULL]");
return nullptr; return nullptr;

View File

@ -9,7 +9,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <etk/math/Vector4D.h> #include <etk/math/Vector4D.h>
#include <etk/math/Vector3D.h> #include <etk/math/Vector3D.h>
#include <memory> #include <ememory/memory.h>
namespace ege { namespace ege {
@ -22,7 +22,7 @@ namespace ege {
class PhysicsShape { class PhysicsShape {
public: public:
static std::shared_ptr<ege::PhysicsShape> create(const std::string& _name); static ememory::SharedPtr<ege::PhysicsShape> create(const std::string& _name);
public: public:
enum type { enum type {
unknow, unknow,

View File

@ -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<ege::Material> _data) { void ege::resource::Mesh::addMaterial(const std::string& _name, ememory::SharedPtr<ege::Material> _data) {
if (_data == nullptr) { if (_data == nullptr) {
EGE_ERROR(" can not add material with null pointer"); EGE_ERROR(" can not add material with null pointer");
return; return;

View File

@ -29,11 +29,11 @@ namespace ege {
namespace resource { namespace resource {
class Mesh : public gale::Resource { class Mesh : public gale::Resource {
public: public:
static std::shared_ptr<ege::resource::Mesh> createGrid(int32_t _lineCount, static ememory::SharedPtr<ege::resource::Mesh> createGrid(int32_t _lineCount,
const vec3& _position=vec3(0,0,0), const vec3& _position=vec3(0,0,0),
float _size=1.0f, float _size=1.0f,
const std::string& _materialName="basics"); const std::string& _materialName="basics");
static std::shared_ptr<ege::resource::Mesh> createCube(float _size=1.0f, static ememory::SharedPtr<ege::resource::Mesh> createCube(float _size=1.0f,
const std::string& _materialName="basics", const std::string& _materialName="basics",
const etk::Color<float>& _color=etk::color::white); const etk::Color<float>& _color=etk::color::white);
public: public:
@ -49,7 +49,7 @@ namespace ege {
enum normalMode m_normalMode; // select the normal mode of display 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 bool m_checkNormal; //!< when enable, this check the normal of the mesh before sending it at the 3d card
protected: protected:
std::shared_ptr<gale::resource::Program> m_GLprogram; ememory::SharedPtr<gale::resource::Program> m_GLprogram;
int32_t m_GLPosition; int32_t m_GLPosition;
int32_t m_GLMatrix; int32_t m_GLMatrix;
int32_t m_GLMatrixPosition; int32_t m_GLMatrixPosition;
@ -67,11 +67,11 @@ namespace ege {
std::vector<vec3> m_listFacesNormal; //!< List of all Face normal, when calculated std::vector<vec3> m_listFacesNormal; //!< List of all Face normal, when calculated
std::vector<vec3> m_listVertexNormal; //!< List of all Face normal, when calculated std::vector<vec3> m_listVertexNormal; //!< List of all Face normal, when calculated
etk::Hash<FaceIndexing> m_listFaces; //!< List of all Face for the mesh etk::Hash<FaceIndexing> m_listFaces; //!< List of all Face for the mesh
etk::Hash<std::shared_ptr<ege::Material>> m_materials; etk::Hash<ememory::SharedPtr<ege::Material>> m_materials;
std::vector<std::shared_ptr<ege::PhysicsShape>> m_physics; //!< collision shape module ... (independent of bullet lib) std::vector<ememory::SharedPtr<ege::PhysicsShape>> m_physics; //!< collision shape module ... (independent of bullet lib)
void clean(); void clean();
protected: protected:
std::shared_ptr<gale::resource::VirtualBufferObject> m_verticesVBO; ememory::SharedPtr<gale::resource::VirtualBufferObject> m_verticesVBO;
protected: protected:
Mesh(); Mesh();
void init(const std::string& _fileName="---", const std::string& _shaderName="DATA:textured3D2.prog"); 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 loadOBJ(const std::string& _fileName);
bool loadEMF(const std::string& _fileName); bool loadEMF(const std::string& _fileName);
public: public:
void addMaterial(const std::string& _name, std::shared_ptr<ege::Material> _data); void addMaterial(const std::string& _name, ememory::SharedPtr<ege::Material> _data);
public: public:
/** /**
* @brief set the check of normal position befor sending it to the openGl card * @brief set the check of normal position befor sending it to the openGl card
@ -113,10 +113,10 @@ namespace ege {
bool getCheckNormal() { bool getCheckNormal() {
return m_checkNormal; return m_checkNormal;
}; };
const std::vector<std::shared_ptr<ege::PhysicsShape>>& getPhysicalProperties() const { const std::vector<ememory::SharedPtr<ege::PhysicsShape>>& getPhysicalProperties() const {
return m_physics; return m_physics;
}; };
void addPhysicElement(const std::shared_ptr<ege::PhysicsShape>& _shape) { void addPhysicElement(const ememory::SharedPtr<ege::PhysicsShape>& _shape) {
m_physics.push_back(_shape); m_physics.push_back(_shape);
} }
private: private:

View File

@ -7,11 +7,11 @@
#include <ege/debug.h> #include <ege/debug.h>
#include <ege/resource/Mesh.h> #include <ege/resource/Mesh.h>
std::shared_ptr<ege::resource::Mesh> ege::resource::Mesh::createCube(float _size, const std::string& _materialName, const etk::Color<float>& _color) { ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCube(float _size, const std::string& _materialName, const etk::Color<float>& _color) {
EGE_ERROR(" create a cube _size=" << _size << " _materialName=" << _materialName << " _color=" << _color); EGE_ERROR(" create a cube _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog"); ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
if (out != nullptr) { if (out != nullptr) {
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
// set the element material properties : // set the element material properties :
material->setAmbientFactor(vec4(1,1,1,1)); material->setAmbientFactor(vec4(1,1,1,1));
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));

View File

@ -171,9 +171,9 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
int32_t meshFaceMaterialID = -1; int32_t meshFaceMaterialID = -1;
// material global param : // material global param :
std::string materialName = ""; std::string materialName = "";
std::shared_ptr<ege::Material> material; ememory::SharedPtr<ege::Material> material;
// physical shape: // physical shape:
std::shared_ptr<ege::PhysicsShape> physics; ememory::SharedPtr<ege::PhysicsShape> physics;
while (1) { while (1) {
int32_t level = countIndent(fileName); int32_t level = countIndent(fileName);
if (level == 0) { if (level == 0) {
@ -416,7 +416,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
materialName = ""; materialName = "";
material = nullptr; material = nullptr;
} }
material = std::make_shared<ege::Material>(); material = ememory::makeShared<ege::Material>();
materialName = inputDataLine; materialName = inputDataLine;
currentMode = EMFModuleMaterialNamed; currentMode = EMFModuleMaterialNamed;
EGE_VERBOSE(" "<< materialName); EGE_VERBOSE(" "<< materialName);

View File

@ -7,10 +7,10 @@
#include <ege/debug.h> #include <ege/debug.h>
#include <ege/resource/Mesh.h> #include <ege/resource/Mesh.h>
std::shared_ptr<ege::resource::Mesh> ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const std::string& _materialName) { ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const std::string& _materialName) {
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog"); ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
if (out != nullptr) { if (out != nullptr) {
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
// set the element material properties : // set the element material properties :
material->setAmbientFactor(vec4(1,1,1,1)); material->setAmbientFactor(vec4(1,1,1,1));
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));

View File

@ -30,7 +30,7 @@ static int32_t addUV(std::vector<vec2>& _listUV, int32_t _uvId, float _add) {
return _listUV.size()-1; return _listUV.size()-1;
} }
void ege::icoSphere::create(etk::Hash<std::shared_ptr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV, void ege::icoSphere::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV,
const std::string& _materialName, float _size, int32_t _recursionLevel) { const std::string& _materialName, float _size, int32_t _recursionLevel) {
/* /*
5 5

View File

@ -12,7 +12,7 @@
namespace ege { namespace ege {
namespace icoSphere { namespace icoSphere {
void create(etk::Hash<std::shared_ptr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV, void create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV,
const std::string& _materialName, float _size, int32_t _recursionLevel); const std::string& _materialName, float _size, int32_t _recursionLevel);
} }
} }

View File

@ -7,7 +7,7 @@
#include <ege/debug.h> #include <ege/debug.h>
#include <ege/resource/tools/isoSphere.h> #include <ege/resource/tools/isoSphere.h>
void ege::isoSphere::create(etk::Hash<std::shared_ptr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV, void ege::isoSphere::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV,
const std::string& _materialName, int32_t _recursionLevel) { const std::string& _materialName, int32_t _recursionLevel) {
_recursionLevel = std::max(_recursionLevel, 3); _recursionLevel = std::max(_recursionLevel, 3);
float size = 1.0f; float size = 1.0f;

View File

@ -12,7 +12,7 @@
namespace ege { namespace ege {
namespace isoSphere { namespace isoSphere {
void create(etk::Hash<std::shared_ptr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV, void create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV,
const std::string& _materialName, int32_t _recursionLevel); const std::string& _materialName, int32_t _recursionLevel);
} }
} }

View File

@ -9,7 +9,7 @@
void ege::viewBox::create(etk::Hash<std::shared_ptr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV, void ege::viewBox::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV,
const std::string& _materialName, float _size) { const std::string& _materialName, float _size) {
// This is the direct generation basis on the .obj system // This is the direct generation basis on the .obj system
/* /*

View File

@ -12,7 +12,7 @@
namespace ege { namespace ege {
namespace viewBox { namespace viewBox {
void create(etk::Hash<std::shared_ptr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV, void create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materials, etk::Hash<FaceIndexing>& _listFaces, std::vector<vec3>& _listVertex, std::vector<vec2>& _listUV,
const std::string& _materialName, float _size); const std::string& _materialName, float _size);
} }
} }

View File

@ -20,7 +20,7 @@ namespace ege {
private: private:
// mesh name : // mesh name :
std::string m_meshName; std::string m_meshName;
std::shared_ptr<ege::resource::Mesh> m_object; ememory::SharedPtr<ege::resource::Mesh> m_object;
// mesh display properties: // mesh display properties:
vec3 m_position; vec3 m_position;
vec3 m_angle; vec3 m_angle;

View File

@ -26,7 +26,7 @@
#include <BulletCollision/CollisionDispatch/btCollisionObject.h> #include <BulletCollision/CollisionDispatch/btCollisionObject.h>
namespace etk { namespace etk {
template<> std::string to_string<std::shared_ptr<ewol::resource::Colored3DObject> >(const std::shared_ptr<ewol::resource::Colored3DObject>& _value) { template<> std::string to_string<ememory::SharedPtr<ewol::resource::Colored3DObject> >(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _value) {
return "{{ERROR}}"; return "{{ERROR}}";
} }
}; };
@ -89,14 +89,14 @@ void ege::widget::Scene::onDraw() {
} }
// get camera : // get camera :
std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName); ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
if (camera == nullptr) { if (camera == nullptr) {
EGE_ERROR(" can not get camera named: '" << m_cameraName << "'"); EGE_ERROR(" can not get camera named: '" << m_cameraName << "'");
return; return;
} }
//EGE_DEBUG("Draw (start)"); //EGE_DEBUG("Draw (start)");
mat4 tmpMatrix; mat4 tmpMatrix;
std::shared_ptr<btDynamicsWorld> world = m_env->getPhysicEngine().getDynamicWorld(); ememory::SharedPtr<btDynamicsWorld> world = m_env->getPhysicEngine().getDynamicWorld();
if (world != nullptr) { if (world != nullptr) {
m_env->getOrderedElementForDisplay(m_displayElementOrdered, camera->getEye(), camera->getViewVector()); 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); m_displayElementOrdered[iii].element->drawDebug(m_debugDrawProperty, camera);
} }
// Draw debug ... (Camera) // Draw debug ... (Camera)
std::map<std::string, std::shared_ptr<ege::Camera>> listCamera = m_env->getCameraList(); std::map<std::string, ememory::SharedPtr<ege::Camera>> listCamera = m_env->getCameraList();
for (auto &itCam : listCamera) { for (auto &itCam : listCamera) {
if (itCam.second != nullptr) { if (itCam.second != nullptr) {
itCam.second->drawDebug(m_debugDrawProperty, camera); 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 // 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); gale::openGL::setViewPort(m_origin, m_size);
// configure render with the camera... // configure render with the camera...
std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName); ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
if (camera != nullptr) { if (camera != nullptr) {
camera->configureOpenGL(); camera->configureOpenGL();
} }
@ -191,7 +191,7 @@ void ege::widget::Scene::setCamera(const std::string& _cameraName) {
} }
m_cameraName = _cameraName; m_cameraName = _cameraName;
// Update camera aspect ratio: // Update camera aspect ratio:
std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName); ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
if (camera != nullptr) { if (camera != nullptr) {
camera->setSceenSize(m_size); camera->setSceenSize(m_size);
} }
@ -200,12 +200,12 @@ void ege::widget::Scene::setCamera(const std::string& _cameraName) {
void ege::widget::Scene::calculateSize() { void ege::widget::Scene::calculateSize() {
ewol::Widget::calculateSize(); ewol::Widget::calculateSize();
// Update camera aspect ratio: // Update camera aspect ratio:
std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName); ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
if (camera != nullptr) { if (camera != nullptr) {
camera->setSceenSize(m_size); camera->setSceenSize(m_size);
} }
} }
#include <esignal/details/ISignal.hxx> #include <esignal/details/ISignal.hxx>
template class esignal::ISignal<std::shared_ptr<ewol::resource::Colored3DObject>>; template class esignal::ISignal<ememory::SharedPtr<ewol::resource::Colored3DObject>>;

View File

@ -35,13 +35,13 @@ namespace ege {
class Scene : public ewol::Widget { class Scene : public ewol::Widget {
public: public:
// signals // signals
esignal::ISignal<std::shared_ptr<ewol::resource::Colored3DObject>/*, std::shared_ptr<ege::Camera>*/> signalDisplayDebug; //!< emit a signal to the application to draw the debug (@ref setDebugPhysic) esignal::ISignal<ememory::SharedPtr<ewol::resource::Colored3DObject>/*, ememory::SharedPtr<ege::Camera>*/> signalDisplayDebug; //!< emit a signal to the application to draw the debug (@ref setDebugPhysic)
// properties // properties
eproperty::Value<bool> propertyDebugPhysic; //!< display Physic Debug eproperty::Value<bool> propertyDebugPhysic; //!< display Physic Debug
eproperty::Value<bool> propertyDebugApplication; //!< display Application Debug eproperty::Value<bool> propertyDebugApplication; //!< display Application Debug
protected: protected:
std::shared_ptr<ege::Environement> m_env; ememory::SharedPtr<ege::Environement> m_env;
std::shared_ptr<ewol::resource::Colored3DObject> m_debugDrawProperty; ememory::SharedPtr<ewol::resource::Colored3DObject> m_debugDrawProperty;
public: public:
protected: protected:
/** /**
@ -51,7 +51,7 @@ namespace ege {
Scene(); Scene();
void init(); void init();
public: public:
void setEnv(std::shared_ptr<ege::Environement> _env) { void setEnv(ememory::SharedPtr<ege::Environement> _env) {
m_env = _env; m_env = _env;
} }
public: public:

View File

@ -23,10 +23,10 @@ appl::Windows::Windows() {
} }
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() { static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
if (out != nullptr) { if (out != nullptr) {
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
// set the element material properties : // set the element material properties :
material->setAmbientFactor(vec4(1,1,1,1)); material->setAmbientFactor(vec4(1,1,1,1));
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));
@ -65,14 +65,14 @@ static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
void appl::Windows::init() { void appl::Windows::init() {
ewol::widget::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(); m_env = ege::Environement::create();
// Create basic Camera // Create basic Camera
m_camera = std::make_shared<ege::camera::View>(vec3(30,30,-100), vec3(0,0,0)); m_camera = ememory::makeShared<ege::camera::View>(vec3(30,30,-100), vec3(0,0,0));
m_env->addCamera("basic", m_camera); m_env->addCamera("basic", m_camera);
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create(); ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget ==> display might be in error"); APPL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
@ -82,7 +82,7 @@ void appl::Windows::init() {
tmpWidget->setCamera("basic"); tmpWidget->setCamera("basic");
setSubWidget(tmpWidget); setSubWidget(tmpWidget);
} }
std::shared_ptr<ege::resource::Mesh> myMesh; ememory::SharedPtr<ege::resource::Mesh> myMesh;
// Create an external box : // Create an external box :
myMesh = createViewBoxStar(); myMesh = createViewBoxStar();
if (myMesh != nullptr) { if (myMesh != nullptr) {

View File

@ -14,8 +14,8 @@
namespace appl { namespace appl {
class Windows : public ewol::widget::Windows { class Windows : public ewol::widget::Windows {
private: private:
std::shared_ptr<ege::Environement> m_env; ememory::SharedPtr<ege::Environement> m_env;
std::shared_ptr<ege::camera::View> m_camera; ememory::SharedPtr<ege::camera::View> m_camera;
protected: protected:
Windows(); Windows();
void init(); void init();

View File

@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
_context.getFontDefault().setUseExternal(true); _context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create(); ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows // create the specific windows
_context.setWindows(basicWindows); _context.setWindows(basicWindows);
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");

View File

@ -26,10 +26,10 @@ appl::Windows::Windows() {
} }
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() { static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
if (out != nullptr) { if (out != nullptr) {
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
// set the element material properties : // set the element material properties :
material->setAmbientFactor(vec4(1,1,1,1)); material->setAmbientFactor(vec4(1,1,1,1));
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));
@ -68,15 +68,15 @@ static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
void appl::Windows::init() { void appl::Windows::init() {
ewol::widget::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(); m_env = ege::Environement::create();
// Create basic Camera // Create basic Camera
m_camera = std::make_shared<ege::camera::View>(vec3(30,30,-100), vec3(0,0,0)); m_camera = ememory::makeShared<ege::camera::View>(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_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy)));
m_env->addCamera("basic", m_camera); m_env->addCamera("basic", m_camera);
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create(); ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
APPL_CRITICAL("Can not allocate widget ==> display might be in error"); APPL_CRITICAL("Can not allocate widget ==> display might be in error");
} else { } else {
@ -87,7 +87,7 @@ void appl::Windows::init() {
setSubWidget(tmpWidget); setSubWidget(tmpWidget);
} }
std::shared_ptr<ege::resource::Mesh> myMesh; ememory::SharedPtr<ege::resource::Mesh> myMesh;
// Create an external box : // Create an external box :
myMesh = createViewBoxStar(); myMesh = createViewBoxStar();
if (myMesh != nullptr) { if (myMesh != nullptr) {
@ -100,10 +100,10 @@ void appl::Windows::init() {
} }
myMesh = ege::resource::Mesh::createCube(3); myMesh = ege::resource::Mesh::createCube(3);
if (myMesh != nullptr) { if (myMesh != nullptr) {
//std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env); //ememory::SharedPtr<ege::ElementBase> element = ememory::makeShared<ege::ElementBase>(m_env);
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env); ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
// add physic interface: // add physic interface:
std::shared_ptr<ege::PhysicsBox> physic = std::make_shared<ege::PhysicsBox>(); ememory::SharedPtr<ege::PhysicsBox> physic = ememory::makeShared<ege::PhysicsBox>();
physic->setSize(vec3(3.2,3.2,3.2)); physic->setSize(vec3(3.2,3.2,3.2));
myMesh->addPhysicElement(physic); myMesh->addPhysicElement(physic);
@ -116,11 +116,11 @@ void appl::Windows::init() {
} }
myMesh = ege::resource::Mesh::createCube(3); myMesh = ege::resource::Mesh::createCube(3);
if (myMesh != nullptr) { if (myMesh != nullptr) {
//element = std::make_shared<ege::ElementBase>(m_env); //element = ememory::makeShared<ege::ElementBase>(m_env);
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env); ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
// add physic interface: // add physic interface:
std::shared_ptr<ege::PhysicsSphere> physic = std::make_shared<ege::PhysicsSphere>(); ememory::SharedPtr<ege::PhysicsSphere> physic = ememory::makeShared<ege::PhysicsSphere>();
physic->setRadius(4.5f); physic->setRadius(4.5f);
myMesh->addPhysicElement(physic); myMesh->addPhysicElement(physic);
@ -140,11 +140,11 @@ void appl::Windows::init() {
namespace appl { namespace appl {
class ElementHerit : public ege::ElementPhysic { class ElementHerit : public ege::ElementPhysic {
public: public:
ElementHerit(const std::shared_ptr<ege::Environement>& _env, bool _autoRigidBody=true) : ElementHerit(const ememory::SharedPtr<ege::Environement>& _env, bool _autoRigidBody=true) :
ege::ElementPhysic(_env, _autoRigidBody) { ege::ElementPhysic(_env, _autoRigidBody) {
setCollisionDetectionStatus(true); setCollisionDetectionStatus(true);
} }
virtual void onCollisionDetected(const std::shared_ptr<ege::Element>& _obj, const vec3& _point, const vec3& _normal) { virtual void onCollisionDetected(const ememory::SharedPtr<ege::Element>& _obj, const vec3& _point, const vec3& _normal) {
APPL_WARNING("[" << getUID() << "] collision : pos=" << _point << " norm=" <<_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()); vec2 pos = relativePosition(_event.getPos());
ege::Ray ray = m_camera->getRayFromScreenPosition(pos, m_size); ege::Ray ray = m_camera->getRayFromScreenPosition(pos, m_size);
std::shared_ptr<ege::resource::Mesh> myMesh; ememory::SharedPtr<ege::resource::Mesh> myMesh;
myMesh = ege::resource::Mesh::createCube(1, "basics", etk::color::green); myMesh = ege::resource::Mesh::createCube(1, "basics", etk::color::green);
if (myMesh != nullptr) { if (myMesh != nullptr) {
std::shared_ptr<appl::ElementHerit> element = std::make_shared<appl::ElementHerit>(m_env); ememory::SharedPtr<appl::ElementHerit> element = ememory::makeShared<appl::ElementHerit>(m_env);
std::shared_ptr<ege::PhysicsBox> physic = std::make_shared<ege::PhysicsBox>(); ememory::SharedPtr<ege::PhysicsBox> physic = ememory::makeShared<ege::PhysicsBox>();
physic->setSize(vec3(1.01,1.01,1.01)); physic->setSize(vec3(1.01,1.01,1.01));
myMesh->addPhysicElement(physic); myMesh->addPhysicElement(physic);
element->setMesh(myMesh); element->setMesh(myMesh);

View File

@ -15,8 +15,8 @@
namespace appl { namespace appl {
class Windows : public ewol::widget::Windows { class Windows : public ewol::widget::Windows {
private: private:
std::shared_ptr<ege::Environement> m_env; ememory::SharedPtr<ege::Environement> m_env;
std::shared_ptr<ege::camera::View> m_camera; ememory::SharedPtr<ege::camera::View> m_camera;
protected: protected:
Windows(); Windows();
void init(); void init();

View File

@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
_context.getFontDefault().setUseExternal(true); _context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create(); ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows // create the specific windows
_context.setWindows(basicWindows); _context.setWindows(basicWindows);
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");

View File

@ -26,10 +26,10 @@ appl::Windows::Windows() {
} }
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() { static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
if (out != nullptr) { if (out != nullptr) {
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
// set the element material properties : // set the element material properties :
material->setAmbientFactor(vec4(1,1,1,1)); material->setAmbientFactor(vec4(1,1,1,1));
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));
@ -70,26 +70,26 @@ void appl::Windows::init() {
m_env = ege::Environement::create(); m_env = ege::Environement::create();
// Create basic Camera // Create basic Camera
m_camera = std::make_shared<ege::camera::View>(vec3(30,30,-100), vec3(0,0,0)); m_camera = ememory::makeShared<ege::camera::View>(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_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy)));
m_env->addCamera("basic", m_camera); m_env->addCamera("basic", m_camera);
// Create basic Camera // Create basic Camera
std::shared_ptr<ege::camera::View> camera2 = std::make_shared<ege::camera::View>(vec3(100,0,0), vec3(0,0,0)); ememory::SharedPtr<ege::camera::View> camera2 = ememory::makeShared<ege::camera::View>(vec3(100,0,0), vec3(0,0,0));
m_env->addCamera("front", camera2); m_env->addCamera("front", camera2);
// Create basic Camera // Create basic Camera
std::shared_ptr<ege::camera::View> camera3 = std::make_shared<ege::camera::View>(vec3(20,20,100), vec3(0,0,0)); ememory::SharedPtr<ege::camera::View> camera3 = ememory::makeShared<ege::camera::View>(vec3(20,20,100), vec3(0,0,0));
m_env->addCamera("top", camera3); m_env->addCamera("top", camera3);
// Create basic Camera // Create basic Camera
std::shared_ptr<ege::camera::View> camera4 = std::make_shared<ege::camera::View>(vec3(0,100,0), vec3(0,0,0)); ememory::SharedPtr<ege::camera::View> camera4 = ememory::makeShared<ege::camera::View>(vec3(0,100,0), vec3(0,0,0));
m_env->addCamera("left", camera4); m_env->addCamera("left", camera4);
std::shared_ptr<ewol::widget::Sizer> tmpSizerVert = ewol::widget::Sizer::create(); ememory::SharedPtr<ewol::widget::Sizer> tmpSizerVert = ewol::widget::Sizer::create();
if (tmpSizerVert == nullptr) { if (tmpSizerVert == nullptr) {
APPL_CRITICAL("Can not allocate widget ==> display might be in error"); APPL_CRITICAL("Can not allocate widget ==> display might be in error");
} else { } else {
tmpSizerVert->propertyMode.set(ewol::widget::Sizer::modeVert); tmpSizerVert->propertyMode.set(ewol::widget::Sizer::modeVert);
setSubWidget(tmpSizerVert); setSubWidget(tmpSizerVert);
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create(); ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
APPL_CRITICAL("Can not allocate widget ==> display might be in error"); APPL_CRITICAL("Can not allocate widget ==> display might be in error");
} else { } else {
@ -99,7 +99,7 @@ void appl::Windows::init() {
tmpWidget->setCamera("basic"); tmpWidget->setCamera("basic");
tmpSizerVert->subWidgetAdd(tmpWidget); tmpSizerVert->subWidgetAdd(tmpWidget);
} }
std::shared_ptr<ewol::widget::Sizer> tmpSizerHori = ewol::widget::Sizer::create(); ememory::SharedPtr<ewol::widget::Sizer> tmpSizerHori = ewol::widget::Sizer::create();
if (tmpSizerHori == nullptr) { if (tmpSizerHori == nullptr) {
APPL_CRITICAL("Can not allocate widget ==> display might be in error"); APPL_CRITICAL("Can not allocate widget ==> display might be in error");
} else { } else {
@ -128,7 +128,7 @@ void appl::Windows::init() {
} }
} }
std::shared_ptr<ege::resource::Mesh> myMesh; ememory::SharedPtr<ege::resource::Mesh> myMesh;
// Create an external box : // Create an external box :
myMesh = createViewBoxStar(); myMesh = createViewBoxStar();
if (myMesh != nullptr) { if (myMesh != nullptr) {
@ -141,10 +141,10 @@ void appl::Windows::init() {
} }
myMesh = ege::resource::Mesh::createCube(3); myMesh = ege::resource::Mesh::createCube(3);
if (myMesh != nullptr) { if (myMesh != nullptr) {
//std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env); //ememory::SharedPtr<ege::ElementBase> element = ememory::makeShared<ege::ElementBase>(m_env);
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env); ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
// add physic interface: // add physic interface:
std::shared_ptr<ege::PhysicsBox> physic = std::make_shared<ege::PhysicsBox>(); ememory::SharedPtr<ege::PhysicsBox> physic = ememory::makeShared<ege::PhysicsBox>();
physic->setSize(vec3(3.2,3.2,3.2)); physic->setSize(vec3(3.2,3.2,3.2));
myMesh->addPhysicElement(physic); myMesh->addPhysicElement(physic);
@ -156,11 +156,11 @@ void appl::Windows::init() {
} }
myMesh = ege::resource::Mesh::createCube(3); myMesh = ege::resource::Mesh::createCube(3);
if (myMesh != nullptr) { if (myMesh != nullptr) {
//element = std::make_shared<ege::ElementBase>(m_env); //element = ememory::makeShared<ege::ElementBase>(m_env);
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env); ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
// add physic interface: // add physic interface:
std::shared_ptr<ege::PhysicsSphere> physic = std::make_shared<ege::PhysicsSphere>(); ememory::SharedPtr<ege::PhysicsSphere> physic = ememory::makeShared<ege::PhysicsSphere>();
physic->setRadius(4.5f); physic->setRadius(4.5f);
myMesh->addPhysicElement(physic); myMesh->addPhysicElement(physic);

View File

@ -15,8 +15,8 @@
namespace appl { namespace appl {
class Windows : public ewol::widget::Windows { class Windows : public ewol::widget::Windows {
private: private:
std::shared_ptr<ege::Environement> m_env; ememory::SharedPtr<ege::Environement> m_env;
std::shared_ptr<ege::camera::View> m_camera; ememory::SharedPtr<ege::camera::View> m_camera;
protected: protected:
Windows(); Windows();
void init(); void init();

View File

@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
_context.getFontDefault().setUseExternal(true); _context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create(); ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows // create the specific windows
_context.setWindows(basicWindows); _context.setWindows(basicWindows);
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");

View File

@ -22,10 +22,10 @@ appl::Windows::Windows() {
propertyTitle.setDirectCheck("example ege: MeshCreator"); propertyTitle.setDirectCheck("example ege: MeshCreator");
} }
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() { static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog"); ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog");
if (out != nullptr) { if (out != nullptr) {
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
// set the element material properties : // set the element material properties :
material->setAmbientFactor(vec4(1,1,1,1)); material->setAmbientFactor(vec4(1,1,1,1));
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));
@ -57,10 +57,10 @@ static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
return out; return out;
} }
static std::shared_ptr<ege::resource::Mesh> createMars() { static ememory::SharedPtr<ege::resource::Mesh> createMars() {
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---"); ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---");
if (out != nullptr) { if (out != nullptr) {
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
material->setAmbientFactor(vec4(0.112f,0.112f,0.112f,1.0f)); material->setAmbientFactor(vec4(0.112f,0.112f,0.112f,1.0f));
material->setDiffuseFactor(vec4(0.512f,0.512f,0.512f,1.0f)); material->setDiffuseFactor(vec4(0.512f,0.512f,0.512f,1.0f));
material->setSpecularFactor(vec4(0.5f,0.5f,0.5f,1.0f)); material->setSpecularFactor(vec4(0.5f,0.5f,0.5f,1.0f));
@ -77,14 +77,14 @@ static std::shared_ptr<ege::resource::Mesh> createMars() {
void appl::Windows::init() { void appl::Windows::init() {
ewol::widget::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(); m_env = ege::Environement::create();
// Create basic Camera // Create basic Camera
m_camera = std::make_shared<ege::camera::View>(vec3(30,30,-100), vec3(50,0,0)); m_camera = ememory::makeShared<ege::camera::View>(vec3(30,30,-100), vec3(50,0,0));
m_env->addCamera("basic", m_camera); m_env->addCamera("basic", m_camera);
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create(); ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget ==> display might be in error"); APPL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
@ -95,7 +95,7 @@ void appl::Windows::init() {
setSubWidget(tmpWidget); setSubWidget(tmpWidget);
} }
// Create an external box : // Create an external box :
std::shared_ptr<ege::resource::Mesh> myMesh = createViewBoxStar(); ememory::SharedPtr<ege::resource::Mesh> myMesh = createViewBoxStar();
if (myMesh != nullptr) { if (myMesh != nullptr) {
m_env->addStaticMeshToDraw(myMesh); m_env->addStaticMeshToDraw(myMesh);
} }
@ -106,8 +106,8 @@ void appl::Windows::init() {
if (true) { if (true) {
myMesh = createMars(); myMesh = createMars();
if (myMesh != nullptr) { if (myMesh != nullptr) {
std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env); ememory::SharedPtr<ege::ElementBase> element = ememory::makeShared<ege::ElementBase>(m_env);
//std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env); //ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
element->setPosition(vec3(50,0,0)); element->setPosition(vec3(50,0,0));
element->setMesh(myMesh); element->setMesh(myMesh);
m_env->addElement(element); m_env->addElement(element);

View File

@ -14,8 +14,8 @@
namespace appl { namespace appl {
class Windows : public ewol::widget::Windows { class Windows : public ewol::widget::Windows {
private: private:
std::shared_ptr<ege::Environement> m_env; ememory::SharedPtr<ege::Environement> m_env;
std::shared_ptr<ege::camera::View> m_camera; ememory::SharedPtr<ege::camera::View> m_camera;
protected: protected:
Windows(); Windows();
void init(); void init();

View File

@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
_context.getFontDefault().setUseExternal(true); _context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create(); ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows // create the specific windows
_context.setWindows(basicWindows); _context.setWindows(basicWindows);
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");

View File

@ -26,10 +26,10 @@ appl::Windows::Windows() :
propertyTitle.setDirectCheck("example ege: RayTest"); propertyTitle.setDirectCheck("example ege: RayTest");
} }
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() { static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog"); ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
if (out != nullptr) { if (out != nullptr) {
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
// set the element material properties : // set the element material properties :
material->setAmbientFactor(vec4(1,1,1,1)); material->setAmbientFactor(vec4(1,1,1,1));
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));
@ -69,11 +69,11 @@ void appl::Windows::init() {
m_env = ege::Environement::create(); m_env = ege::Environement::create();
// Create basic Camera // Create basic Camera
m_camera = std::make_shared<ege::camera::View>(vec3(30,30,-100), vec3(0,0,0)); m_camera = ememory::makeShared<ege::camera::View>(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_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy)));
m_env->addCamera("basic", m_camera); m_env->addCamera("basic", m_camera);
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create(); ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget ==> display might be in error"); APPL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
@ -82,9 +82,9 @@ void appl::Windows::init() {
tmpWidget->propertyFill.set(bvec2(true,true)); tmpWidget->propertyFill.set(bvec2(true,true));
tmpWidget->setCamera("basic"); tmpWidget->setCamera("basic");
setSubWidget(tmpWidget); setSubWidget(tmpWidget);
tmpWidget->signalDisplayDebug.connect(shared_from_this(), &appl::Windows::onCallbackDisplayDebug); tmpWidget->signalDisplayDebug.connect(sharedFromThis(), &appl::Windows::onCallbackDisplayDebug);
} }
std::shared_ptr<ege::resource::Mesh> myMesh; ememory::SharedPtr<ege::resource::Mesh> myMesh;
// Create an external box : // Create an external box :
myMesh = createViewBoxStar(); myMesh = createViewBoxStar();
if (myMesh != nullptr) { if (myMesh != nullptr) {
@ -97,10 +97,10 @@ void appl::Windows::init() {
} }
myMesh = ege::resource::Mesh::createCube(3); myMesh = ege::resource::Mesh::createCube(3);
if (myMesh != nullptr) { if (myMesh != nullptr) {
//std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env); //ememory::SharedPtr<ege::ElementBase> element = ememory::makeShared<ege::ElementBase>(m_env);
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env); ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
// add physic interface: // add physic interface:
std::shared_ptr<ege::PhysicsBox> physic = std::make_shared<ege::PhysicsBox>(); ememory::SharedPtr<ege::PhysicsBox> physic = ememory::makeShared<ege::PhysicsBox>();
physic->setSize(vec3(3.2,3.2,3.2)); physic->setSize(vec3(3.2,3.2,3.2));
myMesh->addPhysicElement(physic); myMesh->addPhysicElement(physic);
@ -112,11 +112,11 @@ void appl::Windows::init() {
} }
myMesh = ege::resource::Mesh::createCube(3); myMesh = ege::resource::Mesh::createCube(3);
if (myMesh != nullptr) { if (myMesh != nullptr) {
//element = std::make_shared<ege::ElementBase>(m_env); //element = ememory::makeShared<ege::ElementBase>(m_env);
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env); ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
// add physic interface: // add physic interface:
std::shared_ptr<ege::PhysicsSphere> physic = std::make_shared<ege::PhysicsSphere>(); ememory::SharedPtr<ege::PhysicsSphere> physic = ememory::makeShared<ege::PhysicsSphere>();
physic->setRadius(4.5f); physic->setRadius(4.5f);
myMesh->addPhysicElement(physic); myMesh->addPhysicElement(physic);
@ -140,7 +140,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
m_ray = ray; m_ray = ray;
APPL_DEBUG("pos=" << pos << " ray = " << ray); APPL_DEBUG("pos=" << pos << " ray = " << ray);
m_destination = ray.testRay(m_env->getPhysicEngine()); m_destination = ray.testRay(m_env->getPhysicEngine());
std::pair<std::shared_ptr<ege::Element>, std::pair<vec3,vec3>> result = ray.testRayObject(m_env->getPhysicEngine()); std::pair<ememory::SharedPtr<ege::Element>, std::pair<vec3,vec3>> result = ray.testRayObject(m_env->getPhysicEngine());
if (result.first != nullptr) { if (result.first != nullptr) {
APPL_INFO("Select Object :" << result.first->getUID()); APPL_INFO("Select Object :" << result.first->getUID());
} }
@ -170,7 +170,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} }
void appl::Windows::onCallbackDisplayDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _obj) { void appl::Windows::onCallbackDisplayDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _obj) {
mat4 mat; mat4 mat;
mat.identity(); mat.identity();
// Display ray line // Display ray line

View File

@ -15,8 +15,8 @@
namespace appl { namespace appl {
class Windows : public ewol::widget::Windows { class Windows : public ewol::widget::Windows {
private: private:
std::shared_ptr<ege::Environement> m_env; ememory::SharedPtr<ege::Environement> m_env;
std::shared_ptr<ege::camera::View> m_camera; ememory::SharedPtr<ege::camera::View> m_camera;
protected: protected:
Windows(); Windows();
void init(); void init();
@ -25,7 +25,7 @@ namespace appl {
virtual ~Windows() { }; virtual ~Windows() { };
private: private:
bool onEventInput(const ewol::event::Input& _event); bool onEventInput(const ewol::event::Input& _event);
void onCallbackDisplayDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _obj); void onCallbackDisplayDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _obj);
ege::Ray m_ray; ege::Ray m_ray;
float m_angleTetha; float m_angleTetha;
float m_anglePsy; float m_anglePsy;

View File

@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
_context.getFontDefault().setUseExternal(true); _context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create(); ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows // create the specific windows
_context.setWindows(basicWindows); _context.setWindows(basicWindows);
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");