예제 #1
0
 private void initTutorial(ShaderManager shaders)
 {
     this.Tutorial = SpriteSet <UVColorVertexData> .FromJsonFile(
         "data/gfx/sprites/tutorial.json", s => new Sprite2DGeometry(s),
         shaders.UVColor, new SurfaceSetting[] { this.screenModelview, this.gameProjection, SurfaceBlendSetting.PremultipliedAlpha },
         SurfaceManager.premultiplyTexture, true);
 }
예제 #2
0
        public SurfaceManager(ShaderManager shaderMan)
        {
            // matrices
            this.ProjectionMatrix = new Matrix4Uniform("projectionMatrix");
            this.ModelviewMatrix  = new Matrix4Uniform("modelviewMatrix");

            // create shaders
            shaderMan.MakeShaderProgram("primitives");
            shaderMan.MakeShaderProgram("uvcolor");
            shaderMan.MakeShaderProgram("building");

            var sharedSettings = new SurfaceSetting[] { this.ProjectionMatrix, this.ModelviewMatrix };

            // surfaces
            this.Primitives = new IndexedSurface <PrimitiveVertexData>();
            this.Primitives.AddSettings(sharedSettings);
            shaderMan["primitives"].UseOnSurface(this.Primitives);

            this.PrimitivesOverlay = new IndexedSurface <PrimitiveVertexData>();
            this.PrimitivesOverlay.AddSettings(sharedSettings);
            shaderMan["primitives"].UseOnSurface(this.PrimitivesOverlay);

            this.Text = new IndexedSurface <UVColorVertexData>();
            this.Text.AddSettings(this.ProjectionMatrix, this.ModelviewMatrix,
                                  new TextureUniform("diffuseTexture", new Texture("data/fonts/inconsolata.png", true)));
            shaderMan["uvcolor"].UseOnSurface(this.Text);

            this.Buildings = new IndexedSurface <BuildingVertex>();
            this.Buildings.AddSettings(sharedSettings);
            shaderMan["building"].UseOnSurface(this.Buildings);

            this.Sprites = SpriteSet <UVColorVertexData> .FromJsonFile("data/sprites/particles.json",
                                                                       s => new Sprite2DGeometry(s), shaderMan["uvcolor"], sharedSettings, f => new Texture(f, true), true);

            this.NavMesh = new IndexedSurface <PrimitiveVertexData>();
            this.NavMesh.AddSettings(
                this.ProjectionMatrix, this.ModelviewMatrix,
                new PolygonModeSetting(PolygonMode.Line)
                );
            shaderMan["primitives"].UseOnSurface(this.NavMesh);
        }
예제 #3
0
 private SpriteSet <SimpleSpriteVertexData> load3DGameSpriteSet(ShaderManager shaders, string filename)
 {
     return(SpriteSet <SimpleSpriteVertexData> .FromJsonFile(
                "data/gfx/sprites/" + filename + ".json", s => new Sprite3DGeometry(s),
                shaders.Sprite3D, this.gameSpriteSettings, SurfaceManager.premultiplyTexture, true));
 }