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


C# Matrix4.ToMatrix4F方法代码示例

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


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

示例1: Render

        public void Render(Matrix4 modelviewProjection, Matrix4 normalMatrix, bool debugColors)
        {
            _shader.Begin();

            _shader.ModelViewProjectionMatrix = modelviewProjection.ToMatrix4F();

            BeginDraw();

            _shader.NormalMatrix = normalMatrix.ToMatrix4F();

            var vloc = Shader.AttributeLocation(_shader, () => _shader.Vertex);

            for (var i = ActiveMin; i < ActiveMax; i++)

            {
                var level = _levels[i];

                BeginLevel(i);
                _shader.Color = debugColors ? SelectColor(i).ToVector4F() : new Vector4(1.0f, 1.0f, 1.0f, 1.0f).ToVector4F();

                var mask = i == ActiveMin ? PatchLocations.PatchSelection.Everything : PatchLocations.PatchSelection.Outer;

                // test line
                //mask = PatchLocations.PatchSelection.OuterDegenerated | PatchLocations.PatchSelection.BaseBottomLeft;

                if (i != 0)
                    mask |= PatchLocations.PatchSelection.OuterDegenerated;

                mask |= level.Bottom ? PatchLocations.PatchSelection.InteriorBottom : PatchLocations.PatchSelection.InteriorTop;
                mask |= level.Left ? PatchLocations.PatchSelection.InteriorLeft : PatchLocations.PatchSelection.InteriorRight;

                var subX = level.Position.X.Fraction * 2.0f - 1.0f;
                var intX = level.Position.X.Integer;
                var subY = level.Position.Y.Fraction * 2.0f - 1.0f;
                var intY = level.Position.Y.Integer;
                var texX = (intX * 2) & N;
                var texY = (intY * 2) & N;

                foreach (var p in Locations.Select(mask))
                {
                    var pp = p.Patch;

                    _shader.ScaleFactor = new Vector4(p.X + subX, p.Y + subY, level.Scale, (float)InverseD).ToVector4F();
                    _shader.FineBlockOrigin = new Vector4(p.X - Hx - texX, p.Y - Hx - texY, p.X - Hx, p.Y - Hx).ToVector4F();
                    pp.Draw(vloc);
                }
            }

            EndDraw();
            _shader.End();
        }
开发者ID:hach-que,项目名称:SLSharp,代码行数:51,代码来源:Clipmap.cs

示例2: Render

        public void Render(Matrix4 modelviewProjection, Matrix4 normalMatrix, bool debugColors)
        {
            _shader.Begin();
            _shader.alpha = 0.5f + 0.5f * (float)Math.Sin((DateTime.Now.Millisecond + DateTime.Now.Second * 1000) * 0.01f);

            _shader.ModelViewProjectionMatrix = modelviewProjection.ToMatrix4F();

            BeginDraw();

            _shader.DebugValue = (DebugIndex & 1) == 1 ? 1.0f : 0.0f;
            _shader.ScaleFactor = new Vector4(0.1f, 0.1f, 0.0f, 0.0f).ToVector4F();
            _shader.FineBlockOrigin = (new Vector4(0.01f, 0.01f, 0.0f, 0.0f)).ToVector4F();
            _shader.ViewerPosition = new Vector2(0.0f, 0.0f).ToVector2F();
            _shader.AlphaOffset = new Vector2(0.0f, 0.0f).ToVector2F();
            _shader.OneOverWidth = new Vector2(1.0f / M, 1.0f / M).ToVector2F();
            _shader.NormalMatrix = normalMatrix.ToMatrix4F();

            var vloc = Shader.AttributeLocation(_shader, () => _shader.Vertex);

            for (var i = 0; i < Levels; i++)
            {
                var level = _levels[i];

                BeginLevel(i);
                _shader.Color = debugColors ? SelectColor(i).ToVector4F() : new Vector4(1.0f, 1.0f, 1.0f, 1.0f).ToVector4F();

                var mask = i == 0 ? PatchLocations.PatchSelection.Everything : PatchLocations.PatchSelection.Outer;

                // test line
                //mask = PatchLocations.PatchSelection.OuterDegenerated | PatchLocations.PatchSelection.BaseBottomLeft;

                if (i != 0)
                    mask |= PatchLocations.PatchSelection.OuterDegenerated;

                mask |= level.Bottom ? PatchLocations.PatchSelection.InteriorBottom : PatchLocations.PatchSelection.InteriorTop;
                mask |= level.Left ? PatchLocations.PatchSelection.InteriorLeft : PatchLocations.PatchSelection.InteriorRight;

                var subX = level.Position.X.Fraction * 2.0f - 1.0f;
                var intX = level.Position.X.Integer;
                var subY = level.Position.Y.Fraction * 2.0f - 1.0f;
                var intY = level.Position.Y.Integer;
                var texX = (intX * 2) & N;
                var texY = (intY * 2) & N;

                foreach (var p in Locations.Select(mask))
                {
                    var pp = p.Patch;

                    _shader.ScaleFactor = new Vector4(p.X + subX, p.Y + subY, level.Scale, level.Scale).ToVector4F();
                    _shader.FineBlockOrigin = new Vector4(p.X - Hx - texX, p.Y - Hx - texY, (float)InverseD, (float)InverseD).ToVector4F();
                    pp.Draw(vloc);
                }
            }

            EndDraw();
            _shader.End();
        }
开发者ID:mono-soc-2011,项目名称:SLSharp,代码行数:57,代码来源:Clipmap.cs


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