Ejemplo n.º 1
0
        public void Dispose()
        {
            TextureDatabase.ReleaseTextures();
            CommonResourceGroup.removeResource("__RmlViewerFilesystem__");

            ReferenceCountable.DumpLeakReport();
            Root.getSingleton().getRenderSystem().removeListener(renderSystemListener);
            Core.Shutdown();
            if (renderInterface != null)
            {
                renderInterface.Dispose();
            }
            if (systemInterface != null)
            {
                systemInterface.Dispose();
            }
        }
Ejemplo n.º 2
0
        public void link(PluginManager pluginManager)
        {
            Root.getSingleton().addArchiveFactory(rocketFilesystemArchiveFactory);

            if (FileInterface == null)
            {
                FileInterface = new VirtualFileSystemFileInterface();
            }

            resources = pluginManager.createLiveResourceManager("Rocket");
            var rendererResources = resources.getSubsystemResource("Ogre");

            CommonResourceGroup = rendererResources.addResourceGroup("Common");
            CommonResourceGroup.addResource("__RmlViewerFilesystem__", RocketFilesystemArchive.ArchiveName, false);
            CommonResourceGroup.addResource(GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true);
            var shaders = rendererResources.addResourceGroup("Shaders");

            shaders.addResource(this.GetType().AssemblyQualifiedName, "EmbeddedResource", false);
            var shared = rendererResources.addResourceGroup("Shared");

            shared.addResource("__LibRocketCommonResourcesFilesystem__", CommonResourcesArchiveFactory.Name, false);
            resources.initializeResources();

            Root.getSingleton().Disposed += OgreRoot_Disposed;

            OgreWindow ogreWindow = pluginManager.RendererPlugin.PrimaryWindow as OgreWindow;

            systemInterface = new ManagedSystemInterface();
            renderInterface = new RenderInterfaceOgre3D((int)ogreWindow.OgreRenderTarget.getWidth(), (int)ogreWindow.OgreRenderTarget.getHeight());
            renderInterface.PixelsPerInch = pixelsPerInch;
            renderInterface.PixelScale    = ScaleHelper.ScaleFactor;

            renderSystemListener = new RocketRenderSystemListener();
            Root.getSingleton().getRenderSystem().addListener(renderSystemListener);

            Core.SetSystemInterface(systemInterface);
            Core.SetRenderInterface(renderInterface);

            Core.Initialise();
            Controls.Initialise();
        }
Ejemplo n.º 3
0
        public void link(PluginManager pluginManager)
        {
            Log.Info("Initializing MyGUI");

            resources = pluginManager.createLiveResourceManager("MyGUI");
            var rendererResources = resources.getSubsystemResource("Ogre");

            CommonResourceGroup = rendererResources.addResourceGroup("Common");
            CommonResourceGroup.addResource(GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true);
            resources.initializeResources();

            sceneManager = Root.getSingleton().createSceneManager(SceneType.ST_GENERIC, "MyGUIScene");
            ogreWindow   = pluginManager.RendererPlugin.PrimaryWindow as OgreWindow;

            //Create camera and viewport
            camera = sceneManager.createCamera("MyGUICamera");
            vp     = ogreWindow.OgreRenderTarget.addViewport(camera, ViewportZIndex, 0.0f, 0.0f, 1.0f, 1.0f);
            vp.setBackgroundColor(new Color(1.0f, 0.0f, 1.0f, 0.0f));
            vp.setClearEveryFrame(false);
            vp.clear();

            //Create Ogre Platform
            ogrePlatform = new OgrePlatform();
            ogrePlatform.initialize(vp.getActualWidth(), vp.getActualHeight(), CommonResourceGroup.FullName, LogFile);

            //Create log
            managedLogListener = new ManagedMyGUILogListener();

            renderListener = new MyGUIRenderListener(vp, sceneManager, ogrePlatform.RenderManager);
            if (ogreWindow.OSWindow != null)
            {
                ogreWindow.OSWindow.Resized += OSWindow_Resized;
            }

            gui             = new Gui();
            gui.ScaleFactor = ScaleHelper.ScaleFactor;
            gui.initialize("");

            //Load config files
            if (BeforeMainResourcesLoaded != null)
            {
                BeforeMainResourcesLoaded.Invoke(this);
            }

            ResourceManager resourceManager = ResourceManager.Instance;

            if (!String.IsNullOrEmpty(OSTheme))
            {
                resourceManager.load(OSTheme);
            }
            resourceManager.load(MainTheme);
            resourceManager.load(PointerFile);
            resourceManager.load(LayerFile);
            resourceManager.load(MessageBoxTheme);

            var platformProvider = pluginManager.GlobalScope.ServiceProvider.GetRequiredService <OgrePlatformProvider>();

            platformProvider.OgrePlatform = ogrePlatform;

            Log.Info("Finished initializing MyGUI");
        }