mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028180: Visualization, TKOpenGl - Performance of Shaded presentation dropped due to FFP disabled by default
FFP state management (light sources, matrices, clipping planes) has been moved to OpenGl_ShaderManager for consistency with Programmable Pipeline. OpenGl_Context::BindProgram() does not re-bind already active Program. OpenGl_PrimitiveArray::Render() does not reset active Program at the end. OpenGl_Context::ApplyModelViewMatrix() now checks if matrix differs from already set one before modifying state in Shader Manager. This allows avoing redundant state changes, matrix uploads onto GPU and re-computation of inversed matrices. NCollection_Mat4 has been extended with equality check operators for proper comparison. OpenGl_ShaderManager - the tracking Material state has been added. Removed unreachable states OPENGL_NS_RESMAT, OPENGL_NS_TEXTURE and OPENGL_NS_WHITEBACK. Fixed resetting FFP material state after displaying GL_COLOR_ARRAY vertices; the Material state within Shader Manager is now invalidated within OpenGl_VertexBuffer::unbindFixedColor(). OpenGl_Workspace::ApplyAspectFace() - fixed invalidating Material State when only Highlighting style is changing.
This commit is contained in:
@@ -185,6 +185,20 @@ public:
|
||||
return std::memcmp (this, myIdentityArray, sizeof (NCollection_Mat4)) == 0;
|
||||
}
|
||||
|
||||
//! Check this matrix for equality with another matrix (without tolerance!).
|
||||
bool IsEqual (const NCollection_Mat4& theOther) const
|
||||
{
|
||||
return std::memcmp (this, &theOther, sizeof(NCollection_Mat4)) == 0;
|
||||
}
|
||||
|
||||
//! Check this matrix for equality with another matrix (without tolerance!).
|
||||
bool operator== (const NCollection_Mat4& theOther) { return IsEqual (theOther); }
|
||||
bool operator== (const NCollection_Mat4& theOther) const { return IsEqual (theOther); }
|
||||
|
||||
//! Check this matrix for non-equality with another matrix (without tolerance!).
|
||||
bool operator!= (const NCollection_Mat4& theOther) { return !IsEqual (theOther); }
|
||||
bool operator!= (const NCollection_Mat4& theOther) const { return !IsEqual (theOther); }
|
||||
|
||||
//! Raw access to the data (for OpenGL exchange).
|
||||
const Element_t* GetData() const { return myMat; }
|
||||
Element_t* ChangeData() { return myMat; }
|
||||
@@ -456,4 +470,11 @@ Element_t NCollection_Mat4<Element_t>::myIdentityArray[] =
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1};
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
|
||||
#include <type_traits>
|
||||
|
||||
static_assert(std::is_trivially_copyable<NCollection_Mat4<float>>::value, "NCollection_Mat4 is not is_trivially_copyable() structure!");
|
||||
static_assert(std::is_standard_layout <NCollection_Mat4<float>>::value, "NCollection_Mat4 is not is_standard_layout() structure!");
|
||||
#endif
|
||||
|
||||
#endif // _NCollection_Mat4_HeaderFile
|
||||
|
@@ -72,6 +72,21 @@ public:
|
||||
//! Alias to 2nd component as Y coordinate in XY.
|
||||
Element_t& y() { return v[1]; }
|
||||
|
||||
//! Check this vector with another vector for equality (without tolerance!).
|
||||
bool IsEqual (const NCollection_Vec2& theOther) const
|
||||
{
|
||||
return v[0] == theOther.v[0]
|
||||
&& v[1] == theOther.v[1];
|
||||
}
|
||||
|
||||
//! Check this vector with another vector for equality (without tolerance!).
|
||||
bool operator== (const NCollection_Vec2& theOther) { return IsEqual (theOther); }
|
||||
bool operator== (const NCollection_Vec2& theOther) const { return IsEqual (theOther); }
|
||||
|
||||
//! Check this vector with another vector for non-equality (without tolerance!).
|
||||
bool operator!= (const NCollection_Vec2& theOther) { return !IsEqual (theOther); }
|
||||
bool operator!= (const NCollection_Vec2& theOther) const { return !IsEqual (theOther); }
|
||||
|
||||
//! Raw access to the data (for OpenGL exchange).
|
||||
const Element_t* GetData() const { return v; }
|
||||
Element_t* ChangeData() { return v; }
|
||||
|
@@ -129,6 +129,22 @@ public:
|
||||
return *((NCollection_Vec2<Element_t>* )&v[1]);
|
||||
}
|
||||
|
||||
//! Check this vector with another vector for equality (without tolerance!).
|
||||
bool IsEqual (const NCollection_Vec3& theOther) const
|
||||
{
|
||||
return v[0] == theOther.v[0]
|
||||
&& v[1] == theOther.v[1]
|
||||
&& v[2] == theOther.v[2];
|
||||
}
|
||||
|
||||
//! Check this vector with another vector for equality (without tolerance!).
|
||||
bool operator== (const NCollection_Vec3& theOther) { return IsEqual (theOther); }
|
||||
bool operator== (const NCollection_Vec3& theOther) const { return IsEqual (theOther); }
|
||||
|
||||
//! Check this vector with another vector for non-equality (without tolerance!).
|
||||
bool operator!= (const NCollection_Vec3& theOther) { return !IsEqual (theOther); }
|
||||
bool operator!= (const NCollection_Vec3& theOther) const { return !IsEqual (theOther); }
|
||||
|
||||
//! Raw access to the data (for OpenGL exchange).
|
||||
const Element_t* GetData() const { return v; }
|
||||
Element_t* ChangeData() { return v; }
|
||||
|
@@ -175,6 +175,23 @@ public:
|
||||
return *((NCollection_Vec3<Element_t>* )&v[1]);
|
||||
}
|
||||
|
||||
//! Check this vector with another vector for equality (without tolerance!).
|
||||
bool IsEqual (const NCollection_Vec4& theOther) const
|
||||
{
|
||||
return v[0] == theOther.v[0]
|
||||
&& v[1] == theOther.v[1]
|
||||
&& v[2] == theOther.v[2]
|
||||
&& v[3] == theOther.v[3];
|
||||
}
|
||||
|
||||
//! Check this vector with another vector for equality (without tolerance!).
|
||||
bool operator== (const NCollection_Vec4& theOther) { return IsEqual (theOther); }
|
||||
bool operator== (const NCollection_Vec4& theOther) const { return IsEqual (theOther); }
|
||||
|
||||
//! Check this vector with another vector for non-equality (without tolerance!).
|
||||
bool operator!= (const NCollection_Vec4& theOther) { return !IsEqual (theOther); }
|
||||
bool operator!= (const NCollection_Vec4& theOther) const { return !IsEqual (theOther); }
|
||||
|
||||
//! Raw access to the data (for OpenGL exchange).
|
||||
const Element_t* GetData() const { return v; }
|
||||
Element_t* ChangeData() { return v; }
|
||||
|
Reference in New Issue
Block a user