void MapCopier::copy(
    MapBuilder& builder, MapComponent* component,
    MapVertexAttribute<int>& vertex_id, MapTexVertexAttribute<int>& tex_vertex_id,
    int& cur_vertex_id, int& cur_tex_vertex_id
)
{

    bind_attribute_copiers(builder.target(), component->map()) ;

    // Step 1 : clear vertex and tex vertex ids
    FOR_EACH_VERTEX(MapComponent, component, it) {
        vertex_id[it] = -1 ;
    }

    FOR_EACH_HALFEDGE(MapComponent, component, it) {
        tex_vertex_id[it->tex_vertex()] = -1 ;
    }

    // Step 2: enumerate vertices
    FOR_EACH_VERTEX(MapComponent, component, it) {
        vertex_id[it] = cur_vertex_id ;
        builder.add_vertex(it->point()) ;
        copy_vertex_attributes(builder.current_vertex(), it) ;
        cur_vertex_id++ ;
    }
Esempio n. 2
0
std::unique_ptr<draco::PointCloud> to_draco_point_cloud(Mesh::Ptr mesh,
        bool with_attributes=true) {
    std::unique_ptr<draco::PointCloud> draco_mesh(new draco::PointCloud());
    assert(mesh->get_num_faces() == 0);
    copy_vertices(mesh, draco_mesh);

    if (with_attributes) {
        copy_vertex_attributes(mesh, draco_mesh);
    }

    return draco_mesh;
}
Esempio n. 3
0
std::unique_ptr<draco::Mesh> to_draco_mesh(Mesh::Ptr mesh,
        bool with_attributes=true) {
    std::unique_ptr<draco::Mesh> draco_mesh(new draco::Mesh());

    const size_t vertex_per_face = mesh->get_vertex_per_face();
    if (vertex_per_face != 3) {
        throw NotImplementedError(
                "Draco encoding only supports triangle mesh.");
    }

    copy_vertices(mesh, draco_mesh);
    copy_faces(mesh, draco_mesh);

    if (with_attributes) {
        copy_vertex_attributes(mesh, draco_mesh);
        //copy_face_attributes(mesh, draco_mesh);
    }

    return draco_mesh;
}