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.

42 lines
1.0 KiB

<?xml version="1.0" encoding="utf-8"?>
<user_transforms>
<transform_def name="mirror_maker">
<node name="input_params">
<real name="mirror_maker">1</real>
</node>
<node name="internal_params">
<real name="weight" />
</node>
<int name="num_unit_randoms">1</int>
<string name="winter_init_function">
<![CDATA[
mirror_maker_init_result(mirror_maker)
]]>
</string>
<string name="winter_eval_function">
<![CDATA[
let
r2 = dot(p_in, p_in)
sph = if r2 >1
then if unit_rnd_0 < 0.5
then p_in * (weight / r2)
else p_in * weight
else vec2(0.0, 0.0)
den_re = -1.0 * sph.x - 0.0 * sph.y + 1.0
den_im = -1.0 * sph.y + 0.0 * sph.x + 0.0
num_re = (1.0) * sph.x - (0.0) * sph.y + (1.0)
num_im = (1.0) * sph.y + (0.0) * sph.x + (0.0)
inv_r2 = 1 / (den_re * den_re + den_im * den_im)
mob_out = vec2(
num_re * den_re + num_im * den_im,
num_im * den_re - num_re * den_im) * inv_r2
in
mob_out
]]>
</string>
</transform_def>
</user_transforms>