diff options
Diffstat (limited to 'assets/shaders/tacmap/body.wgsl')
| -rw-r--r-- | assets/shaders/tacmap/body.wgsl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/assets/shaders/tacmap/body.wgsl b/assets/shaders/tacmap/body.wgsl index 7156150..217a0b2 100644 --- a/assets/shaders/tacmap/body.wgsl +++ b/assets/shaders/tacmap/body.wgsl @@ -1,6 +1,7 @@ struct InstanceInput { @location(0) position: vec3<f32>, - @location(1) radius: f32 + @location(1) origin: vec3<f32>, + @location(2) radius: f32 }; struct VertexOutput { @@ -47,7 +48,17 @@ fn vs_main( //Scale the world around the camera scale and translate about the camera's //absolute (/target) position - let instance_pos = (instance.position - camera.pos) * camera.scale; + let relative_pos = instance.position * camera.scale; + let origin_pos = (instance.origin - camera.pos) * camera.scale; + + if all(relative_pos != origin_pos) { + if length(relative_pos) < 0.01 { + out.clip_position = vec4<f32>(0.0, 0.0, 0.0, 1.0); + return out; + } + } + + let instance_pos = relative_pos + origin_pos; let view_proj = camera.proj * view; |
