Changeset 1774


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

gpu: finalise the framebuffer object Direct3D implementation.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gpu/framebuffer.cpp

    r1773 r1774  
    6565    if (FAILED(g_d3ddevice->CreateTexture(size.x, size.y, 1,
    6666                                          D3DUSAGE_RENDERTARGET,
    67                                           D3DFMT_R8G8B8, D3DPOOL_DEFAULT,
     67                                          D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,
    6868                                          &m_data->m_texture, NULL)))
    6969        Abort();
  • 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.