From 714662d7a923c7c451b1a02a636c8c0e3fefce5c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 13 Nov 2014 21:11:53 +0100 Subject: [PATCH] [DEV] normalize set matrix on openGL --- ege/resource/Mesh.cpp | 13 +++++++++++-- ege/resource/ParticuleMesh.cpp | 4 ++-- ege/resource/tools/Face.h | 15 +++++++++------ lutin_ege.py | 1 + 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ege/resource/Mesh.cpp b/ege/resource/Mesh.cpp index e786979..41bd747 100644 --- a/ege/resource/Mesh.cpp +++ b/ege/resource/Mesh.cpp @@ -20,6 +20,15 @@ ege::resource::Mesh::Mesh() : m_normalMode(normalModeNone), 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) { addObjectType("ege::resource::Mesh"); } @@ -117,8 +126,8 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix, mat4 projMatrix = ewol::openGL::getMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 tmpMatrix = projMatrix * camMatrix; - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); - m_GLprogram->uniformMatrix4fv(m_GLMatrixPosition, 1, _positionMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); + m_GLprogram->uniformMatrix(m_GLMatrixPosition, _positionMatrix); // position : m_GLprogram->sendAttributePointer(m_GLPosition, m_verticesVBO, MESH_VBO_VERTICES); // Texture : diff --git a/ege/resource/ParticuleMesh.cpp b/ege/resource/ParticuleMesh.cpp index 92d1b01..3872bfe 100644 --- a/ege/resource/ParticuleMesh.cpp +++ b/ege/resource/ParticuleMesh.cpp @@ -49,8 +49,8 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix, mat4 projMatrix = ewol::openGL::getMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 tmpMatrix = projMatrix * camMatrix; - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); - m_GLprogram->uniformMatrix4fv(m_GLMatrixPosition, 1, _positionMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); + m_GLprogram->uniformMatrix(m_GLMatrixPosition, _positionMatrix); vec4 tmpColor(_mainColor.r(), _mainColor.g(), _mainColor.b(), _mainColor.a()); m_GLprogram->uniform4(m_GLMainColor, tmpColor); // position : diff --git a/ege/resource/tools/Face.h b/ege/resource/tools/Face.h index 6a623a9..8083cb8 100644 --- a/ege/resource/tools/Face.h +++ b/ege/resource/tools/Face.h @@ -21,8 +21,11 @@ namespace ege { int32_t m_normal[3]; int32_t m_color[3]; public: - Face() { - m_nbElement = 1; + Face() : + m_nbElement(1) { + m_vertex[0] = -1; + m_vertex[1] = -1; + m_vertex[2] = -1; m_uv[0] = -1; m_uv[1] = -1; m_uv[2] = -1; @@ -35,8 +38,8 @@ namespace ege { }; Face(int32_t _v1, int32_t _t1, int32_t _v2, int32_t _t2, - int32_t _v3, int32_t _t3) { - m_nbElement = 3; + int32_t _v3, int32_t _t3) : + m_nbElement(3) { m_vertex[0] = _v1; m_vertex[1] = _v2; m_vertex[2] = _v3; @@ -52,8 +55,8 @@ namespace ege { }; Face(int32_t _v1, int32_t _t1, int32_t _n1, int32_t _v2, int32_t _t2, int32_t _n2, - int32_t _v3, int32_t _t3, int32_t _n3) { - m_nbElement = 3; + int32_t _v3, int32_t _t3, int32_t _n3) : + m_nbElement(3) { m_vertex[0] = _v1; m_vertex[1] = _v2; m_vertex[2] = _v3; diff --git a/lutin_ege.py b/lutin_ege.py index 79a0c8d..ec31543 100644 --- a/lutin_ege.py +++ b/lutin_ege.py @@ -57,6 +57,7 @@ def create(target): myModule.compile_flags_CC([ '-Wno-write-strings', + '-Wmissing-field-initializers', '-Wall']) myModule.add_export_path(tools.get_current_path(__file__))