Skip to content

UVAtlasPartition

Chuck Walbourn edited this page Aug 16, 2025 · 6 revisions
UVAtlas

Create a UV atlas for a mesh, which is then followed by a call to UVAtlasPack.

HRESULT UVAtlasPartition(
    const XMFLOAT3* positions, size_t nVerts,
    const void* indices, DXGI_FORMAT indexFormat, size_t nFaces,
    size_t maxChartNumber, float maxStretch,
    const uint32_t *adjacency, const uint32_t *falseEdgeAdjacency,
    const float *pIMTArray,
    std::function<HRESULT(float percentComplete)> statusCallBack,
    float callbackFrequency,
    UVATLAS options,
    std::vector<UVAtlasVertex>& vMeshOutVertexBuffer,
    std::vector<uint8_t>& vMeshOutIndexBuffer,
    std::vector<uint32_t>* pvFacePartitioning,
    std::vector<uint32_t>* pvVertexRemapArray,
    std::vector<uint32_t>& vPartitionResultAdjacency,
    float *maxStretchOut = nullptr, size_t *numChartsOut = nullptr);

Parameters

See UVAtlasCreate which details the majority of the parameters to this function.

vPartitionResultAdjacency: Contains three values per face. This is used as input to the UVAtlasPack.

Returns

This function will succeed with an S_OK or will return an HRESULT error code (E_INVALIDARG, E_OUTOFMEMORY, E_FAIL, E_POINTER, E_UNEXPECTED, HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), or HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)).

If statusCallBack returns false, this function will return E_ABORT.

Exceptions

This function does not throw C++ exceptions, but is not marked noexcept because statusCallBack could generate one.

Remarks

UVAtlas can partition mesh geometry two ways:

  • Based on the number of charts
  • Based on the maximum allowed stretch. If the maximum allowed stretch is 0, each triangle will likely be in its own chart

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Xbox One
  • Xbox Series X|S
  • Windows Subsystem for Linux

Architecture

  • x86
  • x64
  • ARM64

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v20
  • GCC 10.5, 11.4, 12.3, 13.3, 14.2
  • MinGW 12.2, 13.2
  • CMake 3.21

Related Projects

A python wrapper of UVAtlasTool

DirectXMesh

DirectXTex

DirectXMath

Tools

Test Suite

Content Exporter

DxCapsViewer

Clone this wiki locally