Changeset 1774 for trunk/tutorial


Ignore:
Timestamp:
Aug 18, 2012, 11:54:31 PM (8 years ago)
Author:
sam
Message:

gpu: finalise the framebuffer object Direct3D implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tutorial/08_fbo.lolfx

    r1737 r1774  
    5454
    5555void main(float2 in_Position : POSITION,
     56          out float2 pass_Position : TEXCOORD0,
    5657          out float4 out_Position : POSITION)
    5758{
     59    pass_Position = in_Position;
    5860    out_Position = float4(in_Position, 0.0, 1.0);
    5961}
     
    6163-- HLSL.Frag --
    6264
    63 void main(out float4 out_FragColor : COLOR)
     65void main(in float2 pass_Position : TEXCOORD0,
     66          uniform sampler2D in_Texture,
     67          uniform float in_Flag,
     68          uniform float3 in_Point,
     69          uniform float3 in_Color,
     70          out float4 out_FragColor : COLOR)
    6471{
    65     out_FragColor = float4(0.7, 0.2, 0.5, 1.0);
     72    if (in_Flag == 0.0)
     73    {
     74        float tc = 0.0, ta = 0.0;
     75        {
     76            float s = 6.0 + 3.0 * in_Point.z;
     77            float2 p = pass_Position - in_Point.xy * 0.8;
     78            float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0);
     79            float u = t * t * t * t;
     80            tc += 3.0 * t * t - 2.0 * t * t * t;
     81            ta += 3.0 * u * u - 2.0 * u * u * u;
     82        }
     83
     84        out_FragColor = float4(tc * in_Color, ta + 0.1);
     85    }
     86    else
     87    {
     88        float2 texcoords = pass_Position * 0.5 + float2(0.5, 0.5);
     89        out_FragColor = float4(tex2D(in_Texture, texcoords).xyz, 1.0);
     90    }
    6691}
    6792
Note: See TracChangeset for help on using the changeset viewer.