Rev | Line | |
---|
[1424] | 1 | struct VS_OUT
|
---|
| 2 | {
|
---|
| 3 | float4 hPosition : POSITION;
|
---|
| 4 | float4 texCoord : TEXCOORD0;
|
---|
| 5 | float4 color : COLOR0;
|
---|
| 6 | };
|
---|
| 7 |
|
---|
| 8 | VS_OUT SmokeIllumVolumeVS(float4 position : POSITION,
|
---|
| 9 | float4 texCoord : TEXCOORD0,
|
---|
| 10 | float4 color : COLOR0,
|
---|
| 11 | uniform float baseRadius,
|
---|
| 12 | uniform float4x4 worldView,
|
---|
| 13 | uniform float4x4 Proj,
|
---|
| 14 | uniform float4x4 worldViewProj)
|
---|
| 15 | {
|
---|
| 16 | VS_OUT OUT;
|
---|
| 17 |
|
---|
| 18 | texCoord.y = 1.0 - texCoord.y;
|
---|
| 19 | float2 offset = texCoord.zw * baseRadius;
|
---|
| 20 | float4 cPosition = mul(worldView, position);
|
---|
| 21 | cPosition.xy += offset;
|
---|
| 22 |
|
---|
| 23 | OUT.hPosition = mul( Proj, cPosition );
|
---|
| 24 | OUT.texCoord = texCoord;
|
---|
| 25 | OUT.color = 1;
|
---|
| 26 |
|
---|
| 27 | float z = OUT.hPosition.z / OUT.hPosition.w;
|
---|
| 28 |
|
---|
| 29 | float4 planes = float4(0.33, 0.5, 0.66, 1);
|
---|
| 30 | if(z > planes.x)
|
---|
| 31 | {
|
---|
| 32 | OUT.color.r = 0;
|
---|
| 33 | }
|
---|
| 34 | if(z > planes.y)
|
---|
| 35 | {
|
---|
| 36 | OUT.color.g = 0;
|
---|
| 37 | }
|
---|
| 38 | if(z > planes.z)
|
---|
| 39 | {
|
---|
| 40 | OUT.color.b = 0;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | return OUT;
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | float4 SmokeIllumVolumePS(VS_OUT IN ,
|
---|
| 49 | uniform sampler2D colorTexture : register(s0)):COLOR
|
---|
| 50 | {
|
---|
| 51 |
|
---|
| 52 | return tex2D( colorTexture, IN.texCoord.xy).a * 0.1 * IN.color;
|
---|
| 53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.