5 Commits

Author SHA1 Message Date
794812d4b7 fix texture coordinates 2026-03-10 09:08:08 -07:00
efe5e41fe2 use tabs 2026-03-10 08:57:11 -07:00
d9659b2701 change front face 2026-03-10 08:56:38 -07:00
e39488d8f9 video encoder 2026-03-10 08:44:16 -07:00
f82d860822 update graphics 2026-03-10 07:55:22 -07:00
3 changed files with 20 additions and 15 deletions

View File

@@ -6,7 +6,7 @@ pub struct Graphics{
start_offset:glam::Vec3,
}
impl Graphics{
pub fn new(device:&wgpu::Device,queue:&wgpu::Queue,size:glam::UVec2,view_format: wgpu::TextureFormat)->Self{
pub fn new(device:&wgpu::Device,queue:&wgpu::Queue,size:glam::UVec2,view_format:wgpu::TextureFormat)->Self{
let graphics=strafesnet_graphics::graphics::GraphicsState::new(device,queue,size,view_format);
Self{
graphics,

View File

@@ -1,20 +1,25 @@
struct VertexOutput {
@builtin(position) position: vec4<f32>,
@location(1) uv: vec2<f32>,
}
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
// hacky way to draw a large triangle
let tmp1 = i32(vertex_index) / 2;
let tmp2 = i32(vertex_index) & 1;
var result:VertexOutput;
result.position=vec4<f32>(
f32(tmp1) * 4.0 - 1.0,
f32(tmp2) * 4.0 - 1.0,
1.0,
1.0
);
return result;
// hacky way to draw a large triangle
let tmp1 = i32(vertex_index) / 2;
let tmp2 = i32(vertex_index) & 1;
var result:VertexOutput;
result.position=vec4<f32>(
f32(tmp1) * 4.0 - 1.0,
f32(tmp2) * 4.0 - 1.0,
1.0,
1.0
);
result.uv=vec2<f32>(
f32(tmp1) * 2.0,
1.0 - f32(tmp2) * 2.0
);
return result;
}
@group(0)
@@ -27,7 +32,7 @@ var texture_sampler: sampler;
@fragment
fn fs_main_y(input: VertexOutput) -> @location(0) f32 {
let conversion_weights = vec3<f32>(0.2126, 0.7152, 0.0722);
let color = textureSample(texture, texture_sampler, input.position.xy).rgb;
let color = textureSample(texture, texture_sampler, input.uv).rgb;
return clamp(dot(color, conversion_weights), 0.0, 1.0);
}
@@ -40,7 +45,7 @@ fn fs_main_uv(input: VertexOutput) -> @location(0) vec2<f32> {
0.5, -0.0458,
);
let conversion_bias = vec2<f32>(0.5, 0.5);
let color = textureSample(texture, texture_sampler, input.position.xy).rgb;
let color = textureSample(texture, texture_sampler, input.uv).rgb;
return clamp(conversion_weights * color + conversion_bias, vec2(0.0, 0.0), vec2(1.0, 1.0));
}

View File

@@ -302,7 +302,7 @@ impl PlaneRenderer {
topology: wgpu::PrimitiveTopology::TriangleList,
cull_mode: Some(wgpu::Face::Back),
polygon_mode: wgpu::PolygonMode::Fill,
front_face: wgpu::FrontFace::Ccw,
front_face: wgpu::FrontFace::Cw,
conservative: false,
unclipped_depth: false,
strip_index_format: None,