Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 7bf0dfb

Browse files
committed
Cleanup and version bump
1 parent aadefa7 commit 7bf0dfb

File tree

14 files changed

+40
-90
lines changed

14 files changed

+40
-90
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "effect-engine"
3-
version = "0.1.2"
3+
version = "0.2.0-alpha"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/engine/camera/camera.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
use std::f32::consts::PI;
1+
use wgpu::util::DeviceExt;
22

3-
use wgpu::{util::DeviceExt, Queue};
4-
5-
use crate::engine::{
6-
primitives::{matrix::Matrix4, vector::Vector3},
7-
transform::transform::{Transform2D, Transform2DSystem},
8-
};
3+
use crate::engine::primitives::vector::Vector3;
94

105
pub struct Camera2D {
116
look_at: glam::Mat4,
127
proj: glam::Mat4,
13-
near: f32,
14-
far: f32,
15-
fov_deg: f32,
8+
_near: f32,
9+
_far: f32,
10+
_fov_deg: f32,
1611
bind_group: wgpu::BindGroup,
1712
bind_group_layout: wgpu::BindGroupLayout,
1813
buffer: wgpu::Buffer,
@@ -60,9 +55,9 @@ impl Camera2D {
6055
Self {
6156
proj,
6257
look_at,
63-
near,
64-
far,
65-
fov_deg,
58+
_near: near,
59+
_far: far,
60+
_fov_deg: fov_deg,
6661
buffer,
6762
bind_group,
6863
bind_group_layout,

src/engine/engine.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ use winit::dpi::PhysicalSize;
88

99
use super::camera::camera::Camera2D;
1010
use super::camera::camera::Camera2DSystem;
11-
use super::primitives::vector::Vector3;
1211
use super::texture::background2d::Background2D;
13-
use super::{
14-
primitives::vertex::Vertex,
15-
texture::texture2d::{Texture2D, TextureID},
16-
traits::layer::Layer,
17-
};
12+
use super::{primitives::vertex::Vertex, texture::texture2d::Texture2D};
1813

1914
use anyhow::Result;
2015

@@ -34,6 +29,7 @@ pub struct Engine {
3429
/*
3530
* Update and input should run closures defined by the user
3631
* these closures are to be stored in Engine upon initialisation
32+
* 0.3.0 release
3733
*/
3834
impl Engine {
3935
pub async fn new(window: winit::window::Window, camera_fov: f32, v_sync: bool) -> Self {
@@ -187,13 +183,13 @@ impl Engine {
187183
}
188184
}
189185

190-
pub fn input(&mut self, event: &winit::event::Event<()>, delta: &std::time::Duration) {
186+
pub fn input(&mut self, _event: &winit::event::Event<()>, _delta: &std::time::Duration) {
191187
// do nothing
192188
// not sure what to do with this yet
193189
// TODO: move input to be a burden on user.
194190
}
195191

196-
pub fn update(&mut self, delta: &std::time::Duration) {
192+
pub fn update(&mut self, _delta: &std::time::Duration) {
197193
// TODO: Move update to be a burden on user
198194

199195
// millis returns 0 for some reason...use nano

src/engine/layer/layer.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
use anyhow::{bail, Result};
1+
use anyhow::Result;
22
use std::collections::{hash_map::Keys, HashMap};
33
use winit::dpi::PhysicalSize;
44

5-
use wgpu::util::DeviceExt;
6-
7-
use crate::{
8-
engine::{
9-
entity::entity::{Entity2D, Entity2DRaw},
10-
primitives::vertex::Vertex,
11-
texture::{
12-
texture2d::{Texture2D, TextureID},
13-
texture_atlas2d::TextureAtlas2D,
14-
},
15-
util::effect_error::EffectError,
5+
use crate::engine::{
6+
entity::entity::{Entity2D, Entity2DRaw},
7+
primitives::vertex::Vertex,
8+
texture::{
9+
texture2d::{Texture2D, TextureID},
10+
texture_atlas2d::TextureAtlas2D,
1611
},
17-
EffectSystem,
1812
};
1913

2014
#[derive(std::cmp::PartialEq, std::cmp::Eq, Hash, Clone, Copy, Debug, PartialOrd, Ord)]
@@ -178,7 +172,7 @@ impl Layer2DSystem {
178172
Layer2DSystem::alloc_buffer(data, size * 2, device, queue, "Entity Buffer", false)
179173
}
180174

181-
fn create_index_buffer(device: &wgpu::Device, queue: &wgpu::Queue) -> wgpu::Buffer {
175+
fn _create_index_buffer(device: &wgpu::Device, queue: &wgpu::Queue) -> wgpu::Buffer {
182176
let mut indices: Vec<u16> = Vec::new();
183177
indices.extend_from_slice(&[0, 1, 2, 0, 2, 3]);
184178
let data: &[u8] = bytemuck::cast_slice(&indices);
@@ -187,7 +181,7 @@ impl Layer2DSystem {
187181
}
188182

189183
fn create_vertex_buffer(
190-
texture_size: PhysicalSize<u32>,
184+
_texture_size: PhysicalSize<u32>,
191185
tex_coord_size: PhysicalSize<f32>,
192186
device: &wgpu::Device,
193187
queue: &wgpu::Queue,

src/engine/texture/background2d.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,14 @@ impl Background2D {
169169
pub fn camera_bind_group(&self) -> &wgpu::BindGroup {
170170
&self.camera_bind_group
171171
}
172+
173+
pub fn texture(&self) -> &Texture2D {
174+
&self.texture_data
175+
}
176+
177+
pub fn dimensions(&self) -> PhysicalSize<u32> {
178+
self.dimensions
179+
}
172180
}
173181

174182
// manage all background related operations

src/engine/texture/texture2d.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
use image::GenericImageView;
21
use image::ImageBuffer;
32
use image::Rgba;
4-
use std::fs;
5-
use std::io::prelude::*;
63

74
#[derive(std::cmp::PartialEq, std::cmp::Eq, Hash, Clone, Debug, Copy)]
85
pub struct TextureID(pub &'static str);

src/engine/texture/texture_atlas2d.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
use crate::engine::{
2-
texture::texture2d::Texture2DSystem,
3-
util::{effect_error::EffectError, file_to_bytes::file_to_bytes},
4-
};
1+
use crate::engine::{texture::texture2d::Texture2DSystem, util::effect_error::EffectError};
52

6-
use image::{GenericImage, GenericImageView, ImageBuffer, Rgba};
7-
use wgpu::Extent3d;
3+
use image::{GenericImage, ImageBuffer};
84
use winit::dpi::PhysicalSize;
95

10-
use super::texture2d::{Texture2D, TextureID};
6+
use super::texture2d::Texture2D;
117

128
use anyhow::{bail, Result};
13-
use image::EncodableLayout;
149

1510
const MAX_WIDTH: u32 = 8192;
1611
const MAX_HEIGHT: u32 = 8192;

src/engine/traits/entity.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/engine/traits/layer.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)