TK_Color

Detailed Description

class TK_Color : public BBaseOpcodeHandler

Handles the TKE_Color opcode.

TK_Color provides support for writing/reading the TKE_Color opcode object to/from an HSF file.

The HOOPS/3dGS scene-graph segments can have a ‘named’ color (i.e. “faces = red, lines = blue”)

Subclassed by HTK_Color

Public Functions

TK_Color()
~TK_Color()
virtual TK_Status Read(BStreamFileToolkit &tk)

Reads data from the toolkit buffer, decodes/decompresses it, and maps it to the opcode handlers data members. User-defined classes which need to write out custom data should utilize one of the available GetData() methods.

Parameters:tk – A reference to the BStreamFileToolkit object.
Returns:The result of the function call.
virtual TK_Status Write(BStreamFileToolkit &tk)

Encodes/compresses data and writes data to the toolkit buffer. User-defined classes which need to write out custom data should utilize one of the available PutData() methods, and first write out the opcode associated with the group of binary data followed by the data itself.

Parameters:tk – A reference to the BStreamFileToolkit object.
Returns:The result of the function call.
virtual TK_Status Clone(BStreamFileToolkit &tk, BBaseOpcodeHandler **handler) const

Copies the opcode handler

Parameters:
  • tk – A reference to the BStreamFileToolkit object.
  • handler – A pointer to the opcode handler object. Passed by reference.
Returns:

The result of the function call.

TK_Status ReadAscii(BStreamFileToolkit &tk)

Deprecated.

TK_Status WriteAscii(BStreamFileToolkit &tk)

Deprecated.

virtual void Reset()

Resets the current opcode handler. This is called by the toolkit when it is done processing an opcode. This method reinitializes any opcode handler variables and frees up temporary data.

inline void SetGeometry(int m)

Sets the mask value which indicates which types of geometry are affected by this color setting. Geometry types are specified by TKO_Geometry_Bits.

inline int GetGeometry() const

Returns the mask value which indicates which types of geometry are affected by this color setting. Geometry types are specified by TKO_Geometry_Bits.

inline void SetChannels(int c)

Sets the mask indicating which color/material components are valid. Color channels are specified by TKO_Color_Channels. Note that TKO_Color_Channels are NOT bit masks, but rather indices, so you should pass (1<<TKO_Channel_Diffuse) here, for example.

inline int GetChannels() const

Returns the mask indicating which color/material components are valid. Color channels are specified by TKO_Color_Channels.

inline void SetDiffuse(float r, float g, float b)

Sets the diffuse color using discrete rgb values

inline void SetDiffuse(float const rgb[])

Sets the diffuse color using a float triplet

inline void SetDiffuseName(char const *name)

Sets the diffuse color as a string value. Allocates the buffer and copies the string

inline void SetDiffuseName(int length)

Sets the diffuse color string buffer. Allocates a buffer to hold a string of ‘length’ characters

inline float const *GetDiffuse() const

Returns the diffuse color as the address of a float triplet

inline char const *GetDiffuseName() const

Returns the address of the diffuse color name string.

inline char *GetDiffuseName()

Returns the address of the diffuse color name buffer, which may be modified directly.

inline void SetSpecular(float r, float g, float b)

Sets the specular color using discrete rgb values

inline void SetSpecular(float const rgb[])

Sets the specular color using a float triplet

inline void SetSpecularName(char const *name)

Sets the specular color as a string value. Allocates the buffer and copies the string

inline void SetSpecularName(int length)

Sets the specular color string buffer. Allocates a buffer to hold a string of ‘length’ characters

inline float const *GetSpecular() const

Returns the specular color as the address of a float triplet

inline char const *GetSpecularName() const

Returns the address of the specular color name string.

inline char *GetSpecularName()

Returns the address of the specular color name buffer, which may be modified directly.

inline void SetMirror(float r, float g, float b)

Sets the mirror color using discrete rgb values

inline void SetMirror(float const rgb[])

Sets the mirror color using a float triplet

inline void SetMirrorName(char const *name)

Sets the mirror color as a string value. Allocates the buffer and copies the string

inline void SetMirrorName(int length)

Sets the mirror color string buffer. Allocates a buffer to hold a string of ‘length’ characters

inline float const *GetMirror() const

Returns the mirror color as the address of a float triplet

inline char const *GetMirrorName() const

Returns the address of the mirror color name string.

inline char *GetMirrorName()

Returns the address of the mirror color name buffer, which may be modified directly.

inline void SetTransmission(float r, float g, float b)

Sets the transmission color using discrete rgb values

inline void SetTransmission(float const rgb[])

Sets the transmission color using a float triplet

inline void SetTransmissionName(char const *name)

Sets the transmission color as a string value. Allocates the buffer and copies the string

inline void SetTransmissionName(int length)

Sets the transmission color string buffer. Allocates a buffer to hold a string of ‘length’ characters

inline float const *GetTransmission() const

Returns the transmission color as the address of a float triplet

inline char const *GetTransmissionName() const

Returns the address of the transmission color name string.

inline char *GetTransmissionName()

Returns the address of the transmission color name buffer, which may be modified directly.

inline void SetEmission(float r, float g, float b)

Sets the emission color using discrete rgb values

inline void SetEmission(float const rgb[])

Sets the emission color using a float triplet

inline void SetEmissionName(char const *name)

Sets the emission color as a string value. Allocates the buffer and copies the string

inline void SetEmissionName(int length)

Sets the emission color string buffer. Allocates a buffer to hold a string of ‘length’ characters

inline float const *GetEmission() const

Returns the emission color as the address of a float triplet

inline char const *GetEmissionName() const

Returns the address of the emission color name string.

inline char *GetEmissionName()

Returns the address of the emission color name buffer, which may be modified directly.

inline void SetEnvironmentName(char const *name)

Sets the environment texture as a string value. Allocates the buffer and copies the string

inline void SetEnvironmentName(int length)

Sets the environment texture string buffer. Allocates a buffer to hold a string of ‘length’ characters

inline char const *GetEnvironmentName() const

Returns the address of the environment texture name string.

inline char *GetEnvironmentName()

Returns the address of the environment texture name buffer, which may be modified directly.

inline void SetBumpName(char const *name)

Sets the bump texture as a string value. Allocates the buffer and copies the string

inline void SetBumpName(int length)

Sets the bump texture string buffer. Allocates a buffer to hold a string of ‘length’ characters

inline char const *GetBumpName() const

Returns the address of the bump texture name string.

inline char *GetBumpName()

Returns the address of the bump texture name buffer, which may be modified directly.

inline void SetGloss(float g)

Sets the gloss value

inline float GetGloss() const

Returns the gloss value

inline void SetIndex(float i)

Sets the index of refraction

inline float GetIndex() const

Returns the index of refraction