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


C# Root.CreateSceneManager方法代码示例

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


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

示例1: 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

示例2: 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

示例3: World

        public World(Root root, CameraManager cameraManager, string sceneFile = "")
        {
            this.CameraManager = cameraManager;
            SceneName = sceneFile;
            Scene = root.CreateSceneManager(SceneType.ST_GENERIC);
            SearchGraph = new SearchGraph(this);
            if (sceneFile != "")
            {
                SceneLoader loader = new SceneLoader();
                List<Vector3> PathNodes = new List<Vector3>();
                loader.ParseDotScene(sceneFile, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, Scene, WorldNode, PathNodes, this);
                Scene.SetSkyDome(true, "SkyBoxes/CloudySky", 5, 8, 2000);
                PathNodes.ForEach(x => SearchGraph.AddVertex(x));
            }
            Scene.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);
            Light dirLight = CreateLight(new Vector3(100, 100, 100));
            dirLight.Type = Light.LightTypes.LT_DIRECTIONAL;

            BillboardSystemManager = new Billboards.BillboardSystemManager(Scene, WorldNode);
            ParticleSystemManager = new UniqueParticleSystemManager(Scene, WorldNode);
            CompoundEffectManager = new CompoundEffects.CompoundEffectManager(this);
            SoundEngine = new SoundEngine();
        }
开发者ID:nigelchanyk,项目名称:Archetype,代码行数:23,代码来源:World.cs

示例4: 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

示例5: 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(0.5f, 0.5f, 0.5f);

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

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

            Entity ent = sceneMgr.CreateEntity("ogre", "ogrehead.mesh");
            SceneNode node = sceneMgr.RootSceneNode.CreateChildSceneNode("ogreNode");
            node.AttachObject(ent);
        }
开发者ID:andyhebear,项目名称:mogrelibrarys,代码行数:83,代码来源:MogreForm.cs

示例6: InitMogre

        public void InitMogre()
        {
            root = new Root();
            #if DEBUG
            root.LoadPlugin("RenderSystem_Direct3D9_d");
            #else
            root.LoadPlugin("RenderSystem_Direct3D9");
            #endif

            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",
                String.Format("{0} x {1} @ 32-bit colour", windowSize.Width, windowSize.Height));

            root.Initialise(false);

            // other plugins
            #if DEBUG
            root.LoadPlugin("Plugin_CgProgramManager_d");
            root.LoadPlugin("Plugin_OctreeSceneManager_d");

            #else
            root.LoadPlugin("Plugin_CgProgramManager");
            root.LoadPlugin("Plugin_OctreeSceneManager");
            #endif

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

            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

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

            camera = sceneMgr.CreateCamera("SimpleCamera");
            camera.NearClipDistance = 0.1f;
            camera.AutoAspectRatio = true;

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

            root.FrameStarted += new FrameListener.FrameStartedHandler(MogreFrameStarted);
        }
开发者ID:realmzero,项目名称:RZModelViewer,代码行数:59,代码来源:OgreWindow.cs

示例7: CreateRoot

        private void CreateRoot()
        {
            m_Root = new Root();
            m_Root.LoadPlugin("RenderSystem_Direct3D9");
            m_Root.LoadPlugin("RenderSystem_GL");
            m_Root.LoadPlugin("Plugin_OctreeSceneManager");

            m_SceneManager = m_Root.CreateSceneManager(SceneType.ST_GENERIC);
            m_Scene = new Scene(m_Bus, m_SceneManager);
        }
开发者ID:anthony-martin,项目名称:Triangles-in-space,代码行数:10,代码来源:Renderer.cs

示例8: OnOgreInitComplete

        private void OnOgreInitComplete(object sender, RoutedEventArgs args)
        {
            if (AutoUpdateViewportSize) {
                MogreImage.SizeChanged += new SizeChangedEventHandler(MogreImage_SizeChanged);
            }
            mogreImageSource.IsDebugOverlayVisible = true;

            //-----------------------------------------------------------------------------

            TextureManager.Singleton.DefaultNumMipmaps = 6;

            root = MogreRootManager.GetSharedRoot();
            sceneMgr = mogreImageSource.SceneManager = 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;

            mogreImageSource.ViewportDefinitions = new ViewportDefinition[] { new ViewportDefinition(camera) };

            CreateThings();
            //SetupInput();

            mogreImageSource.Root.FrameStarted += FrameStarted;
        }
开发者ID:Nuke928,项目名称:PonyKart,代码行数:29,代码来源:MainWindow.xaml.cs

示例9: Initialise

        public void Initialise()
        {
            Root = new Root();
            ConfigFile cf = new ConfigFile();
            cf.Load("Resources.cfg", "\t:=", true);

            ConfigFile.SectionIterator seci = cf.GetSectionIterator();

            while (seci.MoveNext())
            {
                ConfigFile.SettingsMultiMap settings = seci.Current;
                foreach (KeyValuePair<string, string> pair in settings)
                    ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey);
            }

            if (!Root.RestoreConfig())
                if (!Root.ShowConfigDialog())
                    return;

            Root.RenderSystem.SetConfigOption("VSync", "Yes");
            RenderWindow = Root.Initialise(true, "WorldCreator");  // @@@@@@@@@@@@@@@ Nazwa okna gry.
            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

            SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC);
            Camera = SceneManager.CreateCamera("MainCamera");
            Viewport = RenderWindow.AddViewport(Camera);
            Camera.NearClipDistance = 0.1f;
            Camera.FarClipDistance = 1000.0f;
            Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height);

            MOIS.ParamList pl = new MOIS.ParamList();
            IntPtr windowHnd;
            RenderWindow.GetCustomAttribute("WINDOW", out windowHnd);
            pl.Insert("WINDOW", windowHnd.ToString());

            InputManager = MOIS.InputManager.CreateInputSystem(pl);

            Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, false);
            Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, false);

            NewtonWorld = new World();
            NewtonDebugger = new Debugger(NewtonWorld);
            NewtonDebugger.Init(SceneManager);

            ObjectManager = new ObjectManager();

            MaterialManager = new MaterialManager();
            MaterialManager.Initialise();

            //CharacterProfileManager = new CharacterProfileManager();
            Items = new Items();
            //PrizeManager = new PrizeManager();  //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ
            //Quests = new Quests();
            //NPCManager = new NPCManager();

            Labeler = new TextLabeler(5);

            User = new Player();

            CharacterProfileManager = new CharacterProfileManager();

            NPCManager = new NPCManager();

            HumanController = new HumanController();

            TypedInput = new TypedInput();

            //SoundManager = new SoundManager();
        }
开发者ID:janPierdolnikParda,项目名称:WorldCreator,代码行数:69,代码来源:Engine.cs

示例10: InitSceneManager

 /// <summary>
 /// Creates the scene manager and sets up shadow stuff
 /// </summary>
 private static SceneManager InitSceneManager(Root root)
 {
     Launch.Log("[Loading] Creating SceneManager");
     var sceneMgr = root.CreateSceneManager("OctreeSceneManager", "sceneMgr");
     return sceneMgr;
 }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:9,代码来源:LKernel+(ogre+initialisers).cs

示例11: Initiliase

        public bool Initiliase(bool autoCreateWindow)
        {
            root = new Root();

            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
            //-----------------------------------------------------
            string renderSystem = "Direct3D9 Rendering Subsystem";

            if (!FindRenderSystem(renderSystem))
                throw new Exception("Unable to find render system: " + renderSystem);

            //we found it, we might as well use it!
            root.RenderSystem.SetConfigOption("VSync", "Yes");      // graphics card doesn't work so hard, physics engine should be more stable
            root.RenderSystem.SetConfigOption("Full Screen", "No");
            root.RenderSystem.SetConfigOption("Video Mode", "1024 x 768 @ 32-bit colour");

            // scene manager
            sceneManager = root.CreateSceneManager(SceneType.ST_GENERIC);

            // render window
            this.renderWindow = root.Initialise(autoCreateWindow, "GlueEngine");
            return true;
        }
开发者ID:andyhebear,项目名称:glueeengine,代码行数:45,代码来源:GraphicsManager.cs

示例12: _InitOgre

        protected bool _InitOgre()
        {
            lock (this)
            {
                IntPtr hWnd = IntPtr.Zero;

                foreach (PresentationSource source in PresentationSource.CurrentSources)
                {
                    var hwndSource = (source as HwndSource);
                    if (hwndSource != null)
                    {
                        hWnd = hwndSource.Handle;
                        break;
                    }
                }

                if (hWnd == IntPtr.Zero) return false;

                CallResourceItemLoaded(new ResourceLoadEventArgs("Engine", 0));

                // load the OGRE engine
                //
                _root = new Root();

                // configure resource paths from : "resources.cfg" file
                //
                var configFile = new ConfigFile();
                configFile.Load("resources.cfg", "\t:=", true);

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

                // Normally we would use the foreach syntax, which enumerates the values,
                // but in this case we need CurrentKey too;
                while (seci.MoveNext())
                {
                    string secName = seci.CurrentKey;

                    ConfigFile.SettingsMultiMap settings = seci.Current;
                    foreach (var pair in settings)
                    {
                        string typeName = pair.Key;
                        string archName = pair.Value;
                        ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
                    }
                }

                // Configures the application and creates the Window
                // A window HAS to be created, even though we'll never use it.
                //
                bool foundit = false;
                foreach (RenderSystem rs in _root.GetAvailableRenderers())
                {
                    if (rs == null) continue;

                    _root.RenderSystem = rs;
                    String rname = _root.RenderSystem.Name;
                    if (rname == "Direct3D9 Rendering Subsystem")
                    {
                        foundit = true;
                        break;
                    }
                }

                if (!foundit)
                    return false;

                _root.RenderSystem.SetConfigOption("Full Screen", "No");
                _root.RenderSystem.SetConfigOption("Video Mode", "1024 x 768 @ 32-bit colour");

                _root.Initialise(false);

                var misc = new NameValuePairList();
                misc["externalWindowHandle"] = hWnd.ToString();
                _renderWindow = _root.CreateRenderWindow("OgreImageSource Windows", 0, 0, false, misc);
                _renderWindow.IsAutoUpdated = false;

                InitResourceLoad();
                ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

                this.Dispatcher.Invoke(
                    (MethodInvoker)delegate
                                       {
                                           if (CreateDefaultScene)
                                           {
                                               //-----------------------------------------------------
                                               // 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
                                               //-----------------------------------------------------
                                               _sceneManager = _root.CreateSceneManager(SceneType.ST_GENERIC, "SceneMgr");
                                               _sceneManager.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);

                                               //-----------------------------------------------------
                                               // 5 Create the camera
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:esdogre,代码行数:101,代码来源:OgreImage.cs

示例13: Initialise

        public void Initialise()
        {
            Root = new Root();
            ConfigFile cf = new ConfigFile();
            cf.Load("Resources.cfg", "\t:=", true);

            ConfigFile.SectionIterator seci = cf.GetSectionIterator();

            while (seci.MoveNext())
            {
                ConfigFile.SettingsMultiMap settings = seci.Current;
                foreach (KeyValuePair<string, string> pair in settings)
                    ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey);
            }

            if (!Root.RestoreConfig())
                if (!Root.ShowConfigDialog())
                    return;

            Root.RenderSystem.SetConfigOption("VSync", "Yes");
            RenderWindow = Root.Initialise(true, "Kolejny epicki erpeg");  // @@@@@@@@@@@@@@@ Nazwa okna gry.

            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

            SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC);
            Camera = SceneManager.CreateCamera("MainCamera");
            Viewport = RenderWindow.AddViewport(Camera);
            Camera.NearClipDistance = 0.1f;
            Camera.FarClipDistance = 1000.0f;
            Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height);

            MOIS.ParamList pl = new MOIS.ParamList();
            IntPtr windowHnd;
            RenderWindow.GetCustomAttribute("WINDOW", out windowHnd);
            pl.Insert("WINDOW", windowHnd.ToString());

            InputManager = MOIS.InputManager.CreateInputSystem(pl);

            Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, true);
            Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, true);

            NewtonWorld = new World();
            NewtonDebugger = new Debugger(NewtonWorld);
            NewtonDebugger.Init(SceneManager);

            GameCamera = new GameCamera();
            ObjectManager = new ObjectManager();

            MaterialManager = new MaterialManager();
            MaterialManager.Initialise();

            Items = new Items();
            PrizeManager = new PrizeManager();  //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ
            CharacterProfileManager = new CharacterProfileManager();
            Quests = new Quests();
            NPCManager = new NPCManager();

            Labeler = new TextLabeler(5);
            Random = new Random();
            HumanController = new HumanController();

            TypedInput = new TypedInput();

            SoundManager = new SoundManager();

            Dialog = new Dialog();
            Mysz = new MOIS.MouseState_NativePtr();
            Conversations = new Conversations();

            TriggerManager = new TriggerManager();

            Engine.Singleton.Keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(TypedInput.onKeyPressed);
            Mouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(MouseReleased);

            IngameConsole = new IngameConsole();
            IngameConsole.Init();
            IngameConsole.AddCommand("dupa", "soundOddawajPiec");
            IngameConsole.AddCommand("tp", "ZejscieDoPiwnicy");
            IngameConsole.AddCommand("exit", "Exit", "Wychodzi z gry. Ale odkrywcze. Super. Musze sprawdzic jak sie zachowa konsola przy duzej dlugosci linii xD llllllllllllllllllllllllllllllllllllllllllllmmmmmmmmmmmmmmmmmmmmmiiiiiiiiiiiiiiii");
            IngameConsole.AddCommand("play", "playSound", "Odtwarza dzwiek. Skladnia: play <sciezka do pliku>. Np. play other/haa.mp3");
            IngameConsole.AddCommand("map", "ChangeMap");
            IngameConsole.AddCommand("save", "SaveGame");
            IngameConsole.AddCommand("load", "LoadGame");
            IngameConsole.AddCommand("help", "ConsoleHelp");
            IngameConsole.AddCommand("h", "CommandHelp");
        }
开发者ID:janPierdolnikParda,项目名称:RPG,代码行数:86,代码来源:Engine.cs

示例14: Initialise

        public void Initialise()
        {
            m_Root = new Root();
            ConfigFile cf = new ConfigFile();
            cf.Load("Resources.cfg", "\t:=", true);

            ConfigFile.SectionIterator seci = cf.GetSectionIterator();

            while (seci.MoveNext())
            {
                ConfigFile.SettingsMultiMap settings = seci.Current;
                foreach (KeyValuePair<string, string> pair in settings)
                    ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey);
            }

            if (!m_Root.RestoreConfig())
                if (!m_Root.ShowConfigDialog())
                    return;

            m_RenderWindow = m_Root.Initialise(true);
            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

            m_SceneManager = m_Root.CreateSceneManager(SceneType.ST_GENERIC);
            m_Camera = m_SceneManager.CreateCamera("MainCamera");
            m_Viewport = m_RenderWindow.AddViewport(m_Camera);
            m_Camera.NearClipDistance = 0.1f;
            m_Camera.FarClipDistance = 1000.0f;

            MOIS.ParamList pl = new MOIS.ParamList();
            IntPtr windowHnd;
            m_RenderWindow.GetCustomAttribute("WINDOW", out windowHnd);
            pl.Insert("WINDOW", windowHnd.ToString());

            m_InputManager = MOIS.InputManager.CreateInputSystem(pl);

            m_Keyboard = (MOIS.Keyboard)m_InputManager.CreateInputObject(MOIS.Type.OISKeyboard, false);
            m_Mouse = (MOIS.Mouse)m_InputManager.CreateInputObject(MOIS.Type.OISMouse, false);

            m_NewtonWorld = new World();
            m_NewtonDebugger = new Debugger(m_NewtonWorld);
            m_NewtonDebugger.Init(m_SceneManager);

            m_GameCamera = new GameCamera();
            m_ObjectManager = new ObjectManager();
        }
开发者ID:Marchew,项目名称:Tachycardia,代码行数:45,代码来源:Core.cs

示例15: init

            public bool init()
            {
                // Start with a new root to get this party started
                root = new Root();

                // Configuration buisness
                ConfigFile config = new ConfigFile();
                config.Load("resources.cfg", "\t:=", true);

                // Go through all our configuration settings
                ConfigFile.SectionIterator itor = config.GetSectionIterator();
                string secName, typeName, archName;

                // Move through all of the sections
                while (itor.MoveNext())
                {
                  secName = itor.CurrentKey;
                  ConfigFile.SettingsMultiMap settings = itor.Current;
                  foreach (KeyValuePair<string, string> pair in settings)
                  {
                typeName = pair.Key;
                archName = pair.Value;
                ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
                  }
                }

                // Configure our window and set up the RenderSystem
                bool found = false;
                foreach (RenderSystem rs in root.GetAvailableRenderers())
                {
                  root.RenderSystem = rs;
                  string rname = root.RenderSystem.Name;
                  if (rname == "Direct3D9 Rendering Subsystem")
                  {
                found = true;
                break;
                  }
                }

                // If we can't find the DirectX rendering system somethign is seriously wrong
                if (!found)
                  return false;

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

                // Create our SceneManager
                sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "SceneMgr");
                sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);
                sceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_STENCIL_ADDITIVE;

                // Create the camera
                camMgr = new CamManager();
                camMgr.Initialize(ref sceneMgr);

                viewport = window.AddViewport(camMgr.mainCam);
                viewport.BackgroundColour = new ColourValue(0, 0, 0, 1);

                // Load our stick here
                LoadModel("TEStick.mesh");

                // Set up ground
                Plane plane = new Plane(Mogre.Vector3.UNIT_Y, 0);
                MeshManager.Singleton.CreatePlane("ground", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane,
                  1500, 1500, 20, 20, true, 1, 5, 5, Mogre.Vector3.UNIT_Z);
                Entity ground = sceneMgr.CreateEntity("GroundEnt", "ground");
                sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(ground);

                ground.SetMaterialName("Examples/Rockwall");
                ground.CastShadows = false;

                // Set up some lights
                Light pointLight = sceneMgr.CreateLight("pointLight");
                pointLight.Type = Light.LightTypes.LT_POINT;
                pointLight.Position = new Mogre.Vector3(0, 150, 250);
                pointLight.DiffuseColour = ColourValue.White;
                pointLight.SpecularColour = ColourValue.White;

                Light directionalLight = sceneMgr.CreateLight("directionalLight");
                directionalLight.Type = Light.LightTypes.LT_DIRECTIONAL;
                directionalLight.DiffuseColour = new ColourValue(.25f, .25f, 0);
                directionalLight.SpecularColour = new ColourValue(.25f, .25f, 0);
                directionalLight.Direction = new Mogre.Vector3(0, -1, 1);

                Light spotLight = sceneMgr.CreateLight("spotLight");
                spotLight.Type = Light.LightTypes.LT_SPOTLIGHT;
                spotLight.DiffuseColour = ColourValue.White;
                spotLight.SpecularColour = ColourValue.White;
                spotLight.Direction = new Mogre.Vector3(-1, -1, 0);
                spotLight.Position = new Mogre.Vector3(300, 300, 0);
                spotLight.SetSpotlightRange(new Degree(35), new Degree(50));

                // Set up our Input
                root.FrameRenderingQueued += new FrameListener.FrameRenderingQueuedHandler(Input);
//.........这里部分代码省略.........
开发者ID:aczarno,项目名称:StickMagik,代码行数:101,代码来源:OgreForm.cs


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