1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0032042: Visualization, TKOpenGl - pre-multiply headlight flag into light source position

OpenGl_ShaderManager::pushLightSourceState() now pre-multiplies headlight transformation.
Built-in shading GLSL programs have been updated to remove special handling if headlight flag;
also removed redundant pre-normalization of light source direction
(already normalized implicitly by Graphic3d_CLight interface).

Graphic3d_CLight::SetHeadlight() now raises exception in case of ambient light type.
OpenGl_ShaderManager::SetLastView() - removed unused property.
This commit is contained in:
kgv
2021-01-08 00:48:29 +03:00
committed by bugmaster
parent 0f26ed5476
commit 37f80e163c
8 changed files with 81 additions and 107 deletions

View File

@@ -293,9 +293,11 @@ public:
Standard_EXPORT void UpdateLightSourceState();
//! Pushes current state of OCCT light sources to specified program (only on state change).
//! Note that light sources definition depends also on WorldViewState.
void PushLightSourceState (const Handle(OpenGl_ShaderProgram)& theProgram) const
{
if (myLightSourceState.Index() != theProgram->ActiveState (OpenGl_LIGHT_SOURCES_STATE))
if (myLightSourceState.Index() != theProgram->ActiveState (OpenGl_LIGHT_SOURCES_STATE)
|| myWorldViewState.Index() != theProgram->ActiveState (OpenGl_WORLD_VIEW_STATE))
{
pushLightSourceState (theProgram);
}
@@ -540,19 +542,6 @@ public:
//! Sets shading model.
Standard_EXPORT void SetShadingModel (const Graphic3d_TypeOfShadingModel theModel);
//! Sets last view manger used with.
//! Helps to handle matrix states in multi-view configurations.
void SetLastView (const OpenGl_View* theLastView)
{
myLastView = theLastView;
}
//! Returns true when provided view is the same as cached one.
bool IsSameView (const OpenGl_View* theView) const
{
return myLastView == theView;
}
protected:
//! Define clipping planes program bits.
@@ -849,10 +838,6 @@ protected:
mutable NCollection_Array1<OpenGl_Vec4d> myClipPlaneArrayFfp;
mutable NCollection_Array1<Standard_Integer> myClipChainArray;
private:
const OpenGl_View* myLastView; //!< Pointer to the last view shader manager used with
};
DEFINE_STANDARD_HANDLE(OpenGl_ShaderManager, Standard_Transient)