Example #1
0
        private void createFramebufferSet(FramebufferCreator mFramebufferCreator, Framebuffer outputFb, RenderOptions mOptions)
        {
            Vector2 size  = mOptions.size;
            Vector2 size2 = size * mOptions.quality;
            Vector2 size3 = size2 * 0.3f;

            //sceeneFramebuffer = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y);
            sceeneBackdropFb = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba8, false);

            lightFramebuffer            = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba8, false);
            lightFramebuffer.clearColor = new Color4(0f, 0f, 0f, 0f);

            lightBlurFramebuffer = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba8, false);

            reflectionFramebuffer = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba8, false);

            sceeneFramebuffer            = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba8, false);
            sceeneFramebuffer.clearColor = new Color4(0f, 0f, 0f, 0f);

            selectionFb = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba8, false);


            //screenNormalFb = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba16f, false);
            //screenNormalFb.clearColor = new Color4(0f, 0f, 0f, 100f);
            //lightFramebuffer = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba16f, false);

            if (mOptions.depthOfField)
            {
                // depth of field buffers
                dofPreFramebuffer = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, false);
                dofFramebuffer    = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, false);
            }

            dofFramebuffer2 = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, true);

            aoBlurFramebuffer2            = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, true);
            aoBlurFramebuffer2.clearColor = new Color4(0f, 0f, 0f, 0.5f);

            if (mOptions.ssAmbientOccluison)
            {
                aoPreFramebuffer  = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba16, false);
                aoFramebuffer     = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, false);
                aoBlurFramebuffer = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, false);
            }
            else
            {
                // if ao is set of make the buffer grey
                //aoBlurFramebuffer2.enable();
            }


            selectionblurFb   = mFramebufferCreator.createFrameBuffer((int)size3.X, (int)size3.Y, PixelInternalFormat.Rgba8, false);
            selectionblurFb2  = mFramebufferCreator.createFrameBuffer((int)size3.X, (int)size3.Y, PixelInternalFormat.Rgba8, true);
            bloomFramebuffer  = mFramebufferCreator.createFrameBuffer((int)size3.X, (int)size3.Y, PixelInternalFormat.Rgba8, false);
            bloomFramebuffer2 = mFramebufferCreator.createFrameBuffer((int)size3.X, (int)size3.Y, PixelInternalFormat.Rgba8, false);

            renderOptions = mOptions;
            this.outputFb = outputFb;
        }
Example #2
0
        public Framebuffer(
            int FboHandle,
            int ColorTexture,
            int DepthTexture,
            Vector2 size,
            FramebufferCreator parent)
        {
            this.FboHandle    = FboHandle;
            this.ColorTexture = ColorTexture;
            this.DepthTexture = DepthTexture;
            this.size         = size;

            Parent = parent;
        }
Example #3
0
        public CubemapBufferSets(Scene parent, FramebufferCreator mFramebufferCreator, int size)
        {
            this.Scene = parent;
            Parent     = parent;

            Vector2 vecSize = new Vector2(size, size);

            float fovy = (float)Math.PI / 2;

            for (int i = 0; i < 6; i++)
            {
                outFrameBuffers[i] = mFramebufferCreator.createFrameBuffer(size, size, PixelInternalFormat.Rgba8, true);
                outTextures[i]     = outFrameBuffers[i].ColorTexture;
                FrameBufferSets[i] = new FramebufferSet(mFramebufferCreator, vecSize, outFrameBuffers[i]);

                cubeView[i] = new ViewInfo(this);
                cubeView[i].PointingDirection = viewDirections[i];
                cubeView[i].upVec             = upDirections[i];

                cubeView[i].aspect = 1f;
                cubeView[i].fovy   = fovy;
                cubeView[i].updateProjectionMatrix();
            }
        }
        public CubemapBufferSets(Scene parent, FramebufferCreator mFramebufferCreator, int size)
        {
            this.Scene = parent;
            Parent = parent;

            Vector2 vecSize = new Vector2(size,size);

            float fovy = (float)Math.PI/2;

            for (int i = 0; i < 6; i++)
            {
                outFrameBuffers[i] = mFramebufferCreator.createFrameBuffer(size, size, PixelInternalFormat.Rgba8, true);
                outTextures[i] = outFrameBuffers[i].ColorTexture;
                FrameBufferSets[i] = new FramebufferSet(mFramebufferCreator, vecSize, outFrameBuffers[i]);

                cubeView[i] = new ViewInfo(this);
                cubeView[i].PointingDirection = viewDirections[i];
                cubeView[i].upVec = upDirections[i];

                cubeView[i].aspect = 1f;
                cubeView[i].fovy = fovy;
                cubeView[i].updateProjectionMatrix();
            }
        }
Example #5
0
        protected override void OnLoad(System.EventArgs e)
        {
            //generate stopwatch
            sw = new Stopwatch();

            //set size of the render
            virtual_size = new Vector2(1920, 1080);

            state = new GameState();

            string versionOpenGL = GL.GetString(StringName.Version);
            log(versionOpenGL);

            // make the Coursor disapear
            Cursor.Hide();

            // center it on the window
            Cursor.Position = new Point(
                (Bounds.Left + Bounds.Right) / 2,
                (Bounds.Top + Bounds.Bottom) / 2);

            // other state
            GL.ClearColor(System.Drawing.Color.Black);
            VSync = VSyncMode.On;
            screenSize = new Vector2(Width, Height);

            // create instances of necessary objects
            textureLoader = new TextureLoader(this);
            framebufferCreator = new FramebufferCreator(this);
            meshLoader = new MeshLoader(this);
            shaderLoader = new ShaderLoader(this);
            materialLoader = new MaterialLoader(this);
            templateLoader = new TemplateLoader(this);

            mScene = new Scene(this);

            // create gameInput
            gameInput = new GameInput(mScene, Keyboard, Mouse);

            // set files for displaying loading screen
            shaderLoader.fromXmlFile("shaders\\composite.xsp");

            shaderLoader.fromTextFile("shaders\\composite.vs", "shaders\\splash_shader.fs");

            meshLoader.fromObj("models\\sprite_plane.obj");

            textureLoader.fromFile("materials\\ultra_engine_back.png",true);
            textureLoader.fromFile("materials\\ultra_engine_back_h.png",true);

            materialLoader.fromXmlFile("materials\\composite.xmf");

            //loading noise manualy so we can disable multisampling
            textureLoader.fromFile("materials\\noise_pixel.png", false);

            // load files for loading screen
            textureLoader.LoadTextures();
            meshLoader.loadMeshes();
            shaderLoader.loadShaders();
            materialLoader.loadMaterials();

            // setup 2d filter (loading screen)
            splashFilter2d = new Quad2d(this);

            // set time to zero
            spawnTime = get_time();
        }
Example #6
0
 public DefaultFramebuffer(Vector2 size, FramebufferCreator parent)
 {
     Parent    = parent;
     this.size = size;
 }
Example #7
0
 public FramebufferSet(FramebufferCreator mFramebufferCreator, Framebuffer outputFb, RenderOptions mOptions)
 {
     createFramebufferSet(mFramebufferCreator, outputFb, mOptions);
 }
Example #8
0
        public FramebufferSet(FramebufferCreator mFramebufferCreator, Vector2 size, Framebuffer outputFb)
        {
            RenderOptions mOptions = new RenderOptions(size);

            createFramebufferSet(mFramebufferCreator, outputFb, mOptions);
        }
Example #9
0
        protected override void OnLoad(System.EventArgs e)
        {
            //generate stopwatch
            sw = new Stopwatch();

            //set size of the render
            virtual_size = Settings.Instance.video.CreateSizeVector(VideoSettings.Target.main);

            state = new GameState();

            string versionOpenGL = GL.GetString(StringName.Version);

            log(versionOpenGL);

            // make the Coursor disapear
            Cursor.Hide();

            // center it on the window
            Cursor.Position = new Point(
                (Bounds.Left + Bounds.Right) / 2,
                (Bounds.Top + Bounds.Bottom) / 2);

            // other state
            GL.ClearColor(System.Drawing.Color.Black);
            VSync      = VSyncMode.On;
            screenSize = new Vector2(Width, Height);

            // create instances of necessary objects
            textureLoader      = new TextureLoader(this);
            framebufferCreator = new FramebufferCreator(this);
            meshLoader         = new MeshLoader(this);
            shaderLoader       = new ShaderLoader(this);
            materialLoader     = new MaterialLoader(this);
            templateLoader     = new TemplateLoader(this);

            mScene = new Scene(this);

            // create gameInput
            gameInput = new GameInput(mScene, Keyboard, Mouse);

            // set files for displaying loading screen
            shaderLoader.fromXmlFile("shaders\\composite.xsp");

            shaderLoader.fromTextFile("shaders\\composite.vs", "shaders\\splash_shader.fs");

            meshLoader.fromObj("models\\sprite_plane.obj");

            textureLoader.fromPng("materials\\ultra_engine_back.png", true);
            textureLoader.fromPng("materials\\ultra_engine_back_h.png", true);

            materialLoader.fromXmlFile("materials\\composite.xmf");

            //loading noise manualy so we can disable multisampling
            textureLoader.fromPng("materials\\noise_pixel.png", false);

            // load files for loading screen
            textureLoader.LoadTextures();
            meshLoader.loadMeshes();
            shaderLoader.loadShaders();
            materialLoader.loadMaterials();

            // load files from cache
            if (Settings.Instance.game.useCache)
            {
                meshLoader.readCacheFile();
                //shaderLoader.readCacheFile();
                //textureLoader.readCacheFile();
                materialLoader.readCacheFile();
                templateLoader.readCacheFile();
            }

            // setup 2d filter (loading screen)
            splashFilter2d = new Quad2d(this);

            // set time to zero
            spawnTime = get_time();
        }
        private void createFramebufferSet(FramebufferCreator mFramebufferCreator, Framebuffer outputFb, RenderOptions mOptions)
        {
            Vector2 size = mOptions.size;
            Vector2 size2 = size * mOptions.quality;
            Vector2 size3 = size2 * 0.3f;

            //sceeneFramebuffer = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y);
            sceeneFramebufferTrans = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba8, false);

            if (mOptions.postProcessing)
            {
                sceeneFramebuffer = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba16f, false);
                sceeneFramebuffer.clearColor = new Color4(0f, 0f, 0f, 100f);

                selectionFb = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba8, false);

                //screenNormalFb = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba16f, false);
                //screenNormalFb.clearColor = new Color4(0f, 0f, 0f, 100f);
                //lightFramebuffer = mFramebufferCreator.createFrameBuffer((int)size.X, (int)size.Y, PixelInternalFormat.Rgba16f, false);

                if (mOptions.depthOfField)
                {
                    // depth of field buffers
                    dofPreFramebuffer = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, false);
                    dofFramebuffer = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, false);
                }

                dofFramebuffer2 = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, true);

                aoBlurFramebuffer2 = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, true);
                aoBlurFramebuffer2.clearColor = new Color4(0f, 0f, 0f, 0.5f);

                if (mOptions.ssAmbientOccluison)
                {
                    aoFramebuffer = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, false);
                    aoBlurFramebuffer = mFramebufferCreator.createFrameBuffer((int)size2.X, (int)size2.Y, PixelInternalFormat.Rgba8, false);
                } else {
                    // if ao is set of make the buffer grey
                    //aoBlurFramebuffer2.enable();
                }

                selectionblurFb = mFramebufferCreator.createFrameBuffer((int)size3.X, (int)size3.Y, PixelInternalFormat.Rgba8, false);
                selectionblurFb2 = mFramebufferCreator.createFrameBuffer((int)size3.X, (int)size3.Y, PixelInternalFormat.Rgba8, true);
                bloomFramebuffer = mFramebufferCreator.createFrameBuffer((int)size3.X, (int)size3.Y, PixelInternalFormat.Rgba8, false);
                bloomFramebuffer2 = mFramebufferCreator.createFrameBuffer((int)size3.X, (int)size3.Y, PixelInternalFormat.Rgba8, false);
            }
            renderOptions = mOptions;
            this.outputFb = outputFb;
        }
 public FramebufferSet(FramebufferCreator mFramebufferCreator, Framebuffer outputFb, RenderOptions mOptions)
 {
     createFramebufferSet(mFramebufferCreator, outputFb, mOptions);
 }
 public FramebufferSet(FramebufferCreator mFramebufferCreator, Vector2 size, Framebuffer outputFb)
 {
     RenderOptions mOptions = new RenderOptions(size);
     createFramebufferSet(mFramebufferCreator, outputFb, mOptions);
 }
        public Framebuffer(
            int FboHandle, 
            int ColorTexture,
            int DepthTexture, 
            Vector2 size,
            FramebufferCreator parent)
        {
            this.FboHandle = FboHandle;
            this.ColorTexture = ColorTexture;
            this.DepthTexture = DepthTexture;
            this.size = size;

            Parent = parent;
        }
 public DefaultFramebuffer(Vector2 size, FramebufferCreator parent)
 {
     Parent = parent;
     this.size = size;
 }