void CommandCopyPasteHeightmap::UpdateLandscapeTilemap(DAVA::Image *image) { Texture* texture = Texture::CreateFromData(image->GetPixelFormat(), image->GetData(), image->GetWidth(), image->GetHeight(), false); texture->relativePathname = tilemapSavedPathname; texture->GenerateMipmaps(); texture->SetWrapMode(Texture::WRAP_REPEAT, Texture::WRAP_REPEAT); LandscapeEditorBase* editor = GetActiveEditor(); if (editor) { editor->UpdateLandscapeTilemap(texture); } else { SceneEditorScreenMain *screen = dynamic_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen()); EditorScene* scene = screen->FindCurrentBody()->bodyControl->GetScene(); Landscape* landscape = scene->GetLandscape(scene); landscape->SetTexture(Landscape::TEXTURE_TILE_MASK, texture); landscape->UpdateFullTiledTexture(); ImageLoader::Save(image, tilemapSavedPathname); } SafeRelease(texture); }
void LandscapesController::SetScene(DAVA::Scene *scene) { ReleaseScene(); this->scene = SafeRetain(scene); if(scene) { EditorScene *editorScene = dynamic_cast<EditorScene *>(scene); if(editorScene) { Landscape *landscape = editorScene->GetLandscape(editorScene); if(landscape) { SaveLandscape(landscape); } } } }
void MaterialEditor::SetupFog(bool enabled, float32 dencity, const DAVA::Color &newColor) { for(int32 i = 0; i < (int32)materials.size(); ++i) { materials[i]->SetFog(enabled); materials[i]->SetFogDensity(dencity); materials[i]->SetFogColor(newColor); } if(workingScene) { EditorScene *editorScene = dynamic_cast<EditorScene *>(workingScene); if(editorScene) { LandscapeNode *landscape = editorScene->GetLandscape(editorScene); if (landscape) { landscape->SetFog(enabled); landscape->SetFogDensity(dencity); landscape->SetFogColor(newColor); } } } }