[DEV] add cubecreator and ray application (not ended)
This commit is contained in:
parent
fd643dea6b
commit
9913bf8b28
@ -540,8 +540,8 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName, const vec3&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode();
|
ewol::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode();
|
||||||
if ( tmpRenderMode != ewol::openGL::renderQuad
|
if ( tmpRenderMode == ewol::openGL::renderQuad
|
||||||
|| tmpRenderMode != ewol::openGL::renderQuadStrip) {
|
|| tmpRenderMode == ewol::openGL::renderQuadStrip) {
|
||||||
EGE_TODO("Create quad interface ...");
|
EGE_TODO("Create quad interface ...");
|
||||||
} else if ( tmpRenderMode == ewol::openGL::renderTriangle
|
} else if ( tmpRenderMode == ewol::openGL::renderTriangle
|
||||||
|| tmpRenderMode == ewol::openGL::renderLineStrip
|
|| tmpRenderMode == ewol::openGL::renderLineStrip
|
||||||
|
@ -34,6 +34,7 @@ namespace ege {
|
|||||||
class Mesh : public ewol::Resource {
|
class Mesh : public ewol::Resource {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<ege::resource::Mesh> createGrid(int32_t _lineCount, const vec3& _position=vec3(0,0,0), float _size=1.0f, const std::string& _materialName="basics");
|
static std::shared_ptr<ege::resource::Mesh> createGrid(int32_t _lineCount, const vec3& _position=vec3(0,0,0), float _size=1.0f, const std::string& _materialName="basics");
|
||||||
|
static std::shared_ptr<ege::resource::Mesh> createCube(float _size=1.0f, const std::string& _materialName="basics", const etk::Color<float>& _color=etk::color::white);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @not-in-doc
|
* @not-in-doc
|
||||||
|
36
ege/resource/MeshCube.cpp
Normal file
36
ege/resource/MeshCube.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ege/debug.h>
|
||||||
|
#include <ege/resource/Mesh.h>
|
||||||
|
|
||||||
|
std::shared_ptr<ege::resource::Mesh> ege::resource::Mesh::createCube(float _size, const std::string& _materialName, const etk::Color<float>& _color) {
|
||||||
|
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||||
|
if (out != nullptr) {
|
||||||
|
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>();
|
||||||
|
// set the element 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);
|
||||||
|
material->setRenderMode(ewol::openGL::renderTriangle);
|
||||||
|
out->addMaterial(_materialName, material);
|
||||||
|
|
||||||
|
out->addFaceIndexing(_materialName);
|
||||||
|
|
||||||
|
out->addQuad(_materialName, vec3(-1,-1,-1)*_size, vec3(-1, 1,-1)*_size, vec3( 1, 1,-1)*_size, vec3( 1,-1,-1)*_size, _color);
|
||||||
|
out->addQuad(_materialName, vec3(-1,-1, 1)*_size, vec3(-1, 1, 1)*_size, vec3( 1, 1, 1)*_size, vec3( 1,-1, 1)*_size, _color);
|
||||||
|
out->addQuad(_materialName, vec3(-1,-1,-1)*_size, vec3(-1,-1, 1)*_size, vec3(-1, 1, 1)*_size, vec3(-1, 1,-1)*_size, _color);
|
||||||
|
out->addQuad(_materialName, vec3( 1,-1,-1)*_size, vec3( 1,-1, 1)*_size, vec3( 1, 1, 1)*_size, vec3( 1, 1,-1)*_size, _color);
|
||||||
|
out->addQuad(_materialName, vec3(-1,-1,-1)*_size, vec3(-1,-1, 1)*_size, vec3( 1,-1, 1)*_size, vec3( 1,-1,-1)*_size, _color);
|
||||||
|
out->addQuad(_materialName, vec3(-1, 1,-1)*_size, vec3(-1, 1, 1)*_size, vec3( 1, 1, 1)*_size, vec3( 1, 1,-1)*_size, _color);
|
||||||
|
// generate the VBO
|
||||||
|
out->generateVBO();
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
std::shared_ptr<ege::resource::Mesh> ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const std::string& _materialName) {
|
std::shared_ptr<ege::resource::Mesh> ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const std::string& _materialName) {
|
||||||
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||||
float lineSize = 0.1f;
|
|
||||||
if (out != nullptr) {
|
if (out != nullptr) {
|
||||||
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>();
|
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>();
|
||||||
// set the element material properties :
|
// set the element material properties :
|
||||||
|
@ -32,6 +32,7 @@ def create(target):
|
|||||||
'ege/resource/Mesh.cpp',
|
'ege/resource/Mesh.cpp',
|
||||||
'ege/resource/MeshEmf.cpp',
|
'ege/resource/MeshEmf.cpp',
|
||||||
'ege/resource/MeshGird.cpp',
|
'ege/resource/MeshGird.cpp',
|
||||||
|
'ege/resource/MeshCube.cpp',
|
||||||
'ege/resource/MeshObj.cpp',
|
'ege/resource/MeshObj.cpp',
|
||||||
'ege/resource/ParticuleMesh.cpp',
|
'ege/resource/ParticuleMesh.cpp',
|
||||||
'ege/resource/tools/icoSphere.cpp',
|
'ege/resource/tools/icoSphere.cpp',
|
||||||
|
@ -24,15 +24,63 @@ appl::Windows::Windows() {
|
|||||||
addObjectType("appl::Windows");
|
addObjectType("appl::Windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||||
|
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog");
|
||||||
|
if (out != nullptr) {
|
||||||
|
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>();
|
||||||
|
// set the element 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);
|
||||||
|
material->setTexture0(""); //"
|
||||||
|
out->addMaterial("basics", material);
|
||||||
|
// 1024 == > 1<<9
|
||||||
|
// 2048 == > 1<<10
|
||||||
|
// 4096 == > 1<<11
|
||||||
|
int32_t size = 1<<11;
|
||||||
|
material->setImageSize(ivec2(size,size));
|
||||||
|
egami::Image* myImage = material->get();
|
||||||
|
if (nullptr == myImage) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<ege::resource::Mesh> createMars() {
|
||||||
|
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---");
|
||||||
|
if (out != nullptr) {
|
||||||
|
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>();
|
||||||
|
material->setAmbientFactor(vec4(0.112f,0.112f,0.112f,1.0f));
|
||||||
|
material->setDiffuseFactor(vec4(0.512f,0.512f,0.512f,1.0f));
|
||||||
|
material->setSpecularFactor(vec4(0.5f,0.5f,0.5f,1.0f));
|
||||||
|
material->setShininess(96.078431f);
|
||||||
|
material->setTexture0("DATA:texture_mars.png");
|
||||||
|
out->addMaterial("basics", material);
|
||||||
|
out->createIcoSphere("basics", 16, 3);
|
||||||
|
out->generateVBO();
|
||||||
|
//m_env->addStaticMeshToDraw(myMesh);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
void appl::Windows::init() {
|
void appl::Windows::init() {
|
||||||
ewol::widget::Windows::init();
|
ewol::widget::Windows::init();
|
||||||
setTitle("example ege : MeshCreator");
|
setTitle("example ege : MeshCreator");
|
||||||
|
|
||||||
getObjectManager().periodicCall.bind(shared_from_this(), &appl::Windows::onCallbackPeriodicUpdateCamera);
|
//getObjectManager().periodicCall.bind(shared_from_this(), &appl::Windows::onCallbackPeriodicUpdateCamera);
|
||||||
|
|
||||||
m_env = ege::Environement::create();
|
m_env = ege::Environement::create();
|
||||||
// Create basic Camera
|
// Create basic Camera
|
||||||
@ -49,73 +97,33 @@ void appl::Windows::init() {
|
|||||||
setSubWidget(tmpWidget);
|
setSubWidget(tmpWidget);
|
||||||
}
|
}
|
||||||
// Create an external box :
|
// Create an external box :
|
||||||
std::shared_ptr<ege::resource::Mesh> myMesh = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog");
|
std::shared_ptr<ege::resource::Mesh> myMesh = createViewBoxStar();
|
||||||
if (myMesh != nullptr) {
|
if (myMesh != nullptr) {
|
||||||
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>();
|
|
||||||
// set the element 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);
|
|
||||||
material->setTexture0(""); //"
|
|
||||||
myMesh->addMaterial("basics", material);
|
|
||||||
// 1024 == > 1<<9
|
|
||||||
// 2048 == > 1<<10
|
|
||||||
// 4096 == > 1<<11
|
|
||||||
int32_t size = 1<<11;
|
|
||||||
material->setImageSize(ivec2(size,size));
|
|
||||||
egami::Image* myImage = material->get();
|
|
||||||
if (nullptr == myImage) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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 :
|
|
||||||
myMesh->createViewBox("basics", 1000/* distance */);
|
|
||||||
// generate the VBO
|
|
||||||
myMesh->generateVBO();
|
|
||||||
m_env->addStaticMeshToDraw(myMesh);
|
m_env->addStaticMeshToDraw(myMesh);
|
||||||
}
|
}
|
||||||
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
myMesh = createGrid(10, vec3(0,0,0), 5);
|
||||||
if (myMesh != nullptr) {
|
if (myMesh != nullptr) {
|
||||||
m_env->addStaticMeshToDraw(myMesh);
|
m_env->addStaticMeshToDraw(myMesh);
|
||||||
}
|
}
|
||||||
if (true) {
|
if (true) {
|
||||||
myMesh = ege::resource::Mesh::create("---");
|
myMesh = ege::resource::Mesh::create("---");
|
||||||
if (myMesh != nullptr) {
|
if (myMesh != nullptr) {
|
||||||
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>();
|
|
||||||
material->setAmbientFactor(vec4(0.112f,0.112f,0.112f,1.0f));
|
|
||||||
material->setDiffuseFactor(vec4(0.512f,0.512f,0.512f,1.0f));
|
|
||||||
material->setSpecularFactor(vec4(0.5f,0.5f,0.5f,1.0f));
|
|
||||||
material->setShininess(96.078431f);
|
|
||||||
material->setTexture0("DATA:texture_mars.png");
|
|
||||||
myMesh->addMaterial("basics", material);
|
|
||||||
myMesh->createIcoSphere("basics", 16, 3);
|
|
||||||
myMesh->generateVBO();
|
|
||||||
std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env);
|
std::shared_ptr<ege::ElementBase> element = std::make_shared<ege::ElementBase>(m_env);
|
||||||
//std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
//std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||||
element->setPosition(vec3(50,0,0));
|
element->setPosition(vec3(50,0,0));
|
||||||
element->setMesh(myMesh);
|
element->setMesh(myMesh);
|
||||||
m_env->addElement(element);
|
m_env->addElement(element);
|
||||||
//m_env->addStaticMeshToDraw(myMesh);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appl::Windows::onCallbackPeriodicUpdateCamera(const ewol::event::Time& _event) {
|
void appl::Windows::onCallbackPeriodicUpdateCamera(const ewol::event::Time& _event) {
|
||||||
/*
|
|
||||||
static float offset = 0;
|
static float offset = 0;
|
||||||
offset += 0.01;
|
offset += 0.01;
|
||||||
static float offset2 = 0;
|
static float offset2 = 0;
|
||||||
offset2 += 0.003;
|
offset2 += 0.003;
|
||||||
m_camera->setEye(vec3(100*std::sin(offset),100*std::cos(offset),40*std::cos(offset2))+vec3(50,0,0));
|
m_camera->setEye(vec3(100*std::sin(offset),100*std::cos(offset),40*std::cos(offset2))+vec3(50,0,0));
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1
sample/RayTest/README.md
Normal file
1
sample/RayTest/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Camera position sample example
|
109
sample/RayTest/appl/Windows.cpp
Normal file
109
sample/RayTest/appl/Windows.cpp
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE-2 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/ewol.h>
|
||||||
|
#include <appl/debug.h>
|
||||||
|
#include <appl/Windows.h>
|
||||||
|
#include <ewol/widget/Label.h>
|
||||||
|
#include <ewol/object/Manager.h>
|
||||||
|
#include <ege/widget/Scene.h>
|
||||||
|
#include <ege/camera/View.h>
|
||||||
|
#include <etk/tool.h>
|
||||||
|
#include <ege/elements/ElementBase.h>
|
||||||
|
#include <ege/elements/ElementPhysic.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "Windows"
|
||||||
|
|
||||||
|
appl::Windows::Windows() {
|
||||||
|
addObjectType("appl::Windows");
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<ege::resource::Mesh> createViewBoxStar() {
|
||||||
|
std::shared_ptr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog");
|
||||||
|
if (out != nullptr) {
|
||||||
|
std::shared_ptr<ege::Material> material = std::make_shared<ege::Material>();
|
||||||
|
// set the element 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);
|
||||||
|
material->setTexture0(""); //"
|
||||||
|
out->addMaterial("basics", material);
|
||||||
|
// 1024 == > 1<<9
|
||||||
|
// 2048 == > 1<<10
|
||||||
|
// 4096 == > 1<<11
|
||||||
|
int32_t size = 1<<11;
|
||||||
|
material->setImageSize(ivec2(size,size));
|
||||||
|
egami::Image* myImage = material->get();
|
||||||
|
if (nullptr == myImage) {
|
||||||
|
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();
|
||||||
|
setTitle("example ege : RayTest");
|
||||||
|
|
||||||
|
getObjectManager().periodicCall.bind(shared_from_this(), &appl::Windows::onCallbackPeriodicUpdateCamera);
|
||||||
|
|
||||||
|
m_env = ege::Environement::create();
|
||||||
|
// Create basic Camera
|
||||||
|
m_camera = std::make_shared<ege::camera::View>(vec3(30,30,-100), vec3(0,0,0));
|
||||||
|
m_env->addCamera("basic", m_camera);
|
||||||
|
|
||||||
|
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create(m_env);
|
||||||
|
if (tmpWidget == nullptr) {
|
||||||
|
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
|
} else {
|
||||||
|
tmpWidget->setExpand(bvec2(true,true));
|
||||||
|
tmpWidget->setFill(bvec2(true,true));
|
||||||
|
tmpWidget->setCamera("basic");
|
||||||
|
setSubWidget(tmpWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create an external box :
|
||||||
|
std::shared_ptr<ege::resource::Mesh> myMesh = createViewBoxStar();
|
||||||
|
if (myMesh != nullptr) {
|
||||||
|
m_env->addStaticMeshToDraw(myMesh);
|
||||||
|
}
|
||||||
|
// create basic gird:
|
||||||
|
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
||||||
|
if (myMesh != nullptr) {
|
||||||
|
m_env->addStaticMeshToDraw(myMesh);
|
||||||
|
}
|
||||||
|
myMesh = ege::resource::Mesh::createCube(3);
|
||||||
|
if (myMesh != nullptr) {
|
||||||
|
m_env->addStaticMeshToDraw(myMesh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void appl::Windows::onCallbackPeriodicUpdateCamera(const ewol::event::Time& _event) {
|
||||||
|
static float offset = 0;
|
||||||
|
offset += 0.01;
|
||||||
|
static float offset2 = 0;
|
||||||
|
offset2 += 0.003;
|
||||||
|
m_camera->setEye(vec3(100*std::sin(offset),100*std::cos(offset),40*std::cos(offset2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
33
sample/RayTest/appl/Windows.h
Normal file
33
sample/RayTest/appl/Windows.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE-2 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __APPL_WINDOWS_H__
|
||||||
|
#define __APPL_WINDOWS_H__
|
||||||
|
|
||||||
|
#include <ewol/widget/Windows.h>
|
||||||
|
#include <ege/Environement.h>
|
||||||
|
#include <ege/camera/View.h>
|
||||||
|
|
||||||
|
namespace appl {
|
||||||
|
class Windows : public ewol::widget::Windows {
|
||||||
|
private:
|
||||||
|
std::shared_ptr<ege::Environement> m_env;
|
||||||
|
std::shared_ptr<ege::camera::View> m_camera;
|
||||||
|
protected:
|
||||||
|
Windows();
|
||||||
|
void init();
|
||||||
|
public:
|
||||||
|
DECLARE_FACTORY(Windows);
|
||||||
|
virtual ~Windows() { };
|
||||||
|
private:
|
||||||
|
void onCallbackPeriodicUpdateCamera(const ewol::event::Time& _event);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
15
sample/RayTest/appl/debug.cpp
Normal file
15
sample/RayTest/appl/debug.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE-2 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <appl/debug.h>
|
||||||
|
|
||||||
|
int32_t appl::getLogId() {
|
||||||
|
static int32_t g_val = etk::log::registerInstance("GP-spaceShip");
|
||||||
|
return g_val;
|
||||||
|
}
|
52
sample/RayTest/appl/debug.h
Normal file
52
sample/RayTest/appl/debug.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE-2 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __APPL_DEBUG_H__
|
||||||
|
#define __APPL_DEBUG_H__
|
||||||
|
|
||||||
|
#include <etk/log.h>
|
||||||
|
|
||||||
|
namespace appl {
|
||||||
|
int32_t getLogId();
|
||||||
|
};
|
||||||
|
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
||||||
|
#define APPL_BASE(info,data) \
|
||||||
|
do { \
|
||||||
|
if (info <= etk::log::getLevel(appl::getLogId())) { \
|
||||||
|
std::stringbuf sb; \
|
||||||
|
std::ostream tmpStream(&sb); \
|
||||||
|
tmpStream << data; \
|
||||||
|
etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#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)
|
||||||
|
|
||||||
|
#endif
|
57
sample/RayTest/appl/main.cpp
Normal file
57
sample/RayTest/appl/main.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE-2 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <ewol/ewol.h>
|
||||||
|
#include <ewol/context/commandLine.h>
|
||||||
|
|
||||||
|
#include <appl/debug.h>
|
||||||
|
#include <appl/Windows.h>
|
||||||
|
#include <ewol/object/Object.h>
|
||||||
|
#include <ewol/widget/Manager.h>
|
||||||
|
#include <ewol/context/Context.h>
|
||||||
|
|
||||||
|
|
||||||
|
class MainApplication : public ewol::context::Application {
|
||||||
|
public:
|
||||||
|
bool init(ewol::Context& _context, size_t _initId) {
|
||||||
|
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
|
||||||
|
// create the specific windows
|
||||||
|
_context.setWindows(basicWindows);
|
||||||
|
APPL_INFO("==> Init APPL (END)");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void unInit(ewol::Context& _context) {
|
||||||
|
APPL_INFO("==> Un-Init APPL (START)");
|
||||||
|
// nothing to do ...
|
||||||
|
APPL_INFO("==> Un-Init APPL (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[]) {
|
||||||
|
// second possibility
|
||||||
|
return ewol::run(new MainApplication(), _argc, _argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
14
sample/RayTest/appl/main.h
Normal file
14
sample/RayTest/appl/main.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE-2 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __APPL_MAIN_H__
|
||||||
|
#define __APPL_MAIN_H__
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
BIN
sample/RayTest/data/texture_mars.png
Normal file
BIN
sample/RayTest/data/texture_mars.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 938 KiB |
40
sample/RayTest/lutin_egeRayTest.py
Normal file
40
sample/RayTest/lutin_egeRayTest.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import lutinModule as module
|
||||||
|
import lutinTools as tools
|
||||||
|
import lutinDebug as debug
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
|
def get_desc():
|
||||||
|
return "ege sample : RayTest"
|
||||||
|
|
||||||
|
def create(target):
|
||||||
|
# module name is 'edn' and type binary.
|
||||||
|
myModule = module.Module(__file__, 'egeRayTest', 'PACKAGE')
|
||||||
|
|
||||||
|
myModule.add_src_file([
|
||||||
|
'appl/debug.cpp',
|
||||||
|
'appl/main.cpp',
|
||||||
|
'appl/Windows.cpp'
|
||||||
|
])
|
||||||
|
|
||||||
|
myModule.add_module_depend('ege')
|
||||||
|
|
||||||
|
myModule.add_path(tools.get_current_path(__file__))
|
||||||
|
|
||||||
|
myModule.copy_folder("data/*")
|
||||||
|
|
||||||
|
# set the package properties :
|
||||||
|
myModule.pkg_set("VERSION", "0.0.0")
|
||||||
|
myModule.pkg_set("VERSION_CODE", "0")
|
||||||
|
myModule.pkg_set("COMPAGNY_TYPE", "org")
|
||||||
|
myModule.pkg_set("COMPAGNY_NAME", "ege")
|
||||||
|
myModule.pkg_set("MAINTAINER", ["noOne <no.one@noreplay.com>"])
|
||||||
|
myModule.pkg_set("SECTION", ["Game"])
|
||||||
|
myModule.pkg_set("PRIORITY", "optional")
|
||||||
|
myModule.pkg_set("DESCRIPTION", "ege sample : Ray test")
|
||||||
|
myModule.pkg_set("NAME", "egeRayTest")
|
||||||
|
|
||||||
|
# add the currrent module at the
|
||||||
|
return myModule
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user