#include "VolumeTexture.h"
Public Member Functions | |
VolumeTexture () | |
Constructor. | |
~VolumeTexture () | |
De-construcor. | |
bool | Load (const char *file, const char *path, VTInfo *info=NULL) |
Loads a 3D texture from a *.vt description file. | |
VTInfo | GetInfo () const |
Retrieves the volume texture info. | |
void | Bind (int unit=0) |
Binds the texture to the given texture unit. | |
int | CopyHistogram (unsigned int *data, int n) |
Copies the specified number of elements of the histogram. | |
void | UnBind () |
Unbinds the texture. | |
GLuint | GetTextureID () const |
Protected Member Functions | |
bool | LoadRAW (const char *filename, int w, int h, int d, int components) |
Loads volume data from a raw file. | |
void | Precompute (const unsigned char *data, int w, int h, int d, unsigned char *res) |
Precomputes gradiant and histogram values and places them into the Green, Blue and Alpha changes of the data. | |
Vector3f | ComputeNormal (const unsigned char *data, int x, int y, int z, int w, int h, int d) |
Computes a normal using central differances. |
Definition at line 34 of file VolumeTexture.h.
bool VolumeTexture::Load | ( | const char * | file, | |
const char * | path, | |||
VTInfo * | info = NULL | |||
) |
Loads a 3D texture from a *.vt description file.
[in] | file | the name of the *.vt description file. |
[in] | path | the path to the *.vt description file. |
[out] | info | pointer to a VTInfo structure that will be filled with info associated with the new volume texture. Defaults to NULL. |
Definition at line 30 of file VolumeTexture.cpp.
References VTInfo::components, VTInfo::depth, ErrorMessage(), VTInfo::height, LoadRAW(), VTInfo::size, and VTInfo::width.
Referenced by RTVolumeRenderer::LoadVolumeDataSet().
VTInfo VolumeTexture::GetInfo | ( | ) | const [inline] |
Retrieves the volume texture info.
Definition at line 62 of file VolumeTexture.h.
void VolumeTexture::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 263 of file VolumeTexture.cpp.
Referenced by RTVolumeRenderer::Draw().
int VolumeTexture::CopyHistogram | ( | unsigned int * | data, | |
int | n | |||
) |
Copies the specified number of elements of the histogram.
[out] | data | the loactoin to copy the historgram. |
[in] | n | the number of elements to copy. |
Definition at line 250 of file VolumeTexture.cpp.
Referenced by RTVolumeRenderer::CopyHistogram().
GLuint VolumeTexture::GetTextureID | ( | ) | const [inline] |
Definition at line 92 of file VolumeTexture.h.
bool VolumeTexture::LoadRAW | ( | const char * | filename, | |
int | w, | |||
int | h, | |||
int | d, | |||
int | components | |||
) | [protected] |
Loads volume data from a raw file.
[in] | filename | the name of the file. |
[in] | w | the width. |
[in] | h | the height. |
[in] | d | the depth. |
[in] | components | the number of components per pixel. Currently this must be 1. |
Definition at line 143 of file VolumeTexture.cpp.
References ErrorMessage(), and Precompute().
Referenced by Load().
void VolumeTexture::Precompute | ( | const unsigned char * | data, | |
int | w, | |||
int | h, | |||
int | d, | |||
unsigned char * | res | |||
) | [protected] |
Precomputes gradiant and histogram values and places them into the Green, Blue and Alpha changes of the data.
[in] | data | the volume data values. |
[in] | w | the width. |
[in] | h | the height. |
[in] | d | the depth. |
[out] | res | assumed to store data as RGBA 4-tuples and be able to hold w*h*d gradiants in th GBA channels. |
Definition at line 194 of file VolumeTexture.cpp.
References ComputeNormal(), Vector3< T >::x, Vector3< T >::y, and Vector3< T >::z.
Referenced by LoadRAW().
Vector3f VolumeTexture::ComputeNormal | ( | const unsigned char * | data, | |
int | x, | |||
int | y, | |||
int | z, | |||
int | w, | |||
int | h, | |||
int | d | |||
) | [protected] |
Computes a normal using central differances.
[in] | data | the volume data values. |
[in] | x | the x position. |
[in] | y | the y position. |
[in] | z | the z position. |
[in] | w | the width. |
[in] | h | the height. |
[in] | d | the depth. |
Definition at line 225 of file VolumeTexture.cpp.
References Vector3< T >::SquaredLength().
Referenced by Precompute().