Skip to content

Commit

Permalink
Fix transform node
Browse files Browse the repository at this point in the history
  • Loading branch information
pragma37 committed Jun 20, 2024
1 parent 841b3a7 commit f46cc94
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Malt/Shaders/Node Utils 2/Vector.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit f46cc94

Please sign in to comment.