@reactvision/react-viro 2.53.1 → 2.55.0

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.
Files changed (153) hide show
  1. package/README.md +85 -46
  2. package/android/react_viro/react_viro-release.aar +0 -0
  3. package/android/viro_renderer/viro_renderer-release.aar +0 -0
  4. package/components/AR/ViroARCamera.tsx +5 -0
  5. package/components/AR/ViroARImageMarker.tsx +5 -0
  6. package/components/AR/ViroARObjectMarker.tsx +5 -0
  7. package/components/AR/ViroARPlane.tsx +5 -0
  8. package/components/AR/ViroARPlaneSelector.tsx +5 -0
  9. package/components/AR/ViroARScene.tsx +5 -0
  10. package/components/AR/ViroARSceneNavigator.tsx +84 -0
  11. package/components/AR/ViroCommonProps.ts +11 -0
  12. package/components/Material/ViroMaterials.ts +51 -0
  13. package/components/Studio/StudioARScene.tsx +368 -0
  14. package/components/Studio/StudioSceneNavigator.tsx +191 -0
  15. package/components/Studio/VRTStudioModule.ts +40 -0
  16. package/components/Studio/domain/animationRegistry.ts +86 -0
  17. package/components/Studio/domain/collisionBindingsRuntime.ts +93 -0
  18. package/components/Studio/domain/collisionPairKey.ts +15 -0
  19. package/components/Studio/domain/dragConfiguration.ts +48 -0
  20. package/components/Studio/domain/materialConfig.ts +276 -0
  21. package/components/Studio/domain/physicsConfig.ts +204 -0
  22. package/components/Studio/domain/sceneNavigationHandler.ts +150 -0
  23. package/components/Studio/domain/studioMaterials.ts +33 -0
  24. package/components/Studio/domain/triggerImageRegistry.ts +64 -0
  25. package/components/Studio/domain/useStudioShaderTimeUniforms.ts +51 -0
  26. package/components/Studio/domain/useStudioShaderViewportUniforms.ts +52 -0
  27. package/components/Studio/domain/viroNodeFactory.tsx +323 -0
  28. package/components/Studio/index.ts +18 -0
  29. package/components/Studio/types.ts +164 -0
  30. package/components/Types/ViroEvents.ts +53 -0
  31. package/components/Utilities/VRModuleOpenXR.ts +50 -0
  32. package/components/Utilities/VRQuestNavigatorBridge.ts +168 -0
  33. package/components/Utilities/ViroPlatform.ts +52 -0
  34. package/components/Utilities/ViroUtils.tsx +48 -0
  35. package/components/Utilities/ViroVersion.ts +1 -1
  36. package/components/Utilities/useAnySourceHover.ts +55 -0
  37. package/components/Utilities/useAnySourcePressed.ts +70 -0
  38. package/components/Viro360Image.tsx +7 -0
  39. package/components/ViroQuestEntryPoint.tsx +79 -0
  40. package/components/ViroVRSceneNavigator.tsx +44 -19
  41. package/components/ViroXRSceneNavigator.tsx +217 -0
  42. package/components/VisionOS/ViroVisionOSModule.ts +93 -0
  43. package/dist/components/AR/ViroARCamera.d.ts +1 -1
  44. package/dist/components/AR/ViroARCamera.js +5 -0
  45. package/dist/components/AR/ViroARImageMarker.d.ts +1 -1
  46. package/dist/components/AR/ViroARImageMarker.js +5 -0
  47. package/dist/components/AR/ViroARObjectMarker.d.ts +1 -1
  48. package/dist/components/AR/ViroARObjectMarker.js +5 -0
  49. package/dist/components/AR/ViroARPlane.d.ts +1 -1
  50. package/dist/components/AR/ViroARPlane.js +5 -0
  51. package/dist/components/AR/ViroARPlaneSelector.d.ts +1 -1
  52. package/dist/components/AR/ViroARPlaneSelector.js +5 -0
  53. package/dist/components/AR/ViroARScene.d.ts +1 -1
  54. package/dist/components/AR/ViroARScene.js +5 -0
  55. package/dist/components/AR/ViroARSceneNavigator.d.ts +36 -0
  56. package/dist/components/AR/ViroARSceneNavigator.js +41 -0
  57. package/dist/components/AR/ViroCommonProps.d.ts +11 -0
  58. package/dist/components/Material/ViroMaterials.d.ts +12 -0
  59. package/dist/components/Material/ViroMaterials.js +25 -0
  60. package/dist/components/ReactVisionClient.d.ts +25 -0
  61. package/dist/components/ReactVisionClient.js +11 -0
  62. package/dist/components/Studio/StudioARScene.d.ts +15 -0
  63. package/dist/components/Studio/StudioARScene.js +299 -0
  64. package/dist/components/Studio/StudioSceneNavigator.d.ts +31 -0
  65. package/dist/components/Studio/StudioSceneNavigator.js +174 -0
  66. package/dist/components/Studio/VRTStudioModule.d.ts +15 -0
  67. package/dist/components/Studio/VRTStudioModule.js +31 -0
  68. package/dist/components/Studio/domain/animationRegistry.d.ts +11 -0
  69. package/dist/components/Studio/domain/animationRegistry.js +67 -0
  70. package/dist/components/Studio/domain/collisionBindingsRuntime.d.ts +21 -0
  71. package/dist/components/Studio/domain/collisionBindingsRuntime.js +54 -0
  72. package/dist/components/Studio/domain/collisionPairKey.d.ts +8 -0
  73. package/dist/components/Studio/domain/collisionPairKey.js +15 -0
  74. package/dist/components/Studio/domain/dragConfiguration.d.ts +20 -0
  75. package/dist/components/Studio/domain/dragConfiguration.js +37 -0
  76. package/dist/components/Studio/domain/materialConfig.d.ts +56 -0
  77. package/dist/components/Studio/domain/materialConfig.js +239 -0
  78. package/dist/components/Studio/domain/physicsConfig.d.ts +69 -0
  79. package/dist/components/Studio/domain/physicsConfig.js +165 -0
  80. package/dist/components/Studio/domain/sceneNavigationHandler.d.ts +12 -0
  81. package/dist/components/Studio/domain/sceneNavigationHandler.js +112 -0
  82. package/dist/components/Studio/domain/studioMaterials.d.ts +6 -0
  83. package/dist/components/Studio/domain/studioMaterials.js +30 -0
  84. package/dist/components/Studio/domain/triggerImageRegistry.d.ts +13 -0
  85. package/dist/components/Studio/domain/triggerImageRegistry.js +47 -0
  86. package/dist/components/Studio/domain/useStudioShaderTimeUniforms.d.ts +6 -0
  87. package/dist/components/Studio/domain/useStudioShaderTimeUniforms.js +48 -0
  88. package/dist/components/Studio/domain/useStudioShaderViewportUniforms.d.ts +6 -0
  89. package/dist/components/Studio/domain/useStudioShaderViewportUniforms.js +48 -0
  90. package/dist/components/Studio/domain/viroNodeFactory.d.ts +28 -0
  91. package/dist/components/Studio/domain/viroNodeFactory.js +193 -0
  92. package/dist/components/Studio/index.d.ts +3 -0
  93. package/dist/components/Studio/index.js +7 -0
  94. package/dist/components/Studio/types.d.ts +149 -0
  95. package/dist/components/Studio/types.js +4 -0
  96. package/dist/components/Types/ViroEvents.d.ts +49 -1
  97. package/dist/components/Types/ViroEvents.js +1 -0
  98. package/dist/components/Utilities/VRModuleOpenXR.d.ts +32 -0
  99. package/dist/components/Utilities/VRModuleOpenXR.js +44 -0
  100. package/dist/components/Utilities/VRQuestNavigatorBridge.d.ts +85 -0
  101. package/dist/components/Utilities/VRQuestNavigatorBridge.js +124 -0
  102. package/dist/components/Utilities/ViroPlatform.d.ts +10 -0
  103. package/dist/components/Utilities/ViroPlatform.js +43 -0
  104. package/dist/components/Utilities/ViroUtils.d.ts +19 -0
  105. package/dist/components/Utilities/ViroUtils.js +34 -0
  106. package/dist/components/Utilities/ViroVersion.d.ts +1 -1
  107. package/dist/components/Utilities/ViroVersion.js +1 -1
  108. package/dist/components/Utilities/useAnySourceHover.d.ts +36 -0
  109. package/dist/components/Utilities/useAnySourceHover.js +48 -0
  110. package/dist/components/Utilities/useAnySourcePressed.d.ts +37 -0
  111. package/dist/components/Utilities/useAnySourcePressed.js +61 -0
  112. package/dist/components/Viro360Image.d.ts +7 -0
  113. package/dist/components/ViroQuestEntryPoint.d.ts +13 -0
  114. package/dist/components/ViroQuestEntryPoint.js +104 -0
  115. package/dist/components/ViroVRSceneNavigator.d.ts +24 -10
  116. package/dist/components/ViroVRSceneNavigator.js +21 -18
  117. package/dist/components/ViroXRSceneNavigator.d.ts +54 -0
  118. package/dist/components/ViroXRSceneNavigator.js +173 -0
  119. package/dist/components/VisionOS/ViroVisionOSModule.d.ts +65 -0
  120. package/dist/components/VisionOS/ViroVisionOSModule.js +91 -0
  121. package/dist/index.d.ts +16 -3
  122. package/dist/index.js +34 -2
  123. package/dist/plugins/withViro.d.ts +28 -1
  124. package/dist/plugins/withViroAndroid.js +312 -7
  125. package/dist/plugins/withViroIos.js +17 -8
  126. package/dist/plugins/withViroVisionOS.d.ts +24 -0
  127. package/dist/plugins/withViroVisionOS.js +265 -0
  128. package/index.ts +66 -0
  129. package/ios/ViroReact.podspec +15 -5
  130. package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreCoreMLSemanticsResources.bundle/Info.plist +0 -0
  131. package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreResources.bundle/Info.plist +0 -0
  132. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSession.h +30 -1
  133. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSessioniOS.h +16 -0
  134. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROGLTFLoader.h +34 -0
  135. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputControllerBase.h +74 -0
  136. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputType.h +11 -3
  137. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMaterial.h +29 -0
  138. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMorpher.h +4 -0
  139. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPlatformUtil.h +13 -0
  140. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPortal.h +17 -0
  141. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderContext.h +41 -0
  142. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderer.h +23 -0
  143. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROSemantics.h +14 -0
  144. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROViewAR.h +11 -0
  145. package/ios/dist/ViroRenderer/ViroKit.framework/Info.plist +0 -0
  146. package/ios/dist/ViroRenderer/ViroKit.framework/Shaders.dat +1 -1
  147. package/ios/dist/ViroRenderer/ViroKit.framework/ViroKit +0 -0
  148. package/ios/dist/ViroRenderer/ViroKit.podspec +5 -0
  149. package/ios/dist/include/VRT360Image.h +1 -0
  150. package/ios/dist/include/VRTARSceneNavigator.h +7 -0
  151. package/ios/dist/include/VRTStudioModule.h +6 -0
  152. package/ios/dist/lib/libViroReact.a +0 -0
  153. package/package.json +8 -8
@@ -27,6 +27,7 @@
27
27
  #define VROInputControllerBase_h
28
28
 
29
29
  #include <stdio.h>
30
+ #include <map>
30
31
  #include <vector>
31
32
  #include <string>
32
33
  #include <memory>
@@ -180,6 +181,23 @@ protected:
180
181
  */
181
182
  void updateHitNode(const VROCamera &camera, VROVector3f origin, VROVector3f ray);
182
183
 
184
+ /*
185
+ Source-aware hit-node update. Stores the result both in the legacy
186
+ `_hitResult` (so single-pointer subsystems — drag, fuse, pinch, rotate —
187
+ keep working unchanged) and in `_hitResultsBySource[source]` so that
188
+ gaze/click events can resolve against the specific input source that
189
+ produced them. Used by backends with multiple simultaneous pointers
190
+ (e.g. OpenXR with two hands tracked at once).
191
+ */
192
+ void updateHitNode(int source, const VROCamera &camera,
193
+ VROVector3f origin, VROVector3f ray);
194
+
195
+ /*
196
+ Returns the per-source hit result if one was recorded for this source,
197
+ otherwise falls back to the legacy single-source `_hitResult`.
198
+ */
199
+ std::shared_ptr<VROHitTestResult> getHitResultForSource(int source) const;
200
+
183
201
  /*
184
202
  VRODraggedObject encapsulates all the information that needs to be tracked
185
203
  and processed for onDrag events for a given dragged node.
@@ -226,6 +244,12 @@ protected:
226
244
  Last result that was returned from the hit test.
227
245
  */
228
246
  std::shared_ptr<VROHitTestResult> _hitResult;
247
+
248
+ /*
249
+ Per-source hit results, populated by the source-aware updateHitNode
250
+ overload. Empty entry → no per-source override; falls back to `_hitResult`.
251
+ */
252
+ std::map<int, std::shared_ptr<VROHitTestResult>> _hitResultsBySource;
229
253
 
230
254
  /*
231
255
  Last known posiiton of the controller.
@@ -296,11 +320,61 @@ private:
296
320
  */
297
321
  std::shared_ptr<VRONode> _lastClickedNode;
298
322
 
323
+ /*
324
+ Per-source last clicked node — used to detect a "completed" click
325
+ (ClickDown + ClickUp on the same node from the same source) when
326
+ multiple pointers are active simultaneously.
327
+ */
328
+ std::map<int, std::shared_ptr<VRONode>> _lastClickedNodesBySource;
329
+
299
330
  /*
300
331
  Last known that was successfully hovered upon.
301
332
  */
302
333
  std::shared_ptr<VRONode> _lastHoveredNode;
303
334
 
335
+ /*
336
+ Per-source last hovered node, used by the source-aware hover dispatch in
337
+ `processGazeEvent`. An entry's presence is the signal that this source
338
+ has its own hover state; otherwise we fall back to `_lastHoveredNode`.
339
+ */
340
+ std::map<int, std::shared_ptr<VRONode>> _lastHoveredNodesBySource;
341
+
342
+ /*
343
+ Hover hysteresis state, per source.
344
+
345
+ OpenXR controller / hand aim ray-casts naturally jitter — pointing at a
346
+ small target with a controller held by an unsteady hand causes the
347
+ hit-test to alternate between the target node and the surrounding
348
+ background every 1–3 frames. Without hysteresis, every alternation
349
+ produced an `onHover(false)` / `onHover(true)` pair to JS, which
350
+ manifested as a flickering hover state and "the click takes dozens of
351
+ presses to register" — because if the user pulled the trigger on a
352
+ "miss" frame, `onButtonEvent` resolved the click against the background
353
+ instead of the target.
354
+
355
+ The hysteresis works as a grace period: when the hit changes from
356
+ `lastHovered` to a different node, we do NOT immediately fire the
357
+ exit — instead we record the candidate change and the timestamp.
358
+ If, within `kHoverHysteresisMillis`, the hit returns to `lastHovered`,
359
+ the exit is cancelled (no `onHover(false)` ever fires). If the new
360
+ candidate persists past the window, the exit is confirmed and the
361
+ normal enter/exit dispatch happens.
362
+
363
+ The same window is consulted by `onButtonEvent` so that clicks landing
364
+ on a transient miss-frame are still routed to `lastHovered` if the
365
+ pending-exit window is still open. That eliminates the "many presses
366
+ to click" symptom even though the underlying ray-cast still oscillates.
367
+ */
368
+ static constexpr double kHoverHysteresisMillis = 75.0;
369
+ struct HoverPending {
370
+ std::shared_ptr<VRONode> candidateNode; // node the hit currently resolves to
371
+ VROVector3f candidatePos; // hit location at the moment of pending start
372
+ bool candidateBgHit = false; // whether candidate is a background hit
373
+ double startedMillis = -1.0; // wall-clock time when the candidate first appeared
374
+ };
375
+ std::map<int, HoverPending> _hoverPendingBySource;
376
+ HoverPending _hoverPending; // legacy single-source fallback
377
+
304
378
  /*
305
379
  Returns the first node that is able to handle the event action by bubbling it up.
306
380
  If nothing is able to handle the event, nullptr is returned.
@@ -57,9 +57,17 @@ namespace ViroCardBoard{
57
57
 
58
58
  namespace ViroOculus{
59
59
  enum InputSource{
60
- Controller = 1,
61
- TouchPad = 2,
62
- BackButton = 3
60
+ Controller = 1, // right controller primary ray (legacy alias for RightController)
61
+ TouchPad = 2,
62
+ BackButton = 3, // menu (left) and B (right) buttons — navigation / back
63
+ LeftController = 4, // left controller primary ray
64
+ AButton = 5, // right-hand A button
65
+ XButton = 6, // left-hand X button
66
+ YButton = 7, // left-hand Y button
67
+ LeftGrip = 8, // left grip / squeeze
68
+ RightGrip = 9, // right grip / squeeze
69
+ LeftThumbstick = 10, // left thumbstick scroll axis
70
+ RightThumbstick = 11, // right thumbstick scroll axis
63
71
  };
64
72
  }
65
73
  #endif
@@ -37,6 +37,7 @@
37
37
  #include "VROStringUtil.h"
38
38
  #include "VROThreadRestricted.h"
39
39
  #include "VRODriver.h"
40
+ #include "VROSemantics.h"
40
41
 
41
42
  enum class VROFace {
42
43
  Front,
@@ -361,6 +362,21 @@ public:
361
362
  return _needsToneMapping;
362
363
  }
363
364
 
365
+ /*
366
+ Semantic masking. When enabled, fragments are shown or hidden based on
367
+ the semantic label of the underlying real-world pixel (requires ARCore
368
+ scene semantics to be enabled on the AR session).
369
+ */
370
+ void setSemanticMaskEnabled(bool enabled);
371
+ bool isSemanticMaskEnabled() const { return _semanticMaskEnabled; }
372
+
373
+ void setSemanticMaskMode(VROSemanticMaskMode mode);
374
+ VROSemanticMaskMode getSemanticMaskMode() const { return _semanticMaskMode; }
375
+
376
+ // Bitmask of VROSemanticLabel values (bit N = label N). Use (1 << label_int) to set bits.
377
+ void setSemanticLabelMask(uint16_t mask);
378
+ uint16_t getSemanticLabelMask() const { return _semanticLabelMask; }
379
+
364
380
  /*
365
381
  Material rendering order; this should only be used to fix a rendering order between materials
366
382
  that are part of the same geometry. For cross-geometry rendering order, use
@@ -647,6 +663,19 @@ private:
647
663
  */
648
664
  bool _needsToneMapping;
649
665
 
666
+ /*
667
+ Semantic masking.
668
+ */
669
+ bool _semanticMaskEnabled = false;
670
+ VROSemanticMaskMode _semanticMaskMode = VROSemanticMaskMode::ShowOnly;
671
+ uint16_t _semanticLabelMask = 0;
672
+
673
+ // Shader modifier injected when semantic masking is enabled (kept to allow removal).
674
+ std::shared_ptr<VROShaderModifier> _semanticMaskModifier;
675
+
676
+ // Internal: inject or remove the semantic mask shader modifier.
677
+ void applySemanticMaskModifier();
678
+
650
679
  /*
651
680
  The rendering order of this material, which determines when it is rendered in relation to
652
681
  other materials. See VROSortKey for where this falls within the hierarchy of renderinng sort
@@ -57,6 +57,10 @@ struct VROMorphTarget {
57
57
  // False if we wish to ignore this VROMorphTarget from all geometric calculations done in VROMorpher.
58
58
  bool isActive;
59
59
 
60
+ // True when the user has explicitly set a non-zero weight via setMorphTargets.
61
+ // Prevents the GLTF animation system from overriding user-controlled expressions.
62
+ bool userOverride = false;
63
+
60
64
  // Map of each VROGeometrySemantic (Norm/Pos/Tangent) to its corresponding
61
65
  // raw VROGeometrySource vertex data.
62
66
  std::map<VROGeometrySourceSemantic, std::shared_ptr<VROGeometrySource>> geometrySources;
@@ -53,6 +53,7 @@ enum class VROPlatformType {
53
53
  Unknown,
54
54
  AndroidGVR,
55
55
  AndroidOVR,
56
+ AndroidOpenXR,
56
57
  AndroidARCore,
57
58
  AndroidSceneView,
58
59
  iOSCardboard,
@@ -163,6 +164,18 @@ VROTextureFormat VROPlatformGetBitmapFormat(jobject jbitmap);
163
164
  */
164
165
  void VROPlatformDispatchAsyncRenderer(std::function<void()> fcn);
165
166
 
167
+ /*
168
+ OpenXR / headless-GL renderers that own their own render thread should call
169
+ VROPlatformSetUseDirectRendererQueue(true) during initialisation. All
170
+ subsequent VROPlatformDispatchAsyncRenderer calls will enqueue into a C++
171
+ queue instead of going through the GLSurfaceView Java path.
172
+
173
+ The render thread must call VROPlatformDrainRendererQueue() every frame to
174
+ execute queued work (e.g. setSceneController, texture uploads).
175
+ */
176
+ void VROPlatformSetUseDirectRendererQueue(bool use);
177
+ void VROPlatformDrainRendererQueue();
178
+
166
179
  /*
167
180
  Run the given function on a background thread. The thread can be pooled,
168
181
  or spun up fresh. The caller should make no assumptions.
@@ -219,6 +219,16 @@ public:
219
219
  return _background;
220
220
  }
221
221
  void removeBackground();
222
+
223
+ /*
224
+ Set a sky-effect background: a sphere textured with the given texture, masked so that
225
+ it only appears over pixels semantically labeled as Sky. Uses alpha blending via the
226
+ confidence texture for smooth edges. Unlike setBackgroundSphere(), this sphere is added
227
+ as a child node (not the portal background geometry) so that it participates in the
228
+ scene's transparent render pass and the semantic mask shader is properly applied.
229
+ */
230
+ void setSkyEffectBackground(std::shared_ptr<VROTexture> texture);
231
+ void removeSkyEffectBackground();
222
232
 
223
233
  private:
224
234
 
@@ -278,6 +288,12 @@ private:
278
288
  node content.
279
289
  */
280
290
  std::shared_ptr<VROGeometry> _background;
291
+
292
+ /*
293
+ Child node holding the sky-effect sphere geometry. Kept as a node so that semantic
294
+ mask shader modifiers are applied normally via the scene render pass.
295
+ */
296
+ std::shared_ptr<VRONode> _skyEffectNode;
281
297
 
282
298
  /*
283
299
  The lighting environment for this portal. Determines the effect of image-based
@@ -299,6 +315,7 @@ private:
299
315
  Installs required shader modifiers on the background.
300
316
  */
301
317
  void installBackgroundShaderModifier();
318
+ void installPortalBackgroundShaderModifier();
302
319
 
303
320
  /*
304
321
  Deactivates culling on every geometry in the given node, recursively down the
@@ -222,6 +222,20 @@ public:
222
222
  return _cameraBackgroundTexture;
223
223
  }
224
224
 
225
+ void setSemanticTexture(std::shared_ptr<VROTexture> texture) {
226
+ _semanticTexture = texture;
227
+ }
228
+ std::shared_ptr<VROTexture> getSemanticTexture() const {
229
+ return _semanticTexture;
230
+ }
231
+
232
+ void setSemanticConfidenceTexture(std::shared_ptr<VROTexture> texture) {
233
+ _semanticConfidenceTexture = texture;
234
+ }
235
+ std::shared_ptr<VROTexture> getSemanticConfidenceTexture() const {
236
+ return _semanticConfidenceTexture;
237
+ }
238
+
225
239
  void setCameraImageTransform(VROMatrix4f transform) {
226
240
  _cameraImageTransform = transform;
227
241
  }
@@ -236,6 +250,13 @@ public:
236
250
  return _depthTextureTransform;
237
251
  }
238
252
 
253
+ void setSemanticTextureTransform(VROMatrix4f transform) {
254
+ _semanticTextureTransform = transform;
255
+ }
256
+ VROMatrix4f getSemanticTextureTransform() const {
257
+ return _semanticTextureTransform;
258
+ }
259
+
239
260
  void setOcclusionMode(VROOcclusionMode mode) {
240
261
  _occlusionMode = mode;
241
262
  }
@@ -351,6 +372,19 @@ private:
351
372
  */
352
373
  std::shared_ptr<VROTexture> _cameraBackgroundTexture;
353
374
 
375
+ /*
376
+ Semantic segmentation texture (R8, per-pixel label 0-11 = VROSemanticLabel).
377
+ Updated each frame when semantic mode is enabled. Null when not available.
378
+ */
379
+ std::shared_ptr<VROTexture> _semanticTexture;
380
+
381
+ /*
382
+ Per-pixel confidence for the semantic label (R8, 0=uncertain, 255=certain).
383
+ Updated each frame alongside _semanticTexture. When not provided by the platform
384
+ (e.g. iOS), a 1×1 all-white texture is used so the shader always reads conf=1.0.
385
+ */
386
+ std::shared_ptr<VROTexture> _semanticConfidenceTexture;
387
+
354
388
  /*
355
389
  Transform mapping viewport UV coordinates to camera image UV coordinates.
356
390
  This accounts for device orientation and camera crop/zoom.
@@ -362,6 +396,13 @@ private:
362
396
  */
363
397
  VROMatrix4f _depthTextureTransform;
364
398
 
399
+ /*
400
+ Transform to convert from GL screen UV (y=0 bottom) to semantic texture UV.
401
+ Equals getViewportToCameraImageTransform() converted to GL convention.
402
+ Valid on both iOS (ARCore semantics) and Android (ARCore semantics).
403
+ */
404
+ VROMatrix4f _semanticTextureTransform;
405
+
365
406
  /*
366
407
  Current occlusion mode.
367
408
  */
@@ -256,6 +256,7 @@ public:
256
256
  void setOcclusionMode(VROOcclusionMode mode);
257
257
  void setDepthTexture(std::shared_ptr<VROTexture> depthTexture);
258
258
  void setDepthTextureTransform(VROMatrix4f transform);
259
+ void setSemanticTextureTransform(VROMatrix4f transform);
259
260
 
260
261
  /*
261
262
  Set the live AR camera background texture and its viewport-to-image UV transform.
@@ -264,9 +265,31 @@ public:
264
265
  */
265
266
  void setCameraBackgroundTexture(std::shared_ptr<VROTexture> texture);
266
267
  void setCameraImageTransform(VROMatrix4f transform);
268
+
269
+ /*
270
+ Set the semantic segmentation texture (R8, per-pixel label 0-11).
271
+ Auto-bound to shader modifier samplers named 'semantic_texture'.
272
+ Pass nullptr when semantic mode is disabled or data is unavailable.
273
+ */
274
+ void setSemanticTexture(std::shared_ptr<VROTexture> texture);
275
+
276
+ /*
277
+ Set the per-pixel semantic confidence texture (R8, 0=uncertain, 255=certain).
278
+ Auto-bound to shader modifier samplers named 'semantic_confidence_texture'.
279
+ Pass a 1×1 all-white texture (or nullptr) when confidence data is unavailable.
280
+ */
281
+ void setSemanticConfidenceTexture(std::shared_ptr<VROTexture> texture);
267
282
 
268
283
  #pragma mark - Camera
269
284
 
285
+ /*
286
+ Returns true if the render context has been initialized (initRenderer called).
287
+ Safe to call before any scene is set.
288
+ */
289
+ bool hasRenderContext() const {
290
+ return _context != nullptr;
291
+ }
292
+
270
293
  /*
271
294
  Get the camera used in the last frame.
272
295
  */
@@ -67,6 +67,20 @@ enum class VROSemanticMode {
67
67
  Enabled // Scene semantics is enabled (requires supported device)
68
68
  };
69
69
 
70
+ /*
71
+ * Mask mode for semantic material masking.
72
+ * Controls whether fragments are shown or hidden based on label match.
73
+ */
74
+ enum class VROSemanticMaskMode {
75
+ ShowOnly = 0, // Only render fragments where the label matches
76
+ Hide = 1, // Hide fragments where the label matches
77
+ Debug = 2, // Color fragments by semantic label for debugging
78
+ ShowOnlySky = 3 // ShowOnly + unlabeled pixels use viewport Y to decide:
79
+ // upper half → show sphere (sky context),
80
+ // lower half → hide sphere (ground/foreground context).
81
+ // Use this for Viro360Image skyEffect only.
82
+ };
83
+
70
84
  /*
71
85
  * Semantic image data containing label IDs for each pixel.
72
86
  * The image is a single-channel buffer where each byte represents
@@ -129,6 +129,17 @@ enum class VROCameraPosition;
129
129
  */
130
130
  - (void)setDepthDebugEnabled:(BOOL)enabled opacity:(float)opacity;
131
131
 
132
+ /*
133
+ Enable or disable semantic segmentation debug visualization. When enabled, the camera
134
+ background shows a color overlay where each real-world category is mapped to a distinct
135
+ color: sky=light-blue, building=gray, tree=green, road=dark-gray, sidewalk=tan,
136
+ terrain=brown, structure=orange, object=yellow, vehicle=red, person=magenta, water=blue.
137
+ Requires semantic mode to be enabled via setSemanticModeEnabled.
138
+
139
+ @param enabled Whether to enable the semantic debug overlay
140
+ */
141
+ - (void)setSemanticDebugEnabled:(BOOL)enabled;
142
+
132
143
  #pragma mark - Monocular Depth Estimation
133
144
 
134
145
  /*
@@ -1,5 +1,5 @@
1
1
  dependencies: \
2
2
  /Users/dorantes/Documents/ViroWorkspace/virocore/ViroRenderer/Shaders.metal \
3
- /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.7003.10.XhrnA4/Metal.xctoolchain/usr/metal/32023/lib/clang/32023.864/include/metal/module.modulemap \
3
+ /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.5.188.0.qU0cxL/Metal.xctoolchain/usr/metal/32023/lib/clang/32023.883/include/metal/module.modulemap \
4
4
  /Users/dorantes/Documents/ViroWorkspace/virocore/ViroRenderer/VROSharedStructures.h \
5
5
  /Users/dorantes/Documents/ViroWorkspace/virocore/ViroRenderer/VRODefines.h
@@ -27,8 +27,13 @@ Pod::Spec.new do |s|
27
27
  s.author = 'ReactVision'
28
28
  s.requires_arc = true
29
29
  s.platform = :ios, '13.0'
30
+ s.visionos.deployment_target = '1.0'
30
31
  s.dependency 'React'
31
32
 
33
+ # visionOS requires CompositorServices for the immersive render loop.
34
+ # Metal and MetalKit are available on both iOS and visionOS.
35
+ s.visionos.frameworks = ['Metal', 'MetalKit', 'CompositorServices', 'ARKit']
36
+
32
37
  # ARCore frameworks and Firebase dependencies are weak-linked via post_install hook
33
38
  # This prevents linker errors when ARCore pods are not installed
34
39
  # The following frameworks are weakly linked when ARCore is enabled:
@@ -40,6 +40,7 @@
40
40
  @property (nonatomic, assign) VROTextureInternalFormat format;
41
41
  @property (nonatomic, assign) BOOL isHdr;
42
42
  @property (nonatomic, copy, nullable) NSString *stereoMode;
43
+ @property (nonatomic, assign) BOOL skyEffect;
43
44
 
44
45
  - (instancetype)initWithBridge:(RCTBridge *)bridge;
45
46
 
@@ -50,6 +50,8 @@
50
50
  @property (nonatomic, copy) NSString *occlusionMode;
51
51
  @property (nonatomic, assign) BOOL depthEnabled;
52
52
  @property (nonatomic, assign) BOOL depthDebugEnabled;
53
+ @property (nonatomic, assign) BOOL semanticDebugEnabled;
54
+ @property (nonatomic, assign) float semanticConfidenceThreshold;
53
55
  @property (nonatomic, copy) NSString *cloudAnchorProvider;
54
56
  @property (nonatomic, copy) NSString *geospatialAnchorProvider;
55
57
 
@@ -206,6 +208,11 @@ typedef void (^GeospatialAnchorCompletionHandler)(BOOL success,
206
208
  radius:(double)radius
207
209
  limit:(int)limit
208
210
  completionHandler:(void (^)(BOOL success, NSArray *anchors, NSString *error))completionHandler;
211
+ - (void)rvGetProject:(void (^)(BOOL success, NSString *data, NSString *error))completionHandler;
212
+ - (void)rvGetScene:(NSString *)sceneId
213
+ completionHandler:(void (^)(BOOL success, NSString *data, NSString *error))completionHandler;
214
+ - (void)rvGetSceneAssets:(NSString *)sceneId
215
+ completionHandler:(void (^)(BOOL success, NSArray *assets, NSString *error))completionHandler;
209
216
  - (void)rvAttachAssetToCloudAnchor:(NSString *)anchorId
210
217
  fileUrl:(NSString *)fileUrl
211
218
  fileSize:(int64_t)fileSize
@@ -0,0 +1,6 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTBridge.h>
3
+
4
+ @interface VRTStudioModule : NSObject <RCTBridgeModule>
5
+
6
+ @end
Binary file
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "dist/index.js",
4
4
  "module": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
- "version": "2.53.1",
6
+ "version": "2.55.0",
7
7
  "license": "MIT",
8
8
  "publishConfig": {
9
9
  "registry": "https://registry.npmjs.org/"
@@ -27,11 +27,11 @@
27
27
  "prepare": "npm run build"
28
28
  },
29
29
  "peerDependencies": {
30
- "expo": "~54.0.10",
31
- "react-native": "~0.81.4"
30
+ "expo": ">=54.0.0 <56.0.0",
31
+ "react-native": ">=0.81.0 <0.84.0"
32
32
  },
33
33
  "engines": {
34
- "react-native": "~0.81.4"
34
+ "react-native": ">=0.81.0 <0.84.0"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "expo": {
@@ -58,7 +58,7 @@
58
58
  ],
59
59
  "dependencies": {
60
60
  "@expo/config-plugins": "^9.0.14",
61
- "react": "~19.1.0",
61
+ "react": "~19.2.0",
62
62
  "react-native-gradle-plugin": "^0.71.19"
63
63
  },
64
64
  "devDependencies": {
@@ -75,12 +75,12 @@
75
75
  "@react-native/typescript-config": "^0.77.0",
76
76
  "@types/babel__core": "^7.20.5",
77
77
  "@types/node": "^22.13.1",
78
- "@types/react": "~19.1.0",
78
+ "@types/react": "~19.2.10",
79
79
  "@types/react-native": "^0.73.0",
80
80
  "babel-jest": "^29.7.0",
81
- "expo": "~54.0.10",
81
+ "expo": "~55.0.8",
82
82
  "jest": "^29.7.0",
83
- "react-native": "~0.81.4",
83
+ "react-native": "~0.83.2",
84
84
  "release-it": "^17.1.1",
85
85
  "ts-node": "^10.9.2",
86
86
  "typescript": "^5.3.0"