Trait thindx::d3d9::IDirect3DVolumeTexture9Ext
source · [−]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
thindx | docs.microsoft.com | Description |
---|---|---|
add_dirty_box | AddDirtyBox | Adds a dirty region to a volume texture resource. |
get_level_desc | GetLevelDesc | Retrieves a level description of a volume texture resource. |
get_volume_level | GetVolumeLevel | Retrieves the specified volume texture level. |
lock_box_unchecked | LockBox | Locks a box on a volume texture resource. |
unlock_box | UnlockBox | Unlocks a box on a volume texture resource. |
IDirect3DBaseTexture9Ext::* | IDirect3DBaseTexture9::* | |
generate_mip_sub_levels | GenerateMipSubLevels | Generate mipmap sublevels. |
get_auto_gen_filter_type | GetAutoGenFilterType | Get the filter type that is used for automatically generated mipmap sublevels. |
get_level_count | GetLevelCount | Returns the number of texture levels in a multilevel texture. |
get_lod | 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). |
set_auto_gen_filter_type | SetAutoGenFilterType | Set the filter type that is used for automatically generated mipmap sublevels. |
set_lod | SetLOD | Sets the most detailed level-of-detail for a managed texture. |
Provided methods
fn add_dirty_box(
&self,
dirty_box: impl IntoBoxOrFull
) -> Result<(), MethodError>
fn add_dirty_box(
&self,
dirty_box: impl IntoBoxOrFull
) -> Result<(), MethodError>
[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
- D3DERR::INVALIDCALL
- Ok(
()
)
fn get_level_desc(&self, level: u32) -> Result<VolumeDesc, MethodError>
fn get_level_desc(&self, level: u32) -> Result<VolumeDesc, MethodError>
[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
fn get_volume_level(&self, level: u32) -> Result<Volume, MethodError>
fn get_volume_level(&self, level: u32) -> Result<Volume, MethodError>
[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
unsafe fn lock_box_unchecked(
&self,
level: u32,
box_: impl IntoBoxOrFull,
flags: impl Into<Lock>
) -> Result<D3DLOCKED_BOX, MethodError>
unsafe fn lock_box_unchecked(
&self,
level: u32,
box_: impl IntoBoxOrFull,
flags: impl Into<Lock>
) -> Result<D3DLOCKED_BOX, MethodError>
[docs.microsoft.com] IDirect3DVolumeTexture9::LockBox
⚠️ Safety ⚠️
level
must be a valid mipmap levelbox_
must be..
or a valid subregion of the volume in questionself
should be lockable in the style specified byflags
… 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
- D3DERR::INVALIDCALL If the texture belongs to Pool::Default
- Ok(D3DLOCKED_BOX)
fn unlock_box(&self, level: u32) -> Result<(), MethodError>
fn unlock_box(&self, level: u32) -> Result<(), MethodError>
[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
- D3DERR::INVALIDCALL If the texture wasn’t locked
- Ok(
()
)