D3DXUVAtlasCreate function
Create a UV atlas for a mesh.
Syntax
HRESULT D3DXUVAtlasCreate(
_In_ LPD3DXMESH pMesh,
_In_ UINT dwMaxChartNumber,
_In_ FLOAT fMaxStretch,
_In_ UINT dwWidth,
_In_ UINT dwHeight,
_In_ FLOAT fGutter,
_In_ DWORD dwTextureIndex,
_In_ const DWORD *pdwAdjacency,
const DWORD *pdwFalseEdges,
_In_ FLOAT *pfIMTArray,
_In_ LPD3DXUVATLASCB pCallback,
_In_ FLOAT fCallbackFrequency,
_In_ LPVOID pUserContext,
_In_ DWORD dwOptions,
_In_ LPD3DXMESH *ppMeshOut,
_Out_ LPD3DXBUFFER *ppFacePartitioning,
_Out_ LPD3DXBUFFER *ppVertexRemapArray,
_Out_ FLOAT *pfMaxStretchOut,
_Out_ UINT *pdwNumChartsOut
);
Parameters
-
pMesh [in]
-
Type: LPD3DXMESH
Pointer to an input mesh (see ID3DXMesh) which 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.
-
dwWidth [in]
-
Type: UINT
Texture width.
-
dwHeight [in]
-
Type: UINT
Texture height.
-
fGutter [in]
-
Type: FLOAT
The minimum distance, in texels, between two charts on the atlas. The gutter is always scaled by the width; so, if a gutter of 2.5 is used on a 512x512 texture, then the minimum distance between two charts is 2.5 / 512.0 texels.
-
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 which 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. See D3DXUVATLAS.
-
ppMeshOut [in]
-
Type: LPD3DXMESH*
Pointer to the created mesh with the atlas (see ID3DXMesh).
-
ppFacePartitioning [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 that each final vertex came from (if the vertex was split during remapping). Each array element contains one DWORD per vertex.
-
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
D3DXUVAtlasCreate 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.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|
See also