Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoSFImage3 Class Reference

The SoSFImage3 class is used to store 3D (volume) images. More...

#include <Inventor/fields/SoSFImage3.h>

Inheritance diagram for SoSFImage3:
SoSField SoField

Public Member Functions

virtual void copyFrom (const SoField &field)
 
void finishEditing (void)
 
virtual SoType getTypeId (void) const
 
const unsigned char * getValue (SbVec3s &size, int &nc) const
 
virtual SbBool isSame (const SoField &field) const
 
int operator!= (const SoSFImage3 &field) const
 
const SoSFImage3operator= (const SoSFImage3 &field)
 
int operator== (const SoSFImage3 &field) const
 
void setValue (const SbVec3s &size, const int nc, const unsigned char *bytes)
 
unsigned char * startEditing (SbVec3s &size, int &nc)
 
- Public Member Functions inherited from SoSField
virtual ~SoSField ()
 
- Public Member Functions inherited from SoField
virtual ~SoField ()
 
void addAuditor (void *f, SoNotRec::Type type)
 
SbBool appendConnection (SoEngineOutput *master, SbBool notnotify=FALSE)
 
SbBool appendConnection (SoField *master, SbBool notnotify=FALSE)
 
SbBool connectFrom (SoEngineOutput *master, SbBool notnotify=FALSE, SbBool append=FALSE)
 
SbBool connectFrom (SoField *master, SbBool notnotify=FALSE, SbBool append=FALSE)
 
virtual void connectionStatusChanged (int numconnections)
 
void copyConnection (const SoField *fromfield)
 
virtual void countWriteRefs (SoOutput *out) const
 
void disconnect (SoEngineOutput *engineoutput)
 
void disconnect (SoField *field)
 
void disconnect (void)
 
void enableConnection (SbBool flag)
 
SbBool enableNotify (SbBool on)
 
void evaluate (void) const
 
virtual void fixCopy (SbBool copyconnections)
 
void get (SbString &valuestring)
 
SbBool getConnectedEngine (SoEngineOutput *&master) const
 
SbBool getConnectedField (SoField *&master) const
 
int getConnections (SoFieldList &masterlist) const
 
SoFieldContainergetContainer (void) const
 
SbBool getDirty (void) const
 
int getFieldType (void) const
 
int getForwardConnections (SoFieldList &slavelist) const
 
int getNumConnections (void) const
 
SbBool isConnected (void) const
 
SbBool isConnectedFromEngine (void) const
 
SbBool isConnectedFromField (void) const
 
SbBool isConnectionEnabled (void) const
 
SbBool isDefault (void) const
 
SbBool isIgnored (void) const
 
SbBool isNotifyEnabled (void) const
 
SbBool isOfType (const SoType type) const
 
SbBool isReadOnly (void) const
 
virtual void notify (SoNotList *nlist)
 
int operator!= (const SoField &f) const
 
int operator== (const SoField &f) const
 
virtual SbBool read (SoInput *input, const SbName &name)
 
virtual SbBool referencesCopy (void) const
 
void removeAuditor (void *f, SoNotRec::Type type)
 
SbBool set (const char *valuestring)
 
void setContainer (SoFieldContainer *cont)
 
void setDefault (SbBool defaultVal)
 
void setDirty (SbBool dirty)
 
void setFieldType (int type)
 
void setIgnored (SbBool ignore)
 
SbBool shouldWrite (void) const
 
virtual void startNotify (void)
 
virtual void touch (void)
 
virtual void write (SoOutput *out, const SbName &name) const
 

Static Public Member Functions

static voidcreateInstance (void)
 
static SoType getClassTypeId (void)
 
static void initClass (void)
 
- Static Public Member Functions inherited from SoSField
static void atexit_cleanup (void)
 
static SoType getClassTypeId (void)
 
static void initClass (void)
 
- Static Public Member Functions inherited from SoField
static void cleanupClass (void)
 
static SoType getClassTypeId (void)
 
static void initClass (void)
 
static void initClasses (void)
 

Additional Inherited Members

- Public Types inherited from SoField
enum  FieldType { NORMAL_FIELD = 0 , EVENTIN_FIELD , EVENTOUT_FIELD , EXPOSED_FIELD }
 
- Protected Member Functions inherited from SoSField
 SoSField (void)
 
- Protected Member Functions inherited from SoField
 SoField (void)
 
virtual SoNotRec createNotRec (SoBase *cont)
 
virtual void evaluateConnection (void) const
 
SbBool isDestructing (void) const
 
virtual SbBool readConnection (SoInput *in)
 
void valueChanged (SbBool resetdefault=TRUE)
 
virtual void writeConnection (SoOutput *out) const
 

Detailed Description

The SoSFImage3 class is used to store 3D (volume) images.

The SoSFImage3 class provides storage for inline 3D image maps. 3D images in Coin are mainly used for 3D texture mapping support.

SoSFImage3 instances can be exported and imported as any other field class in Coin.

The components of an SoSFImage3 is: its image dimensions (width, height and depth), the number of bytes used for describing each pixel (number of components) and an associated pixel buffer. The size of the pixel buffer will be width*height*depth*components.

For texture maps, the components / bytes-per-pixel setting translates as follows: use 1 for a grayscale imagemap, 2 for grayscale + opacity (i.e. alpha value), 3 for RGB (1 byte each for red, green and blue) and 4 components means 3 bytes for RGB + 1 byte opacity value (aka RGBA).

This field is serializable into the Inventor / Coin file format in the following manner:

FIELDNAME X Y Z C 0xRRGGBBAA 0xRRGGBBAA ...
The SbList class is a template container class for lists.
Definition SbList.h:70

"X", "Y" and "Z" are the image dimensions along the given axes, "C" is the number of components in the image. The number of 0xRRGGBBAA pixel color specifications needs to equal the exact number of pixels, which is X*Y*Z. Each part of the pixel color value is in the range 0x00 to 0xff (hexadecimal, 0 to 255 decimal).

For 3-component images, the pixel-format is 0xXXRRGGBB, where the byte in the pixel color value marked as "XX" is ignored and can be left out.

For 2-component images, the pixel-format is 0xXXXXGGAA, where the bytes in the pixel color values marked as "XX" are ignored and can be left out. "GG" is the part which gives a grayscale value and "AA" is for opacity.

For 1-component images, the pixel-format is 0xXXXXXXGG, where the bytes in the pixel color values marked as "XX" are ignored and can be left out.

The pixels are read as being ordered in rows along X (width), columns along Y (height, bottom to top) and Z "planes" (depth, front to back).

Here's a simple example of the file format serialization, for a 2x2x2 RGB-image inside an SoTexture3 node:

images 2 2 2 3
0x000000 0x00ff00
0xff0000 0xffff00
0x000000 0x0000ff
0x00ff00 0x00ffff
}

The image above is colored black+green on the first line and red+yellow on the second line in the first Z plane. The second Z plane is colored black+blue on the first line and green+cyan on the second line.

Be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

See also
SoTexture3, SoSFImage
Since
Coin 2.0
TGS Inventor 2.6

Member Function Documentation

◆ copyFrom()

void SoSFImage3::copyFrom ( const SoField & f)
virtual

Copy value(s) from f into this field. f must be of the same type as this field.

Implements SoField.

◆ createInstance()

void * SoSFImage3::createInstance ( void )
static

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.

Creates a new instance of the class type corresponding to the SoType object.

◆ finishEditing()

void SoSFImage3::finishEditing ( void )

Notify the field's auditors that the image data have been modified.

◆ getClassTypeId()

SoType SoSFImage3::getClassTypeId ( void )
static

This static method returns the SoType object associated with objects of this class.

◆ getTypeId()

SoType SoSFImage3::getTypeId ( void ) const
virtual

Returns the type identification of an object derived from a class inheriting SoField. This is used for runtime type checking and "downward" casting.

Implements SoField.

◆ getValue()

const unsigned char * SoSFImage3::getValue ( SbVec3s & size,
int & nc ) const

Return pixel buffer, set size to contain the image dimensions and nc to the number of components in the image.

◆ initClass()

void SoSFImage3::initClass ( void )
static

Internal method called upon initialization of the library (from SoDB::init()) to set up the type system.

◆ isSame()

SbBool SoSFImage3::isSame ( const SoField & f) const
virtual

Check for equal type and value(s).

Implements SoField.

◆ operator!=()

int SoSFImage3::operator!= ( const SoSFImage3 & field) const
inline

Compare image of field with the image in this field and return FALSE if they are equal.

◆ operator==()

int SoSFImage3::operator== ( const SoSFImage3 & field) const

Compare image of field with the image in this field and return TRUE if they are equal.

◆ setValue()

void SoSFImage3::setValue ( const SbVec3s & size,
const int nc,
const unsigned char * bytes )

Initialize this field to size and nc.

If bytes is not NULL, the image data is copied from bytes into this field. If bytes is NULL, the image data is cleared by setting all bytes to 0 (note that the behavior on passing a NULL pointer is specific for Coin, Open Inventor will crash if you try it).

◆ startEditing()

unsigned char * SoSFImage3::startEditing ( SbVec3s & size,
int & nc )

Return pixel buffer, set size to contain the image dimensions and nc to the number of components in the image.

The field's container will not be notified about the changes until you call finishEditing().


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