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
package/dist/react.d.ts
CHANGED
|
@@ -341,6 +341,7 @@ type GL = EventState<{
|
|
|
341
341
|
isLoop: boolean;
|
|
342
342
|
isDebug: boolean;
|
|
343
343
|
isDepth: boolean;
|
|
344
|
+
wireframe: boolean;
|
|
344
345
|
isGL: true;
|
|
345
346
|
width?: number;
|
|
346
347
|
height?: number;
|
|
@@ -466,6 +467,7 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
466
467
|
isLoop: boolean;
|
|
467
468
|
isDebug: boolean;
|
|
468
469
|
isDepth: boolean;
|
|
470
|
+
wireframe: boolean;
|
|
469
471
|
isGL: true;
|
|
470
472
|
width?: number;
|
|
471
473
|
height?: number;
|
package/dist/solid.d.ts
CHANGED
|
@@ -341,6 +341,7 @@ type GL = EventState<{
|
|
|
341
341
|
isLoop: boolean;
|
|
342
342
|
isDebug: boolean;
|
|
343
343
|
isDepth: boolean;
|
|
344
|
+
wireframe: boolean;
|
|
344
345
|
isGL: true;
|
|
345
346
|
width?: number;
|
|
346
347
|
height?: number;
|
|
@@ -466,6 +467,7 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
466
467
|
isLoop: boolean;
|
|
467
468
|
isDebug: boolean;
|
|
468
469
|
isDepth: boolean;
|
|
470
|
+
wireframe: boolean;
|
|
469
471
|
isGL: true;
|
|
470
472
|
width?: number;
|
|
471
473
|
height?: number;
|
package/package.json
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, min, vec3 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendAdd = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return min(base.add(blend), 1)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendAdd',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendAddVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return min(base.add(blend), vec3(1))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendAddVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendAddVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendAddVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendAddVec3Opacity',
|
|
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 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendAverage = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return base.add(blend).mul(0.5)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendAverage',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendAverageVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return base.add(blend).mul(0.5)
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendAverageVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendAverageVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendAverageVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendAverageVec3Opacity',
|
|
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, Float, Vec3, vec3 } from '../../../node'
|
|
2
|
+
import { rgb2hsv } from '../space/rgb2hsv'
|
|
3
|
+
import { hsv2rgb } from '../space/hsv2rgb'
|
|
4
|
+
|
|
5
|
+
export const blendColor = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
6
|
+
const baseHSV = rgb2hsv(base).toVar('baseHSV')
|
|
7
|
+
const blendHSV = rgb2hsv(blend).toVar('blendHSV')
|
|
8
|
+
return hsv2rgb(vec3(blendHSV.x, blendHSV.y, baseHSV.z))
|
|
9
|
+
}).setLayout({
|
|
10
|
+
name: 'blendColor',
|
|
11
|
+
type: 'vec3',
|
|
12
|
+
inputs: [
|
|
13
|
+
{ name: 'base', type: 'vec3' },
|
|
14
|
+
{ name: 'blend', type: 'vec3' },
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const blendColorOpacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
19
|
+
return blendColor(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
20
|
+
}).setLayout({
|
|
21
|
+
name: 'blendColorOpacity',
|
|
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, vec3, max, select } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendColorBurn = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return select(blend, max(base.div(blend.oneMinus()).oneMinus(), 0), blend.equal(0))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendColorBurn',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendColorBurnVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(blendColorBurn(base.r, blend.r), blendColorBurn(base.g, blend.g), blendColorBurn(base.b, blend.b))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendColorBurnVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendColorBurnVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendColorBurnVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendColorBurnVec3Opacity',
|
|
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,39 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, min, select } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendColorDodge = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return select(blend, min(base.div(blend.oneMinus()), 1), blend.equal(1))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendColorDodge',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendColorDodgeVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(
|
|
16
|
+
blendColorDodge(base.r, blend.r),
|
|
17
|
+
blendColorDodge(base.g, blend.g),
|
|
18
|
+
blendColorDodge(base.b, blend.b)
|
|
19
|
+
)
|
|
20
|
+
}).setLayout({
|
|
21
|
+
name: 'blendColorDodgeVec3',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'base', type: 'vec3' },
|
|
25
|
+
{ name: 'blend', type: 'vec3' },
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const blendColorDodgeVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
30
|
+
return blendColorDodgeVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
31
|
+
}).setLayout({
|
|
32
|
+
name: 'blendColorDodgeVec3Opacity',
|
|
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,35 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, min } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendDarken = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return min(blend, base)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendDarken',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendDarkenVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(blendDarken(base.r, blend.r), blendDarken(base.g, blend.g), blendDarken(base.b, blend.b))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendDarkenVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendDarkenVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendDarkenVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendDarkenVec3Opacity',
|
|
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, abs } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendDifference = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return abs(base.sub(blend))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendDifference',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendDifferenceVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return abs(base.sub(blend))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendDifferenceVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendDifferenceVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendDifferenceVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendDifferenceVec3Opacity',
|
|
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 } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendExclusion = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return base.add(blend).sub(base.mul(blend).mul(2))
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendExclusion',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' }
|
|
11
|
+
]
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendExclusionVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return base.add(blend).sub(base.mul(blend).mul(2))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendExclusionVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' }
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendExclusionVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendExclusionVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendExclusionVec3Opacity',
|
|
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,36 @@
|
|
|
1
|
+
import { Fn, Float, Vec3 } from '../../../node'
|
|
2
|
+
import { blendReflect, blendReflectVec3 } from './reflect'
|
|
3
|
+
|
|
4
|
+
export const blendGlow = Fn(([base, blend]: [Float, Float]): Float => {
|
|
5
|
+
return blendReflect(blend, base)
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'blendGlow',
|
|
8
|
+
type: 'float',
|
|
9
|
+
inputs: [
|
|
10
|
+
{ name: 'base', type: 'float' },
|
|
11
|
+
{ name: 'blend', type: 'float' },
|
|
12
|
+
],
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const blendGlowVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
16
|
+
return blendReflectVec3(blend, base)
|
|
17
|
+
}).setLayout({
|
|
18
|
+
name: 'blendGlowVec3',
|
|
19
|
+
type: 'vec3',
|
|
20
|
+
inputs: [
|
|
21
|
+
{ name: 'base', type: 'vec3' },
|
|
22
|
+
{ name: 'blend', type: 'vec3' },
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export const blendGlowVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
27
|
+
return blendGlowVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
28
|
+
}).setLayout({
|
|
29
|
+
name: 'blendGlowVec3Opacity',
|
|
30
|
+
type: 'vec3',
|
|
31
|
+
inputs: [
|
|
32
|
+
{ name: 'base', type: 'vec3' },
|
|
33
|
+
{ name: 'blend', type: 'vec3' },
|
|
34
|
+
{ name: 'opacity', type: 'float' },
|
|
35
|
+
],
|
|
36
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Fn, Float, Vec3 } from '../../../node'
|
|
2
|
+
import { blendOverlay, blendOverlayVec3 } from './overlay'
|
|
3
|
+
|
|
4
|
+
export const blendHardLight = Fn(([base, blend]: [Float, Float]): Float => {
|
|
5
|
+
return blendOverlay(blend, base)
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'blendHardLight',
|
|
8
|
+
type: 'float',
|
|
9
|
+
inputs: [
|
|
10
|
+
{ name: 'base', type: 'float' },
|
|
11
|
+
{ name: 'blend', type: 'float' },
|
|
12
|
+
],
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const blendHardLightVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
16
|
+
return blendOverlayVec3(blend, base)
|
|
17
|
+
}).setLayout({
|
|
18
|
+
name: 'blendHardLightVec3',
|
|
19
|
+
type: 'vec3',
|
|
20
|
+
inputs: [
|
|
21
|
+
{ name: 'base', type: 'vec3' },
|
|
22
|
+
{ name: 'blend', type: 'vec3' },
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export const blendHardLightVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
27
|
+
return blendHardLightVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
28
|
+
}).setLayout({
|
|
29
|
+
name: 'blendHardLightVec3Opacity',
|
|
30
|
+
type: 'vec3',
|
|
31
|
+
inputs: [
|
|
32
|
+
{ name: 'base', type: 'vec3' },
|
|
33
|
+
{ name: 'blend', type: 'vec3' },
|
|
34
|
+
{ name: 'opacity', type: 'float' },
|
|
35
|
+
],
|
|
36
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, If, float } from '../../../node'
|
|
2
|
+
import { blendVividLight } from './vividLight'
|
|
3
|
+
|
|
4
|
+
export const blendHardMix = Fn(([base, blend]: [Float, Float]): Float => {
|
|
5
|
+
If(blendVividLight(base, blend).lessThan(0.5), () => {
|
|
6
|
+
return float(0)
|
|
7
|
+
})
|
|
8
|
+
return float(1)
|
|
9
|
+
}).setLayout({
|
|
10
|
+
name: 'blendHardMix',
|
|
11
|
+
type: 'float',
|
|
12
|
+
inputs: [
|
|
13
|
+
{ name: 'base', type: 'float' },
|
|
14
|
+
{ name: 'blend', type: 'float' },
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const blendHardMixVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
19
|
+
return vec3(blendHardMix(base.r, blend.r), blendHardMix(base.g, blend.g), blendHardMix(base.b, blend.b))
|
|
20
|
+
}).setLayout({
|
|
21
|
+
name: 'blendHardMixVec3',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'base', type: 'vec3' },
|
|
25
|
+
{ name: 'blend', type: 'vec3' },
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const blendHardMixVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
30
|
+
return blendHardMixVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
31
|
+
}).setLayout({
|
|
32
|
+
name: 'blendHardMixVec3Opacity',
|
|
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,29 @@
|
|
|
1
|
+
import { Fn, Vec3, Float, vec3, clamp } from '../../../node'
|
|
2
|
+
import { rgb2hsv } from '../space/rgb2hsv'
|
|
3
|
+
import { hsv2rgb } from '../space/hsv2rgb'
|
|
4
|
+
|
|
5
|
+
export const blendHue = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
6
|
+
const baseHSV = rgb2hsv(base)
|
|
7
|
+
const blendHSV = rgb2hsv(blend)
|
|
8
|
+
const result = vec3(blendHSV.x, baseHSV.y, baseHSV.z)
|
|
9
|
+
return hsv2rgb(result)
|
|
10
|
+
}).setLayout({
|
|
11
|
+
name: 'blendHue',
|
|
12
|
+
type: 'vec3',
|
|
13
|
+
inputs: [
|
|
14
|
+
{ name: 'base', type: 'vec3' },
|
|
15
|
+
{ name: 'blend', type: 'vec3' },
|
|
16
|
+
],
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const blendHueVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
20
|
+
return blendHue(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
21
|
+
}).setLayout({
|
|
22
|
+
name: 'blendHueVec3Opacity',
|
|
23
|
+
type: 'vec3',
|
|
24
|
+
inputs: [
|
|
25
|
+
{ name: 'base', type: 'vec3' },
|
|
26
|
+
{ name: 'blend', type: 'vec3' },
|
|
27
|
+
{ name: 'opacity', type: 'float' },
|
|
28
|
+
],
|
|
29
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export * from './add'
|
|
2
|
+
export * from './average'
|
|
3
|
+
export * from './color'
|
|
4
|
+
export * from './colorBurn'
|
|
5
|
+
export * from './colorDodge'
|
|
6
|
+
export * from './darken'
|
|
7
|
+
export * from './difference'
|
|
8
|
+
export * from './exclusion'
|
|
9
|
+
export * from './glow'
|
|
10
|
+
export * from './hardLight'
|
|
11
|
+
export * from './hardMix'
|
|
12
|
+
export * from './hue'
|
|
13
|
+
export * from './lighten'
|
|
14
|
+
export * from './linearBurn'
|
|
15
|
+
export * from './luminosity'
|
|
16
|
+
export * from './multiply'
|
|
17
|
+
export * from './linearDodge'
|
|
18
|
+
export * from './linearLight'
|
|
19
|
+
export * from './negation'
|
|
20
|
+
export * from './phoenix'
|
|
21
|
+
export * from './pinLight'
|
|
22
|
+
export * from './vividLight'
|
|
23
|
+
export * from './overlay'
|
|
24
|
+
export * from './reflect'
|
|
25
|
+
export * from './saturation'
|
|
26
|
+
export * from './screen'
|
|
27
|
+
export * from './softLight'
|
|
28
|
+
export * from './subtract'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, max } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendLighten = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return max(blend, base)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendLighten',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendLightenVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(blendLighten(base.r, blend.r), blendLighten(base.g, blend.g), blendLighten(base.b, blend.b))
|
|
16
|
+
}).setLayout({
|
|
17
|
+
name: 'blendLightenVec3',
|
|
18
|
+
type: 'vec3',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'base', type: 'vec3' },
|
|
21
|
+
{ name: 'blend', type: 'vec3' },
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const blendLightenVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
26
|
+
return blendLightenVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
27
|
+
}).setLayout({
|
|
28
|
+
name: 'blendLightenVec3Opacity',
|
|
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,39 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, max } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendLinearBurn = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return max(base.add(blend).sub(1), 0)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendLinearBurn',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendLinearBurnVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(
|
|
16
|
+
blendLinearBurn(base.r, blend.r),
|
|
17
|
+
blendLinearBurn(base.g, blend.g),
|
|
18
|
+
blendLinearBurn(base.b, blend.b)
|
|
19
|
+
)
|
|
20
|
+
}).setLayout({
|
|
21
|
+
name: 'blendLinearBurnVec3',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'base', type: 'vec3' },
|
|
25
|
+
{ name: 'blend', type: 'vec3' },
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const blendLinearBurnVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
30
|
+
return blendLinearBurnVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
31
|
+
}).setLayout({
|
|
32
|
+
name: 'blendLinearBurnVec3Opacity',
|
|
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,39 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, min } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const blendLinearDodge = Fn(([base, blend]: [Float, Float]): Float => {
|
|
4
|
+
return min(base.add(blend), 1)
|
|
5
|
+
}).setLayout({
|
|
6
|
+
name: 'blendLinearDodge',
|
|
7
|
+
type: 'float',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'base', type: 'float' },
|
|
10
|
+
{ name: 'blend', type: 'float' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const blendLinearDodgeVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
15
|
+
return vec3(
|
|
16
|
+
blendLinearDodge(base.r, blend.r),
|
|
17
|
+
blendLinearDodge(base.g, blend.g),
|
|
18
|
+
blendLinearDodge(base.b, blend.b)
|
|
19
|
+
)
|
|
20
|
+
}).setLayout({
|
|
21
|
+
name: 'blendLinearDodgeVec3',
|
|
22
|
+
type: 'vec3',
|
|
23
|
+
inputs: [
|
|
24
|
+
{ name: 'base', type: 'vec3' },
|
|
25
|
+
{ name: 'blend', type: 'vec3' },
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const blendLinearDodgeVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
30
|
+
return blendLinearDodgeVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
31
|
+
}).setLayout({
|
|
32
|
+
name: 'blendLinearDodgeVec3Opacity',
|
|
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,44 @@
|
|
|
1
|
+
import { Fn, Float, Vec3, vec3, If } from '../../../node'
|
|
2
|
+
import { blendLinearBurn } from './linearBurn'
|
|
3
|
+
import { blendLinearDodge } from './linearDodge'
|
|
4
|
+
|
|
5
|
+
export const blendLinearLight = Fn(([base, blend]: [Float, Float]): Float => {
|
|
6
|
+
If(blend.lessThan(0.5), () => {
|
|
7
|
+
return blendLinearBurn(base, blend.mul(2))
|
|
8
|
+
})
|
|
9
|
+
return blendLinearDodge(base, blend.sub(0.5).mul(2))
|
|
10
|
+
}).setLayout({
|
|
11
|
+
name: 'blendLinearLight',
|
|
12
|
+
type: 'float',
|
|
13
|
+
inputs: [
|
|
14
|
+
{ name: 'base', type: 'float' },
|
|
15
|
+
{ name: 'blend', type: 'float' },
|
|
16
|
+
],
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const blendLinearLightVec3 = Fn(([base, blend]: [Vec3, Vec3]): Vec3 => {
|
|
20
|
+
return vec3(
|
|
21
|
+
blendLinearLight(base.r, blend.r),
|
|
22
|
+
blendLinearLight(base.g, blend.g),
|
|
23
|
+
blendLinearLight(base.b, blend.b)
|
|
24
|
+
)
|
|
25
|
+
}).setLayout({
|
|
26
|
+
name: 'blendLinearLightVec3',
|
|
27
|
+
type: 'vec3',
|
|
28
|
+
inputs: [
|
|
29
|
+
{ name: 'base', type: 'vec3' },
|
|
30
|
+
{ name: 'blend', type: 'vec3' },
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export const blendLinearLightVec3Opacity = Fn(([base, blend, opacity]: [Vec3, Vec3, Float]): Vec3 => {
|
|
35
|
+
return blendLinearLightVec3(base, blend).mul(opacity).add(base.mul(opacity.oneMinus()))
|
|
36
|
+
}).setLayout({
|
|
37
|
+
name: 'blendLinearLightVec3Opacity',
|
|
38
|
+
type: 'vec3',
|
|
39
|
+
inputs: [
|
|
40
|
+
{ name: 'base', type: 'vec3' },
|
|
41
|
+
{ name: 'blend', type: 'vec3' },
|
|
42
|
+
{ name: 'opacity', type: 'float' },
|
|
43
|
+
],
|
|
44
|
+
})
|