@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.js
CHANGED
|
@@ -175,6 +175,7 @@ const METAL = .5;
|
|
|
175
175
|
/** Above PMREM's blur for a mirror, so a softbox has an edge in chrome without showing as a shape. */
|
|
176
176
|
const STUDIO_BLUR = .03;
|
|
177
177
|
const KEY = "selvaReflectionEnvironment";
|
|
178
|
+
const probes = /* @__PURE__ */ new WeakSet();
|
|
178
179
|
/**
|
|
179
180
|
* Builds the studio probe once per scene. `rotation` turns its Y-up room to the scene's up, the same
|
|
180
181
|
* rotation the HDR gets.
|
|
@@ -193,6 +194,7 @@ function installReflectionEnvironment(scene, texture, rotation) {
|
|
|
193
194
|
texture,
|
|
194
195
|
rotation: rotation.clone()
|
|
195
196
|
};
|
|
197
|
+
probes.add(texture);
|
|
196
198
|
scene.userData[KEY] = environment;
|
|
197
199
|
applyReflectionEnvironment(scene, scene);
|
|
198
200
|
}
|
|
@@ -216,7 +218,7 @@ function applyReflectionEnvironment(root, scene) {
|
|
|
216
218
|
const materials = Array.isArray(mesh.material) ? mesh.material : mesh.material ? [mesh.material] : [];
|
|
217
219
|
for (const material of materials) {
|
|
218
220
|
if (!(material instanceof THREE.MeshStandardMaterial)) continue;
|
|
219
|
-
if (material.envMap && material.envMap
|
|
221
|
+
if (material.envMap && !probes.has(material.envMap)) continue;
|
|
220
222
|
const wanted = material.metalness > METAL ? environment.texture : null;
|
|
221
223
|
if (material.envMap === wanted) continue;
|
|
222
224
|
material.envMap = wanted;
|