[DEV] add double view scene with single environement
This commit is contained in:
parent
f4074c15a9
commit
fd45ef5f77
@ -151,6 +151,13 @@ namespace ege {
|
||||
* @return A pointer on the camera requested.
|
||||
*/
|
||||
std::shared_ptr<ege::Camera> getCamera(const std::string& _name);
|
||||
/**
|
||||
* @brief Get List of all camera.
|
||||
* @return All the camera registerred.
|
||||
*/
|
||||
std::map<std::string, std::shared_ptr<ege::Camera>> getCameraList() const {
|
||||
return m_listCamera;
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* @brief Remove all from the current environement
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <etk/math/Matrix4.h>
|
||||
#include <ege/Ray.h>
|
||||
#include <ewol/resource/Colored3DObject.h>
|
||||
|
||||
|
||||
namespace ege {
|
||||
@ -166,6 +167,12 @@ namespace ege {
|
||||
* @return x: tetha; y: psy
|
||||
*/
|
||||
vec2 tansformPositionToAngle(vec3 _vect);
|
||||
public:
|
||||
/**
|
||||
* @brief Debug display of the current element
|
||||
* @param[in,out] draw Basic system to draw the debug shape and informations
|
||||
*/
|
||||
virtual void drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) { }
|
||||
|
||||
};
|
||||
};
|
||||
|
@ -87,3 +87,13 @@ ege::Ray ege::camera::View::getRayFromScreen(const vec2& _offset) {
|
||||
EGE_VERBOSE("return ray : " << out);
|
||||
return out;
|
||||
}
|
||||
|
||||
void ege::camera::View::drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) {
|
||||
mat4 mat;
|
||||
mat.identity();
|
||||
vec2 angles = tansformPositionToAngle(-getViewVector());
|
||||
mat.rotate(vec3(1,0,0), -M_PI*0.5f + angles.y());
|
||||
mat.rotate(vec3(0,0,1), angles.x() - M_PI/2.0f);
|
||||
mat.translate(m_eye);
|
||||
_draw->drawSquare(vec3(5,5,5), mat, etk::Color<float>(0.0f, 0.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ namespace ege {
|
||||
virtual vec3 getViewVector() const;
|
||||
public:
|
||||
virtual ege::Ray getRayFromScreen(const vec2& _offset);
|
||||
virtual void drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -101,48 +101,6 @@ const vec3& ege::Element::getPosition() {
|
||||
return emptyPosition;
|
||||
};
|
||||
|
||||
void ege::Element::drawSphere(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw,
|
||||
btScalar _radius,
|
||||
int _lats,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
etk::Color<float>& _tmpColor) {
|
||||
int i, j;
|
||||
std::vector<vec3> EwolVertices;
|
||||
for(i = 0; i <= _lats; i++) {
|
||||
btScalar lat0 = SIMD_PI * (-btScalar(0.5) + (btScalar) (i - 1) / _lats);
|
||||
btScalar z0 = _radius*sin(lat0);
|
||||
btScalar zr0 = _radius*cos(lat0);
|
||||
|
||||
btScalar lat1 = SIMD_PI * (-btScalar(0.5) + (btScalar) i / _lats);
|
||||
btScalar z1 = _radius*sin(lat1);
|
||||
btScalar zr1 = _radius*cos(lat1);
|
||||
|
||||
//glBegin(GL_QUAD_STRIP);
|
||||
for(j = 0; j < _longs; j++) {
|
||||
btScalar lng = 2 * SIMD_PI * (btScalar) (j - 1) / _longs;
|
||||
btScalar x = cos(lng);
|
||||
btScalar y = sin(lng);
|
||||
vec3 v1 = vec3(x * zr1, y * zr1, z1);
|
||||
vec3 v4 = vec3(x * zr0, y * zr0, z0);
|
||||
|
||||
lng = 2 * SIMD_PI * (btScalar) (j) / _longs;
|
||||
x = cos(lng);
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0);
|
||||
|
||||
EwolVertices.push_back(v1);
|
||||
EwolVertices.push_back(v2);
|
||||
EwolVertices.push_back(v3);
|
||||
|
||||
EwolVertices.push_back(v1);
|
||||
EwolVertices.push_back(v3);
|
||||
EwolVertices.push_back(v4);
|
||||
}
|
||||
}
|
||||
_draw->draw(EwolVertices, _tmpColor, _transformationMatrix);
|
||||
}
|
||||
|
||||
const float lifeBorder = 0.1f;
|
||||
const float lifeHeight = 0.3f;
|
||||
|
@ -229,13 +229,6 @@ namespace ege {
|
||||
* @brief remove this element from the physique engine
|
||||
*/
|
||||
virtual void dynamicDisable() {};
|
||||
protected:
|
||||
void drawSphere(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw,
|
||||
btScalar _radius,
|
||||
int _lats,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
etk::Color<float>& _tmpColor);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -192,36 +192,15 @@ void ege::ElementPhysic::drawShape(const btCollisionShape* _shape,
|
||||
EGE_DEBUG(" draw (01): SPHERE_SHAPE_PROXYTYPE");
|
||||
const btSphereShape* sphereShape = static_cast<const btSphereShape*>(_shape);
|
||||
float radius = sphereShape->getMargin();//radius doesn't include the margin, so draw with margin
|
||||
drawSphere(_draw, radius, 10, 10, _transformationMatrix, tmpColor);
|
||||
_draw->drawSphere(radius, 10, 10, _transformationMatrix, tmpColor);
|
||||
break;
|
||||
}
|
||||
case BOX_SHAPE_PROXYTYPE: {
|
||||
// Box collision shape ...
|
||||
EGE_DEBUG(" draw (02): BOX_SHAPE_PROXYTYPE");
|
||||
const btBoxShape* boxShape = static_cast<const btBoxShape*>(_shape);
|
||||
btVector3 halfExtent = boxShape->getHalfExtentsWithMargin();
|
||||
static int indices[36] = { 0,1,2, 3,2,1, 4,0,6,
|
||||
6,0,2, 5,1,4, 4,1,0,
|
||||
7,3,1, 7,1,5, 5,4,7,
|
||||
7,4,6, 7,2,3, 7,6,2};
|
||||
vec3 vertices[8]={ vec3(halfExtent[0],halfExtent[1],halfExtent[2]),
|
||||
vec3(-halfExtent[0],halfExtent[1],halfExtent[2]),
|
||||
vec3(halfExtent[0],-halfExtent[1],halfExtent[2]),
|
||||
vec3(-halfExtent[0],-halfExtent[1],halfExtent[2]),
|
||||
vec3(halfExtent[0],halfExtent[1],-halfExtent[2]),
|
||||
vec3(-halfExtent[0],halfExtent[1],-halfExtent[2]),
|
||||
vec3(halfExtent[0],-halfExtent[1],-halfExtent[2]),
|
||||
vec3(-halfExtent[0],-halfExtent[1],-halfExtent[2])};
|
||||
_tmpVertices.clear();
|
||||
for (int32_t iii=0 ; iii<36 ; iii+=3) {
|
||||
// normal calculation :
|
||||
//btVector3 normal = (vertices[indices[iii+2]]-vertices[indices[iii]]).cross(vertices[indices[iii+1]]-vertices[indices[iii]]);
|
||||
//normal.normalize ();
|
||||
_tmpVertices.push_back(vertices[indices[iii]]);
|
||||
_tmpVertices.push_back(vertices[indices[iii+1]]);
|
||||
_tmpVertices.push_back(vertices[indices[iii+2]]);
|
||||
}
|
||||
_draw->draw(_tmpVertices, tmpColor, _transformationMatrix);
|
||||
vec3 halfExtent = boxShape->getHalfExtentsWithMargin();
|
||||
_draw->drawSquare(halfExtent, _transformationMatrix, tmpColor);
|
||||
break;
|
||||
}
|
||||
case CONE_SHAPE_PROXYTYPE: {
|
||||
|
@ -116,10 +116,18 @@ void ege::widget::Scene::onDraw() {
|
||||
m_displayElementOrdered[iii].element->draw(pass);
|
||||
}
|
||||
}
|
||||
// Draw debug ...
|
||||
// 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, std::shared_ptr<ege::Camera>> listCamera = m_env->getCameraList();
|
||||
for (auto &itCam : listCamera) {
|
||||
if (itCam.second != nullptr) {
|
||||
itCam.second->drawDebug(m_debugDrawProperty, camera);
|
||||
}
|
||||
}
|
||||
// Draw debug ... (User)
|
||||
signalDisplayDebug.emit(m_debugDrawProperty);
|
||||
} else {
|
||||
EGE_WARNING("No Dynamic world ...");
|
||||
|
@ -0,0 +1 @@
|
||||
Camera position sample example
|
251
sample/DoubleView/appl/Windows.cpp
Normal file
251
sample/DoubleView/appl/Windows.cpp
Normal file
@ -0,0 +1,251 @@
|
||||
/**
|
||||
* @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/widget/Sizer.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>
|
||||
#include <ege/physicsShape/PhysicsBox.h>
|
||||
#include <ege/physicsShape/PhysicsSphere.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("viewBoxStar", "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);
|
||||
// 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 (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 : DoubleView");
|
||||
|
||||
//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_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy)));
|
||||
m_env->addCamera("basic", m_camera);
|
||||
// Create basic Camera
|
||||
std::shared_ptr<ege::camera::View> camera2 = std::make_shared<ege::camera::View>(vec3(100,0,0), vec3(0,0,0));
|
||||
m_env->addCamera("front", camera2);
|
||||
// Create basic Camera
|
||||
std::shared_ptr<ege::camera::View> camera3 = std::make_shared<ege::camera::View>(vec3(0,100,0), vec3(0,0,0));
|
||||
m_env->addCamera("left", camera3);
|
||||
|
||||
std::shared_ptr<ewol::widget::Sizer> tmpSizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
|
||||
if (tmpSizerVert == nullptr) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
setSubWidget(tmpSizerVert);
|
||||
std::shared_ptr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create(m_env);
|
||||
if (tmpWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setExpand(bvec2(true,true));
|
||||
tmpWidget->setFill(bvec2(true,true));
|
||||
tmpWidget->setCamera("basic");
|
||||
tmpSizerVert->subWidgetAdd(tmpWidget);
|
||||
tmpWidget->signalDisplayDebug.bind(shared_from_this(), &appl::Windows::onCallbackDisplayDebug);
|
||||
}
|
||||
std::shared_ptr<ewol::widget::Sizer> tmpSizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
|
||||
if (tmpSizerHori == nullptr) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpSizerVert->subWidgetAdd(tmpSizerHori);
|
||||
tmpWidget = ege::widget::Scene::create(m_env);
|
||||
if (tmpWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setExpand(bvec2(true,true));
|
||||
tmpWidget->setFill(bvec2(true,true));
|
||||
tmpWidget->setCamera("front");
|
||||
tmpSizerHori->subWidgetAdd(tmpWidget);
|
||||
tmpWidget->signalDisplayDebug.bind(shared_from_this(), &appl::Windows::onCallbackDisplayDebug);
|
||||
}
|
||||
tmpWidget = ege::widget::Scene::create(m_env);
|
||||
if (tmpWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setExpand(bvec2(true,true));
|
||||
tmpWidget->setFill(bvec2(true,true));
|
||||
tmpWidget->setCamera("left");
|
||||
tmpSizerHori->subWidgetAdd(tmpWidget);
|
||||
tmpWidget->signalDisplayDebug.bind(shared_from_this(), &appl::Windows::onCallbackDisplayDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box :
|
||||
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) {
|
||||
//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);
|
||||
// add physic interface:
|
||||
std::shared_ptr<ege::PhysicsBox> physic = std::make_shared<ege::PhysicsBox>();
|
||||
physic->setSize(vec3(3.2,3.2,3.2));
|
||||
myMesh->addPhysicElement(physic);
|
||||
|
||||
element->setMesh(myMesh);
|
||||
element->createRigidBody(4000000);
|
||||
element->setPosition(vec3(20,10,10));
|
||||
|
||||
m_env->addElement(element);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3);
|
||||
if (myMesh != nullptr) {
|
||||
//element = std::make_shared<ege::ElementBase>(m_env);
|
||||
std::shared_ptr<ege::ElementPhysic> element = std::make_shared<ege::ElementPhysic>(m_env);
|
||||
|
||||
// add physic interface:
|
||||
std::shared_ptr<ege::PhysicsSphere> physic = std::make_shared<ege::PhysicsSphere>();
|
||||
physic->setRadius(4.5f);
|
||||
myMesh->addPhysicElement(physic);
|
||||
|
||||
|
||||
element->setMesh(myMesh);
|
||||
element->createRigidBody(4000000);
|
||||
element->setPosition(vec3(20,-10,10));
|
||||
|
||||
element->iaEnable();
|
||||
|
||||
m_env->addElement(element);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
static float ploppp=1;
|
||||
if (_event.getId() == 1) {
|
||||
vec2 pos = relativePosition(_event.getPos());
|
||||
// thsi is to simplify example ...
|
||||
pos *= vec2(1.0f, 2.0f);
|
||||
ege::Ray ray = m_camera->getRayFromScreenPosition(pos, m_size);
|
||||
m_ray = ray;
|
||||
APPL_DEBUG("pos=" << pos << " ray = " << ray);
|
||||
m_destination = ray.testRay(m_env->getPhysicEngine());
|
||||
std::pair<std::shared_ptr<ege::Element>, std::pair<vec3,vec3>> result = ray.testRayObject(m_env->getPhysicEngine());
|
||||
if (result.first != nullptr) {
|
||||
APPL_INFO("Select Object :" << result.first->getUID());
|
||||
}
|
||||
return true;
|
||||
} else if (_event.getId() == 4) {
|
||||
ploppp += 0.2f;
|
||||
m_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy))*ploppp);
|
||||
} else if (_event.getId() == 5) {
|
||||
ploppp -= 0.2f;
|
||||
if (ploppp == 0) {
|
||||
ploppp = 1.0f;
|
||||
}
|
||||
m_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy))*ploppp);
|
||||
} else if (_event.getId() == 3) {
|
||||
if (_event.getStatus() == ewol::key::statusDown) {
|
||||
m_oldScreenPos = relativePosition(_event.getPos());
|
||||
return true;
|
||||
} else if (_event.getStatus() == ewol::key::statusMove) {
|
||||
vec2 pos = relativePosition(_event.getPos());
|
||||
m_angleTetha -= (m_oldScreenPos.x()-pos.x())*0.05f;
|
||||
m_anglePsy += (m_oldScreenPos.y()-pos.y())*0.05f;
|
||||
m_camera->setEye(vec3(100*std::sin(m_angleTetha),100*std::cos(m_angleTetha),40*std::cos(m_anglePsy))*ploppp);
|
||||
m_oldScreenPos = relativePosition(_event.getPos());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void appl::Windows::onCallbackDisplayDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _obj) {
|
||||
mat4 mat;
|
||||
mat.identity();
|
||||
// Display ray line
|
||||
if (true) {
|
||||
static std::vector<vec3> vertices;
|
||||
if (m_ray.getOrigin() != vec3(0,0,0)) {
|
||||
vertices.push_back(m_ray.getOrigin());
|
||||
vertices.push_back(m_ray.getOrigin()+m_ray.getDirection()*50);
|
||||
// prevent Ray removing with empty
|
||||
m_ray.setOrigin(vec3(0,0,0));
|
||||
}
|
||||
if (vertices.size() > 250) {
|
||||
vertices.erase(vertices.begin(), vertices.begin()+vertices.size()-250);
|
||||
}
|
||||
_obj->drawLine(vertices, etk::Color<float>(0.0, 1.0, 0.0, 0.8), mat);
|
||||
}
|
||||
// display normal impact line
|
||||
if (true) {
|
||||
static std::vector<vec3> vertices;
|
||||
if (m_destination.second != vec3(0,0,0)) {
|
||||
vertices.push_back(m_destination.first);
|
||||
vertices.push_back(m_destination.first + m_destination.second*20);
|
||||
m_destination.second = vec3(0,0,0);
|
||||
}
|
||||
if (vertices.size() > 250) {
|
||||
vertices.erase(vertices.begin(), vertices.begin()+vertices.size()-250);
|
||||
}
|
||||
_obj->drawLine(vertices, etk::Color<float>(1.0, 0.0, 0.0, 0.8), mat);
|
||||
}
|
||||
}
|
||||
|
40
sample/DoubleView/appl/Windows.h
Normal file
40
sample/DoubleView/appl/Windows.h
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @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>
|
||||
#include <ewol/resource/Colored3DObject.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:
|
||||
bool onEventInput(const ewol::event::Input& _event);
|
||||
void onCallbackDisplayDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _obj);
|
||||
ege::Ray m_ray;
|
||||
float m_angleTetha;
|
||||
float m_anglePsy;
|
||||
vec2 m_oldScreenPos;
|
||||
std::pair<vec3,vec3> m_destination;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
15
sample/DoubleView/appl/debug.cpp
Normal file
15
sample/DoubleView/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/DoubleView/appl/debug.h
Normal file
52
sample/DoubleView/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/DoubleView/appl/main.cpp
Normal file
57
sample/DoubleView/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/DoubleView/appl/main.h
Normal file
14
sample/DoubleView/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
|
||||
|
40
sample/DoubleView/lutin_egeDoubleView.py
Normal file
40
sample/DoubleView/lutin_egeDoubleView.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 : DoubleView"
|
||||
|
||||
def create(target):
|
||||
# module name is 'edn' and type binary.
|
||||
myModule = module.Module(__file__, 'egeDoubleView', '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 : DoubleView")
|
||||
myModule.pkg_set("NAME", "egeDoubleView")
|
||||
|
||||
# add the currrent module at the
|
||||
return myModule
|
||||
|
Loading…
x
Reference in New Issue
Block a user