1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +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

@@ -147,10 +147,10 @@ uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sour
//! Intensity of light source (>= 0), float.
#define occLight_Intensity(theId) occLightSources[theId * 4 + 0].a
//! Is light a headlight, bool?
#define occLight_IsHeadlight(theId) (occLightSources[theId * 4 + 1].w > 0.5)
//! Is light a headlight, bool? DEPRECATED method.
#define occLight_IsHeadlight(theId) false
//! Position of specified light source, vec3.
//! Position of specified light source or direction of directional light source, vec3.
#define occLight_Position(theId) occLightSources[theId * 4 + 1].xyz
//! Direction of specified spot light source, vec3.

View File

@@ -150,10 +150,10 @@ static const char Shaders_Declarations_glsl[] =
"//! Intensity of light source (>= 0), float.\n"
"#define occLight_Intensity(theId) occLightSources[theId * 4 + 0].a\n"
"\n"
"//! Is light a headlight, bool?\n"
"#define occLight_IsHeadlight(theId) (occLightSources[theId * 4 + 1].w > 0.5)\n"
"//! Is light a headlight, bool? DEPRECATED method.\n"
"#define occLight_IsHeadlight(theId) false\n"
"\n"
"//! Position of specified light source, vec3.\n"
"//! Position of specified light source or direction of directional light source, vec3.\n"
"#define occLight_Position(theId) occLightSources[theId * 4 + 1].xyz\n"
"\n"
"//! Direction of specified spot light source, vec3.\n"