forked from pythonarcade/arcade
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
4 changed files
with
59 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#version 330 | ||
|
||
uniform sampler2D Texture; | ||
|
||
in vec2 v_texture; | ||
in vec4 v_color; | ||
|
||
out vec4 f_color; | ||
|
||
void main() { | ||
vec4 basecolor = texture(Texture, v_texture); | ||
basecolor = basecolor * v_color; | ||
if (basecolor.a == 0.0){ | ||
discard; | ||
} | ||
f_color = basecolor; | ||
} |
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,36 @@ | ||
#version 330 | ||
|
||
uniform mat4 Projection; | ||
uniform mat3 TextureTransform; | ||
|
||
// per vertex | ||
in vec2 in_vert; | ||
in vec2 in_texture; | ||
|
||
// per instance | ||
in vec2 in_pos; | ||
in float in_angle; | ||
in vec2 in_size; | ||
in vec4 in_sub_tex_coords; | ||
in vec4 in_color; | ||
|
||
out vec2 v_texture; | ||
out vec4 v_color; | ||
|
||
void main() { | ||
mat2 rotate = mat2( | ||
cos(in_angle), sin(in_angle), | ||
-sin(in_angle), cos(in_angle) | ||
); | ||
vec2 pos; | ||
pos = in_pos + vec2(rotate * (in_vert * (in_size / 2))); | ||
gl_Position = Projection * vec4(pos, 0.0, 1.0); | ||
|
||
vec2 tex_offset = in_sub_tex_coords.xy; | ||
vec2 tex_size = in_sub_tex_coords.zw; | ||
|
||
v_texture = (in_texture * tex_size + tex_offset) * vec2(1, -1); | ||
vec3 temp = TextureTransform * vec3(v_texture, 1.0); | ||
v_texture = temp.xy / temp.z; | ||
v_color = in_color; | ||
} |
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