Files
2026-10-02 03:22:11 -03:00

38 lines
1.5 KiB
C++

// INTERNAL (not included by engine.hpp). SVG -> geometry: every non-patch SVG shape becomes a prism.
// * fills are normalised with Clipper2 (union with the shape's fill rule -> islands + holes),
// stroke-only shapes are turned into outlines with Clipper2's polygon offsetting;
// * the outline is lofted between "levels" defined by the `e` label; a level scales the
// cross-section uniformly about the island's centroid;
// * base/top elevations, colours and levels can be patched per vertex (vpatch) or per shape
// (spatch) by shapes drawn on top - see detail/svg.hpp for the label grammar.
// Game code uses Resources::svg() instead, which caches the result as a shared Model.
#pragma once
#include "../graphics.hpp"
#include "../model.hpp"
#include "svg.hpp"
#include <string>
#include <string_view>
#include <vector>
namespace eng {
struct ExtrudedShape {
std::string id;
std::vector<std::string> groups;
MeshData mesh; // world space, unindexed, CCW front faces
Aabb bounds;
};
struct ExtrudeResult {
std::vector<ExtrudedShape> shapes; // document order, patches excluded
std::vector<std::string> warnings;
[[nodiscard]] MeshData merged() const;
[[nodiscard]] const ExtrudedShape* find(std::string_view id) const;
};
ExtrudeResult extrude(const SvgDocument& doc, const ExtrudeOptions& options = {});
ExtrudeResult extrudeSvgFile(const std::string& path, const ExtrudeOptions& options = {});
} // namespace eng