MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / setRootNode

Method setRootNode

radiant/ui/common/MapPreview.cpp:16–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14{}
15
16void 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
40scene::IMapRootNodePtr MapPreview::getRootNode()
41{

Callers 3

ShowModalMethod · 0.45
clearPreviewMethod · 0.45
onSelectionChangedMethod · 0.45

Calls 4

setRootMethod · 0.80
updateSubgraphMethod · 0.80
getRadiusMethod · 0.80
rootMethod · 0.45

Tested by

no test coverage detected