home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 2002 December / JOY143_CD1.iso / Data / Demos / Platoon / pl_demo.exe / Shaders / MaterialDefine.def
Text File  |  2002-09-17  |  14KB  |  366 lines

  1. #define MATERIALDEFINE_VERSION      0.1
  2.  
  3. #define FALSE      0
  4. #define TRUE     1
  5.  
  6. #define DETAIL_LOW
  7. #define DETAIL_MEDIUM
  8. #define DETAIL_HIGH
  9.  
  10. #define RE_BEFORE  0
  11. #define RE_NORMAL  1
  12. #define RE_TRANSPARENT 2
  13. #define RE_AFTER  3
  14.  
  15. #define TEXT_AMBIENT          0
  16. #define TEXT_DIFFUSE          1
  17. #define TEXT_SPECULAR         2
  18. #define TEXT_SPECULARLEVEL     3
  19. #define TEXT_GLOSSINESS     4
  20. #define TEXT_SELFILLUM        5
  21. #define TEXT_OPACITY        6
  22. #define TEXT_FILTERCOLOR     6
  23. #define TEXT_BUMP        8
  24. #define TEXT_REFLECTION     9
  25. #define TEXT_REFRACTION     10
  26.  
  27. ;        ID_AM = 0,   // ambient
  28. ;        ID_DI = 1,   // diffuse
  29. ;        ID_SP = 2,   // specular
  30. ;        ID_SH = 3,   // shininesNs
  31. ;        ID_SS = 4,   // shininess strength
  32. ;        ID_SI = 5,   // self-illumination
  33. ;        ID_OP = 6,   // opacity
  34. ;        ID_FI = 7,   // filter color
  35. ;        ID_BU = 8,   // bump 
  36. ;        ID_RL = 9,   // reflection
  37. ;        ID_RR = 10,  // refraction 
  38. ;        ID_DP = 11,  // displacement 
  39.  
  40.  
  41. #define ASORT_NONE          0
  42. #define ASORT_LOCALTRISET     1
  43. #define ASORT_GLOBALTRISET      2
  44.  
  45.  
  46. #define FILL_POINT                1
  47. #define FILL_WIREFRAME            2
  48. #define FILL_SOLID                3
  49.  
  50.  
  51. #define BLEND_ZERO                1
  52. #define BLEND_ONE                 2
  53. #define BLEND_SRCCOLOR            3
  54. #define BLEND_INVSRCCOLOR         4
  55. #define BLEND_SRCALPHA            5
  56. #define BLEND_INVSRCALPHA         6
  57. #define BLEND_DESTALPHA           7
  58. #define BLEND_INVDESTALPHA        8
  59. #define BLEND_DESTCOLOR           9
  60. #define BLEND_INVDESTCOLOR        10
  61. #define BLEND_SRCALPHASAT         11
  62. #define BLEND_BOTHSRCALPHA        12
  63. #define BLEND_BOTHINVSRCALPHA     13
  64.  
  65.  
  66. #define BLENDOP_ADD               1
  67. #define BLENDOP_SUBTRACT          2
  68. #define BLENDOP_REVSUBTRACT       3
  69. #define BLENDOP_MIN               4
  70. #define BLENDOP_MAX               5
  71.  
  72.  
  73. #define TADDRESS_WRAP             1
  74. #define TADDRESS_MIRROR           2
  75. #define TADDRESS_CLAMP            3
  76. #define TADDRESS_BORDER           4
  77. #define TADDRESS_MIRRORONCE       5
  78.  
  79.  
  80. #define CULL_NONE                 1
  81. #define CULL_CW                   2
  82. #define CULL_CCW                  3
  83.  
  84. #define SHADE_FLAT        1
  85. #define SHADE_GOURAUD        2
  86. #define SHADE_PHONG        3
  87.  
  88. #define CMP_NEVER                 1
  89. #define CMP_LESS                  2
  90. #define CMP_EQUAL                 3
  91. #define CMP_LESSEQUAL             4
  92. #define CMP_GREATER               5
  93. #define CMP_NOTEQUAL              6
  94. #define CMP_GREATEREQUAL          7
  95. #define CMP_ALWAYS                8
  96.  
  97.  
  98. #define STENCILOP_KEEP            1
  99. #define STENCILOP_ZERO            2
  100. #define STENCILOP_REPLACE         3
  101. #define STENCILOP_INCRSAT         4
  102. #define STENCILOP_DECRSAT         5
  103. #define STENCILOP_INVERT          6
  104. #define STENCILOP_INCR            7
  105. #define STENCILOP_DECR            8
  106.  
  107.  
  108. #define ZB_FALSE                  0
  109. #define ZB_TRUE                   1 ; Z buffering
  110. #define ZB_USEW                   2 ; W buffering
  111.  
  112.  
  113. #define TS_VIEW           2
  114. #define TS_PROJECTION     3
  115. #define TS_TEXTURE0       16
  116. #define TS_TEXTURE1       17
  117. #define TS_TEXTURE2       18
  118. #define TS_TEXTURE3       19
  119. #define TS_TEXTURE4       20
  120. #define TS_TEXTURE5       21
  121. #define TS_TEXTURE6       22
  122. #define TS_TEXTURE7       23
  123.  
  124.  
  125. #define MCS_MATERIAL  0 ; Color from material is used
  126. #define MCS_COLOR1    1 ; Diffuse vertex color is used
  127. #define MCS_DIFFUSE   1
  128. #define MCS_COLOR2    2 ; Specular vertex color is used
  129. #define MCS_SPECULAR  2 
  130.  
  131.  
  132. #define COLORWRITEENABLE_RED      1
  133. #define COLORWRITEENABLE_GREEN    2
  134. #define COLORWRITEENABLE_BLUE     4
  135. #define COLORWRITEENABLE_ALPHA    8
  136. #define COLORWRITEENABLE_ALL      15
  137.  
  138.  
  139. #define TSS_COLOROP          1 ; D3DTEXTUREOP - per-stage blending controls for color channels 
  140. #define TSS_COLORARG1        2 ; D3DTA_* (texture arg) 
  141. #define TSS_COLORARG2        3 ; D3DTA_* (texture arg) 
  142. #define TSS_ALPHAOP          4 ; D3DTEXTUREOP - per-stage blending controls for alpha channel 
  143. #define TSS_ALPHAARG1        5 ; D3DTA_* (texture arg) 
  144. #define TSS_ALPHAARG2        6 ; D3DTA_* (texture arg) 
  145. #define TSS_BUMPENVMAT00     7 ; float (bump mapping matrix) 
  146. #define TSS_BUMPENVMAT01     8 ; float (bump mapping matrix) 
  147. #define TSS_BUMPENVMAT10     9 ; float (bump mapping matrix) 
  148. #define TSS_BUMPENVMAT11    10 ; float (bump mapping matrix) 
  149. #define TSS_TEXCOORDINDEX   11 ; identifies which set of texture coordinates index this texture 
  150. #define TSS_ADDRESSU        13 ; D3DTEXTUREADDRESS for U coordinate 
  151. #define TSS_ADDRESSV        14 ; D3DTEXTUREADDRESS for V coordinate 
  152. #define TSS_BORDERCOLOR     15 ; D3DCOLOR 
  153. #define TSS_MAGFILTER       16 ; D3DTEXTUREFILTER filter to use for magnification 
  154. #define TSS_MINFILTER       17 ; D3DTEXTUREFILTER filter to use for minification 
  155. #define TSS_MIPFILTER       18 ; D3DTEXTUREFILTER filter to use between mipmaps during minification 
  156. #define TSS_MIPMAPLODBIAS   19 ; float Mipmap LOD bias 
  157. #define TSS_MAXMIPLEVEL     20 ; DWORD 0..(n-1) LOD index of largest map to use (0  largest) 
  158. #define TSS_MAXANISOTROPY   21 ; DWORD maximum anisotropy 
  159. #define TSS_BUMPENVLSCALE   22 ; float scale for bump map luminance 
  160. #define TSS_BUMPENVLOFFSET  23 ; float offset for bump map luminance 
  161. #define TSS_TEXTURETRANSFORMFLAGS  24 ; D3DTEXTURETRANSFORMFLAGS controls texture transform
  162. #define TSS_ADDRESSW        25 ; D3DTEXTUREADDRESS for W coordinate
  163. #define TSS_COLORARG0       26 ; D3DTA_* third arg for triadic ops
  164. #define TSS_ALPHAARG0       27 ; D3DTA_* third arg for triadic ops
  165. #define TSS_RESULTARG       28 ; D3DTA_* arg for result (CURRENT or TEMP)
  166.  
  167.  
  168.     ; Control
  169. #define TOP_DISABLE              1 ; disables stage
  170. #define TOP_SELECTARG1           2 ; the default
  171. #define TOP_SELECTARG2           3
  172.  
  173.     ; Modulate
  174. #define TOP_MODULATE             4 ; multiply args together
  175. #define TOP_MODULATE2X           5 ; multiply and  1 bit
  176. #define TOP_MODULATE4X           6 ; multiply and  2 bits
  177.  
  178.     ; Add
  179. #define TOP_ADD                   7 ; add arguments together
  180. #define TOP_ADDSIGNED             8 ; add with -0.5 bias
  181. #define TOP_ADDSIGNED2X           9 ; as above but left  1 bit
  182. #define TOP_SUBTRACT             10 ; Arg1 - Arg2, with no saturation
  183. #define TOP_ADDSMOOTH            11 ; add 2 args, subtract product
  184.                                      ; Arg1 + Arg2 - Arg1*Arg2
  185.                                      ;  Arg1 + (1-Arg1)*Arg2
  186.  
  187.     ; Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
  188. #define TOP_BLENDDIFFUSEALPHA    12 ; iterated alpha
  189. #define TOP_BLENDTEXTUREALPHA    13 ; texture alpha
  190. #define TOP_BLENDFACTORALPHA     14 ; alpha from D3DRENDERSTATE_TEXTUREFACTOR
  191.  
  192.     ; Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
  193. #define TOP_BLENDTEXTUREALPHAPM  15 ; texture alpha
  194. #define TOP_BLENDCURRENTALPHA    16 ; by alpha of current color
  195.  
  196.     ; Specular mapping
  197. #define TOP_PREMODULATE             17 ; modulate with next texture before use
  198. #define TOP_MODULATEALPHA_ADDCOLOR  18 ; Arg1.RGB + Arg1.A*Arg2.RGB
  199.                                         ; COLOROP only
  200. #define TOP_MODULATECOLOR_ADDALPHA  19 ; Arg1.RGB*Arg2.RGB + Arg1.A
  201.                                         ; COLOROP only
  202. #define TOP_MODULATEINVALPHA_ADDCOLOR  20 ; (1-Arg1.A)*Arg2.RGB + Arg1.RGB
  203.                                            ; COLOROP only
  204. #define TOP_MODULATEINVCOLOR_ADDALPHA  21 ;  (1-Arg1.RGB)*Arg2.RGB + Arg1.A
  205.                                            ; COLOROP only
  206.     ; Bump mapping
  207. #define TOP_BUMPENVMAP           22 ; per pixel env map perturbation
  208. #define TOP_BUMPENVMAPLUMINANCE  23 ; with luminance channel
  209.  
  210.     ; This can do either diffuse or specular bump mapping with correct input.
  211.     ; Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
  212.     ; where each component has been scaled and offset to make it signed.
  213.     ; The result is replicated into all four (including alpha) channels.
  214.     ; This is a valid COLOROP only.
  215. #define TOP_DOTPRODUCT3          24
  216. #define TOP_MULTIPLYADD          25 ; Arg0 + Arg1*Arg2
  217. #define TOP_LERP                 26 ; (Arg0)*Arg1 + (1-Arg0)*Arg2
  218.  
  219.  
  220. #define TA_SELECTMASK        15 ; mask for arg selector
  221. #define TA_DIFFUSE           0 ; select diffuse color (read only)
  222. #define TA_CURRENT           1 ; select stage destination register (read/write)
  223. #define TA_TEXTURE           2 ; select texture color (read only)
  224. #define TA_TFACTOR           3 ; select RENDERSTATE_TEXTUREFACTOR (read only)
  225. #define TA_SPECULAR          4 ; select specular color (read only)
  226. #define TA_TEMP              5 ; select temporary register color (read/write)
  227. #define TA_COMPLEMENT        16 ; take 1.0 - x (read modifier)
  228. #define TA_ALPHAREPLICATE    32 ; replicate alpha to color components (read modifier)
  229.  
  230. #define TA_INVDIFFUSE        16
  231. #define TA_INVCURRENT        17
  232. #define TA_INVTEXTURE        18
  233. #define TA_INVTFACTOR        19
  234. #define TA_INVSPECULAR       20
  235. #define TA_INVTEMP             21    
  236.  
  237. #define TA_DIFFUSEALPHA         32
  238. #define TA_CURRENTALPHA      33
  239. #define TA_TEXTUREALPHA      34
  240. #define TA_TFACTORALPHA      35
  241. #define TA_SPECULARALPHA     36
  242. #define TA_TEMPALPHA         47    
  243.  
  244. #define TA_INVDIFFUSEALPHA   48
  245. #define TA_INVCURRENTALPHA   49
  246. #define TA_INVTEXTUREALPHA   50
  247. #define TA_INVTFACTORALPHA   51
  248. #define TA_INVSPECULARALPHA  52
  249. #define TA_INVTEMPALPHA      53    
  250.  
  251.  
  252. #define TEXF_NONE            0 ; filtering disabled (valid for mip filter only)
  253. #define TEXF_POINT           1 ; nearest
  254. #define TEXF_LINEAR          2 ; linear interpolation
  255. #define TEXF_ANISOTROPIC     3 ; anisotropic
  256. #define TEXF_FLATCUBIC       4 ; cubic
  257. #define TEXF_GAUSSIANCUBIC   5 ; different cubic kernel
  258.  
  259. #define    TF_POINT         0
  260. #define TF_POINT_MIP_POINT     1
  261. #define TF_POINT_MIP_LINEAR     2
  262. #define TF_LINEAR         3
  263. #define TF_LINEAR_MIP_POINT     4
  264. #define TF_LINEAR_MIP_LINEAR     5
  265. #define TF_ANISOTROPIC         6
  266. #define TF_FLATCUBIC         7
  267. #define TF_GAUSSIANCUBIC    8
  268. #define TF_UNUSED        9
  269.  
  270.  
  271. #define PV_DONOTCOPYDATA     1
  272.  
  273.  
  274. #define SP_WRITEMASK_0       0x00010000  ; Component 0 (X;Red)
  275. #define SP_WRITEMASK_1       0x00020000  ; Component 1 (Y;Green)
  276. #define SP_WRITEMASK_2       0x00040000  ; Component 2 (Z;Blue)
  277. #define SP_WRITEMASK_3       0x00080000  ; Component 3 (W;Alpha)
  278. #define SP_WRITEMASK_ALL     0x000F0000
  279.  
  280.  
  281. #define VBF_DISABLE   0     Disable vertex blending
  282. #define VBF_1WEIGHTS  1     2 matrix blending
  283. #define VBF_2WEIGHTS  2     3 matrix blending
  284. #define VBF_3WEIGHTS  3     4 matrix blending
  285. #define VBF_TWEENING  255   blending using D3DRS_TWEENFACTOR
  286. #define VBF_0WEIGHTS  256   one matrix is used with weight 1.0
  287.  
  288.  
  289. #define TTFF_DISABLE          0    ; texture coordinates are passed directly
  290. #define TTFF_COUNT1           1    ; rasterizer should expect 1-D texture coords
  291. #define TTFF_COUNT2           2    ; rasterizer should expect 2-D texture coords
  292. #define TTFF_COUNT3           3    ; rasterizer should expect 3-D texture coords
  293. #define TTFF_COUNT4           4    ; rasterizer should expect 4-D texture coords
  294. #define TTFF_PROJECTED1       257    ; texcoords to be divided by COUNTth element
  295. #define TTFF_PROJECTED2       258    ; texcoords to be divided by COUNTth element
  296. #define TTFF_PROJECTED3       259    ; texcoords to be divided by COUNTth element
  297. #define TTFF_PROJECTED4       260    ; texcoords to be divided by COUNTth element
  298.  
  299.  
  300. #define CUBEMAP_FACE_POSITIVE_X     0
  301. #define CUBEMAP_FACE_NEGATIVE_X  1
  302. #define CUBEMAP_FACE_POSITIVE_Y  2
  303. #define CUBEMAP_FACE_NEGATIVE_Y  3
  304. #define CUBEMAP_FACE_POSITIVE_Z  4 
  305. #define CUBEMAP_FACE_NEGATIVE_Z  5
  306.  
  307. #define ASORT_FALSE     0
  308. #define ASORT_TRUE     1
  309. #define ASORT_PRIORITY  2
  310.  
  311. #define TSS_TCI_PASSTHRU0             0    ;0
  312. #define TSS_TCI_PASSTHRU1             1    ;0
  313. #define TSS_TCI_PASSTHRU2             2    ;0
  314. #define TSS_TCI_PASSTHRU3             3    ;0
  315. #define TSS_TCI_CAMERASPACENORMAL         65536    ;65536
  316. #define TSS_TCI_CAMERASPACEPOSITION         131072    ;131072
  317. #define TSS_TCI_CAMERASPACEREFLECTIONVECTOR     196608    ;196608
  318.  
  319. #define TTM_NONE        0
  320. #define TTM_SPHERICALENVMAP 1
  321. #define TTM_CUBEENVMAP      2
  322. #define TTM_UVTRANSFORM        3
  323.  
  324. #define DPBM_FIRSTSUNLIGHT    0
  325. #define DPBM_SUNLIGHT        1
  326. #define DPBM_NEARESTLIGHT    2
  327. #define DPBM_ALLIGHT        3
  328.  
  329. ;VertexShader declarator
  330.  
  331. #define VSD_TOKEN_NOP        0 ;NOP or extension
  332. #define VSD_TOKEN_STREAM    1 ;stream selector
  333. #define VSD_TOKEN_STREAMDATA    2 ;stream data definition (map to vertex input memory)
  334. #define VSD_TOKEN_TESSELLATOR    3 ;vertex input memory from tessellator
  335. #define VSD_TOKEN_CONSTMEM    4 ;constant memory from shader
  336. #define VSD_TOKEN_EXT        5 ;extension
  337. #define VSD_TOKEN_END         7 ;
  338.  
  339.  
  340. #define VSDT_FLOAT1    0 ;1D float expanded to (value,0.,0.,1.)
  341. #define VSDT_FLOAT2     1 ;2D float expanded to (value,value,0.,1.)
  342. #define VSDT_FLOAT3     2 ;3D float expanded to (value,value,value,1.)
  343. #define VSDT_FLOAT4     3 ;4D float
  344. #define VSDT_D3DCOLOR   4 ;4D packed unsigned bytes mapped to 0. to 1. range
  345. #define VSDT_UBYTE4     5 ;4D unsigned byte
  346. #define VSDT_SHORT2     6 ;2D signed short expanded to (value,value,0.,1.)
  347. #define VSDT_SHORT4     7 ;4D signed short
  348.  
  349. #define VSDE_POSITION         0
  350. #define VSDE_BLENDWEIGHT     1
  351. #define VSDE_BLENDINDICES     2
  352. #define VSDE_NORMAL         3
  353. #define VSDE_PSIZE         4
  354. #define VSDE_DIFFUSE         5
  355. #define VSDE_SPECULAR         6
  356. #define VSDE_TEXCOORD0         7
  357. #define VSDE_TEXCOORD1         8
  358. #define VSDE_TEXCOORD2         9
  359. #define VSDE_TEXCOORD3         10
  360. #define VSDE_TEXCOORD4         11
  361. #define VSDE_TEXCOORD5         12
  362. #define VSDE_TEXCOORD6         13
  363. #define VSDE_TEXCOORD7         14
  364. #define VSDE_POSITION2         15
  365. #define VSDE_NORMAL2         16
  366.