#include "Volumizer.h"
Go to the source code of this file.
Defines | |
#define | TOOL_HEIGHT 36 |
Functions | |
ATOM | RegisterHistogramClass (HINSTANCE hInstance) |
header for the transfer function (pointer to first handle | |
void | InitHistogramWnd (HWND hWnd) |
void | DeInitHistogramWnd (HWND hWnd) |
void | CalcHistogram () |
void | _drawBox (float x_pos, float y_pos, float delta) |
void | DrawHistogram (HWND hWnd) |
void | CreateDefaultHandle (histo_handle &handle) |
void | CreateInterpolatedHandle (histo_handle &newone, float new_pos) |
histo_handle * | GropeForHandle (HWND hWnd) |
void | MoveHandle (HWND hWnd, histo_handle *handle) |
histo_handle * | InsertHandle (HWND hWnd) |
void | CreateDefaultTransferFunction () |
void | LoadFunction () |
void | SaveFunction () |
LRESULT CALLBACK | HistogramProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
Variables | |
HGLRC | historc |
HDC | histodc |
render context | |
histo_handle * | tf |
device context |
#define TOOL_HEIGHT 36 |
Referenced by SplitterProc(), and WndProc().
void _drawBox | ( | float | x_pos, | |
float | y_pos, | |||
float | delta | |||
) |
Draw a handle box.
y_pos | x-location of the box's center |
delta | y-location of the box's center half-length of a box's side |
Definition at line 215 of file HistogramWnd.cpp.
Referenced by DrawHistogram().
void CalcHistogram | ( | ) |
Calculate the histogram contents based on the global voldat[] volume array.
our class container
the maximum content of all classes
only do this if we actually have something to compute it for
this is done with the float data instead of the raw data because that way the bias/gain/gamma functions are reflected in the histogram
logarithmize the whole thing, otherwise you won't see a lot (the 0 class would be dominant)
now generate a texture out of that information and bind it to our context
Definition at line 134 of file HistogramWnd.cpp.
References histodc, historc, voldat, volx, voly, and volz.
Referenced by ShovelData().
void CreateDefaultHandle | ( | histo_handle & | handle | ) |
Create a default histo_handle.
handle | empty handle to be filled |
Definition at line 336 of file HistogramWnd.cpp.
Referenced by CreateDefaultTransferFunction(), and CreateInterpolatedHandle().
void CreateDefaultTransferFunction | ( | ) |
Create the default transfer function (grey, 0 alpha on the left, 100 alpha on the right)
Definition at line 583 of file HistogramWnd.cpp.
References CreateDefaultHandle(), and tf.
Referenced by _tWinMain().
void CreateInterpolatedHandle | ( | histo_handle & | newone, | |
float | new_pos | |||
) |
Take a reference to a handle, and a position, and then fill the handle with interpolated values based on the position.
first, find the handles to the left and right of the requested position
then, calculate a weighting for the handle we place in between
finally, blend
new_pos | reference to the handle that should hold the interpolated values position for which the interpolation should occur |
Definition at line 363 of file HistogramWnd.cpp.
References CreateDefaultHandle(), and tf.
Referenced by InsertHandle(), ShadeStep(), and ShootRay().
void DeInitHistogramWnd | ( | HWND | hWnd | ) |
De-Init OGL for the Histogram window
obtain its associated device context
make the rendering context not current
release the device context
delete the rendering context
Definition at line 112 of file HistogramWnd.cpp.
References histodc, and historc.
Referenced by HistogramProc().
void DrawHistogram | ( | HWND | hWnd | ) |
Draw the histogram by first filling the background with a quad mapped with the texture from CalcHistogram(), and then drawing the transfer function on top.
draw a viewport-filling quad mapped with our texture
draw the transfer function handles
draw a blended polygon with the diffuse colors (looks prettier)
draw a line connecting it to the next handle
draw a box at the current handle's location
Definition at line 244 of file HistogramWnd.cpp.
References _drawBox(), histodc, historc, and tf.
Referenced by EditTransferHandle(), HistogramProc(), InsertHandle(), MaterialEditorProc(), MoveHandle(), and ShovelData().
histo_handle* GropeForHandle | ( | HWND | hWnd | ) |
Find out, which (if any) handle the cursor currently is hovering over
first, unproject the mouse cursor position
now find out if the coordinates fit to any histo_handle
Definition at line 419 of file HistogramWnd.cpp.
References histodc, historc, and tf.
Referenced by HistogramProc(), and OrthoProc().
LRESULT CALLBACK HistogramProc | ( | HWND | hWnd, | |
UINT | message, | |||
WPARAM | wParam, | |||
LPARAM | lParam | |||
) |
Window Procedure for the histogram window.
this opens the context menu either for a handle, or save/load if over the background
try to grab a handle if none found, insert a fresh one
move a handle if we currently have one in our mittens
Definition at line 720 of file HistogramWnd.cpp.
References DeInitHistogramWnd(), DrawHistogram(), EditTransferHandle(), GropeForHandle(), hInst, ID_BACK_LOADTRANSFERFUNCTION, ID_BACK_SAVETRANSFERFUNCTION, ID_HANDLE_EDIT, ID_HANDLE_REMOVE, IDC_RCLICKS, InitHistogramWnd(), InsertHandle(), LoadFunction(), MoveHandle(), RayRender(), and SaveFunction().
Referenced by RegisterHistogramClass().
void InitHistogramWnd | ( | HWND | hWnd | ) |
Initialize OGL for the Histogram window
size of this pfd
version number
support window
support OpenGL
double buffered
RGBA type
32-bit color depth
color bits ignored
no alpha buffer
shift bit ignored
no accumulation buffer
accum bits ignored
32-bit z-buffer
no stencil buffer
no auxiliary buffer
main layer
reserved
layer masks ignored
get the device context's best, available pixel format match
make that match the device context's current pixel format
try to make it the thread's current rendering context
All the basic things that never change
GL_BLEND is also important for AA
init our font display list
Definition at line 42 of file HistogramWnd.cpp.
References histodc, and historc.
Referenced by HistogramProc().
histo_handle* InsertHandle | ( | HWND | hWnd | ) |
Insert a new histo_handle at the current mouse position.
Definition at line 521 of file HistogramWnd.cpp.
References CreateInterpolatedHandle(), DrawHistogram(), histodc, historc, and tf.
Referenced by HistogramProc().
void LoadFunction | ( | ) |
Load a transfer function from disk.
Definition at line 605 of file HistogramWnd.cpp.
References tf, and wnd_histogram.
Referenced by HistogramProc().
void MoveHandle | ( | HWND | hWnd, | |
histo_handle * | handle | |||
) |
Move a transfer function handle to the mouse position.
Definition at line 471 of file HistogramWnd.cpp.
References DrawHistogram(), histodc, and historc.
Referenced by HistogramProc(), and OrthoProc().
ATOM RegisterHistogramClass | ( | HINSTANCE | hInstance | ) |
header for the transfer function (pointer to first handle
Register the window class of the histogram window
no background, we fill it ourselves with OGL
hInstance | global program instance |
Definition at line 17 of file HistogramWnd.cpp.
References HistogramProc().
Referenced by _tWinMain().
void SaveFunction | ( | ) |
Write a transfer function out to disk.
Definition at line 673 of file HistogramWnd.cpp.
References tf, and wnd_histogram.
Referenced by HistogramProc().
HDC histodc |
render context
Definition at line 10 of file HistogramWnd.cpp.
Referenced by CalcHistogram(), DeInitHistogramWnd(), DrawHistogram(), GropeForHandle(), InitHistogramWnd(), InsertHandle(), and MoveHandle().
HGLRC historc |
Implements the density histogram
Definition at line 9 of file HistogramWnd.cpp.
Referenced by CalcHistogram(), DeInitHistogramWnd(), DrawHistogram(), GropeForHandle(), InitHistogramWnd(), InsertHandle(), and MoveHandle().
histo_handle* tf |
device context
Definition at line 12 of file HistogramWnd.cpp.
Referenced by CreateDefaultTransferFunction(), CreateInterpolatedHandle(), DrawHistogram(), GropeForHandle(), InsertHandle(), LoadFunction(), and SaveFunction().