public override void SetVertexTexture( int stage, Texture texture )
{
if ( texture == null )
{
if ( _texStageDesc[ stage ].vertexTex != null )
{
var result = ActiveD3D9Device.SetTexture( ( (int)VertexTextureSampler.Sampler0 ) + stage, null );
if ( result.IsFailure )
{
throw new AxiomException( "Unable to disable vertex texture '{0}' in D3D9.", stage );
}
}
_texStageDesc[ stage ].vertexTex = null;
}
else
{
var dt = (D3DTexture)texture;
// note used
dt.Touch();
var ptex = dt.DXTexture;
if ( _texStageDesc[ stage ].vertexTex != ptex )
{
var result = ActiveD3D9Device.SetTexture(((int)VertexTextureSampler.Sampler0) + stage, ptex);
if ( result.IsFailure )
{
throw new AxiomException("Unable to set vertex texture '{0}' in D3D9.", dt.Name);
}
}
_texStageDesc[ stage ].vertexTex = ptex;
}
}