diff --git a/sources/ewol/compositing/Compositing.cpp b/sources/ewol/compositing/Compositing.cpp index 4d8f52fe..607cd0d6 100644 --- a/sources/ewol/compositing/Compositing.cpp +++ b/sources/ewol/compositing/Compositing.cpp @@ -53,3 +53,9 @@ void ewol::Compositing::Clear(void) { m_matrixApply.Identity(); } + + +void ewol::Compositing::SetMatrix(mat4 mat) +{ + m_matrixApply = mat; +} diff --git a/sources/ewol/compositing/Compositing.h b/sources/ewol/compositing/Compositing.h index 32fdd98a..82ada712 100644 --- a/sources/ewol/compositing/Compositing.h +++ b/sources/ewol/compositing/Compositing.h @@ -55,6 +55,11 @@ namespace ewol * @param[in] vect The scaling vector to apply at the transformation matrix */ virtual void Scale(vec3 vect); + /** + * @brief set the transformation matrix + * @param[in] mat The new matrix. + */ + virtual void SetMatrix(mat4 mat); }; }; diff --git a/sources/ewol/compositing/Drawing.cpp b/sources/ewol/compositing/Drawing.cpp index 05d6e15e..a8b5c31b 100644 --- a/sources/ewol/compositing/Drawing.cpp +++ b/sources/ewol/compositing/Drawing.cpp @@ -447,7 +447,8 @@ void ewol::Drawing::LineTo(vec3 dest) { ResetCount(); InternalSetColor(m_color); - if (m_position.x() == dest.x() && m_position.y() == dest.y()) { + EWOL_DEBUG("DrawLine : " << m_position << " to " << dest); + if (m_position.x() == dest.x() && m_position.y() == dest.y() && m_position.z() == dest.z()) { EWOL_WARNING("Try to draw an line width 0"); return; } @@ -467,13 +468,13 @@ void ewol::Drawing::LineTo(vec3 dest) float offsety = sin(teta-M_PI/2) * (m_thickness/2); float offsetx = cos(teta-M_PI/2) * (m_thickness/2); - SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, (float)0.0) ); - SetPoint(vec3(m_position.x() + offsetx, m_position.y() + offsety, (float)0.0) ); - SetPoint(vec3(dest.x() + offsetx, dest.y() + offsety, (float)0.0) ); + SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, m_position.z()) ); + SetPoint(vec3(m_position.x() + offsetx, m_position.y() + offsety, m_position.z()) ); + SetPoint(vec3(dest.x() + offsetx, dest.y() + offsety, m_position.z()) ); - SetPoint(vec3(dest.x() + offsetx, dest.y() + offsety, (float)0.0) ); - SetPoint(vec3(dest.x() - offsetx, dest.y() - offsety, (float)0.0) ); - SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, (float)0.0) ); + SetPoint(vec3(dest.x() + offsetx, dest.y() + offsety, dest.z()) ); + SetPoint(vec3(dest.x() - offsetx, dest.y() - offsety, dest.z()) ); + SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, dest.z()) ); // update the system position : m_position = dest; } diff --git a/sources/ewol/compositing/Drawing.h b/sources/ewol/compositing/Drawing.h index c9235c20..5389803a 100644 --- a/sources/ewol/compositing/Drawing.h +++ b/sources/ewol/compositing/Drawing.h @@ -21,21 +21,21 @@ namespace ewol class Drawing : public ewol::Compositing { private: - vec3 m_position; //!< The current position to draw - vec3 m_clippingPosStart; //!< Clipping start position - vec3 m_clippingPosStop; //!< Clipping stop position - bool m_clippingEnable; //!< true if the clipping must be activated + vec3 m_position; //!< The current position to draw + vec3 m_clippingPosStart; //!< Clipping start position + vec3 m_clippingPosStop; //!< Clipping stop position + bool m_clippingEnable; //!< true if the clipping must be activated private: - draw::Color m_color; //!< The text foreground color - draw::Color m_colorBg; //!< The text background color + draw::Color m_color; //!< The text foreground color + draw::Color m_colorBg; //!< The text background color private: - ewol::Program* m_GLprogram; //!< pointer on the opengl display program - int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) - int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) - int32_t m_GLColor; //!< openGL id on the element (color buffer) + ewol::Program* m_GLprogram; //!< pointer on the opengl display program + int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) + int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) + int32_t m_GLColor; //!< openGL id on the element (color buffer) private: // Background Color (display only when needed) - etk::Vector m_coord; //!< internal position for the text display - etk::Vector m_coordColor; //!< internal color of the background + etk::Vector m_coord; //!< internal position for the text display + etk::Vector m_coordColor; //!< internal color of the background public: /** * @brief Basic constructor @@ -54,10 +54,10 @@ namespace ewol * @brief Un-Load the openGL program and get all the ID needed */ void UnLoadProgram(void); - float m_thickness; //!< when drawing line and other things - int32_t m_triElement; //!< special counter of the single dot generated - vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle - draw::Colorf m_tricolor[3]; //!< Register every the associated color foreground + float m_thickness; //!< when drawing line and other things + int32_t m_triElement; //!< special counter of the single dot generated + vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle + draw::Colorf m_tricolor[3]; //!< Register every the associated color foreground // internal API for the generation abstraction of triangles /** * @brief Lunch the generation of triangle diff --git a/sources/ewol/renderer/resources/Colored3DObject.cpp b/sources/ewol/renderer/resources/Colored3DObject.cpp index f37c76df..aa883dfa 100644 --- a/sources/ewol/renderer/resources/Colored3DObject.cpp +++ b/sources/ewol/renderer/resources/Colored3DObject.cpp @@ -33,7 +33,7 @@ ewol::Colored3DObject::~Colored3DObject(void) void ewol::Colored3DObject::Draw(etk::Vector& vertices, - draw::Colorf& color, + const draw::Colorf& color, bool updateDepthBuffer) { if (vertices.Size()<=0) { @@ -55,7 +55,7 @@ void ewol::Colored3DObject::Draw(etk::Vector& vertices, mat4 tmpMatrix = projMatrix * camMatrix; m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // position : - m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &vertices[0], 4); + m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &vertices[0], 4*sizeof(float)); // color : m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&color); // Request the draw od the elements : @@ -71,7 +71,7 @@ void ewol::Colored3DObject::Draw(etk::Vector& vertices, } void ewol::Colored3DObject::Draw(etk::Vector& vertices, - draw::Colorf& color, + const draw::Colorf& color, mat4& transformationMatrix) { if (vertices.Size()<=0) { @@ -90,7 +90,7 @@ void ewol::Colored3DObject::Draw(etk::Vector& vertices, mat4 tmpMatrix = projMatrix * camMatrix * transformationMatrix; m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // position : - m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &vertices[0]); + m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &vertices[0], 4*sizeof(float)); // color : m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&color); // Request the draw od the elements : @@ -100,7 +100,7 @@ void ewol::Colored3DObject::Draw(etk::Vector& vertices, } void ewol::Colored3DObject::DrawLine(etk::Vector& vertices, - draw::Colorf& color, + const draw::Colorf& color, mat4& transformationMatrix) { if (vertices.Size()<=0) { @@ -119,7 +119,7 @@ void ewol::Colored3DObject::DrawLine(etk::Vector& vertices, mat4 tmpMatrix = projMatrix * camMatrix * transformationMatrix; m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // position : - m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &vertices[0]); + m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &vertices[0], 4*sizeof(float)); // color : m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&color); // Request the draw od the elements : diff --git a/sources/ewol/renderer/resources/Colored3DObject.h b/sources/ewol/renderer/resources/Colored3DObject.h index 383ba397..a1d9d5b0 100644 --- a/sources/ewol/renderer/resources/Colored3DObject.h +++ b/sources/ewol/renderer/resources/Colored3DObject.h @@ -29,13 +29,13 @@ namespace ewol virtual ~Colored3DObject(void); virtual const char* GetType(void) { return "ewol::Colored3DObject"; }; virtual void Draw(etk::Vector& vertices, - draw::Colorf& color, + const draw::Colorf& color, bool updateDepthBuffer=true); virtual void Draw(etk::Vector& vertices, - draw::Colorf& color, + const draw::Colorf& color, mat4& transformationMatrix); virtual void DrawLine(etk::Vector& vertices, - draw::Colorf& color, + const draw::Colorf& color, mat4& transformationMatrix); }; diff --git a/sources/ewol/widget/Button.cpp b/sources/ewol/widget/Button.cpp index a5bce343..f96873d0 100644 --- a/sources/ewol/widget/Button.cpp +++ b/sources/ewol/widget/Button.cpp @@ -280,7 +280,8 @@ void widget::Button::OnRegenerateDisplay(void) bool widget::Button::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos) { bool previousHoverState = m_mouseHover; - if(ewol::keyEvent::statusLeave == typeEvent) { + if( ewol::keyEvent::statusLeave == typeEvent + || ewol::keyEvent::statusAbort == typeEvent) { m_mouseHover = false; m_buttonPressed = false; } else {