public Terrain(int terrainSize, int levels, Camera cam) : base(name: "SaganTerrain") { this.levels = levels; // Add +1 to width and height of heightmap so bilinear interpolation of quad can interpolate extra data point beyond edge of quad this.heightMap = new HeightMap(terrainSize + 1); this.rootQuad = new Quad(1, terrainSize, terrainSize, this.heightMap); this.cam = cam; }
public Quad(int LOD, float size, float error, HeightMap heightMap) : base(name: "Quad") { this.size = size; this.LOD = LOD; this.error = error; this._heightMap = heightMap; this.material = new Material(Shader.Find("Sagan/ColorHeight")); this.material.SetFloat("_MaxHeight", this._heightMap.maxHeightValue); this.material.SetFloat("_MinHeight", this._heightMap.minHeightValue); }