Skip to content

Commit

Permalink
Notes: improve alignment with minor keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosua20 committed Jul 31, 2023
1 parent d6d0cf2 commit 1222089
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
16 changes: 15 additions & 1 deletion resources/shaders/notes.vert
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ out INTERFACE {
float channel;
} Out;

#define MAJOR_COUNT 75
const int minorIds[MAJOR_COUNT] = int[](1, 3, 0, 6, 8, 10, 0, 13, 15, 0, 18, 20, 22, 0, 25, 27, 0, 30, 32, 34, 0, 37, 39, 0, 42, 44, 46, 0, 49, 51, 0, 54, 56, 58, 0, 61, 63, 0, 66, 68, 70, 0, 73, 75, 0, 78, 80, 82, 0, 85, 87, 0, 90, 92, 94, 0, 97, 99, 0, 102, 104, 106, 0, 109, 111, 0, 114, 116, 118, 0, 121, 123, 0, 126, 0);

float minorShift(int id){
if(id == 1 || id == 6){
return -0.1;
}
if(id == 3 || id == 10){
return 0.1;
}
return 0.0;
}

void main(){

Expand All @@ -47,7 +59,9 @@ void main(){
float vertLoc = 2.0 * keyboardHeight - 1.0;
vertLoc += (reverseMode ? -1.0 : 1.0) * (Out.noteSize.y * 0.5 + mainSpeed * (id.y - time));
vec2 noteShift = vec2(horizLoc, vertLoc);


noteShift.x += id.w * minorShift(minorIds[int(id.x)] % 12) * Out.noteSize.x;

// Scale uv.
Out.uv = Out.noteSize * v;
Out.isMinor = id.w;
Expand Down
Loading

0 comments on commit 1222089

Please sign in to comment.