xforms for Chaotica
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB

<?xml version="1.0" encoding="utf-8"?>
<user_transforms>
<transform_def name="curlinear">
<!-- Transform by bezo97 -->
<node name="input_params">
<real name="curlinear">1.0</real>
<real name="curlinear_c1">0.0</real>
<real name="curlinear_c2">0.0</real>
<int name="curlinear_t">0.0</int>
<int name="curlinear_r">0.0</int>
</node>
<node name="internal_params">
<real name="weight" />
<real name="c1" />
<real name="c2" />
<real name="t" />
<real name="r" />
</node>
<string name="winter_init_function">
<![CDATA[
curlinear_init_result(curlinear, curlinear_c1, curlinear_c2, curlinear_t, curlinear_r * halfpi())
]]>
</string>
<string name="winter_eval_function">
<![CDATA[
let
rotm = mat2x2(cos(r), -sin(r),
sin(r), cos(r))
linear_out = rotm * p_in
re = 1 + c1 * p_in.x + c2 * (p_in.x * p_in.x - p_in.y * p_in.y)
im = (c1 + 2 * c2 * p_in.x) * p_in.y
fx = p_in.x * re + p_in.y * im
fy = p_in.y * re - p_in.x * im
fr = weight / (re * re + im * im)
curl_out = vec2(fx, fy) * fr
t2 = t * clamp(1.0 - length(p_in), 0.0, 1.0)
in
lerp(linear_out, curl_out, t2) * weight
]]>
</string>
</transform_def>
</user_transforms>