glre 0.40.0 → 0.42.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 +382 -10
- package/dist/addons.js +1 -1
- package/dist/addons.js.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +12 -11
- package/dist/node.cjs +16 -16
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +6 -5
- package/dist/node.js +15 -15
- package/dist/node.js.map +1 -1
- package/dist/react.d.ts +9 -8
- package/dist/solid.d.ts +9 -8
- 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/node/create.ts +2 -3
- package/src/node/scope.ts +3 -2
- package/src/node/types.ts +1 -1
- package/src/node/utils/index.ts +2 -1
- package/src/node/utils/infer.ts +2 -1
- package/src/node/utils/utils.ts +6 -11
- package/src/types.ts +4 -3
- package/src/utils/helpers.ts +25 -8
- package/src/utils/program.ts +11 -4
- package/src/utils/webgl.ts +9 -3
- package/src/utils/webgpu.ts +12 -4
package/dist/react.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ type Color = XImpl<'color'>;
|
|
|
155
155
|
type Mat2 = XImpl<'mat2'>;
|
|
156
156
|
type Mat3 = XImpl<'mat3'>;
|
|
157
157
|
type Mat4 = XImpl<'mat4'>;
|
|
158
|
-
type Texture = XImpl<'texture'>;
|
|
158
|
+
type Texture$1 = XImpl<'texture'>;
|
|
159
159
|
type Sampler2D = XImpl<'sampler2D'>;
|
|
160
160
|
type StructBase = XImpl<'struct'>;
|
|
161
161
|
interface ConstantsToType {
|
|
@@ -180,7 +180,7 @@ interface ConstantsToType {
|
|
|
180
180
|
mat2: Mat2;
|
|
181
181
|
mat3: Mat3;
|
|
182
182
|
mat4: Mat4;
|
|
183
|
-
texture: Texture;
|
|
183
|
+
texture: Texture$1;
|
|
184
184
|
sampler2D: Sampler2D;
|
|
185
185
|
struct: StructBase;
|
|
186
186
|
}
|
|
@@ -386,10 +386,10 @@ type GL = EventState<{
|
|
|
386
386
|
uniform(target: {
|
|
387
387
|
[key: string]: Uniform;
|
|
388
388
|
}): GL;
|
|
389
|
-
_texture?(key: string, value:
|
|
390
|
-
texture(key: string, value:
|
|
389
|
+
_texture?(key: string, value: Texture): GL;
|
|
390
|
+
texture(key: string, value: Texture): GL;
|
|
391
391
|
texture(target: {
|
|
392
|
-
[key: string]:
|
|
392
|
+
[key: string]: Texture;
|
|
393
393
|
}): GL;
|
|
394
394
|
_attribute?(key: string, value: Attribute, iboValue?: Attribute): GL;
|
|
395
395
|
attribute(key: string, value: Attribute, iboValue?: Attribute): GL;
|
|
@@ -408,6 +408,7 @@ type GL = EventState<{
|
|
|
408
408
|
}): GL;
|
|
409
409
|
}>;
|
|
410
410
|
type Uniform = number | number[] | Float32Array;
|
|
411
|
+
type Texture = string | HTMLImageElement | HTMLVideoElement;
|
|
411
412
|
type Attribute = number[] | Float32Array;
|
|
412
413
|
type Storage = number[] | Float32Array;
|
|
413
414
|
/**
|
|
@@ -501,10 +502,10 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
501
502
|
uniform(target: {
|
|
502
503
|
[key: string]: number | number[] | Float32Array<ArrayBufferLike>;
|
|
503
504
|
}): GL;
|
|
504
|
-
_texture?(key: string, value: string): GL;
|
|
505
|
-
texture(key: string, value: string): GL;
|
|
505
|
+
_texture?(key: string, value: string | HTMLImageElement | HTMLVideoElement): GL;
|
|
506
|
+
texture(key: string, value: string | HTMLImageElement | HTMLVideoElement): GL;
|
|
506
507
|
texture(target: {
|
|
507
|
-
[key: string]: string;
|
|
508
|
+
[key: string]: string | HTMLImageElement | HTMLVideoElement;
|
|
508
509
|
}): GL;
|
|
509
510
|
_attribute?(key: string, value: number[] | Float32Array<ArrayBufferLike>, iboValue?: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
510
511
|
attribute(key: string, value: number[] | Float32Array<ArrayBufferLike>, iboValue?: number[] | Float32Array<ArrayBufferLike>): GL;
|
package/dist/solid.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ type Color = XImpl<'color'>;
|
|
|
155
155
|
type Mat2 = XImpl<'mat2'>;
|
|
156
156
|
type Mat3 = XImpl<'mat3'>;
|
|
157
157
|
type Mat4 = XImpl<'mat4'>;
|
|
158
|
-
type Texture = XImpl<'texture'>;
|
|
158
|
+
type Texture$1 = XImpl<'texture'>;
|
|
159
159
|
type Sampler2D = XImpl<'sampler2D'>;
|
|
160
160
|
type StructBase = XImpl<'struct'>;
|
|
161
161
|
interface ConstantsToType {
|
|
@@ -180,7 +180,7 @@ interface ConstantsToType {
|
|
|
180
180
|
mat2: Mat2;
|
|
181
181
|
mat3: Mat3;
|
|
182
182
|
mat4: Mat4;
|
|
183
|
-
texture: Texture;
|
|
183
|
+
texture: Texture$1;
|
|
184
184
|
sampler2D: Sampler2D;
|
|
185
185
|
struct: StructBase;
|
|
186
186
|
}
|
|
@@ -386,10 +386,10 @@ type GL = EventState<{
|
|
|
386
386
|
uniform(target: {
|
|
387
387
|
[key: string]: Uniform;
|
|
388
388
|
}): GL;
|
|
389
|
-
_texture?(key: string, value:
|
|
390
|
-
texture(key: string, value:
|
|
389
|
+
_texture?(key: string, value: Texture): GL;
|
|
390
|
+
texture(key: string, value: Texture): GL;
|
|
391
391
|
texture(target: {
|
|
392
|
-
[key: string]:
|
|
392
|
+
[key: string]: Texture;
|
|
393
393
|
}): GL;
|
|
394
394
|
_attribute?(key: string, value: Attribute, iboValue?: Attribute): GL;
|
|
395
395
|
attribute(key: string, value: Attribute, iboValue?: Attribute): GL;
|
|
@@ -408,6 +408,7 @@ type GL = EventState<{
|
|
|
408
408
|
}): GL;
|
|
409
409
|
}>;
|
|
410
410
|
type Uniform = number | number[] | Float32Array;
|
|
411
|
+
type Texture = string | HTMLImageElement | HTMLVideoElement;
|
|
411
412
|
type Attribute = number[] | Float32Array;
|
|
412
413
|
type Storage = number[] | Float32Array;
|
|
413
414
|
/**
|
|
@@ -501,10 +502,10 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
501
502
|
uniform(target: {
|
|
502
503
|
[key: string]: number | number[] | Float32Array<ArrayBufferLike>;
|
|
503
504
|
}): GL;
|
|
504
|
-
_texture?(key: string, value: string): GL;
|
|
505
|
-
texture(key: string, value: string): GL;
|
|
505
|
+
_texture?(key: string, value: string | HTMLImageElement | HTMLVideoElement): GL;
|
|
506
|
+
texture(key: string, value: string | HTMLImageElement | HTMLVideoElement): GL;
|
|
506
507
|
texture(target: {
|
|
507
|
-
[key: string]: string;
|
|
508
|
+
[key: string]: string | HTMLImageElement | HTMLVideoElement;
|
|
508
509
|
}): GL;
|
|
509
510
|
_attribute?(key: string, value: number[] | Float32Array<ArrayBufferLike>, iboValue?: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
510
511
|
attribute(key: string, value: number[] | Float32Array<ArrayBufferLike>, iboValue?: number[] | Float32Array<ArrayBufferLike>): GL;
|
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
|
+
})
|