Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoColorMap Class Reference

VSG extension Class for indexed texture color map More...

#include <Inventor/nodes/SoColorMap.h>

+ Inheritance diagram for SoColorMap:

Public Types

enum  ColorMapFormat {
  LUMINANCE ,
  ALPHA ,
  LUMINANCE_ALPHA ,
  RGB ,
  RGB_ALPHA
}
 Color map format. More...
 
enum  PredefinedColorMap {
  NONE ,
  GRAY ,
  TEMPERATURE ,
  PHYSICS ,
  STANDARD ,
  GLOW ,
  BLUE_RED ,
  SEISMIC ,
  BLUE_WHITE_RED ,
  INTENSITY ,
  LABEL_256 ,
  VOLREN_RED ,
  VOLREN_GREEN ,
  AIRWAY ,
  AIRWAY_SURFACES ,
  INTENSITY_REVERSED
}
 Predefined color map. More...
 
enum  Interpolation {
  NEAREST ,
  LINEAR
}
 The colormap interpolation type. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoColorMap ()
 Constructor.
 
unsigned int getNumColor () const
 This convenience method returns the number of colors in the color map (ie: colorMap.getNum()/Number of components or 256 if a predefined color map is used)
 
SbBool hasTransparency () const
 Returns TRUE if the current color map contains alpha values less than 1.
 
- Public Member Functions inherited from SoNode
virtual void setOverride (const SbBool state)
 Turns the override flag on or off.
 
virtual SbBool isOverride () const
 Returns the state of the override flag.
 
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
virtual SbBool affectsState () const
 Returns TRUE if a node has an effect on the state during traversal.
 
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoNode
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoNodegetByName (const SbName &name)
 A node's name can be set using SoBase::setName().
 
static int getByName (const SbName &name, SoNodeList &list)
 A node's name can be set using SoBase::setName().
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoSFFloat min
 This field allow to remap the color map such that only data values ranging from min to max will be mapped to the color map.
 
SoSFFloat max
 See min.
 
SoSFEnum predefinedColorMap
 Use this field to load predefined color maps.
 
SoSFEnum colorMapFormat
 Indicates the format of the color map (number of color components).
 
SoMFFloat colorMap
 Array of floats in range [0,1].
 
SoSFEnum interpolation
 The colormap interpolation type.
 

Detailed Description

VSG extension Class for indexed texture color map

This class describes the association between values of the SoIndexedTexture2 node and colors.

The data value coming from the SoIndexedTexture2 node is used as an index into the color map defined by the colorMap field or the predefinedColorMap field.

The predefinedColorMap field allows you to specify a predefined color map or using value NONE, that the color map is contained in the colorMap field.

The min and max fields define the range of the data values that will actually be used. The color map is modified such that only data values ranging from min to max will be mapped to the color map. The figure below illustrates the effects of these fields:

br

The SoColorMap node acts like an SoShaderProgram with an SoFragmentShader. Standard Open Inventor operations on textures will be disabled on all subsequent nodes, thus using an SoTexture2 node or multitexturing after this node will not give the expected result.

NOTE:

  • The SoColorMap node must be inserted before the SoIndexedTexture2.
  • This node puts the color map in the next available texture unit, so this unit must not be used for any other purpose in your application. On hardware which doesn't support ARB_fragment_program but supports EXT_paletted_texture, the next available texture unit is not used and thus remains available for use by the application.
  • If your graphics hardware does not support the ARB_fragment_program or the EXT_paletted_texture OpenGL extension, this node has no effect.
  • SoColorMap is intended to be used with a SoIndexedTexture2 node. However, without an SoIndexedTexture2 node, the color map will still be applied on the geometry, but without indexation. To specify a color map for volume rendering, see SoTransferFunction.

EXAMPLE

FILE FORMAT/DEFAULT

    ColorMap {
    min 0
    max 0
    predefinedColorMap TEMPERATURE
    colorMapFormat RGB_ALPHA
    colorMap 0
    }

ACTION BEHAVIOR

SEE ALSO

SoIndexedTexture2 SoLightModel

Definition at line 138 of file SoColorMap.h.

Member Enumeration Documentation

◆ ColorMapFormat

Color map format.

Enumerator
LUMINANCE 

(1 float)

ALPHA 

(1 float)

LUMINANCE_ALPHA 

(2 floats)

RGB 

(3 floats)

RGB_ALPHA 

(4 floats)

Definition at line 145 of file SoColorMap.h.

◆ Interpolation

The colormap interpolation type.

These types determine the method used for color map texture filtering.

Enumerator
NEAREST 

Nearest-neighbor interpolation.

LINEAR 

Linear interpolation.

Definition at line 286 of file SoColorMap.h.

◆ PredefinedColorMap

Predefined color map.

Enumerator
NONE 

None.

GRAY 

Gray (Default)

TEMPERATURE 

Temperature.

PHYSICS 

Physics.

STANDARD 

Standard.

GLOW 

Glow.

BLUE_RED 

Blue red.

SEISMIC 

Seismic.

BLUE_WHITE_RED 

Blue white red.

INTENSITY 

Intensity.

LABEL_256 

256 labels

VOLREN_RED 

VolRenRed.

VOLREN_GREEN 

VolRenGreen.

AIRWAY 

Airway.

AIRWAY_SURFACES 

Airway surfaces.

INTENSITY_REVERSED 

Intensity reversed.

Definition at line 162 of file SoColorMap.h.

Constructor & Destructor Documentation

◆ SoColorMap()

SoColorMap::SoColorMap ( )

Constructor.

Member Function Documentation

◆ getClassTypeId()

static SoType SoColorMap::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getNumColor()

unsigned int SoColorMap::getNumColor ( ) const

This convenience method returns the number of colors in the color map (ie: colorMap.getNum()/Number of components or 256 if a predefined color map is used)

◆ getTypeId()

virtual SoType SoColorMap::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoNode.

◆ hasTransparency()

SbBool SoColorMap::hasTransparency ( ) const

Returns TRUE if the current color map contains alpha values less than 1.

FALSE means the color map is completely opaque.

Member Data Documentation

◆ colorMap

SoMFFloat SoColorMap::colorMap

Array of floats in range [0,1].

The number of floats depends on colorMapFormat. It is equal to the number of colors defined multiplied by the number of components per color. For example, for an RGBA color map of length n, there should be 4*n float values in the field. If a predefined color map is specified, the values of this field are not used.

Definition at line 280 of file SoColorMap.h.

◆ colorMapFormat

SoSFEnum SoColorMap::colorMapFormat

Indicates the format of the color map (number of color components).

Use enum ColorMapFormat. Default is RGB_ALPHA.

LUMINANCE means one component per color for a grayscale color map.

ALPHA means one alpha component per color.

LUMINANCE_ALPHA means two components per color, luminance and alpha. In such a case the colorMap float array contains a list of two floats. Index 0 is luminance, index 1 is alpha, index 2 is luminance, index 3 is alpha and so on.

RGB means three components per color, ordered red first, then green and blue.

RGB_ALPHA means four components per color, ordered red first, then green, blue, and alpha.

An alpha value equal to zero means "fully transparent", an alpha value equal to one means "opaque".

Definition at line 271 of file SoColorMap.h.

◆ interpolation

SoSFEnum SoColorMap::interpolation

The colormap interpolation type.

These types determine the method used for color map texture filtering. Use enum Interpolation. Default is NEAREST.

NOTE: field available since Open Inventor 9.4.2

Definition at line 302 of file SoColorMap.h.

◆ max

SoSFFloat SoColorMap::max

See min.

Definition at line 220 of file SoColorMap.h.

◆ min

SoSFFloat SoColorMap::min

This field allow to remap the color map such that only data values ranging from min to max will be mapped to the color map.

min and max must be between minValue and maxValue of the corresponding SoIndexedTexture2 node.

Values less than min and greater than max will be set to colorMap[0] and colorMap[colorMap.getNum()-1] respectively. If min is less than the minimum of the indexed texture minValue , it will be clamped to this minimum. If max is greater than the maximum of the indexed texture maxValue , it will be clamped to this maximum. When min and max are equal to 0 (the default), the entire range of data values is used.

Setting (min,max) to (64,192) while the predefined STANDARD color map is selected and in the case of a UNSIGNED_BYTE indexed texture will make the color map as shown:

Definition at line 215 of file SoColorMap.h.

◆ predefinedColorMap

SoSFEnum SoColorMap::predefinedColorMap

Use this field to load predefined color maps.

Use enum PredefinedColorMap. Default is TEMPERATURE. All predefined color maps have 256 entries.

GRAY

TEMPERATURE

PHYSICS

STANDARD

GLOW

BLUE_RED

SEISMIC

BLUE_WHITE_RED

INTENSITY

LABEL_256

VOLREN_RED

VOLREN_GREEN

AIRWAY

AIRWAY_SURFACES

NOTE: In the images above the checkerboard pattern shows through where the color map alpha (opacity) value is less than 1.0.

If it is set to NONE, the fields below must be set.

Definition at line 249 of file SoColorMap.h.


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