Microsoft DirectX 8.1 (C++)

D3DXCreateVolumeTextureFromFileEx

Creates a volume texture from a file. This is a more advanced function than D3DXCreateVolumeTextureFromFile.

HRESULT D3DXCreateVolumeTextureFromFileEx(
  LPDIRECT3DDEVICE8         pDevice,
  LPCTSTR                   pSrcFile,
  UINT                      Width,
  UINT                      Height,
  UINT                      MipLevels,
  DWORD                     Usage,
  D3DFORMAT                 Format,
  D3DPOOL                   Pool,
  DWORD                     Filter,
  DWORD                     MipFilter,
  D3DCOLOR                  ColorKey,
  D3DXIMAGE_INFO*           pSrcInfo,
  PALETTEENTRY*             pPalette,
  LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture
);

Parameters

pDevice
[in] Pointer to an IDirect3DDevice8 interface, representing the device to be associated with the volume texture.
pSrcFile
[in] Pointer to a string that specifies the file from which to create the volume texture.
Width
[in] Width in pixels. If this value is zero or D3DX_DEFAULT, the dimensions are taken from the file.
Height
[in] Height, in pixels. If this value is zero or D3DX_DEFAULT, the dimensions are taken from the file.
MipLevels
[in] Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created.
Usage
[in] 0, D3DUSAGE_RENDERTARGET, or D3DUSAGE_DYNAMIC. Setting this flag to D3DUSAGE_RENDERTARGET indicates that the surface is to be used as a render target. The resource can then be passed to the pNewRenderTarget parameter of the SetRenderTarget method. If either D3DUSAGE_RENDERTARGET or D3DUSAGE_DYNAMIC is specified, Pool must be set to D3DPOOL_DEFAULT, and the application should check that the device supports this operation by calling IDirect3D8::CheckDeviceFormat. D3DUSAGE_DYNAMIC indicates that the surface should be handled dynamically. For more information about using dynamic textures, see Using Dynamic Textures.
Format
Member of the D3DFORMAT enumerated type, describing the requested pixel format for the volume texture. The returned volume texture might have a different format from that specified by Format. Applications should check the format of the returned volume texture. If Format is D3DFMT_UNKNOWN, the format is taken from the file.
Pool
[in] Member of the D3DPOOL enumerated type, describing the memory class into which the volume texture should be placed.
Filter
[in] A combination of one or more D3DX_FILTER flags controlling how the image is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER.
MipFilter
[in] A combination of one or more D3DX_FILTER flags controlling how the image is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_BOX.
ColorKey
[in] D3DCOLOR value to replace with transparent black, or 0 to disable the colorkey. This is always a 32-bit ARGB color, independent of the source image format. Alpha is significant and should usually be set to FF for opaque color keys. Thus, for opaque black, the value would be equal to 0xFF000000.
pSrcInfo
[in, out] Pointer to a D3DXIMAGE_INFO structure to be filled in with a description of the data in the source image file, or NULL.
pPalette
[out] Pointer to a PALETTEENTRY structure, representing a 256-color palette to fill in, or NULL.
ppVolumeTexture
[out] Address of a pointer to an IDirect3DVolumeTexture8 interface, representing the created volume texture object.

Return Values

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be one of the following values.

D3DERR_NOTAVAILABLE
D3DERR_OUTOFVIDEOMEMORY
D3DERR_INVALIDCALL
D3DXERR_INVALIDDATA
E_OUTOFMEMORY

Remarks

This function supports the following file formats: .bmp, .dds, .dib, .jpg, .png, and .tga.

Mipmapped textures automatically have each level filled with the loaded volume texture. When loading images into mipmapped textures, some devices are unable to go to a 1×1 image and this function will fail. If this happens, then the images need to be loaded manually.

This functions supports both Unicode and American National Standards Institute (ANSI) strings.

Requirements

  Header: Declared in D3dx8tex.h.
  Import Library: Use D3dx8.lib.

See Also

D3DXCreateVolumeTextureFromFile, D3DXCreateVolumeTextureFromResource, D3DXCreateVolumeTextureFromResourceEx, D3DXCreateVolumeTextureFromFileInMemory, D3DXCreateVolumeTextureFromFileInMemoryEx