From 013e80917222ef8cd20fe6ee9c4e08ac8c39427c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 13 Sep 2013 09:04:09 +0200 Subject: [PATCH] [DEV] First version that might work --- ege/Camera.cpp | 3 +++ ege/CollisionShapeCreator.cpp | 3 +++ ege/Environement.cpp | 2 ++ ege/Particule.cpp | 8 ++++++-- ege/Particule.h | 1 + ege/ParticuleEngine.cpp | 7 +++++-- ege/ParticuleEngine.h | 2 +- ege/ParticuleSimple.cpp | 2 ++ ege/ParticuleSimple.h | 3 ++- ege/Scene.cpp | 2 ++ 10 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ege/Camera.cpp b/ege/Camera.cpp index b96cc64..e96af28 100644 --- a/ege/Camera.cpp +++ b/ege/Camera.cpp @@ -10,6 +10,9 @@ #include #include +#undef __class__ +#define __class__ "Camera" + void ege::Camera::Update(void) { // Note the view axes of the basic camera is (0,0,-1) diff --git a/ege/CollisionShapeCreator.cpp b/ege/CollisionShapeCreator.cpp index 35c8733..18878e5 100644 --- a/ege/CollisionShapeCreator.cpp +++ b/ege/CollisionShapeCreator.cpp @@ -24,6 +24,9 @@ // Documentetion of bullet library : // http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes +#undef __class__ +#define __class__ "CollisionShapeCreator" + btCollisionShape* ege::collision::CreateShape(const ewol::Mesh* _mesh) { if (NULL == _mesh) { diff --git a/ege/Environement.cpp b/ege/Environement.cpp index b4d59f4..ff634a0 100644 --- a/ege/Environement.cpp +++ b/ege/Environement.cpp @@ -11,6 +11,8 @@ #include +#undef __class__ +#define __class__ "Environement" ege::ElementGame* ege::Environement::GetElementNearest(ege::ElementGame* _sourceRequest, float& _distance) diff --git a/ege/Particule.cpp b/ege/Particule.cpp index 2a33adb..88ec130 100644 --- a/ege/Particule.cpp +++ b/ege/Particule.cpp @@ -9,8 +9,12 @@ #include #include -ege::Particule::Particule(ege::ParticuleEngine& _particuleEngine) : - m_particuleEngine(_particuleEngine) +#undef __class__ +#define __class__ "Particule" + +ege::Particule::Particule(ege::ParticuleEngine& _particuleEngine, const char* _particuleType) : + m_particuleEngine(_particuleEngine), + m_particuleType(_particuleType) { m_particuleEngine.Add(this); } diff --git a/ege/Particule.h b/ege/Particule.h index 3d8b41d..181037f 100644 --- a/ege/Particule.h +++ b/ege/Particule.h @@ -27,6 +27,7 @@ namespace ege { { private: ege::ParticuleEngine& m_particuleEngine; + const char* m_particuleType; public: /** * @brief Constructor. diff --git a/ege/ParticuleEngine.cpp b/ege/ParticuleEngine.cpp index 17c837f..9209d12 100644 --- a/ege/ParticuleEngine.cpp +++ b/ege/ParticuleEngine.cpp @@ -9,6 +9,9 @@ #include #include +#undef __class__ +#define __class__ "ParticuleEngine" + ege::ParticuleEngine::ParticuleEngine(ege::Environement& _env) : m_env(_env) { @@ -20,7 +23,7 @@ ege::ParticuleEngine::~ParticuleEngine(void) } -void ege::ParticuleEngine::Add(Particule* _particule, const char* _particuleType) +void ege::ParticuleEngine::Add(Particule* _particule) { if (_particule==NULL) { EGE_ERROR("Try to add particule NULL"); @@ -34,7 +37,7 @@ void ege::ParticuleEngine::Add(Particule* _particule, const char* _particuleType return; } // Just add it at the end ... - m_particuleList.PushBack(); + m_particuleList.PushBack(_particule); } void ege::ParticuleEngine::Update(float _deltaTime) diff --git a/ege/ParticuleEngine.h b/ege/ParticuleEngine.h index 908390a..1491ff8 100644 --- a/ege/ParticuleEngine.h +++ b/ege/ParticuleEngine.h @@ -31,7 +31,7 @@ namespace ege { etk::Vector m_particuleList; public: void Clear(void); - void Add(Particule* _particule, const char* _particuleType); + void Add(Particule* _particule); void Update(float _deltaTime); void Draw(void); }; diff --git a/ege/ParticuleSimple.cpp b/ege/ParticuleSimple.cpp index 00aed40..26f5cfb 100644 --- a/ege/ParticuleSimple.cpp +++ b/ege/ParticuleSimple.cpp @@ -10,6 +10,8 @@ #include +#undef __class__ +#define __class__ "ParticuleSimple" ege::ParticuleSimple::ParticuleSimple(ege::ParticuleEngine& _particuleEngine, const char* _particuleType) : Particule(_particuleEngine, _particuleType) diff --git a/ege/ParticuleSimple.h b/ege/ParticuleSimple.h index bdc744d..99a8d8b 100644 --- a/ege/ParticuleSimple.h +++ b/ege/ParticuleSimple.h @@ -45,12 +45,13 @@ namespace ege { //virtual void Draw(void) { }; virtual bool NeedRemove(void); virtual void Init(void); - private: + protected: float m_life; float m_level; vec3 m_pos; vec4 m_angle; vec3 m_speed; + public: /** * */ diff --git a/ege/Scene.cpp b/ege/Scene.cpp index c3b21fe..1ab5e0c 100644 --- a/ege/Scene.cpp +++ b/ege/Scene.cpp @@ -228,6 +228,7 @@ void ege::Scene::OnDraw(void) } #endif } + m_env.GetParticuleEngine().Draw(); #ifdef SCENE_DISPLAY_SPEED float localTime = (float)(ewol::GetTime() - g_startTime) / 1000.0f; if (localTime>1) { @@ -280,6 +281,7 @@ void ege::Scene::PeriodicCall(const ewol::EventTime& _event) //optional but useful: debug drawing m_dynamicsWorld->debugDrawWorld(); } + m_env.GetParticuleEngine().Update(curentDelta); // Remove all element that requested it ... { int32_t numberEnnemyKilled=0;