Skip to content

Commit

Permalink
Debug line now have same pixel width (maplibre#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristramg authored Feb 18, 2023
1 parent 63da707 commit 1fc7c4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions maplibre/src/render/shaders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ impl Shader for TileMaskShader {
format: wgpu::VertexFormat::Float32x4,
shader_location: 7,
},
// zoom factor
wgpu::VertexAttribute {
offset: 4 * wgpu::VertexFormat::Float32x4.size(),
format: wgpu::VertexFormat::Float32,
shader_location: 9,
},
],
}],
}
Expand Down
3 changes: 2 additions & 1 deletion maplibre/src/render/shaders/tile_debug.vertex.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn main(
@location(5) translate2: vec4<f32>,
@location(6) translate3: vec4<f32>,
@location(7) translate4: vec4<f32>,
@location(9) zoom_factor: f32,
@builtin(vertex_index) vertex_idx: u32,
@builtin(instance_index) instance_idx: u32 // instance_index is used when we have multiple instances of the same "object"
) -> VertexOutput {
Expand All @@ -20,7 +21,7 @@ fn main(
let target_width = 1.0;
let target_height = 1.0;

let WIDTH = EXTENT / 1024.0;
let WIDTH = EXTENT * zoom_factor / 1024.0;

var VERTICES: array<vec3<f32>, 24> = array<vec3<f32>, 24>(
// Debug lines vertices
Expand Down

0 comments on commit 1fc7c4f

Please sign in to comment.