MCPcopy Create free account
hub / github.com/RenderKit/embree / loadSubdivMesh

Method loadSubdivMesh

tutorials/common/scenegraph/xml_loader.cpp:1116–1164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1114 }
1115
1116 Ref<SceneGraph::Node> XMLLoader::loadSubdivMesh(const Ref<XML>& xml)
1117 {
1118 Ref<SceneGraph::MaterialNode> material = loadMaterial(xml->child("material"));
1119 Ref<SceneGraph::SubdivMeshNode> mesh = new SceneGraph::SubdivMeshNode(material,BBox1f(0,1),0);
1120
1121 if (Ref<XML> animation = xml->childOpt("animated_positions")) {
1122 for (size_t i=0; i<animation->size(); i++)
1123 mesh->positions.push_back(loadVec3faArray(animation->child(i)));
1124 } else {
1125 mesh->positions.push_back(loadVec3faArray(xml->childOpt("positions")));
1126 if (xml->hasChild("positions2"))
1127 mesh->positions.push_back(loadVec3faArray(xml->childOpt("positions2")));
1128 }
1129
1130 if (Ref<XML> animation = xml->childOpt("animated_normals")) {
1131 for (size_t i=0; i<animation->size(); i++)
1132 mesh->normals.push_back(loadVec3faArray(animation->child(i)));
1133 }
1134 else if (Ref<XML> normalbuf = xml->childOpt("normals")) {
1135 auto vec = loadVec3faArray(normalbuf);
1136 if (vec.size())
1137 for (size_t i=0; i<mesh->numTimeSteps(); i++)
1138 mesh->normals.push_back(vec);
1139 }
1140
1141 mesh->texcoords = loadVec2fArray(xml->childOpt("texcoords"));
1142
1143 if (Ref<XML> child = xml->childOpt("position_indices")) {
1144 mesh->position_indices = loadUIntArray(child);
1145 mesh->position_subdiv_mode = parseSubdivMode(child);
1146 }
1147 if (Ref<XML> child = xml->childOpt("normal_indices")) {
1148 mesh->normal_indices = loadUIntArray(child);
1149 mesh->normal_subdiv_mode = parseSubdivMode(child);
1150 }
1151 if (Ref<XML> child = xml->childOpt("texcoord_indices")) {
1152 mesh->texcoord_indices = loadUIntArray(child);
1153 mesh->texcoord_subdiv_mode = parseSubdivMode(child);
1154 }
1155
1156 mesh->verticesPerFace = loadUIntArray(xml->childOpt("faces"));
1157 mesh->holes = loadUIntArray(xml->childOpt("holes"));
1158 mesh->edge_creases = loadVec2iArray(xml->childOpt("edge_creases"));
1159 mesh->edge_crease_weights = loadFloatArray(xml->childOpt("edge_crease_weights"));
1160 mesh->vertex_creases = loadUIntArray(xml->childOpt("vertex_creases"));
1161 mesh->vertex_crease_weights = loadFloatArray(xml->childOpt("vertex_crease_weights"));
1162 mesh->verify();
1163 return mesh.dynamicCast<SceneGraph::Node>();
1164 }
1165
1166 void fix_bspline_end_points(const std::vector<unsigned>& indices, avector<Vec3ff>& positions)
1167 {

Callers

nothing calls this directly

Calls 8

parseSubdivModeFunction · 0.85
childOptMethod · 0.80
hasChildMethod · 0.80
childMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
numTimeStepsMethod · 0.45
verifyMethod · 0.45

Tested by

no test coverage detected