[2269] | 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_LIGHT_SHMAP"
|
---|
| 92 | }
|
---|
| 93 | {
|
---|
| 94 | name "S3D_SHMAP_FILTER16"
|
---|
| 95 | }
|
---|
| 96 | {
|
---|
| 97 | name "S3D_SHMAP_ZBIAS"
|
---|
| 98 | //val "0.0003" // For no-filtering
|
---|
| 99 | val "0.0010" // For 4-filtering
|
---|
| 100 | //val "0.0010" // For 16-filtering
|
---|
| 101 | }
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | param_array
|
---|
| 105 | {
|
---|
| 106 | src_progvar "prog_light_cenrange"
|
---|
| 107 | dest_codevar "lightCenRange"
|
---|
| 108 | type "float4"
|
---|
| 109 | }
|
---|
| 110 | {
|
---|
| 111 | src_progvar "prog_light_ambient"
|
---|
| 112 | dest_codevar "lightAmbient"
|
---|
| 113 | type "float4"
|
---|
| 114 | }
|
---|
| 115 | {
|
---|
| 116 | src_progvar "prog_light_diffuse"
|
---|
| 117 | dest_codevar "lightDiffuse"
|
---|
| 118 | type "float4"
|
---|
| 119 | }
|
---|
| 120 | {
|
---|
| 121 | src_progvar "prog_light_specular"
|
---|
| 122 | dest_codevar "lightSpecular"
|
---|
| 123 | type "float4"
|
---|
| 124 | }
|
---|
| 125 | {
|
---|
| 126 | src_progvar "prog_light_projmat"
|
---|
| 127 | dest_codevar "lightProjMat"
|
---|
| 128 | type "float4x4"
|
---|
| 129 | }
|
---|
| 130 | {
|
---|
| 131 | src_progvar "prog_light_shmapmat"
|
---|
| 132 | dest_codevar "lightShmapMat"
|
---|
| 133 | type "float4x4"
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | sampler_array "tex0" "normalSamp" "lightProjSamp" "lightShmapSamp"
|
---|
| 137 |
|
---|
| 138 | tex_size_codevar_array "" "" "lightShmapSize"
|
---|
| 139 | tex_rcpsize_codevar_array "" "" "lightShmapRcpSize"
|
---|
| 140 | }
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | d3d9
|
---|
| 144 | {
|
---|
| 145 | hlsl_vertshader
|
---|
| 146 | {
|
---|
| 147 | // Code of the pixel program
|
---|
| 148 | code_variant_array
|
---|
| 149 | {
|
---|
| 150 | profile "1x1"
|
---|
| 151 | entry_point "main"
|
---|
| 152 | code "levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 153 | & "bump_d3d9_hlsl_vs1x1.s3d_shadercode_run"
|
---|
| 154 | //debug_code_file "src/res/levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 155 | // & "bump_d3d9_hlsl_vs1x1.s3d_shadercode"
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 |
|
---|
| 159 | // Copy matrices into vertex program constants.
|
---|
| 160 | // The field "chan" can be one
|
---|
| 161 | // of "identity", "proj", "view" or "projview" "bone"
|
---|
| 162 | // The field "trans" can be one
|
---|
| 163 | // of "identity", "inv", "transp" or "invtransp"
|
---|
| 164 | // One matrix needs 4 constants.
|
---|
| 165 | tracking
|
---|
| 166 | {
|
---|
| 167 | codevar "projMat"
|
---|
| 168 | slot 0
|
---|
| 169 | chan "proj"
|
---|
| 170 | trans "identity"
|
---|
| 171 | }
|
---|
| 172 | {
|
---|
| 173 | codevar "matBone"
|
---|
| 174 | slot 0
|
---|
| 175 | chan "bone"
|
---|
| 176 | trans "identity"
|
---|
| 177 | }
|
---|
| 178 |
|
---|
| 179 | param_array
|
---|
| 180 | {
|
---|
| 181 | src_progvar "prog_light_cenrange"
|
---|
| 182 | dest_codevar "lightCenRange"
|
---|
| 183 | type "float4"
|
---|
| 184 | }
|
---|
| 185 | {
|
---|
| 186 | src_progvar "prog_light_projmat"
|
---|
| 187 | dest_codevar "lightProjMat"
|
---|
| 188 | type "float4x4"
|
---|
| 189 | }
|
---|
| 190 | {
|
---|
| 191 | src_progvar "prog_light_shmapmat"
|
---|
| 192 | dest_codevar "lightShmapMat"
|
---|
| 193 | type "float4x4"
|
---|
| 194 | }
|
---|
| 195 |
|
---|
| 196 | predefine_array
|
---|
| 197 | {
|
---|
| 198 | name "S3D_USE_BONESUBSCR"
|
---|
| 199 | }
|
---|
| 200 | {
|
---|
| 201 | name "S3D_MATBONE_CNT"
|
---|
| 202 | val "32"
|
---|
| 203 | }
|
---|
| 204 | {
|
---|
| 205 | name "S3D_PARALLAX_MAPPING"
|
---|
| 206 | }
|
---|
| 207 | {
|
---|
| 208 | name "S3D_LIGHT_PROJ"
|
---|
| 209 | }
|
---|
| 210 | {
|
---|
| 211 | name "S3D_LIGHT_SHMAP"
|
---|
| 212 | }
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | hlsl_pixshader
|
---|
| 216 | {
|
---|
| 217 | code_variant_array
|
---|
| 218 | {
|
---|
| 219 | profile "2x0"
|
---|
| 220 | entry_point "main"
|
---|
| 221 | code "levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 222 | & "bump_d3d9_hlsl_ps2x0.s3d_shadercode_run"
|
---|
| 223 | }
|
---|
| 224 |
|
---|
| 225 | param_array
|
---|
| 226 | {
|
---|
| 227 | src_progvar "prog_light_ambient"
|
---|
| 228 | dest_codevar "lightAmbient"
|
---|
| 229 | type "float4"
|
---|
| 230 | }
|
---|
| 231 | {
|
---|
| 232 | src_progvar "prog_light_diffuse"
|
---|
| 233 | dest_codevar "lightDiffuse"
|
---|
| 234 | type "float4"
|
---|
| 235 | }
|
---|
| 236 | {
|
---|
| 237 | src_progvar "prog_light_specular"
|
---|
| 238 | dest_codevar "lightSpecular"
|
---|
| 239 | type "float4"
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | tex_size_codevar_array "" "" "lightShmapSize"
|
---|
| 243 | tex_rcpsize_codevar_array "" "" "lightShmapRcpSize"
|
---|
| 244 |
|
---|
| 245 | predefine_array
|
---|
| 246 | {
|
---|
| 247 | name "S3D_SPECULAR_EXP"
|
---|
| 248 | val "4.0"
|
---|
| 249 | }
|
---|
| 250 | {
|
---|
| 251 | name "S3D_GEOMETRIC_SHADOW"
|
---|
| 252 | }
|
---|
| 253 | {
|
---|
| 254 | name "S3D_PARALLAX_MAPPING"
|
---|
| 255 | }
|
---|
| 256 | {
|
---|
| 257 | name "S3D_PARALLAX_SCALE"
|
---|
| 258 | val "0.07"
|
---|
| 259 | }
|
---|
| 260 | {
|
---|
| 261 | name "S3D_PARALLAX_BIAS"
|
---|
| 262 | val "0.50196078431372549" // = 128/255
|
---|
| 263 | }
|
---|
| 264 | {
|
---|
| 265 | name "S3D_LIGHT_PROJ"
|
---|
| 266 | }
|
---|
| 267 | {
|
---|
| 268 | name "S3D_LIGHT_SHMAP"
|
---|
| 269 | }
|
---|
| 270 | /*
|
---|
| 271 | {
|
---|
| 272 | name "S3D_SHMAP_FILTER16"
|
---|
| 273 | val ""
|
---|
| 274 | }
|
---|
| 275 | */
|
---|
| 276 | {
|
---|
| 277 | name "S3D_SHMAP_ZBIAS"
|
---|
| 278 | //val "0.0003" // For no-filtering
|
---|
| 279 | val "0.0010" // For 4-filtering
|
---|
| 280 | //val "0.0010" // For 16-filtering
|
---|
| 281 | }
|
---|
| 282 | }
|
---|
| 283 | }
|
---|
| 284 |
|
---|
| 285 | //#ifdef S3D_GENERAL_PLATFORM_XE
|
---|
| 286 | xe
|
---|
| 287 | {
|
---|
| 288 | hlsl_vertshader
|
---|
| 289 | {
|
---|
| 290 | // Code of the pixel program
|
---|
| 291 | code_variant_array
|
---|
| 292 | {
|
---|
| 293 | profile "1x1"
|
---|
| 294 | entry_point "main"
|
---|
| 295 | code "levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 296 | & "bump_d3d9_hlsl_vs1x1.s3d_shadercode_run"
|
---|
| 297 | //debug_code_file "src/res/levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 298 | // & "bump_d3d9_hlsl_vs1x1.s3d_shadercode"
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 |
|
---|
| 302 | // Copy matrices into vertex program constants.
|
---|
| 303 | // The field "chan" can be one
|
---|
| 304 | // of "identity", "proj", "view" or "projview" "bone"
|
---|
| 305 | // The field "trans" can be one
|
---|
| 306 | // of "identity", "inv", "transp" or "invtransp"
|
---|
| 307 | // One matrix needs 4 constants.
|
---|
| 308 | tracking
|
---|
| 309 | {
|
---|
| 310 | codevar "projMat"
|
---|
| 311 | slot 0
|
---|
| 312 | chan "proj"
|
---|
| 313 | trans "identity"
|
---|
| 314 | }
|
---|
| 315 | {
|
---|
| 316 | codevar "matBone"
|
---|
| 317 | slot 0
|
---|
| 318 | chan "bone"
|
---|
| 319 | trans "identity"
|
---|
| 320 | }
|
---|
| 321 |
|
---|
| 322 | param_array
|
---|
| 323 | {
|
---|
| 324 | src_progvar "prog_light_cenrange"
|
---|
| 325 | dest_codevar "lightCenRange"
|
---|
| 326 | type "float4"
|
---|
| 327 | }
|
---|
| 328 | {
|
---|
| 329 | src_progvar "prog_light_projmat"
|
---|
| 330 | dest_codevar "lightProjMat"
|
---|
| 331 | type "float4x4"
|
---|
| 332 | }
|
---|
| 333 | {
|
---|
| 334 | src_progvar "prog_light_shmapmat"
|
---|
| 335 | dest_codevar "lightShmapMat"
|
---|
| 336 | type "float4x4"
|
---|
| 337 | }
|
---|
| 338 |
|
---|
| 339 | predefine_array
|
---|
| 340 | {
|
---|
| 341 | name "S3D_USE_BONESUBSCR"
|
---|
| 342 | }
|
---|
| 343 | {
|
---|
| 344 | name "S3D_MATBONE_CNT"
|
---|
| 345 | val "32"
|
---|
| 346 | }
|
---|
| 347 | {
|
---|
| 348 | name "S3D_PARALLAX_MAPPING"
|
---|
| 349 | }
|
---|
| 350 | {
|
---|
| 351 | name "S3D_LIGHT_PROJ"
|
---|
| 352 | }
|
---|
| 353 | {
|
---|
| 354 | name "S3D_LIGHT_SHMAP"
|
---|
| 355 | }
|
---|
| 356 | }
|
---|
| 357 |
|
---|
| 358 | hlsl_pixshader
|
---|
| 359 | {
|
---|
| 360 | code_variant_array
|
---|
| 361 | {
|
---|
| 362 | profile "2x0"
|
---|
| 363 | entry_point "main"
|
---|
| 364 | code "levelutil/shader/prog/d3d9_hlsl/"
|
---|
| 365 | & "bump_d3d9_hlsl_ps2x0.s3d_shadercode_run"
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | param_array
|
---|
| 369 | {
|
---|
| 370 | src_progvar "prog_light_ambient"
|
---|
| 371 | dest_codevar "lightAmbient"
|
---|
| 372 | type "float4"
|
---|
| 373 | }
|
---|
| 374 | {
|
---|
| 375 | src_progvar "prog_light_diffuse"
|
---|
| 376 | dest_codevar "lightDiffuse"
|
---|
| 377 | type "float4"
|
---|
| 378 | }
|
---|
| 379 | {
|
---|
| 380 | src_progvar "prog_light_specular"
|
---|
| 381 | dest_codevar "lightSpecular"
|
---|
| 382 | type "float4"
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | tex_size_codevar_array "" "" "" "lightShmapSize"
|
---|
| 386 | tex_rcpsize_codevar_array "" "" "" "lightShmapRcpSize"
|
---|
| 387 |
|
---|
| 388 | predefine_array
|
---|
| 389 | {
|
---|
| 390 | name "S3D_SPECULAR_EXP"
|
---|
| 391 | val "4.0"
|
---|
| 392 | }
|
---|
| 393 | {
|
---|
| 394 | name "S3D_GEOMETRIC_SHADOW"
|
---|
| 395 | }
|
---|
| 396 | {
|
---|
| 397 | name "S3D_PARALLAX_MAPPING"
|
---|
| 398 | }
|
---|
| 399 | {
|
---|
| 400 | name "S3D_PARALLAX_SCALE"
|
---|
| 401 | val "0.07"
|
---|
| 402 | }
|
---|
| 403 | {
|
---|
| 404 | name "S3D_PARALLAX_BIAS"
|
---|
| 405 | val "0.50196078431372549" // = 128/255
|
---|
| 406 | }
|
---|
| 407 | {
|
---|
| 408 | name "S3D_LIGHT_PROJ"
|
---|
| 409 | }
|
---|
| 410 | {
|
---|
| 411 | name "S3D_LIGHT_SHMAP"
|
---|
| 412 | }
|
---|
| 413 | {
|
---|
| 414 | name "S3D_SHMAP_FILTER16"
|
---|
| 415 | val ""
|
---|
| 416 | }
|
---|
| 417 | {
|
---|
| 418 | name "S3D_SHMAP_ZBIAS"
|
---|
| 419 | //val "0.0003" // For no-filtering
|
---|
| 420 | //val "0.0010" // For 4-filtering
|
---|
| 421 | val "0.0010" // For 16-filtering
|
---|
| 422 | }
|
---|
| 423 | }
|
---|
| 424 | }
|
---|
| 425 | //#endif
|
---|