public Terrain(float gridX, float gridZ, Loader loader, TerrainTexturePack texturePack, TerrainTexture blendMap, Bitmap hegihtMap) { this.texturePack = texturePack; this.blendMap = blendMap; this.x = gridX * SIZE; this.z = gridZ * SIZE; this.model = GenerateTerrain(loader, hegihtMap); }
private Terrain LoadTerrain(Loader loader) { TerrainTexture baseTexture = new TerrainTexture(loader.LoadRepeatTexture("grassy")); TerrainTexture redTexture = new TerrainTexture(loader.LoadRepeatTexture("dirt")); TerrainTexture greenTexture = new TerrainTexture(loader.LoadRepeatTexture("pinkFlowers")); TerrainTexture blueTexture = new TerrainTexture(loader.LoadRepeatTexture("path")); TerrainTexturePack texturePack = new TerrainTexturePack(baseTexture, redTexture, greenTexture, blueTexture); TerrainTexture blendMapTexture = new TerrainTexture(loader.LoadRepeatTexture("blendMap2")); Bitmap heightMapImage = loader.LoadBitmap("heightmap2"); return(new Terrain(0, -1f, loader, texturePack, blendMapTexture, heightMapImage)); }
private void BindTextures(Terrain terrain) { TerrainTexturePack texturePack = terrain.TexturePack; Gl.ActiveTexture(TextureUnit.Texture0); Gl.BindTexture(TextureTarget.Texture2d, terrain.BlendMap.TextureId); Gl.ActiveTexture(TextureUnit.Texture1); Gl.BindTexture(TextureTarget.Texture2d, texturePack.BaseTexture.TextureId); Gl.ActiveTexture(TextureUnit.Texture2); Gl.BindTexture(TextureTarget.Texture2d, texturePack.RedTexture.TextureId); Gl.ActiveTexture(TextureUnit.Texture3); Gl.BindTexture(TextureTarget.Texture2d, texturePack.GreenTexture.TextureId); Gl.ActiveTexture(TextureUnit.Texture4); Gl.BindTexture(TextureTarget.Texture2d, texturePack.BlueTexture.TextureId); Gl.ActiveTexture(TextureUnit.Texture5); Gl.BindTexture(TextureTarget.Texture2d, this.shadowRenderer.DepthMap); }