loadShape()
ShapeDescription
Loads geometry into a variable of type PShape. Supports SVG and OBJ files.
Syntax
PShape* loadShape(std::string path)
Parameters
| Name | Type | Description |
|---|---|---|
| path | std::string | path to the SVG or OBJ file |
Returns
PShape*Related
Under the Hood
From Processing.h:
PShape* loadShape(const std::string& path);
Under the Hood
From Processing.cpp:
PShape* PApplet::loadShape(const std::string& path){
auto ext=[&](const std::string& e)->bool{
return path.size()>=e.size()&&path.substr(path.size()-e.size())==e;
};
if(ext(".svg")||ext(".SVG")) return svgLoad(path);
if(ext(".obj")||ext(".OBJ")) return objLoad(path);
std::cerr<<"loadShape: unsupported format: "<<path<<"\n";
return new PShape();
}