diff options
Diffstat (limited to 'thirdparty/xatlas/xatlas.h')
-rw-r--r-- | thirdparty/xatlas/xatlas.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/thirdparty/xatlas/xatlas.h b/thirdparty/xatlas/xatlas.h index c123e800b4..7be165e7e5 100644 --- a/thirdparty/xatlas/xatlas.h +++ b/thirdparty/xatlas/xatlas.h @@ -48,8 +48,8 @@ struct Chart { uint32_t atlasIndex; // Sub-atlas index. uint32_t flags; - uint32_t *indexArray; - uint32_t indexCount; + uint32_t *faceArray; + uint32_t faceCount; uint32_t material; }; @@ -73,9 +73,10 @@ struct Mesh uint32_t vertexCount; }; -static const uint32_t kImageChartIndexMask = 0x3FFFFFFF; -static const uint32_t kImageHasChartIndexBit = 0x40000000; -static const uint32_t kImageIsPaddingBit = 0x80000000; +static const uint32_t kImageChartIndexMask = 0x1FFFFFFF; +static const uint32_t kImageHasChartIndexBit = 0x80000000; +static const uint32_t kImageIsBilinearBit = 0x40000000; +static const uint32_t kImageIsPaddingBit = 0x20000000; // Empty on creation. Populated after charts are packed. struct Atlas @@ -173,7 +174,6 @@ struct ChartOptions float textureSeamMetricWeight = 0.5f; float maxThreshold = 2.0f; // If total of all metrics * weights > maxThreshold, don't grow chart. Lower values result in more charts. - uint32_t growFaceCount = 32; // Grow this many faces at a time. uint32_t maxIterations = 1; // Number of iterations of the chart growing and seeding phases. Higher values result in better charts. }; @@ -188,12 +188,24 @@ void ParameterizeCharts(Atlas *atlas, ParameterizeFunc func = nullptr); struct PackOptions { + // Leave space around charts for texels that would be sampled by bilinear filtering. + bool bilinear = true; + + // Align charts to 4x4 blocks. Also improves packing speed, since there are fewer possible chart locations to consider. + bool blockAlign = false; + // Slower, but gives the best result. If false, use random chart placement. bool bruteForce = false; // Create Atlas::image bool createImage = false; + // Charts larger than this will be scaled down. 0 means no limit. + uint32_t maxChartSize = 0; + + // Number of pixels to pad charts with. + uint32_t padding = 0; + // Unit to texel scale. e.g. a 1x1 quad with texelsPerUnit of 32 will take up approximately 32x32 texels in the atlas. // If 0, an estimated value will be calculated to approximately match the given resolution. // If resolution is also 0, the estimated value will approximately match a 1024x1024 atlas. @@ -203,15 +215,6 @@ struct PackOptions // If not 0, and texelsPerUnit is not 0, generate one or more atlases with that exact resolution. // If not 0, and texelsPerUnit is 0, texelsPerUnit is estimated to approximately match the resolution. uint32_t resolution = 0; - - // Charts larger than this will be scaled down. - uint32_t maxChartSize = 1024; - - // Align charts to 4x4 blocks. Also improves packing speed, since there are fewer possible chart locations to consider. - bool blockAlign = false; - - // Number of pixels to pad charts with. - uint32_t padding = 0; }; // Call after ParameterizeCharts. Can be called multiple times to re-pack charts with different options. @@ -240,7 +243,8 @@ void SetProgressCallback(Atlas *atlas, ProgressFunc progressFunc = nullptr, void // Custom memory allocation. typedef void *(*ReallocFunc)(void *, size_t); -void SetRealloc(ReallocFunc reallocFunc); +typedef void (*FreeFunc)(void *); +void SetAlloc(ReallocFunc reallocFunc, FreeFunc freeFunc = nullptr); // Custom print function. typedef int (*PrintFunc)(const char *, ...); |