[DEV] continue to integrate a component architecture
This commit is contained in:
parent
36d869e636
commit
4ed894376d
@ -1,9 +0,0 @@
|
|||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ege/debug.hpp>
|
|
||||||
#include <ege/AudioElement.hpp>
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace ege {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ege/debug.hpp>
|
|
||||||
#include <ege/AudioEngine.hpp>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace ege {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
#include <ege/physicsShape/PhysicsCylinder.hpp>
|
#include <ege/physicsShape/PhysicsCylinder.hpp>
|
||||||
#include <ege/physicsShape/PhysicsSphere.hpp>
|
#include <ege/physicsShape/PhysicsSphere.hpp>
|
||||||
|
|
||||||
// Documentetion of bullet library :
|
// Documentetion of bullet library:
|
||||||
// http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes
|
// http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes
|
||||||
/*
|
/*
|
||||||
btCollisionShape* ege::collision::createShape(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
|
btCollisionShape* ege::collision::createShape(const ememory::SharedPtr<ege::resource::Mesh>& _mesh) {
|
||||||
|
33
ege/Engine.cpp
Normal file
33
ege/Engine.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
#include <ege/Engine.hpp>
|
||||||
|
#include <ege/Environement.hpp>
|
||||||
|
|
||||||
|
ege::Engine::Engine(ege::Environement* _env) :
|
||||||
|
m_env(_env) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& ege::Engine::getType() const {
|
||||||
|
static std::string tmp("engine");
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::Engine::componentRemove(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::Engine::update(const echrono::Duration& _delta) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::Engine::render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) {
|
||||||
|
|
||||||
|
}
|
53
ege/Engine.hpp
Normal file
53
ege/Engine.hpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2017, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <etk/types.hpp>
|
||||||
|
#include <ememory/memory.hpp>
|
||||||
|
|
||||||
|
#include <ege/Component.hpp>
|
||||||
|
#include <echrono/Duration.hpp>
|
||||||
|
#include <ege/camera/Camera.hpp>
|
||||||
|
|
||||||
|
namespace ege {
|
||||||
|
class Environement;
|
||||||
|
class Camera;
|
||||||
|
class Engine : public ememory::EnableSharedFromThis<Engine> {
|
||||||
|
protected:
|
||||||
|
ege::Environement* m_env;
|
||||||
|
public:
|
||||||
|
Engine(ege::Environement* _env);
|
||||||
|
virtual ~Engine() = default;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief get the type of the engine
|
||||||
|
* @return the type in string
|
||||||
|
*/
|
||||||
|
virtual const std::string& getType() const;
|
||||||
|
/**
|
||||||
|
* @brief An ege::Element component has been removed ==> need remove it in local if needed
|
||||||
|
* @param[in] _ref Referrence on the component
|
||||||
|
*/
|
||||||
|
virtual void componentRemove(const ememory::SharedPtr<ege::Component>& _ref);
|
||||||
|
/**
|
||||||
|
* @brief An ege::Element component has been added ==> need add it in local if needed
|
||||||
|
* @param[in] _ref Referrence on the component
|
||||||
|
*/
|
||||||
|
virtual void componentAdd(const ememory::SharedPtr<ege::Component>& _ref);
|
||||||
|
/**
|
||||||
|
* @brief Global game engine main cycle of update internal parameters
|
||||||
|
* @param[in] _delta time from the last update
|
||||||
|
*/
|
||||||
|
virtual void update(const echrono::Duration& _delta);
|
||||||
|
/**
|
||||||
|
* @brief Globalgame engine main cycle of draw
|
||||||
|
* @param[in] _delta time from the last render
|
||||||
|
* @param[in] _camera Camera property to render the engine properties ...
|
||||||
|
*/
|
||||||
|
virtual void render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -9,9 +9,100 @@
|
|||||||
#include <ege/elements/Element.hpp>
|
#include <ege/elements/Element.hpp>
|
||||||
#include <ewol/object/Manager.hpp>
|
#include <ewol/object/Manager.hpp>
|
||||||
|
|
||||||
|
#include <ege/particule/Engine.hpp>
|
||||||
|
#include <ege/render/Engine.hpp>
|
||||||
|
#include <ege/ia/Engine.hpp>
|
||||||
|
#include <ege/physics/Engine.hpp>
|
||||||
|
|
||||||
#include <gale/renderer/openGL/openGL.hpp>
|
#include <gale/renderer/openGL/openGL.hpp>
|
||||||
#include <etk/math/Matrix4x4.hpp>
|
#include <etk/math/Matrix4x4.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
void ege::Environement::addEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
|
||||||
|
if (_ref == nullptr) {
|
||||||
|
EGE_ERROR("try to add an empty Engine");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// check if not exist
|
||||||
|
for (auto &it: m_engine) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (it->getType() == _ref->getType()) {
|
||||||
|
it = _ref;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// try to add in an empty slot
|
||||||
|
for (auto &it: m_engine) {
|
||||||
|
if (it != nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
it = _ref;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// add it at the end ...
|
||||||
|
m_engine.push_back(_ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::Environement::rmEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
|
||||||
|
if (_ref == nullptr) {
|
||||||
|
EGE_ERROR("try to remove an empty engine");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// check if not exist
|
||||||
|
for (auto &it: m_engine) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (it == _ref) {
|
||||||
|
it = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EGE_ERROR("try to remove an unexisting engine");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::Environement::rmEngine(const std::string& _type) {
|
||||||
|
// check if not exist
|
||||||
|
for (auto &it: m_engine) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (it->getType() == _type) {
|
||||||
|
it = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EGE_ERROR("try to remove an unexisting engine type : '" << _type << "'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ege::Environement::engineComponentRemove(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
for (auto &it: m_engine) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (it->getType() == _ref->getType()) {
|
||||||
|
it->componentRemove(_ref);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void ege::Environement::engineComponentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
for (auto &it: m_engine) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (it->getType() == _ref->getType()) {
|
||||||
|
it->componentAdd(_ref);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ememory::SharedPtr<ege::Element> ege::Environement::getElementNearest(ememory::SharedPtr<ege::Element> _sourceRequest, float& _distance) {
|
ememory::SharedPtr<ege::Element> ege::Environement::getElementNearest(ememory::SharedPtr<ege::Element> _sourceRequest, float& _distance) {
|
||||||
if (_sourceRequest == nullptr) {
|
if (_sourceRequest == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -32,7 +123,7 @@ ememory::SharedPtr<ege::Element> ege::Environement::getElementNearest(ememory::S
|
|||||||
}
|
}
|
||||||
// check distance ...
|
// check distance ...
|
||||||
vec3 destPosition = m_listElement[iii]->getPosition();
|
vec3 destPosition = m_listElement[iii]->getPosition();
|
||||||
float distance = btDistance(sourcePosition, destPosition);
|
float distance = (sourcePosition - destPosition).length();
|
||||||
//EGE_DEBUG("Distance : " << _distance << " >? " << distance << " id=" << iii);
|
//EGE_DEBUG("Distance : " << _distance << " >? " << distance << " id=" << iii);
|
||||||
if (_distance>distance) {
|
if (_distance>distance) {
|
||||||
_distance = distance;
|
_distance = distance;
|
||||||
@ -61,7 +152,7 @@ void ege::Environement::getElementNearest(const vec3& _sourcePosition,
|
|||||||
if (_sourcePosition == destPosition) {
|
if (_sourcePosition == destPosition) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.dist = btDistance(_sourcePosition, destPosition);
|
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.push_back(result);
|
||||||
@ -87,7 +178,7 @@ void ege::Environement::getElementNearestFixed(const vec3& _sourcePosition,
|
|||||||
}
|
}
|
||||||
// check distance ...
|
// check distance ...
|
||||||
vec3 destPosition = result.element->getPositionTheoric();
|
vec3 destPosition = result.element->getPositionTheoric();
|
||||||
result.dist = btDistance(_sourcePosition, destPosition);
|
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) {
|
||||||
continue;
|
continue;
|
||||||
@ -285,7 +376,7 @@ void ege::Environement::rmElement(ememory::SharedPtr<ege::Element> _removeElemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : DEPRECATED ==> special function of the renderer ...
|
||||||
void ege::Environement::getOrderedElementForDisplay(std::vector<ege::Environement::ResultNearestElement>& _resultList,
|
void ege::Environement::getOrderedElementForDisplay(std::vector<ege::Environement::ResultNearestElement>& _resultList,
|
||||||
const vec3& _position,
|
const vec3& _position,
|
||||||
const vec3& _direction) {
|
const vec3& _direction) {
|
||||||
@ -316,7 +407,7 @@ void ege::Environement::getOrderedElementForDisplay(std::vector<ege::Environemen
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
result.dist = btDistance(_position, destPosition);
|
result.dist = (_position - destPosition).length();
|
||||||
/*
|
/*
|
||||||
if (result.dist>500.0f) {
|
if (result.dist>500.0f) {
|
||||||
// The element is realy too far ... == > no need to display
|
// The element is realy too far ... == > no need to display
|
||||||
@ -348,7 +439,7 @@ void ege::Environement::generateInteraction(ege::ElementInteraction& _event) {
|
|||||||
_event.applyEvent(*m_listElement[iii]);
|
_event.applyEvent(*m_listElement[iii]);
|
||||||
/*
|
/*
|
||||||
vec3 destPosition = m_listElement[iii]->getPosition();
|
vec3 destPosition = m_listElement[iii]->getPosition();
|
||||||
float dist = btDistance(sourcePosition, destPosition);
|
float dist = (sourcePosition - destPosition).length;
|
||||||
if (dist == 0 || dist>decreasePower) {
|
if (dist == 0 || dist>decreasePower) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -367,12 +458,16 @@ ege::Environement::Environement() :
|
|||||||
propertyRatio(this, "ratio",
|
propertyRatio(this, "ratio",
|
||||||
1.0f,
|
1.0f,
|
||||||
"game speed ratio"),
|
"game speed ratio"),
|
||||||
m_listElement(),
|
m_listElement() {
|
||||||
m_particuleEngine(this) {
|
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
propertyStatus.add(gameStart, "start", "Scene is started");
|
propertyStatus.add(gameStart, "start", "Scene is started");
|
||||||
propertyStatus.add(gamePause, "pause", "Scene is paused");
|
propertyStatus.add(gamePause, "pause", "Scene is paused");
|
||||||
propertyStatus.add(gameStop, "stop", "Scene is stopped");
|
propertyStatus.add(gameStop, "stop", "Scene is stopped");
|
||||||
|
// we add the 4 classical engines (the order is used to the global rendering cycle ...
|
||||||
|
addEngine(ememory::makeShared<ege::physics::Engine>(this));
|
||||||
|
addEngine(ememory::makeShared<ege::ia::Engine>(this));
|
||||||
|
addEngine(ememory::makeShared<ege::render::Engine>(this));
|
||||||
|
addEngine(ememory::makeShared<ege::particule::Engine>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ege::Environement::clear() {
|
void ege::Environement::clear() {
|
||||||
@ -380,6 +475,22 @@ void ege::Environement::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ege::Environement::render(const echrono::Duration& _delta, const std::string& _camera) {
|
||||||
|
// get the correct camera:
|
||||||
|
ememory::SharedPtr<ege::Camera> camera = getCamera(_camera);
|
||||||
|
if (camera == nullptr) {
|
||||||
|
EGE_ERROR("Render: Can not get camera named: '" << _camera << "'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (auto &it: m_engine) {
|
||||||
|
if(it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EGE_INFO(" render: " << it->getType());
|
||||||
|
it->render(_delta, camera);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event) {
|
void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event) {
|
||||||
float curentDelta = _event.getDeltaCall();
|
float curentDelta = _event.getDeltaCall();
|
||||||
EGE_INFO("periodic call : " << _event);
|
EGE_INFO("periodic call : " << _event);
|
||||||
@ -406,15 +517,24 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event)
|
|||||||
it.second->periodicCall(curentDelta);
|
it.second->periodicCall(curentDelta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EGE_INFO(" step simulation : " << curentDelta);
|
||||||
|
for (auto &it: m_engine) {
|
||||||
|
if(it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EGE_INFO(" update: " << it->getType());
|
||||||
|
it->update(echrono::Duration(double(curentDelta)));
|
||||||
|
}
|
||||||
|
|
||||||
//EGE_DEBUG("stepSimulation (start)");
|
//EGE_DEBUG("stepSimulation (start)");
|
||||||
///step the simulation
|
///step the simulation
|
||||||
EGE_INFO(" step simulation : " << curentDelta);
|
// TODO : m_physicEngine.update(curentDelta);
|
||||||
m_physicEngine.update(curentDelta);
|
// TODO : //optional but useful: debug drawing
|
||||||
//optional but useful: debug drawing
|
// TODO : m_physicEngine.debugDrawWorld();
|
||||||
m_physicEngine.debugDrawWorld();
|
// TODO : EGE_INFO(" Update particule engine");
|
||||||
EGE_INFO(" Update particule engine");
|
// TODO : m_particuleEngine.update(curentDelta);
|
||||||
m_particuleEngine.update(curentDelta);
|
|
||||||
// remove all element that requested it ...
|
// remove all element that requested it ...
|
||||||
|
/**
|
||||||
{
|
{
|
||||||
int32_t numberEnnemyKilled=0;
|
int32_t numberEnnemyKilled=0;
|
||||||
int32_t victoryPoint=0;
|
int32_t victoryPoint=0;
|
||||||
@ -440,6 +560,7 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event)
|
|||||||
//signalKillEnemy.emit(numberEnnemyKilled);
|
//signalKillEnemy.emit(numberEnnemyKilled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,9 +10,10 @@ namespace ege {
|
|||||||
class ElementInteraction;
|
class ElementInteraction;
|
||||||
};
|
};
|
||||||
#include <ege/camera/Camera.hpp>
|
#include <ege/camera/Camera.hpp>
|
||||||
#include <ege/particule/Engine.hpp>
|
|
||||||
#include <ege/render/Engine.hpp>
|
#include <ege/Engine.hpp>
|
||||||
#include <ege/ia/Engine.hpp>
|
|
||||||
|
|
||||||
#include <etk/types.hpp>
|
#include <etk/types.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <etk/math/Vector3D.hpp>
|
#include <etk/math/Vector3D.hpp>
|
||||||
@ -23,7 +24,6 @@ namespace ege {
|
|||||||
#include <ewol/event/Time.hpp>
|
#include <ewol/event/Time.hpp>
|
||||||
#include <eproperty/Value.hpp>
|
#include <eproperty/Value.hpp>
|
||||||
#include <ege/resource/Mesh.hpp>
|
#include <ege/resource/Mesh.hpp>
|
||||||
#include <ege/physics/Engine.hpp>
|
|
||||||
|
|
||||||
namespace ege {
|
namespace ege {
|
||||||
class Element;
|
class Element;
|
||||||
@ -73,7 +73,7 @@ namespace ege {
|
|||||||
public:
|
public:
|
||||||
virtual void applyEvent(ege::Element& _element) { };
|
virtual void applyEvent(ege::Element& _element) { };
|
||||||
};
|
};
|
||||||
|
// TODO : An element must be created by a local factory...
|
||||||
class Environement : public ewol::Object {
|
class Environement : public ewol::Object {
|
||||||
public:
|
public:
|
||||||
// Signals
|
// Signals
|
||||||
@ -81,30 +81,14 @@ namespace ege {
|
|||||||
// properties:
|
// properties:
|
||||||
eproperty::List<enum gameStatus> propertyStatus; //!< the display is running (not in pause)
|
eproperty::List<enum gameStatus> propertyStatus; //!< the display is running (not in pause)
|
||||||
eproperty::Value<float> propertyRatio; //!< Speed ratio
|
eproperty::Value<float> propertyRatio; //!< Speed ratio
|
||||||
private:
|
protected:
|
||||||
ege::physics::Engine m_physicEngine; //!< EGE physic engine interface.
|
std::vector<ememory::SharedPtr<ege::Engine>> m_engine; //!< EGE sub engine interface (like physique, rendering, audio, ...).
|
||||||
public:
|
public:
|
||||||
ege::physics::Engine& getPhysicEngine() {
|
void addEngine(const ememory::SharedPtr<ege::Engine>& _ref);
|
||||||
return m_physicEngine;
|
void rmEngine(const ememory::SharedPtr<ege::Engine>& _ref);
|
||||||
}
|
void rmEngine(const std::string& _type);
|
||||||
private:
|
void engineComponentRemove(const ememory::SharedPtr<ege::Component>& _ref);
|
||||||
ege::render::Engine m_renderEngine; //!< EGE rendering engine interface.
|
void engineComponentAdd(const ememory::SharedPtr<ege::Component>& _ref);
|
||||||
public:
|
|
||||||
ege::render::Engine& getRenderEngine() {
|
|
||||||
return m_renderEngine;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
ege::particule::Engine m_particuleEngine; //!< EGE particule engine interface.
|
|
||||||
public:
|
|
||||||
ege::particule::Engine& getParticuleEngine() {
|
|
||||||
return m_particuleEngine;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
ege::ia::Engine m_iaEngine; //!< EGE Artificial inteligence engine interface.
|
|
||||||
public:
|
|
||||||
ege::ia::Engine& getIAEngine() {
|
|
||||||
return m_iaEngine;
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
std::vector<ememory::SharedPtr<ege::Element>> m_listElement; //!< List of all element added in the Game
|
std::vector<ememory::SharedPtr<ege::Element>> m_listElement; //!< List of all element added in the Game
|
||||||
protected:
|
protected:
|
||||||
@ -112,7 +96,8 @@ namespace ege {
|
|||||||
public:
|
public:
|
||||||
DECLARE_FACTORY(Environement);
|
DECLARE_FACTORY(Environement);
|
||||||
virtual ~Environement() { };
|
virtual ~Environement() { };
|
||||||
protected:
|
public:
|
||||||
|
void render(const echrono::Duration& _delta, const std::string& _camera);
|
||||||
protected:
|
protected:
|
||||||
std::map<std::string, ememory::SharedPtr<ege::Camera>> m_listCamera; //!< list of all camera in the world
|
std::map<std::string, ememory::SharedPtr<ege::Camera>> m_listCamera; //!< list of all camera in the world
|
||||||
public:
|
public:
|
||||||
|
49
ege/Game.hpp
49
ege/Game.hpp
@ -1,49 +0,0 @@
|
|||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <etk/types.hpp>
|
|
||||||
#include <etk/math/Vector3D.hpp>
|
|
||||||
#include <etk/math/Matrix4.hpp>
|
|
||||||
#include <vector>
|
|
||||||
#include <ewol/debug.hpp>
|
|
||||||
#include <ege/Camera.hpp>
|
|
||||||
#include <ewol/widget/Widget.hpp>
|
|
||||||
#include <ewol/openGL/openGL.hpp>
|
|
||||||
#include <ewol/resource/Manager.hpp>
|
|
||||||
#include <ege/ElementGame.hpp>
|
|
||||||
#include <ewol/Dimension.hpp>
|
|
||||||
|
|
||||||
class btBroadphaseInterface;
|
|
||||||
class btCollisionShape;
|
|
||||||
class btOverlappingPairCache;
|
|
||||||
class btCollisionDispatcher;
|
|
||||||
class btConstraintSolver;
|
|
||||||
struct btCollisionAlgorithmCreateFunc;
|
|
||||||
class btDefaultCollisionConfiguration;
|
|
||||||
class btDynamicsWorld;
|
|
||||||
#include <LinearMath/btScalar.h>
|
|
||||||
class btVector3;
|
|
||||||
#include <ewol/widget/Widget.hpp>
|
|
||||||
|
|
||||||
namespace ege {
|
|
||||||
enum gameStatus {
|
|
||||||
gameStart,
|
|
||||||
gamePause,
|
|
||||||
gameStop
|
|
||||||
};
|
|
||||||
class Game : public ewol::Object {
|
|
||||||
protected:
|
|
||||||
Game();
|
|
||||||
void init();
|
|
||||||
public:
|
|
||||||
~Game()
|
|
||||||
protected:
|
|
||||||
ege::PhysicEngine m_physicEngine; //!< physic engine interface
|
|
||||||
ege::AudioEngine m_AudioEngine; //!< physic engine interface
|
|
||||||
ege::IAEngine m_iAEngine; //!< physic engine interface
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,6 +7,7 @@
|
|||||||
#include <ege/Ray.hpp>
|
#include <ege/Ray.hpp>
|
||||||
#include <ege/debug.hpp>
|
#include <ege/debug.hpp>
|
||||||
#include <ege/elements/Element.hpp>
|
#include <ege/elements/Element.hpp>
|
||||||
|
#include <etk/math/Vector3D.hpp>
|
||||||
|
|
||||||
|
|
||||||
ege::Ray::Ray(const vec3& _origin, const vec3& _direction) :
|
ege::Ray::Ray(const vec3& _origin, const vec3& _direction) :
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <ege/camera/Camera.hpp>
|
#include <ege/camera/Camera.hpp>
|
||||||
#include <ege/debug.hpp>
|
#include <ege/debug.hpp>
|
||||||
|
#include <ege/Ray.hpp>
|
||||||
|
|
||||||
#include <gale/renderer/openGL/openGL.hpp>
|
#include <gale/renderer/openGL/openGL.hpp>
|
||||||
|
|
||||||
|
@ -10,11 +10,12 @@
|
|||||||
#include <etk/math/Vector3D.hpp>
|
#include <etk/math/Vector3D.hpp>
|
||||||
#include <etk/math/Vector2D.hpp>
|
#include <etk/math/Vector2D.hpp>
|
||||||
#include <etk/math/Matrix4x4.hpp>
|
#include <etk/math/Matrix4x4.hpp>
|
||||||
#include <ege/Ray.hpp>
|
//#include <ege/Ray.hpp>
|
||||||
#include <ewol/resource/Colored3DObject.hpp>
|
#include <ewol/resource/Colored3DObject.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace ege {
|
namespace ege {
|
||||||
|
class Ray;
|
||||||
class Camera : public ememory::EnableSharedFromThis<Camera>{
|
class Camera : public ememory::EnableSharedFromThis<Camera>{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <ege/camera/View.hpp>
|
#include <ege/camera/View.hpp>
|
||||||
#include <ege/debug.hpp>
|
#include <ege/debug.hpp>
|
||||||
#include <etk/math/Vector3D.hpp>
|
#include <etk/math/Vector3D.hpp>
|
||||||
|
#include <ege/Ray.hpp>
|
||||||
|
|
||||||
void ege::camera::View::update() {
|
void ege::camera::View::update() {
|
||||||
//m_matrix = etk::matLookAt(m_eye, m_target, m_up);
|
//m_matrix = etk::matLookAt(m_eye, m_target, m_up);
|
||||||
|
@ -19,11 +19,6 @@ const std::string& ege::Element::getType() const {
|
|||||||
|
|
||||||
ege::Element::Element(const ememory::SharedPtr<ege::Environement>& _env) :
|
ege::Element::Element(const ememory::SharedPtr<ege::Environement>& _env) :
|
||||||
m_env(_env),
|
m_env(_env),
|
||||||
m_idRender(-1),
|
|
||||||
m_idIA(-1),
|
|
||||||
m_idParticule(-1),
|
|
||||||
m_idPhysics(-1),
|
|
||||||
m_idPosition(-1),
|
|
||||||
m_uID(0),
|
m_uID(0),
|
||||||
m_mesh(),
|
m_mesh(),
|
||||||
m_life(100),
|
m_life(100),
|
||||||
@ -77,18 +72,6 @@ void ege::Element::addComponent(const ememory::SharedPtr<ege::Component>& _ref)
|
|||||||
findId = m_component.size();
|
findId = m_component.size();
|
||||||
m_component.push_back(_ref);
|
m_component.push_back(_ref);
|
||||||
}
|
}
|
||||||
if (_ref->getType() == "IA") {
|
|
||||||
m_idIA = findId;
|
|
||||||
m_env->getIAEngine().remove(_ref);
|
|
||||||
} else if (_ref->getType() == "render") {
|
|
||||||
m_idRender = findId;
|
|
||||||
} else if (_ref->getType() == "particule") {
|
|
||||||
m_idParticule = findId;
|
|
||||||
} else if (_ref->getType() == "physics") {
|
|
||||||
m_idPhysics = findId;
|
|
||||||
} else if (_ref->getType() == "position") {
|
|
||||||
m_idPosition = findId;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<m_component.size(); ++iii) {
|
for (int32_t iii=0; iii<m_component.size(); ++iii) {
|
||||||
if (m_component[iii] == nullptr) {
|
if (m_component[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
@ -123,18 +106,6 @@ void ege::Element::rmComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
|||||||
EGE_ERROR("try to remove an unexisting component");
|
EGE_ERROR("try to remove an unexisting component");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_ref->getType() == "IA") {
|
|
||||||
m_idIA = -1;
|
|
||||||
} else if (_ref->getType() == "render") {
|
|
||||||
m_idRender = -1;
|
|
||||||
} else if (_ref->getType() == "particule") {
|
|
||||||
m_idParticule = -1;
|
|
||||||
} else if (_ref->getType() == "physics") {
|
|
||||||
m_idPhysics = -1;
|
|
||||||
} else if (_ref->getType() == "position") {
|
|
||||||
m_idPosition = -1;
|
|
||||||
//m_env->getPositionEngine().remove(componentRemoved);
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<m_component.size(); ++iii) {
|
for (int32_t iii=0; iii<m_component.size(); ++iii) {
|
||||||
if (m_component[iii] == nullptr) {
|
if (m_component[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
@ -163,17 +134,6 @@ void ege::Element::rmComponent(const std::string& _type) {
|
|||||||
EGE_ERROR("try to remove an unexisting component type : '" << _type << "'");
|
EGE_ERROR("try to remove an unexisting component type : '" << _type << "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_type == "IA") {
|
|
||||||
m_idIA = -1;
|
|
||||||
} else if (_type == "render") {
|
|
||||||
m_idRender = -1;
|
|
||||||
} else if (_type == "particule") {
|
|
||||||
m_idParticule = -1;
|
|
||||||
} else if (_type == "physics") {
|
|
||||||
m_idPhysics = -1;
|
|
||||||
} else if (_type == "position") {
|
|
||||||
m_idPosition = -1;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<m_component.size(); ++iii) {
|
for (int32_t iii=0; iii<m_component.size(); ++iii) {
|
||||||
if (m_component[iii] == nullptr) {
|
if (m_component[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -42,15 +42,6 @@ namespace ege {
|
|||||||
virtual ~Element();
|
virtual ~Element();
|
||||||
protected:
|
protected:
|
||||||
std::vector<ememory::SharedPtr<ege::Component>> m_component;
|
std::vector<ememory::SharedPtr<ege::Component>> m_component;
|
||||||
int32_t m_idRender; //!< fast reference on the Render component (can static cast and not dynamic cast)
|
|
||||||
int32_t m_idIA; //!< fast reference on the IA component.
|
|
||||||
int32_t m_idParticule; //!< fast reference on the Particule component.
|
|
||||||
int32_t m_idPhysics; //!< fast reference on the Physics component.
|
|
||||||
int32_t m_idPosition; //!< fast reference on the position component ==> incompatible with 'physics' component.
|
|
||||||
// int32_t m_idCamera; //!< fast reference on the camera component.
|
|
||||||
// int32_t m_idSound; //!< fast reference on the Sound component.
|
|
||||||
// int32_t m_idLife; //!< fast reference on the Life component.
|
|
||||||
// ... and evry thing the user want to add ... to create a good game ...
|
|
||||||
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);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <ewol/compositing/Text.hpp>
|
#include <ewol/compositing/Text.hpp>
|
||||||
#include <ege/Environement.hpp>
|
#include <ege/Environement.hpp>
|
||||||
#include <ege/elements/Element.hpp>
|
#include <ege/elements/Element.hpp>
|
||||||
|
#include <ephysics/reactphysics3d.h>
|
||||||
|
|
||||||
|
|
||||||
#define INDEX_RIGHT_AXIS (0)
|
#define INDEX_RIGHT_AXIS (0)
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
#include <ege/ia/Engine.hpp>
|
||||||
|
|
||||||
|
ege::ia::Engine::Engine(ege::Environement* _env) :
|
||||||
|
ege::Engine(_env) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& ege::ia::Engine::getType() const {
|
||||||
|
static std::string tmp("ia");
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::ia::Engine::componentRemove(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::ia::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <ege/Engine.hpp>
|
||||||
#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>
|
||||||
@ -14,13 +14,17 @@
|
|||||||
|
|
||||||
namespace ege {
|
namespace ege {
|
||||||
namespace ia {
|
namespace ia {
|
||||||
class Engine {
|
class Engine : public ege::Engine {
|
||||||
public:
|
public:
|
||||||
Engine() {}
|
Engine(ege::Environement* _env);
|
||||||
~Engine() {}
|
~Engine() {}
|
||||||
|
|
||||||
// update cycle
|
// update cycle
|
||||||
void update(float _delta) {}
|
void update(float _delta) {}
|
||||||
|
public:
|
||||||
|
const std::string& getType() const override;
|
||||||
|
void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override;
|
||||||
|
void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <ege/particule/Particule.hpp>
|
#include <ege/particule/Particule.hpp>
|
||||||
|
|
||||||
ege::particule::Engine::Engine(ege::Environement* _env) :
|
ege::particule::Engine::Engine(ege::Environement* _env) :
|
||||||
m_env(_env) {
|
ege::Engine(_env) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,6 +18,21 @@ ege::particule::Engine::~Engine() {
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& ege::particule::Engine::getType() const {
|
||||||
|
static std::string tmp("particule");
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::particule::Engine::componentRemove(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::particule::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ege::particule::Engine::add(const ememory::SharedPtr<ege::particule::Component>& _particule) {
|
void ege::particule::Engine::add(const ememory::SharedPtr<ege::particule::Component>& _particule) {
|
||||||
if (_particule == nullptr) {
|
if (_particule == nullptr) {
|
||||||
EGE_ERROR("Try to add particule nullptr");
|
EGE_ERROR("Try to add particule nullptr");
|
||||||
@ -68,16 +83,17 @@ ememory::SharedPtr<ege::particule::Component> ege::particule::Engine::respown(co
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ege::particule::Engine::update(float _deltaTime) {
|
void ege::particule::Engine::update(const echrono::Duration& _delta) {
|
||||||
if (_deltaTime>(1.0f/60.0f)) {
|
float deltaTime = _delta.toSeconds();
|
||||||
_deltaTime = (1.0f/60.0f);
|
if (deltaTime>(1.0f/60.0f)) {
|
||||||
|
deltaTime = (1.0f/60.0f);
|
||||||
}
|
}
|
||||||
EGE_WARNING("Update the Particule engine ... " << _deltaTime);
|
EGE_WARNING("Update the Particule engine ... " << deltaTime);
|
||||||
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||||
if (m_particuleList[iii] == nullptr) {
|
if (m_particuleList[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_particuleList[iii]->update(_deltaTime);
|
m_particuleList[iii]->update(deltaTime);
|
||||||
}
|
}
|
||||||
// check removing elements
|
// check removing elements
|
||||||
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||||
@ -107,12 +123,12 @@ void ege::particule::Engine::update(float _deltaTime) {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ege::particule::Engine::draw(const ege::Camera& _camera) {
|
void ege::particule::Engine::render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) {
|
||||||
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||||
if (m_particuleList[iii] == nullptr) {
|
if (m_particuleList[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_particuleList[iii]->draw(_camera);
|
m_particuleList[iii]->draw(*_camera);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,19 +4,16 @@
|
|||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <ege/Engine.hpp>
|
||||||
#include <etk/types.hpp>
|
#include <etk/types.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ege/camera/Camera.hpp>
|
|
||||||
#include <ege/particule/Component.hpp>
|
#include <ege/particule/Component.hpp>
|
||||||
|
|
||||||
namespace ege {
|
namespace ege {
|
||||||
class Environement;
|
class Environement;
|
||||||
namespace particule {
|
namespace particule {
|
||||||
class Component;
|
class Component;
|
||||||
class Engine {
|
class Engine : public ege::Engine {
|
||||||
private:
|
|
||||||
ege::Environement* m_env;
|
|
||||||
public:
|
public:
|
||||||
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();
|
||||||
@ -40,16 +37,6 @@ namespace ege {
|
|||||||
*/
|
*/
|
||||||
void addRemoved(const ememory::SharedPtr<ege::particule::Component>& _particule);
|
void addRemoved(const ememory::SharedPtr<ege::particule::Component>& _particule);
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @brief update particule properties
|
|
||||||
* @param[in] _deltaTime delta time to process
|
|
||||||
*/
|
|
||||||
void update(float _deltaTime);
|
|
||||||
/**
|
|
||||||
* @brief draw all the active Particule
|
|
||||||
* @param[in] _camera Reference on the current camera
|
|
||||||
*/
|
|
||||||
void draw(const ege::Camera& _camera);
|
|
||||||
/**
|
/**
|
||||||
* @brief get a particue with his type, we get particule that has been already removed, otherwise, you will create new
|
* @brief get a particue with his type, we get particule that has been already removed, otherwise, you will create new
|
||||||
* @param[in] _particuleType Particule type, this chek only the pointer not the data.
|
* @param[in] _particuleType Particule type, this chek only the pointer not the data.
|
||||||
@ -59,6 +46,12 @@ namespace ege {
|
|||||||
*/
|
*/
|
||||||
ememory::SharedPtr<ege::particule::Component> respown(const char* _particuleType);
|
ememory::SharedPtr<ege::particule::Component> respown(const char* _particuleType);
|
||||||
|
|
||||||
|
public:
|
||||||
|
const std::string& getType() const override;
|
||||||
|
void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override;
|
||||||
|
void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override;
|
||||||
|
void update(const echrono::Duration& _delta) override;
|
||||||
|
void render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <ege/elements/Element.hpp>
|
||||||
#include <ege/physics/Engine.hpp>
|
#include <ege/physics/Engine.hpp>
|
||||||
|
|
||||||
#include <ege/debug.hpp>
|
#include <ege/debug.hpp>
|
||||||
@ -13,6 +14,19 @@
|
|||||||
|
|
||||||
#include <ege/elements/ElementPhysic.hpp>
|
#include <ege/elements/ElementPhysic.hpp>
|
||||||
|
|
||||||
|
const std::string& ege::physics::Engine::getType() const {
|
||||||
|
static std::string tmp("physics");
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::physics::Engine::componentRemove(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::physics::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// unique callback function :
|
// unique callback function :
|
||||||
/*
|
/*
|
||||||
@ -38,7 +52,8 @@ static bool handleContactsProcess(btManifoldPoint& _point, btCollisionObject* _b
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ege::physics::Engine::Engine():
|
ege::physics::Engine::Engine(ege::Environement* _env) :
|
||||||
|
ege::Engine(_env),
|
||||||
m_dynamicsWorld(nullptr),
|
m_dynamicsWorld(nullptr),
|
||||||
m_accumulator(0.0f) {
|
m_accumulator(0.0f) {
|
||||||
// Start engine with no gravity
|
// Start engine with no gravity
|
||||||
@ -69,9 +84,10 @@ void ege::physics::Engine::setGravity(const vec3& _axePower) {
|
|||||||
// Constant physics time step
|
// Constant physics time step
|
||||||
const float timeStep = 1.0 / 60.0;
|
const float timeStep = 1.0 / 60.0;
|
||||||
|
|
||||||
void ege::physics::Engine::update(float _delta) {
|
void ege::physics::Engine::update(const echrono::Duration& _delta) {
|
||||||
|
float deltaTime = _delta.toSeconds();
|
||||||
// Add the time difference in the accumulator
|
// Add the time difference in the accumulator
|
||||||
m_accumulator += _delta;
|
m_accumulator += deltaTime;
|
||||||
// While there is enough accumulated time to take one or several physics steps
|
// While there is enough accumulated time to take one or several physics steps
|
||||||
while (m_accumulator >= timeStep) {
|
while (m_accumulator >= timeStep) {
|
||||||
if (m_dynamicsWorld != nullptr) {
|
if (m_dynamicsWorld != nullptr) {
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ege/Engine.hpp>
|
||||||
|
|
||||||
namespace ege {
|
namespace ege {
|
||||||
namespace physics {
|
namespace physics {
|
||||||
class Engine;
|
class Engine;
|
||||||
@ -25,12 +27,12 @@ namespace ege {
|
|||||||
|
|
||||||
namespace ege {
|
namespace ege {
|
||||||
namespace physics {
|
namespace physics {
|
||||||
class Engine {
|
class Engine : public ege::Engine {
|
||||||
private:
|
private:
|
||||||
rp3d::DynamicsWorld* m_dynamicsWorld;
|
rp3d::DynamicsWorld* m_dynamicsWorld;
|
||||||
float m_accumulator; // limit call of the step rendering
|
float m_accumulator; // limit call of the step rendering
|
||||||
public:
|
public:
|
||||||
Engine();
|
Engine(ege::Environement* _env);
|
||||||
~Engine();
|
~Engine();
|
||||||
public:
|
public:
|
||||||
// Define a collision point ==> for debug only ...
|
// Define a collision point ==> for debug only ...
|
||||||
@ -63,12 +65,16 @@ namespace ege {
|
|||||||
* @param[in] _axePower energy of this gravity
|
* @param[in] _axePower energy of this gravity
|
||||||
*/
|
*/
|
||||||
void setGravity(const vec3& _axePower);
|
void setGravity(const vec3& _axePower);
|
||||||
// update cycle
|
|
||||||
void update(float _delta);
|
|
||||||
|
|
||||||
void debugDrawWorld() {
|
void debugDrawWorld() {
|
||||||
// TODO: later ...
|
// TODO: later ...
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
|
const std::string& getType() const override;
|
||||||
|
void componentRemove(const ememory::SharedPtr<ege::Component>& _ref) override;
|
||||||
|
void componentAdd(const ememory::SharedPtr<ege::Component>& _ref) override;
|
||||||
|
void update(const echrono::Duration& _delta) override;
|
||||||
|
//void render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
#include <ege/debug.hpp>
|
#include <ege/debug.hpp>
|
||||||
|
#include <etk/math/Vector3D.hpp>
|
||||||
#include <ege/physicsShape/PhysicsBox.hpp>
|
#include <ege/physicsShape/PhysicsBox.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,6 +56,9 @@ namespace ege {
|
|||||||
return m_mesh;
|
return m_mesh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const etk::Transform3D& getTransform() {
|
||||||
|
return m_transform;
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
const std::string& getType() const override;
|
const std::string& getType() const override;
|
||||||
void addFriendComponent(const ememory::SharedPtr<ege::Component>& _component) override;
|
void addFriendComponent(const ememory::SharedPtr<ege::Component>& _component) override;
|
||||||
|
@ -0,0 +1,158 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
#include <ege/render/Engine.hpp>
|
||||||
|
|
||||||
|
ege::render::Engine::Engine(ege::Environement* _env) :
|
||||||
|
ege::Engine(_env) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& ege::render::Engine::getType() const {
|
||||||
|
static std::string tmp("render");
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::render::Engine::componentRemove(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
ememory::SharedPtr<ege::render::Component> ref = ememory::dynamicPointerCast<ege::render::Component>(_ref);
|
||||||
|
for (auto it=m_component.begin();
|
||||||
|
it != m_component.end();
|
||||||
|
++it) {
|
||||||
|
if (*it == ref) {
|
||||||
|
it->reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ege::render::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||||
|
ememory::SharedPtr<ege::render::Component> ref = ememory::dynamicPointerCast<ege::render::Component>(_ref);
|
||||||
|
for (auto it=m_component.begin();
|
||||||
|
it != m_component.end();
|
||||||
|
++it) {
|
||||||
|
if (*it == nullptr) {
|
||||||
|
*it = ref;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_component.push_back(ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ege::render::Engine::getOrderedElementForDisplay(std::vector<ege::render::Engine::ResultNearestElement>& _resultList,
|
||||||
|
const vec3& _position,
|
||||||
|
const vec3& _direction) {
|
||||||
|
// TODO : Set it back ... corrected...
|
||||||
|
// remove all unneeded elements (old display...)
|
||||||
|
_resultList.clear();
|
||||||
|
// basic element result
|
||||||
|
ege::render::Engine::ResultNearestElement result;
|
||||||
|
result.dist = 99999999999.0f;
|
||||||
|
result.element = nullptr;
|
||||||
|
// for all element in the game we chek if it is needed to display it ...
|
||||||
|
for (auto &it: m_component) {
|
||||||
|
// check nullptr pointer
|
||||||
|
if (it == nullptr) {
|
||||||
|
// no pointer null are set in the output list ...
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result.element = it;
|
||||||
|
// check distance ...
|
||||||
|
vec3 destPosition = result.element->getTransform().getPosition();
|
||||||
|
vec3 angleView = (destPosition - _position);
|
||||||
|
angleView.safeNormalize();
|
||||||
|
float dotResult = angleView.dot(_direction);
|
||||||
|
//EGE_DEBUG("Dot position : " << destPosition << " == > dot=" << dotResult);
|
||||||
|
/*
|
||||||
|
if (dotResult <= 0.85f) {
|
||||||
|
// they are not in the camera angle view ... == > no need to process display
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
result.dist = (_position - destPosition).length();
|
||||||
|
/*
|
||||||
|
if (result.dist>500.0f) {
|
||||||
|
// The element is realy too far ... == > no need to display
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// try to add the element at the best positions:
|
||||||
|
size_t jjj;
|
||||||
|
for (jjj=0; jjj<_resultList.size(); jjj++) {
|
||||||
|
if (_resultList[jjj].dist>result.dist) {
|
||||||
|
_resultList.insert(_resultList.begin()+jjj, result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// add element at the end :
|
||||||
|
if (jjj >= _resultList.size()) {
|
||||||
|
_resultList.push_back(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ege::render::Engine::render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) {
|
||||||
|
for (auto &it : m_component) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//EGE_DEBUG("Draw (start)");
|
||||||
|
mat4 tmpMatrix;
|
||||||
|
getOrderedElementForDisplay(m_displayElementOrdered, _camera->getEye(), _camera->getViewVector());
|
||||||
|
EGE_VERBOSE("DRAW : " << m_displayElementOrdered.size() << "/" << m_component.size() << " elements");
|
||||||
|
|
||||||
|
// TODO : remove this == > no more needed ==> checked in the generate the list of the element ordered
|
||||||
|
for (auto &it: m_displayElementOrdered) {
|
||||||
|
it.element->preCalculationDraw(*_camera);
|
||||||
|
}
|
||||||
|
// note : the first pass is done at the reverse way to prevent multiple display od the same point in the screen
|
||||||
|
// (and we remember that the first pass is to display all the non transparent elements)
|
||||||
|
for (int32_t iii=m_displayElementOrdered.size()-1; iii >= 0; iii--) {
|
||||||
|
m_displayElementOrdered[iii].element->draw(0);
|
||||||
|
}
|
||||||
|
// for the other pass the user can draw transparent elements ...
|
||||||
|
for (int32_t pass=1; pass <= NUMBER_OF_SUB_PASS+1; pass++) {
|
||||||
|
for (auto &it: m_displayElementOrdered) {
|
||||||
|
it.element->draw(pass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
if (propertyDebugPhysic.get() == true) {
|
||||||
|
// Draw debug ... (Object)
|
||||||
|
for (int32_t iii=m_displayElementOrdered.size()-1; iii >= 0; iii--) {
|
||||||
|
m_displayElementOrdered[iii].element->drawDebug(m_debugDrawProperty, camera);
|
||||||
|
}
|
||||||
|
// Draw debug ... (Camera)
|
||||||
|
/*
|
||||||
|
std::map<std::string, ememory::SharedPtr<ege::Camera>> listCamera = m_env->getCameraList();
|
||||||
|
for (auto &itCam : listCamera) {
|
||||||
|
if (itCam.second != nullptr) {
|
||||||
|
itCam.second->drawDebug(m_debugDrawProperty, camera);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
if (propertyDebugNormal.get() == true) {
|
||||||
|
// Draw debug ... (Object)
|
||||||
|
for (int32_t iii=m_displayElementOrdered.size()-1; iii >= 0; iii--) {
|
||||||
|
m_displayElementOrdered[iii].element->drawNormalDebug(m_debugDrawProperty, camera);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertyDebugApplication.get() == true) {
|
||||||
|
// Draw debug ... (User)
|
||||||
|
signalDisplayDebug.emit(m_debugDrawProperty);
|
||||||
|
}
|
||||||
|
/* TODO: set it back ...
|
||||||
|
if (camera != nullptr) {
|
||||||
|
m_env->getParticuleEngine().draw(*camera);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
}
|
@ -11,17 +11,31 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ege/debug.hpp>
|
#include <ege/debug.hpp>
|
||||||
#include <ege/render/Component.hpp>
|
#include <ege/render/Component.hpp>
|
||||||
|
#include <ege/Engine.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace ege {
|
namespace ege {
|
||||||
namespace render {
|
namespace render {
|
||||||
class Engine {
|
class Engine : public ege::Engine {
|
||||||
public:
|
public:
|
||||||
Engine() {}
|
Engine(ege::Environement* _env);
|
||||||
~Engine() {}
|
~Engine() {}
|
||||||
|
protected:
|
||||||
// update cycle
|
std::vector<ememory::SharedPtr<ege::render::Component>> m_component;
|
||||||
void update(float _delta) {}
|
class ResultNearestElement {
|
||||||
|
public:
|
||||||
|
ememory::SharedPtr<ege::render::Component> element;
|
||||||
|
float dist;
|
||||||
|
};
|
||||||
|
std::vector<ege::render::Engine::ResultNearestElement> m_displayElementOrdered;
|
||||||
|
public:
|
||||||
|
const std::string& getType() const override;
|
||||||
|
void componentRemove(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 getOrderedElementForDisplay(std::vector<ege::render::Engine::ResultNearestElement>& _resultList,
|
||||||
|
const vec3& _position,
|
||||||
|
const vec3& _direction);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
|
|||||||
switch(m_normalMode) {
|
switch(m_normalMode) {
|
||||||
case normalModeFace:
|
case normalModeFace:
|
||||||
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
|
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
|
||||||
if(btDot(mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]], cameraNormal) >= 0.0f) {
|
if((mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= 0.0f) {
|
||||||
tmpIndexResult.push_back(iii*3);
|
tmpIndexResult.push_back(iii*3);
|
||||||
tmpIndexResult.push_back(iii*3+1);
|
tmpIndexResult.push_back(iii*3+1);
|
||||||
tmpIndexResult.push_back(iii*3+2);
|
tmpIndexResult.push_back(iii*3+2);
|
||||||
@ -195,9 +195,9 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
|
|||||||
break;
|
break;
|
||||||
case normalModeVertex:
|
case normalModeVertex:
|
||||||
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
|
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
|
||||||
if( (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]], cameraNormal) >= -0.2f)
|
if( ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= -0.2f)
|
||||||
|| (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]], cameraNormal) >= -0.2f)
|
|| ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]]).dot(cameraNormal) >= -0.2f)
|
||||||
|| (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]], cameraNormal) >= -0.2f) ) {
|
|| ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]]).dot(cameraNormal) >= -0.2f) ) {
|
||||||
tmpIndexResult.push_back(iii*3);
|
tmpIndexResult.push_back(iii*3);
|
||||||
tmpIndexResult.push_back(iii*3+1);
|
tmpIndexResult.push_back(iii*3+1);
|
||||||
tmpIndexResult.push_back(iii*3+2);
|
tmpIndexResult.push_back(iii*3+2);
|
||||||
@ -285,7 +285,7 @@ void ege::resource::Mesh::drawNormal(mat4& _positionMatrix,
|
|||||||
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.push_back(position);
|
||||||
vertices.push_back(position+normal/4);
|
vertices.push_back(position+normal*0.25f);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case normalModeFace:
|
case normalModeFace:
|
||||||
@ -298,7 +298,7 @@ void ege::resource::Mesh::drawNormal(mat4& _positionMatrix,
|
|||||||
center /= float(nbIndicInFace);
|
center /= float(nbIndicInFace);
|
||||||
vec3 normal = m_listFacesNormal[tmpFaceList.m_faces[iii].m_normal[0]];
|
vec3 normal = m_listFacesNormal[tmpFaceList.m_faces[iii].m_normal[0]];
|
||||||
vertices.push_back(center);
|
vertices.push_back(center);
|
||||||
vertices.push_back(center+normal/4);
|
vertices.push_back(center+normal*0.25f);
|
||||||
} break;
|
} break;
|
||||||
case normalModeNone:
|
case normalModeNone:
|
||||||
break;
|
break;
|
||||||
@ -325,8 +325,7 @@ void ege::resource::Mesh::calculateNormaleFace(const std::string& _materialName)
|
|||||||
}
|
}
|
||||||
for(auto &it : m_listFaces[_materialName].m_faces) {
|
for(auto &it : m_listFaces[_materialName].m_faces) {
|
||||||
// for all case, We use only the 3 vertex for quad element, in theory 3D modeler export element in triangle if it is not a real plane.
|
// for all case, We use only the 3 vertex for quad element, in theory 3D modeler export element in triangle if it is not a real plane.
|
||||||
vec3 normal = btCross(m_listVertex[it.m_vertex[0]]-m_listVertex[it.m_vertex[1]],
|
vec3 normal = (m_listVertex[it.m_vertex[0]]-m_listVertex[it.m_vertex[1]]).cross(m_listVertex[it.m_vertex[1]]-m_listVertex[it.m_vertex[2]]);
|
||||||
m_listVertex[it.m_vertex[1]]-m_listVertex[it.m_vertex[2]]);
|
|
||||||
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.push_back(vec3(1,0,0));
|
||||||
|
@ -90,7 +90,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
|
|||||||
//std::vector<uint32_t>& tmppIndex = m_listFaces.getValue(kkk).m_index;
|
//std::vector<uint32_t>& tmppIndex = m_listFaces.getValue(kkk).m_index;
|
||||||
if (normalModeFace == m_normalMode) {
|
if (normalModeFace == m_normalMode) {
|
||||||
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
|
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
|
||||||
if(btDot(mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]], cameraNormal) >= 0.0f) {
|
if((mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= 0.0f) {
|
||||||
tmpIndexResult.push_back(iii*3);
|
tmpIndexResult.push_back(iii*3);
|
||||||
tmpIndexResult.push_back(iii*3+1);
|
tmpIndexResult.push_back(iii*3+1);
|
||||||
tmpIndexResult.push_back(iii*3+2);
|
tmpIndexResult.push_back(iii*3+2);
|
||||||
@ -98,9 +98,9 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
|
for(size_t iii=0; iii<tmppFaces.size() ; ++iii) {
|
||||||
if( (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]], cameraNormal) >= -0.2f)
|
if( ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]]).dot(cameraNormal) >= -0.2f)
|
||||||
|| (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]], cameraNormal) >= -0.2f)
|
|| ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]]).dot(cameraNormal) >= -0.2f)
|
||||||
|| (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]], cameraNormal) >= -0.2f) ) {
|
|| ((mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]]).dot(cameraNormal) >= -0.2f) ) {
|
||||||
tmpIndexResult.push_back(iii*3);
|
tmpIndexResult.push_back(iii*3);
|
||||||
tmpIndexResult.push_back(iii*3+1);
|
tmpIndexResult.push_back(iii*3+1);
|
||||||
tmpIndexResult.push_back(iii*3+2);
|
tmpIndexResult.push_back(iii*3+2);
|
||||||
|
@ -71,7 +71,8 @@ void ege::widget::Scene::onDraw() {
|
|||||||
g_counterNbTimeDisplay++;
|
g_counterNbTimeDisplay++;
|
||||||
g_startTime = echrono::Steady::now();
|
g_startTime = echrono::Steady::now();
|
||||||
#endif
|
#endif
|
||||||
|
m_env->render(echrono::Duration(1.0/60.0), m_cameraName);
|
||||||
|
#if 0
|
||||||
// draw constant object:
|
// draw constant object:
|
||||||
{
|
{
|
||||||
mat4 tmpMatrix;
|
mat4 tmpMatrix;
|
||||||
@ -82,7 +83,7 @@ void ege::widget::Scene::onDraw() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get camera :
|
// get camera:
|
||||||
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||||
if (camera == nullptr) {
|
if (camera == nullptr) {
|
||||||
EGE_ERROR(" can not get camera named: '" << m_cameraName << "'");
|
EGE_ERROR(" can not get camera named: '" << m_cameraName << "'");
|
||||||
@ -134,9 +135,12 @@ void ege::widget::Scene::onDraw() {
|
|||||||
// Draw debug ... (User)
|
// Draw debug ... (User)
|
||||||
signalDisplayDebug.emit(m_debugDrawProperty);
|
signalDisplayDebug.emit(m_debugDrawProperty);
|
||||||
}
|
}
|
||||||
|
/* TODO: set it back ...
|
||||||
if (camera != nullptr) {
|
if (camera != nullptr) {
|
||||||
m_env->getParticuleEngine().draw(*camera);
|
m_env->getParticuleEngine().draw(*camera);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
#ifdef SCENE_DISPLAY_SPEED
|
#ifdef SCENE_DISPLAY_SPEED
|
||||||
echrono::Duration localTime = echrono::Steady::now() - g_startTime;
|
echrono::Duration localTime = echrono::Steady::now() - g_startTime;
|
||||||
if (localTime>1) {
|
if (localTime>1) {
|
||||||
|
14
lutin_ege.py
14
lutin_ege.py
@ -27,8 +27,9 @@ def get_version():
|
|||||||
def configure(target, my_module):
|
def configure(target, my_module):
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'ege/debug.cpp',
|
'ege/debug.cpp',
|
||||||
'ege/AudioElement.cpp',
|
'ege/Engine.cpp',
|
||||||
'ege/AudioEngine.cpp',
|
'ege/Component.cpp',
|
||||||
|
'ege/Environement.cpp',
|
||||||
'ege/camera/Camera.cpp',
|
'ege/camera/Camera.cpp',
|
||||||
'ege/camera/View.cpp',
|
'ege/camera/View.cpp',
|
||||||
'ege/camera/FPS.cpp',
|
'ege/camera/FPS.cpp',
|
||||||
@ -36,7 +37,6 @@ def configure(target, my_module):
|
|||||||
'ege/position/Component.cpp',
|
'ege/position/Component.cpp',
|
||||||
'ege/physics/Component.cpp',
|
'ege/physics/Component.cpp',
|
||||||
'ege/physics/Engine.cpp',
|
'ege/physics/Engine.cpp',
|
||||||
'ege/Component.cpp',
|
|
||||||
'ege/elements/Element.cpp',
|
'ege/elements/Element.cpp',
|
||||||
'ege/elements/ElementBase.cpp',
|
'ege/elements/ElementBase.cpp',
|
||||||
'ege/elements/ElementPhysic.cpp',
|
'ege/elements/ElementPhysic.cpp',
|
||||||
@ -49,7 +49,6 @@ def configure(target, my_module):
|
|||||||
'ege/render/Engine.cpp',
|
'ege/render/Engine.cpp',
|
||||||
'ege/widget/Mesh.cpp',
|
'ege/widget/Mesh.cpp',
|
||||||
'ege/widget/Scene.cpp',
|
'ege/widget/Scene.cpp',
|
||||||
'ege/Environement.cpp',
|
|
||||||
'ege/resource/Mesh.cpp',
|
'ege/resource/Mesh.cpp',
|
||||||
'ege/resource/MeshEmf.cpp',
|
'ege/resource/MeshEmf.cpp',
|
||||||
'ege/resource/MeshGird.cpp',
|
'ege/resource/MeshGird.cpp',
|
||||||
@ -79,8 +78,9 @@ def configure(target, my_module):
|
|||||||
'-Wall'])
|
'-Wall'])
|
||||||
my_module.add_header_file([
|
my_module.add_header_file([
|
||||||
'ege/debug.hpp',
|
'ege/debug.hpp',
|
||||||
'ege/AudioElement.hpp',
|
'ege/Engine.hpp',
|
||||||
'ege/AudioEngine.hpp',
|
'ege/Component.hpp',
|
||||||
|
'ege/Environement.hpp',
|
||||||
'ege/camera/Camera.hpp',
|
'ege/camera/Camera.hpp',
|
||||||
'ege/camera/View.hpp',
|
'ege/camera/View.hpp',
|
||||||
'ege/camera/FPS.hpp',
|
'ege/camera/FPS.hpp',
|
||||||
@ -88,7 +88,6 @@ def configure(target, my_module):
|
|||||||
'ege/position/Component.hpp',
|
'ege/position/Component.hpp',
|
||||||
'ege/physics/Engine.hpp',
|
'ege/physics/Engine.hpp',
|
||||||
'ege/physics/Component.hpp',
|
'ege/physics/Component.hpp',
|
||||||
'ege/Component.hpp',
|
|
||||||
'ege/elements/Element.hpp',
|
'ege/elements/Element.hpp',
|
||||||
'ege/elements/ElementBase.hpp',
|
'ege/elements/ElementBase.hpp',
|
||||||
'ege/elements/ElementPhysic.hpp',
|
'ege/elements/ElementPhysic.hpp',
|
||||||
@ -101,7 +100,6 @@ def configure(target, my_module):
|
|||||||
'ege/render/Engine.hpp',
|
'ege/render/Engine.hpp',
|
||||||
'ege/widget/Mesh.hpp',
|
'ege/widget/Mesh.hpp',
|
||||||
'ege/widget/Scene.hpp',
|
'ege/widget/Scene.hpp',
|
||||||
'ege/Environement.hpp',
|
|
||||||
'ege/resource/Mesh.hpp',
|
'ege/resource/Mesh.hpp',
|
||||||
'ege/resource/ParticuleMesh.hpp',
|
'ege/resource/ParticuleMesh.hpp',
|
||||||
'ege/resource/tools/icoSphere.hpp',
|
'ege/resource/tools/icoSphere.hpp',
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <ege/physicsShape/PhysicsBox.hpp>
|
#include <ege/physicsShape/PhysicsBox.hpp>
|
||||||
#include <ege/physicsShape/PhysicsSphere.hpp>
|
#include <ege/physicsShape/PhysicsSphere.hpp>
|
||||||
#include <ege/position/Component.hpp>
|
#include <ege/position/Component.hpp>
|
||||||
|
#include <ege/render/Component.hpp>
|
||||||
|
|
||||||
appl::Windows::Windows() {
|
appl::Windows::Windows() {
|
||||||
addObjectType("appl::Windows");
|
addObjectType("appl::Windows");
|
||||||
@ -242,6 +243,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::Windows::onCallbackPeriodicCheckCollision(const ewol::event::Time& _event) {
|
void appl::Windows::onCallbackPeriodicCheckCollision(const ewol::event::Time& _event) {
|
||||||
|
/*
|
||||||
std::vector<ege::physics::Engine::collisionPoints> list = m_env->getPhysicEngine().getListOfCollision();
|
std::vector<ege::physics::Engine::collisionPoints> list = m_env->getPhysicEngine().getListOfCollision();
|
||||||
|
|
||||||
if (list.size() != 0) {
|
if (list.size() != 0) {
|
||||||
@ -250,6 +252,7 @@ void appl::Windows::onCallbackPeriodicCheckCollision(const ewol::event::Time& _e
|
|||||||
for (size_t iii=0;iii<list.size();++iii) {
|
for (size_t iii=0;iii<list.size();++iii) {
|
||||||
APPL_ERROR(" [" << list[iii].elem1->getUID() << "]:point1=" << list[iii].positionElem1 << " [" << list[iii].elem1->getUID() << "]:point2=" << list[iii].positionElem2 << " normal=" << list[iii].normalElem2);
|
APPL_ERROR(" [" << list[iii].elem1->getUID() << "]:point1=" << list[iii].positionElem1 << " [" << list[iii].elem1->getUID() << "]:point2=" << list[iii].positionElem2 << " normal=" << list[iii].normalElem2);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user