D3DXSavePRTCompBufferToFile function
Saves a compressed precomputed radiance transfer (PRT) buffer to disk.
Syntax
HRESULT D3DXSavePRTCompBufferToFile(
_In_ LPCSTR pFileName,
_In_ LPD3DXPRTCOMPBUFFER pBuffer
);
Parameters
pFileName [in]
Type: LPCSTR
Name of the file to which the compressed buffer is to be saved.
pBuffer [in]
Type: LPD3DXPRTCOMPBUFFER
Address of a pointer to the input ID3DXPRTCompBuffer object.
Return value
Type: HRESULT
If the method succeeds, then the return value is D3D_OK. If the method fails, then the return value can be D3DERR_INVALIDCALL.
Remarks
The compiler setting also determines the function version. If Unicode is defined, then the function call resolves to D3DXSavePRTCompBufferToFileW. Otherwise, the function call resolves to D3DXSavePRTCompBufferToFileA.
The PCA file format is a binary file in the form of a header and then two or three data blocks.
struct PRTCompressHeader
{
UINT NumSamples;
UINT NumCoeffs;
UINT NumChannels;
UINT TexWidth;
UINT TexHeight;
UINT bIsTex;
UINT NumClusters;
UINT NumPCA;
};
For the case of bIsTex being non-zero, NumSamples should equal TexWidth * TexHeight
.
The basis data block that follows the header is NumCoeffs * NumChannels * (NumPCA + 1) * NumClusters * sizeof(float)
bytes.
Following that is the PCA weights data block, which is NumPCA * NumSamples * sizeof(float)
bytes.
If NumClusters is greater than 1, then the file ends with the cluster IDs data block of NumSamples * sizeof(UINT)
bytes.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|