My Project
RenderCoreOpenGL.h
1 #pragma once
2 
3 #ifndef DIRECTINPUT_VERSION
4 namespace ParaEngine
5 {
6 #ifndef FIELD_OFFSET
7 #define FIELD_OFFSET(type, field) ((uint32_t)offsetof(type, field))
8 #endif
9 
10 
11  typedef struct _DIMOUSESTATE {
12  uint32 lX;
13  uint32 lY;
14  uint32 lZ;
15  BYTE rgbButtons[4];
17 
18  // emulate direct mouse
19  typedef struct _DIMOUSESTATE2 {
20  uint32 lX;
21  uint32 lY;
22  uint32 lZ;
23  BYTE rgbButtons[8];
25 
26  enum DIMOFS_ENUM
27  {
28  DIMOFS_X = FIELD_OFFSET(DIMOUSESTATE, lX),
29  DIMOFS_Y = FIELD_OFFSET(DIMOUSESTATE, lY),
30  DIMOFS_Z = FIELD_OFFSET(DIMOUSESTATE, lZ),
31  DIMOFS_BUTTON0 = (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0),
32  DIMOFS_BUTTON1 = (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1),
33  DIMOFS_BUTTON2 = (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2),
34  DIMOFS_BUTTON3 = (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3)
35  };
36 
37  // emulate direct input 8 structure
38  typedef struct DIDEVICEOBJECTDATA {
39  DWORD dwOfs;
40  DWORD dwData;
41  DWORD dwTimeStamp;
42  DWORD dwSequence;
43  DWORD uAppData;
45 
46 
47 
48 
49 }
50 #endif
51 
52 namespace ParaEngine
53 {
54 #ifndef MAKEFOURCC
55 #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
56  ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
57  ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
58 #endif /* defined(MAKEFOURCC) */
59 
60  typedef enum _D3DLIGHTTYPE {
61  D3DLIGHT_POINT = 1,
62  D3DLIGHT_SPOT = 2,
63  D3DLIGHT_DIRECTIONAL = 3,
64  D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
65  } D3DLIGHTTYPE;
66 
67  typedef enum _D3DCULL {
68  D3DCULL_NONE = 1,
69  D3DCULL_CW = 2,
70  D3DCULL_CCW = 3,
71  D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
72  } D3DCULL;
73 
74 
75 
76 
77  typedef enum _D3DFORMAT
78  {
79  D3DFMT_UNKNOWN = 0,
80 
81  D3DFMT_R8G8B8 = 20,
82  D3DFMT_A8R8G8B8 = 21,
83  D3DFMT_X8R8G8B8 = 22,
84  D3DFMT_A8 = 28,
85  D3DFMT_A8B8G8R8 = 32,
86  D3DFMT_X8B8G8R8 = 33,
87 
88  D3DFMT_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'),
89  D3DFMT_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'),
90  D3DFMT_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'),
91  D3DFMT_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'),
92  D3DFMT_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'),
93 
94  D3DFMT_D32 = 71,
95  D3DFMT_D15S1 = 73,
96  D3DFMT_D24S8 = 75,
97  D3DFMT_D24X8 = 77,
98  D3DFMT_D24X4S4 = 79,
99  D3DFMT_D16 = 80,
100 
101  D3DFMT_VERTEXDATA = 100,
102  D3DFMT_INDEX16 = 101,
103  D3DFMT_INDEX32 = 102,
104 
105 
106  } D3DFORMAT;
107 
108  // Primitives supported by draw-primitive API
109  typedef enum _D3DPRIMITIVETYPE {
110  D3DPT_POINTLIST = 1,
111  D3DPT_LINELIST = 2,
112  D3DPT_LINESTRIP = 3,
113  D3DPT_TRIANGLELIST = 4,
114  D3DPT_TRIANGLESTRIP = 5,
115  D3DPT_TRIANGLEFAN = 6,
116  D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
117  } D3DPRIMITIVETYPE;
118 
119  typedef enum _D3DTEXTUREADDRESS {
120  D3DTADDRESS_WRAP = 1,
121  D3DTADDRESS_MIRROR = 2,
122  D3DTADDRESS_CLAMP = 3,
123  D3DTADDRESS_BORDER = 4,
124  D3DTADDRESS_MIRRORONCE = 5,
125  D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
126  } D3DTEXTUREADDRESS;
127 
128  typedef enum _D3DTEXTUREFILTERTYPE
129  {
130  D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only)
131  D3DTEXF_POINT = 1, // nearest
132  D3DTEXF_LINEAR = 2, // linear interpolation
133  D3DTEXF_ANISOTROPIC = 3, // anisotropic
134  D3DTEXF_PYRAMIDALQUAD = 6, // 4-sample tent
135  D3DTEXF_GAUSSIANQUAD = 7, // 4-sample gaussian
136  /* -- D3D9Ex only */
137  D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
138  } D3DTEXTUREFILTERTYPE;
139 
140  typedef struct _D3DVIEWPORT9 {
141  DWORD X;
142  DWORD Y; /* Viewport Top left */
143  DWORD Width;
144  DWORD Height; /* Viewport Dimensions */
145  float MinZ; /* Min/max of clip Volume */
146  float MaxZ;
147  } D3DVIEWPORT9;
148 
149  /*
150  * State enumerants for per-stage processing of fixed function pixel processing
151  * Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX.
152  */
153  typedef enum _D3DTEXTURESTAGESTATETYPE
154  {
155  D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */
156  D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */
157  D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */
158  D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */
159  D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */
160  D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */
161  D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */
162  D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */
163  D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */
164  D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */
165  D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */
166  D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */
167  D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */
168  D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */
169  D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */
170  D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */
171  D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */
172  D3DTSS_CONSTANT = 32, /* Per-stage constant D3DTA_CONSTANT */
173 
174 
175  D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
176  } D3DTEXTURESTAGESTATETYPE;
177 
178  typedef enum _D3DCMPFUNC {
179  D3DCMP_NEVER = 1,
180  D3DCMP_LESS = 2,
181  D3DCMP_EQUAL = 3,
182  D3DCMP_LESSEQUAL = 4,
183  D3DCMP_GREATER = 5,
184  D3DCMP_NOTEQUAL = 6,
185  D3DCMP_GREATEREQUAL = 7,
186  D3DCMP_ALWAYS = 8,
187  D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
188  } D3DCMPFUNC;
189 
190  typedef enum _D3DSTENCILOP {
191  D3DSTENCILOP_KEEP = 1,
192  D3DSTENCILOP_ZERO = 2,
193  D3DSTENCILOP_REPLACE = 3,
194  D3DSTENCILOP_INCRSAT = 4,
195  D3DSTENCILOP_DECRSAT = 5,
196  D3DSTENCILOP_INVERT = 6,
197  D3DSTENCILOP_INCR = 7,
198  D3DSTENCILOP_DECR = 8,
199  D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
200  } D3DSTENCILOP;
201 
202  /*
203  * Enumerations for COLOROP and ALPHAOP texture blending operations set in
204  * texture processing stage controls in D3DTSS.
205  */
206  typedef enum _D3DTEXTUREOP
207  {
208  // Control
209  D3DTOP_DISABLE = 1, // disables stage
210  D3DTOP_SELECTARG1 = 2, // the default
211  D3DTOP_SELECTARG2 = 3,
212 
213  // Modulate
214  D3DTOP_MODULATE = 4, // multiply args together
215  D3DTOP_MODULATE2X = 5, // multiply and 1 bit
216  D3DTOP_MODULATE4X = 6, // multiply and 2 bits
217 
218  // Add
219  D3DTOP_ADD = 7, // add arguments together
220  D3DTOP_ADDSIGNED = 8, // add with -0.5 bias
221  D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit
222  D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation
223  D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product
224  // Arg1 + Arg2 - Arg1*Arg2
225  // = Arg1 + (1-Arg1)*Arg2
226 
227  // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
228  D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha
229  D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha
230  D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR
231 
232  // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
233  D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha
234  D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color
235 
236  // Specular mapping
237  D3DTOP_PREMODULATE = 17, // modulate with next texture before use
238  D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB
239  // COLOROP only
240  D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A
241  // COLOROP only
242  D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
243  // COLOROP only
244  D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
245  // COLOROP only
246 
247  // Bump mapping
248  D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation
249  D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel
250 
251  // This can do either diffuse or specular bump mapping with correct input.
252  // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
253  // where each component has been scaled and offset to make it signed.
254  // The result is replicated into all four (including alpha) channels.
255  // This is a valid COLOROP only.
256  D3DTOP_DOTPRODUCT3 = 24,
257 
258  // Triadic ops
259  D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2
260  D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2
261 
262  D3DTOP_FORCE_DWORD = 0x7fffffff,
263  } D3DTEXTUREOP;
264 
265  typedef enum _D3DTRANSFORMSTATETYPE {
266  D3DTS_VIEW = 2,
267  D3DTS_PROJECTION = 3,
268  D3DTS_TEXTURE0 = 16,
269  D3DTS_TEXTURE1 = 17,
270  D3DTS_TEXTURE2 = 18,
271  D3DTS_TEXTURE3 = 19,
272  D3DTS_TEXTURE4 = 20,
273  D3DTS_TEXTURE5 = 21,
274  D3DTS_TEXTURE6 = 22,
275  D3DTS_TEXTURE7 = 23,
276  D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
277  } D3DTRANSFORMSTATETYPE;
278 
279  typedef enum _D3DDECLTYPE
280  {
281  D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.)
282  D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.)
283  D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.)
284  D3DDECLTYPE_FLOAT4 = 3, // 4D float
285  D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range
286  // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A)
287  D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned byte
288  D3DDECLTYPE_SHORT2 = 6, // 2D signed short expanded to (value, value, 0., 1.)
289  D3DDECLTYPE_SHORT4 = 7, // 4D signed short
290 
291  // The following types are valid only with vertex shaders >= 2.0
292 
293 
294  D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0
295  D3DDECLTYPE_SHORT2N = 9, // 2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1)
296  D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0)
297  D3DDECLTYPE_USHORT2N = 11, // 2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1)
298  D3DDECLTYPE_USHORT4N = 12, // 4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0)
299  D3DDECLTYPE_UDEC3 = 13, // 3D unsigned 10 10 10 format expanded to (value, value, value, 1)
300  D3DDECLTYPE_DEC3N = 14, // 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1)
301  D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1)
302  D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values
303  D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused.
304  } D3DDECLTYPE;
305 
306  typedef enum _D3DDECLUSAGE
307  {
308  D3DDECLUSAGE_POSITION = 0,
309  D3DDECLUSAGE_BLENDWEIGHT, // 1
310  D3DDECLUSAGE_BLENDINDICES, // 2
311  D3DDECLUSAGE_NORMAL, // 3
312  D3DDECLUSAGE_PSIZE, // 4
313  D3DDECLUSAGE_TEXCOORD, // 5
314  D3DDECLUSAGE_TANGENT, // 6
315  D3DDECLUSAGE_BINORMAL, // 7
316  D3DDECLUSAGE_TESSFACTOR, // 8
317  D3DDECLUSAGE_POSITIONT, // 9
318  D3DDECLUSAGE_COLOR, // 10
319  D3DDECLUSAGE_FOG, // 11
320  D3DDECLUSAGE_DEPTH, // 12
321  D3DDECLUSAGE_SAMPLE, // 13
322  } D3DDECLUSAGE;
323 
324  typedef enum _D3DBLEND {
325  D3DBLEND_ZERO = 1,
326  D3DBLEND_ONE = 2,
327  D3DBLEND_SRCCOLOR = 3,
328  D3DBLEND_INVSRCCOLOR = 4,
329  D3DBLEND_SRCALPHA = 5,
330  D3DBLEND_INVSRCALPHA = 6,
331  D3DBLEND_DESTALPHA = 7,
332  D3DBLEND_INVDESTALPHA = 8,
333  D3DBLEND_DESTCOLOR = 9,
334  D3DBLEND_INVDESTCOLOR = 10,
335  D3DBLEND_SRCALPHASAT = 11,
336  D3DBLEND_BOTHSRCALPHA = 12,
337  D3DBLEND_BOTHINVSRCALPHA = 13,
338  D3DBLEND_BLENDFACTOR = 14, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */
339  D3DBLEND_INVBLENDFACTOR = 15, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */
340  /* -- D3D9Ex only */
341  D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
342  } D3DBLEND;
343 
344  struct VertexElement;
345 
346  // This is used to initialize the last vertex element in a vertex declaration
347  // array
348  //
349 #define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0}
350 
351 #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256)
352 #define D3DTS_WORLD D3DTS_WORLDMATRIX(0)
353 #define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1)
354 #define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2)
355 #define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3)
356 
357  typedef enum _D3DRENDERSTATETYPE {
358  D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */
359  D3DRS_FILLMODE = 8, /* D3DFILLMODE */
360  D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */
361  D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */
362  D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */
363  D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */
364  D3DRS_SRCBLEND = 19, /* D3DBLEND */
365  D3DRS_DESTBLEND = 20, /* D3DBLEND */
366  D3DRS_CULLMODE = 22, /* D3DCULL */
367  D3DRS_ZFUNC = 23, /* D3DCMPFUNC */
368  D3DRS_ALPHAREF = 24, /* D3DFIXED */
369  D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */
370  D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */
371  D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */
372  D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */
373  D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */
374  D3DRS_FOGCOLOR = 34, /* D3DCOLOR */
375  D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */
376  D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */
377  D3DRS_FOGEND = 37, /* Fog end */
378  D3DRS_FOGDENSITY = 38, /* Fog density */
379  D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */
380  D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */
381  D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */
382  D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */
383  D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */
384  D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */
385  D3DRS_STENCILREF = 57, /* Reference value used in stencil test */
386  D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */
387  D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */
388  D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */
389  D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */
390  D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */
391  D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */
392  D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */
393  D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */
394  D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */
395  D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */
396  D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */
397  D3DRS_CLIPPING = 136,
398  D3DRS_LIGHTING = 137,
399  D3DRS_AMBIENT = 139,
400  D3DRS_FOGVERTEXMODE = 140,
401  D3DRS_COLORVERTEX = 141,
402  D3DRS_LOCALVIEWER = 142,
403  D3DRS_NORMALIZENORMALS = 143,
404  D3DRS_DIFFUSEMATERIALSOURCE = 145,
405  D3DRS_SPECULARMATERIALSOURCE = 146,
406  D3DRS_AMBIENTMATERIALSOURCE = 147,
407  D3DRS_EMISSIVEMATERIALSOURCE = 148,
408  D3DRS_VERTEXBLEND = 151,
409  D3DRS_CLIPPLANEENABLE = 152,
410  D3DRS_POINTSIZE = 154, /* float point size */
411  D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */
412  D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */
413  D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */
414  D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */
415  D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */
416  D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */
417  D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer
418  D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable
419  D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation
420  D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor
421  D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */
422  D3DRS_INDEXEDVERTEXBLENDENABLE = 167,
423  D3DRS_COLORWRITEENABLE = 168, // per-channel write enable
424  D3DRS_TWEENFACTOR = 170, // float tween factor
425  D3DRS_BLENDOP = 171, // D3DBLENDOP setting
426  D3DRS_POSITIONDEGREE = 172, // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default)
427  D3DRS_NORMALDEGREE = 173, // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC
428  D3DRS_SCISSORTESTENABLE = 174,
429  D3DRS_SLOPESCALEDEPTHBIAS = 175,
430  D3DRS_ANTIALIASEDLINEENABLE = 176,
431  D3DRS_MINTESSELLATIONLEVEL = 178,
432  D3DRS_MAXTESSELLATIONLEVEL = 179,
433  D3DRS_ADAPTIVETESS_X = 180,
434  D3DRS_ADAPTIVETESS_Y = 181,
435  D3DRS_ADAPTIVETESS_Z = 182,
436  D3DRS_ADAPTIVETESS_W = 183,
437  D3DRS_ENABLEADAPTIVETESSELLATION = 184,
438  D3DRS_TWOSIDEDSTENCILMODE = 185, /* BOOL enable/disable 2 sided stenciling */
439  D3DRS_CCW_STENCILFAIL = 186, /* D3DSTENCILOP to do if ccw stencil test fails */
440  D3DRS_CCW_STENCILZFAIL = 187, /* D3DSTENCILOP to do if ccw stencil test passes and Z test fails */
441  D3DRS_CCW_STENCILPASS = 188, /* D3DSTENCILOP to do if both ccw stencil and Z tests pass */
442  D3DRS_CCW_STENCILFUNC = 189, /* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */
443  D3DRS_COLORWRITEENABLE1 = 190, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */
444  D3DRS_COLORWRITEENABLE2 = 191, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */
445  D3DRS_COLORWRITEENABLE3 = 192, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */
446  D3DRS_BLENDFACTOR = 193, /* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR */
447  D3DRS_SRGBWRITEENABLE = 194, /* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) */
448  D3DRS_DEPTHBIAS = 195,
449  D3DRS_WRAP8 = 198, /* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD */
450  D3DRS_WRAP9 = 199,
451  D3DRS_WRAP10 = 200,
452  D3DRS_WRAP11 = 201,
453  D3DRS_WRAP12 = 202,
454  D3DRS_WRAP13 = 203,
455  D3DRS_WRAP14 = 204,
456  D3DRS_WRAP15 = 205,
457  D3DRS_SEPARATEALPHABLENDENABLE = 206, /* TRUE to enable a separate blending function for the alpha channel */
458  D3DRS_SRCBLENDALPHA = 207, /* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */
459  D3DRS_DESTBLENDALPHA = 208, /* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */
460  D3DRS_BLENDOPALPHA = 209, /* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */
461 
462 
463  D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
464  } D3DRENDERSTATETYPE;
465 
466  /*
467  * State enumerants for per-sampler texture processing.
468  */
469  typedef enum _D3DSAMPLERSTATETYPE
470  {
471  D3DSAMP_ADDRESSU = 1, /* D3DTEXTUREADDRESS for U coordinate */
472  D3DSAMP_ADDRESSV = 2, /* D3DTEXTUREADDRESS for V coordinate */
473  D3DSAMP_ADDRESSW = 3, /* D3DTEXTUREADDRESS for W coordinate */
474  D3DSAMP_BORDERCOLOR = 4, /* D3DCOLOR */
475  D3DSAMP_MAGFILTER = 5, /* D3DTEXTUREFILTER filter to use for magnification */
476  D3DSAMP_MINFILTER = 6, /* D3DTEXTUREFILTER filter to use for minification */
477  D3DSAMP_MIPFILTER = 7, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */
478  D3DSAMP_MIPMAPLODBIAS = 8, /* float Mipmap LOD bias */
479  D3DSAMP_MAXMIPLEVEL = 9, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */
480  D3DSAMP_MAXANISOTROPY = 10, /* DWORD maximum anisotropy */
481  D3DSAMP_SRGBTEXTURE = 11, /* Default = 0 (which means Gamma 1.0,
482  no correction required.) else correct for
483  Gamma = 2.2 */
484  D3DSAMP_ELEMENTINDEX = 12, /* When multi-element texture is assigned to sampler, this
485  indicates which element index to use. Default = 0. */
486  D3DSAMP_DMAPOFFSET = 13, /* Offset in vertices in the pre-sampled displacement map.
487  Only valid for D3DDMAPSAMPLER sampler */
488  D3DSAMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
489  } D3DSAMPLERSTATETYPE;
490 
491  typedef enum _D3DDECLMETHOD
492  {
493  D3DDECLMETHOD_DEFAULT = 0,
494  D3DDECLMETHOD_PARTIALU,
495  D3DDECLMETHOD_PARTIALV,
496  D3DDECLMETHOD_CROSSUV, // Normal
497  D3DDECLMETHOD_UV,
498  D3DDECLMETHOD_LOOKUP, // Lookup a displacement map
499  D3DDECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map
500  } D3DDECLMETHOD;
501 
502  /* Pool types */
503  typedef enum _D3DPOOL {
504  D3DPOOL_DEFAULT = 0,
505  D3DPOOL_MANAGED = 1,
506  D3DPOOL_SYSTEMMEM = 2,
507  D3DPOOL_SCRATCH = 3,
508  D3DPOOL_FORCE_DWORD = 0x7fffffff
509  } D3DPOOL;
510 }
511 
512 #include "VirtualKeyDef.h"
513 
514 // Flexible vertex format bits
515 //
516 #define D3DFVF_RESERVED0 0x001
517 #define D3DFVF_POSITION_MASK 0x400E
518 #define D3DFVF_XYZ 0x002
519 #define D3DFVF_XYZRHW 0x004
520 #define D3DFVF_XYZB1 0x006
521 #define D3DFVF_XYZB2 0x008
522 #define D3DFVF_XYZB3 0x00a
523 #define D3DFVF_XYZB4 0x00c
524 #define D3DFVF_XYZB5 0x00e
525 #define D3DFVF_XYZW 0x4002
526 
527 #define D3DFVF_NORMAL 0x010
528 #define D3DFVF_PSIZE 0x020
529 #define D3DFVF_DIFFUSE 0x040
530 #define D3DFVF_SPECULAR 0x080
531 
532 #define D3DFVF_TEXCOUNT_MASK 0xf00
533 #define D3DFVF_TEXCOUNT_SHIFT 8
534 #define D3DFVF_TEX0 0x000
535 #define D3DFVF_TEX1 0x100
536 #define D3DFVF_TEX2 0x200
537 #define D3DFVF_TEX3 0x300
538 #define D3DFVF_TEX4 0x400
539 #define D3DFVF_TEX5 0x500
540 #define D3DFVF_TEX6 0x600
541 #define D3DFVF_TEX7 0x700
542 #define D3DFVF_TEX8 0x800
543 
544 /* Usages for Vertex/Index buffers */
545 #define D3DUSAGE_WRITEONLY (0x00000008L)
546 #define D3DUSAGE_SOFTWAREPROCESSING (0x00000010L)
547 #define D3DUSAGE_DONOTCLIP (0x00000020L)
548 #define D3DUSAGE_POINTS (0x00000040L)
549 #define D3DUSAGE_RTPATCHES (0x00000080L)
550 #define D3DUSAGE_NPATCHES (0x00000100L)
551 
552 #define D3DUSAGE_RENDERTARGET (0x00000001L)
553 #define D3DUSAGE_DEPTHSTENCIL (0x00000002L)
554 #define D3DUSAGE_DYNAMIC (0x00000200L)
555 
556 #define D3DX_DEFAULT ((UINT) -1)
557 
558 /*
559 * Options for clearing
560 */
561 #define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */
562 #define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */
563 #define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */
564 
565 #define D3DTA_SELECTMASK 0x0000000f // mask for arg selector
566 #define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only)
567 #define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write)
568 #define D3DTA_TEXTURE 0x00000002 // select texture color (read only)
569 
570 
571 #define D3DXSPRITE_DONOTSAVESTATE (1 << 0)
572 #define D3DXSPRITE_DONOTMODIFY_RENDERSTATE (1 << 1)
573 #define D3DXSPRITE_OBJECTSPACE (1 << 2)
574 #define D3DXSPRITE_BILLBOARD (1 << 3)
575 #define D3DXSPRITE_ALPHABLEND (1 << 4)
576 #define D3DXSPRITE_SORT_TEXTURE (1 << 5)
577 #define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK (1 << 6)
578 #define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT (1 << 7)
579 #define D3DXSPRITE_DO_NOT_ADDREF_TEXTURE (1 << 8)
580 
581 #define D3DLOCK_READONLY 0x00000010L
582 #define D3DLOCK_DISCARD 0x00002000L
583 #define D3DLOCK_NOOVERWRITE 0x00001000L
584 #define D3DLOCK_NOSYSLOCK 0x00000800L
585 #define D3DLOCK_DONOTWAIT 0x00004000L
586 #define D3DLOCK_NO_DIRTY_UPDATE 0x00008000L
587 
588 #define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L
589 
590 #if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
591 #define PE_CHECK_GL_ERROR_DEBUG()
592 #else
593 #define PE_CHECK_GL_ERROR_DEBUG() RenderDevice::CheckRenderError(__FILE__, __FUNCTION__, __LINE__);
594 #endif
Definition: RenderCoreOpenGL.h:38
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: RenderCoreOpenGL.h:140
Definition: VertexDeclarationOpenGL.h:5
Definition: RenderCoreOpenGL.h:11
Definition: RenderCoreOpenGL.h:19