本文整理汇总了C#中OpenTK.Convert方法的典型用法代码示例。如果您正苦于以下问题:C# OpenTK.Convert方法的具体用法?C# OpenTK.Convert怎么用?C# OpenTK.Convert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenTK
的用法示例。
在下文中一共展示了OpenTK.Convert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawVector
/// <summary>
/// Draws an array in unity using Unity.Debug
/// </summary>
/// <param name="pos">The staring position of the OpenTK Vector3</param>
/// <param name="dir">The direction of the vector of the OpenTK Vector3</param>
/// <param name="length">The length of the vector</param>
/// <param name="c">The color of the vector as a UnityEngine Color</param>
public static void DrawVector(OpenTK.Vector3 pos, OpenTK.Vector3 dir, float size, Color c)
{
Debug.DrawRay(pos.Convert(), Vector3.Normalize(dir.Convert()) * size, c);
}
示例2: DrawTwistConstraints
/// <summary>
/// Draws the twist constraints accoriding in Unity using Giszmos
/// </summary>
/// <param name="b">The bone with its constraints</param>
/// <param name="refBone">The to be twisted against</param>
/// <param name="poss">The position of where it should be drawn</param>
/// <param name="scale">The scale of the constraints</param>
public static void DrawTwistConstraints(Bone b, Bone refBone, OpenTK.Vector3 poss, float scale)
{
if (b.Orientation.Xyz.IsNaN() || refBone.Orientation.Xyz.IsNaN())
{
return;
}
OpenTK.Vector3 thisY = b.GetYAxis();
OpenTK.Quaternion referenceRotation = refBone.Orientation * b.ParentPointer;
OpenTK.Vector3 parentY = OpenTK.Vector3.Transform(OpenTK.Vector3.UnitY, referenceRotation);
OpenTK.Vector3 parentZ = OpenTK.Vector3.Transform(OpenTK.Vector3.UnitZ, referenceRotation);
OpenTK.Quaternion rot = QuaternionHelper2.GetRotationBetween(parentY, thisY);
OpenTK.Vector3 reference = OpenTK.Vector3.Transform(parentZ, rot);
reference.Normalize();
Debug.DrawRay(poss.Convert(), (b.GetZAxis() * scale*2).Convert(), Color.cyan);
float startTwistLimit = OpenTK.MathHelper.DegreesToRadians(b.StartTwistLimit);
OpenTK.Vector3 m = OpenTK.Vector3.Transform(reference, OpenTK.Quaternion.FromAxisAngle(thisY, startTwistLimit));
m.Normalize();
Debug.DrawRay(poss.Convert(), m.Convert() * scale, Color.yellow);
float endTwistLimit = OpenTK.MathHelper.DegreesToRadians(b.EndTwistLimit);
OpenTK.Vector3 m2 = OpenTK.Vector3.Transform(reference, OpenTK.Quaternion.FromAxisAngle(thisY, endTwistLimit));
m2.Normalize();
Debug.DrawRay(poss.Convert(), m2.Convert() * scale, Color.magenta);
Debug.DrawLine((poss + (m*scale)).Convert(), (poss + (m2*scale)).Convert(), Color.cyan);
}
示例3: DrawRays2
/// <summary>
/// Using Unity Debug, draws the x,y,z axis of a Quaternion as x magenta, y yellow and z cyan
/// </summary>
/// <param name="rot">The OpenTK Quaterion</param>
/// <param name="pos">The OpenTK Vector3 position to be drawn</param>
public static void DrawRays2(OpenTK.Quaternion rot, OpenTK.Vector3 pos)
{
DrawRays2(rot.Convert(), pos.Convert(), 0.07f);
}
示例4: DrawRays
/// <summary>
/// Using Unity Debug, draws the x,y,z axis of a Quaternion at 7 cm scale as x red, y green and z blue
/// </summary>
/// <param name="rot">The OpenTK Quaterion</param>
/// <param name="pos">The OpenTK Vector3 position to be drawn</param>
public static void DrawRays(OpenTK.Quaternion rot, OpenTK.Vector3 pos)
{
DrawRays(rot, pos.Convert());
}
示例5: DrawLine
/// <summary>
/// Draws a line from two 3d points in Unity in a specific color
/// </summary>
/// <param name="start">The starting point as a OpenTK Vector3</param>
/// <param name="end">The end point as a OpenTK Vector3</param>
/// <param name="c">The color of the line as a UnityEngine Color</param>
public static void DrawLine(OpenTK.Vector3 start, OpenTK.Vector3 end, Color c)
{
Debug.DrawLine(start.Convert(), end.Convert(), c);
}