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