All pastes #549391 Raw Edit

Chao7

public text v1 · immutable
·published 2007-06-08 03:12 UTC
rendered paste body
//#include "common.h"
//#include "lmodel.h"
//#include "shadow.h"

//
// Parameters:
//
//   float4 Ldynamic_color;
//   float4 Ldynamic_dir;
//   float3 T;
//   float4x4 m_shadow;
//   float3x4 m_sunmask;
//   sampler_2D s_accumulator;
//   sampler_2D s_lmap;
//   sampler_t2D s_normal;
//   sampler_2D s_position;
//   sampler_2D s_smap;
//
//
// Registers:
//
//   Name           Reg   Size
//   -------------- ----- ----
//   m_sunmask      c0       4
//   m_shadow       c4       4
//   Ldynamic_color c8       1
//   Ldynamic_dir   c9       1
//   T              c10      1
//   s_smap         s0       1
//   s_position     s1       1
//   s_normal       s2       1
//   s_lmap         s3       1
//   s_accumulator  s4       1
//

float4 Ldynamic_color;
float4 Ldynamic_dir;
float3 T;
float4x4 m_shadow;
float3x4 m_sunmask;
uniform sampler2D s_accumulator;
uniform sampler2D s_lmap;
uniform sampler2D s_normal;
uniform sampler2D s_position;
uniform sampler2D s_smap;

float4 main( float2 tc : TEXCOORD0 ) : COLOR {
    const float4 _11 = {1, 10, 1.53846157, -1};
    const float4 _12 = {-0.000585937523, 0, 1, 1024};
    const float4 _13 = {1.44269502, 0.625, 0.400000006, 0.600000024};
    const float4 _14 = {0.000585937523, -0.000585937523, 0.25, 0};

    float4 a, b, c, d, e;

    texld a, tc, s_position
    b = a.y * m_shadow[1]
    b = m_shadow[0] * a.x + b
    b = m_shadow[2] * a.z + b
    b = b + m_shadow[3]
    rcp a.w, b.w
    c.xy = b * a.w + _12.x
    texld d, c, s_smap
    c.xy = c * _12.w
    d = b.z * a.w + -d
    cmp d, d, _12.y, _12.z
    frc c.xy, c
    add_pp c.zw, -c.xyxy, _11.x
    e = ((half)c.xyyw) * ((half)c.wzxz)
    dp4_pp b.w, d, e
    c.xy = b * a.w + _14
    texld d, c, s_smap
    c.xy = c * _12.w
    d = b.z * a.w + -d
    cmp d, d, _12.y, _12.z
    frc c.xy, c
    add_pp c.zw, -c.xyxy, _11.x
    e = ((half)c.xyyw) * ((half)c.wzxz)
    dp4_pp c.x, d, e
    add_pp b.w, b.w, c.x
    c.xy = b * a.w + _14.yxzw
    texld d, c, s_smap
    c.xy = c * _12.w
    d = b.z * a.w + -d
    cmp d, d, _12.y, _12.z
    frc c.xy, c
    add_pp c.zw, -c.xyxy, _11.x
    e = ((half)c.xyyw) * ((half)c.wzxz)
    dp4_pp c.x, d, e
    add_pp b.w, b.w, c.x
    b.xy = b * a.w + -_12.x
    texld c, b, s_smap
    b.xy = b * _12.w
    c = b.z * a.w + -c
    cmp c, c, _12.y, _12.z
    frc b.xy, b
    add_pp d.xy, -b, _11.x
    e.xy = ((half)b) * ((half)d.yxzw)
    e.z = ((half)b.y) * ((half)b.x)
    e.w = ((half)d.y) * ((half)d.x)
    dp4_pp a.w, c, e
    add_pp a.w, b.w, a.w
    b.xy = a.y * m_sunmask[1]
    b.xy = m_sunmask[0] * a.x + b
    b.xy = m_sunmask[2] * a.z + b
    b.xy = b + m_sunmask[3]
    texld_pp b, b, s_lmap
    a.w = ((half)a.w) * ((half)b.w)
    a.w = ((half)a.w) * ((half)_14.z)
    dp3_pp b.x, a, a
    rsq_pp b.x, b.x
    mad_pp a.xyz, a, -b.x, -Ldynamic_dir
    dp3_pp b.x, a, a
    rsq_pp b.x, b.x
    texld_pp c, v_TEXCOORD0, s_normal
    nrm_pp d.xyz, c
    dp3_sat_pp b.y, d, -Ldynamic_dir
    c.xyz = d * b.y
    a.xyz = a * b.x + -c
    nrm c.xyz, a
    dp3 a.x, T, c
    a.y = -a.x + _11.x
    a.y = a.y * _11.y
    a.x = a.x * _11.z + a.y
    a.y = b.y + _11.w
    a.x = a.x * a.y
    rcp a.y, b.y
    a.x = a.x * a.y
    a.x = a.x * _13.x
    exp a.x, a.x
    a.x = b.y * a.x
    a.y = b.y * b.y
    a.x = a.x * _13.y + a.y
    mad_sat a.y, b.y, _13.z, _13.w
    a.y = b.y * a.y
    mad_pp a.x, a.y, -Ldynamic_dir.w, a.x
    b = ((half)a.x) * ((half)Ldynamic_color)
    texld_pp c, v_TEXCOORD0, s_accumulator
    mad_pp result, b, a.w, c
}