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

Method loadQuadMesh

tutorials/common/scenegraph/xml_loader.cpp:1053–1083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1051 }
1052
1053 Ref<SceneGraph::Node> XMLLoader::loadQuadMesh(const Ref<XML>& xml)
1054 {
1055 Ref<SceneGraph::MaterialNode> material = loadMaterial(xml->child("material"));
1056 Ref<SceneGraph::QuadMeshNode> mesh = new SceneGraph::QuadMeshNode(material,BBox1f(0,1),0);
1057
1058 if (Ref<XML> animation = xml->childOpt("animated_positions")) {
1059 for (size_t i=0; i<animation->size(); i++)
1060 mesh->positions.push_back(loadVec3faArray(animation->child(i)));
1061 } else {
1062 mesh->positions.push_back(loadVec3faArray(xml->childOpt("positions")));
1063 }
1064
1065 if (Ref<XML> animation = xml->childOpt("animated_normals")) {
1066 for (size_t i=0; i<animation->size(); i++)
1067 mesh->normals.push_back(loadVec3faArray(animation->child(i)));
1068 }
1069 else if (Ref<XML> normalbuf = xml->childOpt("normals")) {
1070 auto vec = loadVec3faArray(normalbuf);
1071 if (vec.size())
1072 for (size_t i=0; i<mesh->numTimeSteps(); i++)
1073 mesh->normals.push_back(vec);
1074 }
1075
1076 mesh->texcoords = loadVec2fArray(xml->childOpt("texcoords"));
1077
1078 std::vector<Vec4i> indices = loadVec4iArray(xml->childOpt("indices"));
1079 for (size_t i=0; i<indices.size(); i++)
1080 mesh->quads.push_back(SceneGraph::QuadMeshNode::Quad(indices[i].x,indices[i].y,indices[i].z,indices[i].w));
1081 mesh->verify();
1082 return mesh.dynamicCast<SceneGraph::Node>();
1083 }
1084
1085 Ref<SceneGraph::Node> XMLLoader::loadGridMesh(const Ref<XML>& xml)
1086 {

Callers

nothing calls this directly

Calls 7

childOptMethod · 0.80
QuadClass · 0.70
childMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
numTimeStepsMethod · 0.45
verifyMethod · 0.45

Tested by

no test coverage detected