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


C# Terrain.Initialize方法代码示例

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


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

示例1: Initialize

        protected override void Initialize()
        {
            base.Initialize();

            main_ui = new MainUI(this);
            main_ui.Initialize();

            scene = new Scene(this, 0, "test");
            Scm.AddScene(scene);
            Scm.SetActiveScene(scene);

            /*
            Vector3 camera_position = new Vector3(0, 10, 51);
            Vector3 camera_target = camera_position + Vector3.Forward;
            Camera cam = new Camera();
            cam.Initialize();
            cam.Fov = MathHelper.PiOver4;
            scene.ActiveCamera = cam;
             */
            camera = new Camera(this);
            scene.ActiveCamera = camera;

            //camera_ctrl = new FpsCameraController(this);
            //cam.AttachController(camera_ctrl);
            //camera_ctrl.Enabled = true;

            //////////////////////////////////////////////////////////////////////////
            Axis axis = new Axis(this);
            axis.Initialize();
            scene.AddEntity(axis);

            axis.Pose.SetScale(10, 10, 10);

            ////////////////////////////////��������ķָ���//////////////////////////////////////////
            Terrain terrain = new Terrain(this, "Textures\\flat_map", null);
            terrain.Initialize();
            scene.AddEntity(terrain);

            camera.Target = new Vector3(terrain.WidthInPixel / 2.0f, 0, -terrain.HeightInPixel / 2.0f);
            //camera.Target = new Vector3(0, 0, 0);

            //////////////////////////////////////////////////////////////////////////
            //Quad s1 = new Quad(this);
            //s1.Initialize();
            //scene.AddEntity(s1);

            //s1.Pose.SetPosition(0, 0, 0);
            //s1.Pose.SetScale(4, 4, 1);

            //////////////////////////////////////////////////////////////////////////
            //Avatar a1 = new Avatar(this, "Models\\p1_wedge");
            //a1.Initialize();
            //scene.AddEntity(a1);

            //a1.pose.SetPosition(10, 20, -10);
            //a1.pose.SetScale(0.01f, 0.01f, 0.01f);

            //////////////////////////////////////////////////////////////////////////
            Light l1 = new Light(this, new Vector3(0.0f, 1.0f, 0.0f), new Vector3(1.0f, -1.0f, -1.0f));
            scene.AddLight(l1);

            //////////////////////////////////////////////////////////////////////////
            Box b1 = new Box(this);
            b1.Initialize();
            b1.SetScale(10.0f, 10.0f, 10.0f);
            b1.SetPosition(100, 10, -100);
            scene.AddEntity(b1);

            Box b2 = new Box(this);
            b2.Initialize();
            b2.SetScale(10, 10, 10);
            b2.SetPosition(150, 10, -150);
            scene.AddEntity(b2);

            //////////////////////////////////////////////////////////////////////////
            float bx = 200;
            float by = 20;
            float bz = -200;

               // Sphere s1 = new Sphere(this);
               // s1.Initialize();
               // s1.SetScale(10, 10, 10);
               // s1.SetPosition(bx + 0.0442591f, by + 0.017970f, bz + 0.045182f);
               // s1.ModelFile = "Models\\SphereLowPoly";
               // scene.AddEntity(s1);

            Axis a1 = new Axis(this);
            a1.Initialize();
            a1.SetScale(10, 10, 10);
            Matrix rot = new Matrix();
            rot.M11 = 9.9994452992e-001f; rot.M12 = 2.8077475493e-003f; rot.M13 = 1.0151533926e-002f;
            rot.M21 = -2.8522679263e-003f; rot.M22 = 9.9998636727e-001f; rot.M23 = 4.3737664750e-003f;
            rot.M31 = -1.0139115101e-002f; rot.M32 = -4.4024787564e-003f; rot.M33 = 9.9993890640e-001f;
            a1.SetRotation(rot);
            a1.SetPosition(bx + 0.0442591f, by + 0.017970f, bz + 0.045182f);
            scene.AddEntity(a1);

            //Sphere s2 = new Sphere(this);
            //s2.Initialize();
            //s2.SetScale(10, 10, 10);
//.........这里部分代码省略.........
开发者ID:konlil,项目名称:pipe,代码行数:101,代码来源:Game1.cs


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