#include "TransferTexture.h"
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... |
Definition at line 31 of file TransferTexture.h.
bool TransferTexture::Load | ( | const char * | name | ) |
Loads a texture as a transfer function.
[in] | name | the name of the texture file. |
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.
[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. |
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.
[in] | unit | the texture unit to bind to. Should be in the range [0,32]. Defaults to 0. |
Definition at line 93 of file TransferTexture.cpp.
Referenced by RTVolumeRenderer::Draw().
GLuint TransferTexture::GetTextureID | ( | ) | const [inline] |
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.
[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. |
Definition at line 58 of file TransferTexture.cpp.
Referenced by CreateFunction().