diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.h | 2 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 6 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas_shadow.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 40 |
5 files changed, 28 insertions, 28 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index e28a40ba9b..158b96ef27 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -175,7 +175,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const { p_shader->canvas_item.uses_color = false; p_shader->canvas_item.uses_vertex = false; - p_shader->canvas_item.uses_world_matrix = false; + p_shader->canvas_item.uses_model_matrix = false; p_shader->canvas_item.uses_extra_matrix = false; p_shader->canvas_item.uses_projection_matrix = false; p_shader->canvas_item.uses_instance_custom = false; @@ -198,7 +198,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const { shaders.actions_canvas.usage_flag_pointers["VERTEX"] = &p_shader->canvas_item.uses_vertex; - shaders.actions_canvas.usage_flag_pointers["WORLD_MATRIX"] = &p_shader->canvas_item.uses_world_matrix; + shaders.actions_canvas.usage_flag_pointers["MODEL_MATRIX"] = &p_shader->canvas_item.uses_model_matrix; shaders.actions_canvas.usage_flag_pointers["EXTRA_MATRIX"] = &p_shader->canvas_item.uses_extra_matrix; shaders.actions_canvas.usage_flag_pointers["PROJECTION_MATRIX"] = &p_shader->canvas_item.uses_projection_matrix; shaders.actions_canvas.usage_flag_pointers["INSTANCE_CUSTOM"] = &p_shader->canvas_item.uses_instance_custom; diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 96daed581b..83b81293c4 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -202,7 +202,7 @@ public: bool uses_vertex; // all these should disable item joining if used in a custom shader - bool uses_world_matrix; + bool uses_model_matrix; bool uses_extra_matrix; bool uses_projection_matrix; bool uses_instance_custom; diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index a18c451858..8812447f6e 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -96,7 +96,7 @@ void main() { #endif - mat4 world_matrix = mat4(vec4(draw_data[draw_data_instance].world_x, 0.0, 0.0), vec4(draw_data[draw_data_instance].world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data[draw_data_instance].world_ofs, 0.0, 1.0)); + mat4 model_matrix = mat4(vec4(draw_data[draw_data_instance].world_x, 0.0, 0.0), vec4(draw_data[draw_data_instance].world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data[draw_data_instance].world_ofs, 0.0, 1.0)); // MultiMeshes don't batch, so always read from draw_data[0] uint instancing = draw_data[0].flags & FLAGS_INSTANCING_MASK; @@ -169,7 +169,7 @@ void main() { } matrix = transpose(matrix); - world_matrix = world_matrix * matrix; + model_matrix = model_matrix * matrix; } } */ @@ -192,7 +192,7 @@ void main() { #endif #if !defined(SKIP_TRANSFORM_USED) - vertex = (world_matrix * vec4(vertex, 0.0, 1.0)).xy; + vertex = (model_matrix * vec4(vertex, 0.0, 1.0)).xy; #endif color_interp = color; diff --git a/drivers/gles3/shaders/canvas_shadow.glsl b/drivers/gles3/shaders/canvas_shadow.glsl index 65389c211a..94485abd11 100644 --- a/drivers/gles3/shaders/canvas_shadow.glsl +++ b/drivers/gles3/shaders/canvas_shadow.glsl @@ -15,13 +15,13 @@ layout(location = 0) in highp vec3 vertex; uniform highp mat4 projection_matrix; /* clang-format on */ uniform highp mat4 light_matrix; -uniform highp mat4 world_matrix; +uniform highp mat4 model_matrix; uniform highp float distance_norm; out highp vec4 position_interp; void main() { - gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex, 1.0))); + gl_Position = projection_matrix * (light_matrix * (model_matrix * vec4(vertex, 1.0))); position_interp = gl_Position; } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 2d504cd052..ebb00e81d0 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -73,8 +73,8 @@ layout(location = 12) in highp vec4 instance_custom_data; // uniforms // -uniform highp mat4 camera_matrix; -uniform highp mat4 camera_inverse_matrix; +uniform highp mat4 inv_view_matrix; +uniform highp mat4 view_matrix; uniform highp mat4 projection_matrix; uniform highp mat4 projection_inverse_matrix; @@ -314,7 +314,7 @@ uniform mediump float fog_height_curve; void main() { highp vec4 vertex = vertex_attrib; - mat4 world_matrix = world_transform; + mat4 model_matrix = world_transform; #ifdef USE_INSTANCING { @@ -323,7 +323,7 @@ void main() { instance_xform_row_1, instance_xform_row_2, vec4(0.0, 0.0, 0.0, 1.0)); - world_matrix = world_matrix * transpose(m); + model_matrix = model_matrix * transpose(m); } #endif @@ -356,12 +356,12 @@ void main() { #endif #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) - vertex = world_matrix * vertex; - normal = normalize((world_matrix * vec4(normal, 0.0)).xyz); + vertex = model_matrix * vertex; + normal = normalize((model_matrix * vec4(normal, 0.0)).xyz); #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) - tangent = normalize((world_matrix * vec4(tangent, 0.0)).xyz); - binormal = normalize((world_matrix * vec4(binormal, 0.0)).xyz); + tangent = normalize((model_matrix * vec4(tangent, 0.0)).xyz); + binormal = normalize((model_matrix * vec4(binormal, 0.0)).xyz); #endif #endif @@ -395,7 +395,7 @@ void main() { #endif - world_matrix = world_matrix * bone_transform; + model_matrix = model_matrix * bone_transform; #endif @@ -408,11 +408,11 @@ void main() { mat4 local_projection_matrix = projection_matrix; - mat4 modelview = camera_inverse_matrix * world_matrix; + mat4 modelview = view_matrix * model_matrix; float roughness = 1.0; #define projection_matrix local_projection_matrix -#define world_transform world_matrix +#define world_transform model_matrix float point_size = 1.0; @@ -439,11 +439,11 @@ VERTEX_SHADER_CODE #endif #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) - vertex = camera_inverse_matrix * vertex; - normal = normalize((camera_inverse_matrix * vec4(normal, 0.0)).xyz); + vertex = view_matrix * vertex; + normal = normalize((view_matrix * vec4(normal, 0.0)).xyz); #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) - tangent = normalize((camera_inverse_matrix * vec4(tangent, 0.0)).xyz); - binormal = normalize((camera_inverse_matrix * vec4(binormal, 0.0)).xyz); + tangent = normalize((view_matrix * vec4(tangent, 0.0)).xyz); + binormal = normalize((view_matrix * vec4(binormal, 0.0)).xyz); #endif #endif @@ -635,7 +635,7 @@ VERTEX_SHADER_CODE #ifdef FOG_HEIGHT_ENABLED { - float y = (camera_matrix * vec4(vertex_interp, 1.0)).y; + float y = (inv_view_matrix * vec4(vertex_interp, 1.0)).y; fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve)); } #endif @@ -680,9 +680,9 @@ precision mediump int; // uniforms // -uniform highp mat4 camera_matrix; +uniform highp mat4 inv_view_matrix; /* clang-format on */ -uniform highp mat4 camera_inverse_matrix; +uniform highp mat4 view_matrix; uniform highp mat4 projection_matrix; uniform highp mat4 projection_inverse_matrix; @@ -1644,7 +1644,7 @@ FRAGMENT_SHADER_CODE cone_dirs[10] = vec3(-0.700629, -0.509037, -0.5); cone_dirs[11] = vec3(0.267617, -0.823639, -0.5); - vec3 local_normal = normalize(camera_matrix * vec4(normal, 0.0)).xyz; + vec3 local_normal = normalize(inv_view_matrix * vec4(normal, 0.0)).xyz; vec4 captured = vec4(0.0); float sum = 0.0; for (int i = 0; i < 12; i++) { @@ -2122,7 +2122,7 @@ FRAGMENT_SHADER_CODE #ifdef FOG_HEIGHT_ENABLED { - float y = (camera_matrix * vec4(vertex, 1.0)).y; + float y = (inv_view_matrix * vec4(vertex, 1.0)).y; fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve)); } #endif |