# TK_Texture

## Functions

| `TK_Texture`
| `~TK_Texture`
`TK_Status` | `Read`
`TK_Status` | `Write`
`TK_Status` | `Clone`
`TK_Status` | `ReadAscii`
`TK_Status` | `WriteAscii`
void | `Reset`
void | `SetName`
void | `SetName`
char const * | `GetName`
char * | `GetName`
void | `SetShaderSource`
void | `SetShaderSource`
char const * | `GetShaderSource`
char * | `GetShaderSource`
void | `SetImage`
void | `SetImage`
char const * | `GetImage`
char * | `GetImage`
void | `SetCamera`
void | `SetCamera`
char const * | `GetCamera`
char * | `GetCamera`
void | `SetFlags`
int | `GetFlags`
void | `SetParameterSource`
int | `GetParameterSource`
void | `SetInterpolation`
int | `GetInterpolation`
void | `SetDecimation`
int | `GetDecimation`
void | `SetRedMapping`
int | `GetRedMapping`
void | `SetGreenMapping`
int | `GetGreenMapping`
void | `SetBlueMapping`
int | `GetBlueMapping`
void | `SetAlphaMapping`
int | `GetAlphaMapping`
void | `SetParameterFunction`
int | `GetParameterFunction`
void | `SetLayout`
int | `GetLayout`
void | `SetTiling`
int | `GetTiling`
void | `SetValueScale`
float const * | `GetValueScale`
void | `SetApplicationMode`
int | `GetApplicationMode`
void | `SetParameterOffset`
int | `GetParameterOffset`
void | `SetTransform`
void | `SetTransform`
char const * | `GetTransform`
char * | `GetTransform`

## Detailed Description

class TK_Texture : public BBaseOpcodeHandler

  Handles the TKE_Texture opcode.

  TK_Texture provides support for writing/reading the TKE_Texture opcode object to/from an HSF file.

  The HOOPS/3dGS scene-graph supports ‘textures’, which define an image that can be applied to a HOOPS/3dGS shell or mesh primitive.

  Subclassed by HTK_Texture

  Public Functions

  inline TK_Texture()

    constructor

  ~TK_Texture()
  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 SetName(char const *name)

    Sets the texture name. Allocates the buffer and copies the name string

  inline void SetName(int length)

    Sets the texture name buffer. Allocates a buffer large enough to hold a string of ‘length’ characters

  inline char const *GetName() const

    Returns the texture name

  inline char *GetName()

    Returns the texture name buffer, which can be modified directly

  void SetShaderSource(char const *shader_source)

    Sets the texture shader source. Allocates the buffer and copies the shader source string

  void SetShaderSource(int length)

    Sets the texture shader source buffer. Allocates a buffer large enough to hold a string of ‘length’ characters

  inline char const *GetShaderSource() const

    Returns the texture shader source

  inline char *GetShaderSource()

    Returns the texture shader source buffer, which can be modified directly

  inline void SetImage(char const *image)

    Sets the image name. Allocates the buffer and copies the name string

  inline void SetImage(int length)

    Sets the image name buffer. Allocates a buffer large enough to hold a string of ‘length’ characters

  inline char const *GetImage() const

    Returns the image name

  inline char *GetImage()

    Returns the image name buffer, which can be modified directly

  void SetCamera(char const *camera)

    Sets the camera segment name. Allocates the buffer and copies the name string

  void SetCamera(int length)

    Sets the camera segment name buffer. Allocates a buffer large enough to hold a string of ‘length’ characters

  inline char const *GetCamera() const

    Returns the camera segment name

  inline char *GetCamera()

    Returns the camera segment name buffer, which can be modified directly

  inline void SetFlags(int f)

    Sets the mask indicating which texture options are specified. Options are defined in TKO_Texture_Option_Bits.

  inline int GetFlags() const

    Returns the mask indicating which texture options are specified. Options are defined in TKO_Texture_Option_Bits.

  inline void SetParameterSource(int p)

    Sets the parameterization source. Options are defined in TKO_Texture_Param_Sources

  inline int GetParameterSource() const

    Returns the parameterization source. Options are defined in TKO_Texture_Param_Sources

  inline void SetInterpolation(int p)

    Sets the interpolation filter. Filter types are defined in TKO_Texture_Filters.

  inline int GetInterpolation() const

    Returns the interpolation filter. Filter types are defined in TKO_Texture_Filters.

  inline void SetDecimation(int p)

    Sets the decimation filter. Filter types are defined in TKO_Texture_Filters.

  inline int GetDecimation() const

    Returns the decimation filter. Filter types are defined in TKO_Texture_Filters.

  inline void SetRedMapping(int p)

    Sets the red channel mapping. Mappings are defined in TKO_Texture_Channel_Mappings.

  inline int GetRedMapping() const

    Returns the red channel mapping. Mappings are defined in TKO_Texture_Channel_Mappings.

  inline void SetGreenMapping(int p)

    Sets the green channel mapping. Mappings are defined in TKO_Texture_Channel_Mappings.

  inline int GetGreenMapping() const

    Returns the green channel mapping. Mappings are defined in TKO_Texture_Channel_Mappings.

  inline void SetBlueMapping(int p)

    Sets the blue channel mapping. Mappings are defined in TKO_Texture_Channel_Mappings.

  inline int GetBlueMapping() const

    Returns the blue channel mapping. Mappings are defined in TKO_Texture_Channel_Mappings.

  inline void SetAlphaMapping(int p)

    Sets the alpha channel mapping. Mappings are defined in TKO_Texture_Channel_Mappings.

  inline int GetAlphaMapping() const

    Returns the alpha channel mapping. Mappings are defined in TKO_Texture_Channel_Mappings.

  inline void SetParameterFunction(int p)

    Sets the parameterization function. Functions are defined in TKO_Texture_Param_Functions.

  inline int GetParameterFunction() const

    Returns the parameterization function. Functions are defined in TKO_Texture_Param_Functions.

  inline void SetLayout(int p)

    Sets the layout of the data in the image. Layouts are specified in TKO_Texture_Layouts.

  inline int GetLayout() const

    Returns the layout of the data in the image. Layouts are specified in TKO_Texture_Layouts.

  inline void SetTiling(int p)

    Sets the texture tiling mode. Tiling modes are specified in TKO_Texture_Tilings.

  inline int GetTiling() const

    Returns the texture tiling mode. Tiling modes are specified in TKO_Texture_Tilings.

  inline void SetValueScale(float v1, float v2)

    Sets the value scale & offset factors

  inline float const *GetValueScale() const

    Returns the value scale & offset factors

  inline void SetApplicationMode(int p)

    Sets the decal & modulate modes. Modes are specified in TKO_Texture_Application_Modes.

  inline int GetApplicationMode() const

    Returns the decal & modulate mode. Tiling modes are specified in TKO_Texture_Application_Modes.

  inline void SetParameterOffset(int p)

    Sets the parameter offset.

  inline int GetParameterOffset() const

    Returns the parameter offset.

  inline void SetTransform(char const *transform)

    Sets the name of the segment containing a texture transform matrix. Allocates the buffer and copies the string

  inline void SetTransform(int length)

    Sets the buffer to contain the name of a transform segment. Allocates a buffer large enough to hold ‘length’ characters

  inline char const *GetTransform() const

    Returns the transform segment name

  inline char *GetTransform()

    Returns the transform segment name buffer, which may be modified directly