glre 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/addons.cjs +1 -1
- package/dist/addons.cjs.map +1 -1
- package/dist/addons.d.ts +853 -22
- package/dist/addons.js +1 -1
- package/dist/addons.js.map +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +47 -28
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +60 -33
- package/dist/node.cjs +59 -30
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +39 -26
- package/dist/node.js +59 -30
- package/dist/node.js.map +1 -1
- package/dist/react.d.ts +47 -28
- package/dist/solid.d.ts +47 -28
- package/package.json +24 -24
- package/src/addons/animation/easing/backIn.ts +10 -0
- package/src/addons/animation/easing/backInOut.ts +12 -0
- package/src/addons/animation/easing/backOut.ts +10 -0
- package/src/addons/animation/easing/bounceIn.ts +10 -0
- package/src/addons/animation/easing/bounceInOut.ts +13 -0
- package/src/addons/animation/easing/bounceOut.ts +30 -0
- package/src/addons/animation/easing/circularIn.ts +9 -0
- package/src/addons/animation/easing/circularInOut.ts +11 -0
- package/src/addons/animation/easing/circularOut.ts +9 -0
- package/src/addons/animation/easing/cubicIn.ts +9 -0
- package/src/addons/animation/easing/cubicInOut.ts +11 -0
- package/src/addons/animation/easing/cubicOut.ts +10 -0
- package/src/addons/animation/easing/elasticIn.ts +10 -0
- package/src/addons/animation/easing/elasticInOut.ts +21 -0
- package/src/addons/animation/easing/elasticOut.ts +12 -0
- package/src/addons/animation/easing/exponentialIn.ts +9 -0
- package/src/addons/animation/easing/exponentialInOut.ts +13 -0
- package/src/addons/animation/easing/exponentialOut.ts +9 -0
- package/src/addons/animation/easing/index.ts +33 -0
- package/src/addons/animation/easing/linearIn.ts +9 -0
- package/src/addons/animation/easing/linearInOut.ts +9 -0
- package/src/addons/animation/easing/linearOut.ts +9 -0
- package/src/addons/animation/easing/quadraticIn.ts +9 -0
- package/src/addons/animation/easing/quadraticInOut.ts +10 -0
- package/src/addons/animation/easing/quadraticOut.ts +9 -0
- package/src/addons/animation/easing/quarticIn.ts +9 -0
- package/src/addons/animation/easing/quarticInOut.ts +11 -0
- package/src/addons/animation/easing/quarticOut.ts +10 -0
- package/src/addons/animation/easing/quinticIn.ts +9 -0
- package/src/addons/animation/easing/quinticInOut.ts +11 -0
- package/src/addons/animation/easing/quinticOut.ts +9 -0
- package/src/addons/animation/easing/sineIn.ts +10 -0
- package/src/addons/animation/easing/sineInOut.ts +10 -0
- package/src/addons/animation/easing/sineOut.ts +10 -0
- package/src/addons/color/palette/macbeth.ts +42 -0
- package/src/addons/color/space/cmyk2rgb.ts +12 -0
- package/src/addons/color/space/gamma2linear.ts +19 -0
- package/src/addons/color/space/hsl2rgb.ts +20 -0
- package/src/addons/color/space/hsv2rgb.ts +18 -0
- package/src/addons/color/space/hue2rgb.ts +12 -0
- package/src/addons/color/space/index.ts +29 -0
- package/src/addons/color/space/lab2lch.ts +22 -0
- package/src/addons/color/space/lab2rgb.ts +19 -0
- package/src/addons/color/space/lab2xyz.ts +32 -0
- package/src/addons/color/space/lch2lab.ts +21 -0
- package/src/addons/color/space/lch2rgb.ts +22 -0
- package/src/addons/color/space/linear2gamma.ts +19 -0
- package/src/addons/color/space/oklab2rgb.ts +35 -0
- package/src/addons/color/space/rgb2cmyk.ts +13 -0
- package/src/addons/color/space/rgb2hcv.ts +29 -0
- package/src/addons/color/space/rgb2hsl.ts +23 -0
- package/src/addons/color/space/rgb2hsv.ts +36 -0
- package/src/addons/color/space/rgb2hue.ts +29 -0
- package/src/addons/color/space/rgb2lab.ts +19 -0
- package/src/addons/color/space/rgb2lch.ts +22 -0
- package/src/addons/color/space/rgb2oklab.ts +45 -0
- package/src/addons/color/space/rgb2srgb.ts +34 -0
- package/src/addons/color/space/rgb2xyz.ts +20 -0
- package/src/addons/color/space/rgb2yiq.ts +22 -0
- package/src/addons/color/space/rgb2yuv.ts +32 -0
- package/src/addons/color/space/srgb2rgb.ts +34 -0
- package/src/addons/color/space/xyz2lab.ts +27 -0
- package/src/addons/color/space/xyz2rgb.ts +30 -0
- package/src/addons/color/space/yiq2rgb.ts +22 -0
- package/src/addons/color/space/yuv2rgb.ts +32 -0
- package/src/addons/draw/arrows.ts +75 -0
- package/src/addons/draw/axis.ts +57 -0
- package/src/addons/draw/bridge.ts +81 -0
- package/src/addons/draw/char.ts +30 -0
- package/src/addons/draw/circle.ts +29 -0
- package/src/addons/draw/fill.ts +25 -0
- package/src/addons/draw/flip.ts +45 -0
- package/src/addons/draw/hex.ts +29 -0
- package/src/addons/draw/index.ts +13 -0
- package/src/addons/draw/line.ts +16 -0
- package/src/addons/draw/point.ts +30 -0
- package/src/addons/draw/rect.ts +52 -0
- package/src/addons/draw/stroke.ts +31 -0
- package/src/addons/draw/tri.ts +29 -0
- package/src/addons/generative/cnoise.ts +239 -0
- package/src/addons/generative/curl.ts +64 -0
- package/src/addons/generative/fbm.ts +69 -0
- package/src/addons/generative/gerstnerWave.ts +21 -0
- package/src/addons/generative/gnoise.ts +113 -0
- package/src/addons/generative/index.ts +15 -0
- package/src/addons/generative/noised.ts +139 -0
- package/src/addons/generative/pnoise.ts +249 -0
- package/src/addons/generative/psrdnoise.ts +277 -0
- package/src/addons/generative/random.ts +136 -0
- package/src/addons/generative/snoise.ts +199 -0
- package/src/addons/generative/srandom.ts +90 -0
- package/src/addons/generative/voronoi.ts +134 -0
- package/src/addons/generative/voronoise.ts +69 -0
- package/src/addons/generative/wavelet.ts +77 -0
- package/src/addons/generative/worley.ts +99 -0
- package/src/addons/geometry/aabb/aabb.ts +8 -0
- package/src/addons/geometry/aabb/centroid.ts +10 -0
- package/src/addons/geometry/aabb/contain.ts +19 -0
- package/src/addons/geometry/aabb/diagonal.ts +10 -0
- package/src/addons/geometry/aabb/expand.ts +16 -0
- package/src/addons/geometry/aabb/index.ts +7 -0
- package/src/addons/geometry/aabb/intersect.ts +20 -0
- package/src/addons/geometry/aabb/square.ts +17 -0
- package/src/addons/geometry/index.ts +2 -0
- package/src/addons/geometry/triangle/area.ts +10 -0
- package/src/addons/geometry/triangle/barycentric.ts +50 -0
- package/src/addons/geometry/triangle/centroid.ts +10 -0
- package/src/addons/geometry/triangle/closestPoint.ts +85 -0
- package/src/addons/geometry/triangle/contain.ts +19 -0
- package/src/addons/geometry/triangle/distanceSq.ts +38 -0
- package/src/addons/geometry/triangle/index.ts +10 -0
- package/src/addons/geometry/triangle/intersect.ts +49 -0
- package/src/addons/geometry/triangle/normal.ts +12 -0
- package/src/addons/geometry/triangle/signedDistance.ts +31 -0
- package/src/addons/geometry/triangle/triangle.ts +9 -0
- package/src/addons/index.ts +8 -6
- package/src/addons/lighting/ray.ts +8 -0
- package/src/addons/math/aafloor.ts +13 -0
- package/src/addons/math/aafract.ts +38 -0
- package/src/addons/math/aamirror.ts +12 -0
- package/src/addons/math/aastep.ts +14 -0
- package/src/addons/math/absi.ts +9 -0
- package/src/addons/math/adaptiveThreshold.ts +24 -0
- package/src/addons/math/bump.ts +20 -0
- package/src/addons/math/const.ts +19 -0
- package/src/addons/math/cubic.ts +101 -0
- package/src/addons/math/cubicMix.ts +49 -0
- package/src/addons/math/decimate.ts +12 -0
- package/src/addons/math/dist.ts +143 -0
- package/src/addons/math/fcos.ts +11 -0
- package/src/addons/math/frac.ts +9 -0
- package/src/addons/math/gain.ts +14 -0
- package/src/addons/math/gaussian.ts +14 -0
- package/src/addons/math/grad4.ts +19 -0
- package/src/addons/math/hammersley.ts +54 -0
- package/src/addons/math/highPass.ts +12 -0
- package/src/addons/math/index.ts +63 -0
- package/src/addons/math/inside.ts +68 -0
- package/src/addons/math/invCubic.ts +9 -0
- package/src/addons/math/invQuartic.ts +9 -0
- package/src/addons/math/inverse.ts +9 -0
- package/src/addons/math/lengthSq.ts +10 -0
- package/src/addons/math/map.ts +27 -0
- package/src/addons/math/mirror.ts +12 -0
- package/src/addons/math/mmax.ts +27 -0
- package/src/addons/math/mmin.ts +28 -0
- package/src/addons/math/mmix.ts +47 -0
- package/src/addons/math/mod2.ts +44 -0
- package/src/addons/math/mod289.ts +46 -0
- package/src/addons/math/modi.ts +15 -0
- package/src/addons/math/nyquist.ts +15 -0
- package/src/addons/math/pack.ts +15 -0
- package/src/addons/math/parabola.ts +12 -0
- package/src/addons/math/permute.ts +42 -0
- package/src/addons/math/pow2.ts +10 -0
- package/src/addons/math/pow3.ts +9 -0
- package/src/addons/math/pow5.ts +10 -0
- package/src/addons/math/pow7.ts +12 -0
- package/src/addons/math/powFast.ts +18 -0
- package/src/addons/math/quartic.ts +15 -0
- package/src/addons/math/quat/index.ts +14 -0
- package/src/addons/math/quat/quat2mat3.ts +28 -0
- package/src/addons/math/quat/quat2mat4.ts +16 -0
- package/src/addons/math/quat/quatAdd.ts +18 -0
- package/src/addons/math/quat/quatConj.ts +14 -0
- package/src/addons/math/quat/quatDiv.ts +18 -0
- package/src/addons/math/quat/quatIdentity.ts +9 -0
- package/src/addons/math/quat/quatInverse.ts +17 -0
- package/src/addons/math/quat/quatLength.ts +15 -0
- package/src/addons/math/quat/quatLengthSq.ts +14 -0
- package/src/addons/math/quat/quatLerp.ts +40 -0
- package/src/addons/math/quat/quatMul.ts +38 -0
- package/src/addons/math/quat/quatNeg.ts +14 -0
- package/src/addons/math/quat/quatNorm.ts +16 -0
- package/src/addons/math/quat/quatSub.ts +18 -0
- package/src/addons/math/quintic.ts +16 -0
- package/src/addons/math/rotate2d.ts +16 -0
- package/src/addons/math/rotate3d.ts +37 -0
- package/src/addons/math/rotate3dX.ts +20 -0
- package/src/addons/math/rotate3dY.ts +20 -0
- package/src/addons/math/rotate3dZ.ts +20 -0
- package/src/addons/math/rotate4d.ts +41 -0
- package/src/addons/math/rotate4dX.ts +21 -0
- package/src/addons/math/rotate4dY.ts +16 -0
- package/src/addons/math/rotate4dZ.ts +21 -0
- package/src/addons/math/saturateMediump.ts +11 -0
- package/src/addons/math/scale2d.ts +44 -0
- package/src/addons/math/scale3d.ts +17 -0
- package/src/addons/math/scale4d.ts +50 -0
- package/src/addons/math/smootherstep.ts +16 -0
- package/src/addons/math/taylorInvSqrt.ts +9 -0
- package/src/addons/math/toMat3.ts +14 -0
- package/src/addons/math/toMat4.ts +14 -0
- package/src/addons/math/translate4d.ts +31 -0
- package/src/addons/math/unpack.ts +88 -0
- package/src/addons/sdf/boxSDF.ts +24 -0
- package/src/addons/sdf/circleSDF.ts +20 -0
- package/src/addons/sdf/crossSDF.ts +17 -0
- package/src/addons/sdf/hexSDF.ts +18 -0
- package/src/addons/sdf/index.ts +7 -0
- package/src/addons/sdf/lineSDF.ts +33 -0
- package/src/addons/sdf/rectSDF.ts +46 -0
- package/src/addons/sdf/sphereSDF.ts +20 -0
- package/src/addons/sdf/triSDF.ts +14 -0
- package/src/addons/space/aspect.ts +14 -0
- package/src/addons/space/bracketing.ts +44 -0
- package/src/addons/space/brickTile.ts +44 -0
- package/src/addons/space/cart2polar.ts +20 -0
- package/src/addons/space/center.ts +32 -0
- package/src/addons/space/checkerTile.ts +41 -0
- package/src/addons/space/depth2viewZ.ts +43 -0
- package/src/addons/space/displace.ts +55 -0
- package/src/addons/space/equirect2xyz.ts +17 -0
- package/src/addons/space/eulerView.ts +19 -0
- package/src/addons/space/fisheye2xyz.ts +18 -0
- package/src/addons/space/flipY.ts +25 -0
- package/src/addons/space/hexTile.ts +18 -0
- package/src/addons/space/index.ts +38 -0
- package/src/addons/space/kaleidoscope.ts +48 -0
- package/src/addons/space/linearizeDepth.ts +17 -0
- package/src/addons/space/lookAt.ts +49 -0
- package/src/addons/space/lookAtView.ts +40 -0
- package/src/addons/space/mirrorTile.ts +73 -0
- package/src/addons/space/nearest.ts +13 -0
- package/src/addons/space/orthographic.ts +25 -0
- package/src/addons/space/parallaxMapping.ts +149 -0
- package/src/addons/space/perspective.ts +24 -0
- package/src/addons/space/polar2cart.ts +24 -0
- package/src/addons/space/ratio.ts +14 -0
- package/src/addons/space/rotate.ts +37 -0
- package/src/addons/space/rotateX.ts +54 -0
- package/src/addons/space/rotateY.ts +54 -0
- package/src/addons/space/rotateZ.ts +54 -0
- package/src/addons/space/scale.ts +13 -0
- package/src/addons/space/sprite.ts +16 -0
- package/src/addons/space/sqTile.ts +20 -0
- package/src/addons/space/tbn.ts +26 -0
- package/src/addons/space/translate.ts +12 -0
- package/src/addons/space/triTile.ts +32 -0
- package/src/addons/space/uncenter.ts +32 -0
- package/src/addons/space/unratio.ts +12 -0
- package/src/addons/space/viewZ2depth.ts +25 -0
- package/src/addons/space/windmillTile.ts +58 -0
- package/src/addons/space/xyz2equirect.ts +10 -0
- package/src/index.ts +5 -2
- package/src/node/build.ts +62 -52
- package/src/node/create.ts +3 -0
- package/src/node/index.ts +1 -2
- package/src/node/scope.ts +27 -25
- package/src/node/types.ts +16 -12
- package/src/node/utils/const.ts +12 -11
- package/src/node/utils/index.ts +15 -12
- package/src/node/utils/infer.ts +17 -6
- package/src/node/utils/parse.ts +37 -13
- package/src/node/utils/utils.ts +40 -22
- package/src/types.ts +13 -5
- package/src/utils/helpers.ts +80 -7
- package/src/utils/pipeline.ts +21 -5
- package/src/utils/program.ts +68 -42
- package/src/utils/webgl.ts +47 -37
- package/src/utils/webgpu.ts +30 -38
package/dist/react.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { EventState, Nested } from 'reev';
|
|
|
3
3
|
import * as refr from 'refr';
|
|
4
4
|
import { Queue, Frame } from 'refr';
|
|
5
5
|
|
|
6
|
-
declare const CONVERSIONS: readonly ["toBool", "
|
|
6
|
+
declare const CONVERSIONS: readonly ["toBool", "toUInt", "toInt", "toFloat", "toBVec2", "toIVec2", "toUVec2", "toVec2", "toBVec3", "toIVec3", "toUVec3", "toVec3", "toBVec4", "toIVec4", "toUVec4", "toVec4", "toColor", "toMat2", "toMat3", "toMat4"];
|
|
7
7
|
declare const TYPE_MAPPING: {
|
|
8
8
|
readonly bool: "bool";
|
|
9
9
|
readonly uint: "u32";
|
|
@@ -68,7 +68,7 @@ declare const OPERATOR_TYPE_RULES: readonly [readonly ["float", "vec2", "vec2"],
|
|
|
68
68
|
* 1.2. index.ts functions and
|
|
69
69
|
* 3.2. types.ts _N
|
|
70
70
|
*/
|
|
71
|
-
declare const FUNCTIONS: readonly [...("texture" | "all" | "any" | "determinant" | "distance" | "dot" | "length" | "lengthSq" | "luminance" | "cross" | "cubeTexture" | "texelFetch" | "textureLod")[], "abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "ceil", "cos", "cosh", "dFdx", "dFdy", "degrees", "exp", "exp2", "floor", "fract", "fwidth", "inverseSqrt", "log", "log2", "negate", "normalize", "oneMinus", "radians", "reciprocal", "round", "
|
|
71
|
+
declare const FUNCTIONS: readonly [...("texture" | "all" | "any" | "determinant" | "distance" | "dot" | "length" | "lengthSq" | "luminance" | "cross" | "cubeTexture" | "texelFetch" | "textureLod")[], "abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "ceil", "cos", "cosh", "dFdx", "dFdy", "degrees", "exp", "exp2", "floor", "fract", "fwidth", "inverse", "inverseSqrt", "log", "log2", "negate", "normalize", "oneMinus", "radians", "reciprocal", "round", "sign", "sin", "sinh", "sqrt", "tan", "tanh", "trunc", "saturate", "atan2", "clamp", "max", "min", "mix", "pow", "reflect", "refract", "smoothstep", "step"];
|
|
72
72
|
|
|
73
73
|
type Constants = (typeof CONSTANTS)[number] | 'void';
|
|
74
74
|
type Conversions = (typeof CONVERSIONS)[number];
|
|
@@ -82,14 +82,14 @@ interface FnLayout {
|
|
|
82
82
|
type: C | 'auto';
|
|
83
83
|
inputs?: Array<{
|
|
84
84
|
name: string;
|
|
85
|
-
type: C;
|
|
85
|
+
type: C | 'auto';
|
|
86
86
|
}>;
|
|
87
87
|
}
|
|
88
88
|
type StructFields = Record<string, X>;
|
|
89
89
|
/**
|
|
90
90
|
* node
|
|
91
91
|
*/
|
|
92
|
-
type NodeTypes = 'attribute' | 'storage' | 'uniform' | 'constant' | 'variable' | 'varying' | 'ternary' | 'builtin' | 'conversion' | 'operator' | 'function' | 'struct' | 'member' | 'element' | 'gather' | 'scatter' | 'scope' | 'assign' | 'loop' | 'define' | 'if' | 'switch' | 'declare' | 'return' | 'break' | 'continue';
|
|
92
|
+
type NodeTypes = 'attribute' | 'instance' | 'storage' | 'uniform' | 'constant' | 'variable' | 'varying' | 'ternary' | 'builtin' | 'conversion' | 'operator' | 'function' | 'struct' | 'member' | 'element' | 'gather' | 'scatter' | 'scope' | 'assign' | 'loop' | 'define' | 'if' | 'switch' | 'declare' | 'return' | 'break' | 'continue';
|
|
93
93
|
interface NodeProps {
|
|
94
94
|
id?: string;
|
|
95
95
|
args?: any[];
|
|
@@ -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
|
}
|
|
@@ -194,10 +194,11 @@ type XImpl<T extends C> = _X<T> & {
|
|
|
194
194
|
};
|
|
195
195
|
type C = Constants;
|
|
196
196
|
type X<T extends C = C> = T extends keyof ConstantsToType ? ConstantsToType[T] : _X<T>;
|
|
197
|
-
type Methods = Functions | Operators | Conversions | Swizzles | '__nodeType' | 'type' | 'props' | 'isProxy' | 'assign' | 'toVar' | 'toString' | 'element';
|
|
197
|
+
type Methods = Functions | Operators | Conversions | Swizzles | '__nodeType' | 'type' | 'props' | 'isProxy' | 'assign' | 'toVar' | 'toString' | 'element' | 'select';
|
|
198
198
|
interface _X<T extends C> {
|
|
199
199
|
readonly __nodeType?: T;
|
|
200
200
|
assign(x: any): X<T>;
|
|
201
|
+
select(x: number | X<T>, y: X<'bool'>): X<T>;
|
|
201
202
|
fragment(c: NodeContext): string;
|
|
202
203
|
toVar(name?: string): X<T>;
|
|
203
204
|
toString(c?: NodeContext): string;
|
|
@@ -241,20 +242,20 @@ interface _X<T extends C> {
|
|
|
241
242
|
shiftLeftAssign<U extends C>(x: ValidateOperator<T, U> extends 0 ? never : number | X<U>): X<T>;
|
|
242
243
|
shiftRightAssign<U extends C>(x: ValidateOperator<T, U> extends 0 ? never : number | X<U>): X<T>;
|
|
243
244
|
toBool(): Bool;
|
|
244
|
-
|
|
245
|
+
toUInt(): UInt;
|
|
245
246
|
toInt(): Int;
|
|
246
247
|
toFloat(): Float;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
toBVec2(): BVec2;
|
|
249
|
+
toIVec2(): IVec2;
|
|
250
|
+
toUVec2(): UVec2;
|
|
250
251
|
toVec2(): Vec2;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
toBVec3(): BVec3;
|
|
253
|
+
toIVec3(): IVec3;
|
|
254
|
+
toUVec3(): UVec3;
|
|
254
255
|
toVec3(): Vec3;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
toBVec4(): BVec4;
|
|
257
|
+
toIVec4(): IVec4;
|
|
258
|
+
toUVec4(): UVec4;
|
|
258
259
|
toVec4(): Vec4;
|
|
259
260
|
toColor(): Color;
|
|
260
261
|
toMat2(): Mat2;
|
|
@@ -338,14 +339,17 @@ type GL = EventState<{
|
|
|
338
339
|
isWebGL: boolean;
|
|
339
340
|
isError: boolean;
|
|
340
341
|
isLoop: boolean;
|
|
342
|
+
isDebug: boolean;
|
|
343
|
+
isDepth: boolean;
|
|
341
344
|
isGL: true;
|
|
342
345
|
width?: number;
|
|
343
346
|
height?: number;
|
|
344
347
|
size: [number, number];
|
|
345
348
|
mouse: [number, number];
|
|
346
349
|
count: number;
|
|
350
|
+
instanceCount: number;
|
|
351
|
+
particleCount: number | [number, number] | [number, number, number];
|
|
347
352
|
loading: number;
|
|
348
|
-
particles: 64 | 256 | 576 | 1024 | 1600 | 2304 | 3136 | 4096 | 4096 | 5184 | 6400;
|
|
349
353
|
el: HTMLCanvasElement;
|
|
350
354
|
vs?: string | Vec4;
|
|
351
355
|
cs?: string | Void;
|
|
@@ -372,7 +376,7 @@ type GL = EventState<{
|
|
|
372
376
|
error(e?: string): void;
|
|
373
377
|
render(): void;
|
|
374
378
|
resize(e?: Event): void;
|
|
375
|
-
mousemove(e:
|
|
379
|
+
mousemove(e: MouseEvent): void;
|
|
376
380
|
loop(): void;
|
|
377
381
|
/**
|
|
378
382
|
* setter
|
|
@@ -382,16 +386,21 @@ type GL = EventState<{
|
|
|
382
386
|
uniform(target: {
|
|
383
387
|
[key: string]: Uniform;
|
|
384
388
|
}): GL;
|
|
385
|
-
_texture?(key: string, value:
|
|
386
|
-
texture(key: string, value:
|
|
389
|
+
_texture?(key: string, value: Texture): GL;
|
|
390
|
+
texture(key: string, value: Texture): GL;
|
|
387
391
|
texture(target: {
|
|
388
|
-
[key: string]:
|
|
392
|
+
[key: string]: Texture;
|
|
389
393
|
}): GL;
|
|
390
394
|
_attribute?(key: string, value: Attribute, iboValue?: Attribute): GL;
|
|
391
395
|
attribute(key: string, value: Attribute, iboValue?: Attribute): GL;
|
|
392
396
|
attribute(target: {
|
|
393
397
|
[key: string]: Attribute;
|
|
394
398
|
}): GL;
|
|
399
|
+
_instance?(key: string, value: Attribute, at?: number): GL;
|
|
400
|
+
instance(key: string, value: Attribute, at?: number): GL;
|
|
401
|
+
instance(target: {
|
|
402
|
+
[key: string]: Attribute;
|
|
403
|
+
}): GL;
|
|
395
404
|
_storage?(key: string, value: Storage): GL;
|
|
396
405
|
storage(key: string, value: Storage): GL;
|
|
397
406
|
storage(target: {
|
|
@@ -399,6 +408,7 @@ type GL = EventState<{
|
|
|
399
408
|
}): GL;
|
|
400
409
|
}>;
|
|
401
410
|
type Uniform = number | number[] | Float32Array;
|
|
411
|
+
type Texture = string | HTMLImageElement | HTMLVideoElement;
|
|
402
412
|
type Attribute = number[] | Float32Array;
|
|
403
413
|
type Storage = number[] | Float32Array;
|
|
404
414
|
/**
|
|
@@ -422,6 +432,7 @@ interface AttribData {
|
|
|
422
432
|
buffer: GPUBuffer;
|
|
423
433
|
location: number;
|
|
424
434
|
stride: number;
|
|
435
|
+
isInstance?: boolean;
|
|
425
436
|
}
|
|
426
437
|
interface StorageData {
|
|
427
438
|
array: Float32Array;
|
|
@@ -453,14 +464,17 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
453
464
|
isWebGL: boolean;
|
|
454
465
|
isError: boolean;
|
|
455
466
|
isLoop: boolean;
|
|
467
|
+
isDebug: boolean;
|
|
468
|
+
isDepth: boolean;
|
|
456
469
|
isGL: true;
|
|
457
470
|
width?: number;
|
|
458
471
|
height?: number;
|
|
459
472
|
size: [number, number];
|
|
460
473
|
mouse: [number, number];
|
|
461
474
|
count: number;
|
|
475
|
+
instanceCount: number;
|
|
476
|
+
particleCount: number | [number, number] | [number, number, number];
|
|
462
477
|
loading: number;
|
|
463
|
-
particles: 64 | 256 | 576 | 1024 | 1600 | 2304 | 3136 | 4096 | 4096 | 5184 | 6400;
|
|
464
478
|
el: HTMLCanvasElement;
|
|
465
479
|
vs?: string | Vec4;
|
|
466
480
|
cs?: string | Void;
|
|
@@ -481,23 +495,28 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
481
495
|
error(e?: string): void;
|
|
482
496
|
render(): void;
|
|
483
497
|
resize(e?: Event): void;
|
|
484
|
-
mousemove(e:
|
|
498
|
+
mousemove(e: MouseEvent): void;
|
|
485
499
|
loop(): void;
|
|
486
500
|
_uniform?(key: string, value: number | number[] | Float32Array<ArrayBufferLike>, isMatrix?: boolean): GL;
|
|
487
501
|
uniform(key: string, value: number | number[] | Float32Array<ArrayBufferLike>, isMatrix?: boolean): GL;
|
|
488
502
|
uniform(target: {
|
|
489
503
|
[key: string]: number | number[] | Float32Array<ArrayBufferLike>;
|
|
490
504
|
}): GL;
|
|
491
|
-
_texture?(key: string, value: string): GL;
|
|
492
|
-
texture(key: string, value: string): GL;
|
|
505
|
+
_texture?(key: string, value: string | HTMLImageElement | HTMLVideoElement): GL;
|
|
506
|
+
texture(key: string, value: string | HTMLImageElement | HTMLVideoElement): GL;
|
|
493
507
|
texture(target: {
|
|
494
|
-
[key: string]: string;
|
|
508
|
+
[key: string]: string | HTMLImageElement | HTMLVideoElement;
|
|
495
509
|
}): GL;
|
|
496
510
|
_attribute?(key: string, value: number[] | Float32Array<ArrayBufferLike>, iboValue?: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
497
511
|
attribute(key: string, value: number[] | Float32Array<ArrayBufferLike>, iboValue?: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
498
512
|
attribute(target: {
|
|
499
513
|
[key: string]: number[] | Float32Array<ArrayBufferLike>;
|
|
500
514
|
}): GL;
|
|
515
|
+
_instance?(key: string, value: number[] | Float32Array<ArrayBufferLike>, at?: number): GL;
|
|
516
|
+
instance(key: string, value: number[] | Float32Array<ArrayBufferLike>, at?: number): GL;
|
|
517
|
+
instance(target: {
|
|
518
|
+
[key: string]: number[] | Float32Array<ArrayBufferLike>;
|
|
519
|
+
}): GL;
|
|
501
520
|
_storage?(key: string, value: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
502
521
|
storage(key: string, value: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
503
522
|
storage(target: {
|
|
@@ -507,4 +526,4 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
507
526
|
|
|
508
527
|
declare const useGL: (props?: Partial<GL>) => reev.EventState<GL>;
|
|
509
528
|
|
|
510
|
-
export { AttribData, GL, StorageData, TextureData, UniformData, WebGLState, WebGPUState, createGL, isGL, isServer, isWebGPUSupported, useGL };
|
|
529
|
+
export { type AttribData, type GL, type StorageData, type TextureData, type UniformData, type WebGLState, type WebGPUState, createGL, isGL, isServer, isWebGPUSupported, useGL };
|
package/dist/solid.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { EventState, Nested } from 'reev';
|
|
|
3
3
|
import * as refr from 'refr';
|
|
4
4
|
import { Queue, Frame } from 'refr';
|
|
5
5
|
|
|
6
|
-
declare const CONVERSIONS: readonly ["toBool", "
|
|
6
|
+
declare const CONVERSIONS: readonly ["toBool", "toUInt", "toInt", "toFloat", "toBVec2", "toIVec2", "toUVec2", "toVec2", "toBVec3", "toIVec3", "toUVec3", "toVec3", "toBVec4", "toIVec4", "toUVec4", "toVec4", "toColor", "toMat2", "toMat3", "toMat4"];
|
|
7
7
|
declare const TYPE_MAPPING: {
|
|
8
8
|
readonly bool: "bool";
|
|
9
9
|
readonly uint: "u32";
|
|
@@ -68,7 +68,7 @@ declare const OPERATOR_TYPE_RULES: readonly [readonly ["float", "vec2", "vec2"],
|
|
|
68
68
|
* 1.2. index.ts functions and
|
|
69
69
|
* 3.2. types.ts _N
|
|
70
70
|
*/
|
|
71
|
-
declare const FUNCTIONS: readonly [...("texture" | "all" | "any" | "determinant" | "distance" | "dot" | "length" | "lengthSq" | "luminance" | "cross" | "cubeTexture" | "texelFetch" | "textureLod")[], "abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "ceil", "cos", "cosh", "dFdx", "dFdy", "degrees", "exp", "exp2", "floor", "fract", "fwidth", "inverseSqrt", "log", "log2", "negate", "normalize", "oneMinus", "radians", "reciprocal", "round", "
|
|
71
|
+
declare const FUNCTIONS: readonly [...("texture" | "all" | "any" | "determinant" | "distance" | "dot" | "length" | "lengthSq" | "luminance" | "cross" | "cubeTexture" | "texelFetch" | "textureLod")[], "abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "ceil", "cos", "cosh", "dFdx", "dFdy", "degrees", "exp", "exp2", "floor", "fract", "fwidth", "inverse", "inverseSqrt", "log", "log2", "negate", "normalize", "oneMinus", "radians", "reciprocal", "round", "sign", "sin", "sinh", "sqrt", "tan", "tanh", "trunc", "saturate", "atan2", "clamp", "max", "min", "mix", "pow", "reflect", "refract", "smoothstep", "step"];
|
|
72
72
|
|
|
73
73
|
type Constants = (typeof CONSTANTS)[number] | 'void';
|
|
74
74
|
type Conversions = (typeof CONVERSIONS)[number];
|
|
@@ -82,14 +82,14 @@ interface FnLayout {
|
|
|
82
82
|
type: C | 'auto';
|
|
83
83
|
inputs?: Array<{
|
|
84
84
|
name: string;
|
|
85
|
-
type: C;
|
|
85
|
+
type: C | 'auto';
|
|
86
86
|
}>;
|
|
87
87
|
}
|
|
88
88
|
type StructFields = Record<string, X>;
|
|
89
89
|
/**
|
|
90
90
|
* node
|
|
91
91
|
*/
|
|
92
|
-
type NodeTypes = 'attribute' | 'storage' | 'uniform' | 'constant' | 'variable' | 'varying' | 'ternary' | 'builtin' | 'conversion' | 'operator' | 'function' | 'struct' | 'member' | 'element' | 'gather' | 'scatter' | 'scope' | 'assign' | 'loop' | 'define' | 'if' | 'switch' | 'declare' | 'return' | 'break' | 'continue';
|
|
92
|
+
type NodeTypes = 'attribute' | 'instance' | 'storage' | 'uniform' | 'constant' | 'variable' | 'varying' | 'ternary' | 'builtin' | 'conversion' | 'operator' | 'function' | 'struct' | 'member' | 'element' | 'gather' | 'scatter' | 'scope' | 'assign' | 'loop' | 'define' | 'if' | 'switch' | 'declare' | 'return' | 'break' | 'continue';
|
|
93
93
|
interface NodeProps {
|
|
94
94
|
id?: string;
|
|
95
95
|
args?: any[];
|
|
@@ -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
|
}
|
|
@@ -194,10 +194,11 @@ type XImpl<T extends C> = _X<T> & {
|
|
|
194
194
|
};
|
|
195
195
|
type C = Constants;
|
|
196
196
|
type X<T extends C = C> = T extends keyof ConstantsToType ? ConstantsToType[T] : _X<T>;
|
|
197
|
-
type Methods = Functions | Operators | Conversions | Swizzles | '__nodeType' | 'type' | 'props' | 'isProxy' | 'assign' | 'toVar' | 'toString' | 'element';
|
|
197
|
+
type Methods = Functions | Operators | Conversions | Swizzles | '__nodeType' | 'type' | 'props' | 'isProxy' | 'assign' | 'toVar' | 'toString' | 'element' | 'select';
|
|
198
198
|
interface _X<T extends C> {
|
|
199
199
|
readonly __nodeType?: T;
|
|
200
200
|
assign(x: any): X<T>;
|
|
201
|
+
select(x: number | X<T>, y: X<'bool'>): X<T>;
|
|
201
202
|
fragment(c: NodeContext): string;
|
|
202
203
|
toVar(name?: string): X<T>;
|
|
203
204
|
toString(c?: NodeContext): string;
|
|
@@ -241,20 +242,20 @@ interface _X<T extends C> {
|
|
|
241
242
|
shiftLeftAssign<U extends C>(x: ValidateOperator<T, U> extends 0 ? never : number | X<U>): X<T>;
|
|
242
243
|
shiftRightAssign<U extends C>(x: ValidateOperator<T, U> extends 0 ? never : number | X<U>): X<T>;
|
|
243
244
|
toBool(): Bool;
|
|
244
|
-
|
|
245
|
+
toUInt(): UInt;
|
|
245
246
|
toInt(): Int;
|
|
246
247
|
toFloat(): Float;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
toBVec2(): BVec2;
|
|
249
|
+
toIVec2(): IVec2;
|
|
250
|
+
toUVec2(): UVec2;
|
|
250
251
|
toVec2(): Vec2;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
toBVec3(): BVec3;
|
|
253
|
+
toIVec3(): IVec3;
|
|
254
|
+
toUVec3(): UVec3;
|
|
254
255
|
toVec3(): Vec3;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
toBVec4(): BVec4;
|
|
257
|
+
toIVec4(): IVec4;
|
|
258
|
+
toUVec4(): UVec4;
|
|
258
259
|
toVec4(): Vec4;
|
|
259
260
|
toColor(): Color;
|
|
260
261
|
toMat2(): Mat2;
|
|
@@ -338,14 +339,17 @@ type GL = EventState<{
|
|
|
338
339
|
isWebGL: boolean;
|
|
339
340
|
isError: boolean;
|
|
340
341
|
isLoop: boolean;
|
|
342
|
+
isDebug: boolean;
|
|
343
|
+
isDepth: boolean;
|
|
341
344
|
isGL: true;
|
|
342
345
|
width?: number;
|
|
343
346
|
height?: number;
|
|
344
347
|
size: [number, number];
|
|
345
348
|
mouse: [number, number];
|
|
346
349
|
count: number;
|
|
350
|
+
instanceCount: number;
|
|
351
|
+
particleCount: number | [number, number] | [number, number, number];
|
|
347
352
|
loading: number;
|
|
348
|
-
particles: 64 | 256 | 576 | 1024 | 1600 | 2304 | 3136 | 4096 | 4096 | 5184 | 6400;
|
|
349
353
|
el: HTMLCanvasElement;
|
|
350
354
|
vs?: string | Vec4;
|
|
351
355
|
cs?: string | Void;
|
|
@@ -372,7 +376,7 @@ type GL = EventState<{
|
|
|
372
376
|
error(e?: string): void;
|
|
373
377
|
render(): void;
|
|
374
378
|
resize(e?: Event): void;
|
|
375
|
-
mousemove(e:
|
|
379
|
+
mousemove(e: MouseEvent): void;
|
|
376
380
|
loop(): void;
|
|
377
381
|
/**
|
|
378
382
|
* setter
|
|
@@ -382,16 +386,21 @@ type GL = EventState<{
|
|
|
382
386
|
uniform(target: {
|
|
383
387
|
[key: string]: Uniform;
|
|
384
388
|
}): GL;
|
|
385
|
-
_texture?(key: string, value:
|
|
386
|
-
texture(key: string, value:
|
|
389
|
+
_texture?(key: string, value: Texture): GL;
|
|
390
|
+
texture(key: string, value: Texture): GL;
|
|
387
391
|
texture(target: {
|
|
388
|
-
[key: string]:
|
|
392
|
+
[key: string]: Texture;
|
|
389
393
|
}): GL;
|
|
390
394
|
_attribute?(key: string, value: Attribute, iboValue?: Attribute): GL;
|
|
391
395
|
attribute(key: string, value: Attribute, iboValue?: Attribute): GL;
|
|
392
396
|
attribute(target: {
|
|
393
397
|
[key: string]: Attribute;
|
|
394
398
|
}): GL;
|
|
399
|
+
_instance?(key: string, value: Attribute, at?: number): GL;
|
|
400
|
+
instance(key: string, value: Attribute, at?: number): GL;
|
|
401
|
+
instance(target: {
|
|
402
|
+
[key: string]: Attribute;
|
|
403
|
+
}): GL;
|
|
395
404
|
_storage?(key: string, value: Storage): GL;
|
|
396
405
|
storage(key: string, value: Storage): GL;
|
|
397
406
|
storage(target: {
|
|
@@ -399,6 +408,7 @@ type GL = EventState<{
|
|
|
399
408
|
}): GL;
|
|
400
409
|
}>;
|
|
401
410
|
type Uniform = number | number[] | Float32Array;
|
|
411
|
+
type Texture = string | HTMLImageElement | HTMLVideoElement;
|
|
402
412
|
type Attribute = number[] | Float32Array;
|
|
403
413
|
type Storage = number[] | Float32Array;
|
|
404
414
|
/**
|
|
@@ -422,6 +432,7 @@ interface AttribData {
|
|
|
422
432
|
buffer: GPUBuffer;
|
|
423
433
|
location: number;
|
|
424
434
|
stride: number;
|
|
435
|
+
isInstance?: boolean;
|
|
425
436
|
}
|
|
426
437
|
interface StorageData {
|
|
427
438
|
array: Float32Array;
|
|
@@ -453,14 +464,17 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
453
464
|
isWebGL: boolean;
|
|
454
465
|
isError: boolean;
|
|
455
466
|
isLoop: boolean;
|
|
467
|
+
isDebug: boolean;
|
|
468
|
+
isDepth: boolean;
|
|
456
469
|
isGL: true;
|
|
457
470
|
width?: number;
|
|
458
471
|
height?: number;
|
|
459
472
|
size: [number, number];
|
|
460
473
|
mouse: [number, number];
|
|
461
474
|
count: number;
|
|
475
|
+
instanceCount: number;
|
|
476
|
+
particleCount: number | [number, number] | [number, number, number];
|
|
462
477
|
loading: number;
|
|
463
|
-
particles: 64 | 256 | 576 | 1024 | 1600 | 2304 | 3136 | 4096 | 4096 | 5184 | 6400;
|
|
464
478
|
el: HTMLCanvasElement;
|
|
465
479
|
vs?: string | Vec4;
|
|
466
480
|
cs?: string | Void;
|
|
@@ -481,23 +495,28 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
481
495
|
error(e?: string): void;
|
|
482
496
|
render(): void;
|
|
483
497
|
resize(e?: Event): void;
|
|
484
|
-
mousemove(e:
|
|
498
|
+
mousemove(e: MouseEvent): void;
|
|
485
499
|
loop(): void;
|
|
486
500
|
_uniform?(key: string, value: number | number[] | Float32Array<ArrayBufferLike>, isMatrix?: boolean): GL;
|
|
487
501
|
uniform(key: string, value: number | number[] | Float32Array<ArrayBufferLike>, isMatrix?: boolean): GL;
|
|
488
502
|
uniform(target: {
|
|
489
503
|
[key: string]: number | number[] | Float32Array<ArrayBufferLike>;
|
|
490
504
|
}): GL;
|
|
491
|
-
_texture?(key: string, value: string): GL;
|
|
492
|
-
texture(key: string, value: string): GL;
|
|
505
|
+
_texture?(key: string, value: string | HTMLImageElement | HTMLVideoElement): GL;
|
|
506
|
+
texture(key: string, value: string | HTMLImageElement | HTMLVideoElement): GL;
|
|
493
507
|
texture(target: {
|
|
494
|
-
[key: string]: string;
|
|
508
|
+
[key: string]: string | HTMLImageElement | HTMLVideoElement;
|
|
495
509
|
}): GL;
|
|
496
510
|
_attribute?(key: string, value: number[] | Float32Array<ArrayBufferLike>, iboValue?: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
497
511
|
attribute(key: string, value: number[] | Float32Array<ArrayBufferLike>, iboValue?: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
498
512
|
attribute(target: {
|
|
499
513
|
[key: string]: number[] | Float32Array<ArrayBufferLike>;
|
|
500
514
|
}): GL;
|
|
515
|
+
_instance?(key: string, value: number[] | Float32Array<ArrayBufferLike>, at?: number): GL;
|
|
516
|
+
instance(key: string, value: number[] | Float32Array<ArrayBufferLike>, at?: number): GL;
|
|
517
|
+
instance(target: {
|
|
518
|
+
[key: string]: number[] | Float32Array<ArrayBufferLike>;
|
|
519
|
+
}): GL;
|
|
501
520
|
_storage?(key: string, value: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
502
521
|
storage(key: string, value: number[] | Float32Array<ArrayBufferLike>): GL;
|
|
503
522
|
storage(target: {
|
|
@@ -507,4 +526,4 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
|
|
|
507
526
|
|
|
508
527
|
declare const onGL: (props?: Partial<GL>) => reev.EventState<GL>;
|
|
509
528
|
|
|
510
|
-
export { AttribData, GL, StorageData, TextureData, UniformData, WebGLState, WebGPUState, createGL, isGL, isServer, isWebGPUSupported, onGL };
|
|
529
|
+
export { type AttribData, type GL, type StorageData, type TextureData, type UniformData, type WebGLState, type WebGPUState, createGL, isGL, isServer, isWebGPUSupported, onGL };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glre",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"author": "tseijp",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -30,26 +30,26 @@
|
|
|
30
30
|
"module": "./dist/index.js",
|
|
31
31
|
"exports": {
|
|
32
32
|
"./packages.json": "./packages.json",
|
|
33
|
-
"./src/node": {
|
|
34
|
-
"types": "./src/node/index.ts",
|
|
35
|
-
"import": "./src/node/index.ts",
|
|
36
|
-
"default": "./src/node/index.ts"
|
|
37
|
-
},
|
|
38
|
-
"./src/react": {
|
|
39
|
-
"types": "./src/react.ts",
|
|
40
|
-
"import": "./src/react.ts",
|
|
41
|
-
"default": "./src/react.ts"
|
|
42
|
-
},
|
|
43
33
|
"./src/addons": {
|
|
44
34
|
"types": "./src/addons/index.ts",
|
|
45
35
|
"import": "./src/addons/index.ts",
|
|
46
36
|
"default": "./src/addons/index.ts"
|
|
47
37
|
},
|
|
38
|
+
"./src/node": {
|
|
39
|
+
"types": "./src/node/index.ts",
|
|
40
|
+
"import": "./src/node/index.ts",
|
|
41
|
+
"default": "./src/node/index.ts"
|
|
42
|
+
},
|
|
48
43
|
"./src/native": {
|
|
49
44
|
"types": "./src/native.ts",
|
|
50
45
|
"import": "./src/native.ts",
|
|
51
46
|
"default": "./src/native.ts"
|
|
52
47
|
},
|
|
48
|
+
"./src/react": {
|
|
49
|
+
"types": "./src/react.ts",
|
|
50
|
+
"import": "./src/react.ts",
|
|
51
|
+
"default": "./src/react.ts"
|
|
52
|
+
},
|
|
53
53
|
"./src/solid": {
|
|
54
54
|
"types": "./src/solid.ts",
|
|
55
55
|
"import": "./src/solid.ts",
|
|
@@ -86,19 +86,6 @@
|
|
|
86
86
|
"require": "./dist/node.cjs",
|
|
87
87
|
"default": "./dist/node.js"
|
|
88
88
|
},
|
|
89
|
-
"./react": {
|
|
90
|
-
"types": "./dist/react.d.ts",
|
|
91
|
-
"import": {
|
|
92
|
-
"types": "./dist/react.d.ts",
|
|
93
|
-
"default": "./dist/react.js"
|
|
94
|
-
},
|
|
95
|
-
"module": {
|
|
96
|
-
"types": "./dist/react.d.ts",
|
|
97
|
-
"default": "./dist/react.js"
|
|
98
|
-
},
|
|
99
|
-
"require": "./dist/react.cjs",
|
|
100
|
-
"default": "./dist/react.js"
|
|
101
|
-
},
|
|
102
89
|
"./native": {
|
|
103
90
|
"types": "./dist/native.d.ts",
|
|
104
91
|
"import": {
|
|
@@ -112,6 +99,19 @@
|
|
|
112
99
|
"require": "./dist/native.cjs",
|
|
113
100
|
"default": "./dist/native.js"
|
|
114
101
|
},
|
|
102
|
+
"./react": {
|
|
103
|
+
"types": "./dist/react.d.ts",
|
|
104
|
+
"import": {
|
|
105
|
+
"types": "./dist/react.d.ts",
|
|
106
|
+
"default": "./dist/react.js"
|
|
107
|
+
},
|
|
108
|
+
"module": {
|
|
109
|
+
"types": "./dist/react.d.ts",
|
|
110
|
+
"default": "./dist/react.js"
|
|
111
|
+
},
|
|
112
|
+
"require": "./dist/react.cjs",
|
|
113
|
+
"default": "./dist/react.js"
|
|
114
|
+
},
|
|
115
115
|
"./solid": {
|
|
116
116
|
"types": "./dist/solid.d.ts",
|
|
117
117
|
"import": {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fn, Float, pow, sin } from '../../../node'
|
|
2
|
+
import { PI } from '../../math/const'
|
|
3
|
+
|
|
4
|
+
export const backIn = Fn(([t]: [Float]): Float => {
|
|
5
|
+
return pow(t, 3).sub(t.mul(sin(t.mul(PI))))
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'backIn',
|
|
8
|
+
type: 'float',
|
|
9
|
+
inputs: [{ name: 't', type: 'float' }],
|
|
10
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Fn, Float, float } from '../../../node'
|
|
2
|
+
import { backIn } from './backIn'
|
|
3
|
+
|
|
4
|
+
export const backInOut = Fn(([t]: [Float]): Float => {
|
|
5
|
+
const f = t.mul(2).select(float(1).sub(t.mul(2).sub(1)), t.lessThan(0.5))
|
|
6
|
+
const g = backIn(f)
|
|
7
|
+
return g.div(2).select(float(1).sub(g).div(2).add(0.5), t.lessThan(0.5))
|
|
8
|
+
}).setLayout({
|
|
9
|
+
name: 'backInOut',
|
|
10
|
+
type: 'float',
|
|
11
|
+
inputs: [{ name: 't', type: 'float' }],
|
|
12
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fn, Float, float } from '../../../node'
|
|
2
|
+
import { backIn } from './backIn'
|
|
3
|
+
|
|
4
|
+
export const backOut = Fn(([t]: [Float]): Float => {
|
|
5
|
+
return float(1).sub(backIn(float(1).sub(t)))
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'backOut',
|
|
8
|
+
type: 'float',
|
|
9
|
+
inputs: [{ name: 't', type: 'float' }],
|
|
10
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fn, Float, float } from '../../../node'
|
|
2
|
+
import { bounceOut } from './bounceOut'
|
|
3
|
+
|
|
4
|
+
export const bounceIn = Fn(([t]: [Float]): Float => {
|
|
5
|
+
return float(1).sub(bounceOut(float(1).sub(t)))
|
|
6
|
+
}).setLayout({
|
|
7
|
+
name: 'bounceIn',
|
|
8
|
+
type: 'float',
|
|
9
|
+
inputs: [{ name: 't', type: 'float' }],
|
|
10
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Fn, Float, float } from '../../../node'
|
|
2
|
+
import { bounceOut } from './bounceOut'
|
|
3
|
+
|
|
4
|
+
export const bounceInOut = Fn(([t]: [Float]): Float => {
|
|
5
|
+
return float(1)
|
|
6
|
+
.sub(bounceOut(float(1).sub(t.mul(2))))
|
|
7
|
+
.div(2)
|
|
8
|
+
.select(bounceOut(t.mul(2).sub(1)).div(2).add(0.5), t.lessThan(0.5))
|
|
9
|
+
}).setLayout({
|
|
10
|
+
name: 'bounceInOut',
|
|
11
|
+
type: 'float',
|
|
12
|
+
inputs: [{ name: 't', type: 'float' }],
|
|
13
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Fn, Float, float } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const bounceOut = Fn(([t]: [Float]): Float => {
|
|
4
|
+
const a = float(4 / 11)
|
|
5
|
+
const b = float(8 / 11)
|
|
6
|
+
const c = float(9 / 10)
|
|
7
|
+
const ca = float(4356.0 / 361.0)
|
|
8
|
+
const cb = float(35442.0 / 1805.0)
|
|
9
|
+
const cc = float(16061.0 / 1805.0)
|
|
10
|
+
const t2 = t.mul(t)
|
|
11
|
+
return t2.mul(7.5625).select(
|
|
12
|
+
t2
|
|
13
|
+
.mul(9.075)
|
|
14
|
+
.sub(t.mul(9.9))
|
|
15
|
+
.add(3.4)
|
|
16
|
+
.select(
|
|
17
|
+
t2
|
|
18
|
+
.mul(ca)
|
|
19
|
+
.sub(t.mul(cb))
|
|
20
|
+
.add(cc)
|
|
21
|
+
.select(t2.mul(10.8).sub(t.mul(20.52)).add(10.72), t.lessThan(c)),
|
|
22
|
+
t.lessThan(b)
|
|
23
|
+
),
|
|
24
|
+
t.lessThan(a)
|
|
25
|
+
)
|
|
26
|
+
}).setLayout({
|
|
27
|
+
name: 'bounceOut',
|
|
28
|
+
type: 'float',
|
|
29
|
+
inputs: [{ name: 't', type: 'float' }],
|
|
30
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Fn, X } from '../../../node'
|
|
2
|
+
|
|
3
|
+
export const circularInOut = Fn(([t]: [X]): X => {
|
|
4
|
+
const early = t.mul(t).mul(4).oneMinus().sqrt().oneMinus().div(2)
|
|
5
|
+
const late = t.mul(2).sub(1).mul(t.mul(-2).add(3)).sqrt().add(1).div(2)
|
|
6
|
+
return (early as any).select(late, t.lessThan(0.5))
|
|
7
|
+
}).setLayout({
|
|
8
|
+
name: 'circularInOut',
|
|
9
|
+
type: 'auto',
|
|
10
|
+
inputs: [{ name: 't', type: 'auto' }],
|
|
11
|
+
})
|