D3DXUVAtlasPartition function

Create a UV atlas for a mesh.

Syntax

HRESULT D3DXUVAtlasPartition(
  _In_        LPD3DXMESH      pMesh,
  _In_        UINT            dwMaxChartNumber,
  _In_        FLOAT           fMaxStretch,
  _In_        DWORD           dwTextureIndex,
  _In_  const DWORD           *pdwAdjacency,
        const DWORD           *pdwFalseEdges,
  _In_        FLOAT           *pfIMTArray,
  _In_        LPD3DXUVATLASCB pCallback,
  _In_        FLOAT           fCallbackFrequency,
  _In_        LPVOID          pUserContent,
  _In_        DWORD           dwOptions,
  _In_        LPD3DXMESH      *ppMeshOut,
  _Out_       LPD3DXBUFFER    pFacePartitioning,
  _Out_       LPD3DXBUFFER    *ppVertexRemapArray,
              LPD3DXBUFFER    *ppPartitionResultAdjacency,
  _Out_       FLOAT           *pfMaxStretchOut,
  _Out_       UINT            *pdwNumChartsOut
);

Parameters

pMesh [in]

Type: LPD3DXMESH

Pointer to an input mesh (see ID3DXMesh) that contains the object geometry for calculating the atlas. At a minimum, the mesh must contain position data and 2D texture coordinates.

dwMaxChartNumber [in]

Type: UINT

The maximum number of charts to partition the mesh into. See remarks about the partitioning modes. Use 0 to tell D3DX that the atlas should be parameterized based on stretch.

fMaxStretch [in]

Type: FLOAT

The amount of stretching allowed. 0 means no stretching is allowed, 1 means any amount of stretching can be used.

dwTextureIndex [in]

Type: DWORD

Zero-based texture coordinate index that identifies which set of texture coordinates to use.

pdwAdjacency [in]

Type: const DWORD*

A pointer to an array of adjacency data with 3 DWORDs per face, indicating which triangles are adjacent to each other (see ID3DXBaseMesh::GenerateAdjacency).

pdwFalseEdges

Type: const DWORD*

An array with 3 DWORDS per face. Each face indicates if an edge is false or not. A non-false edge is indicated by -1, a false edge is indicated by any other value. This enables the parameterization of a mesh of quads where the edges down the middle of each quad will not be cut.

pfIMTArray [in]

Type: FLOAT*

A pointer to an array of integrated metric tensors that describes how to stretch a triangle (see IntegratedMetricTensor).

pCallback [in]

Type: LPD3DXUVATLASCB

A pointer to a callback function (see LPD3DXUVATLASCB) that is useful for monitoring progress.

fCallbackFrequency [in]

Type: FLOAT

Specify how often D3DX will call the callback; a reasonable default value is 0.0001f.

pUserContent [in]

Type: LPVOID

Pointer to a user-defined value that is passed to the callback function; typically used by an application to pass a pointer to a data structure that provides context information for the callback function.

dwOptions [in]

Type: DWORD

Specify the quality of the charts generated by combining one or more D3DXUVATLAS flags.

ppMeshOut [in]

Type: LPD3DXMESH*

Pointer to the created mesh with the atlas (see ID3DXMesh).

pFacePartitioning [out]

Type: LPD3DXBUFFER

A pointer to an array of the final face-partitioning data. Each element contains one DWORD per face (see ID3DXBuffer).

ppVertexRemapArray [out]

Type: LPD3DXBUFFER*

A pointer to an array of remapped vertices. Each array element identifies the original vertex each final vertex came from (if the vertex was split during remapping). Each array element contains one DWORD per vertex.

ppPartitionResultAdjacency

Type: LPD3DXBUFFER*

Address of a pointer to an ID3DXBuffer interface. This buffer will contain an array of three DWORDs per face that specify the three neighbors for each face in the output mesh. This parameter must not be NULL, because the subsequent call to D3DXUVAtlasPack() requires it.

pfMaxStretchOut [out]

Type: FLOAT*

A pointer to the maximum stretch value generated by the atlas algorithm. The range is between 0.0 and 1.0.

pdwNumChartsOut [out]

Type: UINT*

A pointer to the number of charts created by the atlas algorithm. If dwMaxChartNumber is too low, this parameter will return the minimum number of charts required to create an atlas.

Return value

Type: HRESULT

If the function succeeds, the return value is D3D_OK; otherwise, the value is D3DERR_INVALIDCALL.

Remarks

D3DXUVAtlasPartition is similar to D3DXUVAtlasCreate, except that D3DXUVAtlasPartition does not performing the final packing step.

Requirements

Requirement Value
Header
D3DX9Mesh.h
Library
D3dx9.lib

See also

UVAtlas Functions

UV Atlas Command-Line Tool (uvatlas.exe)