blob: b41d2ee3bed882974f1139a687152789fe4b7288 (
plain)
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
|
/*-----------------------------------------------------------------
LOG
GEM - Graphics Environment for Multimedia
The state to pass among GEM objects
Copyright (c) 1997-2000 Mark Danks. mark@danks.org
Copyright (c) Günther Geiger. geiger@epy.co.at
Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
-----------------------------------------------------------------*/
#ifndef INCLUDE_GEMSTATE_H_
#define INCLUDE_GEMSTATE_H_
#include "Base/GemExportDef.h"
#include "Base/GemGL.h"
struct pixBlock;
class TexCoord;
/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
TexCoord
DESCRIPTION
-----------------------------------------------------------------*/
class GEM_EXTERN TexCoord
{
public:
TexCoord() : s(0.f), t(0.f) { }
TexCoord(float s_, float t_) : s(s_), t(t_) { }
float s;
float t;
};
/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
GemState
The state to pass among GEM objects
DESCRIPTION
-----------------------------------------------------------------*/
class GEM_EXTERN GemState
{
public:
//////////
// Has something changed since the last time?
int dirty;
//////////
// Are we in a display list creation?
int inDisplayList;
//////////
// Lighting on?
int lighting;
//////////
// Smooth shading (flat is other type)
int smooth;
//////////
// Texture mapping on?
// 0..off
// 1..normalized texture
// 2..rectangle texture
int texture;
//////////
// The image to texture map
pixBlock *image;
//////////
// Texture coordinates.
// This can be NULL if there aren't any coordinates
TexCoord *texCoords;
//////////
// The number of TexCoords
int numTexCoords;
//////////
// The number of multiTexUnits
// default = 0, max = 7
int multiTexUnits;
//////////
// Milliseconds since last frame
// If in Stereoscopic mode, then it is the same number for both left
// and right renderings
float tickTime;
//////////////////
// the default draw-type (might be overriden within a Geo)
GLenum drawType;
//////////
// how deep is the current stack /* 4 fields for the 4 stacks */
int stackDepth[4];
////////////
//vertex-array data
int VertexDirty; // the vertex-arrays has changed
GLfloat *VertexArray;
int VertexArraySize;
int VertexArrayStride;
GLfloat *ColorArray;
int HaveColorArray;
GLfloat *NormalArray;
int HaveNormalArray;
GLfloat *TexCoordArray;
int HaveTexCoordArray;
//////////
// Constructor
GemState();
float texCoordX(int num) {
if (texture && numTexCoords > num)
return texCoords[num].s;
else return 0.;
}
float texCoordY(int num) {
if (texture && numTexCoords > num)
return texCoords[num].t;
else return 0.;
}
/* reset (parts of?) the GemState: to be called from [gemhead] */
void reset();
};
#endif // for header file
|