bool LandscapesController::HideEditorLandscape(EditorLandscape *hiddingLandscape)
{
    hiddingLandscape->FlushChanges();
    
    EditorLandscape *parentLandscape = hiddingLandscape->GetParentLandscape();
    Landscape *nestedLandscape = hiddingLandscape->GetNestedLandscape();
    
    if(parentLandscape)
    {
        Heightmap *hmap = SafeRetain(parentLandscape->GetHeightmap());
        parentLandscape->SetNestedLandscape(nestedLandscape);
        parentLandscape->SetHeightmap(hmap);
        SafeRelease(hmap);

        currentLandscape = parentLandscape;
    }
    else
    {
        EditorLandscape *editorLandscape = dynamic_cast<EditorLandscape *>(nestedLandscape);
        if(editorLandscape)
        {
            editorLandscape->SetParentLandscape(NULL);
        }
		
		Entity* lanscapeNode = EditorScene::GetLandscapeNode(scene);
		lanscapeNode->RemoveComponent(Component::RENDER_COMPONENT);
		lanscapeNode->AddComponent(new RenderComponent(nestedLandscape));
        
        if(NeedToKillRenderer(nestedLandscape))
        {
            SafeRelease(renderedHeightmap);
            SafeRelease(landscapeRenderer);
        }
        
        currentLandscape = nestedLandscape;
    }
    

    SafeRelease(hiddingLandscape);
    return true;
}
Ejemplo n.º 2
0
void EditorLandscape::SetNestedLandscape(DAVA::Landscape *landscapeNode)
{
    SafeRelease(nestedLandscape);
    nestedLandscape = SafeRetain(landscapeNode);
    
    EditorLandscape *editorLandscape = dynamic_cast<EditorLandscape *>(landscapeNode);
    if(editorLandscape)
    {
        editorLandscape->SetParentLandscape(this);
    }
    
    // RETURN TO THIS CODE LATER
    // SetDebugFlags(nestedLandscape->GetDebugFlags());
    
    SetHeightmap(nestedLandscape->GetHeightmap());
    heightmapPath = nestedLandscape->GetHeightmapPathname();

    SetTexture(TEXTURE_TILE_FULL, nestedLandscape->GetTexture(TEXTURE_TILE_FULL));
    
    bbox = nestedLandscape->GetBoundingBox();
    CopyCursorData(nestedLandscape, this);
    
    SetDisplayedTexture();
}