Beispiel #1
0
        static RenderSphereCommand()
        {
            theVBO = new VertexBufferObject <V3T2B4>(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\draw-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\draw-ps.glsl", ShaderDescriptor.Source.File));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject <V3T2B4>(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            createTheSphere();

            theIBO.setData(theSphereIndexes);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat <V3T2B4>(theShader);
        }
Beispiel #2
0
        static RenderTextureCubeCommand()
        {
            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\draw-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\draw-ps.glsl", ShaderDescriptor.Source.File));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject <V3T2B4>(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            ushort[] index = { 0,   1,  2,
                               0,   2,  3,                              //front
                               4,   5,  6,
                               4,   6,  7,                              //left
                               8,   9, 10,
                               8,  10, 11,                              //right
                               12, 13, 14,
                               12, 14, 15,                              // top
                               16, 17, 18,
                               16, 18, 19,                              // bottom
                               20, 21, 22,
                               20, 22, 23                               // back
            };
            theIBO.setData(index);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat <V3T2B4>(theShader);
        }
Beispiel #3
0
        static RenderWireframeCubeCommand()
        {
            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\draw-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\draw-ps.glsl", ShaderDescriptor.Source.File));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject <V3T2B4>(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            ushort[] index =
            {
                4, 6, 2, 3, PRIM_RESTART,
                1, 3, 7, 6, PRIM_RESTART,
                7, 5, 1, 0, PRIM_RESTART,
                2, 0, 4, 5
            };

            theIBO.setData(index);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat <V3T2B4>(theShader);
        }
        static CopyFramebufferCommand()
        {
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor("Graphics.shaders.post-vs.glsl", "Graphics.shaders.copy-ps.glsl");

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;
            theVao    = new VertexArrayObject();
        }
Beispiel #5
0
        public FishEyeEffect()
            : base()
        {
            name = "fisheye";

            ShaderProgramDescriptor sd = new ShaderProgramDescriptor("Graphics.shaders.post-vs.glsl", "Graphics.shaders.fisheye-ps.glsl");

            myShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;
        }
Beispiel #6
0
        public BlurEffect()
            : base()
        {
            name = "blur";

            ShaderProgramDescriptor sd = new ShaderProgramDescriptor("Graphics.shaders.post-vs.glsl", "Graphics.shaders.blur-ps.glsl");

            myShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;
        }
        public ParticleVisualizer()
            : base("particle")
        {
            ShaderProgramDescriptor spDesc = new ShaderProgramDescriptor("Graphics.shaders.particleSystem-vs.glsl", "Graphics.shaders.particleSystem-gs.glsl", "Graphics.shaders.particleSystem-ps.glsl");

            myParticleShaderProgram = Renderer.resourceManager.getResource(spDesc) as ShaderProgram;

            myVao = new VertexArrayObject();
            myVao.bindVertexFormat(myParticleShaderProgram, V3C4S3R.bindings());
        }
Beispiel #8
0
        public SDFont(String name, String filename, int size)
            : base(name, size)
        {
            myFilename = filename;
            buildFont();

            //set shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\font-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\sdfont-ps.glsl", ShaderDescriptor.Source.File));
            ShaderProgramDescriptor shDesc = new ShaderProgramDescriptor(desc);

            myShader = Renderer.resourceManager.getResource(shDesc) as ShaderProgram;
            myVao.bindVertexFormat <V3T2>(myShader);
        }
Beispiel #9
0
        public TextureFont(String name, Texture t, int charTextureSize, int size, int offset = 0)
            : base(name, size)
        {
            myCharTextureSize = charTextureSize;
            myLetteroffset    = offset;
            texture           = t;
            buildFont();

            //set shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\font-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\font-ps.glsl", ShaderDescriptor.Source.File));
            ShaderProgramDescriptor shDesc = new ShaderProgramDescriptor(desc);

            myShader = Renderer.resourceManager.getResource(shDesc) as ShaderProgram;
            myVao.bindVertexFormat(myShader, V3T2.bindings());
        }
Beispiel #10
0
        static void installDefaultShaders()
        {
            ShaderProgramDescriptor sd;
            ShaderProgram           sp;
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\skybox-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\skybox-ps.glsl", ShaderDescriptor.Source.File));
            sd = new ShaderProgramDescriptor(desc, null, "skyboxShader");
            sp = resourceManager.getResource(sd) as ShaderProgram;
            visualizers["skybox"].registerEffect("skybox", new SkyboxEffect(sp));


            desc.Clear();
            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\staticModel-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\unlit-ps.glsl", ShaderDescriptor.Source.File));
            sd = new ShaderProgramDescriptor(desc, null, "static:unlit");
            sp = resourceManager.getResource(sd) as ShaderProgram;
            visualizers["staticModel"].registerEffect("forward-lighting", new UnlitEffect(sp));

            desc.Clear();
            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\staticModel-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\perpixel-lighting-ps.glsl", ShaderDescriptor.Source.File));
            sd = new ShaderProgramDescriptor(desc, null, "static:perpixel");
            sp = resourceManager.getResource(sd) as ShaderProgram;
            visualizers["staticModel"].registerEffect("forward-lighting", new PerPixelLightinglEffect(sp));


            desc.Clear();
            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\skinnedModel-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\unlit-ps.glsl", ShaderDescriptor.Source.File));
            sd = new ShaderProgramDescriptor(desc, null, "skinned:unlit");
            sp = resourceManager.getResource(sd) as ShaderProgram;
            visualizers["skinnedModel"].registerEffect("forward-lighting", new UnlitEffect(sp));


            desc.Clear();
            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\skinnedModel-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\perpixel-lighting-ps.glsl", ShaderDescriptor.Source.File));
            sd = new ShaderProgramDescriptor(desc, null, "skinned:perpixel");
            sp = resourceManager.getResource(sd) as ShaderProgram;
            visualizers["skinnedModel"].registerEffect("forward-lighting", new PerPixelLightinglEffect(sp));
        }
Beispiel #11
0
        public void init()
        {
            myVbo = new VertexBufferObject <V3T2B4>(BufferUsageHint.DynamicDraw);
            myIbo = new IndexBufferObject(BufferUsageHint.DynamicDraw);
            myVao = new VertexArrayObject();

            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "..\\src\\Graphics\\shaders\\debug-vs.glsl", ShaderDescriptor.Source.File));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "..\\src\\Graphics\\shaders\\debug-ps.glsl", ShaderDescriptor.Source.File));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            myShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            myVao.bindVertexFormat <V3T2B4>(myShader);

            myTexture = Graphics.Util.getEmbeddedTexture("Graphics.data.debugFont.png");
            myTexture.setMinMagFilters(TextureMinFilter.NearestMipmapNearest, TextureMagFilter.Nearest);
            myTexture.setWrapping(TextureWrapMode.ClampToEdge, TextureWrapMode.ClampToEdge);
            myFont = FontManager.findFont("DEFAULT");
        }
Beispiel #12
0
        static RenderTexture2dCommand()
        {
            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Graphics.shaders.draw-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Graphics.shaders.draw-ps.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            ushort[] index = { 0, 1, 2, 0, 2, 3 };
            theIBO.setData(index);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat(theShader, V3T2B4.bindings());
        }
Beispiel #13
0
        public void init()
        {
            myVbo = new VertexBufferObject(BufferUsageHint.DynamicDraw);
            myIbo = new IndexBufferObject(BufferUsageHint.DynamicDraw);
            myVao = new VertexArrayObject();

            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Graphics.shaders.debug-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Graphics.shaders.debug-ps.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            myShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            myVao.bindVertexFormat(myShader, V3T2B4.bindings());

            myTexture = Graphics.Util.getEmbeddedTexture("Graphics.data.debugFont.png");
            //myTexture = Util.getEmbeddedTexture("Graphics.data.proggy12.png");
            myTexture.setMinMagFilters(TextureMinFilter.NearestMipmapNearest, TextureMagFilter.Nearest);
            myTexture.setWrapping(TextureWrapMode.ClampToEdge, TextureWrapMode.ClampToEdge);
            myFont = new TextureFont("Debug", myTexture, 16, 16, 32);
        }
Beispiel #14
0
        static RenderFrustumCommand()
        {
            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Graphics.shaders.draw-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Graphics.shaders.draw-ps.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            ushort[] index =
            {
                0, 1, 3, 2, PRIM_RESTART,
                5, 1, 3, 7, PRIM_RESTART,
                4, 5, 7, 6, PRIM_RESTART,
                0, 4, 6, 2
            };

            theVerts[0] = new Vector4(-1, -1, -1, 1);
            theVerts[1] = new Vector4(1, -1, -1, 1);
            theVerts[2] = new Vector4(-1, 1, -1, 1);
            theVerts[3] = new Vector4(1, 1, -1, 1);

            theVerts[4] = new Vector4(-1, -1, 1, 1);
            theVerts[5] = new Vector4(1, -1, 1, 1);
            theVerts[6] = new Vector4(-1, 1, 1, 1);
            theVerts[7] = new Vector4(1, 1, 1, 1);

            theIBO.setData(index);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat(theShader, V3T2B4.bindings());
        }