compiles and renders textures again
This commit is contained in:
@@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
use crate::canvas::*;
|
||||
use crate::canvas::managed::handles::{CanvasFontHandle, CanvasImageHandle, CanvasTextureHandle, Handle};
|
||||
use crate::canvas::canvas_frame::{Drawable};
|
||||
use crate::util::vertex::{VertexTypes, TextureVertex2D, Vertex3D};
|
||||
use crate::util::vertex::{VertexTypes, TextureVertex3D, Vertex3D};
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -25,8 +25,29 @@ impl Sprite {
|
||||
|
||||
let normalized_depth = (depth as f32 / 255.0);
|
||||
|
||||
let verts = vec![
|
||||
TextureVertex3D{
|
||||
v_position: [position.0, position.1, normalized_depth], // top left
|
||||
ti_position: [-0.0, -0.0] },
|
||||
TextureVertex3D{
|
||||
v_position: [position.0, position.1 + size.1, normalized_depth], // bottom left
|
||||
ti_position: [-0.0, 1.0] },
|
||||
TextureVertex3D{
|
||||
v_position: [position.0 + size.0, position.1 + size.1, normalized_depth], // bottom right
|
||||
ti_position: [1.0, 1.0] },
|
||||
TextureVertex3D{
|
||||
v_position: [position.0, position.1, normalized_depth], // top left
|
||||
ti_position: [-0.0, -0.0] },
|
||||
TextureVertex3D{
|
||||
v_position: [position.0 + size.0, position.1 + size.1, normalized_depth], // bottom right
|
||||
ti_position: [1.0, 1.0] },
|
||||
TextureVertex3D{
|
||||
v_position: [position.0 + size.0, position.1, normalized_depth], // top right
|
||||
ti_position: [1.0, -0.0] },
|
||||
];
|
||||
|
||||
Sprite {
|
||||
verts: VertexTypes::TextureType(Vec::new(), texture_handle),
|
||||
verts: VertexTypes::TextureType(verts, texture_handle),
|
||||
position: position,
|
||||
size: size,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user