diff --git a/game/game.py b/game/game.py index 6e1efd5..9948add 100644 --- a/game/game.py +++ b/game/game.py @@ -205,9 +205,8 @@ def create_scene(keyboard, mouse): PerfNode('tests_batch', DrawNode(tests_batch))))), FuncNode(update_sea, (camera, sea_phase)), - TextureNode({ - sea_shader.u_sea_polar_sampler: sea_polar_textures, - sea_shader.u_sea_detail_sampler: sea_detail_texture}, + TextureNode( + {sea_shader.u_polar_sampler: sea_polar_textures, sea_shader.u_detail_sampler: sea_detail_texture}, ShaderNode(sea_shader, InputNode(sea_shader, camera, environment, sea_phase), PerfNode('sea_triangles', diff --git a/game/shaders/sea_opengles.frag b/game/shaders/sea_opengles.frag index 1bd343e..0841d3f 100644 --- a/game/shaders/sea_opengles.frag +++ b/game/shaders/sea_opengles.frag @@ -28,8 +28,8 @@ uniform float u_sea_phase; #define u_up u_view[2].xyz #define u_origin u_view[3].xyz -layout(binding=0) uniform highp sampler2DArray u_sea_polar_sampler; -layout(binding=1) uniform highp sampler2D u_sea_detail_sampler; +layout(binding=0) uniform highp sampler2DArray u_polar_sampler; +layout(binding=1) uniform highp sampler2D u_detail_sampler; const float c_sea_radius = 637.1; const float c_sea_radius_sq = c_sea_radius * c_sea_radius; @@ -68,13 +68,13 @@ void main(void) { } float t = sqrt(length(sea_position)); //TODO: more accurate vec3 sea_polar1 = normalize( - c_normal_shift + texture(u_sea_polar_sampler, vec3(s, t + u_sea_phase, 0.0)).xyz * c_normal_scale); + c_normal_shift + texture(u_polar_sampler, vec3(s, t + u_sea_phase, 0.0)).xyz * c_normal_scale); vec3 sea_polar2 = normalize( - c_normal_shift + texture(u_sea_polar_sampler, vec3(s, t - u_sea_phase, 1.0)).xyz * c_normal_scale); + c_normal_shift + texture(u_polar_sampler, vec3(s, t - u_sea_phase, 1.0)).xyz * c_normal_scale); //TODO: vec2 s = (u_sea_phase + dot(sea_position, u_right)) * c_detail_scale; t = (u_sea_phase + dot(sea_position, u_forward)) * c_detail_scale; - vec3 sea_detail = normalize(c_normal_shift + texture(u_sea_detail_sampler, vec2(s, t)).xyz * c_normal_scale); + vec3 sea_detail = normalize(c_normal_shift + texture(u_detail_sampler, vec2(s, t)).xyz * c_normal_scale); //TODO: better blending, with earth normal vec4 normal = u_view * vec4(normalize(sea_polar1 + sea_polar2 + sea_detail), 0.0); float d = max(0.0, dot(normal.xyz, u_light_direction));