本文整理汇总了C#中Color.ToVector4方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToVector4方法的具体用法?C# Color.ToVector4怎么用?C# Color.ToVector4使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color.ToVector4方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectColorBox
public SelectColorBox(TextBoxEnterEvent e, Color c)
: base("", "", e, -1, Keys.Enter)
{
this.size = new Vector2(320, 256);
Center();
r = new ColorDial(this.position + new Vector2((SPACE / (BARS + 1)) * 1 + 0 * (this.size.X - SPACE) / BARS , 8), new Vector2((this.size.X - SPACE) / BARS, this.size.Y - 48), Color.Red, c.ToVector4().X);
g = new ColorDial(this.position + new Vector2((SPACE / (BARS + 1)) * 2 + 1 * (this.size.X - SPACE) / BARS, 8), new Vector2((this.size.X - SPACE) / BARS, this.size.Y - 48), Color.Green, c.ToVector4().Y);
b = new ColorDial(this.position + new Vector2((SPACE / (BARS + 1)) * 3 + 2 * (this.size.X - SPACE) / BARS, 8), new Vector2((this.size.X - SPACE) / BARS, this.size.Y - 48), Color.Blue, c.ToVector4().Z);
a = new ColorDial(this.position + new Vector2((SPACE / (BARS + 1)) * 4 + 3 * (this.size.X - SPACE) / BARS, 8), new Vector2((this.size.X - SPACE) / BARS, this.size.Y - 48), Color.Gray, c.ToVector4().W);
}
示例2: Triangle
public Triangle( Vector3 p1, Vector3 p2, Vector3 p3, Color color ) {
myColor = color.ToVector4();
InitEffect();
SetUpVertices( p1, p2, p3, color );
SetUpIndices();
Update();
}
示例3: SetStates
//public void BeginWire()
//{
// graphics.RasterizerState = wire;
//}
void SetStates(Color color, Vector2 targetSize)
{
graphics.RasterizerState = wire;
effectColor.SetValue(color.ToVector4());
effectSize.SetValue(new Vector2(1f / targetSize.X, 1f / targetSize.Y));
effect.CurrentTechnique.Passes[0].Apply();
}
示例4: MultiplyBlend
public static Color MultiplyBlend(Color a, Color b)
{
Vector4 av = a.ToVector4();
Vector4 bv = b.ToVector4();
return new Color(av * bv);
}
示例5: BlockVertex
public BlockVertex(Vector3 position, HalfVector2 blockTextureCoordinate, HalfVector4 light, Color tint)
{
m_position = position;
m_blockTextureCoordinate = blockTextureCoordinate;
m_light = light;
m_tint = new HalfVector4(tint.ToVector4());
}
示例6: Multiply
public static Color Multiply(Color color1, Color color2)
{
Vector4 v1 = color1.ToVector4();
Vector4 v2 = color2.ToVector4();
return new Color(v1.X * v2.X, v1.Y * v2.Y, v1.Z * v2.Z, v1.W * v2.W);
}
示例7: initialize
public void initialize( string name, Vector3 position, Vector3 direction, Color color, float scaleModifier = 1.0f, int nParticlesModifier = 0, float lifetimeModifier = 0.0f)
{
particles.Clear();
data = ParticleManager.Instance.getBaseParticleSystemData(name);
this.position = position;
this.direction = direction;
// modify the base data with the parameters
if (nParticlesModifier != 0)
{
data.nParticles = nParticlesModifier;
}
if (lifetimeModifier != 0.0f)
{
data.systemLife = lifetimeModifier;
data.particlesLife = lifetimeModifier;
}
data.size *= scaleModifier;
data.sizeIni *= scaleModifier;
data.sizeEnd *= scaleModifier;
data.positionVarianceMin *= scaleModifier;
data.positionVarianceMax *= scaleModifier;
data.directionVarianceMin *= scaleModifier;
data.directionVarianceMax *= scaleModifier;
data.accelerationVarianceMin *= scaleModifier;
data.accelerationVarianceMax *= scaleModifier;
data.color = new Color(data.color.ToVector4() * color.ToVector4());
// get an aproximate number of the simultaneous particles that will have the system
float spawnRatio = data.particlesLife / (float)data.nParticles;
particles.Capacity = data.nParticles;
switch(data.type)
{
case ParticleSystemData.tParticleSystem.Burst:
for(int i=0; i<data.nParticles; i++)
{
Particle p = new Particle();
p.isDead = true;
initializeParticle(p);
particles.Add(p);
}
break;
case ParticleSystemData.tParticleSystem.Fountain:
for(int i=0; i<data.nParticles; i++)
{
Particle p = new Particle();
// we want particles prepared to be spawned with the spawnRatio ratio, so we set'em all alive but invisible
p.life = 1.3f + spawnRatio * i;
p.isDead = false;
p.color *= 0;
particles.Add(p);
}
break;
default:
break;
}
}
示例8: structVertex
public structVertex(Vector4 CoordVertex, Vector2 CoordTex, Vector4 Normale, Color Couleur, Vector4 Tangent)
{
this.CoordTex = CoordTex;
this.CoordVertex = CoordVertex;
this.Normale = Normale;
this.Couleur = Couleur.ToVector4();
this.Tangent = Tangent;
}
示例9: Spark
public Spark(Texture2D Texture, int From, int To, float Time, Color color)
{
start = From;
end = To;
time = Time;
parameter = 0.0f;
Color = color.ToVector4();
}
示例10: GetColor
public override Color GetColor(Player player, Color lightColor)
{
bool lighting = true;
Color color = _colorProcessor(player, player.hairColor, ref lighting);
if (lighting)
return new Color(color.ToVector4() * lightColor.ToVector4());
return color;
}
示例11: DrawText
/// <summary>
/// Drawn text using given font, position and color
/// </summary>
public void DrawText(FontType font, String text, Vector2 position, Color color, bool dropShadow)
{
if (mIsTextModeActive)
{
if (dropShadow)
mSpriteBatch.DrawString(Fonts[(int)font], text, position + mDropShadowOffset, new Color(color.ToVector4() * new Vector4(0, 0, 0, 1)));
mSpriteBatch.DrawString(Fonts[(int)font], text, position, color);
}
}
示例12: GetColor
public override Color GetColor(Player player, Color lightColor)
{
bool flag = true;
Color result = this._colorProcessor(player, player.hairColor, ref flag);
if (flag)
{
return new Color(result.ToVector4() * lightColor.ToVector4());
}
return result;
}
示例13: Create
public static Texture2D Create(GraphicsDevice graphicsDevice, int width = 1, int height = 1, Color color = new Color())
{
var texture = new Texture2D(graphicsDevice,
width,
height);
var colors = new Color[width * height];
for (var i = 0; i < colors.Length; i++) colors[i] = new Color(color.ToVector4());
texture.SetData(colors);
return texture;
}
示例14: AddLine
// Add 3d line into cache, so then we can draw many lines at once - by calling DrawLinesFromCache()
public static void AddLine(Vector3 pointFrom, Vector3 pointTo, Color colorFrom, Color colorTo)
{
MyCommonDebugUtils.AssertDebug(IsFull(0) == false);
if (m_linesCount + 2 >= MyDebugDrawCachedLinesConstants.MAX_LINES_IN_CACHE)
return;
m_verticesLine[m_linesCount * 2 + 0].Position = pointFrom;
m_verticesLine[m_linesCount * 2 + 0].Color = colorFrom.ToVector4();
m_verticesLine[m_linesCount * 2 + 1].Position = pointTo;
m_verticesLine[m_linesCount * 2 + 1].Color = colorTo.ToVector4();
m_linesCount++;
}
示例15: ColorMorph
//int colormixer = NewImage(1, 1);
Color ColorMorph(Color col1, Color col2, int step, int totalsteps)
{
float factor = step / (float)totalsteps;
var vcol1 = col1.ToVector4();
var vcol2 = col2.ToVector4();
var result = vcol1 * (1-factor) + vcol2 * factor;
result.W = 1;
return new Color(result);
//SetPixel(0, 0, col1, colormixer);
//SetLucent(100 - (step * 100 / totalsteps));
//SetPixel(0, 0, col2, colormixer);
//SetLucent(0);
//return GetPixel(0, 0, colormixer);
}