@neurodyn/react-room-viewer 0.0.21 → 0.0.22
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/index.js +18 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15813,7 +15813,7 @@ function createRoomLightingTexture(planeIds, shading, neutral = 128) {
|
|
|
15813
15813
|
texture.needsUpdate = true;
|
|
15814
15814
|
return texture;
|
|
15815
15815
|
}
|
|
15816
|
-
const CACHE_KEY = 'neurodyn-room-scene-
|
|
15816
|
+
const CACHE_KEY = 'neurodyn-room-scene-v5';
|
|
15817
15817
|
const GLSL_DEFINE = 'NEURODYN_ROOM_SCENE_PATCH';
|
|
15818
15818
|
function patchShader(shader, patch, shading) {
|
|
15819
15819
|
shader.uniforms.uPlaneIds = {
|
|
@@ -15838,7 +15838,7 @@ function patchShader(shader, patch, shading) {
|
|
|
15838
15838
|
if (_neurodynRoomCoverage <= 0.001) discard;
|
|
15839
15839
|
|
|
15840
15840
|
${shading ? `
|
|
15841
|
-
float _neurodynRoomGain = texture2D(uRoomLighting, vec2(_neurodynRoomUv.x, 1.0 - _neurodynRoomUv.y)).r * (255.0 / 128.0);
|
|
15841
|
+
float _neurodynRoomGain = min(texture2D(uRoomLighting, vec2(_neurodynRoomUv.x, 1.0 - _neurodynRoomUv.y)).r * (255.0 / 128.0), ${patch.maxRoomGain.toFixed(3)});
|
|
15842
15842
|
outgoingLight = (outgoingLight - ${emissive}) * _neurodynRoomGain + ${emissive};
|
|
15843
15843
|
` : ''}
|
|
15844
15844
|
diffuseColor.a *= smoothstep(0.0, 0.6, _neurodynRoomCoverage);
|
|
@@ -15902,7 +15902,7 @@ function patchMaterialWithRoomScene(material, patch, { shading = true } = {}) {
|
|
|
15902
15902
|
previousOnBeforeCompile?.call(material, shader, renderer);
|
|
15903
15903
|
patchShader(shader, patch, shading);
|
|
15904
15904
|
};
|
|
15905
|
-
material.customProgramCacheKey = ()=>`${previousCustomProgramCacheKey()}|${CACHE_KEY}|shading:${shading}`;
|
|
15905
|
+
material.customProgramCacheKey = ()=>`${previousCustomProgramCacheKey()}|${CACHE_KEY}|shading:${shading}|maxRoomGain:${patch.maxRoomGain}`;
|
|
15906
15906
|
material.needsUpdate = true;
|
|
15907
15907
|
return ()=>{
|
|
15908
15908
|
material.onBeforeCompile = previousOnBeforeCompile;
|
|
@@ -17124,6 +17124,7 @@ function RoomPlane({ plane, geometry, setPlaneRef }) {
|
|
|
17124
17124
|
})
|
|
17125
17125
|
});
|
|
17126
17126
|
}
|
|
17127
|
+
const MAX_ROOM_GAIN = 1.1;
|
|
17127
17128
|
function Room() {
|
|
17128
17129
|
const { type } = useRoomViewerMetadata();
|
|
17129
17130
|
const panelGroup = usePanelGroup();
|
|
@@ -17167,7 +17168,8 @@ function Room() {
|
|
|
17167
17168
|
lightingTexture,
|
|
17168
17169
|
planeIdsSize,
|
|
17169
17170
|
viewport,
|
|
17170
|
-
activePlaneIdUniform: scenePlacement.activePlaneIdUniform
|
|
17171
|
+
activePlaneIdUniform: scenePlacement.activePlaneIdUniform,
|
|
17172
|
+
maxRoomGain: MAX_ROOM_GAIN
|
|
17171
17173
|
}), [
|
|
17172
17174
|
scenePlacement.activePlaneIdUniform,
|
|
17173
17175
|
planeIdsSize,
|
|
@@ -17273,6 +17275,13 @@ const ROOM_VIEWER_CONFIG_QUERY_KEY = [
|
|
|
17273
17275
|
'room-viewer',
|
|
17274
17276
|
'layout-config'
|
|
17275
17277
|
];
|
|
17278
|
+
const HDR_ROTATION = [
|
|
17279
|
+
Math.PI / 2,
|
|
17280
|
+
0,
|
|
17281
|
+
0
|
|
17282
|
+
];
|
|
17283
|
+
const REMOTE_HDR_INTENSITY = 0.5;
|
|
17284
|
+
const FALLBACK_ENVIRONMENT_INTENSITY = 0.9;
|
|
17276
17285
|
function getNeutralHdrUrl(config) {
|
|
17277
17286
|
const url = config?.internal?.links?.find((link)=>link.type === HDR_NEUTRAL_LINK_TYPE)?.url?.trim();
|
|
17278
17287
|
return url || void 0;
|
|
@@ -17289,14 +17298,17 @@ function RemoteNeutralHdrEnvironment() {
|
|
|
17289
17298
|
files: hdrUrl ? [
|
|
17290
17299
|
hdrUrl
|
|
17291
17300
|
] : void 0,
|
|
17292
|
-
preset: hdrUrl ? void 0 : 'warehouse'
|
|
17301
|
+
preset: hdrUrl ? void 0 : 'warehouse',
|
|
17302
|
+
environmentRotation: HDR_ROTATION,
|
|
17303
|
+
environmentIntensity: hdrUrl ? REMOTE_HDR_INTENSITY : FALLBACK_ENVIRONMENT_INTENSITY
|
|
17293
17304
|
});
|
|
17294
17305
|
}
|
|
17295
17306
|
function StaticNeutralHdrEnvironment() {
|
|
17296
17307
|
return /*#__PURE__*/ jsx_runtime_jsx(Environment, {
|
|
17297
17308
|
files: [
|
|
17298
17309
|
HDR_URL
|
|
17299
|
-
]
|
|
17310
|
+
],
|
|
17311
|
+
environmentRotation: HDR_ROTATION
|
|
17300
17312
|
});
|
|
17301
17313
|
}
|
|
17302
17314
|
function RoomEnvironment({ lighting }) {
|