本文整理汇总了C#中System.Vector3.LSSwitchYZ方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.LSSwitchYZ方法的具体用法?C# Vector3.LSSwitchYZ怎么用?C# Vector3.LSSwitchYZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector3
的用法示例。
在下文中一共展示了Vector3.LSSwitchYZ方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawLine
public static void DrawLine(Vector3 from, Vector3 to, System.Drawing.Color color)
{
var vertices = new PositionColored[2];
vertices[0] = new PositionColored(Vector3.Zero, color.ToArgb());
from = from.LSSwitchYZ();
to = to.LSSwitchYZ();
vertices[1] = new PositionColored(to - from, color.ToArgb());
InternalRender(from);
Drawing.Direct3DDevice.DrawUserPrimitives(PrimitiveType.LineList, vertices.Length / 2, vertices);
}
示例2: DrawCircle
/// <summary>
/// Draws the circle.
/// </summary>
/// <param name="position">The position.</param>
/// <param name="radius">The radius.</param>
/// <param name="color">The color.</param>
/// <param name="width">The width.</param>
/// <param name="zDeep">if set to <c>true</c> the circle will be drawn with depth buffering.</param>
public static void DrawCircle(Vector3 position, float radius, Color color, int width = 5, bool zDeep = false)
{
try
{
if (Device == null || Device.IsDisposed)
{
return;
}
if (_vertices == null)
{
CreateVertexes();
}
if (_vertices == null || _vertices.IsDisposed || _vertexDeclaration.IsDisposed || _effect.IsDisposed ||
_technique.IsDisposed)
{
return;
}
var olddec = Device.VertexDeclaration;
_effect.Technique = _technique;
_effect.Begin();
_effect.BeginPass(0);
_effect.SetValue(
"ProjectionMatrix", Matrix.Translation(position.LSSwitchYZ()) * Drawing.View * Drawing.Projection);
_effect.SetValue(
"CircleColor", new Vector4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f));
_effect.SetValue("Radius", radius);
_effect.SetValue("Border", 2f + width);
_effect.SetValue("zEnabled", zDeep);
Device.SetStreamSource(0, _vertices, 0, Utilities.SizeOf<Vector4>() * 2);
Device.VertexDeclaration = _vertexDeclaration;
Device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2);
_effect.EndPass();
_effect.End();
Device.VertexDeclaration = olddec;
}
catch (Exception e)
{
_vertices = null;
Console.WriteLine(@"DrawCircle: " + e);
}
}