#include <spectral.h>
Inheritance diagram for ns_vu1112112::vu1112112:
Public Member Functions | |
vu1112112 () | |
Default constructor creating an empty instance. | |
vu1112112 (const vu1112112 &inst) | |
Copy constructor which does a deep copy. | |
virtual | ~vu1112112 () |
Destructor. | |
vu1112112 & | operator= (const vu1112112 &rhs) |
Assignment operator which does a deep copy. | |
void | setViewVectors (const vuVector &pos, const vuVector &vrp, const vuVector &up) |
Sets the camera viewing position for the render method. | |
void | initOpenGL (void) |
Initializes open gl for rendering the volume data. | |
void | render () |
Implements the abstract render() method of the vuVolume base class. | |
virtual bool | read () |
Reimplements the read() method to do some extra volume data processing. | |
virtual bool | readRaw (void) |
This method reads volume data stored using the .raw data type. | |
bool | add_material (Material &mat) |
adds a new material (scattering and absorption information) to the renderer | |
bool | add_light (ColourType &lc) |
adds a light (just a colour) | |
bool | load_scene (const char *filename) |
loads a scene setup (materials, lights, camera resolution...) | |
bool | load_volume (char *name) |
load data | |
void | setLight (const vuColour31a &light) |
adjust light between source 1 and 2; w E [0,1], l intensity scaling | |
void | setImageSize (dword sx, dword sy) |
set size of the canvas to render to | |
void | doRefresh () |
tell that the data should be rerendered on next glRender | |
vuVector | getCenter () |
returns the center of the dataset | |
vuImage * | getImage () |
void | setDoSpecular (bool doit=true) |
Set whether to do specular illumination. (default true). | |
bool | getDoSpecular () |
Is specular illumination calculated? | |
void | setDrawPreview (bool doit=true) |
Set whether to draw a preview. (default true). | |
bool | getDrawPreview () |
Will a preview be drawn? | |
float & | getShininess () |
Returns handle to Shininess. | |
float & | getGloss () |
Returns handle to Gloss (intensity of specular reflection). | |
void | setObserverLight (bool moveit=true) |
Tell whether to move the light with the observer. | |
void | setLightDir (const vuVector &lightdir) |
Set the direction of the light. | |
const vuVector & | getLightDir () const |
return the direction of the light | |
Private Member Functions | |
void | run (int whatsup, void *data) |
Overrides virtual vuThread::run(). | |
void | shootRays (int xofs=0, int xinc=1, int yofs=0, int yinc=1) |
Renders the scene by casting the rays from the camera. | |
void | preprocess (void) |
Preprocesses volume data for rendering once it's been read. | |
ColourType | Cast (vuSampleRay &Vray) |
Cast a ray through the scene used by render(). | |
Private Attributes | |
vuVector | center |
center to rotate about | |
DatGrid | Grid |
the grid to be rendered | |
ColourType | Background |
Background colour. | |
vuColour31a | Ambient |
Ambient colour for normaliztion. | |
ColourType | m_Light [NUM_LIGHTS] |
different colours for light source | |
ColourType | TFLUT_scatt [255] |
own internal look-up-table for scattering (color) Hopefully substituted by spectral transfer function panel. | |
ColourType | TFLUT_absor [255] |
own internal look-up-table for absorption Hopefully substituted by spectral transfer function panel. | |
int | numlights |
number of light sources | |
Material | mat [MAT_NUM_MATERIALS] |
list of materials | |
int | nummat |
number of materials | |
vuSpectralImage | spimg |
image with spectral information for each pixel | |
vuImage | rgbimg |
The rgb image that will be displayed onto the screen. | |
vuVector | m_LightDir |
direction of light vector | |
bool | m_ObserverLight |
move the light with the viewpoint? | |
float | brightness |
scalar to toogle brightness of light source | |
float | diffuse |
weight for diffuse gradient shading | |
float | light_scale |
max value for the brightness slider | |
bool | re_light |
bool | re_render |
refresh tags | |
byte * | imgbuf |
buffer for the image. | |
bool | use_flat_absorption |
optimize using plain alpha blending | |
bool | pp_gradients |
gradients already preprocessed? | |
vuMutex | m_Mutex [2] |
bool | m_DoSpecular |
do specular illumination? | |
bool | m_DrawPreview |
draw preview? | |
float | m_Shininess |
shininess for specular reflection | |
float | m_Gloss |
intensity of specular reflection | |
Friends | |
class | Parser |
class | DatGrid |
class | DatPnt |
This allows modelling special physical properties of light like spectral absorption and metamerism. long name: vuVolumeRegularUnimodal3d1B1ValSpectral
Definition at line 38 of file spectral.h.
|
Default constructor creating an empty instance.
Definition at line 29 of file spectral.cpp. References brightness, ColourType, diffuse, imgbuf, light_scale, m_DoSpecular, m_DrawPreview, m_Gloss, m_LightDir, m_ObserverLight, m_Shininess, vuColour< S >::nComponents(), numlights, nummat, re_light, re_render, vuTFIntensity::resize(), vuCamera::setHeight(), and vuCamera::setWidth(). |
Here is the call graph for this function:
|
Copy constructor which does a deep copy.
Definition at line 56 of file spectral.cpp. References operator=(). |
Here is the call graph for this function:
|
Destructor.
Definition at line 65 of file spectral.cpp. References imgbuf. |
|
adds a light (just a colour)
Definition at line 553 of file spectral.cpp. References ColourType, m_Light, and numlights. Referenced by ns_vu1112112::Parser::ReadLight(). |
|
adds a new material (scattering and absorption information) to the renderer
Definition at line 562 of file spectral.cpp. References nummat. Referenced by ns_vu1112112::Parser::ReadMaterial(). |
|
Here is the call graph for this function:
|
tell that the data should be rerendered on next glRender default behaviour is to just blit the intermediate framebuffer Definition at line 571 of file spectral.cpp. References re_render. Referenced by vuSpectral::DrawAgain(), and vuSpectral::OnButtonRender(). |
|
returns the center of the dataset
Definition at line 576 of file spectral.cpp. Referenced by vuSpectral::OnButtonLightPos(). |
|
Is specular illumination calculated?
Definition at line 95 of file spectral.h. |
|
Will a preview be drawn?
Definition at line 99 of file spectral.h. |
|
Returns handle to Gloss (intensity of specular reflection).
Definition at line 103 of file spectral.h. |
|
Definition at line 581 of file spectral.cpp. References imgbuf, rgbimg, and vuImage::set_data(). Referenced by vuSpectral::getCurrentImage(). |
Here is the call graph for this function:
|
return the direction of the light
Definition at line 113 of file spectral.h. |
|
Returns handle to Shininess.
Definition at line 101 of file spectral.h. |
|
Initializes open gl for rendering the volume data.
Definition at line 383 of file spectral.cpp. Referenced by vuSpectral::glInit(). |
|
loads a scene setup (materials, lights, camera resolution...) The function is intended to be piecewise replaced by additional features of vuVolume (e.g. spectral transfer function panel with load and save...) Definition at line 535 of file spectral.cpp. References center, imgbuf, vuCamera::init(), numlights, nummat, ns_vu1112112::Parser::Parse(), preprocess(), vuCamera::setPosition(), and vuCamera::translateXYZ(). Referenced by vuSpectral::OnButtonLoadSetup(). |
Here is the call graph for this function:
|
load data This function copies the entire volume into a seperate DatGrid structure. |
|
Assignment operator which does a deep copy.
Definition at line 79 of file spectral.cpp. References Grid, vu1112::operator=(), re_light, and re_render. Referenced by vu1112112(). |
Here is the call graph for this function:
|
Preprocesses volume data for rendering once it's been read.
Definition at line 197 of file spectral.cpp. References ns_vu1112112::Material::absorption, ns_vu1112112::DatGrid::calculate_gradients(), ns_vu1112112::DatGrid::classify(), ColourType, data, Grid, ns_vu1112112::Material::high_th, ns_vu1112112::Material::low_th, mat, pp_gradients, ns_vu1112112::Material::scattering, ns_vu1112112::DatGrid::shade(), TFLUT_absor, and TFLUT_scatt. Referenced by load_scene(), read(), and readRaw(). |
Here is the call graph for this function:
|
Reimplements the read() method to do some extra volume data processing.
Reimplemented from vu11121. Definition at line 121 of file spectral.cpp. References center, Grid, imgbuf, ns_vu1112112::DatGrid::load_vol(), pp_gradients, preprocess(), re_light, re_render, vu11121::read(), setImageSize(), vuCamera::setPosition(), and vuCamera::translateXYZ(). Referenced by vuSpectral::init(). |
Here is the call graph for this function:
|
This method reads volume data stored using the .raw data type.
Definition at line 150 of file spectral.cpp. References byte, center, dword, Grid, imgbuf, vuCamera::init(), ns_vu1112112::DatGrid::load_vol(), pp_gradients, preprocess(), re_light, re_render, setImageSize(), vuCamera::setPosition(), and vuCamera::translateXYZ(). |
Here is the call graph for this function:
|
Implements the abstract render() method of the vuVolume base class.
Reimplemented from vu11121. Definition at line 319 of file spectral.cpp. References byte, ns_vu1112112::DatGrid::classify(), vuSpectralImage::create_black_mask(), ns_vu1112112::Material::flat_absorption, vuSpectralImage::get_extents(), vuSpectralImage::get_rgb(), vuCamera::getLookAtVector(), vuCamera::getPosition(), GL_RGB, GL_UNPACK_ALIGNMENT, GL_UNSIGNED_BYTE, glDrawPixels(), glPixelStorei(), glRasterPos2i(), Grid, imgbuf, vuMutex::lock(), m_Mutex, mat, nummat, re_light, re_render, shootRays(), spimg, vuThread::startThread(), vuMutex::unlock(), and use_flat_absorption. Referenced by vuSpectral::glRender(). |
Here is the call graph for this function:
|
Overrides virtual vuThread::run(). Calls shootRays to distribute rendering to two different threads. Implements vuThread. Definition at line 300 of file spectral.cpp. References dword, vuCamera::getHeight(), m_Mutex, shootRays(), and vuMutex::unlock(). |
Here is the call graph for this function:
|
Set whether to do specular illumination. (default true).
Definition at line 93 of file spectral.h. Referenced by vuSpectral::addRight(), and vuSpectral::handleGUIevent(). |
|
Set whether to draw a preview. (default true).
Definition at line 97 of file spectral.h. Referenced by vuSpectral::addRight(), and vuSpectral::handleGUIevent(). |
|
set size of the canvas to render to
Definition at line 91 of file spectral.cpp. References byte, vuCamera::getHeight(), vuCamera::getWidth(), imgbuf, vuSpectralImage::init(), vuCamera::init(), vuCamera::setHeight(), vuCamera::setWidth(), and spimg. Referenced by vuSpectral::glResize(), read(), and readRaw(). |
Here is the call graph for this function:
|
adjust light between source 1 and 2; w E [0,1], l intensity scaling
Definition at line 511 of file spectral.cpp. References ColourType, ns_vu1112112::light, re_light, vuSpectralImage::set_light(), and spimg. Referenced by vuSpectral::glRender(). |
Here is the call graph for this function:
|
Set the direction of the light.
Definition at line 108 of file spectral.h. Referenced by vuSpectral::OnButtonLightPos(). |
|
Tell whether to move the light with the observer.
Definition at line 105 of file spectral.h. |
|
Sets the camera viewing position for the render method.
Reimplemented from vu11121. Definition at line 108 of file spectral.cpp. References vuCamera::init(), vuCamera::setLookAtVector(), vuCamera::setPosition(), and vuCamera::setUpVector(). |
Here is the call graph for this function:
|
Renders the scene by casting the rays from the camera. The parameters can be used to render only specific pixels. That can be used for progressive rendering or rendering distributed to different processes. The default values setup for full rendering.
Definition at line 242 of file spectral.cpp. References Cast(), vuColour< S >::clampTo01(), ColourType, vuColourRGBa::from(), vuColourXYZa::from(), vuSpectralImage::get_light(), vuCamera::getHeight(), vuCamera::getRay(), vuCamera::getWidth(), GL_POINTS, glBegin(), vuColourRGBa::glColor(), glEnd(), glVertex2f(), re_light, vuSpectralImage::set_xy(), and spimg. |
Here is the call graph for this function:
|
Definition at line 41 of file spectral.h. |
|
Definition at line 42 of file spectral.h. |
|
Definition at line 40 of file spectral.h. |
|
Ambient colour for normaliztion.
Definition at line 138 of file spectral.h. |
|
Background colour.
Definition at line 137 of file spectral.h. Referenced by Cast(), and ns_vu1112112::Parser::ReadGeneral(). |
|
scalar to toogle brightness of light source
Definition at line 156 of file spectral.h. Referenced by ns_vu1112112::Parser::ReadGeneral(), ns_vu1112112::DatPnt::shade(), and vu1112112(). |
|
center to rotate about
Definition at line 134 of file spectral.h. Referenced by load_scene(), read(), and readRaw(). |
|
weight for diffuse gradient shading
Definition at line 157 of file spectral.h. Referenced by ns_vu1112112::Parser::ReadGeneral(), ns_vu1112112::DatPnt::shade(), and vu1112112(). |
|
the grid to be rendered
Definition at line 136 of file spectral.h. Referenced by Cast(), operator=(), preprocess(), read(), readRaw(), and render(). |
|
buffer for the image. This expires when we have more sophisticated vuDrawTools Definition at line 162 of file spectral.h. Referenced by getImage(), load_scene(), read(), readRaw(), render(), setImageSize(), vu1112112(), and ~vu1112112(). |
|
max value for the brightness slider
Definition at line 158 of file spectral.h. Referenced by ns_vu1112112::Parser::ReadGeneral(), and vu1112112(). |
|
do specular illumination?
Definition at line 167 of file spectral.h. Referenced by Cast(), and vu1112112(). |
|
draw preview?
Definition at line 168 of file spectral.h. Referenced by vu1112112(). |
|
intensity of specular reflection
Definition at line 170 of file spectral.h. Referenced by vu1112112(). |
|
different colours for light source
Definition at line 139 of file spectral.h. Referenced by add_light(). |
|
direction of light vector
Definition at line 154 of file spectral.h. Referenced by Cast(), ns_vu1112112::Parser::ReadGeneral(), ns_vu1112112::DatPnt::shade(), and vu1112112(). |
|
Definition at line 165 of file spectral.h. |
|
move the light with the viewpoint?
Definition at line 155 of file spectral.h. Referenced by vu1112112(). |
|
shininess for specular reflection
Definition at line 169 of file spectral.h. Referenced by vu1112112(). |
|
list of materials
Definition at line 150 of file spectral.h. Referenced by Cast(), ns_vu1112112::DatPnt::classify(), preprocess(), and render(). |
|
number of light sources
Definition at line 149 of file spectral.h. Referenced by add_light(), load_scene(), and vu1112112(). |
|
number of materials
Definition at line 151 of file spectral.h. Referenced by add_material(), ns_vu1112112::DatPnt::classify(), load_scene(), render(), and vu1112112(). |
|
gradients already preprocessed?
Definition at line 164 of file spectral.h. Referenced by preprocess(), read(), and readRaw(). |
|
Definition at line 159 of file spectral.h. Referenced by operator=(), read(), readRaw(), render(), setLight(), shootRays(), and vu1112112(). |
|
refresh tags
Definition at line 159 of file spectral.h. Referenced by doRefresh(), operator=(), read(), readRaw(), render(), and vu1112112(). |
|
The rgb image that will be displayed onto the screen.
Definition at line 153 of file spectral.h. Referenced by getImage(). |
|
image with spectral information for each pixel
Definition at line 152 of file spectral.h. Referenced by render(), setImageSize(), setLight(), and shootRays(). |
|
own internal look-up-table for absorption Hopefully substituted by spectral transfer function panel.
Definition at line 147 of file spectral.h. Referenced by Cast(), and preprocess(). |
|
own internal look-up-table for scattering (color) Hopefully substituted by spectral transfer function panel.
Definition at line 143 of file spectral.h. Referenced by Cast(), and preprocess(). |
|
optimize using plain alpha blending
Definition at line 163 of file spectral.h. |