registerAsRoot method
Registers this node as the root node of the scene graph.
Throws an exception if the node is already a root or has a parent.
Implementation
void registerAsRoot(Scene scene) {
name = 'root';
if (_isSceneRoot) {
throw Exception('Node is already a root');
}
if (_parent != null) {
throw Exception('Node already has a parent');
}
_isSceneRoot = true;
}