Sophie

Sophie

distrib > * > cooker > x86_64 > by-pkgid > 0243c8b7bca94179c78b9bd6ac76c033 > files > 425

cg-examples-3.0.0018-0.1.x86_64.rpm


// texture_array.cgfx - CgFX file demonstrating texture arrays

void offset_layer(float2 position  : POSITION,
                  float3 texcoord  : TEXCOORD0,
                     
                  out float4 oPosition : POSITION,
                  out float3 oTexCoord : TEXCOORD0,
          
                  uniform float layerOffset)
{
  oPosition = float4(position,0,1);
  oTexCoord = texcoord;
  oTexCoord.z += layerOffset;
}

sampler2DARRAY decalArray = sampler_state {    
    MinFilter = LinearMipMapLinear;
};

float4 choose_decal(float3 texcoord : TEXCOORD0) : COLOR
{
  return tex2DARRAY(decalArray, texcoord);
}

float LayerOffset;

technique texture_array
{
    pass
    {
        VertexProgram   = compile gp4vp offset_layer( LayerOffset );
        FragmentProgram = compile gp4fp choose_decal();
    }
}