mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-24 15:58:43 -06:00
Compare commits
2 commits
9532161ed7
...
1ac6861610
Author | SHA1 | Date | |
---|---|---|---|
griffi-gh | 1ac6861610 | ||
griffi-gh | 6064fe0b76 |
|
@ -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=error");
|
||||
.filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn,wgpu=warn,wgpu_core=warn,wgpu_hal=warn,naga=warn");
|
||||
Builder::from_env(env)
|
||||
.format(|buf, record| {
|
||||
let mut level_style = buf.style();
|
||||
|
|
|
@ -1,19 +1,34 @@
|
|||
//TODO migrate, this is just some filler code to make the game compile
|
||||
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>,
|
||||
}
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) position: vec4<f32>,
|
||||
};
|
||||
@builtin(position) clip_position: vec4<f32>,
|
||||
@location(0) tex_coords: vec2<f32>,
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vs_main(
|
||||
@builtin(vertex_index) in_vertex_index: u32,
|
||||
model: VertexInput,
|
||||
) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
out.tex_coords = model.tex_coords;
|
||||
out.clip_position = camera.view_proj * vec4<f32>(model.position, 1.0); // 2.
|
||||
return out;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(0.3, 0.2, 0.1, 1.0);
|
||||
return vec4(1.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ use winit::{
|
|||
window::{Window, WindowBuilder, Fullscreen},
|
||||
dpi::PhysicalSize,
|
||||
};
|
||||
use glam::Vec3;
|
||||
use glam::{Vec3, Mat4};
|
||||
use pollster::FutureExt as _;
|
||||
use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}};
|
||||
|
||||
|
@ -17,6 +17,14 @@ 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,
|
||||
|
|
|
@ -27,8 +27,7 @@ pub struct ChunkVertex {
|
|||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
struct WorldUniform {
|
||||
position_offset: [f32; 3],
|
||||
view: [[f32; 4]; 4],
|
||||
perspective: [[f32; 4]; 4],
|
||||
view_proj: [[f32; 4]; 4],
|
||||
}
|
||||
|
||||
pub fn draw_world(
|
||||
|
|
Loading…
Reference in a new issue