[DEV] update gale

This commit is contained in:
Edouard DUPIN 2015-08-23 21:42:48 +02:00
parent 9055235cf7
commit 835c7f5134
24 changed files with 137 additions and 142 deletions

View File

@ -11,7 +11,7 @@
#include <ege/elements/Element.h> #include <ege/elements/Element.h>
#include <ewol/object/Manager.h> #include <ewol/object/Manager.h>
#include <ewol/openGL/openGL.h> #include <gale/renderer/openGL/openGL.h>
#include <etk/math/Matrix4.h> #include <etk/math/Matrix4.h>
#include <BulletDynamics/Dynamics/btRigidBody.h> #include <BulletDynamics/Dynamics/btRigidBody.h>
#include <LinearMath/btDefaultMotionState.h> #include <LinearMath/btDefaultMotionState.h>

View File

@ -27,7 +27,7 @@ ege::Light::~Light() {
} }
void ege::Light::link(const std::shared_ptr<ewol::resource::Program>& _prog, const std::string& _baseName) { void ege::Light::link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName) {
if (nullptr == _prog) { if (nullptr == _prog) {
return; return;
} }
@ -38,7 +38,7 @@ void ege::Light::link(const std::shared_ptr<ewol::resource::Program>& _prog, con
m_GL_specularColor = _prog->getUniform(_baseName+".specularColor"); m_GL_specularColor = _prog->getUniform(_baseName+".specularColor");
} }
void ege::Light::draw(const std::shared_ptr<ewol::resource::Program>& _prog) { void ege::Light::draw(const std::shared_ptr<gale::resource::Program>& _prog) {
_prog->uniform3(m_GL_direction, m_direction); _prog->uniform3(m_GL_direction, m_direction);
_prog->uniform3(m_GL_halfplane, m_halfplane); _prog->uniform3(m_GL_halfplane, m_halfplane);
_prog->uniform4(m_GL_ambientColor, m_ambientColor); _prog->uniform4(m_GL_ambientColor, m_ambientColor);

View File

@ -12,7 +12,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <etk/math/Vector3D.h> #include <etk/math/Vector3D.h>
#include <etk/math/Vector4D.h> #include <etk/math/Vector4D.h>
#include <ewol/resource/Program.h> #include <gale/resource/Program.h>
namespace ege { namespace ege {
class Light { class Light {
@ -33,8 +33,8 @@ namespace ege {
public: public:
Light(); Light();
~Light(); ~Light();
void link(const std::shared_ptr<ewol::resource::Program>& _prog, const std::string& _baseName); void link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName);
void draw(const std::shared_ptr<ewol::resource::Program>& _prog); void draw(const std::shared_ptr<gale::resource::Program>& _prog);
void setDirection(const vec3& val) { void setDirection(const vec3& val) {
m_direction = val; m_direction = val;
} }

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file) * @license BSD v3 (see license file)
*/ */
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#include <ege/Material.h> #include <ege/Material.h>
#include <ege/debug.h> #include <ege/debug.h>
@ -19,7 +19,7 @@ ege::MaterialGlId::MaterialGlId() :
// nothing to do else ... // nothing to do else ...
} }
void ege::MaterialGlId::link(const std::shared_ptr<ewol::resource::Program>& _prog, const std::string& _baseName) { void ege::MaterialGlId::link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName) {
if (nullptr == _prog) { if (nullptr == _prog) {
return; return;
} }
@ -35,7 +35,7 @@ ege::Material::Material() :
m_diffuseFactor(0,0,0,1), m_diffuseFactor(0,0,0,1),
m_specularFactor(0,0,0,1), m_specularFactor(0,0,0,1),
m_shininess(1), m_shininess(1),
m_renderMode(ewol::openGL::renderTriangle), m_renderMode(gale::openGL::render_triangle),
m_texture0(nullptr) { m_texture0(nullptr) {
// nothing to do else ... // nothing to do else ...
} }
@ -44,7 +44,7 @@ ege::Material::~Material() {
} }
void ege::Material::draw(const std::shared_ptr<ewol::resource::Program>& _prog, const MaterialGlId& _glID) { void ege::Material::draw(const std::shared_ptr<gale::resource::Program>& _prog, const MaterialGlId& _glID) {
_prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor); _prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor); _prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
_prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor); _prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor);
@ -100,45 +100,45 @@ void ege::Material::setTexture0Magic(const ivec2& _size) {
} }
} }
int32_t ege::Material::getRenderModeOpenGl() { enum gale::openGL::renderMode ege::Material::getRenderModeOpenGl() {
return static_cast<int32_t>(m_renderMode); return m_renderMode;
} }
void ege::Material::setRenderMode(enum ewol::openGL::renderMode _val) { void ege::Material::setRenderMode(enum gale::openGL::renderMode _val) {
switch (_val) { switch (_val) {
case ewol::openGL::renderPoint: case gale::openGL::render_point:
break; break;
case ewol::openGL::renderLine: case gale::openGL::render_line:
break; break;
case ewol::openGL::renderLineStrip: case gale::openGL::render_lineStrip:
EGE_INFO("Does not support " << _val << " auto convert it in 'LINE'"); EGE_INFO("Does not support " << _val << " auto convert it in 'LINE'");
_val = ewol::openGL::renderLine; _val = gale::openGL::render_line;
break; break;
case ewol::openGL::renderLineLoop: case gale::openGL::render_lineLoop:
EGE_INFO("Does not support " << _val << " auto convert it in 'LINE'"); EGE_INFO("Does not support " << _val << " auto convert it in 'LINE'");
_val = ewol::openGL::renderLine; _val = gale::openGL::render_line;
break; break;
case ewol::openGL::renderTriangle: case gale::openGL::render_triangle:
break; break;
case ewol::openGL::renderTriangleStrip: case gale::openGL::render_triangleStrip:
EGE_INFO("Does not support " << _val << " auto convert it in 'TRIANGLE'"); EGE_INFO("Does not support " << _val << " auto convert it in 'TRIANGLE'");
_val = ewol::openGL::renderTriangle; _val = gale::openGL::render_triangle;
break; break;
case ewol::openGL::renderTriangleFan: case gale::openGL::render_triangleFan:
EGE_INFO("Does not support " << _val << " auto convert it in 'TRIANGLE'"); EGE_INFO("Does not support " << _val << " auto convert it in 'TRIANGLE'");
_val = ewol::openGL::renderTriangle; _val = gale::openGL::render_triangle;
break; break;
case ewol::openGL::renderQuad: case gale::openGL::render_quad:
EGE_INFO("Does not support " << _val << " auto convert it in 'TRIANGLE'"); EGE_INFO("Does not support " << _val << " auto convert it in 'TRIANGLE'");
_val = ewol::openGL::renderTriangle; _val = gale::openGL::render_triangle;
break; break;
case ewol::openGL::renderQuadStrip: case gale::openGL::render_quadStrip:
EGE_INFO("Does not support " << _val << " auto convert it in 'TRIANGLE'"); EGE_INFO("Does not support " << _val << " auto convert it in 'TRIANGLE'");
_val = ewol::openGL::renderTriangle; _val = gale::openGL::render_triangle;
break; break;
case ewol::openGL::renderPolygon: case gale::openGL::render_polygon:
EGE_ERROR("Does not support " << _val << " try convert it in 'TRIANGLE'"); EGE_ERROR("Does not support " << _val << " try convert it in 'TRIANGLE'");
_val = ewol::openGL::renderTriangle; _val = gale::openGL::render_triangle;
break; break;
} }
m_renderMode = _val; m_renderMode = _val;

View File

@ -12,7 +12,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <etk/math/Vector3D.h> #include <etk/math/Vector3D.h>
#include <etk/math/Vector4D.h> #include <etk/math/Vector4D.h>
#include <ewol/resource/Program.h> #include <gale/resource/Program.h>
#include <ewol/resource/Image.h> #include <ewol/resource/Image.h>
namespace ege { namespace ege {
@ -28,7 +28,7 @@ namespace ege {
int32_t m_GL_shininess; int32_t m_GL_shininess;
int32_t m_GL_texture0; int32_t m_GL_texture0;
MaterialGlId(); MaterialGlId();
void link(const std::shared_ptr<ewol::resource::Program>& _prog, const std::string& _baseName); void link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName);
}; };
@ -39,14 +39,14 @@ namespace ege {
vec4 m_diffuseFactor; vec4 m_diffuseFactor;
vec4 m_specularFactor; vec4 m_specularFactor;
float m_shininess; float m_shininess;
enum ewol::openGL::renderMode m_renderMode; // Select Render mode (triangle/Line/point ...) enum gale::openGL::renderMode m_renderMode; // Select Render mode (triangle/Line/point ...)
std::shared_ptr<ewol::resource::Texture> m_texture0; std::shared_ptr<ewol::resource::Texture> m_texture0;
public: public:
std::vector<uint32_t> m_listIndexFaces; std::vector<uint32_t> m_listIndexFaces;
public: public:
Material(); Material();
~Material(); ~Material();
void draw(const std::shared_ptr<ewol::resource::Program>& _prog, const ege::MaterialGlId& _glID); void draw(const std::shared_ptr<gale::resource::Program>& _prog, const ege::MaterialGlId& _glID);
void setAmbientFactor(const vec4& _val) { void setAmbientFactor(const vec4& _val) {
m_ambientFactor = _val; m_ambientFactor = _val;
} }
@ -59,9 +59,9 @@ namespace ege {
void setShininess(float _val) { void setShininess(float _val) {
m_shininess = _val; m_shininess = _val;
} }
void setRenderMode(enum ewol::openGL::renderMode _val); void setRenderMode(enum gale::openGL::renderMode _val);
int32_t getRenderModeOpenGl(); enum gale::openGL::renderMode getRenderModeOpenGl();
enum ewol::openGL::renderMode getRenderMode() { enum gale::openGL::renderMode getRenderMode() {
return m_renderMode; return m_renderMode;
} }
void setTexture0(const std::string& _filename); void setTexture0(const std::string& _filename);

View File

@ -10,7 +10,7 @@
#include <ege/camera/Camera.h> #include <ege/camera/Camera.h>
#include <ege/debug.h> #include <ege/debug.h>
#include <ewol/openGL/openGL.h> #include <gale/renderer/openGL/openGL.h>
#undef __class__ #undef __class__
#define __class__ "Camera" #define __class__ "Camera"
@ -62,8 +62,8 @@ void ege::Camera::updateProjectionMatrix() {
} }
void ege::Camera::configureOpenGL() { void ege::Camera::configureOpenGL() {
ewol::openGL::setCameraMatrix(getMatrixCamera()); gale::openGL::setCameraMatrix(getMatrixCamera());
ewol::openGL::setMatrix(getMatrixProjection()); gale::openGL::setMatrix(getMatrixProjection());
} }

View File

@ -15,7 +15,7 @@
#include <vector> #include <vector>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <ewol/openGL/openGL.h> #include <gale/renderer/openGL/openGL.h>
#include <ewol/resource/Colored3DObject.h> #include <ewol/resource/Colored3DObject.h>
#include <ege/resource/Mesh.h> #include <ege/resource/Mesh.h>
#include <ege/camera/Camera.h> #include <ege/camera/Camera.h>

View File

@ -15,7 +15,7 @@
#include <vector> #include <vector>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <ewol/openGL/openGL.h> #include <gale/renderer/openGL/openGL.h>
#include <ewol/resource/Colored3DObject.h> #include <ewol/resource/Colored3DObject.h>
#include <ege/resource/Mesh.h> #include <ege/resource/Mesh.h>
#include <ege/camera/Camera.h> #include <ege/camera/Camera.h>

View File

@ -10,7 +10,7 @@
#include <ege/debug.h> #include <ege/debug.h>
#include <ewol/openGL/openGL.h> #include <gale/renderer/openGL/openGL.h>
#include <etk/math/Matrix4.h> #include <etk/math/Matrix4.h>
#include <BulletDynamics/Dynamics/btRigidBody.h> #include <BulletDynamics/Dynamics/btRigidBody.h>
#include <LinearMath/btDefaultMotionState.h> #include <LinearMath/btDefaultMotionState.h>

View File

@ -21,9 +21,9 @@ namespace ege {
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ege/camera/Camera.h> #include <ege/camera/Camera.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <ewol/openGL/openGL.h> #include <gale/renderer/openGL/openGL.h>
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#include <ewol/Dimension.h> #include <gale/Dimension.h>
class btBroadphaseInterface; class btBroadphaseInterface;

View File

@ -8,7 +8,8 @@
#include <ege/debug.h> #include <ege/debug.h>
#include <ege/resource/Mesh.h> #include <ege/resource/Mesh.h>
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#include <gale/renderer/openGL/openGL-include.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <ege/resource/tools/viewBox.h> #include <ege/resource/tools/viewBox.h>
#include <ege/resource/tools/isoSphere.h> #include <ege/resource/tools/isoSphere.h>
@ -30,12 +31,11 @@ ege::resource::Mesh::Mesh() :
m_numberOfElments(-1), m_numberOfElments(-1),
m_pointerShape(nullptr), m_pointerShape(nullptr),
m_functionFreeShape(nullptr) { m_functionFreeShape(nullptr) {
addObjectType("ege::resource::Mesh"); addResourceType("ege::resource::Mesh");
} }
void ege::resource::Mesh::init(const std::string& _fileName, const std::string& _shaderName) { void ege::resource::Mesh::init(const std::string& _fileName, const std::string& _shaderName) {
ewol::Resource::init(_fileName); gale::Resource::init(_fileName);
addObjectType("ege::resource::Mesh");
EGE_VERBOSE("Load a new mesh : '" << _fileName << "'"); EGE_VERBOSE("Load a new mesh : '" << _fileName << "'");
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
@ -47,7 +47,7 @@ void ege::resource::Mesh::init(const std::string& _fileName, const std::string&
m_light.setSpecularColor(vec4(0.0f,0.0f,0.0f,1.0f)); m_light.setSpecularColor(vec4(0.0f,0.0f,0.0f,1.0f));
//EGE_DEBUG(m_name << " " << m_light); //EGE_DEBUG(m_name << " " << m_light);
m_GLprogram = ewol::resource::Program::create(_shaderName); m_GLprogram = gale::resource::Program::create(_shaderName);
if (m_GLprogram != nullptr) { if (m_GLprogram != nullptr) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLtexture = m_GLprogram->getAttribute("EW_texture2d"); m_GLtexture = m_GLprogram->getAttribute("EW_texture2d");
@ -60,7 +60,7 @@ void ege::resource::Mesh::init(const std::string& _fileName, const std::string&
m_light.link(m_GLprogram, "EW_directionalLight"); m_light.link(m_GLprogram, "EW_directionalLight");
} }
// this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer // this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
m_verticesVBO = ewol::resource::VirtualBufferObject::create(5); m_verticesVBO = gale::resource::VirtualBufferObject::create(5);
if (m_verticesVBO == nullptr) { if (m_verticesVBO == nullptr) {
EGE_ERROR("can not instanciate VBO ..."); EGE_ERROR("can not instanciate VBO ...");
return; return;
@ -118,18 +118,18 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
} }
//EGE_DEBUG(m_name << " " << m_light); //EGE_DEBUG(m_name << " " << m_light);
if (_enableDepthTest == true) { if (_enableDepthTest == true) {
ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST); gale::openGL::enable(gale::openGL::flag_depthTest);
if (false == _enableDepthUpdate) { if (false == _enableDepthUpdate) {
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
} else { } else {
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); gale::openGL::disable(gale::openGL::flag_depthTest);
} }
//EGE_DEBUG(" display " << m_coord.size() << " elements" ); //EGE_DEBUG(" display " << m_coord.size() << " elements" );
m_GLprogram->use(); m_GLprogram->use();
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::getMatrix(); mat4 projMatrix = gale::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 camMatrix = gale::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix; mat4 tmpMatrix = projMatrix * camMatrix;
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
m_GLprogram->uniformMatrix(m_GLMatrixPosition, _positionMatrix); m_GLprogram->uniformMatrix(m_GLMatrixPosition, _positionMatrix);
@ -165,7 +165,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
} }
m_materials[m_listFaces.getKey(kkk)]->draw(m_GLprogram, m_GLMaterial); m_materials[m_listFaces.getKey(kkk)]->draw(m_GLprogram, m_GLMaterial);
if (m_checkNormal == false) { if (m_checkNormal == false) {
ewol::openGL::drawElements(m_materials[m_listFaces.getKey(kkk)]->getRenderModeOpenGl(), m_listFaces.getValue(kkk).m_index); gale::openGL::drawElements(m_materials[m_listFaces.getKey(kkk)]->getRenderModeOpenGl(), m_listFaces.getValue(kkk).m_index);
#ifdef DISPLAY_NB_VERTEX_DISPLAYED #ifdef DISPLAY_NB_VERTEX_DISPLAYED
nbElementDraw += m_listFaces.getValue(kkk).m_index.size(); nbElementDraw += m_listFaces.getValue(kkk).m_index.size();
nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size(); nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size();
@ -211,7 +211,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
} }
break; break;
} }
ewol::openGL::drawElements(m_materials[m_listFaces.getKey(kkk)]->getRenderModeOpenGl(), tmpIndexResult); gale::openGL::drawElements(m_materials[m_listFaces.getKey(kkk)]->getRenderModeOpenGl(), tmpIndexResult);
#ifdef DISPLAY_NB_VERTEX_DISPLAYED #ifdef DISPLAY_NB_VERTEX_DISPLAYED
nbElementDraw += tmpIndexResult.size(); nbElementDraw += tmpIndexResult.size();
nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size(); nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size();
@ -235,7 +235,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
if (false == _enableDepthUpdate) { if (false == _enableDepthUpdate) {
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
} }
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); gale::openGL::disable(gale::openGL::flag_depthTest);
} }
// TODO : UNDERSTAND why ... it is needed // TODO : UNDERSTAND why ... it is needed
glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ARRAY_BUFFER,0);
@ -247,11 +247,11 @@ void ege::resource::Mesh::calculateNormaleFace(const std::string& _materialName)
m_listFacesNormal.clear(); m_listFacesNormal.clear();
if (m_normalMode == ege::resource::Mesh::normalModeFace) { if (m_normalMode == ege::resource::Mesh::normalModeFace) {
EGE_INFO("calculateNormaleFace(" << _materialName << ")"); EGE_INFO("calculateNormaleFace(" << _materialName << ")");
ewol::openGL::renderMode tmpRenderMode = m_materials[_materialName]->getRenderMode(); gale::openGL::renderMode tmpRenderMode = m_materials[_materialName]->getRenderMode();
if ( tmpRenderMode == ewol::openGL::renderPoint if ( tmpRenderMode == gale::openGL::render_point
|| tmpRenderMode == ewol::openGL::renderLine || tmpRenderMode == gale::openGL::render_line
|| tmpRenderMode == ewol::openGL::renderLineStrip || tmpRenderMode == gale::openGL::render_lineStrip
|| tmpRenderMode == ewol::openGL::renderLineLoop) { || tmpRenderMode == gale::openGL::render_lineLoop) {
EGE_ERROR("calculateNormaleFace(" << _materialName << ") : can not calculate normal on lines ..."); EGE_ERROR("calculateNormaleFace(" << _materialName << ") : can not calculate normal on lines ...");
m_normalMode = ege::resource::Mesh::normalModeNone; m_normalMode = ege::resource::Mesh::normalModeNone;
return; return;
@ -269,11 +269,11 @@ void ege::resource::Mesh::calculateNormaleEdge(const std::string& _materialName)
m_listVertexNormal.clear(); m_listVertexNormal.clear();
if (m_normalMode == ege::resource::Mesh::normalModeVertex) { if (m_normalMode == ege::resource::Mesh::normalModeVertex) {
EGE_INFO("calculateNormaleEdge(" << _materialName << ")"); EGE_INFO("calculateNormaleEdge(" << _materialName << ")");
ewol::openGL::renderMode tmpRenderMode = m_materials[_materialName]->getRenderMode(); gale::openGL::renderMode tmpRenderMode = m_materials[_materialName]->getRenderMode();
if ( tmpRenderMode == ewol::openGL::renderPoint if ( tmpRenderMode == gale::openGL::render_point
|| tmpRenderMode == ewol::openGL::renderLine || tmpRenderMode == gale::openGL::render_line
|| tmpRenderMode == ewol::openGL::renderLineStrip || tmpRenderMode == gale::openGL::render_lineStrip
|| tmpRenderMode == ewol::openGL::renderLineLoop) { || tmpRenderMode == gale::openGL::render_lineLoop) {
EGE_ERROR("calculateNormaleEdge(" << _materialName << ") : can not calculate normal on lines ..."); EGE_ERROR("calculateNormaleEdge(" << _materialName << ") : can not calculate normal on lines ...");
m_normalMode = ege::resource::Mesh::normalModeNone; m_normalMode = ege::resource::Mesh::normalModeNone;
return; return;
@ -319,24 +319,24 @@ void ege::resource::Mesh::generateVBO() {
m_listFaces.getValue(kkk).m_index.clear(); m_listFaces.getValue(kkk).m_index.clear();
int32_t nbIndicInFace = 3; int32_t nbIndicInFace = 3;
switch (m_materials[m_listFaces.getKey(kkk)]->getRenderMode()) { switch (m_materials[m_listFaces.getKey(kkk)]->getRenderMode()) {
case ewol::openGL::renderTriangle: case gale::openGL::render_triangle:
case ewol::openGL::renderTriangleStrip: case gale::openGL::render_triangleStrip:
case ewol::openGL::renderTriangleFan: case gale::openGL::render_triangleFan:
nbIndicInFace = 3; nbIndicInFace = 3;
break; break;
case ewol::openGL::renderLine: case gale::openGL::render_line:
case ewol::openGL::renderLineStrip: case gale::openGL::render_lineStrip:
case ewol::openGL::renderLineLoop: case gale::openGL::render_lineLoop:
nbIndicInFace = 2; nbIndicInFace = 2;
break; break;
case ewol::openGL::renderPoint: case gale::openGL::render_point:
nbIndicInFace = 1; nbIndicInFace = 1;
break; break;
case ewol::openGL::renderQuad: case gale::openGL::render_quad:
case ewol::openGL::renderQuadStrip: case gale::openGL::render_quadStrip:
nbIndicInFace = 4; nbIndicInFace = 4;
break; break;
case ewol::openGL::renderPolygon: case gale::openGL::render_polygon:
nbIndicInFace = 3; nbIndicInFace = 3;
break; break;
} }
@ -493,8 +493,8 @@ void ege::resource::Mesh::addPoint(const std::string& _layerName, const vec3& _p
EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ..."); EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ...");
return; return;
} }
ewol::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode(); gale::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode();
if (tmpRenderMode != ewol::openGL::renderPoint) { if (tmpRenderMode != gale::openGL::render_point) {
EGE_ERROR("try to add Point in a mesh material section that not support Point"); EGE_ERROR("try to add Point in a mesh material section that not support Point");
return; return;
} }
@ -514,10 +514,10 @@ void ege::resource::Mesh::addLine(const std::string& _layerName, const vec3& _po
EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ..."); EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ...");
return; return;
} }
ewol::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode(); gale::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode();
if ( tmpRenderMode != ewol::openGL::renderLine if ( tmpRenderMode != gale::openGL::render_line
&& tmpRenderMode != ewol::openGL::renderLineStrip && tmpRenderMode != gale::openGL::render_lineStrip
&& tmpRenderMode != ewol::openGL::renderLineLoop) { && tmpRenderMode != gale::openGL::render_lineLoop) {
EGE_ERROR("try to add Line in a mesh material section that not support Line"); EGE_ERROR("try to add Line in a mesh material section that not support Line");
return; return;
} }
@ -559,10 +559,10 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName,
EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ..."); EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ...");
return; return;
} }
ewol::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode(); gale::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode();
if ( tmpRenderMode != ewol::openGL::renderTriangle if ( tmpRenderMode != gale::openGL::render_triangle
&& tmpRenderMode != ewol::openGL::renderTriangleStrip && tmpRenderMode != gale::openGL::render_triangleStrip
&& tmpRenderMode != ewol::openGL::renderTriangleFan) { && tmpRenderMode != gale::openGL::render_triangleFan) {
EGE_ERROR("try to add Line in a mesh material section that not support Line"); EGE_ERROR("try to add Line in a mesh material section that not support Line");
return; return;
} }
@ -592,13 +592,13 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName, const vec3&
EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ..."); EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ...");
return; return;
} }
ewol::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode(); gale::openGL::renderMode tmpRenderMode = m_materials[_layerName]->getRenderMode();
if ( tmpRenderMode == ewol::openGL::renderQuad if ( tmpRenderMode == gale::openGL::render_quad
|| tmpRenderMode == ewol::openGL::renderQuadStrip) { || tmpRenderMode == gale::openGL::render_quadStrip) {
EGE_TODO("Create quad interface ..."); EGE_TODO("Create quad interface ...");
} else if ( tmpRenderMode == ewol::openGL::renderTriangle } else if ( tmpRenderMode == gale::openGL::render_triangle
|| tmpRenderMode == ewol::openGL::renderLineStrip || tmpRenderMode == gale::openGL::render_lineStrip
|| tmpRenderMode == ewol::openGL::renderTriangleFan) { || tmpRenderMode == gale::openGL::render_triangleFan) {
// try to find position: // try to find position:
int32_t pos1 = findPositionInList(_pos1); int32_t pos1 = findPositionInList(_pos1);

View File

@ -11,11 +11,11 @@
#include <etk/types.h> #include <etk/types.h>
#include <etk/Hash.h> #include <etk/Hash.h>
#include <ewol/resource/Resource.h> #include <gale/resource/Resource.h>
#include <ewol/resource/Image.h> #include <ewol/resource/Image.h>
#include <ewol/resource/Shader.h> #include <gale/resource/Shader.h>
#include <ewol/resource/Program.h> #include <gale/resource/Program.h>
#include <ewol/resource/VirtualBufferObject.h> #include <gale/resource/VirtualBufferObject.h>
#include <ege/Light.h> #include <ege/Light.h>
#include <ege/Material.h> #include <ege/Material.h>
#include <ege/resource/tools/Face.h> #include <ege/resource/tools/Face.h>
@ -31,7 +31,7 @@
namespace ege { namespace ege {
namespace resource { namespace resource {
class Mesh : public ewol::Resource { class Mesh : public gale::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); 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);
@ -48,7 +48,7 @@ namespace ege {
enum normalMode m_normalMode; // select the normal mode of display enum normalMode m_normalMode; // select the normal mode of display
bool m_checkNormal; //!< when enable, this check the normal of the mesh before sending it at the 3d card bool m_checkNormal; //!< when enable, this check the normal of the mesh before sending it at the 3d card
protected: protected:
std::shared_ptr<ewol::resource::Program> m_GLprogram; std::shared_ptr<gale::resource::Program> m_GLprogram;
int32_t m_GLPosition; int32_t m_GLPosition;
int32_t m_GLMatrix; int32_t m_GLMatrix;
int32_t m_GLMatrixPosition; int32_t m_GLMatrixPosition;
@ -70,7 +70,7 @@ namespace ege {
std::vector<std::shared_ptr<ege::PhysicsShape>> m_physics; //!< collision shape module ... (independent of bullet lib) std::vector<std::shared_ptr<ege::PhysicsShape>> m_physics; //!< collision shape module ... (independent of bullet lib)
void clean(); void clean();
protected: protected:
std::shared_ptr<ewol::resource::VirtualBufferObject> m_verticesVBO; std::shared_ptr<gale::resource::VirtualBufferObject> m_verticesVBO;
protected: protected:
Mesh(); Mesh();
void init(const std::string& _fileName="---", const std::string& _shaderName="DATA:textured3D2.prog"); void init(const std::string& _fileName="---", const std::string& _shaderName="DATA:textured3D2.prog");

View File

@ -19,7 +19,7 @@ std::shared_ptr<ege::resource::Mesh> ege::resource::Mesh::createCube(float _size
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));
material->setSpecularFactor(vec4(0,0,0,1)); material->setSpecularFactor(vec4(0,0,0,1));
material->setShininess(1); material->setShininess(1);
material->setRenderMode(ewol::openGL::renderTriangle); material->setRenderMode(gale::openGL::render_triangle);
out->addMaterial(_materialName, material); out->addMaterial(_materialName, material);
out->addFaceIndexing(_materialName); out->addFaceIndexing(_materialName);

View File

@ -483,7 +483,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
material->setTexture0(fileName.getRelativeFolder() + &inputDataLine[7]); material->setTexture0(fileName.getRelativeFolder() + &inputDataLine[7]);
EGE_VERBOSE(" Texture " << &inputDataLine[7]); EGE_VERBOSE(" Texture " << &inputDataLine[7]);
} else if(0 == strncmp(inputDataLine,"renderMode ",11)) { } else if(0 == strncmp(inputDataLine,"renderMode ",11)) {
ewol::openGL::renderMode mode; gale::openGL::renderMode mode;
etk::from_string(mode, &inputDataLine[11]); etk::from_string(mode, &inputDataLine[11]);
material->setRenderMode(mode); material->setRenderMode(mode);
EGE_VERBOSE(" Texture " << mode); EGE_VERBOSE(" Texture " << mode);

View File

@ -18,8 +18,8 @@ std::shared_ptr<ege::resource::Mesh> ege::resource::Mesh::createGrid(int32_t _li
material->setDiffuseFactor(vec4(0,0,0,1)); material->setDiffuseFactor(vec4(0,0,0,1));
material->setSpecularFactor(vec4(0,0,0,1)); material->setSpecularFactor(vec4(0,0,0,1));
material->setShininess(1); material->setShininess(1);
material->setRenderMode(ewol::openGL::renderLine); material->setRenderMode(gale::openGL::render_line);
//material->setRenderMode(ewol::openGL::renderPoint); //material->setRenderMode(gale::openGL::render_point);
out->addMaterial(_materialName, material); out->addMaterial(_materialName, material);
out->addFaceIndexing(_materialName); out->addFaceIndexing(_materialName);

View File

@ -8,10 +8,11 @@
#include <ege/debug.h> #include <ege/debug.h>
#include <ege/resource/ParticuleMesh.h> #include <ege/resource/ParticuleMesh.h>
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#include <gale/renderer/openGL/openGL-include.h>
ege::resource::ParticuleMesh::ParticuleMesh() { ege::resource::ParticuleMesh::ParticuleMesh() {
addObjectType("ege::resource::ParticuleMesh"); addResourceType("ege::resource::ParticuleMesh");
} }
void ege::resource::ParticuleMesh::init(const std::string& _fileName, const std::string& _shaderName) { void ege::resource::ParticuleMesh::init(const std::string& _fileName, const std::string& _shaderName) {
@ -36,18 +37,18 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
} }
//EGE_DEBUG(m_name << " " << m_light); //EGE_DEBUG(m_name << " " << m_light);
if (_enableDepthTest == true) { if (_enableDepthTest == true) {
ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST); gale::openGL::enable(gale::openGL::flag_depthTest);
if (false == _enableDepthUpdate) { if (false == _enableDepthUpdate) {
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
} else { } else {
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); gale::openGL::disable(gale::openGL::flag_depthTest);
} }
//EGE_DEBUG(" display " << m_coord.size() << " elements" ); //EGE_DEBUG(" display " << m_coord.size() << " elements" );
m_GLprogram->use(); m_GLprogram->use();
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::getMatrix(); mat4 projMatrix = gale::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 camMatrix = gale::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix; mat4 tmpMatrix = projMatrix * camMatrix;
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
m_GLprogram->uniformMatrix(m_GLMatrixPosition, _positionMatrix); m_GLprogram->uniformMatrix(m_GLMatrixPosition, _positionMatrix);
@ -72,7 +73,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
} }
m_materials[m_listFaces.getKey(kkk)]->draw(m_GLprogram, m_GLMaterial); m_materials[m_listFaces.getKey(kkk)]->draw(m_GLprogram, m_GLMaterial);
if (m_checkNormal == false) { if (m_checkNormal == false) {
ewol::openGL::drawElements(GL_TRIANGLES, m_listFaces.getValue(kkk).m_index); gale::openGL::drawElements(gale::openGL::render_triangle, m_listFaces.getValue(kkk).m_index);
#ifdef DISPLAY_NB_VERTEX_DISPLAYED #ifdef DISPLAY_NB_VERTEX_DISPLAYED
nbElementDraw += m_listFaces.getValue(kkk).m_index.size(); nbElementDraw += m_listFaces.getValue(kkk).m_index.size();
nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size(); nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size();
@ -108,7 +109,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
} }
} }
} }
ewol::openGL::drawElements(GL_TRIANGLES, tmpIndexResult); gale::openGL::drawElements(gale::openGL::render_triangle, tmpIndexResult);
#ifdef DISPLAY_NB_VERTEX_DISPLAYED #ifdef DISPLAY_NB_VERTEX_DISPLAYED
nbElementDraw += tmpIndexResult.size(); nbElementDraw += tmpIndexResult.size();
nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size(); nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size();
@ -123,7 +124,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
if (false == _enableDepthUpdate) { if (false == _enableDepthUpdate) {
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
} }
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); gale::openGL::disable(gale::openGL::flag_depthTest);
} }
glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ARRAY_BUFFER,0);
} }

View File

@ -8,7 +8,7 @@
#include <ege/widget/Mesh.h> #include <ege/widget/Mesh.h>
#include <ewol/widget/Manager.h> #include <ewol/widget/Manager.h>
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#include <ege/debug.h> #include <ege/debug.h>
#undef __class__ #undef __class__
@ -54,22 +54,19 @@ void ege::widget::Mesh::onDraw() {
} }
void ege::widget::Mesh::systemDraw(const ewol::DrawProperty& _displayProp) { void ege::widget::Mesh::systemDraw(const ewol::DrawProperty& _displayProp) {
ewol::openGL::push(); gale::openGL::push();
// here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left // here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left
glViewport( m_origin.x(), gale::openGL::setViewPort(m_origin, m_size);
m_origin.y(),
m_size.x(),
m_size.y());
float ratio = m_size.x() / m_size.y(); float ratio = m_size.x() / m_size.y();
//EGE_INFO("ratio : " << ratio); //EGE_INFO("ratio : " << ratio);
mat4 tmpProjection = etk::matPerspective(M_PI/3.0, ratio, 0.5, 100); mat4 tmpProjection = etk::matPerspective(M_PI/3.0, ratio, 0.5, 100);
//mat4 tmpMat = tmpProjection * m_camera.getMatrix(); //mat4 tmpMat = tmpProjection * m_camera.getMatrix();
// set internal matrix system : // set internal matrix system :
//ewol::openGL::setMatrix(tmpMat); //ewol::openGL::setMatrix(tmpMat);
ewol::openGL::setMatrix(tmpProjection); gale::openGL::setMatrix(tmpProjection);
onDraw(); onDraw();
ewol::openGL::pop(); gale::openGL::pop();
} }
void ege::widget::Mesh::onRegenerateDisplay() { void ege::widget::Mesh::onRegenerateDisplay() {
@ -85,8 +82,8 @@ void ege::widget::Mesh::periodicCall(const ewol::event::Time& _event) {
bool ege::widget::Mesh::onEventInput(const ewol::event::Input& _event) { bool ege::widget::Mesh::onEventInput(const ewol::event::Input& _event) {
//EGE_DEBUG("Event on BT ..."); //EGE_DEBUG("Event on BT ...");
if (1 == _event.getId()) { if (_event.getId() == 1) {
if(ewol::key::statusSingle == _event.getStatus()) { if(_event.getStatus() == gale::key::status_single) {
signalPressed.emit(); signalPressed.emit();
return true; return true;
} }
@ -95,7 +92,7 @@ bool ege::widget::Mesh::onEventInput(const ewol::event::Input& _event) {
} }
void ege::widget::Mesh::setFile(const std::string& _filename) { void ege::widget::Mesh::setFile(const std::string& _filename) {
if( _filename!="" if( _filename != ""
&& m_meshName != _filename ) { && m_meshName != _filename ) {
m_meshName = _filename; m_meshName = _filename;
m_object = ege::resource::Mesh::create(m_meshName); m_object = ege::resource::Mesh::create(m_meshName);

View File

@ -12,7 +12,7 @@
#include <math.h> #include <math.h>
#include <ege/debug.h> #include <ege/debug.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/openGL/openGL.h> #include <gale/renderer/openGL/openGL.h>
#include <etk/math/Matrix4.h> #include <etk/math/Matrix4.h>
#include <BulletDynamics/Dynamics/btRigidBody.h> #include <BulletDynamics/Dynamics/btRigidBody.h>
#include <LinearMath/btDefaultMotionState.h> #include <LinearMath/btDefaultMotionState.h>
@ -168,20 +168,17 @@ void ege::widget::Scene::systemDraw(const ewol::DrawProperty& _displayProp) {
#ifdef SCENE_BRUT_PERFO_TEST #ifdef SCENE_BRUT_PERFO_TEST
int64_t tmp___startTime0 = ewol::getTime(); int64_t tmp___startTime0 = ewol::getTime();
#endif #endif
glBindBuffer(GL_ARRAY_BUFFER,0); gale::openGL::bindBuffer(0);
ewol::openGL::push(); gale::openGL::push();
// here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left // here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left
glViewport( m_origin.x(), gale::openGL::setViewPort(m_origin, m_size);
m_origin.y(),
m_size.x(),
m_size.y());
// configure render with the camera... // configure render with the camera...
std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName); std::shared_ptr<ege::Camera> camera = m_env->getCamera(m_cameraName);
if (camera != nullptr) { if (camera != nullptr) {
camera->configureOpenGL(); camera->configureOpenGL();
} }
onDraw(); onDraw();
ewol::openGL::pop(); gale::openGL::pop();
#ifdef SCENE_BRUT_PERFO_TEST #ifdef SCENE_BRUT_PERFO_TEST
float tmp___localTime1 = (float)(ewol::getTime() - tmp___startTime0) / 1000.0f; float tmp___localTime1 = (float)(ewol::getTime() - tmp___startTime0) / 1000.0f;
EWOL_DEBUG(" SCENE render : " << tmp___localTime1 << "ms "); EWOL_DEBUG(" SCENE render : " << tmp___localTime1 << "ms ");

View File

@ -16,10 +16,10 @@
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ege/camera/Camera.h> #include <ege/camera/Camera.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <ewol/openGL/openGL.h> #include <gale/renderer/openGL/openGL.h>
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#include <ege/elements/Element.h> #include <ege/elements/Element.h>
#include <ewol/Dimension.h> #include <gale/Dimension.h>
class btBroadphaseInterface; class btBroadphaseInterface;
class btCollisionShape; class btCollisionShape;

View File

@ -9,7 +9,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/context/commandLine.h> #include <gale/context/commandLine.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Windows.h> #include <appl/Windows.h>

View File

@ -9,7 +9,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/context/commandLine.h> #include <gale/context/commandLine.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Windows.h> #include <appl/Windows.h>

View File

@ -9,7 +9,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/context/commandLine.h> #include <gale/context/commandLine.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Windows.h> #include <appl/Windows.h>

View File

@ -9,7 +9,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/context/commandLine.h> #include <gale/context/commandLine.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Windows.h> #include <appl/Windows.h>

View File

@ -9,7 +9,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/context/commandLine.h> #include <gale/context/commandLine.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Windows.h> #include <appl/Windows.h>