28 void *Vertices, *Normals, *TexCoords, *Colors;
29 bool VerticesAreValid, NormalsAreValid, TexCoordsAreValid, ColorsAreValid;
30 char WordsPerVertex, WordsPerNormal, WordsPerTexCoord, WordsPerColor;
35 inline bool GetVerticesAreValid()
const {
return VerticesAreValid; }
36 inline bool GetNormalsAreValid()
const {
return NormalsAreValid; }
37 inline bool GetTexCoordsAreValid()
const {
return TexCoordsAreValid; }
38 inline bool GetColorsAreValid()
const {
return ColorsAreValid; }
40 inline void SetVerticesValid(
bool valid) { VerticesAreValid = valid; }
41 inline void SetNormalsValid(
bool valid) { NormalsAreValid = valid; }
42 inline void SetTexCoordsValid(
bool valid) { TexCoordsAreValid = valid; }
43 inline void SetColorsValid(
bool valid) { ColorsAreValid = valid; }
45 inline void* GetVertices()
const {
return Vertices; }
46 inline void* GetNormals()
const {
return Normals; }
47 inline void* GetTexCoords()
const {
return TexCoords; }
48 inline void* GetColors()
const {
return Colors; }
50 inline void SetVertices(
void* newPtr) { Vertices = newPtr; }
51 inline void SetNormals(
void* newPtr) { Normals = newPtr; }
52 inline void SetTexCoords(
void* newPtr) { TexCoords = newPtr; }
53 inline void SetColors(
void* newPtr) { Colors = newPtr; }
55 inline int GetWordsPerVertex()
const {
return WordsPerVertex; }
56 inline int GetWordsPerNormal()
const {
return WordsPerNormal; }
57 inline int GetWordsPerTexCoord()
const {
return WordsPerTexCoord; }
58 inline int GetWordsPerColor()
const {
return WordsPerColor; }
60 inline void SetWordsPerVertex(
int numWords) { WordsPerVertex = numWords; }
61 inline void SetWordsPerNormal(
int numWords) { WordsPerNormal = numWords; }
62 inline void SetWordsPerTexCoord(
int numWords) { WordsPerTexCoord = numWords; }
63 inline void SetWordsPerColor(
int numWords) { WordsPerColor = numWords; }
103 static const unsigned int kMaxUserPrimTypes = PGL_MAX_CUSTOM_PRIM_TYPES;
107 cpu_vec_xyz CurNormal;
108 float CurTexCoord[2];
109 static bool DoNormalize;
115 bool LastArrayAccessWasIndexed, LastArrayAccessIsValid;
117 bool UserRenderContextChanged;
119 static inline void CheckPrimAccess(GLenum prim)
122 mErrorIf(prim >= kMaxUserPrimTypes,
123 "trying to access prim %d; max number of custom prim types is %d\n",
124 prim, kMaxUserPrimTypes);
132 static inline bool IsUserPrimType(
unsigned int prim) {
return (prim & 0x80000000); }
134 static inline void RegisterUserPrimType(GLenum prim,
136 tU64 rendererReqMask,
137 bool mergeContiguous)
139 CheckPrimAccess(prim);
141 UserPrimTypes[prim].requirements = requirements;
142 UserPrimTypes[prim].rendererReqMask = rendererReqMask;
143 UserPrimTypes[prim].mergeContiguous = mergeContiguous;
146 static inline tU64 GetUserPrimRequirements(GLenum prim)
148 CheckPrimAccess(prim);
150 return UserPrimTypes[prim].requirements;
153 static inline bool GetUserPrimMerge(GLenum prim)
155 CheckPrimAccess(prim);
157 return UserPrimTypes[prim].mergeContiguous;
160 static inline tU64 GetUserPrimReqMask(GLenum prim)
162 CheckPrimAccess(prim);
164 return UserPrimTypes[prim].rendererReqMask;
167 void SetUserRenderContextChanged() { UserRenderContextChanged =
true; }
171 inline cpu_vec_xyz GetCurNormal()
const {
return CurNormal; }
172 inline void SetCurNormal(cpu_vec_xyz normal) { CurNormal = normal; }
174 inline const float* GetCurTexCoord()
const {
return CurTexCoord; }
175 inline void SetCurTexCoord(
float u,
float v)
182 void SetDoNormalize(
bool normalize) { DoNormalize = normalize; }
184 inline CVertArray& GetVertArray() {
return *VertArray; }
188 virtual void EnableCustom(tU64 flag) = 0;
189 virtual void DisableCustom(tU64 flag) = 0;
193 virtual void BeginGeom(GLenum mode) = 0;
194 virtual void Vertex(cpu_vec_xyzw newVert) = 0;
195 virtual void Normal(cpu_vec_xyz normal) = 0;
196 virtual void TexCoord(
float u,
float v) = 0;
197 virtual void Color(cpu_vec_xyzw color) = 0;
198 virtual void EndGeom() = 0;
199 virtual void DrawArrays(GLenum mode,
int first,
int count) = 0;
200 virtual void DrawIndexedArrays(GLenum primType,
201 int numIndices,
const unsigned char* indices,
204 virtual void Flush() = 0;