@xort/cga 0.1.0 → 0.1.2

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.
Files changed (39) hide show
  1. package/THIRD_PARTY_NOTICES.md +26 -39
  2. package/build/@xort_cga.js +10096 -9226
  3. package/build/cga.d.ts +1286 -465
  4. package/build/cga.esm.js +10062 -9228
  5. package/build/shaders/cga.glsl +204 -0
  6. package/build/shaders/common.glsl +36 -0
  7. package/build/shaders/noise/GLSL-Noise.md +1108 -0
  8. package/build/shaders/noise/LICENSE +20 -0
  9. package/build/shaders/noise/cellular2D.glsl +69 -0
  10. package/build/shaders/noise/cellular2x2.glsl +64 -0
  11. package/build/shaders/noise/cellular2x2x2.glsl +88 -0
  12. package/build/shaders/noise/cellular3D.glsl +187 -0
  13. package/build/shaders/noise/classicnoise2D.glsl +113 -0
  14. package/build/shaders/noise/classicnoise3D.glsl +177 -0
  15. package/build/shaders/noise/classicnoise4D.glsl +302 -0
  16. package/build/shaders/noise/noise2D.glsl +71 -0
  17. package/build/shaders/noise/noise3D.glsl +103 -0
  18. package/build/shaders/noise/noise3Dgrad.glsl +111 -0
  19. package/build/shaders/noise/noise4D.glsl +129 -0
  20. package/build/shaders/noise/psrdnoise2D.glsl +463 -0
  21. package/dist/THIRD_PARTY_NOTICES.md +26 -39
  22. package/dist/index.cjs +10096 -9226
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +1286 -465
  25. package/dist/index.d.ts +1286 -465
  26. package/dist/index.js +10062 -9228
  27. package/dist/index.js.map +1 -1
  28. package/dist/shaders.cjs +21 -0
  29. package/dist/shaders.d.cts +20 -0
  30. package/dist/shaders.d.ts +20 -0
  31. package/dist/shaders.js +20 -0
  32. package/dist/three.cjs +3035 -0
  33. package/dist/three.cjs.map +1 -0
  34. package/dist/three.d.cts +311 -0
  35. package/dist/three.d.ts +311 -0
  36. package/dist/three.js +3008 -0
  37. package/dist/three.js.map +1 -0
  38. package/package.json +123 -83
  39. package/readme.md +74 -119
@@ -0,0 +1,311 @@
1
+ import * as three from 'three';
2
+ import { WebGLRenderer, Scene, PerspectiveCamera, ColorRepresentation, Object3D, Texture, Vector3, Vector2, Intersection, BufferGeometry, Mesh, Material } from 'three';
3
+ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
4
+ import { TransformControls } from 'three/addons/controls/TransformControls.js';
5
+ import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
6
+ import { Pass } from 'three/addons/postprocessing/Pass.js';
7
+ import Decimal from 'decimal.js';
8
+
9
+ type EventListener<T = unknown> = (data: T) => void;
10
+ declare class EventHandler<Events extends object = Record<string, unknown>> {
11
+ private listeners;
12
+ on<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): () => this;
13
+ off<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): this;
14
+ once<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): () => this;
15
+ fire<K extends keyof Events>(type: K, data: Events[K]): this;
16
+ removeAllListeners(): void;
17
+ }
18
+
19
+ interface GLViewOptions {
20
+ container?: HTMLElement;
21
+ scene?: Scene;
22
+ camera?: PerspectiveCamera;
23
+ renderer?: WebGLRenderer;
24
+ clearColor?: ColorRepresentation;
25
+ enablePostProcessing?: boolean;
26
+ _enablePostProcessing?: boolean;
27
+ pixelRatio?: number;
28
+ }
29
+ declare class GLView extends EventHandler {
30
+ readonly renderer: WebGLRenderer;
31
+ readonly container: HTMLElement;
32
+ readonly effectComposer: EffectComposer;
33
+ readonly _controls: OrbitControls;
34
+ readonly _transfromControl: TransformControls;
35
+ private _scene;
36
+ private _camera;
37
+ private _modelScene;
38
+ private _helperScene;
39
+ private outputPass;
40
+ private renderPass;
41
+ private observer;
42
+ private abort;
43
+ private pmrem;
44
+ private environment?;
45
+ private selected;
46
+ private disposed;
47
+ private postProcessing;
48
+ readonly updates: Set<(time: number) => void>;
49
+ allowSelected: boolean;
50
+ private pointer;
51
+ constructor(settings?: GLViewOptions);
52
+ get scene(): Scene;
53
+ set scene(value: Scene);
54
+ get camera(): PerspectiveCamera;
55
+ set camera(value: PerspectiveCamera);
56
+ get modelScene(): Object3D;
57
+ set modelScene(value: Object3D);
58
+ get helperScene(): Object3D;
59
+ set helperScene(value: Object3D);
60
+ get domElement(): HTMLCanvasElement;
61
+ get width(): number;
62
+ get height(): number;
63
+ set clearColor(value: ColorRepresentation);
64
+ set toneExposure(value: number);
65
+ get enablePostProcessing(): boolean;
66
+ set enablePostProcessing(value: boolean);
67
+ get selecteds(): Object3D<three.Object3DEventMap>[];
68
+ setTransformMode(mode: 'translate' | 'rotate' | 'scale'): void;
69
+ setTransfromMode(mode: 'translate' | 'rotate' | 'scale'): void;
70
+ attach(model: Object3D): void;
71
+ detach(_model?: Object3D): void;
72
+ pmrenvMap(texture: Texture | Scene, type?: number): Texture<unknown, three.TextureEventMap>;
73
+ addPass(pass: Pass): Pass;
74
+ addPassEx(name: string, params?: {
75
+ threshold: number;
76
+ strength: number;
77
+ radius: number;
78
+ }): Pass;
79
+ add(...objects: Object3D[]): this;
80
+ remove(...objects: Object3D[]): this;
81
+ size(width: number, height: number): void;
82
+ onResize(): void;
83
+ addUpdates(...callbacks: Array<(time: number) => void>): void;
84
+ removeUpdates(...callbacks: Array<(time: number) => void>): void;
85
+ onMousedown(event: MouseEvent): void;
86
+ project(point: Vector3): Vector3;
87
+ unproject(point: Vector3): Vector3;
88
+ getScreenPosition(point: Vector3): Vector3;
89
+ getSelect(point: Vector2, isMousePos?: boolean, first?: true): Intersection | undefined;
90
+ getSelect(point: Vector2, isMousePos: boolean, first: false): Intersection[];
91
+ selectMD(multiple?: boolean): Object3D<three.Object3DEventMap>[];
92
+ selectModels(models: readonly Object3D[], multiple?: boolean): void;
93
+ select(models?: readonly Object3D[]): void;
94
+ unselect(models?: readonly Object3D[]): void;
95
+ inRendererArea(point: Vector3): boolean;
96
+ render(): void;
97
+ run(): void;
98
+ stop(): void;
99
+ hide(object: Object3D): void;
100
+ hideOther(object: Object3D): void;
101
+ showAll(): void;
102
+ dispose(): void;
103
+ }
104
+
105
+ declare class BreathLight extends Object3D {
106
+ private geometry;
107
+ private rings;
108
+ constructor(color?: ColorRepresentation);
109
+ update(time: number): void;
110
+ dispose(): void;
111
+ }
112
+
113
+ declare const DiamondShader: {
114
+ defines: {
115
+ RAY_BOUNCES: number;
116
+ };
117
+ vertexShader: string;
118
+ fragmentShader: string;
119
+ uniforms: {
120
+ invModelMatrix: {
121
+ value: three.Matrix4;
122
+ };
123
+ tCubeMapNormals: {
124
+ type: string;
125
+ value: null;
126
+ };
127
+ envMap: {
128
+ type: string;
129
+ value: null;
130
+ };
131
+ envRefractionMap: {
132
+ type: string;
133
+ value: null;
134
+ };
135
+ sphereMap: {
136
+ type: string;
137
+ value: null;
138
+ };
139
+ envMapIntensity: {
140
+ type: string;
141
+ value: number;
142
+ };
143
+ maxBounces: {
144
+ type: string;
145
+ value: number;
146
+ };
147
+ tanAngleSqCone: {
148
+ type: string;
149
+ value: number;
150
+ };
151
+ coneHeight: {
152
+ type: string;
153
+ value: number;
154
+ };
155
+ bDebugBounces: {
156
+ type: string;
157
+ value: boolean;
158
+ };
159
+ rIndexDelta: {
160
+ type: string;
161
+ value: number;
162
+ };
163
+ n2: {
164
+ type: string;
165
+ value: number;
166
+ };
167
+ radius: {
168
+ type: string;
169
+ value: number;
170
+ };
171
+ normalOffset: {
172
+ type: string;
173
+ value: number;
174
+ };
175
+ squashFactor: {
176
+ type: string;
177
+ value: number;
178
+ };
179
+ distanceOffset: {
180
+ type: string;
181
+ value: number;
182
+ };
183
+ geometryFactor: {
184
+ type: string;
185
+ value: number;
186
+ };
187
+ Absorbption: {
188
+ type: string;
189
+ value: three.Vector3;
190
+ };
191
+ colorCorrection: {
192
+ type: string;
193
+ value: three.Vector3;
194
+ };
195
+ boostFactors: {
196
+ type: string;
197
+ value: three.Vector3;
198
+ };
199
+ centreOffset: {
200
+ type: string;
201
+ value: three.Vector3;
202
+ };
203
+ };
204
+ side: 2;
205
+ };
206
+
207
+ interface IHVec2 {
208
+ x: Decimal;
209
+ y: Decimal;
210
+ }
211
+ interface IHVec3 extends IHVec2 {
212
+ z: Decimal;
213
+ }
214
+ /** Mutable decimal vector. Pass strings to preserve more precision than a JS number. */
215
+ declare class HVec3 implements IHVec3 {
216
+ x: Decimal;
217
+ y: Decimal;
218
+ z: Decimal;
219
+ constructor(x?: Decimal.Value, y?: Decimal.Value, z?: Decimal.Value);
220
+ static isVec3(v: unknown): v is IHVec3;
221
+ get isVec3(): boolean;
222
+ static get Up(): HVec3;
223
+ static get Down(): HVec3;
224
+ static get UnitX(): HVec3;
225
+ static get UnitY(): HVec3;
226
+ static get UnitZ(): HVec3;
227
+ set(x: Decimal.Value, y: Decimal.Value, z: Decimal.Value): this;
228
+ setScalar(s: Decimal.Value): this;
229
+ setComponent(index: number, value: Decimal.Value): this;
230
+ getComponent(index: number): Decimal;
231
+ copy(v: IHVec3): this;
232
+ clone(): HVec3;
233
+ add(v: IHVec3, w?: IHVec3): this;
234
+ addVecs(a: IHVec3, b: IHVec3): this;
235
+ sub(v: IHVec3, w?: IHVec3): this;
236
+ subVecs(a: IHVec3, b: IHVec3): this;
237
+ multiplyScalar(s: Decimal.Value): this;
238
+ divideScalar(s: Decimal.Value): this;
239
+ cross(v: IHVec3, w?: IHVec3): this;
240
+ crossVecs(a: IHVec3, b: IHVec3): this;
241
+ dot(v: IHVec3): Decimal;
242
+ lengthSq(): Decimal;
243
+ length(): Decimal;
244
+ normalize(): this;
245
+ lerp(v: IHVec3, alpha: Decimal.Value): this;
246
+ distanceTo(v: IHVec3): Decimal;
247
+ equals(v: IHVec3): boolean;
248
+ toArray(): Decimal[];
249
+ toJSON(): string[];
250
+ }
251
+
252
+ declare enum Side {
253
+ COPLANAR = 0,
254
+ FRONT = 1,
255
+ BACK = 2,
256
+ SPANNING = 3
257
+ }
258
+ declare class Polygon {
259
+ w: Decimal;
260
+ normal: HVec3;
261
+ vertices: HVec3[];
262
+ readonly epsilon: Decimal;
263
+ constructor(vertices?: readonly HVec3[], epsilon?: Decimal.Value);
264
+ calcPlane(): this;
265
+ flip(): this;
266
+ classifyVertex(v: HVec3): Side.COPLANAR | Side.FRONT | Side.BACK;
267
+ classifySide(p: Polygon): Side;
268
+ splitPolygon(p: Polygon, coplanarFront?: Polygon[], coplanarBack?: Polygon[], front?: Polygon[], back?: Polygon[]): void;
269
+ clone(): Polygon;
270
+ }
271
+
272
+ declare class Node {
273
+ front?: Node;
274
+ back?: Node;
275
+ divider?: Polygon;
276
+ polygons: Polygon[];
277
+ constructor(polygons?: readonly Polygon[]);
278
+ clone(): Node;
279
+ invert(): this;
280
+ clipPolygons(polygons: readonly Polygon[]): Polygon[];
281
+ clipTo(node: Node): this;
282
+ allPolygons(): Polygon[];
283
+ build(polygons: readonly Polygon[]): this;
284
+ }
285
+
286
+ /** BSP solid booleans on closed, consistently outward oriented convex polygon faces. */
287
+ declare class BSP {
288
+ tree: Node;
289
+ constructor(faces?: readonly Polygon[]);
290
+ toPolygons(): Polygon[];
291
+ clone(): BSP;
292
+ inverse(): BSP;
293
+ sub(other: BSP): BSP;
294
+ subtract(other: BSP): BSP;
295
+ union(other: BSP): BSP;
296
+ intersect(other: BSP): BSP;
297
+ }
298
+
299
+ /** BufferGeometry adapter. Mesh input is baked into world coordinates. */
300
+ declare class ThreeBSP {
301
+ private solid;
302
+ constructor(source: BufferGeometry | Mesh | BSP);
303
+ subtract(other: ThreeBSP): ThreeBSP;
304
+ union(other: ThreeBSP): ThreeBSP;
305
+ intersect(other: ThreeBSP): ThreeBSP;
306
+ toGeometry(): BufferGeometry<three.NormalBufferAttributes, three.BufferGeometryEventMap>;
307
+ toMesh(material?: Material): Mesh<BufferGeometry<three.NormalBufferAttributes, three.BufferGeometryEventMap>, Material<three.MaterialEventMap>, three.Object3DEventMap>;
308
+ }
309
+
310
+ export { BreathLight, DiamondShader, GLView, ThreeBSP };
311
+ export type { GLViewOptions };
@@ -0,0 +1,311 @@
1
+ import * as three from 'three';
2
+ import { WebGLRenderer, Scene, PerspectiveCamera, ColorRepresentation, Object3D, Texture, Vector3, Vector2, Intersection, BufferGeometry, Mesh, Material } from 'three';
3
+ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
4
+ import { TransformControls } from 'three/addons/controls/TransformControls.js';
5
+ import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
6
+ import { Pass } from 'three/addons/postprocessing/Pass.js';
7
+ import Decimal from 'decimal.js';
8
+
9
+ type EventListener<T = unknown> = (data: T) => void;
10
+ declare class EventHandler<Events extends object = Record<string, unknown>> {
11
+ private listeners;
12
+ on<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): () => this;
13
+ off<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): this;
14
+ once<K extends keyof Events>(type: K, listener: EventListener<Events[K]>): () => this;
15
+ fire<K extends keyof Events>(type: K, data: Events[K]): this;
16
+ removeAllListeners(): void;
17
+ }
18
+
19
+ interface GLViewOptions {
20
+ container?: HTMLElement;
21
+ scene?: Scene;
22
+ camera?: PerspectiveCamera;
23
+ renderer?: WebGLRenderer;
24
+ clearColor?: ColorRepresentation;
25
+ enablePostProcessing?: boolean;
26
+ _enablePostProcessing?: boolean;
27
+ pixelRatio?: number;
28
+ }
29
+ declare class GLView extends EventHandler {
30
+ readonly renderer: WebGLRenderer;
31
+ readonly container: HTMLElement;
32
+ readonly effectComposer: EffectComposer;
33
+ readonly _controls: OrbitControls;
34
+ readonly _transfromControl: TransformControls;
35
+ private _scene;
36
+ private _camera;
37
+ private _modelScene;
38
+ private _helperScene;
39
+ private outputPass;
40
+ private renderPass;
41
+ private observer;
42
+ private abort;
43
+ private pmrem;
44
+ private environment?;
45
+ private selected;
46
+ private disposed;
47
+ private postProcessing;
48
+ readonly updates: Set<(time: number) => void>;
49
+ allowSelected: boolean;
50
+ private pointer;
51
+ constructor(settings?: GLViewOptions);
52
+ get scene(): Scene;
53
+ set scene(value: Scene);
54
+ get camera(): PerspectiveCamera;
55
+ set camera(value: PerspectiveCamera);
56
+ get modelScene(): Object3D;
57
+ set modelScene(value: Object3D);
58
+ get helperScene(): Object3D;
59
+ set helperScene(value: Object3D);
60
+ get domElement(): HTMLCanvasElement;
61
+ get width(): number;
62
+ get height(): number;
63
+ set clearColor(value: ColorRepresentation);
64
+ set toneExposure(value: number);
65
+ get enablePostProcessing(): boolean;
66
+ set enablePostProcessing(value: boolean);
67
+ get selecteds(): Object3D<three.Object3DEventMap>[];
68
+ setTransformMode(mode: 'translate' | 'rotate' | 'scale'): void;
69
+ setTransfromMode(mode: 'translate' | 'rotate' | 'scale'): void;
70
+ attach(model: Object3D): void;
71
+ detach(_model?: Object3D): void;
72
+ pmrenvMap(texture: Texture | Scene, type?: number): Texture<unknown, three.TextureEventMap>;
73
+ addPass(pass: Pass): Pass;
74
+ addPassEx(name: string, params?: {
75
+ threshold: number;
76
+ strength: number;
77
+ radius: number;
78
+ }): Pass;
79
+ add(...objects: Object3D[]): this;
80
+ remove(...objects: Object3D[]): this;
81
+ size(width: number, height: number): void;
82
+ onResize(): void;
83
+ addUpdates(...callbacks: Array<(time: number) => void>): void;
84
+ removeUpdates(...callbacks: Array<(time: number) => void>): void;
85
+ onMousedown(event: MouseEvent): void;
86
+ project(point: Vector3): Vector3;
87
+ unproject(point: Vector3): Vector3;
88
+ getScreenPosition(point: Vector3): Vector3;
89
+ getSelect(point: Vector2, isMousePos?: boolean, first?: true): Intersection | undefined;
90
+ getSelect(point: Vector2, isMousePos: boolean, first: false): Intersection[];
91
+ selectMD(multiple?: boolean): Object3D<three.Object3DEventMap>[];
92
+ selectModels(models: readonly Object3D[], multiple?: boolean): void;
93
+ select(models?: readonly Object3D[]): void;
94
+ unselect(models?: readonly Object3D[]): void;
95
+ inRendererArea(point: Vector3): boolean;
96
+ render(): void;
97
+ run(): void;
98
+ stop(): void;
99
+ hide(object: Object3D): void;
100
+ hideOther(object: Object3D): void;
101
+ showAll(): void;
102
+ dispose(): void;
103
+ }
104
+
105
+ declare class BreathLight extends Object3D {
106
+ private geometry;
107
+ private rings;
108
+ constructor(color?: ColorRepresentation);
109
+ update(time: number): void;
110
+ dispose(): void;
111
+ }
112
+
113
+ declare const DiamondShader: {
114
+ defines: {
115
+ RAY_BOUNCES: number;
116
+ };
117
+ vertexShader: string;
118
+ fragmentShader: string;
119
+ uniforms: {
120
+ invModelMatrix: {
121
+ value: three.Matrix4;
122
+ };
123
+ tCubeMapNormals: {
124
+ type: string;
125
+ value: null;
126
+ };
127
+ envMap: {
128
+ type: string;
129
+ value: null;
130
+ };
131
+ envRefractionMap: {
132
+ type: string;
133
+ value: null;
134
+ };
135
+ sphereMap: {
136
+ type: string;
137
+ value: null;
138
+ };
139
+ envMapIntensity: {
140
+ type: string;
141
+ value: number;
142
+ };
143
+ maxBounces: {
144
+ type: string;
145
+ value: number;
146
+ };
147
+ tanAngleSqCone: {
148
+ type: string;
149
+ value: number;
150
+ };
151
+ coneHeight: {
152
+ type: string;
153
+ value: number;
154
+ };
155
+ bDebugBounces: {
156
+ type: string;
157
+ value: boolean;
158
+ };
159
+ rIndexDelta: {
160
+ type: string;
161
+ value: number;
162
+ };
163
+ n2: {
164
+ type: string;
165
+ value: number;
166
+ };
167
+ radius: {
168
+ type: string;
169
+ value: number;
170
+ };
171
+ normalOffset: {
172
+ type: string;
173
+ value: number;
174
+ };
175
+ squashFactor: {
176
+ type: string;
177
+ value: number;
178
+ };
179
+ distanceOffset: {
180
+ type: string;
181
+ value: number;
182
+ };
183
+ geometryFactor: {
184
+ type: string;
185
+ value: number;
186
+ };
187
+ Absorbption: {
188
+ type: string;
189
+ value: three.Vector3;
190
+ };
191
+ colorCorrection: {
192
+ type: string;
193
+ value: three.Vector3;
194
+ };
195
+ boostFactors: {
196
+ type: string;
197
+ value: three.Vector3;
198
+ };
199
+ centreOffset: {
200
+ type: string;
201
+ value: three.Vector3;
202
+ };
203
+ };
204
+ side: 2;
205
+ };
206
+
207
+ interface IHVec2 {
208
+ x: Decimal;
209
+ y: Decimal;
210
+ }
211
+ interface IHVec3 extends IHVec2 {
212
+ z: Decimal;
213
+ }
214
+ /** Mutable decimal vector. Pass strings to preserve more precision than a JS number. */
215
+ declare class HVec3 implements IHVec3 {
216
+ x: Decimal;
217
+ y: Decimal;
218
+ z: Decimal;
219
+ constructor(x?: Decimal.Value, y?: Decimal.Value, z?: Decimal.Value);
220
+ static isVec3(v: unknown): v is IHVec3;
221
+ get isVec3(): boolean;
222
+ static get Up(): HVec3;
223
+ static get Down(): HVec3;
224
+ static get UnitX(): HVec3;
225
+ static get UnitY(): HVec3;
226
+ static get UnitZ(): HVec3;
227
+ set(x: Decimal.Value, y: Decimal.Value, z: Decimal.Value): this;
228
+ setScalar(s: Decimal.Value): this;
229
+ setComponent(index: number, value: Decimal.Value): this;
230
+ getComponent(index: number): Decimal;
231
+ copy(v: IHVec3): this;
232
+ clone(): HVec3;
233
+ add(v: IHVec3, w?: IHVec3): this;
234
+ addVecs(a: IHVec3, b: IHVec3): this;
235
+ sub(v: IHVec3, w?: IHVec3): this;
236
+ subVecs(a: IHVec3, b: IHVec3): this;
237
+ multiplyScalar(s: Decimal.Value): this;
238
+ divideScalar(s: Decimal.Value): this;
239
+ cross(v: IHVec3, w?: IHVec3): this;
240
+ crossVecs(a: IHVec3, b: IHVec3): this;
241
+ dot(v: IHVec3): Decimal;
242
+ lengthSq(): Decimal;
243
+ length(): Decimal;
244
+ normalize(): this;
245
+ lerp(v: IHVec3, alpha: Decimal.Value): this;
246
+ distanceTo(v: IHVec3): Decimal;
247
+ equals(v: IHVec3): boolean;
248
+ toArray(): Decimal[];
249
+ toJSON(): string[];
250
+ }
251
+
252
+ declare enum Side {
253
+ COPLANAR = 0,
254
+ FRONT = 1,
255
+ BACK = 2,
256
+ SPANNING = 3
257
+ }
258
+ declare class Polygon {
259
+ w: Decimal;
260
+ normal: HVec3;
261
+ vertices: HVec3[];
262
+ readonly epsilon: Decimal;
263
+ constructor(vertices?: readonly HVec3[], epsilon?: Decimal.Value);
264
+ calcPlane(): this;
265
+ flip(): this;
266
+ classifyVertex(v: HVec3): Side.COPLANAR | Side.FRONT | Side.BACK;
267
+ classifySide(p: Polygon): Side;
268
+ splitPolygon(p: Polygon, coplanarFront?: Polygon[], coplanarBack?: Polygon[], front?: Polygon[], back?: Polygon[]): void;
269
+ clone(): Polygon;
270
+ }
271
+
272
+ declare class Node {
273
+ front?: Node;
274
+ back?: Node;
275
+ divider?: Polygon;
276
+ polygons: Polygon[];
277
+ constructor(polygons?: readonly Polygon[]);
278
+ clone(): Node;
279
+ invert(): this;
280
+ clipPolygons(polygons: readonly Polygon[]): Polygon[];
281
+ clipTo(node: Node): this;
282
+ allPolygons(): Polygon[];
283
+ build(polygons: readonly Polygon[]): this;
284
+ }
285
+
286
+ /** BSP solid booleans on closed, consistently outward oriented convex polygon faces. */
287
+ declare class BSP {
288
+ tree: Node;
289
+ constructor(faces?: readonly Polygon[]);
290
+ toPolygons(): Polygon[];
291
+ clone(): BSP;
292
+ inverse(): BSP;
293
+ sub(other: BSP): BSP;
294
+ subtract(other: BSP): BSP;
295
+ union(other: BSP): BSP;
296
+ intersect(other: BSP): BSP;
297
+ }
298
+
299
+ /** BufferGeometry adapter. Mesh input is baked into world coordinates. */
300
+ declare class ThreeBSP {
301
+ private solid;
302
+ constructor(source: BufferGeometry | Mesh | BSP);
303
+ subtract(other: ThreeBSP): ThreeBSP;
304
+ union(other: ThreeBSP): ThreeBSP;
305
+ intersect(other: ThreeBSP): ThreeBSP;
306
+ toGeometry(): BufferGeometry<three.NormalBufferAttributes, three.BufferGeometryEventMap>;
307
+ toMesh(material?: Material): Mesh<BufferGeometry<three.NormalBufferAttributes, three.BufferGeometryEventMap>, Material<three.MaterialEventMap>, three.Object3DEventMap>;
308
+ }
309
+
310
+ export { BreathLight, DiamondShader, GLView, ThreeBSP };
311
+ export type { GLViewOptions };