// spot_tex makes a spotlight pattern to be projected // $Revision: #1 $ #ifndef _H_SPOT_TEX #define _H_SPOT_TEX #ifndef SPOT_TEX_SIZE #define SPOT_TEX_SIZE 64 #endif /* SPOT_TEX_SIZE */ #ifndef SPOT_TEX_INSIDE #define SPOT_TEX_INSIDE 0.4 #endif /* SPOT_TEX_INSIDE */ // function used to fill texture float4 spot_texel(float2 P : POSITION,float2 dP : PSIZE) : COLOR { //adjust so the outer rows and columns are ALWAYS black float2 rad = float2(0.5,0.5) - dP; float2 v = P - float2(0.5,0.5); float d = length(v)/rad.x; // for now simple case of (dP.x==dP.y) float s = 1.0 - smoothstep(SPOT_TEX_INSIDE,1,d); return s.xxxx; } texture SpotTex < string TextureType = "2D"; string function = "spot_texel"; string UIWidget = "None"; int width = SPOT_TEX_SIZE, height = SPOT_TEX_SIZE; >; // samplers sampler SpotSamp = sampler_state { texture = ; MinFilter = LinearMipMapLinear; MagFilter = Linear; WrapS = Clamp; WrapT = Clamp; }; #endif /* _H_SPOT_TEX */