Open CASCADE Technology  7.4.0
Data Structures | Public Types | Public Member Functions

Graphic3d_LightSet Class Reference

Class defining the set of light sources. More...

#include <Graphic3d_LightSet.hxx>

Inheritance diagram for Graphic3d_LightSet:
Inheritance graph
[legend]

Data Structures

class  Iterator
 Iterator through light sources. More...
 

Public Types

enum  IterationFilter { IterationFilter_None = 0x0000, IterationFilter_ExcludeAmbient = 0x0002, IterationFilter_ExcludeDisabled = 0x0004, IterationFilter_ExcludeDisabledAndAmbient = IterationFilter_ExcludeAmbient | IterationFilter_ExcludeDisabled }
 Iteration filter flags. More...
 
- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 

Public Member Functions

 Graphic3d_LightSet ()
 Empty constructor. More...
 
Standard_Integer Lower () const
 Return lower light index. More...
 
Standard_Integer Upper () const
 Return upper light index. More...
 
Standard_Boolean IsEmpty () const
 Return TRUE if lights list is empty. More...
 
Standard_Integer Extent () const
 Return number of light sources. More...
 
const Handle< Graphic3d_CLight > & Value (Standard_Integer theIndex) const
 Return the light source for specified index within range [Lower(), Upper()]. More...
 
Standard_Boolean Contains (const Handle< Graphic3d_CLight > &theLight) const
 Return TRUE if light source is defined in this set. More...
 
Standard_Boolean Add (const Handle< Graphic3d_CLight > &theLight)
 Append new light source. More...
 
Standard_Boolean Remove (const Handle< Graphic3d_CLight > &theLight)
 Remove light source. More...
 
Standard_Integer NbLightsOfType (Graphic3d_TypeOfLightSource theType) const
 Returns total amount of lights of specified type. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

cached state of lights set updated by UpdateRevision()

NCollection_IndexedDataMap< Handle< Graphic3d_CLight >, Standard_SizemyLights
 list of light sources with their cached state (revision) More...
 
Graphic3d_Vec4 myAmbient
 cached value of cumulative ambient color More...
 
TCollection_AsciiString myKeyEnabledLong
 key identifying the list of enabled light sources by their type More...
 
TCollection_AsciiString myKeyEnabledShort
 key identifying the list of enabled light sources by the number of sources of each type More...
 
Standard_Integer myLightTypes [Graphic3d_TypeOfLightSource_NB]
 counters per each light source type defined in the list More...
 
Standard_Integer myLightTypesEnabled [Graphic3d_TypeOfLightSource_NB]
 counters per each light source type enabled in the list More...
 
Standard_Integer myNbEnabled
 number of enabled light sources, excluding ambient More...
 
Standard_Size myRevision
 current revision of light source set More...
 
Standard_Size myCacheRevision
 revision of cached state More...
 
Standard_Size UpdateRevision ()
 Update light sources revision. More...
 
Standard_Size Revision () const
 Return light sources revision. More...
 
Standard_Integer NbEnabled () const
 Returns total amount of enabled lights EXCLUDING ambient. More...
 
Standard_Integer NbEnabledLightsOfType (Graphic3d_TypeOfLightSource theType) const
 Returns total amount of enabled lights of specified type. More...
 
const Graphic3d_Vec4AmbientColor () const
 Returns cumulative ambient color, which is computed as sum of all enabled ambient light sources. Values are NOT clamped (can be greater than 1.0f) and alpha component is fixed to 1.0f. More...
 
const TCollection_AsciiStringKeyEnabledLong () const
 Returns a string defining a list of enabled light sources as concatenation of letters 'd' (Directional), 'p' (Point), 's' (Spot) depending on the type of light source in the list. Example: "dppp". More...
 
const TCollection_AsciiStringKeyEnabledShort () const
 Returns a string defining a list of enabled light sources as concatenation of letters 'd' (Directional), 'p' (Point), 's' (Spot) depending on the type of light source in the list, specified only once. Example: "dp". More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Detailed Description

Class defining the set of light sources.

Member Enumeration Documentation

◆ IterationFilter

Iteration filter flags.

Enumerator
IterationFilter_None 

no filter

IterationFilter_ExcludeAmbient 

exclude ambient light sources

IterationFilter_ExcludeDisabled 

exclude disabled light sources

IterationFilter_ExcludeDisabledAndAmbient 

Constructor & Destructor Documentation

◆ Graphic3d_LightSet()

Graphic3d_LightSet::Graphic3d_LightSet ( )

Empty constructor.

Member Function Documentation

◆ Add()

Standard_Boolean Graphic3d_LightSet::Add ( const Handle< Graphic3d_CLight > &  theLight)

Append new light source.

◆ AmbientColor()

const Graphic3d_Vec4& Graphic3d_LightSet::AmbientColor ( ) const
inline

Returns cumulative ambient color, which is computed as sum of all enabled ambient light sources. Values are NOT clamped (can be greater than 1.0f) and alpha component is fixed to 1.0f.

See also
UpdateRevision()

◆ Contains()

Standard_Boolean Graphic3d_LightSet::Contains ( const Handle< Graphic3d_CLight > &  theLight) const
inline

Return TRUE if light source is defined in this set.

◆ Extent()

Standard_Integer Graphic3d_LightSet::Extent ( ) const
inline

Return number of light sources.

◆ IsEmpty()

Standard_Boolean Graphic3d_LightSet::IsEmpty ( ) const
inline

Return TRUE if lights list is empty.

◆ KeyEnabledLong()

const TCollection_AsciiString& Graphic3d_LightSet::KeyEnabledLong ( ) const
inline

Returns a string defining a list of enabled light sources as concatenation of letters 'd' (Directional), 'p' (Point), 's' (Spot) depending on the type of light source in the list. Example: "dppp".

See also
UpdateRevision()

◆ KeyEnabledShort()

const TCollection_AsciiString& Graphic3d_LightSet::KeyEnabledShort ( ) const
inline

Returns a string defining a list of enabled light sources as concatenation of letters 'd' (Directional), 'p' (Point), 's' (Spot) depending on the type of light source in the list, specified only once. Example: "dp".

See also
UpdateRevision()

◆ Lower()

Standard_Integer Graphic3d_LightSet::Lower ( void  ) const
inline

Return lower light index.

◆ NbEnabled()

Standard_Integer Graphic3d_LightSet::NbEnabled ( ) const
inline

Returns total amount of enabled lights EXCLUDING ambient.

See also
UpdateRevision()

◆ NbEnabledLightsOfType()

Standard_Integer Graphic3d_LightSet::NbEnabledLightsOfType ( Graphic3d_TypeOfLightSource  theType) const
inline

Returns total amount of enabled lights of specified type.

See also
UpdateRevision()

◆ NbLightsOfType()

Standard_Integer Graphic3d_LightSet::NbLightsOfType ( Graphic3d_TypeOfLightSource  theType) const
inline

Returns total amount of lights of specified type.

◆ Remove()

Standard_Boolean Graphic3d_LightSet::Remove ( const Handle< Graphic3d_CLight > &  theLight)

Remove light source.

◆ Revision()

Standard_Size Graphic3d_LightSet::Revision ( ) const
inline

Return light sources revision.

See also
UpdateRevision()

◆ UpdateRevision()

Standard_Size Graphic3d_LightSet::UpdateRevision ( )

Update light sources revision.

◆ Upper()

Standard_Integer Graphic3d_LightSet::Upper ( void  ) const
inline

Return upper light index.

◆ Value()

const Handle< Graphic3d_CLight >& Graphic3d_LightSet::Value ( Standard_Integer  theIndex) const
inline

Return the light source for specified index within range [Lower(), Upper()].

Field Documentation

◆ myAmbient

Graphic3d_Vec4 Graphic3d_LightSet::myAmbient
protected

cached value of cumulative ambient color

◆ myCacheRevision

Standard_Size Graphic3d_LightSet::myCacheRevision
protected

revision of cached state

◆ myKeyEnabledLong

TCollection_AsciiString Graphic3d_LightSet::myKeyEnabledLong
protected

key identifying the list of enabled light sources by their type

◆ myKeyEnabledShort

TCollection_AsciiString Graphic3d_LightSet::myKeyEnabledShort
protected

key identifying the list of enabled light sources by the number of sources of each type

◆ myLights

NCollection_IndexedDataMap<Handle< Graphic3d_CLight >, Standard_Size> Graphic3d_LightSet::myLights
protected

list of light sources with their cached state (revision)

◆ myLightTypes

Standard_Integer Graphic3d_LightSet::myLightTypes[Graphic3d_TypeOfLightSource_NB]
protected

counters per each light source type defined in the list

◆ myLightTypesEnabled

Standard_Integer Graphic3d_LightSet::myLightTypesEnabled[Graphic3d_TypeOfLightSource_NB]
protected

counters per each light source type enabled in the list

◆ myNbEnabled

Standard_Integer Graphic3d_LightSet::myNbEnabled
protected

number of enabled light sources, excluding ambient

◆ myRevision

Standard_Size Graphic3d_LightSet::myRevision
protected

current revision of light source set


The documentation for this class was generated from the following file: