[DEV] update new ememory::SharedPtr
This commit is contained in:
parent
bf2c8bdc8c
commit
1a97ed92ac
@ -22,12 +22,12 @@
|
||||
// Documentetion of bullet library :
|
||||
// http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes
|
||||
|
||||
btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resource::Mesh>& _mesh) {
|
||||
btCollisionShape* ege::collision::createShape(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
|
||||
if (_mesh == nullptr) {
|
||||
EGE_DEBUG("Create empty shape (no mesh)");
|
||||
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) {
|
||||
EGE_DEBUG("Create empty shape (no default shape)");
|
||||
return new btEmptyShape();;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace ege {
|
||||
namespace collision {
|
||||
btCollisionShape* createShape(const std::shared_ptr<ege::resource::Mesh>& _mesh);
|
||||
btCollisionShape* createShape(const ememory::SharedPtr<ege::resource::Mesh>& _mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,12 +24,12 @@
|
||||
#include <btBulletDynamicsCommon.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) {
|
||||
return nullptr;
|
||||
}
|
||||
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++) {
|
||||
// chack nullptr pointer
|
||||
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) {
|
||||
EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
|
||||
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 << "'");
|
||||
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) {
|
||||
EGE_ERROR("allocation error '" << _type << "'");
|
||||
return nullptr;
|
||||
@ -160,7 +160,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
||||
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) {
|
||||
EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
|
||||
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 << "'");
|
||||
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) {
|
||||
EGE_ERROR("allocation error '" << _type << "'");
|
||||
return nullptr;
|
||||
@ -185,7 +185,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
||||
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) {
|
||||
EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
|
||||
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 << "'");
|
||||
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) {
|
||||
EGE_ERROR("allocation error '" << _type << "'");
|
||||
return nullptr;
|
||||
@ -210,7 +210,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
||||
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) {
|
||||
EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
|
||||
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 << "'");
|
||||
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) {
|
||||
EGE_ERROR("allocation error '" << _type << "'");
|
||||
return nullptr;
|
||||
@ -235,7 +235,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
||||
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) {
|
||||
EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
|
||||
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 << "'");
|
||||
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) {
|
||||
EGE_ERROR("allocation error '" << _type << "'");
|
||||
return nullptr;
|
||||
@ -260,7 +260,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
||||
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 ...
|
||||
if (_newElement == nullptr) {
|
||||
return;
|
||||
@ -276,7 +276,7 @@ void ege::Environement::addElement(std::shared_ptr<ege::Element> _newElement) {
|
||||
_newElement->dynamicEnable();
|
||||
}
|
||||
|
||||
void ege::Environement::rmElement(std::shared_ptr<ege::Element> _removeElement) {
|
||||
void ege::Environement::rmElement(ememory::SharedPtr<ege::Element> _removeElement) {
|
||||
if (_removeElement == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -457,11 +457,11 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event)
|
||||
}
|
||||
|
||||
|
||||
void ege::Environement::addCamera(const std::string& _name, const std::shared_ptr<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));
|
||||
}
|
||||
|
||||
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);
|
||||
if (cameraIt != m_listCamera.end()) {
|
||||
return cameraIt->second;
|
||||
|
@ -30,7 +30,7 @@ class btDynamicsWorld;
|
||||
namespace ege {
|
||||
class Element;
|
||||
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 {
|
||||
gameStart,
|
||||
@ -84,9 +84,9 @@ namespace ege {
|
||||
eproperty::List<enum gameStatus> propertyStatus; //!< the display is running (not in pause)
|
||||
eproperty::Value<float> propertyRatio; //!< Speed ratio
|
||||
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.
|
||||
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:
|
||||
Environement();
|
||||
public:
|
||||
@ -94,25 +94,25 @@ namespace ege {
|
||||
virtual ~Environement() { };
|
||||
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:
|
||||
/**
|
||||
* @brief Add a camera in the camera pool.
|
||||
* @param[in] _name Name of the camera.
|
||||
* @param[in] _camera Pointer on the camera to add.
|
||||
*/
|
||||
void addCamera(const std::string& _name, const std::shared_ptr<ege::Camera>& _camera);
|
||||
void addCamera(const std::string& _name, const ememory::SharedPtr<ege::Camera>& _camera);
|
||||
/**
|
||||
* @brief Get a specific camera.
|
||||
* @param[in] _name Name of the camera.
|
||||
* @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.
|
||||
* @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;
|
||||
}
|
||||
public:
|
||||
@ -134,15 +134,15 @@ namespace ege {
|
||||
* @return nullptr if an error occured OR the pointer on the element and it is already added on the system.
|
||||
* @note Pointer is return in case of setting properties on it...
|
||||
*/
|
||||
std::shared_ptr<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);
|
||||
std::shared_ptr<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);
|
||||
std::shared_ptr<ege::Element> createElement(const std::string& _type, bool _autoAddElement=true);
|
||||
ememory::SharedPtr<ege::Element> createElement(const std::string& _type, const std::string& _description, bool _autoAddElement=true);
|
||||
ememory::SharedPtr<ege::Element> createElement(const std::string& _type, const ejson::Value& _value, bool _autoAddElement=true);
|
||||
ememory::SharedPtr<ege::Element> createElement(const std::string& _type, const exml::Node& _node, bool _autoAddElement=true);
|
||||
ememory::SharedPtr<ege::Element> createElement(const std::string& _type, void* _data, bool _autoAddElement=true);
|
||||
ememory::SharedPtr<ege::Element> createElement(const std::string& _type, bool _autoAddElement=true);
|
||||
public:
|
||||
class ResultNearestElement {
|
||||
public:
|
||||
std::shared_ptr<ege::Element> element;
|
||||
ememory::SharedPtr<ege::Element> element;
|
||||
float dist;
|
||||
};
|
||||
#if 0
|
||||
@ -150,14 +150,14 @@ namespace ege {
|
||||
* @brief set the curent world
|
||||
* @param[in] _newWorld Pointer on the current world
|
||||
*/
|
||||
void setDynamicWorld(const std::shared_ptr<btDynamicsWorld>& _newWorld) {
|
||||
void setDynamicWorld(const ememory::SharedPtr<btDynamicsWorld>& _newWorld) {
|
||||
m_dynamicsWorld=_newWorld;
|
||||
};
|
||||
/**
|
||||
* @brief get the curent world
|
||||
* @return pointer on the current world
|
||||
*/
|
||||
std::shared_ptr<btDynamicsWorld> getDynamicWorld() {
|
||||
ememory::SharedPtr<btDynamicsWorld> getDynamicWorld() {
|
||||
return m_dynamicsWorld;
|
||||
};
|
||||
#endif
|
||||
@ -168,7 +168,7 @@ namespace ege {
|
||||
* @breif get a reference on the curent list of element games
|
||||
* @return all element list
|
||||
*/
|
||||
std::vector<std::shared_ptr<ege::Element>>& getElement() {
|
||||
std::vector<ememory::SharedPtr<ege::Element>>& getElement() {
|
||||
return m_listElement;
|
||||
};
|
||||
/**
|
||||
@ -177,7 +177,7 @@ namespace ege {
|
||||
* @param[in] _distance Maximum distance search == > return the element distance
|
||||
* @return Pointer on the neares element OR nullptr
|
||||
*/
|
||||
std::shared_ptr<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,
|
||||
float _distanceMax,
|
||||
@ -189,12 +189,12 @@ namespace ege {
|
||||
* @brief add an element on the list availlable.
|
||||
* @param[in] _newElement Element to add.
|
||||
*/
|
||||
void addElement(std::shared_ptr<ege::Element> _newElement);
|
||||
void addElement(ememory::SharedPtr<ege::Element> _newElement);
|
||||
/**
|
||||
* @brief remove an element on the list availlable.
|
||||
* @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.
|
||||
* @param[in,out] _resultList List of the element ordered.
|
||||
@ -224,12 +224,12 @@ namespace ege {
|
||||
private:
|
||||
void onCallbackPeriodicCall(const ewol::event::Time& _event);
|
||||
protected:
|
||||
std::vector<std::shared_ptr<ege::resource::Mesh>> m_listMeshToDrawFirst;
|
||||
std::vector<ememory::SharedPtr<ege::resource::Mesh>> m_listMeshToDrawFirst;
|
||||
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);
|
||||
}
|
||||
const std::vector<std::shared_ptr<ege::resource::Mesh>>& getStaticMeshToDraw() {
|
||||
const std::vector<ememory::SharedPtr<ege::resource::Mesh>>& getStaticMeshToDraw() {
|
||||
return m_listMeshToDrawFirst;
|
||||
}
|
||||
virtual void onChangePropertyStatus();
|
||||
|
@ -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) {
|
||||
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");
|
||||
}
|
||||
|
||||
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_halfplane, m_halfplane);
|
||||
_prog->uniform4(m_GL_ambientColor, m_ambientColor);
|
||||
|
@ -29,8 +29,8 @@ namespace ege {
|
||||
public:
|
||||
Light();
|
||||
~Light();
|
||||
void link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName);
|
||||
void draw(const std::shared_ptr<gale::resource::Program>& _prog);
|
||||
void link(const ememory::SharedPtr<gale::resource::Program>& _prog, const std::string& _baseName);
|
||||
void draw(const ememory::SharedPtr<gale::resource::Program>& _prog);
|
||||
void setDirection(const vec3& val) {
|
||||
m_direction = val;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ ege::MaterialGlId::MaterialGlId() :
|
||||
// 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) {
|
||||
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)");
|
||||
_prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
|
||||
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
|
||||
@ -70,7 +70,7 @@ void ege::Material::setTexture0(const std::string& _filename) {
|
||||
ivec2 tmpSize(256, 256);
|
||||
if (_filename != "") {
|
||||
// prevent overloard error :
|
||||
std::shared_ptr<ewol::resource::Texture> tmpCopy = m_texture0;
|
||||
ememory::SharedPtr<ewol::resource::Texture> tmpCopy = m_texture0;
|
||||
m_texture0 = ewol::resource::TextureFile::create(_filename, tmpSize);
|
||||
if (m_texture0 == nullptr) {
|
||||
EGE_ERROR("Can not load specific texture : " << _filename);
|
||||
|
@ -24,7 +24,7 @@ namespace ege {
|
||||
int32_t m_GL_shininess;
|
||||
int32_t m_GL_texture0;
|
||||
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;
|
||||
float m_shininess;
|
||||
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:
|
||||
std::vector<uint32_t> m_listIndexFaces;
|
||||
public:
|
||||
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) {
|
||||
m_ambientFactor = _val;
|
||||
}
|
||||
|
@ -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 stop = m_origin+m_direction*1000.0f;
|
||||
// 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());
|
||||
if (elem != nullptr) {
|
||||
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");
|
||||
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 {
|
||||
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() {
|
||||
|
@ -11,7 +11,7 @@ namespace ege {
|
||||
class Element;
|
||||
};
|
||||
#include <ege/physics/Engine.h>
|
||||
#include <memory>
|
||||
#include <ememory/memory.h>
|
||||
|
||||
namespace ege {
|
||||
class Ray {
|
||||
@ -65,7 +65,7 @@ namespace ege {
|
||||
void set(const vec3& _origin, const vec3& _direction);
|
||||
public:
|
||||
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();
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const ege::Ray& _obj);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
namespace ege {
|
||||
class Camera : public std::enable_shared_from_this<Camera>{
|
||||
class Camera : public ememory::EnableSharedFromThis<Camera>{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor.
|
||||
@ -168,7 +168,7 @@ namespace ege {
|
||||
* @brief Debug display of the current element
|
||||
* @param[in,out] draw Basic system to draw the debug shape and informations
|
||||
*/
|
||||
virtual void drawDebug(const std::shared_ptr<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) { }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -90,9 +90,9 @@ ege::Ray ege::camera::View::getRayFromScreen(const vec2& _offset) {
|
||||
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;
|
||||
if (_camera != shared_from_this()) {
|
||||
if (_camera != sharedFromThis()) {
|
||||
mat.identity();
|
||||
vec2 angles = tansformPositionToAngle(-getViewVector());
|
||||
mat.rotate(vec3(0,0,1), angles.x() - M_PI/2.0f);
|
||||
|
@ -73,7 +73,7 @@ namespace ege {
|
||||
virtual vec3 getViewVector() const;
|
||||
public:
|
||||
virtual ege::Ray getRayFromScreen(const vec2& _offset);
|
||||
virtual void drawDebug(const std::shared_ptr<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 getPsy();
|
||||
};
|
||||
|
@ -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_uID(0),
|
||||
m_mesh(),
|
||||
@ -77,7 +77,7 @@ bool ege::Element::unInit() {
|
||||
|
||||
|
||||
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) {
|
||||
EGE_ERROR("can not load the resources : " << _meshFileName);
|
||||
return false;
|
||||
@ -85,7 +85,7 @@ bool ege::Element::loadMesh(const std::string& _meshFileName) {
|
||||
return setMesh(tmpMesh);
|
||||
}
|
||||
|
||||
bool ege::Element::setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh) {
|
||||
bool ege::Element::setMesh(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
|
||||
if (m_mesh != nullptr) {
|
||||
m_mesh.reset();
|
||||
}
|
||||
@ -129,7 +129,7 @@ const float lifeHeight = 0.3f;
|
||||
const float lifeWidth = 2.0f;
|
||||
const float lifeYPos = 1.7f;
|
||||
|
||||
void ege::Element::drawLife(const std::shared_ptr<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) {
|
||||
return;
|
||||
}
|
||||
@ -168,7 +168,7 @@ void ege::Element::drawLife(const std::shared_ptr<ewol::resource::Colored3DObjec
|
||||
#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.setColor(etk::Color<>(0x00, 0xFF, 0x00, 0xFF));
|
||||
m_debugText.setPos(vec3(-20,32,0));
|
||||
|
@ -25,16 +25,16 @@
|
||||
#define ELEMENT_SCALE (1.0f/8.0f)
|
||||
|
||||
namespace ege {
|
||||
class Element : public std::enable_shared_from_this<Element> {
|
||||
class Element : public ememory::EnableSharedFromThis<Element> {
|
||||
protected:
|
||||
std::shared_ptr<ege::Environement> m_env;
|
||||
ememory::SharedPtr<ege::Environement> m_env;
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor (when constructer is called just add element that did not change.
|
||||
* The objest will be stored in a pool of element and keep a second time if needed == > redure memory allocation,
|
||||
* when needed, the system will call the init and un-init function...
|
||||
*/
|
||||
Element(const std::shared_ptr<ege::Environement>& _env);
|
||||
Element(const ememory::SharedPtr<ege::Environement>& _env);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
@ -67,7 +67,7 @@ namespace ege {
|
||||
return m_uID;
|
||||
};
|
||||
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:
|
||||
/**
|
||||
* @brief Select a mesh with a specific name.
|
||||
@ -82,12 +82,12 @@ namespace ege {
|
||||
* @note : this remove the shape and the mesh properties.
|
||||
* @return true if no error occured
|
||||
*/
|
||||
virtual bool setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh);
|
||||
virtual bool setMesh(const ememory::SharedPtr<ege::resource::Mesh>& _mesh);
|
||||
/**
|
||||
* @brief get a pointer on the Mesh file.
|
||||
* @return the mesh pointer.
|
||||
*/
|
||||
inline const std::shared_ptr<ege::resource::Mesh>& getMesh() {
|
||||
inline const ememory::SharedPtr<ege::resource::Mesh>& getMesh() {
|
||||
return m_mesh;
|
||||
};
|
||||
protected:
|
||||
@ -159,7 +159,7 @@ namespace ege {
|
||||
* @brief draw the current life of the element
|
||||
*/
|
||||
// TODO : Remove this ...
|
||||
virtual void drawLife(const std::shared_ptr<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:
|
||||
// For debug only ...
|
||||
@ -169,7 +169,7 @@ namespace ege {
|
||||
* @brief Debug display of the current element
|
||||
* @param[in,out] draw Basic system to draw the debug shape and informations
|
||||
*/
|
||||
virtual void drawDebug(const std::shared_ptr<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 ...
|
||||
@ -192,7 +192,7 @@ namespace ege {
|
||||
* @brief Event arrive when an element has been remove from the system == > this permit to keep pointer of ennemy, and not search them every cycle ...
|
||||
* @param[in] _removedElement Pointer on the element removed.
|
||||
*/
|
||||
virtual void elementIsRemoved(std::shared_ptr<ege::Element> _removedElement) { };
|
||||
virtual void elementIsRemoved(ememory::SharedPtr<ege::Element> _removedElement) { };
|
||||
protected:
|
||||
bool m_fixe; //!< is a fixed element == > used for placement of every elements
|
||||
public:
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <ege/elements/ElementBase.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),
|
||||
m_position(0,0,0) {
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace ege {
|
||||
* The objest will be stored in a pool of element and keep a second time if needed == > redure memory allocation,
|
||||
* when needed, the system will call the init and un-init function...
|
||||
*/
|
||||
ElementBase(const std::shared_ptr<ege::Environement>& _env);
|
||||
ElementBase(const ememory::SharedPtr<ege::Environement>& _env);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
|
@ -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),
|
||||
m_body(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");
|
||||
if (nullptr!=m_mesh) {
|
||||
removeShape();
|
||||
@ -170,7 +170,7 @@ const float ege::ElementPhysic::getInvMass() {
|
||||
};
|
||||
|
||||
void ege::ElementPhysic::drawShape(const btCollisionShape* _shape,
|
||||
const std::shared_ptr<ewol::resource::Colored3DObject>& _draw,
|
||||
const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw,
|
||||
mat4 _transformationMatrix,
|
||||
std::vector<vec3> _tmpVertices) {
|
||||
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);
|
||||
btScalar mmm[16];
|
||||
btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_body->getMotionState();
|
||||
|
@ -43,7 +43,7 @@ namespace ege {
|
||||
* @param[in] _env glabal ege environement
|
||||
* @param[in] _autoRigidBody add a basic rigid body (not availlable after befor setting a shape)
|
||||
*/
|
||||
ElementPhysic(const std::shared_ptr<ege::Environement>& _env, bool _autoRigidBody=true);
|
||||
ElementPhysic(const ememory::SharedPtr<ege::Environement>& _env, bool _autoRigidBody=true);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
@ -76,7 +76,7 @@ namespace ege {
|
||||
*/
|
||||
void removeShape();
|
||||
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)
|
||||
* @param[in] pass Id of the current pass : [0..?]
|
||||
@ -86,7 +86,7 @@ namespace ege {
|
||||
/**
|
||||
* @brief draw the current life of the element
|
||||
*/
|
||||
// virtual void drawLife(const std::shared_ptr<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 ...
|
||||
protected:
|
||||
vec3 m_theoricPosition;
|
||||
@ -175,10 +175,10 @@ namespace ege {
|
||||
virtual void onDestroy() {};
|
||||
virtual const vec3& getPosition();
|
||||
virtual void setPosition(const vec3& _pos);
|
||||
virtual void drawDebug(const std::shared_ptr<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:
|
||||
void drawShape(const btCollisionShape* _shape,
|
||||
const std::shared_ptr<ewol::resource::Colored3DObject>& _draw,
|
||||
const ememory::SharedPtr<ewol::resource::Colored3DObject>& _draw,
|
||||
mat4 _transformationMatrix,
|
||||
std::vector<vec3> _tmpVertices);
|
||||
protected:
|
||||
@ -202,7 +202,7 @@ namespace ege {
|
||||
* @param[in] _point Position of the impact in the global world
|
||||
* @param[in] _normal Normal of the impact
|
||||
*/
|
||||
virtual void onCollisionDetected(const std::shared_ptr<ege::Element>& _obj, const vec3& _point, const vec3& _normal) {};
|
||||
virtual void onCollisionDetected(const ememory::SharedPtr<ege::Element>& _obj, const vec3& _point, const vec3& _normal) {};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -40,10 +40,10 @@ static bool handleContactsProcess(btManifoldPoint& _point, btCollisionObject* _b
|
||||
}
|
||||
EGE_VERBOSE("collision process between " << elem0->getUID() << " && " << elem1->getUID() << " pos=" << _point.getPositionWorldOnA() << " norm=" << _point.m_normalWorldOnB);
|
||||
if (elem0->getCollisionDetectionStatus() == true) {
|
||||
elem0->onCollisionDetected(elem1->shared_from_this(), _point.getPositionWorldOnA(), -_point.m_normalWorldOnB);
|
||||
elem0->onCollisionDetected(elem1->sharedFromThis(), _point.getPositionWorldOnA(), -_point.m_normalWorldOnB);
|
||||
}
|
||||
if (elem1->getCollisionDetectionStatus() == true) {
|
||||
elem1->onCollisionDetected(elem0->shared_from_this(), _point.getPositionWorldOnA(), _point.m_normalWorldOnB);
|
||||
elem1->onCollisionDetected(elem0->sharedFromThis(), _point.getPositionWorldOnA(), _point.m_normalWorldOnB);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -65,39 +65,39 @@ ege::physics::Engine::~Engine() {
|
||||
*/
|
||||
}
|
||||
|
||||
void ege::physics::Engine::setBulletConfig(std::shared_ptr<btDefaultCollisionConfiguration> _collisionConfiguration,
|
||||
std::shared_ptr<btCollisionDispatcher> _dispatcher,
|
||||
std::shared_ptr<btBroadphaseInterface> _broadphase,
|
||||
std::shared_ptr<btConstraintSolver> _solver,
|
||||
std::shared_ptr<btDynamicsWorld> _dynamicsWorld) {
|
||||
void ege::physics::Engine::setBulletConfig(ememory::SharedPtr<btDefaultCollisionConfiguration> _collisionConfiguration,
|
||||
ememory::SharedPtr<btCollisionDispatcher> _dispatcher,
|
||||
ememory::SharedPtr<btBroadphaseInterface> _broadphase,
|
||||
ememory::SharedPtr<btConstraintSolver> _solver,
|
||||
ememory::SharedPtr<btDynamicsWorld> _dynamicsWorld) {
|
||||
if (_collisionConfiguration != nullptr) {
|
||||
m_collisionConfiguration = _collisionConfiguration;
|
||||
} else {
|
||||
m_collisionConfiguration = std::make_shared<btDefaultCollisionConfiguration>();
|
||||
m_collisionConfiguration = ememory::makeShared<btDefaultCollisionConfiguration>();
|
||||
}
|
||||
///use the default collision dispatcher.
|
||||
if (_dispatcher != nullptr) {
|
||||
m_dispatcher = _dispatcher;
|
||||
} else {
|
||||
m_dispatcher = std::make_shared<btCollisionDispatcher>(m_collisionConfiguration.get());
|
||||
m_dispatcher = ememory::makeShared<btCollisionDispatcher>(m_collisionConfiguration.get());
|
||||
}
|
||||
if (_broadphase != nullptr) {
|
||||
m_broadphase = _broadphase;
|
||||
} else {
|
||||
m_broadphase = std::make_shared<btDbvtBroadphase>();
|
||||
m_broadphase = ememory::makeShared<btDbvtBroadphase>();
|
||||
}
|
||||
|
||||
///the default constraint solver.
|
||||
if (_solver != nullptr) {
|
||||
m_solver = _solver;
|
||||
} else {
|
||||
m_solver = std::make_shared<btSequentialImpulseConstraintSolver>();
|
||||
m_solver = ememory::makeShared<btSequentialImpulseConstraintSolver>();
|
||||
}
|
||||
|
||||
if (_dynamicsWorld != nullptr) {
|
||||
m_dynamicsWorld = _dynamicsWorld;
|
||||
} 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
|
||||
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++) {
|
||||
btManifoldPoint& pt = contactManifold->getContactPoint(j);
|
||||
if (pt.getDistance()<0.f) {
|
||||
out.push_back(collisionPoints(elem0->shared_from_this(), elem1->shared_from_this(), pt.getPositionWorldOnA(), pt.getPositionWorldOnB(), pt.m_normalWorldOnB));
|
||||
out.push_back(collisionPoints(elem0->sharedFromThis(), elem1->sharedFromThis(), pt.getPositionWorldOnA(), pt.getPositionWorldOnB(), pt.m_normalWorldOnB));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,31 +41,31 @@ namespace ege {
|
||||
class Engine {
|
||||
private:
|
||||
///this is the most important class
|
||||
std::shared_ptr<btDefaultCollisionConfiguration> m_collisionConfiguration;
|
||||
std::shared_ptr<btCollisionDispatcher> m_dispatcher;
|
||||
std::shared_ptr<btBroadphaseInterface> m_broadphase;
|
||||
std::shared_ptr<btConstraintSolver> m_solver;
|
||||
std::shared_ptr<btDynamicsWorld> m_dynamicsWorld;
|
||||
ememory::SharedPtr<btDefaultCollisionConfiguration> m_collisionConfiguration;
|
||||
ememory::SharedPtr<btCollisionDispatcher> m_dispatcher;
|
||||
ememory::SharedPtr<btBroadphaseInterface> m_broadphase;
|
||||
ememory::SharedPtr<btConstraintSolver> m_solver;
|
||||
ememory::SharedPtr<btDynamicsWorld> m_dynamicsWorld;
|
||||
public:
|
||||
Engine();
|
||||
~Engine();
|
||||
void setBulletConfig(std::shared_ptr<btDefaultCollisionConfiguration> _collisionConfiguration=nullptr,
|
||||
std::shared_ptr<btCollisionDispatcher> _dispatcher=nullptr,
|
||||
std::shared_ptr<btBroadphaseInterface> _broadphase=nullptr,
|
||||
std::shared_ptr<btConstraintSolver> _solver=nullptr,
|
||||
std::shared_ptr<btDynamicsWorld> _dynamicsWorld=nullptr);
|
||||
void setBulletConfig(ememory::SharedPtr<btDefaultCollisionConfiguration> _collisionConfiguration=nullptr,
|
||||
ememory::SharedPtr<btCollisionDispatcher> _dispatcher=nullptr,
|
||||
ememory::SharedPtr<btBroadphaseInterface> _broadphase=nullptr,
|
||||
ememory::SharedPtr<btConstraintSolver> _solver=nullptr,
|
||||
ememory::SharedPtr<btDynamicsWorld> _dynamicsWorld=nullptr);
|
||||
/**
|
||||
* @brief set the curent 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;
|
||||
};
|
||||
/**
|
||||
* @brief get the curent world
|
||||
* @return pointer on the current world
|
||||
*/
|
||||
std::shared_ptr<btDynamicsWorld> getDynamicWorld() {
|
||||
ememory::SharedPtr<btDynamicsWorld> getDynamicWorld() {
|
||||
return m_dynamicsWorld;
|
||||
};
|
||||
public:
|
||||
@ -73,13 +73,13 @@ namespace ege {
|
||||
//! @not_in_doc
|
||||
class collisionPoints {
|
||||
public:
|
||||
std::shared_ptr<ege::Element> elem1;
|
||||
std::shared_ptr<ege::Element> elem2;
|
||||
ememory::SharedPtr<ege::Element> elem1;
|
||||
ememory::SharedPtr<ege::Element> elem2;
|
||||
vec3 positionElem1;
|
||||
vec3 positionElem2;
|
||||
vec3 normalElem2;
|
||||
collisionPoints(const std::shared_ptr<ege::Element>& _elem1,
|
||||
const std::shared_ptr<ege::Element>& _elem2,
|
||||
collisionPoints(const ememory::SharedPtr<ege::Element>& _elem1,
|
||||
const ememory::SharedPtr<ege::Element>& _elem2,
|
||||
const vec3& _pos1,
|
||||
const vec3& _pos2,
|
||||
const vec3& _normal) :
|
||||
|
@ -13,21 +13,21 @@
|
||||
#include <ege/physicsShape/PhysicsSphere.h>
|
||||
|
||||
|
||||
std::shared_ptr<ege::PhysicsShape> ege::PhysicsShape::create(const std::string& _name) {
|
||||
std::shared_ptr<ege::PhysicsShape> tmpp = nullptr;
|
||||
ememory::SharedPtr<ege::PhysicsShape> ege::PhysicsShape::create(const std::string& _name) {
|
||||
ememory::SharedPtr<ege::PhysicsShape> tmpp = nullptr;
|
||||
std::string name = etk::tolower(_name);
|
||||
if (name == "box") {
|
||||
tmpp = std::make_shared<ege::PhysicsBox>();
|
||||
tmpp = ememory::makeShared<ege::PhysicsBox>();
|
||||
} else if (name == "sphere") {
|
||||
tmpp = std::make_shared<ege::PhysicsSphere>();
|
||||
tmpp = ememory::makeShared<ege::PhysicsSphere>();
|
||||
} else if (name == "cone") {
|
||||
tmpp = std::make_shared<ege::PhysicsCone>();
|
||||
tmpp = ememory::makeShared<ege::PhysicsCone>();
|
||||
} else if (name == "cylinder") {
|
||||
tmpp = std::make_shared<ege::PhysicsCylinder>();
|
||||
tmpp = ememory::makeShared<ege::PhysicsCylinder>();
|
||||
} else if (name == "capsule") {
|
||||
tmpp = std::make_shared<ege::PhysicsCapsule>();
|
||||
tmpp = ememory::makeShared<ege::PhysicsCapsule>();
|
||||
} else if (name == "convexhull") {
|
||||
tmpp = std::make_shared<ege::PhysicsConvexHull>();
|
||||
tmpp = ememory::makeShared<ege::PhysicsConvexHull>();
|
||||
} else {
|
||||
EGE_ERROR("Create an unknow element : '" << _name << "' availlable : [BOX,SPHERE,CONE,CYLINDER,CAPSULE,CONVEXHULL]");
|
||||
return nullptr;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector4D.h>
|
||||
#include <etk/math/Vector3D.h>
|
||||
#include <memory>
|
||||
#include <ememory/memory.h>
|
||||
|
||||
|
||||
namespace ege {
|
||||
@ -22,7 +22,7 @@ namespace ege {
|
||||
|
||||
class PhysicsShape {
|
||||
public:
|
||||
static std::shared_ptr<ege::PhysicsShape> create(const std::string& _name);
|
||||
static ememory::SharedPtr<ege::PhysicsShape> create(const std::string& _name);
|
||||
public:
|
||||
enum type {
|
||||
unknow,
|
||||
|
@ -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) {
|
||||
EGE_ERROR(" can not add material with null pointer");
|
||||
return;
|
||||
|
@ -29,11 +29,11 @@ namespace ege {
|
||||
namespace resource {
|
||||
class Mesh : public gale::Resource {
|
||||
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),
|
||||
float _size=1.0f,
|
||||
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 etk::Color<float>& _color=etk::color::white);
|
||||
public:
|
||||
@ -49,7 +49,7 @@ namespace ege {
|
||||
enum normalMode m_normalMode; // select the normal mode of display
|
||||
bool m_checkNormal; //!< when enable, this check the normal of the mesh before sending it at the 3d card
|
||||
protected:
|
||||
std::shared_ptr<gale::resource::Program> m_GLprogram;
|
||||
ememory::SharedPtr<gale::resource::Program> m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
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_listVertexNormal; //!< List of all Face normal, when calculated
|
||||
etk::Hash<FaceIndexing> m_listFaces; //!< List of all Face for the mesh
|
||||
etk::Hash<std::shared_ptr<ege::Material>> m_materials;
|
||||
std::vector<std::shared_ptr<ege::PhysicsShape>> m_physics; //!< collision shape module ... (independent of bullet lib)
|
||||
etk::Hash<ememory::SharedPtr<ege::Material>> m_materials;
|
||||
std::vector<ememory::SharedPtr<ege::PhysicsShape>> m_physics; //!< collision shape module ... (independent of bullet lib)
|
||||
void clean();
|
||||
protected:
|
||||
std::shared_ptr<gale::resource::VirtualBufferObject> m_verticesVBO;
|
||||
ememory::SharedPtr<gale::resource::VirtualBufferObject> m_verticesVBO;
|
||||
protected:
|
||||
Mesh();
|
||||
void init(const std::string& _fileName="---", const std::string& _shaderName="DATA:textured3D2.prog");
|
||||
@ -97,7 +97,7 @@ namespace ege {
|
||||
bool loadOBJ(const std::string& _fileName);
|
||||
bool loadEMF(const std::string& _fileName);
|
||||
public:
|
||||
void addMaterial(const std::string& _name, std::shared_ptr<ege::Material> _data);
|
||||
void addMaterial(const std::string& _name, ememory::SharedPtr<ege::Material> _data);
|
||||
public:
|
||||
/**
|
||||
* @brief set the check of normal position befor sending it to the openGl card
|
||||
@ -113,10 +113,10 @@ namespace ege {
|
||||
bool getCheckNormal() {
|
||||
return m_checkNormal;
|
||||
};
|
||||
const std::vector<std::shared_ptr<ege::PhysicsShape>>& getPhysicalProperties() const {
|
||||
const std::vector<ememory::SharedPtr<ege::PhysicsShape>>& getPhysicalProperties() const {
|
||||
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);
|
||||
}
|
||||
private:
|
||||
|
@ -7,11 +7,11 @@
|
||||
#include <ege/debug.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);
|
||||
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) {
|
||||
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 :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
|
@ -171,9 +171,9 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
||||
int32_t meshFaceMaterialID = -1;
|
||||
// material global param :
|
||||
std::string materialName = "";
|
||||
std::shared_ptr<ege::Material> material;
|
||||
ememory::SharedPtr<ege::Material> material;
|
||||
// physical shape:
|
||||
std::shared_ptr<ege::PhysicsShape> physics;
|
||||
ememory::SharedPtr<ege::PhysicsShape> physics;
|
||||
while (1) {
|
||||
int32_t level = countIndent(fileName);
|
||||
if (level == 0) {
|
||||
@ -416,7 +416,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
||||
materialName = "";
|
||||
material = nullptr;
|
||||
}
|
||||
material = std::make_shared<ege::Material>();
|
||||
material = ememory::makeShared<ege::Material>();
|
||||
materialName = inputDataLine;
|
||||
currentMode = EMFModuleMaterialNamed;
|
||||
EGE_VERBOSE(" "<< materialName);
|
||||
|
@ -7,10 +7,10 @@
|
||||
#include <ege/debug.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) {
|
||||
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const std::string& _materialName) {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||
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 :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
|
@ -30,7 +30,7 @@ static int32_t addUV(std::vector<vec2>& _listUV, int32_t _uvId, float _add) {
|
||||
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) {
|
||||
/*
|
||||
5
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace ege {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <ege/debug.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) {
|
||||
_recursionLevel = std::max(_recursionLevel, 3);
|
||||
float size = 1.0f;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace ege {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
// This is the direct generation basis on the .obj system
|
||||
/*
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace ege {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace ege {
|
||||
private:
|
||||
// mesh name :
|
||||
std::string m_meshName;
|
||||
std::shared_ptr<ege::resource::Mesh> m_object;
|
||||
ememory::SharedPtr<ege::resource::Mesh> m_object;
|
||||
// mesh display properties:
|
||||
vec3 m_position;
|
||||
vec3 m_angle;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
|
||||
|
||||
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}}";
|
||||
}
|
||||
};
|
||||
@ -89,14 +89,14 @@ void ege::widget::Scene::onDraw() {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
EGE_ERROR(" can not get camera named: '" << m_cameraName << "'");
|
||||
return;
|
||||
}
|
||||
//EGE_DEBUG("Draw (start)");
|
||||
mat4 tmpMatrix;
|
||||
std::shared_ptr<btDynamicsWorld> world = m_env->getPhysicEngine().getDynamicWorld();
|
||||
ememory::SharedPtr<btDynamicsWorld> world = m_env->getPhysicEngine().getDynamicWorld();
|
||||
if (world != nullptr) {
|
||||
|
||||
m_env->getOrderedElementForDisplay(m_displayElementOrdered, camera->getEye(), camera->getViewVector());
|
||||
@ -123,7 +123,7 @@ void ege::widget::Scene::onDraw() {
|
||||
m_displayElementOrdered[iii].element->drawDebug(m_debugDrawProperty, camera);
|
||||
}
|
||||
// Draw debug ... (Camera)
|
||||
std::map<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) {
|
||||
if (itCam.second != nullptr) {
|
||||
itCam.second->drawDebug(m_debugDrawProperty, camera);
|
||||
@ -172,7 +172,7 @@ void ege::widget::Scene::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
// here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left
|
||||
gale::openGL::setViewPort(m_origin, m_size);
|
||||
// configure render with the camera...
|
||||
std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
if (camera != nullptr) {
|
||||
camera->configureOpenGL();
|
||||
}
|
||||
@ -191,7 +191,7 @@ void ege::widget::Scene::setCamera(const std::string& _cameraName) {
|
||||
}
|
||||
m_cameraName = _cameraName;
|
||||
// Update camera aspect ratio:
|
||||
std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
if (camera != nullptr) {
|
||||
camera->setSceenSize(m_size);
|
||||
}
|
||||
@ -200,12 +200,12 @@ void ege::widget::Scene::setCamera(const std::string& _cameraName) {
|
||||
void ege::widget::Scene::calculateSize() {
|
||||
ewol::Widget::calculateSize();
|
||||
// Update camera aspect ratio:
|
||||
std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
if (camera != nullptr) {
|
||||
camera->setSceenSize(m_size);
|
||||
}
|
||||
}
|
||||
|
||||
#include <esignal/details/ISignal.hxx>
|
||||
template class esignal::ISignal<std::shared_ptr<ewol::resource::Colored3DObject>>;
|
||||
template class esignal::ISignal<ememory::SharedPtr<ewol::resource::Colored3DObject>>;
|
||||
|
||||
|
@ -35,13 +35,13 @@ namespace ege {
|
||||
class Scene : public ewol::Widget {
|
||||
public:
|
||||
// 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
|
||||
eproperty::Value<bool> propertyDebugPhysic; //!< display Physic Debug
|
||||
eproperty::Value<bool> propertyDebugApplication; //!< display Application Debug
|
||||
protected:
|
||||
std::shared_ptr<ege::Environement> m_env;
|
||||
std::shared_ptr<ewol::resource::Colored3DObject> m_debugDrawProperty;
|
||||
ememory::SharedPtr<ege::Environement> m_env;
|
||||
ememory::SharedPtr<ewol::resource::Colored3DObject> m_debugDrawProperty;
|
||||
public:
|
||||
protected:
|
||||
/**
|
||||
@ -51,7 +51,7 @@ namespace ege {
|
||||
Scene();
|
||||
void init();
|
||||
public:
|
||||
void setEnv(std::shared_ptr<ege::Environement> _env) {
|
||||
void setEnv(ememory::SharedPtr<ege::Environement> _env) {
|
||||
m_env = _env;
|
||||
}
|
||||
public:
|
||||
|
@ -23,10 +23,10 @@ appl::Windows::Windows() {
|
||||
}
|
||||
|
||||
|
||||
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
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 :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
@ -65,14 +65,14 @@ static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||
void appl::Windows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
|
||||
getObjectManager().periodicCall.connect(shared_from_this(), &appl::Windows::onCallbackPeriodicUpdateCamera);
|
||||
getObjectManager().periodicCall.connect(sharedFromThis(), &appl::Windows::onCallbackPeriodicUpdateCamera);
|
||||
|
||||
m_env = ege::Environement::create();
|
||||
// Create basic Camera
|
||||
m_camera = std::make_shared<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);
|
||||
|
||||
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
@ -82,7 +82,7 @@ void appl::Windows::init() {
|
||||
tmpWidget->setCamera("basic");
|
||||
setSubWidget(tmpWidget);
|
||||
}
|
||||
std::shared_ptr<ege::resource::Mesh> myMesh;
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box :
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
|
@ -14,8 +14,8 @@
|
||||
namespace appl {
|
||||
class Windows : public ewol::widget::Windows {
|
||||
private:
|
||||
std::shared_ptr<ege::Environement> m_env;
|
||||
std::shared_ptr<ege::camera::View> m_camera;
|
||||
ememory::SharedPtr<ege::Environement> m_env;
|
||||
ememory::SharedPtr<ege::camera::View> m_camera;
|
||||
protected:
|
||||
Windows();
|
||||
void init();
|
||||
|
@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
_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
|
||||
_context.setWindows(basicWindows);
|
||||
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||
|
@ -26,10 +26,10 @@ appl::Windows::Windows() {
|
||||
}
|
||||
|
||||
|
||||
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
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 :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
@ -68,15 +68,15 @@ static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||
void appl::Windows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
|
||||
getObjectManager().periodicCall.connect(shared_from_this(), &appl::Windows::onCallbackPeriodicCheckCollision);
|
||||
getObjectManager().periodicCall.connect(sharedFromThis(), &appl::Windows::onCallbackPeriodicCheckCollision);
|
||||
|
||||
m_env = ege::Environement::create();
|
||||
// Create basic Camera
|
||||
m_camera = std::make_shared<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_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) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
@ -87,7 +87,7 @@ void appl::Windows::init() {
|
||||
setSubWidget(tmpWidget);
|
||||
}
|
||||
|
||||
std::shared_ptr<ege::resource::Mesh> myMesh;
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box :
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
@ -100,10 +100,10 @@ void appl::Windows::init() {
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3);
|
||||
if (myMesh != nullptr) {
|
||||
//std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env);
|
||||
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||
//ememory::SharedPtr<ege::ElementBase> element = ememory::makeShared<ege::ElementBase>(m_env);
|
||||
ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
|
||||
// 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));
|
||||
myMesh->addPhysicElement(physic);
|
||||
|
||||
@ -116,11 +116,11 @@ void appl::Windows::init() {
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3);
|
||||
if (myMesh != nullptr) {
|
||||
//element = std::make_shared<ege::ElementBase>(m_env);
|
||||
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||
//element = ememory::makeShared<ege::ElementBase>(m_env);
|
||||
ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
|
||||
|
||||
// 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);
|
||||
myMesh->addPhysicElement(physic);
|
||||
|
||||
@ -140,11 +140,11 @@ void appl::Windows::init() {
|
||||
namespace appl {
|
||||
class ElementHerit : public ege::ElementPhysic {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
};
|
||||
@ -158,11 +158,11 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
vec2 pos = relativePosition(_event.getPos());
|
||||
ege::Ray ray = m_camera->getRayFromScreenPosition(pos, m_size);
|
||||
|
||||
std::shared_ptr<ege::resource::Mesh> myMesh;
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
myMesh = ege::resource::Mesh::createCube(1, "basics", etk::color::green);
|
||||
if (myMesh != nullptr) {
|
||||
std::shared_ptr<appl::ElementHerit> element = std::make_shared<appl::ElementHerit>(m_env);
|
||||
std::shared_ptr<ege::PhysicsBox> physic = std::make_shared<ege::PhysicsBox>();
|
||||
ememory::SharedPtr<appl::ElementHerit> element = ememory::makeShared<appl::ElementHerit>(m_env);
|
||||
ememory::SharedPtr<ege::PhysicsBox> physic = ememory::makeShared<ege::PhysicsBox>();
|
||||
physic->setSize(vec3(1.01,1.01,1.01));
|
||||
myMesh->addPhysicElement(physic);
|
||||
element->setMesh(myMesh);
|
||||
|
@ -15,8 +15,8 @@
|
||||
namespace appl {
|
||||
class Windows : public ewol::widget::Windows {
|
||||
private:
|
||||
std::shared_ptr<ege::Environement> m_env;
|
||||
std::shared_ptr<ege::camera::View> m_camera;
|
||||
ememory::SharedPtr<ege::Environement> m_env;
|
||||
ememory::SharedPtr<ege::camera::View> m_camera;
|
||||
protected:
|
||||
Windows();
|
||||
void init();
|
||||
|
@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
_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
|
||||
_context.setWindows(basicWindows);
|
||||
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||
|
@ -26,10 +26,10 @@ appl::Windows::Windows() {
|
||||
}
|
||||
|
||||
|
||||
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
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 :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
@ -70,26 +70,26 @@ void appl::Windows::init() {
|
||||
|
||||
m_env = ege::Environement::create();
|
||||
// Create basic Camera
|
||||
m_camera = std::make_shared<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_env->addCamera("basic", m_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);
|
||||
// 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);
|
||||
// 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);
|
||||
|
||||
std::shared_ptr<ewol::widget::Sizer> tmpSizerVert = ewol::widget::Sizer::create();
|
||||
ememory::SharedPtr<ewol::widget::Sizer> tmpSizerVert = ewol::widget::Sizer::create();
|
||||
if (tmpSizerVert == nullptr) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpSizerVert->propertyMode.set(ewol::widget::Sizer::modeVert);
|
||||
setSubWidget(tmpSizerVert);
|
||||
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
@ -99,7 +99,7 @@ void appl::Windows::init() {
|
||||
tmpWidget->setCamera("basic");
|
||||
tmpSizerVert->subWidgetAdd(tmpWidget);
|
||||
}
|
||||
std::shared_ptr<ewol::widget::Sizer> tmpSizerHori = ewol::widget::Sizer::create();
|
||||
ememory::SharedPtr<ewol::widget::Sizer> tmpSizerHori = ewol::widget::Sizer::create();
|
||||
if (tmpSizerHori == nullptr) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
@ -128,7 +128,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<ege::resource::Mesh> myMesh;
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box :
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
@ -141,10 +141,10 @@ void appl::Windows::init() {
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3);
|
||||
if (myMesh != nullptr) {
|
||||
//std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env);
|
||||
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||
//ememory::SharedPtr<ege::ElementBase> element = ememory::makeShared<ege::ElementBase>(m_env);
|
||||
ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
|
||||
// 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));
|
||||
myMesh->addPhysicElement(physic);
|
||||
|
||||
@ -156,11 +156,11 @@ void appl::Windows::init() {
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3);
|
||||
if (myMesh != nullptr) {
|
||||
//element = std::make_shared<ege::ElementBase>(m_env);
|
||||
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||
//element = ememory::makeShared<ege::ElementBase>(m_env);
|
||||
ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
|
||||
|
||||
// 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);
|
||||
myMesh->addPhysicElement(physic);
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
namespace appl {
|
||||
class Windows : public ewol::widget::Windows {
|
||||
private:
|
||||
std::shared_ptr<ege::Environement> m_env;
|
||||
std::shared_ptr<ege::camera::View> m_camera;
|
||||
ememory::SharedPtr<ege::Environement> m_env;
|
||||
ememory::SharedPtr<ege::camera::View> m_camera;
|
||||
protected:
|
||||
Windows();
|
||||
void init();
|
||||
|
@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
_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
|
||||
_context.setWindows(basicWindows);
|
||||
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||
|
@ -22,10 +22,10 @@ appl::Windows::Windows() {
|
||||
propertyTitle.setDirectCheck("example ege: MeshCreator");
|
||||
}
|
||||
|
||||
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog");
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog");
|
||||
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 :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
@ -57,10 +57,10 @@ static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||
return out;
|
||||
}
|
||||
|
||||
static std::shared_ptr<ege::resource::Mesh> createMars() {
|
||||
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---");
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createMars() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---");
|
||||
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->setDiffuseFactor(vec4(0.512f,0.512f,0.512f,1.0f));
|
||||
material->setSpecularFactor(vec4(0.5f,0.5f,0.5f,1.0f));
|
||||
@ -77,14 +77,14 @@ static std::shared_ptr<ege::resource::Mesh> createMars() {
|
||||
void appl::Windows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
|
||||
getObjectManager().periodicCall.connect(shared_from_this(), &appl::Windows::onCallbackPeriodicUpdateCamera);
|
||||
getObjectManager().periodicCall.connect(sharedFromThis(), &appl::Windows::onCallbackPeriodicUpdateCamera);
|
||||
|
||||
m_env = ege::Environement::create();
|
||||
// Create basic Camera
|
||||
m_camera = std::make_shared<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);
|
||||
|
||||
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
@ -95,7 +95,7 @@ void appl::Windows::init() {
|
||||
setSubWidget(tmpWidget);
|
||||
}
|
||||
// Create an external box :
|
||||
std::shared_ptr<ege::resource::Mesh> myMesh = createViewBoxStar();
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
m_env->addStaticMeshToDraw(myMesh);
|
||||
}
|
||||
@ -106,8 +106,8 @@ void appl::Windows::init() {
|
||||
if (true) {
|
||||
myMesh = createMars();
|
||||
if (myMesh != nullptr) {
|
||||
std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env);
|
||||
//std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||
ememory::SharedPtr<ege::ElementBase> element = ememory::makeShared<ege::ElementBase>(m_env);
|
||||
//ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
|
||||
element->setPosition(vec3(50,0,0));
|
||||
element->setMesh(myMesh);
|
||||
m_env->addElement(element);
|
||||
|
@ -14,8 +14,8 @@
|
||||
namespace appl {
|
||||
class Windows : public ewol::widget::Windows {
|
||||
private:
|
||||
std::shared_ptr<ege::Environement> m_env;
|
||||
std::shared_ptr<ege::camera::View> m_camera;
|
||||
ememory::SharedPtr<ege::Environement> m_env;
|
||||
ememory::SharedPtr<ege::camera::View> m_camera;
|
||||
protected:
|
||||
Windows();
|
||||
void init();
|
||||
|
@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
_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
|
||||
_context.setWindows(basicWindows);
|
||||
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||
|
@ -26,10 +26,10 @@ appl::Windows::Windows() :
|
||||
propertyTitle.setDirectCheck("example ege: RayTest");
|
||||
}
|
||||
|
||||
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
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 :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
@ -69,11 +69,11 @@ void appl::Windows::init() {
|
||||
|
||||
m_env = ege::Environement::create();
|
||||
// Create basic Camera
|
||||
m_camera = std::make_shared<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_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) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
@ -82,9 +82,9 @@ void appl::Windows::init() {
|
||||
tmpWidget->propertyFill.set(bvec2(true,true));
|
||||
tmpWidget->setCamera("basic");
|
||||
setSubWidget(tmpWidget);
|
||||
tmpWidget->signalDisplayDebug.connect(shared_from_this(), &appl::Windows::onCallbackDisplayDebug);
|
||||
tmpWidget->signalDisplayDebug.connect(sharedFromThis(), &appl::Windows::onCallbackDisplayDebug);
|
||||
}
|
||||
std::shared_ptr<ege::resource::Mesh> myMesh;
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box :
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
@ -97,10 +97,10 @@ void appl::Windows::init() {
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3);
|
||||
if (myMesh != nullptr) {
|
||||
//std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env);
|
||||
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||
//ememory::SharedPtr<ege::ElementBase> element = ememory::makeShared<ege::ElementBase>(m_env);
|
||||
ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
|
||||
// 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));
|
||||
myMesh->addPhysicElement(physic);
|
||||
|
||||
@ -112,11 +112,11 @@ void appl::Windows::init() {
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3);
|
||||
if (myMesh != nullptr) {
|
||||
//element = std::make_shared<ege::ElementBase>(m_env);
|
||||
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||
//element = ememory::makeShared<ege::ElementBase>(m_env);
|
||||
ememory::SharedPtr<ege::ElementPhysic> element = ememory::makeShared<ege::ElementPhysic>(m_env);
|
||||
|
||||
// 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);
|
||||
myMesh->addPhysicElement(physic);
|
||||
|
||||
@ -140,7 +140,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
m_ray = ray;
|
||||
APPL_DEBUG("pos=" << pos << " ray = " << ray);
|
||||
m_destination = ray.testRay(m_env->getPhysicEngine());
|
||||
std::pair<std::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) {
|
||||
APPL_INFO("Select Object :" << result.first->getUID());
|
||||
}
|
||||
@ -170,7 +170,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void appl::Windows::onCallbackDisplayDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _obj) {
|
||||
void appl::Windows::onCallbackDisplayDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _obj) {
|
||||
mat4 mat;
|
||||
mat.identity();
|
||||
// Display ray line
|
||||
|
@ -15,8 +15,8 @@
|
||||
namespace appl {
|
||||
class Windows : public ewol::widget::Windows {
|
||||
private:
|
||||
std::shared_ptr<ege::Environement> m_env;
|
||||
std::shared_ptr<ege::camera::View> m_camera;
|
||||
ememory::SharedPtr<ege::Environement> m_env;
|
||||
ememory::SharedPtr<ege::camera::View> m_camera;
|
||||
protected:
|
||||
Windows();
|
||||
void init();
|
||||
@ -25,7 +25,7 @@ namespace appl {
|
||||
virtual ~Windows() { };
|
||||
private:
|
||||
bool onEventInput(const ewol::event::Input& _event);
|
||||
void onCallbackDisplayDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _obj);
|
||||
void onCallbackDisplayDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _obj);
|
||||
ege::Ray m_ray;
|
||||
float m_angleTetha;
|
||||
float m_anglePsy;
|
||||
|
@ -37,7 +37,7 @@ class MainApplication : public ewol::context::Application {
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
_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
|
||||
_context.setWindows(basicWindows);
|
||||
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||
|
Loading…
x
Reference in New Issue
Block a user