TransferTexture Class Reference

Holds a texture that represents a transfer function. More...

#include "TransferTexture.h"

List of all members.

Public Member Functions

 TransferTexture ()
 Default Constructor.
 ~TransferTexture ()
 De-constructor.
bool Load (const char *name)
 Loads a texture as a transfer function.
bool CreateFunction (const std::vector< PlotPoint > &red, const std::vector< PlotPoint > &green, const std::vector< PlotPoint > &blue, const std::vector< PlotPoint > &alpha)
 Contructs a transfer function based on the given plots.
void Bind (int unit=0)
 Binds the texture to the given texture unit.
void UnBind ()
 Unbinds the texture.
GLuint GetTextureID () const

Protected Member Functions

bool Interpolate (const std::vector< PlotPoint > &plot, float *color, int stride)
 Interpolates the given plots into an array of color value.

Classes

struct  ControlPoint
 Holds point information for defining a piecewise linear function. More...


Detailed Description

Holds a texture that represents a transfer function.

Definition at line 31 of file TransferTexture.h.


Member Function Documentation

bool TransferTexture::Load ( const char *  name  ) 

Loads a texture as a transfer function.

Parameters:
[in] name the name of the texture file.
Returns:
True if the texture was loaded, false otherwise.

Definition at line 22 of file TransferTexture.cpp.

bool TransferTexture::CreateFunction ( const std::vector< PlotPoint > &  red,
const std::vector< PlotPoint > &  green,
const std::vector< PlotPoint > &  blue,
const std::vector< PlotPoint > &  alpha 
)

Contructs a transfer function based on the given plots.

Parameters:
[in] red the points that define a piecewise linear function for the red component.
[in] green the points that define a piecewise linear function for the green component.
[in] blue the points that define a piecewise linear function for the blue component.
[in] alpha the points that define a piecewise linear function for the alpha component.
Returns:
true if the function was created, false otherwise.
NOTE: the points are assumed to be sorted from low to high based on the 'value' component of the PlotPoint struct. The first point should have a dataValue of 0 and the last value should have a dataValue of 255. No two points should have the same dataValue.

Definition at line 28 of file TransferTexture.cpp.

References Interpolate().

Referenced by TransferFunctionPlot::UpdateTexture().

void TransferTexture::Bind ( int  unit = 0  ) 

Binds the texture to the given texture unit.

Parameters:
[in] unit the texture unit to bind to. Should be in the range [0,32]. Defaults to 0.
NOTE: The texture can only be bound to one unit at a time. This does not check if the given texture unit actually exists.

Definition at line 93 of file TransferTexture.cpp.

Referenced by RTVolumeRenderer::Draw().

GLuint TransferTexture::GetTextureID (  )  const [inline]

Returns:
the opengl texture id for the loaded volume texture.

Definition at line 101 of file TransferTexture.h.

bool TransferTexture::Interpolate ( const std::vector< PlotPoint > &  plot,
float *  color,
int  stride 
) [protected]

Interpolates the given plots into an array of color value.

Parameters:
[in] plot the points that define a piecewise linear function.
[out] color the location to store the interpolated color value. Assumed to have space for 256 values.
[in] stride the number of float to skip in the color array for each consecutive value.
Returns:
true if the interpolation was successful, false otherwise.
NOTE: the points are assumed to be sorted from low to high based on the 'value' component of the PlotPoint struct. The first point should have a dataValue of 0 and the last value should have a dataValue of 255. No two points should have the same dataValue.

Definition at line 58 of file TransferTexture.cpp.

Referenced by CreateFunction().


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

Generated on Thu Jan 15 00:58:04 2009 for RTVolumeRendering by  doxygen 1.5.6