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


C# Vector4d.NormalizeFast方法代码示例

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


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

示例1: UpdateFrustum

        /// <summary>Update the ModelView and Frustum. Done on every update cycle and before the world is initially loaded so we can preload chunks in the initial frustum.</summary>
        private static void UpdateFrustum()
        {
            ModelView = Matrix4d.LookAt(Player.Coords.Xf, Player.Coords.Yf + Constants.PLAYER_EYE_LEVEL, Player.Coords.Zf, Player.Coords.Xf + (float)Math.Cos(Player.Coords.Direction) * (float)Math.Cos(Player.Coords.Pitch), Player.Coords.Yf + Constants.PLAYER_EYE_LEVEL + (float)Math.Sin(Player.Coords.Pitch), Player.Coords.Zf + (float)Math.Sin(Player.Coords.Direction) * (float)Math.Cos(Player.Coords.Pitch), 0, 1, 0);

            Matrix4d clip;
            Matrix4d.Mult(ref ModelView, ref Projection, out clip);
            LeftFrustum = new Vector4d(clip.M14 + clip.M11, clip.M24 + clip.M21, clip.M34 + clip.M31, clip.M44 + clip.M41);
            LeftFrustum.NormalizeFast();
            RightFrustum = new Vector4d(clip.M14 - clip.M11, clip.M24 - clip.M21, clip.M34 - clip.M31, clip.M44 - clip.M41);
            RightFrustum.NormalizeFast();

            BottomFrustum = new Vector4d(clip.M14 + clip.M12, clip.M24 + clip.M22, clip.M34 + clip.M32, clip.M44 + clip.M42);
            BottomFrustum.NormalizeFast();
            TopFrustum = new Vector4d(clip.M14 - clip.M12, clip.M24 - clip.M22, clip.M34 - clip.M32, clip.M44 - clip.M42);
            TopFrustum.NormalizeFast();

            NearFrustum = new Vector4d(clip.M14 + clip.M13, clip.M24 + clip.M23, clip.M34 + clip.M33, clip.M44 + clip.M43);
            NearFrustum.NormalizeFast();
            FarFrustum = new Vector4d(clip.M14 - clip.M13, clip.M24 - clip.M23, clip.M34 - clip.M33, clip.M44 - clip.M43);
            FarFrustum.NormalizeFast();
        }
开发者ID:MagistrAVSH,项目名称:voxelgame,代码行数:22,代码来源:Game.cs


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