mirror of
https://github.com/lisk77/comet.git
synced 2025-10-23 21:38:50 +00:00
feat: added a camera with orthographic projection and did some work restructuring the comet_app to make the setup system optional. Input handling is moved to the app
This commit is contained in:
parent
780365aeb8
commit
5a9f632e3a
22 changed files with 1173 additions and 349 deletions
|
|
@ -1,6 +1,5 @@
|
|||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use chrono::Local;
|
||||
use std::time::Instant;
|
||||
use image::{DynamicImage, GenericImage, GenericImageView, ImageFormat};
|
||||
use comet_log::*;
|
||||
|
|
@ -165,7 +164,7 @@ impl TextureAtlas {
|
|||
//base.save_with_format(output_path, ImageFormat::Png).expect("Failed to save texture atlas");
|
||||
|
||||
info!("Texture atlas created!");
|
||||
debug!(format!("{:?}", regions));
|
||||
//debug!(format!("{:?}", regions));
|
||||
|
||||
/*let t1 = Instant::now();
|
||||
let delta = t1.duration_since(t0);
|
||||
|
|
|
|||
|
|
@ -5,13 +5,15 @@ use wgpu::Color;
|
|||
pub struct Vertex {
|
||||
position: [f32; 3],
|
||||
tex_coords: [f32; 2],
|
||||
color: [f32; 4]
|
||||
}
|
||||
|
||||
impl Vertex {
|
||||
pub fn new(position: [f32; 3], tex_coords: [f32; 2]) -> Self {
|
||||
pub fn new(position: [f32; 3], tex_coords: [f32; 2], color: [f32; 4]) -> Self {
|
||||
Self {
|
||||
position,
|
||||
tex_coords
|
||||
tex_coords,
|
||||
color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -23,6 +25,10 @@ impl Vertex {
|
|||
self.tex_coords = new_tex_coords
|
||||
}
|
||||
|
||||
pub fn set_color(&mut self, new_color: [f32; 4]) {
|
||||
self.color = new_color
|
||||
}
|
||||
|
||||
pub fn desc() -> wgpu::VertexBufferLayout<'static> {
|
||||
wgpu::VertexBufferLayout {
|
||||
array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress,
|
||||
|
|
@ -37,6 +43,11 @@ impl Vertex {
|
|||
offset: std::mem::size_of::<[f32; 3]>() as wgpu::BufferAddress,
|
||||
shader_location: 1,
|
||||
format: wgpu::VertexFormat::Float32x2,
|
||||
},
|
||||
wgpu::VertexAttribute {
|
||||
offset: std::mem::size_of::<[f32; 5]>() as wgpu::BufferAddress,
|
||||
shader_location: 2,
|
||||
format: wgpu::VertexFormat::Float32x4,
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue