@reactvision/react-viro 2.55.0 → 2.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/android/react_viro/react_viro-release.aar +0 -0
- package/android/viro_renderer/viro_renderer-release.aar +0 -0
- package/components/AR/ViroARScene.tsx +17 -0
- package/components/AR/ViroARSceneNavigator.tsx +33 -0
- package/components/Utilities/StreamingAudioManager.ts +73 -0
- package/components/Utilities/ViroVersion.ts +1 -1
- package/components/ViroCameraTexture.tsx +230 -0
- package/components/ViroGameLoop.tsx +74 -0
- package/components/ViroGameLoopUtils.ts +52 -0
- package/components/ViroObjectDetector.tsx +222 -0
- package/components/ViroVirtualButton.tsx +101 -0
- package/components/ViroVirtualJoystick.tsx +126 -0
- package/components/hooks/useGameLoop.ts +78 -0
- package/dist/components/AR/ViroARScene.d.ts +12 -0
- package/dist/components/AR/ViroARScene.js +8 -1
- package/dist/components/AR/ViroARSceneNavigator.d.ts +30 -0
- package/dist/components/Utilities/StreamingAudioManager.d.ts +22 -0
- package/dist/components/Utilities/StreamingAudioManager.js +45 -0
- package/dist/components/Utilities/ViroVersion.d.ts +1 -1
- package/dist/components/Utilities/ViroVersion.js +1 -1
- package/dist/components/ViroCameraTexture.d.ts +137 -0
- package/dist/components/ViroCameraTexture.js +170 -0
- package/dist/components/ViroGameLoop.d.ts +31 -0
- package/dist/components/ViroGameLoop.js +31 -0
- package/dist/components/ViroGameLoopUtils.d.ts +26 -0
- package/dist/components/ViroGameLoopUtils.js +44 -0
- package/dist/components/ViroObjectDetector.d.ts +138 -0
- package/dist/components/ViroObjectDetector.js +85 -0
- package/dist/components/ViroVirtualButton.d.ts +76 -0
- package/dist/components/ViroVirtualButton.js +62 -0
- package/dist/components/ViroVirtualJoystick.d.ts +85 -0
- package/dist/components/ViroVirtualJoystick.js +72 -0
- package/dist/components/hooks/useGameLoop.d.ts +34 -0
- package/dist/components/hooks/useGameLoop.js +63 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +20 -2
- package/dist/plugins/withViro.js +2 -15
- package/dist/plugins/withViroAndroid.js +52 -15
- package/dist/plugins/withViroIos.js +0 -6
- package/index.ts +21 -0
- package/ios/ViroReact.podspec +25 -6
- 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/VROARDepthMesh.h +9 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARFrame.h +33 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARFrameiOS.h +26 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARScene.h +15 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSceneDelegateiOS.h +8 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSession.h +7 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSessioniOS.h +18 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARWorldMesh.h +111 -8
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROAudioPlayer.h +19 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROAudioPlayerStreamiOS.h +95 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROCameraTextureiOS.h +17 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRODriver.h +20 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRODynamicGeometry.h +170 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRODynamicMeshNode.h +87 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROGLTFLoader.h +5 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROGameLoopListener.h +125 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputState.h +133 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMonocularDepthEstimator.h +73 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROObjectDetector.h +134 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPCMRingBuffer.h +143 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPencil.h +9 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderContext.h +4 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderer.h +1 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROVertexBuffer.h +102 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROViewAR.h +9 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROVirtualControllerRegistry.h +106 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Info.plist +0 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Shaders.dat +1 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/ViroKit +0 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/constant_fsh.glsl +1 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/constant_fsh_adreno.glsl +1 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/standard_fsh.glsl +1 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/standard_vsh.glsl +4 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/standard_vsh_adreno.glsl +4 -0
- package/ios/dist/ViroRendererVisionOS/ViroKit.podspec +27 -0
- package/ios/dist/include/VRTARScene.h +1 -0
- package/ios/dist/include/VRTARSceneNavigator.h +3 -0
- package/ios/dist/include/VRTCameraTexture.h +62 -0
- package/ios/dist/include/VRTCameraTextureManager.h +30 -0
- package/ios/dist/include/VRTCameraTextureModule.h +38 -0
- package/ios/dist/include/VRTGameLoopView.h +19 -0
- package/ios/dist/include/VRTGameLoopViewManager.h +8 -0
- package/ios/dist/include/VRTManagedAnimation.h +67 -0
- package/ios/dist/include/VRTStreamingAudioModule.h +21 -0
- package/ios/dist/include/VRTVirtualButtonView.h +47 -0
- package/ios/dist/include/VRTVirtualButtonViewManager.h +21 -0
- package/ios/dist/include/VRTVirtualJoystickView.h +59 -0
- package/ios/dist/include/VRTVirtualJoystickViewManager.h +26 -0
- package/ios/dist/lib/libViroReact.a +0 -0
- package/package.json +17 -20
|
@@ -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 setDepthIsMonocular(bool monocular);
|
|
259
260
|
void setSemanticTextureTransform(VROMatrix4f transform);
|
|
260
261
|
|
|
261
262
|
/*
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VROVertexBuffer.h
|
|
3
|
+
// ViroKit
|
|
4
|
+
//
|
|
5
|
+
// Created by Raj Advani on 6/29/19.
|
|
6
|
+
// Copyright © 2019 Viro Media. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
|
9
|
+
// a copy of this software and associated documentation files (the
|
|
10
|
+
// "Software"), to deal in the Software without restriction, including
|
|
11
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
12
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
13
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
|
14
|
+
// the following conditions:
|
|
15
|
+
//
|
|
16
|
+
// The above copyright notice and this permission notice shall be included
|
|
17
|
+
// in all copies or substantial portions of the Software.
|
|
18
|
+
//
|
|
19
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
20
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
22
|
+
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
23
|
+
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
24
|
+
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
25
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
#ifndef VROVertexBuffer_h
|
|
28
|
+
#define VROVertexBuffer_h
|
|
29
|
+
|
|
30
|
+
#include <stdio.h>
|
|
31
|
+
#include "VROData.h"
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
Hint indicating how often the buffer's contents will be updated. Maps to GL_*_DRAW
|
|
35
|
+
hints on OpenGL ES and informs storage mode selection on Metal. Static buffers
|
|
36
|
+
cannot be updated after the initial hydrate(); subclasses that support updates
|
|
37
|
+
should warn when updateData() is called on a Static buffer.
|
|
38
|
+
|
|
39
|
+
NOTE: an explicit underlying type (`int`) is fixed so this enum can be
|
|
40
|
+
forward-declared in other headers (e.g. VRODriver.h) without dragging in
|
|
41
|
+
VROVertexBuffer.h's transitive includes.
|
|
42
|
+
*/
|
|
43
|
+
enum class VROVertexBufferUsage : int {
|
|
44
|
+
Static, // Set once, drawn many times (default; matches legacy behaviour)
|
|
45
|
+
Dynamic, // Updated occasionally
|
|
46
|
+
Stream, // Updated every frame
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
class VROVertexBuffer {
|
|
50
|
+
public:
|
|
51
|
+
|
|
52
|
+
VROVertexBuffer(std::shared_ptr<VROData> data) :
|
|
53
|
+
_data(data),
|
|
54
|
+
_usage(VROVertexBufferUsage::Static) {}
|
|
55
|
+
|
|
56
|
+
VROVertexBuffer(std::shared_ptr<VROData> data, VROVertexBufferUsage usage) :
|
|
57
|
+
_data(data),
|
|
58
|
+
_usage(usage) {}
|
|
59
|
+
|
|
60
|
+
virtual ~VROVertexBuffer() {}
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
Upload this buffer to the GPU. No-op if this buffer is already on the GPU.
|
|
64
|
+
*/
|
|
65
|
+
virtual void hydrate() = 0;
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
Replace the underlying CPU data and re-upload the new contents to the existing
|
|
69
|
+
GPU buffer object in place. Preserves the GPU handle (no new VBO allocation), so
|
|
70
|
+
any geometry substrate that references this buffer continues to work without
|
|
71
|
+
being rebuilt.
|
|
72
|
+
|
|
73
|
+
The default implementation is a silent no-op so that subclasses which don't
|
|
74
|
+
support mutable updates compile without changes. Subclasses that DO support
|
|
75
|
+
updates should override and may warn when called on a Static-usage buffer
|
|
76
|
+
(see VROVertexBufferOpenGL::updateData for the canonical implementation).
|
|
77
|
+
|
|
78
|
+
The new data's size must not exceed the size with which the buffer was first
|
|
79
|
+
hydrated. Larger updates require recreating the substrate.
|
|
80
|
+
*/
|
|
81
|
+
virtual void updateData(std::shared_ptr<VROData> newData) {
|
|
82
|
+
// Intentional no-op default. See class comment above.
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
Get the data (on the CPU) underlying this vertex buffer.
|
|
87
|
+
*/
|
|
88
|
+
std::shared_ptr<VROData> getData() const { return _data; }
|
|
89
|
+
|
|
90
|
+
/*
|
|
91
|
+
Get the update-frequency hint declared at construction.
|
|
92
|
+
*/
|
|
93
|
+
VROVertexBufferUsage getUsage() const { return _usage; }
|
|
94
|
+
|
|
95
|
+
protected:
|
|
96
|
+
|
|
97
|
+
std::shared_ptr<VROData> _data;
|
|
98
|
+
VROVertexBufferUsage _usage;
|
|
99
|
+
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
#endif /* VROVertexBuffer_h */
|
|
@@ -188,4 +188,13 @@ enum class VROCameraPosition;
|
|
|
188
188
|
*/
|
|
189
189
|
- (BOOL)isPreferMonocularDepth;
|
|
190
190
|
|
|
191
|
+
// Calibration scale applied to monocular depth values (1.0 = no change).
|
|
192
|
+
- (void)setMonocularDepthScale:(float)scale;
|
|
193
|
+
|
|
194
|
+
// Target inference rate for monocular depth. Thermal state overrides downward automatically.
|
|
195
|
+
- (void)setMonocularDepthTargetFPS:(int)fps;
|
|
196
|
+
|
|
197
|
+
// Switch to ARFaceTrackingConfiguration (front TrueDepth camera) when YES.
|
|
198
|
+
- (void)setFrontCameraEnabled:(BOOL)enabled;
|
|
199
|
+
|
|
191
200
|
@end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VROVirtualControllerRegistry.h
|
|
3
|
+
// ViroKit
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2026 ReactVision. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
// a copy of this software and associated documentation files (the
|
|
9
|
+
// "Software"), to deal in the Software without restriction, including
|
|
10
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
// the following conditions:
|
|
14
|
+
//
|
|
15
|
+
// The above copyright notice and this permission notice shall be included
|
|
16
|
+
// in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
#ifndef VROVirtualControllerRegistry_h
|
|
19
|
+
#define VROVirtualControllerRegistry_h
|
|
20
|
+
|
|
21
|
+
#include <memory>
|
|
22
|
+
#include <mutex>
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <unordered_map>
|
|
25
|
+
|
|
26
|
+
class VROInputState;
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
Process-wide registry of named virtual controllers, each identified by a
|
|
30
|
+
string id (e.g. "p1", "p2"). Source adapters and consumers find each other
|
|
31
|
+
by referring to the same id.
|
|
32
|
+
|
|
33
|
+
Typical use:
|
|
34
|
+
|
|
35
|
+
// Bridge / view manager, on JS mounting <ViroVirtualController id="p1">:
|
|
36
|
+
auto state = VROVirtualControllerRegistry::instance().acquire("p1");
|
|
37
|
+
|
|
38
|
+
// Touch joystick / gamepad / tilt adapter writes to the same id:
|
|
39
|
+
state->setStickL(x, y);
|
|
40
|
+
state->setButton(VROInputState::Button_A, pressed);
|
|
41
|
+
|
|
42
|
+
// Game loop reader (VROFrameListener / VROGameLoopListener):
|
|
43
|
+
auto snap = state->snapshot();
|
|
44
|
+
float forward = -snap.stickLY;
|
|
45
|
+
|
|
46
|
+
// On unmount:
|
|
47
|
+
VROVirtualControllerRegistry::instance().release("p1");
|
|
48
|
+
|
|
49
|
+
Acquire/release are reference-counted internally so multiple subscribers can
|
|
50
|
+
share the same id and the state survives as long as anyone holds it.
|
|
51
|
+
|
|
52
|
+
Thread-safety: all methods are safe to call from any thread. The internal
|
|
53
|
+
map is mutex-guarded; the VROInputState shared_ptr returned to callers is
|
|
54
|
+
itself thread-safe via its own mutex (see VROInputState).
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
class VROVirtualControllerRegistry {
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
|
|
61
|
+
static VROVirtualControllerRegistry &instance();
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
Return the VROInputState bound to the given id, creating one if none
|
|
65
|
+
exists. Increments an internal reference count so the state stays alive
|
|
66
|
+
until a matching release() call.
|
|
67
|
+
*/
|
|
68
|
+
std::shared_ptr<VROInputState> acquire(const std::string &id);
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
Look up an existing state without creating one. Returns nullptr if no
|
|
72
|
+
adapter or subscriber has acquired this id yet. Does not affect the ref
|
|
73
|
+
count. Use this from frame-loop readers that should fail gracefully
|
|
74
|
+
when the controller hasn't been wired up yet.
|
|
75
|
+
*/
|
|
76
|
+
std::shared_ptr<VROInputState> peek(const std::string &id) const;
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
Decrement the reference count for this id. When the count reaches zero
|
|
80
|
+
the state is removed from the registry and destroyed; the next acquire()
|
|
81
|
+
for that id allocates a fresh one.
|
|
82
|
+
*/
|
|
83
|
+
void release(const std::string &id);
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
Test helper / diagnostic: number of distinct ids currently bound.
|
|
87
|
+
*/
|
|
88
|
+
size_t size() const;
|
|
89
|
+
|
|
90
|
+
private:
|
|
91
|
+
|
|
92
|
+
VROVirtualControllerRegistry() = default;
|
|
93
|
+
VROVirtualControllerRegistry(const VROVirtualControllerRegistry &) = delete;
|
|
94
|
+
VROVirtualControllerRegistry &operator=(const VROVirtualControllerRegistry &) = delete;
|
|
95
|
+
|
|
96
|
+
struct Entry {
|
|
97
|
+
std::shared_ptr<VROInputState> state;
|
|
98
|
+
int refCount = 0;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
mutable std::mutex _mtx;
|
|
102
|
+
std::unordered_map<std::string, Entry> _entries;
|
|
103
|
+
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
#endif /* VROVirtualControllerRegistry_h */
|
|
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.6.42.0.h0RVpk/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 @@ in vec3 morph_3;
|
|
|
40
40
|
in vec3 morph_4;
|
|
41
41
|
in vec3 morph_5;
|
|
42
42
|
in vec3 morph_6;
|
|
43
|
+
in lowp vec4 color;
|
|
43
44
|
|
|
44
45
|
uniform highp vec3 camera_position;
|
|
45
46
|
uniform mat4 normal_matrix;
|
|
@@ -54,6 +55,7 @@ out mat3 v_tbn;
|
|
|
54
55
|
out vec2 v_texcoord;
|
|
55
56
|
out vec3 v_surface_position;
|
|
56
57
|
flat out int v_instance_id;
|
|
58
|
+
out lowp vec4 v_color;
|
|
57
59
|
#pragma varying_out_declarations
|
|
58
60
|
|
|
59
61
|
void main() {
|
|
@@ -77,6 +79,8 @@ void main() {
|
|
|
77
79
|
|
|
78
80
|
_vertex.position = _transforms.projection_matrix * _transforms.view_matrix * _transforms.model_matrix * vec4(_geometry.position, 1.0);
|
|
79
81
|
|
|
82
|
+
v_color = color;
|
|
83
|
+
|
|
80
84
|
#pragma vertex_modifier_body
|
|
81
85
|
|
|
82
86
|
gl_Position = _vertex.position;
|
|
@@ -34,6 +34,7 @@ in vec3 morph_3;
|
|
|
34
34
|
in vec3 morph_4;
|
|
35
35
|
in vec3 morph_5;
|
|
36
36
|
in vec3 morph_6;
|
|
37
|
+
in lowp vec4 color;
|
|
37
38
|
|
|
38
39
|
uniform mat4 normal_matrix;
|
|
39
40
|
uniform mat4 model_matrix;
|
|
@@ -47,6 +48,7 @@ out mat3 v_tbn;
|
|
|
47
48
|
out vec2 v_texcoord;
|
|
48
49
|
out vec3 v_surface_position;
|
|
49
50
|
flat out int v_instance_id;
|
|
51
|
+
out lowp vec4 v_color;
|
|
50
52
|
#pragma varying_out_declarations
|
|
51
53
|
|
|
52
54
|
void main() {
|
|
@@ -75,6 +77,8 @@ void main() {
|
|
|
75
77
|
|
|
76
78
|
_vertex_position = _transforms_projection_matrix * _transforms_view_matrix * _transforms_model_matrix * vec4(_geometry_position, 1.0);
|
|
77
79
|
|
|
80
|
+
v_color = color;
|
|
81
|
+
|
|
78
82
|
#pragma vertex_modifier_body
|
|
79
83
|
|
|
80
84
|
gl_Position = _vertex_position;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Pod::Spec.new do |s|
|
|
2
|
+
s.name = 'ViroKit'
|
|
3
|
+
s.version = '1.0'
|
|
4
|
+
s.summary = 'Framework containing the ViroRenderer (visionOS / xros)'
|
|
5
|
+
s.description = <<-DESC
|
|
6
|
+
ViroKit is the core rendering framework for ViroReact.
|
|
7
|
+
|
|
8
|
+
This is the visionOS (xros) distribution: a Metal-only build of the
|
|
9
|
+
ViroRenderer packaged as an xcframework with both the device (xros-arm64)
|
|
10
|
+
and simulator (xros-arm64_x86_64-simulator) slices. It plugs into the
|
|
11
|
+
CompositorServices immersive render loop via VRORendererBridge.
|
|
12
|
+
DESC
|
|
13
|
+
s.source = { :path => '.' } # source is required, but path is defined in the user's Podfile (this value is ignored).
|
|
14
|
+
s.vendored_frameworks = 'ViroKit.xcframework'
|
|
15
|
+
s.homepage = 'https://reactvision.xyz'
|
|
16
|
+
s.license = {:type => 'Copyright', :text => "Copyright 2025 ReactVision" }
|
|
17
|
+
s.author = 'ReactVision'
|
|
18
|
+
s.requires_arc = true
|
|
19
|
+
s.platform = :visionos, '1.0'
|
|
20
|
+
s.visionos.deployment_target = '1.0'
|
|
21
|
+
s.dependency 'React'
|
|
22
|
+
|
|
23
|
+
# visionOS requires CompositorServices for the immersive render loop.
|
|
24
|
+
# Metal and MetalKit are available on both iOS and visionOS; ARKit provides
|
|
25
|
+
# world / hand tracking.
|
|
26
|
+
s.visionos.frameworks = ['Metal', 'MetalKit', 'CompositorServices', 'ARKit']
|
|
27
|
+
end
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
@property (nonatomic, copy, nullable) NSArray<NSString *> *anchorDetectionTypes;
|
|
37
37
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onTrackingUpdatedViro;
|
|
38
38
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onAmbientLightUpdateViro;
|
|
39
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onDepthReadyViro;
|
|
39
40
|
|
|
40
41
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onAnchorFoundViro;
|
|
41
42
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onAnchorUpdatedViro;
|
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
@property (nonatomic, assign) BOOL depthEnabled;
|
|
52
52
|
@property (nonatomic, assign) BOOL depthDebugEnabled;
|
|
53
53
|
@property (nonatomic, assign) BOOL semanticDebugEnabled;
|
|
54
|
+
@property (nonatomic, assign) float monocularDepthScale;
|
|
55
|
+
@property (nonatomic, assign) int monocularDepthTargetFPS;
|
|
56
|
+
@property (nonatomic, assign) BOOL frontCameraEnabled;
|
|
54
57
|
@property (nonatomic, assign) float semanticConfidenceThreshold;
|
|
55
58
|
@property (nonatomic, copy) NSString *cloudAnchorProvider;
|
|
56
59
|
@property (nonatomic, copy) NSString *geospatialAnchorProvider;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VRTCameraTexture.h
|
|
3
|
+
// ViroReact
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2026 ReactVision. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
// a copy of this software and associated documentation files (the
|
|
9
|
+
// "Software"), to deal in the Software without restriction, including
|
|
10
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
// the following conditions:
|
|
14
|
+
//
|
|
15
|
+
// The above copyright notice and this permission notice shall be included
|
|
16
|
+
// in all copies or substantial portions of the Software.
|
|
17
|
+
//
|
|
18
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
#import <Foundation/Foundation.h>
|
|
27
|
+
#import "VRTView.h"
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* VRTCameraTexture binds a live device camera feed to a named ViroMaterial
|
|
31
|
+
* as its diffuse texture. It creates a VROCameraTextureiOS internally and
|
|
32
|
+
* sets it on the material — the material only needs a lightingModel defined.
|
|
33
|
+
*
|
|
34
|
+
* Unlike VRTMaterialVideo (which controls an existing VideoTexture on a material),
|
|
35
|
+
* this component creates and owns the camera texture.
|
|
36
|
+
*/
|
|
37
|
+
@interface VRTCameraTexture : VRTView
|
|
38
|
+
|
|
39
|
+
// React Native properties
|
|
40
|
+
@property (nonatomic, copy) NSString *material;
|
|
41
|
+
@property (nonatomic, copy) NSString *cameraPosition; // "front" | "back", default "front"
|
|
42
|
+
@property (nonatomic, assign) BOOL paused;
|
|
43
|
+
|
|
44
|
+
// Direct event callbacks (use Viro suffix — matches ViroMaterialVideo convention)
|
|
45
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onCameraReadyViro;
|
|
46
|
+
@property (nonatomic, copy) RCTDirectEventBlock onErrorViro;
|
|
47
|
+
|
|
48
|
+
- (instancetype)initWithBridge:(RCTBridge *)bridge;
|
|
49
|
+
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Photo / video capture (called from VRTCameraTextureModule)
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
- (void)capturePhoto:(nullable NSString *)outputPath
|
|
55
|
+
completion:(void (^)(BOOL success, NSString * _Nullable path, NSString * _Nullable error))completion;
|
|
56
|
+
|
|
57
|
+
- (void)startRecording:(nullable NSString *)outputPath
|
|
58
|
+
completion:(void (^)(BOOL success, NSString * _Nullable path, NSString * _Nullable error))completion;
|
|
59
|
+
|
|
60
|
+
- (void)stopRecording:(void (^)(BOOL success, NSString * _Nullable path, NSString * _Nullable error))completion;
|
|
61
|
+
|
|
62
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VRTCameraTextureManager.h
|
|
3
|
+
// ViroReact
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2026 ReactVision. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
// a copy of this software and associated documentation files (the
|
|
9
|
+
// "Software"), to deal in the Software without restriction, including
|
|
10
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
// the following conditions:
|
|
14
|
+
//
|
|
15
|
+
// The above copyright notice and this permission notice shall be included
|
|
16
|
+
// in all copies or substantial portions of the Software.
|
|
17
|
+
//
|
|
18
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
#import <Foundation/Foundation.h>
|
|
27
|
+
#import "ViroViewManager.h"
|
|
28
|
+
|
|
29
|
+
@interface VRTCameraTextureManager : ViroViewManager
|
|
30
|
+
@end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VRTCameraTextureModule.h
|
|
3
|
+
// ViroReact
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2026 ReactVision. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
// a copy of this software and associated documentation files (the
|
|
9
|
+
// "Software"), to deal in the Software without restriction, including
|
|
10
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
// the following conditions:
|
|
14
|
+
//
|
|
15
|
+
// The above copyright notice and this permission notice shall be included
|
|
16
|
+
// in all copies or substantial portions of the Software.
|
|
17
|
+
//
|
|
18
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
#import <React/RCTBridgeModule.h>
|
|
27
|
+
#import <React/RCTBridge.h>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* NativeModule that exposes capturePhoto / startRecording / stopRecording to JavaScript.
|
|
31
|
+
*
|
|
32
|
+
* Methods look up the VRTCameraTexture view by its React tag via RCTUIManager and
|
|
33
|
+
* delegate to the view's capture methods, resolving the promise with:
|
|
34
|
+
* { success: boolean, url?: string, error?: string }
|
|
35
|
+
*/
|
|
36
|
+
@interface VRTCameraTextureModule : NSObject <RCTBridgeModule>
|
|
37
|
+
|
|
38
|
+
@end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// VRTGameLoopView.h — headless VRTNode that fires per-frame JS callbacks
|
|
2
|
+
// Copyright © 2026 ReactVision. All rights reserved.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
#import <React/RCTComponent.h>
|
|
6
|
+
#import "VRTNode.h"
|
|
7
|
+
|
|
8
|
+
@interface VRTGameLoopView : VRTNode
|
|
9
|
+
|
|
10
|
+
// Called every rendered frame: {dt: number, elapsed: number}
|
|
11
|
+
@property (nonatomic, copy) RCTDirectEventBlock onUpdate;
|
|
12
|
+
// Called after physics/rendering each frame
|
|
13
|
+
@property (nonatomic, copy) RCTDirectEventBlock onLateUpdate;
|
|
14
|
+
// When > 0: fire onFixedUpdate at this frequency (Hz)
|
|
15
|
+
@property (nonatomic, assign) float fixedHz;
|
|
16
|
+
// Called at the fixed-step rate set by fixedHz
|
|
17
|
+
@property (nonatomic, copy) RCTDirectEventBlock onFixedUpdate;
|
|
18
|
+
|
|
19
|
+
@end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VRTManagedAnimation.h
|
|
3
|
+
// ViroReact
|
|
4
|
+
//
|
|
5
|
+
// Created by Raj Advani on 7/21/17.
|
|
6
|
+
// Copyright © 2017 Viro Media. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
|
9
|
+
// a copy of this software and associated documentation files (the
|
|
10
|
+
// "Software"), to deal in the Software without restriction, including
|
|
11
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
12
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
13
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
|
14
|
+
// the following conditions:
|
|
15
|
+
//
|
|
16
|
+
// The above copyright notice and this permission notice shall be included
|
|
17
|
+
// in all copies or substantial portions of the Software.
|
|
18
|
+
//
|
|
19
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
20
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
22
|
+
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
23
|
+
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
24
|
+
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
25
|
+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
//
|
|
27
|
+
|
|
28
|
+
#import <Foundation/Foundation.h>
|
|
29
|
+
#import <ViroKit/ViroKit.h>
|
|
30
|
+
#import <React/RCTComponent.h>
|
|
31
|
+
#import <memory>
|
|
32
|
+
|
|
33
|
+
class VROExecutableAnimation;
|
|
34
|
+
|
|
35
|
+
@interface VRTManagedAnimation : NSObject
|
|
36
|
+
|
|
37
|
+
@property (nonatomic, assign) float delay;
|
|
38
|
+
@property (nonatomic, assign) float durationOverride;
|
|
39
|
+
@property (nonatomic, assign) BOOL loop;
|
|
40
|
+
@property (nonatomic, assign) BOOL run;
|
|
41
|
+
@property (nonatomic, assign) BOOL interruptible;
|
|
42
|
+
@property (nonatomic, readwrite) std::weak_ptr<VRONode> node;
|
|
43
|
+
@property (nonatomic, copy) RCTDirectEventBlock onStart;
|
|
44
|
+
@property (nonatomic, copy) RCTDirectEventBlock onFinish;
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
Implemented by subclasses: load the animation to be run. This is
|
|
48
|
+
invoked just before each time we start the animation, so that the
|
|
49
|
+
animation may be updated between loops.
|
|
50
|
+
*/
|
|
51
|
+
- (std::shared_ptr<VROExecutableAnimation>)loadAnimation;
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
Invoke after updating any animation properties. Changes the running
|
|
55
|
+
state of the animation (e.g. if run is set to true, and the animation
|
|
56
|
+
is not running, will start the animation).
|
|
57
|
+
*/
|
|
58
|
+
- (void)updateAnimation;
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
Parse the properties of this animation from the given dictionary.
|
|
62
|
+
This will populate delay, loop, run, onStart, and onFinish. The
|
|
63
|
+
node and the animation must be set manually.
|
|
64
|
+
*/
|
|
65
|
+
- (void)parseFromDictionary:(NSDictionary *)dictionary;
|
|
66
|
+
|
|
67
|
+
@end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VRTStreamingAudioModule.h
|
|
3
|
+
// ViroReact
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2026 ReactVision. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
// a copy of this software and associated documentation files (the
|
|
9
|
+
// "Software"), to deal in the Software without restriction, including
|
|
10
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
// the following conditions:
|
|
14
|
+
//
|
|
15
|
+
// The above copyright notice and this permission notice shall be included
|
|
16
|
+
// in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
#import <React/RCTBridgeModule.h>
|
|
19
|
+
|
|
20
|
+
@interface VRTStreamingAudioModule : NSObject <RCTBridgeModule>
|
|
21
|
+
@end
|