string description = "PointParticle"; /************* UN-TWEAKABLES **************/ float4x4 wM < string UIWidget="None"; >; float alphaMod < string UIWidget = "slider"; float UIMin = 0.0; float UIMax = 1.0; > = 1.0f; float4 colourMod = {1.0f, 1.0f, 1.0f, 1.0f}; float3 impactPoint = {0.0f, 0.0f, 0.0f}; float4 offset = {0.0f, 0.0f, 0.0f, 0.0f}; /*********** Tweakables **********************/ /************* Textures ******************/ sampler2D TexturePage[1]; /************* DATA STRUCTS **************/ /* data from application vertex buffer */ struct appdata { float4 position : POSITION; float2 texCoord0 : TEXCOORD0; int textureIdx : TEXCOORD1; }; /* data passed from vertex shader to pixel shader */ struct vertexOutput { float4 position : POSITION; float2 texCoord : TEXCOORD0; int textureIdx : TEXCOORD1; }; /*********** vertex program ******/ vertexOutput simpleVP(appdata IN) { vertexOutput OUT = (vertexOutput)0; //constants OUT.texCoord = IN.texCoord0; //position OUT.position = mul( wM, IN.position); OUT.textureIdx = IN.textureIdx; // Centre the text OUT.position.xy += offset.xy; float progress = 1.0f - alphaMod; float2 vec = OUT.position.xy - impactPoint.xy; normalize(vec); OUT.position.xy += vec * progress; return OUT; } /********* fragment program ********/ float4 simpleFP(vertexOutput IN) : COLOR { float4 texCol = tex2D(TexturePage[0], IN.texCoord); return texCol * colourMod; } /*************/ technique basic < string layer = "GUI" ; > { pass p0 { VertexProgram = compile arbvp1 simpleVP(); FragmentProgram = compile arbfp1 simpleFP(); DepthTestEnable = false; DepthMask = true; BlendEnable = true; BlendFunc = int2(SrcAlpha, InvSrcAlpha); } } /***************************** eof ***/