| 1180 | } |
| 1181 | |
| 1182 | Ref<SceneGraph::Node> XMLLoader::loadBezierCurves(const Ref<XML>& xml, SceneGraph::CurveSubtype subtype) |
| 1183 | { |
| 1184 | Ref<SceneGraph::MaterialNode> material = loadMaterial(xml->child("material")); |
| 1185 | RTCGeometryType type = (subtype == SceneGraph::ROUND_CURVE) ? RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE : RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE; |
| 1186 | Ref<SceneGraph::HairSetNode> mesh = new SceneGraph::HairSetNode(type,material,BBox1f(0,1),0); |
| 1187 | |
| 1188 | if (Ref<XML> animation = xml->childOpt("animated_positions")) { |
| 1189 | for (size_t i=0; i<animation->size(); i++) |
| 1190 | mesh->positions.push_back(loadVec3ffArray(animation->child(i))); |
| 1191 | } else { |
| 1192 | mesh->positions.push_back(loadVec3ffArray(xml->childOpt("positions"))); |
| 1193 | if (xml->hasChild("positions2")) |
| 1194 | mesh->positions.push_back(loadVec3ffArray(xml->childOpt("positions2"))); |
| 1195 | } |
| 1196 | |
| 1197 | std::vector<Vec2i> indices = loadVec2iArray(xml->childOpt("indices")); |
| 1198 | mesh->hairs.resize(indices.size()); |
| 1199 | for (size_t i=0; i<indices.size(); i++) |
| 1200 | mesh->hairs[i] = SceneGraph::HairSetNode::Hair(indices[i].x,indices[i].y); |
| 1201 | |
| 1202 | std::string tessellation_rate = xml->parm("tessellation_rate"); |
| 1203 | if (tessellation_rate != "") |
| 1204 | mesh->tessellation_rate = atoi(tessellation_rate.c_str()); |
| 1205 | |
| 1206 | mesh->flags = loadUCharArray(xml->childOpt("flags")); |
| 1207 | |
| 1208 | mesh->verify(); |
| 1209 | return mesh.dynamicCast<SceneGraph::Node>(); |
| 1210 | } |
| 1211 | |
| 1212 | Ref<SceneGraph::Node> XMLLoader::loadCurves(const Ref<XML>& xml, RTCGeometryType type) |
| 1213 | { |