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,8 +158,9 @@ def create_scene(keyboard, mouse):
sea_triangles = sea.sea_triangles(64, proj_far_z - 0.1, proj_ratio) sea_triangles = sea.sea_triangles(64, proj_far_z - 0.1, proj_ratio)
return SceneNode( return SceneNode(
TextureNode({1: heightmap, 2: normalmap},
FuncNode(update_camera, (mouse, camera, environment)), FuncNode(update_camera, (mouse, camera, environment)),
TextureNode((tiles_texture, heightmap, normalmap), TextureNode({0: tiles_texture},
ShaderNode(tiles_shader, ShaderNode(tiles_shader,
InputNode(tiles_shader, camera), InputNode(tiles_shader, camera),
InputNode(tiles_shader, environment), InputNode(tiles_shader, environment),
@ -167,15 +168,16 @@ def create_scene(keyboard, mouse):
) )
), ),
FuncNode(update_tests, (blob, cube, clouds)), FuncNode(update_tests, (blob, cube, clouds)),
TextureNode((tests_texture, heightmap, normalmap), TextureNode({0: tests_texture},
ShaderNode(tests_shader, ShaderNode(tests_shader,
InputNode(tests_shader, camera), InputNode(tests_shader, camera),
InputNode(tests_shader, environment), InputNode(tests_shader, environment),
DrawNode(tests_batch) DrawNode(tests_batch)
) )
)
), ),
FuncNode(update_sea, (camera, sea_phase)), 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, ShaderNode(sea_shader,
InputNode(sea_shader, camera), InputNode(sea_shader, camera),
InputNode(sea_shader, environment), InputNode(sea_shader, environment),

View File

@ -34,10 +34,11 @@ class TextureNode(Node):
self._textures = textures self._textures = textures
def draw(self, time): def draw(self, time):
for slot, texture in enumerate(self._textures): items = self._textures.items()
for slot, texture in items:
texture.select(slot) texture.select(slot)
Node.draw(self, time) Node.draw(self, time)
for slot, texture in enumerate(self._textures): for slot, texture in items:
texture.unselect(slot) texture.unselect(slot)
class ShaderNode(Node): class ShaderNode(Node):