VolumeTexture Class Reference

Represents a 3D volume texture. More...

#include "VolumeTexture.h"

Collaboration diagram for VolumeTexture:

Collaboration graph
[legend]

List of all members.

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.


Detailed Description

Represents a 3D volume texture.

Definition at line 34 of file VolumeTexture.h.


Member Function Documentation

bool VolumeTexture::Load ( const char *  file,
const char *  path,
VTInfo info = NULL 
)

Loads a 3D texture from a *.vt description file.

Parameters:
[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.

Returns:
A VTInfo struct that describes the currently loaded volume texture.

Definition at line 62 of file VolumeTexture.h.

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

Parameters:
[out] data the loactoin to copy the historgram.
[in] n the number of elements to copy.
Returns:
the number of elements left in the historgam that were not copied.

Definition at line 250 of file VolumeTexture.cpp.

Referenced by RTVolumeRenderer::CopyHistogram().

GLuint VolumeTexture::GetTextureID (  )  const [inline]

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

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.

Parameters:
[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.
Returns:
True if the image was loaded succesfully, false otherwise.
NOTE: The data is padded to the largest dimmension.

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.

Parameters:
[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.

Parameters:
[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.
Returns:
the computed normal.

Definition at line 225 of file VolumeTexture.cpp.

References Vector3< T >::SquaredLength().

Referenced by Precompute().


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