Merge pull request #75462 from joao-pedro-braz/use_modelview_for_vertex_transform_when_double_precision_is_enabled

Use MODELVIEW_MATRIX when on double precision
This commit is contained in:
Rémi Verschelde 2023-04-13 09:53:54 +02:00
commit 34a842b5d1
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 2 additions and 4 deletions

View File

@ -360,7 +360,7 @@ void vertex_shader(in uint instance_index, in bool is_multimesh, in uint multime
vertex = mat3(matrix) * vertex; vertex = mat3(matrix) * vertex;
model_origin = double_add_vec3(model_origin, model_precision, matrix[3].xyz, vec3(0.0), model_precision); model_origin = double_add_vec3(model_origin, model_precision, matrix[3].xyz, vec3(0.0), model_precision);
} }
vertex = mat3(model_matrix) * vertex; vertex = mat3(inv_view_matrix * modelview) * vertex;
vec3 temp_precision; // Will be ignored. vec3 temp_precision; // Will be ignored.
vertex += double_add_vec3(model_origin, model_precision, scene_data.inv_view_matrix[3].xyz, view_precision, temp_precision); vertex += double_add_vec3(model_origin, model_precision, scene_data.inv_view_matrix[3].xyz, view_precision, temp_precision);
vertex = mat3(scene_data.view_matrix) * vertex; vertex = mat3(scene_data.view_matrix) * vertex;

View File

@ -347,8 +347,6 @@ void main() {
#CODE : VERTEX #CODE : VERTEX
} }
/* output */
// using local coordinates (default) // using local coordinates (default)
#if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED) #if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
@ -361,7 +359,7 @@ void main() {
vertex = mat3(matrix) * vertex; vertex = mat3(matrix) * vertex;
model_origin = double_add_vec3(model_origin, model_precision, matrix[3].xyz, vec3(0.0), model_precision); model_origin = double_add_vec3(model_origin, model_precision, matrix[3].xyz, vec3(0.0), model_precision);
} }
vertex = mat3(model_matrix) * vertex; vertex = mat3(inv_view_matrix * modelview) * vertex;
vec3 temp_precision; vec3 temp_precision;
vertex += double_add_vec3(model_origin, model_precision, scene_data.inv_view_matrix[3].xyz, view_precision, temp_precision); vertex += double_add_vec3(model_origin, model_precision, scene_data.inv_view_matrix[3].xyz, view_precision, temp_precision);
vertex = mat3(scene_data.view_matrix) * vertex; vertex = mat3(scene_data.view_matrix) * vertex;