public override void SetSurfaceParams( ColorEx ambient, ColorEx diffuse, ColorEx specular, ColorEx emissive, float shininess, TrackVertexColor tracking )
{
// Track vertex colour
if ( tracking != TrackVertexColor.None )
{
All gt = All.Diffuse;
// There are actually 15 different combinations for tracking, of which
// GL only supports the most used 5. This means that we have to do some
// magic to find the best match. NOTE:
// GL_AMBIENT_AND_DIFFUSE != GL_AMBIENT | GL__DIFFUSE
if ( ( tracking & TrackVertexColor.Ambient ) != 0 )
{
if ( ( tracking & TrackVertexColor.Diffuse ) != 0 )
{
gt = All.AmbientAndDiffuse;
}
else
{
gt = All.Ambient;
}
}
else if ( ( tracking & TrackVertexColor.Diffuse ) != 0 )
{
gt = All.Diffuse;
}
else if ( ( tracking & TrackVertexColor.Specular ) != 0 )
{
gt = All.Emission;
}
OpenGL.Enable( gt );
GLESConfig.GlCheckError( this );
OpenGL.Enable( All.ColorMaterial );
GLESConfig.GlCheckError( this );
}
else
{
OpenGL.Disable( All.ColorMaterial );
}
// XXX Cache previous values?
// XXX Front or Front and Back?
float[] f4Val = new float[] { diffuse.r, diffuse.g, diffuse.b, diffuse.a };
OpenGL.Material( All.FrontAndBack, All.Diffuse, f4Val );
GLESConfig.GlCheckError( this );
f4Val[ 0 ] = ambient.r;
f4Val[ 1 ] = ambient.g;
f4Val[ 2 ] = ambient.b;
f4Val[ 3 ] = ambient.a;
OpenGL.Material( All.FrontAndBack, All.Ambient, f4Val );
GLESConfig.GlCheckError( this );
f4Val[ 0 ] = specular.r;
f4Val[ 1 ] = specular.g;
f4Val[ 2 ] = specular.b;
f4Val[ 3 ] = specular.a;
OpenGL.Material( All.FrontAndBack, All.Specular, f4Val );
GLESConfig.GlCheckError( this );
f4Val[ 0 ] = emissive.r;
f4Val[ 1 ] = emissive.g;
f4Val[ 2 ] = emissive.b;
f4Val[ 3 ] = emissive.a;
OpenGL.Material( All.FrontAndBack, All.Emission, f4Val );
GLESConfig.GlCheckError( this );
OpenGL.Material( All.FrontAndBack, All.Shininess, shininess );
GLESConfig.GlCheckError( this );
}
/// <summary>