mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0027943: Visualization - fix broken shading by positional light for object with local transformation
OpenGl_ShaderManager, per-vertex shading and per-fragment shading - do not apply model-world matrix on the light sources which are expected to be defined in world-space.
This commit is contained in:
@@ -31,7 +31,7 @@ void pointLight (in int theId,
|
||||
vec3 aLight = occLight_Position (theId).xyz;
|
||||
if (occLight_IsHeadlight (theId) == 0)
|
||||
{
|
||||
aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 1.0));
|
||||
aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 1.0));
|
||||
}
|
||||
aLight -= thePoint;
|
||||
|
||||
@@ -67,8 +67,8 @@ void spotLight (in int theId,
|
||||
vec3 aSpotDir = occLight_SpotDirection (theId).xyz;
|
||||
if (occLight_IsHeadlight (theId) == 0)
|
||||
{
|
||||
aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 1.0));
|
||||
aSpotDir = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aSpotDir, 0.0));
|
||||
aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 1.0));
|
||||
aSpotDir = vec3 (occWorldViewMatrix * vec4 (aSpotDir, 0.0));
|
||||
}
|
||||
aLight -= thePoint;
|
||||
|
||||
@@ -116,7 +116,7 @@ void directionalLight (in int theId,
|
||||
vec3 aLight = normalize (occLight_Position (theId).xyz);
|
||||
if (occLight_IsHeadlight (theId) == 0)
|
||||
{
|
||||
aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 0.0));
|
||||
aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 0.0));
|
||||
}
|
||||
|
||||
vec3 aHalf = normalize (aLight + theView);
|
||||
|
Reference in New Issue
Block a user