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


C# SceneManager.GetManualObject方法代码示例

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


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

示例1: InitMogre

        public void InitMogre()
        {
            //-----------------------------------------------------
            // 1 enter ogre
            //-----------------------------------------------------
            root = new Root();

            //-----------------------------------------------------
            // 2 configure resource paths
            //-----------------------------------------------------
            ConfigFile cf = new ConfigFile();
            cf.Load("resources.cfg", "\t:=", true);

            // Go through all sections & settings in the file
            ConfigFile.SectionIterator seci = cf.GetSectionIterator();

            String secName, typeName, archName;

            // Normally we would use the foreach syntax, which enumerates the values, but in this case we need CurrentKey too;
            while (seci.MoveNext())
            {
                secName = seci.CurrentKey;
                ConfigFile.SettingsMultiMap settings = seci.Current;
                foreach (KeyValuePair<string, string> pair in settings)
                {
                    typeName = pair.Key;
                    archName = pair.Value;
                    ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
                }
            }

            //-----------------------------------------------------
            // 3 Configures the application and creates the window
            //-----------------------------------------------------
            bool foundit = false;
            foreach (RenderSystem rs in root.GetAvailableRenderers())
            {
                root.RenderSystem = rs;
                String rname = root.RenderSystem.Name;
                if (rname == "Direct3D9 Rendering Subsystem")
                {
                    foundit = true;
                    break;
                }
            }

            if (!foundit)
                return; //we didn't find it... Raise exception?

            //we found it, we might as well use it!
            root.RenderSystem.SetConfigOption("Full Screen", "No");
            root.RenderSystem.SetConfigOption("Video Mode", "640 x 480 @ 32-bit colour");

            root.Initialise(false);
            NameValuePairList misc = new NameValuePairList();
            misc["externalWindowHandle"] = hWnd.ToString();
            window = root.CreateRenderWindow("Simple Mogre Form Window", 0, 0, false, misc);
            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

            //-----------------------------------------------------
            // 4 Create the SceneManager
            //
            //		ST_GENERIC = octree
            //		ST_EXTERIOR_CLOSE = simple terrain
            //		ST_EXTERIOR_FAR = nature terrain (depreciated)
            //		ST_EXTERIOR_REAL_FAR = paging landscape
            //		ST_INTERIOR = Quake3 BSP
            //-----------------------------------------------------
            sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "SceneMgr");
            sceneMgr.AmbientLight = new ColourValue(1f, 1f, 1f);

            //-----------------------------------------------------
            // 5 Create the camera
            //-----------------------------------------------------
            camera = sceneMgr.CreateCamera("SimpleCamera");
            camera.Position = new Vector3(400f, 0f, 0f);
            // Look back along -Z
            camera.LookAt(new Vector3(-1f, 0f, 0f));
            camera.NearClipDistance = 5;

            viewport = window.AddViewport(camera);
            viewport.BackgroundColour = new ColourValue(0.0f, 0.0f, 0.0f, 1.0f);

            material = MaterialManager.Singleton.Create("front", "General");
            material.GetTechnique(0).GetPass(0).CreateTextureUnitState("snow3.jpg");
            material = MaterialManager.Singleton.Create("other", "General");
            material.GetTechnique(0).GetPass(0).CreateTextureUnitState("snow.jpg");
            material = MaterialManager.Singleton.Create("back", "General");
            material.GetTechnique(0).GetPass(0).CreateTextureUnitState("back2.jpg");

            Vector3 moveVector3 = new Vector3(0f,-60f,110f);
            for (int i = 0; i < cubeCount; i++)
            {
                Cube cube = new Cube();
                cube.CubeName = "cube" + i.ToString();
                cube.BuildCube("front", ref sceneMgr);

                ManualObject manual = sceneMgr.GetManualObject(cube.CubeName);
                manual.ConvertToMesh("cubeMesh"+i.ToString());
                Entity ent = sceneMgr.CreateEntity("box"+i.ToString(), "cubeMesh"+i.ToString());
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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