[DEV] add some optionnel parameter to display

This commit is contained in:
Edouard DUPIN 2013-09-13 21:52:18 +02:00
parent 318e44f571
commit 4fc426c414
14 changed files with 46 additions and 20 deletions

2
external/ege vendored

@ -1 +1 @@
Subproject commit d68acc190307c9be0232f3b17cfe0c8cbb3ea683 Subproject commit 912f4b83167007e6ca5bed76d899316a802f1590

View File

@ -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) { if (m_coord.Size()<=0) {
//EWOL_WARNING("Nothink to draw..."); //EWOL_WARNING("Nothink to draw...");

View File

@ -51,7 +51,7 @@ namespace ewol
/** /**
* @brief Draw All the refistered text in the current element on openGL * @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 * @brief Clear alll the registered element in the current element
*/ */

View File

@ -31,7 +31,7 @@ namespace ewol
/** /**
* @brief Virtal pure function that request the draw of all openGl elements * @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 * @brief Clear alll tre registered element in the current element
*/ */

View File

@ -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) { if (m_coord.Size()<=0) {
// TODO : a remÚtre ... // TODO : a remÚtre ...

View File

@ -82,7 +82,7 @@ namespace ewol
/** /**
* @brief Draw All the refistered text in the current element on openGL * @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 * @brief Clear alll tre registered element in the current element
*/ */

View File

@ -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) { if (m_coord.Size()<=0) {
//EWOL_WARNING("Nothink to draw..."); //EWOL_WARNING("Nothink to draw...");
@ -65,7 +65,11 @@ void ewol::Image::Draw(void)
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; 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 // set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply; mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply;
m_GLprogram->Use(); m_GLprogram->Use();

View File

@ -55,8 +55,9 @@ namespace ewol
public: public:
/** /**
* @brief Draw All the refistered text in the current element on openGL * @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 * @brief Clear alll tre registered element in the current element
*/ */

View File

@ -103,7 +103,7 @@ void ewol::Shaper::LoadProgram(void)
} }
void ewol::Shaper::Draw(void) void ewol::Shaper::Draw(bool _disableDepthTest)
{ {
if (m_config == NULL) { if (m_config == NULL) {
// this is a normale case ... the user can choice to have no config basic file ... // this is a normale case ... the user can choice to have no config basic file ...

View File

@ -79,7 +79,7 @@ namespace ewol
/** /**
* @brief Draw All the refistered text in the current element on openGL * @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 * @brief Clear alll tre registered element in the current element
*/ */

View File

@ -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: // draw BG in any case:
m_vectorialDraw.Draw(); m_vectorialDraw.Draw();

View File

@ -115,7 +115,7 @@ namespace ewol
/** /**
* @brief Draw All the refistered text in the current element on openGL * @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); void Draw(const mat4& _transformationMatrix, bool _enableDepthTest=false);
/** /**
* @brief Clear all the registered element in the current element * @brief Clear all the registered element in the current element

View File

@ -78,14 +78,21 @@ ewol::Mesh::~Mesh(void)
//#define DISPLAY_NB_VERTEX_DISPLAYED //#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) { if (m_GLprogram==NULL) {
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
//EWOL_DEBUG(m_name << " " << m_light); //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" ); //EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
m_GLprogram->Use(); m_GLprogram->Use();
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
@ -93,7 +100,7 @@ void ewol::Mesh::Draw(mat4& positionMatrix)
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->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 : // position :
m_GLprogram->SendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES); m_GLprogram->SendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES);
// Texture : // Texture :
@ -119,7 +126,7 @@ void ewol::Mesh::Draw(mat4& positionMatrix)
nbElementDrawTheoric += m_listFaces.GetValue(kkk).m_index.Size(); nbElementDrawTheoric += m_listFaces.GetValue(kkk).m_index.Size();
#endif #endif
} else { } else {
mat4 mattttt = (projMatrix * camMatrix) * positionMatrix; mat4 mattttt = (projMatrix * camMatrix) * _positionMatrix;
mattttt.m_mat[3] = 0; mattttt.m_mat[3] = 0;
mattttt.m_mat[7] = 0; mattttt.m_mat[7] = 0;
mattttt.m_mat[11] = 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 << "]"); EWOL_DEBUG(((float)nbElementDraw/(float)nbElementDrawTheoric*100.0f) << "% Request Draw : " << m_listFaces.Size() << ":" << nbElementDraw << "/" << nbElementDrawTheoric << " elements [" << m_name << "]");
#endif #endif
m_GLprogram->UnUse(); 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 // TODO : UNDERSTAND why ... it is needed
glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ARRAY_BUFFER,0);
} }

View File

@ -112,7 +112,7 @@ namespace ewol
virtual ~Mesh(void); virtual ~Mesh(void);
public: public:
virtual const char* GetType(void) { return "ewol::Mesh"; }; 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); void GenerateVBO(void);
private: private:
void CalculateNormaleFace(void); void CalculateNormaleFace(void);
@ -125,7 +125,16 @@ namespace ewol
public: public:
void AddMaterial(const etk::UString& _name, ewol::Material* _data); void AddMaterial(const etk::UString& _name, ewol::Material* _data);
public: 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<ewol::PhysicsShape*>& GetPhysicalProperties(void) const { return m_physics; }; const etk::Vector<ewol::PhysicsShape*>& GetPhysicalProperties(void) const { return m_physics; };
private: private:
void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib