diff --git a/external/ege b/external/ege index d68acc19..912f4b83 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit d68acc190307c9be0232f3b17cfe0c8cbb3ea683 +Subproject commit 912f4b83167007e6ca5bed76d899316a802f1590 diff --git a/sources/ewol/compositing/Area.cpp b/sources/ewol/compositing/Area.cpp index 93bc1505..303ec815 100644 --- a/sources/ewol/compositing/Area.cpp +++ b/sources/ewol/compositing/Area.cpp @@ -49,7 +49,7 @@ void ewol::Area::LoadProgram(void) } } -void ewol::Area::Draw(void) +void ewol::Area::Draw(bool _disableDepthTest) { if (m_coord.Size()<=0) { //EWOL_WARNING("Nothink to draw..."); diff --git a/sources/ewol/compositing/Area.h b/sources/ewol/compositing/Area.h index 1fe64ce3..9f36801f 100644 --- a/sources/ewol/compositing/Area.h +++ b/sources/ewol/compositing/Area.h @@ -51,7 +51,7 @@ namespace ewol /** * @brief Draw All the refistered text in the current element on openGL */ - void Draw(void); + void Draw(bool _disableDepthTest=true); /** * @brief Clear alll the registered element in the current element */ diff --git a/sources/ewol/compositing/Compositing.h b/sources/ewol/compositing/Compositing.h index 7f37c700..78417f7a 100644 --- a/sources/ewol/compositing/Compositing.h +++ b/sources/ewol/compositing/Compositing.h @@ -31,7 +31,7 @@ namespace ewol /** * @brief Virtal pure function that request the draw of all openGl elements */ - virtual void Draw(void)=0; + virtual void Draw(bool _disableDepthTest=true)=0; /** * @brief Clear alll tre registered element in the current element */ diff --git a/sources/ewol/compositing/Drawing.cpp b/sources/ewol/compositing/Drawing.cpp index c15c847d..ed12fbad 100644 --- a/sources/ewol/compositing/Drawing.cpp +++ b/sources/ewol/compositing/Drawing.cpp @@ -305,7 +305,7 @@ void ewol::Drawing::LoadProgram(void) } } -void ewol::Drawing::Draw(void) +void ewol::Drawing::Draw(bool _disableDepthTest) { if (m_coord.Size()<=0) { // TODO : a remÚtre ... diff --git a/sources/ewol/compositing/Drawing.h b/sources/ewol/compositing/Drawing.h index a9ae807e..1553b159 100644 --- a/sources/ewol/compositing/Drawing.h +++ b/sources/ewol/compositing/Drawing.h @@ -82,7 +82,7 @@ namespace ewol /** * @brief Draw All the refistered text in the current element on openGL */ - void Draw(void); + void Draw(bool _disableDepthTest=true); /** * @brief Clear alll tre registered element in the current element */ diff --git a/sources/ewol/compositing/Image.cpp b/sources/ewol/compositing/Image.cpp index 30d3da69..0b7c9a1f 100644 --- a/sources/ewol/compositing/Image.cpp +++ b/sources/ewol/compositing/Image.cpp @@ -51,7 +51,7 @@ void ewol::Image::LoadProgram(void) } } -void ewol::Image::Draw(void) +void ewol::Image::Draw(bool _disableDepthTest) { if (m_coord.Size()<=0) { //EWOL_WARNING("Nothink to draw..."); @@ -65,7 +65,11 @@ void ewol::Image::Draw(void) EWOL_ERROR("No shader ..."); return; } - ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); + if (_disableDepthTest == true) { + ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); + } else { + ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); + } // set Matrix : translation/positionMatrix mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply; m_GLprogram->Use(); diff --git a/sources/ewol/compositing/Image.h b/sources/ewol/compositing/Image.h index f132cec4..c2ece91b 100644 --- a/sources/ewol/compositing/Image.h +++ b/sources/ewol/compositing/Image.h @@ -55,8 +55,9 @@ namespace ewol public: /** * @brief Draw All the refistered text in the current element on openGL + * @param[in] _disableDepthTest Disable the Depth test for display */ - void Draw(void); + void Draw(bool _disableDepthTest=true); /** * @brief Clear alll tre registered element in the current element */ diff --git a/sources/ewol/compositing/Shaper.cpp b/sources/ewol/compositing/Shaper.cpp index 1f7f04e9..5c500974 100644 --- a/sources/ewol/compositing/Shaper.cpp +++ b/sources/ewol/compositing/Shaper.cpp @@ -103,7 +103,7 @@ void ewol::Shaper::LoadProgram(void) } -void ewol::Shaper::Draw(void) +void ewol::Shaper::Draw(bool _disableDepthTest) { if (m_config == NULL) { // this is a normale case ... the user can choice to have no config basic file ... diff --git a/sources/ewol/compositing/Shaper.h b/sources/ewol/compositing/Shaper.h index 4c4640c1..ffafd4c3 100644 --- a/sources/ewol/compositing/Shaper.h +++ b/sources/ewol/compositing/Shaper.h @@ -79,7 +79,7 @@ namespace ewol /** * @brief Draw All the refistered text in the current element on openGL */ - void Draw(void); + void Draw(bool _disableDepthTest=true); /** * @brief Clear alll tre registered element in the current element */ diff --git a/sources/ewol/compositing/Text.cpp b/sources/ewol/compositing/Text.cpp index 0a8d97e2..b09cf3d8 100644 --- a/sources/ewol/compositing/Text.cpp +++ b/sources/ewol/compositing/Text.cpp @@ -110,7 +110,7 @@ void ewol::Text::Draw(const mat4& _transformationMatrix, bool _enableDepthTest) } -void ewol::Text::Draw(void) +void ewol::Text::Draw(bool _disableDepthTest) { // draw BG in any case: m_vectorialDraw.Draw(); diff --git a/sources/ewol/compositing/Text.h b/sources/ewol/compositing/Text.h index 1e09ab61..edc8708c 100644 --- a/sources/ewol/compositing/Text.h +++ b/sources/ewol/compositing/Text.h @@ -115,7 +115,7 @@ namespace ewol /** * @brief Draw All the refistered text in the current element on openGL */ - void Draw(void); + void Draw(bool _disableDepthTest=true); void Draw(const mat4& _transformationMatrix, bool _enableDepthTest=false); /** * @brief Clear all the registered element in the current element diff --git a/sources/ewol/resources/Mesh.cpp b/sources/ewol/resources/Mesh.cpp index 7bcf5e8f..53ed5e33 100644 --- a/sources/ewol/resources/Mesh.cpp +++ b/sources/ewol/resources/Mesh.cpp @@ -78,14 +78,21 @@ ewol::Mesh::~Mesh(void) //#define DISPLAY_NB_VERTEX_DISPLAYED -void ewol::Mesh::Draw(mat4& positionMatrix) +void ewol::Mesh::Draw(mat4& _positionMatrix, bool _enableDepthTest, bool _enableDepthUpdate) { if (m_GLprogram==NULL) { EWOL_ERROR("No shader ..."); return; } //EWOL_DEBUG(m_name << " " << m_light); - ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); + if (_enableDepthTest==true) { + ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); + if (false==_enableDepthUpdate) { + glDepthMask(GL_FALSE); + } + } else { + ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); + } //EWOL_DEBUG(" Display " << m_coord.Size() << " elements" ); m_GLprogram->Use(); // set Matrix : translation/positionMatrix @@ -93,7 +100,7 @@ void ewol::Mesh::Draw(mat4& positionMatrix) 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->UniformMatrix4fv(m_GLMatrixPosition, 1, _positionMatrix.m_mat); // position : m_GLprogram->SendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES); // Texture : @@ -119,7 +126,7 @@ void ewol::Mesh::Draw(mat4& positionMatrix) nbElementDrawTheoric += m_listFaces.GetValue(kkk).m_index.Size(); #endif } else { - mat4 mattttt = (projMatrix * camMatrix) * positionMatrix; + mat4 mattttt = (projMatrix * camMatrix) * _positionMatrix; mattttt.m_mat[3] = 0; mattttt.m_mat[7] = 0; mattttt.m_mat[11] = 0; @@ -160,7 +167,12 @@ void ewol::Mesh::Draw(mat4& positionMatrix) EWOL_DEBUG(((float)nbElementDraw/(float)nbElementDrawTheoric*100.0f) << "% Request Draw : " << m_listFaces.Size() << ":" << nbElementDraw << "/" << nbElementDrawTheoric << " elements [" << m_name << "]"); #endif m_GLprogram->UnUse(); - ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); + if (_enableDepthTest==true){ + if (false==_enableDepthUpdate) { + glDepthMask(GL_TRUE); + } + ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); + } // TODO : UNDERSTAND why ... it is needed glBindBuffer(GL_ARRAY_BUFFER,0); } diff --git a/sources/ewol/resources/Mesh.h b/sources/ewol/resources/Mesh.h index b032da71..28d6b42f 100644 --- a/sources/ewol/resources/Mesh.h +++ b/sources/ewol/resources/Mesh.h @@ -112,7 +112,7 @@ namespace ewol virtual ~Mesh(void); public: virtual const char* GetType(void) { return "ewol::Mesh"; }; - virtual void Draw(mat4& positionMatrix); + virtual void Draw(mat4& _positionMatrix, bool _enableDepthTest=true, bool _enableDepthUpdate=true); void GenerateVBO(void); private: void CalculateNormaleFace(void); @@ -125,7 +125,16 @@ namespace ewol public: void AddMaterial(const etk::UString& _name, ewol::Material* _data); public: - + /** + * @brief Set the check of normal position befor sending it to the openGl card + * @param[in] _status New state. + */ + void SetCheckNormal(bool _status) { m_checkNormal=_status; }; + /** + * @brief Get the check value of normal position befor sending it to the openGl card + * @return Get the chcking stus of normal or not + */ + bool GetCheckNormal(void) { return m_checkNormal; }; const etk::Vector& GetPhysicalProperties(void) const { return m_physics; }; private: void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib