[DEV] start developement of a basic IA system

This commit is contained in:
Edouard DUPIN 2018-08-14 23:33:42 +02:00
parent 1fe5bececb
commit 436ae2c58d
25 changed files with 591 additions and 18 deletions

View File

@ -39,6 +39,8 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
EGE_ERROR("try to add an empty component"); EGE_ERROR("try to add an empty component");
return; return;
} }
EGE_PRINT("Entity: Add New component ... [START]");
// Componenet to remove if it have the same type of the previous Component:
ememory::SharedPtr<ege::Component> componentRemoved; ememory::SharedPtr<ege::Component> componentRemoved;
int32_t findId = -1; int32_t findId = -1;
// check if not exist // check if not exist
@ -74,11 +76,14 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
continue; continue;
} }
if (componentRemoved != null) { if (componentRemoved != null) {
EGE_PRINT("Entity: ==> remove previous component");
m_env->engineComponentRemove(componentRemoved); m_env->engineComponentRemove(componentRemoved);
m_component[iii]->removeFriendComponent(componentRemoved); m_component[iii]->removeFriendComponent(componentRemoved);
} }
EGE_PRINT("Entity: ==> add New component");
m_env->engineComponentAdd(_ref); m_env->engineComponentAdd(_ref);
m_component[iii]->addFriendComponent(_ref); m_component[iii]->addFriendComponent(_ref);
break;
} }
// notify new component of all previously added component: // notify new component of all previously added component:
componentRemoved = _ref; componentRemoved = _ref;
@ -91,6 +96,7 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
} }
componentRemoved->addFriendComponent(m_component[iii]); componentRemoved->addFriendComponent(m_component[iii]);
} }
EGE_PRINT("Entity: Add New component ... [END]");
} }
void ege::Entity::rmComponent(const ememory::SharedPtr<ege::Component>& _ref) { void ege::Entity::rmComponent(const ememory::SharedPtr<ege::Component>& _ref) {

View File

@ -12,6 +12,7 @@ namespace ege {
}; };
#define EGE_BASE(info,data) ELOG_BASE(ege::getLogId(),info,data) #define EGE_BASE(info,data) ELOG_BASE(ege::getLogId(),info,data)
#define EGE_PRINT(data) EGE_BASE(-1, data)
#define EGE_CRITICAL(data) EGE_BASE(1, data) #define EGE_CRITICAL(data) EGE_BASE(1, data)
#define EGE_ERROR(data) EGE_BASE(2, data) #define EGE_ERROR(data) EGE_BASE(2, data)
#define EGE_WARNING(data) EGE_BASE(3, data) #define EGE_WARNING(data) EGE_BASE(3, data)

View File

@ -10,3 +10,6 @@ const etk::String& ege::ia::Component::getType() const {
return tmp; return tmp;
} }
void ege::ia::Component::update(float _delta) {
}

View File

@ -16,6 +16,8 @@ namespace ege {
public: public:
virtual const etk::String& getType() const override; virtual const etk::String& getType() const override;
// call of this function every time the call will be done
virtual void update(float _delta);
}; };
} }
} }

16
ege/ia/ComponentLua.cpp Normal file
View File

@ -0,0 +1,16 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#include <ege/ia/ComponentLua.hpp>
ege::ia::ComponentLua::ComponentLua(const etk::String& _fileName) {
// Load the current IA file interface ==> init...
m_engine.executeFile(_fileName);
}
void ege::ia::ComponentLua::update(float _delta) {
m_engine.callVoid("update", float(_delta));
}

21
ege/ia/ComponentLua.hpp Normal file
View File

@ -0,0 +1,21 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <ege/ia/Component.hpp>
#include <luaWrapper/luaWrapper.hpp>
namespace ege {
namespace ia {
class ComponentLua : public ege::ia::Component {
public:
ComponentLua(const etk::String& _fileName);
void update(float _delta) override;
private:
luaWrapper::Lua m_engine;
};
}
}

View File

@ -4,6 +4,7 @@
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#include <ege/ia/Engine.hpp> #include <ege/ia/Engine.hpp>
#include <ege/debug.hpp>
ege::ia::Engine::Engine(ege::Environement* _env) : ege::ia::Engine::Engine(ege::Environement* _env) :
ege::Engine(_env) { ege::Engine(_env) {
@ -16,9 +17,66 @@ const etk::String& ege::ia::Engine::getType() const {
} }
void ege::ia::Engine::componentRemove(const ememory::SharedPtr<ege::Component>& _ref) { void ege::ia::Engine::componentRemove(const ememory::SharedPtr<ege::Component>& _ref) {
ememory::SharedPtr<ege::ia::Component> ref = ememory::dynamicPointerCast<ege::ia::Component>(_ref);
for (auto it=m_component.begin();
it != m_component.end();
++it) {
if (*it == ref) {
it->reset();
return;
}
}
} }
void ege::ia::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) { void ege::ia::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
ememory::SharedPtr<ege::ia::Component> ref = ememory::dynamicPointerCast<ege::ia::Component>(_ref);
EGE_WARNING("ADD COMPONENT " << uint64_t(ref.get()) );
if (ref == null) {
return;
}
#if DEBUG
for (auto it=m_component.begin();
it != m_component.end();
++it) {
if (*it != null) {
if (*it == ref) {
EGE_ERROR("Try Add multiple time the same Component in the IA Engine " << uint64_t(ref.get()) );
}
}
}
#endif
for (auto it=m_component.begin();
it != m_component.end();
++it) {
if (*it == null) {
*it = ref;
return;
}
}
m_component.pushBack(ref);
}
// Constant physics time step ==> 10 time / seconds
// TODO: set it configurable, some games need more, and soem other just need really less ==> or set it configurable with the internal component
static const float timeStep = 5.0;
void ege::ia::Engine::update(const echrono::Duration& _delta) {
float deltaTime = _delta.toSeconds();
// Add the time difference in the accumulator
m_accumulator += deltaTime;
// While there is enough accumulated time to take one or several physics steps
while (m_accumulator >= timeStep) {
EGE_WARNING("Generate for " << m_accumulator << " / " << timeStep << " for:" << m_component.size());
// call every object to usdate their constant forces applyed
for (auto &it: m_component) {
// check null pointer
if (it == null) {
// no pointer null are set in the output list ...
continue;
}
it->update(timeStep);
}
// Decrease the accumulated time
m_accumulator -= timeStep;
}
} }

View File

@ -10,6 +10,7 @@
#include <etk/math/Matrix4x4.hpp> #include <etk/math/Matrix4x4.hpp>
#include <etk/Vector.hpp> #include <etk/Vector.hpp>
#include <ege/debug.hpp> #include <ege/debug.hpp>
#include <ege/ia/Component.hpp>
namespace ege { namespace ege {
@ -20,11 +21,14 @@ namespace ege {
~Engine() {} ~Engine() {}
// update cycle // update cycle
void update(float _delta) {} void update(const echrono::Duration& _delta) override;
public: public:
const etk::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;
protected:
etk::Vector<ememory::SharedPtr<ege::ia::Component>> m_component;
float m_accumulator; // limit call of IA process
}; };
} }
} }

View File

@ -73,6 +73,17 @@ void ege::physics::Engine::componentRemove(const ememory::SharedPtr<ege::Compone
void ege::physics::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) { void ege::physics::Engine::componentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
ememory::SharedPtr<ege::physics::Component> ref = ememory::dynamicPointerCast<ege::physics::Component>(_ref); ememory::SharedPtr<ege::physics::Component> ref = ememory::dynamicPointerCast<ege::physics::Component>(_ref);
#if DEBUG
for (auto it=m_component.begin();
it != m_component.end();
++it) {
if (*it != null) {
if (*it == ref) {
EGE_ERROR("Try Add multiple time the same Component in the Physic Engine " << uint64_t(ref.get()) );
}
}
}
#endif
for (auto it=m_component.begin(); for (auto it=m_component.begin();
it != m_component.end(); it != m_component.end();
++it) { ++it) {
@ -118,7 +129,7 @@ void ege::physics::Engine::setGravity(const vec3& _axePower) {
} }
// Constant physics time step // Constant physics time step
const float timeStep = 1.0 / 60.0; static const float timeStep = 1.0 / 60.0;
void ege::physics::Engine::update(const echrono::Duration& _delta) { void ege::physics::Engine::update(const echrono::Duration& _delta) {
float deltaTime = _delta.toSeconds(); float deltaTime = _delta.toSeconds();

View File

@ -64,7 +64,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
int32_t nbElementDrawTheoric = 0; int32_t nbElementDrawTheoric = 0;
int32_t nbElementDraw = 0; int32_t nbElementDraw = 0;
#endif #endif
for (int32_t kkk=0; kkk<m_listFaces.size(); kkk++) { for (size_t kkk=0; kkk<m_listFaces.size(); kkk++) {
if (m_materials.exist(m_listFaces.getKey(kkk)) == false) { if (m_materials.exist(m_listFaces.getKey(kkk)) == false) {
EGE_WARNING("missing materials : '" << m_listFaces.getKey(kkk) << "'"); EGE_WARNING("missing materials : '" << m_listFaces.getKey(kkk) << "'");
continue; continue;

View File

@ -28,7 +28,7 @@ namespace ege {
float m_cameraDistance; float m_cameraDistance;
protected: protected:
Mesh(); Mesh();
void init(); // automatic considering in the appl Data older void init() override; // automatic considering in the appl Data older
public: public:
virtual ~Mesh(); virtual ~Mesh();
public: public:

View File

@ -15,3 +15,4 @@ sample/Script
sample/StereoVision sample/StereoVision
sample/TorqueApply sample/TorqueApply
sample/LowPoly sample/LowPoly
sample/IA

View File

@ -45,6 +45,7 @@ def configure(target, my_module):
'ege/particule/Engine.cpp', 'ege/particule/Engine.cpp',
'ege/particule/Simple.cpp', 'ege/particule/Simple.cpp',
'ege/ia/Component.cpp', 'ege/ia/Component.cpp',
'ege/ia/ComponentLua.cpp',
'ege/ia/Engine.cpp', 'ege/ia/Engine.cpp',
'ege/render/Component.cpp', 'ege/render/Component.cpp',
'ege/render/Engine.cpp', 'ege/render/Engine.cpp',
@ -77,7 +78,13 @@ def configure(target, my_module):
]) ])
my_module.copy_path('data/ParticuleMesh.*') my_module.copy_path('data/ParticuleMesh.*')
my_module.copy_path('data/material3D.*') my_module.copy_path('data/material3D.*')
my_module.add_depend(['ewol', 'ephysics', 'eproperty', 'echrono']) my_module.add_depend([
'ewol',
'ephysics',
'eproperty',
'echrono',
'luaWrapper',
])
my_module.add_flag('c++', [ my_module.add_flag('c++', [
'-Wno-write-strings', '-Wno-write-strings',
'-Wmissing-field-initializers', '-Wmissing-field-initializers',
@ -101,6 +108,7 @@ def configure(target, my_module):
'ege/particule/Engine.hpp', 'ege/particule/Engine.hpp',
'ege/particule/Simple.hpp', 'ege/particule/Simple.hpp',
'ege/ia/Component.hpp', 'ege/ia/Component.hpp',
'ege/ia/ComponentLua.hpp',
'ege/ia/Engine.hpp', 'ege/ia/Engine.hpp',
'ege/render/Component.hpp', 'ege/render/Component.hpp',
'ege/render/Engine.hpp', 'ege/render/Engine.hpp',

160
sample/IA/appl/Windows.cpp Normal file
View File

@ -0,0 +1,160 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file)
*/
#include <ewol/ewol.hpp>
#include <appl/debug.hpp>
#include <appl/Windows.hpp>
#include <ewol/widget/Label.hpp>
#include <ewol/object/Manager.hpp>
#include <ege/widget/Scene.hpp>
#include <ege/camera/View.hpp>
#include <etk/tool.hpp>
#include <ege/Entity.hpp>
#include <ege/physics/shape/Box.hpp>
#include <ege/physics/shape/Sphere.hpp>
#include <ege/physics/shape/Cylinder.hpp>
#include <ege/physics/shape/Capsule.hpp>
#include <ege/physics/shape/Cone.hpp>
#include <ege/position/Component.hpp>
#include <ege/ia/ComponentLua.hpp>
#include <ege/render/Component.hpp>
#include <ege/physics/Component.hpp>
appl::Windows::Windows() {
addObjectType("appl::Windows");
propertyTitle.setDirectCheck("example ege : Artificial Intelligence");
}
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
if (out != null) {
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
// set the entity material properties :
material->setAmbientFactor(vec4(1,1,1,1));
material->setDiffuseFactor(vec4(0,0,0,1));
material->setSpecularFactor(vec4(0,0,0,1));
material->setShininess(1);
// 1024 == > 1<<9
// 2048 == > 1<<10
// 4096 == > 1<<11
int32_t size = 1<<11;
//material->setTexture0(""); //"
material->setTexture0Magic(ivec2(size,size));
out->addMaterial("basics", material);
//material->setImageSize(ivec2(size,size));
egami::Image* myImage = material->get();
if (myImage == null) {
return out;
}
myImage->clear(etk::color::black);
ivec2 tmpPos;
for (int32_t iii=0; iii<6000; iii++) {
tmpPos.setValue(etk::tool::frand(0,size), etk::tool::frand(0,size)) ;
myImage->set(tmpPos, etk::color::white);
}
material->flush();
// basis on cube :
out->createViewBox("basics", 1000/* distance */);
// generate the VBO
out->generateVBO();
}
return out;
}
void appl::Windows::init() {
ewol::widget::Windows::init();
// TODO : Auto mode : getObjectManager().periodicCall.connect(sharedFromThis(), &appl::Windows::onCallbackPeriodicUpdateCamera);
m_env = ege::Environement::create();
// Create basic Camera
m_camera = ememory::makeShared<ege::camera::View>();
m_env->addCamera("basic", m_camera);
m_cameraControler.setCamera(m_camera);
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
if (tmpWidget == null) {
APPL_ERROR("Can not allocate widget ==> display might be in error");
} else {
tmpWidget->setEnv(m_env);
tmpWidget->propertyExpand.set(bvec2(true,true));
tmpWidget->propertyFill.set(bvec2(true,true));
tmpWidget->setCamera("basic");
setSubWidget(tmpWidget);
}
ememory::SharedPtr<ege::resource::Mesh> myMesh;
// Create an external box: (no physics)
myMesh = createViewBoxStar();
if (myMesh != null) {
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
// 1st Position component:
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
ememory::SharedPtr<ege::position::Component> componentPosition = ememory::makeShared<ege::position::Component>(transform);
entity->addComponent(componentPosition);
// 2nd something to diplay:
ememory::SharedPtr<ege::render::Component> componentRender = ememory::makeShared<ege::render::Component>(myMesh);
entity->addComponent(componentRender);
// add it ..
m_env->addEntity(entity);
}
// create basic gird: (no physics)
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
if (myMesh != null) {
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
// 1st Position component:
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
ememory::SharedPtr<ege::position::Component> componentPosition = ememory::makeShared<ege::position::Component>(transform);
entity->addComponent(componentPosition);
// 2nd something to diplay:
ememory::SharedPtr<ege::render::Component> componentRender = ememory::makeShared<ege::render::Component>(myMesh);
entity->addComponent(componentRender);
// add it ..
m_env->addEntity(entity);
}
myMesh = ege::resource::Mesh::create("DATA:tower.emf");
if (myMesh != null) {
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
// add all component:
// 1st Position component:
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
// 2nd something to diplay:
ememory::SharedPtr<ege::render::Component> componentRender = ememory::makeShared<ege::render::Component>(myMesh);
entity->addComponent(componentRender);
// 3rd some physic:
ememory::SharedPtr<ege::physics::Component> componentPhysics = ememory::makeShared<ege::physics::Component>(m_env, transform);
componentPhysics->setShape(myMesh->getPhysicalProperties());
componentPhysics->generate();
entity->addComponent(componentPhysics);
// 3rd this object have some intelligence:
ememory::SharedPtr<ege::ia::Component> componentIA = ememory::makeShared<ege::ia::ComponentLua>("DATA:tower.lua");
entity->addComponent(componentIA);
// add it ..
m_env->addEntity(entity);
}
m_env->propertyStatus.set(ege::gameStart);
tmpWidget->propertyDebugPhysic.set(true);
tmpWidget->propertyDebugNormal.set(true);
}
bool appl::Windows::onEventEntry(const ewol::event::Entry& _event) {
if (m_cameraControler.onEventEntry(_event) == true) {
return true;
}
return false;
}
bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
if (m_cameraControler.onEventInput(_event, relativePosition(_event.getPos())) == true) {
return true;
}
return false;
}

View File

@ -0,0 +1,35 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <ewol/widget/Windows.hpp>
#include <ege/Environement.hpp>
#include <ege/camera/View.hpp>
#include <ege/camera/ControlBase.hpp>
namespace appl {
class Windows : public ewol::widget::Windows {
private:
ememory::SharedPtr<ege::Environement> m_env;
ememory::SharedPtr<ege::camera::View> m_camera;
ege::camera::ControlBase m_cameraControler;
protected:
Windows();
void init() override;
public:
DECLARE_FACTORY(Windows);
virtual ~Windows() { };
private:
void onCallbackPeriodicUpdateCamera(const ewol::event::Time& _event);
private:
// need this to forward if to the camera controler ...
bool onEventEntry(const ewol::event::Entry& _event) override;
bool onEventInput(const ewol::event::Input& _event) override;
};
}

15
sample/IA/appl/debug.cpp Normal file
View File

@ -0,0 +1,15 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file)
*/
#include <appl/debug.hpp>
int32_t appl::getLogId() {
static int32_t g_val = elog::registerInstance("GP-spaceShip");
return g_val;
}

40
sample/IA/appl/debug.hpp Normal file
View File

@ -0,0 +1,40 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <elog/log.hpp>
namespace appl {
int32_t getLogId();
}
#define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_PRINT(data) APPL_BASE(-1, data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)
#define APPL_WARNING(data) APPL_BASE(3, data)
#ifdef DEBUG
#define APPL_INFO(data) APPL_BASE(4, data)
#define APPL_DEBUG(data) APPL_BASE(5, data)
#define APPL_VERBOSE(data) APPL_BASE(6, data)
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
#else
#define APPL_INFO(data) do { } while(false)
#define APPL_DEBUG(data) do { } while(false)
#define APPL_VERBOSE(data) do { } while(false)
#define APPL_TODO(data) do { } while(false)
#endif
#define APPL_ASSERT(cond,data) \
do { \
if (!(cond)) { \
APPL_CRITICAL(data); \
assert(!#cond); \
} \
} while (0)

67
sample/IA/appl/main.cpp Normal file
View File

@ -0,0 +1,67 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file)
*/
#include <etk/types.hpp>
#include <ewol/ewol.hpp>
#include <gale/context/commandLine.hpp>
#include <appl/debug.hpp>
#include <appl/Windows.hpp>
#include <ewol/object/Object.hpp>
#include <ewol/widget/Manager.hpp>
#include <ewol/context/Context.hpp>
namespace appl {
class MainApplication : public ewol::context::Application {
public:
void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h"
|| tmpppp == "--help") {
APPL_INFO(" -h/--help display this help" );
exit(0);
}
}
// TODO : Remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows
_context.setWindows(basicWindows);
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
}
void onStart(ewol::Context& _context) override {
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
// nothing to do ...
APPL_INFO("==> START ... " PROJECT_NAME " (END)");
}
void onStop(ewol::Context& _context) override {
APPL_INFO("==> STOP ... " PROJECT_NAME " (START)");
// nothing to do ...
APPL_INFO("==> STOP ... " PROJECT_NAME " (END)");
}
};
}
/**
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
* @param std IO
* @return std IO
*/
int main(int _argc, const char *_argv[]) {
return ewol::run(ETK_NEW(appl::MainApplication), _argc, _argv);
}

9
sample/IA/appl/main.hpp Normal file
View File

@ -0,0 +1,9 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file)
*/
#pragma once

BIN
sample/IA/data/tower.blend Normal file

Binary file not shown.

BIN
sample/IA/data/tower.blend1 Normal file

Binary file not shown.

61
sample/IA/data/tower.emf Normal file
View File

@ -0,0 +1,61 @@
EMF(STRING)
# Blender v2.79 (sub 0) EMF File: 'tower.blend'
Mesh:Arbre_Normal_Cylinder.002
Vertex:46
1.069005 3.112304 -0.025150|2.853355 1.343076 -0.025150|2.864047 -1.169684 -0.025150|1.094818 -2.954032 -0.025150|-1.417942 -2.964725 -0.025150|-3.202291 -1.195495 -0.025150|-3.212983 1.317264 -0.025150|-1.443754 3.101613 -0.025150|4.864760 -1.378834 39.491188|2.573533 -4.188148 13.610696|2.550247 4.372152 13.763056|0.797895 2.449828 3.651479|2.193210 1.066338 3.651479|2.201570 -0.898573 3.651479|0.818080 -2.293888 3.651479|-1.146831 -2.302248 3.651479|-2.542146 -0.918756 3.651479|-2.550506 1.046154 3.651479|-1.167017 2.441468 3.651479|1.813901 0.907330 11.753383|1.820923 -0.742798 11.753383|0.659070 -1.914580 11.448664|-0.991056 -1.921600 11.753383|-2.162838 -0.759748 11.753383|-2.169859 0.890379 11.583043|-1.008008 2.062160 11.753383|0.642120 2.069181 11.753383|-2.922470 4.335726 18.342533|-2.922470 4.335726 13.677886|2.550247 4.372152 18.427702|-2.899184 -4.224570 13.763056|2.573533 -4.188148 18.275343|-2.899184 -4.224570 18.427702|9.985636 -13.979649 27.016886|-1.247164 1.241499 19.622894|0.889137 1.251479 19.635977|0.898226 -1.093919 19.606348|-1.238073 -1.103898 19.612017|3.685154 -0.754828 14.929379|3.651026 0.938832 14.998319|3.651026 0.938832 17.109020|3.685154 -0.754828 17.040079|14.711964 -0.754827 14.929379|14.677835 0.938832 14.998319|14.677835 0.938832 17.109020|14.711964 -0.754827 17.040079|
Normal(face):84
-0.000000 0.000000 -1.000000|0.692971 0.698893 0.177029|0.984197 0.004188 0.177030|0.698893 -0.692971 0.177030|0.004188 -0.984197 0.177029|-0.692971 -0.698893 0.177030|-0.984197 -0.004188 0.177029|-0.004188 0.984197 0.177029|-0.698893 0.692971 0.177029|0.703318 0.709330 0.046849|0.998893 0.004250 0.046849|0.709268 -0.703257 0.048675|0.004250 -0.998806 0.048675|-0.703319 -0.709329 0.046849|-0.998845 -0.004250 0.047853|-0.004250 0.998893 0.046849|-0.709296 0.703285 0.047853|0.692971 0.698894 0.177029|0.984197 0.004187 0.177029|0.698894 -0.692971 0.177029|0.004187 -0.984197 0.177030|-0.984197 -0.004187 0.177030|-0.698894 0.692971 0.177029|0.703319 0.709329 0.046849|0.998893 0.004251 0.046849|0.703239 -0.709419 0.046680|0.012870 -0.998827 0.046680|-0.998906 0.000576 0.046755|-0.712723 0.699886 0.046755|-0.000000 -0.040672 0.999173|0.000000 -1.000000 0.000000|-0.000000 0.040671 -0.999173|0.000000 1.000000 0.000000|0.999797 0.020146 -0.000000|-0.393778 -0.397144 -0.828985|0.523432 -0.312899 -0.792536|0.393778 0.397144 -0.828985|-0.320729 0.439945 -0.838797|0.951376 -0.308031 0.000000|0.004145 -0.356739 0.934195|-0.007405 0.364480 0.931182|0.002675 -0.004627 0.999986|0.755196 -0.009611 0.655429|0.952254 0.305308 -0.000000|0.746418 0.013872 -0.665332|0.028258 -0.382042 0.923713|-0.016920 0.374459 0.927089|-0.006064 -0.012655 0.999901|0.758604 -0.011231 0.651455|0.799250 0.040513 -0.599632|0.932442 0.008965 -0.361208|-0.016842 -0.649447 -0.760220|-0.956977 -0.033821 -0.288187|0.007420 0.653983 -0.756473|-0.999996 -0.002720 0.000000|0.006655 -0.999978 0.000000|-0.006656 0.999978 0.000000|0.607779 -0.012479 0.794008|-0.614232 -0.006041 0.789102|0.936710 0.003986 -0.350083|-0.120039 -0.735340 -0.666982|-0.935520 -0.006059 -0.353222|-0.002743 0.644733 -0.764403|0.597770 -0.007810 0.801630|-0.588511 0.006443 0.808464|
Face:84
troc
6/0 7/0 3/0| 11/1 1/1 0/1| 1/2 13/2 2/2| 13/3 3/3 2/3| 14/4 4/4 3/4| 15/5 5/5 4/5| 16/6 6/6 5/6| 18/7 0/7 7/7| 17/8 7/8 6/8| 26/9 12/9 11/9| 12/10 20/10 13/10| 13/11 21/11 14/11| 21/12 15/12 14/12| 15/13 23/13 16/13| 16/14 24/14 17/14| 25/15 11/15 18/15| 24/16 18/16 17/16| 7/0 0/0 3/0| 0/0 1/0 3/0| 1/0 2/0 3/0| 3/0 4/0 5/0| 5/0 6/0 3/0| 11/17 12/17 1/17| 1/18 12/18 13/18| 13/19 14/19 3/19| 14/20 15/20 4/20| 15/5 16/5 5/5| 16/21 17/21 6/21| 18/7 11/7 0/7| 17/22 18/22 7/22| 26/23 19/23 12/23| 12/24 19/24 20/24| 13/25 20/25 21/25| 21/26 22/26 15/26| 15/13 22/13 23/13| 16/27 23/27 24/27| 25/15 26/15 11/15| 24/28 25/28 18/28|
Material.001
41/29 44/29 40/29| 38/30 45/30 41/30| 38/31 43/31 42/31| 40/32 43/32 39/32| 43/33 45/33 42/33| 41/29 45/29 44/29| 38/30 42/30 45/30| 38/31 39/31 43/31| 40/32 44/32 43/32| 43/33 44/33 45/33|
Material.002
22/34 30/34 23/34| 20/35 9/35 21/35| 10/36 19/36 26/36| 24/37 28/37 25/37| 31/38 38/38 41/38| 32/39 36/39 37/39| 29/40 34/40 35/40| 36/41 34/41 37/41| 31/42 40/42 29/42| 10/43 40/43 39/43| 10/44 38/44 9/44| 31/38 9/38 38/38| 32/45 31/45 36/45| 29/46 27/46 34/46| 36/47 35/47 34/47| 31/48 41/48 40/48| 10/43 29/43 40/43| 10/49 39/49 38/49|
Material.003
20/50 10/50 9/50| 22/51 9/51 30/51| 23/52 28/52 24/52| 26/53 28/53 10/53| 30/54 27/54 28/54| 30/55 31/55 32/55| 10/56 27/56 29/56| 29/57 36/57 31/57| 27/58 37/58 34/58| 20/59 19/59 10/59| 22/60 21/60 9/60| 23/61 30/61 28/61| 26/62 25/62 28/62| 30/54 32/54 27/54| 30/55 9/55 31/55| 10/56 28/56 27/56| 29/63 35/63 36/63| 27/64 32/64 37/64|
Physics:
Cylinder
radius:0.24216008186340332
size:2.0
origin:-0.0126615 0.0444214 2.88964
rotate:0 0 1.96444e-08 1
mass:5.836589337064879
Sphere
radius:0.8244769909363967
origin:0.128048 0.0593033 8.31704
rotate:0 0 1.96444e-08 1
mass:178.05015608942654
Materials:Material.001
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.277363 0.446672 0.072673
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2
Materials:Material.002
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.223115 0.223115 0.018523
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2
Materials:Material.003
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2
Materials:troc
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.046244 0.031637 0.010962
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2

9
sample/IA/data/tower.lua Normal file
View File

@ -0,0 +1,9 @@
--
-- Generic update function called by the IA center engine
--
function update(deltaTime)
print("hello how are you ?", deltaTime)
end

View File

@ -0,0 +1,52 @@
#!/usr/bin/python
import lutin.debug as debug
import lutin.tools as tools
def get_type():
return "BINARY"
def get_sub_type():
return "SAMPLE"
def get_name():
return "ege-sample-ia"
def get_desc():
return "ege sample : Artificial intelligence"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
def get_version():
return [0,1]
def configure(target, my_module):
my_module.add_extra_flags()
my_module.add_src_file([
'appl/debug.cpp',
'appl/main.cpp',
'appl/Windows.cpp',
])
my_module.add_depend('ege')
my_module.add_path(".")
my_module.copy_path("data/*.emf")
my_module.copy_path("data/*.lua")
my_module.add_flag('c++', [
"-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"",
])
# set the package properties:
my_module.set_pkg("SECTION", ["Game"])
my_module.set_pkg("PRIORITY", "optional")
return True

View File

@ -10,10 +10,10 @@ def get_sub_type():
return "SAMPLE" return "SAMPLE"
def get_name(): def get_name():
return "ege-sample-CameraPosition" return "ege-sample-LowPoly"
def get_desc(): def get_desc():
return "ege sample : CameraPisition" return "ege sample : Low poly test"
def get_licence(): def get_licence():
return "MPL-2" return "MPL-2"
@ -32,24 +32,18 @@ def get_version():
def configure(target, my_module): def configure(target, my_module):
my_module.add_extra_flags() my_module.add_extra_flags()
my_module.add_src_file([ my_module.add_src_file([
'appl/debug.cpp', 'appl/debug.cpp',
'appl/main.cpp', 'appl/main.cpp',
'appl/Windows.cpp' 'appl/Windows.cpp',
]) ])
my_module.add_depend('ege') my_module.add_depend('ege')
my_module.add_path(".") my_module.add_path(".")
my_module.copy_path("data/*.emf") my_module.copy_path("data/*.emf")
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_to_string(get_version()) + "\\\"\"",
]) ])
# set the package properties: # set the package properties:
my_module.set_pkg("SECTION", ["Game"]) my_module.set_pkg("SECTION", ["Game"])
my_module.set_pkg("PRIORITY", "optional") my_module.set_pkg("PRIORITY", "optional")