@reactvision/react-viro 2.53.0 → 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/components/Viro3DObject.tsx +7 -1
- 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/components/Viro3DObject.d.ts +7 -1
- 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 +49 -4
- 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
|
@@ -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;
|
|
@@ -119,7 +121,7 @@ private:
|
|
|
119
121
|
static bool processCamera(const tinygltf::Model &gModel, std::shared_ptr<VRONode> &node, int cameraIndex);
|
|
120
122
|
static bool processLight(const tinygltf::Model &gModel, std::shared_ptr<VRONode> &node, int lightIndex);
|
|
121
123
|
static bool processMesh(const tinygltf::Model &gModel, std::shared_ptr<VRONode> &node, const tinygltf::Mesh &gMesh,
|
|
122
|
-
std::shared_ptr<VRODriver> driver);
|
|
124
|
+
int meshIndex, std::shared_ptr<VRODriver> driver);
|
|
123
125
|
static bool processSkin(const tinygltf::Model &gModel, std::shared_ptr<VRONode> &node, int skinIndex);
|
|
124
126
|
static bool processVertexElement(const tinygltf::Model &gModel, const tinygltf::Primitive &gPrimitive,
|
|
125
127
|
std::vector<std::shared_ptr<VROGeometryElement>> &element);
|
|
@@ -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,
|
|
@@ -186,7 +189,8 @@ private:
|
|
|
186
189
|
static bool processKeyFrameAnimations(const tinygltf::Model &gModel,
|
|
187
190
|
std::map<int, std::map<int, std::vector<int>>> &gltfAnimatedNodes);
|
|
188
191
|
static void flattenSkeletalKeyframeAnimations(
|
|
189
|
-
std::map<int, std::pair<int, std::vector<int>>> &skeletalAnimToNodeSkinPair
|
|
192
|
+
std::map<int, std::pair<int, std::vector<int>>> &skeletalAnimToNodeSkinPair,
|
|
193
|
+
int skinIndex);
|
|
190
194
|
static std::shared_ptr<VROKeyframeAnimation> convertChannelToKeyFrameAnimation(
|
|
191
195
|
const tinygltf::Model &gModel,
|
|
192
196
|
const tinygltf::Animation &anim,
|
|
@@ -195,9 +199,11 @@ private:
|
|
|
195
199
|
std::string channelProperty,
|
|
196
200
|
int channelTarget,
|
|
197
201
|
const tinygltf::AnimationSampler &gChannelSampler,
|
|
198
|
-
std::vector<std::unique_ptr<VROKeyframeAnimationFrame>> &framesOut
|
|
202
|
+
std::vector<std::unique_ptr<VROKeyframeAnimationFrame>> &framesOut,
|
|
203
|
+
float animDuration = 1.0f);
|
|
204
|
+
// skeletalAnimToSkinToNodeMap: animIndex → vector of (skinIndex, animatedJointNodeIndices)
|
|
199
205
|
static bool processSkeletalAnimation(const tinygltf::Model &gModel,
|
|
200
|
-
std::map<int, std::pair<int, std::vector<int
|
|
206
|
+
std::map<int, std::vector<std::pair<int, std::vector<int>>>> &skeletalAnimToSkinToNodeMap);
|
|
201
207
|
static bool processSkeletalTransformsForFrame(const tinygltf::Model &gModel,
|
|
202
208
|
int skin,
|
|
203
209
|
int animation,
|
|
@@ -210,6 +216,7 @@ private:
|
|
|
210
216
|
const tinygltf::Skin &skin,
|
|
211
217
|
std::vector<VROMatrix4f> &invBindTransformsOut);
|
|
212
218
|
static void clearCachedData();
|
|
219
|
+
static void injectBindPoseAnimations();
|
|
213
220
|
|
|
214
221
|
/*
|
|
215
222
|
As multiple mesh attributes may point to the same texture or data arrays when loading a
|
|
@@ -229,6 +236,32 @@ private:
|
|
|
229
236
|
static std::map<int, std::shared_ptr<VROSkinner>> _skinMap;
|
|
230
237
|
static std::map<int, int> _skinIndexToSkeletonRootJoint;
|
|
231
238
|
|
|
239
|
+
/*
|
|
240
|
+
Per-mesh bone attribute sources cached during processMesh so that processNode can wire them
|
|
241
|
+
into the VROSkinner once both mesh geometry and skin data are available.
|
|
242
|
+
Keyed by glTF mesh index.
|
|
243
|
+
*/
|
|
244
|
+
static std::map<int, std::shared_ptr<VROGeometrySource>> _meshBoneIndices;
|
|
245
|
+
static std::map<int, std::shared_ptr<VROGeometrySource>> _meshBoneWeights;
|
|
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
|
+
|
|
232
265
|
/*
|
|
233
266
|
Cached maps of nodeIndexes to it's corresponding animations. These caches are cleared
|
|
234
267
|
out after the parsing of a single gLTF model. Note that _nodeKeyFrameAnims is of the form:
|
|
@@ -237,6 +270,18 @@ private:
|
|
|
237
270
|
static std::map<int, std::map<int, std::vector<std::shared_ptr<VROKeyframeAnimation>>>> _nodeKeyFrameAnims;
|
|
238
271
|
static std::map<int, std::vector<std::shared_ptr<VROSkeletalAnimation>>> _skinSkeletalAnims;
|
|
239
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
|
+
|
|
240
285
|
/*
|
|
241
286
|
Returns the local transform of the node index retried from the gltf model.
|
|
242
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"
|