55#ifndef _SO_LAZY_ELEMENT
56#define _SO_LAZY_ELEMENT
85#define SO_LAZY_SHINY_THRESHOLD 0.005
88#define SO_LAZY_NUM_COMPONENTS 9
93 const GLvoid * indices);
179 {
return ivState.numDiffuseColors;}
181 {
return ivState.numTransparencies;}
185 {
return(
ivState.packedTransparent ||
186 (
ivState.numTransparencies > 1)||
187 (
ivState.transparencies[0]>0.0));}
203 {
return SbColor(0.8f, 0.8f, 0.8f);}
205 {
return SbColor(0.2f, 0.2f, 0.2f);}
207 {
return SbColor(0.0f, 0.0f, 0.0f);}
209 {
return SbColor(0.0f, 0.0f, 0.0f);}
213 {
return (0xccccccff);}
257 {
return ivState.diffuseColors; }
260 {
return ivState.transparencies;}
290 GLenum type,
const GLvoid * indices);
383 virtual void setTranspTypeElt(
int32_t type);
384 virtual void setAmbientElt(
const SbColor* color);
385 virtual void setEmissiveElt(
const SbColor* color);
386 virtual void setSpecularElt(
const SbColor* color);
387 virtual void setShininessElt(
float value);
388 virtual void setColorMaterialElt(
bool value);
389 virtual void setBlendingElt(
bool value);
415 {
return packedColors;}
418 {
return (nodeId == diffuseNodeId);}
421 {
return (nodeId == transpNodeId);}
424 {diffuseNodeId = diffNodeId; transpNodeId = tNodeId;}
427 {
return packedArraySize;}
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
size_t SbNodeIdType
Type of unique ids of SoNode, used in the notification/change detection handling.
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
#define SO_LAZY_NUM_COMPONENTS
number of components (subelements) in this element:
void SoDrawArraysCallback(void *userData, SoState *state, GLenum mode, GLint first, GLsizei count)
void SoDrawElementsCallback(void *userData, SoState *state, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
#define SO_ELEMENT_HEADER(className)
This one is for non-abstract element classes.
This class is meant to be used by all property nodes that set either a diffuse color or transparency ...
bool transpMatch(SbNodeIdType nodeId)
bool diffuseMatch(SbNodeIdType nodeId)
uint32_t * getPackedColors() const
void reallocate(int32_t size)
SoColorPacker()
Constructor, makes a colorPacker with NULL packedColor pointer:
~SoColorPacker()
destructor, deletes packed color array
void setNodeIds(SbNodeIdType diffNodeId, SbNodeIdType tNodeId)
static int classStackIndex
Stack index for SoElement class.
SoElement()
Constructor; use typeId.createInstance to create elements.
Element that manages several properties such as colors, that need to be lazily tracked by GL.
virtual void registerRedundantSet(SoState *, uint32_t)
method to tell the cache that a redundant set was issued.
static const SbColor & getDiffuse(SoState *state, int index)
get() methods get value from Inventor state.
static float getTransparency(SoState *, int index)
cases
Following masks and cases define the components of the lazy element.
static const SbColor & getAmbient(SoState *)
int32_t getNumDiffuse() const
Methods to inquire about current colors:
static void setOverrideBlending(SoState *state, bool flag)
This method allows to enable overriding of the blending mode.
static const SbColor & getEmissive(SoState *)
static void setPacked(SoState *state, SoNode *node, int32_t numColors, const uint32_t *colors)
static void setTransparencyType(SoState *state, int32_t type)
set method for transparency type is SoINTERNAL, because it should only be invoked by SoGLRenderAction
static SbColor getDefaultEmissive()
const uint32_t * getPackedPointer() const
Following SoINTERNAL get() methods do NOT cause cache dependency, should only be invoked by nodes tha...
static SbColor getDefaultSpecular()
static SbColor getDefaultAmbient()
static SbColor * defaultDiffuseColor
store pointers to the default color, transp so that we can set point to them if no other color or tra...
static SoLazyElement * getInstance(SoState *state)
Returns the top (current) instance of the element in the state Note that the cache dependencies assoc...
static void setBlending(SoState *state, bool value)
static uint32_t getDefaultPacked()
static void setEmissive(SoState *state, const SbColor *color)
virtual void init(SoState *state)
Initializes element.
static void setLightModel(SoState *state, const int32_t model)
static void setShininess(SoState *state, float value)
static SoLazyElement * getWInstance(SoState *state)
Get a Writable instance, so will force a push if needed:
static void setDrawArraysCallback(SoState *state, SoDrawArraysCallback *cb, void *userData)
Set a callback for drawElements().
static void setSpecular(SoState *state, const SbColor *color)
static void setDrawElementsCallback(SoState *state, SoDrawElementsCallback *cb, void *userData)
Set a callback for drawElements().
static void setTransparency(SoState *state, SoNode *node, int32_t numTransp, const float *transp, SoColorPacker *cPacker)
static float getDefaultShininess()
LightModel
Enum values to be used in setting/getting light model:
static bool shouldUseVertexAttributes(SoState *state)
Returns if vertex attributes should be used instead of old style glVertexPointer/glNormalPointer etc.
bool isTransparent() const
virtual void print(FILE *fp) const
Prints element (for debugging)
static int32_t getDefaultLightModel()
virtual SoElement * copyMatchInfo() const
Create a copy that we can put in a cache used list and call matches() on later.
virtual void registerGetDependence(SoState *, uint32_t)
method to register dependence due to get().
static void setColorMaterial(SoState *state, bool value)
virtual void push(SoState *state)
push (for non-GL elements)
static const SbColor & getSpecular(SoState *)
static void setUseVertexAttributes(SoState *state, bool flag)
Sets if vertex attributes should be used instead of old style glVertexPointer/glNormalPointer etc.
static void setAmbient(SoState *state, const SbColor *color)
static void drawElements(SoState *state, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
Draws the given data using glDrawElements() or via a callback if one has been set.
static bool getBlending(SoState *)
static void drawArrays(SoState *state, GLenum mode, GLint first, GLsizei count)
Draws the given data using glDrawArrays() or via a callback if one has been set.
static void setDiffuse(SoState *state, SoNode *node, int32_t numColors, const SbColor *colors, SoColorPacker *cPacker)
static set methods:
const SbColor * getDiffusePointer() const
static void setMaterials(SoState *state, SoNode *node, uint32_t bitmask, SoColorPacker *cPacker, const SoMFColor &diffuse, const SoMFFloat &transp, const SoMFColor &ambient, const SoMFColor &emissive, const SoMFColor &specular, const SoMFFloat &shininess)
set method for use in SoMaterial nodes:
static bool getColorMaterial(SoState *)
static float * defaultTransparency
const float * getTransparencyPointer() const
static uint32_t * defaultPackedColor
static float getDefaultTransparency()
uint32_t invalidBits
This is more convenient here, but might logically be kept with SoGLLazyElement.
int32_t getNumTransparencies() const
static int32_t getLightModel(SoState *)
static int getNumPatterns()
Returns number of transparency levels supported with stipple patterns.
static void initClass()
Initializes the SoLazyElement class.
virtual bool matches(const SoElement *) const
note: matches, copyMatchinfo not used by this element.
static const uint32_t * getPackedColors(SoState *)
static SbColor getDefaultDiffuse()
Specify inventor defaults for colors, etc.
static float getShininess(SoState *)
Multiple-value field containing any number of RGB colors stored as three floats.
Multiple-value field containing any number of floating point values.
Abstract base class for all database nodes.
An SoState collects and holds state while traversing a scene graph.
SoElement * getElement(int stackIndex)
Returns a writable instance of the element on the top of the stack with the given index.
SoElement * getElementNoPush(int stackIndex) const
Internal-only, dangerous method that returns a writeable element without checking for state depth and...
Struct to hold the inventor state:
SoDrawElementsCallback * drawElementsCallback
bool packed
following are not used for matching GL & IV, but must be copied on push:
SoDrawArraysCallback * drawArraysCallback
const float * transparencies
const SbColor * diffuseColors
int32_t numTransparencies
uint32_t cacheLevelSetBits
SbNodeIdType transpNodeId
for transparency, keep either nodeid, or 0 if opaque.
void * drawElementsCallbackUserData
SbColor ambientColor
store a value of each color component; ambient, emissive, specular, shininess, or appropriate info to...
SbNodeIdType diffuseNodeId
Keep nodeID to compare diffuse GL and diffuse inventor state: 0 is initial value, 1 is invalid.
void * drawArraysCallbackUserData
const uint32_t * packedColors
uint32_t cacheLevelSendBits