|
Lagrange
|
Reusable xatlas engine. More...
#include <AtlasEngine.h>
Classes | |
| struct | Impl |
Public Types | |
| using | Mesh = SurfaceMesh<Scalar, Index> |
| using | NotificationFunc = std::function<void(const std::string&, float)> |
Public Member Functions | |
| AtlasEngine (const AtlasEngine &)=delete | |
| AtlasEngine & | operator= (const AtlasEngine &)=delete |
| AtlasEngine (AtlasEngine &&) noexcept | |
| AtlasEngine & | operator= (AtlasEngine &&) noexcept |
| void | add_mesh (const Mesh &mesh, const UnwrapOptions &options={}) |
| Add a mesh for unwrapping. Throws if any UV-only mesh has already been added. | |
| void | add_uv_mesh (const Mesh &mesh, const RepackOptions &options={}) |
| Add a mesh with existing UVs for repacking only. Throws if any unwrap mesh has been added. | |
| void | clear () |
| Reset the engine to its initial empty state. | |
| void | compute_charts (const ChartOptions &opts={}) |
Compute charts. Valid only after at least one add_mesh() call. | |
| void | pack_charts (const PackOptions &opts) |
Pack charts. Valid after compute_charts() (unwrap path) or add_uv_mesh() (repack path). | |
| void | generate (const ChartOptions &chart_opts, const PackOptions &pack_opts) |
Convenience: compute_charts() + pack_charts(). | |
| void | generate (const UnwrapOptions &opts) |
Convenience: compute_charts(opts.chart) + pack_charts(opts.packing). | |
| Mesh | extract_mesh (size_t mesh_index, MultiAtlasPolicy multi_atlas_policy, std::string_view output_uv_attribute_name, std::string_view output_atlas_attribute_name, std::string_view output_chart_attribute_name) const |
| Read back the i-th input mesh with the new UVs applied as an indexed attribute. | |
| size_t | mesh_count () const |
| Number of meshes added to the atlas. | |
| uint32_t | atlas_width () const |
| Atlas tile width in pixels (0 before pack). | |
| uint32_t | atlas_height () const |
| Atlas tile height in pixels (0 before pack). | |
| uint32_t | atlas_count () const |
| Number of atlas tiles xatlas produced (0 before pack). | |
| uint32_t | chart_count () const |
| Total number of charts (0 before chart computation). | |
| float | texels_per_unit () const |
| Effective texels-per-unit value used by the most recent pack. | |
| float | utilization (uint32_t atlas_index) const |
Utilization of the given atlas tile (in [0, 1]). | |
| void | set_notification_func (NotificationFunc func) |
| Set the optional progress callback. xatlas may invoke it from any thread. | |
| void | set_cancel (const std::atomic_bool *cancel) |
| Set the optional cancellation flag. | |
Reusable xatlas engine.
Wraps an xatlas::Atlas* so callers can run the chart-then-pack pipeline once and re-pack with different PackOptions without rebuilding charts. This is the efficient path for repeated calls; one-shot users should prefer the free functions.
State machine:
add_mesh() (one or more times) for the unwrap path, OR call add_uv_mesh() (one or more times) for the repack-only path. Mixing the two is rejected.compute_charts() then pack_charts() (or generate() to do both). compute_charts() may be called again to re-segment with new options; this invalidates any previously packed output and requires another pack_charts() before extraction. pack_charts() may be called repeatedly with different options.pack_charts() directly.extract_mesh(i, ...) reads back the i-th input mesh with the new UVs applied.clear() resets the engine to its initial empty state.