Minor fixes

master
Mark 2024-01-06 16:00:40 -08:00
parent a65372f866
commit c1d50f0c45
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
1 changed files with 18 additions and 18 deletions

View File

@ -58,31 +58,31 @@ fn vertex_main(
// Apply transformations // Apply transformations
let angle = instance.angle + age * instance.angvel; let angle = instance.angle + age * instance.angvel;
let rotation = mat2x2(
var scale: f32 = instance.size / global_data.camera_zoom.x;
var pos: vec2<f32> = vec2(
vertex.position.x * scale * global_sprites[instance.sprite_index].aspect,
vertex.position.y * scale
);
pos = mat2x2(
vec2(cos(angle), sin(angle)), vec2(cos(angle), sin(angle)),
vec2(-sin(angle), cos(angle)) vec2(-sin(angle), cos(angle))
); ) * pos;
var scale: f32 = instance.size / global_data.camera_zoom.x;
var pos: vec2<f32> = vec2(vertex.position.x, vertex.position.y);
pos = pos * vec2<f32>(
global_sprites[instance.sprite_index].aspect * scale / global_data.window_aspect.x,
scale
);
pos = rotation * pos;
var ipos: vec2<f32> = ( var trans: vec2<f32> = (instance.position + (instance.velocity * age) - global_data.camera_position);
vec2(instance.position.x, instance.position.y)
+ (instance.velocity * age) pos = vec2(
- global_data.camera_position pos.x / global_data.window_aspect.x,
pos.y
); );
pos = pos + vec2<f32>( pos = pos + vec2(
ipos.x / (global_data.camera_zoom.x/2.0) / global_data.window_aspect.x, trans.x / (global_data.camera_zoom.x / 2.0) / global_data.window_aspect.x,
ipos.y / (global_data.camera_zoom.x/2.0) trans.y / (global_data.camera_zoom.x / 2.0)
); );
out.position = vec4<f32>(pos, 0.0, 1.0);
out.position = vec4(pos, 0.0, 1.0);
// Compute texture coordinates // Compute texture coordinates