示例#1
0
 public void Resize(int width, int height)
 {
     _width                       = width;
     _height                      = height;
     _aspect                      = (float)width / height;
     _renderToTexture[0]          = new FBO(Texture2dGL.Create(width, height));
     _renderToTexture[1]          = new FBO(Texture2dGL.Create(width, height));
     _renderToTexture[2]          = new FBO(Texture2dGL.Create(width, height));
     _renderToTexture[3]          = new FBO(Texture2dGL.Create(width / 2, height / 2));
     _renderToTexture[4]          = new FBO(Texture2dGL.Create(width, height));
     _renderToTextureWithDepth[0] = new FBOwithDepth(Texture2dGL.Create(width, height));
     _renderToTextureWithDepth[1] = new FBOwithDepth(Texture2dGL.Create(width / 2, height / 2, 1, true));
 }
示例#2
0
        public void Resize(int width, int height)
        {
            var texNormalMaterial = Texture2dGL.Create(width, height, 4, true);
            var texPosition       = Texture2dGL.Create(width, height, 4, true);

            mrtSurface = new FBOwithDepth(texNormalMaterial);
            mrtSurface.Attach(texPosition);
            var bindings = new List <TextureBinding>()
            {
                new TextureBinding(nameof(texNormalMaterial), texNormalMaterial),
                new TextureBinding(nameof(texPosition), texPosition),
            };

            lightsVisual = new MeshVisual(lightsVisual.Drawable, lightsVisual.ShaderProgram, bindings);
        }
示例#3
0
        public EnvironmentMap(int size, IContentLoader contentLoader, Dictionary <Enums.EntityType, DefaultMesh> meshes)
        {
            _bloom = new[] {
                new Bloom(contentLoader),
                new Bloom(contentLoader),
                new Bloom(contentLoader),
                new Bloom(contentLoader),
                new Bloom(contentLoader),
                new Bloom(contentLoader)
            };

            _positions = new[]
            {
                new Position(Vector3.Zero, -90, 180), //right
                new Position(Vector3.Zero, 90, 180),  //left
                new Position(Vector3.Zero, 0, -90),   //up
                new Position(Vector3.Zero, 0, 90),    //down
                new Position(Vector3.Zero, 0, 180),   //back
                new Position(Vector3.Zero, 180, 180)  //front
            };

            for (int i = 0; i < 6; i++)
            {
                _cameras[i]     = new Camera <Position, Perspective>(_positions[i], new Perspective(farClip: 500f));
                _mapSurfaces[i] = new FBOwithDepth(Texture2dGL.Create(size, size));
            }

            _cubeFbo = new CubeMapFBO(size);

            _deferred = new Deferred(contentLoader, meshes);
            _deferred.UpdateResolution(size, size);
            _shadowMapping = new DirectionalShadowMapping(contentLoader, meshes);
            _shadowMapping.UpdateResolution(size, size);
            _lighting = new Lighting(contentLoader);
            _lighting.UpdateResolution(size, size);
            _skybox = new Skybox(contentLoader, 245, "blue");
            _skybox.UpdateResolution(size, size);
            _add = new Add(contentLoader);
            _add.UpdateResolution(size, size);

            _environmentMapProgram = contentLoader.Load <IShaderProgram>("environmentMap.*");

            foreach (var meshContainer in meshes)
            {
                _geometries.Add(meshContainer.Key, VAOLoader.FromMesh(meshContainer.Value, _environmentMapProgram));
            }
        }
示例#4
0
 public void Resize(int width, int height)
 {
     renderToTexture = new FBOwithDepth(Texture2dGL.Create(width, height));
     renderToTexture.Texture.WrapFunction = TextureWrapFunction.Repeat;
 }
示例#5
0
 public void Resize(int width, int height)
 {
     renderToTexture = new FBOwithDepth(Texture.Create(width, height));
 }