| 14 | {} |
| 15 | |
| 16 | void MapPreview::setRootNode(const scene::IMapRootNodePtr& root) |
| 17 | { |
| 18 | getScene()->setRoot(root); |
| 19 | |
| 20 | if (getScene()->root() != NULL) |
| 21 | { |
| 22 | // Re-associate the rendersystem, we need to propagate this info to the nodes |
| 23 | associateRenderSystem(); |
| 24 | |
| 25 | // Trigger an initial update of the subgraph |
| 26 | GlobalFilterSystem().updateSubgraph(getScene()->root()); |
| 27 | |
| 28 | // Reset the model rotation |
| 29 | resetModelRotation(); |
| 30 | |
| 31 | // Calculate camera distance so map is appropriately zoomed |
| 32 | auto sceneBounds = getSceneBounds(); |
| 33 | auto distance = sceneBounds.getRadius() * 3.0f; |
| 34 | |
| 35 | setViewOrigin(sceneBounds.getOrigin() + Vector3(-0.5, -0.8, 0.4) * distance); |
| 36 | setViewAngles(Vector3(26, 300, 0)); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | scene::IMapRootNodePtr MapPreview::getRootNode() |
| 41 | { |
no test coverage detected