Open Inventor Reference
SoGLLightIdElement Class Reference

Element that stores the id of the current light. More...

#include <Inventor/elements/SoGLLightIdElement.h>

Inheritance diagram for SoGLLightIdElement:
SoInt32Element SoElement

Public Member Functions

virtual void init (SoState *state)
 Initializes element.
 
virtual void push (SoState *state)
 Overrides push() method to copy values from next instance in the stack.
 
virtual void pop (SoState *state, const SoElement *prevTopElement)
 Override pop() method so side effects can occur in GL.
 
virtual void print (FILE *fp) const
 Prints element (for debugging)
 
- Public Member Functions inherited from SoInt32Element
virtual bool matches (const SoElement *elt) const
 Comparison based on value of int32_ts.
 
virtual SoElementcopyMatchInfo () const
 Copy method, takes care copying the data.
 
virtual void setElt (int32_t value)
 Virtual set that subclasses can override to implement side-effect behaviors.
 
virtual void print (FILE *fp) const
 Prints element (for debugging)
 
- Public Member Functions inherited from SoElement
virtual void init (SoState *state)
 Initializes element.
 
virtual void push (SoState *state)
 Pushes/pops element.
 
virtual void pop (SoState *state, const SoElement *prevTopElement)
 
virtual void print (FILE *fp) const
 Prints element (for debugging)
 
virtual bool matches (const SoElement *elt) const =0
 Returns TRUE if the element matches another element (of the same class, presumably) with respect to cache validity.
 
virtual SoElementcopyMatchInfo () const =0
 Create a copy that we can put in a cache used list and call matches() on later.
 
SoType getTypeId () const
 Returns type identifier for element instance.
 
int getStackIndex () const
 Returns the stack index for an element instance.
 
void setDepth (int dpth)
 Sets stuff in an element instance.
 
void setNext (SoElement *nxt)
 
void setNextInStack (SoElement *nxt)
 
void setNextFree (SoElement *nxt)
 
int getDepth () const
 Returns stuff from element instance.
 
SoElementgetNext () const
 
virtual ~SoElement ()
 Destructor.
 

Static Public Member Functions

static int increment (SoState *state)
 Increments the current light id.
 
static int increment (SoState *state, SoNode *)
 
static int get (SoState *state)
 Returns current light id from the state.
 
static int getDefault ()
 Returns the default light id.
 
static int getMaxGLSources ()
 Returns the maximum number of concurrent light sources supported by GL implementation.
 
static void initClass ()
 Initializes the SoGLLightIdElement class.
 
- Static Public Member Functions inherited from SoInt32Element
static void initClass ()
 Initializes the SoInt32Element class.
 
static void set (int stackIndex, SoState *state, int32_t value)
 Set value.
 
static void set (int stackIndex, SoState *state, SoNode *, int32_t value)
 
static void set (int stackIndex, SoState *state, SoNode *, long value)
 
static int32_t get (int stackIndex, SoState *state)
 Get value.
 
- Static Public Member Functions inherited from SoElement
static SoType getClassTypeId ()
 Returns type identifier for SoElement class.
 
static void initElements ()
 Initialize ALL Inventor element classes.
 
static void initClass ()
 Initializes the SoElement class.
 
static int getNumStackIndices ()
 Returns the number of stack indices allocated.
 
static SoType getIdFromStackIndex (int stackIndex)
 Returns the id for the element with the given stack index.
 

Protected Member Functions

virtual ~SoGLLightIdElement ()
 
- Protected Member Functions inherited from SoInt32Element
virtual ~SoInt32Element ()
 
- Protected Member Functions inherited from SoElement
 SoElement ()
 Constructor; use typeId.createInstance to create elements.
 
void capture (SoState *state) const
 Does whatever is necessary in state to capture this element for caching purposes.
 
virtual void captureThis (SoState *state) const
 Really captures this element, once it has been determined that a cache is open to capture it.
 
void setTypeId (SoType id)
 Sets typeId in instance.
 
void setStackIndex (int index)
 Sets stackIndex in instance.
 
SoElementgetNextInStack () const
 Returns next instance in specific element stack.
 
SoElementgetNextFree () const
 Returns next free element in a specific element stack.
 

Additional Inherited Members

- Static Protected Member Functions inherited from SoElement
static SoElementgetElement (SoState *state, int stackIndex)
 Returns an instance of an element from the stack with the given index in the given state.
 
static const SoElementgetConstElement (SoState *state, int stackIndex)
 Returns a read-only pointer to the top instance in the given element stack.
 
static int createStackIndex (SoType id)
 Creates and returns a new stack index.
 
- Protected Attributes inherited from SoInt32Element
int32_t data
 Storage for data.
 
- Static Protected Attributes inherited from SoElement
static int classStackIndex
 Stack index for SoElement class.
 

Detailed Description

The first light active in a scene has id 0, the next has 1, and so on. This element can be used to determine how many lights are currently active. The initial value of this element is -1 to indicate that there are no lights active.

Note that even though the effects of this element accumulate (each light source increments the id), it is derived from SoInt32Element. This is because each call to increment() effectively does a "get" of the current top instance, so caching knows about the dependency of each instance on the previous one.

Definition at line 79 of file SoGLLightIdElement.h.

Constructor & Destructor Documentation

◆ ~SoGLLightIdElement()

virtual SoGLLightIdElement::~SoGLLightIdElement ( )
protectedvirtual

Member Function Documentation

◆ get()

static int SoGLLightIdElement::get ( SoState state)
inlinestatic

Definition at line 99 of file SoGLLightIdElement.h.

References SoInt32Element::get().

◆ getDefault()

static int SoGLLightIdElement::getDefault ( )
inlinestatic

Definition at line 103 of file SoGLLightIdElement.h.

◆ getMaxGLSources()

static int SoGLLightIdElement::getMaxGLSources ( )
static

◆ increment() [1/2]

static int SoGLLightIdElement::increment ( SoState state)
static

This should be called when a light source becomes active. This returns the new id, or -1 if the maximum number of GL light sources has been exceeded. Otherwise, enables light source.

◆ increment() [2/2]

static int SoGLLightIdElement::increment ( SoState state,
SoNode  
)
inlinestatic

Definition at line 94 of file SoGLLightIdElement.h.

◆ init()

virtual void SoGLLightIdElement::init ( SoState state)
virtual

Reimplemented from SoElement.

◆ initClass()

static void SoGLLightIdElement::initClass ( )
static

◆ pop()

virtual void SoGLLightIdElement::pop ( SoState state,
const SoElement prevTopElement 
)
virtual

Reimplemented from SoElement.

◆ print()

virtual void SoGLLightIdElement::print ( FILE *  fp) const
virtual

Reimplemented from SoInt32Element.

◆ push()

virtual void SoGLLightIdElement::push ( SoState state)
virtual

Reimplemented from SoElement.


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