| 1285 | } |
| 1286 | |
| 1287 | Ref<SceneGraph::Node> XMLLoader::loadPoints(const Ref<XML>& xml, RTCGeometryType type) |
| 1288 | { |
| 1289 | Ref<SceneGraph::MaterialNode> material = loadMaterial(xml->child("material")); |
| 1290 | Ref<SceneGraph::PointSetNode> mesh = new SceneGraph::PointSetNode(type,material,BBox1f(0,1),0); |
| 1291 | |
| 1292 | if (Ref<XML> animation = xml->childOpt("animated_positions")) { |
| 1293 | for (size_t i=0; i<animation->size(); i++) { |
| 1294 | mesh->positions.push_back(loadVec3ffArray(animation->child(i))); |
| 1295 | } |
| 1296 | } else { |
| 1297 | mesh->positions.push_back(loadVec3ffArray(xml->childOpt("positions"))); |
| 1298 | } |
| 1299 | |
| 1300 | if (Ref<XML> animation = xml->childOpt("animated_normals")) { |
| 1301 | for (size_t i=0; i<animation->size(); i++) { |
| 1302 | mesh->normals.push_back(loadVec3faArray(animation->child(i))); |
| 1303 | } |
| 1304 | } else if (Ref<XML> normals = xml->childOpt("normals")) { |
| 1305 | mesh->normals.push_back(loadVec3faArray(normals)); |
| 1306 | } |
| 1307 | |
| 1308 | mesh->verify(); |
| 1309 | return mesh.dynamicCast<SceneGraph::Node>(); |
| 1310 | } |
| 1311 | |
| 1312 | Ref<SceneGraph::Node> XMLLoader::loadFurBall(const Ref<XML>& xml) |
| 1313 | { |