Skip to content

Commit

Permalink
Merge branch 'shader_experimental' of github.com:pvcraven/arcade into…
Browse files Browse the repository at this point in the history
… shader_experimental
  • Loading branch information
pvcraven committed May 19, 2020
2 parents fa9061c + 98ecb1c commit eab8d9f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,17 @@ def __init__(self, width, height, title):
self.quad_2 = geometry.quad_2d(pos=(0.5, 0.5))

def on_draw(self):
try:
self.clear()
self.color_program['color'] = (
(math.sin(self.time) + 1.0) / 2,
(math.sin(self.time + 2) + 1.0) / 2,
(math.sin(self.time + 3) + 1.0) / 2,
1.0
)
self.quad_1.render(self.color_program)
self.quad_2.render(self.uv_program)

arcade.draw_circle_filled(100, 100, 100, arcade.color.APPLE_GREEN)
self.clear()
self.color_program['color'] = (
(math.sin(self.time) + 1.0) / 2,
(math.sin(self.time + 2) + 1.0) / 2,
(math.sin(self.time + 3) + 1.0) / 2,
1.0
)
self.quad_1.render(self.color_program)
self.quad_2.render(self.uv_program)

except Exception:
exit(1)
arcade.draw_circle_filled(100, 100, 100, arcade.color.APPLE_GREEN)

def on_update(self, dt):
self.time += dt
Expand Down
16 changes: 10 additions & 6 deletions arcade/experimental/examples/geometry_shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,33 @@ def __init__(self, width, height, title):
// Get the position emitted from the vertex shader
// We get the 0th element because point primitives only have 1 position.
vec4 pos = gl_in[0].gl_Position;
float offset = 0.02 + sin(time * 5.0) / 200.0;
float offset = 0.02 + sin(time * 5.0 + gl_PrimitiveIDIn) / 200.0;
float rot = time + length(pos) * 10.0;
mat2 rotate = mat2(
cos(rot), -sin(rot),
sin(rot), cos(rot)
);
vec3 color = vec3(
(sin(time + gl_PrimitiveIDIn) + 1.0) / 2.0,
(sin(time + 2 + gl_PrimitiveIDIn) + 1.0) / 2.0,
(sin(time + 3 + gl_PrimitiveIDIn) + 1.0) / 2.0
);
// Emit 4 vertices around the original vertex position making a quad
gl_Position = pos + vec4(rotate * vec2(-offset, offset), 0.0, 0.0);
gs_color = vec3(pos.x, pos.y, 0.5);
gs_color = color;
EmitVertex();
gl_Position = pos + vec4(rotate * vec2(-offset, -offset), 0.0, 0.0);
gs_color = vec3(pos.x, pos.y, 0.5);
gs_color = color;
EmitVertex();
gl_Position = pos + vec4(rotate * vec2(offset, offset), 0.0, 0.0);
gs_color = vec3(pos.x, pos.y, 0.5);
gs_color = color;
EmitVertex();
gl_Position = pos + vec4(rotate * vec2(offset, -offset), 0.0, 0.0);
gs_color = vec3(pos.x, pos.y, 0.5);
gs_color = color;
EmitVertex();
// Done with the primitive
Expand Down
2 changes: 1 addition & 1 deletion arcade/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class Theme:
DEFAULT_FONT_NAME = ('Calibri', 'Arial')

def __init__(self):
self.button_textures: Dict[str, Optional['', arcade.Texture]] =\
self.button_textures: Dict[str, Optional[str, arcade.Texture]] =\
{'normal': '', 'hover': '', 'clicked': '', 'locked': '', }
self.menu_texture = ""
self.window_texture = ""
Expand Down
2 changes: 1 addition & 1 deletion arcade/tilemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def process_layer(map_object: pytiled_parser.objects.TileMap,
layer_name: str,
scaling: float = 1,
base_directory: str = "",
use_spatial_hash: Optional[bool] = None) -> SpriteList:
use_spatial_hash: bool = False) -> SpriteList:
"""
This takes a map layer returned by the read_tmx function, and creates Sprites for it.
Expand Down

0 comments on commit eab8d9f

Please sign in to comment.