Exemplo n.º 1
0
 public void OnRemoveChunk(TerrainChunkNode chunk)
 {
     if (this.ChunkRemoved != null)
     {
         ChunkRemoved(chunk, e);
     }
 }
Exemplo n.º 2
0
        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
            {
            }
        }
Exemplo n.º 3
0
 public void OnAddChunk(TerrainChunkNode chunk)
 {
     if (this.ChunkAdded != null)
     {
         ChunkAdded(chunk, e);
     }
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 public HeightInfo(TerrainComponent component, Vector2f pos, TerrainChunkNode chunk)
 {
     this.position = pos;
     this.chunk = chunk;
     this.component = component;
 }
Exemplo n.º 7
0
 public HeightInfo(TerrainComponent component, Vector2f pos, TerrainChunkNode chunk)
 {
     this.position  = pos;
     this.chunk     = chunk;
     this.component = component;
 }
Exemplo n.º 8
0
 public abstract void ApplyTerrainMaterial(TerrainChunkNode chunk);
Exemplo n.º 9
0
 public abstract TerrainChunkNode CreateNewChunk(PhysicsWorld physicsWorld, TerrainComponent parentT, int x, int z, Vector3f scale, int chunkSize, TerrainChunkNode[] neighbors);
Exemplo n.º 10
0
 public abstract void ApplyTerrainMaterial(TerrainChunkNode chunk);
Exemplo n.º 11
0
 public void OnRemoveChunk(TerrainChunkNode chunk)
 {
     if (this.ChunkRemoved != null)
     {
         ChunkRemoved(chunk, e);
     }
 }
Exemplo n.º 12
0
 public void OnAddChunk(TerrainChunkNode chunk)
 {
     if (this.ChunkAdded != null)
     {
         ChunkAdded(chunk, e);
     }
 }