Compare commits

..

No commits in common. "1ac68616100bb5d02d615f76a3315bec5960d9e8" and "9532161ed742a6e02cfe575bf46367553abd5d06" have entirely different histories.

4 changed files with 10 additions and 32 deletions

View file

@ -9,7 +9,7 @@ pub fn init() {
use env_logger::{fmt::Color, Builder, Env}; use env_logger::{fmt::Color, Builder, Env};
let env = Env::default() let env = Env::default()
.filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn,wgpu=warn,wgpu_core=warn,wgpu_hal=warn,naga=warn"); .filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn,wgpu=warn,wgpu_core=warn,wgpu_hal=error");
Builder::from_env(env) Builder::from_env(env)
.format(|buf, record| { .format(|buf, record| {
let mut level_style = buf.style(); let mut level_style = buf.style();

View file

@ -1,34 +1,19 @@
struct Uniform { //TODO migrate, this is just some filler code to make the game compile
position_offset: vec3<f32>,
view_proj: mat4x4<f32>,
};
@group(1) @binding(0)
var<uniform> world: Uniform;
struct VertexInput {
@location(0) position: vec3<f32>,
@location(1) normal: vec3<f32>,
@location(2) uv: vec2<f32>,
@location(3) tex_index: vec2<u8>,
}
struct VertexOutput { struct VertexOutput {
@builtin(position) clip_position: vec4<f32>, @builtin(position) position: vec4<f32>,
@location(0) tex_coords: vec2<f32>, };
}
@vertex @vertex
fn vs_main( fn vs_main(
model: VertexInput, @builtin(vertex_index) in_vertex_index: u32,
) -> VertexOutput { ) -> VertexOutput {
var out: VertexOutput; var out: VertexOutput;
out.tex_coords = model.tex_coords; out.position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
out.clip_position = camera.view_proj * vec4<f32>(model.position, 1.0); // 2.
return out; return out;
} }
@fragment @fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return vec4(1.0, 0.0, 0.0, 0.0); return vec4<f32>(0.3, 0.2, 0.1, 1.0);
} }

View file

@ -4,7 +4,7 @@ use winit::{
window::{Window, WindowBuilder, Fullscreen}, window::{Window, WindowBuilder, Fullscreen},
dpi::PhysicalSize, dpi::PhysicalSize,
}; };
use glam::{Vec3, Mat4}; use glam::Vec3;
use pollster::FutureExt as _; use pollster::FutureExt as _;
use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}}; use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}};
@ -17,14 +17,6 @@ pub mod world;
pub mod selection_box; pub mod selection_box;
pub mod entities; pub mod entities;
pub const OPENGL_TO_WGPU_MATRIX: Mat4 = Mat4::from_cols_array(&[
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 0.5, 0.0,
0.0, 0.0, 0.5, 1.0,
]);
#[derive(Unique)] #[derive(Unique)]
pub struct RenderTarget { pub struct RenderTarget {
pub output: wgpu::SurfaceTexture, pub output: wgpu::SurfaceTexture,

View file

@ -27,7 +27,8 @@ pub struct ChunkVertex {
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)] #[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
struct WorldUniform { struct WorldUniform {
position_offset: [f32; 3], position_offset: [f32; 3],
view_proj: [[f32; 4]; 4], view: [[f32; 4]; 4],
perspective: [[f32; 4]; 4],
} }
pub fn draw_world( pub fn draw_world(