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


C# Root.GetRenderSystemByName方法代码示例

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


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

示例1: CreateRoot

 private Root CreateRoot()
 {
     var root = new Root();
     root.RenderSystem = root.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
     root.Initialise(false);
     return root;
 }
开发者ID:crescent,项目名称:SubmarineSim3D,代码行数:7,代码来源:Sim.cs

示例2: InitRenderSystem

        /// <summary>
        /// Initialises the render system, tells it to use directx, windowed, etc
        /// </summary>
        private static RenderSystem InitRenderSystem(Root root)
        {
            Launch.Log("[Loading] Creating RenderSystem...");

            if (root.RenderSystem == null) {
                var renderSystem = root.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
                renderSystem.SetConfigOption("Full Screen", Options.Get("Full Screen"));
                renderSystem.SetConfigOption("Floating-point mode", Options.Get("Floating-point mode"));
                renderSystem.SetConfigOption("VSync", Options.Get("VSync"));
                renderSystem.SetConfigOption("VSync Interval", Options.Get("VSync Interval"));
                renderSystem.SetConfigOption("FSAA", Options.Get("FSAA"));
                renderSystem.SetConfigOption("Video Mode", Options.Get("Video Mode"));
                renderSystem.SetConfigOption("sRGB Gamma Conversion", Options.Get("sRGB Gamma Conversion"));

                root.RenderSystem = renderSystem;
            }

            #if DEBUG
            // print out the things we can support
            var renderList = root.GetAvailableRenderers();
            foreach (var renderSystem in renderList) {
                Launch.Log("\n**** Available options for Render System: " + renderSystem.Name + " ****");
                foreach (var option in renderSystem.GetConfigOptions()) {
                    Launch.Log("\t" + option.Key);
                    foreach (var p in option.Value.possibleValues) {
                        Launch.Log("\t\t" + p);
                    }
                }
                Launch.Log("***********************************");
            }
            #endif

            return root.RenderSystem;
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:37,代码来源:LKernel+(ogre+initialisers).cs

示例3: Main

        private static void Main()
        {
            using (var r = new Root())
            {

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("Select Render system:");
                Console.WriteLine("1.) OpenGL");
                Console.WriteLine("2.) Direct3D9");
                while (true)
                {
                    var k = Console.ReadKey(true);
                    int v;
                    if (!int.TryParse(k.KeyChar.ToString(), out v))
                        continue;
                    if (v > 2 || v == 0)
                        continue;

                    if (v == 1)
                    {
                        r.LoadPlugin("RenderSystem_GL");
                        r.RenderSystem = r.GetRenderSystemByName("OpenGL Rendering Subsystem");
                    }
                    else
                    {
                        r.LoadPlugin("RenderSystem_Direct3D9");
                        r.RenderSystem = r.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
                    }
                    break;
                }

                using (r.Initialise(false))
                {
                    using (var w = r.RenderSystem._createRenderWindow("SL# Demo", 640, 480, false))
                    {
                        var win = new DemoWindow(r, w);
                        win.OnLoad();
                        r.FrameRenderingQueued += win.OnRenderFrame;
                        r.StartRendering();
                        win.OnUnload();
                    }
                }
            }
        }
开发者ID:hach-que,项目名称:SLSharp,代码行数:45,代码来源:Program.cs

示例4: Init

        public void Init()
        {
            // Create root object
             mRoot = new Root();

             // Define Resources
             ConfigFile cf = new ConfigFile();
             cf.Load("resources.cfg", "\t:=", true);
             ConfigFile.SectionIterator seci = cf.GetSectionIterator();
             String secName, typeName, archName;

             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);
            }
             }

             // Setup RenderSystem
             RenderSystem rs = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
             // or use "OpenGL Rendering Subsystem"
             mRoot.RenderSystem = rs;
             rs.SetConfigOption("Full Screen", "No");
             rs.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

             // Create Render Window
             mRoot.Initialise(false, "Main Ogre Window");
             NameValuePairList misc = new NameValuePairList();
             misc["externalWindowHandle"] = Handle.ToString();
             mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

             // Init resources
             TextureManager.Singleton.DefaultNumMipmaps = 5;
             ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

             // Create a Simple Scene
             SceneManager mgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC);
             Camera cam = mgr.CreateCamera("Camera");
             cam.AutoAspectRatio = true;
             mWindow.AddViewport(cam);

             Entity ent = mgr.CreateEntity("ninja", "ninja.mesh");
             mgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);

             cam.Position = new Vector3(0, 200, -400);
             cam.LookAt(ent.BoundingBox.Center);
        }
开发者ID:andyhebear,项目名称:mogresdk,代码行数:52,代码来源:Form1.cs

示例5: Program

        /// <summary>
        /// set up ogre
        /// </summary>
        public Program()
        {
            root = new Root("plugins.cfg", "", "Ogre.log");

            renderSystem = root.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
            renderSystem.SetConfigOption("Full Screen", "No");
            renderSystem.SetConfigOption("Video Mode", "1920 x 1200 @ 32-bit colour");
            root.RenderSystem = renderSystem;

            SetupResources();
            window = root.Initialise(true, "shadow test");

            sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "sceneMgr");
            sceneMgr.AmbientLight = new ColourValue(0.8f, 0.8f, 0.8f);

            camera = sceneMgr.CreateCamera("cam");
            camera.Position = new Vector3(0.8f, 0.8f, 0.8f);
            camera.LookAt(new Vector3(-1, 1, -1));
            camera.SetAutoTracking(true, sceneMgr.RootSceneNode.CreateChildSceneNode(new Vector3(0, 0.4f, 0)));
            camera.NearClipDistance = 0.1f;
            camera.FarClipDistance = 2000;

            viewport = window.AddViewport(camera);
            viewport.BackgroundColour = ColourValue.Black;
            camera.AspectRatio = (float) viewport.ActualWidth / (float) viewport.ActualHeight;

            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

            TextureManager.Singleton.DefaultNumMipmaps = 1;

            CreateThings();

            //SetupParticles();
            //SetupShadows();

            SetupInput();

            root.FrameStarted += FrameStarted;

            Console.WriteLine(
            @"

            Press 1, 2, 3, 4 to enable/disable lights, or Esc to quit.
            The red and blue textures have PSSM and self-shadowing enabled.
            The yellow one does not.
            You can also use WASDQE to move the camera around."
            );
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:51,代码来源:Program.cs

示例6: Init

        public void Init(String handle)
        {
            try
            {
                // Create root object
                mRoot = new Root();

                // Define Resources
                ConfigFile cf = new ConfigFile();
                cf.Load("./resources.cfg", "\t:=", true);
                ConfigFile.SectionIterator seci = cf.GetSectionIterator();
                String secName, typeName, archName;

                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);
                    }
                }

                //Load the resources from resources.cfg and selected tab (_ConfigurationPaths)
                //LoadResourceLocations(_ConfigurationPaths);

                //example of manual add: _FileSystemPaths.Add("../../Media/models");
                foreach (string foo in _ConfigurationPaths)
                {
                    AddResourceLocation(foo);
                }

                // Setup RenderSystem
                mRSys = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
                //mRSys = mRoot.GetRenderSystemByName("OpenGL Rendering Subsystem");

                // or use "OpenGL Rendering Subsystem"
                mRoot.RenderSystem = mRSys;

                mRSys.SetConfigOption("Full Screen", "No");
                mRSys.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

                // Create Render Window
                mRoot.Initialise(false, "Main Ogre Window");
                NameValuePairList misc = new NameValuePairList();
                misc["externalWindowHandle"] = handle;
                misc["FSAA"] = "4";
                // misc["VSync"] = "True"; //not sure how to enable vsync to remove those warnings in Ogre.log
                mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

                // Init resources
                MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_ANISOTROPIC);
                TextureManager.Singleton.DefaultNumMipmaps = 5;
                ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

                // Create a Simple Scene
                //SceneNode node = null;
                // mMgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC, "SceneManager");
                mMgr = mRoot.CreateSceneManager(SceneType.ST_EXTERIOR_CLOSE, "SceneManager");

                mMgr.AmbientLight = new ColourValue(0.8f, 0.8f, 0.8f);

                mCamera = mMgr.CreateCamera("Camera");
                mWindow.AddViewport(mCamera);

                mCamera.AutoAspectRatio = true;
                mCamera.Viewport.SetClearEveryFrame(false);

                //Entity ent = mMgr.CreateEntity(displayMesh, displayMesh);

                //ent.SetMaterialName(displayMaterial);
                //node = mMgr.RootSceneNode.CreateChildSceneNode(displayMesh + "node");
                //node.AttachObject(ent);

                mCamera.Position = new Vector3(0, 0, 0);
                //mCamera.Position = new Vector3(0, 0, -400);
                mCamera.LookAt(0, 0, 1);

                //Create a single point light source
                Light light2 = mMgr.CreateLight("MainLight");
                light2.Position = new Vector3(0, 10, -25);
                light2.Type = Light.LightTypes.LT_POINT;
                light2.SetDiffuseColour(1.0f, 1.0f, 1.0f);
                light2.SetSpecularColour(0.1f, 0.1f, 0.1f);

                mWindow.WindowMovedOrResized();

                IsInitialized = true;

                // Create the camera's top node (which will only handle position).
                cameraNode = mMgr.RootSceneNode.CreateChildSceneNode();
                cameraNode.Position = new Vector3(0, 0, 0);

                //cameraNode = mMgr->getRootSceneNode()->createChildSceneNode();
                //cameraNode->setPosition(0, 0, 500);

                // Create the camera's yaw node as a child of camera's top node.
                cameraYawNode = cameraNode.CreateChildSceneNode();
//.........这里部分代码省略.........
开发者ID:zinick,项目名称:Ogre3D-Level-Editor,代码行数:101,代码来源:OgreForm.cs

示例7: InitRenderer

        public void InitRenderer()
        {
            try
            {
                OgreRoot = new Root();

                {	//Load config file data
                    ConfigFile cf = new ConfigFile();
                    cf.Load("./resources.cfg", "\t:=", true);
                    ConfigFile.SectionIterator seci = cf.GetSectionIterator();
                    String secName, typeName, archName;

                    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);
                        }
                    }
                }

                OgreRenderSystem = OgreRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
                OgreRenderSystem.SetConfigOption("Full Screen", "No");
                OgreRenderSystem.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

                OgreRoot.RenderSystem = OgreRenderSystem;
                OgreRoot.Initialise(false, "Main Ogre Window");

                NameValuePairList misc = new NameValuePairList();
                misc["externalWindowHandle"] = RenderPanel.Handle.ToString();
                misc["FSAA"] = "4";
                OgreRenderWindow = OgreRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

                OgreRenderWindow.IsActive = true;
                OgreRenderWindow.IsAutoUpdated = true;

                MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_ANISOTROPIC);

                //Trigger background resource load
                StartResourceThread();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error during renderer initialization:" + ex.Message + "," + ex.StackTrace);
            }
        }
开发者ID:Jerdak,项目名称:OgreWpf,代码行数:50,代码来源:Window1.xaml.cs


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