three-cad-viewer 4.3.5 → 4.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/three-cad-viewer.esm.js +8 -5
- package/dist/three-cad-viewer.esm.js.map +1 -1
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +8 -5
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +2 -3
- package/src/_version.ts +0 -1
- package/src/camera/camera.ts +0 -445
- package/src/camera/controls/CADOrbitControls.ts +0 -241
- package/src/camera/controls/CADTrackballControls.ts +0 -598
- package/src/camera/controls.ts +0 -380
- package/src/core/patches.ts +0 -16
- package/src/core/studio-manager.ts +0 -652
- package/src/core/types.ts +0 -892
- package/src/core/viewer-state.ts +0 -784
- package/src/core/viewer.ts +0 -4821
- package/src/index.ts +0 -151
- package/src/rendering/environment.ts +0 -840
- package/src/rendering/light-detection.ts +0 -327
- package/src/rendering/material-factory.ts +0 -735
- package/src/rendering/material-presets.ts +0 -289
- package/src/rendering/raycast.ts +0 -291
- package/src/rendering/room-environment.ts +0 -192
- package/src/rendering/studio-composer.ts +0 -577
- package/src/rendering/studio-floor.ts +0 -108
- package/src/rendering/texture-cache.ts +0 -324
- package/src/rendering/tree-model.ts +0 -542
- package/src/rendering/triplanar.ts +0 -329
- package/src/scene/animation.ts +0 -343
- package/src/scene/axes.ts +0 -108
- package/src/scene/bbox.ts +0 -223
- package/src/scene/clipping.ts +0 -650
- package/src/scene/grid.ts +0 -864
- package/src/scene/nestedgroup.ts +0 -1448
- package/src/scene/objectgroup.ts +0 -866
- package/src/scene/orientation.ts +0 -259
- package/src/scene/render-shape.ts +0 -634
- package/src/tools/cad_tools/measure.ts +0 -811
- package/src/tools/cad_tools/select.ts +0 -100
- package/src/tools/cad_tools/tools.ts +0 -231
- package/src/tools/cad_tools/ui.ts +0 -454
- package/src/tools/cad_tools/zebra.ts +0 -369
- package/src/types/html.d.ts +0 -5
- package/src/types/n8ao.d.ts +0 -28
- package/src/types/three-augmentation.d.ts +0 -60
- package/src/ui/display.ts +0 -3295
- package/src/ui/index.html +0 -505
- package/src/ui/info.ts +0 -177
- package/src/ui/slider.ts +0 -206
- package/src/ui/toolbar.ts +0 -347
- package/src/ui/treeview.ts +0 -945
- package/src/utils/decode-instances.ts +0 -233
- package/src/utils/font.ts +0 -60
- package/src/utils/gpu-tracker.ts +0 -265
- package/src/utils/logger.ts +0 -92
- package/src/utils/sizeof.ts +0 -116
- package/src/utils/timer.ts +0 -69
- package/src/utils/utils.ts +0 -446
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { isMeshStandardMaterial, hasColor } from "../../utils/utils.js";
|
|
3
|
-
import type { ZebraColorScheme, ZebraMappingMode } from "../../core/types.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Internal settings for the zebra tool.
|
|
7
|
-
*/
|
|
8
|
-
interface ZebraSettings {
|
|
9
|
-
stripeCount: number;
|
|
10
|
-
stripeDirection: number;
|
|
11
|
-
colorScheme: ZebraColorScheme;
|
|
12
|
-
opacity: number;
|
|
13
|
-
mappingMode: ZebraMappingMode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Zebra Analysis Tool for Three.js CAD Viewer
|
|
18
|
-
* Visualizes surface continuity using alternating stripes
|
|
19
|
-
*/
|
|
20
|
-
export class ZebraTool {
|
|
21
|
-
originalMaterials: Map<string, THREE.Material>;
|
|
22
|
-
zebraMaterials: Map<string, THREE.ShaderMaterial>;
|
|
23
|
-
settings: ZebraSettings;
|
|
24
|
-
zebraTexture: THREE.CanvasTexture | null;
|
|
25
|
-
|
|
26
|
-
constructor() {
|
|
27
|
-
this.originalMaterials = new Map();
|
|
28
|
-
this.zebraMaterials = new Map();
|
|
29
|
-
|
|
30
|
-
// Default settings
|
|
31
|
-
this.settings = {
|
|
32
|
-
stripeCount: 15,
|
|
33
|
-
stripeDirection: 0, // angle in degrees
|
|
34
|
-
colorScheme: "blackwhite", // 'blackwhite', 'colorful', 'grayscale'
|
|
35
|
-
opacity: 1.0, // 0.0 = fully transparent (see original), 1.0 = fully opaque (only zebra)
|
|
36
|
-
mappingMode: "normal", // 'reflection' (Onshape-like) or 'normal' (Fusion360/Shapr3D-like)
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
this.zebraTexture = null;
|
|
40
|
-
this.createZebraTexture();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Create the zebra stripe texture
|
|
45
|
-
*/
|
|
46
|
-
createZebraTexture(): void {
|
|
47
|
-
const canvas = document.createElement("canvas");
|
|
48
|
-
canvas.width = 1;
|
|
49
|
-
canvas.height = 4096; // Increased from 1024 for higher resolution
|
|
50
|
-
const ctx = canvas.getContext("2d")!;
|
|
51
|
-
|
|
52
|
-
// For odd stripe counts: first and last stripes are half-width for seamless tiling
|
|
53
|
-
// For even counts: all stripes are full-width (already tiles correctly)
|
|
54
|
-
const isOddCount = this.settings.stripeCount % 2 === 1;
|
|
55
|
-
const totalStripeUnits = isOddCount
|
|
56
|
-
? this.settings.stripeCount - 1
|
|
57
|
-
: this.settings.stripeCount;
|
|
58
|
-
const stripeHeight = canvas.height / totalStripeUnits;
|
|
59
|
-
|
|
60
|
-
let currentY = 0;
|
|
61
|
-
|
|
62
|
-
for (let i = 0; i < this.settings.stripeCount; i++) {
|
|
63
|
-
let color1: string, color2: string;
|
|
64
|
-
|
|
65
|
-
switch (this.settings.colorScheme) {
|
|
66
|
-
case "blackwhite":
|
|
67
|
-
color1 = "#000000";
|
|
68
|
-
color2 = "#ffffff";
|
|
69
|
-
break;
|
|
70
|
-
case "colorful": {
|
|
71
|
-
// Rainbow colors — for odd counts, first and last half-stripes
|
|
72
|
-
// merge at the tile boundary, so they must share the same hue.
|
|
73
|
-
// Distribute hues across N-1 divisions (the merged pair counts as one).
|
|
74
|
-
let hue: number;
|
|
75
|
-
if (isOddCount && i === this.settings.stripeCount - 1) {
|
|
76
|
-
hue = 0;
|
|
77
|
-
} else {
|
|
78
|
-
const divisions = isOddCount
|
|
79
|
-
? this.settings.stripeCount - 1
|
|
80
|
-
: this.settings.stripeCount;
|
|
81
|
-
hue = (i / divisions) * 360;
|
|
82
|
-
}
|
|
83
|
-
color1 = `hsl(${hue}, 100%, 50%)`;
|
|
84
|
-
color2 = `hsl(${(hue + 180) % 360}, 100%, 50%)`;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
case "grayscale":
|
|
88
|
-
// Simple alternating grayscale with wide contrast range
|
|
89
|
-
// Light gray: 210 (0xD2, ~82%)
|
|
90
|
-
// Dark gray: 70 (0x46, ~27%)
|
|
91
|
-
color1 = "#D2D2D2"; // Always light
|
|
92
|
-
color2 = "#464646"; // Always dark
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Only make first/last stripes half-width for odd stripe counts
|
|
97
|
-
const height =
|
|
98
|
-
isOddCount && (i === 0 || i === this.settings.stripeCount - 1)
|
|
99
|
-
? stripeHeight * 0.5
|
|
100
|
-
: stripeHeight;
|
|
101
|
-
|
|
102
|
-
ctx.fillStyle = i % 2 === 0 ? color1 : color2;
|
|
103
|
-
ctx.fillRect(0, currentY, canvas.width, height);
|
|
104
|
-
currentY += height;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (this.zebraTexture) {
|
|
108
|
-
this.zebraTexture.dispose();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
this.zebraTexture = new THREE.CanvasTexture(canvas);
|
|
112
|
-
this.zebraTexture.wrapS = THREE.RepeatWrapping;
|
|
113
|
-
this.zebraTexture.wrapT = THREE.RepeatWrapping;
|
|
114
|
-
// Using default linear filtering for smooth stripes
|
|
115
|
-
// High resolution (4096) prevents visible blurring even at close zoom
|
|
116
|
-
this.zebraTexture.needsUpdate = true;
|
|
117
|
-
|
|
118
|
-
// Update all existing zebra materials with the new texture
|
|
119
|
-
this.zebraMaterials.forEach((material) => {
|
|
120
|
-
material.uniforms.zebraTexture.value = this.zebraTexture;
|
|
121
|
-
material.uniforms.zebraTexture.value.needsUpdate = true;
|
|
122
|
-
material.uniformsNeedUpdate = true;
|
|
123
|
-
material.needsUpdate = true;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Create zebra shader material
|
|
129
|
-
*/
|
|
130
|
-
createZebraMaterial(): THREE.ShaderMaterial {
|
|
131
|
-
const angle = (this.settings.stripeDirection * Math.PI) / 180;
|
|
132
|
-
// Fixed: Use cos/sin for proper screen-space orientation
|
|
133
|
-
// 0° = vertical stripes, 90° = horizontal stripes
|
|
134
|
-
const direction = new THREE.Vector3(
|
|
135
|
-
Math.cos(angle),
|
|
136
|
-
Math.sin(angle),
|
|
137
|
-
0,
|
|
138
|
-
).normalize();
|
|
139
|
-
|
|
140
|
-
return new THREE.ShaderMaterial({
|
|
141
|
-
uniforms: {
|
|
142
|
-
zebraTexture: { value: this.zebraTexture },
|
|
143
|
-
direction: { value: direction },
|
|
144
|
-
opacity: { value: this.settings.opacity },
|
|
145
|
-
baseColor: { value: new THREE.Color(0.7, 0.7, 0.7) }, // Will be overridden per mesh
|
|
146
|
-
mappingMode: {
|
|
147
|
-
value: this.settings.mappingMode === "reflection" ? 0 : 1,
|
|
148
|
-
}, // 0 = reflection, 1 = normal
|
|
149
|
-
},
|
|
150
|
-
vertexShader: `
|
|
151
|
-
varying vec3 vViewNormal;
|
|
152
|
-
varying vec3 vViewPosition;
|
|
153
|
-
varying vec4 vScreenPosition;
|
|
154
|
-
|
|
155
|
-
void main() {
|
|
156
|
-
// Transform normal to view space
|
|
157
|
-
vViewNormal = normalize(normalMatrix * normal);
|
|
158
|
-
|
|
159
|
-
// Transform position to view space
|
|
160
|
-
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
|
|
161
|
-
vViewPosition = mvPosition.xyz;
|
|
162
|
-
|
|
163
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
164
|
-
|
|
165
|
-
// Store screen position for normal mode
|
|
166
|
-
vScreenPosition = gl_Position;
|
|
167
|
-
}
|
|
168
|
-
`,
|
|
169
|
-
fragmentShader: `
|
|
170
|
-
uniform sampler2D zebraTexture;
|
|
171
|
-
uniform vec3 direction;
|
|
172
|
-
uniform float opacity;
|
|
173
|
-
uniform vec3 baseColor;
|
|
174
|
-
uniform int mappingMode; // 0 = reflection, 1 = normal
|
|
175
|
-
|
|
176
|
-
varying vec3 vViewNormal;
|
|
177
|
-
varying vec3 vViewPosition;
|
|
178
|
-
varying vec4 vScreenPosition;
|
|
179
|
-
|
|
180
|
-
void main() {
|
|
181
|
-
// Normalize view-space normal
|
|
182
|
-
vec3 normal = normalize(vViewNormal);
|
|
183
|
-
|
|
184
|
-
float v;
|
|
185
|
-
|
|
186
|
-
if (mappingMode == 0) {
|
|
187
|
-
// Reflection mode (Onshape-like): circular/elliptical stripes
|
|
188
|
-
// View direction in view space (points toward camera)
|
|
189
|
-
vec3 viewDir = normalize(-vViewPosition);
|
|
190
|
-
|
|
191
|
-
// Calculate reflection in view space
|
|
192
|
-
vec3 mappingVector = reflect(-viewDir, normal);
|
|
193
|
-
|
|
194
|
-
// Use the reflection vector with screen-space direction
|
|
195
|
-
v = dot(mappingVector, direction) * 3.0 * 0.5 + 0.5;
|
|
196
|
-
} else {
|
|
197
|
-
// Normal mode (Fusion360/Shapr3D-like): zoom-independent view-based stripes
|
|
198
|
-
// Use view direction normalized by distance (zoom-independent)
|
|
199
|
-
|
|
200
|
-
// Normalize view position by distance to make it zoom-independent
|
|
201
|
-
float dist = length(vViewPosition);
|
|
202
|
-
vec2 viewDir2D = vViewPosition.xy / dist;
|
|
203
|
-
|
|
204
|
-
// Rotate by stripe direction
|
|
205
|
-
float cosA = direction.x / length(direction.xy);
|
|
206
|
-
float sinA = direction.y / length(direction.xy);
|
|
207
|
-
float rotatedPos = viewDir2D.x * cosA + viewDir2D.y * sinA;
|
|
208
|
-
|
|
209
|
-
// Scale for stripe frequency (zoom-independent)
|
|
210
|
-
float positionValue = rotatedPos * 2.0;
|
|
211
|
-
|
|
212
|
-
// Add normal influence to follow curvature
|
|
213
|
-
float normalValue = dot(normal, direction) * 0.5;
|
|
214
|
-
|
|
215
|
-
// Combine: position creates base stripes, normal makes them follow curvature
|
|
216
|
-
v = (positionValue + normalValue) * 3.0 * 0.5 + 0.5;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Sample the zebra texture (texture varies in V/Y direction)
|
|
220
|
-
vec4 zebraColor = texture2D(zebraTexture, vec2(0.5, v));
|
|
221
|
-
|
|
222
|
-
// Blend zebra stripes with original material color based on opacity
|
|
223
|
-
vec3 finalColor = mix(baseColor, zebraColor.rgb, opacity);
|
|
224
|
-
|
|
225
|
-
gl_FragColor = vec4(finalColor, 1.0);
|
|
226
|
-
}
|
|
227
|
-
`,
|
|
228
|
-
side: THREE.DoubleSide,
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Apply zebra material to a mesh
|
|
234
|
-
*/
|
|
235
|
-
applyToMesh(mesh: THREE.Mesh, visible: boolean): void {
|
|
236
|
-
if (!mesh.isMesh) return;
|
|
237
|
-
|
|
238
|
-
// Skip objects marked to be excluded
|
|
239
|
-
if (mesh.userData.excludeFromZebra) return;
|
|
240
|
-
|
|
241
|
-
// Store original material (handle array case by taking first)
|
|
242
|
-
const currentMaterial = Array.isArray(mesh.material) ? mesh.material[0] : mesh.material;
|
|
243
|
-
if (!this.originalMaterials.has(mesh.uuid)) {
|
|
244
|
-
this.originalMaterials.set(mesh.uuid, currentMaterial);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// Create or reuse zebra material
|
|
248
|
-
if (!this.zebraMaterials.has(mesh.uuid)) {
|
|
249
|
-
const zebraMaterial = this.createZebraMaterial();
|
|
250
|
-
|
|
251
|
-
// Extract color from original material
|
|
252
|
-
let baseColor = new THREE.Color(0.7, 0.7, 0.7); // Default gray
|
|
253
|
-
|
|
254
|
-
if (hasColor(currentMaterial)) {
|
|
255
|
-
baseColor = currentMaterial.color.clone();
|
|
256
|
-
} else if (isMeshStandardMaterial(currentMaterial) && currentMaterial.map) {
|
|
257
|
-
// If there's a texture but no color, use white as base
|
|
258
|
-
baseColor = new THREE.Color(1, 1, 1);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Set the base color uniform
|
|
262
|
-
zebraMaterial.uniforms.baseColor = { value: baseColor };
|
|
263
|
-
|
|
264
|
-
this.zebraMaterials.set(mesh.uuid, zebraMaterial);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
mesh.material = this.zebraMaterials.get(mesh.uuid)!;
|
|
268
|
-
mesh.material.visible = visible;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Restore original material to a mesh
|
|
273
|
-
*/
|
|
274
|
-
restoreMesh(mesh: THREE.Mesh, visible: boolean): void {
|
|
275
|
-
if (!mesh.isMesh) return;
|
|
276
|
-
|
|
277
|
-
const originalMaterial = this.originalMaterials.get(mesh.uuid);
|
|
278
|
-
if (originalMaterial) {
|
|
279
|
-
mesh.material = originalMaterial;
|
|
280
|
-
originalMaterial.visible = visible;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Update stripe count
|
|
286
|
-
*/
|
|
287
|
-
setStripeCount(count: number): void {
|
|
288
|
-
this.settings.stripeCount = Math.max(2, Math.min(50, count));
|
|
289
|
-
this.createZebraTexture();
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Update stripe direction (in degrees, 0-90° is sufficient)
|
|
294
|
-
*/
|
|
295
|
-
setStripeDirection(angle: number): void {
|
|
296
|
-
this.settings.stripeDirection = angle;
|
|
297
|
-
const radians = (angle * Math.PI) / 180;
|
|
298
|
-
// Fixed: Use cos/sin for proper screen-space orientation
|
|
299
|
-
const direction = new THREE.Vector3(
|
|
300
|
-
Math.cos(radians),
|
|
301
|
-
Math.sin(radians),
|
|
302
|
-
0,
|
|
303
|
-
).normalize();
|
|
304
|
-
|
|
305
|
-
this.zebraMaterials.forEach((material) => {
|
|
306
|
-
material.uniforms.direction.value = direction;
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Update color scheme
|
|
312
|
-
*/
|
|
313
|
-
setColorScheme(scheme: "blackwhite" | "colorful" | "grayscale"): void {
|
|
314
|
-
if (["blackwhite", "colorful", "grayscale"].includes(scheme)) {
|
|
315
|
-
this.settings.colorScheme = scheme;
|
|
316
|
-
this.createZebraTexture();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Update stripe opacity (0.0 = show original material, 1.0 = full zebra)
|
|
322
|
-
*/
|
|
323
|
-
setStripeOpacity(opacity: number): void {
|
|
324
|
-
this.settings.opacity = Math.max(0, Math.min(1, opacity));
|
|
325
|
-
this.zebraMaterials.forEach((material) => {
|
|
326
|
-
material.uniforms.opacity.value = this.settings.opacity;
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Update mapping mode ('reflection' = Onshape-like, 'normal' = Fusion360/Shapr3D-like)
|
|
332
|
-
*/
|
|
333
|
-
setMappingMode(mode: "reflection" | "normal"): void {
|
|
334
|
-
if (["reflection", "normal"].includes(mode)) {
|
|
335
|
-
this.settings.mappingMode = mode;
|
|
336
|
-
const modeValue = mode === "reflection" ? 0 : 1;
|
|
337
|
-
this.zebraMaterials.forEach((material) => {
|
|
338
|
-
material.uniforms.mappingMode.value = modeValue;
|
|
339
|
-
material.uniformsNeedUpdate = true;
|
|
340
|
-
material.needsUpdate = true;
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Update camera position for shaders (call in render loop).
|
|
347
|
-
* No longer needed - view space calculations handle this automatically.
|
|
348
|
-
* This method is kept for API compatibility.
|
|
349
|
-
*/
|
|
350
|
-
update(): void {
|
|
351
|
-
// No-op
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Clean up resources
|
|
356
|
-
*/
|
|
357
|
-
dispose(): void {
|
|
358
|
-
if (this.zebraTexture) {
|
|
359
|
-
this.zebraTexture.dispose();
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
this.zebraMaterials.forEach((material) => {
|
|
363
|
-
material.dispose();
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
this.originalMaterials.clear();
|
|
367
|
-
this.zebraMaterials.clear();
|
|
368
|
-
}
|
|
369
|
-
}
|
package/src/types/html.d.ts
DELETED
package/src/types/n8ao.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal type declarations for n8ao.
|
|
3
|
-
*
|
|
4
|
-
* n8ao does not ship TypeScript types. This provides just enough
|
|
5
|
-
* typing to suppress TS7016 during builds while keeping the actual
|
|
6
|
-
* N8AOPostPass usage typed as `any` (the API is untyped upstream).
|
|
7
|
-
*/
|
|
8
|
-
declare module "n8ao" {
|
|
9
|
-
import type { Scene, Camera } from "three";
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
export class N8AOPostPass {
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
camera: Camera;
|
|
15
|
-
configuration: {
|
|
16
|
-
aoRadius: number;
|
|
17
|
-
distanceFalloff: number;
|
|
18
|
-
intensity: number;
|
|
19
|
-
halfRes: boolean;
|
|
20
|
-
depthAwareUpsampling: boolean;
|
|
21
|
-
gammaCorrection: boolean;
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
};
|
|
24
|
-
constructor(scene: Scene, camera: Camera, width: number, height: number);
|
|
25
|
-
setQualityMode(mode: "Low" | "Medium" | "High" | "Ultra"): void;
|
|
26
|
-
setSize(width: number, height: number): void;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type augmentations for THREE.js types that are incomplete or have undocumented properties.
|
|
3
|
-
* This allows type-safe access to internal/undocumented THREE.js APIs.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import "three";
|
|
7
|
-
|
|
8
|
-
declare module "three" {
|
|
9
|
-
/**
|
|
10
|
-
* Raycaster.params includes Line2 threshold for fat line picking,
|
|
11
|
-
* but this is not in the default type definitions.
|
|
12
|
-
*/
|
|
13
|
-
interface Raycaster {
|
|
14
|
-
params: {
|
|
15
|
-
Line2?: { threshold: number };
|
|
16
|
-
Line?: { threshold: number };
|
|
17
|
-
Points?: { threshold: number };
|
|
18
|
-
Mesh?: Record<string, unknown>;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
declare module "three/examples/jsm/controls/OrbitControls.js" {
|
|
24
|
-
interface OrbitControls {
|
|
25
|
-
/**
|
|
26
|
-
* Enable/disable keyboard controls (deprecated in recent THREE.js but still present)
|
|
27
|
-
*/
|
|
28
|
-
enableKeys: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* When true, panning is in screen space (XY) rather than camera plane
|
|
31
|
-
*/
|
|
32
|
-
screenSpacePanning: boolean;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
declare module "three/examples/jsm/controls/TrackballControls.js" {
|
|
37
|
-
interface TrackballControls {
|
|
38
|
-
/**
|
|
39
|
-
* Enable/disable keyboard controls
|
|
40
|
-
*/
|
|
41
|
-
enableKeys: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Internal: rotate camera based on mouse movement
|
|
44
|
-
*/
|
|
45
|
-
_rotateCamera(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Internal: pan camera based on mouse movement
|
|
48
|
-
*/
|
|
49
|
-
_panCamera(): void;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
declare module "three/examples/jsm/lines/LineMaterial.js" {
|
|
54
|
-
interface LineMaterial {
|
|
55
|
-
/**
|
|
56
|
-
* Legacy vertex colors property (string-based in older THREE.js versions)
|
|
57
|
-
*/
|
|
58
|
-
vertexColors: boolean | string;
|
|
59
|
-
}
|
|
60
|
-
}
|