pub trait IDirect3DBaseTexture9Ext: AsSafe<IDirect3DBaseTexture9> {
    fn generate_mip_sub_levels(&self) { ... }
fn get_auto_gen_filter_type(&self) -> TextureFilterType { ... }
fn get_level_count(&self) -> u32 { ... }
fn get_lod(&self) -> u32 { ... }
fn set_auto_gen_filter_type(
        &self,
        filter_type: impl Into<TextureFilterType>
    ) -> Result<(), MethodError> { ... }
fn set_lod(&self, new_lod: u32) -> u32 { ... } }
Expand description

[docs.microsoft.com] IDirect3DBaseTexture9 extension methods

Methods

thindxdocs.microsoft.comDescription
generate_mip_sub_levelsGenerateMipSubLevelsGenerate mipmap sublevels.
get_auto_gen_filter_typeGetAutoGenFilterTypeGet the filter type that is used for automatically generated mipmap sublevels.
get_level_countGetLevelCountReturns the number of texture levels in a multilevel texture.
get_lodGetLODReturns a value clamped to the maximum level-of-detail set for a managed texture (this method is not supported for an unmanaged texture).
set_auto_gen_filter_typeSetAutoGenFilterTypeSet the filter type that is used for automatically generated mipmap sublevels.
set_lodSetLODSets the most detailed level-of-detail for a managed texture.

Provided methods

[docs.microsoft.com] IDirect3DBaseTexture9::GenerateMipSubLevels

Generate mipmap sublevels.

Example
texture.generate_mip_sub_levels();

[docs.microsoft.com] IDirect3DBaseTexture9::GetAutoGenFilterType

Get the filter type that is used for automatically generated mipmap sublevels.

Example
assert_eq!(TextureFilterType::Linear, texture.get_auto_gen_filter_type());

[docs.microsoft.com] IDirect3DBaseTexture9::GetLevelCount

Returns the number of texture levels in a multilevel texture.

Warning: If you create a texture with Usage::AutoGenMipMap to make that texture automatically generate sublevels, get_level_count always returns 1 for the number of levels.

Returns
Example
// Automatic level count
let texture = device.create_texture(128, 128, 0, Usage::None, Format::A8R8G8B8, Pool::Default, ()).unwrap();
assert_eq!(8, texture.get_level_count()); // [128, 64, 32, 16, 8, 4, 2, 1].len() == 8

// Explicit level count
let texture = device.create_texture(128, 128, 3, Usage::None, Format::A8R8G8B8, Pool::Default, ()).unwrap();
assert_eq!(3, texture.get_level_count());

[docs.microsoft.com] IDirect3DBaseTexture9::GetLOD

Returns a value clamped to the maximum level-of-detail set for a managed texture (this method is not supported for an unmanaged texture).

Returns
Example
let texture = device.create_texture(128, 128, 0, Usage::None, Format::A8R8G8B8, Pool::Managed, ()).unwrap();
assert_eq!(0, texture.get_lod());
assert_eq!(0, texture.set_lod(5));
assert_eq!(5, texture.get_lod());

// Silently noops for unmanaged textures:
let texture = device.create_texture(128, 128, 0, Usage::None, Format::A8R8G8B8, Pool::Default, ()).unwrap();
assert_eq!(0, texture.get_lod());
assert_eq!(0, texture.set_lod(5));
assert_eq!(0, texture.get_lod());

[docs.microsoft.com] IDirect3DBaseTexture9::SetAutoGenFilterType

Changing the filter type “dirties” the mipmap sublevels and causes them to be regenerated. The (default) filter type set at texture creation time is TexF::Linear. If the driver does not support a linear filter, the filter type will be set to TexF::Point. All filter types supported by the driver for regular texture filtering are supported for autogeneration except TexF::None. set_auto_gen_filter_type will fail unless the driver sets the appropriate D3DPTFILTERCAPS_MINFxxx caps. These values are specified in the TextureFilterCaps and/or CubeTextureFilterCaps members of Caps.

For more information about texture filter types, see TextureFilterType.

This method has no effect if the texture is not created with Usage::AutoGenMipMap. In this case, no failure is returned. For more information about usage constants, see Usage.

Returns
Example
texture.set_auto_gen_filter_type(TextureFilterType::Point).unwrap();
texture.set_auto_gen_filter_type(TextureFilterType::Linear).unwrap();

let _ = texture.set_auto_gen_filter_type(TextureFilterType::ConvolutionMono); // may not be supported

assert_eq!(D3DERR::INVALIDCALL, texture.set_auto_gen_filter_type(TextureFilterType::None).err());
assert_eq!(D3DERR::INVALIDCALL, texture.set_auto_gen_filter_type(TextureFilterType::from_unchecked(9001)).err());
assert_eq!(D3DERR::INVALIDCALL, texture.set_auto_gen_filter_type(TextureFilterType::from_unchecked(!0)).err());
assert_eq!(D3DERR::INVALIDCALL, texture.set_auto_gen_filter_type(TextureFilterType::from_unchecked(!0-4)).err());
assert_eq!(D3DERR::INVALIDCALL, texture.set_auto_gen_filter_type(TextureFilterType::from_unchecked(!0-100)).err());

[docs.microsoft.com] IDirect3DBaseTexture9::SetLOD

Sets the most detailed level-of-detail for a Pool::Managed texture.

Returns
  • 0 - for nonmanaged textures (e.g. not Pool::Managed?)
  • old_lod : u32 - the previous most detailed level-of-detail supported.
Example
let texture = device.create_texture(128, 128, 0, Usage::None, Format::A8R8G8B8, Pool::Managed, ()).unwrap();
assert_eq!(0, texture.set_lod(5));
assert_eq!(5, texture.set_lod(6));
assert_eq!(6, texture.set_lod(9001));
assert_eq!(7, texture.set_lod(0)); // 9001 was clamped to `get_level_count()-1`

// Silently noops for unmanaged textures:
let texture = device.create_texture(128, 128, 0, Usage::None, Format::A8R8G8B8, Pool::Default, ()).unwrap();
assert_eq!(0, texture.get_lod());
assert_eq!(0, texture.set_lod(5));
assert_eq!(0, texture.get_lod());

Implementors