|
|
@ -1,10 +1,11 @@
|
|
|
|
use crate::canvas::canvas_state::{Drawable, CanvasTextureHandle, CanvasImageHandle, DrawableTest};
|
|
|
|
use crate::canvas::canvas_state::{Drawable, CanvasTextureHandle, CanvasImageHandle, DrawableTest, CanvasFontHandle};
|
|
|
|
use std::sync::Arc;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use crate::canvas::shader::text_shader::GlyphInstance;
|
|
|
|
use crate::canvas::shader::text_shader::GlyphInstance;
|
|
|
|
|
|
|
|
use crate::canvas::canvas_buffer::CanvasFont;
|
|
|
|
|
|
|
|
use crate::util::vertex_3d::Vertex3D;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct Sprite {
|
|
|
|
pub struct Sprite {
|
|
|
|
|
|
|
|
|
|
|
|
pub vertices: [(f32, f32, f32); 6],
|
|
|
|
pub vertices: [(f32, f32, f32); 6],
|
|
|
|
pub ti_position: [(f32, f32); 6],
|
|
|
|
pub ti_position: [(f32, f32); 6],
|
|
|
|
|
|
|
|
|
|
|
@ -20,36 +21,34 @@ pub struct Sprite {
|
|
|
|
|
|
|
|
|
|
|
|
/// Container class which implements drawable.
|
|
|
|
/// Container class which implements drawable.
|
|
|
|
impl Sprite {
|
|
|
|
impl Sprite {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn new(position: (f32, f32), size: (f32, f32)) -> Sprite {
|
|
|
|
pub fn new(position: (f32, f32), size: (f32, f32)) -> Sprite {
|
|
|
|
Sprite::new_with_color(position, size, 0, (0.,0.,0.,0.))
|
|
|
|
Sprite::new_with_color(position, size, 0, (0., 0., 0., 0.))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn new_with_color(position: (f32, f32),
|
|
|
|
pub fn new_with_color(position: (f32, f32),
|
|
|
|
size: (f32, f32),
|
|
|
|
size: (f32, f32),
|
|
|
|
depth: u32,
|
|
|
|
depth: u32,
|
|
|
|
color: (f32, f32, f32, f32)) -> Sprite {
|
|
|
|
color: (f32, f32, f32, f32)) -> Sprite {
|
|
|
|
|
|
|
|
|
|
|
|
let normalized_depth = (depth as f32 / 255.0);
|
|
|
|
let normalized_depth = (depth as f32 / 255.0);
|
|
|
|
|
|
|
|
|
|
|
|
Sprite {
|
|
|
|
Sprite {
|
|
|
|
vertices: [
|
|
|
|
vertices: [
|
|
|
|
(position.0, position.1 , normalized_depth), // top left
|
|
|
|
(position.0, position.1, normalized_depth), // top left
|
|
|
|
(position.0, position.1 + size.1 , normalized_depth), // bottom left
|
|
|
|
(position.0, position.1 + size.1, normalized_depth), // bottom left
|
|
|
|
(position.0 + size.0, position.1 + size.1, normalized_depth), // bottom right
|
|
|
|
(position.0 + size.0, position.1 + size.1, normalized_depth), // bottom right
|
|
|
|
(position.0, position.1 , normalized_depth), // top left
|
|
|
|
(position.0, position.1, normalized_depth), // top left
|
|
|
|
(position.0 + size.0, position.1 + size.1, normalized_depth), // bottom right
|
|
|
|
(position.0 + size.0, position.1 + size.1, normalized_depth), // bottom right
|
|
|
|
(position.0 + size.0, position.1 , normalized_depth), // top right
|
|
|
|
(position.0 + size.0, position.1, normalized_depth), // top right
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
position: position,
|
|
|
|
position: position,
|
|
|
|
ti_position: [
|
|
|
|
ti_position: [
|
|
|
|
(-0.0, -0.0), // top left
|
|
|
|
(-0.0, -0.0), // top left
|
|
|
|
(-0.0, 1.0), // bottom left
|
|
|
|
(-0.0, 1.0), // bottom left
|
|
|
|
( 1.0, 1.0), // bottom right
|
|
|
|
(1.0, 1.0), // bottom right
|
|
|
|
(-0.0, -0.0), // top left
|
|
|
|
(-0.0, -0.0), // top left
|
|
|
|
( 1.0, 1.0), // bottom right
|
|
|
|
(1.0, 1.0), // bottom right
|
|
|
|
( 1.0, -0.0), // top right
|
|
|
|
(1.0, -0.0), // top right
|
|
|
|
],
|
|
|
|
],
|
|
|
|
size: size,
|
|
|
|
size: size,
|
|
|
|
color: color,
|
|
|
|
color: color,
|
|
|
@ -59,8 +58,8 @@ impl Sprite {
|
|
|
|
screen_position: (0.0, 0.0),
|
|
|
|
screen_position: (0.0, 0.0),
|
|
|
|
atlas_position: (0.0, 0.0),
|
|
|
|
atlas_position: (0.0, 0.0),
|
|
|
|
atlas_size: (0.0, 0.0),
|
|
|
|
atlas_size: (0.0, 0.0),
|
|
|
|
scale: 0.0
|
|
|
|
scale: 0.0,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -69,41 +68,38 @@ impl Sprite {
|
|
|
|
size: (f32, f32),
|
|
|
|
size: (f32, f32),
|
|
|
|
depth: u32,
|
|
|
|
depth: u32,
|
|
|
|
texture_handle: Arc<CanvasTextureHandle>) -> Sprite {
|
|
|
|
texture_handle: Arc<CanvasTextureHandle>) -> Sprite {
|
|
|
|
|
|
|
|
|
|
|
|
let normalized_depth = (depth as f32 / 255.0);
|
|
|
|
let normalized_depth = (depth as f32 / 255.0);
|
|
|
|
|
|
|
|
|
|
|
|
Sprite {
|
|
|
|
Sprite {
|
|
|
|
vertices: [
|
|
|
|
vertices: [
|
|
|
|
(position.0, position.1 , normalized_depth), // top left
|
|
|
|
(position.0, position.1, normalized_depth), // top left
|
|
|
|
(position.0, position.1 + size.1 , normalized_depth), // bottom left
|
|
|
|
(position.0, position.1 + size.1, normalized_depth), // bottom left
|
|
|
|
(position.0 + size.0, position.1 + size.1, normalized_depth), // bottom right
|
|
|
|
(position.0 + size.0, position.1 + size.1, normalized_depth), // bottom right
|
|
|
|
(position.0, position.1 , normalized_depth), // top left
|
|
|
|
(position.0, position.1, normalized_depth), // top left
|
|
|
|
(position.0 + size.0, position.1 + size.1, normalized_depth), // bottom right
|
|
|
|
(position.0 + size.0, position.1 + size.1, normalized_depth), // bottom right
|
|
|
|
(position.0 + size.0, position.1 , normalized_depth), // top right
|
|
|
|
(position.0 + size.0, position.1, normalized_depth), // top right
|
|
|
|
],
|
|
|
|
],
|
|
|
|
position: position,
|
|
|
|
position: position,
|
|
|
|
ti_position: [
|
|
|
|
ti_position: [
|
|
|
|
(-0.0, -0.0), // top left
|
|
|
|
(-0.0, -0.0), // top left
|
|
|
|
(-0.0, 1.0), // bottom left
|
|
|
|
(-0.0, 1.0), // bottom left
|
|
|
|
( 1.0, 1.0), // bottom right
|
|
|
|
(1.0, 1.0), // bottom right
|
|
|
|
(-0.0, -0.0), // top left
|
|
|
|
(-0.0, -0.0), // top left
|
|
|
|
( 1.0, 1.0), // bottom right
|
|
|
|
(1.0, 1.0), // bottom right
|
|
|
|
( 1.0, -0.0), // top right
|
|
|
|
(1.0, -0.0), // top right
|
|
|
|
],
|
|
|
|
],
|
|
|
|
size: size,
|
|
|
|
size: size,
|
|
|
|
color: (1.0, 0.0, 0.0, 1.0),
|
|
|
|
color: (1.0, 0.0, 0.0, 1.0),
|
|
|
|
textured: true,
|
|
|
|
textured: true,
|
|
|
|
texture_handle: Some(texture_handle.clone())
|
|
|
|
texture_handle: Some(texture_handle.clone()),
|
|
|
|
|
|
|
|
value: Default::default(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl<V, H> DrawableTest<V, H> for Sprite {
|
|
|
|
impl<V, H> DrawableTest<V, H> for Sprite {
|
|
|
|
fn get_vertices(&self) -> Vec<V> {
|
|
|
|
fn get_vertices(&self) -> Vec<V> {
|
|
|
|
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn get_handle(&self) -> Vec<H> {
|
|
|
|
fn get_handle(&self) -> Vec<H> {
|
|
|
@ -112,8 +108,7 @@ impl<V, H> DrawableTest<V, H> for Sprite {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Drawable for Sprite {
|
|
|
|
impl Drawable for Sprite {
|
|
|
|
|
|
|
|
fn get_vertices(&self) -> Vec<(f32, f32, f32)> {
|
|
|
|
fn get_vertices(&self) -> Vec<(f32,f32,f32)> {
|
|
|
|
|
|
|
|
self.vertices.to_vec()
|
|
|
|
self.vertices.to_vec()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -129,7 +124,7 @@ impl Drawable for Sprite {
|
|
|
|
match self.textured {
|
|
|
|
match self.textured {
|
|
|
|
true => {
|
|
|
|
true => {
|
|
|
|
self.texture_handle.clone()
|
|
|
|
self.texture_handle.clone()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
false => None,
|
|
|
|
false => None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -142,7 +137,6 @@ impl Drawable for Sprite {
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct Poly {
|
|
|
|
pub struct Poly {
|
|
|
|
|
|
|
|
|
|
|
|
pub vertices: Vec<(f32, f32, f32)>,
|
|
|
|
pub vertices: Vec<(f32, f32, f32)>,
|
|
|
|
pub ti_position: Vec<(f32, f32)>,
|
|
|
|
pub ti_position: Vec<(f32, f32)>,
|
|
|
|
|
|
|
|
|
|
|
@ -154,97 +148,85 @@ pub struct Poly {
|
|
|
|
texture_handle: Option<Arc<CanvasTextureHandle>>,
|
|
|
|
texture_handle: Option<Arc<CanvasTextureHandle>>,
|
|
|
|
|
|
|
|
|
|
|
|
// ==================================
|
|
|
|
// ==================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Container class which implements drawable.
|
|
|
|
/// Container class which implements drawable.
|
|
|
|
impl Poly {
|
|
|
|
impl Poly {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn new(position: (f32, f32), size: (f32, f32)) -> Poly {
|
|
|
|
pub fn new(position: (f32, f32), size: (f32, f32)) -> Poly {
|
|
|
|
Poly::new_with_color(position, size, 0, (0.,0.,0.,0.))
|
|
|
|
Poly::new_with_color(position, size, 0, (0., 0., 0., 0.))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn new_with_color(position: (f32, f32),
|
|
|
|
pub fn new_with_color(position: (f32, f32),
|
|
|
|
size: (f32, f32),
|
|
|
|
size: (f32, f32),
|
|
|
|
depth: u32,
|
|
|
|
depth: u32,
|
|
|
|
color: (f32, f32, f32, f32)) -> Poly {
|
|
|
|
color: (f32, f32, f32, f32)) -> Poly {
|
|
|
|
|
|
|
|
|
|
|
|
let normalized_depth = (depth as f32 / 255.0);
|
|
|
|
let normalized_depth = (depth as f32 / 255.0);
|
|
|
|
|
|
|
|
|
|
|
|
Poly {
|
|
|
|
Poly {
|
|
|
|
vertices: vec![
|
|
|
|
vertices: vec![
|
|
|
|
(-0.5 , -0.5 , normalized_depth),
|
|
|
|
(-0.5, -0.5, normalized_depth),
|
|
|
|
(-1.0 , 1.0 , normalized_depth),
|
|
|
|
(-1.0, 1.0, normalized_depth),
|
|
|
|
(-0.25 , 0.0 , normalized_depth),
|
|
|
|
(-0.25, 0.0, normalized_depth),
|
|
|
|
|
|
|
|
(-0.25, 0.0, normalized_depth),
|
|
|
|
(-0.25 , 0.0 , normalized_depth),
|
|
|
|
(-1.0, 1.0, normalized_depth),
|
|
|
|
(-1.0 , 1.0 , normalized_depth),
|
|
|
|
(0.0, 0.5, normalized_depth),
|
|
|
|
(0.0 , 0.5 , normalized_depth),
|
|
|
|
(0.25, 0.0, normalized_depth),
|
|
|
|
|
|
|
|
(-1.0, 1.0, normalized_depth),
|
|
|
|
(0.25 , 0.0 , normalized_depth),
|
|
|
|
(0.0, 0.5, normalized_depth),
|
|
|
|
(-1.0 , 1.0 , normalized_depth),
|
|
|
|
(0.5, -0.5, normalized_depth),
|
|
|
|
(0.0 , 0.5 , normalized_depth),
|
|
|
|
(-1.0, 1.0, normalized_depth),
|
|
|
|
|
|
|
|
(0.25, 0.0, normalized_depth),
|
|
|
|
(0.5 , -0.5 , normalized_depth),
|
|
|
|
(0.25, -0.5, normalized_depth),
|
|
|
|
(-1.0 , 1.0 , normalized_depth),
|
|
|
|
(-1.0, 1.0, normalized_depth),
|
|
|
|
(0.25 , 0.0 , normalized_depth),
|
|
|
|
(0.5, -0.5, normalized_depth),
|
|
|
|
|
|
|
|
(0.25, -0.5, normalized_depth),
|
|
|
|
(0.25 , -0.5 , normalized_depth),
|
|
|
|
(-1.0, 1.0, normalized_depth),
|
|
|
|
(-1.0 , 1.0 , normalized_depth),
|
|
|
|
(0.0, -0.1, normalized_depth),
|
|
|
|
(0.5 , -0.5 , normalized_depth),
|
|
|
|
(-0.25, -0.5, normalized_depth),
|
|
|
|
|
|
|
|
(-1.0, 1.0, normalized_depth),
|
|
|
|
(0.25 , -0.5 , normalized_depth),
|
|
|
|
(0.0, -0.1, normalized_depth),
|
|
|
|
(-1.0 , 1.0 , normalized_depth),
|
|
|
|
(-0.5, -0.5, normalized_depth),
|
|
|
|
(0.0 , -0.1 , normalized_depth),
|
|
|
|
(-1.0, 1.0, normalized_depth),
|
|
|
|
|
|
|
|
(-0.25, -0.5, normalized_depth),
|
|
|
|
(-0.25 , -0.5 , normalized_depth),
|
|
|
|
|
|
|
|
(-1.0 , 1.0 , normalized_depth),
|
|
|
|
|
|
|
|
(0.0 , -0.1 , normalized_depth),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(-0.5 , -0.5 , normalized_depth),
|
|
|
|
|
|
|
|
(-1.0 , 1.0 , normalized_depth),
|
|
|
|
|
|
|
|
(-0.25 , -0.5 , normalized_depth),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
position: position,
|
|
|
|
position: position,
|
|
|
|
ti_position: vec![
|
|
|
|
ti_position: vec![
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
(0.0,0.0),
|
|
|
|
(0.0, 0.0),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
size: size,
|
|
|
|
size: size,
|
|
|
|
color: color,
|
|
|
|
color: color,
|
|
|
|
textured: false,
|
|
|
|
textured: false,
|
|
|
|
texture_handle: None
|
|
|
|
texture_handle: None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Drawable for Poly {
|
|
|
|
impl Drawable for Poly {
|
|
|
|
|
|
|
|
fn get_vertices(&self) -> Vec<(f32, f32, f32)> {
|
|
|
|
fn get_vertices(&self) -> Vec<(f32,f32,f32)> {
|
|
|
|
|
|
|
|
self.vertices.to_vec()
|
|
|
|
self.vertices.to_vec()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -260,7 +242,7 @@ impl Drawable for Poly {
|
|
|
|
match self.textured {
|
|
|
|
match self.textured {
|
|
|
|
true => {
|
|
|
|
true => {
|
|
|
|
self.texture_handle.clone()
|
|
|
|
self.texture_handle.clone()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
false => None,
|
|
|
|
false => None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -272,74 +254,43 @@ impl Drawable for Poly {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct Poly {
|
|
|
|
pub struct Text {
|
|
|
|
|
|
|
|
position: (f32, f32, f32),
|
|
|
|
pub vertices: Vec<(f32, f32, f32)>,
|
|
|
|
scale: f32,
|
|
|
|
pub ti_position: Vec<(f32, f32)>,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
position: (f32, f32),
|
|
|
|
|
|
|
|
size: (f32, f32),
|
|
|
|
|
|
|
|
color: (f32, f32, f32, f32),
|
|
|
|
color: (f32, f32, f32, f32),
|
|
|
|
|
|
|
|
|
|
|
|
textured: bool,
|
|
|
|
text_handle: Arc<CanvasFontHandle>,
|
|
|
|
texture_handle: Option<Arc<CanvasTextureHandle>>,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ==================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Container class which implements drawable.
|
|
|
|
/// Container class which implements drawable.
|
|
|
|
impl Poly {
|
|
|
|
impl Text {
|
|
|
|
|
|
|
|
pub fn new(position: (f32, f32), size: (f32, f32), font_handle: Arc<CanvasFontHandle>) -> Text {
|
|
|
|
pub fn new(position: (f32, f32), size: (f32, f32)) -> Poly {
|
|
|
|
Text::new_with_color(position, size, 0, (0., 0., 0., 0.), font_handle)
|
|
|
|
Poly::new_with_color(position, size, 0, (0.,0.,0.,0.))
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn new_with_color(position: (f32, f32),
|
|
|
|
pub fn new_with_color(position: (f32, f32),
|
|
|
|
size: (f32, f32),
|
|
|
|
size: (f32, f32),
|
|
|
|
depth: u32,
|
|
|
|
depth: u32,
|
|
|
|
color: (f32, f32, f32, f32)) -> Poly {
|
|
|
|
color: (f32, f32, f32, f32),
|
|
|
|
|
|
|
|
handle: Arc<CanvasFontHandle>) -> Text {
|
|
|
|
let normalized_depth = (depth as f32 / 255.0);
|
|
|
|
let normalized_depth = (depth as f32 / 255.0);
|
|
|
|
|
|
|
|
|
|
|
|
Poly {
|
|
|
|
Text {
|
|
|
|
vertices: vec![],
|
|
|
|
position: (position.0, position.1, normalized_depth),
|
|
|
|
|
|
|
|
scale: 0.0,
|
|
|
|
position: position,
|
|
|
|
color,
|
|
|
|
ti_position: vec![],
|
|
|
|
text_handle: handle,
|
|
|
|
size: size,
|
|
|
|
|
|
|
|
color: color,
|
|
|
|
|
|
|
|
textured: false,
|
|
|
|
|
|
|
|
texture_handle: None
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Drawable for Poly {
|
|
|
|
impl<V, H> DrawableTest<V, H> for Text {
|
|
|
|
|
|
|
|
fn get_vertices(&self) -> Vec<V> {
|
|
|
|
fn get_vertices(&self) -> Vec<(f32,f32,f32)> {
|
|
|
|
unimplemented!()
|
|
|
|
self.vertices.to_vec()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn get_color(&self) -> (f32, f32, f32, f32) {
|
|
|
|
|
|
|
|
self.color.clone()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn get_ti_coords(&self) -> Vec<(f32, f32)> {
|
|
|
|
|
|
|
|
self.ti_position.to_vec()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn get_texture_handle(&self) -> Option<Arc<CanvasTextureHandle>> {
|
|
|
|
|
|
|
|
match self.textured {
|
|
|
|
|
|
|
|
true => {
|
|
|
|
|
|
|
|
self.texture_handle.clone()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
false => None,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn get_image_handle(&self) -> Option<Arc<CanvasImageHandle>> {
|
|
|
|
fn get_handle(&self) -> Vec<H> {
|
|
|
|
None
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|