1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +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

@@ -42,7 +42,6 @@
#include <OpenGl_FrameBuffer.hxx>
#include <OpenGl_GraduatedTrihedron.hxx>
#include <OpenGl_LayerList.hxx>
#include <OpenGl_Light.hxx>
#include <OpenGl_LineAttributes.hxx>
#include <OpenGl_SceneGeometry.hxx>
#include <OpenGl_Structure.hxx>
@@ -280,10 +279,10 @@ public:
Standard_EXPORT virtual void SetCamera (const Handle(Graphic3d_Camera)& theCamera) Standard_OVERRIDE;
//! Returns list of lights of the view.
virtual const Graphic3d_ListOfCLight& Lights() const Standard_OVERRIDE { return myLights; }
virtual const Handle(Graphic3d_LightSet)& Lights() const Standard_OVERRIDE { return myLights; }
//! Sets list of lights for the view.
virtual void SetLights (const Graphic3d_ListOfCLight& theLights) Standard_OVERRIDE
virtual void SetLights (const Handle(Graphic3d_LightSet)& theLights) Standard_OVERRIDE
{
myLights = theLights;
myCurrLightSourceState = myStateCounter->Increment();
@@ -325,9 +324,6 @@ public:
//! Returns list of OpenGL Z-layers.
const OpenGl_LayerList& LayerList() const { return myZLayers; }
//! Returns list of openGL light sources.
const OpenGl_ListOfLight& LightList() const { return myLights; }
//! Returns OpenGL window implementation.
const Handle(OpenGl_Window) GlWindow() const { return myWindow; }
@@ -484,13 +480,14 @@ protected:
Handle(Graphic3d_TextureEnv) myTextureEnvData;
Graphic3d_GraduatedTrihedron myGTrihedronData;
OpenGl_ListOfLight myNoShadingLight;
OpenGl_ListOfLight myLights;
Handle(Graphic3d_LightSet) myNoShadingLight;
Handle(Graphic3d_LightSet) myLights;
OpenGl_LayerList myZLayers; //!< main list of displayed structure, sorted by layers
Graphic3d_WorldViewProjState myWorldViewProjState; //!< camera modification state
OpenGl_StateCounter* myStateCounter;
Standard_Size myCurrLightSourceState;
Standard_Size myLightsRevision;
typedef std::pair<Standard_Size, Standard_Size> StateInfo;