glre 0.41.0 → 0.43.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/dist/addons.cjs +1 -1
- package/dist/addons.cjs.map +1 -1
- package/dist/addons.d.ts +379 -7
- package/dist/addons.js +1 -1
- package/dist/addons.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +3 -0
- package/dist/node.cjs +12 -12
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +2 -1
- package/dist/node.js +12 -12
- package/dist/node.js.map +1 -1
- package/dist/react.d.ts +2 -0
- package/dist/solid.d.ts +2 -0
- package/package.json +1 -1
- package/src/addons/color/blend/add.ts +35 -0
- package/src/addons/color/blend/average.ts +35 -0
- package/src/addons/color/blend/color.ts +28 -0
- package/src/addons/color/blend/colorBurn.ts +35 -0
- package/src/addons/color/blend/colorDodge.ts +39 -0
- package/src/addons/color/blend/darken.ts +35 -0
- package/src/addons/color/blend/difference.ts +35 -0
- package/src/addons/color/blend/exclusion.ts +35 -0
- package/src/addons/color/blend/glow.ts +36 -0
- package/src/addons/color/blend/hardLight.ts +36 -0
- package/src/addons/color/blend/hardMix.ts +39 -0
- package/src/addons/color/blend/hue.ts +29 -0
- package/src/addons/color/blend/index.ts +28 -0
- package/src/addons/color/blend/lighten.ts +35 -0
- package/src/addons/color/blend/linearBurn.ts +39 -0
- package/src/addons/color/blend/linearDodge.ts +39 -0
- package/src/addons/color/blend/linearLight.ts +44 -0
- package/src/addons/color/blend/luminosity.ts +28 -0
- package/src/addons/color/blend/multiply.ts +35 -0
- package/src/addons/color/blend/negation.ts +35 -0
- package/src/addons/color/blend/overlay.ts +38 -0
- package/src/addons/color/blend/phoenix.ts +35 -0
- package/src/addons/color/blend/pinLight.ts +40 -0
- package/src/addons/color/blend/reflect.ts +35 -0
- package/src/addons/color/blend/saturation.ts +28 -0
- package/src/addons/color/blend/screen.ts +39 -0
- package/src/addons/color/blend/softLight.ts +63 -0
- package/src/addons/color/blend/subtract.ts +37 -0
- package/src/addons/color/blend/vividLight.ts +44 -0
- package/src/addons/color/composite/compositeXor.ts +40 -0
- package/src/addons/color/composite/destinationAtop.ts +42 -0
- package/src/addons/color/composite/destinationIn.ts +42 -0
- package/src/addons/color/composite/destinationOut.ts +42 -0
- package/src/addons/color/composite/destinationOver.ts +42 -0
- package/src/addons/color/composite/index.ts +9 -0
- package/src/addons/color/composite/sourceAtop.ts +42 -0
- package/src/addons/color/composite/sourceIn.ts +40 -0
- package/src/addons/color/composite/sourceOut.ts +40 -0
- package/src/addons/color/composite/sourceOver.ts +40 -0
- package/src/addons/color/palette/macbeth.ts +31 -33
- package/src/addons/draw/arrows.ts +34 -48
- package/src/addons/draw/axis.ts +24 -42
- package/src/addons/draw/bridge.ts +4 -4
- package/src/addons/draw/char.ts +235 -18
- package/src/addons/draw/circle.ts +22 -1
- package/src/addons/draw/colorChecker.ts +42 -0
- package/src/addons/draw/colorPicker.ts +66 -0
- package/src/addons/draw/digits.ts +334 -0
- package/src/addons/draw/index.ts +4 -0
- package/src/addons/draw/matrix.ts +26 -0
- package/src/addons/draw/point.ts +24 -11
- package/src/addons/geometry/triangle/closestPoint.ts +7 -7
- package/src/addons/index.ts +3 -0
- package/src/addons/math/const.ts +4 -4
- package/src/addons/math/mod289.ts +1 -6
- package/src/addons/math/powFast.ts +4 -10
- package/src/addons/math/quartic.ts +6 -11
- package/src/addons/math/quat/quatLerp.ts +3 -3
- package/src/addons/math/quintic.ts +7 -12
- package/src/addons/math/rotate2d.ts +1 -6
- package/src/addons/math/rotate3d.ts +4 -10
- package/src/addons/math/rotate3dX.ts +3 -12
- package/src/addons/math/rotate3dY.ts +3 -12
- package/src/addons/math/rotate3dZ.ts +3 -12
- package/src/addons/math/rotate4d.ts +4 -10
- package/src/addons/math/rotate4dX.ts +3 -13
- package/src/addons/math/rotate4dY.ts +1 -6
- package/src/addons/math/rotate4dZ.ts +3 -13
- package/src/addons/math/scale2d.ts +16 -32
- package/src/addons/math/toMat3.ts +1 -6
- package/src/addons/math/toMat4.ts +1 -6
- package/src/addons/sdf/arrowSDF.ts +61 -0
- package/src/addons/sdf/boxFrameSDF.ts +31 -0
- package/src/addons/sdf/boxSDF.ts +4 -6
- package/src/addons/sdf/capsuleSDF.ts +17 -0
- package/src/addons/sdf/coneSDF.ts +60 -0
- package/src/addons/sdf/crossSDF.ts +4 -7
- package/src/addons/sdf/cubeSDF.ts +13 -0
- package/src/addons/sdf/cylinderSDF.ts +65 -0
- package/src/addons/sdf/dodecahedronSDF.ts +32 -0
- package/src/addons/sdf/ellipsoidSDF.ts +14 -0
- package/src/addons/sdf/flowerSDF.ts +16 -0
- package/src/addons/sdf/gearSDF.ts +22 -0
- package/src/addons/sdf/heartSDF.ts +17 -0
- package/src/addons/sdf/hexPrismSDF.ts +15 -0
- package/src/addons/sdf/hexSDF.ts +8 -15
- package/src/addons/sdf/icosahedronSDF.ts +23 -0
- package/src/addons/sdf/index.ts +41 -0
- package/src/addons/sdf/juliaSDF.ts +39 -0
- package/src/addons/sdf/kochSDF.ts +49 -0
- package/src/addons/sdf/linkSDF.ts +15 -0
- package/src/addons/sdf/mandelbulbSDF.ts +41 -0
- package/src/addons/sdf/octahedronSDF.ts +30 -0
- package/src/addons/sdf/octogonPrismSDF.ts +19 -0
- package/src/addons/sdf/opElongate.ts +35 -0
- package/src/addons/sdf/opExtrude.ts +14 -0
- package/src/addons/sdf/opIntersection.ts +25 -0
- package/src/addons/sdf/opOnion.ts +12 -0
- package/src/addons/sdf/opRepeat.ts +49 -0
- package/src/addons/sdf/opRevolve.ts +12 -0
- package/src/addons/sdf/opRound.ts +12 -0
- package/src/addons/sdf/opSubtraction.ts +50 -0
- package/src/addons/sdf/opUnion.ts +39 -0
- package/src/addons/sdf/planeSDF.ts +21 -0
- package/src/addons/sdf/polySDF.ts +32 -0
- package/src/addons/sdf/pyramidSDF.ts +29 -0
- package/src/addons/sdf/raysSDF.ts +14 -0
- package/src/addons/sdf/rhombSDF.ts +10 -0
- package/src/addons/sdf/spiralSDF.ts +15 -0
- package/src/addons/sdf/starSDF.ts +47 -0
- package/src/addons/sdf/superShapeSDF.ts +73 -0
- package/src/addons/sdf/tetrahedronSDF.ts +21 -0
- package/src/addons/sdf/torusSDF.ts +27 -0
- package/src/addons/sdf/triPrismSDF.ts +13 -0
- package/src/addons/sdf/triSDF.ts +19 -11
- package/src/addons/sdf/vesicaSDF.ts +23 -0
- package/src/addons/space/bracketing.ts +1 -2
- package/src/addons/space/kaleidoscope.ts +1 -2
- package/src/addons/space/scale.ts +42 -7
- package/src/addons/space/windmillTile.ts +2 -1
- package/src/index.ts +1 -0
- package/src/node/create.ts +2 -3
- package/src/node/utils/index.ts +2 -2
- package/src/types.ts +1 -0
- package/src/utils/webgl.ts +7 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Fn, Vec3, Float, vec3 } from '../../../node'
|
|
2
|
+
import { rgb2hsv } from '../space/rgb2hsv'
|
|
3
|
+
import { hsv2rgb } from '../space/hsv2rgb'
|
|
4
|
+
|
|
5
|
+
export const blendLuminosity = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
6
|
+
const baseHSV = rgb2hsv(base)
|
|
7
|
+
const blendHSV = rgb2hsv(blend)
|
|
8
|
+
return hsv2rgb(vec3(baseHSV.x, baseHSV.y, blendHSV.z))
|
|
9
|
+
}).setLayout({
|
|
10
|
+
name: 'blendLuminosity',
|
|
11
|
+
type: 'vec3',
|
|
12
|
+
inputs: [
|
|
13
|
+
{ name: 'base', type: 'vec3' },
|
|
14
|
+
{ name: 'blend', type: 'vec3' },
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const blendLuminosityOpacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
19
|
+
return blendLuminosity(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
20
|
+
}).setLayout({
|
|
21
|
+
name: 'blendLuminosityOpacity',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'base', type: 'vec3' },
|
|
25
|
+
{ name: 'blend', type: 'vec3' },
|
|
26
|
+
{ name: 'opacity', type: 'float' },
|
|
27
|
+
],
|
|
28
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Fn, Float, Vec3 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendMultiply = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return base.mul(blend)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendMultiply',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendMultiplyVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return base.mul(blend)
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendMultiplyVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendMultiplyVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendMultiplyVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendMultiplyVec3Opacity',
|
|
29
|
+
type: 'vec3',
|
|
30
|
+
inputs: [
|
|
31
|
+
{ name: 'base', type: 'vec3' },
|
|
32
|
+
{ name: 'blend', type: 'vec3' },
|
|
33
|
+
{ name: 'opacity', type: 'float' },
|
|
34
|
+
],
|
|
35
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, abs, float } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendNegation = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return float(1).sub(abs(float(1).sub(base).sub(blend)))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendNegation',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendNegationVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(1).sub(abs(vec3(1).sub(base).sub(blend)))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendNegationVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendNegationVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendNegationVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendNegationVec3Opacity',
|
|
29
|
+
type: 'vec3',
|
|
30
|
+
inputs: [
|
|
31
|
+
{ name: 'base', type: 'vec3' },
|
|
32
|
+
{ name: 'blend', type: 'vec3' },
|
|
33
|
+
{ name: 'opacity', type: 'float' },
|
|
34
|
+
],
|
|
35
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, If } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendOverlay = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
If(base.lessThan(0.5), () => {
|
|
5
|
+
return base.mul(blend).mul(2)
|
|
6
|
+
})
|
|
7
|
+
return base.oneMinus().mul(blend.oneMinus()).mul(2).oneMinus()
|
|
8
|
+
}).setLayout({
|
|
9
|
+
name: 'blendOverlay',
|
|
10
|
+
type: 'float',
|
|
11
|
+
inputs: [
|
|
12
|
+
{ name: 'base', type: 'float' },
|
|
13
|
+
{ name: 'blend', type: 'float' },
|
|
14
|
+
],
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const blendOverlayVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
18
|
+
return vec3(blendOverlay(base.r, blend.r), blendOverlay(base.g, blend.g), blendOverlay(base.b, blend.b))
|
|
19
|
+
}).setLayout({
|
|
20
|
+
name: 'blendOverlayVec3',
|
|
21
|
+
type: 'vec3',
|
|
22
|
+
inputs: [
|
|
23
|
+
{ name: 'base', type: 'vec3' },
|
|
24
|
+
{ name: 'blend', type: 'vec3' },
|
|
25
|
+
],
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export const blendOverlayVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
29
|
+
return blendOverlayVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
30
|
+
}).setLayout({
|
|
31
|
+
name: 'blendOverlayVec3Opacity',
|
|
32
|
+
type: 'vec3',
|
|
33
|
+
inputs: [
|
|
34
|
+
{ name: 'base', type: 'vec3' },
|
|
35
|
+
{ name: 'blend', type: 'vec3' },
|
|
36
|
+
{ name: 'opacity', type: 'float' },
|
|
37
|
+
],
|
|
38
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, min, max, float } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendPhoenix = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return min(base, blend).sub(max(base, blend)).add(float(1))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendPhoenix',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendPhoenixVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return min(base, blend).sub(max(base, blend)).add(vec3(1))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendPhoenixVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendPhoenixVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendPhoenixVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendPhoenixVec3Opacity',
|
|
29
|
+
type: 'vec3',
|
|
30
|
+
inputs: [
|
|
31
|
+
{ name: 'base', type: 'vec3' },
|
|
32
|
+
{ name: 'blend', type: 'vec3' },
|
|
33
|
+
{ name: 'opacity', type: 'float' },
|
|
34
|
+
],
|
|
35
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, If } from '../../../node'
|
|
2
|
+
import { blendDarken } from './darken'
|
|
3
|
+
import { blendLighten } from './lighten'
|
|
4
|
+
|
|
5
|
+
export const blendPinLight = Fn(([base, blend]: [Float, Float]): Float => {
|
|
6
|
+
If(blend.lessThan(0.5), () => {
|
|
7
|
+
return blendDarken(base, blend.mul(2))
|
|
8
|
+
})
|
|
9
|
+
return blendLighten(base, blend.sub(0.5).mul(2))
|
|
10
|
+
}).setLayout({
|
|
11
|
+
name: 'blendPinLight',
|
|
12
|
+
type: 'float',
|
|
13
|
+
inputs: [
|
|
14
|
+
{ name: 'base', type: 'float' },
|
|
15
|
+
{ name: 'blend', type: 'float' },
|
|
16
|
+
],
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const blendPinLightVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
20
|
+
return vec3(blendPinLight(base.x, blend.x), blendPinLight(base.y, blend.y), blendPinLight(base.z, blend.z))
|
|
21
|
+
}).setLayout({
|
|
22
|
+
name: 'blendPinLightVec3',
|
|
23
|
+
type: 'vec3',
|
|
24
|
+
inputs: [
|
|
25
|
+
{ name: 'base', type: 'vec3' },
|
|
26
|
+
{ name: 'blend', type: 'vec3' },
|
|
27
|
+
],
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
export const blendPinLightVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
31
|
+
return blendPinLightVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
32
|
+
}).setLayout({
|
|
33
|
+
name: 'blendPinLightVec3Opacity',
|
|
34
|
+
type: 'vec3',
|
|
35
|
+
inputs: [
|
|
36
|
+
{ name: 'base', type: 'vec3' },
|
|
37
|
+
{ name: 'blend', type: 'vec3' },
|
|
38
|
+
{ name: 'opacity', type: 'float' },
|
|
39
|
+
],
|
|
40
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, min, select } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendReflect = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return select(blend, min(base.mul(base).div(blend.oneMinus()), 1), blend.equal(1))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendReflect',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendReflectVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(blendReflect(base.r, blend.r), blendReflect(base.g, blend.g), blendReflect(base.b, blend.b))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendReflectVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendReflectVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendReflectVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendReflectVec3Opacity',
|
|
29
|
+
type: 'vec3',
|
|
30
|
+
inputs: [
|
|
31
|
+
{ name: 'base', type: 'vec3' },
|
|
32
|
+
{ name: 'blend', type: 'vec3' },
|
|
33
|
+
{ name: 'opacity', type: 'float' },
|
|
34
|
+
],
|
|
35
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Fn, Vec3, Float, vec3 } from '../../../node'
|
|
2
|
+
import { rgb2hsv } from '../space/rgb2hsv'
|
|
3
|
+
import { hsv2rgb } from '../space/hsv2rgb'
|
|
4
|
+
|
|
5
|
+
export const blendSaturation = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
6
|
+
const baseHSV = rgb2hsv(base)
|
|
7
|
+
const blendHSV = rgb2hsv(blend)
|
|
8
|
+
return hsv2rgb(vec3(baseHSV.x, blendHSV.y, baseHSV.z))
|
|
9
|
+
}).setLayout({
|
|
10
|
+
name: 'blendSaturation',
|
|
11
|
+
type: 'vec3',
|
|
12
|
+
inputs: [
|
|
13
|
+
{ name: 'base', type: 'vec3' },
|
|
14
|
+
{ name: 'blend', type: 'vec3' },
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const blendSaturationOpacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
19
|
+
return blendSaturation(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
20
|
+
}).setLayout({
|
|
21
|
+
name: 'blendSaturationOpacity',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'base', type: 'vec3' },
|
|
25
|
+
{ name: 'blend', type: 'vec3' },
|
|
26
|
+
{ name: 'opacity', type: 'float' },
|
|
27
|
+
],
|
|
28
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, float } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendScreenFloat = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return float(1).sub(float(1).sub(base).mul(float(1).sub(blend)))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendScreenFloat',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendScreen = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(
|
|
16
|
+
blendScreenFloat(base.x, blend.x),
|
|
17
|
+
blendScreenFloat(base.y, blend.y),
|
|
18
|
+
blendScreenFloat(base.z, blend.z)
|
|
19
|
+
)
|
|
20
|
+
}).setLayout({
|
|
21
|
+
name: 'blendScreen',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'base', type: 'vec3' },
|
|
25
|
+
{ name: 'blend', type: 'vec3' },
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const blendScreenOpacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
30
|
+
return blendScreen(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
31
|
+
}).setLayout({
|
|
32
|
+
name: 'blendScreenOpacity',
|
|
33
|
+
type: 'vec3',
|
|
34
|
+
inputs: [
|
|
35
|
+
{ name: 'base', type: 'vec3' },
|
|
36
|
+
{ name: 'blend', type: 'vec3' },
|
|
37
|
+
{ name: 'opacity', type: 'float' },
|
|
38
|
+
],
|
|
39
|
+
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, Vec4, If, sqrt, vec3, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
const blendSoftLightFloat = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
If(blend.lessThan(0.5), () => {
|
|
5
|
+
return base
|
|
6
|
+
.mul(2)
|
|
7
|
+
.mul(blend)
|
|
8
|
+
.add(base.mul(base).mul(blend.mul(2).oneMinus()))
|
|
9
|
+
})
|
|
10
|
+
return sqrt(base).mul(blend.mul(2).sub(1)).add(base.mul(2).mul(blend.oneMinus()))
|
|
11
|
+
}).setLayout({
|
|
12
|
+
name: 'blendSoftLight',
|
|
13
|
+
type: 'float',
|
|
14
|
+
inputs: [
|
|
15
|
+
{ name: 'base', type: 'float' },
|
|
16
|
+
{ name: 'blend', type: 'float' },
|
|
17
|
+
],
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const blendSoftLight = blendSoftLightFloat
|
|
21
|
+
|
|
22
|
+
export const blendSoftLightVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
23
|
+
return vec3(
|
|
24
|
+
blendSoftLightFloat(base.r, blend.r),
|
|
25
|
+
blendSoftLightFloat(base.g, blend.g),
|
|
26
|
+
blendSoftLightFloat(base.b, blend.b)
|
|
27
|
+
)
|
|
28
|
+
}).setLayout({
|
|
29
|
+
name: 'blendSoftLightVec3',
|
|
30
|
+
type: 'vec3',
|
|
31
|
+
inputs: [
|
|
32
|
+
{ name: 'base', type: 'vec3' },
|
|
33
|
+
{ name: 'blend', type: 'vec3' },
|
|
34
|
+
],
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export const blendSoftLightVec4 = Fn(([base, blend]: [Vec4, Vec4]): Vec4 => {
|
|
38
|
+
return vec4(
|
|
39
|
+
blendSoftLightFloat(base.r, blend.r),
|
|
40
|
+
blendSoftLightFloat(base.g, blend.g),
|
|
41
|
+
blendSoftLightFloat(base.b, blend.b),
|
|
42
|
+
blendSoftLightFloat(base.a, blend.a)
|
|
43
|
+
)
|
|
44
|
+
}).setLayout({
|
|
45
|
+
name: 'blendSoftLightVec4',
|
|
46
|
+
type: 'vec4',
|
|
47
|
+
inputs: [
|
|
48
|
+
{ name: 'base', type: 'vec4' },
|
|
49
|
+
{ name: 'blend', type: 'vec4' },
|
|
50
|
+
],
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export const blendSoftLightVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
54
|
+
return blendSoftLightVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
55
|
+
}).setLayout({
|
|
56
|
+
name: 'blendSoftLightVec3Opacity',
|
|
57
|
+
type: 'vec3',
|
|
58
|
+
inputs: [
|
|
59
|
+
{ name: 'base', type: 'vec3' },
|
|
60
|
+
{ name: 'blend', type: 'vec3' },
|
|
61
|
+
{ name: 'opacity', type: 'float' },
|
|
62
|
+
],
|
|
63
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, max, vec3 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
const blendSubtractFloat = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return max(base.add(blend).sub(1), 0)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendSubtract',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' }
|
|
11
|
+
]
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendSubtract = blendSubtractFloat
|
|
15
|
+
|
|
16
|
+
export const blendSubtractVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
17
|
+
return max(base.add(blend).sub(vec3(1)), vec3(0))
|
|
18
|
+
}).setLayout({
|
|
19
|
+
name: 'blendSubtractVec3',
|
|
20
|
+
type: 'vec3',
|
|
21
|
+
inputs: [
|
|
22
|
+
{ name: 'base', type: 'vec3' },
|
|
23
|
+
{ name: 'blend', type: 'vec3' }
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const blendSubtractVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
28
|
+
return blendSubtractVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
29
|
+
}).setLayout({
|
|
30
|
+
name: 'blendSubtractVec3Opacity',
|
|
31
|
+
type: 'vec3',
|
|
32
|
+
inputs: [
|
|
33
|
+
{ name: 'base', type: 'vec3' },
|
|
34
|
+
{ name: 'blend', type: 'vec3' },
|
|
35
|
+
{ name: 'opacity', type: 'float' }
|
|
36
|
+
]
|
|
37
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, If } from '../../../node'
|
|
2
|
+
import { blendColorBurn } from './colorBurn'
|
|
3
|
+
import { blendColorDodge } from './colorDodge'
|
|
4
|
+
|
|
5
|
+
export const blendVividLight = Fn(([base, blend]: [Float, Float]): Float => {
|
|
6
|
+
If(blend.lessThan(0.5), () => {
|
|
7
|
+
return blendColorBurn(base, blend.mul(2))
|
|
8
|
+
})
|
|
9
|
+
return blendColorDodge(base, blend.sub(0.5).mul(2))
|
|
10
|
+
}).setLayout({
|
|
11
|
+
name: 'blendVividLight',
|
|
12
|
+
type: 'float',
|
|
13
|
+
inputs: [
|
|
14
|
+
{ name: 'base', type: 'float' },
|
|
15
|
+
{ name: 'blend', type: 'float' },
|
|
16
|
+
],
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const blendVividLightVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
20
|
+
return vec3(
|
|
21
|
+
blendVividLight(base.r, blend.r),
|
|
22
|
+
blendVividLight(base.g, blend.g),
|
|
23
|
+
blendVividLight(base.b, blend.b)
|
|
24
|
+
)
|
|
25
|
+
}).setLayout({
|
|
26
|
+
name: 'blendVividLightVec3',
|
|
27
|
+
type: 'vec3',
|
|
28
|
+
inputs: [
|
|
29
|
+
{ name: 'base', type: 'vec3' },
|
|
30
|
+
{ name: 'blend', type: 'vec3' },
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export const blendVividLightVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
35
|
+
return blendVividLightVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
36
|
+
}).setLayout({
|
|
37
|
+
name: 'blendVividLightVec3Opacity',
|
|
38
|
+
type: 'vec3',
|
|
39
|
+
inputs: [
|
|
40
|
+
{ name: 'base', type: 'vec3' },
|
|
41
|
+
{ name: 'blend', type: 'vec3' },
|
|
42
|
+
{ name: 'opacity', type: 'float' },
|
|
43
|
+
],
|
|
44
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, Vec4, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
const compositeXorFloat = Fn(([src, dst]: [Float, Float]): Float => {
|
|
4
|
+
return src.mul(dst.oneMinus()).add(dst.mul(src.oneMinus()))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'compositeXor',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'src', type: 'float' },
|
|
10
|
+
{ name: 'dst', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const compositeXor = compositeXorFloat
|
|
15
|
+
|
|
16
|
+
export const compositeXorVec3 = Fn(([srcColor, dstColor, srcAlpha, dstAlpha]: [Vec3, Vec3, Float, Float]): Vec3 => {
|
|
17
|
+
return srcColor.mul(dstAlpha.oneMinus()).add(dstColor.mul(srcAlpha.oneMinus()))
|
|
18
|
+
}).setLayout({
|
|
19
|
+
name: 'compositeXorVec3',
|
|
20
|
+
type: 'vec3',
|
|
21
|
+
inputs: [
|
|
22
|
+
{ name: 'srcColor', type: 'vec3' },
|
|
23
|
+
{ name: 'dstColor', type: 'vec3' },
|
|
24
|
+
{ name: 'srcAlpha', type: 'float' },
|
|
25
|
+
{ name: 'dstAlpha', type: 'float' },
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const compositeXorVec4 = Fn(([srcColor, dstColor]: [Vec4, Vec4]): Vec4 => {
|
|
30
|
+
const resultRgb = compositeXorVec3(srcColor.rgb, dstColor.rgb, srcColor.a, dstColor.a)
|
|
31
|
+
const resultA = compositeXorFloat(srcColor.a, dstColor.a)
|
|
32
|
+
return vec4(resultRgb, resultA)
|
|
33
|
+
}).setLayout({
|
|
34
|
+
name: 'compositeXorVec4',
|
|
35
|
+
type: 'vec4',
|
|
36
|
+
inputs: [
|
|
37
|
+
{ name: 'srcColor', type: 'vec4' },
|
|
38
|
+
{ name: 'dstColor', type: 'vec4' },
|
|
39
|
+
],
|
|
40
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, Vec4, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
const compositeDestinationAtopFloat = Fn(([src, dst]: [Float, Float]): Float => {
|
|
4
|
+
return dst.mul(src).add(src.mul(dst.oneMinus()))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'compositeDestinationAtop',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'src', type: 'float' },
|
|
10
|
+
{ name: 'dst', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const compositeDestinationAtop = compositeDestinationAtopFloat
|
|
15
|
+
|
|
16
|
+
export const compositeDestinationAtopVec3 = Fn(
|
|
17
|
+
([srcColor, dstColor, srcAlpha, dstAlpha]: [Vec3, Vec3, Float, Float]): Vec3 => {
|
|
18
|
+
return dstColor.mul(srcAlpha).add(srcColor.mul(dstAlpha.oneMinus()))
|
|
19
|
+
}
|
|
20
|
+
).setLayout({
|
|
21
|
+
name: 'compositeDestinationAtopVec3',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'srcColor', type: 'vec3' },
|
|
25
|
+
{ name: 'dstColor', type: 'vec3' },
|
|
26
|
+
{ name: 'srcAlpha', type: 'float' },
|
|
27
|
+
{ name: 'dstAlpha', type: 'float' },
|
|
28
|
+
],
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export const compositeDestinationAtopVec4 = Fn(([srcColor, dstColor]: [Vec4, Vec4]): Vec4 => {
|
|
32
|
+
const resultRgb = compositeDestinationAtopVec3(srcColor.rgb, dstColor.rgb, srcColor.a, dstColor.a)
|
|
33
|
+
const resultA = compositeDestinationAtopFloat(srcColor.a, dstColor.a)
|
|
34
|
+
return vec4(resultRgb, resultA)
|
|
35
|
+
}).setLayout({
|
|
36
|
+
name: 'compositeDestinationAtopVec4',
|
|
37
|
+
type: 'vec4',
|
|
38
|
+
inputs: [
|
|
39
|
+
{ name: 'srcColor', type: 'vec4' },
|
|
40
|
+
{ name: 'dstColor', type: 'vec4' },
|
|
41
|
+
],
|
|
42
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, Vec4, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
const compositeDestinationInFloat = Fn(([src, dst]: [Float, Float]): Float => {
|
|
4
|
+
return dst.mul(src)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'compositeDestinationIn',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'src', type: 'float' },
|
|
10
|
+
{ name: 'dst', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const compositeDestinationIn = compositeDestinationInFloat
|
|
15
|
+
|
|
16
|
+
export const compositeDestinationInVec3 = Fn(
|
|
17
|
+
([srcColor, dstColor, srcAlpha, dstAlpha]: [Vec3, Vec3, Float, Float]): Vec3 => {
|
|
18
|
+
return dstColor.mul(srcAlpha)
|
|
19
|
+
}
|
|
20
|
+
).setLayout({
|
|
21
|
+
name: 'compositeDestinationInVec3',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'srcColor', type: 'vec3' },
|
|
25
|
+
{ name: 'dstColor', type: 'vec3' },
|
|
26
|
+
{ name: 'srcAlpha', type: 'float' },
|
|
27
|
+
{ name: 'dstAlpha', type: 'float' },
|
|
28
|
+
],
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export const compositeDestinationInVec4 = Fn(([srcColor, dstColor]: [Vec4, Vec4]): Vec4 => {
|
|
32
|
+
const resultRgb = compositeDestinationInVec3(srcColor.rgb, dstColor.rgb, srcColor.a, dstColor.a)
|
|
33
|
+
const resultA = compositeDestinationInFloat(srcColor.a, dstColor.a)
|
|
34
|
+
return vec4(resultRgb, resultA)
|
|
35
|
+
}).setLayout({
|
|
36
|
+
name: 'compositeDestinationInVec4',
|
|
37
|
+
type: 'vec4',
|
|
38
|
+
inputs: [
|
|
39
|
+
{ name: 'srcColor', type: 'vec4' },
|
|
40
|
+
{ name: 'dstColor', type: 'vec4' },
|
|
41
|
+
],
|
|
42
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, Vec4, vec4 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
const compositeDestinationOutFloat = Fn(([src, dst]: [Float, Float]): Float => {
|
|
4
|
+
return dst.mul(src.oneMinus())
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'compositeDestinationOut',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'src', type: 'float' },
|
|
10
|
+
{ name: 'dst', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const compositeDestinationOut = compositeDestinationOutFloat
|
|
15
|
+
|
|
16
|
+
export const compositeDestinationOutVec3 = Fn(
|
|
17
|
+
([_srcColor, dstColor, srcAlpha, _dstAlpha]: [Vec3, Vec3, Float, Float]): Vec3 => {
|
|
18
|
+
return dstColor.mul(srcAlpha.oneMinus())
|
|
19
|
+
}
|
|
20
|
+
).setLayout({
|
|
21
|
+
name: 'compositeDestinationOutVec3',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'srcColor', type: 'vec3' },
|
|
25
|
+
{ name: 'dstColor', type: 'vec3' },
|
|
26
|
+
{ name: 'srcAlpha', type: 'float' },
|
|
27
|
+
{ name: 'dstAlpha', type: 'float' },
|
|
28
|
+
],
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export const compositeDestinationOutVec4 = Fn(([srcColor, dstColor]: [Vec4, Vec4]): Vec4 => {
|
|
32
|
+
const resultRgb = compositeDestinationOutVec3(srcColor.rgb, dstColor.rgb, srcColor.a, dstColor.a)
|
|
33
|
+
const resultA = compositeDestinationOutFloat(srcColor.a, dstColor.a)
|
|
34
|
+
return vec4(resultRgb, resultA)
|
|
35
|
+
}).setLayout({
|
|
36
|
+
name: 'compositeDestinationOutVec4',
|
|
37
|
+
type: 'vec4',
|
|
38
|
+
inputs: [
|
|
39
|
+
{ name: 'srcColor', type: 'vec4' },
|
|
40
|
+
{ name: 'dstColor', type: 'vec4' },
|
|
41
|
+
],
|
|
42
|
+
})
|