Rename samplers in sea shader.
This commit is contained in:
parent
89e0b99d3a
commit
3344ac7d6c
@ -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',
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user