本文整理汇总了C#中Color.ToVector3方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToVector3方法的具体用法?C# Color.ToVector3怎么用?C# Color.ToVector3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color.ToVector3方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(Matrix world, Matrix view, Matrix projection, Color newcolor, float scale, float hoveringHeight)
{
// Set BasicEffect parameters.
Matrix worldMatrix = Matrix.CreateScale(scale) *
Matrix.CreateRotationX((float)(Math.PI)) *
Matrix.CreateTranslation(new Vector3(0, 0, hoveringHeight)) *
world;
basicEffect.World = worldMatrix;
basicEffect.View = view;
basicEffect.Projection = projection;
basicEffect.DiffuseColor = newcolor.ToVector3();
// basicEffect.VertexColorEnabled = true;
//basicEffect.Alpha = color.A / 255.0f;
basicEffect.EmissiveColor = newcolor.ToVector3();
GraphicsDevice device = basicEffect.GraphicsDevice;
device.DepthStencilState = DepthStencilState.Default;
device.BlendState = BlendState.AlphaBlend;
// Draw the model, using BasicEffect.
foreach (ModelMesh mesh in ship.Meshes)
{
mesh.Draw();
}
}
示例2: Draw
public static void Draw(Matrix world, Matrix view, Matrix projection, Color newcolor, float scale)
{
// Set BasicEffect parameters.
basicEffect.World = Matrix.CreateRotationZ((float) (Math.PI)) * Matrix.CreateScale(2.0f) * world;
basicEffect.View = view;
basicEffect.Projection = projection;
basicEffect.DiffuseColor = newcolor.ToVector3();
//basicEffect.VertexColorEnabled = true;
basicEffect.Alpha = newcolor.A / 255.0f;
basicEffect.EmissiveColor = newcolor.ToVector3();
//basicEffect.EmissiveColor = new Color(100,100,0).ToVector3();
basicEffect.SpecularColor = new Color(255, 255, 0).ToVector3();
basicEffect.SpecularPower = 10f;
//basicEffect.Texture = Texture2D.FromStream(Game1.device, new FileStream(@"Content\suntexture.png", FileMode.Open));
// basicEffect.TextureEnabled = true;
GraphicsDevice device = basicEffect.GraphicsDevice;
device.DepthStencilState = DepthStencilState.Default;
device.BlendState = BlendState.AlphaBlend;
// Draw the model, using BasicEffect.
Matrix translationMatrix = Matrix.CreateRotationY((float)(Math.PI / 2.0f));
foreach (ModelMesh mesh in beam.Meshes)
{
mesh.Draw();
}
}
示例3: AddFace
public int AddFace(Face.Facing facing, float x, float y, float z, Vector3 size, ref Color color)
{
if (color == Color.Black) Console.WriteLine("Black detected.");
for (int i = 0; i < buffers.Count; i++)
{
if (!buffers[i].Full)
{
//int k = buffers[i].AddFace(Face.getFace(facing, new Vector3(x, y, z), size, color.ToVector3()));
int k = buffers[i].AddFace(Face.getInstancedFace(facing, new Vector3(x, y, z), size, color.ToVector3()));
if (k > -1)
return (i * Size) + k;
return -1;
}
}
buffers.Add(new BatchBuffer(Size));
int j = buffers[buffers.Count - 1].AddFace(Face.getInstancedFace(facing, new Vector3(x, y, z), size, color.ToVector3()));
if (j > -1)
return ((buffers.Count - 1) * Size) + j;
return -1;
}
示例4: AnnotateAvoidNeighbor
public void AnnotateAvoidNeighbor(IVehicle threat, Vector3 ourFuture, Vector3 threatFuture)
{
Color green = new Color((byte)(255.0f * 0.15f), (byte)(255.0f * 0.6f), 0);
annotation.Line(Position, ourFuture, green.ToVector3().FromXna());
annotation.Line(threat.Position, threatFuture, green.ToVector3().FromXna());
annotation.Line(ourFuture, threatFuture, Color.Red.ToVector3().FromXna());
annotation.CircleXZ(Radius, ourFuture, green.ToVector3().FromXna(), 12);
annotation.CircleXZ(Radius, threatFuture, green.ToVector3().FromXna(), 12);
}
示例5: ButtonRow
/// <summary>
/// Button Row Constructor
/// </summary>
/// <param name="name">Control Name</param>
/// <param name="position">Control Position</param>
/// <param name="width">Control Width</param>
/// <param name="titles">Button Titles</param>
/// <param name="backColor">Backcolor</param>
/// <param name="foreColor">Forecolor</param>
public ButtonRow(string name, Vector2 position, float width, string[] titles, Color backColor, Color foreColor)
: base(name)
{
this.Position = position;
this.size = new Vector2(width, 0f);
this.titles = titles;
this.BackColor = backColor;
this.highlight = new Color(backColor.ToVector3() * 0.9f);
this.dimColor = new Color(backColor.ToVector3() * 0.85f);
this.ForeColor = foreColor;
}
示例6: NightSettings
public static void NightSettings()
{
SunPosition = new Vector3(0, -0.4f, -0.6f); //The moon in this case.
SunColor = new Vector3(0.05f, 0.15f, 0.2f);
SkyColor = new Color(0.06f, 0.06f, 0.15f);
FogColor = SkyColor.ToVector3();
}
示例7: ActDye
public ActDye(Color TargetColor, float Time, bool isSolid = true, bool isRelative = false)
: base(isSolid)
{
this.targetColor = TargetColor.ToVector3();
this.frames = (int)(Time * Tool.GetFPS());
this.isRelative = isRelative;
}
示例8: DaySettings
public static void DaySettings()
{
SunPosition = new Vector3(0,-0.8f,-0.2f);
SunColor = new Vector3(.8f, .8f, .8f);
SkyColor = new Color(0, 0.8f, 1);
FogColor = SkyColor.ToVector3();
}
示例9: DrawCube
public static void DrawCube(Matrix W, Matrix V, Matrix P, Color color)
{
foreach (ModelMesh mesh in cube.Meshes)
{
foreach (ModelMeshPart part in mesh.MeshParts)
{
// fontos a sorrend !!
// ha a forgatást a mozgatás után végeznénk el akkor is a (0, 0, 0) pont körül forgatna de mivel az már
// nem a középpontja ezért teljesen más eredményt kapnánk
// ha előbb skáláznánk aztán mozgatnánk akkor a skálázás arányának megfelelően kéne változtatni
// a mozgatást is
// a forgatást a skálázás után kell elvégezni valószinüleg..mármint hogy ne legyen semmi féle szétnyúlás
// ami valószinüleg nem kívánt
basicEffect.EnableDefaultLighting();
basicEffect.DiffuseColor = color.ToVector3();
basicEffect.World = W;
basicEffect.View = V;
basicEffect.Projection = P;
part.Effect = basicEffect;
}
mesh.Draw();
}
}
示例10: Draw
public void Draw(Matrix world, Matrix view, Matrix projection, Color color)
{
// Set BasicEffect parameters.
basicEffect.World = world;
basicEffect.View = view;
basicEffect.Projection = projection;
basicEffect.DiffuseColor = color.ToVector3();
basicEffect.Alpha = color.A / 255.0f;
GraphicsDevice device = basicEffect.GraphicsDevice;
device.DepthStencilState = DepthStencilState.Default;
if (color.A < 255)
{
// Set renderstates for alpha blended rendering.
device.BlendState = BlendState.AlphaBlend;
}
else
{
// Set renderstates for opaque rendering.
device.BlendState = BlendState.Opaque;
}
// Draw the model, using BasicEffect.
Draw(basicEffect);
}
示例11: Render
public static void Render(BoundingSphere sphere,
GraphicsDevice graphicsDevice,
Matrix view,
Matrix projection,
Color color,
Guid id)
{
var subscription = Subscriptions[id];
graphicsDevice.SetVertexBuffer(subscription.VertexBuffer);
subscription.BasicEffect.World = Matrix.CreateScale(sphere.Radius)*
Matrix.CreateTranslation(sphere.Center);
subscription.BasicEffect.View = view;
subscription.BasicEffect.Projection = projection;
subscription.BasicEffect.DiffuseColor = color.ToVector3();
foreach (var pass in subscription.BasicEffect.CurrentTechnique.Passes)
{
pass.Apply();
graphicsDevice.DrawPrimitives(PrimitiveType.LineStrip, 0, SphereResolution);
graphicsDevice.DrawPrimitives(PrimitiveType.LineStrip,
SphereResolution + 1,
SphereResolution);
graphicsDevice.DrawPrimitives(PrimitiveType.LineStrip,
(SphereResolution + 1)*2,
SphereResolution);
}
}
示例12: ShouldConvertToVector3
public void ShouldConvertToVector3()
{
var color = new Color(0.1f, 0.2f, 0.3f);
var vector = color.ToVector3();
Assert.AreEqual(vector.X, color.R);
Assert.AreEqual(vector.Y, color.G);
Assert.AreEqual(vector.Z, color.B);
}
示例13: LambertPointLightMaterial
public LambertPointLightMaterial(Color ambientColor, Color lightColor, Vector3 lightPosition, float attenuation, float falloff)
{
AmbientLightColor = ambientColor.ToVector3();
LightColor = lightColor.ToVector3();
LightPosition = lightPosition;
LightAttenuation = attenuation;
LightFalloff = falloff;
}
示例14: Label
public Label( string name, Vector2 position, string text, Color color, float scale )//, Font font)
{
this.Type = ControlType.Label;
this.name = name;
this.position = position;
this.text = text;
this.scale = scale;
this.color = new Color( new Vector4( color.ToVector3(), 1f ) );
}
示例15: Draw
public static void Draw(this BoundingBox boundingBox, RenderContext renderContext, Color color)
{
if (_basicEffect == null)
_basicEffect = new BasicEffect(renderContext.GraphicsDevice);
var lineList = new VertexPositionColor[8];
var lineListIndices = new short[24];
var index = 0;
var min = boundingBox.Min;
var max = boundingBox.Max;
var boundingCorners = boundingBox.GetCorners();
for (var i = 0; i < 8; ++i)
lineList[i] = new VertexPositionColor(boundingCorners[i], color);
index = 0;
lineListIndices[index] = 0;
lineListIndices[++index] = 1;
lineListIndices[++index] = 1;
lineListIndices[++index] = 2;
lineListIndices[++index] = 2;
lineListIndices[++index] = 3;
lineListIndices[++index] = 3;
lineListIndices[++index] = 0;
lineListIndices[++index] = 4;
lineListIndices[++index] = 5;
lineListIndices[++index] = 5;
lineListIndices[++index] = 6;
lineListIndices[++index] = 6;
lineListIndices[++index] = 7;
lineListIndices[++index] = 7;
lineListIndices[++index] = 4;
lineListIndices[++index] = 0;
lineListIndices[++index] = 4;
lineListIndices[++index] = 1;
lineListIndices[++index] = 5;
lineListIndices[++index] = 2;
lineListIndices[++index] = 6;
lineListIndices[++index] = 3;
lineListIndices[++index] = 7;
_basicEffect.Projection = renderContext.Camera.Projection;
_basicEffect.View = renderContext.Camera.View;
_basicEffect.DiffuseColor = color.ToVector3();
foreach (var pass in _basicEffect.CurrentTechnique.Passes)
{
pass.Apply();
renderContext.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.LineList, lineList, 0, lineList.Length, lineListIndices, 0, 12);
}
}