public void OnRemoveChunk(TerrainChunkNode chunk) { if (this.ChunkRemoved != null) { ChunkRemoved(chunk, e); } }
private void AddChunk(int x, int z) { HeightInfo hi = HmWithCoords(x, z); if (hi == null) { Vector2f vec = new Vector2f(x, z); if (vec.Distance(this.v2cp) < maxDist) { TerrainChunkNode hmtc = CreateNewChunk(physicsWorld, this, x, z, scale, chunkSize, null); heightmaps.Add(hi = new HeightInfo(this, vec, hmtc)); hi.chunk.Create(); ApplyTerrainMaterial(hmtc); hi.chunk.SetLocalTranslation(new Vector3f(x * (chunkSize - 1) * scale.x, 0, z * (chunkSize - 1) * scale.z)); hi.midpoint = new Vector2f(hi.chunk.GetLocalTranslation().x - ((chunkSize - 1) * scale.x / 2), hi.chunk.GetLocalTranslation().z - (chunkSize - 1) * scale.z / 2); Vector2f[] neighbors = GetNeighbors(hi); hi.neighbors = neighbors; rootNode.AddChild(hi.chunk); hi.pageState = PageState.Loaded; } } else { } }
public void OnAddChunk(TerrainChunkNode chunk) { if (this.ChunkAdded != null) { ChunkAdded(chunk, e); } }
public TerrainChunkNode(PhysicsWorld physicsWorld, TerrainComponent parentT, int x, int z, Vector3f scale, int chunkSize, TerrainChunkNode[] neighbors) : base("TerrainChunkNode") { this.physicsWorld = physicsWorld; this.x = x; this.z = z; this.neighbors = neighbors; this.scale = scale; this.chunkSize = chunkSize; this.parentT = parentT; }
public void GenPatches(TerrainChunkNode terrain, int numPatches, int numEntityPerChunk) { GenPatches(terrain, new Vector2f(0,0), new Vector2f(0, 0), numPatches, numEntityPerChunk, terrain.ChunkSize*terrain.Scale.x); }
public HeightInfo(TerrainComponent component, Vector2f pos, TerrainChunkNode chunk) { this.position = pos; this.chunk = chunk; this.component = component; }
public HeightInfo(TerrainComponent component, Vector2f pos, TerrainChunkNode chunk) { this.position = pos; this.chunk = chunk; this.component = component; }
public abstract void ApplyTerrainMaterial(TerrainChunkNode chunk);
public abstract TerrainChunkNode CreateNewChunk(PhysicsWorld physicsWorld, TerrainComponent parentT, int x, int z, Vector3f scale, int chunkSize, TerrainChunkNode[] neighbors);
public abstract void ApplyTerrainMaterial(TerrainChunkNode chunk);
public void OnRemoveChunk(TerrainChunkNode chunk) { if (this.ChunkRemoved != null) { ChunkRemoved(chunk, e); } }
public void OnAddChunk(TerrainChunkNode chunk) { if (this.ChunkAdded != null) { ChunkAdded(chunk, e); } }