three-cad-viewer 4.3.8 → 4.3.9
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/core/studio-manager.d.ts +7 -0
- package/dist/core/types.d.ts +11 -0
- package/dist/core/viewer.d.ts +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/rendering/environment.d.ts +3 -19
- package/dist/rendering/material-factory.d.ts +8 -6
- package/dist/rendering/raycast.d.ts +1 -1
- package/dist/rendering/studio-composer.d.ts +1 -1
- package/dist/rendering/tree-model.d.ts +1 -1
- package/dist/three-cad-viewer.esm.js +866 -275
- package/dist/three-cad-viewer.esm.js.map +1 -1
- package/dist/three-cad-viewer.esm.min.js +2 -2
- package/dist/three-cad-viewer.js +866 -275
- package/dist/three-cad-viewer.min.js +2 -2
- package/dist/tools/cad_tools/tools.d.ts +1 -1
- package/dist/utils/utils.d.ts +1 -1
- package/package.json +4 -2
|
@@ -48,6 +48,13 @@ declare class StudioManager {
|
|
|
48
48
|
private _savedClippingState;
|
|
49
49
|
private _shadowLights;
|
|
50
50
|
private _ctx;
|
|
51
|
+
/**
|
|
52
|
+
* Renderer pixel ratio saved on Studio entry, restored on leave.
|
|
53
|
+
* Studio mode bumps the pixel ratio to apply supersampling, which
|
|
54
|
+
* compensates for low DPR (e.g., VSCode webviews report DPR=1 even
|
|
55
|
+
* on Retina displays) and improves AA on shallow-angle edges.
|
|
56
|
+
*/
|
|
57
|
+
private _savedPixelRatio;
|
|
51
58
|
constructor(ctx: StudioManagerContext);
|
|
52
59
|
get isActive(): boolean;
|
|
53
60
|
get hasComposer(): boolean;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -271,6 +271,14 @@ export interface ViewerOptions extends StudioModeOptions {
|
|
|
271
271
|
zoomSpeed?: number;
|
|
272
272
|
/** Show timings in browser console (default: false) */
|
|
273
273
|
timeit?: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Tab to land on after render (default: "tree", i.e. CAD mode).
|
|
276
|
+
* When set to a non-tree tab, the initial CAD paint is skipped so the
|
|
277
|
+
* user doesn't see a brief CAD-mode flicker before the target tab takes
|
|
278
|
+
* over. Especially noticeable for "studio" (async env-map load) and
|
|
279
|
+
* "zebra" (material swap).
|
|
280
|
+
*/
|
|
281
|
+
tab?: ActiveTab;
|
|
274
282
|
}
|
|
275
283
|
/** Zebra tool options */
|
|
276
284
|
export interface ZebraOptions {
|
|
@@ -508,6 +516,9 @@ export interface MaterialXMaterial {
|
|
|
508
516
|
textures: Record<string, string>;
|
|
509
517
|
/** Optional texture tiling [u, v], default [1, 1]. Applied to all textures. */
|
|
510
518
|
textureRepeat?: [number, number];
|
|
519
|
+
/** Optional texture rotation in **radians**, counterclockwise. Pivot is
|
|
520
|
+
* the texture center (0.5, 0.5). Applied to all textures. */
|
|
521
|
+
textureRotation?: number;
|
|
511
522
|
}
|
|
512
523
|
/**
|
|
513
524
|
* Type guard to check if a material entry is a threejs-materials format dict.
|
package/dist/core/viewer.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -15,10 +15,10 @@ import { Timer } from "./utils/timer.js";
|
|
|
15
15
|
import { logger } from "./utils/logger.js";
|
|
16
16
|
import { gpuTracker } from "./utils/gpu-tracker.js";
|
|
17
17
|
import { version } from "./_version.js";
|
|
18
|
-
export { Viewer, Display, EnvironmentManager, Timer, logger, gpuTracker, version };
|
|
19
|
-
export { MATERIAL_PRESETS, MATERIAL_PRESET_NAMES } from "./rendering/material-presets.js";
|
|
18
|
+
export { Viewer, Display, EnvironmentManager, Timer, logger, gpuTracker, version, };
|
|
19
|
+
export { MATERIAL_PRESETS, MATERIAL_PRESET_NAMES, } from "./rendering/material-presets.js";
|
|
20
20
|
export type { LogLevel } from "./utils/logger.js";
|
|
21
|
-
export type { ResourceType, TrackedResource, ResourceSummary } from "./utils/gpu-tracker.js";
|
|
21
|
+
export type { ResourceType, TrackedResource, ResourceSummary, } from "./utils/gpu-tracker.js";
|
|
22
22
|
export type { Vector3Tuple, QuaternionTuple } from "three";
|
|
23
23
|
export type { ThemeInput, Theme, ControlType, UpDirection, AnimationMode, ActiveTab, ZebraColorScheme, ZebraMappingMode, ShapeType, ShapeSubtype, Axis, ClipIndex, ColorValue, RGBColor, RGBAColor, AxisColors, AxisColorsFlatArray, } from "./core/types.js";
|
|
24
24
|
export { CLIP_INDICES, isClipIndex, CollapseState } from "./core/types.js";
|
|
@@ -27,12 +27,12 @@ export type { BoundingBox, BoundingSphere, BoundingBoxFlat, } from "./core/types
|
|
|
27
27
|
export type { PickInfo } from "./core/types.js";
|
|
28
28
|
export type { ChangeInfos, ChangeNotification, NotificationCallback, } from "./core/types.js";
|
|
29
29
|
export type { DisplayOptions, RenderOptions, ViewerOptions, ZebraOptions, CombinedOptions, } from "./core/types.js";
|
|
30
|
-
export type { ViewerStateShape, StateKey
|
|
30
|
+
export type { ViewerStateShape, StateKey } from "./core/types.js";
|
|
31
31
|
export type { Texture, Shape, ShapeBinary, ShapeNested, Location, VisibilityValue, VisibilityState, Shapes, } from "./core/types.js";
|
|
32
32
|
export { isShapeBinaryFormat, hasTrianglesPerFace, hasSegmentsPerEdge, } from "./core/types.js";
|
|
33
33
|
export type { DomEventCallback } from "./core/types.js";
|
|
34
34
|
export type { ColoredMaterial } from "./core/types.js";
|
|
35
35
|
export type { MaterialAppearance, MaterialXMaterial, StudioOptions, StudioBackground, StudioModeOptions, StudioEnvironment, StudioToneMapping, StudioTextureMapping, } from "./core/types.js";
|
|
36
36
|
export { isMaterialXMaterial } from "./core/types.js";
|
|
37
|
-
export { isInstancedFormat, decodeInstancedFormat } from "./utils/decode-instances.js";
|
|
37
|
+
export { isInstancedFormat, decodeInstancedFormat, } from "./utils/decode-instances.js";
|
|
38
38
|
export type { SubscribeOptions } from "./core/types.js";
|
|
@@ -31,14 +31,6 @@ interface EnvironmentManagerOptions {
|
|
|
31
31
|
declare class EnvironmentManager {
|
|
32
32
|
/** Cached PMREM render targets keyed by environment name or URL */
|
|
33
33
|
private _cache;
|
|
34
|
-
/**
|
|
35
|
-
* Cached raw equirectangular HDR textures keyed by the same name/URL.
|
|
36
|
-
* Preserved (not disposed after PMREM generation) so `scene.background`
|
|
37
|
-
* can sample the original HDR at full source resolution instead of the
|
|
38
|
-
* 256² PMREM cubemap. Only populated by `_loadHdr` — procedural
|
|
39
|
-
* environments have no source HDR.
|
|
40
|
-
*/
|
|
41
|
-
private _hdrCache;
|
|
42
34
|
/** Cached light detection results keyed by environment name or URL */
|
|
43
35
|
private _lightDetectionCache;
|
|
44
36
|
/** In-flight load promises keyed by environment name or URL */
|
|
@@ -55,13 +47,6 @@ declare class EnvironmentManager {
|
|
|
55
47
|
private _hdrLoader;
|
|
56
48
|
/** The last loaded PMREM texture (stateful — used by apply() for IBL) */
|
|
57
49
|
private _currentTexture;
|
|
58
|
-
/**
|
|
59
|
-
* Raw HDR texture corresponding to `_currentTexture`, used for
|
|
60
|
-
* `scene.background` to keep the backdrop at source resolution. Null when
|
|
61
|
-
* the current environment is procedural ("studio" RoomEnvironment) — in
|
|
62
|
-
* that case the background falls back to `_currentTexture` (the PMREM).
|
|
63
|
-
*/
|
|
64
|
-
private _currentBackgroundTexture;
|
|
65
50
|
/** Whether this manager has been disposed */
|
|
66
51
|
private _disposed;
|
|
67
52
|
/**
|
|
@@ -236,10 +221,9 @@ declare class EnvironmentManager {
|
|
|
236
221
|
* Load an HDR file and generate a PMREM texture from it.
|
|
237
222
|
*
|
|
238
223
|
* Uses HDRLoader to fetch the .hdr file, then PMREMGenerator.fromEquirectangular()
|
|
239
|
-
* to create the PMREM cubemap
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* instead of the 256² PMREM cubemap.
|
|
224
|
+
* to create the PMREM cubemap. The source equirectangular HDR is disposed
|
|
225
|
+
* after PMREM generation. The PMREM texture itself serves as both the IBL
|
|
226
|
+
* environment and the background (in "environment" mode).
|
|
243
227
|
*
|
|
244
228
|
* @param url - URL of the .hdr file
|
|
245
229
|
* @param cacheKey - Cache key for the resulting PMREM render target
|
|
@@ -117,12 +117,12 @@ declare class MaterialFactory {
|
|
|
117
117
|
* Create a standard material for back faces with PBR properties.
|
|
118
118
|
* Used for polygon rendering where back faces need full shading.
|
|
119
119
|
*/
|
|
120
|
-
createBackFaceStandardMaterial({ color, alpha, polygonOffsetUnits, visible }: BackFaceMaterialOptions, label?: string): THREE.MeshStandardMaterial;
|
|
120
|
+
createBackFaceStandardMaterial({ color, alpha, polygonOffsetUnits, visible, }: BackFaceMaterialOptions, label?: string): THREE.MeshStandardMaterial;
|
|
121
121
|
/**
|
|
122
122
|
* Create a basic material for back faces (no lighting/PBR).
|
|
123
123
|
* Used for shape rendering where back faces are simple fills.
|
|
124
124
|
*/
|
|
125
|
-
createBackFaceBasicMaterial({ color, alpha, polygonOffsetUnits, visible }: BackFaceMaterialOptions, label?: string): THREE.MeshBasicMaterial;
|
|
125
|
+
createBackFaceBasicMaterial({ color, alpha, polygonOffsetUnits, visible, }: BackFaceMaterialOptions, label?: string): THREE.MeshBasicMaterial;
|
|
126
126
|
/**
|
|
127
127
|
* Create a basic front face material (no PBR, for simple shapes).
|
|
128
128
|
*/
|
|
@@ -130,7 +130,7 @@ declare class MaterialFactory {
|
|
|
130
130
|
/**
|
|
131
131
|
* Create a fat line material (LineMaterial from Three.js examples).
|
|
132
132
|
*/
|
|
133
|
-
createEdgeMaterial({ lineWidth, color, vertexColors, visible, resolution }: EdgeMaterialOptions, label?: string): LineMaterial;
|
|
133
|
+
createEdgeMaterial({ lineWidth, color, vertexColors, visible, resolution, }: EdgeMaterialOptions, label?: string): LineMaterial;
|
|
134
134
|
/**
|
|
135
135
|
* Create a basic line material for simple edges (e.g., polygon outlines).
|
|
136
136
|
*/
|
|
@@ -156,7 +156,7 @@ declare class MaterialFactory {
|
|
|
156
156
|
* @param label - Optional label for GPU tracking
|
|
157
157
|
* @returns Configured MeshPhysicalMaterial (or MeshBasicMaterial if unlit)
|
|
158
158
|
*/
|
|
159
|
-
createStudioMaterial({ materialDef, fallbackColor, fallbackAlpha, textureCache }: StudioMaterialOptions, label?: string): Promise<THREE.MeshPhysicalMaterial | THREE.MeshBasicMaterial>;
|
|
159
|
+
createStudioMaterial({ materialDef, fallbackColor, fallbackAlpha, textureCache, }: StudioMaterialOptions, label?: string): Promise<THREE.MeshPhysicalMaterial | THREE.MeshBasicMaterial>;
|
|
160
160
|
/**
|
|
161
161
|
* Create a Studio mode material from a threejs-materials format entry.
|
|
162
162
|
*
|
|
@@ -167,11 +167,13 @@ declare class MaterialFactory {
|
|
|
167
167
|
* @param values - Scalar PBR values from threejs-materials
|
|
168
168
|
* @param textures - Texture map references from threejs-materials
|
|
169
169
|
* @param textureRepeat - Optional [u, v] texture tiling applied to all loaded textures
|
|
170
|
+
* @param textureRotation - Optional texture rotation in radians (counterclockwise),
|
|
171
|
+
* pivoting around the texture center (0.5, 0.5)
|
|
170
172
|
* @param textureCache - TextureCache for resolving data URI textures
|
|
171
173
|
* @param label - Optional label for GPU tracking
|
|
172
174
|
* @returns Configured MeshPhysicalMaterial
|
|
173
175
|
*/
|
|
174
|
-
createStudioMaterialFromMaterialX(values: Record<string, unknown>, textures: Record<string, string>, textureRepeat: [number, number] | undefined, textureCache: TextureCacheInterface | null, label?: string): Promise<THREE.MeshPhysicalMaterial>;
|
|
176
|
+
createStudioMaterialFromMaterialX(values: Record<string, unknown>, textures: Record<string, string>, textureRepeat: [number, number] | undefined, textureRotation: number | undefined, textureCache: TextureCacheInterface | null, label?: string): Promise<THREE.MeshPhysicalMaterial>;
|
|
175
177
|
/**
|
|
176
178
|
* Apply alpha mode settings to a material.
|
|
177
179
|
*
|
|
@@ -201,4 +203,4 @@ declare class MaterialFactory {
|
|
|
201
203
|
update(options: UpdateOptions): void;
|
|
202
204
|
}
|
|
203
205
|
export { MaterialFactory };
|
|
204
|
-
export type { MaterialFactoryOptions, UpdateOptions, StudioMaterialOptions, TextureCacheInterface };
|
|
206
|
+
export type { MaterialFactoryOptions, UpdateOptions, StudioMaterialOptions, TextureCacheInterface, };
|
|
@@ -11,7 +11,7 @@ export declare const TopoFilter: {
|
|
|
11
11
|
face: "face";
|
|
12
12
|
solid: "solid";
|
|
13
13
|
};
|
|
14
|
-
export type TopoFilterType = typeof TopoFilter[keyof typeof TopoFilter];
|
|
14
|
+
export type TopoFilterType = (typeof TopoFilter)[keyof typeof TopoFilter];
|
|
15
15
|
interface RaycastFilters {
|
|
16
16
|
topoFilter: TopoFilterType[];
|
|
17
17
|
}
|
|
@@ -61,7 +61,7 @@ declare class StudioComposer {
|
|
|
61
61
|
* @param width - Canvas width in pixels
|
|
62
62
|
* @param height - Canvas height in pixels
|
|
63
63
|
*/
|
|
64
|
-
constructor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number);
|
|
64
|
+
constructor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, onSmaaReady?: () => void);
|
|
65
65
|
/**
|
|
66
66
|
* Enable or disable solid-background protection.
|
|
67
67
|
*
|
|
@@ -7,7 +7,7 @@ declare const States: {
|
|
|
7
7
|
readonly mixed: 2;
|
|
8
8
|
readonly disabled: 3;
|
|
9
9
|
};
|
|
10
|
-
type StateValue = typeof States[keyof typeof States];
|
|
10
|
+
type StateValue = (typeof States)[keyof typeof States];
|
|
11
11
|
/** Icon index: 0 for shapes, 1 for edges */
|
|
12
12
|
type IconIndex = 0 | 1;
|
|
13
13
|
/**
|