pub trait IDirect3DVolumeTexture9Ext: AsSafe<IDirect3DVolumeTexture9> {
    fn add_dirty_box(
        &self,
        dirty_box: impl IntoBoxOrFull
    ) -> Result<(), MethodError> { ... }
fn get_level_desc(&self, level: u32) -> Result<VolumeDesc, MethodError> { ... }
fn get_volume_level(&self, level: u32) -> Result<Volume, MethodError> { ... }
unsafe fn lock_box_unchecked(
        &self,
        level: u32,
        box_: impl IntoBoxOrFull,
        flags: impl Into<Lock>
    ) -> Result<D3DLOCKED_BOX, MethodError> { ... }
fn unlock_box(&self, level: u32) -> Result<(), MethodError> { ... } }
Expand description

[docs.microsoft.com] IDirect3DVolumeTexture9 extension methods

Methods

thindxdocs.microsoft.comDescription
add_dirty_boxAddDirtyBoxAdds a dirty region to a volume texture resource.
get_level_descGetLevelDescRetrieves a level description of a volume texture resource.
get_volume_levelGetVolumeLevelRetrieves the specified volume texture level.
lock_box_uncheckedLockBoxLocks a box on a volume texture resource.
unlock_boxUnlockBoxUnlocks a box on a volume texture resource.
IDirect3DBaseTexture9Ext::*IDirect3DBaseTexture9::*
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] IDirect3DVolumeTexture9::AddDirtyBox

Adds a dirty region to a volume texture resource.

Example
texture.add_dirty_box(..).unwrap();
texture.add_dirty_box((0,0,0) .. (32,32,32)).unwrap();
texture.add_dirty_box(Box::from((0,0,0) .. (32,32,32))).unwrap();
Returns

[docs.microsoft.com] IDirect3DVolumeTexture9::GetLevelDesc

Example
let level0 : VolumeDesc = texture.get_level_desc(0).unwrap();
assert_eq!(level0.format, Format::A8R8G8B8);
assert_eq!(level0.ty,     ResourceType::Volume);
assert_eq!(level0.usage,  Usage::None);
assert_eq!(level0.pool,   Pool::Default);
assert_eq!(level0.width,  32);
assert_eq!(level0.height, 32);
assert_eq!(level0.depth,  32);
Returns

[docs.microsoft.com] IDirect3DVolumeTexture9::GetVolumeLevel

Example
let level0 : Volume = texture.get_volume_level(0).unwrap();
// get_container, get_desc, get_device, lock_box, ...
let desc : VolumeDesc = level0.get_desc().unwrap();
assert_eq!(desc.format, Format::A8R8G8B8);
assert_eq!(desc.ty,     ResourceType::Volume);
assert_eq!(desc.usage,  Usage::None);
assert_eq!(desc.pool,   Pool::Default);
assert_eq!(desc.width,  32);
assert_eq!(desc.height, 32);
assert_eq!(desc.depth,  32);
Returns

[docs.microsoft.com] IDirect3DVolumeTexture9::LockBox

⚠️ Safety ⚠️
  • level must be a valid mipmap level
  • box_ must be .. or a valid subregion of the volume in question
  • self should be lockable in the style specified by flags… and not already locked?
  • self may need to be unlocked again before being bound, drawn, or released
Example
// Pool::Default textures cannot be locked
let texture = device.create_volume_texture(32, 32, 32, 1, Usage::None, Format::A8R8G8B8, Pool::Default, ()).unwrap();
assert_eq!(D3DERR::INVALIDCALL, unsafe { texture.lock_box_unchecked(0, .., Lock::None) }.err());

// Pool::Managed textures *can* be locked
let data = [[[Color::argb(0xFF112233); 32]; 32]; 32];
let texture = device.create_volume_texture(32, 32, 32, 1, Usage::None, Format::A8R8G8B8, Pool::Managed, ()).unwrap();
unsafe {
    let bits = texture.lock_box_unchecked(0, Box::from((0,0,0)..(32,32,4)), Lock::None).unwrap();
    for z in 0..32 { for y in 0..32 {
        let src = data[z][y].as_ptr();
        let dst = (bits.pBits as *mut u8).add(y * bits.RowPitch as usize + z * bits.SlicePitch as usize);
        std::ptr::copy(src, dst.cast(), 32);
    }}
}
texture.unlock_box(0).unwrap();
Returns

[docs.microsoft.com] IDirect3DVolumeTexture9::UnlockBox

Example
assert_eq!(D3DERR::INVALIDCALL, texture.unlock_box(0));

unsafe {
    let bits = texture.lock_box_unchecked(0, .., Lock::None).unwrap();
    // ...copy data to bits.pBits...
}
texture.unlock_box(0).unwrap();
assert_eq!(D3DERR::INVALIDCALL, texture.unlock_box(0));
Returns

Implementors