diff --git a/game/game.py b/game/game.py index ad04a9e..2f5544c 100644 --- a/game/game.py +++ b/game/game.py @@ -162,16 +162,14 @@ def create_scene(keyboard, mouse): FuncNode(update_camera, (mouse, camera, environment)), TextureNode({0: tiles_texture}, ShaderNode(tiles_shader, - InputNode(tiles_shader, camera), - InputNode(tiles_shader, environment), + InputNode(tiles_shader, camera, 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), + InputNode(tests_shader, camera, environment), DrawNode(tests_batch) ) ) @@ -179,9 +177,7 @@ def create_scene(keyboard, mouse): FuncNode(update_sea, (camera, sea_phase)), TextureNode({0: sea_polar_textures, 1: sea_detail_texture}, ShaderNode(sea_shader, - InputNode(sea_shader, camera), - InputNode(sea_shader, environment), - InputNode(sea_shader, sea_phase), + InputNode(sea_shader, camera, environment, sea_phase), DrawNode(sea_triangles) ) ) diff --git a/game/scene.py b/game/scene.py index a3a8503..980e0af 100644 --- a/game/scene.py +++ b/game/scene.py @@ -53,37 +53,33 @@ class ShaderNode(Node): Node.draw(self, time) self._shader.unselect() -class InputNode(Node): - __slots__ = '_shader', '_input' +class InputNode: + __slots__ = '_shader', '_inputs' - def __init__(self, shader, input, *subnodes): - Node.__init__(self, *subnodes) + def __init__(self, shader, *inputs): self._shader = shader - self._input = input + self._inputs = inputs def draw(self, time): - self._input.set_inputs(self._shader) - Node.draw(self, time) + shader = self._shader + for input in self._inputs: + input.set_inputs(shader) -class DrawNode(Node): +class DrawNode: __slots__ = '_drawable' - def __init__(self, drawable, *subnodes): - Node.__init__(self, *subnodes) + def __init__(self, drawable): self._drawable = drawable def draw(self, time): self._drawable.draw() - Node.draw(self, time) -class FuncNode(Node): +class FuncNode: __slots__ = '_func', '_params' - def __init__(self, func, params, *subnodes): - Node.__init__(self, *subnodes) + def __init__(self, func, params): self._func = func self._params = params def draw(self, time): self._func(time, *self._params) - Node.draw(self, time)