TK_Color

class TK_Color

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”)

Inherits from: BBaseOpcodeHandler

Classes

Methods

void TK_Color::set_channel_rgb(channel &c, float r, float g, float b, int which_channel = -1)

protected

internal use

void TK_Color::set_channel_name(channel &c, char const *name, int which_channel = -1)

protected

internal use

void TK_Color::set_channel_name(channel &c, int length, int which_channel = -1)

protected

internal use

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

virtual

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.
TK_Status TK_Color::Write(BStreamFileToolkit &tk)

virtual

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.
TK_Status TK_Color::Clone(BStreamFileToolkit &tk, BBaseOpcodeHandler **handler) const

const virtual

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 TK_Color::ReadAscii(BStreamFileToolkit &tk)

Deprecated.

TK_Status TK_Color::WriteAscii(BStreamFileToolkit &tk)

Deprecated.

void TK_Color::Reset()

virtual

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.

void TK_Color::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.

int TK_Color::GetGeometry() const

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.

void TK_Color::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.

int TK_Color::GetChannels() const

const

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

void TK_Color::SetDiffuse(float r, float g, float b)

Sets the diffuse color using discrete rgb values

void TK_Color::SetDiffuse(float const rgb[])

Sets the diffuse color using a float triplet

void TK_Color::SetDiffuseName(char const *name)

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

void TK_Color::SetDiffuseName(int length)

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

float const *TK_Color::GetDiffuse() const

const

Returns the diffuse color as the address of a float triplet

char const *TK_Color::GetDiffuseName() const

const

Returns the address of the diffuse color name string.

char *TK_Color::GetDiffuseName()

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

void TK_Color::SetSpecular(float r, float g, float b)

Sets the specular color using discrete rgb values

void TK_Color::SetSpecular(float const rgb[])

Sets the specular color using a float triplet

void TK_Color::SetSpecularName(char const *name)

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

void TK_Color::SetSpecularName(int length)

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

float const *TK_Color::GetSpecular() const

const

Returns the specular color as the address of a float triplet

char const *TK_Color::GetSpecularName() const

const

Returns the address of the specular color name string.

char *TK_Color::GetSpecularName()

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

void TK_Color::SetMirror(float r, float g, float b)

Sets the mirror color using discrete rgb values

void TK_Color::SetMirror(float const rgb[])

Sets the mirror color using a float triplet

void TK_Color::SetMirrorName(char const *name)

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

void TK_Color::SetMirrorName(int length)

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

float const *TK_Color::GetMirror() const

const

Returns the mirror color as the address of a float triplet

char const *TK_Color::GetMirrorName() const

const

Returns the address of the mirror color name string.

char *TK_Color::GetMirrorName()

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

void TK_Color::SetTransmission(float r, float g, float b)

Sets the transmission color using discrete rgb values

void TK_Color::SetTransmission(float const rgb[])

Sets the transmission color using a float triplet

void TK_Color::SetTransmissionName(char const *name)

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

void TK_Color::SetTransmissionName(int length)

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

float const *TK_Color::GetTransmission() const

const

Returns the transmission color as the address of a float triplet

char const *TK_Color::GetTransmissionName() const

const

Returns the address of the transmission color name string.

char *TK_Color::GetTransmissionName()

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

void TK_Color::SetEmission(float r, float g, float b)

Sets the emission color using discrete rgb values

void TK_Color::SetEmission(float const rgb[])

Sets the emission color using a float triplet

void TK_Color::SetEmissionName(char const *name)

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

void TK_Color::SetEmissionName(int length)

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

float const *TK_Color::GetEmission() const

const

Returns the emission color as the address of a float triplet

char const *TK_Color::GetEmissionName() const

const

Returns the address of the emission color name string.

char *TK_Color::GetEmissionName()

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

void TK_Color::SetEnvironmentName(char const *name)

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

void TK_Color::SetEnvironmentName(int length)

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

char const *TK_Color::GetEnvironmentName() const

const

Returns the address of the environment texture name string.

char *TK_Color::GetEnvironmentName()

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

void TK_Color::SetBumpName(char const *name)

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

void TK_Color::SetBumpName(int length)

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

char const *TK_Color::GetBumpName() const

const

Returns the address of the bump texture name string.

char *TK_Color::GetBumpName()

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

void TK_Color::SetGloss(float g)

Sets the gloss value

float TK_Color::GetGloss() const

const

Returns the gloss value

void TK_Color::SetIndex(float i)

Sets the index of refraction

float TK_Color::GetIndex() const

const

Returns the index of refraction

Variables

int TK_Color::m_mask

protected

int

internal use

short TK_Color::m_channels

protected

short

internal use

channel TK_Color::m_diffuse

protected

internal use

channel TK_Color::m_specular

protected

internal use

channel TK_Color::m_mirror

protected

internal use

channel TK_Color::m_transmission

protected

internal use

channel TK_Color::m_emission

protected

internal use

channel TK_Color::m_environment

protected

internal use; note: environment & bump are never a simple RGB type color

channel TK_Color::m_bump

protected

internal use

float TK_Color::m_gloss

protected

float

internal use

float TK_Color::m_index

protected

float

internal use

int TK_Color::m_substage

protected

int

internal use; To track the subcases