EOL" vec3 aLight = occLight_Position (theId).xyz;"
EOL" if (occLight_IsHeadlight (theId) == 0)"
EOL" {"
- EOL" aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 1.0));"
+ EOL" aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 1.0));"
EOL" }"
EOL" aLight -= thePoint;"
EOL
EOL" vec3 aSpotDir = occLight_SpotDirection (theId).xyz;"
EOL" if (occLight_IsHeadlight (theId) == 0)"
EOL" {"
- EOL" aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 1.0));"
- EOL" aSpotDir = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aSpotDir, 0.0));"
+ EOL" aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 1.0));"
+ EOL" aSpotDir = vec3 (occWorldViewMatrix * vec4 (aSpotDir, 0.0));"
EOL" }"
EOL" aLight -= thePoint;"
EOL
EOL" vec3 aLight = normalize (occLight_Position (theId).xyz);"
EOL" if (occLight_IsHeadlight (theId) == 0)"
EOL" {"
- EOL" aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 0.0));"
+ EOL" aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 0.0));"
EOL" }"
EOL
EOL" vec3 aHalf = normalize (aLight + theView);"
EOL" vec3 aLight = normalize (occLightSources[1].xyz);"
EOL" if (occLight_IsHeadlight (0) == 0)"
EOL" {"
- EOL" aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 0.0));"
+ EOL" aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 0.0));"
EOL" }"
EOL
EOL" vec3 aHalf = normalize (aLight + theView);"
return;
}
- GLint aPlanesNb = 0;
- for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes());
- anIter.More(); anIter.Next())
- {
- const Handle(Graphic3d_ClipPlane)& aPlane = anIter.Value();
- if (!myContext->Clipping().IsEnabled (aPlane))
- {
- continue;
- }
-
- ++aPlanesNb;
- }
- if (aPlanesNb < 1)
+ const GLint aNbPlanes = Min (myContext->Clipping().NbClippingOrCappingOn(), THE_MAX_CLIP_PLANES);
+ theProgram->SetUniform (myContext,
+ theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_COUNT),
+ aNbPlanes);
+ if (aNbPlanes < 1)
{
return;
}
OpenGl_Vec4 anEquations[THE_MAX_CLIP_PLANES];
GLuint aPlaneId = 0;
- for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes());
- anIter.More(); anIter.Next())
+ for (OpenGl_ClippingIterator aPlaneIter (myContext->Clipping()); aPlaneIter.More(); aPlaneIter.Next())
{
- const Handle(Graphic3d_ClipPlane)& aPlane = anIter.Value();
- if (!myContext->Clipping().IsEnabled (aPlane))
+ const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIter.Value();
+ if (aPlaneIter.IsDisabled())
{
continue;
}
++aPlaneId;
}
- theProgram->SetUniform (myContext,
- theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_COUNT),
- aPlanesNb);
theProgram->SetUniform (myContext, aLocEquations, THE_MAX_CLIP_PLANES, anEquations);
}
{
aProgramSrc->SetHeader ("#version 300 es");
}
+ else if (myContext->extFragDepth)
+ {
+ aProgramSrc->SetHeader ("#extension GL_EXT_frag_depth : enable"
+ EOL"#define gl_FragDepth gl_FragDepthEXT");
+ }
else
{
// there is no way to draw into depth buffer
EOL"uniform mat4 uMultL;"
EOL"uniform mat4 uMultR;"
EOL
- EOL"vec4 THE_POW_UP = vec4 (2.2, 2.2, 2.2, 1.0);"
- EOL"vec4 THE_POW_DOWN = 1.0 / THE_POW_UP;"
+ EOL"const vec4 THE_POW_UP = vec4 (2.2, 2.2, 2.2, 1.0);"
+ EOL"const vec4 THE_POW_DOWN = 1.0 / vec4 (2.2, 2.2, 2.2, 1.0);"
EOL
EOL"THE_SHADER_IN vec2 TexCoord;"
EOL