diff --git a/game/game.py b/game/game.py index 7f466d6..ad04a9e 100644 --- a/game/game.py +++ b/game/game.py @@ -158,24 +158,26 @@ def create_scene(keyboard, mouse): sea_triangles = sea.sea_triangles(64, proj_far_z - 0.1, proj_ratio) return SceneNode( - FuncNode(update_camera, (mouse, camera, environment)), - TextureNode((tiles_texture, heightmap, normalmap), - ShaderNode(tiles_shader, - InputNode(tiles_shader, camera), - InputNode(tiles_shader, environment), - DrawNode(tiles_batch) - ) - ), - FuncNode(update_tests, (blob, cube, clouds)), - TextureNode((tests_texture, heightmap, normalmap), - ShaderNode(tests_shader, - InputNode(tests_shader, camera), - InputNode(tests_shader, environment), - DrawNode(tests_batch) + TextureNode({1: heightmap, 2: normalmap}, + FuncNode(update_camera, (mouse, camera, environment)), + TextureNode({0: tiles_texture}, + ShaderNode(tiles_shader, + InputNode(tiles_shader, camera), + InputNode(tiles_shader, environment), + DrawNode(tiles_batch) + ) + ), + FuncNode(update_tests, (blob, cube, clouds)), + TextureNode({0: tests_texture}, + ShaderNode(tests_shader, + InputNode(tests_shader, camera), + InputNode(tests_shader, environment), + DrawNode(tests_batch) + ) ) ), FuncNode(update_sea, (camera, sea_phase)), - TextureNode((sea_polar_textures, sea_detail_texture), + TextureNode({0: sea_polar_textures, 1: sea_detail_texture}, ShaderNode(sea_shader, InputNode(sea_shader, camera), InputNode(sea_shader, environment), diff --git a/game/scene.py b/game/scene.py index 67d9fa4..a3a8503 100644 --- a/game/scene.py +++ b/game/scene.py @@ -34,10 +34,11 @@ class TextureNode(Node): self._textures = textures def draw(self, time): - for slot, texture in enumerate(self._textures): + items = self._textures.items() + for slot, texture in items: texture.select(slot) Node.draw(self, time) - for slot, texture in enumerate(self._textures): + for slot, texture in items: texture.unselect(slot) class ShaderNode(Node):