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


C# IndexedQuaternion.Normalize方法代码示例

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


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

示例1: UpdateCamera

        //----------------------------------------------------------------------------------------------

        public virtual void UpdateCamera()
        {
            float rele = m_pitch;
            float razi = m_yaw;

            IndexedQuaternion rot = new IndexedQuaternion(m_cameraUp, razi);
            
            IndexedVector3 eyePos = new IndexedVector3();
            eyePos[m_forwardAxis] = m_cameraDistance;

            IndexedVector3 forward = eyePos;
            if (forward.LengthSquared() < MathUtil.SIMD_EPSILON)
            {
                forward = new IndexedVector3(0,0,-1);
            }
            IndexedVector3 right = IndexedVector3.Cross(m_cameraUp, IndexedVector3.Normalize(forward));
            IndexedQuaternion roll = new IndexedQuaternion(right, -rele);
            rot.Normalize();
            roll.Normalize();

            IndexedMatrix m1 = IndexedMatrix.CreateFromQuaternion(rot);
            IndexedMatrix m2 = IndexedMatrix.CreateFromQuaternion(roll);
            IndexedMatrix m3 = m1 * m2;


            //eyePos = new IndexedVector3(Vector3.Transform(eyePos.ToVector3(),(rot * roll)));
            //eyePos = new IndexedVector3(eyePos, (rot * roll));
            eyePos = m3 * eyePos;

            //m_cameraTargetPosition = m_cameraPosition + eyePos;
            m_cameraPosition = eyePos;

            m_cameraPosition += m_cameraTargetPosition;

            if (m_glutScreenWidth == 0 && m_glutScreenHeight == 0)
                return;

            m_lookAt = IndexedMatrix.CreateLookAt(m_cameraPosition, m_cameraTargetPosition, m_cameraUp);
            Matrix t = Matrix.CreateLookAt(m_cameraPosition.ToVector3(), m_cameraTargetPosition.ToVector3(), m_cameraUp.ToVector3());
            Matrix t2 = m_lookAt.ToMatrix();

            if (t != t2)
            {
                int ibreak2 = 0;
            }


            int ibreak = 0;
        }
开发者ID:ousttrue,项目名称:bullet-xna,代码行数:51,代码来源:DemoApplication.cs


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