[2236] | 1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | //
|
---|
| 3 | // ## ######
|
---|
| 4 | // ###### ###
|
---|
| 5 | // ## ############### Shark 3D Engine (www.shark3d.com)
|
---|
| 6 | // ########## # # #
|
---|
| 7 | // ######## Copyright (c) 1996-2006 Spinor GmbH.
|
---|
| 8 | // ######### # # # All rights reserved.
|
---|
| 9 | // ## ##########
|
---|
| 10 | // ##
|
---|
| 11 | //
|
---|
| 12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 13 |
|
---|
| 14 | // Shader program configuration.
|
---|
| 15 | // Different drivers access different parameters.
|
---|
| 16 |
|
---|
| 17 | // Opengl Highlevel Shaderlanguage
|
---|
| 18 | ogl
|
---|
| 19 | {
|
---|
| 20 | samp_depth_test_array "" "" ""
|
---|
| 21 |
|
---|
| 22 | glsl
|
---|
| 23 | {
|
---|
| 24 | vertshader
|
---|
| 25 | {
|
---|
| 26 | code_variant_array
|
---|
| 27 | {
|
---|
| 28 | req_ver "1x0"
|
---|
| 29 | code_array "levelutil/shader/prog/ogl_glsl/"
|
---|
| 30 | & "bump_ogl_glsl_vs1x0.s3d_shadercode_run"
|
---|
| 31 | }
|
---|
| 32 | tracking
|
---|
| 33 | {
|
---|
| 34 | // uniform mat4 matBone[4];
|
---|
| 35 | cnt 4
|
---|
| 36 | codevar "matBone[$]"
|
---|
| 37 | chan "bone"
|
---|
| 38 | trans "identity"
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | // attribute vec4 bone_wgh;
|
---|
| 42 | bone_wgh "boneWgh"
|
---|
| 43 | //bone_subscr "boneSubscr"
|
---|
| 44 |
|
---|
| 45 | predefine_array
|
---|
| 46 | {
|
---|
| 47 | name "S3D_USE_BONEWGH"
|
---|
| 48 | }
|
---|
| 49 | {
|
---|
| 50 | name "S3D_PARALLAX_MAPPING"
|
---|
| 51 | }
|
---|
| 52 | {
|
---|
| 53 | name "S3D_LIGHT_PROJ"
|
---|
| 54 | }
|
---|
| 55 | {
|
---|
| 56 | name "S3D_LIGHT_SHMAP"
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | fragshader
|
---|
| 61 | {
|
---|
| 62 | code_variant_array
|
---|
| 63 | {
|
---|
| 64 | req_ver "1x0"
|
---|
| 65 | code_array "levelutil/shader/prog/ogl_glsl/"
|
---|
| 66 | & "bump_ogl_glsl_fs1x0.s3d_shadercode_run"
|
---|
| 67 | }
|
---|
| 68 | predefine_array
|
---|
| 69 | {
|
---|
| 70 | name "S3D_SPECULAR_EXP"
|
---|
| 71 | val "4.0"
|
---|
| 72 | }
|
---|
| 73 | {
|
---|
| 74 | name "S3D_GEOMETRIC_SHADOW"
|
---|
| 75 | }
|
---|
| 76 | {
|
---|
| 77 | name "S3D_PARALLAX_MAPPING"
|
---|
| 78 | }
|
---|
| 79 | {
|
---|
| 80 | name "S3D_PARALLAX_SCALE"
|
---|
| 81 | val "0.07"
|
---|
| 82 | }
|
---|
| 83 | {
|
---|
| 84 | name "S3D_PARALLAX_BIAS"
|
---|
| 85 | val "0.50196078431372549" // = 128/255
|
---|
| 86 | }
|
---|
| 87 | {
|
---|
| 88 | name "S3D_LIGHT_PROJ"
|
---|
| 89 | }
|
---|
| 90 | {
|
---|
| 91 | name "S3D_SHMAP_FILTER16"
|
---|
| 92 | }
|
---|
| 93 | {
|
---|
| 94 | name "S3D_LIGHT_SHMAP"
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | param_array
|
---|
| 99 | {
|
---|
| 100 | src_progvar "prog_light_cenrange"
|
---|
| 101 | dest_codevar "lightCenRange"
|
---|
| 102 | type "float4"
|
---|
| 103 | }
|
---|
| 104 | {
|
---|
| 105 | src_progvar "prog_light_ambient"
|
---|
| 106 | dest_codevar "lightAmbient"
|
---|
| 107 | type "float4"
|
---|
| 108 | }
|
---|
| 109 | {
|
---|
| 110 | src_progvar "prog_light_diffuse"
|
---|
| 111 | dest_codevar "lightDiffuse"
|
---|
| 112 | type "float4"
|
---|
| 113 | }
|
---|
| 114 | {
|
---|
| 115 | src_progvar "prog_light_specular"
|
---|
| 116 | dest_codevar "lightSpecular"
|
---|
| 117 | type "float4"
|
---|
| 118 | }
|
---|
| 119 | {
|
---|
| 120 | src_progvar "prog_light_projmat"
|
---|
| 121 | dest_codevar "lightProjMat"
|
---|
| 122 | type "float4x4"
|
---|
| 123 | }
|
---|
| 124 | {
|
---|
| 125 | src_progvar "prog_light_shmapmat"
|
---|
| 126 | dest_codevar "lightShmapMat"
|
---|
| 127 | type "float4x4"
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | sampler_array "tex0" "normalSamp" "lightProjSamp" "lightShmapSamp"
|
---|
| 131 |
|
---|
| 132 | tex_size_codevar_array "" "" "lightShmapSize"
|
---|
| 133 | tex_rcpsize_codevar_array "" "" "lightShmapRcpSize"
|
---|
| 134 | }
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | // D3D9 Highlevel Shaderlanguage
|
---|
| 138 | d3d9
|
---|
| 139 | {
|
---|
| 140 | hlsl_vertshader
|
---|
| 141 | {
|
---|
| 142 | // Code of the pixel program
|
---|
| 143 | code_variant_array
|
---|
| 144 | {
|
---|
| 145 | profile "1x1"
|
---|
| 146 | entry_point "main"
|
---|
| 147 | code "levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 148 | & "bump_d3d9_hlsl_vs1x1.s3d_shadercode_run"
|
---|
| 149 | //debug_code_file "src/res/levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 150 | // & "bump_d3d9_hlsl_vs1x1.s3d_shadercode"
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 | // Copy matrices into vertex program constants.
|
---|
| 155 | // The field "chan" can be one
|
---|
| 156 | // of "identity", "proj", "view" or "projview" "bone"
|
---|
| 157 | // The field "trans" can be one
|
---|
| 158 | // of "identity", "inv", "transp" or "invtransp"
|
---|
| 159 | // One matrix needs 4 constants.
|
---|
| 160 | tracking
|
---|
| 161 | {
|
---|
| 162 | codevar "projMat"
|
---|
| 163 | slot 0
|
---|
| 164 | chan "proj"
|
---|
| 165 | trans "identity"
|
---|
| 166 | }
|
---|
| 167 | {
|
---|
| 168 | codevar "matBone"
|
---|
| 169 | slot 0
|
---|
| 170 | chan "bone"
|
---|
| 171 | trans "identity"
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | param_array
|
---|
| 175 | {
|
---|
| 176 | src_progvar "prog_light_cenrange"
|
---|
| 177 | dest_codevar "lightCenRange"
|
---|
| 178 | type "float4"
|
---|
| 179 | }
|
---|
| 180 | {
|
---|
| 181 | src_progvar "prog_light_projmat"
|
---|
| 182 | dest_codevar "lightProjMat"
|
---|
| 183 | type "float4x4"
|
---|
| 184 | }
|
---|
| 185 | {
|
---|
| 186 | src_progvar "prog_light_shmapmat"
|
---|
| 187 | dest_codevar "lightShmapMat"
|
---|
| 188 | type "float4x4"
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | predefine_array
|
---|
| 192 | {
|
---|
| 193 | name "S3D_USE_BONESUBSCR"
|
---|
| 194 | }
|
---|
| 195 | {
|
---|
| 196 | name "S3D_MATBONE_CNT"
|
---|
| 197 | val "32"
|
---|
| 198 | }
|
---|
| 199 | {
|
---|
| 200 | name "S3D_PARALLAX_MAPPING"
|
---|
| 201 | }
|
---|
| 202 | {
|
---|
| 203 | name "S3D_LIGHT_PROJ"
|
---|
| 204 | }
|
---|
| 205 | {
|
---|
| 206 | name "S3D_LIGHT_SHMAP"
|
---|
| 207 | }
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | hlsl_pixshader
|
---|
| 211 | {
|
---|
| 212 | code_variant_array
|
---|
| 213 | {
|
---|
| 214 | profile "2x0"
|
---|
| 215 | entry_point "main"
|
---|
| 216 | code "levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 217 | & "bump_d3d9_hlsl_ps2x0.s3d_shadercode_run"
|
---|
| 218 | }
|
---|
| 219 |
|
---|
| 220 | param_array
|
---|
| 221 | {
|
---|
| 222 | src_progvar "prog_light_ambient"
|
---|
| 223 | dest_codevar "lightAmbient"
|
---|
| 224 | type "float4"
|
---|
| 225 | }
|
---|
| 226 | {
|
---|
| 227 | src_progvar "prog_light_diffuse"
|
---|
| 228 | dest_codevar "lightDiffuse"
|
---|
| 229 | type "float4"
|
---|
| 230 | }
|
---|
| 231 | {
|
---|
| 232 | src_progvar "prog_light_specular"
|
---|
| 233 | dest_codevar "lightSpecular"
|
---|
| 234 | type "float4"
|
---|
| 235 | }
|
---|
| 236 |
|
---|
| 237 | tex_size_codevar_array "" "" "lightShmapSize"
|
---|
| 238 | tex_rcpsize_codevar_array "" "" "lightShmapRcpSize"
|
---|
| 239 |
|
---|
| 240 | predefine_array
|
---|
| 241 | {
|
---|
| 242 | name "S3D_SPECULAR_EXP"
|
---|
| 243 | val "4.0"
|
---|
| 244 | }
|
---|
| 245 | {
|
---|
| 246 | name "S3D_GEOMETRIC_SHADOW"
|
---|
| 247 | }
|
---|
| 248 | {
|
---|
| 249 | name "S3D_PARALLAX_MAPPING"
|
---|
| 250 | }
|
---|
| 251 | {
|
---|
| 252 | name "S3D_PARALLAX_SCALE"
|
---|
| 253 | val "0.07"
|
---|
| 254 | }
|
---|
| 255 | {
|
---|
| 256 | name "S3D_PARALLAX_BIAS"
|
---|
| 257 | val "0.50196078431372549" // = 128/255
|
---|
| 258 | }
|
---|
| 259 | {
|
---|
| 260 | name "S3D_LIGHT_PROJ"
|
---|
| 261 | }
|
---|
| 262 | {
|
---|
| 263 | name "S3D_LIGHT_SHMAP"
|
---|
| 264 | }
|
---|
| 265 | {
|
---|
| 266 | name "S3D_SHMAP_ZBIAS"
|
---|
| 267 | //val "0.0003" // For no-filtering
|
---|
| 268 | val "0.0010" // For 4-filtering
|
---|
| 269 | //val "0.0010" // For 16-filtering
|
---|
| 270 | }
|
---|
| 271 | }
|
---|
| 272 | }
|
---|
| 273 |
|
---|
| 274 | // D3D9 Highlevel Shaderlanguage
|
---|
| 275 | xe
|
---|
| 276 | {
|
---|
| 277 | hlsl_vertshader
|
---|
| 278 | {
|
---|
| 279 | // Code of the pixel program
|
---|
| 280 | code_variant_array
|
---|
| 281 | {
|
---|
| 282 | profile "1x1"
|
---|
| 283 | entry_point "main"
|
---|
| 284 | code "levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 285 | & "bump_d3d9_hlsl_vs1x1.s3d_shadercode_run"
|
---|
| 286 | //debug_code_file "src/res/levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 287 | // & "bump_d3d9_hlsl_vs1x1.s3d_shadercode"
|
---|
| 288 | }
|
---|
| 289 |
|
---|
| 290 |
|
---|
| 291 | // Copy matrices into vertex program constants.
|
---|
| 292 | // The field "chan" can be one
|
---|
| 293 | // of "identity", "proj", "view" or "projview" "bone"
|
---|
| 294 | // The field "trans" can be one
|
---|
| 295 | // of "identity", "inv", "transp" or "invtransp"
|
---|
| 296 | // One matrix needs 4 constants.
|
---|
| 297 | tracking
|
---|
| 298 | {
|
---|
| 299 | codevar "projMat"
|
---|
| 300 | slot 0
|
---|
| 301 | chan "proj"
|
---|
| 302 | trans "identity"
|
---|
| 303 | }
|
---|
| 304 | {
|
---|
| 305 | codevar "matBone"
|
---|
| 306 | slot 0
|
---|
| 307 | chan "bone"
|
---|
| 308 | trans "identity"
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | param_array
|
---|
| 312 | {
|
---|
| 313 | src_progvar "prog_light_cenrange"
|
---|
| 314 | dest_codevar "lightCenRange"
|
---|
| 315 | type "float4"
|
---|
| 316 | }
|
---|
| 317 | {
|
---|
| 318 | src_progvar "prog_light_projmat"
|
---|
| 319 | dest_codevar "lightProjMat"
|
---|
| 320 | type "float4x4"
|
---|
| 321 | }
|
---|
| 322 | {
|
---|
| 323 | src_progvar "prog_light_shmapmat"
|
---|
| 324 | dest_codevar "lightShmapMat"
|
---|
| 325 | type "float4x4"
|
---|
| 326 | }
|
---|
| 327 |
|
---|
| 328 | predefine_array
|
---|
| 329 | {
|
---|
| 330 | name "S3D_USE_BONESUBSCR"
|
---|
| 331 | }
|
---|
| 332 | {
|
---|
| 333 | name "S3D_MATBONE_CNT"
|
---|
| 334 | val "32"
|
---|
| 335 | }
|
---|
| 336 | {
|
---|
| 337 | name "S3D_PARALLAX_MAPPING"
|
---|
| 338 | }
|
---|
| 339 | {
|
---|
| 340 | name "S3D_LIGHT_PROJ"
|
---|
| 341 | }
|
---|
| 342 | {
|
---|
| 343 | name "S3D_LIGHT_SHMAP"
|
---|
| 344 | }
|
---|
| 345 | }
|
---|
| 346 |
|
---|
| 347 | hlsl_pixshader
|
---|
| 348 | {
|
---|
| 349 | code_variant_array
|
---|
| 350 | {
|
---|
| 351 | profile "2x0"
|
---|
| 352 | entry_point "main"
|
---|
| 353 | code "levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 354 | & "bump_d3d9_hlsl_ps2x0.s3d_shadercode_run"
|
---|
| 355 | }
|
---|
| 356 |
|
---|
| 357 | param_array
|
---|
| 358 | {
|
---|
| 359 | src_progvar "prog_light_ambient"
|
---|
| 360 | dest_codevar "lightAmbient"
|
---|
| 361 | type "float4"
|
---|
| 362 | }
|
---|
| 363 | {
|
---|
| 364 | src_progvar "prog_light_diffuse"
|
---|
| 365 | dest_codevar "lightDiffuse"
|
---|
| 366 | type "float4"
|
---|
| 367 | }
|
---|
| 368 | {
|
---|
| 369 | src_progvar "prog_light_specular"
|
---|
| 370 | dest_codevar "lightSpecular"
|
---|
| 371 | type "float4"
|
---|
| 372 | }
|
---|
| 373 |
|
---|
| 374 | tex_size_codevar_array "" "" "" "lightShmapSize"
|
---|
| 375 | tex_rcpsize_codevar_array "" "" "" "lightShmapRcpSize"
|
---|
| 376 |
|
---|
| 377 | predefine_array
|
---|
| 378 | {
|
---|
| 379 | name "S3D_SPECULAR_EXP"
|
---|
| 380 | val "4.0"
|
---|
| 381 | }
|
---|
| 382 | {
|
---|
| 383 | name "S3D_GEOMETRIC_SHADOW"
|
---|
| 384 | }
|
---|
| 385 | {
|
---|
| 386 | name "S3D_PARALLAX_MAPPING"
|
---|
| 387 | }
|
---|
| 388 | {
|
---|
| 389 | name "S3D_PARALLAX_SCALE"
|
---|
| 390 | val "0.07"
|
---|
| 391 | }
|
---|
| 392 | {
|
---|
| 393 | name "S3D_PARALLAX_BIAS"
|
---|
| 394 | val "0.50196078431372549" // = 128/255
|
---|
| 395 | }
|
---|
| 396 | {
|
---|
| 397 | name "S3D_LIGHT_PROJ"
|
---|
| 398 | }
|
---|
| 399 | {
|
---|
| 400 | name "S3D_LIGHT_SHMAP"
|
---|
| 401 | }
|
---|
| 402 | {
|
---|
| 403 | name "S3D_SHMAP_FILTER16"
|
---|
| 404 | val ""
|
---|
| 405 | }
|
---|
| 406 | {
|
---|
| 407 | name "S3D_SHMAP_ZBIAS"
|
---|
| 408 | //val "0.0003" // For no-filtering
|
---|
| 409 | //val "0.0010" // For 4-filtering
|
---|
| 410 | val "0.0010" // For 16-filtering
|
---|
| 411 | }
|
---|
| 412 | }
|
---|
| 413 | }
|
---|