예제 #1
0
        public virtual bool Setup()
        {
            // Create root
            var pluginFileName = _fileSystemLayer.GetConfigFilePath("plugins.cfg");

            _root = new Root(pluginFileName,
                             _fileSystemLayer.GetWritablePath("ogre.cfg"),
                             _fileSystemLayer.GetWritablePath("Ogre.log"));

            // Create OverlaySystem
            _overlaySystem = new OverlaySystem();

            //
            SetupResources();
            //if (Configure() == false)
            //{
            //	return false;
            //}
            SetupDirectX();

            // Create RenderWindow
            _root.Initialise(false);
            var nameValuePairList = new NameValuePairList();

            nameValuePairList["externalWindowHandle"] = Handle.ToString();
            _window = _root.CreateRenderWindow("Mogre RenderWindow", 800, 600, false, nameValuePairList);

            TestCapabilities(_root.RenderSystem.Capabilities);

            // Now we have GPU stuff setup
            ResourceGroupManager.Singleton.AddBuiltinLocations();

            _sceneManager = CreateSceneManager();
#if INCLUDE_RTSHADER_SYSTEM
            if (!_root.RenderSystem.Capabilities.HasCapability(Capabilities.RSC_FIXED_FUNCTION))
            {
                InitializeRTShaderSystem(_sceneManager);
            }
#endif

            _overlaySystem.SceneManager = _sceneManager;
            CreateCamera();
            TextureManager.Singleton.DefaultNumMipmaps = 5;
            LoadResources();
            _workspace = SetupCompositor();
            CreateInputHandler();
            Disposed += OgreWindow_Disposed;
            CreateScene();

            // Create Frame Listeners
            _root.FrameStarted               += OnFrameStarted;
            _root.FrameRenderingQueued       += OnFrameRenderingQueued;
            _root.FrameEnded                 += OnFrameEnded;
            _sceneManager.RenderQueueStarted += _sceneManager_RenderQueueStarted;
            _trayManager = new SdkTrayManager("SampleControls", _window);
            _trayManager.ShowFrameStats(TrayLocation.BottomLeft);
            _trayManager.ShowLogo(TrayLocation.BottomRight);
            _trayManager.ShowCursor();

            return(true);
        }
예제 #2
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(OverlaySystem obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }