@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
|
@@ -293,7 +293,7 @@ export declare class ViroARPlaneSelector extends React.Component<Props, State> {
|
|
|
293
293
|
*/
|
|
294
294
|
_worldToLocal: (world: [number, number, number], anchorPosition: [number, number, number], rotationDeg: [number, number, number]) => [number, number, number];
|
|
295
295
|
_passesAlignmentFilter: (anchor: ViroAnchor) => boolean;
|
|
296
|
-
render(): React.JSX.Element;
|
|
296
|
+
render(): React.JSX.Element | null;
|
|
297
297
|
_renderPlanes(): React.JSX.Element[];
|
|
298
298
|
}
|
|
299
299
|
export {};
|
|
@@ -45,6 +45,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.ViroARPlaneSelector = void 0;
|
|
47
47
|
const React = __importStar(require("react"));
|
|
48
|
+
const ViroPlatform_1 = require("../Utilities/ViroPlatform");
|
|
48
49
|
const ViroMaterials_1 = require("../Material/ViroMaterials");
|
|
49
50
|
const ViroNode_1 = require("../ViroNode");
|
|
50
51
|
const ViroQuad_1 = require("../ViroQuad");
|
|
@@ -284,6 +285,10 @@ class ViroARPlaneSelector extends React.Component {
|
|
|
284
285
|
// Render
|
|
285
286
|
// ---------------------------------------------------------------------------
|
|
286
287
|
render() {
|
|
288
|
+
if (ViroPlatform_1.isQuest) {
|
|
289
|
+
console.warn("[Viro] ViroARPlaneSelector is not supported on Quest and will not render.");
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
287
292
|
return <ViroNode_1.ViroNode>{this._renderPlanes()}</ViroNode_1.ViroNode>;
|
|
288
293
|
}
|
|
289
294
|
_renderPlanes() {
|
|
@@ -52,6 +52,7 @@ const react_native_1 = require("react-native");
|
|
|
52
52
|
const resolveAssetSource_1 = __importDefault(require("react-native/Libraries/Image/resolveAssetSource"));
|
|
53
53
|
const ViroBase_1 = require("../ViroBase");
|
|
54
54
|
const ViroConstants_1 = require("../ViroConstants");
|
|
55
|
+
const ViroPlatform_1 = require("../Utilities/ViroPlatform");
|
|
55
56
|
const ViroCameraModule = react_native_1.NativeModules.ViroCameraModule;
|
|
56
57
|
class ViroARScene extends ViroBase_1.ViroBase {
|
|
57
58
|
onTrackingFirstInitialized = false;
|
|
@@ -283,6 +284,10 @@ class ViroARScene extends ViroBase_1.ViroBase {
|
|
|
283
284
|
return await ViroCameraModule.getCameraPosition((0, react_native_1.findNodeHandle)(this));
|
|
284
285
|
};
|
|
285
286
|
render() {
|
|
287
|
+
if (ViroPlatform_1.isQuest) {
|
|
288
|
+
console.warn("[Viro] ViroARScene is not supported on Quest and will not render. Use ViroScene instead.");
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
286
291
|
// Uncomment this line to check for misnamed props
|
|
287
292
|
//checkMisnamedProps("ViroARScene", this.props);
|
|
288
293
|
// Since anchorDetectionTypes can be either a string or an array, convert the string to a 1-element array.
|
|
@@ -30,6 +30,12 @@ type Props = ViewProps & {
|
|
|
30
30
|
scene: () => React.JSX.Element;
|
|
31
31
|
};
|
|
32
32
|
initialSceneKey?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional fallback rendered when this navigator is mounted on a Meta Quest
|
|
35
|
+
* device (where AR is not supported). When omitted, a default message view
|
|
36
|
+
* is rendered. Pass `null` to render nothing.
|
|
37
|
+
*/
|
|
38
|
+
questFallback?: React.ReactNode;
|
|
33
39
|
autofocus?: boolean;
|
|
34
40
|
/**
|
|
35
41
|
* iOS only props! Note: these props may change as the underlying platforms coalesce in features.
|
|
@@ -80,6 +86,26 @@ type Props = ViewProps & {
|
|
|
80
86
|
* @default false
|
|
81
87
|
*/
|
|
82
88
|
depthDebugEnabled?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Enable semantic segmentation debug visualization. When enabled, the camera
|
|
91
|
+
* background shows a color overlay for each real-world category (sky, building, tree,
|
|
92
|
+
* road, sidewalk, terrain, structure, object, vehicle, person, water).
|
|
93
|
+
* Requires `setSemanticModeEnabled(true)` to be called on the scene navigator first.
|
|
94
|
+
*
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
semanticDebugEnabled?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Confidence threshold (0.0–1.0) below which semantic labels are discarded (treated
|
|
100
|
+
* as unlabeled = 0) before the texture is uploaded to the GPU. Higher values reduce
|
|
101
|
+
* noise and boundary blinking at the cost of smaller labeled regions.
|
|
102
|
+
*
|
|
103
|
+
* Only used on Android (ARCore provides per-pixel confidence). On iOS, ARKit's
|
|
104
|
+
* segmentation is already temporally smoothed by the OS.
|
|
105
|
+
*
|
|
106
|
+
* @default 0.0
|
|
107
|
+
*/
|
|
108
|
+
semanticConfidenceThreshold?: number;
|
|
83
109
|
/**
|
|
84
110
|
* [iOS Only] Prefer monocular depth estimation over LiDAR.
|
|
85
111
|
* When true, monocular depth will be used even on devices with LiDAR.
|
|
@@ -152,6 +178,7 @@ type State = {
|
|
|
152
178
|
* ViroARSceneNavigator is used to transition between multiple AR Scenes.
|
|
153
179
|
*/
|
|
154
180
|
export declare class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
181
|
+
static _questWarningLogged: boolean;
|
|
155
182
|
_component: ViroNativeRef;
|
|
156
183
|
constructor(props: Props);
|
|
157
184
|
componentDidMount(): void;
|
|
@@ -479,6 +506,9 @@ export declare class ViroARSceneNavigator extends React.Component<Props, State>
|
|
|
479
506
|
_rvUpdateCloudAnchor: (anchorId: string, name: string, description: string, isPublic: boolean) => Promise<any>;
|
|
480
507
|
_rvDeleteCloudAnchor: (anchorId: string) => Promise<any>;
|
|
481
508
|
_rvFindNearbyCloudAnchors: (latitude: number, longitude: number, radius: number, limit: number) => Promise<any>;
|
|
509
|
+
_rvGetProject: () => Promise<any>;
|
|
510
|
+
_rvGetScene: (sceneId: string) => Promise<any>;
|
|
511
|
+
_rvGetSceneAssets: (sceneId: string) => Promise<any>;
|
|
482
512
|
_rvAttachAssetToCloudAnchor: (anchorId: string, fileUrl: string, fileSize: number, name: string, assetType: string, externalUserId: string) => Promise<any>;
|
|
483
513
|
_rvRemoveAssetFromCloudAnchor: (anchorId: string, assetId: string) => Promise<any>;
|
|
484
514
|
_rvTrackCloudAnchorResolution: (anchorId: string, success: boolean, confidence: number, matchCount: number, inlierCount: number, processingTimeMs: number, platform: string, externalUserId: string) => Promise<any>;
|
|
@@ -597,6 +627,9 @@ export declare class ViroARSceneNavigator extends React.Component<Props, State>
|
|
|
597
627
|
rvAttachAssetToCloudAnchor: (anchorId: string, fileUrl: string, fileSize: number, name: string, assetType: string, externalUserId: string) => Promise<any>;
|
|
598
628
|
rvRemoveAssetFromCloudAnchor: (anchorId: string, assetId: string) => Promise<any>;
|
|
599
629
|
rvTrackCloudAnchorResolution: (anchorId: string, success: boolean, confidence: number, matchCount: number, inlierCount: number, processingTimeMs: number, platform: string, externalUserId: string) => Promise<any>;
|
|
630
|
+
rvGetProject: () => Promise<any>;
|
|
631
|
+
rvGetScene: (sceneId: string) => Promise<any>;
|
|
632
|
+
rvGetSceneAssets: (sceneId: string) => Promise<any>;
|
|
600
633
|
rvUploadAsset: (filePath: string, assetType: string, fileName: string, appUserId?: string) => Promise<any>;
|
|
601
634
|
isSemanticModeSupported: () => Promise<ViroSemanticSupportResult>;
|
|
602
635
|
setSemanticModeEnabled: (enabled: boolean) => void;
|
|
@@ -648,6 +681,9 @@ export declare class ViroARSceneNavigator extends React.Component<Props, State>
|
|
|
648
681
|
rvAttachAssetToCloudAnchor: (anchorId: string, fileUrl: string, fileSize: number, name: string, assetType: string, externalUserId: string) => Promise<any>;
|
|
649
682
|
rvRemoveAssetFromCloudAnchor: (anchorId: string, assetId: string) => Promise<any>;
|
|
650
683
|
rvTrackCloudAnchorResolution: (anchorId: string, success: boolean, confidence: number, matchCount: number, inlierCount: number, processingTimeMs: number, platform: string, externalUserId: string) => Promise<any>;
|
|
684
|
+
rvGetProject: () => Promise<any>;
|
|
685
|
+
rvGetScene: (sceneId: string) => Promise<any>;
|
|
686
|
+
rvGetSceneAssets: (sceneId: string) => Promise<any>;
|
|
651
687
|
rvUploadAsset: (filePath: string, assetType: string, fileName: string, appUserId?: string) => Promise<any>;
|
|
652
688
|
isSemanticModeSupported: () => Promise<ViroSemanticSupportResult>;
|
|
653
689
|
setSemanticModeEnabled: (enabled: boolean) => void;
|
|
@@ -47,12 +47,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
47
47
|
exports.ViroARSceneNavigator = void 0;
|
|
48
48
|
const React = __importStar(require("react"));
|
|
49
49
|
const react_native_1 = require("react-native");
|
|
50
|
+
const ViroPlatform_1 = require("../Utilities/ViroPlatform");
|
|
50
51
|
const ViroARSceneNavigatorModule = react_native_1.NativeModules.VRTARSceneNavigatorModule;
|
|
51
52
|
let mathRandomOffset = 0;
|
|
52
53
|
/**
|
|
53
54
|
* ViroARSceneNavigator is used to transition between multiple AR Scenes.
|
|
54
55
|
*/
|
|
55
56
|
class ViroARSceneNavigator extends React.Component {
|
|
57
|
+
static _questWarningLogged = false;
|
|
56
58
|
_component = null;
|
|
57
59
|
constructor(props) {
|
|
58
60
|
super(props);
|
|
@@ -681,6 +683,15 @@ class ViroARSceneNavigator extends React.Component {
|
|
|
681
683
|
_rvFindNearbyCloudAnchors = async (latitude, longitude, radius, limit) => {
|
|
682
684
|
return await ViroARSceneNavigatorModule.rvFindNearbyCloudAnchors((0, react_native_1.findNodeHandle)(this), latitude, longitude, radius, limit);
|
|
683
685
|
};
|
|
686
|
+
_rvGetProject = async () => {
|
|
687
|
+
return await ViroARSceneNavigatorModule.rvGetProject((0, react_native_1.findNodeHandle)(this));
|
|
688
|
+
};
|
|
689
|
+
_rvGetScene = async (sceneId) => {
|
|
690
|
+
return await ViroARSceneNavigatorModule.rvGetScene((0, react_native_1.findNodeHandle)(this), sceneId);
|
|
691
|
+
};
|
|
692
|
+
_rvGetSceneAssets = async (sceneId) => {
|
|
693
|
+
return await ViroARSceneNavigatorModule.rvGetSceneAssets((0, react_native_1.findNodeHandle)(this), sceneId);
|
|
694
|
+
};
|
|
684
695
|
_rvAttachAssetToCloudAnchor = async (anchorId, fileUrl, fileSize, name, assetType, externalUserId) => {
|
|
685
696
|
return await ViroARSceneNavigatorModule.rvAttachAssetToCloudAnchor((0, react_native_1.findNodeHandle)(this), anchorId, fileUrl, fileSize, name, assetType, externalUserId);
|
|
686
697
|
};
|
|
@@ -901,6 +912,9 @@ class ViroARSceneNavigator extends React.Component {
|
|
|
901
912
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
902
913
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
903
914
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
915
|
+
rvGetProject: this._rvGetProject,
|
|
916
|
+
rvGetScene: this._rvGetScene,
|
|
917
|
+
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
904
918
|
// Assets API
|
|
905
919
|
rvUploadAsset: this._rvUploadAsset,
|
|
906
920
|
// Scene Semantics API
|
|
@@ -959,6 +973,9 @@ class ViroARSceneNavigator extends React.Component {
|
|
|
959
973
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
960
974
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
961
975
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
976
|
+
rvGetProject: this._rvGetProject,
|
|
977
|
+
rvGetScene: this._rvGetScene,
|
|
978
|
+
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
962
979
|
// Assets API
|
|
963
980
|
rvUploadAsset: this._rvUploadAsset,
|
|
964
981
|
// Scene Semantics API
|
|
@@ -977,6 +994,21 @@ class ViroARSceneNavigator extends React.Component {
|
|
|
977
994
|
render() {
|
|
978
995
|
// Uncomment this line to check for misnamed props
|
|
979
996
|
//checkMisnamedProps("ViroARSceneNavigator", this.props);
|
|
997
|
+
if (ViroPlatform_1.isQuest) {
|
|
998
|
+
if (!ViroARSceneNavigator._questWarningLogged) {
|
|
999
|
+
console.warn("[Viro] ViroARSceneNavigator is not supported on Meta Quest. " +
|
|
1000
|
+
"Use ViroXRSceneNavigator (auto-detects Quest) or ViroVRSceneNavigator instead.");
|
|
1001
|
+
ViroARSceneNavigator._questWarningLogged = true;
|
|
1002
|
+
}
|
|
1003
|
+
if ("questFallback" in this.props) {
|
|
1004
|
+
return <>{this.props.questFallback}</>;
|
|
1005
|
+
}
|
|
1006
|
+
return (<react_native_1.View style={[styles.container, styles.questFallback]}>
|
|
1007
|
+
<react_native_1.Text style={styles.questFallbackText}>
|
|
1008
|
+
AR is not supported on Meta Quest.
|
|
1009
|
+
</react_native_1.Text>
|
|
1010
|
+
</react_native_1.View>);
|
|
1011
|
+
}
|
|
980
1012
|
const items = this._renderSceneStackItems();
|
|
981
1013
|
// update the arSceneNavigator with the latest given props on every render
|
|
982
1014
|
this.arSceneNavigator.viroAppProps = this.props.viroAppProps;
|
|
@@ -1005,6 +1037,15 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
1005
1037
|
justifyContent: "center",
|
|
1006
1038
|
alignItems: "center",
|
|
1007
1039
|
},
|
|
1040
|
+
questFallback: {
|
|
1041
|
+
backgroundColor: "#000",
|
|
1042
|
+
padding: 24,
|
|
1043
|
+
},
|
|
1044
|
+
questFallbackText: {
|
|
1045
|
+
color: "#fff",
|
|
1046
|
+
fontSize: 16,
|
|
1047
|
+
textAlign: "center",
|
|
1048
|
+
},
|
|
1008
1049
|
});
|
|
1009
1050
|
const VRTARSceneNavigator = (0, react_native_1.requireNativeComponent)("VRTARSceneNavigator",
|
|
1010
1051
|
// @ts-ignore
|
|
@@ -54,6 +54,17 @@ export type ViroObjectProps = {
|
|
|
54
54
|
lightReceivingBitMask?: number;
|
|
55
55
|
shadowCastingBitMask?: number;
|
|
56
56
|
shaderModifiers?: ViroShaderModifiers;
|
|
57
|
+
/**
|
|
58
|
+
* Apply shader modifiers from named materials to this node and all its children,
|
|
59
|
+
* preserving embedded textures (e.g. GLB/VRX). Unlike `materials`, which replaces
|
|
60
|
+
* the root geometry's material entirely, `shaderOverrides` merges only the shader
|
|
61
|
+
* modifiers and rendering properties from the named material onto every child mesh
|
|
62
|
+
* in the hierarchy. Use this for GLB models when you want to apply semantic masking,
|
|
63
|
+
* custom effects, or other per-material shader modifiers without losing the model's
|
|
64
|
+
* original textures and skinning.
|
|
65
|
+
*
|
|
66
|
+
* Accepts an array of material names previously registered via `ViroMaterials.createMaterials`.
|
|
67
|
+
*/
|
|
57
68
|
shaderOverrides?: string[];
|
|
58
69
|
materialUniforms?: {
|
|
59
70
|
[key: string]: any;
|
|
@@ -27,6 +27,14 @@ export type ViroResolvedCubeMap = {
|
|
|
27
27
|
nz: ImageResolvedAssetSource;
|
|
28
28
|
pz: ImageResolvedAssetSource;
|
|
29
29
|
};
|
|
30
|
+
export type ViroSemanticMaskMode = "showOnly" | "hide" | "debug";
|
|
31
|
+
export type ViroSemanticLabel = "sky" | "building" | "tree" | "road" | "sidewalk" | "terrain" | "structure" | "object" | "vehicle" | "person" | "water";
|
|
32
|
+
export type ViroSemanticMaskConfig = {
|
|
33
|
+
/** Whether to show the material only where the label matches, or to hide it there. */
|
|
34
|
+
mode: ViroSemanticMaskMode;
|
|
35
|
+
/** One or more semantic labels to match against. */
|
|
36
|
+
labels: ViroSemanticLabel[];
|
|
37
|
+
};
|
|
30
38
|
export type ViroShaderModifier = {
|
|
31
39
|
body?: string;
|
|
32
40
|
uniforms?: string;
|
|
@@ -86,6 +94,10 @@ export type ViroMaterial = {
|
|
|
86
94
|
ambientOcclusionTexture?: any;
|
|
87
95
|
shaderModifiers?: ViroShaderModifiers;
|
|
88
96
|
materialUniforms?: ViroShaderUniform[];
|
|
97
|
+
/** Semantic masking — shows or hides the material based on ARCore scene semantics labels.
|
|
98
|
+
* Requires `setSemanticModeEnabled(true)` on the AR scene navigator.
|
|
99
|
+
* Only supported on Android (ARCore). Gracefully no-ops on iOS. */
|
|
100
|
+
semanticMask?: ViroSemanticMaskConfig;
|
|
89
101
|
};
|
|
90
102
|
export type ViroMaterialDict = {
|
|
91
103
|
[key: string]: ViroMaterial;
|
|
@@ -23,6 +23,20 @@ const resolveAssetSource_1 = __importDefault(require("react-native/Libraries/Ima
|
|
|
23
23
|
var MaterialManager = react_native_1.NativeModules.VRTMaterialManager ||
|
|
24
24
|
react_native_1.TurboModuleRegistry.get("VRTMaterialManager");
|
|
25
25
|
console.log("VRTMaterialManager lookup:", MaterialManager ? "FOUND" : "NOT FOUND");
|
|
26
|
+
// Maps VROSemanticLabel enum value → bit position (bit N = label N, value 1-11).
|
|
27
|
+
const kSemanticLabelBit = {
|
|
28
|
+
sky: 1 << 1,
|
|
29
|
+
building: 1 << 2,
|
|
30
|
+
tree: 1 << 3,
|
|
31
|
+
road: 1 << 4,
|
|
32
|
+
sidewalk: 1 << 5,
|
|
33
|
+
terrain: 1 << 6,
|
|
34
|
+
structure: 1 << 7,
|
|
35
|
+
object: 1 << 8,
|
|
36
|
+
vehicle: 1 << 9,
|
|
37
|
+
person: 1 << 10,
|
|
38
|
+
water: 1 << 11,
|
|
39
|
+
};
|
|
26
40
|
class ViroMaterials {
|
|
27
41
|
static createMaterials(materials) {
|
|
28
42
|
var result = {};
|
|
@@ -65,6 +79,17 @@ class ViroMaterials {
|
|
|
65
79
|
var color = (0, react_native_1.processColor)(material[prop]);
|
|
66
80
|
resultMaterial[prop] = color;
|
|
67
81
|
}
|
|
82
|
+
else if (prop === "semanticMask") {
|
|
83
|
+
const config = material[prop];
|
|
84
|
+
let labelMask = 0;
|
|
85
|
+
for (const label of config.labels) {
|
|
86
|
+
labelMask |= kSemanticLabelBit[label] ?? 0;
|
|
87
|
+
}
|
|
88
|
+
resultMaterial["semanticMask"] = {
|
|
89
|
+
mode: config.mode,
|
|
90
|
+
labelMask,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
68
93
|
else {
|
|
69
94
|
//just apply material property directly.
|
|
70
95
|
resultMaterial[prop] = material[prop];
|
|
@@ -63,6 +63,29 @@ export interface RVGeospatialListResult {
|
|
|
63
63
|
data: RVGeospatialAnchor[];
|
|
64
64
|
total?: number;
|
|
65
65
|
}
|
|
66
|
+
export interface RVSceneAsset {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
description?: string | null;
|
|
70
|
+
file_url?: string | null;
|
|
71
|
+
file_size?: number | null;
|
|
72
|
+
asset_type_name?: "3D-MODEL" | "TEXT" | "IMAGE" | "VIDEO" | null;
|
|
73
|
+
position_x?: number | null;
|
|
74
|
+
position_y?: number | null;
|
|
75
|
+
position_z?: number | null;
|
|
76
|
+
rotation_x?: number | null;
|
|
77
|
+
rotation_y?: number | null;
|
|
78
|
+
rotation_z?: number | null;
|
|
79
|
+
scale?: number | null;
|
|
80
|
+
latitude: number;
|
|
81
|
+
longitude: number;
|
|
82
|
+
is_draggable: boolean;
|
|
83
|
+
trigger_image_url?: string | null;
|
|
84
|
+
trigger_image_orientation?: "Up" | "Down" | "Left" | "Right" | null;
|
|
85
|
+
trigger_image_physical_width_m?: number | null;
|
|
86
|
+
created_at: string;
|
|
87
|
+
updated_at: string;
|
|
88
|
+
}
|
|
66
89
|
export interface RVCloudAnchor {
|
|
67
90
|
id: string;
|
|
68
91
|
project_id: string;
|
|
@@ -102,6 +125,8 @@ export declare class ReactVisionClient {
|
|
|
102
125
|
listCloudAnchors(projectId: string, limit?: number, offset?: number): Promise<RVApiResult<RVCloudAnchor[]>>;
|
|
103
126
|
/** Delete a cloud anchor. */
|
|
104
127
|
deleteCloudAnchor(id: string): Promise<RVApiResult<null>>;
|
|
128
|
+
/** Fetch all assets for a scene by scene ID. */
|
|
129
|
+
getSceneAssets(sceneId: string): Promise<RVApiResult<RVSceneAsset[]>>;
|
|
105
130
|
private _get;
|
|
106
131
|
private _post;
|
|
107
132
|
private _patch;
|
|
@@ -82,6 +82,17 @@ class ReactVisionClient {
|
|
|
82
82
|
return this._delete(`/cloud-anchors/${id}`);
|
|
83
83
|
}
|
|
84
84
|
// --------------------------------------------------------------------------
|
|
85
|
+
// Scenes
|
|
86
|
+
// --------------------------------------------------------------------------
|
|
87
|
+
/** Fetch all assets for a scene by scene ID. */
|
|
88
|
+
async getSceneAssets(sceneId) {
|
|
89
|
+
const result = await this._get(`/functions/v1/scenes/${encodeURIComponent(sceneId)}/assets`);
|
|
90
|
+
if (!result.success)
|
|
91
|
+
return result;
|
|
92
|
+
const assets = result.data?.assets ?? result.data ?? [];
|
|
93
|
+
return { success: true, data: assets };
|
|
94
|
+
}
|
|
95
|
+
// --------------------------------------------------------------------------
|
|
85
96
|
// Internal fetch helpers
|
|
86
97
|
// --------------------------------------------------------------------------
|
|
87
98
|
async _get(path) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StudioSceneResponse } from "./types";
|
|
3
|
+
interface StudioARSceneProps {
|
|
4
|
+
sceneNavigator?: any;
|
|
5
|
+
sceneData: StudioSceneResponse | null;
|
|
6
|
+
onReady?: () => void;
|
|
7
|
+
onError?: (err: Error) => void;
|
|
8
|
+
onSceneChange?: (sceneId: string, sceneName: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Outer gate: keeps the hooks-bearing inner component out of the tree until
|
|
12
|
+
* sceneData is available, avoiding a Rules of Hooks violation.
|
|
13
|
+
*/
|
|
14
|
+
export declare const StudioARScene: React.FC<StudioARSceneProps>;
|
|
15
|
+
export {};
|