summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl/vector.fx
diff options
context:
space:
mode:
Diffstat (limited to 'hlsl/vector.fx')
-rw-r--r--hlsl/vector.fx33
1 files changed, 15 insertions, 18 deletions
diff --git a/hlsl/vector.fx b/hlsl/vector.fx
index 066d7df1889..8b9aa6333f3 100644
--- a/hlsl/vector.fx
+++ b/hlsl/vector.fx
@@ -2,19 +2,6 @@
// Effect File Variables
//-----------------------------------------------------------------------------
-texture Diffuse;
-
-sampler DiffuseSampler = sampler_state
-{
- Texture = <Diffuse>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
-};
-
//-----------------------------------------------------------------------------
// Vertex Definitions
//-----------------------------------------------------------------------------
@@ -45,6 +32,8 @@ struct PS_INPUT
uniform float TargetWidth;
uniform float TargetHeight;
+uniform float2 TimeParams;
+uniform float3 LengthParams;
VS_OUTPUT vs_main(VS_INPUT Input)
{
@@ -57,7 +46,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position.x -= 0.5f;
Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
- Output.Color = float4(0.0f, 0.0f, Input.Color.z, 1.0f);
+ Output.Color = Input.Color;
Output.TexCoord = Input.Position.xy / float2(TargetWidth, TargetHeight);
return Output;
@@ -67,10 +56,20 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// Simple Pixel Shader
//-----------------------------------------------------------------------------
+// TimeParams.x: Frame time of the vector
+// TimeParams.y: How much frame time affects the vector's fade
+// LengthParams.x: Length of the vector
+// LengthParams.y: How much length affects the vector's fade
+// LengthParams.z: Size at which fade is maximum
float4 ps_main(PS_INPUT Input) : COLOR
{
- float4 BaseTexel = tex2D(DiffuseSampler, Input.TexCoord);
- return BaseTexel * Input.Color;
+ float timeModulate = lerp(1.0f, TimeParams.x, TimeParams.y) * 2.0;
+
+ float lengthModulate = clamp(1.0f - LengthParams.x / LengthParams.z, 0.0f, 1.0f);
+ lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y) * 2.0;
+
+ float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f) * 2.5;
+ return outColor;
}
//-----------------------------------------------------------------------------
@@ -83,8 +82,6 @@ technique TestTechnique
{
Lighting = FALSE;
- //Sampler[0] = <DiffuseSampler>;
-
VertexShader = compile vs_2_0 vs_main();
PixelShader = compile ps_2_0 ps_main();
}