renderprogram game/scope { program vertex cg { <% struct VsInputs { float3 pos : $positionAttrib; float2 tex : $texCoordAttrib; float4 col : $colorAttrib; }; struct VsOutputs { float2 texCoord0 : TEXCOORD0; float2 center : TEXCOORD1; float4 color : COLOR0; }; float2 screenSize : $currentRenderTexelSize; uniform float4 parameters : $parameters; VsOutputs vertex( VsInputs indata ) { VsOutputs outdata; $if r_32ByteVtx indata.tex *= 1.f/4096.f; $endif float2 coord = indata.tex.xy; coord.y = 1 - coord.y; outdata.center = ( 0.5 * screenSize ); outdata.center.y += parameters.w; outdata.texCoord0 = ( coord * screenSize ) - outdata.center; outdata.color = indata.col; return outdata; } %> } program fragment cg { <% struct VsOutputs { float2 texCoord0 : TEXCOORD0; float2 center : TEXCOORD1; float4 color : COLOR0; }; samplerRECT blurbuffer : $map; samplerRECT framebuffer : $currentRender; float2 screenSize : $currentRenderTexelSize; uniform float4 glareParameters : $postGlareParameters; uniform float4 postSaturationContrast : $postSaturationContrast; uniform float4 postTint : $postTint; uniform float4 parameters : $parameters; uniform float4 diffuseColor : $diffuseColor; float4 fragment( VsOutputs indata ) : COLOR { float pi = 3.14159265358979323846f; float twopi = pi * 2.f; float wpvPinch = parameters.x;// - 0.4 * indata.color.x; //-0.15; //float wpvWhirl = /*indata.color.x*/ 3 * 360 * pi / 180; //float wpvRadius = 1; float lens_diameter = screenSize.y + 64;//+ 128 * indata.color.x; float lens_radius = 0.5 * lens_diameter; float dx = indata.texCoord0.x * parameters.y; float dy = indata.texCoord0.y * parameters.z; float d = dx * dx + dy * dy; float2 texcoord; //if ( d < lens_radius * lens_radius /** wpvRadius*/ ) { float dist = sqrt( d /*/ wpvRadius*/ ) / lens_diameter; // pinch float factor = pow( sin( twopi * /*0.5 **/ dist ), -wpvPinch ); dx *= factor; dy *= factor; #if 0 // whirl factor = 1.0 - dist; float ang = wpvWhirl * factor * factor; float2 sincosa; sincos( ang, sincosa.x, sincosa.y ); texcoord.x = sincosa.y * dx - sincosa.x * dy; texcoord.y = 1 - ( sincosa.x * dx - sincosa.y * dy ); #else texcoord.x = dx / parameters.y; texcoord.y = dy / parameters.z; #endif //} else { // texcoord.x = indata.texCoord0.x; // texcoord.y = indata.texCoord0.y; //} texcoord += indata.center; //return texRECT( framebuffer, texcoord ); // do post processing glare float4 clean = texRECT( framebuffer, texcoord ); float4 blur = texRECT( blurbuffer, texcoord * 0.25 ); float4 final = clean * glareParameters.x + blur * glareParameters.y; float4 grayscale = dot( final.rgb, float3( 0.299, 0.587, 0.114 ) ); return diffuseColor * lerp( float4( 0.5, 0.5, 0.5, 0.5 ), lerp( grayscale, final, postSaturationContrast.x ) , postSaturationContrast.y ) * postTint; } %> } } renderprogram game/scopeModel { program vertex cg { <% struct VsInputs { float3 pos : $positionAttrib; float2 tex : $texCoordAttrib; float4 col : $colorAttrib; }; struct VsOutputs { float2 texCoord0 : TEXCOORD0; float2 center : TEXCOORD1; float4 color : COLOR0; }; float2 screenSize : $currentRenderTexelSize; uniform float4 parameters : $parameters; VsOutputs vertex( VsInputs indata ) { VsOutputs outdata; $if r_32ByteVtx indata.tex *= 1.f/4096.f; $endif float2 coord = indata.tex.xy; coord.y = 1 - coord.y; outdata.center = ( 0.5 * screenSize ); outdata.center.y += parameters.w; outdata.texCoord0 = ( coord * screenSize ) - outdata.center; outdata.color = indata.col; return outdata; } %> } program fragment cg { <% struct VsOutputs { float2 texCoord0 : WPOS; //TEXCOORD0; float2 center : TEXCOORD1; float4 color : COLOR0; }; samplerRECT blurbuffer : $map; samplerRECT framebuffer : $currentRender; float2 screenSize : $currentRenderTexelSize; uniform float4 glareParameters : $postGlareParameters; uniform float4 postSaturationContrast : $postSaturationContrast; uniform float4 postTint : $postTint; uniform float4 parameters : $parameters; uniform float4 diffuseColor : $diffuseColor; float luminance( float3 c ){ return dot( c, float3( 0.33, 0.33, 0.33 ) ); } float4 fragment( VsOutputs indata ) : COLOR { float pi = 3.14159265358979323846f; float twopi = pi * 2.0f; indata.texCoord0 -= screenSize * 0.5; float wpvPinch = parameters.x;// - 0.4 * indata.color.x; //-0.15; float lens_diameter = screenSize.y + 64;//+ 128 * indata.color.x; float lens_radius = 0.5 * lens_diameter; float dx = indata.texCoord0.x * parameters.y; float dy = indata.texCoord0.y * parameters.z; float d = dx * dx + dy * dy; float2 texcoord; //if ( d < lens_radius * lens_radius /** wpvRadius*/ ) { float dist = sqrt( d /*/ wpvRadius*/ ) / lens_diameter; // pinch float factor = pow( sin( twopi /* 0.5*/ * dist ), -wpvPinch ); dx *= factor; dy *= factor; texcoord.x = dx / parameters.y; texcoord.y = dy / parameters.z; //} else { // texcoord.x = indata.texCoord0.x; // texcoord.y = indata.texCoord0.y; //} texcoord += screenSize * 0.5; //indata.center; // do post processing glare float4 clean = texRECT( framebuffer, texcoord ); //float4 blur = texRECT( blurbuffer, float2( texcoord.x * 0.25, texcoord.y * 0.5 ) ); float blur = 0;//lerp( 1, smoothstep( glareParameters.z, 1.0, luminance (clean.rgb ) ), glareParameters.w )*( clean.a * 0.25f ); float4 final = clean * glareParameters.x + blur * glareParameters.y; //final = blur; //return final; float4 grayscale = dot( final.rgb, float3( 0.299, 0.587, 0.114 ) ); return diffuseColor * lerp( float4( 0.5, 0.5, 0.5, 0.5 ), lerp( grayscale, final, postSaturationContrast.x ) , postSaturationContrast.y ) * postTint; } %> } } renderprogram game/scopeStatix { program vertex cg { <% struct VsInputs { float3 pos : $positionAttrib; float2 tex : $texCoordAttrib; float4 col : $colorAttrib; }; struct VsOutputs { float2 texCoord0 : TEXCOORD0; float2 center : TEXCOORD1; float2 texCoord1 : TEXCOORD2; float4 color : COLOR0; }; float2 screenSize : $currentRenderTexelSize; uniform float4 parameters : $parameters; VsOutputs vertex( VsInputs indata ) { VsOutputs outdata; $if r_32ByteVtx indata.tex *= 1.f/4096.f; $endif float2 coord = indata.tex.xy; coord.y = 1 - coord.y; outdata.center = ( 0.5 * screenSize ); outdata.center.y += parameters.w; outdata.texCoord0 = ( coord * screenSize ) - outdata.center; outdata.texCoord1 = indata.tex; outdata.color = indata.col; return outdata; } %> } program fragment cg { <% struct VsOutputs { float2 texCoord : WPOS; // float2 texCoord0 : TEXCOORD0; float2 center : TEXCOORD1; float2 texCoord1 : TEXCOORD2; float4 color : COLOR0; }; sampler2D noise : $mask; samplerRECT blurbuffer : $map; samplerRECT framebuffer : $currentRender; float2 screenSize : $currentRenderTexelSize; uniform float4 glareParameters : $postGlareParameters; uniform float4 postSaturationContrast : $postSaturationContrast; uniform float4 postTint : $postTint; uniform float4 parameters : $parameters; uniform float4 parameters2 : $parameters2; uniform float4 diffuseColor : $diffuseColor; float4 fragment( VsOutputs indata ) : COLOR { float pi = 3.14159265358979323846f; float twopi = pi * 2.f; float2 texCoord0 = indata.texCoord - screenSize * 0.5; float wpvPinch = parameters.x; float lens_diameter = screenSize.y + 128;//+ 128 * indata.color.x; float lens_radius = 0.5 * lens_diameter; float dx = texCoord0.x * parameters.y; float dy = texCoord0.y * parameters.z; float d = dx * dx + dy * dy; float2 texcoord; float dist = sqrt( d /*/ wpvRadius*/ ) / lens_diameter; // pinch float factor = pow( sin( twopi * /*0.5 **/ dist ), -wpvPinch ); dx *= factor; dy *= factor; texcoord.x = dx / parameters.y; texcoord.y = dy / parameters.z; texcoord += screenSize * 0.5; // do post processing glare float4 clean = texRECT( framebuffer, texcoord ); float4 blur = texRECT( blurbuffer, texcoord * 0.25 ); float4 final = clean * glareParameters.x + blur * glareParameters.y; float4 grayscale = dot( final.rgb, float3( 0.299, 0.587, 0.114 ) ); float4 outcol = diffuseColor * lerp( float4( 0.5, 0.5, 0.5, 0.5 ), lerp( grayscale, final, postSaturationContrast.x ) , postSaturationContrast.y ) * postTint; float4 c0 = tex2D( noise, (indata.texCoord1.xy + float2(parameters2.x,parameters2.x)) * 2); float4 c1 = tex2D( noise, (indata.texCoord1.xy + float2(parameters2.x,-parameters2.x)) * 2); float4 c = c0;//(c0 + c1) / 2; outcol = lerp( outcol, c, saturate(c.w * parameters2.y)); return outcol; } %> } }