diff --git a/addons/ShaderLib/Maths/Vector/VectorTransform.gdshaderinc b/addons/ShaderLib/Maths/Vector/VectorTransform.gdshaderinc index d6f7b52..32eebf1 100644 --- a/addons/ShaderLib/Maths/Vector/VectorTransform.gdshaderinc +++ b/addons/ShaderLib/Maths/Vector/VectorTransform.gdshaderinc @@ -1,14 +1,14 @@ vec3 vector_transform_world_to_local(mat4 model_matrix, vec3 vector){ - return (transpose(model_matrix) * vec4(vector, 0.0)).xyz; + return (transpose(model_matrix) * vec4(vector, 1.0)).xyz; } vec3 vector_transform_world_to_view(mat4 view_matrix, vec3 vector){ - return (view_matrix * vec4(vector, 0.0)).xyz; + return (view_matrix * vec4(vector, 1.0)).xyz; } vec3 vector_transform_world_to_screen(mat4 view_matrix, mat4 projection_matrix, vec3 vector){ vec3 vector_view = vector_transform_world_to_view(view_matrix, vector); - return (projection_matrix * vec4(vector_view, 0.0)).xyz; + return (projection_matrix * vec4(vector_view, 1.0)).xyz; } vec3 vector_transform_world_to_tangent(mat4 model_matrix, vec3 normal, vec3 binormal, vec3 tangent, vec3 vector){ @@ -18,17 +18,17 @@ vec3 vector_transform_world_to_tangent(mat4 model_matrix, vec3 normal, vec3 bino } vec3 vector_transform_local_to_world(mat4 model_matrix, vec3 vector){ - return (model_matrix * vec4(vector, 0.0)).xyz; + return (model_matrix * vec4(vector, 1.0)).xyz; } vec3 vector_transform_local_to_view(mat4 model_matrix, mat4 view_matrix, vec3 vector){ vec3 vector_world = vector_transform_local_to_world(model_matrix, vector); - return (view_matrix * vec4(vector_world, 0.0)).xyz; + return (view_matrix * vec4(vector_world, 1.0)).xyz; } vec3 vector_transform_local_to_screen(mat4 model_matrix, mat4 view_matrix, mat4 projection_matrix, vec3 vector){ vec3 vector_view = vector_transform_local_to_view(model_matrix, view_matrix, vector); - return (projection_matrix * vec4(vector_view, 0.0)).xyz; + return (projection_matrix * vec4(vector_view, 1.0)).xyz; } vec3 vector_transform_local_to_tangent(vec3 normal, vec3 binormal, vec3 tangent, vec3 vector){ @@ -37,7 +37,7 @@ vec3 vector_transform_local_to_tangent(vec3 normal, vec3 binormal, vec3 tangent, } vec3 vector_transform_view_to_world(mat4 inv_view_matrix, vec3 vector){ - return (inv_view_matrix * vec4(vector, 0.0)).xyz;; + return (inv_view_matrix * vec4(vector, 1.0)).xyz;; } vec3 vector_transform_view_to_local(mat4 inv_view_matrix, mat4 model_matrix, vec3 vector){ @@ -46,7 +46,7 @@ vec3 vector_transform_view_to_local(mat4 inv_view_matrix, mat4 model_matrix, vec } vec3 vector_transform_view_to_screen(mat4 projection_matrix, vec3 vector){ - return (projection_matrix * vec4(vector, 0.0)).xyz; + return (projection_matrix * vec4(vector, 1.0)).xyz; } vec3 vector_transform_view_to_tangent(mat4 inv_view_matrix, mat4 model_matrix, vec3 normal, vec3 binormal, vec3 tangent, vec3 vector){ @@ -56,7 +56,7 @@ vec3 vector_transform_view_to_tangent(mat4 inv_view_matrix, mat4 model_matrix, v } vec3 vector_transform_screen_to_view(mat4 inv_projection_matrix, vec3 vector){ - return (inv_projection_matrix * vec4(vector, 0.0)).xyz;; + return (inv_projection_matrix * vec4(vector, 1.0)).xyz;; } vec3 vector_transform_screen_to_local(mat4 inv_projection_matrix, mat4 inv_view_matrix, mat4 model_matrix, vec3 vector){