pub struct SpritesheetBuilder {
pub image: Option<Image>,
pub shaders: Shaders,
pub alpha_blending: AlphaBlending,
pub minification_smoothing: bool,
pub magnification_smoothing: bool,
pub wrap: (TextureWrapping, TextureWrapping),
pub srgb: bool,
}Expand description
A builder for Spritesheet.
Fields§
§image: Option<Image>The texture used when drawing with this handle. None can be used if you want to just draw flat-color quads.
shaders: ShadersThe shaders used when drawing with this handle.
alpha_blending: AlphaBlendingWhether to blend with previously drawn pixels when drawing over them, or just replace the color. Rule of thumb: if the sprites only use alpha values of 0 and 255 (ie. fully transparent and fully opaque), set this to false, and true otherwise. In any case, alpha values of less than 1/256 will be cut out and won’t be rendered at all.
Internally, this controls whether GL_BLEND and back-to-front
sorting are enabled.
minification_smoothing: boolWhen drawing quads that are smaller than the texture provided, use linear (true) or nearest neighbor (false) smoothing when scaling? (Linear is probably always better.)
magnification_smoothing: boolWhen drawing quads that are larger than the texture provided,
use linear (true) or nearest neighbor (false) smoothing when
scaling? (Tip: for pixel art or other textures that don’t
suffer from jaggies, set this to false for the intended
look.)
wrap: (TextureWrapping, TextureWrapping)Sets the texture’s behavior when sampling coordinates under
0.0 or over 1.0, or smoothing over texture
boundaries. (Corresponds to GL_TEXTURE_WRAP_S and
GL_TEXTURE_WRAP_T, in that order.)
srgb: boolControls whether the colors rendered by this draw call should be converted into sRGB before display. This should generally be true, unless you handle gamma in your shaders yourself. Note that in any case, the fragment shader will process fragments in linear space: this conversion happens after blending.
Internally, this controls whether or not GL_FRAMEBUFFER_SRGB
is enabled when drawing with this handle.
Implementations§
Source§impl SpritesheetBuilder
impl SpritesheetBuilder
Sourcepub fn build(&self, ctx: &mut Context) -> Spritesheet
pub fn build(&self, ctx: &mut Context) -> Spritesheet
Creates a new Spritesheet from this builder.
Sourcepub fn image(&mut self, image: Image) -> &mut SpritesheetBuilder
pub fn image(&mut self, image: Image) -> &mut SpritesheetBuilder
Sets the spritesheet’s texture.
Sourcepub fn shaders(&mut self, shaders: Shaders) -> &mut SpritesheetBuilder
pub fn shaders(&mut self, shaders: Shaders) -> &mut SpritesheetBuilder
Sets the spritesheet’s shaders.
Sourcepub fn alpha_blending(
&mut self,
blend: bool,
sort: bool,
) -> &mut SpritesheetBuilder
pub fn alpha_blending( &mut self, blend: bool, sort: bool, ) -> &mut SpritesheetBuilder
Toggles the spritesheet’s alpha blending.
Sourcepub fn minification_smoothing(
&mut self,
smoothing: bool,
) -> &mut SpritesheetBuilder
pub fn minification_smoothing( &mut self, smoothing: bool, ) -> &mut SpritesheetBuilder
Sets the spritesheet’s minification filter.
Sourcepub fn magnification_smoothing(
&mut self,
smoothing: bool,
) -> &mut SpritesheetBuilder
pub fn magnification_smoothing( &mut self, smoothing: bool, ) -> &mut SpritesheetBuilder
Sets the spritesheet’s magnification filter.
Sourcepub fn wrapping_behavior(
&mut self,
wrap_s: TextureWrapping,
wrap_t: TextureWrapping,
) -> &mut SpritesheetBuilder
pub fn wrapping_behavior( &mut self, wrap_s: TextureWrapping, wrap_t: TextureWrapping, ) -> &mut SpritesheetBuilder
Sets the spritesheet texture’s wrapping behavior.
Sourcepub fn srgb(&mut self, srgb: bool) -> &mut SpritesheetBuilder
pub fn srgb(&mut self, srgb: bool) -> &mut SpritesheetBuilder
Toggles the srgb-ness of the draw call.
Trait Implementations§
Source§impl Clone for SpritesheetBuilder
impl Clone for SpritesheetBuilder
Source§fn clone(&self) -> SpritesheetBuilder
fn clone(&self) -> SpritesheetBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more