@liveroom-tech/react-immersive 1.3.0 → 1.3.2
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 +20 -2
- package/dist/index.mjs +20 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -317,9 +317,22 @@ function exportSceneMesh({
|
|
|
317
317
|
for (const [bindingKey, binding] of Object.entries(objectBindings)) {
|
|
318
318
|
bindingKeyByModelObject.set(binding.modelObjectId ?? bindingKey, bindingKey);
|
|
319
319
|
}
|
|
320
|
+
const isVisibleForExport = (node) => {
|
|
321
|
+
let current = node;
|
|
322
|
+
while (current) {
|
|
323
|
+
const nodeName = current.name || current.uuid;
|
|
324
|
+
const bindingKey = bindingKeyByModelObject.get(nodeName) ?? nodeName;
|
|
325
|
+
const binding = objectBindings[bindingKey];
|
|
326
|
+
if (binding ? binding.visible === false : current.visible === false) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
current = current.parent;
|
|
330
|
+
}
|
|
331
|
+
return true;
|
|
332
|
+
};
|
|
320
333
|
scene.traverse((node) => {
|
|
321
334
|
const mesh = node;
|
|
322
|
-
if (!mesh.isMesh || !mesh.geometry) return;
|
|
335
|
+
if (!mesh.isMesh || !mesh.geometry || !isVisibleForExport(mesh)) return;
|
|
323
336
|
const nodeName = mesh.name || mesh.uuid;
|
|
324
337
|
const bindingKey = bindingKeyByModelObject.get(nodeName) ?? nodeName;
|
|
325
338
|
const liveMat = matRefs[bindingKey] ?? mesh.material;
|
|
@@ -4115,12 +4128,16 @@ function CinematicCamera({
|
|
|
4115
4128
|
const enterPos = (0, import_react15.useRef)(new import_three18.Vector3());
|
|
4116
4129
|
const enterTarget = (0, import_react15.useRef)(new import_three18.Vector3());
|
|
4117
4130
|
const startedRef = (0, import_react15.useRef)(false);
|
|
4131
|
+
const pausedElapsedRef = (0, import_react15.useRef)(0);
|
|
4118
4132
|
const orbitRef = (0, import_react15.useRef)(null);
|
|
4119
4133
|
const tmpPos = (0, import_react15.useMemo)(() => new import_three18.Vector3(), []);
|
|
4120
4134
|
const tmpTarget = (0, import_react15.useMemo)(() => new import_three18.Vector3(), []);
|
|
4121
4135
|
(0, import_react15.useEffect)(() => {
|
|
4122
4136
|
if (!playing) {
|
|
4123
4137
|
startedRef.current = false;
|
|
4138
|
+
if (elapsedRef.current > 0) {
|
|
4139
|
+
pausedElapsedRef.current = elapsedRef.current;
|
|
4140
|
+
}
|
|
4124
4141
|
return;
|
|
4125
4142
|
}
|
|
4126
4143
|
const controls = controlsRef.current;
|
|
@@ -4128,7 +4145,7 @@ function CinematicCamera({
|
|
|
4128
4145
|
controls.getPosition(enterPos.current);
|
|
4129
4146
|
controls.getTarget(enterTarget.current);
|
|
4130
4147
|
}
|
|
4131
|
-
elapsedRef.current = 0;
|
|
4148
|
+
elapsedRef.current = pausedElapsedRef.current || 0;
|
|
4132
4149
|
enterElapsedRef.current = 0;
|
|
4133
4150
|
if (!hasPath) {
|
|
4134
4151
|
const scene = sceneRef.current;
|
|
@@ -4192,6 +4209,7 @@ function CinematicCamera({
|
|
|
4192
4209
|
);
|
|
4193
4210
|
if (finished) {
|
|
4194
4211
|
startedRef.current = false;
|
|
4212
|
+
pausedElapsedRef.current = 0;
|
|
4195
4213
|
onFinished?.();
|
|
4196
4214
|
return;
|
|
4197
4215
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -275,9 +275,22 @@ function exportSceneMesh({
|
|
|
275
275
|
for (const [bindingKey, binding] of Object.entries(objectBindings)) {
|
|
276
276
|
bindingKeyByModelObject.set(binding.modelObjectId ?? bindingKey, bindingKey);
|
|
277
277
|
}
|
|
278
|
+
const isVisibleForExport = (node) => {
|
|
279
|
+
let current = node;
|
|
280
|
+
while (current) {
|
|
281
|
+
const nodeName = current.name || current.uuid;
|
|
282
|
+
const bindingKey = bindingKeyByModelObject.get(nodeName) ?? nodeName;
|
|
283
|
+
const binding = objectBindings[bindingKey];
|
|
284
|
+
if (binding ? binding.visible === false : current.visible === false) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
current = current.parent;
|
|
288
|
+
}
|
|
289
|
+
return true;
|
|
290
|
+
};
|
|
278
291
|
scene.traverse((node) => {
|
|
279
292
|
const mesh = node;
|
|
280
|
-
if (!mesh.isMesh || !mesh.geometry) return;
|
|
293
|
+
if (!mesh.isMesh || !mesh.geometry || !isVisibleForExport(mesh)) return;
|
|
281
294
|
const nodeName = mesh.name || mesh.uuid;
|
|
282
295
|
const bindingKey = bindingKeyByModelObject.get(nodeName) ?? nodeName;
|
|
283
296
|
const liveMat = matRefs[bindingKey] ?? mesh.material;
|
|
@@ -4154,12 +4167,16 @@ function CinematicCamera({
|
|
|
4154
4167
|
const enterPos = useRef8(new Vector36());
|
|
4155
4168
|
const enterTarget = useRef8(new Vector36());
|
|
4156
4169
|
const startedRef = useRef8(false);
|
|
4170
|
+
const pausedElapsedRef = useRef8(0);
|
|
4157
4171
|
const orbitRef = useRef8(null);
|
|
4158
4172
|
const tmpPos = useMemo11(() => new Vector36(), []);
|
|
4159
4173
|
const tmpTarget = useMemo11(() => new Vector36(), []);
|
|
4160
4174
|
useEffect11(() => {
|
|
4161
4175
|
if (!playing) {
|
|
4162
4176
|
startedRef.current = false;
|
|
4177
|
+
if (elapsedRef.current > 0) {
|
|
4178
|
+
pausedElapsedRef.current = elapsedRef.current;
|
|
4179
|
+
}
|
|
4163
4180
|
return;
|
|
4164
4181
|
}
|
|
4165
4182
|
const controls = controlsRef.current;
|
|
@@ -4167,7 +4184,7 @@ function CinematicCamera({
|
|
|
4167
4184
|
controls.getPosition(enterPos.current);
|
|
4168
4185
|
controls.getTarget(enterTarget.current);
|
|
4169
4186
|
}
|
|
4170
|
-
elapsedRef.current = 0;
|
|
4187
|
+
elapsedRef.current = pausedElapsedRef.current || 0;
|
|
4171
4188
|
enterElapsedRef.current = 0;
|
|
4172
4189
|
if (!hasPath) {
|
|
4173
4190
|
const scene = sceneRef.current;
|
|
@@ -4231,6 +4248,7 @@ function CinematicCamera({
|
|
|
4231
4248
|
);
|
|
4232
4249
|
if (finished) {
|
|
4233
4250
|
startedRef.current = false;
|
|
4251
|
+
pausedElapsedRef.current = 0;
|
|
4234
4252
|
onFinished?.();
|
|
4235
4253
|
return;
|
|
4236
4254
|
}
|