Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        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());
        }
Ejemplo n.º 5
0
        public TextureFont(String name, String textureName, int charTextureSize, int size, int offset = 0)
            : base(name, size)
        {
            myCharTextureSize = charTextureSize;
            myLetteroffset    = offset;
            TextureDescriptor td = new TextureDescriptor(textureName, true);

            texture = Renderer.resourceManager.getResource(td) as Texture;
            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());
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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");
        }
Ejemplo n.º 8
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());
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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());
        }