Esempio n. 1
0
        public void destroyRendererWindow(RendererWindow window)
        {
            OgreWindow ogreWindow = window as OgreWindow;

            if (ogreWindow != null)
            {
                Log.Default.sendMessage("Destroying RenderWindow {0}.", LogLevel.Info, "OgrePlugin", ogreWindow.OgreRenderTarget.getName());
                ogreWindow.Dispose();
                root.destroyRenderTarget(ogreWindow.OgreRenderTarget);
                if (ogreWindow == primaryWindow)
                {
                    primaryWindow = null;
                }
            }
            else
            {
                if (window == null)
                {
                    Log.Default.sendMessage("Error attempted to destroy a null RenderWindow. No changes have been made.", LogLevel.Warning, "OgrePlugin");
                }
                else
                {
                    Log.Default.sendMessage("Error destroying RendererWindow {0}. It is not a recognized OgreWindow. The window has not been destroyed.", LogLevel.Warning, "OgrePlugin", window.ToString());
                }
            }
        }
Esempio n. 2
0
        public void InitializeRenderer(RendererWindow WindowHandle, IPreferredGraphicsDeviceFilter myPreferencesForDevice = null)
        {
            Gl.Enable(EnableCap.Multisample);
            byte[]  ShaderData = null;
            Program myProgram  = new Program(_VertexSourceGL, _FragmentSourceGL);

            int linked;

            Gl.GetProgram(ProgramName, ProgramProperty.LinkStatus, out linked);
            if (linked == 0)
            {
                throw new Exception("Damn");
            }
            if ((LocationMVP = Gl.GetUniformLocation(ProgramName, "uMVP")) < 0)
            {
                throw new InvalidOperationException("no uniform uMVP");
            }

            // Get attributes locations
            if ((LocationPosition = Gl.GetAttribLocation(ProgramName, "aPosition")) < 0)
            {
                throw new InvalidOperationException("no attribute aPosition");
            }
            if ((LocationColor = Gl.GetAttribLocation(ProgramName, "aColor")) < 0)
            {
                throw new InvalidOperationException("no attribute aColor");
            }
            this.WindowHandle = WindowHandle;
            _VertexArray      = new VertexArray(myProgram, _ArrayPosition, _ArrayColor);
            Gl.Viewport(0, 0, WindowHandle.Width, WindowHandle.Height);

            Gl.ClearColor(Color.AliceBlue.R, Color.AliceBlue.G, Color.AliceBlue.B, Color.AliceBlue.A);
        }
Esempio n. 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Globals.ObjectAdded    += OnObjectAdded;
            Globals.ObjectSelected += OnObjectSelected;
            Globals.ObjectRemoved  += OnObjectRemoved;
            Globals.Draw           += OnDraw;
            Globals.Update         += OnUpdate;

            // Store this for quick access to our drop down pgrid editors
            Globals.RenderWindow = this;

            Camera          = new BasicCamera(Globals.Game);
            Camera.Position = new Vector3(0, 1, 50);

            // Create our Resolution Ruler Marks
            SceneMarkers = new ResolutionMarkers(Globals.Game);
            SceneMarkers.Initialize();

            // Create our Scene Manager
            SceneManager = new SceneManager(Globals.Game);
            SceneManager.Initialize();

            // Create our Game Screen for Rendering
            RenderWindow = new RendererWindow(Globals.Game);

            // Add our Game Screen for rendering to it
            SceneManager.Load(RenderWindow);
        }
Esempio n. 4
0
        static void Main()
        {
            //System.Windows.Forms.Application.EnableVisualStyles();
            //System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            //System.Windows.Forms.Application.Run(new MainForm());

            using (RendererWindow renderer = new RendererWindow())
            {
                renderer.Renderables.Add(new FPSDisplay());
                renderer.Renderables.Add(new BasicTerrain(513));
                renderer.Run();
            }
        }
        public SceneViewController(MDILayoutManager mdiLayout, EventManager eventManager, UpdateTimer mainTimer, RendererWindow rendererWindow, OgreRenderManager renderManager, BackgroundScene background)
        {
            this.DefaultBackgroundColor = new Color(0.149f, 0.149f, 0.149f);
            this.background             = background;
            this.mainTimer        = mainTimer;
            this.rendererWindow   = rendererWindow;
            this.mdiLayout        = mdiLayout;
            cameraInputController = new CameraInputController(this, eventManager);

            rm = renderManager;
            mdiLayout.ActiveWindowChanged += new EventHandler(mdiLayout_ActiveWindowChanged);
            eventManager.setUnprojectFunction(unproject);
        }
Esempio n. 6
0
        public VulkanInitializer(String WindowName, RendererWindow WindowHandle, GraphicsSettings mySettings, IPreferredGraphicsDeviceFilter myGraphicsDeviceFilter = null, IPreferredComputeDeviceFilter myComputeDeviceFilter = null)
        {
            var Window       = new VulkanInstance(WindowName, WindowHandle.WindowHandle);
            var Surface      = new SurfaceKHR(Window);
            var myDeviceList = new VulkanSupportedDevices(Window, Surface, myGraphicsDeviceFilter, myComputeDeviceFilter);

            var SelectedPhysicalGraphicsDevice = myDeviceList.GetBestGraphicsDevice();
            var SelectedLogicalGraphicsDevice  = new VulkanLogicalDevice(SelectedPhysicalGraphicsDevice);

            DescriptorSetPoolManager myDescriptorPoolGraphicsManager;
            DescriptorSetPoolManager myDescriptorPoolComputeManager;

            Renderer.Vulkan.Queue myGraphicsQueue = null;
            Renderer.Vulkan.Queue myComputeQueue  = null;

            var SelectedPhysicalComputeDevice = myDeviceList.GetNextComputeDevice();
            VulkanLogicalDevice SelectedLogicalComputeDevice;

            if (myDeviceList.Count == 1)
            {
                //Compute and Renderer will share a device.
                SelectedLogicalComputeDevice    = new VulkanLogicalDevice(SelectedPhysicalGraphicsDevice);
                myDescriptorPoolGraphicsManager = new DescriptorSetPoolManager(SelectedLogicalGraphicsDevice);
                myDescriptorPoolComputeManager  = myDescriptorPoolGraphicsManager;
                myGraphicsQueue = SelectedLogicalGraphicsDevice.QueueManager.GetQueue(QueueFlags.Graphics);
                myComputeQueue  = SelectedLogicalGraphicsDevice.QueueManager.GetQueue(QueueFlags.Compute);
            }
            else
            {
                //TODO: iterate through queue to find next best device for compute
                SelectedLogicalComputeDevice    = new VulkanLogicalDevice(SelectedPhysicalComputeDevice);
                myDescriptorPoolGraphicsManager = new DescriptorSetPoolManager(SelectedLogicalGraphicsDevice);
                myDescriptorPoolComputeManager  = new DescriptorSetPoolManager(SelectedLogicalComputeDevice);
                myGraphicsQueue = SelectedLogicalGraphicsDevice.QueueManager.GetQueue(QueueFlags.Graphics);
                myComputeQueue  = SelectedLogicalComputeDevice.QueueManager.GetQueue(QueueFlags.Compute);
            }


            myLightingManager = new LightingManager();

            var Renderer = new VulkanRenderer(myLightingManager, Surface, Window, SelectedLogicalGraphicsDevice, myDescriptorPoolGraphicsManager, SelectedPhysicalGraphicsDevice, myGraphicsQueue, mySettings);
            var Compute  = new VulkanCompute(SelectedLogicalComputeDevice, myDescriptorPoolComputeManager, SelectedPhysicalComputeDevice, myComputeQueue);

            RenderingManager = Renderer;
            //Make sure they know about eachother's fences so they don't draw or do compute shaders at the same time!
            Renderer.SetComputeFence(Compute.GetFinishedFence());//Semaphore or fence?
            Compute.SetRendererFence(Renderer.GetFinshedFence());
            ComputeManager = Compute;
        }
Esempio n. 7
0
        static void Main()
        {
            //using (Game game = new Game())
            //{
            //    float[] pose = new float[6];
            //    string dataDir = "../../../../Data/";

            //    pose[0] = 0.1000f; pose[1] = 0.1000f; pose[2] = -4.0000f; pose[3] = 0.1303f; pose[4] = 0.1580f; pose[5] = 0.1507f;

            //    game.TextureName = dataDir + "Out/red.png";
            //    game.ModelName = dataDir + "Out/ana.obj";
            //    game.TestImageName = dataDir + "Out/test.png";
            //    game.Pose = pose;

            //    game.Run(0.0);
            //}

            //using (Game game = new Game())
            //{
            //    float[] pose = new float[6];
            //    string dataDir = "../../../../Data/";

            //    pose[0] = 0.1000f; pose[1] = 0.1000f; pose[2] = -4.0000f; pose[3] = 0.1303f; pose[4] = 0.1580f; pose[5] = 0.1507f;

            //    game.TextureName = dataDir + "Out/red.png";
            //    game.ModelName = dataDir + "Out/ana.obj";
            //    game.TestImageName = dataDir + "Out/test.png";
            //    game.Pose = pose;

            //    game.Run(0.0);
            //}


            RendererWindow game = new RendererWindow();

            float[] pose    = new float[6];
            string  dataDir = "../../../Data/";

            pose[0] = -0.0065f; pose[1] = 0.0499f; pose[2] = -1.8197f;
            pose[3] = -0.0156f; pose[4] = 0.0178f; pose[5] = -0.4001f;

            game.Set(dataDir + "test.png", dataDir + "ana.obj", dataDir + "red.png");
            game.Pose = pose;

            game.ShowDialog();
            //game.RenderOffScreen();
        }
Esempio n. 8
0
        public TextureSceneView(SceneViewController controller, CameraMover cameraMover, String name, BackgroundScene background, int zIndexStart, int width, int height)
            : base(controller, cameraMover, name, background, zIndexStart)
        {
            resourceLoader   = new ManualResourceLoader(this);
            this.TextureName = name;
            texture          = TextureManager.getInstance().createManual(name, MyGUIInterface.Instance.CommonResourceGroup.FullName, TextureType.TEX_TYPE_2D, (uint)width, (uint)height, 1, 0, ogreTextureFormat, TextureUsage.TU_RENDERTARGET, resourceLoader, false, 0);

            pixelBuffer          = texture.Value.getBuffer();
            renderTexture        = pixelBuffer.Value.getRenderTarget();
            this.RenderingEnded += TextureSceneView_RenderingEnded;

            rendererWindow       = new ManualWindow(renderTexture);
            this.RendererWindow  = rendererWindow;
            this.ClearEveryFrame = true;

            this.BackColor = new Engine.Color(0, 0, 0, 0);
        }
Esempio n. 9
0
        private IEnumerator <object> WaitForAll_Coroutine()
        {
            TaskCount = CreateInstances.Count;
            foreach (IEnumerator <object> enumerator in CreateInstances)
            {
                ILRuntimeService.StartILCoroutine(enumerator);
            }

            while (TaskCount > 0)
            {
                yield return(null);
            }
            TaskCount = StartInstance.Count;
            foreach (IEnumerator <object> enumerator in StartInstance)
            {
                ILRuntimeService.StartILCoroutine(enumerator);
            }
            while (TaskCount > 0)
            {
                yield return(null);
            }

            TaskCount = Windows.Count;
            foreach (Type window in Windows)
            {
                AssetBundlePool.LoadAsset <GameObject>(
                    "bmpfont_prefab.assetbundle",
                    window.Name,
                    (gameObject) =>
                {
                    GameSystemData.Instance.PrefabCache.Insert(new PrefabAsset(window.Name, gameObject));
                    TaskCount--;
                });
            }
            while (TaskCount > 0)
            {
                yield return(null);
            }

            GameSystemData.Instance.FontSettingWindow = FontSettingWindow.OpenWindow();
            GameSystemData.Instance.MenuWindow        = MenuWindow.OpenWindow();
            GameSystemData.Instance.RendererWindow    = RendererWindow.OpenWindow();
            Debug.Log("return GameStart.WaitForAll_Coroutine.");
        }
        public MDISceneViewWindow(RendererWindow rendererWindow, SceneViewController controller, CameraMover cameraMover, String name, BackgroundScene background, int zIndexStart)
            : base(controller, cameraMover, name, background, zIndexStart)
        {
            this.createBackground(((OgreWindow)PluginManager.Instance.RendererPlugin.PrimaryWindow).OgreRenderTarget, false);

            //MDI Window
            mdiWindow = new MDIDocumentWindow(Name);
            mdiWindow.AllowedDockLocations = DockLocation.Center;
            mdiWindow.SuppressLayout       = true;
            mdiWindow.Content              = this;
            mdiWindow.SuppressLayout       = false;
            mdiWindow.Caption              = Name;
            mdiWindow.Closed              += new EventHandler(mdiWindow_Closed);
            mdiWindow.ActiveStatusChanged += new EventHandler(mdiWindow_ActiveStatusChanged);

            PrimaryActionSelect.FirstFrameDownEvent   += selectEvent;
            SecondaryActionSelect.FirstFrameDownEvent += selectEvent;

            this.RendererWindow = rendererWindow;
        }
Esempio n. 11
0
 public WindowInfoEventArgs(RendererWindow createdWindow)
 {
     CreatedWindow = createdWindow;
 }
 public SceneViewController(MDILayoutManager mdiLayout, EventManager eventManager, UpdateTimer mainTimer, RendererWindow rendererWindow, OgreRenderManager renderManager)
     : this(mdiLayout, eventManager, mainTimer, rendererWindow, renderManager, null)
 {
 }
 public void changeRendererWindow(RendererWindow rendererWindow)
 {
     this.rendererWindow = rendererWindow;
 }
Esempio n. 14
0
        public DoggoEngine(String GameName)
        {
            //Initialize SDL without setting up Subsystems
            SDL2.SDL.SDL_Init(0);

            #region Graphics And Compute Interface Loading
            //Get our available graphics Settings
            GraphicsSettings mySettings = EngineSettings.LoadSettingsFile <GraphicsSettings>();//new GraphicsSettings("GraphicsSettings.xml");

            //Load the RendererWindow
            RendererWindow myRenderWindow = new RendererWindow(0, 0, GameName, mySettings.myRendererType, mySettings.SCREEN_WIDTH, mySettings.SCREEN_HEIGHT);

            //Gets our renderer singleton component
            RendererManagerComponent RendererComponentObject = RendererManagerComponent.Get();

            //Gets our Compute singleton component
            ComputeManagerComponent ComputeComponentObject = ComputeManagerComponent.Get();

            //Load proper initializers based on RendererType
            switch (mySettings.myRendererType)
            {
            case RendererType.OPENGL:
                throw new NotImplementedException();
                break;

            case RendererType.VULKAN:
                VulkanInitializer myInitializerClass = new VulkanInitializer(GameName, myRenderWindow, mySettings);
                RendererComponentObject.Initialize(myInitializerClass.RenderingManager);
                ComputeComponentObject.Initialize(myInitializerClass.ComputeManager);
                break;
            }
            #endregion

            //Gets the InputManager's Singleton Component
            InputManagerComponent myManager = InputManagerComponent.Get();

            //Gets the AudioManager's Singleton Component
            AudioManagerComponent myAudioManager = AudioManagerComponent.Get();

            //Prints out all currently unwritten tests that should've been done before actually writing the code.
#if DEBUG
            var         Assembly2 = Assembly.GetEntryAssembly();
            List <Type> myTYpes   = new List <Type>();
            myTYpes.AddRange(Assembly2.GetTypes());
            myTYpes.AddRange(Assembly.GetExecutingAssembly().GetTypes());
            Debug.WriteLine("/////////////////////////////////////////////////////////////////////////");
            Debug.WriteLine("Unwritten Tests: ");
            foreach (Type a in myTYpes)
            {
                var myAttributes = a.GetCustomAttributes <TestReminderAttribute>() as TestReminderAttribute[];
                foreach (TestReminderAttribute A in myAttributes)
                {
                    A.PrintTestInformational();
                }
            }
            Debug.WriteLine("/////////////////////////////////////////////////////////////////////////");
#endif

            //Creates the world manager with all subsystems inside of it ready for use.
            myWorldManager = new WorldManager();

            //Passes the WorldManager to the developer
            SetupGame(myWorldManager, WorldManager.myCurrentResourceManager);

            //Makes sure that the developer set the active world so that it doesn't throw a cryptic error down the line which requires them to contact me.
            if (myWorldManager.ActiveWorld == null)
            {
                throw new Exception("An active world wasn't created in SetupGame!");
            }
        }
Esempio n. 15
0
 public void InitializeRenderer(RendererWindow WindowHandle, IPreferredGraphicsDeviceFilter myPreferencesForDevice = null, bool Deferred = true)
 {
     throw new NotImplementedException();
 }