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


C# Matrix4F.Normalize方法代码示例

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


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

示例1: GetManipulatorMatrix

        protected override Matrix4F GetManipulatorMatrix()
        {
            ITransformable node = GetManipulatorNode(TransformationTypes.Rotation);
            if (node == null ) return null;
            
            Path<DomNode> path = new Path<DomNode>(node.Cast<DomNode>().GetPath());
            Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1);

            // local transform
            Matrix4F toworld = new Matrix4F(localToWorld);

            // Offset by rotate pivot
            Matrix4F P = new Matrix4F();
            P.Translation = node.Pivot;
            toworld.Mul(P, toworld);

            // Normalize            
            toworld.Normalize(toworld);

            return toworld;
        }
开发者ID:coreafive,项目名称:XLE,代码行数:21,代码来源:RotateManipulator.cs

示例2: OnBeginDrag

        public override void OnBeginDrag()
        {
            if (m_hitRegion == HitRegion.None)
                return;
            var selectionCntx = DesignView.Context.As<ISelectionContext>();
            var selection = selectionCntx.Selection;
            var transactionContext = DesignView.Context.As<ITransactionContext>();

            m_activeOp = null;

            var op = new ManipulatorActiveOperation(
                "Rotate", DesignView.Context.As<ISelectionContext>(),
                (ITransformable node) => (node.TransformationType & TransformationTypes.Rotation) != 0,
                false);

            m_rotations = new Matrix4F[op.NodeList.Count];
            for (int k = 0; k < op.NodeList.Count; k++)
            {
                ITransformable node = op.NodeList[k];                
                Matrix4F m = new Matrix4F(node.Transform);
                m.Translation = new Vec3F(0, 0, 0);
                m.Normalize(m);
                m_rotations[k] = m;
            }

            m_activeOp = op;
        }
开发者ID:coreafive,项目名称:XLE,代码行数:27,代码来源:RotateManipulator.cs

示例3: GetManipulatorMatrix

        protected override Matrix4F GetManipulatorMatrix()
        {
            ITransformable node = GetManipulatorNode(TransformationTypes.Translation);
            if (node == null) return null;

            ISnapSettings snapSettings = (ISnapSettings)DesignView;
            Path<DomNode> path = new Path<DomNode>(node.Cast<DomNode>().GetPath());
            Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1);

            Matrix4F toworld = new Matrix4F();
            if (snapSettings.ManipulateLocalAxis)
            {
                toworld.Set(localToWorld);
                toworld.Normalize(toworld);
            }
            else
            {
                toworld.Translation = localToWorld.Translation;
            }

                //  DavidJ --   note -- this "pivot" behaviour was inherited from another manipulator
            //                  but appears to be broken! Check coordinate space of value returned from CalcSnapFromOffset
            // Vec3F offset = TransformUtils.CalcSnapFromOffset(node, snapSettings.SnapFrom);
            //
            // // Offset by pivot
            // Matrix4F P = new Matrix4F();
            // P.Translation = offset;
            // toworld.Mul(toworld,P);

            return toworld;
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:31,代码来源:MoveAcrossTerrainManipulator.cs

示例4: OnBeginDrag

        public override void OnBeginDrag()
        {
            if (m_hitRegion == HitRegion.None)
                return;
            var selectionCntx = DesignView.Context.As<ISelectionContext>();
            var selection = selectionCntx.Selection;
            var transactionContext = DesignView.Context.As<ITransactionContext>();

            NodeList.Clear();

            IEnumerable<DomNode> rootDomNodes = DomNode.GetRoots(selection.AsIEnumerable<DomNode>());
            foreach (DomNode domNode in rootDomNodes)
            {
                ITransformable node = domNode.As<ITransformable>();
                                
                if (node == null || (node.TransformationType & TransformationTypes.Rotation) == 0)
                    continue;

                IVisible vn = node.As<IVisible>();
                if (!vn.Visible) continue;

                ILockable lockable = node.As<ILockable>();
                if (lockable.IsLocked) continue;
                
                NodeList.Add(node);
                IManipulatorNotify notifier = node.As<IManipulatorNotify>();
                if (notifier != null) notifier.OnBeginDrag();
            }

            m_rotations = new Matrix4F[NodeList.Count];

            for (int k = 0; k < NodeList.Count; k++)
            {
                ITransformable node = NodeList[k];                
                Matrix4F m = new Matrix4F(node.Transform);
                m.Translation = new Vec3F(0, 0, 0);
                m.Normalize(m);
                m_rotations[k] = m;
            }

            if(NodeList.Count > 0)
                transactionContext.Begin("Rotate".Localize());
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:43,代码来源:RotateManipulator.cs

示例5: GetManipulatorMatrix

        protected override Matrix4F GetManipulatorMatrix()
        {
            ITransformable node = GetManipulatorNode(TransformationTypes.Translation);
            if (node == null ) return null;

            ISnapSettings snapSettings = (ISnapSettings)DesignView;            
            Path<DomNode> path = new Path<DomNode>(node.Cast<DomNode>().GetPath());
            Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1);
            
            Matrix4F toworld = new Matrix4F();
            if (snapSettings.ManipulateLocalAxis)
            {
                toworld.Set(localToWorld);
                toworld.Normalize(toworld);                
            }
            else
            {
                toworld.Translation = localToWorld.Translation;                
            }

            Vec3F offset = TransformUtils.CalcSnapFromOffset(node, snapSettings.SnapFrom);
          
            // Offset by pivot
            Matrix4F P = new Matrix4F();
            P.Translation = offset;
            toworld.Mul(toworld,P);
                        
            return toworld;
        }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:29,代码来源:TranslateManipulator.cs


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