Trait adi_gpu_base::Display
[−]
[src]
pub trait Display: Sized { type Texture; fn new<G: AsRef<Graphic>>(title: &str, icon: G) -> Option<Self>; fn color(&mut self, color: (f32, f32, f32)); fn fog(&mut self, fog: Option<(f32, f32)>); fn update(&mut self) -> Option<Input>; fn camera(&mut self, position: (f32, f32, f32), rotation: (f32, f32, f32)); fn model(&mut self, vertices: &[f32], indices: &[u32]) -> Model; fn texture<G: AsRef<Graphic>>(&mut self, graphic: G) -> Self::Texture; fn gradient(&mut self, colors: &[f32]) -> Gradient; fn texcoords(&mut self, texcoords: &[f32]) -> TexCoords; fn set_texture(&mut self, texture: &mut Self::Texture, pixels: &[u32]); fn shape_solid(
&mut self,
model: &Model,
transform: Mat4,
color: [f32; 4],
blending: bool,
fog: bool,
camera: bool
) -> Shape; fn shape_gradient(
&mut self,
model: &Model,
transform: Mat4,
gradient: Gradient,
blending: bool,
fog: bool,
camera: bool
) -> Shape; fn shape_texture(
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
blending: bool,
fog: bool,
camera: bool
) -> Shape; fn shape_faded(
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
alpha: f32,
fog: bool,
camera: bool
) -> Shape; fn shape_tinted(
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
tint: [f32; 4],
blending: bool,
fog: bool,
camera: bool
) -> Shape; fn shape_complex(
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
gradient: Gradient,
blending: bool,
fog: bool,
camera: bool
) -> Shape; fn transform(&mut self, shape: &mut Shape, transform: Mat4); fn resize(&mut self, wh: (u32, u32)); fn wh(&self) -> (u32, u32); }
A trait for a Display
Associated Types
type Texture
Required Methods
fn new<G: AsRef<Graphic>>(title: &str, icon: G) -> Option<Self>
Create a new GPU-Accelerated Display
. If it can't be created,
return None.
title
: The window title.icon
: The window icon.
fn color(&mut self, color: (f32, f32, f32))
Set the background color for the Display
.
color
: The background color for the display.
fn fog(&mut self, fog: Option<(f32, f32)>)
Set the fog for the display.
fog
:None
for no fog, otherwise set fog begin distance and fog end distance.
fn update(&mut self) -> Option<Input>
Get input, if there's any. If there's no input, update the
Display
and return None
.
fn camera(&mut self, position: (f32, f32, f32), rotation: (f32, f32, f32))
Move the camera.
position
: position of the camera.rotation
: rotation of the camera.
fn model(&mut self, vertices: &[f32], indices: &[u32]) -> Model
Create a new Model
for this Display
.
fn texture<G: AsRef<Graphic>>(&mut self, graphic: G) -> Self::Texture
Create a new Texture
for this Display
.
fn gradient(&mut self, colors: &[f32]) -> Gradient
Create a new Gradient
for this Display
.
fn texcoords(&mut self, texcoords: &[f32]) -> TexCoords
Create new TexCoords
for this Display
.
fn set_texture(&mut self, texture: &mut Self::Texture, pixels: &[u32])
Set the pixels for a Texture
.
fn shape_solid(
&mut self,
model: &Model,
transform: Mat4,
color: [f32; 4],
blending: bool,
fog: bool,
camera: bool
) -> Shape
&mut self,
model: &Model,
transform: Mat4,
color: [f32; 4],
blending: bool,
fog: bool,
camera: bool
) -> Shape
Create a new shape with a solid color.
fn shape_gradient(
&mut self,
model: &Model,
transform: Mat4,
gradient: Gradient,
blending: bool,
fog: bool,
camera: bool
) -> Shape
&mut self,
model: &Model,
transform: Mat4,
gradient: Gradient,
blending: bool,
fog: bool,
camera: bool
) -> Shape
Create a new shape shaded by a gradient (1 color per vertex).
fn shape_texture(
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
blending: bool,
fog: bool,
camera: bool
) -> Shape
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
blending: bool,
fog: bool,
camera: bool
) -> Shape
Create a new shape shaded by a texture using texture coordinates.
Texture Coordinates follow this format (X, Y, UNUSED(1.0), ALPHA)
fn shape_faded(
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
alpha: f32,
fog: bool,
camera: bool
) -> Shape
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
alpha: f32,
fog: bool,
camera: bool
) -> Shape
Create a new shape shaded by a texture using texture coordinates and alpha.
Texture Coordinates follow this format (X, Y, UNUSED(1.0), ALPHA)
fn shape_tinted(
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
tint: [f32; 4],
blending: bool,
fog: bool,
camera: bool
) -> Shape
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
tint: [f32; 4],
blending: bool,
fog: bool,
camera: bool
) -> Shape
Create a new shape shaded by a texture using texture coordinates and tint.
Texture Coordinates follow this format (X, Y, UNUSED(1.0), ALPHA)
fn shape_complex(
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
gradient: Gradient,
blending: bool,
fog: bool,
camera: bool
) -> Shape
&mut self,
model: &Model,
transform: Mat4,
texture: Self::Texture,
tc: TexCoords,
gradient: Gradient,
blending: bool,
fog: bool,
camera: bool
) -> Shape
Create a new shape shaded by a texture using texture coordinates and tint per vertex.
Texture Coordinates follow this format (X, Y, UNUSED(1.0), ALPHA)
fn transform(&mut self, shape: &mut Shape, transform: Mat4)
Transform the shape.
fn resize(&mut self, wh: (u32, u32))
Resize the display.
fn wh(&self) -> (u32, u32)
Get the width and height of the window, as a tuple.