[DEV] normalize set matrix on openGL

This commit is contained in:
Edouard DUPIN 2014-11-13 21:11:53 +01:00
parent 59a2162deb
commit 714662d7a9
4 changed files with 23 additions and 10 deletions

View File

@ -20,6 +20,15 @@
ege::resource::Mesh::Mesh() : ege::resource::Mesh::Mesh() :
m_normalMode(normalModeNone), m_normalMode(normalModeNone),
m_checkNormal(false), m_checkNormal(false),
m_GLPosition(-1),
m_GLMatrix(-1),
m_GLMatrixPosition(-1),
m_GLNormal(-1),
m_GLtexture(-1),
m_GLColor(-1),
m_bufferOfset(-1),
m_numberOfElments(-1),
m_pointerShape(nullptr),
m_functionFreeShape(nullptr) { m_functionFreeShape(nullptr) {
addObjectType("ege::resource::Mesh"); addObjectType("ege::resource::Mesh");
} }
@ -117,8 +126,8 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
mat4 projMatrix = ewol::openGL::getMatrix(); mat4 projMatrix = ewol::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix; mat4 tmpMatrix = projMatrix * camMatrix;
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
m_GLprogram->uniformMatrix4fv(m_GLMatrixPosition, 1, _positionMatrix.m_mat); m_GLprogram->uniformMatrix(m_GLMatrixPosition, _positionMatrix);
// position : // position :
m_GLprogram->sendAttributePointer(m_GLPosition, m_verticesVBO, MESH_VBO_VERTICES); m_GLprogram->sendAttributePointer(m_GLPosition, m_verticesVBO, MESH_VBO_VERTICES);
// Texture : // Texture :

View File

@ -49,8 +49,8 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
mat4 projMatrix = ewol::openGL::getMatrix(); mat4 projMatrix = ewol::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix; mat4 tmpMatrix = projMatrix * camMatrix;
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
m_GLprogram->uniformMatrix4fv(m_GLMatrixPosition, 1, _positionMatrix.m_mat); m_GLprogram->uniformMatrix(m_GLMatrixPosition, _positionMatrix);
vec4 tmpColor(_mainColor.r(), _mainColor.g(), _mainColor.b(), _mainColor.a()); vec4 tmpColor(_mainColor.r(), _mainColor.g(), _mainColor.b(), _mainColor.a());
m_GLprogram->uniform4(m_GLMainColor, tmpColor); m_GLprogram->uniform4(m_GLMainColor, tmpColor);
// position : // position :

View File

@ -21,8 +21,11 @@ namespace ege {
int32_t m_normal[3]; int32_t m_normal[3];
int32_t m_color[3]; int32_t m_color[3];
public: public:
Face() { Face() :
m_nbElement = 1; m_nbElement(1) {
m_vertex[0] = -1;
m_vertex[1] = -1;
m_vertex[2] = -1;
m_uv[0] = -1; m_uv[0] = -1;
m_uv[1] = -1; m_uv[1] = -1;
m_uv[2] = -1; m_uv[2] = -1;
@ -35,8 +38,8 @@ namespace ege {
}; };
Face(int32_t _v1, int32_t _t1, Face(int32_t _v1, int32_t _t1,
int32_t _v2, int32_t _t2, int32_t _v2, int32_t _t2,
int32_t _v3, int32_t _t3) { int32_t _v3, int32_t _t3) :
m_nbElement = 3; m_nbElement(3) {
m_vertex[0] = _v1; m_vertex[0] = _v1;
m_vertex[1] = _v2; m_vertex[1] = _v2;
m_vertex[2] = _v3; m_vertex[2] = _v3;
@ -52,8 +55,8 @@ namespace ege {
}; };
Face(int32_t _v1, int32_t _t1, int32_t _n1, Face(int32_t _v1, int32_t _t1, int32_t _n1,
int32_t _v2, int32_t _t2, int32_t _n2, int32_t _v2, int32_t _t2, int32_t _n2,
int32_t _v3, int32_t _t3, int32_t _n3) { int32_t _v3, int32_t _t3, int32_t _n3) :
m_nbElement = 3; m_nbElement(3) {
m_vertex[0] = _v1; m_vertex[0] = _v1;
m_vertex[1] = _v2; m_vertex[1] = _v2;
m_vertex[2] = _v3; m_vertex[2] = _v3;

View File

@ -57,6 +57,7 @@ def create(target):
myModule.compile_flags_CC([ myModule.compile_flags_CC([
'-Wno-write-strings', '-Wno-write-strings',
'-Wmissing-field-initializers',
'-Wall']) '-Wall'])
myModule.add_export_path(tools.get_current_path(__file__)) myModule.add_export_path(tools.get_current_path(__file__))