Merge pull request #55123 from akien-mga/xatlas-ec707faea
This commit is contained in:
commit
0a76ddc3dd
|
@ -683,12 +683,12 @@ File extracted from upstream release tarball:
|
|||
## xatlas
|
||||
|
||||
- Upstream: https://github.com/jpcy/xatlas
|
||||
- Version: git (5571fc7ef0d06832947c0a935ccdcf083f7a9264, 2020)
|
||||
- Version: git (ec707faeac3b95e6b416076a9509718cce105b6a, 2021)
|
||||
- License: MIT
|
||||
|
||||
Files extracted from upstream source:
|
||||
|
||||
- `xatlas.{cpp,h}`
|
||||
- `source/xatlas/xatlas.{cpp,h}`
|
||||
- `LICENSE`
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,7 +36,8 @@ Copyright NVIDIA Corporation 2006 -- Ignacio Castano <icastano@nvidia.com>
|
|||
|
||||
namespace xatlas {
|
||||
|
||||
enum class ChartType {
|
||||
enum class ChartType
|
||||
{
|
||||
Planar,
|
||||
Ortho,
|
||||
LSCM,
|
||||
|
@ -45,7 +46,8 @@ enum class ChartType {
|
|||
};
|
||||
|
||||
// A group of connected faces, belonging to a single atlas.
|
||||
struct Chart {
|
||||
struct Chart
|
||||
{
|
||||
uint32_t *faceArray;
|
||||
uint32_t atlasIndex; // Sub-atlas index.
|
||||
uint32_t faceCount;
|
||||
|
@ -54,7 +56,8 @@ struct Chart {
|
|||
};
|
||||
|
||||
// Output vertex.
|
||||
struct Vertex {
|
||||
struct Vertex
|
||||
{
|
||||
int32_t atlasIndex; // Sub-atlas index. -1 if the vertex doesn't exist in any atlas.
|
||||
int32_t chartIndex; // -1 if the vertex doesn't exist in any chart.
|
||||
float uv[2]; // Not normalized - values are in Atlas width and height range.
|
||||
|
@ -62,7 +65,8 @@ struct Vertex {
|
|||
};
|
||||
|
||||
// Output mesh.
|
||||
struct Mesh {
|
||||
struct Mesh
|
||||
{
|
||||
Chart *chartArray;
|
||||
uint32_t *indexArray;
|
||||
Vertex *vertexArray;
|
||||
|
@ -77,7 +81,8 @@ static const uint32_t kImageIsBilinearBit = 0x40000000;
|
|||
static const uint32_t kImageIsPaddingBit = 0x20000000;
|
||||
|
||||
// Empty on creation. Populated after charts are packed.
|
||||
struct Atlas {
|
||||
struct Atlas
|
||||
{
|
||||
uint32_t *image;
|
||||
Mesh *meshes; // The output meshes, corresponding to each AddMesh call.
|
||||
float *utilization; // Normalized atlas texel utilization array. E.g. a value of 0.8 means 20% empty space. atlasCount in length.
|
||||
|
@ -94,13 +99,15 @@ Atlas *Create();
|
|||
|
||||
void Destroy(Atlas *atlas);
|
||||
|
||||
enum class IndexFormat {
|
||||
enum class IndexFormat
|
||||
{
|
||||
UInt16,
|
||||
UInt32
|
||||
};
|
||||
|
||||
// Input mesh declaration.
|
||||
struct MeshDecl {
|
||||
struct MeshDecl
|
||||
{
|
||||
const void *vertexPositionData = nullptr;
|
||||
const void *vertexNormalData = nullptr; // optional
|
||||
const void *vertexUvData = nullptr; // optional. The input UVs are provided as a hint to the chart generator.
|
||||
|
@ -131,7 +138,8 @@ struct MeshDecl {
|
|||
float epsilon = 1.192092896e-07F;
|
||||
};
|
||||
|
||||
enum class AddMeshError {
|
||||
enum class AddMeshError
|
||||
{
|
||||
Success, // No error.
|
||||
Error, // Unspecified error.
|
||||
IndexOutOfRange, // An index is >= MeshDecl vertexCount.
|
||||
|
@ -145,7 +153,8 @@ AddMeshError AddMesh(Atlas *atlas, const MeshDecl &meshDecl, uint32_t meshCountH
|
|||
// Wait for AddMesh async processing to finish. ComputeCharts / Generate call this internally.
|
||||
void AddMeshJoin(Atlas *atlas);
|
||||
|
||||
struct UvMeshDecl {
|
||||
struct UvMeshDecl
|
||||
{
|
||||
const void *vertexUvData = nullptr;
|
||||
const void *indexData = nullptr; // optional
|
||||
const uint32_t *faceMaterialData = nullptr; // Optional. Overlapping UVs should be assigned a different material. Must be indexCount / 3 in length.
|
||||
|
@ -161,7 +170,8 @@ AddMeshError AddUvMesh(Atlas *atlas, const UvMeshDecl &decl);
|
|||
// Custom parameterization function. texcoords initial values are an orthogonal parameterization.
|
||||
typedef void (*ParameterizeFunc)(const float *positions, float *texcoords, uint32_t vertexCount, const uint32_t *indices, uint32_t indexCount);
|
||||
|
||||
struct ChartOptions {
|
||||
struct ChartOptions
|
||||
{
|
||||
ParameterizeFunc paramFunc = nullptr;
|
||||
|
||||
float maxChartArea = 0.0f; // Don't grow charts to be larger than this. 0 means no limit.
|
||||
|
@ -184,7 +194,8 @@ struct ChartOptions {
|
|||
// Call after all AddMesh calls. Can be called multiple times to recompute charts with different options.
|
||||
void ComputeCharts(Atlas *atlas, ChartOptions options = ChartOptions());
|
||||
|
||||
struct PackOptions {
|
||||
struct PackOptions
|
||||
{
|
||||
// Charts larger than this will be scaled down. 0 means no limit.
|
||||
uint32_t maxChartSize = 0;
|
||||
|
||||
|
@ -227,7 +238,8 @@ void PackCharts(Atlas *atlas, PackOptions packOptions = PackOptions());
|
|||
void Generate(Atlas *atlas, ChartOptions chartOptions = ChartOptions(), PackOptions packOptions = PackOptions());
|
||||
|
||||
// Progress tracking.
|
||||
enum class ProgressCategory {
|
||||
enum class ProgressCategory
|
||||
{
|
||||
AddMesh,
|
||||
ComputeCharts,
|
||||
PackCharts,
|
||||
|
|
Loading…
Reference in New Issue