From f46cc9484f073cbeeefa86a1c72b811a1dd15ef1 Mon Sep 17 00:00:00 2001 From: Miguel Pozo Date: Thu, 20 Jun 2024 23:06:19 +0200 Subject: [PATCH] Fix transform node --- Malt/Shaders/Node Utils 2/Vector.glsl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Malt/Shaders/Node Utils 2/Vector.glsl b/Malt/Shaders/Node Utils 2/Vector.glsl index 95bff4c3..63c514d7 100644 --- a/Malt/Shaders/Node Utils 2/Vector.glsl +++ b/Malt/Shaders/Node Utils 2/Vector.glsl @@ -5,12 +5,6 @@ @meta: category=Vector; */ -mat4 TRANSFORM_CONVERSION_TABLE[3*3] = mat4[3*3]( - mat4(1), MODEL, CAMERA*MODEL, - inverse(MODEL), mat4(1), CAMERA, - inverse(CAMERA*MODEL), inverse(CAMERA), mat4(1) -); - /* META @Type: subtype=ENUM(Point,Vector,Normal); @From: subtype=ENUM(Object,World,Camera); @@ -24,6 +18,12 @@ void Transform( inout vec3 Vector ) { + mat4 TRANSFORM_CONVERSION_TABLE[3*3] = mat4[3*3]( + mat4(1), MODEL, CAMERA*MODEL, + inverse(MODEL), mat4(1), CAMERA, + inverse(CAMERA*MODEL), inverse(CAMERA), mat4(1) + ); + mat4 m = TRANSFORM_CONVERSION_TABLE[clamp(From,0,2)*3 + clamp(To,0,2)]; bool project = To == 3; if(Type==0)//Point