﻿<?xml version="1.0" encoding="utf-8" ?>
<library version="1">
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="TransformPosition">
    <desc>
    This fragment is responsible for applying the view projection transform
    to the input position. Additionally, this fragment applies the world 
    transform to the input position. 
    </desc>
    <inputs>
        <resource type="float3" semantic="Position" label="Local" 
            variable="Position" />
        <resource type="float4x4" semantic="WorldMatrix" label="" 
            variable="World" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="Position" label="World" 
            variable="WorldPos" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    // Transform the position into world space for lighting, and projected 
    // space for display
    WorldPos = mul( float4(Position, 1.0f), World );
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="TransformSkinnedPosition">
    <desc>
    This fragment is responsible for applying the view projection and skinning 
    transform to the input position. Additionally, this fragment applies the 
    computed world transform to the input position. The weighted world 
    transform defined by the blendweights is output for use in normals or
    other calculations as the new world matrix.
    </desc>
    <inputs>
        <resource type="float3" semantic="Position" label="Local" 
            variable="Position" />
        <resource type="int4" semantic="BlendIndices" label="" 
            variable="BlendIndices" />
        <resource type="float4" semantic="BlendWeight" label="Local" 
            variable="BlendWeights" />
        <resource type="float4x3" count="30" semantic="SkinBoneMatrix" 
            label="World" variable="Bones" />
        <resource type="float4x4" semantic="WorldMatrix" label="" 
            variable="SkinToWorldTransform" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="Position" label="World" 
            variable="WorldPos" />
        <resource type="float4x4" semantic="WorldMatrix" label="" 
            variable="SkinBoneTransform" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    // TransformSkinnedPosition *********************************************
    // Transform the skinned position into world space
    // Composite the skinning transform which will take the vertex
    // and normal to world space.
    float fWeight3 = 1.0 - BlendWeights[0] - BlendWeights[1] - BlendWeights[2];
    float4x3 ShortSkinBoneTransform;
    ShortSkinBoneTransform  = Bones[BlendIndices[0]] * BlendWeights[0];
    ShortSkinBoneTransform += Bones[BlendIndices[1]] * BlendWeights[1];
    ShortSkinBoneTransform += Bones[BlendIndices[2]] * BlendWeights[2];
    ShortSkinBoneTransform += Bones[BlendIndices[3]] * fWeight3;
    SkinBoneTransform = float4x4(ShortSkinBoneTransform[0], 0.0f, 
        ShortSkinBoneTransform[1], 0.0f, 
        ShortSkinBoneTransform[2], 0.0f, 
        ShortSkinBoneTransform[3], 1.0f);

    // Transform into world space.
	WorldPos.xyz = mul(float4(Position, 1.0), ShortSkinBoneTransform);
	WorldPos = mul(float4(WorldPos.xyz, 1.0), SkinToWorldTransform);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="TransformSkinnedPositionNoIndices">
    <desc>
    This fragment is responsible for applying the view projection and skinning 
    transform to the input position. Additionally, this fragment applies the 
    computed world transform to the input position. The weighted world 
    transform defined by the blendweights is output for use in normals or
    other calculations as the new world matrix.
    </desc>
    <inputs>
        <resource type="float3" semantic="Position" label="Local" 
            variable="Position" />
        <resource type="float4" semantic="BlendWeight" label="Local" 
            variable="BlendWeights" />
        <resource type="float4x3" count="4" semantic="SkinBoneMatrix" 
            label="World" variable="Bones" />
        <resource type="float4x4" semantic="WorldMatrix" label="" 
            variable="SkinToWorldTransform" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="Position" label="World" 
            variable="WorldPos" />
        <resource type="float4x4" semantic="WorldMatrix" label="" 
            variable="SkinBoneTransform" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    // TransformSkinnedPosition *********************************************
    // Transform the skinned position into world space
    // Composite the skinning transform which will take the vertex
    // and normal to world space.
    float fWeight3 = 1.0 - BlendWeights[0] - BlendWeights[1] - BlendWeights[2];
    float4x3 ShortSkinBoneTransform;
    ShortSkinBoneTransform  = Bones[0] * BlendWeights[0];
    ShortSkinBoneTransform += Bones[1] * BlendWeights[1];
    ShortSkinBoneTransform += Bones[2] * BlendWeights[2];
    ShortSkinBoneTransform += Bones[3] * fWeight3;
    SkinBoneTransform = float4x4(ShortSkinBoneTransform[0], 0.0f, 
        ShortSkinBoneTransform[1], 0.0f, 
        ShortSkinBoneTransform[2], 0.0f, 
        ShortSkinBoneTransform[3], 1.0f);

    // Transform into world space.
	WorldPos.xyz = mul(float4(Position, 1.0), ShortSkinBoneTransform);
	WorldPos = mul(float4(WorldPos.xyz, 1.0), SkinToWorldTransform);

    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="ProjectPositionWorldToProj">
    <desc>
    This fragment is responsible for applying the view projection transform
    to the input world position.
    </desc>
    <inputs>
        <resource type="float4" semantic="Position" label="World" 
        variable="WorldPosition" />
        <resource type="float4x4" semantic="ViewProjMatrix" label="" 
        variable="ViewProjection" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="Position" label="Proj" 
        variable="ProjPos" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    ProjPos = mul(WorldPosition, ViewProjection );
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="ProjectPositionWorldToViewToProj">
    <desc>
    This fragment is responsible for applying the view projection transform
    to the input world position.
    </desc>
    <inputs>
        <resource type="float4" semantic="Position" label="World" 
        variable="WorldPosition" />
        <resource type="float4x4" semantic="ViewMatrix" label="" 
        variable="ViewTransform" />
        <resource type="float4x4" semantic="ProjMatrix" label="" 
        variable="ProjTransform" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="Position" label="View" 
        variable="ViewPos" />
        <resource type="float4" semantic="Position" label="Proj" 
        variable="ProjPos" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    ViewPos = mul(WorldPosition, ViewTransform );
    ProjPos = mul(ViewPos, ProjTransform );
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="CalculateViewVector">
    <desc>
    This fragment is responsible for calculating the camera view vector.
    </desc>
    <inputs>
        <resource type="float4" semantic="Position" label="World" 
            variable="WorldPos" />
        <resource type="float3" semantic="CameraPosition" label="World" 
            variable="CameraPos" default="(0.0, 0.0, 0.0)" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="ViewVector" label="World" 
            variable="WorldViewVector"/>
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    WorldViewVector = CameraPos - WorldPos;
    </code>
</fragment>	  	
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="AddFloat4">
    <desc>
    This fragment is responsible for adding two float4's.   
    </desc>
    <inputs>
        <resource type="float4" semantic="" label="" 
            variable="V1" />
        <resource type="float4" semantic="" label="" 
            variable="V2" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = V1 + V2;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="AddFloat3">
    <desc>
    This fragment is responsible for adding two float3's.   
    </desc>
    <inputs>
        <resource type="float3" semantic="" label="" 
            variable="V1" />
        <resource type="float3" semantic="" label="" 
            variable="V2" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = V1 + V2;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="AddFloat2">
    <desc>
    This fragment is responsible for adding two float2's.   
    </desc>
    <inputs>
        <resource type="float2" semantic="" label="" 
            variable="V1" />
        <resource type="float2" semantic="" label="" 
            variable="V2" />
    </inputs>
    <outputs>
        <resource type="float2" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = V1 + V2;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="AddFloat">
    <desc>
    This fragment is responsible for adding two floats.   
    </desc>
    <inputs>
        <resource type="float" semantic="" label="" 
            variable="V1" />
        <resource type="float" semantic="" label="" 
            variable="V2" />
    </inputs>
    <outputs>
        <resource type="float" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = V1 + V2;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="MultiplyFloat4">
    <desc>
    This fragment is responsible for multiplying two float4's.   
    </desc>
    <inputs>
        <resource type="float4" semantic="" label="" 
            variable="V1" />
        <resource type="float4" semantic="" label="" 
            variable="V2" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = V1 * V2;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="MultiplyFloat3">
    <desc>
    This fragment is responsible for multiplying two float3's.   
    </desc>
    <inputs>
        <resource type="float3" semantic="" label="" 
            variable="V1" />
        <resource type="float3" semantic="" label="" 
            variable="V2" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = V1 * V2;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="MultiplyFloat2">
    <desc>
    This fragment is responsible for multiplying two float2's.   
    </desc>
    <inputs>
        <resource type="float2" semantic="" label="" 
            variable="V1" />
        <resource type="float2" semantic="" label="" 
            variable="V2" />
    </inputs>
    <outputs>
        <resource type="float2" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = V1 * V2;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="MultiplyFloat">
    <desc>
    This fragment is responsible for multiplying two floats.   
    </desc>
    <inputs>
        <resource type="float" semantic="" label="" 
            variable="V1" />
        <resource type="float" semantic="" label="" 
            variable="V2" />
    </inputs>
    <outputs>
        <resource type="float" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = V1 * V2;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="ScaleFloat4">
    <desc>
    This fragment is responsible for scaling a float4 by a constant.     
    </desc>
    <inputs>
        <resource type="float4" semantic="" label="" 
            variable="V1" />
        <resource type="float" semantic="" label="" 
            variable="Scale" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = Scale * V1;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="ScaleFloat3">
    <desc>    
    This fragment is responsible for scaling a float3 by a constant.   
    </desc>
    <inputs>
        <resource type="float3" semantic="" label="" 
            variable="V1" />
        <resource type="float" semantic="" label="" 
            variable="Scale" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = Scale * V1;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="ScaleFloat2">
    <desc>
    This fragment is responsible for scaling a float2 by a constant.   
    </desc>
    <inputs>
        <resource type="float2" semantic="" label="" 
            variable="V1" />
        <resource type="float" semantic="" label="" 
            variable="Scale" />
    </inputs>
    <outputs>
        <resource type="float2" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = Scale * V1;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="SaturateFloat4">
    <desc>
    This fragment is responsible for saturating a float4.   
    </desc>
    <inputs>
        <resource type="float4" semantic="" label="" 
            variable="V1" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = saturate(V1);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="SaturateFloat3">
    <desc>
    This fragment is responsible for saturating a float3.   
    </desc>
    <inputs>
        <resource type="float3" semantic="" label="" 
            variable="V1" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = saturate(V1);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="SaturateFloat2">
    <desc>
    This fragment is responsible for saturating a float2.   
    </desc>
    <inputs>
        <resource type="float2" semantic="" label="" 
            variable="V1" />
    </inputs>
    <outputs>
        <resource type="float2" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = saturate(V1);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="SaturateFloat">
    <desc>
    This fragment is responsible for saturating a float.   
    </desc>
    <inputs>
        <resource type="float" semantic="" label="" 
            variable="V1" />
    </inputs>
    <outputs>
        <resource type="float" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = saturate(V1);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="LerpFloat4">
    <desc>
    This fragment is responsible for linearly interpolating two float4's.   
    </desc>
    <inputs>
        <resource type="float4" semantic="" label="" 
            variable="V1" />
        <resource type="float4" semantic="" label="" 
            variable="V2" />
        <resource type="float" semantic="" label="" 
            variable="LerpAmount" default="(0.5)" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = lerp(V1, V2, LerpAmount);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="LerpFloat3">
    <desc>
    This fragment is responsible for linearly interpolating two float3's.   
    </desc>
    <inputs>
        <resource type="float3" semantic="" label="" 
            variable="V1" />
        <resource type="float3" semantic="" label="" 
            variable="V2" />
        <resource type="float" semantic="" label="" 
            variable="LerpAmount" default="(0.5)" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = lerp(V1, V2, LerpAmount);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="LerpFloat2">
    <desc>
    This fragment is responsible for linearly interpolating two float2's.   
    </desc>
    <inputs>
        <resource type="float2" semantic="" label="" 
            variable="V1" />
        <resource type="float2" semantic="" label="" 
            variable="V2" />
        <resource type="float" semantic="" label="" 
            variable="LerpAmount" default="(0.5)" />
    </inputs>
    <outputs>
        <resource type="float2" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = lerp(V1, V2, LerpAmount);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="LerpFloat">
    <desc>
    This fragment is responsible for linearly interpolating two floats.   
    </desc>
    <inputs>
        <resource type="float" semantic="" label="" 
            variable="V1" />
        <resource type="float" semantic="" label="" 
            variable="V2" />
        <resource type="float" semantic="" label="" 
            variable="LerpAmount" default="(0.5)" />
    </inputs>
    <outputs>
        <resource type="float" semantic="" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Output = lerp(V1, V2, LerpAmount);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="NormalizeFloat4">
    <desc>
    This fragment is responsible for normalizing a float4.
    </desc>
    <inputs>
        <resource type="float4" semantic="" label="" 
            variable="VectorIn" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="" label="" 
            variable="VectorOut" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    VectorOut = normalize(VectorIn);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="NormalizeFloat2">
    <desc>
    This fragment is responsible for normalizing a float2.
    </desc>
    <inputs>
        <resource type="float2" semantic="" label="" 
            variable="VectorIn" />
    </inputs>
    <outputs>
        <resource type="float2" semantic="" label="" 
            variable="VectorOut" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    VectorOut = normalize(VectorIn);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="NormalizeFloat3">
    <desc>
    This fragment is responsible for normalizing a float3.
    </desc>
    <inputs>
        <resource type="float3" semantic="" label="" 
            variable="VectorIn" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="" label="" 
            variable="VectorOut" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    VectorOut = normalize(VectorIn);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="MultiplyAddFloat3">
    <desc>
    This fragment implements the equation:
    Output = (V1 * V2) + V3
    </desc>
    <inputs>
        <resource type="float3" semantic="Color" label="" 
            variable="V1" default="(1.0, 1.0, 1.0)"/>
        <resource type="float3" semantic="Color" label="" 
            variable="V2" default="(1.0, 1.0, 1.0)"/>
        <resource type="float3" semantic="Scalar" label=""
            variable="V3" default="(1.0, 1.0, 1.0)" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = (V1 * V2) + V3;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="FloatToFloat3">
    <desc>
    This fragment implements the operation:
    Output = float3(Input, Input, Input);
    </desc>
    <inputs>
        <resource type="float" semantic="" label="" 
            variable="Input" default="(1.0)"/>
    </inputs>
    <outputs>
        <resource type="float3" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = Input.rrr;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="FloatToFloat4">
    <desc>
    This fragment implements the operation:
    Output = float4(Input, Input, Input, Input);
    </desc>
    <inputs>
        <resource type="float" semantic="" label="" 
            variable="Input" default="(1.0)"/>
    </inputs>
    <outputs>
        <resource type="float4" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = Input.rrrr;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="Float4ToFloat">
    <desc>
    This fragment implements the operation:
    Output = Input.r;
    </desc>
    <inputs>
        <resource type="float4" semantic="" label="" 
            variable="Input" default="(1.0, 1.0, 1.0, 1.0)"/>
    </inputs>
    <outputs>
        <resource type="float" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = Input.r;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="Float3ToFloat">
    <desc>
    This fragment implements the operation:
    Output = Input.r;
    </desc>
    <inputs>
        <resource type="float3" semantic="" label="" 
            variable="Input" default="(1.0, 1.0, 1.0, 1.0)"/>
    </inputs>
    <outputs>
        <resource type="float" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = Input.r;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel" name="WriteDepthToColor">
    <desc>
    This fragment writes projected depth to all color component outputs.
    </desc>
    <inputs>
        <resource type="float4" semantic="Position" label="Proj" 
            variable="WorldPosProjected" />
        <resource type="float3" semantic="ViewVector" label="World" 
            variable="WorldViewVector" /> 
    </inputs>
    <outputs>
        <resource type="float4" semantic="Color" label="" 
            variable="OutputColor" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
        
    float Depth = WorldPosProjected.z / WorldPosProjected.w;    
    OutputColor.x = Depth;
    OutputColor.yzw = 1.0f;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel" name="WriteVSMDepthToColor">
    <desc>
    This fragment writes projected depth to all color component outputs.
    </desc>
    <inputs>
        <resource type="float4" semantic="Position" label="Proj" 
            variable="WorldPosProjected" />
        <resource type="float3" semantic="ViewVector" label="World" 
            variable="WorldViewVector" /> 
    </inputs>
    <outputs>
        <resource type="float4" semantic="Color" label="" 
            variable="OutputColor" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    float Depth = WorldPosProjected.z / WorldPosProjected.w;
            
    OutputColor.x = Depth;
    OutputColor.y = Depth * Depth;
    OutputColor.zw = 1.0;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name ="TeeFloat4">
    <desc>
      This fragment splits and passes through a single float4 input into two
      float4 outputs.
    </desc>
    <inputs>
      <resource type="float4" semantic="" label="" variable="Input" />
    </inputs>
    <outputs>
      <resource type="float4" semantic="" label="" variable="Output1" />
      <resource type="float4" semantic="" label="" variable="Output2" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
      Output1 = Input;
      Output2 = Input;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel" name="TextureRGBSample">
    <desc>
    This fragment is responsible for sampling a texture and returning its value
    as a RGB value.
    </desc>
    <inputs>
        <resource type="float2" semantic="TexCoord" label="" 
            variable="TexCoord" />
        <resource type="sampler2D" semantic="Texture" label="" 
            variable="Sampler" />
        <resource type="bool" semantic="" label="" 
            variable="Saturate" default="(true)" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="Color" label="" 
            variable="ColorOut" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    ColorOut.rgb = tex2D(Sampler, TexCoord).rgb;
    if (Saturate)
    {
        ColorOut.rgb = saturate(ColorOut.rgb);
    }
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel" name="TextureRGBASample">
    <desc>
    This fragment is responsible for sampling a texture and returning its value
    as a RGB value and an A value.
    </desc>
    <inputs>
        <resource type="float2" semantic="TexCoord" label="" 
            variable="TexCoord" />
        <resource type="sampler2D" semantic="Texture" label="" 
            variable="Sampler" />
        <resource type="bool" semantic="" label="" 
            variable="Saturate" default="(true)" />
    </inputs>
    <outputs>
        <resource type="float4" semantic="Color" label="" 
            variable="ColorOut" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    ColorOut = tex2D(Sampler, TexCoord);
    if (Saturate)
    {
        ColorOut = saturate(ColorOut);
    }
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel" name="TextureRGBProjectSample">
    <desc>
    This fragment is responsible for sampling a texture and returning its value
    as a RGB value and an A value.
    </desc>
    <inputs>
        <resource type="float3" semantic="TexCoord" label="" 
            variable="TexCoord" />
        <resource type="sampler2D" semantic="Texture" label="" 
            variable="Sampler" />
        <resource type="bool" semantic="" label="" 
            variable="Saturate" default="(true)" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="Color" label="" 
            variable="ColorOut" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    float4 ProjTexCoord = TexCoord.xyzz;
    ColorOut.rgb = tex2Dproj(Sampler, ProjTexCoord).rgb;
    if (Saturate)
    {
        ColorOut.rgb = saturate(ColorOut.rgb);
    }
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel" name="TextureRGBCubeSample">
    <desc>
    This fragment is responsible for sampling a texture and returning its value
    as a RGB value.
    </desc>
    <inputs>
        <resource type="float3" semantic="TexCoord" label="" 
            variable="TexCoord" />
        <resource type="samplerCUBE" semantic="Texture" label="" 
            variable="Sampler" />
        <resource type="bool" semantic="" label="" 
            variable="Saturate" default="(true)" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="Color" label="" 
            variable="ColorOut" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    ColorOut.rgb = texCUBE(Sampler, TexCoord).rgb;
    if (Saturate)
    {
        ColorOut.rgb = saturate(ColorOut.rgb);
    }
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Pixel/Vertex" name="SplitColorAndOpacity">
    <desc>
    Separate a float4 into a float3 and a float.   
    </desc>
    <inputs>
        <resource type="float4" semantic="Color" label="" 
            variable="ColorAndOpacity" default="(1.0, 1.0, 1.0, 1.0)" />
    </inputs>
    <outputs>
        <resource type="float3" semantic="Color" label="" 
            variable="Color" />
        <resource type="float" semantic="Opacity" label="" 
            variable="Opacity" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" 
          target="vs_1_1/ps_2_0/vs_4_0/ps_4_0">
    Color.rgb = ColorAndOpacity.rgb;
    Opacity = ColorAndOpacity.a;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex" name="ApplyAlphaTest">
    <desc>
    This fragment is responsible for alpha testing based on the alpha
    reference value and alpha test function.
    </desc>
    <inputs>
        <resource type="float" semantic="Alpha" label="" 
            variable="AlphaTestValue" default="(1.0)" />
        <resource type="float3" semantic="Function" label="" 
            variable="AlphaTestFunction" default="(0.0, 0.0, 0.0)"/>
        <resource type="float" semantic="Fog" label="" 
            variable="AlphaTestRef" default="(0.0)"/>
    </inputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    // These tests will evaluate to less than 0 if they are true.
    float fLessTest = (AlphaTestValue - AlphaTestRef);
    float fGreaterTest = -fLessTest;
    float fEqualTest = 0.0;
    if (fLessTest == 0.0)
        fEqualTest = -1.0;

    // Clip if AlphaTestValue &lt; AlphaTestRef for:
    //  TEST_LESS 
    //  TEST_EQUAL 
    //  TEST_LESSEQUAL 
    clip(fGreaterTest * AlphaTestFunction.x);
    
    // Clip if AlphaTestValue &gt; AlphaTestRef for:
    //  TEST_EQUAL 
    //  TEST_GREATER 
    //  TEST_GREATEREQUAL 
    clip(fLessTest * AlphaTestFunction.y);
    
    // Clip if AlphaTestValue == AlphaTestRef for:
    //  TEST_LESS 
    //  TEST_GREATER 
    //  TEST_NOTEQUAL 
    clip(fEqualTest * AlphaTestFunction.z);
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="FloatToFloat3">
    <desc>
    This fragment implements the operation:
    Output = float3(Input, Input, Input);
    </desc>
    <inputs>
        <resource type="float" semantic="" label="" 
            variable="Input" default="(1.0)"/>
    </inputs>
    <outputs>
        <resource type="float3" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = Input.rrr;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="FloatToFloat4">
    <desc>
    This fragment implements the operation:
    Output = float4(Input, Input, Input, Input);
    </desc>
    <inputs>
        <resource type="float" semantic="" label="" 
            variable="Input" default="(1.0)"/>
    </inputs>
    <outputs>
        <resource type="float4" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = Input.rrrr;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="Float4ToFloat">
    <desc>
    This fragment implements the operation:
    Output = Input.r;
    </desc>
    <inputs>
        <resource type="float4" semantic="" label="" 
            variable="Input" default="(1.0, 1.0, 1.0, 1.0)"/>
    </inputs>
    <outputs>
        <resource type="float" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = Input.r;
    </code>
</fragment>
<!--========================================================================-->
<fragment type="Vertex/Pixel" name="Float3ToFloat">
    <desc>
    This fragment implements the operation:
    Output = Input.r;
    </desc>
    <inputs>
        <resource type="float3" semantic="" label="" 
            variable="Input" default="(1.0, 1.0, 1.0, 1.0)"/>
    </inputs>
    <outputs>
        <resource type="float" semantic="Color" label="" 
            variable="Output" />
    </outputs>
    <code lang="hlsl/Cg" platform="D3D10/DX9/Xenon/PS3" target="ps_2_0/ps_4_0">
    Output = Input.r;
    </code>
</fragment>
<!--========================================================================-->
</library>
