@liveroom-tech/react-immersive 1.3.1 → 1.3.3

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.d.mts CHANGED
@@ -275,6 +275,7 @@ type ScenePostProcessingConfig = {
275
275
  rampEnd: [number, number];
276
276
  startColor: string;
277
277
  endColor: string;
278
+ opacity?: number;
278
279
  rampBias: number;
279
280
  rampGain: number;
280
281
  rampMask: boolean;
package/dist/index.d.ts CHANGED
@@ -275,6 +275,7 @@ type ScenePostProcessingConfig = {
275
275
  rampEnd: [number, number];
276
276
  startColor: string;
277
277
  endColor: string;
278
+ opacity?: number;
278
279
  rampBias: number;
279
280
  rampGain: number;
280
281
  rampMask: boolean;
package/dist/index.js CHANGED
@@ -637,6 +637,7 @@ var DEFAULT_SCENE_POST_PROCESSING_CONFIG = {
637
637
  rampEnd: [1, 1],
638
638
  startColor: "#000000",
639
639
  endColor: "#ffffff",
640
+ opacity: 0.5,
640
641
  rampBias: 0.5,
641
642
  rampGain: 0.5,
642
643
  rampMask: false,
@@ -1474,7 +1475,10 @@ function PostProcessingEffects({
1474
1475
  }
1475
1476
  ),
1476
1477
  pp.pixelation.enabled === true && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_postprocessing5.Pixelation, { granularity: pp.pixelation.granularity }),
1477
- pp.ramp.enabled === true && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1478
+ pp.ramp.enabled === true && // Ramp's non-mask shader emits an opaque full-screen gradient.
1479
+ // Blend it with the scene by default instead of replacing the
1480
+ // model completely; mask mode already performs its own mix.
1481
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1478
1482
  import_postprocessing5.Ramp,
1479
1483
  {
1480
1484
  rampType: rampTypeFromName(pp.ramp.rampType),
@@ -1482,6 +1486,7 @@ function PostProcessingEffects({
1482
1486
  rampEnd: pp.ramp.rampEnd,
1483
1487
  startColor: rampStartColor,
1484
1488
  endColor: rampEndColor,
1489
+ opacity: pp.ramp.rampMask ? 1 : pp.ramp.opacity ?? 0.5,
1485
1490
  rampBias: pp.ramp.rampBias,
1486
1491
  rampGain: pp.ramp.rampGain,
1487
1492
  rampMask: pp.ramp.rampMask,
@@ -4128,12 +4133,16 @@ function CinematicCamera({
4128
4133
  const enterPos = (0, import_react15.useRef)(new import_three18.Vector3());
4129
4134
  const enterTarget = (0, import_react15.useRef)(new import_three18.Vector3());
4130
4135
  const startedRef = (0, import_react15.useRef)(false);
4136
+ const pausedElapsedRef = (0, import_react15.useRef)(0);
4131
4137
  const orbitRef = (0, import_react15.useRef)(null);
4132
4138
  const tmpPos = (0, import_react15.useMemo)(() => new import_three18.Vector3(), []);
4133
4139
  const tmpTarget = (0, import_react15.useMemo)(() => new import_three18.Vector3(), []);
4134
4140
  (0, import_react15.useEffect)(() => {
4135
4141
  if (!playing) {
4136
4142
  startedRef.current = false;
4143
+ if (elapsedRef.current > 0) {
4144
+ pausedElapsedRef.current = elapsedRef.current;
4145
+ }
4137
4146
  return;
4138
4147
  }
4139
4148
  const controls = controlsRef.current;
@@ -4141,7 +4150,7 @@ function CinematicCamera({
4141
4150
  controls.getPosition(enterPos.current);
4142
4151
  controls.getTarget(enterTarget.current);
4143
4152
  }
4144
- elapsedRef.current = 0;
4153
+ elapsedRef.current = pausedElapsedRef.current || 0;
4145
4154
  enterElapsedRef.current = 0;
4146
4155
  if (!hasPath) {
4147
4156
  const scene = sceneRef.current;
@@ -4205,6 +4214,7 @@ function CinematicCamera({
4205
4214
  );
4206
4215
  if (finished) {
4207
4216
  startedRef.current = false;
4217
+ pausedElapsedRef.current = 0;
4208
4218
  onFinished?.();
4209
4219
  return;
4210
4220
  }
@@ -10310,7 +10320,7 @@ function RampSection({
10310
10320
  PPSection,
10311
10321
  {
10312
10322
  title: "Ramp",
10313
- tooltip: "Maps shading through a custom color ramp or gradient.",
10323
+ tooltip: "Adds a screen-space color gradient, or masks effects earlier in the stack.",
10314
10324
  open: open.ramp,
10315
10325
  onToggle: () => toggle("ramp"),
10316
10326
  disabled: !ramp.enabled,
@@ -10370,6 +10380,17 @@ function RampSection({
10370
10380
  onChange: (v) => set("ramp", { ...ramp, endColor: v })
10371
10381
  }
10372
10382
  ),
10383
+ !ramp.rampMask && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
10384
+ SliderRow,
10385
+ {
10386
+ label: "Gradient Opacity",
10387
+ value: ramp.opacity ?? 0.5,
10388
+ min: 0,
10389
+ max: 1,
10390
+ step: 0.01,
10391
+ onChange: (v) => set("ramp", { ...ramp, opacity: v })
10392
+ }
10393
+ ),
10373
10394
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
10374
10395
  SliderRow,
10375
10396
  {
@@ -10395,7 +10416,7 @@ function RampSection({
10395
10416
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
10396
10417
  ToggleRow,
10397
10418
  {
10398
- label: "Mask",
10419
+ label: "Mask Earlier Effects",
10399
10420
  checked: ramp.rampMask,
10400
10421
  onChange: (v) => set("ramp", { ...ramp, rampMask: v })
10401
10422
  }
package/dist/index.mjs CHANGED
@@ -600,6 +600,7 @@ var DEFAULT_SCENE_POST_PROCESSING_CONFIG = {
600
600
  rampEnd: [1, 1],
601
601
  startColor: "#000000",
602
602
  endColor: "#ffffff",
603
+ opacity: 0.5,
603
604
  rampBias: 0.5,
604
605
  rampGain: 0.5,
605
606
  rampMask: false,
@@ -1467,7 +1468,10 @@ function PostProcessingEffects({
1467
1468
  }
1468
1469
  ),
1469
1470
  pp.pixelation.enabled === true && /* @__PURE__ */ jsx4(Pixelation, { granularity: pp.pixelation.granularity }),
1470
- pp.ramp.enabled === true && /* @__PURE__ */ jsx4(
1471
+ pp.ramp.enabled === true && // Ramp's non-mask shader emits an opaque full-screen gradient.
1472
+ // Blend it with the scene by default instead of replacing the
1473
+ // model completely; mask mode already performs its own mix.
1474
+ /* @__PURE__ */ jsx4(
1471
1475
  Ramp,
1472
1476
  {
1473
1477
  rampType: rampTypeFromName(pp.ramp.rampType),
@@ -1475,6 +1479,7 @@ function PostProcessingEffects({
1475
1479
  rampEnd: pp.ramp.rampEnd,
1476
1480
  startColor: rampStartColor,
1477
1481
  endColor: rampEndColor,
1482
+ opacity: pp.ramp.rampMask ? 1 : pp.ramp.opacity ?? 0.5,
1478
1483
  rampBias: pp.ramp.rampBias,
1479
1484
  rampGain: pp.ramp.rampGain,
1480
1485
  rampMask: pp.ramp.rampMask,
@@ -4167,12 +4172,16 @@ function CinematicCamera({
4167
4172
  const enterPos = useRef8(new Vector36());
4168
4173
  const enterTarget = useRef8(new Vector36());
4169
4174
  const startedRef = useRef8(false);
4175
+ const pausedElapsedRef = useRef8(0);
4170
4176
  const orbitRef = useRef8(null);
4171
4177
  const tmpPos = useMemo11(() => new Vector36(), []);
4172
4178
  const tmpTarget = useMemo11(() => new Vector36(), []);
4173
4179
  useEffect11(() => {
4174
4180
  if (!playing) {
4175
4181
  startedRef.current = false;
4182
+ if (elapsedRef.current > 0) {
4183
+ pausedElapsedRef.current = elapsedRef.current;
4184
+ }
4176
4185
  return;
4177
4186
  }
4178
4187
  const controls = controlsRef.current;
@@ -4180,7 +4189,7 @@ function CinematicCamera({
4180
4189
  controls.getPosition(enterPos.current);
4181
4190
  controls.getTarget(enterTarget.current);
4182
4191
  }
4183
- elapsedRef.current = 0;
4192
+ elapsedRef.current = pausedElapsedRef.current || 0;
4184
4193
  enterElapsedRef.current = 0;
4185
4194
  if (!hasPath) {
4186
4195
  const scene = sceneRef.current;
@@ -4244,6 +4253,7 @@ function CinematicCamera({
4244
4253
  );
4245
4254
  if (finished) {
4246
4255
  startedRef.current = false;
4256
+ pausedElapsedRef.current = 0;
4247
4257
  onFinished?.();
4248
4258
  return;
4249
4259
  }
@@ -10381,7 +10391,7 @@ function RampSection({
10381
10391
  PPSection,
10382
10392
  {
10383
10393
  title: "Ramp",
10384
- tooltip: "Maps shading through a custom color ramp or gradient.",
10394
+ tooltip: "Adds a screen-space color gradient, or masks effects earlier in the stack.",
10385
10395
  open: open.ramp,
10386
10396
  onToggle: () => toggle("ramp"),
10387
10397
  disabled: !ramp.enabled,
@@ -10441,6 +10451,17 @@ function RampSection({
10441
10451
  onChange: (v) => set("ramp", { ...ramp, endColor: v })
10442
10452
  }
10443
10453
  ),
10454
+ !ramp.rampMask && /* @__PURE__ */ jsx25(
10455
+ SliderRow,
10456
+ {
10457
+ label: "Gradient Opacity",
10458
+ value: ramp.opacity ?? 0.5,
10459
+ min: 0,
10460
+ max: 1,
10461
+ step: 0.01,
10462
+ onChange: (v) => set("ramp", { ...ramp, opacity: v })
10463
+ }
10464
+ ),
10444
10465
  /* @__PURE__ */ jsx25(
10445
10466
  SliderRow,
10446
10467
  {
@@ -10466,7 +10487,7 @@ function RampSection({
10466
10487
  /* @__PURE__ */ jsx25(
10467
10488
  ToggleRow,
10468
10489
  {
10469
- label: "Mask",
10490
+ label: "Mask Earlier Effects",
10470
10491
  checked: ramp.rampMask,
10471
10492
  onChange: (v) => set("ramp", { ...ramp, rampMask: v })
10472
10493
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveroom-tech/react-immersive",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",