source: GTP/trunk/App/Demos/Illum/Standalone/HierRayEngine [DirectX]/Parameters.h @ 1481

Revision 1481, 1.9 KB checked in by szirmay, 18 years ago (diff)
Line 
1#pragma once
2#include <assert.h>
3
4typedef enum { bShowHelp, bMoveLight, bLookFromLight, bDots, bTurbo, LAST_BOOL } bool_t;
5typedef enum { fRayPathLength, LAST_NUMBER } number_t;
6
7enum { IDC_GEN_BUTTON = -4, IDC_RESET_BUTTON, IDC_SAVE_BUTTON, IDC_LOAD_BUTTON };
8
9#define CHARBUF 100                             // The max length of a line in the save file
10
11typedef float (*CONVERTER)(float a);
12typedef void (*ONCHANGE_CALLBACK)(void);
13
14float noconvert(float a);       // { return a; }
15
16float convert100(float a);
17float convert10(float a);
18float convert1(float a);
19float convertNSamples(float a);
20float convertDepthResolution(float a);
21
22void OnChange();                        // {}
23
24
25class Parameters {
26        bool bparam[LAST_BOOL];
27        wchar_t bname[LAST_BOOL][CHARBUF];
28
29        int param[LAST_NUMBER]; // 0..100 (0..num_steps)
30        wchar_t name[LAST_NUMBER][CHARBUF];
31        int numsteps[LAST_NUMBER];
32
33        CONVERTER ffunc[LAST_NUMBER];
34        ONCHANGE_CALLBACK chfunc[LAST_NUMBER+3];
35
36        CDXUTDialog* g_HUD;
37
38        bool bSilent;
39        const static int CHARBUFFER_SIZE = 200;
40        enum { checkboxID0 = 1000, sliderID0 = 2000, staticID0 = 3000, upID0 = 4000, downID0 = 5000 };
41
42public:
43        void Setup( CDXUTDialog* g_HUD );
44        void Setup( CDXUTDialog* g_HUD, ONCHANGE_CALLBACK OnReset, ONCHANGE_CALLBACK OnSave = OnChange, ONCHANGE_CALLBACK OnLoad = OnChange);
45
46        bool Get( bool_t i );
47        float Get( number_t i );
48        int GetInt( number_t i );
49
50        void SetBool( bool_t ID, bool b );
51        void SetFloat( number_t ID, float v );
52        void SetInt( number_t ID, int v );
53
54        void Add( bool_t ID, char* label, char cHotKey = 0 );
55        void Add( number_t ID, char* label, int num_steps);
56
57        void Add( number_t ID, char* label, int num_steps,
58                CONVERTER ff, ONCHANGE_CALLBACK chf = OnChange );
59
60        void Add( number_t ID, char* label, int num_steps, char cKeyDecr, char cKeyIncr,
61                CONVERTER ff = noconvert, ONCHANGE_CALLBACK chf = OnChange );
62
63        void UpdateFromHUD( int controlID );
64
65        void SaveToFile( char* fileName );
66        void LoadFromFile( char* fileName );
67};
Note: See TracBrowser for help on using the repository browser.