D3DXSavePRTBufferToFile function

Saves a precomputed radiance transfer (PRT) buffer to disk.

Syntax

HRESULT D3DXSavePRTBufferToFile(
  _In_ LPCSTR          pFileName,
  _In_ LPD3DXPRTBUFFER pBuffer
);

Parameters

pFileName [in]

Type: LPCSTR

Name of the file to which the buffer is to be saved.

pBuffer [in]

Type: LPD3DXPRTBUFFER

Address of a pointer to the input ID3DXPRTBuffer object.

Return value

Type: HRESULT

If the method succeeds, the return value is D3D_OK. If the method fails, 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 D3DXSavePRTBufferToFileW. Otherwise, the function call resolves to D3DXSavePRTBufferToFileA.

The PRT file format is a binary file in the form of a header and then a data block.

struct PRTHeader
{
    UINT NumSamples;
    UINT NumCoeffs;
    UINT NumChannels;
    UINT TexWidth;
    UINT TexHeight;
    UINT bIsTex;
};

For the case of bIsTex being non-zero, NumSamples should equal TexWidth * TexHeight.

The data block that follows the header is NumSamples * NumCoeffs * NumChannels * sizeof(float) bytes.

Requirements

Requirement Value
Header
D3DX9Mesh.h
Library
D3dx9.lib

See also

Precomputed Radiance Transfer Functions