@selvajs/visualization 1.6.1 → 1.7.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/dist/{gpu-dispose-D66GqIWS.cjs → gpu-dispose-0c_-KS12.cjs} +11 -8
- package/dist/gpu-dispose-0c_-KS12.cjs.map +1 -0
- package/dist/{gpu-dispose-Di_nxeXF.js → gpu-dispose-k_Gq-ygL.js} +11 -8
- package/dist/gpu-dispose-k_Gq-ygL.js.map +1 -0
- package/dist/parse.cjs +47 -16
- package/dist/parse.cjs.map +1 -1
- package/dist/parse.d.cts +3 -3
- package/dist/parse.d.ts +3 -3
- package/dist/parse.js +47 -16
- package/dist/parse.js.map +1 -1
- package/dist/render.cjs +10 -9
- package/dist/render.cjs.map +1 -1
- package/dist/render.d.cts +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/render.js +10 -9
- package/dist/render.js.map +1 -1
- package/dist/{types-DW_qU4-Y.d.ts → types-i9wRcHK7.d.cts} +13 -1
- package/dist/{types-DW_qU4-Y.d.cts → types-i9wRcHK7.d.ts} +13 -1
- package/package.json +2 -1
- package/dist/gpu-dispose-D66GqIWS.cjs.map +0 -1
- package/dist/gpu-dispose-Di_nxeXF.js.map +0 -1
package/dist/render.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as LookPreset, i as LookMaterialOverride, n as LOOKS, o as MaterialAppearanceOptions, r as Look, t as BloomOptions } from "./types-
|
|
1
|
+
import { a as LookPreset, i as LookMaterialOverride, n as LOOKS, o as MaterialAppearanceOptions, r as Look, t as BloomOptions } from "./types-i9wRcHK7.cjs";
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
4
4
|
import "three/addons/lines/LineSegments2.js";
|
package/dist/render.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as LookPreset, i as LookMaterialOverride, n as LOOKS, o as MaterialAppearanceOptions, r as Look, t as BloomOptions } from "./types-
|
|
1
|
+
import { a as LookPreset, i as LookMaterialOverride, n as LOOKS, o as MaterialAppearanceOptions, r as Look, t as BloomOptions } from "./types-i9wRcHK7.js";
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import { LineSegments2 } from "three/addons/lines/LineSegments2.js";
|
|
4
4
|
import { CSS2DObject } from "three/addons/renderers/CSS2DRenderer.js";
|
package/dist/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as VisualizationError, _ as materialAppearanceForLook, b as setLogger, c as computeCombinedBoundingBox, d as EMISSIVE_LIGHT, f as LOOK_PRESETS, g as lookPreset, h as lookEnvMapIntensity, m as OWN_ENV_MAP_INTENSITY, o as publishMaxAnisotropy, r as hideGlass, t as disposeObjectTree, u as DEFAULT_LOOK, v as enableDebugLogging, x as ErrorCodes, y as getLogger } from "./gpu-dispose-
|
|
1
|
+
import { S as VisualizationError, _ as materialAppearanceForLook, b as setLogger, c as computeCombinedBoundingBox, d as EMISSIVE_LIGHT, f as LOOK_PRESETS, g as lookPreset, h as lookEnvMapIntensity, m as OWN_ENV_MAP_INTENSITY, o as publishMaxAnisotropy, r as hideGlass, t as disposeObjectTree, u as DEFAULT_LOOK, v as enableDebugLogging, x as ErrorCodes, y as getLogger } from "./gpu-dispose-k_Gq-ygL.js";
|
|
2
2
|
import { n as cachedSourceOf } from "./gpu-ownership-Bs9l7hrU.js";
|
|
3
3
|
import { a as onMemberDrawChange, i as getHiddenMembers, n as cloneForTint, r as getBaseMaterial, s as setMemberHighlight, t as clearMemberHighlight } from "./merged-draw-CO4rr2Co.js";
|
|
4
4
|
import * as THREE from "three";
|
|
@@ -2895,10 +2895,11 @@ const MIN_RELATIVE_STRENGTH = 1 / 3;
|
|
|
2895
2895
|
/** Parts this close, as a share of the larger one's diagonal, are one lamp: a bulb and its reflector. */
|
|
2896
2896
|
const SAME_LAMP_GAP = .05;
|
|
2897
2897
|
/**
|
|
2898
|
-
*
|
|
2899
|
-
*
|
|
2898
|
+
* A glow sent without lumens lights like the lamp its strength stands for, so it agrees with one
|
|
2899
|
+
* that has them. Mirrors `Photometry` in Selva.Slva: one strength is 160 lm, spread over 4π
|
|
2900
|
+
* steradians, at 0.005 viewer units per lux. Assumes a scene in metres, as the lumens path does.
|
|
2900
2901
|
*/
|
|
2901
|
-
const
|
|
2902
|
+
const LIGHT_PER_STRENGTH = 160 / (4 * Math.PI) * .005;
|
|
2902
2903
|
/** Share of a source's light that comes back off the room, with no shadow to stop it. */
|
|
2903
2904
|
const BOUNCE_SHARE = .07;
|
|
2904
2905
|
/** A lamp's source has a size, so its shadow has a penumbra; three's default edge is a hard line. */
|
|
@@ -3029,7 +3030,7 @@ function createEmissiveLights(scene) {
|
|
|
3029
3030
|
silenced.add(mesh);
|
|
3030
3031
|
}
|
|
3031
3032
|
};
|
|
3032
|
-
const sync = (enabled, maxLights = DEFAULT_MAX_LIGHTS) => {
|
|
3033
|
+
const sync = (enabled, maxLights = DEFAULT_MAX_LIGHTS, lightScale = 1) => {
|
|
3033
3034
|
for (const mesh of silenced) mesh.castShadow = true;
|
|
3034
3035
|
silenced.clear();
|
|
3035
3036
|
const { parts, radius } = enabled ? collect() : {
|
|
@@ -3039,7 +3040,7 @@ function createEmissiveLights(scene) {
|
|
|
3039
3040
|
const sources = pickLightSources(sourcesFrom(parts, maxLights), maxLights);
|
|
3040
3041
|
sources.forEach((source, index) => {
|
|
3041
3042
|
const { key, bounce, home, size } = lights[index] ?? addLight(index < MAX_SHADOWED_LIGHTS);
|
|
3042
|
-
const intensity = source.light ?? source.strength *
|
|
3043
|
+
const intensity = (source.light ?? source.strength * LIGHT_PER_STRENGTH) * lightScale;
|
|
3043
3044
|
key.color.copy(source.color);
|
|
3044
3045
|
const spread = source.bounds.getSize(new THREE.Vector3()).length() / 2 / radius;
|
|
3045
3046
|
key.intensity = !source.light && spread > MAX_POINT_SOURCE_SPREAD ? 0 : intensity;
|
|
@@ -3151,7 +3152,7 @@ function envMapIntensityForLook(material, preset) {
|
|
|
3151
3152
|
if (own != null) return own;
|
|
3152
3153
|
const target = material;
|
|
3153
3154
|
const metalness = target[BASELINE_KEY]?.metalness ?? target.metalness ?? 0;
|
|
3154
|
-
return lookEnvMapIntensity(preset.envMapIntensity, metalness);
|
|
3155
|
+
return lookEnvMapIntensity(preset.envMapIntensity, metalness, preset.metalReflection);
|
|
3155
3156
|
}
|
|
3156
3157
|
function lookPixelRatio(fullPixelRatio, preset) {
|
|
3157
3158
|
return Math.min(fullPixelRatio, preset.maxPixelRatio ?? fullPixelRatio);
|
|
@@ -3209,8 +3210,8 @@ function createAppearanceController(params) {
|
|
|
3209
3210
|
if (pipeline.get()) pipeline.rebuild();
|
|
3210
3211
|
};
|
|
3211
3212
|
const syncEmissiveLights = () => {
|
|
3212
|
-
const { emissiveLights: enabled, maxEmissiveLights } = presetOf(activeLook);
|
|
3213
|
-
emissiveLights.sync(!!enabled, maxEmissiveLights);
|
|
3213
|
+
const { emissiveLights: enabled, maxEmissiveLights, emissiveLightScale } = presetOf(activeLook);
|
|
3214
|
+
emissiveLights.sync(!!enabled, maxEmissiveLights, emissiveLightScale);
|
|
3214
3215
|
requestRender();
|
|
3215
3216
|
};
|
|
3216
3217
|
const setLook = (look, options) => {
|