Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local shader = dxCreateShader([[
- #define GENERATE_NORMALS
- #include "mta-helper.fx"
- float transparency = 1.0f;
- sampler Sampler0 = sampler_state
- {
- Texture = (gTexture0);
- };
- struct VertexShaderInput
- {
- float3 Position : POSITION0;
- float4 Diffuse : COLOR0;
- float2 TexCoord : TEXCOORD0;
- float3 Normal : NORMAL0;
- };
- struct VertexShaderOutput
- {
- float4 Position : POSITION0;
- float4 Diffuse : COLOR0;
- float2 TexCoord : TEXCOORD0;
- float3 Normal : TEXCOORD1;
- };
- VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
- {
- VertexShaderOutput output = (VertexShaderOutput)0;
- output.Position = MTACalcScreenPosition(input.Position);
- output.Diffuse = MTACalcGTABuildingDiffuse(input.Diffuse);
- output.Normal = MTACalcWorldNormal(input.Normal);
- output.TexCoord = input.TexCoord;
- return output;
- }
- float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
- {
- float4 color = tex2D(Sampler0, input.TexCoord);
- color.a = transparency;
- return color;
- }
- technique
- {
- pass P0
- {
- PixelShader = compile ps_2_0 PixelShaderFunction();
- VertexShader = compile vs_2_0 VertexShaderFunction();
- }
- }]], 0, 200, false)
- addEventHandler('onClientResourceStart', resourceRoot, function()
- local sW,sH = guiGetScreenSize()
- local myScreenSource = dxCreateScreenSource(sW, sH)
- shader:setValue('screenSource', myScreenSource);
- shader:applyToWorldTexture('waterclear256')
- local input = dxCreateScreenSource(sW, sH)
- local output = dxCreateScreenSource(sW, sH)
- local frameTick = 0.0;
- local update = false;
- addEventHandler('onClientPreRender', root, function(timeSlice)
- if getTickCount() > frameTick then
- frameTick = getTickCount() + (timeSlice * 2);
- iprint('frameTick-update: ', frameTick);
- end
- end )
- -- addEventHandler('onClientHUDRender', root, function()
- -- if not continue then
- -- output:update(true);
- -- shader:setValue('transparency', 0.0);
- -- else
- -- input:update(false);
- -- shader:setValue('transparency', 1.0);
- -- end
- -- continue = not continue
- -- dxDrawImage(0, 0, sW, sH, output)
- -- end )
- addEventHandler('onClientHUDRender', root, function()
- if getTickCount() > frameTick then
- shader:setValue('transparency', 0.0);
- update = true
- else
- shader:setValue('transparency', 1.0);
- if update then
- input:update(false);
- update = false
- end
- end
- end )
- addEventHandler('onClientRender', root, function()
- dxDrawImage(1920 - 800, 0, 800, 600, input)
- end )
- end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement