D3DXUVAtlasCreate
Create a UV atlas for a mesh.
HRESULT D3DXUVAtlasCreate(
LPD3DXMESH pMesh,
UINT dwMaxChartNumber,
FLOAT fMaxStretch,
UINT dwWidth,
UINT dwHeight,
FLOAT fGutter,
DWORD dwTextureIndex,
CONST DWORD * pdwAdjacency,
CONST CHAR * pcFalseEdges,
FLOAT * pfIMTArray,
LPD3DXUVATLASCB pCallback,
FLOAT fCallbackFrequency,
LPVOID pUserContent,
DWORD dwOptions,
LPD3DXMESH * ppMeshOut,
LPD3DXBUFFER * ppFacePartitioning,
LPD3DXBUFFER * ppVertexRemapArray,
FLOAT * pfMaxStretchOut,
UINT * pdwNumChartsOut
);
Parameters
- pMesh
- [in] 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] 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] The amount of stretching allowed. 0 means no stretching is allowed, 1 means any amount of stretching can be used.
- dwWidth
- [in] Texture width.
- dwHeight
- [in] Texture height.
- fGutter
- [in] 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] Zero-based texture coordinate index that identifies which set of texture coordinates to use.
- pdwAdjacency
- [in] A pointer to an array of adjacency data. with 3 DWORDs per face, indicating which triangles are adjacent to each other (see ID3DXBaseMesh::GenerateAdjacency).
- pcFalseEdges
- [in] An array, with one element for each edge in the mesh, that specifies whether each edge is a "false edge". False edges will not be split during partitioning.
- pfIMTArray
- [in] A pointer to an array of integrated metric tensors that describes how to stretch a triangle (see IntegratedMetricTensor).
- pCallback
- [in] A pointer to a callback function (see LPD3DXUVATLASCB) that is useful for monitoring progress.
- fCallbackFrequency
- [in] Specify how often D3DX will call the callback; a reasonable default value is 0.0001f.
- pUserContent
- [in] 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] Specify the quality of the charts generated by combining one or more flags in the D3DXUVATLAS enum.
- ppMeshOut
- [in] Pointer to the created mesh with the atlas (see ID3DXMesh).
- ppFacePartitioning
- [out] A pointer to an array of the final face-partioning data. Each element contains one DWORD per face (see ID3DXBuffer).
- ppVertexRemapArray
- [out] 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] A pointer to the maximum stretch value generated by the atlas algorithm. The range is between 0.0 and 1.0.
- pdwNumChartsOut
- [out] 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 Values
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
Header: Declared in D3dx9mesh.h.
See Also
UV Atlas Command-Line Tool (uvatlas.exe)