@reactvision/react-viro 2.53.1 → 2.54.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/android/react_viro/react_viro-release.aar +0 -0
- package/android/viro_renderer/viro_renderer-release.aar +0 -0
- package/components/AR/ViroARSceneNavigator.tsx +30 -0
- package/components/AR/ViroCommonProps.ts +11 -0
- package/components/Material/ViroMaterials.ts +51 -0
- package/components/Utilities/ViroUtils.tsx +48 -0
- package/components/Utilities/ViroVersion.ts +1 -1
- package/components/Viro360Image.tsx +7 -0
- package/dist/components/AR/ViroARSceneNavigator.d.ts +23 -0
- package/dist/components/AR/ViroARSceneNavigator.js +5 -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/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/Viro360Image.d.ts +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/plugins/withViro.d.ts +11 -0
- package/dist/plugins/withViroIos.js +12 -8
- package/index.ts +8 -0
- package/ios/ViroReact.podspec +2 -1
- 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 +20 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSessioniOS.h +12 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROGLTFLoader.h +34 -0
- 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/VROPortal.h +17 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderContext.h +41 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderer.h +15 -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/include/VRT360Image.h +1 -0
- package/ios/dist/include/VRTARSceneNavigator.h +4 -0
- package/ios/dist/lib/libViroReact.a +0 -0
- package/package.json +8 -8
|
Binary file
|
|
Binary file
|
|
@@ -130,6 +130,28 @@ type Props = ViewProps & {
|
|
|
130
130
|
*/
|
|
131
131
|
depthDebugEnabled?: boolean;
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Enable semantic segmentation debug visualization. When enabled, the camera
|
|
135
|
+
* background shows a color overlay for each real-world category (sky, building, tree,
|
|
136
|
+
* road, sidewalk, terrain, structure, object, vehicle, person, water).
|
|
137
|
+
* Requires `setSemanticModeEnabled(true)` to be called on the scene navigator first.
|
|
138
|
+
*
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
semanticDebugEnabled?: boolean;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Confidence threshold (0.0–1.0) below which semantic labels are discarded (treated
|
|
145
|
+
* as unlabeled = 0) before the texture is uploaded to the GPU. Higher values reduce
|
|
146
|
+
* noise and boundary blinking at the cost of smaller labeled regions.
|
|
147
|
+
*
|
|
148
|
+
* Only used on Android (ARCore provides per-pixel confidence). On iOS, ARKit's
|
|
149
|
+
* segmentation is already temporally smoothed by the OS.
|
|
150
|
+
*
|
|
151
|
+
* @default 0.0
|
|
152
|
+
*/
|
|
153
|
+
semanticConfidenceThreshold?: number;
|
|
154
|
+
|
|
133
155
|
/**
|
|
134
156
|
* [iOS Only] Prefer monocular depth estimation over LiDAR.
|
|
135
157
|
* When true, monocular depth will be used even on devices with LiDAR.
|
|
@@ -1105,6 +1127,12 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1105
1127
|
);
|
|
1106
1128
|
};
|
|
1107
1129
|
|
|
1130
|
+
_rvGetSceneAssets = async (sceneId: string): Promise<any> => {
|
|
1131
|
+
return await ViroARSceneNavigatorModule.rvGetSceneAssets(
|
|
1132
|
+
findNodeHandle(this), sceneId
|
|
1133
|
+
);
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1108
1136
|
_rvAttachAssetToCloudAnchor = async (
|
|
1109
1137
|
anchorId: string,
|
|
1110
1138
|
fileUrl: string,
|
|
@@ -1394,6 +1422,7 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1394
1422
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
1395
1423
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
1396
1424
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
1425
|
+
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
1397
1426
|
// Assets API
|
|
1398
1427
|
rvUploadAsset: this._rvUploadAsset,
|
|
1399
1428
|
// Scene Semantics API
|
|
@@ -1452,6 +1481,7 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1452
1481
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
1453
1482
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
1454
1483
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
1484
|
+
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
1455
1485
|
// Assets API
|
|
1456
1486
|
rvUploadAsset: this._rvUploadAsset,
|
|
1457
1487
|
// Scene Semantics API
|
|
@@ -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];
|
|
@@ -136,6 +136,54 @@ export function gpsToArWorld(
|
|
|
136
136
|
];
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
export type ViroPermission = "camera" | "microphone" | "storage" | "location";
|
|
140
|
+
|
|
141
|
+
const ALL_PERMISSIONS: ViroPermission[] = [
|
|
142
|
+
"camera",
|
|
143
|
+
"microphone",
|
|
144
|
+
"storage",
|
|
145
|
+
"location",
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
export interface ViroPermissionsResult {
|
|
149
|
+
camera?: boolean;
|
|
150
|
+
microphone?: boolean;
|
|
151
|
+
storage?: boolean;
|
|
152
|
+
location?: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Request the specified permissions required for Viro AR to function.
|
|
157
|
+
* Omit `permissions` to request all four (camera, microphone, storage, location).
|
|
158
|
+
* Only the requested keys are present in the resolved result.
|
|
159
|
+
*/
|
|
160
|
+
export function requestRequiredPermissions(
|
|
161
|
+
permissions: ViroPermission[] = ALL_PERMISSIONS
|
|
162
|
+
): Promise<ViroPermissionsResult> {
|
|
163
|
+
if (Platform.OS === "ios") {
|
|
164
|
+
return NativeModules.VRTARUtils.requestRequiredPermissions(permissions);
|
|
165
|
+
} else {
|
|
166
|
+
return NativeModules.VRTARSceneNavigatorModule.requestRequiredPermissions(
|
|
167
|
+
permissions
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Check the current status of the specified permissions without prompting the user.
|
|
174
|
+
* Omit `permissions` to check all four (camera, microphone, storage, location).
|
|
175
|
+
* Only the requested keys are present in the resolved result.
|
|
176
|
+
*/
|
|
177
|
+
export function checkPermissions(
|
|
178
|
+
permissions: ViroPermission[] = ALL_PERMISSIONS
|
|
179
|
+
): Promise<ViroPermissionsResult> {
|
|
180
|
+
if (Platform.OS === "ios") {
|
|
181
|
+
return NativeModules.VRTARUtils.checkPermissions(permissions);
|
|
182
|
+
} else {
|
|
183
|
+
return NativeModules.VRTARSceneNavigatorModule.checkPermissions(permissions);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
139
187
|
export interface ViroiOSArSupportResponse {
|
|
140
188
|
isARSupported: boolean;
|
|
141
189
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VIRO_VERSION = "2.
|
|
1
|
+
export const VIRO_VERSION = "2.54.0";
|
|
@@ -37,6 +37,13 @@ type Props = ViewProps & {
|
|
|
37
37
|
format?: "RGBA8" | "RGB565";
|
|
38
38
|
steroMode?: "LeftRight" | "RightLeft" | "TopBottom" | "BottomTop" | "None";
|
|
39
39
|
isHdr?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* When true, the image is rendered as a sky-effect overlay: it appears only over pixels
|
|
42
|
+
* semantically labeled as sky by ARCore/ARKit scene semantics, using alpha blending via
|
|
43
|
+
* the confidence texture for smooth boundary transitions. Requires scene semantics to be
|
|
44
|
+
* enabled on the AR session. Has no effect in VR mode. Default false.
|
|
45
|
+
*/
|
|
46
|
+
skyEffect?: boolean;
|
|
40
47
|
/**
|
|
41
48
|
* Callback triggered when we are processing the assets to be
|
|
42
49
|
* displayed in this 360 Photo (either downloading / reading from file).
|
|
@@ -80,6 +80,26 @@ type Props = ViewProps & {
|
|
|
80
80
|
* @default false
|
|
81
81
|
*/
|
|
82
82
|
depthDebugEnabled?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Enable semantic segmentation debug visualization. When enabled, the camera
|
|
85
|
+
* background shows a color overlay for each real-world category (sky, building, tree,
|
|
86
|
+
* road, sidewalk, terrain, structure, object, vehicle, person, water).
|
|
87
|
+
* Requires `setSemanticModeEnabled(true)` to be called on the scene navigator first.
|
|
88
|
+
*
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
semanticDebugEnabled?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Confidence threshold (0.0–1.0) below which semantic labels are discarded (treated
|
|
94
|
+
* as unlabeled = 0) before the texture is uploaded to the GPU. Higher values reduce
|
|
95
|
+
* noise and boundary blinking at the cost of smaller labeled regions.
|
|
96
|
+
*
|
|
97
|
+
* Only used on Android (ARCore provides per-pixel confidence). On iOS, ARKit's
|
|
98
|
+
* segmentation is already temporally smoothed by the OS.
|
|
99
|
+
*
|
|
100
|
+
* @default 0.0
|
|
101
|
+
*/
|
|
102
|
+
semanticConfidenceThreshold?: number;
|
|
83
103
|
/**
|
|
84
104
|
* [iOS Only] Prefer monocular depth estimation over LiDAR.
|
|
85
105
|
* When true, monocular depth will be used even on devices with LiDAR.
|
|
@@ -479,6 +499,7 @@ export declare class ViroARSceneNavigator extends React.Component<Props, State>
|
|
|
479
499
|
_rvUpdateCloudAnchor: (anchorId: string, name: string, description: string, isPublic: boolean) => Promise<any>;
|
|
480
500
|
_rvDeleteCloudAnchor: (anchorId: string) => Promise<any>;
|
|
481
501
|
_rvFindNearbyCloudAnchors: (latitude: number, longitude: number, radius: number, limit: number) => Promise<any>;
|
|
502
|
+
_rvGetSceneAssets: (sceneId: string) => Promise<any>;
|
|
482
503
|
_rvAttachAssetToCloudAnchor: (anchorId: string, fileUrl: string, fileSize: number, name: string, assetType: string, externalUserId: string) => Promise<any>;
|
|
483
504
|
_rvRemoveAssetFromCloudAnchor: (anchorId: string, assetId: string) => Promise<any>;
|
|
484
505
|
_rvTrackCloudAnchorResolution: (anchorId: string, success: boolean, confidence: number, matchCount: number, inlierCount: number, processingTimeMs: number, platform: string, externalUserId: string) => Promise<any>;
|
|
@@ -597,6 +618,7 @@ export declare class ViroARSceneNavigator extends React.Component<Props, State>
|
|
|
597
618
|
rvAttachAssetToCloudAnchor: (anchorId: string, fileUrl: string, fileSize: number, name: string, assetType: string, externalUserId: string) => Promise<any>;
|
|
598
619
|
rvRemoveAssetFromCloudAnchor: (anchorId: string, assetId: string) => Promise<any>;
|
|
599
620
|
rvTrackCloudAnchorResolution: (anchorId: string, success: boolean, confidence: number, matchCount: number, inlierCount: number, processingTimeMs: number, platform: string, externalUserId: string) => Promise<any>;
|
|
621
|
+
rvGetSceneAssets: (sceneId: string) => Promise<any>;
|
|
600
622
|
rvUploadAsset: (filePath: string, assetType: string, fileName: string, appUserId?: string) => Promise<any>;
|
|
601
623
|
isSemanticModeSupported: () => Promise<ViroSemanticSupportResult>;
|
|
602
624
|
setSemanticModeEnabled: (enabled: boolean) => void;
|
|
@@ -648,6 +670,7 @@ export declare class ViroARSceneNavigator extends React.Component<Props, State>
|
|
|
648
670
|
rvAttachAssetToCloudAnchor: (anchorId: string, fileUrl: string, fileSize: number, name: string, assetType: string, externalUserId: string) => Promise<any>;
|
|
649
671
|
rvRemoveAssetFromCloudAnchor: (anchorId: string, assetId: string) => Promise<any>;
|
|
650
672
|
rvTrackCloudAnchorResolution: (anchorId: string, success: boolean, confidence: number, matchCount: number, inlierCount: number, processingTimeMs: number, platform: string, externalUserId: string) => Promise<any>;
|
|
673
|
+
rvGetSceneAssets: (sceneId: string) => Promise<any>;
|
|
651
674
|
rvUploadAsset: (filePath: string, assetType: string, fileName: string, appUserId?: string) => Promise<any>;
|
|
652
675
|
isSemanticModeSupported: () => Promise<ViroSemanticSupportResult>;
|
|
653
676
|
setSemanticModeEnabled: (enabled: boolean) => void;
|
|
@@ -681,6 +681,9 @@ class ViroARSceneNavigator extends React.Component {
|
|
|
681
681
|
_rvFindNearbyCloudAnchors = async (latitude, longitude, radius, limit) => {
|
|
682
682
|
return await ViroARSceneNavigatorModule.rvFindNearbyCloudAnchors((0, react_native_1.findNodeHandle)(this), latitude, longitude, radius, limit);
|
|
683
683
|
};
|
|
684
|
+
_rvGetSceneAssets = async (sceneId) => {
|
|
685
|
+
return await ViroARSceneNavigatorModule.rvGetSceneAssets((0, react_native_1.findNodeHandle)(this), sceneId);
|
|
686
|
+
};
|
|
684
687
|
_rvAttachAssetToCloudAnchor = async (anchorId, fileUrl, fileSize, name, assetType, externalUserId) => {
|
|
685
688
|
return await ViroARSceneNavigatorModule.rvAttachAssetToCloudAnchor((0, react_native_1.findNodeHandle)(this), anchorId, fileUrl, fileSize, name, assetType, externalUserId);
|
|
686
689
|
};
|
|
@@ -901,6 +904,7 @@ class ViroARSceneNavigator extends React.Component {
|
|
|
901
904
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
902
905
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
903
906
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
907
|
+
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
904
908
|
// Assets API
|
|
905
909
|
rvUploadAsset: this._rvUploadAsset,
|
|
906
910
|
// Scene Semantics API
|
|
@@ -959,6 +963,7 @@ class ViroARSceneNavigator extends React.Component {
|
|
|
959
963
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
960
964
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
961
965
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
966
|
+
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
962
967
|
// Assets API
|
|
963
968
|
rvUploadAsset: this._rvUploadAsset,
|
|
964
969
|
// Scene Semantics API
|
|
@@ -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) {
|
|
@@ -49,6 +49,25 @@ export declare function latLngToMercator(lat: number, lng: number): [number, num
|
|
|
49
49
|
* @returns [arX, arY, arZ] position in metres relative to the device
|
|
50
50
|
*/
|
|
51
51
|
export declare function gpsToArWorld(devicePose: ViroGeospatialPose, anchorLat: number, anchorLng: number, anchorAlt: number): [number, number, number];
|
|
52
|
+
export type ViroPermission = "camera" | "microphone" | "storage" | "location";
|
|
53
|
+
export interface ViroPermissionsResult {
|
|
54
|
+
camera?: boolean;
|
|
55
|
+
microphone?: boolean;
|
|
56
|
+
storage?: boolean;
|
|
57
|
+
location?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Request the specified permissions required for Viro AR to function.
|
|
61
|
+
* Omit `permissions` to request all four (camera, microphone, storage, location).
|
|
62
|
+
* Only the requested keys are present in the resolved result.
|
|
63
|
+
*/
|
|
64
|
+
export declare function requestRequiredPermissions(permissions?: ViroPermission[]): Promise<ViroPermissionsResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Check the current status of the specified permissions without prompting the user.
|
|
67
|
+
* Omit `permissions` to check all four (camera, microphone, storage, location).
|
|
68
|
+
* Only the requested keys are present in the resolved result.
|
|
69
|
+
*/
|
|
70
|
+
export declare function checkPermissions(permissions?: ViroPermission[]): Promise<ViroPermissionsResult>;
|
|
52
71
|
export interface ViroiOSArSupportResponse {
|
|
53
72
|
isARSupported: boolean;
|
|
54
73
|
}
|
|
@@ -14,6 +14,8 @@ exports.polarToCartesian = polarToCartesian;
|
|
|
14
14
|
exports.polarToCartesianActual = polarToCartesianActual;
|
|
15
15
|
exports.latLngToMercator = latLngToMercator;
|
|
16
16
|
exports.gpsToArWorld = gpsToArWorld;
|
|
17
|
+
exports.requestRequiredPermissions = requestRequiredPermissions;
|
|
18
|
+
exports.checkPermissions = checkPermissions;
|
|
17
19
|
exports.isARSupportedOnDevice = isARSupportedOnDevice;
|
|
18
20
|
/**
|
|
19
21
|
* Convert the given polar coords of the form [r, theta, phi] to cartesian
|
|
@@ -113,6 +115,38 @@ function gpsToArWorld(devicePose, anchorLat, anchorLng, anchorAlt) {
|
|
|
113
115
|
-distance * Math.cos(relBearing), // arZ
|
|
114
116
|
];
|
|
115
117
|
}
|
|
118
|
+
const ALL_PERMISSIONS = [
|
|
119
|
+
"camera",
|
|
120
|
+
"microphone",
|
|
121
|
+
"storage",
|
|
122
|
+
"location",
|
|
123
|
+
];
|
|
124
|
+
/**
|
|
125
|
+
* Request the specified permissions required for Viro AR to function.
|
|
126
|
+
* Omit `permissions` to request all four (camera, microphone, storage, location).
|
|
127
|
+
* Only the requested keys are present in the resolved result.
|
|
128
|
+
*/
|
|
129
|
+
function requestRequiredPermissions(permissions = ALL_PERMISSIONS) {
|
|
130
|
+
if (react_native_1.Platform.OS === "ios") {
|
|
131
|
+
return react_native_1.NativeModules.VRTARUtils.requestRequiredPermissions(permissions);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return react_native_1.NativeModules.VRTARSceneNavigatorModule.requestRequiredPermissions(permissions);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check the current status of the specified permissions without prompting the user.
|
|
139
|
+
* Omit `permissions` to check all four (camera, microphone, storage, location).
|
|
140
|
+
* Only the requested keys are present in the resolved result.
|
|
141
|
+
*/
|
|
142
|
+
function checkPermissions(permissions = ALL_PERMISSIONS) {
|
|
143
|
+
if (react_native_1.Platform.OS === "ios") {
|
|
144
|
+
return react_native_1.NativeModules.VRTARUtils.checkPermissions(permissions);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
return react_native_1.NativeModules.VRTARSceneNavigatorModule.checkPermissions(permissions);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
116
150
|
function isARSupportedOnDevice() {
|
|
117
151
|
return new Promise((resolve, reject) => {
|
|
118
152
|
if (react_native_1.Platform.OS == "ios") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VIRO_VERSION = "2.
|
|
1
|
+
export declare const VIRO_VERSION = "2.54.0";
|
|
@@ -11,6 +11,13 @@ type Props = ViewProps & {
|
|
|
11
11
|
format?: "RGBA8" | "RGB565";
|
|
12
12
|
steroMode?: "LeftRight" | "RightLeft" | "TopBottom" | "BottomTop" | "None";
|
|
13
13
|
isHdr?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When true, the image is rendered as a sky-effect overlay: it appears only over pixels
|
|
16
|
+
* semantically labeled as sky by ARCore/ARKit scene semantics, using alpha blending via
|
|
17
|
+
* the confidence texture for smooth boundary transitions. Requires scene semantics to be
|
|
18
|
+
* enabled on the AR session. Has no effect in VR mode. Default false.
|
|
19
|
+
*/
|
|
20
|
+
skyEffect?: boolean;
|
|
14
21
|
/**
|
|
15
22
|
* Callback triggered when we are processing the assets to be
|
|
16
23
|
* displayed in this 360 Photo (either downloading / reading from file).
|
package/dist/index.d.ts
CHANGED
|
@@ -52,10 +52,10 @@ import { ViroVRSceneNavigator } from "./components/ViroVRSceneNavigator";
|
|
|
52
52
|
import { Viro3DSceneNavigator } from "./components/Viro3DSceneNavigator";
|
|
53
53
|
import { ViroTextStyle } from "./components/Styles/ViroTextStyle";
|
|
54
54
|
import { ViroStyle } from "./components/Styles/ViroStyle";
|
|
55
|
-
import { polarToCartesian, polarToCartesianActual, isARSupportedOnDevice, ViroARSupportResponse, latLngToMercator, gpsToArWorld } from "./components/Utilities/ViroUtils";
|
|
55
|
+
import { polarToCartesian, polarToCartesianActual, isARSupportedOnDevice, requestRequiredPermissions, checkPermissions, ViroARSupportResponse, ViroPermissionsResult, ViroPermission, latLngToMercator, gpsToArWorld } from "./components/Utilities/ViroUtils";
|
|
56
56
|
import { ViroARCamera } from "./components/AR/ViroARCamera";
|
|
57
57
|
import { ViroHoverEvent, ViroClickEvent, ViroClickStateEvent, ViroTouchEvent, ViroScrollEvent, ViroSwipeEvent, ViroFuseEvent, ViroPinchEvent, ViroRotateEvent, ViroDragEvent, ViroPlatformEvent, ViroCollisionEvent, ViroPlatformInfo, ViroCameraTransformEvent, ViroPlatformUpdateEvent, ViroCameraTransform, ViroExitViroEvent, ViroErrorEvent, ViroAnimationStartEvent, ViroAnimationFinishEvent, ViroLoadStartEvent, ViroLoadEndEvent, ViroLoadErrorEvent, ViroVideoBufferStartEvent, ViroVideoBufferEndEvent, ViroVideoUpdateTimeEvent, ViroVideoErrorEvent, ViroVideoFinishEvent, ViroAnimatedComponentStartEvent, ViroAnimatedComponentFinishEvent, ViroARAnchorRemovedEvent, ViroARAnchorUpdatedEvent, ViroARAnchorFoundEvent, ViroAnchor, ViroAnchorFoundMap, ViroAnchorUpdatedMap, ViroPlaneUpdatedMap, ViroPlaneUpdatedEvent, ViroARPlaneSizes, ViroCameraARHitTestEvent, ViroCameraARHitTest, ViroARHitTestResult, ViroARPointCloudUpdateEvent, ViroARPointCloud, ViroTrackingUpdatedEvent, ViroTrackingState, ViroTrackingReason, ViroAmbientLightUpdateEvent, ViroAmbientLightInfo, ViroWorldOrigin, ViroNativeTransformUpdateEvent, ViroControllerStatusEvent, ViroControllerStatus, ViroPortalEnterEvent, ViroPortalExitEvent, ViroSoundFinishEvent, ViroPinchStateTypes, ViroClickStateTypes, ViroRotateStateTypes, ViroProvider, ViroCloudAnchorState, ViroCloudAnchorProvider, ViroCloudAnchor, ViroHostCloudAnchorResult, ViroResolveCloudAnchorResult, ViroCloudAnchorStateChangeEvent, ViroGeospatialAnchorProvider, ViroEarthTrackingState, ViroVPSAvailability, ViroGeospatialAnchorType, ViroQuaternion, ViroGeospatialPose, ViroGeospatialAnchor, ViroGeospatialSupportResult, ViroEarthTrackingStateResult, ViroGeospatialPoseResult, ViroVPSAvailabilityResult, ViroCreateGeospatialAnchorResult, ViroMonocularDepthSupportResult, ViroMonocularDepthModelAvailableResult, ViroMonocularDepthPreferenceResult } from "./components/Types/ViroEvents";
|
|
58
58
|
import { ViroSurface } from "./components/ViroSurface";
|
|
59
59
|
import { ViroSceneNavigator } from "./components/ViroSceneNavigator";
|
|
60
60
|
import { VIRO_VERSION } from "./components/Utilities/ViroVersion";
|
|
61
|
-
export { ViroARImageMarker, ViroARObjectMarker, ViroARTrackingTargets, ViroARPlane, ViroARPlaneSelector, ViroARScene, ViroARSceneNavigator, ViroBox, ViroButton, ViroCamera, ViroController, ViroDirectionalLight, ViroFlexView, ViroGeometry, ViroLightingEnvironment, ViroImage, ViroMaterials, ViroARCamera, ViroMaterialVideo, ViroNode, ViroOmniLight, ViroOrbitCamera, ViroParticleEmitter, ViroPolygon, ViroPolyline, ViroPortal, ViroPortalScene, ViroQuad, ViroScene, ViroSurface, ViroSceneNavigator, ViroSkyBox, ViroAnimations, Viro3DObject, Viro360Image, Viro360Video, ViroAnimatedImage, ViroAmbientLight, ViroAnimatedComponent, ViroSound, ViroSoundField, ViroSpatialSound, ViroSphere, ViroSpinner, ViroSpotLight, ViroText, ViroVideo, ViroVRSceneNavigator, Viro3DSceneNavigator, ViroARTrackingReasonConstants, ViroRecordingErrorConstants, ViroTrackingStateConstants, polarToCartesian, polarToCartesianActual, isARSupportedOnDevice, latLngToMercator, gpsToArWorld, ViroARSupportResponse, ViroHoverEvent, ViroClickEvent, ViroClickStateEvent, ViroClickStateTypes, ViroTouchEvent, ViroScrollEvent, ViroSwipeEvent, ViroFuseEvent, ViroPinchEvent, ViroPinchStateTypes, ViroRotateEvent, ViroRotateStateTypes, ViroDragEvent, ViroPlatformEvent, ViroCollisionEvent, ViroPlatformInfo, ViroCameraTransformEvent, ViroPlatformUpdateEvent, ViroCameraTransform, ViroExitViroEvent, ViroErrorEvent, ViroAnimationStartEvent, ViroAnimationFinishEvent, ViroLoadStartEvent, ViroLoadEndEvent, ViroLoadErrorEvent, ViroVideoBufferStartEvent, ViroVideoBufferEndEvent, ViroVideoUpdateTimeEvent, ViroVideoErrorEvent, ViroVideoFinishEvent, ViroAnimatedComponentStartEvent, ViroAnimatedComponentFinishEvent, ViroARAnchorRemovedEvent, ViroARAnchorUpdatedEvent, ViroARAnchorFoundEvent, ViroAnchor, ViroAnchorFoundMap, ViroAnchorUpdatedMap, ViroPlaneUpdatedMap, ViroPlaneUpdatedEvent, ViroARPlaneSizes, ViroCameraARHitTestEvent, ViroCameraARHitTest, ViroARHitTestResult, ViroARPointCloudUpdateEvent, ViroARPointCloud, ViroTrackingUpdatedEvent, ViroTrackingState, ViroTrackingReason, ViroAmbientLightUpdateEvent, ViroAmbientLightInfo, ViroWorldOrigin, ViroNativeTransformUpdateEvent, ViroControllerStatusEvent, ViroControllerStatus, ViroPortalEnterEvent, ViroPortalExitEvent, ViroSoundFinishEvent, ViroTextStyle, ViroStyle, ViroMaterial, ViroShaderModifiers, ViroShaderUniform, ViroShaderModifier, VIRO_VERSION, ViroProvider, ViroCloudAnchorState, ViroCloudAnchorProvider, ViroCloudAnchor, ViroHostCloudAnchorResult, ViroResolveCloudAnchorResult, ViroCloudAnchorStateChangeEvent, ViroGeospatialAnchorProvider, ViroEarthTrackingState, ViroVPSAvailability, ViroGeospatialAnchorType, ViroQuaternion, ViroGeospatialPose, ViroGeospatialAnchor, ViroGeospatialSupportResult, ViroEarthTrackingStateResult, ViroGeospatialPoseResult, ViroVPSAvailabilityResult, ViroCreateGeospatialAnchorResult, ViroMonocularDepthSupportResult, ViroMonocularDepthModelAvailableResult, ViroMonocularDepthPreferenceResult, };
|
|
61
|
+
export { ViroARImageMarker, ViroARObjectMarker, ViroARTrackingTargets, ViroARPlane, ViroARPlaneSelector, ViroARScene, ViroARSceneNavigator, ViroBox, ViroButton, ViroCamera, ViroController, ViroDirectionalLight, ViroFlexView, ViroGeometry, ViroLightingEnvironment, ViroImage, ViroMaterials, ViroARCamera, ViroMaterialVideo, ViroNode, ViroOmniLight, ViroOrbitCamera, ViroParticleEmitter, ViroPolygon, ViroPolyline, ViroPortal, ViroPortalScene, ViroQuad, ViroScene, ViroSurface, ViroSceneNavigator, ViroSkyBox, ViroAnimations, Viro3DObject, Viro360Image, Viro360Video, ViroAnimatedImage, ViroAmbientLight, ViroAnimatedComponent, ViroSound, ViroSoundField, ViroSpatialSound, ViroSphere, ViroSpinner, ViroSpotLight, ViroText, ViroVideo, ViroVRSceneNavigator, Viro3DSceneNavigator, ViroARTrackingReasonConstants, ViroRecordingErrorConstants, ViroTrackingStateConstants, polarToCartesian, polarToCartesianActual, isARSupportedOnDevice, requestRequiredPermissions, checkPermissions, latLngToMercator, gpsToArWorld, ViroARSupportResponse, ViroPermissionsResult, ViroPermission, ViroHoverEvent, ViroClickEvent, ViroClickStateEvent, ViroClickStateTypes, ViroTouchEvent, ViroScrollEvent, ViroSwipeEvent, ViroFuseEvent, ViroPinchEvent, ViroPinchStateTypes, ViroRotateEvent, ViroRotateStateTypes, ViroDragEvent, ViroPlatformEvent, ViroCollisionEvent, ViroPlatformInfo, ViroCameraTransformEvent, ViroPlatformUpdateEvent, ViroCameraTransform, ViroExitViroEvent, ViroErrorEvent, ViroAnimationStartEvent, ViroAnimationFinishEvent, ViroLoadStartEvent, ViroLoadEndEvent, ViroLoadErrorEvent, ViroVideoBufferStartEvent, ViroVideoBufferEndEvent, ViroVideoUpdateTimeEvent, ViroVideoErrorEvent, ViroVideoFinishEvent, ViroAnimatedComponentStartEvent, ViroAnimatedComponentFinishEvent, ViroARAnchorRemovedEvent, ViroARAnchorUpdatedEvent, ViroARAnchorFoundEvent, ViroAnchor, ViroAnchorFoundMap, ViroAnchorUpdatedMap, ViroPlaneUpdatedMap, ViroPlaneUpdatedEvent, ViroARPlaneSizes, ViroCameraARHitTestEvent, ViroCameraARHitTest, ViroARHitTestResult, ViroARPointCloudUpdateEvent, ViroARPointCloud, ViroTrackingUpdatedEvent, ViroTrackingState, ViroTrackingReason, ViroAmbientLightUpdateEvent, ViroAmbientLightInfo, ViroWorldOrigin, ViroNativeTransformUpdateEvent, ViroControllerStatusEvent, ViroControllerStatus, ViroPortalEnterEvent, ViroPortalExitEvent, ViroSoundFinishEvent, ViroTextStyle, ViroStyle, ViroMaterial, ViroShaderModifiers, ViroShaderUniform, ViroShaderModifier, VIRO_VERSION, ViroProvider, ViroCloudAnchorState, ViroCloudAnchorProvider, ViroCloudAnchor, ViroHostCloudAnchorResult, ViroResolveCloudAnchorResult, ViroCloudAnchorStateChangeEvent, ViroGeospatialAnchorProvider, ViroEarthTrackingState, ViroVPSAvailability, ViroGeospatialAnchorType, ViroQuaternion, ViroGeospatialPose, ViroGeospatialAnchor, ViroGeospatialSupportResult, ViroEarthTrackingStateResult, ViroGeospatialPoseResult, ViroVPSAvailabilityResult, ViroCreateGeospatialAnchorResult, ViroMonocularDepthSupportResult, ViroMonocularDepthModelAvailableResult, ViroMonocularDepthPreferenceResult, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ViroARTrackingReasonConstants = exports.Viro3DSceneNavigator = exports.ViroVRSceneNavigator = exports.ViroVideo = exports.ViroText = exports.ViroSpotLight = exports.ViroSpinner = exports.ViroSphere = exports.ViroSpatialSound = exports.ViroSoundField = exports.ViroSound = exports.ViroAnimatedComponent = exports.ViroAmbientLight = exports.ViroAnimatedImage = exports.Viro360Video = exports.Viro360Image = exports.Viro3DObject = exports.ViroAnimations = exports.ViroSkyBox = exports.ViroSceneNavigator = exports.ViroSurface = exports.ViroScene = exports.ViroQuad = exports.ViroPortalScene = exports.ViroPortal = exports.ViroPolyline = exports.ViroPolygon = exports.ViroParticleEmitter = exports.ViroOrbitCamera = exports.ViroOmniLight = exports.ViroNode = exports.ViroMaterialVideo = exports.ViroARCamera = exports.ViroMaterials = exports.ViroImage = exports.ViroLightingEnvironment = exports.ViroGeometry = exports.ViroFlexView = exports.ViroDirectionalLight = exports.ViroController = exports.ViroCamera = exports.ViroButton = exports.ViroBox = exports.ViroARSceneNavigator = exports.ViroARScene = exports.ViroARPlaneSelector = exports.ViroARPlane = exports.ViroARTrackingTargets = exports.ViroARObjectMarker = exports.ViroARImageMarker = void 0;
|
|
4
|
-
exports.VIRO_VERSION = exports.ViroRotateStateTypes = exports.ViroPinchStateTypes = exports.ViroClickStateTypes = exports.gpsToArWorld = exports.latLngToMercator = exports.isARSupportedOnDevice = exports.polarToCartesianActual = exports.polarToCartesian = exports.ViroTrackingStateConstants = exports.ViroRecordingErrorConstants = void 0;
|
|
4
|
+
exports.VIRO_VERSION = exports.ViroRotateStateTypes = exports.ViroPinchStateTypes = exports.ViroClickStateTypes = exports.gpsToArWorld = exports.latLngToMercator = exports.checkPermissions = exports.requestRequiredPermissions = exports.isARSupportedOnDevice = exports.polarToCartesianActual = exports.polarToCartesian = exports.ViroTrackingStateConstants = exports.ViroRecordingErrorConstants = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* Copyright (c) 2016-present, Viro Media, Inc.
|
|
7
7
|
* All rights reserved.
|
|
@@ -107,6 +107,8 @@ const ViroUtils_1 = require("./components/Utilities/ViroUtils");
|
|
|
107
107
|
Object.defineProperty(exports, "polarToCartesian", { enumerable: true, get: function () { return ViroUtils_1.polarToCartesian; } });
|
|
108
108
|
Object.defineProperty(exports, "polarToCartesianActual", { enumerable: true, get: function () { return ViroUtils_1.polarToCartesianActual; } });
|
|
109
109
|
Object.defineProperty(exports, "isARSupportedOnDevice", { enumerable: true, get: function () { return ViroUtils_1.isARSupportedOnDevice; } });
|
|
110
|
+
Object.defineProperty(exports, "requestRequiredPermissions", { enumerable: true, get: function () { return ViroUtils_1.requestRequiredPermissions; } });
|
|
111
|
+
Object.defineProperty(exports, "checkPermissions", { enumerable: true, get: function () { return ViroUtils_1.checkPermissions; } });
|
|
110
112
|
Object.defineProperty(exports, "latLngToMercator", { enumerable: true, get: function () { return ViroUtils_1.latLngToMercator; } });
|
|
111
113
|
Object.defineProperty(exports, "gpsToArWorld", { enumerable: true, get: function () { return ViroUtils_1.gpsToArWorld; } });
|
|
112
114
|
const ViroARCamera_1 = require("./components/AR/ViroARCamera");
|
|
@@ -118,6 +118,17 @@ export interface ViroConfigurationOptions {
|
|
|
118
118
|
* DEFAULTS TO: false (unless provider is "arcore")
|
|
119
119
|
*/
|
|
120
120
|
includeARCore?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether to include the ARCore/Semantics pod for scene semantic segmentation.
|
|
123
|
+
* When true, adds the ARCore/Semantics pod (and ARCore/CloudAnchors as a base dependency)
|
|
124
|
+
* without enabling cloud anchors or geospatial features.
|
|
125
|
+
*
|
|
126
|
+
* Use this when you want semantic masking (ViroMaterial.semanticMask) but do NOT need
|
|
127
|
+
* cloud anchors or geospatial anchors. If includeARCore is already true, this has no effect.
|
|
128
|
+
*
|
|
129
|
+
* DEFAULTS TO: false
|
|
130
|
+
*/
|
|
131
|
+
includeSemantics?: boolean;
|
|
121
132
|
};
|
|
122
133
|
android?: {
|
|
123
134
|
xRMode?: XrMode[];
|
|
@@ -18,6 +18,7 @@ const withViroPods = (config) => {
|
|
|
18
18
|
let geospatialAnchorProvider;
|
|
19
19
|
let iosLinkage;
|
|
20
20
|
let includeARCore;
|
|
21
|
+
let includeSemantics;
|
|
21
22
|
if (Array.isArray(config.plugins)) {
|
|
22
23
|
const pluginConfig = config?.plugins?.find((plugin) => Array.isArray(plugin) && plugin[0] === "@reactvision/react-viro");
|
|
23
24
|
if (Array.isArray(pluginConfig) && pluginConfig.length > 1) {
|
|
@@ -30,6 +31,7 @@ const withViroPods = (config) => {
|
|
|
30
31
|
geospatialAnchorProvider = legacyOpts.geospatialAnchorProvider ?? options.provider ?? defaultProvider;
|
|
31
32
|
iosLinkage = options.iosLinkage;
|
|
32
33
|
includeARCore = options.ios?.includeARCore;
|
|
34
|
+
includeSemantics = options.ios?.includeSemantics;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
fs_1.default.readFile(`${root}/Podfile`, "utf-8", (err, data) => {
|
|
@@ -44,36 +46,38 @@ const withViroPods = (config) => {
|
|
|
44
46
|
` # Automatically includes Fabric components when RCT_NEW_ARCH_ENABLED=1\n` +
|
|
45
47
|
` pod 'ViroReact', :path => '../node_modules/@reactvision/react-viro/ios'\n` +
|
|
46
48
|
` pod 'ViroKit', :path => '../node_modules/@reactvision/react-viro/ios/dist/ViroRenderer/'`;
|
|
47
|
-
// Add ARCore pods if enabled (explicitly via includeARCore or implicitly via
|
|
49
|
+
// Add ARCore pods if enabled (explicitly via includeARCore/includeSemantics or implicitly via providers)
|
|
48
50
|
// ViroKit.podspec declares these as weak_frameworks, making ARCore optional at runtime
|
|
49
51
|
const needsARCoreForFeatures = cloudAnchorProvider === "arcore" || geospatialAnchorProvider === "arcore";
|
|
50
52
|
const shouldIncludeARCore = includeARCore === true || needsARCoreForFeatures;
|
|
51
|
-
|
|
53
|
+
const shouldIncludeSemantics = shouldIncludeARCore || includeSemantics === true;
|
|
54
|
+
if (shouldIncludeSemantics) {
|
|
52
55
|
viroPods +=
|
|
53
56
|
`\n\n # ARCore SDK - Cloud Anchors, Geospatial, and Scene Semantics API\n` +
|
|
54
57
|
` # ViroKit uses weak linking for these frameworks, making ARCore optional at runtime.\n` +
|
|
55
58
|
` # ViroKit checks availability using NSClassFromString and gracefully degrades if not present.\n` +
|
|
56
59
|
` pod 'ARCore/CloudAnchors', '~> 1.51.0'`;
|
|
57
|
-
// Add Geospatial pod if geospatial is enabled or
|
|
60
|
+
// Add Geospatial pod if geospatial is enabled or full ARCore inclusion
|
|
58
61
|
if (geospatialAnchorProvider === "arcore" || includeARCore === true) {
|
|
59
62
|
viroPods +=
|
|
60
63
|
`\n pod 'ARCore/Geospatial', '~> 1.51.0'`;
|
|
61
64
|
}
|
|
62
65
|
// Add Semantics pod for Scene Semantics API (ML-based scene understanding)
|
|
66
|
+
// Included whenever ARCore is present OR includeSemantics: true
|
|
63
67
|
viroPods +=
|
|
64
68
|
`\n pod 'ARCore/Semantics', '~> 1.51.0'`;
|
|
65
69
|
}
|
|
66
70
|
// Add use_frameworks! if configured
|
|
67
|
-
// User's iosLinkage setting is respected; if not set and ARCore is enabled, default to dynamic
|
|
68
|
-
const effectiveLinkage = iosLinkage || (
|
|
71
|
+
// User's iosLinkage setting is respected; if not set and ARCore/Semantics is enabled, default to dynamic
|
|
72
|
+
const effectiveLinkage = iosLinkage || (shouldIncludeSemantics ? "dynamic" : undefined);
|
|
69
73
|
if (effectiveLinkage) {
|
|
70
74
|
// Insert use_frameworks! before the target block
|
|
71
75
|
let linkageComment;
|
|
72
|
-
if (
|
|
76
|
+
if (shouldIncludeSemantics && effectiveLinkage === "static") {
|
|
73
77
|
// Warn user that static linkage may not work with ARCore
|
|
74
78
|
linkageComment = `# WARNING: ARCore SDK typically requires dynamic frameworks.\n# Static linkage is set but may cause build issues with ARCore pods.`;
|
|
75
79
|
}
|
|
76
|
-
else if (
|
|
80
|
+
else if (shouldIncludeSemantics) {
|
|
77
81
|
linkageComment = `# Framework linkage: ${effectiveLinkage} (ARCore requires dynamic frameworks)`;
|
|
78
82
|
}
|
|
79
83
|
else {
|
|
@@ -231,7 +235,7 @@ const withDefaultInfoPlist = (config, _props) => {
|
|
|
231
235
|
};
|
|
232
236
|
exports.withDefaultInfoPlist = withDefaultInfoPlist;
|
|
233
237
|
const withViroIos = (config, props) => {
|
|
234
|
-
(0, config_plugins_1.withPlugins)(config, [[withViroPods, props]]);
|
|
238
|
+
config = (0, config_plugins_1.withPlugins)(config, [[withViroPods, props]]);
|
|
235
239
|
(0, exports.withDefaultInfoPlist)(config, props);
|
|
236
240
|
withEnabledBitcode(config);
|
|
237
241
|
withExcludedSimulatorArchitectures(config);
|
package/index.ts
CHANGED
|
@@ -66,7 +66,11 @@ import {
|
|
|
66
66
|
polarToCartesian,
|
|
67
67
|
polarToCartesianActual,
|
|
68
68
|
isARSupportedOnDevice,
|
|
69
|
+
requestRequiredPermissions,
|
|
70
|
+
checkPermissions,
|
|
69
71
|
ViroARSupportResponse,
|
|
72
|
+
ViroPermissionsResult,
|
|
73
|
+
ViroPermission,
|
|
70
74
|
latLngToMercator,
|
|
71
75
|
gpsToArWorld,
|
|
72
76
|
} from "./components/Utilities/ViroUtils";
|
|
@@ -219,10 +223,14 @@ export {
|
|
|
219
223
|
polarToCartesian,
|
|
220
224
|
polarToCartesianActual,
|
|
221
225
|
isARSupportedOnDevice,
|
|
226
|
+
requestRequiredPermissions,
|
|
227
|
+
checkPermissions,
|
|
222
228
|
latLngToMercator,
|
|
223
229
|
gpsToArWorld,
|
|
224
230
|
// Types
|
|
225
231
|
ViroARSupportResponse,
|
|
232
|
+
ViroPermissionsResult,
|
|
233
|
+
ViroPermission,
|
|
226
234
|
ViroHoverEvent,
|
|
227
235
|
ViroClickEvent,
|
|
228
236
|
ViroClickStateEvent,
|
package/ios/ViroReact.podspec
CHANGED
|
@@ -40,7 +40,8 @@ Pod::Spec.new do |s|
|
|
|
40
40
|
s.dependency 'React-FabricComponents'
|
|
41
41
|
|
|
42
42
|
# Fabric-specific build configuration
|
|
43
|
-
s.pod_target_xcconfig = {
|
|
43
|
+
s.pod_target_xcconfig = {
|
|
44
|
+
'SWIFT_VERSION' => '5.0',
|
|
44
45
|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
|
45
46
|
'HEADER_SEARCH_PATHS' => [
|
|
46
47
|
'"$(PODS_TARGET_SRCROOT)/ViroReact"',
|
package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreCoreMLSemanticsResources.bundle/Info.plist
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -319,7 +319,21 @@ public:
|
|
|
319
319
|
texture are updated after each call to updateFrame().
|
|
320
320
|
*/
|
|
321
321
|
virtual std::shared_ptr<VROTexture> getCameraBackgroundTexture() = 0;
|
|
322
|
-
|
|
322
|
+
|
|
323
|
+
/*
|
|
324
|
+
Get the semantic texture for the current frame. Each pixel is a VROSemanticLabel
|
|
325
|
+
value (0-11, R8 format). Returns nullptr if semantic mode is not enabled or
|
|
326
|
+
the platform does not support it.
|
|
327
|
+
*/
|
|
328
|
+
virtual std::shared_ptr<VROTexture> getSemanticTexture() { return nullptr; }
|
|
329
|
+
|
|
330
|
+
/*
|
|
331
|
+
Get the confidence texture for the current frame. Each pixel is a confidence value
|
|
332
|
+
(R8, 0=uncertain, 255=certain) corresponding to the label in getSemanticTexture().
|
|
333
|
+
Returns nullptr if not supported; callers should substitute a 1×1 white texture.
|
|
334
|
+
*/
|
|
335
|
+
virtual std::shared_ptr<VROTexture> getSemanticConfidenceTexture() { return nullptr; }
|
|
336
|
+
|
|
323
337
|
/*
|
|
324
338
|
Invoke when the viewport changes. The AR engine may adjust its camera
|
|
325
339
|
background and projection matrices in response to a viewport change.
|
|
@@ -557,6 +571,11 @@ public:
|
|
|
557
571
|
std::function<void(bool success, std::string error)> callback) {
|
|
558
572
|
if (callback) callback(false, "Not supported");
|
|
559
573
|
}
|
|
574
|
+
virtual void rvGetSceneAssets(
|
|
575
|
+
const std::string& sceneId,
|
|
576
|
+
std::function<void(bool success, std::string jsonData, std::string error)> callback) {
|
|
577
|
+
if (callback) callback(false, "", "Not supported");
|
|
578
|
+
}
|
|
560
579
|
|
|
561
580
|
// ========================================================================
|
|
562
581
|
// ReactVision Geospatial CRUD API
|
|
@@ -90,6 +90,8 @@ public:
|
|
|
90
90
|
std::unique_ptr<VROARFrame> &updateFrame();
|
|
91
91
|
std::unique_ptr<VROARFrame> &getLastFrame();
|
|
92
92
|
std::shared_ptr<VROTexture> getCameraBackgroundTexture();
|
|
93
|
+
std::shared_ptr<VROTexture> getSemanticTexture() override;
|
|
94
|
+
std::shared_ptr<VROTexture> getSemanticConfidenceTexture() override;
|
|
93
95
|
|
|
94
96
|
void setViewport(VROViewport viewport);
|
|
95
97
|
void setOrientation(VROCameraOrientation orientation);
|
|
@@ -195,6 +197,8 @@ public:
|
|
|
195
197
|
double confidence, int matchCount, int inlierCount, int processingTimeMs,
|
|
196
198
|
const std::string& platform, const std::string& externalUserId,
|
|
197
199
|
std::function<void(bool, std::string)> callback) override;
|
|
200
|
+
void rvGetSceneAssets(const std::string& sceneId,
|
|
201
|
+
std::function<void(bool, std::string, std::string)> callback) override;
|
|
198
202
|
|
|
199
203
|
// Scene Semantics API
|
|
200
204
|
bool isSemanticModeSupported() const override;
|
|
@@ -326,6 +330,14 @@ private:
|
|
|
326
330
|
Video texture cache used for transferring camera content to OpenGL.
|
|
327
331
|
*/
|
|
328
332
|
std::shared_ptr<VROVideoTextureCacheOpenGL> _videoTextureCache;
|
|
333
|
+
|
|
334
|
+
/*
|
|
335
|
+
Fallback 1×1 all-white confidence texture (conf=1.0 everywhere).
|
|
336
|
+
Returned by getSemanticConfidenceTexture() because the ARCore iOS SDK does not
|
|
337
|
+
expose a per-pixel confidence image. The result is hard alpha edges (no soft blend)
|
|
338
|
+
on iOS, identical to the previous discard behaviour.
|
|
339
|
+
*/
|
|
340
|
+
std::shared_ptr<VROTexture> _defaultConfidenceTexture;
|
|
329
341
|
|
|
330
342
|
/*
|
|
331
343
|
Update the VROARAnchor with the transforms in the given ARAnchor.
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
#include "VROMaterial.h"
|
|
38
38
|
#include "VROModelIOUtil.h"
|
|
39
39
|
#include "VROByteBuffer.h"
|
|
40
|
+
#include "VROVector3f.h"
|
|
41
|
+
#include "VROQuaternion.h"
|
|
40
42
|
|
|
41
43
|
class VROMorpher;
|
|
42
44
|
class VRONode;
|
|
@@ -143,6 +145,7 @@ private:
|
|
|
143
145
|
std::map<int, std::shared_ptr<VROMorpher>> &morphers,
|
|
144
146
|
std::shared_ptr<VRODriver> driver);
|
|
145
147
|
static std::string getMorphTargetName(const tinygltf::Model &gModel,
|
|
148
|
+
const tinygltf::Mesh &gMesh,
|
|
146
149
|
const tinygltf::Primitive &gPrimtive, int targetIndex);
|
|
147
150
|
|
|
148
151
|
static void injectGLTF(std::shared_ptr<VRONode> gltfNode, std::shared_ptr<VRONode> rootNode,
|
|
@@ -213,6 +216,7 @@ private:
|
|
|
213
216
|
const tinygltf::Skin &skin,
|
|
214
217
|
std::vector<VROMatrix4f> &invBindTransformsOut);
|
|
215
218
|
static void clearCachedData();
|
|
219
|
+
static void injectBindPoseAnimations();
|
|
216
220
|
|
|
217
221
|
/*
|
|
218
222
|
As multiple mesh attributes may point to the same texture or data arrays when loading a
|
|
@@ -240,6 +244,24 @@ private:
|
|
|
240
244
|
static std::map<int, std::shared_ptr<VROGeometrySource>> _meshBoneIndices;
|
|
241
245
|
static std::map<int, std::shared_ptr<VROGeometrySource>> _meshBoneWeights;
|
|
242
246
|
|
|
247
|
+
/*
|
|
248
|
+
Maps each glTF node index to its parent node index. Needed to walk up the scene graph
|
|
249
|
+
for multi-skin models where a skin's root joint has non-joint ancestors (e.g. a visor
|
|
250
|
+
skin whose root is the Neck joint, whose ancestors Hips/Spine are only in the body skin).
|
|
251
|
+
Populated in processSkinner(), cleared in clearCachedData().
|
|
252
|
+
*/
|
|
253
|
+
static std::map<int, int> _nodeParentMap;
|
|
254
|
+
|
|
255
|
+
/*
|
|
256
|
+
Maps each skin index to the set of node indices that are ancestors of that skin's mesh
|
|
257
|
+
node (the glTF node that has gNode.skin == skinIndex). These ancestors are already applied
|
|
258
|
+
by Viro's renderer as the mesh node's modelMatrix, so the ancestor walk in
|
|
259
|
+
processSkeletalTransformsForFrame must stop before including them to avoid double-applying
|
|
260
|
+
transforms (e.g. Character's scale=0.01 being applied twice → model becomes invisible).
|
|
261
|
+
Populated in processSkinner(), cleared in clearCachedData().
|
|
262
|
+
*/
|
|
263
|
+
static std::map<int, std::set<int>> _skinMeshAncestors;
|
|
264
|
+
|
|
243
265
|
/*
|
|
244
266
|
Cached maps of nodeIndexes to it's corresponding animations. These caches are cleared
|
|
245
267
|
out after the parsing of a single gLTF model. Note that _nodeKeyFrameAnims is of the form:
|
|
@@ -248,6 +270,18 @@ private:
|
|
|
248
270
|
static std::map<int, std::map<int, std::vector<std::shared_ptr<VROKeyframeAnimation>>>> _nodeKeyFrameAnims;
|
|
249
271
|
static std::map<int, std::vector<std::shared_ptr<VROSkeletalAnimation>>> _skinSkeletalAnims;
|
|
250
272
|
|
|
273
|
+
/*
|
|
274
|
+
Per-node VRONode references and bind-pose TRS, populated during processNode for any node
|
|
275
|
+
that has keyframe animations. Used by injectBindPoseAnimations() to create single-frame
|
|
276
|
+
bind-pose reset animations for animation names a node doesn't participate in.
|
|
277
|
+
Without these, switching animations leaves non-driven nodes at the previous animation's
|
|
278
|
+
final pose, causing visible mesh disassembly.
|
|
279
|
+
*/
|
|
280
|
+
static std::map<int, std::shared_ptr<VRONode>> _nodeGLTFMap;
|
|
281
|
+
static std::map<int, VROVector3f> _nodeBindPos;
|
|
282
|
+
static std::map<int, VROVector3f> _nodeBindScale;
|
|
283
|
+
static std::map<int, VROQuaternion> _nodeBindRot;
|
|
284
|
+
|
|
251
285
|
/*
|
|
252
286
|
Returns the local transform of the node index retried from the gltf model.
|
|
253
287
|
*/
|
|
@@ -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;
|
|
@@ -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,6 +265,20 @@ 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
|
|
|
@@ -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
|
/*
|
|
Binary file
|
|
@@ -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
|
+
/private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.5.188.0.TTgSDB/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
|
|
Binary file
|
|
@@ -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,8 @@ 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)rvGetSceneAssets:(NSString *)sceneId
|
|
212
|
+
completionHandler:(void (^)(BOOL success, NSArray *assets, NSString *error))completionHandler;
|
|
209
213
|
- (void)rvAttachAssetToCloudAnchor:(NSString *)anchorId
|
|
210
214
|
fileUrl:(NSString *)fileUrl
|
|
211
215
|
fileSize:(int64_t)fileSize
|
|
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.
|
|
6
|
+
"version": "2.54.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": "
|
|
31
|
-
"react-native": "
|
|
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": "
|
|
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.
|
|
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.
|
|
78
|
+
"@types/react": "~19.2.10",
|
|
79
79
|
"@types/react-native": "^0.73.0",
|
|
80
80
|
"babel-jest": "^29.7.0",
|
|
81
|
-
"expo": "~
|
|
81
|
+
"expo": "~55.0.8",
|
|
82
82
|
"jest": "^29.7.0",
|
|
83
|
-
"react-native": "~0.
|
|
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"
|