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

HRESULT UVAtlasPartition(
    _In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts,
    _When_(indexFormat == DXGI_FORMAT_R16_UINT,
    _When_(indexFormat != DXGI_FORMAT_R16_UINT,
        _In_reads_bytes_(nFaces*sizeof(uint32_t))) const void* indices,
    _In_ DXGI_FORMAT indexFormat, _In_ size_t nFaces,
    _In_ size_t maxChartNumber, _In_ float maxStretch,
    _In_reads_(nFaces*3)        const uint32_t *adjacency,
    _In_reads_opt_(nFaces*3)    const uint32_t *falseEdgeAdjacency,
    _In_reads_opt_(nFaces*3)    const float *pIMTArray,
    _In_opt_ std::function<HRESULT(float percentComplete)> statusCallBack,
    _In_ float callbackFrequency,
    _In_ DWORD options,
    _Inout_ std::vector<UVAtlasVertex>& vMeshOutVertexBuffer,
    _Inout_ std::vector<uint8_t>& vMeshOutIndexBuffer,
    _Inout_opt_ std::vector<uint32_t>* pvFacePartitioning,
    _Inout_opt_ std::vector<uint32_t>* pvVertexRemapArray,
    _Inout_ std::vector<uint32_t>& vPartitionResultAdjacency,
    _Out_opt_ float *maxStretchOut = nullptr,
    _Out_opt_ size_t *numChartsOut = nullptr);


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.


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

Last edited Oct 31, 2014 at 6:38 PM by walbourn, version 8