Main Page | Class List | Directories | File List | Class Members | File Members

Parameters Class Reference

Provides an easy way to manage application-specific parameters. More...

#include <Parameters.h>

List of all members.

Public Member Functions

void Setup (CDXUTDialog *g_HUD)
 You can set the dialog that manages input and rendering for the GUI controls.
void Setup (CDXUTDialog *g_HUD, ONCHANGE_CALLBACK OnReset, ONCHANGE_CALLBACK OnSave=OnChange, ONCHANGE_CALLBACK OnLoad=OnChange)
 You can set the dialog that manages input and rendering for the GUI controls.
bool Get (bool_t i)
 Returns value of the specified boolean parameter, e.g. Get( bShowHelp ).
float Get (number_t i)
 Returns float value of the specified numeric parameter, in range 0..1.
int GetInt (number_t i)
 Returns integer value of the specified numeric parameter, in range 0...number-of-steps.
void SetBool (bool_t ID, bool b)
void SetFloat (number_t ID, float v)
void SetInt (number_t ID, int v)
void Add (bool_t ID, char *label, char cHotKey=0, ONCHANGE_CALLBACK bchf=OnChange)
 Adds a boolean parameter represented by a GUI checkbox. Specifies hotkey and callback function.
void Add (int radiogroupID, bool_t ID, char *label, char cHotKey=0, ONCHANGE_CALLBACK bchf=OnChange)
 Adds a boolean parameter represented by a GUI radio button. Specifies hotkey and callback function.
void Add (number_t ID, char *label, int num_steps)
 Adds a numeric parameter represented by a GUI slider.
void Add (number_t ID, char *label, int num_steps, CONVERTER ff, ONCHANGE_CALLBACK chf=OnChange)
 Adds a numeric parameter represented by a GUI slider. Specifies callback functions.
void Add (number_t ID, char *label, int num_steps, char cKeyDecr, char cKeyIncr=0, CONVERTER ff=noconvert, ONCHANGE_CALLBACK chf=OnChange)
 Adds a numeric parameter represented by a GUI slider. Specifies hotkeys and callback functions.
void SetEnabled (bool_t ID, bool bEnabled)
void SetEnabled (number_t ID, bool bEnabled)
void UpdateFromHUD (int controlID)
 Updates the specified parameter from the GUI.
void SaveToFile (char *fileName)
 Writes all parameter values into the specified file.
void LoadFromFile (char *fileName)
 Loads all parameter values from the specified file.

Private Attributes

bool bparam [LAST_BOOL]
wchar_t bname [LAST_BOOL][CHARBUFFER_SIZE]
int radiogroup [LAST_BOOL]
int param [LAST_NUMBER]
wchar_t name [LAST_NUMBER][CHARBUFFER_SIZE]
int numsteps [LAST_NUMBER]
bool rotate [LAST_NUMBER]
CONVERTER ffunc [LAST_NUMBER]
ONCHANGE_CALLBACK chfunc [LAST_NUMBER+3]
ONCHANGE_CALLBACK bchfunc [LAST_BOOL]
CDXUTDialog * g_HUD
 Manages input and rendering for the GUI controls.
bool bSilent

Static Private Attributes

static const int CHARBUFFER_SIZE = 200
 The max length of a line in the saved file.


Detailed Description

Provides an easy way to manage application-specific parameters.

You can easily add numeric/boolean parameters represented by GUI sliders and checkboxes/radio buttons. Then get the current values of these parameters when needed. All parameters can be saved to file or read from file in one step.

The following rendering methods (method_t) are defined here:

Uses technique EnvMapClassicPS() (or EnvMapClassicMetalPS() for metals).

Uses technique EnvMapImpostorPS() (or EnvMapImpostorMetalPS() for metals).

Uses technique EnvMapDiffusePS() for rendering and EnvMap::PreConvolve() for precalculation.

Uses technique EnvMapDiffuseLocalizedWithCosLookupPS() for rendering and EnvMap::GenerateCosTexture() for precalculation.

Sorry for the long function names ;)

Uses technique EnvMapDiffuseLocalizedPS().

Author:
Istvan Lazanyi, TU Budapest
Date:
2006-04-26


Member Function Documentation

void Parameters::Add number_t  ID,
char *  label,
int  num_steps,
char  cKeyDecr,
char  cKeyIncr = 0,
CONVERTER  ff = noconvert,
ONCHANGE_CALLBACK  chf = OnChange
 

Adds a numeric parameter represented by a GUI slider. Specifies hotkeys and callback functions.

Parameters:
ID id of the given numeric parameter
label label to be displayed for the slider
num_steps number of possible parameter values
cKeyDecr Hotkey to decrease parameter value. (Note: keys R, S, L are reserved.)
cKeyIncr Hotkey to increase parameter value. (Note: keys R, S, L are reserved.) If 0, the slider will only have one hotkey that circulates between values min, min+1, ..., max-1, max, min, ...
ff converter function to transform the parameter value
chf callback to an action to be performed when the parameter changes

void Parameters::Add number_t  ID,
char *  label,
int  num_steps,
CONVERTER  ff,
ONCHANGE_CALLBACK  chf = OnChange
 

Adds a numeric parameter represented by a GUI slider. Specifies callback functions.

Parameters:
ID id of the given numeric parameter
label label to be displayed for the slider
num_steps number of possible parameter values
ff converter function to transform the parameter value
chf callback to an action to be performed when the parameter changes

void Parameters::Add number_t  ID,
char *  label,
int  num_steps
 

Adds a numeric parameter represented by a GUI slider.

Parameters:
ID id of the given numeric parameter
label label to be displayed for the slider
num_steps number of possible parameter values

void Parameters::Add int  radiogroupID,
bool_t  ID,
char *  label,
char  cHotKey = 0,
ONCHANGE_CALLBACK  bchf = OnChange
 

Adds a boolean parameter represented by a GUI radio button. Specifies hotkey and callback function.

Parameters:
radiogroupID id of radio button group. Checking a radio button will clear all other radio buttons with the same radiogroupID.
ID id of the given boolean parameter
label label to be displayed for the control
cHotkey Hotkey to change parameter value. (Note: keys R, S, L are reserved.)
bchf callback to an action to be performed when the parameter changes

void Parameters::Add bool_t  ID,
char *  label,
char  cHotKey = 0,
ONCHANGE_CALLBACK  bchf = OnChange
 

Adds a boolean parameter represented by a GUI checkbox. Specifies hotkey and callback function.

Parameters:
ID id of the given boolean parameter
label label to be displayed for the control
cHotkey Hotkey to change parameter value. (Note: keys R, S, L are reserved.)
bchf callback to an action to be performed when the parameter changes

float Parameters::Get number_t  i  ) 
 

Returns float value of the specified numeric parameter, in range 0..1.

Example: Get( refractionIndex ). Converter functions (if present) are applied to the result.

bool Parameters::Get bool_t  i  ) 
 

Returns value of the specified boolean parameter, e.g. Get( bShowHelp ).

int Parameters::GetInt number_t  i  ) 
 

Returns integer value of the specified numeric parameter, in range 0...number-of-steps.

Example: Get( fIntensity ) = 0..100. Converter functions (if present) are applied to the result.

void Parameters::LoadFromFile char *  fileName  ) 
 

Loads all parameter values from the specified file.

void Parameters::SaveToFile char *  fileName  ) 
 

Writes all parameter values into the specified file.

void Parameters::SetBool bool_t  ID,
bool  b
 

void Parameters::SetEnabled number_t  ID,
bool  bEnabled
 

void Parameters::SetEnabled bool_t  ID,
bool  bEnabled
 

void Parameters::SetFloat number_t  ID,
float  v
 

void Parameters::SetInt number_t  ID,
int  v
 

void Parameters::Setup CDXUTDialog *  g_HUD,
ONCHANGE_CALLBACK  OnReset,
ONCHANGE_CALLBACK  OnSave = OnChange,
ONCHANGE_CALLBACK  OnLoad = OnChange
 

You can set the dialog that manages input and rendering for the GUI controls.

Additionally, you can specify actions (ONCHANGE_CALLBACK) to the standard buttons Reset, Save and Load.

void Parameters::Setup CDXUTDialog *  g_HUD  ) 
 

You can set the dialog that manages input and rendering for the GUI controls.

void Parameters::UpdateFromHUD int  controlID  ) 
 

Updates the specified parameter from the GUI.

Since a GUI event provides the id of the sender (see OnGUIEvent() in Main.cpp), we can update the parameter value belonging to that control.

In case of Load/Save, parameters are loaded from/saved to the file called .params. In case of Reset, parameters are loaded from the file called .params0.


Member Data Documentation

ONCHANGE_CALLBACK Parameters::bchfunc[LAST_BOOL] [private]
 

wchar_t Parameters::bname[LAST_BOOL][CHARBUFFER_SIZE] [private]
 

bool Parameters::bparam[LAST_BOOL] [private]
 

bool Parameters::bSilent [private]
 

const int Parameters::CHARBUFFER_SIZE = 200 [static, private]
 

The max length of a line in the saved file.

ONCHANGE_CALLBACK Parameters::chfunc[LAST_NUMBER+3] [private]
 

CONVERTER Parameters::ffunc[LAST_NUMBER] [private]
 

CDXUTDialog* Parameters::g_HUD [private]
 

Manages input and rendering for the GUI controls.

wchar_t Parameters::name[LAST_NUMBER][CHARBUFFER_SIZE] [private]
 

int Parameters::numsteps[LAST_NUMBER] [private]
 

int Parameters::param[LAST_NUMBER] [private]
 

int Parameters::radiogroup[LAST_BOOL] [private]
 

bool Parameters::rotate[LAST_NUMBER] [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Apr 27 11:58:01 2006 for gyak by  doxygen 1.4.2