@selvajs/visualization 1.8.0 → 1.8.1
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/render.cjs +3 -1
- package/dist/render.cjs.map +1 -1
- package/dist/render.js +3 -1
- package/dist/render.js.map +1 -1
- package/package.json +1 -1
package/dist/render.cjs
CHANGED
|
@@ -178,6 +178,7 @@ const METAL = .5;
|
|
|
178
178
|
/** Above PMREM's blur for a mirror, so a softbox has an edge in chrome without showing as a shape. */
|
|
179
179
|
const STUDIO_BLUR = .03;
|
|
180
180
|
const KEY = "selvaReflectionEnvironment";
|
|
181
|
+
const probes = /* @__PURE__ */ new WeakSet();
|
|
181
182
|
/**
|
|
182
183
|
* Builds the studio probe once per scene. `rotation` turns its Y-up room to the scene's up, the same
|
|
183
184
|
* rotation the HDR gets.
|
|
@@ -196,6 +197,7 @@ function installReflectionEnvironment(scene, texture, rotation) {
|
|
|
196
197
|
texture,
|
|
197
198
|
rotation: rotation.clone()
|
|
198
199
|
};
|
|
200
|
+
probes.add(texture);
|
|
199
201
|
scene.userData[KEY] = environment;
|
|
200
202
|
applyReflectionEnvironment(scene, scene);
|
|
201
203
|
}
|
|
@@ -219,7 +221,7 @@ function applyReflectionEnvironment(root, scene) {
|
|
|
219
221
|
const materials = Array.isArray(mesh.material) ? mesh.material : mesh.material ? [mesh.material] : [];
|
|
220
222
|
for (const material of materials) {
|
|
221
223
|
if (!(material instanceof three.MeshStandardMaterial)) continue;
|
|
222
|
-
if (material.envMap && material.envMap
|
|
224
|
+
if (material.envMap && !probes.has(material.envMap)) continue;
|
|
223
225
|
const wanted = material.metalness > METAL ? environment.texture : null;
|
|
224
226
|
if (material.envMap === wanted) continue;
|
|
225
227
|
material.envMap = wanted;
|