1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0030640: Visualization, Graphic3d_Camera - add option creating Projection matrix with [0,1] depth range

Added new property Graphic3d_Camera::IsZeroToOneDepth() and OpenGl_Caps::useZeroToOneDepth
for activating [0,1] depth range instead of [-1,1] range using glClipControl() within OpenGL 4.5+.
This commit is contained in:
kgv
2021-03-03 14:58:46 +03:00
committed by bugmaster
parent 395d00e058
commit e70625d6b1
25 changed files with 226 additions and 71 deletions

View File

@@ -1085,7 +1085,11 @@ static const char Shaders_RaytraceBase_fs[] =
" vec4 aNDCPoint = uViewMat * vec4 (theRay.Origin, 1.f);\n"
"\n"
" float aPolygonOffset = PolygonOffset (aHit.Normal, theRay.Origin);\n"
" #ifdef THE_ZERO_TO_ONE_DEPTH\n"
" aRaytraceDepth = (aNDCPoint.z / aNDCPoint.w + aPolygonOffset * POLYGON_OFFSET_SCALE);\n"
" #else\n"
" aRaytraceDepth = (aNDCPoint.z / aNDCPoint.w + aPolygonOffset * POLYGON_OFFSET_SCALE) * 0.5f + 0.5f;\n"
" #endif\n"
" }\n"
"\n"
" vec3 aNormal = SmoothNormal (aHit.UV, aTriIndex);\n"