Skip to content

Commit

Permalink
fixed bug where barSize and barGap didn't account for rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dougal-s committed Feb 13, 2020
1 parent 7df5afd commit 66d83c2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/bars/1/shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ void main() {
mat2 transform = mat2(cos(rotation), sin(rotation), -sin(rotation), cos(rotation))
* mat2(boxWidth, 0, 0, limit*boxHeight);
gl_Position = vec4(transform*positions[gl_VertexIndex]+vec2(xOffset+sin(rotation)*(1-limit)*boxHeight, yOffset+cos(rotation)*(1-limit)*boxHeight), 0.0, 1.0);
position = vec2(width*boxWidth/2, -limit*boxHeight/2)*(vec2(0, -1)+positions[gl_VertexIndex]);
position = vec2((cos(rotation)*width+sin(rotation)*height)*boxWidth/2, -limit*boxHeight/2)*(vec2(0, -1)+positions[gl_VertexIndex]);
}
Binary file modified src/modules/bars/1/vert.spv
Binary file not shown.
1 change: 1 addition & 0 deletions src/modules/bars/config
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
// radians clockwise
(id=21) float rotation = 0

// applied last
(id=22) float xOffset = 0
(id=23) float yOffset = 0.5

0 comments on commit 66d83c2

Please sign in to comment.