当前位置: 首页>>代码示例>>C#>>正文


C# Matrix4F类代码示例

本文整理汇总了C#中Matrix4F的典型用法代码示例。如果您正苦于以下问题:C# Matrix4F类的具体用法?C# Matrix4F怎么用?C# Matrix4F使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Matrix4F类属于命名空间,在下文中一共展示了Matrix4F类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        /// <summary>
        /// Renders the control</summary>
        /// <param name="action">Render action</param>
        /// <param name="camera">Camera</param>
        /// <param name="state">Render state</param>
        /// <param name="transform">Transform</param>
        public void Render(IRenderAction action, Camera camera, RenderState state, Matrix4F transform)
        {
            float s1, s2, s3;

            // apply xform
            Gl.glPushMatrix();
            Util3D.glMultMatrixf(transform);

            CalcAxisLengths(camera, transform, out s1, out s2, out s3);

            bool drawX, drawY, drawZ;
            DecideArrowDrawing(transform, camera, out drawX, out drawY, out drawZ);

            if (drawX)
            {
                RenderXArrow(s1);
                RenderXAxis(s1);
            }
            if (drawY)
            {
                RenderYArrow(s2);
                RenderYAxis(s2);
            }
            if (drawZ)
            {
                RenderZArrow(s3);
                RenderZAxis(s3);
            }

            RenderXYSquare(s1 * SquareLength, s2 * SquareLength, true);
            RenderYZSquare(s2 * SquareLength, s3 * SquareLength, true);
            RenderXZSquare(s1 * SquareLength, s3 * SquareLength, true);
            
            Gl.glPopMatrix();
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:41,代码来源:TranslatorControl.cs

示例2: TestToStringWithCulture

        private void TestToStringWithCulture(CultureInfo culture)
        {
            CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = culture;
            try
            {
                string listSeparator = culture.TextInfo.ListSeparator;
                string decimalSeparator = culture.NumberFormat.NumberDecimalSeparator;
                var o = new Matrix4F(
                    1.1f, 2.2f, 3.3f, 4.4f,
                    5.5f, 6.6f, 7.7f, 8.8f,
                    9.9f, 10.10f, 11.11f, 12.12f,
                    13.13f, 14.14f, 15.15f, 16.16f);

                string s = o.ToString(null, null);
                TestToStringResults(o, s, listSeparator, decimalSeparator);

                s = o.ToString();
                Assert.True(s.Contains(listSeparator));

                s = o.ToString("G", culture);
                TestToStringResults(o, s, listSeparator, decimalSeparator);

                s = o.ToString("R", culture);
                TestToStringResults(o, s, listSeparator, decimalSeparator);
            }
            finally
            {
                Thread.CurrentThread.CurrentCulture = originalCulture;
            }
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:31,代码来源:TestMatrix4F.cs

示例3: TraverseNode

 /// <summary>
 /// Constructor</summary>
 /// <param name="renderObject">RenderObject. A reference is held to this, so that IRenderObject.Dispatch
 /// can be called.</param>
 /// <param name="transform">Transform to use when dispatching the RenderObject; a reference is held</param>
 /// <param name="graphPath">Graph path leading to RenderObject; a reference is held</param>
 /// <param name="renderState">RenderState to use for RenderObject; is copied</param>
 public TraverseNode(
     IRenderObject renderObject,
     Matrix4F transform,
     Stack<SceneNode> graphPath,
     RenderState renderState)
 {
     Init(renderObject, transform, graphPath, renderState);
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:15,代码来源:TraverseNode.cs

示例4: DrawCircle

 public static void DrawCircle(GUILayer.SimpleRenderingContext context, Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(context, PrimitiveType.LineStrip,
        s_circleVerts,
        0,
        s_circleVertexCount,
        color,
        xform);
 }
开发者ID:coreafive,项目名称:XLE,代码行数:9,代码来源:Util3d.cs

示例5: DrawUnitSquare

 public static void DrawUnitSquare(GUILayer.SimpleRenderingContext context, Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(context, PrimitiveType.LineList,
         s_linesVertId,
         s_unitSquareStartVertex,
         s_unitSquareVertexCount,
         color,
         xform);
 }
开发者ID:coreafive,项目名称:XLE,代码行数:9,代码来源:Util3d.cs

示例6: SetTransform

 /// <summary>
 /// Decomposes the given matrix to translation, scale, 
 /// and rotation and set them to given Transformable node.        
 /// </summary>        
 public static void SetTransform(ITransformable xform, Matrix4F mtrx)
 {
     xform.Translation = mtrx.Translation;
     xform.Scale = mtrx.GetScale();
     Vec3F rot = new Vec3F();
     mtrx.GetEulerAngles(out rot.X, out rot.Y, out rot.Z);
     xform.Rotation = rot;
     xform.UpdateTransform();
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:13,代码来源:TransformUtils.cs

示例7: DrawPivot

 public static void DrawPivot(GUILayer.SimpleRenderingContext context, Matrix4F xform, Color c)
 {
     GameEngine.DrawPrimitive(context, PrimitiveType.LineStrip,
       s_pivotVerts,
       0,
       s_pivotVertexCount,
       c,
       xform);            
 }
开发者ID:coreafive,项目名称:XLE,代码行数:9,代码来源:Util3d.cs

示例8: Init

 /// <summary>
 /// Initializes instance</summary>
 /// <param name="renderObject">RenderObject. A reference is held to this, so that IRenderObject.Dispatch
 /// can be called.</param>
 /// <param name="transform">Transform to use when dispatching the RenderObject; a reference is held</param>
 /// <param name="graphPath">Graph path leading to RenderObject; a reference is held</param>
 /// <param name="renderState">RenderState to use for RenderObject; is copied</param>
 public void Init(
     IRenderObject renderObject,
     Matrix4F transform,
     Stack<SceneNode> graphPath,
     RenderState renderState)
 {
     m_renderObject = renderObject;
     m_transform = transform;
     m_renderState.Init(renderState);
     m_graphPath = graphPath.ToArray();//faster to create every time than to cache!
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:18,代码来源:TraverseNode.cs

示例9: DrawUnitSquare

 public static void DrawUnitSquare(Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(PrimitiveType.LineList,
         s_linesVertId,
         s_unitSquareStartVertex,
         s_unitSquareVertexCount,
         color,
         xform,
         RenderFlag
         );
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:11,代码来源:Util3d.cs

示例10: DrawCircle

 public static void DrawCircle(Matrix4F xform, Color color)
 {            
     GameEngine.DrawPrimitive(PrimitiveType.LineStrip,
        s_circleVerts,
        0,
        s_circleVertexCount,
        color,
        xform,
        RenderFlag
        );
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:11,代码来源:Util3d.cs

示例11: DrawPivot

 public static void DrawPivot(Matrix4F xform, Color c)
 {
     GameEngine.DrawPrimitive(PrimitiveType.LineStrip,
       s_pivotVerts,
       0,
       s_pivotVertexCount,
       c,
       xform,
       RenderFlag
       );            
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:11,代码来源:Util3d.cs

示例12: TestToStringResults

 private void TestToStringResults(Matrix4F o, string s, string listSeparator, string decimalSeparator)
 {
     string[] results = s.Split(new[] { listSeparator }, StringSplitOptions.RemoveEmptyEntries);
     Assert.AreEqual(results.Length, 16);
     for (int i = 0; i < 16; i++)
     {
         Assert.True(results[i].Contains(decimalSeparator));
         float result = float.Parse(results[i]);
         Assert.AreEqual(result, o[i]);
     }
 }
开发者ID:Joxx0r,项目名称:ATF,代码行数:11,代码来源:TestMatrix4F.cs

示例13: OnBeginDrag

        public override void OnBeginDrag()
        {
            if (m_hitRegion == HitRegion.None || !CanManipulate(m_node))
                return;
            var transactionContext = DesignView.Context.As<ITransactionContext>();
            transactionContext.Begin("Move".Localize());
            m_originalPivot = m_node.Pivot;

            Path<DomNode> path = new Path<DomNode>(m_node.Cast<DomNode>().GetPath());
            Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1);
            m_worldToLocal = new Matrix4F();
            m_worldToLocal.Invert(localToWorld);
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:13,代码来源:TranslatePivotManipulator.cs

示例14: ComputeWorldTransform

 /// <summary>
 /// Computes world transformation matrix for the given 
 /// Transformable node.</summary>        
 public static Matrix4F ComputeWorldTransform(ITransformable xform)
 {
     Matrix4F world = new Matrix4F();
     DomNode node = xform.As<DomNode>();
     foreach (DomNode n in node.Lineage)
     {
         ITransformable xformNode = n.As<ITransformable>();
         if (xformNode != null)
         {
             world.Mul(world, xformNode.Transform);
         }
     }
     return world;
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:17,代码来源:TransformUtils.cs

示例15: CalcPathTransform

        /// <summary>
        /// Calculates the world space matrix of the given path</summary>
        /// <param name="path">The path</param>
        /// <param name="start">Starting index</param>
        /// <param name="M">the world matrix</param>        
        public static void CalcPathTransform(Matrix4F M, Path<DomNode> path, int start)
        {
            for (int i = start; i >= 0; i--)
            {
                if (path[i] != null)
                {
                    ITransformable renderable =
                        path[i].As<ITransformable>();

                    if (renderable != null)
                    {
                        M.Mul(M, renderable.Transform);
                    }
                }
            }
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:21,代码来源:TransformUtils.cs


注:本文中的Matrix4F类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。