9 Commits

Author SHA1 Message Date
0e9fc87976 path helpers 2026-03-10 07:57:10 -07:00
673142c493 update to graphics v0.0.7 2026-03-10 07:57:10 -07:00
0b5a8453dc use surface in wasm 2026-03-10 07:38:31 -07:00
de2bcc77a0 surface api 2026-03-10 07:36:09 -07:00
3f0acaae30 surface 2026-03-10 07:25:37 -07:00
935cc87663 fix resize 2026-03-10 07:06:10 -07:00
839c59ea54 waaa 2026-03-10 07:01:33 -07:00
1c6461464f wip refactor surface (rename to TextureView?) 2026-03-09 11:54:56 -07:00
0afc5cddad video encoder 2026-03-09 11:32:24 -07:00
3 changed files with 15 additions and 20 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,25 +1,20 @@
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
);
result.uv=vec2<f32>(
f32(tmp1) * 2.0,
1.0 - f32(tmp2) * 2.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
);
return result;
}
@group(0)
@@ -32,7 +27,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.uv).rgb;
let color = textureSample(texture, texture_sampler, input.position.xy).rgb;
return clamp(dot(color, conversion_weights), 0.0, 1.0);
}
@@ -45,7 +40,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.uv).rgb;
let color = textureSample(texture, texture_sampler, input.position.xy).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::Cw,
front_face: wgpu::FrontFace::Ccw,
conservative: false,
unclipped_depth: false,
strip_index_format: None,