-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgluvv.h
282 lines (252 loc) · 11.7 KB
/
gluvv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
//------------------------------------------------------------------------
//
// Joe Kniss
// A glut implementation of the Volume Renderer
// gluvv.h "GL Utilites for Virtual reality Volume rendering"
// 3-4-01
// ________ ____ ___
// | \ / | / /
// +---+ \/ |/ /
// +--+| |\ /| <
// | || | \ / | |\ \
// | | \/ | | \ \
// \_____| |__| \__\
// Copyright 2001
// Joe Michael Kniss
// << jmk@cs.utah.edu >>
// "All Your Base are Belong to Us"
//-------------------------------------------------------------------------
#ifndef __GLUVV_DOT_H
#define __GLUVV_DOT_H
#include "gluvvPrimitive.h"
#include "MetaVolume.h"
#include "TLUT.h"
#include "TFWindow.h"
#include "LTWidgetRen.h"
struct gluvvWindow{ //Window size and location attributes
unsigned int width;
unsigned int height;
unsigned int xPos;
unsigned int yPos; //screen pos
};
struct gluvvEnv{ //GL rendering Environment parameters
float eye[3]; // eye location
float at[3]; // lookat point
float up[3]; // up vector
// frustum[0] = left, frustum[1] = right
float frustum[4];// frustum[2] = bottom, frustum[3] = top
float clip[2]; // clip[0] = front, clip[1] = back
float diff[4]; // diffuse color (material)
float spec[4]; // speculare color (material)
int bgColor; // what color is the back ground? 0==white 1==black
};
struct gluvvLight{ //lighting information
float pos[3]; //light position
float startpos[3];
float color[3]; //light color
float amb; //(ambient contribution)
float intens;
float mv[16]; //the light model view
float pj[16]; //the light projection
float xf[16]; //pj*mv
int buffsz[2]; //x&y sizes of shadow buffer
int shadow; //are shadows enabled??
int softShadow;//are soft shadows enabled??
int showView; //show the view from the light
int shadowTF; //use a separate shadow transfer function
int showShadowTF; //render the shadow tf from your view
int sill; //do silhouette edges
float gShadowQual; //good shadow quality
float iShadowQual; //interactive shadow quality
unsigned int cubeName; //cube map name
float *cubeKey[6]; //decode the cubemap normals
int csz; //dimension of one axis of the cube map
int load; //reload the lighting info
int gload; //this is the good load, not interacting anymore
int fog; //is fog on?
float fogColor[3]; //fog color
float fogThresh; //fog blend threshold
float fogLimits[2];//limits of fog calculations
int latt; //light attinuation is on?
float lattThresh; //attinuation threshold
float lattLimits[2];//limits of attinuation calculations
};
extern LTWidgetRen ltwr; //the lighting widget
struct gluvvRInfo{ //rendering transform parameters
float xform[16]; //rotation from trackball
float scale; //isotropic scale value
float trans[3]; //translation
};
struct gluvvMouse{ //mouse state information
int button; //GLUT mouse button
int state; //GLUT mouse state
int pos[2]; //x,y
int last[2]; //last mouse position
int shift; //is shift down
int ctrl; //is control down
int alt; //is alt down
};
struct gluvvKey{ //key board state
unsigned char key; //GLUT key
int shift; //is shift down
int ctrl; //is control down
int alt; //is alt down
};
struct gluvvPick{ //picking information
int name32; //name for 32 bit compiles
int name64; //name for 64 bit compiles
int data1; //data pushed on with name
int data2; // ''
int data3; // ''
int pos[2]; //screen space coords
unsigned int z; //depth of pick
gluvvPrimitive *prim; //primitive pointer (same as name*)
};
struct gluvvVolRen{ //volume rendering paramters
float sampleRate; //current sample rate for rendering
float interactSamp; //interactive sample rate
float goodSamp; //high quality sample rate
int shade; //render the volume shaded
TLUT *tlut; //texture lookup table
unsigned char *deptex; //2d dependent texture 256x256xRGBA [gb]
unsigned int deptexName; // '' name [gb]
unsigned char *deptex2; //2d dependent texture ... [ar]
unsigned int deptex2Name; // '' name [ar]
unsigned char *deptex3; //2d dependent texture for shadows
unsigned int deptex3Name; // '' name shadows
int loadTLUT; //reload the LUT if flag == 1
int scaleAlphas; //scale alphas with sample rate
float gamma; //constant alpha scale
int timestep; //what timestep are we on?
int usePostCNorm; //using post classification normals???
int loadNorms; //reload the normals
};
typedef enum { //Major axies of volume coords
VolRenAxisUnknown,
VolRenAxisXPos,
VolRenAxisXNeg,
VolRenAxisYPos,
VolRenAxisYNeg,
VolRenAxisZPos,
VolRenAxisZNeg
} VolRenMajorAxis;
struct gluvvTF{ //transfer funciton widget
int tfWindow; //idenftifier for transfer function window
TFWindow *tfwin; //the tf window class
int loadme; //reload the tf
int paintme; //paint the brush into the tf
int dropme; //drop the brush widget into the tf
int clearpaint; //clear the painted tf
int ptexsz[3];
int numelts; //RGBA ??
int brushon; //brush on or off?
float slider1; //slider for third axis emphasis
float slider1hi;
float slider1lo;
float slider2; //slider for fourth axis emphasis
int histOn; //use the histogram??
};
struct gluvvClip{ //clipping plane widget
int on; //flag for clip on(1) or off(0).
int ortho; //ortho graphic mode (axis aligned)
VolRenMajorAxis oaxis; //ortho graphic axis to render along
float xform[16]; //orientation of clip plane
unsigned int pname; //name of plane
float alpha; //how to blend it with the volume
float pos[3]; //position of clip plane (world coords)
float vpos[3]; // '' in volume space
float dir[3]; //direction of clip plane normal
float mousepnt[3]; //a selected point
float corners[4][3];//corners of plane widget
};
struct gluvvPert{ //perturbation info
int on;
int numHarm;
float weights[10];
float scales[10];
};
typedef enum{ //gluvv brush modes
NoBrush,
EllipseBrush,
AutoEllipseBrush,
TriangleBrush,
OneDBrush,
AutoOneDBrush
} gluvvBrush;
struct gluvvProbe{ //data probe widget
float vpos[3]; //probes position in the volume
float slider; //slider pos [0--1]
gluvvBrush brush; //brush type
};
typedef enum { //Gluvv Shade modes (shadows are handled by the light struct)
gluvvShadeUnknown,
gluvvShadeAmb, //ambient
gluvvShadeDiff, //diffuse
gluvvShadeDSpec, //diffuse + specular
gluvvShadeFaux, //Faux shading
gluvvShadeArb, //arbitrary shading via pixel texture
gluvvShadeMIP
} gluvvShade;
typedef enum { //Gluvv platforms supported
GPGineric, //default
GPOctane, //-o
GPOctane2, //-o2
GPInfinite, //-i SGI Infinite Reality
GPNV15, //-nv15 GeForce 2
GPNV20, //-nv20 - 3D textures GeForce 3
GPNV202D, //-nv20 - 2D textures GeForce 3
GPWildcat, //Intense3D Wildcat
GPATI8K //ATI Radeon 8000 (R200)
} gluvvPlatform;
typedef enum { //Gluvv Data modes #of bytes in data texture
GDM_V1, //1 value only, scalar (1B)
GDM_V1G, //1 value and gradient (2B)
GDM_V1GH, //1 value, gradient, and hessian (3B)
GDM_V2, //2 values (2B)
GDM_V2G, //2 values with gradient (3B)
GDM_V2GH, //2 values with gradient and hessian (4B)
GDM_V3, //3 values (3B)
GDM_V3G, //3 values with gradient (4B)
GDM_V4, //4 values (4B)
GDM_VGH, //VGH data (pre-computed) (3B)
GDM_VGH_VG, //VGH data - only use VG (2B)
GDM_VGH_V, //VGH data - only use V (1B)
GDM_UNKNOWN //I have no idea what the data type is(?B)
} gluvvDataMode;
typedef enum {
GB_NONE,
GB_UNDER,
GB_OVER,
GB_ZERO
} gluvvBlend;
struct gluvvGlobal{ //------ GLUVV GLOBAL -----------------------------------
int debug;
gluvvWindow win; //widnow
gluvvEnv env; //environment
gluvvLight light; //light
gluvvRInfo rinfo; //render info
gluvvMouse mouse; //mouse
gluvvPlatform plat; //plaform
int picking;//picking toggle
gluvvPick pick; //picked object
gluvvVolRen volren; //volume rendering stuff
gluvvTF tf; //transfer function
gluvvClip clip; //clipping plane tf
gluvvProbe probe; //data probe widget
int mprobe; //using data probe or clip plane for probing??
MetaVolume *mv; //the volumes
MetaVolume *mv1;
MetaVolume *mv2;
MetaVolume *mv3;
int mainWindow; //mainWindow Identifier
gluvvShade shade; //shading enable/disable flag
gluvvDataMode dmode; //what data mode are we in?
gluvvBlend reblend; //re-render scene with blend
gluvvPert pert; //perturbation parameters
}; //-------------------------------------------------------------------------
//----------------- gluvvGlobal gluvv ----------------------------------------
//----------------------------------------------------------------------------
// This needs to be declared in the "main" function!
//----------------------------------------------------------------------------
extern gluvvGlobal gluvv;
#endif