[DEV] continue removing stl

This commit is contained in:
Edouard DUPIN 2017-08-28 00:03:33 +02:00
parent 54529a3efd
commit fbc979aab5
83 changed files with 462 additions and 462 deletions

View File

@ -5,8 +5,8 @@
*/ */
#include <ege/Component.hpp> #include <ege/Component.hpp>
const std::string& ege::Component::getType() const { const etk::String& ege::Component::getType() const {
static std::string tmp("component"); static etk::String tmp("component");
return tmp; return tmp;
} }

View File

@ -15,7 +15,7 @@ namespace ege {
protected: protected:
public: public:
virtual const std::string& getType() const; virtual const etk::String& getType() const;
/** /**
* @brief Evironement notify that a new component is added on the same Element * @brief Evironement notify that a new component is added on the same Element

View File

@ -11,8 +11,8 @@ ege::Engine::Engine(ege::Environement* _env) :
} }
const std::string& ege::Engine::getType() const { const etk::String& ege::Engine::getType() const {
static std::string tmp("engine"); static etk::String tmp("engine");
return tmp; return tmp;
} }

View File

@ -29,7 +29,7 @@ namespace ege {
* @brief get the type of the engine * @brief get the type of the engine
* @return the type in string * @return the type in string
*/ */
virtual const std::string& getType() const; virtual const etk::String& getType() const;
/** /**
* @brief An ege::Entity component has been removed ==> need remove it in local if needed * @brief An ege::Entity component has been removed ==> need remove it in local if needed
* @param[in] _ref Referrence on the component * @param[in] _ref Referrence on the component

View File

@ -10,8 +10,8 @@
#include <ege/Environement.hpp> #include <ege/Environement.hpp>
const std::string& ege::Entity::getType() const { const etk::String& ege::Entity::getType() const {
static const std::string nameType("----"); static const etk::String nameType("----");
return nameType; return nameType;
} }
@ -67,7 +67,7 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
// add it at the end ... // add it at the end ...
if (findId == -1) { if (findId == -1) {
findId = m_component.size(); findId = m_component.size();
m_component.push_back(_ref); m_component.pushBack(_ref);
} }
for (size_t iii=0; iii<m_component.size(); ++iii) { for (size_t iii=0; iii<m_component.size(); ++iii) {
if (m_component[iii] == nullptr) { if (m_component[iii] == nullptr) {
@ -123,7 +123,7 @@ void ege::Entity::rmComponent(const ememory::SharedPtr<ege::Component>& _ref) {
} }
} }
void ege::Entity::rmComponent(const std::string& _type) { void ege::Entity::rmComponent(const etk::String& _type) {
int32_t findId = -1; int32_t findId = -1;
ememory::SharedPtr<ege::Component> componentRemoved; ememory::SharedPtr<ege::Component> componentRemoved;
// check if not exist // check if not exist
@ -159,7 +159,7 @@ bool ege::Entity::init() {
EGE_WARNING("init() not implemented: uId=" << m_uID); EGE_WARNING("init() not implemented: uId=" << m_uID);
return false; return false;
} }
bool ege::Entity::initString(const std::string& _description) { bool ege::Entity::initString(const etk::String& _description) {
EGE_WARNING("String Init not implemented: uId=" << m_uID); EGE_WARNING("String Init not implemented: uId=" << m_uID);
return false; return false;
} }
@ -191,7 +191,7 @@ float ege::Entity::getLifeRatio() {
void ege::Entity::setFireOn(int32_t _groupIdSource, int32_t _type, float _power, const vec3& _center) { void ege::Entity::setFireOn(int32_t _groupIdSource, int32_t _type, float _power, const vec3& _center) {
float previousLife = m_life; float previousLife = m_life;
m_life += _power; m_life += _power;
m_life = std::avg(0.0f, m_life, m_lifeMax); m_life = etk::avg(0.0f, m_life, m_lifeMax);
if (m_life <= 0) { if (m_life <= 0) {
EGE_DEBUG("[" << getUID() << "] Entity is killed ..." << getType()); EGE_DEBUG("[" << getUID() << "] Entity is killed ..." << getType());
} }
@ -218,23 +218,23 @@ void ege::Entity::drawLife(ememory::SharedPtr<ewol::resource::Colored3DObject> _
mat4 transformationMatrix = etk::matTranslate(getPosition()) mat4 transformationMatrix = etk::matTranslate(getPosition())
* etk::matRotate(vec3(0,0,1),_camera.getAngleZ()) * etk::matRotate(vec3(0,0,1),_camera.getAngleZ())
* etk::matRotate(vec3(1,0,0),(M_PI/2.0f-_camera.getAngleTeta())); * etk::matRotate(vec3(1,0,0),(M_PI/2.0f-_camera.getAngleTeta()));
std::vector<vec3> localVertices; etk::Vector<vec3> localVertices;
localVertices.push_back(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos -lifeBorder,0)); localVertices.pushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos -lifeBorder,0));
localVertices.push_back(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); localVertices.pushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos+lifeHeight+lifeBorder,0));
localVertices.push_back(vec3( lifeWidth/2.0+lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); localVertices.pushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos+lifeHeight+lifeBorder,0));
localVertices.push_back(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos -lifeBorder,0)); localVertices.pushBack(vec3(-lifeWidth/2.0-lifeBorder,lifeYPos -lifeBorder,0));
localVertices.push_back(vec3( lifeWidth/2.0+lifeBorder,lifeYPos+lifeHeight+lifeBorder,0)); localVertices.pushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos+lifeHeight+lifeBorder,0));
localVertices.push_back(vec3( lifeWidth/2.0+lifeBorder,lifeYPos -lifeBorder,0)); localVertices.pushBack(vec3( lifeWidth/2.0+lifeBorder,lifeYPos -lifeBorder,0));
etk::Color<float> myColor(0x0000FF99); etk::Color<float> myColor(0x0000FF99);
_draw->draw(localVertices, myColor, transformationMatrix, false, false); _draw->draw(localVertices, myColor, transformationMatrix, false, false);
localVertices.clear(); localVertices.clear();
/** Bounding box == > model shape **/ /** Bounding box == > model shape **/
localVertices.push_back(vec3(-lifeWidth/2.0 ,lifeYPos,0)); localVertices.pushBack(vec3(-lifeWidth/2.0 ,lifeYPos,0));
localVertices.push_back(vec3(-lifeWidth/2.0 ,lifeYPos + lifeHeight,0)); localVertices.pushBack(vec3(-lifeWidth/2.0 ,lifeYPos + lifeHeight,0));
localVertices.push_back(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos + lifeHeight,0)); localVertices.pushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos + lifeHeight,0));
localVertices.push_back(vec3(-lifeWidth/2.0 ,lifeYPos,0)); localVertices.pushBack(vec3(-lifeWidth/2.0 ,lifeYPos,0));
localVertices.push_back(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos + lifeHeight,0)); localVertices.pushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos + lifeHeight,0));
localVertices.push_back(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos,0)); localVertices.pushBack(vec3(-lifeWidth/2.0+lifeWidth*ratio,lifeYPos,0));
myColor =0x00FF00FF; myColor =0x00FF00FF;
if (ratio < 0.2f) { if (ratio < 0.2f) {
myColor = 0xFF0000FF; myColor = 0xFF0000FF;
@ -253,9 +253,9 @@ void ege::Entity::drawDebug(ememory::SharedPtr<ewol::resource::Colored3DObject>
m_debugText.setPos(vec3(-20,32,0)); m_debugText.setPos(vec3(-20,32,0));
m_debugText.print(getType()); m_debugText.print(getType());
m_debugText.setPos(vec3(-20,20,0)); m_debugText.setPos(vec3(-20,20,0));
m_debugText.print("life=("+etk::to_string(getLifeRatio())); m_debugText.print("life=("+etk::toString(getLifeRatio()));
*/ */
//m_debugText.print(std::string("Axe=(")+std::string(m_tmpAxe.x())+std::string(",")+etk::UString(m_tmpAxe.y())+etk::UString(",")+etk::UString(m_tmpAxe.z())+etk::UString(")")); //m_debugText.print(etk::String("Axe=(")+etk::String(m_tmpAxe.x())+etk::String(",")+etk::UString(m_tmpAxe.y())+etk::UString(",")+etk::UString(m_tmpAxe.z())+etk::UString(")"));
/* /*
// TODO : Keep this it can be usefull to print something in direction of the camera ... // TODO : Keep this it can be usefull to print something in direction of the camera ...
m_debugText.draw( etk::matTranslate(getPosition()) m_debugText.draw( etk::matTranslate(getPosition())

View File

@ -8,7 +8,7 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/math/Vector3D.hpp> #include <etk/math/Vector3D.hpp>
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
#include <vector> #include <etk/Vector.hpp>
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <ewol/widget/Widget.hpp> #include <ewol/widget/Widget.hpp>
#include <gale/renderer/openGL/openGL.hpp> #include <gale/renderer/openGL/openGL.hpp>
@ -41,17 +41,17 @@ namespace ege {
*/ */
virtual ~Entity(); virtual ~Entity();
protected: protected:
std::vector<ememory::SharedPtr<ege::Component>> m_component; etk::Vector<ememory::SharedPtr<ege::Component>> m_component;
public: public:
void addComponent(const ememory::SharedPtr<ege::Component>& _ref); void addComponent(const ememory::SharedPtr<ege::Component>& _ref);
void rmComponent(const ememory::SharedPtr<ege::Component>& _ref); void rmComponent(const ememory::SharedPtr<ege::Component>& _ref);
void rmComponent(const std::string& _type); void rmComponent(const etk::String& _type);
/** /**
* @brief get the Entity Type description string. * @brief get the Entity Type description string.
* @return A reference on the descriptive string. * @return A reference on the descriptive string.
*/ */
virtual const std::string& getType() const; virtual const etk::String& getType() const;
/** /**
* @brief init the Entity with the defined properties * @brief init the Entity with the defined properties
* @param[in] _property Type of the next Entity * @param[in] _property Type of the next Entity
@ -59,7 +59,7 @@ namespace ege {
* @return true, the Entity is corectly initialized. * @return true, the Entity is corectly initialized.
*/ */
virtual bool init(); virtual bool init();
virtual bool initString(const std::string& _description); virtual bool initString(const etk::String& _description);
virtual bool initXML(const exml::Node& _node); virtual bool initXML(const exml::Node& _node);
virtual bool initJSON(const ejson::Value& _value); virtual bool initJSON(const ejson::Value& _value);
virtual bool initVoid(void* _value); virtual bool initVoid(void* _value);

View File

@ -42,7 +42,7 @@ void ege::Environement::addEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
return; return;
} }
// add it at the end ... // add it at the end ...
m_engine.push_back(_ref); m_engine.pushBack(_ref);
} }
void ege::Environement::rmEngine(const ememory::SharedPtr<ege::Engine>& _ref) { void ege::Environement::rmEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
@ -63,7 +63,7 @@ void ege::Environement::rmEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
EGE_ERROR("try to remove an unexisting engine"); EGE_ERROR("try to remove an unexisting engine");
} }
void ege::Environement::rmEngine(const std::string& _type) { void ege::Environement::rmEngine(const etk::String& _type) {
// check if not exist // check if not exist
for (auto &it: m_engine) { for (auto &it: m_engine) {
if (it == nullptr) { if (it == nullptr) {
@ -78,7 +78,7 @@ void ege::Environement::rmEngine(const std::string& _type) {
return; return;
} }
ememory::SharedPtr<ege::Engine> ege::Environement::getEngine(const std::string& _type) { ememory::SharedPtr<ege::Engine> ege::Environement::getEngine(const etk::String& _type) {
// check if not exist // check if not exist
for (auto &it: m_engine) { for (auto &it: m_engine) {
if (it == nullptr) { if (it == nullptr) {
@ -149,7 +149,7 @@ ememory::SharedPtr<ege::Entity> ege::Environement::getEntityNearest(ememory::Sha
void ege::Environement::getEntityNearest(const vec3& _sourcePosition, void ege::Environement::getEntityNearest(const vec3& _sourcePosition,
float _distanceMax, float _distanceMax,
std::vector<ege::Environement::ResultNearestEntity>& _resultList) { etk::Vector<ege::Environement::ResultNearestEntity>& _resultList) {
_resultList.clear(); _resultList.clear();
ege::Environement::ResultNearestEntity result; ege::Environement::ResultNearestEntity result;
result.dist = 99999999999.0f; result.dist = 99999999999.0f;
@ -168,14 +168,14 @@ void ege::Environement::getEntityNearest(const vec3& _sourcePosition,
result.dist = (_sourcePosition - destPosition).length(); result.dist = (_sourcePosition - destPosition).length();
//EGE_DEBUG("Distance : " << _distance << " >? " << distance << " id=" << iii); //EGE_DEBUG("Distance : " << _distance << " >? " << distance << " id=" << iii);
if (_distanceMax>result.dist) { if (_distanceMax>result.dist) {
_resultList.push_back(result); _resultList.pushBack(result);
} }
} }
} }
void ege::Environement::getEntityNearestFixed(const vec3& _sourcePosition, void ege::Environement::getEntityNearestFixed(const vec3& _sourcePosition,
float _distanceMax, float _distanceMax,
std::vector<ege::Environement::ResultNearestEntity>& _resultList) { etk::Vector<ege::Environement::ResultNearestEntity>& _resultList) {
_resultList.clear(); _resultList.clear();
ege::Environement::ResultNearestEntity result; ege::Environement::ResultNearestEntity result;
result.dist = 99999999999.0f; result.dist = 99999999999.0f;
@ -206,7 +206,7 @@ void ege::Environement::getEntityNearestFixed(const vec3& _sourcePosition,
} }
// add entity at the end : // add entity at the end :
if (jjj >= _resultList.size()) { if (jjj >= _resultList.size()) {
_resultList.push_back(result); _resultList.pushBack(result);
} }
} }
} }
@ -217,7 +217,7 @@ static etk::Hash<ege::createEntity_tf>& getHachTableCreating() {
return s_table; return s_table;
} }
void ege::Environement::addCreator(const std::string& _type, ege::createEntity_tf _creator) { void ege::Environement::addCreator(const etk::String& _type, ege::createEntity_tf _creator) {
if (_creator == nullptr) { if (_creator == nullptr) {
EGE_ERROR("Try to add an empty CREATOR ..."); EGE_ERROR("Try to add an empty CREATOR ...");
return; return;
@ -228,7 +228,7 @@ void ege::Environement::addCreator(const std::string& _type, ege::createEntity_t
} }
ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::string& _type, const std::string& _description, bool _autoAddEntity) { ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const etk::String& _type, const etk::String& _description, bool _autoAddEntity) {
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;
@ -253,7 +253,7 @@ ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::strin
return tmpEntity; return tmpEntity;
} }
ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::string& _type, const ejson::Value& _value, bool _autoAddEntity) { ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const etk::String& _type, const ejson::Value& _value, bool _autoAddEntity) {
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;
@ -278,7 +278,7 @@ ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::strin
return tmpEntity; return tmpEntity;
} }
ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::string& _type, const exml::Node& _node, bool _autoAddEntity) { ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const etk::String& _type, const exml::Node& _node, bool _autoAddEntity) {
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;
@ -303,7 +303,7 @@ ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::strin
return tmpEntity; return tmpEntity;
} }
ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::string& _type, void* _data, bool _autoAddEntity) { ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const etk::String& _type, void* _data, bool _autoAddEntity) {
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;
@ -328,7 +328,7 @@ ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::strin
return tmpEntity; return tmpEntity;
} }
ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const std::string& _type, bool _autoAddEntity) { ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const etk::String& _type, bool _autoAddEntity) {
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;
@ -365,7 +365,7 @@ void ege::Environement::addEntity(ememory::SharedPtr<ege::Entity> _newEntity) {
return; return;
} }
} }
m_listEntity.push_back(_newEntity); m_listEntity.pushBack(_newEntity);
_newEntity->dynamicEnable(); _newEntity->dynamicEnable();
} }
@ -435,7 +435,7 @@ void ege::Environement::clear() {
} }
void ege::Environement::render(const echrono::Duration& _delta, const std::string& _camera) { void ege::Environement::render(const echrono::Duration& _delta, const etk::String& _camera) {
// get the correct camera: // get the correct camera:
ememory::SharedPtr<ege::Camera> camera = getCamera(_camera); ememory::SharedPtr<ege::Camera> camera = getCamera(_camera);
if (camera == nullptr) { if (camera == nullptr) {
@ -531,11 +531,11 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event)
} }
void ege::Environement::addCamera(const std::string& _name, const ememory::SharedPtr<ege::Camera>& _camera) { void ege::Environement::addCamera(const etk::String& _name, const ememory::SharedPtr<ege::Camera>& _camera) {
m_listCamera.insert(std::make_pair(_name, _camera)); m_listCamera.insert(etk::makePair(_name, _camera));
} }
ememory::SharedPtr<ege::Camera> ege::Environement::getCamera(const std::string& _name) { ememory::SharedPtr<ege::Camera> ege::Environement::getCamera(const etk::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

@ -15,7 +15,7 @@ namespace ege {
#include <etk/types.hpp> #include <etk/types.hpp>
#include <vector> #include <etk/Vector.hpp>
#include <etk/math/Vector3D.hpp> #include <etk/math/Vector3D.hpp>
#include <ejson/ejson.hpp> #include <ejson/ejson.hpp>
#include <exml/exml.hpp> #include <exml/exml.hpp>
@ -50,13 +50,13 @@ namespace ege {
return m_groupSource; return m_groupSource;
}; };
protected: protected:
std::vector<int32_t> m_groupDestination; etk::Vector<int32_t> m_groupDestination;
public: public:
const std::vector<int32_t>& getDestinationGroup() { const etk::Vector<int32_t>& getDestinationGroup() {
return m_groupDestination; return m_groupDestination;
}; };
void addGroupDestination(int32_t _id) { void addGroupDestination(int32_t _id) {
m_groupDestination.push_back(_id); m_groupDestination.pushBack(_id);
}; };
protected: protected:
vec3 m_positionSource; vec3 m_positionSource;
@ -83,44 +83,44 @@ 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
protected: protected:
std::vector<ememory::SharedPtr<ege::Engine>> m_engine; //!< EGE sub engine interface (like physique, rendering, audio, ...). etk::Vector<ememory::SharedPtr<ege::Engine>> m_engine; //!< EGE sub engine interface (like physique, rendering, audio, ...).
public: public:
void addEngine(const ememory::SharedPtr<ege::Engine>& _ref); void addEngine(const ememory::SharedPtr<ege::Engine>& _ref);
void rmEngine(const ememory::SharedPtr<ege::Engine>& _ref); void rmEngine(const ememory::SharedPtr<ege::Engine>& _ref);
void rmEngine(const std::string& _type); void rmEngine(const etk::String& _type);
ememory::SharedPtr<ege::Engine> getEngine(const std::string& _type); ememory::SharedPtr<ege::Engine> getEngine(const etk::String& _type);
void engineComponentRemove(const ememory::SharedPtr<ege::Component>& _ref); void engineComponentRemove(const ememory::SharedPtr<ege::Component>& _ref);
void engineComponentAdd(const ememory::SharedPtr<ege::Component>& _ref); void engineComponentAdd(const ememory::SharedPtr<ege::Component>& _ref);
private: private:
std::vector<ememory::SharedPtr<ege::Entity>> m_listEntity; //!< List of all entity added in the Game etk::Vector<ememory::SharedPtr<ege::Entity>> m_listEntity; //!< List of all entity added in the Game
protected: protected:
Environement(); Environement();
public: public:
DECLARE_FACTORY(Environement); DECLARE_FACTORY(Environement);
virtual ~Environement() { }; virtual ~Environement() { };
public: public:
void render(const echrono::Duration& _delta, const std::string& _camera); void render(const echrono::Duration& _delta, const etk::String& _camera);
protected: protected:
std::map<std::string, ememory::SharedPtr<ege::Camera>> m_listCamera; //!< list of all camera in the world etk::Map<etk::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 ememory::SharedPtr<ege::Camera>& _camera); void addCamera(const etk::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.
*/ */
ememory::SharedPtr<ege::Camera> getCamera(const std::string& _name); ememory::SharedPtr<ege::Camera> getCamera(const etk::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, ememory::SharedPtr<ege::Camera>> getCameraList() const { etk::Map<etk::String, ememory::SharedPtr<ege::Camera>> getCameraList() const {
return m_listCamera; return m_listCamera;
} }
public: public:
@ -133,7 +133,7 @@ namespace ege {
* @param[in] _type Type of the entity. * @param[in] _type Type of the entity.
* @param[in] _creator Function pointer that reference the entity creating. * @param[in] _creator Function pointer that reference the entity creating.
*/ */
static void addCreator(const std::string& _type, ege::createEntity_tf _creator); static void addCreator(const etk::String& _type, ege::createEntity_tf _creator);
/** /**
* @brief Create an entity on the curent scene. * @brief Create an entity on the curent scene.
* @param[in] _type Type of the entity that might be created. * @param[in] _type Type of the entity that might be created.
@ -142,11 +142,11 @@ namespace ege {
* @return nullptr if an error occured OR the pointer on the entity and it is already added on the system. * @return nullptr if an error occured OR the pointer on the entity 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...
*/ */
ememory::SharedPtr<ege::Entity> createEntity(const std::string& _type, const std::string& _description, bool _autoAddEntity=true); ememory::SharedPtr<ege::Entity> createEntity(const etk::String& _type, const etk::String& _description, bool _autoAddEntity=true);
ememory::SharedPtr<ege::Entity> createEntity(const std::string& _type, const ejson::Value& _value, bool _autoAddEntity=true); ememory::SharedPtr<ege::Entity> createEntity(const etk::String& _type, const ejson::Value& _value, bool _autoAddEntity=true);
ememory::SharedPtr<ege::Entity> createEntity(const std::string& _type, const exml::Node& _node, bool _autoAddEntity=true); ememory::SharedPtr<ege::Entity> createEntity(const etk::String& _type, const exml::Node& _node, bool _autoAddEntity=true);
ememory::SharedPtr<ege::Entity> createEntity(const std::string& _type, void* _data, bool _autoAddEntity=true); ememory::SharedPtr<ege::Entity> createEntity(const etk::String& _type, void* _data, bool _autoAddEntity=true);
ememory::SharedPtr<ege::Entity> createEntity(const std::string& _type, bool _autoAddEntity=true); ememory::SharedPtr<ege::Entity> createEntity(const etk::String& _type, bool _autoAddEntity=true);
public: public:
class ResultNearestEntity { class ResultNearestEntity {
public: public:
@ -173,7 +173,7 @@ namespace ege {
* @breif get a reference on the curent list of entity games * @breif get a reference on the curent list of entity games
* @return all entity list * @return all entity list
*/ */
std::vector<ememory::SharedPtr<ege::Entity>>& getEntity() { etk::Vector<ememory::SharedPtr<ege::Entity>>& getEntity() {
return m_listEntity; return m_listEntity;
}; };
/** /**
@ -187,10 +187,10 @@ namespace ege {
void getEntityNearest(const vec3& _sourcePosition, void getEntityNearest(const vec3& _sourcePosition,
float _distanceMax, float _distanceMax,
std::vector<ege::Environement::ResultNearestEntity>& _resultList); etk::Vector<ege::Environement::ResultNearestEntity>& _resultList);
void getEntityNearestFixed(const vec3& _sourcePosition, void getEntityNearestFixed(const vec3& _sourcePosition,
float _distanceMax, float _distanceMax,
std::vector<ege::Environement::ResultNearestEntity>& _resultList); etk::Vector<ege::Environement::ResultNearestEntity>& _resultList);
*/ */
/** /**
* @brief add an entity on the list availlable. * @brief add an entity on the list availlable.
@ -214,12 +214,12 @@ namespace ege {
private: private:
void onCallbackPeriodicCall(const ewol::event::Time& _event); void onCallbackPeriodicCall(const ewol::event::Time& _event);
protected: protected:
std::vector<ememory::SharedPtr<ege::resource::Mesh>> m_listMeshToDrawFirst; etk::Vector<ememory::SharedPtr<ege::resource::Mesh>> m_listMeshToDrawFirst;
public: public:
void addStaticMeshToDraw(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) { void addStaticMeshToDraw(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
m_listMeshToDrawFirst.push_back(_mesh); m_listMeshToDrawFirst.pushBack(_mesh);
} }
std::vector<ememory::SharedPtr<ege::resource::Mesh>>& getStaticMeshToDraw() { etk::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(ememory::SharedPtr<gale::resource::Program> _prog, const std::string& _baseName) { void ege::Light::link(ememory::SharedPtr<gale::resource::Program> _prog, const etk::String& _baseName) {
if (_prog == nullptr) { if (_prog == nullptr) {
return; return;
} }
@ -44,7 +44,7 @@ void ege::Light::draw(ememory::SharedPtr<gale::resource::Program> _prog) {
_prog->uniform4(m_GL_specularColor, m_specularColor); _prog->uniform4(m_GL_specularColor, m_specularColor);
} }
std::ostream& ege::operator <<(std::ostream& _os, const ege::Light& _obj) { etk::Stream& ege::operator <<(etk::Stream& _os, const ege::Light& _obj) {
_os << "light:{"; _os << "light:{";
_os << "dir=" << _obj.m_direction; _os << "dir=" << _obj.m_direction;
_os << " halfplan=" << _obj.m_halfplane; _os << " halfplan=" << _obj.m_halfplane;

View File

@ -29,7 +29,7 @@ namespace ege {
public: public:
Light(); Light();
~Light(); ~Light();
void link(ememory::SharedPtr<gale::resource::Program> _prog, const std::string& _baseName); void link(ememory::SharedPtr<gale::resource::Program> _prog, const etk::String& _baseName);
void draw(ememory::SharedPtr<gale::resource::Program> _prog); void draw(ememory::SharedPtr<gale::resource::Program> _prog);
void setDirection(const vec3& val) { void setDirection(const vec3& val) {
m_direction = val; m_direction = val;
@ -47,8 +47,8 @@ namespace ege {
m_specularColor = val; m_specularColor = val;
} }
friend std::ostream& operator <<(std::ostream& _os, const ege::Light& _obj); friend etk::Stream& operator <<(etk::Stream& _os, const ege::Light& _obj);
}; };
std::ostream& operator <<(std::ostream& _os, const ege::Light& _obj); etk::Stream& operator <<(etk::Stream& _os, const ege::Light& _obj);
} }

View File

@ -17,7 +17,7 @@ ege::MaterialGlId::MaterialGlId() :
// nothing to do else ... // nothing to do else ...
} }
void ege::MaterialGlId::link(ememory::SharedPtr<gale::resource::Program> _prog, const std::string& _baseName) { void ege::MaterialGlId::link(ememory::SharedPtr<gale::resource::Program> _prog, const etk::String& _baseName) {
if (_prog == nullptr) { if (_prog == nullptr) {
return; return;
} }
@ -66,7 +66,7 @@ void ege::Material::draw(ememory::SharedPtr<gale::resource::Program> _prog, cons
EGE_VERBOSE("draw Material: ( end )"); EGE_VERBOSE("draw Material: ( end )");
} }
void ege::Material::setTexture0(const std::string& _filename) { void ege::Material::setTexture0(const etk::String& _filename) {
ivec2 tmpSize(256, 256); ivec2 tmpSize(256, 256);
if (_filename != "") { if (_filename != "") {
// prevent overloard error : // prevent overloard error :

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(ememory::SharedPtr<gale::resource::Program> _prog, const std::string& _baseName); void link(ememory::SharedPtr<gale::resource::Program> _prog, const etk::String& _baseName);
}; };
@ -38,7 +38,7 @@ namespace ege {
enum gale::openGL::renderMode m_renderMode; // Select Render mode (triangle/Line/point ...) enum gale::openGL::renderMode m_renderMode; // Select Render mode (triangle/Line/point ...)
ememory::SharedPtr<ewol::resource::Texture> m_texture0; ememory::SharedPtr<ewol::resource::Texture> m_texture0;
public: public:
std::vector<uint32_t> m_listIndexFaces; etk::Vector<uint32_t> m_listIndexFaces;
public: public:
Material(); Material();
~Material(); ~Material();
@ -60,7 +60,7 @@ namespace ege {
enum gale::openGL::renderMode getRenderMode() { enum gale::openGL::renderMode getRenderMode() {
return m_renderMode; return m_renderMode;
} }
void setTexture0(const std::string& _filename); void setTexture0(const etk::String& _filename);
void setTexture0Magic(const ivec2& _size); void setTexture0Magic(const ivec2& _size);
void setImageSize(const ivec2& _newSize) { void setImageSize(const ivec2& _newSize) {

View File

@ -27,7 +27,7 @@ void ege::Ray::setDirection(const vec3& _direction) {
std::ostream& ege::operator <<(std::ostream& _os, const ege::Ray& _obj) { etk::Stream& ege::operator <<(etk::Stream& _os, const ege::Ray& _obj) {
_os << "{ori="; _os << "{ori=";
_os << _obj.getOrigin(); _os << _obj.getOrigin();
_os << " dir="; _os << " dir=";

View File

@ -66,6 +66,6 @@ namespace ege {
public: public:
vec3 testRayZeroPlane(); vec3 testRayZeroPlane();
}; };
std::ostream& operator <<(std::ostream& _os, const ege::Ray& _obj); etk::Stream& operator <<(etk::Stream& _os, const ege::Ray& _obj);
} }

View File

@ -108,22 +108,22 @@ ege::Ray ege::camera::View::getRayFromScreen(const vec2& _offset) {
mat.rotate(vec3(0,0,1), m_angle); mat.rotate(vec3(0,0,1), m_angle);
//mat.translate(vec3(m_eye.x(), m_eye.y(), m_eye.z())); //mat.translate(vec3(m_eye.x(), m_eye.y(), m_eye.z()));
_draw->drawSquare(vec3(2,2,2), mat, etk::Color<float>(0.0f, 0.0f, 1.0f, 1.0f)); _draw->drawSquare(vec3(2,2,2), mat, etk::Color<float>(0.0f, 0.0f, 1.0f, 1.0f));
std::vector<vec3> EwolVertices; etk::Vector<vec3> EwolVertices;
EwolVertices.push_back(vec3(0,0,0)); EwolVertices.pushBack(vec3(0,0,0));
EwolVertices.push_back(vec3(-5,-5,-5)); EwolVertices.pushBack(vec3(-5,-5,-5));
EwolVertices.push_back(vec3(5,-5,-5)); EwolVertices.pushBack(vec3(5,-5,-5));
EwolVertices.push_back(vec3(0,0,0)); EwolVertices.pushBack(vec3(0,0,0));
EwolVertices.push_back(vec3(5,-5,-5)); EwolVertices.pushBack(vec3(5,-5,-5));
EwolVertices.push_back(vec3(5,5,-5)); EwolVertices.pushBack(vec3(5,5,-5));
EwolVertices.push_back(vec3(0,0,0)); EwolVertices.pushBack(vec3(0,0,0));
EwolVertices.push_back(vec3(5,5,-5)); EwolVertices.pushBack(vec3(5,5,-5));
EwolVertices.push_back(vec3(-5,5,-5)); EwolVertices.pushBack(vec3(-5,5,-5));
EwolVertices.push_back(vec3(0,0,0)); EwolVertices.pushBack(vec3(0,0,0));
EwolVertices.push_back(vec3(-5,5,-5)); EwolVertices.pushBack(vec3(-5,5,-5));
EwolVertices.push_back(vec3(-5,-5,-5)); EwolVertices.pushBack(vec3(-5,-5,-5));
_draw->draw(EwolVertices, etk::Color<float>(0.0f, 0.0f, 1.0f, 0.5f), mat); _draw->draw(EwolVertices, etk::Color<float>(0.0f, 0.0f, 1.0f, 0.5f), mat);
} }
mat.identity(); mat.identity();

View File

@ -21,7 +21,7 @@ ege::ElementBase::~ElementBase() {
EGE_WARNING("Remove ... "); EGE_WARNING("Remove ... ");
} }
const std::string& ege::ElementBase::getType() const { const etk::String& ege::ElementBase::getType() const {
return ege::Element::getType(); return ege::Element::getType();
} }

View File

@ -32,7 +32,7 @@ namespace ege {
* @brief get the element Type description string. * @brief get the element Type description string.
* @return A reference on the descriptive string. * @return A reference on the descriptive string.
*/ */
virtual const std::string& getType() const; virtual const etk::String& getType() const;
virtual void draw(int32_t _pass=0); virtual void draw(int32_t _pass=0);
private: private:
vec3 m_position; vec3 m_position;

View File

@ -18,8 +18,8 @@
#include <ege/CollisionShapeCreator.hpp> #include <ege/CollisionShapeCreator.hpp>
const std::string& ege::ElementPhysic::getType() const { const etk::String& ege::ElementPhysic::getType() const {
static const std::string nameType("----"); static const etk::String nameType("----");
return nameType; return nameType;
} }
@ -180,7 +180,7 @@ const float ege::ElementPhysic::getInvMass() {
void ege::ElementPhysic::drawShape(/*const btCollisionShape* _shape,*/ void ege::ElementPhysic::drawShape(/*const btCollisionShape* _shape,*/
ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ewol::resource::Colored3DObject> _draw,
mat4 _transformationMatrix, mat4 _transformationMatrix,
std::vector<vec3> _tmpVertices) { etk::Vector<vec3> _tmpVertices) {
#if 0 #if 0
if( _draw == nullptr if( _draw == nullptr
|| _shape == nullptr) { || _shape == nullptr) {

View File

@ -15,7 +15,7 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/math/Vector3D.hpp> #include <etk/math/Vector3D.hpp>
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
#include <vector> #include <etk/Vector.hpp>
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <ewol/widget/Widget.hpp> #include <ewol/widget/Widget.hpp>
#include <gale/renderer/openGL/openGL.hpp> #include <gale/renderer/openGL/openGL.hpp>
@ -59,7 +59,7 @@ namespace ege {
* @brief get the element Type description string. * @brief get the element Type description string.
* @return A reference on the descriptive string. * @return A reference on the descriptive string.
*/ */
virtual const std::string& getType() const; virtual const etk::String& getType() const;
protected: protected:
//btCollisionShape* m_shape; //!< shape of the element (set a copy here to have the debug display of it) //btCollisionShape* m_shape; //!< shape of the element (set a copy here to have the debug display of it)
public: public:
@ -192,7 +192,7 @@ namespace ege {
void drawShape(/*const btCollisionShape* _shape,*/ void drawShape(/*const btCollisionShape* _shape,*/
ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ewol::resource::Colored3DObject> _draw,
mat4 _transformationMatrix, mat4 _transformationMatrix,
std::vector<vec3> _tmpVertices); etk::Vector<vec3> _tmpVertices);
protected: protected:
bool m_detectCollisionEnable; //!< physic collision detect enable. bool m_detectCollisionEnable; //!< physic collision detect enable.
public: public:

View File

@ -5,8 +5,8 @@
*/ */
#include <ege/ia/Component.hpp> #include <ege/ia/Component.hpp>
const std::string& ege::ia::Component::getType() const { const etk::String& ege::ia::Component::getType() const {
static std::string tmp("ia"); static etk::String tmp("ia");
return tmp; return tmp;
} }

View File

@ -15,7 +15,7 @@ namespace ege {
protected: protected:
public: public:
virtual const std::string& getType() const override; virtual const etk::String& getType() const override;
}; };
} }
} }

View File

@ -10,8 +10,8 @@ ege::ia::Engine::Engine(ege::Environement* _env) :
} }
const std::string& ege::ia::Engine::getType() const { const etk::String& ege::ia::Engine::getType() const {
static std::string tmp("ia"); static etk::String tmp("ia");
return tmp; return tmp;
} }

View File

@ -8,7 +8,7 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/math/Vector3D.hpp> #include <etk/math/Vector3D.hpp>
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
#include <vector> #include <etk/Vector.hpp>
#include <ege/debug.hpp> #include <ege/debug.hpp>
@ -22,7 +22,7 @@ namespace ege {
// update cycle // update cycle
void update(float _delta) {} void update(float _delta) {}
public: public:
const std::string& getType() const override; const etk::String& getType() const override;
void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override; void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override;
void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override; void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override;
}; };

View File

@ -7,8 +7,8 @@
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/particule/Engine.hpp> #include <ege/particule/Engine.hpp>
const std::string& ege::particule::Component::getType() const { const etk::String& ege::particule::Component::getType() const {
static std::string tmp("particule"); static etk::String tmp("particule");
return tmp; return tmp;
} }

View File

@ -16,7 +16,7 @@ namespace ege {
class Engine; class Engine;
class Component : public ege::Component { class Component : public ege::Component {
public: public:
virtual const std::string& getType() const override; virtual const etk::String& getType() const override;
protected: protected:
ege::particule::Engine* m_particuleEngine; ege::particule::Engine* m_particuleEngine;
const char* m_particuleType; const char* m_particuleType;

View File

@ -18,8 +18,8 @@ ege::particule::Engine::~Engine() {
clear(); clear();
} }
const std::string& ege::particule::Engine::getType() const { const etk::String& ege::particule::Engine::getType() const {
static std::string tmp("particule"); static etk::String tmp("particule");
return tmp; return tmp;
} }
@ -46,7 +46,7 @@ void ege::particule::Engine::add(const ememory::SharedPtr<ege::particule::Compon
return; return;
} }
// Just add it at the end ... // Just add it at the end ...
m_particuleList.push_back(_particule); m_particuleList.pushBack(_particule);
} }
void ege::particule::Engine::addRemoved(const ememory::SharedPtr<ege::particule::Component>& _particule) { void ege::particule::Engine::addRemoved(const ememory::SharedPtr<ege::particule::Component>& _particule) {
@ -61,7 +61,7 @@ void ege::particule::Engine::addRemoved(const ememory::SharedPtr<ege::particule:
return; return;
} }
// Just add it at the end ... // Just add it at the end ...
m_particuleRemoved.push_back(_particule); m_particuleRemoved.pushBack(_particule);
} }
ememory::SharedPtr<ege::particule::Component> ege::particule::Engine::respown(const char* _particuleType) { ememory::SharedPtr<ege::particule::Component> ege::particule::Engine::respown(const char* _particuleType) {

View File

@ -6,7 +6,7 @@
#pragma once #pragma once
#include <ege/Engine.hpp> #include <ege/Engine.hpp>
#include <etk/types.hpp> #include <etk/types.hpp>
#include <vector> #include <etk/Vector.hpp>
#include <ege/particule/Component.hpp> #include <ege/particule/Component.hpp>
namespace ege { namespace ege {
@ -18,8 +18,8 @@ namespace ege {
Engine(ege::Environement* _env); // note : need the engine to register has an dynamic element ... (the first ...) Engine(ege::Environement* _env); // note : need the engine to register has an dynamic element ... (the first ...)
~Engine(); ~Engine();
private: private:
std::vector<ememory::SharedPtr<ege::particule::Component>> m_particuleList; //!< all particule created and active etk::Vector<ememory::SharedPtr<ege::particule::Component>> m_particuleList; //!< all particule created and active
std::vector<ememory::SharedPtr<ege::particule::Component>> m_particuleRemoved; //!< removed particule etk::Vector<ememory::SharedPtr<ege::particule::Component>> m_particuleRemoved; //!< removed particule
public: public:
/** /**
* @brief clear the particule engine * @brief clear the particule engine
@ -47,7 +47,7 @@ namespace ege {
ememory::SharedPtr<ege::particule::Component> respown(const char* _particuleType); ememory::SharedPtr<ege::particule::Component> respown(const char* _particuleType);
public: public:
const std::string& getType() const override; const etk::String& getType() const override;
void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override; void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override;
void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override; void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override;
void update(const echrono::Duration& _delta) override; void update(const echrono::Duration& _delta) override;

View File

@ -17,8 +17,8 @@
#include <ephysics/collision/shapes/ConcaveShape.hpp> #include <ephysics/collision/shapes/ConcaveShape.hpp>
#include <ephysics/collision/shapes/ConcaveMeshShape.hpp> #include <ephysics/collision/shapes/ConcaveMeshShape.hpp>
const std::string& ege::physics::Component::getType() const { const etk::String& ege::physics::Component::getType() const {
static std::string tmp("physics"); static etk::String tmp("physics");
return tmp; return tmp;
} }
@ -116,13 +116,13 @@ void ege::physics::Component::generate() {
tmpElement->getSize().z()); tmpElement->getSize().z());
// Create the box shape // Create the box shape
ephysics::BoxShape* shape = new ephysics::BoxShape(halfExtents, 0.0001); ephysics::BoxShape* shape = new ephysics::BoxShape(halfExtents, 0.0001);
m_listShape.push_back(shape); m_listShape.pushBack(shape);
// The ephysic use Y as UP ==> ege use Z as UP // The ephysic use Y as UP ==> ege use Z as UP
//orientation = orientation * ephysics::Quaternion(-0.707107, 0, 0, 0.707107); //orientation = orientation * ephysics::Quaternion(-0.707107, 0, 0, 0.707107);
etk::Transform3D transform(it->getOrigin(), it->getOrientation()); etk::Transform3D transform(it->getOrigin(), it->getOrientation());
ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass()); ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
proxyShape->setUserData(this); proxyShape->setUserData(this);
m_listProxyShape.push_back(proxyShape); m_listProxyShape.pushBack(proxyShape);
break; break;
} }
case ege::physics::Shape::type::cylinder: { case ege::physics::Shape::type::cylinder: {
@ -139,7 +139,7 @@ void ege::physics::Component::generate() {
etk::Transform3D transform(it->getOrigin(), orientation); etk::Transform3D transform(it->getOrigin(), orientation);
ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass()); ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
proxyShape->setUserData(this); proxyShape->setUserData(this);
m_listProxyShape.push_back(proxyShape); m_listProxyShape.pushBack(proxyShape);
break; break;
} }
case ege::physics::Shape::type::capsule: { case ege::physics::Shape::type::capsule: {
@ -156,7 +156,7 @@ void ege::physics::Component::generate() {
etk::Transform3D transform(it->getOrigin(), orientation); etk::Transform3D transform(it->getOrigin(), orientation);
ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass()); ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
proxyShape->setUserData(this); proxyShape->setUserData(this);
m_listProxyShape.push_back(proxyShape); m_listProxyShape.pushBack(proxyShape);
break; break;
} }
case ege::physics::Shape::type::cone: { case ege::physics::Shape::type::cone: {
@ -173,7 +173,7 @@ void ege::physics::Component::generate() {
etk::Transform3D transform(it->getOrigin(), orientation); etk::Transform3D transform(it->getOrigin(), orientation);
ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass()); ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
proxyShape->setUserData(this); proxyShape->setUserData(this);
m_listProxyShape.push_back(proxyShape); m_listProxyShape.pushBack(proxyShape);
break; break;
} }
case ege::physics::Shape::type::sphere: { case ege::physics::Shape::type::sphere: {
@ -190,7 +190,7 @@ void ege::physics::Component::generate() {
etk::Transform3D transform(it->getOrigin(), orientation); etk::Transform3D transform(it->getOrigin(), orientation);
ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass()); ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
proxyShape->setUserData(this); proxyShape->setUserData(this);
m_listProxyShape.push_back(proxyShape); m_listProxyShape.pushBack(proxyShape);
break; break;
} }
case ege::physics::Shape::type::concave: { case ege::physics::Shape::type::concave: {
@ -201,8 +201,8 @@ void ege::physics::Component::generate() {
continue; continue;
} }
#if 0 #if 0
static const std::vector<vec3> vertices = {vec3(-100.0f,-100.0f,-50.0f),vec3(100.0f,-100.0f,-50.0f),vec3(100.0f,100.0f,-50.0f)}; static const etk::Vector<vec3> vertices = {vec3(-100.0f,-100.0f,-50.0f),vec3(100.0f,-100.0f,-50.0f),vec3(100.0f,100.0f,-50.0f)};
static const std::vector<uint32_t> indices = {0,1,2}; static const etk::Vector<uint32_t> indices = {0,1,2};
ephysics::TriangleVertexArray* triangleArray = new ephysics::TriangleVertexArray(vertices, indices); ephysics::TriangleVertexArray* triangleArray = new ephysics::TriangleVertexArray(vertices, indices);
#else #else
@ -221,7 +221,7 @@ void ege::physics::Component::generate() {
etk::Transform3D transform(it->getOrigin(), it->getOrientation()); etk::Transform3D transform(it->getOrigin(), it->getOrientation());
ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass()); ephysics::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
proxyShape->setUserData(this); proxyShape->setUserData(this);
m_listProxyShape.push_back(proxyShape); m_listProxyShape.pushBack(proxyShape);
break; break;
} }
default : default :
@ -385,16 +385,16 @@ void ege::physics::Component::applyRelativeTorque(const vec3& _torque, bool _sta
} }
} }
const std::vector<ememory::SharedPtr<ege::physics::Shape>>& ege::physics::Component::getShape() const { const etk::Vector<ememory::SharedPtr<ege::physics::Shape>>& ege::physics::Component::getShape() const {
return m_shape; return m_shape;
} }
void ege::physics::Component::setShape(const std::vector<ememory::SharedPtr<ege::physics::Shape>>& _prop) { void ege::physics::Component::setShape(const etk::Vector<ememory::SharedPtr<ege::physics::Shape>>& _prop) {
m_shape = _prop; m_shape = _prop;
} }
void ege::physics::Component::addShape(const ememory::SharedPtr<ege::physics::Shape>& _shape) { void ege::physics::Component::addShape(const ememory::SharedPtr<ege::physics::Shape>& _shape) {
m_shape.push_back(_shape); m_shape.pushBack(_shape);
} }

View File

@ -28,8 +28,8 @@ namespace ege {
protected: protected:
ememory::SharedPtr<ege::physics::Engine> m_engine; ememory::SharedPtr<ege::physics::Engine> m_engine;
ephysics::RigidBody* m_rigidBody; ephysics::RigidBody* m_rigidBody;
std::vector<ephysics::CollisionShape*> m_listShape; etk::Vector<ephysics::CollisionShape*> m_listShape;
std::vector<ephysics::ProxyShape*> m_listProxyShape; etk::Vector<ephysics::ProxyShape*> m_listProxyShape;
public: public:
/** /**
* @brief Create a basic position component (no orientation and position (0,0,0)) * @brief Create a basic position component (no orientation and position (0,0,0))
@ -42,7 +42,7 @@ namespace ege {
Component(ememory::SharedPtr<ege::Environement> _env, const etk::Transform3D& _transform); Component(ememory::SharedPtr<ege::Environement> _env, const etk::Transform3D& _transform);
~Component(); ~Component();
public: public:
virtual const std::string& getType() const override; virtual const etk::String& getType() const override;
enum class type { enum class type {
bodyDynamic, bodyDynamic,
@ -150,10 +150,10 @@ namespace ege {
void applyRelativeTorque(const vec3& _torque, bool _static=false); void applyRelativeTorque(const vec3& _torque, bool _static=false);
protected: protected:
std::vector<ememory::SharedPtr<ege::physics::Shape>> m_shape; //!< collision shape module ... (independent of bullet lib) etk::Vector<ememory::SharedPtr<ege::physics::Shape>> m_shape; //!< collision shape module ... (independent of bullet lib)
public: public:
const std::vector<ememory::SharedPtr<ege::physics::Shape>>& getShape() const; const etk::Vector<ememory::SharedPtr<ege::physics::Shape>>& getShape() const;
void setShape(const std::vector<ememory::SharedPtr<ege::physics::Shape>>& _prop); void setShape(const etk::Vector<ememory::SharedPtr<ege::physics::Shape>>& _prop);
void addShape(const ememory::SharedPtr<ege::physics::Shape>& _shape); void addShape(const ememory::SharedPtr<ege::physics::Shape>& _shape);
void generate(); void generate();
void drawShape(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ege::Camera> _camera); void drawShape(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ege::Camera> _camera);

View File

@ -12,8 +12,8 @@
#include <gale/renderer/openGL/openGL.hpp> #include <gale/renderer/openGL/openGL.hpp>
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
const std::string& ege::physics::Engine::getType() const { const etk::String& ege::physics::Engine::getType() const {
static std::string tmp("physics"); static etk::String tmp("physics");
return tmp; return tmp;
} }
@ -81,7 +81,7 @@ void ege::physics::Engine::componentAdd(const ememory::SharedPtr<ege::Component>
return; return;
} }
} }
m_component.push_back(ref); m_component.pushBack(ref);
} }
ege::physics::Engine::Engine(ege::Environement* _env) : ege::physics::Engine::Engine(ege::Environement* _env) :
@ -196,7 +196,7 @@ class MyCallbackClass : public ephysics::RaycastCallback {
} }
}; };
std::pair<vec3,vec3> ege::physics::Engine::testRay(const ege::Ray& _ray) { etk::Pair<vec3,vec3> ege::physics::Engine::testRay(const ege::Ray& _ray) {
vec3 start = _ray.getOrigin(); vec3 start = _ray.getOrigin();
vec3 stop = _ray.getOrigin()+_ray.getDirection()*1000.0f; vec3 stop = _ray.getOrigin()+_ray.getDirection()*1000.0f;
// Start and End are vectors // Start and End are vectors
@ -207,13 +207,13 @@ std::pair<vec3,vec3> ege::physics::Engine::testRay(const ege::Ray& _ray) {
// Raycast test // Raycast test
m_dynamicsWorld->raycast(ray, &callbackObject); m_dynamicsWorld->raycast(ray, &callbackObject);
if (callbackObject.m_haveImpact == true) { if (callbackObject.m_haveImpact == true) {
return std::pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal); return etk::Pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal);
} }
EGE_VERBOSE(" No Hit"); EGE_VERBOSE(" No Hit");
return std::pair<vec3,vec3>(vec3(0,0,0),vec3(0,0,0)); return etk::Pair<vec3,vec3>(vec3(0,0,0),vec3(0,0,0));
} }
std::pair<ememory::SharedPtr<ege::Component>, std::pair<vec3,vec3>> ege::physics::Engine::testRayObject(const ege::Ray& _ray) { etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>> ege::physics::Engine::testRayObject(const ege::Ray& _ray) {
vec3 start = _ray.getOrigin(); vec3 start = _ray.getOrigin();
vec3 stop = _ray.getOrigin()+_ray.getDirection()*1000.0f; vec3 stop = _ray.getOrigin()+_ray.getDirection()*1000.0f;
// Start and End are vectors // Start and End are vectors
@ -226,13 +226,13 @@ std::pair<ememory::SharedPtr<ege::Component>, std::pair<vec3,vec3>> ege::physics
if (callbackObject.m_haveImpact == true) { if (callbackObject.m_haveImpact == true) {
if ( callbackObject.m_body == nullptr if ( callbackObject.m_body == nullptr
|| callbackObject.m_body->getUserData() == nullptr) { || callbackObject.m_body->getUserData() == nullptr) {
std::pair<ememory::SharedPtr<ege::Component>, std::pair<vec3,vec3>>(nullptr, std::pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal)); etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>>(nullptr, std::pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal));
} }
// TODO: je n'ai pas une entity, main un component ... // TODO: je n'ai pas une entity, main un component ...
ege::physics::Component* elem = static_cast<ege::physics::Component*>(callbackObject.m_body->getUserData()); ege::physics::Component* elem = static_cast<ege::physics::Component*>(callbackObject.m_body->getUserData());
return std::pair<ememory::SharedPtr<ege::Component>, std::pair<vec3,vec3>>(elem->sharedFromThis(), std::pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal)); return etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>>(elem->sharedFromThis(), std::pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal));
} }
EGE_VERBOSE(" No Hit"); EGE_VERBOSE(" No Hit");
return std::pair<ememory::SharedPtr<ege::Component>, std::pair<vec3,vec3>>(nullptr, std::pair<vec3,vec3>(vec3(0,0,0),vec3(0,0,0))); return etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>>(nullptr, std::pair<vec3,vec3>(vec3(0,0,0),vec3(0,0,0)));
} }

View File

@ -15,7 +15,7 @@ namespace ege {
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/math/Vector3D.hpp> #include <etk/math/Vector3D.hpp>
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
#include <vector> #include <etk/Vector.hpp>
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <ege/camera/Camera.hpp> #include <ege/camera/Camera.hpp>
#include <ewol/widget/Widget.hpp> #include <ewol/widget/Widget.hpp>
@ -53,11 +53,11 @@ namespace ege {
return m_dynamicsWorld; return m_dynamicsWorld;
} }
protected: protected:
std::vector<ememory::SharedPtr<ege::physics::Component>> m_component; etk::Vector<ememory::SharedPtr<ege::physics::Component>> m_component;
//TODO : set it not in ewol ... //TODO : set it not in ewol ...
ememory::SharedPtr<ewol::resource::Colored3DObject> m_debugDrawProperty; ememory::SharedPtr<ewol::resource::Colored3DObject> m_debugDrawProperty;
public: public:
const std::string& getType() const override; const etk::String& getType() const override;
void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override; void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override;
void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override; void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override;
void update(const echrono::Duration& _delta) override; void update(const echrono::Duration& _delta) override;
@ -72,13 +72,13 @@ namespace ege {
* @param[in] _ray Ray top test * @param[in] _ray Ray top test
* @return Impact position and normal of the impact (if normal == vec3(0,0,0) then no object impact... * @return Impact position and normal of the impact (if normal == vec3(0,0,0) then no object impact...
*/ */
std::pair<vec3,vec3> testRay(const ege::Ray& _ray); etk::Pair<vec3,vec3> testRay(const ege::Ray& _ray);
/** /**
* @brief Test a rayCasting on the physic engine * @brief Test a rayCasting on the physic engine
* @param[in] _ray Ray top test * @param[in] _ray Ray top test
* @return Impact Component, position and normal of the impact (if normal == vec3(0,0,0) then no object impact... * @return Impact Component, position and normal of the impact (if normal == vec3(0,0,0) then no object impact...
*/ */
std::pair<ememory::SharedPtr<ege::Component>, std::pair<vec3,vec3>> testRayObject(const ege::Ray& _ray); etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>> testRayObject(const ege::Ray& _ray);
}; };
} }
} }

View File

@ -32,17 +32,17 @@ namespace ege {
return this; return this;
} }
private: private:
std::vector<vec3> m_listVertex; etk::Vector<vec3> m_listVertex;
std::vector<uint32_t> m_indices; etk::Vector<uint32_t> m_indices;
public: public:
void clear() { void clear() {
m_listVertex.clear(); m_listVertex.clear();
m_indices.clear(); m_indices.clear();
} }
void setListOfVertex(const std::vector<vec3>& _listVertex) { void setListOfVertex(const etk::Vector<vec3>& _listVertex) {
m_listVertex = _listVertex; m_listVertex = _listVertex;
} }
void addTriangle(const std::vector<uint32_t>& _index) { void addTriangle(const etk::Vector<uint32_t>& _index) {
/* /*
if (m_indices.size() == 0) { if (m_indices.size() == 0) {
m_indices = _index; m_indices = _index;
@ -54,13 +54,13 @@ namespace ege {
return; return;
} }
for (auto &it: _index) { for (auto &it: _index) {
m_indices.push_back(it); m_indices.pushBack(it);
} }
} }
const std::vector<vec3>& getVertex() const { const etk::Vector<vec3>& getVertex() const {
return m_listVertex; return m_listVertex;
} }
const std::vector<uint32_t>& getIndices() const { const etk::Vector<uint32_t>& getIndices() const {
return m_indices; return m_indices;
} }
}; };

View File

@ -20,12 +20,12 @@ bool ege::physics::shape::ConvexHull::parse(const char* _line) {
while (tmp != nullptr) { while (tmp != nullptr) {
*tmp = '\0'; *tmp = '\0';
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] ); sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.push_back(pos); m_points.pushBack(pos);
base = tmp+1; base = tmp+1;
tmp= strchr(base, '|'); tmp= strchr(base, '|');
} }
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] ); sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.push_back(pos); m_points.pushBack(pos);
/* /*
for (int32_t iii=0; iii<m_points.size(); iii++) { for (int32_t iii=0; iii<m_points.size(); iii++) {
EGE_VERBOSE(" parsed " << m_points[iii]); EGE_VERBOSE(" parsed " << m_points[iii]);

View File

@ -29,9 +29,9 @@ namespace ege {
return m_scale; return m_scale;
}; };
private: private:
std::vector<vec3> m_points; etk::Vector<vec3> m_points;
public: public:
const std::vector<vec3>& getPointList() const { const etk::Vector<vec3>& getPointList() const {
return m_points; return m_points;
}; };
public: public:

View File

@ -14,9 +14,9 @@
#include <ege/physics/shape/Concave.hpp> #include <ege/physics/shape/Concave.hpp>
ememory::SharedPtr<ege::physics::Shape> ege::physics::Shape::create(const std::string& _name) { ememory::SharedPtr<ege::physics::Shape> ege::physics::Shape::create(const etk::String& _name) {
ememory::SharedPtr<ege::physics::Shape> tmpp = nullptr; ememory::SharedPtr<ege::physics::Shape> tmpp = nullptr;
std::string name = etk::tolower(_name); etk::String name = etk::tolower(_name);
if (name == "box") { if (name == "box") {
tmpp = ememory::makeShared<ege::physics::shape::Box>(); tmpp = ememory::makeShared<ege::physics::shape::Box>();
} else if (name == "sphere") { } else if (name == "sphere") {

View File

@ -26,7 +26,7 @@ namespace ege {
class Shape { class Shape {
public: public:
static ememory::SharedPtr<ege::physics::Shape> create(const std::string& _name); static ememory::SharedPtr<ege::physics::Shape> create(const etk::String& _name);
public: public:
enum class type { enum class type {
unknow, unknow,

View File

@ -5,8 +5,8 @@
*/ */
#include <ege/position/Component.hpp> #include <ege/position/Component.hpp>
const std::string& ege::position::Component::getType() const { const etk::String& ege::position::Component::getType() const {
static std::string tmp("position"); static etk::String tmp("position");
return tmp; return tmp;
} }

View File

@ -39,7 +39,7 @@ namespace ege {
*/ */
const etk::Transform3D& getTransform() const; const etk::Transform3D& getTransform() const;
public: public:
const std::string& getType() const override; const etk::String& getType() const override;
void addFriendComponent(const ememory::SharedPtr<ege::Component>& _component) override; void addFriendComponent(const ememory::SharedPtr<ege::Component>& _component) override;
}; };
} }

View File

@ -7,8 +7,8 @@
#include <ege/position/Component.hpp> #include <ege/position/Component.hpp>
#include <ege/physics/Component.hpp> #include <ege/physics/Component.hpp>
const std::string& ege::render::Component::getType() const { const etk::String& ege::render::Component::getType() const {
static std::string tmp("render"); static etk::String tmp("render");
return tmp; return tmp;
} }
@ -16,7 +16,7 @@ ege::render::Component::Component() {
} }
ege::render::Component::Component(const std::string& _fileName) { ege::render::Component::Component(const etk::String& _fileName) {
loadMesh(_fileName); loadMesh(_fileName);
} }
@ -47,7 +47,7 @@ void ege::render::Component::onSignalPositionChange(const etk::Transform3D& _tra
m_transform = _transform; m_transform = _transform;
} }
bool ege::render::Component::loadMesh(const std::string& _meshFileName) { bool ege::render::Component::loadMesh(const etk::String& _meshFileName) {
ememory::SharedPtr<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);

View File

@ -25,7 +25,7 @@ namespace ege {
* @brief contruct with a mesh filename * @brief contruct with a mesh filename
* @param[in] _fileName filename of the Mesh. * @param[in] _fileName filename of the Mesh.
*/ */
Component(const std::string& _fileName); Component(const etk::String& _fileName);
/** /**
* @brief contruct with a prebuild mesh * @brief contruct with a prebuild mesh
* @param[in] _mesh The mesh pointer. * @param[in] _mesh The mesh pointer.
@ -40,7 +40,7 @@ namespace ege {
* @note Automaticly load the shape if it is specify in the mesh file * @note Automaticly load the shape if it is specify in the mesh file
* @return true if no error occured * @return true if no error occured
*/ */
virtual bool loadMesh(const std::string& _fileName); virtual bool loadMesh(const etk::String& _fileName);
/** /**
* @brief set the the Mesh properties. * @brief set the the Mesh properties.
* @param[in] _mesh The mesh pointer. (nullptr to force the mesh remove ...) * @param[in] _mesh The mesh pointer. (nullptr to force the mesh remove ...)
@ -70,7 +70,7 @@ namespace ege {
*/ */
void drawNormalDebug(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw); void drawNormalDebug(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw);
public: public:
const std::string& getType() const override; const etk::String& getType() const override;
void addFriendComponent(const ememory::SharedPtr<ege::Component>& _component) override; void addFriendComponent(const ememory::SharedPtr<ege::Component>& _component) override;
private: private:
void onSignalPositionChange(const etk::Transform3D& _transform); void onSignalPositionChange(const etk::Transform3D& _transform);

View File

@ -11,8 +11,8 @@ ege::render::Engine::Engine(ege::Environement* _env) :
m_debugDrawProperty = ewol::resource::Colored3DObject::create(); m_debugDrawProperty = ewol::resource::Colored3DObject::create();
} }
const std::string& ege::render::Engine::getType() const { const etk::String& ege::render::Engine::getType() const {
static std::string tmp("render"); static etk::String tmp("render");
return tmp; return tmp;
} }
@ -38,11 +38,11 @@ void ege::render::Engine::componentAdd(const ememory::SharedPtr<ege::Component>&
return; return;
} }
} }
m_component.push_back(ref); m_component.pushBack(ref);
} }
void ege::render::Engine::getOrderedElementForDisplay(std::vector<ege::render::Engine::ResultNearestElement>& _resultList, void ege::render::Engine::getOrderedElementForDisplay(etk::Vector<ege::render::Engine::ResultNearestElement>& _resultList,
const vec3& _position, const vec3& _position,
const vec3& _direction) { const vec3& _direction) {
// TODO : Set it back ... corrected... // TODO : Set it back ... corrected...
@ -89,7 +89,7 @@ void ege::render::Engine::getOrderedElementForDisplay(std::vector<ege::render::E
} }
// add element at the end : // add element at the end :
if (jjj >= _resultList.size()) { if (jjj >= _resultList.size()) {
_resultList.push_back(result); _resultList.pushBack(result);
} }
} }
} }
@ -135,7 +135,7 @@ void ege::render::Engine::renderDebug(const echrono::Duration& _delta, const eme
} }
// Draw debug ... (Camera) // Draw debug ... (Camera)
/* /*
std::map<std::string, ememory::SharedPtr<ege::Camera>> listCamera = m_env->getCameraList(); etk::Map<etk::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);

View File

@ -8,7 +8,7 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/math/Vector3D.hpp> #include <etk/math/Vector3D.hpp>
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
#include <vector> #include <etk/Vector.hpp>
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/render/Component.hpp> #include <ege/render/Component.hpp>
#include <ege/Engine.hpp> #include <ege/Engine.hpp>
@ -24,22 +24,22 @@ namespace ege {
~Engine() {} ~Engine() {}
eproperty::Value<bool> propertyDebugNormal; eproperty::Value<bool> propertyDebugNormal;
protected: protected:
std::vector<ememory::SharedPtr<ege::render::Component>> m_component; etk::Vector<ememory::SharedPtr<ege::render::Component>> m_component;
class ResultNearestElement { class ResultNearestElement {
public: public:
ememory::SharedPtr<ege::render::Component> element; ememory::SharedPtr<ege::render::Component> element;
float dist; float dist;
}; };
std::vector<ege::render::Engine::ResultNearestElement> m_displayElementOrdered; etk::Vector<ege::render::Engine::ResultNearestElement> m_displayElementOrdered;
//TODO : set it not in ewol ... //TODO : set it not in ewol ...
ememory::SharedPtr<ewol::resource::Colored3DObject> m_debugDrawProperty; ememory::SharedPtr<ewol::resource::Colored3DObject> m_debugDrawProperty;
public: public:
const std::string& getType() const override; const etk::String& getType() const override;
void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override; void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override;
void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override; void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override;
void render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) override; void render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) override;
void renderDebug(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) override; void renderDebug(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) override;
void getOrderedElementForDisplay(std::vector<ege::render::Engine::ResultNearestElement>& _resultList, void getOrderedElementForDisplay(etk::Vector<ege::render::Engine::ResultNearestElement>& _resultList,
const vec3& _position, const vec3& _position,
const vec3& _direction); const vec3& _direction);
}; };

View File

@ -29,7 +29,7 @@ ege::resource::Mesh::Mesh() :
addResourceType("ege::resource::Mesh"); addResourceType("ege::resource::Mesh");
} }
void ege::resource::Mesh::init(const std::string& _fileName, const std::string& _shaderName) { void ege::resource::Mesh::init(const etk::String& _fileName, const etk::String& _shaderName) {
gale::Resource::init(_fileName); gale::Resource::init(_fileName);
EGE_VERBOSE("Load a new mesh : '" << _fileName << "'"); EGE_VERBOSE("Load a new mesh : '" << _fileName << "'");
// get the shader resource : // get the shader resource :
@ -63,7 +63,7 @@ void ege::resource::Mesh::init(const std::string& _fileName, const std::string&
// TO facilitate some debugs we add a name of the VBO: // TO facilitate some debugs we add a name of the VBO:
m_verticesVBO->setName("[VBO] of " + _fileName); m_verticesVBO->setName("[VBO] of " + _fileName);
// load the curent file : // load the curent file :
std::string tmpName = etk::tolower(_fileName); etk::String tmpName = etk::tolower(_fileName);
// select the corect loader : // select the corect loader :
if (etk::end_with(tmpName, ".obj") == true) { if (etk::end_with(tmpName, ".obj") == true) {
if (loadOBJ(_fileName) == false) { if (loadOBJ(_fileName) == false) {
@ -180,16 +180,16 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
vec3 cameraNormal = vec3(0,0,-1); vec3 cameraNormal = vec3(0,0,-1);
cameraNormal.normalized(); cameraNormal.normalized();
// remove face that is notin the view ... // remove face that is notin the view ...
std::vector<uint32_t> tmpIndexResult; etk::Vector<uint32_t> tmpIndexResult;
std::vector<ege::Face>& tmppFaces = m_listFaces.getValue(kkk).m_faces; etk::Vector<ege::Face>& tmppFaces = m_listFaces.getValue(kkk).m_faces;
//std::vector<uint32_t>& tmppIndex = m_listFaces.getValue(kkk).m_index; //etk::Vector<uint32_t>& tmppIndex = m_listFaces.getValue(kkk).m_index;
switch(m_normalMode) { switch(m_normalMode) {
case ege::resource::Mesh::normalMode::face: case ege::resource::Mesh::normalMode::face:
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) { for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
if((mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= 0.0f) { if((mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= 0.0f) {
tmpIndexResult.push_back(iii*3); tmpIndexResult.pushBack(iii*3);
tmpIndexResult.push_back(iii*3+1); tmpIndexResult.pushBack(iii*3+1);
tmpIndexResult.push_back(iii*3+2); tmpIndexResult.pushBack(iii*3+2);
} }
} }
break; break;
@ -198,17 +198,17 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
if( ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= -0.2f) if( ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= -0.2f)
|| ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]]).dot(cameraNormal) >= -0.2f) || ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]]).dot(cameraNormal) >= -0.2f)
|| ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]]).dot(cameraNormal) >= -0.2f) ) { || ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]]).dot(cameraNormal) >= -0.2f) ) {
tmpIndexResult.push_back(iii*3); tmpIndexResult.pushBack(iii*3);
tmpIndexResult.push_back(iii*3+1); tmpIndexResult.pushBack(iii*3+1);
tmpIndexResult.push_back(iii*3+2); tmpIndexResult.pushBack(iii*3+2);
} }
} }
break; break;
default: default:
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) { for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
tmpIndexResult.push_back(iii*3); tmpIndexResult.pushBack(iii*3);
tmpIndexResult.push_back(iii*3+1); tmpIndexResult.pushBack(iii*3+1);
tmpIndexResult.push_back(iii*3+2); tmpIndexResult.pushBack(iii*3+2);
} }
break; break;
} }
@ -246,7 +246,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
void ege::resource::Mesh::drawNormal(mat4& _positionMatrix, void ege::resource::Mesh::drawNormal(mat4& _positionMatrix,
ememory::SharedPtr<ewol::resource::Colored3DObject> _draw) { ememory::SharedPtr<ewol::resource::Colored3DObject> _draw) {
etk::Color<float> tmpColor(0.0, 1.0, 0.0, 1.0); etk::Color<float> tmpColor(0.0, 1.0, 0.0, 1.0);
std::vector<vec3> vertices; etk::Vector<vec3> vertices;
// generate element in 2 pass : // generate element in 2 pass :
// - create new index dependeng a vertex is a unique componenet of position, texture, normal // - create new index dependeng a vertex is a unique componenet of position, texture, normal
// - the index list generation (can be dynamic ... (TODO later) // - the index list generation (can be dynamic ... (TODO later)
@ -284,8 +284,8 @@ void ege::resource::Mesh::drawNormal(mat4& _positionMatrix,
for(size_t indice=0 ; indice<nbIndicInFace; indice++) { for(size_t indice=0 ; indice<nbIndicInFace; indice++) {
vec3 position = m_listVertex[tmpFaceList.m_faces[iii].m_vertex[indice]]; vec3 position = m_listVertex[tmpFaceList.m_faces[iii].m_vertex[indice]];
vec3 normal = m_listVertexNormal[tmpFaceList.m_faces[iii].m_normal[indice]]; vec3 normal = m_listVertexNormal[tmpFaceList.m_faces[iii].m_normal[indice]];
vertices.push_back(position); vertices.pushBack(position);
vertices.push_back(position+normal*0.5f); vertices.pushBack(position+normal*0.5f);
} }
} break; } break;
case ege::resource::Mesh::normalMode::face: case ege::resource::Mesh::normalMode::face:
@ -302,8 +302,8 @@ void ege::resource::Mesh::drawNormal(mat4& _positionMatrix,
return; return;
} }
vec3 normal = m_listFacesNormal[index]; vec3 normal = m_listFacesNormal[index];
vertices.push_back(center); vertices.pushBack(center);
vertices.push_back(center+normal*0.5f); vertices.pushBack(center+normal*0.5f);
} break; } break;
case ege::resource::Mesh::normalMode::none: case ege::resource::Mesh::normalMode::none:
break; break;
@ -319,7 +319,7 @@ void ege::resource::Mesh::setNormalMode(enum normalMode _mode) {
// normal calculation of the normal face is really easy : // normal calculation of the normal face is really easy :
// TODO : Use it for multiple Material interface // TODO : Use it for multiple Material interface
void ege::resource::Mesh::calculateNormaleFace(const std::string& _materialName) { void ege::resource::Mesh::calculateNormaleFace(const etk::String& _materialName) {
m_listFacesNormal.clear(); m_listFacesNormal.clear();
if (m_normalMode == ege::resource::Mesh::normalMode::face) { if (m_normalMode == ege::resource::Mesh::normalMode::face) {
EGE_VERBOSE("calculateNormaleFace(" << _materialName << ")"); EGE_VERBOSE("calculateNormaleFace(" << _materialName << ")");
@ -338,9 +338,9 @@ void ege::resource::Mesh::calculateNormaleFace(const std::string& _materialName)
//EGE_INFO("normal: " << normal.normalized()); //EGE_INFO("normal: " << normal.normalized());
if (normal == vec3(0,0,0)) { if (normal == vec3(0,0,0)) {
EGE_ERROR("Null vertor for a face ... " << m_listVertex[it.m_vertex[0]] << " " << m_listVertex[it.m_vertex[1]] << " " << m_listVertex[it.m_vertex[2]]); EGE_ERROR("Null vertor for a face ... " << m_listVertex[it.m_vertex[0]] << " " << m_listVertex[it.m_vertex[1]] << " " << m_listVertex[it.m_vertex[2]]);
m_listFacesNormal.push_back(vec3(1,0,0)); m_listFacesNormal.pushBack(vec3(1,0,0));
} else { } else {
m_listFacesNormal.push_back(normal.normalized()); m_listFacesNormal.pushBack(normal.normalized());
} }
int32_t normalID = m_listFacesNormal.size() - 1; int32_t normalID = m_listFacesNormal.size() - 1;
it.m_normal[0] = normalID; it.m_normal[0] = normalID;
@ -350,7 +350,7 @@ void ege::resource::Mesh::calculateNormaleFace(const std::string& _materialName)
} }
} }
void ege::resource::Mesh::calculateNormaleEdge(const std::string& _materialName) { void ege::resource::Mesh::calculateNormaleEdge(const etk::String& _materialName) {
m_listVertexNormal.clear(); m_listVertexNormal.clear();
if (m_normalMode == ege::resource::Mesh::normalMode::vertex) { if (m_normalMode == ege::resource::Mesh::normalMode::vertex) {
EGE_INFO("calculateNormaleEdge(" << _materialName << ")"); EGE_INFO("calculateNormaleEdge(" << _materialName << ")");
@ -364,7 +364,7 @@ void ege::resource::Mesh::calculateNormaleEdge(const std::string& _materialName)
return; return;
} }
for(size_t iii=0 ; iii<m_listVertex.size() ; iii++) { for(size_t iii=0 ; iii<m_listVertex.size() ; iii++) {
std::vector<Face>& tmpFaceList = m_listFaces[_materialName].m_faces; etk::Vector<Face>& tmpFaceList = m_listFaces[_materialName].m_faces;
vec3 normal(0,0,0); vec3 normal(0,0,0);
// add the vertex from all the element in the list for face when the element in the face ... // add the vertex from all the element in the list for face when the element in the face ...
for(size_t jjj=0 ; jjj<tmpFaceList.size() ; jjj++) { for(size_t jjj=0 ; jjj<tmpFaceList.size() ; jjj++) {
@ -376,9 +376,9 @@ void ege::resource::Mesh::calculateNormaleEdge(const std::string& _materialName)
} }
} }
if (normal == vec3(0,0,0)) { if (normal == vec3(0,0,0)) {
m_listVertexNormal.push_back(vec3(1,1,1)); m_listVertexNormal.pushBack(vec3(1,1,1));
} else { } else {
m_listVertexNormal.push_back(normal.normalized()); m_listVertexNormal.pushBack(normal.normalized());
} }
} }
} }
@ -396,7 +396,7 @@ void ege::resource::Mesh::generateVBO() {
EGE_ERROR("Calculate normal face ... in case ????"); EGE_ERROR("Calculate normal face ... in case ????");
calculateNormaleFace(m_listFaces.getKeys()[0]); calculateNormaleFace(m_listFaces.getKeys()[0]);
} }
EGE_WARNING("Generate VBO for nb faces layers: " << m_listFaces.size() << " list layer=" << etk::to_string(m_listFaces.getKeys())); EGE_WARNING("Generate VBO for nb faces layers: " << m_listFaces.size() << " list layer=" << etk::toString(m_listFaces.getKeys()));
// generate element in 2 pass: // generate element in 2 pass:
// - create new index depending on a vertex is a unique component of position, texture, normal // - create new index depending on a vertex is a unique component of position, texture, normal
@ -494,7 +494,7 @@ void ege::resource::Mesh::generateVBO() {
} }
} }
for(size_t indice=0 ; indice<nbIndicInFace; indice++) { for(size_t indice=0 ; indice<nbIndicInFace; indice++) {
tmpFaceList.m_index.push_back(vertexVBOId[indice]); tmpFaceList.m_index.pushBack(vertexVBOId[indice]);
} }
} }
#ifdef TRY_MINIMAL_VBO #ifdef TRY_MINIMAL_VBO
@ -506,14 +506,14 @@ void ege::resource::Mesh::generateVBO() {
} }
void ege::resource::Mesh::createViewBox(const std::string& _materialName,float _size) { void ege::resource::Mesh::createViewBox(const etk::String& _materialName,float _size) {
m_normalMode = ege::resource::Mesh::normalMode::none; m_normalMode = ege::resource::Mesh::normalMode::none;
ege::viewBox::create(m_materials, m_listFaces, m_listVertex, m_listUV, ege::viewBox::create(m_materials, m_listFaces, m_listVertex, m_listUV,
_materialName, _size); _materialName, _size);
calculateNormaleFace(_materialName); calculateNormaleFace(_materialName);
} }
void ege::resource::Mesh::createIcoSphere(const std::string& _materialName,float _size, int32_t _subdivision) { void ege::resource::Mesh::createIcoSphere(const etk::String& _materialName,float _size, int32_t _subdivision) {
m_normalMode = ege::resource::Mesh::normalMode::none; m_normalMode = ege::resource::Mesh::normalMode::none;
ege::icoSphere::create(m_materials, m_listFaces, m_listVertex, m_listUV, ege::icoSphere::create(m_materials, m_listFaces, m_listVertex, m_listUV,
_materialName, _size, _subdivision); _materialName, _size, _subdivision);
@ -521,7 +521,7 @@ void ege::resource::Mesh::createIcoSphere(const std::string& _materialName,float
} }
void ege::resource::Mesh::addMaterial(const std::string& _name, ememory::SharedPtr<ege::Material> _data) { void ege::resource::Mesh::addMaterial(const etk::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;
@ -548,7 +548,7 @@ int32_t ege::resource::Mesh::findPositionInList(const vec3& _pos) {
return iii; return iii;
} }
} }
m_listVertex.push_back(_pos); m_listVertex.pushBack(_pos);
return m_listVertex.size()-1; return m_listVertex.size()-1;
} }
int32_t ege::resource::Mesh::findTextureInList(const vec2& _uv) { int32_t ege::resource::Mesh::findTextureInList(const vec2& _uv) {
@ -557,7 +557,7 @@ int32_t ege::resource::Mesh::findTextureInList(const vec2& _uv) {
return iii; return iii;
} }
} }
m_listUV.push_back(_uv); m_listUV.pushBack(_uv);
return m_listUV.size()-1; return m_listUV.size()-1;
} }
int32_t ege::resource::Mesh::findColorInList(const etk::Color<float>& _color) { int32_t ege::resource::Mesh::findColorInList(const etk::Color<float>& _color) {
@ -566,19 +566,19 @@ int32_t ege::resource::Mesh::findColorInList(const etk::Color<float>& _color) {
return iii; return iii;
} }
} }
m_listColor.push_back(_color); m_listColor.pushBack(_color);
return m_listColor.size()-1; return m_listColor.size()-1;
} }
void ege::resource::Mesh::addFaceIndexing(const std::string& _layerName) { void ege::resource::Mesh::addFaceIndexing(const etk::String& _layerName) {
if (m_listFaces.exist(_layerName) == false) { if (m_listFaces.exist(_layerName) == false) {
FaceIndexing empty; FaceIndexing empty;
m_listFaces.add(_layerName, empty); m_listFaces.add(_layerName, empty);
} }
} }
void ege::resource::Mesh::addPoint(const std::string& _layerName, const vec3& _pos, const etk::Color<float>& _color) { void ege::resource::Mesh::addPoint(const etk::String& _layerName, const vec3& _pos, const etk::Color<float>& _color) {
if ( m_listFaces.exist(_layerName) == false if ( m_listFaces.exist(_layerName) == false
|| m_materials.exist(_layerName) == false) { || m_materials.exist(_layerName) == false) {
EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ..."); EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ...");
@ -596,10 +596,10 @@ void ege::resource::Mesh::addPoint(const std::string& _layerName, const vec3& _p
Face tmpFace; Face tmpFace;
tmpFace.setVertex(pos); tmpFace.setVertex(pos);
tmpFace.setColor(color, color, color); tmpFace.setColor(color, color, color);
m_listFaces[_layerName].m_faces.push_back(tmpFace); m_listFaces[_layerName].m_faces.pushBack(tmpFace);
} }
void ege::resource::Mesh::addLine(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const etk::Color<float>& _color1, const etk::Color<float>& _color2) { void ege::resource::Mesh::addLine(const etk::String& _layerName, const vec3& _pos1, const vec3& _pos2, const etk::Color<float>& _color1, const etk::Color<float>& _color2) {
if ( m_listFaces.exist(_layerName) == false if ( m_listFaces.exist(_layerName) == false
|| m_materials.exist(_layerName) == false) { || m_materials.exist(_layerName) == false) {
EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ..."); EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ...");
@ -621,16 +621,16 @@ void ege::resource::Mesh::addLine(const std::string& _layerName, const vec3& _po
Face tmpFace; Face tmpFace;
tmpFace.setVertex(pos1, pos2); tmpFace.setVertex(pos1, pos2);
tmpFace.setColor(color1, color2, color2); tmpFace.setColor(color1, color2, color2);
m_listFaces[_layerName].m_faces.push_back(tmpFace); m_listFaces[_layerName].m_faces.pushBack(tmpFace);
} }
void ege::resource::Mesh::addLines(const std::string& _layerName, const std::vector<vec3>& _list, const etk::Color<float>& _color) { void ege::resource::Mesh::addLines(const etk::String& _layerName, const etk::Vector<vec3>& _list, const etk::Color<float>& _color) {
for (size_t iii=1; iii<_list.size(); ++iii) { for (size_t iii=1; iii<_list.size(); ++iii) {
addLine(_layerName, _list[iii-1], _list[iii], _color); addLine(_layerName, _list[iii-1], _list[iii], _color);
} }
} }
void ege::resource::Mesh::addLines(const std::string& _layerName, const std::vector<vec3>& _list, const std::vector<etk::Color<float>>& _color) { void ege::resource::Mesh::addLines(const etk::String& _layerName, const etk::Vector<vec3>& _list, const etk::Vector<etk::Color<float>>& _color) {
if (_color.size() != _list.size()) { if (_color.size() != _list.size()) {
EGE_ERROR("Can not add line with changing color without same number of color"); EGE_ERROR("Can not add line with changing color without same number of color");
return; return;
@ -641,7 +641,7 @@ void ege::resource::Mesh::addLines(const std::string& _layerName, const std::vec
} }
void ege::resource::Mesh::addTriangle(const std::string& _layerName, void ege::resource::Mesh::addTriangle(const etk::String& _layerName,
const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
const vec2& _uv1, const vec2& _uv2, const vec2& _uv3, const vec2& _uv1, const vec2& _uv2, const vec2& _uv3,
const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3) { const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3) {
@ -674,11 +674,11 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName,
pos2, uv2, pos2, uv2,
pos3, uv3); pos3, uv3);
tmpFace.setColor(color1, color2, color3); tmpFace.setColor(color1, color2, color3);
m_listFaces[_layerName].m_faces.push_back(tmpFace); m_listFaces[_layerName].m_faces.pushBack(tmpFace);
EGE_INFO(" nbFace: " << m_listFaces[_layerName].m_faces.size()); EGE_INFO(" nbFace: " << m_listFaces[_layerName].m_faces.size());
} }
void ege::resource::Mesh::addTriangle(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, void ege::resource::Mesh::addTriangle(const etk::String& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3) { const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3) {
if ( m_listFaces.exist(_layerName) == false if ( m_listFaces.exist(_layerName) == false
|| m_materials.exist(_layerName) == false) { || m_materials.exist(_layerName) == false) {
@ -705,7 +705,7 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName, const vec3&
pos2, -1, pos2, -1,
pos3, -1); pos3, -1);
tmpFace.setColor(color1, color2, color3); tmpFace.setColor(color1, color2, color3);
m_listFaces[_layerName].m_faces.push_back(tmpFace); m_listFaces[_layerName].m_faces.pushBack(tmpFace);
} else { } else {
EGE_ERROR("try to add Quad in a mesh material section that not support Quad"); EGE_ERROR("try to add Quad in a mesh material section that not support Quad");
return; return;
@ -713,7 +713,7 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName, const vec3&
} }
#include <ege/physics/shape/Concave.hpp> #include <ege/physics/shape/Concave.hpp>
const std::vector<ememory::SharedPtr<ege::physics::Shape>>& ege::resource::Mesh::getPhysicalProperties() { const etk::Vector<ememory::SharedPtr<ege::physics::Shape>>& ege::resource::Mesh::getPhysicalProperties() {
for (auto &it: m_physics) { for (auto &it: m_physics) {
if (it->getType() == ege::physics::Shape::type::concave) { if (it->getType() == ege::physics::Shape::type::concave) {
// need to generate the internal list of point and triangle needed: // need to generate the internal list of point and triangle needed:
@ -726,11 +726,11 @@ const std::vector<ememory::SharedPtr<ege::physics::Shape>>& ege::resource::Mesh:
//EGE_INFO(" add vertices : " << m_listVertex); //EGE_INFO(" add vertices : " << m_listVertex);
tmpElement->setListOfVertex(m_listVertex); tmpElement->setListOfVertex(m_listVertex);
for (size_t kkk=0; kkk<m_listFaces.size(); ++kkk) { for (size_t kkk=0; kkk<m_listFaces.size(); ++kkk) {
std::vector<uint32_t> index; etk::Vector<uint32_t> index;
for (auto &it : m_listFaces.getValue(kkk).m_faces) { for (auto &it : m_listFaces.getValue(kkk).m_faces) {
index.push_back(it.m_vertex[0]); index.pushBack(it.m_vertex[0]);
index.push_back(it.m_vertex[1]); index.pushBack(it.m_vertex[1]);
index.push_back(it.m_vertex[2]); index.pushBack(it.m_vertex[2]);
} }
//EGE_INFO(" add triangle : " << m_listFaces.getValue(kkk).m_index); //EGE_INFO(" add triangle : " << m_listFaces.getValue(kkk).m_index);

View File

@ -47,33 +47,33 @@ namespace ege {
static ememory::SharedPtr<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 etk::String& _materialName="basics");
static ememory::SharedPtr<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::String& _materialName="basics",
const etk::Color<float>& _color=etk::color::green); const etk::Color<float>& _color=etk::color::green);
static ememory::SharedPtr<ege::resource::Mesh> createCube(const vec3& _size=vec3(1.0f, 1.0f, 1.0f), static ememory::SharedPtr<ege::resource::Mesh> createCube(const vec3& _size=vec3(1.0f, 1.0f, 1.0f),
const std::string& _materialName="basics", const etk::String& _materialName="basics",
const etk::Color<float>& _color=etk::color::green); const etk::Color<float>& _color=etk::color::green);
static ememory::SharedPtr<ege::resource::Mesh> createSphere(float _size=1.0f, static ememory::SharedPtr<ege::resource::Mesh> createSphere(float _size=1.0f,
const std::string& _materialName="basics", const etk::String& _materialName="basics",
const etk::Color<float>& _color=etk::color::green, const etk::Color<float>& _color=etk::color::green,
int32_t _lats = 10, int32_t _lats = 10,
int32_t _longs = 10); int32_t _longs = 10);
static ememory::SharedPtr<ege::resource::Mesh> createCylinder(float _radius = 1.0f, static ememory::SharedPtr<ege::resource::Mesh> createCylinder(float _radius = 1.0f,
float _size = 1.0f, float _size = 1.0f,
const std::string& _materialName="basics", const etk::String& _materialName="basics",
const etk::Color<float>& _color=etk::color::green, const etk::Color<float>& _color=etk::color::green,
int32_t _lats = 10, int32_t _lats = 10,
int32_t _longs = 10); int32_t _longs = 10);
static ememory::SharedPtr<ege::resource::Mesh> createCapsule(float _radius = 1.0f, static ememory::SharedPtr<ege::resource::Mesh> createCapsule(float _radius = 1.0f,
float _size = 1.0f, float _size = 1.0f,
const std::string& _materialName="basics", const etk::String& _materialName="basics",
const etk::Color<float>& _color=etk::color::green, const etk::Color<float>& _color=etk::color::green,
int32_t _lats = 10, int32_t _lats = 10,
int32_t _longs = 10); int32_t _longs = 10);
static ememory::SharedPtr<ege::resource::Mesh> createCone(float _radius = 1.0f, static ememory::SharedPtr<ege::resource::Mesh> createCone(float _radius = 1.0f,
float _size = 1.0f, float _size = 1.0f,
const std::string& _materialName="basics", const etk::String& _materialName="basics",
const etk::Color<float>& _color=etk::color::green, const etk::Color<float>& _color=etk::color::green,
int32_t _lats = 10, int32_t _lats = 10,
int32_t _longs = 10); int32_t _longs = 10);
@ -105,22 +105,22 @@ namespace ege {
MaterialGlId m_GLMaterial; MaterialGlId m_GLMaterial;
ege::Light m_light; ege::Light m_light;
protected: protected:
std::vector<vec3> m_listVertex; //!< List of all vertex in the element etk::Vector<vec3> m_listVertex; //!< List of all vertex in the element
std::vector<vec2> m_listUV; //!< List of all UV point in the mesh (for the specify texture) etk::Vector<vec2> m_listUV; //!< List of all UV point in the mesh (for the specify texture)
std::vector<etk::Color<float>> m_listColor; //!< List of all Color point in the mesh etk::Vector<etk::Color<float>> m_listColor; //!< List of all Color point in the mesh
std::vector<vec3> m_listFacesNormal; //!< List of all Face normal, when calculated etk::Vector<vec3> m_listFacesNormal; //!< List of all Face normal, when calculated
std::vector<vec3> m_listVertexNormal; //!< List of all Face normal, when calculated etk::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<ememory::SharedPtr<ege::Material>> m_materials; etk::Hash<ememory::SharedPtr<ege::Material>> m_materials;
std::vector<ememory::SharedPtr<ege::physics::Shape>> m_physics; //!< collision shape module ... (independent of bullet lib) etk::Vector<ememory::SharedPtr<ege::physics::Shape>> m_physics; //!< collision shape module ... (independent of bullet lib)
void clean(); void clean();
protected: protected:
ememory::SharedPtr<gale::resource::VirtualBufferObject> m_verticesVBO; ememory::SharedPtr<gale::resource::VirtualBufferObject> m_verticesVBO;
protected: protected:
Mesh(); Mesh();
void init(const std::string& _fileName="---", void init(const etk::String& _fileName="---",
//const std::string& _shaderName="DATA:textured3D2.prog" //const etk::String& _shaderName="DATA:textured3D2.prog"
const std::string& _shaderName="DATA:material3D.prog" const etk::String& _shaderName="DATA:material3D.prog"
); );
public: public:
virtual ~Mesh(); virtual ~Mesh();
@ -138,16 +138,16 @@ namespace ege {
ememory::SharedPtr<ewol::resource::Colored3DObject> _draw); ememory::SharedPtr<ewol::resource::Colored3DObject> _draw);
void generateVBO(); void generateVBO();
private: private:
void calculateNormaleFace(const std::string& _materialName); void calculateNormaleFace(const etk::String& _materialName);
void calculateNormaleEdge(const std::string& _materialName); void calculateNormaleEdge(const etk::String& _materialName);
public : public :
void createViewBox(const std::string& _materialName,float _size=1.0); void createViewBox(const etk::String& _materialName,float _size=1.0);
void createIcoSphere(const std::string& _materialName,float _size=1.0, int32_t _subdivision=3); void createIcoSphere(const etk::String& _materialName,float _size=1.0, int32_t _subdivision=3);
private: private:
bool loadOBJ(const std::string& _fileName); bool loadOBJ(const etk::String& _fileName);
bool loadEMF(const std::string& _fileName); bool loadEMF(const etk::String& _fileName);
public: public:
void addMaterial(const std::string& _name, ememory::SharedPtr<ege::Material> _data); void addMaterial(const etk::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
@ -163,9 +163,9 @@ namespace ege {
bool getCheckNormal() { bool getCheckNormal() {
return m_checkNormal; return m_checkNormal;
}; };
const std::vector<ememory::SharedPtr<ege::physics::Shape>>& getPhysicalProperties(); const etk::Vector<ememory::SharedPtr<ege::physics::Shape>>& getPhysicalProperties();
void addPhysicElement(const ememory::SharedPtr<ege::physics::Shape>& _shape) { void addPhysicElement(const ememory::SharedPtr<ege::physics::Shape>& _shape) {
m_physics.push_back(_shape); m_physics.pushBack(_shape);
} }
private: private:
void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib
@ -192,17 +192,17 @@ namespace ege {
* @brief Add in the faces list the layer requested * @brief Add in the faces list the layer requested
* @param[in] _layerName face index to add * @param[in] _layerName face index to add
*/ */
void addFaceIndexing(const std::string& _layerName); void addFaceIndexing(const etk::String& _layerName);
public: public:
void addPoint(const std::string& _layerName, const vec3& _pos, const etk::Color<float>& _color); void addPoint(const etk::String& _layerName, const vec3& _pos, const etk::Color<float>& _color);
void addLine(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const etk::Color<float>& _color) { void addLine(const etk::String& _layerName, const vec3& _pos1, const vec3& _pos2, const etk::Color<float>& _color) {
addLine( _layerName, _pos1, _pos2, _color, _color); addLine( _layerName, _pos1, _pos2, _color, _color);
} }
void addLine(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const etk::Color<float>& _color1, const etk::Color<float>& _color2); void addLine(const etk::String& _layerName, const vec3& _pos1, const vec3& _pos2, const etk::Color<float>& _color1, const etk::Color<float>& _color2);
void addLines(const std::string& _layerName, const std::vector<vec3>& _list, const etk::Color<float>& _color); void addLines(const etk::String& _layerName, const etk::Vector<vec3>& _list, const etk::Color<float>& _color);
void addLines(const std::string& _layerName, const std::vector<vec3>& _list, const std::vector<etk::Color<float>>& _color); void addLines(const etk::String& _layerName, const etk::Vector<vec3>& _list, const etk::Vector<etk::Color<float>>& _color);
/** /**
* @not_in_doc * @not_in_doc
@ -215,7 +215,7 @@ namespace ege {
* @param[in] _color2 color of the _pos2 element * @param[in] _color2 color of the _pos2 element
* @param[in] _color3 color of the _pos3 element * @param[in] _color3 color of the _pos3 element
*/ */
void addTriangle(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const etk::Color<float>& _color) { void addTriangle(const etk::String& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const etk::Color<float>& _color) {
addTriangle(_layerName, _pos1, _pos2, _pos3, _color, _color, _color); addTriangle(_layerName, _pos1, _pos2, _pos3, _color, _color, _color);
} }
/** /**
@ -229,7 +229,7 @@ namespace ege {
* @param[in] _color2 color of the _pos2 element * @param[in] _color2 color of the _pos2 element
* @param[in] _color3 color of the _pos3 element * @param[in] _color3 color of the _pos3 element
*/ */
void addTriangle(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, void addTriangle(const etk::String& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3); const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3);
/** /**
* @not_in_doc * @not_in_doc
@ -241,7 +241,7 @@ namespace ege {
* @param[in] _pos4 faurth point position * @param[in] _pos4 faurth point position
* @param[in] _color color of all elements * @param[in] _color color of all elements
*/ */
void addQuad(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos4, const etk::Color<float>& _color) { void addQuad(const etk::String& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos4, const etk::Color<float>& _color) {
addQuad(_layerName, _pos1, _pos2, _pos3, _pos4, _color, _color, _color, _color); addQuad(_layerName, _pos1, _pos2, _pos3, _pos4, _color, _color, _color, _color);
} }
/** /**
@ -257,7 +257,7 @@ namespace ege {
* @param[in] _color3 color of the _pos3 element * @param[in] _color3 color of the _pos3 element
* @param[in] _color4 color of the _pos4 element * @param[in] _color4 color of the _pos4 element
*/ */
void addQuad(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos4, void addQuad(const etk::String& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos4,
const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3, const etk::Color<float>& _color4) { const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3, const etk::Color<float>& _color4) {
addTriangle(_layerName, _pos1, _pos2, _pos3, _color1, _color2, _color3); addTriangle(_layerName, _pos1, _pos2, _pos3, _color1, _color2, _color3);
addTriangle(_layerName, _pos1, _pos3, _pos4, _color1, _color3, _color4); addTriangle(_layerName, _pos1, _pos3, _pos4, _color1, _color3, _color4);
@ -274,7 +274,7 @@ namespace ege {
* @param[in] _uv2 texture position of the _pos2 element * @param[in] _uv2 texture position of the _pos2 element
* @param[in] _uv3 texture position of the _pos3 element * @param[in] _uv3 texture position of the _pos3 element
*/ */
void addTriangle(const std::string& _layerName, void addTriangle(const etk::String& _layerName,
const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
const vec2& _uv1, const vec2& _uv2, const vec2& _uv3, const vec2& _uv1, const vec2& _uv2, const vec2& _uv3,
const etk::Color<float>& _color) { const etk::Color<float>& _color) {
@ -294,7 +294,7 @@ namespace ege {
* @param[in] _uv2 texture position of the _pos2 element * @param[in] _uv2 texture position of the _pos2 element
* @param[in] _uv3 texture position of the _pos3 element * @param[in] _uv3 texture position of the _pos3 element
*/ */
void addTriangle(const std::string& _layerName, void addTriangle(const etk::String& _layerName,
const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
const vec2& _uv1, const vec2& _uv2, const vec2& _uv3, const vec2& _uv1, const vec2& _uv2, const vec2& _uv3,
const etk::Color<float>& _color1=etk::color::white, const etk::Color<float>& _color2=etk::color::white, const etk::Color<float>& _color3=etk::color::white); const etk::Color<float>& _color1=etk::color::white, const etk::Color<float>& _color2=etk::color::white, const etk::Color<float>& _color3=etk::color::white);
@ -312,7 +312,7 @@ namespace ege {
* @param[in] _uv3 texture position of the _pos3 element * @param[in] _uv3 texture position of the _pos3 element
* @param[in] _uv4 texture position of the _pos4 element * @param[in] _uv4 texture position of the _pos4 element
*/ */
void addQuad(const std::string& _layerName, void addQuad(const etk::String& _layerName,
const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos4, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos4,
const vec2& _uv1, const vec2& _uv2, const vec2& _uv3, const vec2& _uv4, const vec2& _uv1, const vec2& _uv2, const vec2& _uv3, const vec2& _uv4,
const etk::Color<float>& _color) { const etk::Color<float>& _color) {
@ -335,7 +335,7 @@ namespace ege {
* @param[in] _color3 color of the _pos3 element * @param[in] _color3 color of the _pos3 element
* @param[in] _color4 color of the _pos4 element * @param[in] _color4 color of the _pos4 element
*/ */
void addQuad(const std::string& _layerName, void addQuad(const etk::String& _layerName,
const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos4, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3, const vec3& _pos4,
const vec2& _uv1, const vec2& _uv2, const vec2& _uv3, const vec2& _uv4, const vec2& _uv1, const vec2& _uv2, const vec2& _uv3, const vec2& _uv4,
const etk::Color<float>& _color1=etk::color::white, const etk::Color<float>& _color2=etk::color::white, const etk::Color<float>& _color3=etk::color::white, const etk::Color<float>& _color4=etk::color::white) { const etk::Color<float>& _color1=etk::color::white, const etk::Color<float>& _color2=etk::color::white, const etk::Color<float>& _color3=etk::color::white, const etk::Color<float>& _color4=etk::color::white) {

View File

@ -7,7 +7,7 @@
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/resource/Mesh.hpp> #include <ege/resource/Mesh.hpp>
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCapsule(float _radius, float _size, const std::string& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) { ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCapsule(float _radius, float _size, const etk::String& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) {
EGE_VERBOSE(" create a capsule _size=" << _size << " _materialName=" << _materialName << " _color=" << _color); EGE_VERBOSE(" create a capsule _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
ememory::SharedPtr<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) {

View File

@ -7,7 +7,7 @@
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/resource/Mesh.hpp> #include <ege/resource/Mesh.hpp>
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCone(float _radius, float _size, const std::string& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) { ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCone(float _radius, float _size, const etk::String& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) {
EGE_VERBOSE(" create a cylinder _size=" << _size << " _materialName=" << _materialName << " _color=" << _color); EGE_VERBOSE(" create a cylinder _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
ememory::SharedPtr<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) {

View File

@ -7,11 +7,11 @@
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/resource/Mesh.hpp> #include <ege/resource/Mesh.hpp>
ememory::SharedPtr<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 etk::String& _materialName, const etk::Color<float>& _color) {
return createCube(vec3(_size, _size, _size), _materialName, _color); return createCube(vec3(_size, _size, _size), _materialName, _color);
} }
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCube(const vec3& _size, const std::string& _materialName, const etk::Color<float>& _color) { ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCube(const vec3& _size, const etk::String& _materialName, const etk::Color<float>& _color) {
EGE_VERBOSE(" create a cube _size=" << _size << " _materialName=" << _materialName << " _color=" << _color); EGE_VERBOSE(" create a cube _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
ememory::SharedPtr<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) {

View File

@ -7,7 +7,7 @@
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/resource/Mesh.hpp> #include <ege/resource/Mesh.hpp>
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCylinder(float _radius, float _size, const std::string& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) { ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCylinder(float _radius, float _size, const etk::String& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) {
EGE_VERBOSE(" create a cylinder _size=" << _size << " _materialName=" << _materialName << " _color=" << _color); EGE_VERBOSE(" create a cylinder _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
ememory::SharedPtr<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) {

View File

@ -139,7 +139,7 @@ enum emfModuleMode {
}; };
// TODO : rework with string line extractor // TODO : rework with string line extractor
bool ege::resource::Mesh::loadEMF(const std::string& _fileName) { bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
m_checkNormal = true; m_checkNormal = true;
m_normalMode = ege::resource::Mesh::normalMode::none; m_normalMode = ege::resource::Mesh::normalMode::none;
etk::FSNode fileName(_fileName); etk::FSNode fileName(_fileName);
@ -168,10 +168,10 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
enum emfModuleMode currentMode = EMFModuleNone; enum emfModuleMode currentMode = EMFModuleNone;
EGE_VERBOSE("Start parsing Mesh file : " << fileName); EGE_VERBOSE("Start parsing Mesh file : " << fileName);
// mesh global param : // mesh global param :
std::string currentMeshName = ""; etk::String currentMeshName = "";
int32_t meshFaceMaterialID = -1; int32_t meshFaceMaterialID = -1;
// material global param : // material global param :
std::string materialName = ""; etk::String materialName = "";
ememory::SharedPtr<ege::Material> material; ememory::SharedPtr<ege::Material> material;
// physical shape: // physical shape:
ememory::SharedPtr<ege::physics::Shape> physics; ememory::SharedPtr<ege::physics::Shape> physics;
@ -266,7 +266,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
break; break;
} }
sscanf(inputDataLine, "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[2] ); sscanf(inputDataLine, "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[2] );
m_listVertex.push_back(vertex); m_listVertex.pushBack(vertex);
int32_t len = strlen(inputDataLine)-1; int32_t len = strlen(inputDataLine)-1;
if( inputDataLine[len] == '\n' if( inputDataLine[len] == '\n'
|| inputDataLine[len] == '\r') { || inputDataLine[len] == '\r') {
@ -283,7 +283,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
break; break;
} }
sscanf(inputDataLine, "%f %f", &uvMap.m_floats[0], &uvMap.m_floats[1]); sscanf(inputDataLine, "%f %f", &uvMap.m_floats[0], &uvMap.m_floats[1]);
m_listUV.push_back(uvMap); m_listUV.pushBack(uvMap);
int32_t len = strlen(inputDataLine)-1; int32_t len = strlen(inputDataLine)-1;
if( inputDataLine[len] == '\n' if( inputDataLine[len] == '\n'
|| inputDataLine[len] == '\r') { || inputDataLine[len] == '\r') {
@ -302,7 +302,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
break; break;
} }
sscanf(inputDataLine, "%f %f %f", &normal.m_floats[0], &normal.m_floats[1], &normal.m_floats[2] ); sscanf(inputDataLine, "%f %f %f", &normal.m_floats[0], &normal.m_floats[1], &normal.m_floats[2] );
m_listVertexNormal.push_back(normal); m_listVertexNormal.pushBack(normal);
int32_t len = strlen(inputDataLine)-1; int32_t len = strlen(inputDataLine)-1;
if( inputDataLine[len] == '\n' if( inputDataLine[len] == '\n'
|| inputDataLine[len] == '\r') { || inputDataLine[len] == '\r') {
@ -322,7 +322,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
break; break;
} }
sscanf(inputDataLine, "%f %f %f", &normal.m_floats[0], &normal.m_floats[1], &normal.m_floats[2] ); sscanf(inputDataLine, "%f %f %f", &normal.m_floats[0], &normal.m_floats[1], &normal.m_floats[2] );
m_listFacesNormal.push_back(normal); m_listFacesNormal.pushBack(normal);
int32_t len = strlen(inputDataLine)-1; int32_t len = strlen(inputDataLine)-1;
if( inputDataLine[len] == '\n' if( inputDataLine[len] == '\n'
|| inputDataLine[len] == '\r') { || inputDataLine[len] == '\r') {
@ -406,7 +406,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
normalIndex[2] += offsetVertexNormal; normalIndex[2] += offsetVertexNormal;
} }
} }
m_listFaces.getValue(meshFaceMaterialID).m_faces.push_back(Face(vertexIndex[0], uvIndex[0], normalIndex[0], m_listFaces.getValue(meshFaceMaterialID).m_faces.pushBack(Face(vertexIndex[0], uvIndex[0], normalIndex[0],
vertexIndex[1], uvIndex[1], normalIndex[1], vertexIndex[1], uvIndex[1], normalIndex[1],
vertexIndex[2], uvIndex[2], normalIndex[2])); vertexIndex[2], uvIndex[2], normalIndex[2]));
/* /*

View File

@ -7,7 +7,7 @@
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/resource/Mesh.hpp> #include <ege/resource/Mesh.hpp>
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> ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const etk::String& _materialName) {
ememory::SharedPtr<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) {
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>(); ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
@ -73,12 +73,12 @@ ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createGrid(int32_t
out->addLine(_materialName, _position+vec3(-1,-1,_lineCount+2.0f)*_size, _position+vec3(-1, 1,_lineCount+2.0f)*_size, etk::color::blue); out->addLine(_materialName, _position+vec3(-1,-1,_lineCount+2.0f)*_size, _position+vec3(-1, 1,_lineCount+2.0f)*_size, etk::color::blue);
} else { } else {
std::vector<vec3> list; etk::Vector<vec3> list;
list.push_back(_position+vec3(-1,-1,iii)*_size); list.pushBack(_position+vec3(-1,-1,iii)*_size);
list.push_back(_position+vec3(1,-1,iii)*_size); list.pushBack(_position+vec3(1,-1,iii)*_size);
list.push_back(_position+vec3(1,1,iii)*_size); list.pushBack(_position+vec3(1,1,iii)*_size);
list.push_back(_position+vec3(-1,1,iii)*_size); list.pushBack(_position+vec3(-1,1,iii)*_size);
list.push_back(_position+vec3(-1,-1,iii)*_size); list.pushBack(_position+vec3(-1,-1,iii)*_size);
out->addLines(_materialName, list, etk::color::gray); out->addLines(_materialName, list, etk::color::gray);
} }
//out->addPoint(_materialName, vec3(iii,-_lineCount,0), etk::color::white); //out->addPoint(_materialName, vec3(iii,-_lineCount,0), etk::color::white);

View File

@ -8,7 +8,7 @@
#include <ege/resource/Mesh.hpp> #include <ege/resource/Mesh.hpp>
bool ege::resource::Mesh::loadOBJ(const std::string& _fileName) { bool ege::resource::Mesh::loadOBJ(const etk::String& _fileName) {
m_normalMode = ege::resource::Mesh::normalMode::none; m_normalMode = ege::resource::Mesh::normalMode::none;
#if 0 #if 0
etk::FSNode fileName(_fileName); etk::FSNode fileName(_fileName);
@ -37,12 +37,12 @@ bool ege::resource::Mesh::loadOBJ(const std::string& _fileName) {
// Texture position : vt 0.748573 0.750412 // Texture position : vt 0.748573 0.750412
vec2 vertex(0,0); vec2 vertex(0,0);
sscanf(&inputDataLine[3], "%f %f", &vertex.m_floats[0], &vertex.m_floats[1]); sscanf(&inputDataLine[3], "%f %f", &vertex.m_floats[0], &vertex.m_floats[1]);
m_listUV.push_back(vertex); m_listUV.pushBack(vertex);
} else { } else {
// Vertice position : v 1.000000 -1.000000 -1.000000 // Vertice position : v 1.000000 -1.000000 -1.000000
vec3 vertex(0,0,0); vec3 vertex(0,0,0);
sscanf(&inputDataLine[2], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[2] ); sscanf(&inputDataLine[2], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[2] );
m_listVertex.push_back(vertex); m_listVertex.pushBack(vertex);
} }
} else if (inputDataLine[0] == 'f') { } else if (inputDataLine[0] == 'f') {
// face : f 5/1/1 1/2/1 4/3/1* // face : f 5/1/1 1/2/1 4/3/1*
@ -80,12 +80,12 @@ bool ege::resource::Mesh::loadOBJ(const std::string& _fileName) {
} }
} }
if (quadMode == true) { if (quadMode == true) {
m_listFaces.push_back(Face(vertexIndex[0]-1, uvIndex[0]-1, m_listFaces.pushBack(Face(vertexIndex[0]-1, uvIndex[0]-1,
vertexIndex[1]-1, uvIndex[1]-1, vertexIndex[1]-1, uvIndex[1]-1,
vertexIndex[2]-1, uvIndex[2]-1, vertexIndex[2]-1, uvIndex[2]-1,
vertexIndex[3]-1, uvIndex[3]-1)); vertexIndex[3]-1, uvIndex[3]-1));
} else { } else {
m_listFaces.push_back(Face(vertexIndex[0]-1, uvIndex[0]-1, m_listFaces.pushBack(Face(vertexIndex[0]-1, uvIndex[0]-1,
vertexIndex[1]-1, uvIndex[1]-1, vertexIndex[1]-1, uvIndex[1]-1,
vertexIndex[2]-1, uvIndex[2]-1)); vertexIndex[2]-1, uvIndex[2]-1));
} }
@ -114,7 +114,7 @@ bool ege::resource::Mesh::loadOBJ(const std::string& _fileName) {
} }
inputDataLine[strlen(inputDataLine)-1] = '\0'; inputDataLine[strlen(inputDataLine)-1] = '\0';
} }
std::string tmpVal(&inputDataLine[7]); etk::String tmpVal(&inputDataLine[7]);
setTexture(fileName.getRelativeFolder() + tmpVal); setTexture(fileName.getRelativeFolder() + tmpVal);
} else if( inputDataLine[0] == 'm' } else if( inputDataLine[0] == 'm'
&& inputDataLine[1] == 't' && inputDataLine[1] == 't'

View File

@ -7,7 +7,7 @@
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/resource/Mesh.hpp> #include <ege/resource/Mesh.hpp>
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createSphere(float _radius, const std::string& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) { ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createSphere(float _radius, const etk::String& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) {
EGE_VERBOSE(" create a sphere _size=" << _radius << " _materialName=" << _materialName << " _color=" << _color); EGE_VERBOSE(" create a sphere _size=" << _radius << " _materialName=" << _materialName << " _color=" << _color);
ememory::SharedPtr<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) {

View File

@ -13,7 +13,7 @@ ege::resource::ParticuleMesh::ParticuleMesh() {
addResourceType("ege::resource::ParticuleMesh"); addResourceType("ege::resource::ParticuleMesh");
} }
void ege::resource::ParticuleMesh::init(const std::string& _fileName, const std::string& _shaderName) { void ege::resource::ParticuleMesh::init(const etk::String& _fileName, const etk::String& _shaderName) {
ege::resource::Mesh::init(_fileName, _shaderName); ege::resource::Mesh::init(_fileName, _shaderName);
if (m_GLprogram != nullptr) { if (m_GLprogram != nullptr) {
m_GLMainColor = m_GLprogram->getUniform("EW_mainColor"); m_GLMainColor = m_GLprogram->getUniform("EW_mainColor");
@ -85,15 +85,15 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
vec3 cameraNormal = vec3(0,0,-1); vec3 cameraNormal = vec3(0,0,-1);
cameraNormal.normalized(); cameraNormal.normalized();
// remove face that is notin the view ... // remove face that is notin the view ...
std::vector<uint32_t> tmpIndexResult; etk::Vector<uint32_t> tmpIndexResult;
std::vector<ege::Face>& tmppFaces = m_listFaces.getValue(kkk).m_faces; etk::Vector<ege::Face>& tmppFaces = m_listFaces.getValue(kkk).m_faces;
//std::vector<uint32_t>& tmppIndex = m_listFaces.getValue(kkk).m_index; //etk::Vector<uint32_t>& tmppIndex = m_listFaces.getValue(kkk).m_index;
if (m_normalMode == ege::resource::Mesh::normalMode::face) { if (m_normalMode == ege::resource::Mesh::normalMode::face) {
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) { for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
if((mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= 0.0f) { if((mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= 0.0f) {
tmpIndexResult.push_back(iii*3); tmpIndexResult.pushBack(iii*3);
tmpIndexResult.push_back(iii*3+1); tmpIndexResult.pushBack(iii*3+1);
tmpIndexResult.push_back(iii*3+2); tmpIndexResult.pushBack(iii*3+2);
} }
} }
} else { } else {
@ -101,9 +101,9 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
if( ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= -0.2f) if( ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= -0.2f)
|| ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]]).dot(cameraNormal) >= -0.2f) || ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]]).dot(cameraNormal) >= -0.2f)
|| ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]]).dot(cameraNormal) >= -0.2f) ) { || ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]]).dot(cameraNormal) >= -0.2f) ) {
tmpIndexResult.push_back(iii*3); tmpIndexResult.pushBack(iii*3);
tmpIndexResult.push_back(iii*3+1); tmpIndexResult.pushBack(iii*3+1);
tmpIndexResult.push_back(iii*3+2); tmpIndexResult.pushBack(iii*3+2);
} }
} }
} }

View File

@ -14,7 +14,7 @@ namespace ege {
int32_t m_GLMainColor; int32_t m_GLMainColor;
protected: protected:
ParticuleMesh(); ParticuleMesh();
void init(const std::string& _fileName, const std::string& _shaderName="DATA:ParticuleMesh.prog"); void init(const etk::String& _fileName, const etk::String& _shaderName="DATA:ParticuleMesh.prog");
public: public:
DECLARE_RESOURCE_NAMED_FACTORY(ParticuleMesh); DECLARE_RESOURCE_NAMED_FACTORY(ParticuleMesh);
virtual ~ParticuleMesh(); virtual ~ParticuleMesh();

View File

@ -8,8 +8,8 @@
namespace ege { namespace ege {
class FaceIndexing { class FaceIndexing {
public: public:
std::vector<Face> m_faces; etk::Vector<Face> m_faces;
std::vector<uint32_t> m_index; //!< index of the vertex in the VBO not in the Mesh.m_listVertex etk::Vector<uint32_t> m_index; //!< index of the vertex in the VBO not in the Mesh.m_listVertex
}; };
} }

View File

@ -9,7 +9,7 @@
#include <cmath> #include <cmath>
// return index of point in the middle of p1 and p2 // return index of point in the middle of p1 and p2
static int32_t getMiddlePoint(std::vector<vec3>& _listVertex, int32_t _p1, int32_t _p2) { static int32_t getMiddlePoint(etk::Vector<vec3>& _listVertex, int32_t _p1, int32_t _p2) {
vec3 middle = (_listVertex[_p1] + _listVertex[_p2])*0.5f; vec3 middle = (_listVertex[_p1] + _listVertex[_p2])*0.5f;
// check if this point exist: // check if this point exist:
int32_t id=0; int32_t id=0;
@ -19,19 +19,19 @@ static int32_t getMiddlePoint(std::vector<vec3>& _listVertex, int32_t _p1, int32
} }
id++; id++;
} }
_listVertex.push_back(middle.normalize()); _listVertex.pushBack(middle.normalize());
return _listVertex.size()-1; return _listVertex.size()-1;
} }
static int32_t addUV(std::vector<vec2>& _listUV, int32_t _uvId, float _add) { static int32_t addUV(etk::Vector<vec2>& _listUV, int32_t _uvId, float _add) {
//vec2 plop(-_add, _listUV[_uvId].y()); //vec2 plop(-_add, _listUV[_uvId].y());
//_listUV.push_back(plop); //_listUV.pushBack(plop);
_listUV.push_back(_listUV[_uvId] + vec2(_add, 0.0f)); _listUV.pushBack(_listUV[_uvId] + vec2(_add, 0.0f));
return _listUV.size()-1; return _listUV.size()-1;
} }
void ege::icoSphere::create(etk::Hash<ememory::SharedPtr<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, etk::Vector<vec3>& _listVertex, etk::Vector<vec2>& _listUV,
const std::string& _materialName, float _size, int32_t _recursionLevel) { const etk::String& _materialName, float _size, int32_t _recursionLevel) {
/* /*
5 5
o o
@ -62,28 +62,28 @@ void ege::icoSphere::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _mater
double size = 1.0; double size = 1.0;
double ttt = (1.0 + sqrt(5.0)) / 2.0*size; double ttt = (1.0 + sqrt(5.0)) / 2.0*size;
EGE_ERROR("podition : " << ttt); EGE_ERROR("podition : " << ttt);
_listVertex.push_back(vec3(-size, ttt, 0.0).normalize()); // 0 _listVertex.pushBack(vec3(-size, ttt, 0.0).normalize()); // 0
_listVertex.push_back(vec3( size, ttt, 0.0).normalize()); // 1 _listVertex.pushBack(vec3( size, ttt, 0.0).normalize()); // 1
_listVertex.push_back(vec3(-size, -ttt, 0.0).normalize()); // 2 _listVertex.pushBack(vec3(-size, -ttt, 0.0).normalize()); // 2
_listVertex.push_back(vec3( size, -ttt, 0.0).normalize()); // 3 _listVertex.pushBack(vec3( size, -ttt, 0.0).normalize()); // 3
_listVertex.push_back(vec3( 0.0, -1, ttt).normalize()); // 4 _listVertex.pushBack(vec3( 0.0, -1, ttt).normalize()); // 4
_listVertex.push_back(vec3( 0.0, 1, ttt).normalize()); // 5 _listVertex.pushBack(vec3( 0.0, 1, ttt).normalize()); // 5
_listVertex.push_back(vec3( 0.0, -1, -ttt).normalize()); // 6 _listVertex.pushBack(vec3( 0.0, -1, -ttt).normalize()); // 6
_listVertex.push_back(vec3( 0.0, 1, -ttt).normalize()); // 7 _listVertex.pushBack(vec3( 0.0, 1, -ttt).normalize()); // 7
_listVertex.push_back(vec3( ttt, 0.0, -size).normalize()); // 8 _listVertex.pushBack(vec3( ttt, 0.0, -size).normalize()); // 8
_listVertex.push_back(vec3( ttt, 0.0, size).normalize()); // 9 _listVertex.pushBack(vec3( ttt, 0.0, size).normalize()); // 9
_listVertex.push_back(vec3(-ttt, 0.0, -size).normalize()); // 10 _listVertex.pushBack(vec3(-ttt, 0.0, -size).normalize()); // 10
_listVertex.push_back(vec3(-ttt, 0.0, size).normalize()); // 11 _listVertex.pushBack(vec3(-ttt, 0.0, size).normalize()); // 11
// _listUV ==> TODO : very bad code ... get from viewBox .... // _listUV ==> TODO : very bad code ... get from viewBox ....
_listUV.push_back(vec2(0.0, 0.0 )); // 0 _listUV.pushBack(vec2(0.0, 0.0 )); // 0
_listUV.push_back(vec2(0.0, 1.0 )); // 1 _listUV.pushBack(vec2(0.0, 1.0 )); // 1
_listUV.push_back(vec2(1.0, 0.0 )); // 2 _listUV.pushBack(vec2(1.0, 0.0 )); // 2
for (auto &elem : _listVertex) { for (auto &elem : _listVertex) {
EGE_INFO("plop : " << etk::to_string(elem)); EGE_INFO("plop : " << etk::toString(elem));
} }
if (_listFaces.exist(_materialName) == false) { if (_listFaces.exist(_materialName) == false) {
@ -93,44 +93,44 @@ void ege::icoSphere::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _mater
{ {
FaceIndexing& tmpElement = _listFaces[_materialName]; FaceIndexing& tmpElement = _listFaces[_materialName];
// 5 faces around point 0 // 5 faces around point 0
tmpElement.m_faces.push_back(Face(0,0, 11,1, 5,2)); tmpElement.m_faces.pushBack(Face(0,0, 11,1, 5,2));
tmpElement.m_faces.push_back(Face(0,0, 5,1, 1,2)); tmpElement.m_faces.pushBack(Face(0,0, 5,1, 1,2));
tmpElement.m_faces.push_back(Face(0,0, 1,1, 7,2)); tmpElement.m_faces.pushBack(Face(0,0, 1,1, 7,2));
tmpElement.m_faces.push_back(Face(0,0, 7,1, 10,2)); tmpElement.m_faces.pushBack(Face(0,0, 7,1, 10,2));
tmpElement.m_faces.push_back(Face(0,0, 10,1, 11,2)); tmpElement.m_faces.pushBack(Face(0,0, 10,1, 11,2));
// 5 adjacent faces // 5 adjacent faces
tmpElement.m_faces.push_back(Face( 1,0, 5,1, 9,2)); tmpElement.m_faces.pushBack(Face( 1,0, 5,1, 9,2));
tmpElement.m_faces.push_back(Face( 5,0, 11,1, 4,2)); tmpElement.m_faces.pushBack(Face( 5,0, 11,1, 4,2));
tmpElement.m_faces.push_back(Face(11,0, 10,1, 2,2)); tmpElement.m_faces.pushBack(Face(11,0, 10,1, 2,2));
tmpElement.m_faces.push_back(Face(10,0, 7,1, 6,2)); tmpElement.m_faces.pushBack(Face(10,0, 7,1, 6,2));
tmpElement.m_faces.push_back(Face( 7,0, 1,1, 8,2)); tmpElement.m_faces.pushBack(Face( 7,0, 1,1, 8,2));
// 5 faces around point 3 // 5 faces around point 3
tmpElement.m_faces.push_back(Face(3,0, 9,1, 4,2)); tmpElement.m_faces.pushBack(Face(3,0, 9,1, 4,2));
tmpElement.m_faces.push_back(Face(3,0, 4,1, 2,2)); tmpElement.m_faces.pushBack(Face(3,0, 4,1, 2,2));
tmpElement.m_faces.push_back(Face(3,0, 2,1, 6,2)); tmpElement.m_faces.pushBack(Face(3,0, 2,1, 6,2));
tmpElement.m_faces.push_back(Face(3,0, 6,1, 8,2)); tmpElement.m_faces.pushBack(Face(3,0, 6,1, 8,2));
tmpElement.m_faces.push_back(Face(3,0, 8,1, 9,2)); tmpElement.m_faces.pushBack(Face(3,0, 8,1, 9,2));
// 5 adjacent faces // 5 adjacent faces
tmpElement.m_faces.push_back(Face(4,0, 9,1, 5,2)); tmpElement.m_faces.pushBack(Face(4,0, 9,1, 5,2));
tmpElement.m_faces.push_back(Face(2,0, 4,1, 11,2)); tmpElement.m_faces.pushBack(Face(2,0, 4,1, 11,2));
tmpElement.m_faces.push_back(Face(6,0, 2,1, 10,2)); tmpElement.m_faces.pushBack(Face(6,0, 2,1, 10,2));
tmpElement.m_faces.push_back(Face(8,0, 6,1, 7,2)); tmpElement.m_faces.pushBack(Face(8,0, 6,1, 7,2));
tmpElement.m_faces.push_back(Face(9,0, 8,1, 1,2)); tmpElement.m_faces.pushBack(Face(9,0, 8,1, 1,2));
// refine triangles // refine triangles
for (int i = 0; i < _recursionLevel; i++) { for (int i = 0; i < _recursionLevel; i++) {
std::vector<Face> listFaces; etk::Vector<Face> listFaces;
for (auto &tri : tmpElement.m_faces) { for (auto &tri : tmpElement.m_faces) {
// replace triangle by 4 triangles // replace triangle by 4 triangles
int32_t a = getMiddlePoint(_listVertex, tri.m_vertex[0], tri.m_vertex[1]); int32_t a = getMiddlePoint(_listVertex, tri.m_vertex[0], tri.m_vertex[1]);
int32_t b = getMiddlePoint(_listVertex, tri.m_vertex[1], tri.m_vertex[2]); int32_t b = getMiddlePoint(_listVertex, tri.m_vertex[1], tri.m_vertex[2]);
int32_t c = getMiddlePoint(_listVertex, tri.m_vertex[2], tri.m_vertex[0]); int32_t c = getMiddlePoint(_listVertex, tri.m_vertex[2], tri.m_vertex[0]);
listFaces.push_back(Face(tri.m_vertex[0],0, a,1, c,2)); listFaces.pushBack(Face(tri.m_vertex[0],0, a,1, c,2));
listFaces.push_back(Face(tri.m_vertex[1],0, b,1, a,2)); listFaces.pushBack(Face(tri.m_vertex[1],0, b,1, a,2));
listFaces.push_back(Face(tri.m_vertex[2],0, c,1, b,2)); listFaces.pushBack(Face(tri.m_vertex[2],0, c,1, b,2));
listFaces.push_back(Face(a,0, b,1, c,2)); listFaces.pushBack(Face(a,0, b,1, c,2));
} }
tmpElement.m_faces = listFaces; tmpElement.m_faces = listFaces;
} }
@ -156,20 +156,20 @@ void ege::icoSphere::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _mater
angle = -angle; angle = -angle;
} }
} }
//EGE_WARNING( "angle = " << (angle/M_PI*180.0f) << " from: vert=" << etk::to_string(vert) << " proj=" << proj ); //EGE_WARNING( "angle = " << (angle/M_PI*180.0f) << " from: vert=" << etk::toString(vert) << " proj=" << proj );
texturePos.setX(angle/(2.0f*M_PI)+0.5f); texturePos.setX(angle/(2.0f*M_PI)+0.5f);
angle = std::acos(proj/1.0f); angle = std::acos(proj/1.0f);
if (vert.z()<0) { if (vert.z()<0) {
angle = -angle; angle = -angle;
} }
//EGE_WARNING( "angle = " << (angle/M_PI*180.0f) << " from: vert=" << etk::to_string(vert) << " proj=" << proj ); //EGE_WARNING( "angle = " << (angle/M_PI*180.0f) << " from: vert=" << etk::toString(vert) << " proj=" << proj );
texturePos.setY(angle/(M_PI)+0.5); texturePos.setY(angle/(M_PI)+0.5);
texturePos.setMax(vec2(0.0f, 0.0f)); texturePos.setMax(vec2(0.0f, 0.0f));
texturePos.setMin(vec2(1.0f, 1.0f)); texturePos.setMin(vec2(1.0f, 1.0f));
//EGE_WARNING("texturePosition = " << texturePos); //EGE_WARNING("texturePosition = " << texturePos);
_listUV.push_back(texturePos); _listUV.pushBack(texturePos);
} }
for (auto &face : tmpElement.m_faces) { for (auto &face : tmpElement.m_faces) {
float y0 = _listVertex[face.m_vertex[0]].y(); float y0 = _listVertex[face.m_vertex[0]].y();

View File

@ -12,8 +12,8 @@
namespace ege { namespace ege {
namespace icoSphere { namespace icoSphere {
void create(etk::Hash<ememory::SharedPtr<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, etk::Vector<vec3>& _listVertex, etk::Vector<vec2>& _listUV,
const std::string& _materialName, float _size, int32_t _recursionLevel); const etk::String& _materialName, float _size, int32_t _recursionLevel);
} }
} }

View File

@ -7,15 +7,15 @@
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/resource/tools/isoSphere.hpp> #include <ege/resource/tools/isoSphere.hpp>
void ege::isoSphere::create(etk::Hash<ememory::SharedPtr<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, etk::Vector<vec3>& _listVertex, etk::Vector<vec2>& _listUV,
const std::string& _materialName, int32_t _recursionLevel) { const etk::String& _materialName, int32_t _recursionLevel) {
_recursionLevel = std::max(_recursionLevel, 3); _recursionLevel = etk::max(_recursionLevel, 3);
float size = 1.0f; float size = 1.0f;
//Add top and buttom point: //Add top and buttom point:
_listVertex.push_back(vec3(0.0f, 0.0f, size)); // 0 (top) _listVertex.pushBack(vec3(0.0f, 0.0f, size)); // 0 (top)
_listVertex.push_back(vec3(0.0f, 0.0f, -size)); // 1 (buttom) _listVertex.pushBack(vec3(0.0f, 0.0f, -size)); // 1 (buttom)
_listUV.push_back(vec2(0.5, 1.0 )); // 0 _listUV.pushBack(vec2(0.5, 1.0 )); // 0
_listUV.push_back(vec2(0.5, 0.0 )); // 1 _listUV.pushBack(vec2(0.5, 0.0 )); // 1
for (int32_t iii=0; iii<_recursionLevel; iii++) { for (int32_t iii=0; iii<_recursionLevel; iii++) {

View File

@ -12,8 +12,8 @@
namespace ege { namespace ege {
namespace isoSphere { namespace isoSphere {
void create(etk::Hash<ememory::SharedPtr<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, etk::Vector<vec3>& _listVertex, etk::Vector<vec2>& _listUV,
const std::string& _materialName, int32_t _recursionLevel); const etk::String& _materialName, int32_t _recursionLevel);
} }
} }

View File

@ -9,8 +9,8 @@
void ege::viewBox::create(etk::Hash<ememory::SharedPtr<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, etk::Vector<vec3>& _listVertex, etk::Vector<vec2>& _listUV,
const std::string& _materialName, float _size) { const etk::String& _materialName, float _size) {
// This is the direct generation basis on the .obj system // This is the direct generation basis on the .obj system
/* /*
5 6 5 6
@ -36,14 +36,14 @@ void ege::viewBox::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materia
o---------------------o o---------------------o
0 3 0 3
*/ */
_listVertex.push_back(vec3( _size, -_size, -_size)); // 0 _listVertex.pushBack(vec3( _size, -_size, -_size)); // 0
_listVertex.push_back(vec3( _size, -_size, _size)); // 1 _listVertex.pushBack(vec3( _size, -_size, _size)); // 1
_listVertex.push_back(vec3(-_size, -_size, _size)); // 2 _listVertex.pushBack(vec3(-_size, -_size, _size)); // 2
_listVertex.push_back(vec3(-_size, -_size, -_size)); // 3 _listVertex.pushBack(vec3(-_size, -_size, -_size)); // 3
_listVertex.push_back(vec3( _size, _size, -_size)); // 4 _listVertex.pushBack(vec3( _size, _size, -_size)); // 4
_listVertex.push_back(vec3( _size, _size, _size)); // 5 _listVertex.pushBack(vec3( _size, _size, _size)); // 5
_listVertex.push_back(vec3(-_size, _size, _size)); // 6 _listVertex.pushBack(vec3(-_size, _size, _size)); // 6
_listVertex.push_back(vec3(-_size, _size, -_size)); // 7 _listVertex.pushBack(vec3(-_size, _size, -_size)); // 7
/* /*
o----------o----------o----------o o----------o----------o----------o
|8 |9 |10 |11 |8 |9 |10 |11
@ -66,18 +66,18 @@ void ege::viewBox::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materia
o----------o----------o----------o o----------o----------o----------o
0 1 2 3 0 1 2 3
*/ */
_listUV.push_back(vec2(0.0 , 0.0 )); // 0 _listUV.pushBack(vec2(0.0 , 0.0 )); // 0
_listUV.push_back(vec2(1.0/3.0, 0.0 )); // 1 _listUV.pushBack(vec2(1.0/3.0, 0.0 )); // 1
_listUV.push_back(vec2(2.0/3.0, 0.0 )); // 2 _listUV.pushBack(vec2(2.0/3.0, 0.0 )); // 2
_listUV.push_back(vec2(1.0 , 0.0 )); // 3 _listUV.pushBack(vec2(1.0 , 0.0 )); // 3
_listUV.push_back(vec2(0.0 , 0.5 )); // 4 _listUV.pushBack(vec2(0.0 , 0.5 )); // 4
_listUV.push_back(vec2(1.0/3.0, 0.5 )); // 5 _listUV.pushBack(vec2(1.0/3.0, 0.5 )); // 5
_listUV.push_back(vec2(2.0/3.0, 0.5 )); // 6 _listUV.pushBack(vec2(2.0/3.0, 0.5 )); // 6
_listUV.push_back(vec2(1.0 , 0.5 )); // 7 _listUV.pushBack(vec2(1.0 , 0.5 )); // 7
_listUV.push_back(vec2(0.0 , 1.0 )); // 8 _listUV.pushBack(vec2(0.0 , 1.0 )); // 8
_listUV.push_back(vec2(1.0/3.0, 1.0 )); // 9 _listUV.pushBack(vec2(1.0/3.0, 1.0 )); // 9
_listUV.push_back(vec2(2.0/3.0, 1.0 )); // 10 _listUV.pushBack(vec2(2.0/3.0, 1.0 )); // 10
_listUV.push_back(vec2(1.0 , 1.0 )); // 11 _listUV.pushBack(vec2(1.0 , 1.0 )); // 11
if (_listFaces.exist(_materialName) == false) { if (_listFaces.exist(_materialName) == false) {
FaceIndexing empty; FaceIndexing empty;
@ -85,17 +85,17 @@ void ege::viewBox::create(etk::Hash<ememory::SharedPtr<ege::Material>>& _materia
} }
{ {
FaceIndexing& tmpElement = _listFaces[_materialName]; FaceIndexing& tmpElement = _listFaces[_materialName];
tmpElement.m_faces.push_back(Face(0,1, 1,5, 2,6)); // 4 tmpElement.m_faces.pushBack(Face(0,1, 1,5, 2,6)); // 4
tmpElement.m_faces.push_back(Face(0,1, 2,6, 3,2)); // 4 tmpElement.m_faces.pushBack(Face(0,1, 2,6, 3,2)); // 4
tmpElement.m_faces.push_back(Face(4,4, 0,0, 3,1)); // 3 tmpElement.m_faces.pushBack(Face(4,4, 0,0, 3,1)); // 3
tmpElement.m_faces.push_back(Face(4,4, 3,1, 7,5)); // 3 tmpElement.m_faces.pushBack(Face(4,4, 3,1, 7,5)); // 3
tmpElement.m_faces.push_back(Face(2,6, 6,10, 7,11)); // 2 tmpElement.m_faces.pushBack(Face(2,6, 6,10, 7,11)); // 2
tmpElement.m_faces.push_back(Face(2,6, 7,11, 3,7)); // 2 tmpElement.m_faces.pushBack(Face(2,6, 7,11, 3,7)); // 2
tmpElement.m_faces.push_back(Face(4,2, 7,3, 6,7)); // 5 tmpElement.m_faces.pushBack(Face(4,2, 7,3, 6,7)); // 5
tmpElement.m_faces.push_back(Face(4,2, 6,7, 5,6)); // 5 tmpElement.m_faces.pushBack(Face(4,2, 6,7, 5,6)); // 5
tmpElement.m_faces.push_back(Face(1,5, 5,9, 6,10)); // 1 tmpElement.m_faces.pushBack(Face(1,5, 5,9, 6,10)); // 1
tmpElement.m_faces.push_back(Face(1,5, 6,10, 2,6)); // 1 tmpElement.m_faces.pushBack(Face(1,5, 6,10, 2,6)); // 1
tmpElement.m_faces.push_back(Face(0,4, 4,8, 5,9)); // 0 tmpElement.m_faces.pushBack(Face(0,4, 4,8, 5,9)); // 0
tmpElement.m_faces.push_back(Face(0,4, 5,9, 1,5)); // 0 tmpElement.m_faces.pushBack(Face(0,4, 5,9, 1,5)); // 0
} }
} }

View File

@ -12,8 +12,8 @@
namespace ege { namespace ege {
namespace viewBox { namespace viewBox {
void create(etk::Hash<ememory::SharedPtr<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, etk::Vector<vec3>& _listVertex, etk::Vector<vec2>& _listUV,
const std::string& _materialName, float _size); const etk::String& _materialName, float _size);
} }
} }

View File

@ -85,7 +85,7 @@ bool ege::widget::Mesh::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} }
void ege::widget::Mesh::setFile(const std::string& _filename) { void ege::widget::Mesh::setFile(const etk::String& _filename) {
if( _filename != "" if( _filename != ""
&& m_meshName != _filename ) { && m_meshName != _filename ) {
m_meshName = _filename; m_meshName = _filename;

View File

@ -19,7 +19,7 @@ namespace ege {
esignal::Signal<> signalPressed; esignal::Signal<> signalPressed;
private: private:
// mesh name : // mesh name :
std::string m_meshName; etk::String m_meshName;
ememory::SharedPtr<ege::resource::Mesh> m_object; ememory::SharedPtr<ege::resource::Mesh> m_object;
// mesh display properties: // mesh display properties:
vec3 m_position; vec3 m_position;
@ -48,7 +48,7 @@ namespace ege {
* @brief set a mesh name file * @brief set a mesh name file
* @param[in] _filename Name of the new mesh * @param[in] _filename Name of the new mesh
*/ */
void setFile(const std::string& _filename); void setFile(const etk::String& _filename);
/** /**
* @brief set the mesh position * @brief set the mesh position
* @param[in] _pos The new position of the mesh * @param[in] _pos The new position of the mesh

View File

@ -17,7 +17,7 @@
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
namespace etk { namespace etk {
template<> std::string to_string<ememory::SharedPtr<ewol::resource::Colored3DObject> >(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _value) { template<> etk::String toString<ememory::SharedPtr<ewol::resource::Colored3DObject> >(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _value) {
return "{{ERROR}}"; return "{{ERROR}}";
} }
}; };
@ -119,7 +119,7 @@ void ege::widget::Scene::systemDraw(const ewol::DrawProperty& _displayProp) {
} }
void ege::widget::Scene::setCamera(const std::string& _cameraName) { void ege::widget::Scene::setCamera(const etk::String& _cameraName) {
if (m_cameraName == _cameraName) { if (m_cameraName == _cameraName) {
return; return;
} }

View File

@ -8,7 +8,7 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/math/Vector3D.hpp> #include <etk/math/Vector3D.hpp>
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
#include <vector> #include <etk/Vector.hpp>
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <ege/camera/Camera.hpp> #include <ege/camera/Camera.hpp>
#include <ewol/widget/Widget.hpp> #include <ewol/widget/Widget.hpp>
@ -51,23 +51,23 @@ namespace ege {
*/ */
virtual ~Scene(); virtual ~Scene();
protected: protected:
std::string m_cameraName; //!< current camera name etk::String m_cameraName; //!< current camera name
public: public:
/** /**
* @brief Select a Camera for the display. * @brief Select a Camera for the display.
* @param[in] _cameraName New name of the camera. * @param[in] _cameraName New name of the camera.
*/ */
void setCamera(const std::string& _cameraName); void setCamera(const etk::String& _cameraName);
/** /**
* @brief Get the current camera name to display the environnement. * @brief Get the current camera name to display the environnement.
* @return the current camera name. * @return the current camera name.
*/ */
const std::string& getCamera() const { const etk::String& getCamera() const {
return m_cameraName; return m_cameraName;
} }
protected: protected:
// Note : This is only for temporary entitys : on the display // Note : This is only for temporary entitys : on the display
std::vector<ege::Environement::ResultNearestEntity> m_displayEntityOrdered; etk::Vector<ege::Environement::ResultNearestEntity> m_displayEntityOrdered;
protected: protected:
esignal::Connection m_PCH; //!< Periodic call handle to remove it when needed esignal::Connection m_PCH; //!< Periodic call handle to remove it when needed
/** /**

View File

@ -23,7 +23,7 @@ class MainApplication : public ewol::context::Application {
void onCreate(ewol::Context& _context) override { void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)"); APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii); etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h" if ( tmpppp == "-h"
|| tmpppp == "--help") { || tmpppp == "--help") {
APPL_INFO(" -h/--help display this help" ); APPL_INFO(" -h/--help display this help" );

View File

@ -47,7 +47,7 @@ def configure(target, my_module):
my_module.add_flag('c++', [ my_module.add_flag('c++', [
"-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" "-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
]) ])
# set the package properties: # set the package properties:

View File

@ -23,7 +23,7 @@ class MainApplication : public ewol::context::Application {
void onCreate(ewol::Context& _context) override { void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)"); APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii); etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h" if ( tmpppp == "-h"
|| tmpppp == "--help") { || tmpppp == "--help") {
APPL_INFO(" -h/--help display this help" ); APPL_INFO(" -h/--help display this help" );

View File

@ -47,7 +47,7 @@ def configure(target, my_module):
my_module.add_flag('c++', [ my_module.add_flag('c++', [
"-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" "-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
]) ])
# set the package properties : # set the package properties :

View File

@ -23,7 +23,7 @@ class MainApplication : public ewol::context::Application {
void onCreate(ewol::Context& _context) override { void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)"); APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii); etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h" if ( tmpppp == "-h"
|| tmpppp == "--help") { || tmpppp == "--help") {
APPL_INFO(" -h/--help display this help" ); APPL_INFO(" -h/--help display this help" );

View File

@ -47,7 +47,7 @@ def configure(target, my_module):
my_module.add_flag('c++', [ my_module.add_flag('c++', [
"-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" "-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
]) ])
# set the package properties: # set the package properties:

View File

@ -23,7 +23,7 @@ class MainApplication : public ewol::context::Application {
void onCreate(ewol::Context& _context) override { void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)"); APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii); etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h" if ( tmpppp == "-h"
|| tmpppp == "--help") { || tmpppp == "--help") {
APPL_INFO(" -h/--help display this help" ); APPL_INFO(" -h/--help display this help" );

View File

@ -47,7 +47,7 @@ def configure(target, my_module):
my_module.add_flag('c++', [ my_module.add_flag('c++', [
"-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" "-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
]) ])
# set the package properties: # set the package properties:

View File

@ -160,7 +160,7 @@ void appl::Windows::setDebugShape() {
m_env->getEngine("physics")->properties.set("debug-shape", "true"); m_env->getEngine("physics")->properties.set("debug-shape", "true");
} }
void appl::Windows::setMeshName(const std::string& _fileName) { void appl::Windows::setMeshName(const etk::String& _fileName) {
// Create an external box: (no physics) // Create an external box: (no physics)
ememory::SharedPtr<ege::resource::Mesh> myMesh = ege::resource::Mesh::create(_fileName); ememory::SharedPtr<ege::resource::Mesh> myMesh = ege::resource::Mesh::create(_fileName);
if (myMesh != nullptr) { if (myMesh != nullptr) {

View File

@ -27,7 +27,7 @@ namespace appl {
private: private:
void onCallbackPeriodicUpdateCamera(const ewol::event::Time& _event); void onCallbackPeriodicUpdateCamera(const ewol::event::Time& _event);
public: public:
void setMeshName(const std::string& _fileName); void setMeshName(const etk::String& _fileName);
void setDebugNormal(); void setDebugNormal();
void setDebugAABB(); void setDebugAABB();
void setDebugShape(); void setDebugShape();

View File

@ -33,7 +33,7 @@ class MainApplication : public ewol::context::Application {
ememory::SharedPtr<appl::Windows> basicWindows = appl::Windows::create(); ememory::SharedPtr<appl::Windows> basicWindows = appl::Windows::create();
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii); etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h" if ( tmpppp == "-h"
|| tmpppp == "--help") { || tmpppp == "--help") {
APPL_PRINT(" -h/--help display this help"); APPL_PRINT(" -h/--help display this help");
@ -43,7 +43,7 @@ class MainApplication : public ewol::context::Application {
APPL_PRINT(" --debug-shape Display Shape"); APPL_PRINT(" --debug-shape Display Shape");
exit(0); exit(0);
} else if (etk::start_with(tmpppp, "--mesh=") == true) { } else if (etk::start_with(tmpppp, "--mesh=") == true) {
std::string fileName = &tmpppp[7]; etk::String fileName = &tmpppp[7];
basicWindows->setMeshName(fileName); basicWindows->setMeshName(fileName);
} else if (tmpppp == "--debug-normal") { } else if (tmpppp == "--debug-normal") {
basicWindows->setDebugNormal(); basicWindows->setDebugNormal();

View File

@ -46,7 +46,7 @@ def configure(target, my_module):
my_module.add_flag('c++', [ my_module.add_flag('c++', [
"-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" "-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
]) ])
# set the package properties: # set the package properties:

View File

@ -181,20 +181,20 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
if (_event.getStatus() == gale::key::status::down) { if (_event.getStatus() == gale::key::status::down) {
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);
m_ray = std::make_pair(ray.getOrigin(), ray.getOrigin()+ray.getDirection()*50000); m_ray = etk::makePair(ray.getOrigin(), ray.getOrigin()+ray.getDirection()*50000);
APPL_DEBUG("pos=" << pos << " ray = " << ray); APPL_DEBUG("pos=" << pos << " ray = " << ray);
ememory::SharedPtr<ege::physics::Engine> engine = ememory::dynamicPointerCast<ege::physics::Engine>(m_env->getEngine("physics")); ememory::SharedPtr<ege::physics::Engine> engine = ememory::dynamicPointerCast<ege::physics::Engine>(m_env->getEngine("physics"));
if (engine != nullptr) { if (engine != nullptr) {
/* /*
std::pair<ememory::SharedPtr<ege::physic::Component>, std::pair<vec3,vec3>> result = engine->testRayObject(m_ray); etk::Pair<ememory::SharedPtr<ege::physic::Component>, etk::Pair<vec3,vec3>> result = engine->testRayObject(m_ray);
if (result.first != nullptr) { if (result.first != nullptr) {
APPL_INFO("Select Object :" << result.first->getUID()); APPL_INFO("Select Object :" << result.first->getUID());
} }
*/ */
std::pair<vec3,vec3> result = engine->testRay(ray); etk::Pair<vec3,vec3> result = engine->testRay(ray);
if (result.second != vec3(0,0,0)) { if (result.second != vec3(0,0,0)) {
APPL_INFO("impact at: pos=" << result.first << " normal=" << result.second); APPL_INFO("impact at: pos=" << result.first << " normal=" << result.second);
m_destination = std::make_pair(result.first, result.first+result.second*50); m_destination = etk::makePair(result.first, result.first+result.second*50);
m_ray.second = result.first; m_ray.second = result.first;
} }
} }
@ -210,10 +210,10 @@ void appl::Windows::onCallbackDisplayDebug(const ememory::SharedPtr<ewol::resour
mat.identity(); mat.identity();
// Display ray line // Display ray line
if (true) { if (true) {
static std::vector<vec3> vertices; static etk::Vector<vec3> vertices;
if (m_ray.first != vec3(0,0,0)) { if (m_ray.first != vec3(0,0,0)) {
vertices.push_back(m_ray.first); vertices.pushBack(m_ray.first);
vertices.push_back(m_ray.second); vertices.pushBack(m_ray.second);
// prevent Ray removing with empty // prevent Ray removing with empty
m_ray.first = vec3(0,0,0); m_ray.first = vec3(0,0,0);
} }
@ -224,10 +224,10 @@ void appl::Windows::onCallbackDisplayDebug(const ememory::SharedPtr<ewol::resour
} }
// display normal impact line // display normal impact line
if (true) { if (true) {
static std::vector<vec3> vertices; static etk::Vector<vec3> vertices;
if (m_destination.second != vec3(0,0,0)) { if (m_destination.second != vec3(0,0,0)) {
vertices.push_back(m_destination.first); vertices.pushBack(m_destination.first);
vertices.push_back(m_destination.second); vertices.pushBack(m_destination.second);
m_destination.second = vec3(0,0,0); m_destination.second = vec3(0,0,0);
} }
if (vertices.size() > 250) { if (vertices.size() > 250) {

View File

@ -31,8 +31,8 @@ namespace appl {
bool onEventEntry(const ewol::event::Entry& _event) override; bool onEventEntry(const ewol::event::Entry& _event) override;
bool onEventInput(const ewol::event::Input& _event) override; bool onEventInput(const ewol::event::Input& _event) override;
void onCallbackDisplayDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _obj); void onCallbackDisplayDebug(const ememory::SharedPtr<ewol::resource::Colored3DObject>& _obj);
std::pair<vec3,vec3> m_ray; etk::Pair<vec3,vec3> m_ray;
std::pair<vec3,vec3> m_destination; etk::Pair<vec3,vec3> m_destination;
}; };
} }

View File

@ -23,7 +23,7 @@ class MainApplication : public ewol::context::Application {
void onCreate(ewol::Context& _context) override { void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)"); APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii); etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h" if ( tmpppp == "-h"
|| tmpppp == "--help") { || tmpppp == "--help") {
APPL_INFO(" -h/--help display this help" ); APPL_INFO(" -h/--help display this help" );

View File

@ -47,7 +47,7 @@ def configure(target, my_module):
my_module.add_flag('c++', [ my_module.add_flag('c++', [
"-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" "-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
]) ])
# set the package properties: # set the package properties:

View File

@ -23,7 +23,7 @@ class MainApplication : public ewol::context::Application {
void onCreate(ewol::Context& _context) override { void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)"); APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii); etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h" if ( tmpppp == "-h"
|| tmpppp == "--help") { || tmpppp == "--help") {
APPL_INFO(" -h/--help display this help" ); APPL_INFO(" -h/--help display this help" );

View File

@ -47,7 +47,7 @@ def configure(target, my_module):
my_module.add_flag('c++', [ my_module.add_flag('c++', [
"-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" "-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
]) ])
# set the package properties : # set the package properties :