77
88#include < glm/glm.hpp>
99
10- #include " number_utils.h"
1110#include " SegmentedBuffer.h"
1211
1312namespace atlas {
@@ -21,10 +20,10 @@ struct UvMesh {
2120class Packing {
2221public:
2322 Packing () = default ;
24- Packing (std::vector<glm::dvec2> uvs, const double effective_pixel_area , const float utilization = 1 .0f )
25- : Packing(SegmentedBuffer<glm::dvec2>(std::move(uvs)), effective_pixel_area, utilization ) {}
26- Packing (SegmentedBuffer<glm::dvec2> uvs, const double effective_pixel_area , const float utilization = 1 .0f )
27- : _uvs(std::move(uvs)), _effective_pixel_area(effective_pixel_area ), _utilization(utilization ) {}
23+ Packing (std::vector<glm::dvec2> uvs, const double utilization = 1.0 , const double aspect = 1.0 )
24+ : Packing(SegmentedBuffer<glm::dvec2>(std::move(uvs)), utilization, aspect ) {}
25+ Packing (SegmentedBuffer<glm::dvec2> uvs, const double utilization = 1.0 , const double aspect = 1.0 )
26+ : _uvs(std::move(uvs)), _utilization(utilization ), _aspect(aspect ) {}
2827
2928 std::span<const glm::dvec2> uvs_for_mesh (const uint32_t mesh_index) const {
3029 return this ->_uvs .segment (mesh_index);
@@ -37,22 +36,18 @@ class Packing {
3736 return this ->_uvs .backing ();
3837 }
3938
40- // Sum of effective input pixels (source-texture pixels actually covered by UVs) across all packed meshes.
41- double effective_pixel_area () const {
42- return this ->_effective_pixel_area ;
39+ double utilization () const {
40+ return this ->_utilization ;
4341 }
4442
45- // Fraction of the packed atlas actually covered by charts. 1.0 for
46- // packings that were not produced by the chart packer (e.g. a single
47- // mesh's own UVs), since there is no wasted atlas space to account for.
48- float utilization () const {
49- return this ->_utilization ;
43+ double aspect () const {
44+ return this ->_aspect ;
5045 }
5146
5247private:
5348 SegmentedBuffer<glm::dvec2> _uvs;
54- double _effective_pixel_area = 0 .0 ;
55- float _utilization = 1 .0f ;
49+ double _utilization = 1 .0 ;
50+ double _aspect = 1.0 ;
5651};
5752
5853class Packer {
0 commit comments