| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- //////////////////////////////////////////////////////////////////////////////
- // ©2005 Electronic Arts Inc
- //
- // FX Shader for shadow map debugging
- //////////////////////////////////////////////////////////////////////////////
- #include "Common.fxh"
- #if defined(EA_PLATFORM_WINDOWS) && defined(_3DSMAX_)
- // ----------------------------------------------------------------------------
- // SAMPLER : nhendricks : had to pull these in here for MAX to compile
- // ----------------------------------------------------------------------------
- #define SAMPLER_2D_BEGIN(samplerName, annotations) \
- texture samplerName \
- < \
- annotations \
- >; \
- sampler2D samplerName##Sampler = sampler_state \
- { \
- Texture = < samplerName >;
-
- #define SAMPLER_2D_END };
- #define SAMPLER( samplerName ) samplerName##Sampler
- #define SAMPLER_CUBE_BEGIN(samplerName, annotations) \
- texture samplerName \
- < \
- annotations \
- >; \
- samplerCUBE samplerName##Sampler = sampler_state \
- { \
- Texture = < samplerName >;
-
- #define SAMPLER_CUBE_END };
- #endif
- float4 FlatColorOverride
- <
- string UIWidget = "None";
- string SasBindAddress = "WW3D.FlatColor";
- int WW3DDynamicSet = DS_CUSTOM_FIRST;
- >;
- SAMPLER_2D_BEGIN( BaseTexture,
- string UIName = "Base Texture";
- )
- MinFilter = Linear;
- MagFilter = Linear;
- MipFilter = Linear;
- AddressU = Clamp;
- AddressV = Clamp;
- SAMPLER_2D_END
- // ----------------------------------------------------------------------------
- // Transformations
- // ----------------------------------------------------------------------------
- float4x4 WorldViewProjection : WorldViewProjection;
-
- // ----------------------------------------------------------------------------
- struct VSOutput_FlatColor
- {
- float4 Position : POSITION;
- };
- // ----------------------------------------------------------------------------
- VSOutput_FlatColor VS_FlatColor(float3 Position : POSITION)
- {
- VSOutput_FlatColor Out;
-
- Out.Position = mul(float4(Position, 1), WorldViewProjection); //float4(Position, 1);//
- //Out.Position = mul(mul(mul(float4(Position, 1), World), View), Projection);
-
- return Out;
- }
- // ----------------------------------------------------------------------------
- float4 PS_FlatColor(VSOutput_FlatColor In) : COLOR
- {
- return float4(1, 0, 0, 1);
- }
- // ----------------------------------------------------------------------------
- float4 PS_FlatColorOverride(VSOutput_FlatColor In) : COLOR
- {
- return FlatColorOverride;
- }
- // ----------------------------------------------------------------------------
- // ----------------------------------------------------------------------------
- struct VSOutput_Texture1
- {
- float4 Position : POSITION;
- float2 BaseTexCoord : TEXCOORD0;
- };
- // ----------------------------------------------------------------------------
- VSOutput_Texture1 VS_Texture1(float3 Position : POSITION, float2 TexCoord0 : TEXCOORD0)
- {
- VSOutput_Texture1 Out;
- Out.Position = mul(float4(Position, 1), WorldViewProjection);
- Out.BaseTexCoord = TexCoord0;
- return Out;
- }
- // ----------------------------------------------------------------------------
- float4 PS_Texture1(VSOutput_Texture1 In) : COLOR
- {
- float4 color = tex2D(SAMPLER(BaseTexture), In.BaseTexCoord);
- return color;
- }
- // ----------------------------------------------------------------------------
- technique Simplest
- {
- pass P0
- {
- VertexShader = compile VS_2_0 VS_FlatColor();
- PixelShader = compile PS_2_0 PS_FlatColor();
- ZEnable = false;
- ZWriteEnable = false;
- CullMode = None;
- AlphaBlendEnable = false;
- ColorWriteEnable = RGBA;
- AlphaTestEnable = false;
- }
- }
- /*technique DynamicParameter
- {
- pass P0
- {
- VertexShader = compile VS_2_0 VS_FlatColor();
- PixelShader = compile PS_2_0 PS_FlatColorOverride();
- ZEnable = false;
- ZWriteEnable = false;
- CullMode = None;
- AlphaBlendEnable = false;
- ColorWriteEnable = RGBA;
- AlphaTestEnable = false;
- }
- }*/
- technique DynamicParameter
- {
- pass P0
- <
- USE_EXPRESSION_EVALUATOR("Simplest")
- >
- {
- VertexShader = compile VS_2_0 VS_FlatColor();
- PixelShader = compile PS_2_0 PS_FlatColor();
- ZEnable = false;
- ZWriteEnable = false;
- CullMode = None;
- #if !EXPRESSION_EVALUATOR_ENABLED
- AlphaBlendEnable = ( FlatColorOverride.z > 0.5 );
- #endif
- SrcBlend = One;
- DestBlend = One;
- ColorWriteEnable = RGBA;
- AlphaTestEnable = false;
- }
- }
- technique Textured
- {
- pass P0
- {
- VertexShader = compile VS_2_0 VS_Texture1();
- PixelShader = compile PS_2_0 PS_Texture1();
- ZEnable = false;
- ZWriteEnable = false;
- CullMode = None;
- AlphaBlendEnable = false;
- ColorWriteEnable = RGBA;
- AlphaTestEnable = false;
- }
- }
|