@sparkjsdev/spark 0.1.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/LICENSE +21 -0
- package/README.md +212 -0
- package/dist/assets/worker-DQiiPuma.js.map +1 -0
- package/dist/assets/worker-DnqMl73p.js.map +1 -0
- package/dist/spark.cjs.js +12696 -0
- package/dist/spark.cjs.js.map +1 -0
- package/dist/spark.cjs.min.js +1086 -0
- package/dist/spark.cjs.min.js.map +1 -0
- package/dist/spark.module.js +12679 -0
- package/dist/spark.module.js.map +1 -0
- package/dist/spark.module.min.js +10048 -0
- package/dist/spark.module.min.js.map +1 -0
- package/dist/types/ForgeRenderer.d.ts +136 -0
- package/dist/types/ForgeViewpoint.d.ts +83 -0
- package/dist/types/PackedSplats.d.ts +87 -0
- package/dist/types/Readback.d.ts +50 -0
- package/dist/types/RgbaArray.d.ts +44 -0
- package/dist/types/SplatAccumulator.d.ts +27 -0
- package/dist/types/SplatEdit.d.ts +94 -0
- package/dist/types/SplatGenerator.d.ts +61 -0
- package/dist/types/SplatGeometry.d.ts +7 -0
- package/dist/types/SplatLoader.d.ts +80 -0
- package/dist/types/SplatMesh.d.ts +85 -0
- package/dist/types/SplatSkinning.d.ts +29 -0
- package/dist/types/antisplat.d.ts +5 -0
- package/dist/types/controls.d.ts +114 -0
- package/dist/types/defines.d.ts +17 -0
- package/dist/types/dyno/base.d.ts +174 -0
- package/dist/types/dyno/control.d.ts +6 -0
- package/dist/types/dyno/convert.d.ts +190 -0
- package/dist/types/dyno/logic.d.ts +103 -0
- package/dist/types/dyno/math.d.ts +214 -0
- package/dist/types/dyno/mathTypes.d.ts +47 -0
- package/dist/types/dyno/output.d.ts +25 -0
- package/dist/types/dyno/program.d.ts +30 -0
- package/dist/types/dyno/splats.d.ts +156 -0
- package/dist/types/dyno/texture.d.ts +50 -0
- package/dist/types/dyno/transform.d.ts +59 -0
- package/dist/types/dyno/trig.d.ts +94 -0
- package/dist/types/dyno/types.d.ts +62 -0
- package/dist/types/dyno/uniforms.d.ts +374 -0
- package/dist/types/dyno/util.d.ts +139 -0
- package/dist/types/dyno/value.d.ts +32 -0
- package/dist/types/dyno/vecmat.d.ts +226 -0
- package/dist/types/dyno.d.ts +16 -0
- package/dist/types/generators/snow.d.ts +65 -0
- package/dist/types/generators/static.d.ts +9 -0
- package/dist/types/generators.d.ts +2 -0
- package/dist/types/hands.d.ts +95 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/ksplat.d.ts +6 -0
- package/dist/types/ply.d.ts +31 -0
- package/dist/types/shaders.d.ts +1 -0
- package/dist/types/splatConstructors.d.ts +46 -0
- package/dist/types/splatWorker.d.ts +20 -0
- package/dist/types/spz.d.ts +50 -0
- package/dist/types/utils.d.ts +150 -0
- package/dist/types/vrButton.d.ts +6 -0
- package/dist/types/worker.d.ts +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Dyno, DynoBlock } from './base';
|
|
2
|
+
import { ValueTypes } from './types';
|
|
3
|
+
import { DynoVal, DynoValue, HasDynoOut } from './value';
|
|
4
|
+
export declare const remapIndex: (index: DynoVal<"int">, from: DynoVal<"int">, to: DynoVal<"int">) => DynoVal<"int">;
|
|
5
|
+
export declare const pcgMix: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"uint">;
|
|
6
|
+
export declare const pcgNext: (state: DynoVal<"uint">) => DynoVal<"uint">;
|
|
7
|
+
export declare const pcgHash: (state: DynoVal<"uint">) => DynoVal<"uint">;
|
|
8
|
+
export declare const hash: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"uint">;
|
|
9
|
+
export declare const hash2: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"uvec2">;
|
|
10
|
+
export declare const hash3: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"uvec3">;
|
|
11
|
+
export declare const hash4: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"uvec4">;
|
|
12
|
+
export declare const hashFloat: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"float">;
|
|
13
|
+
export declare const hashVec2: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"vec2">;
|
|
14
|
+
export declare const hashVec3: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"vec3">;
|
|
15
|
+
export declare const hashVec4: <T extends ValueTypes>(value: DynoVal<T>) => DynoVal<"vec4">;
|
|
16
|
+
export declare class DynoRemapIndex extends Dyno<{
|
|
17
|
+
from: "int";
|
|
18
|
+
to: "int";
|
|
19
|
+
index: "int";
|
|
20
|
+
}, {
|
|
21
|
+
index: "int";
|
|
22
|
+
}> implements HasDynoOut<"int"> {
|
|
23
|
+
constructor({ from, to, index, }: {
|
|
24
|
+
from: DynoVal<"int">;
|
|
25
|
+
to: DynoVal<"int">;
|
|
26
|
+
index: DynoVal<"int">;
|
|
27
|
+
});
|
|
28
|
+
dynoOut(): DynoValue<"int">;
|
|
29
|
+
}
|
|
30
|
+
export declare class PcgNext<T extends "uint" | "int" | "float"> extends Dyno<{
|
|
31
|
+
state: T;
|
|
32
|
+
}, {
|
|
33
|
+
state: "uint";
|
|
34
|
+
}> implements HasDynoOut<"uint"> {
|
|
35
|
+
constructor({ state }: {
|
|
36
|
+
state: DynoVal<T>;
|
|
37
|
+
});
|
|
38
|
+
dynoOut(): DynoValue<"uint">;
|
|
39
|
+
}
|
|
40
|
+
export declare class PcgHash extends Dyno<{
|
|
41
|
+
state: "uint";
|
|
42
|
+
}, {
|
|
43
|
+
hash: "uint";
|
|
44
|
+
}> implements HasDynoOut<"uint"> {
|
|
45
|
+
constructor({ state }: {
|
|
46
|
+
state: DynoVal<"uint">;
|
|
47
|
+
});
|
|
48
|
+
dynoOut(): DynoValue<"uint">;
|
|
49
|
+
}
|
|
50
|
+
export declare class PcgMix<T extends ValueTypes> extends Dyno<{
|
|
51
|
+
value: T;
|
|
52
|
+
}, {
|
|
53
|
+
state: "uint";
|
|
54
|
+
}> implements HasDynoOut<"uint"> {
|
|
55
|
+
constructor({ value }: {
|
|
56
|
+
value: DynoVal<T>;
|
|
57
|
+
});
|
|
58
|
+
dynoOut(): DynoValue<"uint">;
|
|
59
|
+
}
|
|
60
|
+
export declare class Hash<T extends ValueTypes> extends DynoBlock<{
|
|
61
|
+
value: T;
|
|
62
|
+
}, {
|
|
63
|
+
hash: "uint";
|
|
64
|
+
}> implements HasDynoOut<"uint"> {
|
|
65
|
+
constructor({ value }: {
|
|
66
|
+
value: DynoVal<T>;
|
|
67
|
+
});
|
|
68
|
+
dynoOut(): DynoValue<"uint">;
|
|
69
|
+
}
|
|
70
|
+
export declare class Hash2<T extends ValueTypes> extends DynoBlock<{
|
|
71
|
+
value: T;
|
|
72
|
+
}, {
|
|
73
|
+
hash: "uvec2";
|
|
74
|
+
}> implements HasDynoOut<"uvec2"> {
|
|
75
|
+
constructor({ value }: {
|
|
76
|
+
value: DynoVal<T>;
|
|
77
|
+
});
|
|
78
|
+
dynoOut(): DynoValue<"uvec2">;
|
|
79
|
+
}
|
|
80
|
+
export declare class Hash3<T extends ValueTypes> extends DynoBlock<{
|
|
81
|
+
value: T;
|
|
82
|
+
}, {
|
|
83
|
+
hash: "uvec3";
|
|
84
|
+
}> implements HasDynoOut<"uvec3"> {
|
|
85
|
+
constructor({ value }: {
|
|
86
|
+
value: DynoVal<T>;
|
|
87
|
+
});
|
|
88
|
+
dynoOut(): DynoValue<"uvec3">;
|
|
89
|
+
}
|
|
90
|
+
export declare class Hash4<T extends ValueTypes> extends DynoBlock<{
|
|
91
|
+
value: T;
|
|
92
|
+
}, {
|
|
93
|
+
hash: "uvec4";
|
|
94
|
+
}> implements HasDynoOut<"uvec4"> {
|
|
95
|
+
constructor({ value }: {
|
|
96
|
+
value: DynoVal<T>;
|
|
97
|
+
});
|
|
98
|
+
dynoOut(): DynoValue<"uvec4">;
|
|
99
|
+
}
|
|
100
|
+
export declare class HashFloat<T extends ValueTypes> extends DynoBlock<{
|
|
101
|
+
value: T;
|
|
102
|
+
}, {
|
|
103
|
+
hash: "float";
|
|
104
|
+
}> implements HasDynoOut<"float"> {
|
|
105
|
+
constructor({ value }: {
|
|
106
|
+
value: DynoVal<T>;
|
|
107
|
+
});
|
|
108
|
+
dynoOut(): DynoValue<"float">;
|
|
109
|
+
}
|
|
110
|
+
export declare class HashVec2<T extends ValueTypes> extends DynoBlock<{
|
|
111
|
+
value: T;
|
|
112
|
+
}, {
|
|
113
|
+
hash: "vec2";
|
|
114
|
+
}> implements HasDynoOut<"vec2"> {
|
|
115
|
+
constructor({ value }: {
|
|
116
|
+
value: DynoVal<T>;
|
|
117
|
+
});
|
|
118
|
+
dynoOut(): DynoValue<"vec2">;
|
|
119
|
+
}
|
|
120
|
+
export declare class HashVec3<T extends ValueTypes> extends DynoBlock<{
|
|
121
|
+
value: T;
|
|
122
|
+
}, {
|
|
123
|
+
hash: "vec3";
|
|
124
|
+
}> implements HasDynoOut<"vec3"> {
|
|
125
|
+
constructor({ value }: {
|
|
126
|
+
value: DynoVal<T>;
|
|
127
|
+
});
|
|
128
|
+
dynoOut(): DynoValue<"vec3">;
|
|
129
|
+
}
|
|
130
|
+
export declare class HashVec4<T extends ValueTypes> extends DynoBlock<{
|
|
131
|
+
value: T;
|
|
132
|
+
}, {
|
|
133
|
+
hash: "vec4";
|
|
134
|
+
}> implements HasDynoOut<"vec4"> {
|
|
135
|
+
constructor({ value }: {
|
|
136
|
+
value: DynoVal<T>;
|
|
137
|
+
});
|
|
138
|
+
dynoOut(): DynoValue<"vec4">;
|
|
139
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Dyno, IOTypes } from './base';
|
|
2
|
+
import { DynoJsType, DynoType, SimpleTypes } from './types';
|
|
3
|
+
export type DynoVal<T extends DynoType> = DynoValue<T> | HasDynoOut<T>;
|
|
4
|
+
export declare function valType<T extends DynoType>(val: DynoVal<T>): T;
|
|
5
|
+
export interface HasDynoOut<T extends DynoType> {
|
|
6
|
+
dynoOut(): DynoValue<T>;
|
|
7
|
+
}
|
|
8
|
+
export declare class DynoValue<T extends DynoType> {
|
|
9
|
+
type: T;
|
|
10
|
+
private __isDynoValue;
|
|
11
|
+
constructor(type: T);
|
|
12
|
+
}
|
|
13
|
+
export declare class DynoOutput<T extends DynoType, InTypes extends IOTypes, OutTypes extends IOTypes> extends DynoValue<T> {
|
|
14
|
+
dyno: Dyno<InTypes, OutTypes>;
|
|
15
|
+
key: string;
|
|
16
|
+
constructor(dyno: Dyno<InTypes, OutTypes>, key: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class DynoLiteral<T extends DynoType> extends DynoValue<T> {
|
|
19
|
+
literal: string;
|
|
20
|
+
constructor(type: T, literal: string);
|
|
21
|
+
getLiteral(): string;
|
|
22
|
+
}
|
|
23
|
+
export declare function dynoLiteral<T extends DynoType>(type: T, literal: string): DynoLiteral<T>;
|
|
24
|
+
export declare class DynoConst<T extends DynoType> extends DynoLiteral<T> {
|
|
25
|
+
value: DynoJsType<T>;
|
|
26
|
+
constructor(type: T, value: DynoJsType<T>);
|
|
27
|
+
getLiteral(): string;
|
|
28
|
+
}
|
|
29
|
+
export declare function dynoConst<T extends DynoType>(type: T, value: DynoJsType<T>): DynoConst<T>;
|
|
30
|
+
export declare function literalZero(type: SimpleTypes): string;
|
|
31
|
+
export declare function literalOne(type: SimpleTypes): string;
|
|
32
|
+
export declare function literalNegOne(type: SimpleTypes): string;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { BinaryOp, Dyno, TrinaryOp, UnaryOp } from './base';
|
|
2
|
+
import { FloatTypes, IntTypes, MatFloatTypes, SquareMatTypes, UintTypes, VectorElementType, VectorTypes } from './types';
|
|
3
|
+
import { DynoVal, DynoValue, HasDynoOut } from './value';
|
|
4
|
+
export declare const length: <A extends "vec2" | "vec3" | "vec4">(a: DynoVal<A>) => DynoVal<"float">;
|
|
5
|
+
export declare const distance: <A extends "vec2" | "vec3" | "vec4">(a: DynoVal<A>, b: DynoVal<A>) => DynoVal<"float">;
|
|
6
|
+
export declare const dot: <A extends "vec2" | "vec3" | "vec4">(a: DynoVal<A>, b: DynoVal<A>) => DynoVal<"float">;
|
|
7
|
+
export declare const cross: (a: DynoVal<"vec3">, b: DynoVal<"vec3">) => DynoVal<"vec3">;
|
|
8
|
+
export declare const normalize: <A extends "vec2" | "vec3" | "vec4">(a: DynoVal<A>) => DynoVal<A>;
|
|
9
|
+
export declare const faceforward: <A extends "vec2" | "vec3" | "vec4">(a: DynoVal<A>, b: DynoVal<A>, c: DynoVal<A>) => DynoVal<A>;
|
|
10
|
+
export declare const reflectVec: <A extends "vec2" | "vec3" | "vec4">(incident: DynoVal<A>, normal: DynoVal<A>) => DynoVal<A>;
|
|
11
|
+
export declare const refractVec: <A extends "vec2" | "vec3" | "vec4">(incident: DynoVal<A>, normal: DynoVal<A>, eta: DynoVal<"float">) => DynoVal<A>;
|
|
12
|
+
export declare const split: <V extends VectorTypes>(vector: DynoVal<V>) => Split<V>;
|
|
13
|
+
export declare const combine: <V extends VectorTypes, T extends VectorElementType<V>>({ vector, vectorType, x, y, z, w, r, g, b, a, }: {
|
|
14
|
+
vector?: DynoVal<V>;
|
|
15
|
+
vectorType?: V;
|
|
16
|
+
x?: DynoVal<T>;
|
|
17
|
+
y?: DynoVal<T>;
|
|
18
|
+
z?: DynoVal<T>;
|
|
19
|
+
w?: DynoVal<T>;
|
|
20
|
+
r?: DynoVal<T>;
|
|
21
|
+
g?: DynoVal<T>;
|
|
22
|
+
b?: DynoVal<T>;
|
|
23
|
+
a?: DynoVal<T>;
|
|
24
|
+
}) => DynoVal<V>;
|
|
25
|
+
export declare const projectH: <A extends "vec3" | "vec4">(a: DynoVal<A>) => DynoVal<ProjectHOutput<A>>;
|
|
26
|
+
export declare const extendVec: <A extends "float" | "vec2" | "vec3">(a: DynoVal<A>, b: DynoVal<"float">) => DynoVal<ExtendVecOutput<A>>;
|
|
27
|
+
export declare const swizzle: <A extends VectorTypes, S extends SwizzleSelect>(a: DynoVal<A>, select: S) => DynoVal<SwizzleOutput<A, SwizzleSelectLen<S>>>;
|
|
28
|
+
export declare const compMult: <A extends MatFloatTypes>(a: DynoVal<A>, b: DynoVal<A>) => DynoVal<A>;
|
|
29
|
+
export declare const outer: <A extends "vec2" | "vec3" | "vec4", B extends "vec2" | "vec3" | "vec4">(a: DynoVal<A>, b: DynoVal<B>) => DynoVal<OuterOutput<A, B>>;
|
|
30
|
+
export declare const transpose: <A extends MatFloatTypes>(a: DynoVal<A>) => DynoVal<TransposeOutput<A>>;
|
|
31
|
+
export declare const determinant: <A extends SquareMatTypes>(a: DynoVal<A>) => DynoVal<"float">;
|
|
32
|
+
export declare const inverse: <A extends SquareMatTypes>(a: DynoVal<A>) => DynoVal<A>;
|
|
33
|
+
export declare class Length<A extends "vec2" | "vec3" | "vec4"> extends UnaryOp<A, "float", "length"> {
|
|
34
|
+
constructor({ a }: {
|
|
35
|
+
a: DynoVal<A>;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export declare class Distance<A extends "vec2" | "vec3" | "vec4"> extends BinaryOp<A, A, "float", "distance"> {
|
|
39
|
+
constructor({ a, b }: {
|
|
40
|
+
a: DynoVal<A>;
|
|
41
|
+
b: DynoVal<A>;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export declare class Dot<A extends "vec2" | "vec3" | "vec4"> extends BinaryOp<A, A, "float", "dot"> {
|
|
45
|
+
constructor({ a, b }: {
|
|
46
|
+
a: DynoVal<A>;
|
|
47
|
+
b: DynoVal<A>;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export declare class Cross extends BinaryOp<"vec3", "vec3", "vec3", "cross"> {
|
|
51
|
+
constructor({ a, b }: {
|
|
52
|
+
a: DynoVal<"vec3">;
|
|
53
|
+
b: DynoVal<"vec3">;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export declare class Normalize<A extends "vec2" | "vec3" | "vec4"> extends UnaryOp<A, A, "normalize"> {
|
|
57
|
+
constructor({ a }: {
|
|
58
|
+
a: DynoVal<A>;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
type ProjectHOutput<A extends "vec3" | "vec4"> = A extends "vec3" ? "vec2" : A extends "vec4" ? "vec3" : never;
|
|
62
|
+
export declare class ProjectH<A extends "vec3" | "vec4"> extends UnaryOp<A, ProjectHOutput<A>, "projected"> {
|
|
63
|
+
constructor({ a }: {
|
|
64
|
+
a: DynoVal<A>;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
type ExtendVecOutput<A extends "float" | "vec2" | "vec3"> = A extends "float" ? "vec2" : A extends "vec2" ? "vec3" : A extends "vec3" ? "vec4" : never;
|
|
68
|
+
export declare class ExtendVec<A extends "float" | "vec2" | "vec3"> extends BinaryOp<A, "float", ExtendVecOutput<A>, "extend"> {
|
|
69
|
+
constructor({ a, b }: {
|
|
70
|
+
a: DynoVal<A>;
|
|
71
|
+
b: DynoVal<"float">;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export declare class FaceForward<A extends "vec2" | "vec3" | "vec4"> extends TrinaryOp<A, A, A, A, "forward"> {
|
|
75
|
+
constructor({ a, b, c }: {
|
|
76
|
+
a: DynoVal<A>;
|
|
77
|
+
b: DynoVal<A>;
|
|
78
|
+
c: DynoVal<A>;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export declare class ReflectVec<A extends "vec2" | "vec3" | "vec4"> extends BinaryOp<A, A, A, "reflection"> {
|
|
82
|
+
constructor({ incident, normal, }: {
|
|
83
|
+
incident: DynoVal<A>;
|
|
84
|
+
normal: DynoVal<A>;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export declare class RefractVec<A extends "vec2" | "vec3" | "vec4"> extends TrinaryOp<A, A, "float", A, "refraction"> {
|
|
88
|
+
constructor({ incident, normal, eta, }: {
|
|
89
|
+
incident: DynoVal<A>;
|
|
90
|
+
normal: DynoVal<A>;
|
|
91
|
+
eta: DynoVal<"float">;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export declare class CompMult<A extends MatFloatTypes> extends BinaryOp<A, A, A, "product"> {
|
|
95
|
+
constructor({ a, b }: {
|
|
96
|
+
a: DynoVal<A>;
|
|
97
|
+
b: DynoVal<A>;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
type OuterOutput<A extends "vec2" | "vec3" | "vec4", B extends "vec2" | "vec3" | "vec4"> = A extends "vec2" ? B extends "vec2" ? "mat2" : B extends "vec3" ? "mat3x2" : B extends "vec4" ? "mat4x2" : never : A extends "vec3" ? B extends "vec2" ? "mat2x3" : B extends "vec3" ? "mat3" : B extends "vec4" ? "mat4x3" : never : A extends "vec4" ? B extends "vec2" ? "mat2x4" : B extends "vec3" ? "mat3x4" : B extends "vec4" ? "mat4" : never : never;
|
|
101
|
+
export declare class Outer<A extends "vec2" | "vec3" | "vec4", B extends "vec2" | "vec3" | "vec4"> extends BinaryOp<A, B, OuterOutput<A, B>, "outer"> {
|
|
102
|
+
constructor({ a, b }: {
|
|
103
|
+
a: DynoVal<A>;
|
|
104
|
+
b: DynoVal<B>;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
type TransposeOutput<A extends MatFloatTypes> = A extends SquareMatTypes ? A : A extends "mat2x3" ? "mat3x2" : A extends "mat2x4" ? "mat4x2" : A extends "mat3x2" ? "mat2x3" : A extends "mat3x4" ? "mat4x3" : A extends "mat4x2" ? "mat2x4" : A extends "mat4x3" ? "mat3x4" : never;
|
|
108
|
+
export declare class Transpose<A extends MatFloatTypes> extends UnaryOp<A, TransposeOutput<A>, "transpose"> {
|
|
109
|
+
constructor({ a }: {
|
|
110
|
+
a: DynoVal<A>;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
export declare class Determinant<A extends SquareMatTypes> extends UnaryOp<A, "float", "det"> {
|
|
114
|
+
constructor({ a }: {
|
|
115
|
+
a: DynoVal<A>;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export declare class Inverse<A extends SquareMatTypes> extends UnaryOp<A, A, "inverse"> {
|
|
119
|
+
constructor({ a }: {
|
|
120
|
+
a: DynoVal<A>;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
type SplitOutTypes<A extends VectorTypes> = A extends "vec2" ? {
|
|
124
|
+
x: "float";
|
|
125
|
+
y: "float";
|
|
126
|
+
r: "float";
|
|
127
|
+
g: "float";
|
|
128
|
+
} : A extends "vec3" ? {
|
|
129
|
+
x: "float";
|
|
130
|
+
y: "float";
|
|
131
|
+
z: "float";
|
|
132
|
+
r: "float";
|
|
133
|
+
g: "float";
|
|
134
|
+
b: "float";
|
|
135
|
+
} : A extends "vec4" ? {
|
|
136
|
+
x: "float";
|
|
137
|
+
y: "float";
|
|
138
|
+
z: "float";
|
|
139
|
+
w: "float";
|
|
140
|
+
r: "float";
|
|
141
|
+
g: "float";
|
|
142
|
+
b: "float";
|
|
143
|
+
a: "float";
|
|
144
|
+
} : A extends "ivec2" ? {
|
|
145
|
+
x: "int";
|
|
146
|
+
y: "int";
|
|
147
|
+
r: "int";
|
|
148
|
+
g: "int";
|
|
149
|
+
} : A extends "ivec3" ? {
|
|
150
|
+
x: "int";
|
|
151
|
+
y: "int";
|
|
152
|
+
z: "int";
|
|
153
|
+
r: "int";
|
|
154
|
+
g: "int";
|
|
155
|
+
b: "int";
|
|
156
|
+
} : A extends "ivec4" ? {
|
|
157
|
+
x: "int";
|
|
158
|
+
y: "int";
|
|
159
|
+
z: "int";
|
|
160
|
+
w: "int";
|
|
161
|
+
r: "int";
|
|
162
|
+
g: "int";
|
|
163
|
+
b: "int";
|
|
164
|
+
a: "int";
|
|
165
|
+
} : A extends "uvec2" ? {
|
|
166
|
+
x: "uint";
|
|
167
|
+
y: "uint";
|
|
168
|
+
r: "uint";
|
|
169
|
+
g: "uint";
|
|
170
|
+
} : A extends "uvec3" ? {
|
|
171
|
+
x: "uint";
|
|
172
|
+
y: "uint";
|
|
173
|
+
z: "uint";
|
|
174
|
+
r: "uint";
|
|
175
|
+
g: "uint";
|
|
176
|
+
b: "uint";
|
|
177
|
+
} : A extends "uvec4" ? {
|
|
178
|
+
x: "uint";
|
|
179
|
+
y: "uint";
|
|
180
|
+
z: "uint";
|
|
181
|
+
w: "uint";
|
|
182
|
+
r: "uint";
|
|
183
|
+
g: "uint";
|
|
184
|
+
b: "uint";
|
|
185
|
+
a: "uint";
|
|
186
|
+
} : never;
|
|
187
|
+
export declare class Split<V extends VectorTypes> extends Dyno<{
|
|
188
|
+
vector: V;
|
|
189
|
+
}, SplitOutTypes<V>> {
|
|
190
|
+
constructor({ vector }: {
|
|
191
|
+
vector: DynoVal<V>;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
export declare class Combine<V extends VectorTypes, T extends VectorElementType<V>> extends Dyno<SplitOutTypes<V> & {
|
|
195
|
+
vector: V;
|
|
196
|
+
}, {
|
|
197
|
+
vector: V;
|
|
198
|
+
}> implements HasDynoOut<V> {
|
|
199
|
+
constructor({ vector, vectorType, x, y, z, w, r, g, b, a, }: {
|
|
200
|
+
vector?: DynoVal<V>;
|
|
201
|
+
vectorType?: V;
|
|
202
|
+
x?: DynoVal<T>;
|
|
203
|
+
y?: DynoVal<T>;
|
|
204
|
+
z?: DynoVal<T>;
|
|
205
|
+
w?: DynoVal<T>;
|
|
206
|
+
r?: DynoVal<T>;
|
|
207
|
+
g?: DynoVal<T>;
|
|
208
|
+
b?: DynoVal<T>;
|
|
209
|
+
a?: DynoVal<T>;
|
|
210
|
+
});
|
|
211
|
+
dynoOut(): DynoValue<V>;
|
|
212
|
+
}
|
|
213
|
+
type SwizzleOutput<A extends VectorTypes, Len extends number> = A extends FloatTypes ? Len extends 1 ? "float" : Len extends 2 ? "vec2" : Len extends 3 ? "vec3" : Len extends 4 ? "vec4" : never : A extends IntTypes ? Len extends 1 ? "int" : Len extends 2 ? "ivec2" : Len extends 3 ? "ivec3" : Len extends 4 ? "ivec4" : never : A extends UintTypes ? Len extends 1 ? "uint" : Len extends 2 ? "uvec2" : Len extends 3 ? "uvec3" : Len extends 4 ? "uvec4" : never : never;
|
|
214
|
+
type SwizzleSelectLen<S extends SwizzleSelect> = S extends Swizzle1Select ? 1 : S extends Swizzle2Select ? 2 : S extends Swizzle3Select ? 3 : S extends Swizzle4Select ? 4 : never;
|
|
215
|
+
type Swizzle1Select = `${"x" | "y" | "z" | "w"}|${"r" | "g" | "b" | "a"}`;
|
|
216
|
+
type Swizzle2Select = `${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}` | `${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}`;
|
|
217
|
+
type Swizzle3Select = `${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}` | `${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}`;
|
|
218
|
+
type Swizzle4Select = `${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}` | `${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}`;
|
|
219
|
+
type SwizzleSelect = Swizzle1Select | Swizzle2Select | Swizzle3Select | Swizzle4Select;
|
|
220
|
+
export declare class Swizzle<A extends VectorTypes, S extends SwizzleSelect> extends UnaryOp<A, SwizzleOutput<A, SwizzleSelectLen<S>>, "swizzle"> {
|
|
221
|
+
constructor({ vector, select }: {
|
|
222
|
+
vector: DynoVal<A>;
|
|
223
|
+
select: S;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './dyno/types';
|
|
2
|
+
export * from './dyno/base';
|
|
3
|
+
export * from './dyno/value';
|
|
4
|
+
export * from './dyno/output';
|
|
5
|
+
export * from './dyno/uniforms';
|
|
6
|
+
export * from './dyno/program';
|
|
7
|
+
export * from './dyno/math';
|
|
8
|
+
export * from './dyno/logic';
|
|
9
|
+
export * from './dyno/util';
|
|
10
|
+
export * from './dyno/splats';
|
|
11
|
+
export * from './dyno/transform';
|
|
12
|
+
export * from './dyno/control';
|
|
13
|
+
export * from './dyno/convert';
|
|
14
|
+
export * from './dyno/texture';
|
|
15
|
+
export * from './dyno/trig';
|
|
16
|
+
export * from './dyno/vecmat';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SplatGenerator } from '../SplatGenerator';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
export declare const DEFAULT_SNOW: {
|
|
4
|
+
box: THREE.Box3;
|
|
5
|
+
density: number;
|
|
6
|
+
fallDirection: THREE.Vector3;
|
|
7
|
+
fallVelocity: number;
|
|
8
|
+
wanderScale: number;
|
|
9
|
+
wanderVariance: number;
|
|
10
|
+
color1: THREE.Color;
|
|
11
|
+
color2: THREE.Color;
|
|
12
|
+
minScale: number;
|
|
13
|
+
maxScale: number;
|
|
14
|
+
anisoScale: THREE.Vector3;
|
|
15
|
+
};
|
|
16
|
+
export declare const DEFAULT_RAIN: {
|
|
17
|
+
box: THREE.Box3;
|
|
18
|
+
density: number;
|
|
19
|
+
fallDirection: THREE.Vector3;
|
|
20
|
+
fallVelocity: number;
|
|
21
|
+
wanderScale: number;
|
|
22
|
+
wanderVariance: number;
|
|
23
|
+
color1: THREE.Color;
|
|
24
|
+
color2: THREE.Color;
|
|
25
|
+
minScale: number;
|
|
26
|
+
maxScale: number;
|
|
27
|
+
anisoScale: THREE.Vector3;
|
|
28
|
+
};
|
|
29
|
+
export declare function snowBox({ box, minY, numSplats, density, anisoScale, minScale, maxScale, fallDirection, fallVelocity, wanderScale, wanderVariance, color1, color2, opacity, onFrame, }: {
|
|
30
|
+
box?: THREE.Box3;
|
|
31
|
+
minY?: number;
|
|
32
|
+
numSplats?: number;
|
|
33
|
+
density?: number;
|
|
34
|
+
anisoScale?: THREE.Vector3;
|
|
35
|
+
minScale?: number;
|
|
36
|
+
maxScale?: number;
|
|
37
|
+
fallDirection?: THREE.Vector3;
|
|
38
|
+
fallVelocity?: number;
|
|
39
|
+
wanderScale?: number;
|
|
40
|
+
wanderVariance?: number;
|
|
41
|
+
color1?: THREE.Color;
|
|
42
|
+
color2?: THREE.Color;
|
|
43
|
+
opacity?: number;
|
|
44
|
+
onFrame?: ({ object, time, deltaTime, }: {
|
|
45
|
+
object: SplatGenerator;
|
|
46
|
+
time: number;
|
|
47
|
+
deltaTime: number;
|
|
48
|
+
}) => void;
|
|
49
|
+
}): {
|
|
50
|
+
snow: SplatGenerator;
|
|
51
|
+
min: import('../dyno').DynoVec3<THREE.Vector3, string>;
|
|
52
|
+
max: import('../dyno').DynoVec3<THREE.Vector3, string>;
|
|
53
|
+
minY: import('../dyno').DynoFloat<string>;
|
|
54
|
+
color1: import('../dyno').DynoVec3<THREE.Color, string>;
|
|
55
|
+
color2: import('../dyno').DynoVec3<THREE.Color, string>;
|
|
56
|
+
opacity: import('../dyno').DynoFloat<string>;
|
|
57
|
+
fallVelocity: import('../dyno').DynoFloat<string>;
|
|
58
|
+
wanderVariance: import('../dyno').DynoFloat<string>;
|
|
59
|
+
wanderScale: import('../dyno').DynoFloat<string>;
|
|
60
|
+
fallDirection: import('../dyno').DynoVec3<THREE.Vector3, string>;
|
|
61
|
+
minScale: import('../dyno').DynoFloat<string>;
|
|
62
|
+
maxScale: import('../dyno').DynoFloat<string>;
|
|
63
|
+
anisoScale: import('../dyno').DynoVec3<THREE.Vector3, string>;
|
|
64
|
+
};
|
|
65
|
+
export type SNOW_RESULT_TYPE = ReturnType<typeof snowBox>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SplatGenerator } from '../SplatGenerator';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
export declare function staticBox({ box, cells, dotScale, color, opacity, }: {
|
|
4
|
+
box: THREE.Box3;
|
|
5
|
+
cells: THREE.Vector3;
|
|
6
|
+
dotScale: number;
|
|
7
|
+
color?: THREE.Color;
|
|
8
|
+
opacity?: number;
|
|
9
|
+
}): SplatGenerator;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Object3D, Quaternion, Vector3, WebXRManager } from 'three';
|
|
2
|
+
import { SplatMesh } from './SplatMesh';
|
|
3
|
+
export declare enum JointEnum {
|
|
4
|
+
w = "wrist",
|
|
5
|
+
t0 = "thumb-metacarpal",
|
|
6
|
+
t1 = "thumb-phalanx-proximal",
|
|
7
|
+
t2 = "thumb-phalanx-distal",
|
|
8
|
+
t3 = "thumb-tip",
|
|
9
|
+
i0 = "index-finger-metacarpal",
|
|
10
|
+
i1 = "index-finger-phalanx-proximal",
|
|
11
|
+
i2 = "index-finger-phalanx-intermediate",
|
|
12
|
+
i3 = "index-finger-phalanx-distal",
|
|
13
|
+
i4 = "index-finger-tip",
|
|
14
|
+
m0 = "middle-finger-metacarpal",
|
|
15
|
+
m1 = "middle-finger-phalanx-proximal",
|
|
16
|
+
m2 = "middle-finger-phalanx-intermediate",
|
|
17
|
+
m3 = "middle-finger-phalanx-distal",
|
|
18
|
+
m4 = "middle-finger-tip",
|
|
19
|
+
r0 = "ring-finger-metacarpal",
|
|
20
|
+
r1 = "ring-finger-phalanx-proximal",
|
|
21
|
+
r2 = "ring-finger-phalanx-intermediate",
|
|
22
|
+
r3 = "ring-finger-phalanx-distal",
|
|
23
|
+
r4 = "ring-finger-tip",
|
|
24
|
+
p0 = "pinky-finger-metacarpal",
|
|
25
|
+
p1 = "pinky-finger-phalanx-proximal",
|
|
26
|
+
p2 = "pinky-finger-phalanx-intermediate",
|
|
27
|
+
p3 = "pinky-finger-phalanx-distal",
|
|
28
|
+
p4 = "pinky-finger-tip"
|
|
29
|
+
}
|
|
30
|
+
export type JointId = keyof typeof JointEnum;
|
|
31
|
+
export declare const JOINT_IDS: JointId[];
|
|
32
|
+
export declare const NUM_JOINTS: number;
|
|
33
|
+
export declare const JOINT_INDEX: {
|
|
34
|
+
[key in JointId]: number;
|
|
35
|
+
};
|
|
36
|
+
export declare const JOINT_RADIUS: {
|
|
37
|
+
[key in JointId]: number;
|
|
38
|
+
};
|
|
39
|
+
export declare const JOINT_SEGMENTS: JointId[][];
|
|
40
|
+
export declare const JOINT_SEGMENT_STEPS: number[][];
|
|
41
|
+
export declare const JOINT_TIPS: JointId[];
|
|
42
|
+
export declare const FINGER_TIPS: JointId[];
|
|
43
|
+
export declare enum Hand {
|
|
44
|
+
left = "left",
|
|
45
|
+
right = "right"
|
|
46
|
+
}
|
|
47
|
+
export declare const HANDS: Hand[];
|
|
48
|
+
export type Joint = {
|
|
49
|
+
position: Vector3;
|
|
50
|
+
quaternion: Quaternion;
|
|
51
|
+
radius: number;
|
|
52
|
+
};
|
|
53
|
+
export type HandJoints = {
|
|
54
|
+
[key in JointId]?: Joint;
|
|
55
|
+
};
|
|
56
|
+
export type HandsJoints = {
|
|
57
|
+
[key in Hand]?: HandJoints;
|
|
58
|
+
};
|
|
59
|
+
export declare class XrHands {
|
|
60
|
+
hands: HandsJoints;
|
|
61
|
+
last: HandsJoints;
|
|
62
|
+
values: Record<string, number>;
|
|
63
|
+
tests: Record<string, boolean>;
|
|
64
|
+
lastTests: Record<string, boolean>;
|
|
65
|
+
updated: boolean;
|
|
66
|
+
update({ xr, xrFrame }: {
|
|
67
|
+
xr: WebXRManager;
|
|
68
|
+
xrFrame: XRFrame;
|
|
69
|
+
}): void;
|
|
70
|
+
makeGhostMesh(): SplatMesh;
|
|
71
|
+
distance(handA: Hand, jointA: JointId, handB: Hand, jointB: JointId, last?: boolean): number;
|
|
72
|
+
separation(handA: Hand, jointA: JointId, handB: Hand, jointB: JointId, last?: boolean): number;
|
|
73
|
+
touching(handA: Hand, jointA: JointId, handB: Hand, jointB: JointId, last?: boolean): number;
|
|
74
|
+
allTipsTouching(hand: Hand, last?: boolean): number;
|
|
75
|
+
triTipsTouching(hand: Hand, last?: boolean): number;
|
|
76
|
+
}
|
|
77
|
+
export declare class HandMovement {
|
|
78
|
+
xrHands: XrHands;
|
|
79
|
+
control: Object3D;
|
|
80
|
+
moveInertia: number;
|
|
81
|
+
rotateInertia: number;
|
|
82
|
+
lastGrip: {
|
|
83
|
+
[key in Hand]?: Vector3;
|
|
84
|
+
};
|
|
85
|
+
lastPivot: Vector3;
|
|
86
|
+
rotateVelocity: number;
|
|
87
|
+
velocity: Vector3;
|
|
88
|
+
constructor({ xrHands, control, moveInertia, rotateInertia, }: {
|
|
89
|
+
xrHands: XrHands;
|
|
90
|
+
control: Object3D;
|
|
91
|
+
moveInertia?: number;
|
|
92
|
+
rotateInertia?: number;
|
|
93
|
+
});
|
|
94
|
+
update(deltaTime: number): void;
|
|
95
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { ForgeRenderer, type ForgeRendererOptions } from './ForgeRenderer';
|
|
2
|
+
export { ForgeViewpoint, type ForgeViewpointOptions } from './ForgeViewpoint';
|
|
3
|
+
export * as dyno from './dyno';
|
|
4
|
+
export { SplatLoader, unpackSplats, SplatFileType, getSplatFileType, } from './SplatLoader';
|
|
5
|
+
export { PlyReader } from './ply';
|
|
6
|
+
export { SpzReader, SpzWriter, transcodeSpz } from './spz';
|
|
7
|
+
export { PackedSplats, type PackedSplatsOptions } from './PackedSplats';
|
|
8
|
+
export { SplatGenerator, type GsplatGenerator, SplatModifier, type GsplatModifier, SplatTransformer, } from './SplatGenerator';
|
|
9
|
+
export { SplatAccumulator, type GeneratorMapping } from './SplatAccumulator';
|
|
10
|
+
export { Readback, type Rgba8Readback, type ReadbackBuffer } from './Readback';
|
|
11
|
+
export { SplatMesh, type SplatMeshOptions, type SplatMeshContext, } from './SplatMesh';
|
|
12
|
+
export { SplatSkinning, type SplatSkinningOptions } from './SplatSkinning';
|
|
13
|
+
export { SplatEdit, type SplatEditOptions, SplatEditSdf, type SplatEditSdfOptions, SplatEditSdfType, SplatEditRgbaBlendMode, SplatEdits, } from './SplatEdit';
|
|
14
|
+
export { constructGrid, constructAxes, constructSpherePoints, imageSplats, textSplats, } from './splatConstructors';
|
|
15
|
+
export * as generators from './generators';
|
|
16
|
+
export { VRButton } from './vrButton';
|
|
17
|
+
export { type JointId, JointEnum, JOINT_IDS, NUM_JOINTS, JOINT_INDEX, JOINT_RADIUS, JOINT_SEGMENTS, JOINT_SEGMENT_STEPS, JOINT_TIPS, FINGER_TIPS, Hand, HANDS, type Joint, type HandJoints, type HandsJoints, XrHands, HandMovement, } from './hands';
|
|
18
|
+
export { ForgeControls, FpsMovement, PointerControls } from './controls';
|
|
19
|
+
export { isMobile, isAndroid, isOculus, flipPixels, pixelsToPngUrl, toHalf, fromHalf, floatToUint8, floatToSint8, Uint8ToFloat, Sint8ToFloat, setPackedSplat, unpackSplat, } from './utils';
|
|
20
|
+
export * as utils from './utils';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function decodeKsplat(fileBytes: Uint8Array, initNumSplats: (numSplats: number) => void, splatCallback: (index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number) => void, shCallback?: (index: number, sh1: Float32Array, sh2?: Float32Array, sh3?: Float32Array) => void): void;
|
|
2
|
+
export declare function unpackKsplat(fileBytes: Uint8Array): {
|
|
3
|
+
packedArray: Uint32Array;
|
|
4
|
+
numSplats: number;
|
|
5
|
+
extra: Record<string, unknown>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type PlyPropertyType = "char" | "uchar" | "short" | "ushort" | "int" | "uint" | "float" | "double";
|
|
2
|
+
export type PlyElement = {
|
|
3
|
+
name: string;
|
|
4
|
+
count: number;
|
|
5
|
+
properties: Record<string, PlyProperty>;
|
|
6
|
+
};
|
|
7
|
+
export type PlyProperty = {
|
|
8
|
+
isList: boolean;
|
|
9
|
+
type: PlyPropertyType;
|
|
10
|
+
countType?: PlyPropertyType;
|
|
11
|
+
};
|
|
12
|
+
export type SplatCallback = (index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number) => void;
|
|
13
|
+
export type SplatShCallback = (index: number, sh1: Float32Array, sh2?: Float32Array, sh3?: Float32Array) => void;
|
|
14
|
+
export declare class PlyReader {
|
|
15
|
+
fileBytes: Uint8Array;
|
|
16
|
+
header: string;
|
|
17
|
+
littleEndian: boolean;
|
|
18
|
+
elements: Record<string, PlyElement>;
|
|
19
|
+
comments: string[];
|
|
20
|
+
data: DataView | null;
|
|
21
|
+
static defaultPointScale: number;
|
|
22
|
+
numSplats: number;
|
|
23
|
+
constructor({ fileBytes }: {
|
|
24
|
+
fileBytes: Uint8Array | ArrayBuffer;
|
|
25
|
+
});
|
|
26
|
+
parseHeader(): Promise<void>;
|
|
27
|
+
parseData(elementCallback: (element: PlyElement) => null | ((index: number, item: Record<string, number | number[]>) => void)): void;
|
|
28
|
+
parseSplats(splatCallback: SplatCallback, shCallback?: SplatShCallback): void;
|
|
29
|
+
injectRgba(rgba: Uint8Array): void;
|
|
30
|
+
}
|
|
31
|
+
export declare const SH_C0 = 0.28209479177387814;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getShaders(): Record<string, string>;
|