Better texture node.

This commit is contained in:
Roz K 2022-12-31 21:45:29 +01:00
parent acc2e4cd28
commit dd786ef2b4
Signed by: roz
GPG Key ID: 51FBF4E483E1C822
2 changed files with 20 additions and 17 deletions

View File

@ -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),

View File

@ -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):