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 | #include \
|
---|
15 | <levelutil/shader/prog/d3d9_hlsl/include_shmap_filter_d3d9_hlsl.s3d_shadercode_run>
|
---|
16 |
|
---|
17 | ///////////////////////////////////////////////////////////////////////////////
|
---|
18 |
|
---|
19 | struct PS_INPUT
|
---|
20 | {
|
---|
21 | float4 lightProjCoord: TEXCOORD0;
|
---|
22 | float4 lightShmapCoord: TEXCOORD1;
|
---|
23 | };
|
---|
24 |
|
---|
25 | ///////////////////////////////////////////////////////////////////////////////
|
---|
26 |
|
---|
27 | const float4 lightIntens;
|
---|
28 |
|
---|
29 | const float4 lightShmapSize;
|
---|
30 | const float4 lightShmapRcpSize;
|
---|
31 |
|
---|
32 | sampler lightProjSamp: register(s0);
|
---|
33 | sampler lightShmapSamp: register(s1);
|
---|
34 |
|
---|
35 | ///////////////////////////////////////////////////////////////////////////////
|
---|
36 | // Pixelshader
|
---|
37 | // Profile: 2x0
|
---|
38 |
|
---|
39 | float4 main(PS_INPUT input): COLOR0
|
---|
40 | {
|
---|
41 | float3 clipVal = input.lightShmapCoord.www
|
---|
42 | - abs(2 * input.lightShmapCoord.xyz - input.lightShmapCoord.www);
|
---|
43 | clip(clipVal.xyz);
|
---|
44 |
|
---|
45 | float4 outCol = lightIntens;
|
---|
46 |
|
---|
47 | float4 texColProjTex = tex2Dproj(lightProjSamp, input.lightProjCoord);
|
---|
48 |
|
---|
49 | float bright = s3d_shmapFilter(lightShmapSamp, input.lightShmapCoord,
|
---|
50 | lightShmapSize, lightShmapRcpSize);
|
---|
51 |
|
---|
52 | outCol *= texColProjTex * bright;
|
---|
53 |
|
---|
54 | return outCol;
|
---|
55 | }
|
---|
56 |
|
---|
57 | ///////////////////////////////////////////////////////////////////////////////
|
---|