Struct bgfx_rs::static_lib::Texture
source · [−]pub struct Texture { /* private fields */ }
Implementations
sourceimpl Texture
impl Texture
sourcepub fn create_texture(
mem: &Memory,
flags: u64,
skip: u8,
info: &mut TextureInfo
) -> Texture
pub fn create_texture(
mem: &Memory,
flags: u64,
skip: u8,
info: &mut TextureInfo
) -> Texture
mem
: DDS, KTX or PVR texture binary data.flags
: Texture creation (see TextureFlags.), and sampler (see SamplerFlags) flags. Default texture sampling mode is linear, and wrap mode is repeat.
- [SamplerFlags::[U/V/W]_[MIRROR/CLAMP]] - Mirror or clamp to edge wrap mode.
- [SamplerFlags::[MIN/MAG/MIP]_[POINT/ANISOTROPIC]] - Point or anisotropic sampling.
skip
: Skip top level mips when parsing texture.info
: When non-NULL
is specified it returns parsed texture information.
sourcepub fn create_texture_2d(
width: u16,
height: u16,
has_mips: bool,
num_layers: u16,
format: TextureFormat,
flags: u64,
mem: &Memory
) -> Texture
pub fn create_texture_2d(
width: u16,
height: u16,
has_mips: bool,
num_layers: u16,
format: TextureFormat,
flags: u64,
mem: &Memory
) -> Texture
width
: Width.height
: Height.has_mips
: Indicates that texture contains full mip-map chain.num_layers
: Number of layers in texture array. Must be 1 if caps [CapsFlags::TEXTURE_2D_ARRAY] flag is not set.format
: Texture format. See: TextureFormat.flags
: Texture creation (see TextureFlags.), and sampler (see SamplerFlags) flags. Default texture sampling mode is linear, and wrap mode is repeat.
- [SamplerFlags::[U/V/W]_[MIRROR/CLAMP]] - Mirror or clamp to edge wrap mode.
- [SamplerFlags::[MIN/MAG/MIP]_[POINT/ANISOTROPIC]] - Point or anisotropic sampling.
mem
: Texture data. If_mem
is non-NULL, created texture will be immutable. If_mem
is NULL content of the texture is uninitialized. When_numLayers
is more than 1, expected memory layout is texture and all mips together for each array element.
sourcepub fn create_texture_2d_scaled(
ratio: BackbufferRatio,
has_mips: bool,
num_layers: u16,
format: TextureFormat,
flags: u64
) -> Texture
pub fn create_texture_2d_scaled(
ratio: BackbufferRatio,
has_mips: bool,
num_layers: u16,
format: TextureFormat,
flags: u64
) -> Texture
ratio
: Texture size in respect to back-buffer size. See: BackbufferRatio.has_mips
: Indicates that texture contains full mip-map chain.num_layers
: Number of layers in texture array. Must be 1 if caps [CapsFlags::TEXTURE_2D_ARRAY] flag is not set.format
: Texture format. See: TextureFormat.flags
: Texture creation (see TextureFlags.), and sampler (see SamplerFlags) flags. Default texture sampling mode is linear, and wrap mode is repeat.
- [SamplerFlags::[U/V/W]_[MIRROR/CLAMP]] - Mirror or clamp to edge wrap mode.
- [SamplerFlags::[MIN/MAG/MIP]_[POINT/ANISOTROPIC]] - Point or anisotropic sampling.
sourcepub fn create_texture_3d(
width: u16,
height: u16,
depth: u16,
has_mips: bool,
format: TextureFormat,
params: CreateTexture3DArgs
) -> Texture
pub fn create_texture_3d(
width: u16,
height: u16,
depth: u16,
has_mips: bool,
format: TextureFormat,
params: CreateTexture3DArgs
) -> Texture
width
: Width.height
: Height.depth
: Depth.has_mips
: Indicates that texture contains full mip-map chain.format
: Texture format. See: TextureFormat.flags
: Texture creation (see TextureFlags.), and sampler (see SamplerFlags) flags. Default texture sampling mode is linear, and wrap mode is repeat.
- [SamplerFlags::[U/V/W]_[MIRROR/CLAMP]] - Mirror or clamp to edge wrap mode.
- [SamplerFlags::[MIN/MAG/MIP]_[POINT/ANISOTROPIC]] - Point or anisotropic sampling.
mem
: Texture data. If_mem
is non-NULL, created texture will be immutable. If_mem
is NULL content of the texture is uninitialized. When_numLayers
is more than 1, expected memory layout is texture and all mips together for each array element.
sourcepub fn create_texture_cube(
size: u16,
has_mips: bool,
num_layers: u16,
format: TextureFormat,
params: CreateTextureCubeArgs
) -> Texture
pub fn create_texture_cube(
size: u16,
has_mips: bool,
num_layers: u16,
format: TextureFormat,
params: CreateTextureCubeArgs
) -> Texture
size
: Cube side size.has_mips
: Indicates that texture contains full mip-map chain.num_layers
: Number of layers in texture array. Must be 1 if caps [CapsFlags::TEXTURE_2D_ARRAY] flag is not set.format
: Texture format. See: TextureFormat.flags
: Texture creation (see TextureFlags.), and sampler (see SamplerFlags) flags. Default texture sampling mode is linear, and wrap mode is repeat.
- [SamplerFlags::[U/V/W]_[MIRROR/CLAMP]] - Mirror or clamp to edge wrap mode.
- [SamplerFlags::[MIN/MAG/MIP]_[POINT/ANISOTROPIC]] - Point or anisotropic sampling.
mem
: Texture data. If_mem
is non-NULL, created texture will be immutable. If_mem
is NULL content of the texture is uninitialized. When_numLayers
is more than 1, expected memory layout is texture and all mips together for each array element.
sourcepub fn update_texture_2d(
&self,
layer: u16,
mip: u8,
x: u16,
y: u16,
width: u16,
height: u16,
mem: &Memory,
pitch: u16
)
pub fn update_texture_2d(
&self,
layer: u16,
mip: u8,
x: u16,
y: u16,
width: u16,
height: u16,
mem: &Memory,
pitch: u16
)
handle
: Texture handle.layer
: Layer in texture array.mip
: Mip level.x
: X offset in texture.y
: Y offset in texture.width
: Width of texture block.height
: Height of texture block.mem
: Texture update data.pitch
: Pitch of input image (bytes). When _pitch is set to UINT16_MAX, it will be calculated internally based on _width.
sourcepub fn update_texture_3d(
&self,
mip: u8,
x: u16,
y: u16,
z: u16,
width: u16,
height: u16,
depth: u16,
mem: &Memory
)
pub fn update_texture_3d(
&self,
mip: u8,
x: u16,
y: u16,
z: u16,
width: u16,
height: u16,
depth: u16,
mem: &Memory
)
handle
: Texture handle.mip
: Mip level.x
: X offset in texture.y
: Y offset in texture.z
: Z offset in texture.width
: Width of texture block.height
: Height of texture block.depth
: Depth of texture block.mem
: Texture update data.
sourcepub fn update_texture_cube(
&self,
layer: u16,
side: u8,
mip: u8,
x: u16,
y: u16,
width: u16,
height: u16,
mem: &Memory,
pitch: u16
)
pub fn update_texture_cube(
&self,
layer: u16,
side: u8,
mip: u8,
x: u16,
y: u16,
width: u16,
height: u16,
mem: &Memory,
pitch: u16
)
-
handle
: Texture handle. -
layer
: Layer in texture array. -
side
: Cubemap side [CubeMapFlags::_<X, Y or Z>], where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. +----------+ |-z 2| | ^ +y | | | | Unfolded cube: | +---->+x | +----------+----------+----------+----------+ |+y 1|+y 4|+y 0|+y 5| | ^ -x | ^ +z | ^ +x | ^ -z | | | | | | | | | | | +---->+z | +---->+x | +---->-z | +---->-x | +----------+----------+----------+----------+ |+z 3| | ^ -y | | | | | +---->+x | +----------+
-
mip
: Mip level. -
x
: X offset in texture. -
y
: Y offset in texture. -
width
: Width of texture block. -
height
: Height of texture block. -
mem
: Texture update data. -
pitch
: Pitch of input image (bytes). When _pitch is set to UINT16_MAX, it will be calculated internally based on _width.
sourcepub fn set_name(&self, name: &str)
pub fn set_name(&self, name: &str)
handle
: Texture handle.name
: Texture name.len
: Texture name length (if length is INT32_MAX, it’s expected that _name is zero terminated string.
sourcepub fn get_texture(handle: &FrameBuffer, attachment: u8) -> Texture
pub fn get_texture(handle: &FrameBuffer, attachment: u8) -> Texture
handle
: Frame buffer handle.attachment
:
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnwindSafe for Texture
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more