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

Method loadNode

tutorials/common/scenegraph/xml_loader.cpp:1707–1874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1705 }
1706
1707 Ref<SceneGraph::Node> XMLLoader::loadNode(const Ref<XML>& xml)
1708 {
1709 if (xml->name == "assign")
1710 {
1711 if (xml->parm("type") == "material")
1712 {
1713 const std::string id = xml->parm("id");
1714 Ref<SceneGraph::MaterialNode> material = loadMaterial(xml->child(0));
1715 state.materialMap[id] = material;
1716 material->name = xml->parm("name");
1717 return nullptr;
1718 }
1719 else if (xml->parm("type") == "scene")
1720 {
1721 const std::string id = xml->parm("id");
1722 state.sceneMap[id] = loadNode(xml->child(0));
1723 return nullptr;
1724 }
1725 else
1726 THROW_RUNTIME_ERROR(xml->loc.str()+": unknown type: "+xml->parm("type"));
1727 }
1728 else
1729 {
1730 Ref<SceneGraph::Node> node = nullptr;
1731 const std::string id = xml->parm("id");
1732 if (xml->name == "extern")
1733 node = state.sceneMap[id] = SceneGraph::load(path + xml->parm("src"));
1734 else if (xml->name == "xml")
1735 node = state.sceneMap[id] = XMLLoader::load(path + xml->parm("src"),one,state);
1736 else if (xml->name == "extern_combine")
1737 node = state.sceneMap[id] = SceneGraph::load(path + xml->parm("src"),true);
1738 else if (xml->name == "obj" ) {
1739 const bool subdiv_mode = xml->parm("subdiv") == "1";
1740 node = state.sceneMap[id] = loadOBJ(path + xml->parm("src"),subdiv_mode);
1741 }
1742
1743 else if (xml->name == "ref" ) node = state.sceneMap[id] = state.sceneMap[xml->parm("id")];
1744 else if (xml->name == "PointLight" ) node = state.sceneMap[id] = loadPointLight (xml);
1745 else if (xml->name == "SpotLight" ) node = state.sceneMap[id] = loadSpotLight (xml);
1746 else if (xml->name == "DirectionalLight") node = state.sceneMap[id] = loadDirectionalLight(xml);
1747 else if (xml->name == "DistantLight" ) node = state.sceneMap[id] = loadDistantLight (xml);
1748 else if (xml->name == "AmbientLight" ) node = state.sceneMap[id] = loadAmbientLight (xml);
1749 else if (xml->name == "TriangleLight" ) node = state.sceneMap[id] = loadTriangleLight (xml);
1750 else if (xml->name == "AnimatedLight" ) node = state.sceneMap[id] = loadAnimatedLight (xml);
1751 else if (xml->name == "QuadLight" ) node = state.sceneMap[id] = loadQuadLight (xml);
1752 else if (xml->name == "TriangleMesh" ) node = state.sceneMap[id] = loadTriangleMesh (xml);
1753 else if (xml->name == "QuadMesh" ) node = state.sceneMap[id] = loadQuadMesh (xml);
1754 else if (xml->name == "GridMesh" ) node = state.sceneMap[id] = loadGridMesh (xml);
1755 else if (xml->name == "SubdivisionMesh" ) node = state.sceneMap[id] = loadSubdivMesh (xml);
1756
1757 /* just for compatibility, use Curves XML node instead */
1758 else if (xml->name == "Hair" ) node = state.sceneMap[id] = loadBezierCurves (xml,SceneGraph::FLAT_CURVE);
1759 else if (xml->name == "LineSegments" ) node = state.sceneMap[id] = loadCurves (xml,RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE);
1760 else if (xml->name == "RoundLineSegments") node = state.sceneMap[id] = loadCurves (xml,RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE);
1761 else if (xml->name == "ConeSegments") node = state.sceneMap[id] = loadCurves (xml,RTC_GEOMETRY_TYPE_CONE_LINEAR_CURVE);
1762 else if (xml->name == "BezierHair" ) node = state.sceneMap[id] = loadBezierCurves (xml,SceneGraph::FLAT_CURVE);
1763 else if (xml->name == "BSplineHair" ) node = state.sceneMap[id] = loadCurves (xml,RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE);
1764 else if (xml->name == "BezierCurves" ) node = state.sceneMap[id] = loadBezierCurves (xml,SceneGraph::ROUND_CURVE);

Callers

nothing calls this directly

Calls 6

loadOBJFunction · 0.85
parmMethod · 0.80
parm_Vec2fMethod · 0.80
loadFunction · 0.50
childMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected