本文整理汇总了C#中Axiom.Core.ColorEx.ToArrayRGBA方法的典型用法代码示例。如果您正苦于以下问题:C# ColorEx.ToArrayRGBA方法的具体用法?C# ColorEx.ToArrayRGBA怎么用?C# ColorEx.ToArrayRGBA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axiom.Core.ColorEx
的用法示例。
在下文中一共展示了ColorEx.ToArrayRGBA方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteRawConstant
public void WriteRawConstant( int physicalIndex, ColorEx color, int count )
#endif
{
// write either the number requested (for packed types) or up to 4
var arr = new float[4];
color.ToArrayRGBA( arr );
_writeRawConstants( physicalIndex, arr, Utility.Min( count, 4 ) );
}
示例2: SetTextureBorderColor
public override void SetTextureBorderColor( int stage, ColorEx borderColor )
{
borderColor.ToArrayRGBA( _tempColorVals );
if (ActivateGLTextureUnit(stage))
{
Gl.glTexParameterfv( textureTypes[ stage ], Gl.GL_TEXTURE_BORDER_COLOR, _tempColorVals );
ActivateGLTextureUnit( 0 );
}
}
示例3: SetFog
public override void SetFog(FogMode mode, ColorEx color, Real density, Real start, Real end)
{
int fogMode;
switch ( mode )
{
case FogMode.Exp:
fogMode = Gl.GL_EXP;
break;
case FogMode.Exp2:
fogMode = Gl.GL_EXP2;
break;
case FogMode.Linear:
fogMode = Gl.GL_LINEAR;
break;
default:
if ( fogEnabled )
{
Gl.glDisable( Gl.GL_FOG );
fogEnabled = false;
}
return;
} // switch
if (!fogEnabled)
{
Gl.glEnable( Gl.GL_FOG );
fogEnabled = true;
}
Gl.glFogi( Gl.GL_FOG_MODE, fogMode );
// fog color values
color.ToArrayRGBA( _tempColorVals );
Gl.glFogfv( Gl.GL_FOG_COLOR, _tempColorVals );
Gl.glFogf( Gl.GL_FOG_DENSITY, density );
Gl.glFogf( Gl.GL_FOG_START, start );
Gl.glFogf( Gl.GL_FOG_END, end );
// TODO: Fog hints maybe?
}
示例4: SetSurfaceParams
public override void SetSurfaceParams(ColorEx ambient, ColorEx diffuse, ColorEx specular,
ColorEx emissive, Real shininess, TrackVertexColor tracking)
{
if (tracking == TrackVertexColor.None)
{
var gt = Gl.GL_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 = Gl.GL_AMBIENT_AND_DIFFUSE;
}
else
{
gt = Gl.GL_AMBIENT;
}
}
else if ((tracking & TrackVertexColor.Diffuse) != 0)
{
gt = Gl.GL_DIFFUSE;
}
else if ((tracking & TrackVertexColor.Specular) != 0)
{
gt = Gl.GL_SPECULAR;
}
else if ((tracking & TrackVertexColor.Emissive) != 0)
{
gt = Gl.GL_EMISSION;
}
Gl.glColorMaterial(Gl.GL_FRONT_AND_BACK, gt);
Gl.glEnable(Gl.GL_COLOR_MATERIAL);
}
else
{
Gl.glDisable(Gl.GL_COLOR_MATERIAL);
}
var vals = _tempColorVals;
diffuse.ToArrayRGBA( vals );
Gl.glMaterialfv(Gl.GL_FRONT_AND_BACK, Gl.GL_DIFFUSE, vals);
ambient.ToArrayRGBA( vals );
Gl.glMaterialfv( Gl.GL_FRONT_AND_BACK, Gl.GL_AMBIENT, vals );
specular.ToArrayRGBA( vals );
Gl.glMaterialfv( Gl.GL_FRONT_AND_BACK, Gl.GL_SPECULAR, vals );
emissive.ToArrayRGBA(vals);
Gl.glMaterialfv( Gl.GL_FRONT_AND_BACK, Gl.GL_EMISSION, vals );
Gl.glMaterialf( Gl.GL_FRONT_AND_BACK, Gl.GL_SHININESS, shininess );
}
示例5: SetSurfaceParams
/// <summary>
///
/// </summary>
/// <param name="ambient"></param>
/// <param name="diffuse"></param>
/// <param name="specular"></param>
/// <param name="emissive"></param>
/// <param name="shininess"></param>
public override void SetSurfaceParams(ColorEx ambient, ColorEx diffuse, ColorEx specular, ColorEx emissive, float shininess)
{
float[] vals = tempColorVals;
// ambient
//if(lastAmbient == null || lastAmbient.CompareTo(ambient) != 0) {
ambient.ToArrayRGBA(vals);
Gl.glMaterialfv(Gl.GL_FRONT_AND_BACK, Gl.GL_AMBIENT, vals);
lastAmbient = ambient;
//}
// diffuse
//if(lastDiffuse == null || lastDiffuse.CompareTo(diffuse) != 0) {
vals[0] = diffuse.r; vals[1] = diffuse.g; vals[2] = diffuse.b; vals[3] = diffuse.a;
Gl.glMaterialfv(Gl.GL_FRONT_AND_BACK, Gl.GL_DIFFUSE, vals);
lastDiffuse = diffuse;
//}
// specular
//if(lastSpecular == null || lastSpecular.CompareTo(specular) != 0) {
vals[0] = specular.r; vals[1] = specular.g; vals[2] = specular.b; vals[3] = specular.a;
Gl.glMaterialfv(Gl.GL_FRONT_AND_BACK, Gl.GL_SPECULAR, vals);
lastSpecular = specular;
//}
// emissive
//if(lastEmissive == null || lastEmissive.CompareTo(emissive) != 0) {
vals[0] = emissive.r; vals[1] = emissive.g; vals[2] = emissive.b; vals[3] = emissive.a;
Gl.glMaterialfv(Gl.GL_FRONT_AND_BACK, Gl.GL_EMISSION, vals);
lastEmissive = emissive;
//}
// shininess
//if(lastShininess != shininess) {
Gl.glMaterialf(Gl.GL_FRONT_AND_BACK, Gl.GL_SHININESS, shininess);
lastShininess = shininess;
//}
}
示例6: SetNamedConstant
public void SetNamedConstant(string name, ColorEx value)
{
var floats = new float[4];
value.ToArrayRGBA( floats );
SetNamedConstant(name, floats);
}