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};
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)
.format(|buf, record| {
let mut level_style = buf.style();

View file

@ -1,34 +1,19 @@
struct Uniform {
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>,
}
//TODO migrate, this is just some filler code to make the game compile
struct VertexOutput {
@builtin(position) clip_position: vec4<f32>,
@location(0) tex_coords: vec2<f32>,
}
@builtin(position) position: vec4<f32>,
};
@vertex
fn vs_main(
model: VertexInput,
@builtin(vertex_index) in_vertex_index: u32,
) -> VertexOutput {
var out: VertexOutput;
out.tex_coords = model.tex_coords;
out.clip_position = camera.view_proj * vec4<f32>(model.position, 1.0); // 2.
out.position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
return out;
}
@fragment
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},
dpi::PhysicalSize,
};
use glam::{Vec3, Mat4};
use glam::Vec3;
use pollster::FutureExt as _;
use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}};
@ -17,14 +17,6 @@ pub mod world;
pub mod selection_box;
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)]
pub struct RenderTarget {
pub output: wgpu::SurfaceTexture,

View file

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