示例#1
0
        public SkyBox(string directory, string ext = ".png")
        {
            Texture = new TextureCube(directory, ext);

            Vector3[] positions = new Vector3[]
            {
                new Vector3(1.0f, -1.0f, -1.0f),
                new Vector3(1.0f, -1.0f, 1.0f),
                new Vector3(-1.0f, -1.0f, 1.0f),
                new Vector3(-1.0f, -1.0f, -1.0f),
                new Vector3(1.0f, 1.0f, -1.0f),
                new Vector3(1.0f, 1.0f, 1.0f),
                new Vector3(-1.0f, 1.0f, 1.0f),
                new Vector3(-1.0f, 1.0f, -1.0f)
            };

            uint[] elements = new uint[]
            {
                0, 1, 2, 3,
                4, 7, 6, 5,
                0, 4, 5, 1,
                1, 5, 6, 2,
                2, 6, 7, 3,
                4, 0, 3, 7
            };

            Vao = new VAO(positions);
            Vao.addElementArray(elements);

            Shader = Shaders.SkyboxShader();
        }
示例#2
0
        public GaussianBlur(int width, int height)
        {
            horizontal = new Framebuffer(width, height);
            horizontal.AttachColorBuffer(type: PixelType.Float, internalFormat: PixelInternalFormat.Rgba16f);

            vertical = new Framebuffer(width, height);
            vertical.AttachColorBuffer(type: PixelType.Float, internalFormat: PixelInternalFormat.Rgba16f);

            shader = Shaders.BlurShader();
            fr     = FrameRenderer.Instance;
        }
示例#3
0
        public SkyBox(int textureId)
        {
            Texture = textureId;

            vao = GL.GenVertexArray();
            GL.BindVertexArray(vao);

            verts = GL.GenBuffer();
            GL.BindBuffer(BufferTarget.ArrayBuffer, verts);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts_f.Length * sizeof(float)), verts_f, BufferUsageHint.StaticDraw);
            GL.EnableVertexAttribArray(0);
            GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0);

            elements = GL.GenBuffer();
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, elements);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(elems_u.Length * sizeof(uint)), elems_u, BufferUsageHint.StaticDraw);

            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
            GL.BindVertexArray(0);

            Shader = Shaders.SkyboxShader();
        }
示例#4
0
 private FrameRenderer()
 {
     shader = Shaders.FrameShader();
 }