mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0032237: Visualization, TKOpenGl - fix Gouraud shading within perspective camera projection
This commit is contained in:
parent
1a96d253a5
commit
a076535090
@ -1476,7 +1476,16 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramGouraud (c
|
||||
EOL"{"
|
||||
EOL" vec4 aPositionWorld = occModelWorldMatrix * occVertex;"
|
||||
EOL" vec3 aNormal = transformNormal (occNormal);"
|
||||
EOL" vec3 aView = (occWorldViewMatrixInverse * vec4(0.0, 0.0, 1.0, 0.0)).xyz;"
|
||||
EOL" vec3 aView;"
|
||||
EOL" if (occProjectionMatrix[3][3] == 1.0)"
|
||||
EOL" {"
|
||||
EOL" aView = (occWorldViewMatrixInverse * vec4(0.0, 0.0, 1.0, 0.0)).xyz;"
|
||||
EOL" }"
|
||||
EOL" else"
|
||||
EOL" {"
|
||||
EOL" vec3 anEye = (occWorldViewMatrixInverse * vec4(0.0, 0.0, 0.0, 1.0)).xyz;"
|
||||
EOL" aView = normalize (anEye - aPositionWorld.xyz);"
|
||||
EOL" }"
|
||||
EOL" FrontColor = computeLighting (aNormal, aView, aPositionWorld, true);"
|
||||
EOL" BackColor = computeLighting (aNormal, aView, aPositionWorld, false);"
|
||||
+ aSrcVertExtraMain
|
||||
@ -1693,14 +1702,13 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
|
||||
EOL" PositionWorld = occModelWorldMatrix * occVertex;"
|
||||
EOL" if (occProjectionMatrix[3][3] == 1.0)"
|
||||
EOL" {"
|
||||
EOL" View = vec3(0.0, 0.0, 1.0);"
|
||||
EOL" View = (occWorldViewMatrixInverse * vec4(0.0, 0.0, 1.0, 0.0)).xyz;"
|
||||
EOL" }"
|
||||
EOL" else"
|
||||
EOL" {"
|
||||
EOL" vec4 aPosition = occWorldViewMatrix * PositionWorld;"
|
||||
EOL" View = -aPosition.xyz;"
|
||||
EOL" vec3 anEye = (occWorldViewMatrixInverse * vec4(0.0, 0.0, 0.0, 1.0)).xyz;"
|
||||
EOL" View = normalize (anEye - PositionWorld.xyz);"
|
||||
EOL" }"
|
||||
EOL" View = (occWorldViewMatrixInverse * vec4(View, 0.0)).xyz;"
|
||||
+ aSrcVertExtraMain
|
||||
+ THE_VERT_gl_Position
|
||||
+ EOL"}";
|
||||
|
Loading…
x
Reference in New Issue
Block a user