| 230 | } |
| 231 | |
| 232 | Ref<SceneGraph::Node> CoronaLoader::loadGroupNode(const Ref<XML>& xml) |
| 233 | { |
| 234 | if (xml->children.size() < 1) |
| 235 | THROW_RUNTIME_ERROR(xml->loc.str()+": invalid group node"); |
| 236 | |
| 237 | /* load instances */ |
| 238 | auto p = loadInstances(xml->children[0]); |
| 239 | Ref<SceneGraph::MaterialNode> material = p.first; |
| 240 | avector<AffineSpace3fa>& xfms = p.second; |
| 241 | |
| 242 | /* load meshes */ |
| 243 | Ref<SceneGraph::GroupNode> objects = new SceneGraph::GroupNode; |
| 244 | for (size_t i=1; i<xml->children.size(); i++) |
| 245 | objects->add(loadObject(xml->children[i])); |
| 246 | |
| 247 | /* force material */ |
| 248 | objects->setMaterial(material); |
| 249 | |
| 250 | /* create instances */ |
| 251 | Ref<SceneGraph::GroupNode> instances = new SceneGraph::GroupNode; |
| 252 | for (size_t i=0; i<xfms.size(); i++) |
| 253 | instances->add(new SceneGraph::TransformNode(xfms[i],objects.cast<SceneGraph::Node>())); |
| 254 | |
| 255 | return instances.cast<SceneGraph::Node>(); |
| 256 | } |
| 257 | |
| 258 | Ref<SceneGraph::Node> CoronaLoader::loadNode(const Ref<XML>& xml) |
| 259 | { |
nothing calls this directly
no test coverage detected