Minor fixes
parent
a65372f866
commit
c1d50f0c45
|
@ -58,31 +58,31 @@ fn vertex_main(
|
|||
|
||||
// Apply transformations
|
||||
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(-sin(angle), cos(angle))
|
||||
);
|
||||
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;
|
||||
|
||||
var trans: vec2<f32> = (instance.position + (instance.velocity * age) - global_data.camera_position);
|
||||
|
||||
pos = vec2(
|
||||
pos.x / global_data.window_aspect.x,
|
||||
pos.y
|
||||
);
|
||||
|
||||
pos = rotation * pos;
|
||||
|
||||
var ipos: vec2<f32> = (
|
||||
vec2(instance.position.x, instance.position.y)
|
||||
+ (instance.velocity * age)
|
||||
- global_data.camera_position
|
||||
pos = pos + vec2(
|
||||
trans.x / (global_data.camera_zoom.x / 2.0) / global_data.window_aspect.x,
|
||||
trans.y / (global_data.camera_zoom.x / 2.0)
|
||||
);
|
||||
|
||||
pos = pos + vec2<f32>(
|
||||
ipos.x / (global_data.camera_zoom.x/2.0) / global_data.window_aspect.x,
|
||||
ipos.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
|
||||
|
|
Loading…
Reference in New Issue