bool LandscapesController::ShowEditorLandscape(EditorLandscape *displayingLandscape) { Landscape *landscape = EditorScene::GetLandscape(scene); if (!landscape) { Logger::Error("[LandscapesController::ShowEditorLandscape] Can be only one landscape"); return false; } displayingLandscape->SetNestedLandscape(landscape); if(!landscapeRenderer) { renderedHeightmap = new EditorHeightmap(landscape->GetHeightmap()); landscapeRenderer = new LandscapeRenderer(renderedHeightmap, landscape->GetBoundingBox()); displayingLandscape->SetHeightmap(renderedHeightmap); } displayingLandscape->SetRenderer(landscapeRenderer); //TODO: remove SetWorldTransformPtr displayingLandscape->SetWorldTransformPtr(landscape->GetWorldTransformPtr()); Entity* lanscapeNode = EditorScene::GetLandscapeNode(scene); lanscapeNode->RemoveComponent(Component::RENDER_COMPONENT); RenderComponent* component = new RenderComponent(displayingLandscape); lanscapeNode->AddComponent(component); currentLandscape = displayingLandscape; return true; }
void Test::PreparePath() { SettingsManager *settings = SettingsManager::Instance(); int32 partX = settings->GetLandscapePartitioning().x; int32 partY = settings->GetLandscapePartitioning().y; Landscape *land = GetLandscape(); AABBox3 boundingBox = land->GetBoundingBox(); Vector3 min = boundingBox.min; Vector3 max = boundingBox.max; float32 landWidth = max.x - min.x; float32 landLength = max.y - min.y; Vector2 rectSize(landWidth / partX, landLength / partY); int32 x = 0; int32 xDir = 1; for(int32 y = 0; y < partY; ++y) { Rect curRect; for(int32 i = 0; i < partX; ++i, x += xDir) { Vector2 v; v.Set(min.x + x * rectSize.x, min.y + y * rectSize.y); curRect.SetPosition(v); curRect.SetSize(rectSize); rectSequence.push_back(curRect); } x -= xDir; xDir = -xDir; } }
void Test::PrepareFpsStat() { testData.Clear(); fpsStatItem.rect = rectSequence[testData.GetItemCount()]; Landscape *land = GetLandscape(); AABBox3 boundingBox = land->GetBoundingBox(); Vector2 landPos(boundingBox.min.x, boundingBox.min.y); Vector2 landSize((boundingBox.max - boundingBox.min).x, (boundingBox.max - boundingBox.min).x); testData.SetLandscapeRect(Rect(landPos, landSize)); }