Ejemplo n.º 1
0
        public Planet(Camera c)
        {
            myCamera = c;
            for (int i = 0; i < MAX_TRI; i++)
            {
                myTris.Add(new Tri());
            }

            myFov    = MathHelper.DegreesToRadians(myCamera.fieldOfView);
            mySinFov = (float)Math.Sin(myFov);
            myCosFov = (float)Math.Cos(myFov);

            init();

            myTextureManager.init();

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

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Test IcoPlanet.shaders.draw-planet-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.GeometryShader, "Test IcoPlanet.shaders.draw-planet-gs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Test IcoPlanet.shaders.draw-planet-ps.glsl"));
            ShaderProgramDescriptor sd     = new ShaderProgramDescriptor(desc);
            ShaderProgram           shader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            myRenderCommand = new StatelessDrawElementsCommand(PrimitiveType.Triangles, (int)myIndexCount, 0, IndexBufferObject.IndexBufferDatatype.UnsignedInt);

            myRenderCommand.pipelineState.shaderState.shaderProgram = shader;
            myRenderCommand.pipelineState.vaoState.vao = new VertexArrayObject();
            myRenderCommand.pipelineState.vaoState.vao.bindVertexFormat <V3F1>(shader);
            myRenderCommand.pipelineState.generateId();

            myHeightTexture = new Texture("../data/textures/EarthLookupTable.png");
        }