Sprite

Struct Sprite 

Source
#[repr(C)]
pub struct Sprite(pub NonNull<_SpriteT>);
Expand description

A Sprite is an image that’s set up for direct 2D rendering, without using a mesh or model! This is technically a wrapper over a texture, but it also includes atlasing functionality, which can be pretty important to performance! This is used a lot in UI, for image rendering.

Atlasing is not currently implemented, it’ll swap to Single for now. But here’s how it works! StereoKit will batch your sprites into an atlas if you ask it to! This puts all the images on a single texture to significantly reduce draw calls when many images are present. Any time you add a sprite to an atlas, it’ll be marked as dirty and rebuilt at the end of the frame. So it can be a good idea to add all your images to the atlas on initialize rather than during execution!

Since rendering is atlas based, you also have only one material per atlas. So this is why you might wish to put a sprite in one atlas or another, so you can apply different https://stereokit.net/Pages/StereoKit/Sprite.html

§Examples

use stereokit_rust::{maths::{Vec3, Matrix}, sprite::{Sprite, SpriteType},
                     tex::Tex, util::{Gradient, Color128, named_colors}, system::Pivot};
let mut gradient = Gradient::new(None);
gradient
    .add(Color128::BLACK_TRANSPARENT, 0.0)
    .add(named_colors::YELLOW, 0.1)
    .add(named_colors::LIGHT_BLUE, 0.4)
    .add(named_colors::BLUE, 0.5)
    .add(Color128::BLACK, 0.7);
let tex_particule1 = Tex::gen_particle(128, 128, 0.2, Some(gradient));
let tex_particule2 = Tex::gen_particle(128, 128, 0.2, None);

let sprite1 = Sprite::from_tex(&tex_particule1, None, None)
                  .expect("Should be able to create sprite");
let sprite2 = Sprite::from_file("icons/fly_over.png", Some(SpriteType::Single), Some("MY_ID"))
                  .expect("open_gltf.jpeg should be able to create sprite");
let sprite3 = sprite1.clone_ref();
let sprite4 = Sprite::from_tex(&tex_particule2, None, None)
                  .expect("Should be able to create sprite");

let transform1 = Matrix::t([-0.7, 0.4, 0.0]) * Matrix::Y_180;
let transform2 = Matrix::t([ 0.7, 0.4, 0.0]) * Matrix::Y_180;
let transform3 = Matrix::t([-0.7,-0.4, 0.0]) * Matrix::Y_180;
let transform4 = Matrix::t([ 0.7,-0.4, 0.0]) * Matrix::Y_180;

filename_scr = "screenshots/sprite.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite1.draw(token, transform1, Pivot::Center, None);
    sprite2.draw(token, transform2, Pivot::XLeft, Some(named_colors::AZURE.into()));
    sprite3.draw(token, transform3, Pivot::TopRight, Some(named_colors::LIME.into()));
    sprite4.draw(token, transform4, Pivot::YCenter, None);
);
screenshot

Tuple Fields§

§0: NonNull<_SpriteT>

Implementations§

Source§

impl Sprite

Source

pub fn from_tex( sprite_tex: impl AsRef<Tex>, sprite_type: Option<SpriteType>, atlas_id: Option<String>, ) -> Result<Sprite, StereoKitError>

Create a sprite from a texture. https://stereokit.net/Pages/StereoKit/Sprite/FromTex.html

  • tex - The texture to build a sprite from. Must be a valid, 2D image!
  • sprite_type - Should this sprite be atlased, or an individual image? Adding this as an atlased image is better for performance, but will cause the atlas to be rebuilt! Images that take up too much space on the atlas, or might be loaded or unloaded during runtime may be better as Single rather than Atlased! If None has default of Atlased.
  • atlas_id - The name of which atlas the sprite should belong to, this is only relevant if the SpriteType is Atlased. If None has default of “default”.

Returns a Sprite asset, or null if the image failed when adding to the sprite system! see also sprite_create

§Examples
use stereokit_rust::{ maths::Matrix, sprite::{Sprite, SpriteType}, tex::Tex, system::Pivot,
                     util::{Gradient, Color128, named_colors}};

let mut gradient = Gradient::new(None);
gradient
    .add(Color128::BLACK_TRANSPARENT, 0.0)
    .add(named_colors::YELLOW, 0.1)
    .add(named_colors::LIGHT_BLUE, 0.4)
    .add(named_colors::BLUE, 0.5)
    .add(Color128::BLACK, 0.7);
let tex_particule1 = Tex::gen_particle(128, 128, 0.2, Some(gradient));
let sprite = Sprite::from_tex(&tex_particule1, Some(SpriteType::Atlased), Some("my_sprite".to_string()))
                  .expect("Should be able to create sprite");

assert!(sprite.get_id().starts_with("auto/tex_"));
assert_eq!(sprite.get_height(), 128);
assert_eq!(sprite.get_width(), 128);
assert_eq!(sprite.get_normalized_dimensions(), [1.0, 1.0].into());
assert_eq!(sprite.get_aspect(), 1.0);

filename_scr = "screenshots/sprite_from_tex.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::XRight,  None);
    sprite.draw(token, Matrix::Y_180, Pivot::XLeft,   Some(named_colors::BLUE.into()));
    sprite.draw(token, Matrix::Y_180, Pivot::YTop,    Some(named_colors::RED.into()));
    sprite.draw(token, Matrix::Y_180, Pivot::YBottom, Some(named_colors::GREEN.into()));
);
screenshot
Source

pub fn from_file( file_utf8: impl AsRef<Path>, sprite_type: Option<SpriteType>, atlas_id: Option<&str>, ) -> Result<Sprite, StereoKitError>

Create a sprite from an image file! This loads a Texture from file, and then uses that Texture as the source for the Sprite. https://stereokit.net/Pages/StereoKit/Sprite/FromFile.html

  • file_utf8 - The filename of the image, an absolute filename, or a filename relative to the assets folder. Supports jpg, png, tga, bmp, psd, gif, hdr, pic.
  • sprite_type - Should this sprite be atlased, or an individual image? Adding this as an atlased image is better for performance, but will cause the atlas to be rebuilt! Images that take up too much space on the atlas, or might be loaded or unloaded during runtime may be better as Single rather than Atlased! If None has default of Atlased
  • atlas_id - The name of which atlas the sprite should belong to, this is only relevant if the SpriteType is Atlased. If None has default of “default”.

see also sprite_create_file

§Examples
use stereokit_rust::{ maths::Matrix, sprite::{Sprite, SpriteType}, system::Pivot,
                     util::named_colors};

let sprite = Sprite::from_file("icons/log_viewer.png", Some(SpriteType::Single), Some("MY_ID"))
                  .expect("open_gltf.jpeg should be able to create sprite");

assert_eq!(sprite.get_id(), "icons/log_viewer.png/sprite");
assert_eq!(sprite.get_height(), 128);
assert_eq!(sprite.get_width(), 128);
assert_eq!(sprite.get_normalized_dimensions().x, 1.0);
assert_eq!(sprite.get_normalized_dimensions().y, 1.0);

filename_scr = "screenshots/sprite_from_file.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::XRight,  None);
    sprite.draw(token, Matrix::Y_180, Pivot::XLeft,   Some(named_colors::BLUE.into()));
    sprite.draw(token, Matrix::Y_180, Pivot::YTop,    Some(named_colors::RED.into()));
    sprite.draw(token, Matrix::Y_180, Pivot::YBottom, Some(named_colors::GREEN.into()));
);
screenshot
Source

pub fn find<S: AsRef<str>>(id: S) -> Result<Sprite, StereoKitError>

Finds a sprite that matches the given id! Check out the DefaultIds static class for some built-in ids. Sprites will auto-id themselves using this pattern if single sprites: {Tex.Id}/sprite, and this pattern if atlased sprites: {Tex.Id}/sprite/atlas/{atlasId}. https://stereokit.net/Pages/StereoKit/Sprite/Find.html

  • id - The id of the sprite to find.

see also sprite_find Sprite::clone_ref

§Examples
use stereokit_rust::{sprite::{Sprite, SpriteType}, tex::Tex,
                     util::{Gradient, Color128, named_colors}};

let mut gradient = Gradient::new(None);
gradient
    .add(Color128::BLACK_TRANSPARENT, 0.0)
    .add(Color128::BLACK, 0.7);
let tex_particule1 = Tex::gen_particle(128, 128, 0.2, Some(gradient));
let mut sprite = Sprite::from_tex(&tex_particule1, None, None)
                  .expect("Should be able to create sprite");
assert!(sprite.get_id().starts_with( "auto/tex_"));

sprite.id("My_sprite_ID");

let same_sprite = Sprite::find("My_sprite_ID")
                       .expect("Should be able to find sprite");

assert_eq!(same_sprite, sprite);
Source

pub fn clone_ref(&self) -> Sprite

Creates a clone of the same reference. Basically, the new variable is the same asset. This is what you get by calling find() method. https://stereokit.net/Pages/StereoKit/Sprite/Find.html

see also sprite_find()

§Examples
use stereokit_rust::{sprite::{Sprite, SpriteType}, tex::Tex};

let tex = Tex::rough();
let mut sprite = Sprite::from_tex(&tex, None, None)
                  .expect("Should be able to create sprite");
assert_eq!(sprite.get_id(), "default/tex_rough/sprite");

sprite.id("My_sprite_ID");

let same_sprite = sprite.clone_ref();

assert_eq!(same_sprite, sprite);
Source

pub fn id<S: AsRef<str>>(&mut self, id: S) -> &mut Self

Sets the unique identifier of this asset resource! This can be helpful for debugging, managing your assets, or finding them later on! https://stereokit.net/Pages/StereoKit/Sprite/Id.html

see also sprite_get_id

§Examples
use stereokit_rust::{sprite::{Sprite, SpriteType}, tex::Tex};

let tex = Tex::rough();
let mut sprite = Sprite::from_tex(&tex, None, None)
                  .expect("Should be able to create sprite");
assert_eq!(sprite.get_id(), "default/tex_rough/sprite");

sprite.id("My_sprite_ID");

assert_eq!(sprite.get_id(), "My_sprite_ID");
Source

pub fn draw( &self, _token: &MainThreadToken, transform: impl Into<Matrix>, pivot_position: Pivot, linear_color: Option<Color32>, )

Draws the sprite at the location specified by the transform matrix. A sprite is always sized in model space as 1 x Aspect meters on the x and y axes respectively, so scale appropriately. The ‘position’ attribute describes what corner of the sprite you’re specifying the transform of. https://stereokit.net/Pages/StereoKit/Sprite/Draw.html

  • token - The token to ensure the sprite is drawn in the correct frame.
  • transform - A Matrix describing a transform from model space to world space. A sprite is always sized in model space as 1 x Aspect meters on the x and y axes respectively, so scale appropriately and remember that your anchor position may affect the transform as well.
  • pivot_position - Describes what corner of the sprite you’re specifying the transform of. The ‘Pivot’ point or ‘Origin’ of the Sprite.
  • linear_color - Per-instance color data for this render item. It is unmodified by StereoKit, and is generally interpreted as linear. If None has default value of WHITE.

see also sprite_draw

§Examples
use stereokit_rust::{ maths::Matrix, sprite::{Sprite, SpriteType}, tex::Tex, system::Pivot,
                     util::{Gradient, Color128, named_colors}};

let sprite = Sprite::close();

filename_scr = "screenshots/sprite_draw.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::TopLeft,     None);
    sprite.draw(token, Matrix::Y_180, Pivot::TopRight,    Some(named_colors::BLUE.into()));
    sprite.draw(token, Matrix::Y_180, Pivot::BottomLeft,  Some(named_colors::RED.into()));
    sprite.draw(token, Matrix::Y_180, Pivot::BottomRight, Some(named_colors::GREEN.into()));
);
screenshot
Source

pub fn get_id(&self) -> &str

Source

pub fn get_aspect(&self) -> f32

The aspect ratio of the sprite! This is width/height. You may also be interested in the NormalizedDimensions property, which are normalized to the 0-1 range. https://stereokit.net/Pages/StereoKit/Sprite/Aspect.html

see also sprite_get_aspect

§Examples
use stereokit_rust::sprite::{Sprite, SpriteType};

let sprite = Sprite::from_file("icons/log_viewer.png", Some(SpriteType::Single), Some("MY_ID"))
                  .expect("open_gltf.jpeg should be able to create sprite");
assert_eq!(sprite.get_aspect(), 1.0);

let sprite = Sprite::from_file("hdri/sky_dawn.hdr", None, None)
                 .expect("open_gltf.jpeg should be able to create sprite");
assert_eq!(sprite.get_aspect(), 2.0);
Source

pub fn get_height(&self) -> i32

Get the height in pixel https://stereokit.net/Pages/StereoKit/Sprite/Height.html

see also sprite_get_height

§Examples
use stereokit_rust::sprite::{Sprite, SpriteType};

let sprite = Sprite::from_file("icons/log_viewer.png", Some(SpriteType::Single), Some("MY_ID"))
                  .expect("open_gltf.jpeg should be able to create sprite");
assert_eq!(sprite.get_height(), 128);

let sprite = Sprite::from_file("hdri/sky_dawn.hdr", None, None)
                 .expect("open_gltf.jpeg should be able to create sprite");
assert_eq!(sprite.get_height(), 2048);
Source

pub fn get_width(&self) -> i32

Get the width in pixel https://stereokit.net/Pages/StereoKit/Sprite/Width.html

see also sprite_get_width

§Examples
use stereokit_rust::sprite::{Sprite, SpriteType};

let sprite = Sprite::from_file("icons/log_viewer.png", Some(SpriteType::Single), Some("MY_ID"))
                  .expect("open_gltf.jpeg should be able to create sprite");
assert_eq!(sprite.get_width(), 128);

let sprite = Sprite::from_file("hdri/sky_dawn.hdr", None, None)
                 .expect("open_gltf.jpeg should be able to create sprite");
assert_eq!(sprite.get_width(), 4096);
Source

pub fn get_normalized_dimensions(&self) -> Vec2

Get the width and height of the sprite, normalized so the maximum value is 1. https://stereokit.net/Pages/StereoKit/Sprite/NormalizedDimensions.html

see also sprite_get_dimensions_normalized

§Examples
use stereokit_rust::{sprite::{Sprite, SpriteType}, maths::Vec2};

let sprite = Sprite::from_file("icons/log_viewer.png", Some(SpriteType::Single), Some("MY_ID"))
                  .expect("open_gltf.jpeg should be able to create sprite");
assert_eq!(sprite.get_normalized_dimensions(), Vec2::ONE);

let sprite = Sprite::from_file("hdri/sky_dawn.hdr", None, None)
                 .expect("open_gltf.jpeg should be able to create sprite");
assert_eq!(sprite.get_normalized_dimensions(), Vec2::new(1.0, 0.5));
Source

pub fn radio_on() -> Self

This is a 64x64 image of a filled hole. This is common iconography for radio buttons which use an empty hole to indicate an un-selected radio, and a filled hole for a selected radio. This is used by the UI for radio buttons! https://stereokit.net/Pages/StereoKit/Sprite/RadioOn.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::radio_on();
assert_eq!(sprite.get_id(), "sk/ui/radio_on");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_radio_on.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn radio_off() -> Self

This is a 64x64 image of an empty hole. This is common iconography for radio buttons which use an empty hole to indicate an un-selected radio, and a filled hole for a selected radio. This is used by the UI for radio buttons! https://stereokit.net/Pages/StereoKit/Sprite/RadioOff.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::radio_off();
assert_eq!(sprite.get_id(), "sk/ui/radio_off");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_radio_off.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn toggle_on() -> Self

This is a 64x64 image of a filled rounded square. This is common iconography for checkboxes which use an empty square to indicate an un-selected checkbox, and a filled square for a selected checkbox. This is used by the UI for toggle buttons! https://stereokit.net/Pages/StereoKit/Sprite/ToggleOn.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::toggle_on();
assert_eq!(sprite.get_id(), "sk/ui/toggle_on");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_toggle_on.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn toggle_off() -> Self

This is a 64x64 image of an empty rounded square. This is common iconography for checkboxes which use an empty square to indicate an un-selected checkbox, and a filled square for a selected checkbox. This is used by the UI for toggle buttons! https://stereokit.net/Pages/StereoKit/Sprite/ToggleOff.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::toggle_off();
assert_eq!(sprite.get_id(), "sk/ui/toggle_off");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_toggle_off.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn arrow_left() -> Self

This is a 64x64 image of a slightly rounded triangle pointing left. https://stereokit.net/Pages/StereoKit/Sprite/ArrowLeft.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::{Vec3, Matrix}, system::Pivot};

let sprite = Sprite::arrow_left();
assert_eq!(sprite.get_id(), "sk/ui/arrow_left");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_arrow_left.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn arrow_right() -> Self

This is a 64x64 image of a slightly rounded triangle pointing right. https://stereokit.net/Pages/StereoKit/Sprite/ArrowRight.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::{Vec3, Matrix}, system::Pivot};

let sprite = Sprite::arrow_right();
assert_eq!(sprite.get_id(), "sk/ui/arrow_right");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_arrow_right.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn arrow_up() -> Self

This is a 64x64 image of a slightly rounded triangle pointing up. https://stereokit.net/Pages/StereoKit/Sprite/ArrowUp.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::arrow_up();
assert_eq!(sprite.get_id(), "sk/ui/arrow_up");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_arrow_up.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn arrow_down() -> Self

This is a 64x64 image of a slightly rounded triangle pointing down. https://stereokit.net/Pages/StereoKit/Sprite/ArrowDown.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::arrow_down();
assert_eq!(sprite.get_id(), "sk/ui/arrow_down");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_arrow_down.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn backspace() -> Self

This is a 64x64 image of a backspace action button, similar to a backspace button you might find on a mobile keyboard. https://stereokit.net/Pages/StereoKit/Sprite/Backspace.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::backspace();
assert_eq!(sprite.get_id(), "sk/ui/backspace");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_backspace.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn shift() -> Self

This is a 64x64 image of an upward facing rounded arrow. This is a triangular top with a narrow rectangular base, and is used to indicate a ‘shift’ icon on a keyboard. https://stereokit.net/Pages/StereoKit/Sprite/Shift.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::shift();
assert_eq!(sprite.get_id(), "sk/ui/shift");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_shift.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn close() -> Self

This is a 64x64 image of a square aspect X, with rounded edge. It’s used to indicate a ‘close’ icon. https://stereokit.net/Pages/StereoKit/Sprite/Close.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::close();
assert_eq!(sprite.get_id(), "sk/ui/close");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_close.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn list() -> Self

https://stereokit.net/Pages/StereoKit/Sprite/List.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::list();
assert_eq!(sprite.get_id(), "sk/ui/list");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_list.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot
Source

pub fn grid() -> Self

https://stereokit.net/Pages/StereoKit/Sprite/Grid.html

§Examples
use stereokit_rust::{sprite::Sprite, maths::Matrix, system::Pivot};

let sprite = Sprite::grid();
assert_eq!(sprite.get_id(), "sk/ui/grid");

width_scr = 48; height_scr = 48; fov_scr = 65.0;
filename_scr = "screenshots/sprite_grid.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
    sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
);
screenshot

Trait Implementations§

Source§

impl AsRef<Sprite> for Sprite

Source§

fn as_ref(&self) -> &Sprite

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for Sprite

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Sprite

A Default sprite is asked when a Sprite creation or find returned an error. (close is the default sprite)

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for Sprite

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl IAsset for Sprite

Source§

fn get_id(&self) -> &str

gets the unique identifier of this asset resource! This can be helpful for debugging, managing your assets, or finding them later on! https://stereokit.net/Pages/StereoKit/IAsset/Id.html
Source§

impl PartialEq for Sprite

Source§

fn eq(&self, other: &Sprite) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Sprite

Auto Trait Implementations§

§

impl Freeze for Sprite

§

impl RefUnwindSafe for Sprite

§

impl !Send for Sprite

§

impl !Sync for Sprite

§

impl Unpin for Sprite

§

impl UnwindSafe for Sprite

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more