@selvajs/visualization 1.1.0 → 1.3.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 +82 -65
- package/dist/parse.cjs +3 -3
- package/dist/parse.cjs.map +1 -1
- package/dist/parse.d.cts +15 -17
- package/dist/parse.d.ts +15 -17
- package/dist/parse.js +3 -3
- package/dist/parse.js.map +1 -1
- package/dist/render.cjs +4 -4
- package/dist/render.cjs.map +1 -1
- package/dist/render.d.cts +60 -7
- package/dist/render.d.ts +60 -7
- package/dist/render.js +4 -4
- package/dist/render.js.map +1 -1
- package/dist/scene.cjs +1 -1
- package/dist/scene.cjs.map +1 -1
- package/dist/scene.d.cts +70 -3
- package/dist/scene.d.ts +70 -3
- package/dist/scene.js +1 -1
- package/dist/scene.js.map +1 -1
- package/dist/types-C0V-dIU-.d.cts +83 -0
- package/dist/types-C0V-dIU-.d.ts +83 -0
- package/package.json +5 -5
- package/dist/types-Di80Y609.d.cts +0 -34
- package/dist/types-Di80Y609.d.ts +0 -34
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
//#region src/shared/types.d.ts
|
|
3
|
+
/** Source of truth for {@link Look} — lets consumers (e.g. a style picker) iterate instead of hardcoding names. */
|
|
4
|
+
declare const LOOKS: readonly ["technical", "studio", "showcase", "arctic", "xray", "lineart", "wireframe"];
|
|
5
|
+
type Look = (typeof LOOKS)[number];
|
|
6
|
+
/**
|
|
7
|
+
* How a {@link Look} overrides the per-mesh material a solve produced. Omitted fields leave the
|
|
8
|
+
* mesh's own value alone, so a look that sets none of them is purely a lighting change.
|
|
9
|
+
*
|
|
10
|
+
* These fight the model's real colours on purpose: `arctic` reads shape over material, `xray` reads
|
|
11
|
+
* what is inside, `wireframe` reads topology. `setLook` snapshots the parsed values before the first
|
|
12
|
+
* override and restores them when switching back, so the model's own colours survive a round trip.
|
|
13
|
+
*/
|
|
14
|
+
type LookMaterialOverride = {
|
|
15
|
+
/** Replaces the mesh's own colour. Hex, e.g. 0xf2f4f7. */
|
|
16
|
+
color?: number;
|
|
17
|
+
metalness?: number;
|
|
18
|
+
roughness?: number;
|
|
19
|
+
/** Forces `transparent: true` when below 1. */
|
|
20
|
+
opacity?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Skip the depth buffer so far faces aren't hidden by near ones — what makes an x-ray read
|
|
23
|
+
* through the model instead of just looking like tinted glass. Costs correct sort order, which
|
|
24
|
+
* is the intended trade.
|
|
25
|
+
*/
|
|
26
|
+
depthWrite?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Draw each triangle as its three edges instead of a filled face. Shows the tessellation, not the
|
|
29
|
+
* design edges the `edges` overlay extracts — a curved surface reads as a dense triangle mesh.
|
|
30
|
+
* Lighting still applies but has almost nothing to shade, so a wireframe look wants flat fill
|
|
31
|
+
* rather than a key light.
|
|
32
|
+
*/
|
|
33
|
+
wireframe?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The lighting/material dials a {@link Look} sets. It still never *drives* the edge overlay or the
|
|
37
|
+
* grid; `requiresEdges` only states that a look is incomplete without edges, and the host decides
|
|
38
|
+
* whether to honour it.
|
|
39
|
+
*/
|
|
40
|
+
type LookPreset = {
|
|
41
|
+
toneMapping: THREE.ToneMapping;
|
|
42
|
+
toneMappingExposure: number;
|
|
43
|
+
envMapIntensity: number;
|
|
44
|
+
/** Multiplier on the HDR's IBL (`scene.environmentIntensity`). */
|
|
45
|
+
environmentIntensity: number;
|
|
46
|
+
hemisphereIntensity: number;
|
|
47
|
+
ambientIntensity: number;
|
|
48
|
+
cullBackfaces: boolean;
|
|
49
|
+
ambientOcclusion: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* A key light casting a shadow. IBL alone lights every face of a box almost equally, so without
|
|
52
|
+
* this a model reads as a flat white silhouette — the directional falloff is what separates the
|
|
53
|
+
* three faces meeting at a corner.
|
|
54
|
+
*/
|
|
55
|
+
sunlightIntensity: number;
|
|
56
|
+
/** Absent on the looks that only retune lighting. */
|
|
57
|
+
materialOverride?: LookMaterialOverride;
|
|
58
|
+
/**
|
|
59
|
+
* This look is a line drawing: without the edge overlay it renders as blank white shapes. Set
|
|
60
|
+
* only by `lineart`. A declaration, not an action — `setLook` still touches no overlay, so a
|
|
61
|
+
* host that ignores this gets a look that doesn't work rather than a broken invariant.
|
|
62
|
+
*
|
|
63
|
+
* A host honouring this must also turn `edges.distanceFade` off. The fade sets opacity per
|
|
64
|
+
* overlay from its 15th-percentile segment length, so one finely-detailed mesh fades whole:
|
|
65
|
+
* in a shaded look that softens some outlines, but here it erases parts of the only thing being
|
|
66
|
+
* drawn, and the opacity is recomputed per frame so edges pop in and out while orbiting.
|
|
67
|
+
*/
|
|
68
|
+
requiresEdges?: boolean;
|
|
69
|
+
};
|
|
70
|
+
/** How compute meshes read visually — the parse-time material choices baked from a {@link Look}. */
|
|
71
|
+
interface MaterialAppearanceOptions {
|
|
72
|
+
/** Default 1 (three.js's own material default) when omitted. */
|
|
73
|
+
envMapIntensity?: number;
|
|
74
|
+
/**
|
|
75
|
+
* `THREE.FrontSide` instead of `THREE.DoubleSide` — crisper silhouette on closed solids, but open
|
|
76
|
+
* surfaces (which Rhino also emits) vanish when viewed from behind. Default false (DoubleSide) to
|
|
77
|
+
* stay safe for surface geometry.
|
|
78
|
+
*/
|
|
79
|
+
cullBackfaces?: boolean;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { MaterialAppearanceOptions as a, LookPreset as i, Look as n, LookMaterialOverride as r, LOOKS as t };
|
|
83
|
+
//# sourceMappingURL=types-C0V-dIU-.d.cts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
//#region src/shared/types.d.ts
|
|
3
|
+
/** Source of truth for {@link Look} — lets consumers (e.g. a style picker) iterate instead of hardcoding names. */
|
|
4
|
+
declare const LOOKS: readonly ["technical", "studio", "showcase", "arctic", "xray", "lineart", "wireframe"];
|
|
5
|
+
type Look = (typeof LOOKS)[number];
|
|
6
|
+
/**
|
|
7
|
+
* How a {@link Look} overrides the per-mesh material a solve produced. Omitted fields leave the
|
|
8
|
+
* mesh's own value alone, so a look that sets none of them is purely a lighting change.
|
|
9
|
+
*
|
|
10
|
+
* These fight the model's real colours on purpose: `arctic` reads shape over material, `xray` reads
|
|
11
|
+
* what is inside, `wireframe` reads topology. `setLook` snapshots the parsed values before the first
|
|
12
|
+
* override and restores them when switching back, so the model's own colours survive a round trip.
|
|
13
|
+
*/
|
|
14
|
+
type LookMaterialOverride = {
|
|
15
|
+
/** Replaces the mesh's own colour. Hex, e.g. 0xf2f4f7. */
|
|
16
|
+
color?: number;
|
|
17
|
+
metalness?: number;
|
|
18
|
+
roughness?: number;
|
|
19
|
+
/** Forces `transparent: true` when below 1. */
|
|
20
|
+
opacity?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Skip the depth buffer so far faces aren't hidden by near ones — what makes an x-ray read
|
|
23
|
+
* through the model instead of just looking like tinted glass. Costs correct sort order, which
|
|
24
|
+
* is the intended trade.
|
|
25
|
+
*/
|
|
26
|
+
depthWrite?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Draw each triangle as its three edges instead of a filled face. Shows the tessellation, not the
|
|
29
|
+
* design edges the `edges` overlay extracts — a curved surface reads as a dense triangle mesh.
|
|
30
|
+
* Lighting still applies but has almost nothing to shade, so a wireframe look wants flat fill
|
|
31
|
+
* rather than a key light.
|
|
32
|
+
*/
|
|
33
|
+
wireframe?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The lighting/material dials a {@link Look} sets. It still never *drives* the edge overlay or the
|
|
37
|
+
* grid; `requiresEdges` only states that a look is incomplete without edges, and the host decides
|
|
38
|
+
* whether to honour it.
|
|
39
|
+
*/
|
|
40
|
+
type LookPreset = {
|
|
41
|
+
toneMapping: THREE.ToneMapping;
|
|
42
|
+
toneMappingExposure: number;
|
|
43
|
+
envMapIntensity: number;
|
|
44
|
+
/** Multiplier on the HDR's IBL (`scene.environmentIntensity`). */
|
|
45
|
+
environmentIntensity: number;
|
|
46
|
+
hemisphereIntensity: number;
|
|
47
|
+
ambientIntensity: number;
|
|
48
|
+
cullBackfaces: boolean;
|
|
49
|
+
ambientOcclusion: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* A key light casting a shadow. IBL alone lights every face of a box almost equally, so without
|
|
52
|
+
* this a model reads as a flat white silhouette — the directional falloff is what separates the
|
|
53
|
+
* three faces meeting at a corner.
|
|
54
|
+
*/
|
|
55
|
+
sunlightIntensity: number;
|
|
56
|
+
/** Absent on the looks that only retune lighting. */
|
|
57
|
+
materialOverride?: LookMaterialOverride;
|
|
58
|
+
/**
|
|
59
|
+
* This look is a line drawing: without the edge overlay it renders as blank white shapes. Set
|
|
60
|
+
* only by `lineart`. A declaration, not an action — `setLook` still touches no overlay, so a
|
|
61
|
+
* host that ignores this gets a look that doesn't work rather than a broken invariant.
|
|
62
|
+
*
|
|
63
|
+
* A host honouring this must also turn `edges.distanceFade` off. The fade sets opacity per
|
|
64
|
+
* overlay from its 15th-percentile segment length, so one finely-detailed mesh fades whole:
|
|
65
|
+
* in a shaded look that softens some outlines, but here it erases parts of the only thing being
|
|
66
|
+
* drawn, and the opacity is recomputed per frame so edges pop in and out while orbiting.
|
|
67
|
+
*/
|
|
68
|
+
requiresEdges?: boolean;
|
|
69
|
+
};
|
|
70
|
+
/** How compute meshes read visually — the parse-time material choices baked from a {@link Look}. */
|
|
71
|
+
interface MaterialAppearanceOptions {
|
|
72
|
+
/** Default 1 (three.js's own material default) when omitted. */
|
|
73
|
+
envMapIntensity?: number;
|
|
74
|
+
/**
|
|
75
|
+
* `THREE.FrontSide` instead of `THREE.DoubleSide` — crisper silhouette on closed solids, but open
|
|
76
|
+
* surfaces (which Rhino also emits) vanish when viewed from behind. Default false (DoubleSide) to
|
|
77
|
+
* stay safe for surface geometry.
|
|
78
|
+
*/
|
|
79
|
+
cullBackfaces?: boolean;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { MaterialAppearanceOptions as a, LookPreset as i, Look as n, LookMaterialOverride as r, LOOKS as t };
|
|
83
|
+
//# sourceMappingURL=types-C0V-dIU-.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selvajs/visualization",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Headless, extensible viewer core for Selva — parse, render and scene layers over Three.js",
|
|
5
5
|
"author": "VektorNode",
|
|
6
6
|
"license": "MIT",
|
|
@@ -84,17 +84,17 @@
|
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@eslint/js": "^10.0.1",
|
|
87
|
-
"@types/node": "^26.
|
|
87
|
+
"@types/node": "^26.4.0",
|
|
88
88
|
"@types/three": "^0.185.4",
|
|
89
|
-
"eslint": "^10.
|
|
89
|
+
"eslint": "^10.9.1",
|
|
90
90
|
"eslint-config-prettier": "^10.1.8",
|
|
91
91
|
"globals": "^17.11.0",
|
|
92
92
|
"prettier": "^3.9.6",
|
|
93
93
|
"three": "^0.185.1",
|
|
94
94
|
"tsdown": "^0.22.14",
|
|
95
95
|
"typescript": "~6.0.3",
|
|
96
|
-
"vite": "^8.2.
|
|
97
|
-
"vitest": "^4.1.
|
|
96
|
+
"vite": "^8.2.2",
|
|
97
|
+
"vitest": "^4.1.11",
|
|
98
98
|
"@selvajs/config": "0.0.4"
|
|
99
99
|
},
|
|
100
100
|
"engines": {
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
//#region src/shared/types.d.ts
|
|
3
|
-
/** Source of truth for {@link Look} — lets consumers (e.g. a style picker) iterate instead of hardcoding names. */
|
|
4
|
-
declare const LOOKS: readonly ["technical", "studio", "showcase"];
|
|
5
|
-
type Look = (typeof LOOKS)[number];
|
|
6
|
-
/**
|
|
7
|
-
* The lighting/material dials a {@link Look} sets. Never carries edges or grid — those are
|
|
8
|
-
* independent overlays.
|
|
9
|
-
*/
|
|
10
|
-
type LookPreset = {
|
|
11
|
-
toneMapping: THREE.ToneMapping;
|
|
12
|
-
toneMappingExposure: number;
|
|
13
|
-
envMapIntensity: number;
|
|
14
|
-
/** Multiplier on the HDR's IBL (`scene.environmentIntensity`). */
|
|
15
|
-
environmentIntensity: number;
|
|
16
|
-
hemisphereIntensity: number;
|
|
17
|
-
ambientIntensity: number;
|
|
18
|
-
cullBackfaces: boolean;
|
|
19
|
-
ambientOcclusion: boolean;
|
|
20
|
-
};
|
|
21
|
-
/** How compute meshes read visually — the parse-time material choices baked from a {@link Look}. */
|
|
22
|
-
interface MaterialAppearanceOptions {
|
|
23
|
-
/** Default 1 (three.js's own material default) when omitted. */
|
|
24
|
-
envMapIntensity?: number;
|
|
25
|
-
/**
|
|
26
|
-
* `THREE.FrontSide` instead of `THREE.DoubleSide` — crisper silhouette on closed solids, but open
|
|
27
|
-
* surfaces (which Rhino also emits) vanish when viewed from behind. Default false (DoubleSide) to
|
|
28
|
-
* stay safe for surface geometry.
|
|
29
|
-
*/
|
|
30
|
-
cullBackfaces?: boolean;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { MaterialAppearanceOptions as i, Look as n, LookPreset as r, LOOKS as t };
|
|
34
|
-
//# sourceMappingURL=types-Di80Y609.d.cts.map
|
package/dist/types-Di80Y609.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
//#region src/shared/types.d.ts
|
|
3
|
-
/** Source of truth for {@link Look} — lets consumers (e.g. a style picker) iterate instead of hardcoding names. */
|
|
4
|
-
declare const LOOKS: readonly ["technical", "studio", "showcase"];
|
|
5
|
-
type Look = (typeof LOOKS)[number];
|
|
6
|
-
/**
|
|
7
|
-
* The lighting/material dials a {@link Look} sets. Never carries edges or grid — those are
|
|
8
|
-
* independent overlays.
|
|
9
|
-
*/
|
|
10
|
-
type LookPreset = {
|
|
11
|
-
toneMapping: THREE.ToneMapping;
|
|
12
|
-
toneMappingExposure: number;
|
|
13
|
-
envMapIntensity: number;
|
|
14
|
-
/** Multiplier on the HDR's IBL (`scene.environmentIntensity`). */
|
|
15
|
-
environmentIntensity: number;
|
|
16
|
-
hemisphereIntensity: number;
|
|
17
|
-
ambientIntensity: number;
|
|
18
|
-
cullBackfaces: boolean;
|
|
19
|
-
ambientOcclusion: boolean;
|
|
20
|
-
};
|
|
21
|
-
/** How compute meshes read visually — the parse-time material choices baked from a {@link Look}. */
|
|
22
|
-
interface MaterialAppearanceOptions {
|
|
23
|
-
/** Default 1 (three.js's own material default) when omitted. */
|
|
24
|
-
envMapIntensity?: number;
|
|
25
|
-
/**
|
|
26
|
-
* `THREE.FrontSide` instead of `THREE.DoubleSide` — crisper silhouette on closed solids, but open
|
|
27
|
-
* surfaces (which Rhino also emits) vanish when viewed from behind. Default false (DoubleSide) to
|
|
28
|
-
* stay safe for surface geometry.
|
|
29
|
-
*/
|
|
30
|
-
cullBackfaces?: boolean;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { MaterialAppearanceOptions as i, Look as n, LookPreset as r, LOOKS as t };
|
|
34
|
-
//# sourceMappingURL=types-Di80Y609.d.ts.map
|