Step_03.py差异#
Step_01.py到Step_03.py的差异#
--- /pb1/repo/arcade/doc/tutorials/raycasting/step_01.py
+++ /pb1/repo/arcade/doc/tutorials/raycasting/step_03.py
@@ -45,7 +45,7 @@
window_size = self.get_size()
# Create the shader toy, passing in a path for the shader source
- self.shadertoy = Shadertoy.create_from_file(window_size, "step_01.glsl")
+ self.shadertoy = Shadertoy.create_from_file(window_size, "step_03.glsl")
# Create the channels 0 and 1 frame buffers.
# Make the buffer the size of the window, with 4 channels (RGBA)
@@ -99,12 +99,21 @@
# Draw the walls
self.wall_list.draw()
+ self.channel1.use()
+ self.channel1.clear()
+ # Draw the bombs
+ self.bomb_list.draw()
+
# Select this window to draw on
self.use()
# Clear to background color
self.clear()
# Run the shader and render to the window
+ self.shadertoy.program['lightPosition'] = self.player_sprite.position
+ self.shadertoy.program['lightSize'] = 300
self.shadertoy.render()
+ # Draw the player
+ self.player_list.draw()
def on_key_press(self, key, modifiers):
"""Called whenever a key is pressed. """