//---------------------------------------------------------------------------- void EditMap::CreateTerrain (std::string name, int terrainSize, int pageSize, float gridSpacing) { TerrainActor *actor = new0 TerrainActor(); actor->SetName(name); RawTerrain *rawTerrain = new0 RawTerrain(); rawTerrain->SetName(name); rawTerrain->SetSize(pageSize); int quantity = terrainSize/(pageSize-1); rawTerrain->SetRowQuantity(quantity); rawTerrain->SetColQuantity(quantity); rawTerrain->SetSpacing(gridSpacing); rawTerrain->AllocateRawTerrainPages(); actor->SetTerrain(rawTerrain); actor->ComeInToEventWorld(); Event *event = EditorEventSpace::CreateEventX( EditorEventSpace::CreateTerrain); event->SetData<TerrainActor*>(actor); EventWorld::GetSingleton().BroadcastingLocalEvent(event); mScene->AddActor(actor); }
//---------------------------------------------------------------------------- void EditMap::CreateTerrain (std::string name, int terrainSize, int pageSize, float gridSpacing) { TerrainActor *actor = new0 TerrainActor(); actor->SetName(name); RawTerrain *rawTerrain = new0 RawTerrain(); rawTerrain->SetName(name); rawTerrain->SetSize(pageSize); int quantity = terrainSize/(pageSize-1); rawTerrain->SetRowQuantity(quantity); rawTerrain->SetColQuantity(quantity); rawTerrain->SetSpacing(gridSpacing); rawTerrain->AllocateRawTerrainPages(); actor->SetRawTerrain(rawTerrain); actor->ComeInToEventWorld(); AddActor(actor); }