MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / EMSCRIPTEN_BINDINGS

Function EMSCRIPTEN_BINDINGS

source/MRWasmModule/MRWasmMeshComponents.cpp:23–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23EMSCRIPTEN_BINDINGS( meshlib_mesh_components )
24{
25 emscripten::enum_<MeshComponents::FaceIncidence>( "MeshComponentsFaceIncidence" )
26 .value( "PerEdge", MeshComponents::FaceIncidence::PerEdge )
27 .value( "PerVertex", MeshComponents::FaceIncidence::PerVertex );
28
29 emscripten::class_<MeshComponentsModule>( "MeshComponents" )
30 .class_function( "getComponent", +[]( std::shared_ptr<Mesh> m, int seed, MeshComponents::FaceIncidence inc )
31 {
32 return MeshComponents::getComponent( *m, FaceId( seed ), inc );
33 } )
34 .class_function( "getComponents", +[]( std::shared_ptr<Mesh> m, const FaceBitSet& seeds, MeshComponents::FaceIncidence inc )
35 {
36 return MeshComponents::getComponents( *m, seeds, inc );
37 } )
38 .class_function( "getLargestComponent", +[]( std::shared_ptr<Mesh> m, MeshComponents::FaceIncidence inc, float minArea )
39 {
40 return MeshComponents::getLargestComponent( *m, inc, nullptr, minArea );
41 } )
42 .class_function( "getLargeByAreaComponents", +[]( std::shared_ptr<Mesh> m, float minArea )
43 {
44 return MeshComponents::getLargeByAreaComponents( *m, minArea, nullptr );
45 } )
46 .class_function( "getNumComponents", +[]( std::shared_ptr<Mesh> m, MeshComponents::FaceIncidence inc )
47 {
48 return MeshComponents::getNumComponents( *m, inc );
49 } )
50 .class_function( "getAllComponents", +[]( std::shared_ptr<Mesh> m, MeshComponents::FaceIncidence inc )
51 {
52 const std::vector<FaceBitSet> comps = MeshComponents::getAllComponents( *m, inc );
53 emscripten::val arr = emscripten::val::array();
54 for ( const FaceBitSet& c : comps )
55 arr.call<void>( "push", c );
56 return arr;
57 } )
58 .class_function( "getAllComponentsMap", +[]( std::shared_ptr<Mesh> m, MeshComponents::FaceIncidence inc )
59 {
60 auto [regionMap, numRegions] = MeshComponents::getAllComponentsMap( *m, inc );
61 emscripten::val out = emscripten::val::object();
62 out.set( "map", regionMap );
63 out.set( "numRegions", numRegions );
64 return out;
65 } )
66 .class_function( "getLargeByAreaRegions", +[]( std::shared_ptr<Mesh> m, const Face2RegionMap& face2RegionMap, int numRegions, float minArea )
67 {
68 auto [faces, n] = MeshComponents::getLargeByAreaRegions( *m, face2RegionMap, numRegions, minArea );
69 emscripten::val out = emscripten::val::object();
70 out.set( "faces", faces );
71 out.set( "numRegions", n );
72 return out;
73 } );
74}

Callers

nothing calls this directly

Calls 10

getComponentsFunction · 0.85
getLargeByAreaComponentsFunction · 0.85
getAllComponentsMapFunction · 0.85
getLargeByAreaRegionsFunction · 0.85
getComponentFunction · 0.50
getLargestComponentFunction · 0.50
getNumComponentsFunction · 0.50
getAllComponentsFunction · 0.50
valueMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected