glre 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/addons.cjs +2 -0
- package/dist/addons.cjs.map +1 -0
- package/dist/addons.d.ts +1287 -0
- package/dist/addons.js +2 -0
- package/dist/addons.js.map +1 -0
- package/dist/index.cjs +31 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +187 -323
- package/dist/index.js +31 -43
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +1 -48
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.ts +536 -10
- package/dist/native.js +1 -48
- package/dist/native.js.map +1 -1
- package/dist/node.cjs +69 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.ts +626 -0
- package/dist/node.js +69 -0
- package/dist/node.js.map +1 -0
- package/dist/react.cjs +1 -48
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts +524 -4
- package/dist/react.js +1 -48
- package/dist/react.js.map +1 -1
- package/dist/solid.cjs +1 -48
- package/dist/solid.cjs.map +1 -1
- package/dist/solid.d.ts +524 -4
- package/dist/solid.js +1 -48
- package/dist/solid.js.map +1 -1
- package/package.json +64 -11
- package/src/addons/animation/easing/backIn.ts +10 -0
- package/src/addons/animation/easing/backInOut.ts +12 -0
- package/src/addons/animation/easing/backOut.ts +10 -0
- package/src/addons/animation/easing/bounceIn.ts +10 -0
- package/src/addons/animation/easing/bounceInOut.ts +13 -0
- package/src/addons/animation/easing/bounceOut.ts +30 -0
- package/src/addons/animation/easing/circularIn.ts +9 -0
- package/src/addons/animation/easing/circularInOut.ts +11 -0
- package/src/addons/animation/easing/circularOut.ts +9 -0
- package/src/addons/animation/easing/cubicIn.ts +9 -0
- package/src/addons/animation/easing/cubicInOut.ts +11 -0
- package/src/addons/animation/easing/cubicOut.ts +10 -0
- package/src/addons/animation/easing/elasticIn.ts +10 -0
- package/src/addons/animation/easing/elasticInOut.ts +21 -0
- package/src/addons/animation/easing/elasticOut.ts +12 -0
- package/src/addons/animation/easing/exponentialIn.ts +9 -0
- package/src/addons/animation/easing/exponentialInOut.ts +13 -0
- package/src/addons/animation/easing/exponentialOut.ts +9 -0
- package/src/addons/animation/easing/index.ts +33 -0
- package/src/addons/animation/easing/linearIn.ts +9 -0
- package/src/addons/animation/easing/linearInOut.ts +9 -0
- package/src/addons/animation/easing/linearOut.ts +9 -0
- package/src/addons/animation/easing/quadraticIn.ts +9 -0
- package/src/addons/animation/easing/quadraticInOut.ts +10 -0
- package/src/addons/animation/easing/quadraticOut.ts +9 -0
- package/src/addons/animation/easing/quarticIn.ts +9 -0
- package/src/addons/animation/easing/quarticInOut.ts +11 -0
- package/src/addons/animation/easing/quarticOut.ts +10 -0
- package/src/addons/animation/easing/quinticIn.ts +9 -0
- package/src/addons/animation/easing/quinticInOut.ts +11 -0
- package/src/addons/animation/easing/quinticOut.ts +9 -0
- package/src/addons/animation/easing/sineIn.ts +10 -0
- package/src/addons/animation/easing/sineInOut.ts +10 -0
- package/src/addons/animation/easing/sineOut.ts +10 -0
- package/src/addons/color/palette/macbeth.ts +42 -0
- package/src/addons/color/space/cmyk2rgb.ts +12 -0
- package/src/addons/color/space/gamma2linear.ts +19 -0
- package/src/addons/color/space/hsl2rgb.ts +20 -0
- package/src/addons/color/space/hsv2rgb.ts +18 -0
- package/src/addons/color/space/hue2rgb.ts +12 -0
- package/src/addons/color/space/index.ts +29 -0
- package/src/addons/color/space/lab2lch.ts +22 -0
- package/src/addons/color/space/lab2rgb.ts +19 -0
- package/src/addons/color/space/lab2xyz.ts +32 -0
- package/src/addons/color/space/lch2lab.ts +21 -0
- package/src/addons/color/space/lch2rgb.ts +22 -0
- package/src/addons/color/space/linear2gamma.ts +19 -0
- package/src/addons/color/space/oklab2rgb.ts +35 -0
- package/src/addons/color/space/rgb2cmyk.ts +13 -0
- package/src/addons/color/space/rgb2hcv.ts +29 -0
- package/src/addons/color/space/rgb2hsl.ts +23 -0
- package/src/addons/color/space/rgb2hsv.ts +36 -0
- package/src/addons/color/space/rgb2hue.ts +29 -0
- package/src/addons/color/space/rgb2lab.ts +19 -0
- package/src/addons/color/space/rgb2lch.ts +22 -0
- package/src/addons/color/space/rgb2oklab.ts +45 -0
- package/src/addons/color/space/rgb2srgb.ts +34 -0
- package/src/addons/color/space/rgb2xyz.ts +20 -0
- package/src/addons/color/space/rgb2yiq.ts +22 -0
- package/src/addons/color/space/rgb2yuv.ts +32 -0
- package/src/addons/color/space/srgb2rgb.ts +34 -0
- package/src/addons/color/space/xyz2lab.ts +27 -0
- package/src/addons/color/space/xyz2rgb.ts +30 -0
- package/src/addons/color/space/yiq2rgb.ts +22 -0
- package/src/addons/color/space/yuv2rgb.ts +32 -0
- package/src/addons/draw/arrows.ts +75 -0
- package/src/addons/draw/axis.ts +57 -0
- package/src/addons/draw/bridge.ts +81 -0
- package/src/addons/draw/char.ts +30 -0
- package/src/addons/draw/circle.ts +29 -0
- package/src/addons/draw/fill.ts +25 -0
- package/src/addons/draw/flip.ts +45 -0
- package/src/addons/draw/hex.ts +29 -0
- package/src/addons/draw/index.ts +13 -0
- package/src/addons/draw/line.ts +16 -0
- package/src/addons/draw/point.ts +30 -0
- package/src/addons/draw/rect.ts +52 -0
- package/src/addons/draw/stroke.ts +31 -0
- package/src/addons/draw/tri.ts +29 -0
- package/src/addons/generative/cnoise.ts +239 -0
- package/src/addons/generative/curl.ts +64 -0
- package/src/addons/generative/fbm.ts +69 -0
- package/src/addons/generative/gerstnerWave.ts +21 -0
- package/src/addons/generative/gnoise.ts +113 -0
- package/src/addons/generative/index.ts +15 -0
- package/src/addons/generative/noised.ts +139 -0
- package/src/addons/generative/pnoise.ts +249 -0
- package/src/addons/generative/psrdnoise.ts +277 -0
- package/src/addons/generative/random.ts +136 -0
- package/src/addons/generative/snoise.ts +199 -0
- package/src/addons/generative/srandom.ts +90 -0
- package/src/addons/generative/voronoi.ts +134 -0
- package/src/addons/generative/voronoise.ts +69 -0
- package/src/addons/generative/wavelet.ts +77 -0
- package/src/addons/generative/worley.ts +99 -0
- package/src/addons/geometry/aabb/aabb.ts +8 -0
- package/src/addons/geometry/aabb/centroid.ts +10 -0
- package/src/addons/geometry/aabb/contain.ts +19 -0
- package/src/addons/geometry/aabb/diagonal.ts +10 -0
- package/src/addons/geometry/aabb/expand.ts +16 -0
- package/src/addons/geometry/aabb/index.ts +7 -0
- package/src/addons/geometry/aabb/intersect.ts +20 -0
- package/src/addons/geometry/aabb/square.ts +17 -0
- package/src/addons/geometry/index.ts +2 -0
- package/src/addons/geometry/triangle/area.ts +10 -0
- package/src/addons/geometry/triangle/barycentric.ts +50 -0
- package/src/addons/geometry/triangle/centroid.ts +10 -0
- package/src/addons/geometry/triangle/closestPoint.ts +85 -0
- package/src/addons/geometry/triangle/contain.ts +19 -0
- package/src/addons/geometry/triangle/distanceSq.ts +38 -0
- package/src/addons/geometry/triangle/index.ts +10 -0
- package/src/addons/geometry/triangle/intersect.ts +49 -0
- package/src/addons/geometry/triangle/normal.ts +12 -0
- package/src/addons/geometry/triangle/signedDistance.ts +31 -0
- package/src/addons/geometry/triangle/triangle.ts +9 -0
- package/src/addons/index.ts +8 -0
- package/src/addons/lighting/ray.ts +8 -0
- package/src/addons/math/aafloor.ts +13 -0
- package/src/addons/math/aafract.ts +38 -0
- package/src/addons/math/aamirror.ts +12 -0
- package/src/addons/math/aastep.ts +14 -0
- package/src/addons/math/absi.ts +9 -0
- package/src/addons/math/adaptiveThreshold.ts +24 -0
- package/src/addons/math/bump.ts +20 -0
- package/src/addons/math/const.ts +19 -0
- package/src/addons/math/cubic.ts +101 -0
- package/src/addons/math/cubicMix.ts +49 -0
- package/src/addons/math/decimate.ts +12 -0
- package/src/addons/math/dist.ts +143 -0
- package/src/addons/math/fcos.ts +11 -0
- package/src/addons/math/frac.ts +9 -0
- package/src/addons/math/gain.ts +14 -0
- package/src/addons/math/gaussian.ts +14 -0
- package/src/addons/math/grad4.ts +19 -0
- package/src/addons/math/hammersley.ts +54 -0
- package/src/addons/math/highPass.ts +12 -0
- package/src/addons/math/index.ts +63 -0
- package/src/addons/math/inside.ts +68 -0
- package/src/addons/math/invCubic.ts +9 -0
- package/src/addons/math/invQuartic.ts +9 -0
- package/src/addons/math/inverse.ts +9 -0
- package/src/addons/math/lengthSq.ts +10 -0
- package/src/addons/math/map.ts +27 -0
- package/src/addons/math/mirror.ts +12 -0
- package/src/addons/math/mmax.ts +27 -0
- package/src/addons/math/mmin.ts +28 -0
- package/src/addons/math/mmix.ts +47 -0
- package/src/addons/math/mod2.ts +44 -0
- package/src/addons/math/mod289.ts +46 -0
- package/src/addons/math/modi.ts +15 -0
- package/src/addons/math/nyquist.ts +15 -0
- package/src/addons/math/pack.ts +15 -0
- package/src/addons/math/parabola.ts +12 -0
- package/src/addons/math/permute.ts +42 -0
- package/src/addons/math/pow2.ts +10 -0
- package/src/addons/math/pow3.ts +9 -0
- package/src/addons/math/pow5.ts +10 -0
- package/src/addons/math/pow7.ts +12 -0
- package/src/addons/math/powFast.ts +18 -0
- package/src/addons/math/quartic.ts +15 -0
- package/src/addons/math/quat/index.ts +14 -0
- package/src/addons/math/quat/quat2mat3.ts +28 -0
- package/src/addons/math/quat/quat2mat4.ts +16 -0
- package/src/addons/math/quat/quatAdd.ts +18 -0
- package/src/addons/math/quat/quatConj.ts +14 -0
- package/src/addons/math/quat/quatDiv.ts +18 -0
- package/src/addons/math/quat/quatIdentity.ts +9 -0
- package/src/addons/math/quat/quatInverse.ts +17 -0
- package/src/addons/math/quat/quatLength.ts +15 -0
- package/src/addons/math/quat/quatLengthSq.ts +14 -0
- package/src/addons/math/quat/quatLerp.ts +40 -0
- package/src/addons/math/quat/quatMul.ts +38 -0
- package/src/addons/math/quat/quatNeg.ts +14 -0
- package/src/addons/math/quat/quatNorm.ts +16 -0
- package/src/addons/math/quat/quatSub.ts +18 -0
- package/src/addons/math/quintic.ts +16 -0
- package/src/addons/math/rotate2d.ts +16 -0
- package/src/addons/math/rotate3d.ts +37 -0
- package/src/addons/math/rotate3dX.ts +20 -0
- package/src/addons/math/rotate3dY.ts +20 -0
- package/src/addons/math/rotate3dZ.ts +20 -0
- package/src/addons/math/rotate4d.ts +41 -0
- package/src/addons/math/rotate4dX.ts +21 -0
- package/src/addons/math/rotate4dY.ts +16 -0
- package/src/addons/math/rotate4dZ.ts +21 -0
- package/src/addons/math/saturateMediump.ts +11 -0
- package/src/addons/math/scale2d.ts +44 -0
- package/src/addons/math/scale3d.ts +17 -0
- package/src/addons/math/scale4d.ts +50 -0
- package/src/addons/math/smootherstep.ts +16 -0
- package/src/addons/math/taylorInvSqrt.ts +9 -0
- package/src/addons/math/toMat3.ts +14 -0
- package/src/addons/math/toMat4.ts +14 -0
- package/src/addons/math/translate4d.ts +31 -0
- package/src/addons/math/unpack.ts +88 -0
- package/src/addons/sdf/boxSDF.ts +24 -0
- package/src/addons/sdf/circleSDF.ts +20 -0
- package/src/addons/sdf/crossSDF.ts +17 -0
- package/src/addons/sdf/hexSDF.ts +18 -0
- package/src/addons/sdf/index.ts +7 -0
- package/src/addons/sdf/lineSDF.ts +33 -0
- package/src/addons/sdf/rectSDF.ts +46 -0
- package/src/addons/sdf/sphereSDF.ts +20 -0
- package/src/addons/sdf/triSDF.ts +14 -0
- package/src/addons/space/aspect.ts +14 -0
- package/src/addons/space/bracketing.ts +44 -0
- package/src/addons/space/brickTile.ts +44 -0
- package/src/addons/space/cart2polar.ts +20 -0
- package/src/addons/space/center.ts +32 -0
- package/src/addons/space/checkerTile.ts +41 -0
- package/src/addons/space/depth2viewZ.ts +43 -0
- package/src/addons/space/displace.ts +55 -0
- package/src/addons/space/equirect2xyz.ts +17 -0
- package/src/addons/space/eulerView.ts +19 -0
- package/src/addons/space/fisheye2xyz.ts +18 -0
- package/src/addons/space/flipY.ts +25 -0
- package/src/addons/space/hexTile.ts +18 -0
- package/src/addons/space/index.ts +38 -0
- package/src/addons/space/kaleidoscope.ts +48 -0
- package/src/addons/space/linearizeDepth.ts +17 -0
- package/src/addons/space/lookAt.ts +49 -0
- package/src/addons/space/lookAtView.ts +40 -0
- package/src/addons/space/mirrorTile.ts +73 -0
- package/src/addons/space/nearest.ts +13 -0
- package/src/addons/space/orthographic.ts +25 -0
- package/src/addons/space/parallaxMapping.ts +149 -0
- package/src/addons/space/perspective.ts +24 -0
- package/src/addons/space/polar2cart.ts +24 -0
- package/src/addons/space/ratio.ts +14 -0
- package/src/addons/space/rotate.ts +37 -0
- package/src/addons/space/rotateX.ts +54 -0
- package/src/addons/space/rotateY.ts +54 -0
- package/src/addons/space/rotateZ.ts +54 -0
- package/src/addons/space/scale.ts +13 -0
- package/src/addons/space/sprite.ts +16 -0
- package/src/addons/space/sqTile.ts +20 -0
- package/src/addons/space/tbn.ts +26 -0
- package/src/addons/space/translate.ts +12 -0
- package/src/addons/space/triTile.ts +32 -0
- package/src/addons/space/uncenter.ts +32 -0
- package/src/addons/space/unratio.ts +12 -0
- package/src/addons/space/viewZ2depth.ts +25 -0
- package/src/addons/space/windmillTile.ts +58 -0
- package/src/addons/space/xyz2equirect.ts +10 -0
- package/src/index.ts +10 -23
- package/src/node/build.ts +127 -0
- package/src/node/create.ts +76 -0
- package/src/node/index.ts +64 -49
- package/src/node/scope.ts +66 -62
- package/src/node/types.ts +221 -187
- package/src/node/utils/const.ts +74 -13
- package/src/node/utils/index.ts +19 -14
- package/src/node/utils/infer.ts +32 -34
- package/src/node/utils/parse.ts +48 -24
- package/src/node/utils/utils.ts +52 -29
- package/src/types.ts +11 -6
- package/src/utils/helpers.ts +56 -0
- package/src/utils/pipeline.ts +24 -8
- package/src/utils/program.ts +62 -38
- package/src/{webgl.ts → utils/webgl.ts} +46 -30
- package/src/{webgpu.ts → utils/webgpu.ts} +22 -17
- package/src/node/core.ts +0 -121
- package/src/node/node.ts +0 -65
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Fn, Vec2, Vec3, Vec4, Float, max } from '../../node'
|
|
2
|
+
|
|
3
|
+
export const mmax2 = Fn(([v]: [Vec2]): Float => {
|
|
4
|
+
return max(v.x, v.y)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'mmax',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [{ name: 'v', type: 'vec2' }],
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const mmax3 = Fn(([v]: [Vec3]): Float => {
|
|
12
|
+
return max(v.x, max(v.y, v.z))
|
|
13
|
+
}).setLayout({
|
|
14
|
+
name: 'mmax',
|
|
15
|
+
type: 'float',
|
|
16
|
+
inputs: [{ name: 'v', type: 'vec3' }],
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const mmax4 = Fn(([v]: [Vec4]): Float => {
|
|
20
|
+
return max(max(v.x, v.y), max(v.z, v.w))
|
|
21
|
+
}).setLayout({
|
|
22
|
+
name: 'mmax',
|
|
23
|
+
type: 'float',
|
|
24
|
+
inputs: [{ name: 'v', type: 'vec4' }],
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const mmax = mmax4
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Fn, Vec2, Vec3, Vec4, Float, min } from '../../node'
|
|
2
|
+
|
|
3
|
+
export const mmin2 = Fn(([v]: [Vec2]): Float => {
|
|
4
|
+
return min(v.x, v.y)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'mmin',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [{ name: 'v', type: 'vec2' }],
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const mmin3 = Fn(([v]: [Vec3]): Float => {
|
|
12
|
+
return min(v.x, min(v.y, v.z))
|
|
13
|
+
}).setLayout({
|
|
14
|
+
name: 'mmin',
|
|
15
|
+
type: 'float',
|
|
16
|
+
inputs: [{ name: 'v', type: 'vec3' }],
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const mmin4 = Fn(([v]: [Vec4]): Float => {
|
|
20
|
+
return min(min(v.x, v.y), min(v.z, v.w))
|
|
21
|
+
}).setLayout({
|
|
22
|
+
name: 'mmin',
|
|
23
|
+
type: 'float',
|
|
24
|
+
inputs: [{ name: 'v', type: 'vec4' }],
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Generic mmin function - delegates to specific implementations
|
|
28
|
+
export const mmin = mmin4
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Fn, X, mix, max, step, clamp } from '../../node'
|
|
2
|
+
|
|
3
|
+
// Basic mmix function - wrapper around standard mix
|
|
4
|
+
export const mmix = Fn(([a, b, c]: [X, X, X]): X => {
|
|
5
|
+
return mix(a, b, c)
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'mmix',
|
|
8
|
+
type: 'auto',
|
|
9
|
+
inputs: [
|
|
10
|
+
{ name: 'a', type: 'auto' },
|
|
11
|
+
{ name: 'b', type: 'auto' },
|
|
12
|
+
{ name: 'c', type: 'auto' },
|
|
13
|
+
],
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
// Three-value interpolation with percentage control
|
|
17
|
+
export const mmix3 = Fn(([a, b, c, pct]: [X, X, X, X]): X => {
|
|
18
|
+
return mix(mix(a, b, pct.mul(2)), mix(b, c, max(pct, 0.5).sub(0.5).mul(2)), step(0.5, pct))
|
|
19
|
+
}).setLayout({
|
|
20
|
+
name: 'mmix3',
|
|
21
|
+
type: 'auto',
|
|
22
|
+
inputs: [
|
|
23
|
+
{ name: 'a', type: 'auto' },
|
|
24
|
+
{ name: 'b', type: 'auto' },
|
|
25
|
+
{ name: 'c', type: 'auto' },
|
|
26
|
+
{ name: 'pct', type: 'auto' },
|
|
27
|
+
],
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
// Four-value interpolation with percentage control
|
|
31
|
+
export const mmix4 = Fn(([a, b, c, d, pct]: [X, X, X, X, X]): X => {
|
|
32
|
+
return mix(
|
|
33
|
+
mix(a, b, pct.mul(3)),
|
|
34
|
+
mix(b, mix(c, d, max(pct, 0.66).sub(0.66).mul(3)), clamp(pct, 0.33, 0.66).sub(0.33).mul(3)),
|
|
35
|
+
step(0.33, pct)
|
|
36
|
+
)
|
|
37
|
+
}).setLayout({
|
|
38
|
+
name: 'mmix4',
|
|
39
|
+
type: 'auto',
|
|
40
|
+
inputs: [
|
|
41
|
+
{ name: 'a', type: 'auto' },
|
|
42
|
+
{ name: 'b', type: 'auto' },
|
|
43
|
+
{ name: 'c', type: 'auto' },
|
|
44
|
+
{ name: 'd', type: 'auto' },
|
|
45
|
+
{ name: 'pct', type: 'auto' },
|
|
46
|
+
],
|
|
47
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Fn, Vec2, X, vec4 } from '../../node'
|
|
2
|
+
|
|
3
|
+
// 2D modulo function that returns both cell coordinates and wrapped position
|
|
4
|
+
// Returns vec4(cellX, cellY, wrappedX, wrappedY)
|
|
5
|
+
export const mod2 = Fn(([p, s]: [Vec2, X]): X => {
|
|
6
|
+
const halfS = s.div(2).toVar()
|
|
7
|
+
const pShifted = p.add(halfS).toVar()
|
|
8
|
+
const c = pShifted.div(s).floor().toVar()
|
|
9
|
+
const wrapped = pShifted.mod(s).sub(halfS)
|
|
10
|
+
return vec4(c.x, c.y, wrapped.x, wrapped.y)
|
|
11
|
+
}).setLayout({
|
|
12
|
+
name: 'mod2',
|
|
13
|
+
type: 'vec4',
|
|
14
|
+
inputs: [
|
|
15
|
+
{ name: 'p', type: 'vec2' },
|
|
16
|
+
{ name: 's', type: 'auto' },
|
|
17
|
+
],
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// Utility function to extract cell coordinates from mod2 result
|
|
21
|
+
export const mod2Cell = Fn(([p, s]: [Vec2, X]): Vec2 => {
|
|
22
|
+
const result = mod2(p, s)
|
|
23
|
+
return result.xy
|
|
24
|
+
}).setLayout({
|
|
25
|
+
name: 'mod2Cell',
|
|
26
|
+
type: 'vec2',
|
|
27
|
+
inputs: [
|
|
28
|
+
{ name: 'p', type: 'vec2' },
|
|
29
|
+
{ name: 's', type: 'auto' },
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// Utility function to extract wrapped position from mod2 result
|
|
34
|
+
export const mod2Wrap = Fn(([p, s]: [Vec2, X]): Vec2 => {
|
|
35
|
+
const result = mod2(p, s)
|
|
36
|
+
return result.zw
|
|
37
|
+
}).setLayout({
|
|
38
|
+
name: 'mod2Wrap',
|
|
39
|
+
type: 'vec2',
|
|
40
|
+
inputs: [
|
|
41
|
+
{ name: 'p', type: 'vec2' },
|
|
42
|
+
{ name: 's', type: 'auto' },
|
|
43
|
+
],
|
|
44
|
+
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Fn, Float, Vec2, Vec3, Vec4, X } from '../../node'
|
|
2
|
+
|
|
3
|
+
function fun(x: Float): Float
|
|
4
|
+
function fun(x: Vec2): Vec2
|
|
5
|
+
function fun(x: Vec3): Vec3
|
|
6
|
+
function fun(x: Vec4): Vec4
|
|
7
|
+
function fun(x: X): X {
|
|
8
|
+
return x.sub(
|
|
9
|
+
x
|
|
10
|
+
.div(289)
|
|
11
|
+
.floor()
|
|
12
|
+
.mul(289)
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const mod289 = Fn(([x]: [Float]): Float => {
|
|
17
|
+
return fun(x)
|
|
18
|
+
}).setLayout({
|
|
19
|
+
name: 'mod289',
|
|
20
|
+
type: 'float',
|
|
21
|
+
inputs: [{ name: 'x', type: 'float' }],
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export const mod289Vec2 = Fn(([x]: [Vec2]): Vec2 => {
|
|
25
|
+
return fun(x)
|
|
26
|
+
}).setLayout({
|
|
27
|
+
name: 'mod289Vec2',
|
|
28
|
+
type: 'vec2',
|
|
29
|
+
inputs: [{ name: 'x', type: 'vec2' }],
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
export const mod289Vec3 = Fn(([x]: [Vec3]): Vec3 => {
|
|
33
|
+
return fun(x)
|
|
34
|
+
}).setLayout({
|
|
35
|
+
name: 'mod289Vec3',
|
|
36
|
+
type: 'vec3',
|
|
37
|
+
inputs: [{ name: 'x', type: 'vec3' }],
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export const mod289Vec4 = Fn(([x]: [Vec4]): Vec4 => {
|
|
41
|
+
return fun(x)
|
|
42
|
+
}).setLayout({
|
|
43
|
+
name: 'mod289Vec4',
|
|
44
|
+
type: 'vec4',
|
|
45
|
+
inputs: [{ name: 'x', type: 'vec4' }],
|
|
46
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fn, Int } from '../../node'
|
|
2
|
+
|
|
3
|
+
export const modi = Fn(([x, y]: [Int, Int]): Int => {
|
|
4
|
+
const xf = x.toFloat()
|
|
5
|
+
const yf = y.toFloat()
|
|
6
|
+
const quotient = xf.div(yf).floor()
|
|
7
|
+
return x.sub(quotient.mul(yf).toInt())
|
|
8
|
+
}).setLayout({
|
|
9
|
+
name: 'modi',
|
|
10
|
+
type: 'int',
|
|
11
|
+
inputs: [
|
|
12
|
+
{ name: 'x', type: 'int' },
|
|
13
|
+
{ name: 'y', type: 'int' },
|
|
14
|
+
],
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fn, Float, X, mix, smoothstep, float } from '../../node'
|
|
2
|
+
|
|
3
|
+
export const nyquist = Fn(([x, width]: [X, Float]): X => {
|
|
4
|
+
const cutoffStart = 0.25
|
|
5
|
+
const cutoffEnd = 0.75
|
|
6
|
+
const f = smoothstep(cutoffEnd, cutoffStart, width)
|
|
7
|
+
return mix(float(0.5), x, f)
|
|
8
|
+
}).setLayout({
|
|
9
|
+
name: 'nyquist',
|
|
10
|
+
type: 'auto',
|
|
11
|
+
inputs: [
|
|
12
|
+
{ name: 'x', type: 'auto' },
|
|
13
|
+
{ name: 'width', type: 'float' },
|
|
14
|
+
],
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fn, Float, Vec4, fract, vec3, vec4, float } from '../../node'
|
|
2
|
+
|
|
3
|
+
const PackUpscale = float(256.0 / 255.0)
|
|
4
|
+
const PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0)
|
|
5
|
+
const ShiftRight8 = float(1 / 256)
|
|
6
|
+
|
|
7
|
+
export const pack = Fn(([v]: [Float]): Vec4 => {
|
|
8
|
+
const r = vec4(fract(v.mul(PackFactors)), v).toVar()
|
|
9
|
+
r.yzw.assign(r.yzw.sub(r.xyz.mul(ShiftRight8)))
|
|
10
|
+
return r.mul(PackUpscale)
|
|
11
|
+
}).setLayout({
|
|
12
|
+
name: 'pack',
|
|
13
|
+
type: 'vec4',
|
|
14
|
+
inputs: [{ name: 'v', type: 'float' }],
|
|
15
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Fn, Float } from '../../node'
|
|
2
|
+
|
|
3
|
+
export const parabola = Fn(([x, k]: [Float, Float]): Float => {
|
|
4
|
+
return x.mul(4).mul(x.oneMinus()).pow(k)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'parabola',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'x', type: 'float' },
|
|
10
|
+
{ name: 'k', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fn, Float, Vec2, Vec3, Vec4, X } from '../../node'
|
|
2
|
+
import { mod289, mod289Vec2, mod289Vec3, mod289Vec4 } from './mod289'
|
|
3
|
+
|
|
4
|
+
function fun(v: Float): Float
|
|
5
|
+
function fun(v: Vec2): Vec2
|
|
6
|
+
function fun(v: Vec3): Vec3
|
|
7
|
+
function fun(v: Vec4): Vec4
|
|
8
|
+
function fun(v: X): X {
|
|
9
|
+
return v.mul(34).add(1).mul(v)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const permute = Fn(([v]: [Float]): Float => {
|
|
13
|
+
return mod289(fun(v))
|
|
14
|
+
}).setLayout({
|
|
15
|
+
name: 'permute',
|
|
16
|
+
type: 'float',
|
|
17
|
+
inputs: [{ name: 'v', type: 'float' }],
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const permuteVec2 = Fn(([v]: [Vec2]): Vec2 => {
|
|
21
|
+
return mod289Vec2(fun(v))
|
|
22
|
+
}).setLayout({
|
|
23
|
+
name: 'permuteVec2',
|
|
24
|
+
type: 'vec2',
|
|
25
|
+
inputs: [{ name: 'v', type: 'vec2' }],
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export const permuteVec3 = Fn(([v]: [Vec3]): Vec3 => {
|
|
29
|
+
return mod289Vec3(fun(v))
|
|
30
|
+
}).setLayout({
|
|
31
|
+
name: 'permuteVec3',
|
|
32
|
+
type: 'vec3',
|
|
33
|
+
inputs: [{ name: 'v', type: 'vec3' }],
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
export const permuteVec4 = Fn(([v]: [Vec4]): Vec4 => {
|
|
37
|
+
return mod289Vec4(fun(v))
|
|
38
|
+
}).setLayout({
|
|
39
|
+
name: 'permuteVec4',
|
|
40
|
+
type: 'vec4',
|
|
41
|
+
inputs: [{ name: 'v', type: 'vec4' }],
|
|
42
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fn, X } from '../../node'
|
|
2
|
+
|
|
3
|
+
// Square function - computes x^2 with quadratic energy amplification
|
|
4
|
+
export const pow2 = Fn(([v]: [X]): X => {
|
|
5
|
+
return v.mul(v)
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'pow2',
|
|
8
|
+
type: 'auto',
|
|
9
|
+
inputs: [{ name: 'v', type: 'auto' }],
|
|
10
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Fn, X } from '../../node'
|
|
2
|
+
|
|
3
|
+
export const pow7 = Fn(([x]: [X]): X => {
|
|
4
|
+
const v2 = x.mul(x).toVar('v2')
|
|
5
|
+
const v4 = v2.mul(v2).toVar('v4')
|
|
6
|
+
const v6 = v4.mul(v2).toVar('v6')
|
|
7
|
+
return v6.mul(x)
|
|
8
|
+
}).setLayout({
|
|
9
|
+
name: 'pow7',
|
|
10
|
+
type: 'auto',
|
|
11
|
+
inputs: [{ name: 'x', type: 'auto' }],
|
|
12
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Fn, X, Float, float } from '../../node'
|
|
2
|
+
|
|
3
|
+
export const powFast = Fn(([a, b]: [X, X]): X => {
|
|
4
|
+
return a.div((float(1) as any).sub(b).mul(a).add(b))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'powFast',
|
|
7
|
+
type: 'auto',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'a',
|
|
11
|
+
type: 'auto'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'b',
|
|
15
|
+
type: 'auto'
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fn, X, float } from '../../node'
|
|
2
|
+
|
|
3
|
+
export const quartic = Fn(([v]: [X]): X => {
|
|
4
|
+
const v2 = v.mul(v).toVar('v2')
|
|
5
|
+
return v2.mul((float(2) as any).sub(v2))
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'quartic',
|
|
8
|
+
type: 'auto',
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: 'v',
|
|
12
|
+
type: 'auto'
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './quat2mat3'
|
|
2
|
+
export * from './quat2mat4'
|
|
3
|
+
export * from './quatAdd'
|
|
4
|
+
export * from './quatConj'
|
|
5
|
+
export * from './quatDiv'
|
|
6
|
+
export * from './quatIdentity'
|
|
7
|
+
export * from './quatInverse'
|
|
8
|
+
export * from './quatLength'
|
|
9
|
+
export * from './quatLengthSq'
|
|
10
|
+
export * from './quatLerp'
|
|
11
|
+
export * from './quatMul'
|
|
12
|
+
export * from './quatNeg'
|
|
13
|
+
export * from './quatNorm'
|
|
14
|
+
export * from './quatSub'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Fn, Vec4, Mat3, mat3, vec3, float } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const quat2mat3 = Fn(([q]: [Vec4]): Mat3 => {
|
|
4
|
+
const qxx = q.x.mul(q.x).toVar('qxx')
|
|
5
|
+
const qyy = q.y.mul(q.y).toVar('qyy')
|
|
6
|
+
const qzz = q.z.mul(q.z).toVar('qzz')
|
|
7
|
+
const qxz = q.x.mul(q.z).toVar('qxz')
|
|
8
|
+
const qxy = q.x.mul(q.y).toVar('qxy')
|
|
9
|
+
const qyw = q.y.mul(q.w).toVar('qyw')
|
|
10
|
+
const qzw = q.z.mul(q.w).toVar('qzw')
|
|
11
|
+
const qyz = q.y.mul(q.z).toVar('qyz')
|
|
12
|
+
const qxw = q.x.mul(q.w).toVar('qxw')
|
|
13
|
+
|
|
14
|
+
return mat3(
|
|
15
|
+
vec3(float(1).sub(float(2).mul(qyy.add(qzz))), float(2).mul(qxy.sub(qzw)), float(2).mul(qxz.add(qyw))),
|
|
16
|
+
vec3(float(2).mul(qxy.add(qzw)), float(1).sub(float(2).mul(qxx.add(qzz))), float(2).mul(qyz.sub(qxw))),
|
|
17
|
+
vec3(float(2).mul(qxz.sub(qyw)), float(2).mul(qyz.add(qxw)), float(1).sub(float(2).mul(qxx.add(qyy))))
|
|
18
|
+
)
|
|
19
|
+
}).setLayout({
|
|
20
|
+
name: 'quat2mat3',
|
|
21
|
+
type: 'mat3',
|
|
22
|
+
inputs: [
|
|
23
|
+
{
|
|
24
|
+
name: 'q',
|
|
25
|
+
type: 'vec4',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Fn, Vec4, Mat4 } from '../../../node'
|
|
2
|
+
import { quat2mat3 } from './quat2mat3'
|
|
3
|
+
import { toMat4 } from '../toMat4'
|
|
4
|
+
|
|
5
|
+
export const quat2mat4 = Fn(([q]: [Vec4]): Mat4 => {
|
|
6
|
+
return toMat4(quat2mat3(q))
|
|
7
|
+
}).setLayout({
|
|
8
|
+
name: 'quat2mat4',
|
|
9
|
+
type: 'mat4',
|
|
10
|
+
inputs: [
|
|
11
|
+
{
|
|
12
|
+
name: 'q',
|
|
13
|
+
type: 'vec4',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Fn, Vec4, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const quatAdd = Fn(([a, b]: [Vec4, Vec4]): Vec4 => {
|
|
4
|
+
return vec4(a.xyz.add(b.xyz), a.w.add(b.w))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'quatAdd',
|
|
7
|
+
type: 'vec4',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'a',
|
|
11
|
+
type: 'vec4',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'b',
|
|
15
|
+
type: 'vec4',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fn, Vec4, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const quatConj = Fn(([q]: [Vec4]): Vec4 => {
|
|
4
|
+
return vec4(q.xyz.negate(), q.w)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'quatConj',
|
|
7
|
+
type: 'vec4',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'q',
|
|
11
|
+
type: 'vec4',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Fn, Vec4, Float, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const quatDiv = Fn(([q, s]: [Vec4, Float]): Vec4 => {
|
|
4
|
+
return vec4(q.xyz.div(s), q.w.div(s))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'quatDiv',
|
|
7
|
+
type: 'vec4',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'q',
|
|
11
|
+
type: 'vec4',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 's',
|
|
15
|
+
type: 'float',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fn, Vec4 } from '../../../node'
|
|
2
|
+
import { quatDiv } from './quatDiv'
|
|
3
|
+
import { quatConj } from './quatConj'
|
|
4
|
+
import { quatLengthSq } from './quatLengthSq'
|
|
5
|
+
|
|
6
|
+
export const quatInverse = Fn(([q]: [Vec4]): Vec4 => {
|
|
7
|
+
return quatDiv(quatConj(q), quatLengthSq(q))
|
|
8
|
+
}).setLayout({
|
|
9
|
+
name: 'quatInverse',
|
|
10
|
+
type: 'vec4',
|
|
11
|
+
inputs: [
|
|
12
|
+
{
|
|
13
|
+
name: 'q',
|
|
14
|
+
type: 'vec4',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fn, Vec4, Float } from '../../../node'
|
|
2
|
+
import { quatLengthSq } from './quatLengthSq'
|
|
3
|
+
|
|
4
|
+
export const quatLength = Fn(([q]: [Vec4]): Float => {
|
|
5
|
+
return quatLengthSq(q).sqrt()
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'quatLength',
|
|
8
|
+
type: 'float',
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: 'q',
|
|
12
|
+
type: 'vec4',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fn, Vec4, Float } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const quatLengthSq = Fn(([q]: [Vec4]): Float => {
|
|
4
|
+
return q.xyz.dot(q.xyz).add(q.w.mul(q.w))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'quatLengthSq',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'q',
|
|
11
|
+
type: 'vec4',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Fn, Vec4, Float, vec4, If, Return, float } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const quatLerp = Fn(([qa, qb, t]: [Vec4, Vec4, Float]): Vec4 => {
|
|
4
|
+
const cosHalfTheta = qa.w.mul(qb.w).add(qa.xyz.dot(qb.xyz)).toVar('cosHalfTheta')
|
|
5
|
+
const adjustedQb = qb.negate().select(qb, cosHalfTheta.lessThan(0)).toVar('adjustedQb')
|
|
6
|
+
const absCosHalfTheta = cosHalfTheta.abs().toVar('absCosHalfTheta')
|
|
7
|
+
|
|
8
|
+
If(absCosHalfTheta.greaterThanEqual(1), () => {
|
|
9
|
+
Return(qa)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const halfTheta = absCosHalfTheta.acos().toVar('halfTheta')
|
|
13
|
+
const sinHalfTheta = float(1).sub(absCosHalfTheta.mul(absCosHalfTheta)).sqrt().toVar('sinHalfTheta')
|
|
14
|
+
|
|
15
|
+
If(sinHalfTheta.abs().lessThan(0.001), () => {
|
|
16
|
+
Return(qa.div(2).add(adjustedQb.div(2)).normalize())
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const ratioA = float(1).sub(t).mul(halfTheta).sin().div(sinHalfTheta).toVar('ratioA')
|
|
20
|
+
const ratioB = t.mul(halfTheta).sin().div(sinHalfTheta).toVar('ratioB')
|
|
21
|
+
|
|
22
|
+
return qa.mul(ratioA).add(adjustedQb.mul(ratioB)).normalize()
|
|
23
|
+
}).setLayout({
|
|
24
|
+
name: 'quatLerp',
|
|
25
|
+
type: 'vec4',
|
|
26
|
+
inputs: [
|
|
27
|
+
{
|
|
28
|
+
name: 'qa',
|
|
29
|
+
type: 'vec4',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'qb',
|
|
33
|
+
type: 'vec4',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 't',
|
|
37
|
+
type: 'float',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Fn, Vec4, Float, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const quatMul = Fn(([q1, q2]: [Vec4, Vec4]): Vec4 => {
|
|
4
|
+
return vec4(
|
|
5
|
+
q2.xyz.mul(q1.w).add(q1.xyz.mul(q2.w)).add(q1.xyz.cross(q2.xyz)),
|
|
6
|
+
q1.w.mul(q2.w).sub(q1.xyz.dot(q2.xyz))
|
|
7
|
+
)
|
|
8
|
+
}).setLayout({
|
|
9
|
+
name: 'quatMul',
|
|
10
|
+
type: 'vec4',
|
|
11
|
+
inputs: [
|
|
12
|
+
{
|
|
13
|
+
name: 'q1',
|
|
14
|
+
type: 'vec4',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'q2',
|
|
18
|
+
type: 'vec4',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const quatMulScalar = Fn(([q, s]: [Vec4, Float]): Vec4 => {
|
|
24
|
+
return vec4(q.xyz.mul(s), q.w.mul(s))
|
|
25
|
+
}).setLayout({
|
|
26
|
+
name: 'quatMulScalar',
|
|
27
|
+
type: 'vec4',
|
|
28
|
+
inputs: [
|
|
29
|
+
{
|
|
30
|
+
name: 'q',
|
|
31
|
+
type: 'vec4',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 's',
|
|
35
|
+
type: 'float',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fn, Vec4, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const quatNeg = Fn(([q]: [Vec4]): Vec4 => {
|
|
4
|
+
return vec4(q.xyz.negate(), q.w.negate())
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'quatNeg',
|
|
7
|
+
type: 'vec4',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'q',
|
|
11
|
+
type: 'vec4',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|