@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.
- package/README.md +85 -46
- package/android/react_viro/react_viro-release.aar +0 -0
- package/android/viro_renderer/viro_renderer-release.aar +0 -0
- package/components/AR/ViroARCamera.tsx +5 -0
- package/components/AR/ViroARImageMarker.tsx +5 -0
- package/components/AR/ViroARObjectMarker.tsx +5 -0
- package/components/AR/ViroARPlane.tsx +5 -0
- package/components/AR/ViroARPlaneSelector.tsx +5 -0
- package/components/AR/ViroARScene.tsx +5 -0
- package/components/AR/ViroARSceneNavigator.tsx +84 -0
- package/components/AR/ViroCommonProps.ts +11 -0
- package/components/Material/ViroMaterials.ts +51 -0
- package/components/Studio/StudioARScene.tsx +368 -0
- package/components/Studio/StudioSceneNavigator.tsx +191 -0
- package/components/Studio/VRTStudioModule.ts +40 -0
- package/components/Studio/domain/animationRegistry.ts +86 -0
- package/components/Studio/domain/collisionBindingsRuntime.ts +93 -0
- package/components/Studio/domain/collisionPairKey.ts +15 -0
- package/components/Studio/domain/dragConfiguration.ts +48 -0
- package/components/Studio/domain/materialConfig.ts +276 -0
- package/components/Studio/domain/physicsConfig.ts +204 -0
- package/components/Studio/domain/sceneNavigationHandler.ts +150 -0
- package/components/Studio/domain/studioMaterials.ts +33 -0
- package/components/Studio/domain/triggerImageRegistry.ts +64 -0
- package/components/Studio/domain/useStudioShaderTimeUniforms.ts +51 -0
- package/components/Studio/domain/useStudioShaderViewportUniforms.ts +52 -0
- package/components/Studio/domain/viroNodeFactory.tsx +323 -0
- package/components/Studio/index.ts +18 -0
- package/components/Studio/types.ts +164 -0
- package/components/Types/ViroEvents.ts +53 -0
- package/components/Utilities/VRModuleOpenXR.ts +50 -0
- package/components/Utilities/VRQuestNavigatorBridge.ts +168 -0
- package/components/Utilities/ViroPlatform.ts +52 -0
- package/components/Utilities/ViroUtils.tsx +48 -0
- package/components/Utilities/ViroVersion.ts +1 -1
- package/components/Utilities/useAnySourceHover.ts +55 -0
- package/components/Utilities/useAnySourcePressed.ts +70 -0
- package/components/Viro360Image.tsx +7 -0
- package/components/ViroQuestEntryPoint.tsx +79 -0
- package/components/ViroVRSceneNavigator.tsx +44 -19
- package/components/ViroXRSceneNavigator.tsx +217 -0
- package/components/VisionOS/ViroVisionOSModule.ts +93 -0
- package/dist/components/AR/ViroARCamera.d.ts +1 -1
- package/dist/components/AR/ViroARCamera.js +5 -0
- package/dist/components/AR/ViroARImageMarker.d.ts +1 -1
- package/dist/components/AR/ViroARImageMarker.js +5 -0
- package/dist/components/AR/ViroARObjectMarker.d.ts +1 -1
- package/dist/components/AR/ViroARObjectMarker.js +5 -0
- package/dist/components/AR/ViroARPlane.d.ts +1 -1
- package/dist/components/AR/ViroARPlane.js +5 -0
- package/dist/components/AR/ViroARPlaneSelector.d.ts +1 -1
- package/dist/components/AR/ViroARPlaneSelector.js +5 -0
- package/dist/components/AR/ViroARScene.d.ts +1 -1
- package/dist/components/AR/ViroARScene.js +5 -0
- package/dist/components/AR/ViroARSceneNavigator.d.ts +36 -0
- package/dist/components/AR/ViroARSceneNavigator.js +41 -0
- package/dist/components/AR/ViroCommonProps.d.ts +11 -0
- package/dist/components/Material/ViroMaterials.d.ts +12 -0
- package/dist/components/Material/ViroMaterials.js +25 -0
- package/dist/components/ReactVisionClient.d.ts +25 -0
- package/dist/components/ReactVisionClient.js +11 -0
- package/dist/components/Studio/StudioARScene.d.ts +15 -0
- package/dist/components/Studio/StudioARScene.js +299 -0
- package/dist/components/Studio/StudioSceneNavigator.d.ts +31 -0
- package/dist/components/Studio/StudioSceneNavigator.js +174 -0
- package/dist/components/Studio/VRTStudioModule.d.ts +15 -0
- package/dist/components/Studio/VRTStudioModule.js +31 -0
- package/dist/components/Studio/domain/animationRegistry.d.ts +11 -0
- package/dist/components/Studio/domain/animationRegistry.js +67 -0
- package/dist/components/Studio/domain/collisionBindingsRuntime.d.ts +21 -0
- package/dist/components/Studio/domain/collisionBindingsRuntime.js +54 -0
- package/dist/components/Studio/domain/collisionPairKey.d.ts +8 -0
- package/dist/components/Studio/domain/collisionPairKey.js +15 -0
- package/dist/components/Studio/domain/dragConfiguration.d.ts +20 -0
- package/dist/components/Studio/domain/dragConfiguration.js +37 -0
- package/dist/components/Studio/domain/materialConfig.d.ts +56 -0
- package/dist/components/Studio/domain/materialConfig.js +239 -0
- package/dist/components/Studio/domain/physicsConfig.d.ts +69 -0
- package/dist/components/Studio/domain/physicsConfig.js +165 -0
- package/dist/components/Studio/domain/sceneNavigationHandler.d.ts +12 -0
- package/dist/components/Studio/domain/sceneNavigationHandler.js +112 -0
- package/dist/components/Studio/domain/studioMaterials.d.ts +6 -0
- package/dist/components/Studio/domain/studioMaterials.js +30 -0
- package/dist/components/Studio/domain/triggerImageRegistry.d.ts +13 -0
- package/dist/components/Studio/domain/triggerImageRegistry.js +47 -0
- package/dist/components/Studio/domain/useStudioShaderTimeUniforms.d.ts +6 -0
- package/dist/components/Studio/domain/useStudioShaderTimeUniforms.js +48 -0
- package/dist/components/Studio/domain/useStudioShaderViewportUniforms.d.ts +6 -0
- package/dist/components/Studio/domain/useStudioShaderViewportUniforms.js +48 -0
- package/dist/components/Studio/domain/viroNodeFactory.d.ts +28 -0
- package/dist/components/Studio/domain/viroNodeFactory.js +193 -0
- package/dist/components/Studio/index.d.ts +3 -0
- package/dist/components/Studio/index.js +7 -0
- package/dist/components/Studio/types.d.ts +149 -0
- package/dist/components/Studio/types.js +4 -0
- package/dist/components/Types/ViroEvents.d.ts +49 -1
- package/dist/components/Types/ViroEvents.js +1 -0
- package/dist/components/Utilities/VRModuleOpenXR.d.ts +32 -0
- package/dist/components/Utilities/VRModuleOpenXR.js +44 -0
- package/dist/components/Utilities/VRQuestNavigatorBridge.d.ts +85 -0
- package/dist/components/Utilities/VRQuestNavigatorBridge.js +124 -0
- package/dist/components/Utilities/ViroPlatform.d.ts +10 -0
- package/dist/components/Utilities/ViroPlatform.js +43 -0
- package/dist/components/Utilities/ViroUtils.d.ts +19 -0
- package/dist/components/Utilities/ViroUtils.js +34 -0
- package/dist/components/Utilities/ViroVersion.d.ts +1 -1
- package/dist/components/Utilities/ViroVersion.js +1 -1
- package/dist/components/Utilities/useAnySourceHover.d.ts +36 -0
- package/dist/components/Utilities/useAnySourceHover.js +48 -0
- package/dist/components/Utilities/useAnySourcePressed.d.ts +37 -0
- package/dist/components/Utilities/useAnySourcePressed.js +61 -0
- package/dist/components/Viro360Image.d.ts +7 -0
- package/dist/components/ViroQuestEntryPoint.d.ts +13 -0
- package/dist/components/ViroQuestEntryPoint.js +104 -0
- package/dist/components/ViroVRSceneNavigator.d.ts +24 -10
- package/dist/components/ViroVRSceneNavigator.js +21 -18
- package/dist/components/ViroXRSceneNavigator.d.ts +54 -0
- package/dist/components/ViroXRSceneNavigator.js +173 -0
- package/dist/components/VisionOS/ViroVisionOSModule.d.ts +65 -0
- package/dist/components/VisionOS/ViroVisionOSModule.js +91 -0
- package/dist/index.d.ts +16 -3
- package/dist/index.js +34 -2
- package/dist/plugins/withViro.d.ts +28 -1
- package/dist/plugins/withViroAndroid.js +312 -7
- package/dist/plugins/withViroIos.js +17 -8
- package/dist/plugins/withViroVisionOS.d.ts +24 -0
- package/dist/plugins/withViroVisionOS.js +265 -0
- package/index.ts +66 -0
- package/ios/ViroReact.podspec +15 -5
- package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreCoreMLSemanticsResources.bundle/Info.plist +0 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreResources.bundle/Info.plist +0 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSession.h +30 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSessioniOS.h +16 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROGLTFLoader.h +34 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputControllerBase.h +74 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputType.h +11 -3
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMaterial.h +29 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMorpher.h +4 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPlatformUtil.h +13 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPortal.h +17 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderContext.h +41 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderer.h +23 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROSemantics.h +14 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROViewAR.h +11 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Info.plist +0 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Shaders.dat +1 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/ViroKit +0 -0
- package/ios/dist/ViroRenderer/ViroKit.podspec +5 -0
- package/ios/dist/include/VRT360Image.h +1 -0
- package/ios/dist/include/VRTARSceneNavigator.h +7 -0
- package/ios/dist/include/VRTStudioModule.h +6 -0
- package/ios/dist/lib/libViroReact.a +0 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
<p align="center" style="background-colour: #CCCCCC;">
|
|
3
2
|
<a href="https://www.reactvision.xyz/">
|
|
4
3
|
<img src="https://avatars.githubusercontent.com/u/74572641?s=200&v=4" alt="ReactVision logo" width="120px" height="120px">
|
|
@@ -17,78 +16,118 @@
|
|
|
17
16
|
</a>
|
|
18
17
|
</p>
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
# ViroReact, By ReactVision
|
|
21
20
|
|
|
22
|
-
ViroReact is
|
|
21
|
+
ViroReact is the most widely used open-source library for building Augmented Reality (AR) and Virtual Reality (VR) experiences with React Native. Write your app once in TypeScript and ship it natively across mobile AR and VR headsets — no new engine, no new language, no months of ramp-up.
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
<tr>
|
|
26
|
-
<td align="centre">
|
|
27
|
-
<img height="200" src="https://raw.githubusercontent.com/viromedia/viro/master/code-samples/js/ARCarDemo/viro_car_marker_demo.gif" alt="AR car demo">
|
|
28
|
-
</td>
|
|
29
|
-
<td align="centre">
|
|
30
|
-
<img height="200" src="https://github.com/ViroCommunity/viro/assets/430272/b153b8e4-7b40-4197-b05b-dd1eb1566102" alt="Viro example">
|
|
31
|
-
</td>
|
|
32
|
-
</tr>
|
|
33
|
-
</table>
|
|
23
|
+
ViroReact is MIT licensed and free forever.
|
|
34
24
|
|
|
35
|
-
##
|
|
25
|
+
## Supported Platforms
|
|
26
|
+
|
|
27
|
+
| Platform | Support |
|
|
28
|
+
| ---------------- | ------------ |
|
|
29
|
+
| iOS (ARKit) | ✅ Supported |
|
|
30
|
+
| Android (ARCore) | ✅ Supported |
|
|
31
|
+
| Meta Horizon OS | ✅ Supported |
|
|
32
|
+
|
|
33
|
+
ViroReact works with both **React Native CLI** and **Expo** projects.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @reactvision/react-viro
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For Expo projects, the easiest way to start is to clone the official starter kit:
|
|
42
|
+
|
|
43
|
+
- **Expo + TypeScript starter kit:** <https://github.com/ReactVision/expo-starter-kit-typescript>
|
|
44
|
+
- **React Native CLI starter kit:** <https://github.com/ReactVision/starter-kit>
|
|
45
|
+
|
|
46
|
+
For step-by-step setup instructions, including platform-specific permissions and build configuration, see the full installation guide in the docs: <https://viro-community.readme.io/docs/installation-instructions>
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
ViroReact ships with a complete spatial computing toolkit out of the box — no third-party plugins, no paid add-ons.
|
|
51
|
+
|
|
52
|
+
**Tracking and anchoring**
|
|
53
|
+
|
|
54
|
+
- AR plane detection with horizontal and vertical surface anchors
|
|
55
|
+
- Image and object recognition triggers
|
|
56
|
+
- Cloud Anchors for persistent, multi-user shared AR content _(Platform feature)_
|
|
57
|
+
- Geospatial Anchors that pin content to real-world latitude, longitude, and altitude _(Platform feature)_
|
|
36
58
|
|
|
37
|
-
|
|
59
|
+
**Rendering**
|
|
38
60
|
|
|
39
|
-
|
|
61
|
+
- PBR lighting, HDR environment maps, and real-time shadow casting
|
|
62
|
+
- 360° photo and video environments
|
|
63
|
+
- Portal rendering for immersive pass-through experiences
|
|
64
|
+
- OBJ, FBX, and GLTF/GLB model loading with embedded animations
|
|
65
|
+
- Custom procedural geometry and custom GPU shaders
|
|
40
66
|
|
|
41
|
-
|
|
67
|
+
**Interaction and motion**
|
|
42
68
|
|
|
43
|
-
|
|
69
|
+
- Built-in physics engine with dynamic and static bodies, collision callbacks
|
|
70
|
+
- Particle system for fire, smoke, rain, snow, confetti, and other effects
|
|
71
|
+
- Declarative animation system with sequencing and chaining
|
|
72
|
+
- Full input event system: tap, drag, pinch, rotate, fuse, hover
|
|
44
73
|
|
|
45
|
-
|
|
46
|
-
- React Native: https://github.com/ReactVision/starter-kit
|
|
47
|
-
- Expo + JavaScript: https://github.com/ReactVision/expo-starter-kit
|
|
74
|
+
**Audio**
|
|
48
75
|
|
|
49
|
-
|
|
76
|
+
- Spatial audio, 360° sound fields, and positioned 3D audio
|
|
50
77
|
|
|
51
|
-
|
|
78
|
+
## Platform Features
|
|
52
79
|
|
|
53
|
-
|
|
54
|
-
These are a little old (~2019), but they’re still a useful reference for many parts of the library.
|
|
80
|
+
Cloud Anchors, Geospatial Anchors, and AI-powered 3D asset creation are powered by **ReactVision Platform** — managed cloud infrastructure built directly into ViroReact. Add your `rvApiKey` and `rvProjectId` and the platform handles hosting, resolution, and geospatial infrastructure for you.
|
|
55
81
|
|
|
56
|
-
|
|
82
|
+
You can get a Studio account, which includes Platform access, for free at <https://studio.reactvision.xyz>.
|
|
57
83
|
|
|
58
|
-
|
|
84
|
+
- Cloud Anchors guide: <https://viro-community.readme.io/docs/cloud-anchors>
|
|
85
|
+
- Geospatial Anchors guide: <https://viro-community.readme.io/docs/geospatial-anchors>
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
- Full API reference and guides: <https://viro-community.readme.io/docs/overview>
|
|
90
|
+
- Getting started tutorial: <https://updates.reactvision.xyz/get-started-with-the-viroreact-and-expo-starter-kit-a9ca88803e5a>
|
|
91
|
+
|
|
92
|
+
## Community
|
|
93
|
+
|
|
94
|
+
Discord is the best place to find the team and other developers building with ViroReact:
|
|
59
95
|
|
|
60
96
|
<a href="https://discord.gg/A6TaFNqwVc">
|
|
61
|
-
<img src="https://discordapp.com/api/guilds/774471080713781259/widget.png?style=banner2"
|
|
97
|
+
<img src="https://discordapp.com/api/guilds/774471080713781259/widget.png?style=banner2" />
|
|
62
98
|
</a>
|
|
63
99
|
|
|
64
|
-
##
|
|
100
|
+
## Enterprise Support and Partners
|
|
65
101
|
|
|
66
|
-
|
|
67
|
-
https://viro-community.readme.io/docs/hire-a-viro-react-expert
|
|
102
|
+
For teams adopting XR at scale, the ReactVision team works directly with you on architecture, migrations from 8th Wall or Unity, performance audits, and shipping production experiences. <https://reactvision.xyz/contact>
|
|
68
103
|
|
|
69
|
-
|
|
104
|
+
For independent agencies and consultants vetted by the ReactVision team: <https://reactvision.xyz/partners>
|
|
70
105
|
|
|
71
|
-
##
|
|
106
|
+
## Supporters
|
|
72
107
|
|
|
73
|
-
|
|
108
|
+
A huge thank you to everyone who supports ongoing development by sponsoring us on GitHub: <https://github.com/sponsors/ReactVision>
|
|
74
109
|
|
|
75
|
-
|
|
110
|
+
- [Device Cloud](https://devicecloud.dev/)
|
|
111
|
+
- [Looking Glass](http://looking-glass.space)
|
|
112
|
+
- [@lentesta](https://github.com/lentesta)
|
|
113
|
+
|
|
114
|
+
## Powered by
|
|
76
115
|
|
|
77
|
-
|
|
78
|
-
https://github.com/sponsors/ReactVision
|
|
116
|
+
[](https://jb.gg/OpenSource)
|
|
79
117
|
|
|
80
|
-
|
|
81
|
-
- https://github.com/lentesta
|
|
82
|
-
- Looking Glass: http://looking-glass.space
|
|
118
|
+
JetBrains supports ViroReact development through their [Open Source program](https://jb.gg/OpenSource).
|
|
83
119
|
|
|
84
|
-
##
|
|
120
|
+
## Find Out More
|
|
85
121
|
|
|
86
|
-
|
|
122
|
+
- Website: <https://reactvision.xyz>
|
|
123
|
+
- ViroReact: <https://reactvision.xyz/viro-react>
|
|
124
|
+
- ReactVision Studio: <https://studio.reactvision.xyz>
|
|
125
|
+
- Blog: <https://updates.reactvision.xyz>
|
|
87
126
|
|
|
88
|
-
|
|
127
|
+
## A little history…
|
|
89
128
|
|
|
90
|
-
|
|
129
|
+
ViroReact was originally developed by Viro Media and open-sourced in 2019. In late 2020, the Viro Community formed to maintain and modernise the project, keeping it compatible with current React Native versions. In January 2025, Morrow Digital acquired the project to invest in its future, and in late 2025 ReactVision was spun out as an independent company with a full-time team building the next generation of XR tooling.
|
|
91
130
|
|
|
92
|
-
|
|
131
|
+
---
|
|
93
132
|
|
|
94
|
-
|
|
133
|
+
MIT licensed. © ReactVision, Inc.
|
|
Binary file
|
|
Binary file
|
|
@@ -14,11 +14,16 @@
|
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import { ViewProps } from "react-native";
|
|
16
16
|
import { ViroCamera } from "../ViroCamera";
|
|
17
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
17
18
|
|
|
18
19
|
export class ViroARCamera extends React.Component<ViewProps> {
|
|
19
20
|
_component: ViroCamera | null = null;
|
|
20
21
|
|
|
21
22
|
render() {
|
|
23
|
+
if (isQuest) {
|
|
24
|
+
console.warn("[Viro] ViroARCamera is not supported on Quest and will not render.");
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
22
27
|
// Uncomment this to check props
|
|
23
28
|
return (
|
|
24
29
|
<ViroCamera
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
ViroARAnchorUpdatedEvent,
|
|
20
20
|
} from "../Types/ViroEvents";
|
|
21
21
|
import { ViroBase } from "../ViroBase";
|
|
22
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Container for Viro Components anchored to a detected image.
|
|
@@ -47,6 +48,10 @@ export class ViroARImageMarker extends ViroBase<{}> {
|
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
render() {
|
|
51
|
+
if (isQuest) {
|
|
52
|
+
console.warn("[Viro] ViroARImageMarker is not supported on Quest and will not render.");
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
50
55
|
// Uncomment this line to check for misnamed props
|
|
51
56
|
//checkMisnamedProps("ViroARImageMarker", this.props);
|
|
52
57
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { ViroBase } from "../ViroBase";
|
|
15
15
|
import * as React from "react";
|
|
16
16
|
import { NativeSyntheticEvent, requireNativeComponent } from "react-native";
|
|
17
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
17
18
|
import {
|
|
18
19
|
ViroARAnchorFoundEvent,
|
|
19
20
|
ViroARAnchorRemovedEvent,
|
|
@@ -45,6 +46,10 @@ export class ViroARObjectMarker extends ViroBase<Props> {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
render() {
|
|
49
|
+
if (isQuest) {
|
|
50
|
+
console.warn("[Viro] ViroARObjectMarker is not supported on Quest and will not render.");
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
48
53
|
// Uncomment this line to check for misnamed props
|
|
49
54
|
//checkMisnamedProps("ViroARObjectMarker", this.props);
|
|
50
55
|
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { ViroBase } from "../ViroBase";
|
|
20
20
|
import * as React from "react";
|
|
21
21
|
import { NativeSyntheticEvent, requireNativeComponent } from "react-native";
|
|
22
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
22
23
|
|
|
23
24
|
type Props = {
|
|
24
25
|
anchorId?: string;
|
|
@@ -58,6 +59,10 @@ export class ViroARPlane extends ViroBase<Props> {
|
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
render() {
|
|
62
|
+
if (isQuest) {
|
|
63
|
+
console.warn("[Viro] ViroARPlane is not supported on Quest and will not render.");
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
61
66
|
// Uncomment this line to check for misnamed props
|
|
62
67
|
//checkMisnamedProps("ViroARPlane", this.props);
|
|
63
68
|
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import { ViroAnchor, ViroPlaneUpdatedMap } from "../Types/ViroEvents";
|
|
15
15
|
import * as React from "react";
|
|
16
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
16
17
|
import { ViroMaterials } from "../Material/ViroMaterials";
|
|
17
18
|
import { ViroNode } from "../ViroNode";
|
|
18
19
|
import { ViroQuad } from "../ViroQuad";
|
|
@@ -416,6 +417,10 @@ export class ViroARPlaneSelector extends React.Component<Props, State> {
|
|
|
416
417
|
// ---------------------------------------------------------------------------
|
|
417
418
|
|
|
418
419
|
render() {
|
|
420
|
+
if (isQuest) {
|
|
421
|
+
console.warn("[Viro] ViroARPlaneSelector is not supported on Quest and will not render.");
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
419
424
|
return <ViroNode>{this._renderPlanes()}</ViroNode>;
|
|
420
425
|
}
|
|
421
426
|
|
|
@@ -50,6 +50,7 @@ import { ViroCamera } from "../ViroCamera";
|
|
|
50
50
|
import { ViroTrackingStateConstants } from "../ViroConstants";
|
|
51
51
|
import { ViroCommonProps } from "./ViroCommonProps";
|
|
52
52
|
import { ViroOrbitCamera } from "components/ViroOrbitCamera";
|
|
53
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
53
54
|
|
|
54
55
|
const ViroCameraModule = NativeModules.ViroCameraModule;
|
|
55
56
|
|
|
@@ -413,6 +414,10 @@ export class ViroARScene extends ViroBase<Props> {
|
|
|
413
414
|
};
|
|
414
415
|
|
|
415
416
|
render() {
|
|
417
|
+
if (isQuest) {
|
|
418
|
+
console.warn("[Viro] ViroARScene is not supported on Quest and will not render. Use ViroScene instead.");
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
416
421
|
// Uncomment this line to check for misnamed props
|
|
417
422
|
//checkMisnamedProps("ViroARScene", this.props);
|
|
418
423
|
|
|
@@ -18,8 +18,11 @@ import {
|
|
|
18
18
|
NativeModules,
|
|
19
19
|
requireNativeComponent,
|
|
20
20
|
StyleSheet,
|
|
21
|
+
Text,
|
|
22
|
+
View,
|
|
21
23
|
ViewProps,
|
|
22
24
|
} from "react-native";
|
|
25
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
23
26
|
import {
|
|
24
27
|
ViroWorldOrigin,
|
|
25
28
|
ViroProvider,
|
|
@@ -75,6 +78,13 @@ type Props = ViewProps & {
|
|
|
75
78
|
};
|
|
76
79
|
initialSceneKey?: string;
|
|
77
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Optional fallback rendered when this navigator is mounted on a Meta Quest
|
|
83
|
+
* device (where AR is not supported). When omitted, a default message view
|
|
84
|
+
* is rendered. Pass `null` to render nothing.
|
|
85
|
+
*/
|
|
86
|
+
questFallback?: React.ReactNode;
|
|
87
|
+
|
|
78
88
|
autofocus?: boolean;
|
|
79
89
|
/**
|
|
80
90
|
* iOS only props! Note: these props may change as the underlying platforms coalesce in features.
|
|
@@ -130,6 +140,28 @@ type Props = ViewProps & {
|
|
|
130
140
|
*/
|
|
131
141
|
depthDebugEnabled?: boolean;
|
|
132
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Enable semantic segmentation debug visualization. When enabled, the camera
|
|
145
|
+
* background shows a color overlay for each real-world category (sky, building, tree,
|
|
146
|
+
* road, sidewalk, terrain, structure, object, vehicle, person, water).
|
|
147
|
+
* Requires `setSemanticModeEnabled(true)` to be called on the scene navigator first.
|
|
148
|
+
*
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
semanticDebugEnabled?: boolean;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Confidence threshold (0.0–1.0) below which semantic labels are discarded (treated
|
|
155
|
+
* as unlabeled = 0) before the texture is uploaded to the GPU. Higher values reduce
|
|
156
|
+
* noise and boundary blinking at the cost of smaller labeled regions.
|
|
157
|
+
*
|
|
158
|
+
* Only used on Android (ARCore provides per-pixel confidence). On iOS, ARKit's
|
|
159
|
+
* segmentation is already temporally smoothed by the OS.
|
|
160
|
+
*
|
|
161
|
+
* @default 0.0
|
|
162
|
+
*/
|
|
163
|
+
semanticConfidenceThreshold?: number;
|
|
164
|
+
|
|
133
165
|
/**
|
|
134
166
|
* [iOS Only] Prefer monocular depth estimation over LiDAR.
|
|
135
167
|
* When true, monocular depth will be used even on devices with LiDAR.
|
|
@@ -210,6 +242,7 @@ type State = {
|
|
|
210
242
|
* ViroARSceneNavigator is used to transition between multiple AR Scenes.
|
|
211
243
|
*/
|
|
212
244
|
export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
245
|
+
static _questWarningLogged = false;
|
|
213
246
|
_component: ViroNativeRef = null;
|
|
214
247
|
|
|
215
248
|
constructor(props: Props) {
|
|
@@ -1105,6 +1138,22 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1105
1138
|
);
|
|
1106
1139
|
};
|
|
1107
1140
|
|
|
1141
|
+
_rvGetProject = async (): Promise<any> => {
|
|
1142
|
+
return await ViroARSceneNavigatorModule.rvGetProject(findNodeHandle(this));
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
_rvGetScene = async (sceneId: string): Promise<any> => {
|
|
1146
|
+
return await ViroARSceneNavigatorModule.rvGetScene(
|
|
1147
|
+
findNodeHandle(this), sceneId
|
|
1148
|
+
);
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
_rvGetSceneAssets = async (sceneId: string): Promise<any> => {
|
|
1152
|
+
return await ViroARSceneNavigatorModule.rvGetSceneAssets(
|
|
1153
|
+
findNodeHandle(this), sceneId
|
|
1154
|
+
);
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1108
1157
|
_rvAttachAssetToCloudAnchor = async (
|
|
1109
1158
|
anchorId: string,
|
|
1110
1159
|
fileUrl: string,
|
|
@@ -1394,6 +1443,9 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1394
1443
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
1395
1444
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
1396
1445
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
1446
|
+
rvGetProject: this._rvGetProject,
|
|
1447
|
+
rvGetScene: this._rvGetScene,
|
|
1448
|
+
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
1397
1449
|
// Assets API
|
|
1398
1450
|
rvUploadAsset: this._rvUploadAsset,
|
|
1399
1451
|
// Scene Semantics API
|
|
@@ -1452,6 +1504,9 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1452
1504
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
1453
1505
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
1454
1506
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
1507
|
+
rvGetProject: this._rvGetProject,
|
|
1508
|
+
rvGetScene: this._rvGetScene,
|
|
1509
|
+
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
1455
1510
|
// Assets API
|
|
1456
1511
|
rvUploadAsset: this._rvUploadAsset,
|
|
1457
1512
|
// Scene Semantics API
|
|
@@ -1472,6 +1527,26 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1472
1527
|
// Uncomment this line to check for misnamed props
|
|
1473
1528
|
//checkMisnamedProps("ViroARSceneNavigator", this.props);
|
|
1474
1529
|
|
|
1530
|
+
if (isQuest) {
|
|
1531
|
+
if (!ViroARSceneNavigator._questWarningLogged) {
|
|
1532
|
+
console.warn(
|
|
1533
|
+
"[Viro] ViroARSceneNavigator is not supported on Meta Quest. " +
|
|
1534
|
+
"Use ViroXRSceneNavigator (auto-detects Quest) or ViroVRSceneNavigator instead."
|
|
1535
|
+
);
|
|
1536
|
+
ViroARSceneNavigator._questWarningLogged = true;
|
|
1537
|
+
}
|
|
1538
|
+
if ("questFallback" in this.props) {
|
|
1539
|
+
return <>{this.props.questFallback}</>;
|
|
1540
|
+
}
|
|
1541
|
+
return (
|
|
1542
|
+
<View style={[styles.container, styles.questFallback]}>
|
|
1543
|
+
<Text style={styles.questFallbackText}>
|
|
1544
|
+
AR is not supported on Meta Quest.
|
|
1545
|
+
</Text>
|
|
1546
|
+
</View>
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1475
1550
|
const items = this._renderSceneStackItems();
|
|
1476
1551
|
|
|
1477
1552
|
// update the arSceneNavigator with the latest given props on every render
|
|
@@ -1520,6 +1595,15 @@ const styles = StyleSheet.create({
|
|
|
1520
1595
|
justifyContent: "center",
|
|
1521
1596
|
alignItems: "center",
|
|
1522
1597
|
},
|
|
1598
|
+
questFallback: {
|
|
1599
|
+
backgroundColor: "#000",
|
|
1600
|
+
padding: 24,
|
|
1601
|
+
},
|
|
1602
|
+
questFallbackText: {
|
|
1603
|
+
color: "#fff",
|
|
1604
|
+
fontSize: 16,
|
|
1605
|
+
textAlign: "center",
|
|
1606
|
+
},
|
|
1523
1607
|
});
|
|
1524
1608
|
|
|
1525
1609
|
const VRTARSceneNavigator = requireNativeComponent<any>(
|
|
@@ -103,6 +103,17 @@ export type ViroObjectProps = {
|
|
|
103
103
|
shadowCastingBitMask?: number;
|
|
104
104
|
|
|
105
105
|
shaderModifiers?: ViroShaderModifiers;
|
|
106
|
+
/**
|
|
107
|
+
* Apply shader modifiers from named materials to this node and all its children,
|
|
108
|
+
* preserving embedded textures (e.g. GLB/VRX). Unlike `materials`, which replaces
|
|
109
|
+
* the root geometry's material entirely, `shaderOverrides` merges only the shader
|
|
110
|
+
* modifiers and rendering properties from the named material onto every child mesh
|
|
111
|
+
* in the hierarchy. Use this for GLB models when you want to apply semantic masking,
|
|
112
|
+
* custom effects, or other per-material shader modifiers without losing the model's
|
|
113
|
+
* original textures and skinning.
|
|
114
|
+
*
|
|
115
|
+
* Accepts an array of material names previously registered via `ViroMaterials.createMaterials`.
|
|
116
|
+
*/
|
|
106
117
|
shaderOverrides?: string[];
|
|
107
118
|
materialUniforms?: { [key: string]: any } | ViroShaderUniform[];
|
|
108
119
|
|
|
@@ -54,6 +54,43 @@ export type ViroResolvedCubeMap = {
|
|
|
54
54
|
pz: ImageResolvedAssetSource;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
export type ViroSemanticMaskMode = "showOnly" | "hide" | "debug";
|
|
58
|
+
|
|
59
|
+
export type ViroSemanticLabel =
|
|
60
|
+
| "sky"
|
|
61
|
+
| "building"
|
|
62
|
+
| "tree"
|
|
63
|
+
| "road"
|
|
64
|
+
| "sidewalk"
|
|
65
|
+
| "terrain"
|
|
66
|
+
| "structure"
|
|
67
|
+
| "object"
|
|
68
|
+
| "vehicle"
|
|
69
|
+
| "person"
|
|
70
|
+
| "water";
|
|
71
|
+
|
|
72
|
+
export type ViroSemanticMaskConfig = {
|
|
73
|
+
/** Whether to show the material only where the label matches, or to hide it there. */
|
|
74
|
+
mode: ViroSemanticMaskMode;
|
|
75
|
+
/** One or more semantic labels to match against. */
|
|
76
|
+
labels: ViroSemanticLabel[];
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Maps VROSemanticLabel enum value → bit position (bit N = label N, value 1-11).
|
|
80
|
+
const kSemanticLabelBit: Record<ViroSemanticLabel, number> = {
|
|
81
|
+
sky: 1 << 1,
|
|
82
|
+
building: 1 << 2,
|
|
83
|
+
tree: 1 << 3,
|
|
84
|
+
road: 1 << 4,
|
|
85
|
+
sidewalk: 1 << 5,
|
|
86
|
+
terrain: 1 << 6,
|
|
87
|
+
structure: 1 << 7,
|
|
88
|
+
object: 1 << 8,
|
|
89
|
+
vehicle: 1 << 9,
|
|
90
|
+
person: 1 << 10,
|
|
91
|
+
water: 1 << 11,
|
|
92
|
+
};
|
|
93
|
+
|
|
57
94
|
export type ViroShaderModifier = {
|
|
58
95
|
body?: string;
|
|
59
96
|
uniforms?: string;
|
|
@@ -116,6 +153,10 @@ export type ViroMaterial = {
|
|
|
116
153
|
ambientOcclusionTexture?: any; // TODO: types
|
|
117
154
|
shaderModifiers?: ViroShaderModifiers;
|
|
118
155
|
materialUniforms?: ViroShaderUniform[];
|
|
156
|
+
/** Semantic masking — shows or hides the material based on ARCore scene semantics labels.
|
|
157
|
+
* Requires `setSemanticModeEnabled(true)` on the AR scene navigator.
|
|
158
|
+
* Only supported on Android (ARCore). Gracefully no-ops on iOS. */
|
|
159
|
+
semanticMask?: ViroSemanticMaskConfig;
|
|
119
160
|
};
|
|
120
161
|
|
|
121
162
|
export type ViroMaterialDict = {
|
|
@@ -163,6 +204,16 @@ export class ViroMaterials {
|
|
|
163
204
|
} else if (prop.endsWith("color") || prop.endsWith("Color")) {
|
|
164
205
|
var color = processColor(material[prop]);
|
|
165
206
|
resultMaterial[prop] = color;
|
|
207
|
+
} else if (prop === "semanticMask") {
|
|
208
|
+
const config = material[prop] as ViroSemanticMaskConfig;
|
|
209
|
+
let labelMask = 0;
|
|
210
|
+
for (const label of config.labels) {
|
|
211
|
+
labelMask |= kSemanticLabelBit[label] ?? 0;
|
|
212
|
+
}
|
|
213
|
+
resultMaterial["semanticMask"] = {
|
|
214
|
+
mode: config.mode,
|
|
215
|
+
labelMask,
|
|
216
|
+
};
|
|
166
217
|
} else {
|
|
167
218
|
//just apply material property directly.
|
|
168
219
|
resultMaterial[prop] = material[prop];
|