-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bc9b85
commit dae7208
Showing
14 changed files
with
452 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
void main() { | ||
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
attribute vec2 a_pos; | ||
attribute vec2 a_reserved; | ||
|
||
uniform mat4 u_matrix; | ||
uniform mat4 u_toWorld; | ||
uniform mat4 u_fromWorld; | ||
uniform vec2 u_viewport_size; | ||
|
||
void main() { | ||
// 100 = hard-coded padding used in collision logic | ||
vec4 clipPos = u_matrix * vec4(a_pos - vec2(100), 0.0, 1.0); | ||
|
||
vec4 rayStart = u_toWorld * vec4(clipPos.xy / clipPos.w, -1.0, 1.0); | ||
vec4 rayEnd = u_toWorld * vec4(clipPos.xy / clipPos.w, 1.0, 1.0); | ||
|
||
rayStart.xyz /= rayStart.w; | ||
rayEnd.xyz /= rayEnd.w; | ||
|
||
float t = (0.0 - rayStart.z) / (rayEnd.z - rayStart.z); | ||
vec3 tilePos = mix(rayStart.xyz, rayEnd.xyz, t); | ||
|
||
clipPos = u_fromWorld * vec4(tilePos, 1.0); | ||
|
||
gl_Position = vec4(clipPos.xyz / clipPos.w, 1.0) + vec4(a_reserved / u_viewport_size * 2.0, 0.0, 0.0); | ||
} |
Oops, something went wrong.