#include "RTVolumeRenderer.h"
Public Member Functions | |
RTVolumeRenderer (wxWindow *parent, int w, int h) | |
Constructor. | |
void | ResizeRenderer (int w, int h) |
Resizes the renderer window. | |
void | Draw () |
void | ShouldDrawCube (bool yn) |
Tells the renderer if it should draw the bounding cube or not. | |
void | ShouldDrawCubeOutline (bool yn) |
Tells the renderer if it should draw the bounding cube outline or not. | |
void | ShouldDrawPlanes (bool yn) |
Tells the renderer if it should draw the rendering planes. | |
void | UseVolumeTexture (bool yn) |
Tells the renderer if it should draw using the volume data. | |
void | SetPlanes (int n) |
Sets the number of planes to draw. | |
void | SetLightDirection (const Vector3f &dir) |
Sets the direction of the light. | |
void | SetLightDiffuseColor (const Color4f &c) |
Sets the diffuse color of the light. | |
void | MouseMove (wxMouseEvent &m) |
Called when the mouse moves. | |
void | MouseLeftUp (wxMouseEvent &m) |
Called when the left mouse button is released. | |
void | MouseLeftDown (wxMouseEvent &m) |
Called when the left mouse button is pressed. | |
void | MouseWheel (wxMouseEvent &m) |
Called when the mouse wheel is moved. | |
void | KeyDown (wxKeyEvent &k) |
Called when a key is pressed. | |
void | SetFrameTime (float t) |
Sets the current frame time. | |
void | SetBackgroundColor (const Color4f &c) |
Sets the background color. | |
void | SetCubeColor (const Color4f &c) |
Sets the cube color. | |
void | SetOutlineColor (const Color4f &c) |
Sets the cube outline color. | |
void | SetPlaneColor (const Color4f &c) |
Sets the plane color. | |
void | ToggleCameraAttachment () |
Toggles the attachment of the camera to the plane slices. | |
void | SetQuickMovmentRendering (bool quick) |
Enables/Disables simplified rendering when the camera is being moved. | |
bool | LoadVolumeDataSet (const char *name, const char *path, VTInfo &info) |
Loads a volume data set from a *.vt file. | |
int | CopyHistogram (unsigned int *data, int n) |
Copies the specified number of elements of the volume data sets histogram. | |
virtual void | TransferPlotChanged (TransferFunctionPlot *plot) |
Called when the transfer function plot changes. | |
Protected Member Functions | |
void | Clear () |
Clears the back buffer to black. |
Definition at line 27 of file RTVolumeRenderer.h.
RTVolumeRenderer::RTVolumeRenderer | ( | wxWindow * | parent, | |
int | w, | |||
int | h | |||
) |
Constructor.
[in] | parent | the parent window the volume renderer should reside in. |
[in] | w | the width of the opengl frame buffer. |
[in] | h | the height of the opengl frame buffer. |
Definition at line 39 of file RTVolumeRenderer.cpp.
References CubeDef::c, CreateFrame(), and CubeDef::dim.
void RTVolumeRenderer::ResizeRenderer | ( | int | w, | |
int | h | |||
) |
Resizes the renderer window.
[in] | w | the width of frame buffer. |
[in] | h | the height of frame buffer. |
Definition at line 85 of file RTVolumeRenderer.cpp.
References Matrix< T >::GetOpenGLMatrix(), and Matrix< T >::MakePerspective().
Referenced by MainWindow::OnResolutionSelection().
void RTVolumeRenderer::Draw | ( | ) |
Draws the next frame.
Definition at line 332 of file RTVolumeRenderer.cpp.
References ShaderProgram::Attach(), TransferTexture::Bind(), VolumeTexture::Bind(), Clear(), ShaderProgram::Detach(), Cube::Draw(), Cube::DrawOutline(), Cube::DrawPlanes(), Matrix< T >::GetOpenGLMatrix(), Camera::GetViewMatrix(), Cube::SetViewDirection(), VolumeTexture::UnBind(), TransferTexture::UnBind(), and Camera::ViewDirection().
Referenced by MainWindow::Draw().
void RTVolumeRenderer::ShouldDrawCube | ( | bool | yn | ) |
Tells the renderer if it should draw the bounding cube or not.
[in] | yn | set to true to draw the cube, set to false to disable drawing the cube. |
Definition at line 160 of file RTVolumeRenderer.cpp.
Referenced by MainWindow::OnDrawCubeClick().
void RTVolumeRenderer::ShouldDrawCubeOutline | ( | bool | yn | ) |
Tells the renderer if it should draw the bounding cube outline or not.
[in] | yn | set to true to draw the cube outline, set to false to disable drawing the cube outline. |
Definition at line 167 of file RTVolumeRenderer.cpp.
Referenced by MainWindow::OnDrawOutlineClick().
void RTVolumeRenderer::ShouldDrawPlanes | ( | bool | yn | ) |
Tells the renderer if it should draw the rendering planes.
[in] | yn | set to true to draw the rendering planes, set to false to disable drawing the rendering planes. |
Definition at line 174 of file RTVolumeRenderer.cpp.
Referenced by MainWindow::OnDrawPlanesClick().
void RTVolumeRenderer::UseVolumeTexture | ( | bool | yn | ) |
Tells the renderer if it should draw using the volume data.
[in] | yn | set to true to draw the rendering planes with the volume texture enabled, set to false to disable drawing the rendering with the volume texture. |
Definition at line 181 of file RTVolumeRenderer.cpp.
Referenced by MainWindow::OnUseTexClick().
void RTVolumeRenderer::SetPlanes | ( | int | n | ) |
Sets the number of planes to draw.
[in] | n | the number of planes. Should be in the range [1, MAX_PLANES]. |
Definition at line 188 of file RTVolumeRenderer.cpp.
References Cube::SetNumberOfPlanes().
Referenced by MainWindow::OnPlanesSliderScroll().
void RTVolumeRenderer::SetLightDirection | ( | const Vector3f & | dir | ) |
Sets the direction of the light.
[in] | dir | the direction of the light. |
Definition at line 146 of file RTVolumeRenderer.cpp.
References ShaderProgram::SetVector(), Vector3< T >::x, Vector3< T >::y, and Vector3< T >::z.
Referenced by MainWindow::OnResetLightDirButtonClick(), and MainWindow::OnSetLightDirButtonClick().
void RTVolumeRenderer::SetLightDiffuseColor | ( | const Color4f & | c | ) |
Sets the diffuse color of the light.
[in] | c | the diffuse color of the light |
Definition at line 153 of file RTVolumeRenderer.cpp.
References Color4f::b, Color4f::g, Color4f::r, and ShaderProgram::SetVector().
Referenced by MainWindow::ColorChanged().
void RTVolumeRenderer::MouseMove | ( | wxMouseEvent & | m | ) |
Called when the mouse moves.
[in,out] | m | the mouse event. |
Definition at line 236 of file RTVolumeRenderer.cpp.
References Camera::RotateRight(), and Camera::RotateUp().
void RTVolumeRenderer::MouseLeftUp | ( | wxMouseEvent & | m | ) |
Called when the left mouse button is released.
[in,out] | m | the mouse event. |
Definition at line 255 of file RTVolumeRenderer.cpp.
void RTVolumeRenderer::MouseLeftDown | ( | wxMouseEvent & | m | ) |
Called when the left mouse button is pressed.
[in,out] | m | the mouse event. |
Definition at line 262 of file RTVolumeRenderer.cpp.
void RTVolumeRenderer::MouseWheel | ( | wxMouseEvent & | m | ) |
Called when the mouse wheel is moved.
[in,out] | m | the mouse event. |
Definition at line 275 of file RTVolumeRenderer.cpp.
References Camera::Zoom().
void RTVolumeRenderer::KeyDown | ( | wxKeyEvent & | k | ) |
Called when a key is pressed.
[in,out] | k | the key event. |
Definition at line 292 of file RTVolumeRenderer.cpp.
References Camera::RotateRight(), Camera::RotateUp(), and Camera::Zoom().
void RTVolumeRenderer::SetFrameTime | ( | float | t | ) | [inline] |
Sets the current frame time.
[in] | t | the time in seconds since the last frame. |
Definition at line 147 of file RTVolumeRenderer.h.
Referenced by MainWindow::OnIdle().
void RTVolumeRenderer::SetBackgroundColor | ( | const Color4f & | c | ) |
Sets the background color.
[in] | c | the color to use. |
Definition at line 195 of file RTVolumeRenderer.cpp.
References Color4f::b, Color4f::g, and Color4f::r.
Referenced by MainWindow::ColorChanged().
void RTVolumeRenderer::SetCubeColor | ( | const Color4f & | c | ) |
Sets the cube color.
[in] | c | the color to use. |
Definition at line 202 of file RTVolumeRenderer.cpp.
References Cube::SetCubeColor().
Referenced by MainWindow::ColorChanged().
void RTVolumeRenderer::SetOutlineColor | ( | const Color4f & | c | ) |
Sets the cube outline color.
[in] | c | the color to use. |
Definition at line 209 of file RTVolumeRenderer.cpp.
References Cube::SetOutlineColor().
Referenced by MainWindow::ColorChanged().
void RTVolumeRenderer::SetPlaneColor | ( | const Color4f & | c | ) |
Sets the plane color.
[in] | c | the color to use. |
Definition at line 216 of file RTVolumeRenderer.cpp.
References Cube::SetPlaneColor().
Referenced by MainWindow::ColorChanged().
void RTVolumeRenderer::SetQuickMovmentRendering | ( | bool | quick | ) | [inline] |
Enables/Disables simplified rendering when the camera is being moved.
[in] | quick | set to true to enable simplified rendering, set to false to disable it. |
Definition at line 187 of file RTVolumeRenderer.h.
Referenced by MainWindow::OnRealTimeClick().
bool RTVolumeRenderer::LoadVolumeDataSet | ( | const char * | name, | |
const char * | path, | |||
VTInfo & | info | |||
) |
Loads a volume data set from a *.vt file.
[in] | name | the filename of the *.vt volume texture file. |
[in] | path | the path to the *.vt description file. |
[out] | info | the information describing the loaded texture. |
Definition at line 229 of file RTVolumeRenderer.cpp.
References VolumeTexture::Load().
Referenced by MainWindow::OnLoadDataSetButtonClick().
int RTVolumeRenderer::CopyHistogram | ( | unsigned int * | data, | |
int | n | |||
) | [inline] |
Copies the specified number of elements of the volume data sets histogram.
[out] | data | the loactoin to copy the historgram. |
[in] | n | the number of elements to copy. |
Definition at line 208 of file RTVolumeRenderer.h.
References VolumeTexture::CopyHistogram().
Referenced by MainWindow::OnLoadDataSetButtonClick().
void RTVolumeRenderer::TransferPlotChanged | ( | TransferFunctionPlot * | plot | ) | [virtual] |
Called when the transfer function plot changes.
[in] | plot | the plot that changed. |
Implements TransferPlotChangeListner.
Definition at line 285 of file RTVolumeRenderer.cpp.
References TransferFunctionPlot::UpdateTexture().