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

0032039: Visualization, TKOpenGl - implement simple shadow mapping for a direct light source

Graphic3d_CLight::ToCastShadows() - added new property defining if light should cast shadows (ignored by Ray-Tracing).

OpenGl_ShaderManager::stdComputeLighting() now implements shadow mapping for directional lights.
OpenGl_ShaderManager::prepareGeomMainSrc() now handles copying of arrays.
OpenGl_Context::ShadowMapTexUnit() - added property defining an offset for shadow map texture units.
OpenGl_ShadowMap - added new class storing shadow map FBO with parameters.
OpenGl_View::prepareFrameBuffers() - added resizing of shadow map FBOs.
OpenGl_View::Redraw() - added section redrawing scene into shadow map FBOs via OpenGl_View::renderShadowMap() method.

vrenderparams - added new parameters -shadowMapResolution and -shadowMapBias.
This commit is contained in:
kgv
2021-01-04 12:17:44 +03:00
committed by bugmaster
parent 37f80e163c
commit d84e866973
33 changed files with 1025 additions and 47 deletions

View File

@@ -440,8 +440,12 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
}
#endif
bool anOldCastShadows = false;
if (!myTrsfPers.IsNull())
{
// temporarily disable shadows on non-3d objects
anOldCastShadows = aCtx->ShaderManager()->SetCastShadows (false);
aCtx->WorldViewState.Push();
OpenGl_Mat4& aWorldView = aCtx->WorldViewState.ChangeCurrent();
myTrsfPers->Apply (aCtx->Camera(),
@@ -608,6 +612,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
if (!myTrsfPers.IsNull())
{
aCtx->WorldViewState.Pop();
aCtx->ShaderManager()->SetCastShadows (anOldCastShadows);
}
// Restore named status