1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +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

@@ -114,6 +114,10 @@ void Graphic3d_CLight::SetEnabled (Standard_Boolean theIsOn)
// =======================================================================
void Graphic3d_CLight::SetHeadlight (Standard_Boolean theValue)
{
if (myType == Graphic3d_TOLS_AMBIENT)
{
throw Standard_ProgramError ("Graphic3d_CLight::SetHeadlight() is not applicable to ambient light");
}
updateRevisionIf (myIsHeadlight != theValue);
myIsHeadlight = theValue;
}

View File

@@ -202,6 +202,9 @@ public:
//! Returns direction of directional/spot light and range for positional/spot light in alpha channel.
const Graphic3d_Vec4& PackedDirectionRange() const { return myDirection; }
//! Returns direction of directional/spot light.
Graphic3d_Vec3 PackedDirection() const { return myDirection.xyz(); }
//! @return modification counter
Standard_Size Revision() const { return myRevision; }