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

VSG extension Shader parameter node storing a texture image. More...

#include <Inventor/nodes/SoShaderParameterImage.h>

+ Inheritance diagram for SoShaderParameterImage:

Public Types

enum  AccessMode {
  READ = SbEnums::READ ,
  WRITE = SbEnums::WRITE ,
  READ_WRITE = SbEnums::READ_WRITE
}
 Image access modes. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoShaderParameterImage ()
 
- 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 SoShaderParameter
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

SoSFNode texture
 Specifies the texture to bind to the image unit.
 
SoSFInt32 layer
 Specifies the layer of texture to be bound to the image unit.
 
SoSFEnum accessMode
 Specifies the type of access that will be performed on the image.
 
- Public Attributes inherited from SoShaderParameter
SoSFString name
 Specifies the parameter's string name which is declared and used within high-level shading programs.
 
SoSFInt32 identifier
 Specifies the parameter's integer name which is declared and used within low-level shading programs.
 

Detailed Description

VSG extension Shader parameter node storing a texture image.

This node allows the application to bind a texture to an image unit for the purpose of reading and writing it from shaders. texture specifies an existing texture node to bind to the image unit.

If texture is an SoTextureCubeMap or an SoTexture3 with SoTexture3::ARRAY layout, then it is possible to bind either the entire array, or only a single layer of the array to the image unit. In such cases, if layer is -1, the entire array is attached to the image unit. Otherwise, layer specifies the layer of the array to attach to the image unit.

accessMode specifies the access types to be performed by shaders and may be set to READ, WRITE, or READ_WRITE to indicate read-only, write-only or read-write access, respectively. Violation of the access type specified in accessMode (for example, if a shader writes to an image bound with accessMode set to READ) will lead to undefined results, possibly including program termination.

SoShaderParameterImage nodes are usually added to the field SoShaderProgram::images to affect only that specific shader program, but can also be inserted in the scene graph and affect all subsequent shader programs.

See Image Load Store section of the OpenGL wiki for more information about using this feature in GLSL.

As an example, here is how you could define a 2D write-only texture in GLSL:

restrict writeonly uniform image2D myTexture;

Use "restrict" to allow the compiler to make optimizations when you know that this variable is the only one that will access the underlying texture.
Also note that the name of the variable ("myTexture" in the example) should correspond to the value of the field name.

FILE FORMAT/DEFAULT

    ShaderParameterImage {
    name ""
    identifier 0
    texture NULL
    layer -1
    accessMode READ
    }

SEE ALSO

SoShaderParameter, SoShaderParameterBufferObject, SoUniformShaderParameter, SoShaderObject, SoShaderProgram

NOTE: node available since Open Inventor 10.12

Definition at line 93 of file SoShaderParameterImage.h.

Member Enumeration Documentation

◆ AccessMode

Image access modes.

Enumerator
READ 

The shader can only read from the image.

WRITE 

The shader can only write to the image.

READ_WRITE 

The shader can read from and can write to the image.

Definition at line 114 of file SoShaderParameterImage.h.

Constructor & Destructor Documentation

◆ SoShaderParameterImage()

SoShaderParameterImage::SoShaderParameterImage ( )

Member Function Documentation

◆ getClassTypeId()

static SoType SoShaderParameterImage::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getTypeId()

virtual SoType SoShaderParameterImage::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoShaderParameter.

Member Data Documentation

◆ accessMode

SoSFEnum SoShaderParameterImage::accessMode

Specifies the type of access that will be performed on the image.

Use enum AccessMode. Default is READ.

Definition at line 137 of file SoShaderParameterImage.h.

◆ layer

SoSFInt32 SoShaderParameterImage::layer

Specifies the layer of texture to be bound to the image unit.

Default is -1 (bind all layers).

Definition at line 109 of file SoShaderParameterImage.h.

◆ texture

SoSFNode SoShaderParameterImage::texture

Specifies the texture to bind to the image unit.

Default is NULL.

Definition at line 103 of file SoShaderParameterImage.h.


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