1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0029290: Visualization, TKOpenGl - allow defining Light source per ZLayer

Graphic3d_CLight is now defined as a class inheriting Standard_Transient,
so that it's fields now should be accessed through methods.
Graphic3d_CLight::IsEnabled() - new property allowing to disable light source everywhere.
Confusing alias OpenGl_Light has been removed.

Graphic3d_CLight::SetAttenuation() - the upper limit 1.0 of attenuation factors has been removed
since it contradicts to OpenGL specs and does not make sense.

Graphic3d_ZLayerSettings::Lights() - light sources list is now property of ZLayer.
When defined, it overrides light sources defined for View/Viewer.
New class Graphic3d_LightSet has been defined to define a set of light sources.

V3d_Light - removed obsolete interface for debug drawing lights sources.
V3d_Light is now an alias to Graphic3d_CLight.
V3d_TypeOfLight is now defined as a typedef to Graphic3d_TypeOfLightSource.
This commit is contained in:
kgv
2017-11-02 15:36:20 +03:00
parent 3cbd0a8e87
commit 992ed6b3c0
61 changed files with 1816 additions and 2366 deletions

View File

@@ -883,10 +883,18 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
myBVHSelector.SetViewportSize (myWindow->Width(), myWindow->Height(), myRenderParams.ResolutionRatio());
myBVHSelector.CacheClipPtsProjections();
const Handle(OpenGl_ShaderManager)& aManager = aContext->ShaderManager();
if (StateInfo (myCurrLightSourceState, aManager->LightSourceState().Index()) != myLastLightSourceState)
const Handle(OpenGl_ShaderManager)& aManager = aContext->ShaderManager();
const Handle(Graphic3d_LightSet)& aLights = myShadingModel == Graphic3d_TOSM_NONE ? myNoShadingLight : myLights;
Standard_Size aLightsRevision = 0;
if (!aLights.IsNull())
{
aManager->UpdateLightSourceStateTo (myShadingModel == Graphic3d_TOSM_NONE ? &myNoShadingLight : &myLights);
aLightsRevision = aLights->UpdateRevision();
}
if (StateInfo (myCurrLightSourceState, aManager->LightSourceState().Index()) != myLastLightSourceState
|| aLightsRevision != myLightsRevision)
{
myLightsRevision = aLightsRevision;
aManager->UpdateLightSourceStateTo (aLights);
myLastLightSourceState = StateInfo (myCurrLightSourceState, aManager->LightSourceState().Index());
}