@webspatial/platform-visionos 1.0.4 → 1.0.5

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.
Files changed (74) hide show
  1. package/package.json +2 -2
  2. package/web-spatial/EventEmitter.swift +56 -0
  3. package/web-spatial/JSBCommand.swift +348 -0
  4. package/web-spatial/SpatialObject.swift +108 -0
  5. package/web-spatial/WebMsgCommand.swift +119 -0
  6. package/web-spatial/WebSpatialApp.swift +111 -0
  7. package/web-spatial/{libs/uiKitDelegate/Window.swift → Window.swift} +1 -0
  8. package/web-spatial/manager/Dynamic3DManager.swift +114 -0
  9. package/web-spatial/manager/JSBManager.swift +148 -0
  10. package/web-spatial/manager/WKWebViewManager.swift +39 -0
  11. package/web-spatial/{libs/webView/manifest.swift → manifest.swift} +16 -5
  12. package/web-spatial/model/SpatialApp.swift +190 -0
  13. package/web-spatial/model/SpatialScene.swift +1042 -0
  14. package/web-spatial/model/Spatialized2DElement.swift +128 -0
  15. package/web-spatial/model/SpatializedDynamic3DElement.swift +34 -0
  16. package/web-spatial/model/SpatializedElement.swift +95 -0
  17. package/web-spatial/model/SpatializedStatic3DElement.swift +19 -0
  18. package/web-spatial/model/dynamic3d/Geometry.swift +95 -0
  19. package/web-spatial/model/dynamic3d/SpatialComponent.swift +72 -0
  20. package/web-spatial/model/dynamic3d/SpatialEntity.swift +211 -0
  21. package/web-spatial/model/dynamic3d/SpatialMaterial.swift +39 -0
  22. package/web-spatial/model/dynamic3d/SpatialModelEntity.swift +39 -0
  23. package/web-spatial/model/dynamic3d/SpatialModelResource.swift +38 -0
  24. package/web-spatial/model/dynamic3d/SpatialTextureResource.swift +18 -0
  25. package/web-spatial/protocol/ScrollAbleSpatialElementContainer.swift +1 -0
  26. package/web-spatial/protocol/SpatialScrollAble.swift +8 -0
  27. package/web-spatial/protocol/SpatializedElementContainer.swift +8 -0
  28. package/web-spatial/protocol/WebMsgSender.swift +5 -0
  29. package/web-spatial/types/Vec2.swift +12 -0
  30. package/web-spatial/types/Vec3.swift +7 -0
  31. package/web-spatial/view/SceneHandlerUIView.swift +92 -0
  32. package/web-spatial/{views/ui/NavView.swift → view/SpatialNavView.swift} +149 -77
  33. package/web-spatial/view/SpatialSceneContentView.swift +218 -0
  34. package/web-spatial/view/SpatialSceneView.swift +53 -0
  35. package/web-spatial/view/Spatialized2DElementView.swift +96 -0
  36. package/web-spatial/view/SpatializedDynamic3DView.swift +104 -0
  37. package/web-spatial/view/SpatializedElementView.swift +178 -0
  38. package/web-spatial/view/SpatializedStatic3DView.swift +70 -0
  39. package/web-spatial/{views → view/view-modifier}/MaterialWithBorderCornerModifier.swift +28 -8
  40. package/web-spatial/webview/SpatialWebController.swift +300 -0
  41. package/web-spatial/webview/SpatialWebView.swift +34 -0
  42. package/web-spatial/webview/SpatialWebViewModel.swift +307 -0
  43. package/web-spatial.xcodeproj/project.pbxproj +126 -207
  44. package/web-spatial/libs/EventEmitter.swift +0 -25
  45. package/web-spatial/libs/SpatialComponent.swift +0 -24
  46. package/web-spatial/libs/SpatialEntity.swift +0 -172
  47. package/web-spatial/libs/SpatialInputComponent.swift +0 -19
  48. package/web-spatial/libs/SpatialMeshResource.swift +0 -12
  49. package/web-spatial/libs/SpatialModel3DComponent.swift +0 -51
  50. package/web-spatial/libs/SpatialModelComponent.swift +0 -25
  51. package/web-spatial/libs/SpatialObject.swift +0 -140
  52. package/web-spatial/libs/SpatialPhysicallyBasedMaterial.swift +0 -19
  53. package/web-spatial/libs/SpatialViewComponent.swift +0 -8
  54. package/web-spatial/libs/SpatialWindowComponent.swift +0 -454
  55. package/web-spatial/libs/SpatialWindowContainer.swift +0 -153
  56. package/web-spatial/libs/Utils/CommandManager.swift +0 -823
  57. package/web-spatial/libs/Utils/PerfClock.swift +0 -43
  58. package/web-spatial/libs/Utils/SceneManager.swift +0 -101
  59. package/web-spatial/libs/Utils/WindowContainerMgr.swift +0 -122
  60. package/web-spatial/libs/json/JsonParser.swift +0 -45
  61. package/web-spatial/libs/webView/UpdateSystem.swift +0 -26
  62. package/web-spatial/libs/webView/backend/NativeWebView.swift +0 -350
  63. package/web-spatial/views/ImmersiveView.swift +0 -17
  64. package/web-spatial/views/OpenDismissHandlerUI.swift +0 -45
  65. package/web-spatial/views/PlainWindowContainerView.swift +0 -132
  66. package/web-spatial/views/SpatialModel3DView.swift +0 -187
  67. package/web-spatial/views/SpatialViewUI.swift +0 -168
  68. package/web-spatial/views/SpatialWebViewUI.swift +0 -179
  69. package/web-spatial/views/VolumetricWindowContainerView.swift +0 -30
  70. package/web-spatial/web_spatialApp.swift +0 -141
  71. /package/web-spatial/{libs/Utils → Utils}/ColorExtension.swift +0 -0
  72. /package/web-spatial/{libs/Utils → Utils}/Logger.swift +0 -0
  73. /package/web-spatial/{views → view}/LoadingView.swift +0 -0
  74. /package/web-spatial/{views → view/view-modifier}/HideViewModifier.swift +0 -0
@@ -3,49 +3,21 @@
3
3
  archiveVersion = 1;
4
4
  classes = {
5
5
  };
6
- objectVersion = 56;
6
+ objectVersion = 70;
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- 2B0B1C102C494E5400E644F9 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B1C0F2C494E5400E644F9 /* Logger.swift */; };
11
- 2B0B430A2CBE21580003CEF3 /* CommandManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B43092CBE21540003CEF3 /* CommandManager.swift */; };
12
- 2B0FF4F42DD2711E00C3F20A /* PerfClock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0FF4F32DD2711800C3F20A /* PerfClock.swift */; };
13
- 2B23CB3F2D0BEE6900E70D95 /* WindowContainerMgr.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B23CB3E2D0BEE6900E70D95 /* WindowContainerMgr.swift */; };
10
+ 2B06AEDB2E4C1AE8000327E9 /* Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B06AEC42E4C1AE8000327E9 /* Window.swift */; };
11
+ 2B06AEDE2E4C1AE8000327E9 /* WebSpatialApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B06AEC32E4C1AE8000327E9 /* WebSpatialApp.swift */; };
12
+ 2B06AEE12E4C1AE8000327E9 /* SpatialObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B06AEC22E4C1AE8000327E9 /* SpatialObject.swift */; };
13
+ 2B06AEE42E4C1AE8000327E9 /* manifest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B06AEC12E4C1AE8000327E9 /* manifest.swift */; };
14
+ 2B06AEE62E4C1AE8000327E9 /* JSBCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B06AEC02E4C1AE8000327E9 /* JSBCommand.swift */; };
15
+ 2B06AEE92E4C1AE8000327E9 /* EventEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B06AEBF2E4C1AE8000327E9 /* EventEmitter.swift */; };
14
16
  2B2F1D692BEBFAAA006897EE /* RealityKitContent in Frameworks */ = {isa = PBXBuildFile; productRef = 2B2F1D682BEBFAAA006897EE /* RealityKitContent */; };
15
- 2B2F1D6B2BEBFAAA006897EE /* web_spatialApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2F1D6A2BEBFAAA006897EE /* web_spatialApp.swift */; };
16
- 2B2F1D6F2BEBFAAA006897EE /* ImmersiveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2F1D6E2BEBFAAA006897EE /* ImmersiveView.swift */; };
17
17
  2B2F1D712BEBFAAC006897EE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2B2F1D702BEBFAAC006897EE /* Assets.xcassets */; };
18
18
  2B2F1D742BEBFAAC006897EE /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2B2F1D732BEBFAAC006897EE /* Preview Assets.xcassets */; };
19
- 2B2F1D8F2BED4D7A006897EE /* JsonParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2F1D8E2BED4D7A006897EE /* JsonParser.swift */; };
20
- 2B2F1D912BED61A8006897EE /* NativeWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2F1D902BED61A8006897EE /* NativeWebView.swift */; };
21
- 2B2F1D992BEDA8EF006897EE /* VolumetricWindowContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2F1D982BEDA8EF006897EE /* VolumetricWindowContainerView.swift */; };
22
- 2B2F1D9B2BEDA975006897EE /* PlainWindowContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2F1D9A2BEDA975006897EE /* PlainWindowContainerView.swift */; };
23
- 2B37E8E12D002C4D0096749A /* MaterialWithBorderCornerModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B37E8E02D002C2B0096749A /* MaterialWithBorderCornerModifier.swift */; };
24
- 2B48B3F12DF9866700826889 /* ColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B48B3F02DF9866100826889 /* ColorExtension.swift */; };
25
- 2B67BBAC2D151C1A00BBC689 /* manifest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B67BBAB2D151C1500BBC689 /* manifest.swift */; };
26
- 2B85209C2BFD5FDB0038FE29 /* UpdateSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B85209B2BFD5FDB0038FE29 /* UpdateSystem.swift */; };
27
- 2B9909932C3605A9004826D1 /* Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B9909922C3605A9004826D1 /* Window.swift */; };
28
- 2BA06D712D4380C60020B505 /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BA06D702D4380C30020B505 /* LoadingView.swift */; };
29
- 2BAC1BE02CDC34500022E29B /* SpatialViewComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BAC1BDF2CDC34410022E29B /* SpatialViewComponent.swift */; };
30
- 2BAC1BE22CDC49040022E29B /* SpatialViewUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BAC1BE12CDC49000022E29B /* SpatialViewUI.swift */; };
31
- 2BB28CCC2C747DB0007F4BDC /* OpenDismissHandlerUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BB28CCB2C747DB0007F4BDC /* OpenDismissHandlerUI.swift */; };
32
- 2BC261222D38F1DA00BCA977 /* NavView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BC261202D38F1DA00BCA977 /* NavView.swift */; };
33
- 2BC9A2212D1E829B00912170 /* HideViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BC9A2202D1E829B00912170 /* HideViewModifier.swift */; };
34
- 2BD510562D54A30D0001E5E6 /* SceneManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BD510552D54A2FF0001E5E6 /* SceneManager.swift */; };
35
- 2BDBED5F2D3F885A0065443F /* SpatialModel3DComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDBED5E2D3F885A0065443F /* SpatialModel3DComponent.swift */; };
36
- 2BDBED632D3FE8EC0065443F /* SpatialModel3DView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDBED622D3FE8EA0065443F /* SpatialModel3DView.swift */; };
19
+ 2B89E38C2E699104004079AA /* WebMsgCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B89E38B2E699104004079AA /* WebMsgCommand.swift */; };
37
20
  2BDBF9B62C4ED9F600D269D7 /* static-web in Resources */ = {isa = PBXBuildFile; fileRef = 2BDBF9B52C4ED9F600D269D7 /* static-web */; };
38
- 2BE1E8FA2C90332400EAE76A /* SpatialObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E8F92C90331C00EAE76A /* SpatialObject.swift */; };
39
- 2BE1E8FF2C90359400EAE76A /* SpatialEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E8FE2C90359400EAE76A /* SpatialEntity.swift */; };
40
- 2BE1E9012C9035AB00EAE76A /* SpatialComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E9002C9035AB00EAE76A /* SpatialComponent.swift */; };
41
- 2BE1E9032C9035DB00EAE76A /* SpatialInputComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E9022C9035DB00EAE76A /* SpatialInputComponent.swift */; };
42
- 2BE1E9052C90375F00EAE76A /* SpatialWindowContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E9042C90375F00EAE76A /* SpatialWindowContainer.swift */; };
43
- 2BE1E9072C903E2C00EAE76A /* EventEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E9062C903E2C00EAE76A /* EventEmitter.swift */; };
44
- 2BE1E9092C90497C00EAE76A /* SpatialWindowComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E9082C90497C00EAE76A /* SpatialWindowComponent.swift */; };
45
- 2BE1E90B2C905DA300EAE76A /* SpatialMeshResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E90A2C905DA300EAE76A /* SpatialMeshResource.swift */; };
46
- 2BE1E90D2C905FB800EAE76A /* SpatialPhysicallyBasedMaterial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E90C2C905FB800EAE76A /* SpatialPhysicallyBasedMaterial.swift */; };
47
- 2BE1E9112C90795D00EAE76A /* SpatialModelComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E9102C90795D00EAE76A /* SpatialModelComponent.swift */; };
48
- 2BE1E9152C9194DC00EAE76A /* SpatialWebViewUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE1E9142C9194DC00EAE76A /* SpatialWebViewUI.swift */; };
49
21
  /* End PBXBuildFile section */
50
22
 
51
23
  /* Begin PBXContainerItemProxy section */
@@ -59,50 +31,107 @@
59
31
  /* End PBXContainerItemProxy section */
60
32
 
61
33
  /* Begin PBXFileReference section */
62
- 2B0B1C0F2C494E5400E644F9 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
63
- 2B0B43092CBE21540003CEF3 /* CommandManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandManager.swift; sourceTree = "<group>"; };
64
- 2B0FF4F32DD2711800C3F20A /* PerfClock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerfClock.swift; sourceTree = "<group>"; };
65
- 2B23CB3E2D0BEE6900E70D95 /* WindowContainerMgr.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowContainerMgr.swift; sourceTree = "<group>"; };
34
+ 2B06AEBF2E4C1AE8000327E9 /* EventEmitter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventEmitter.swift; sourceTree = "<group>"; };
35
+ 2B06AEC02E4C1AE8000327E9 /* JSBCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSBCommand.swift; sourceTree = "<group>"; };
36
+ 2B06AEC12E4C1AE8000327E9 /* manifest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = manifest.swift; sourceTree = "<group>"; };
37
+ 2B06AEC22E4C1AE8000327E9 /* SpatialObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialObject.swift; sourceTree = "<group>"; };
38
+ 2B06AEC32E4C1AE8000327E9 /* WebSpatialApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSpatialApp.swift; sourceTree = "<group>"; };
39
+ 2B06AEC42E4C1AE8000327E9 /* Window.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Window.swift; sourceTree = "<group>"; };
66
40
  2B2F1D632BEBFAAA006897EE /* WebSpatial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebSpatial.app; sourceTree = BUILT_PRODUCTS_DIR; };
67
41
  2B2F1D672BEBFAAA006897EE /* RealityKitContent */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = RealityKitContent; sourceTree = "<group>"; };
68
- 2B2F1D6A2BEBFAAA006897EE /* web_spatialApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = web_spatialApp.swift; sourceTree = "<group>"; };
69
- 2B2F1D6E2BEBFAAA006897EE /* ImmersiveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImmersiveView.swift; sourceTree = "<group>"; };
70
42
  2B2F1D702BEBFAAC006897EE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
71
43
  2B2F1D732BEBFAAC006897EE /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
72
44
  2B2F1D752BEBFAAC006897EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
73
45
  2B2F1D7A2BEBFAAD006897EE /* WebSpatial.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebSpatial.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
74
- 2B2F1D8E2BED4D7A006897EE /* JsonParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JsonParser.swift; sourceTree = "<group>"; };
75
- 2B2F1D902BED61A8006897EE /* NativeWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NativeWebView.swift; sourceTree = "<group>"; };
76
- 2B2F1D982BEDA8EF006897EE /* VolumetricWindowContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VolumetricWindowContainerView.swift; sourceTree = "<group>"; };
77
- 2B2F1D9A2BEDA975006897EE /* PlainWindowContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlainWindowContainerView.swift; sourceTree = "<group>"; };
78
- 2B37E8E02D002C2B0096749A /* MaterialWithBorderCornerModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaterialWithBorderCornerModifier.swift; sourceTree = "<group>"; };
79
- 2B48B3F02DF9866100826889 /* ColorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = "<group>"; };
80
- 2B67BBAB2D151C1500BBC689 /* manifest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = manifest.swift; sourceTree = "<group>"; };
81
- 2B85209B2BFD5FDB0038FE29 /* UpdateSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateSystem.swift; sourceTree = "<group>"; };
82
- 2B9909922C3605A9004826D1 /* Window.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Window.swift; sourceTree = "<group>"; };
83
- 2BA06D702D4380C30020B505 /* LoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = "<group>"; };
84
- 2BAC1BDF2CDC34410022E29B /* SpatialViewComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialViewComponent.swift; sourceTree = "<group>"; };
85
- 2BAC1BE12CDC49000022E29B /* SpatialViewUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialViewUI.swift; sourceTree = "<group>"; };
86
- 2BB28CCB2C747DB0007F4BDC /* OpenDismissHandlerUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenDismissHandlerUI.swift; sourceTree = "<group>"; };
87
- 2BC261202D38F1DA00BCA977 /* NavView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavView.swift; sourceTree = "<group>"; };
88
- 2BC9A2202D1E829B00912170 /* HideViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HideViewModifier.swift; sourceTree = "<group>"; };
89
- 2BD510552D54A2FF0001E5E6 /* SceneManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneManager.swift; sourceTree = "<group>"; };
90
- 2BDBED5E2D3F885A0065443F /* SpatialModel3DComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialModel3DComponent.swift; sourceTree = "<group>"; };
91
- 2BDBED622D3FE8EA0065443F /* SpatialModel3DView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialModel3DView.swift; sourceTree = "<group>"; };
46
+ 2B89E38B2E699104004079AA /* WebMsgCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebMsgCommand.swift; sourceTree = "<group>"; };
92
47
  2BDBF9B52C4ED9F600D269D7 /* static-web */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "static-web"; sourceTree = "<group>"; };
93
- 2BE1E8F92C90331C00EAE76A /* SpatialObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialObject.swift; sourceTree = "<group>"; };
94
- 2BE1E8FE2C90359400EAE76A /* SpatialEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialEntity.swift; sourceTree = "<group>"; };
95
- 2BE1E9002C9035AB00EAE76A /* SpatialComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialComponent.swift; sourceTree = "<group>"; };
96
- 2BE1E9022C9035DB00EAE76A /* SpatialInputComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialInputComponent.swift; sourceTree = "<group>"; };
97
- 2BE1E9042C90375F00EAE76A /* SpatialWindowContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialWindowContainer.swift; sourceTree = "<group>"; };
98
- 2BE1E9062C903E2C00EAE76A /* EventEmitter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventEmitter.swift; sourceTree = "<group>"; };
99
- 2BE1E9082C90497C00EAE76A /* SpatialWindowComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialWindowComponent.swift; sourceTree = "<group>"; };
100
- 2BE1E90A2C905DA300EAE76A /* SpatialMeshResource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialMeshResource.swift; sourceTree = "<group>"; };
101
- 2BE1E90C2C905FB800EAE76A /* SpatialPhysicallyBasedMaterial.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialPhysicallyBasedMaterial.swift; sourceTree = "<group>"; };
102
- 2BE1E9102C90795D00EAE76A /* SpatialModelComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialModelComponent.swift; sourceTree = "<group>"; };
103
- 2BE1E9142C9194DC00EAE76A /* SpatialWebViewUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialWebViewUI.swift; sourceTree = "<group>"; };
104
48
  /* End PBXFileReference section */
105
49
 
50
+ /* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
51
+ 2B06AF302E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
52
+ isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
53
+ membershipExceptions = (
54
+ Dynamic3DManager.swift,
55
+ JSBManager.swift,
56
+ WKWebViewManager.swift,
57
+ );
58
+ target = 2B2F1D622BEBFAAA006897EE /* web-spatial */;
59
+ };
60
+ 2B06AF312E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
61
+ isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
62
+ membershipExceptions = (
63
+ dynamic3d/Geometry.swift,
64
+ dynamic3d/SpatialComponent.swift,
65
+ dynamic3d/SpatialEntity.swift,
66
+ dynamic3d/SpatialMaterial.swift,
67
+ dynamic3d/SpatialModelEntity.swift,
68
+ dynamic3d/SpatialModelResource.swift,
69
+ dynamic3d/SpatialTextureResource.swift,
70
+ SpatialApp.swift,
71
+ Spatialized2DElement.swift,
72
+ SpatializedDynamic3DElement.swift,
73
+ SpatializedElement.swift,
74
+ SpatializedStatic3DElement.swift,
75
+ SpatialScene.swift,
76
+ );
77
+ target = 2B2F1D622BEBFAAA006897EE /* web-spatial */;
78
+ };
79
+ 2B06AF322E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
80
+ isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
81
+ membershipExceptions = (
82
+ ScrollAbleSpatialElementContainer.swift,
83
+ SpatializedElementContainer.swift,
84
+ SpatialScrollAble.swift,
85
+ WebMsgSender.swift,
86
+ );
87
+ target = 2B2F1D622BEBFAAA006897EE /* web-spatial */;
88
+ };
89
+ 2B06AF332E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
90
+ isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
91
+ membershipExceptions = (
92
+ Vec2.swift,
93
+ Vec3.swift,
94
+ );
95
+ target = 2B2F1D622BEBFAAA006897EE /* web-spatial */;
96
+ };
97
+ 2B06AF342E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
98
+ isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
99
+ membershipExceptions = (
100
+ LoadingView.swift,
101
+ SceneHandlerUIView.swift,
102
+ Spatialized2DElementView.swift,
103
+ SpatializedDynamic3DView.swift,
104
+ SpatializedElementView.swift,
105
+ SpatializedStatic3DView.swift,
106
+ SpatialNavView.swift,
107
+ SpatialSceneContentView.swift,
108
+ SpatialSceneView.swift,
109
+ "view-modifier/HideViewModifier.swift",
110
+ "view-modifier/MaterialWithBorderCornerModifier.swift",
111
+ );
112
+ target = 2B2F1D622BEBFAAA006897EE /* web-spatial */;
113
+ };
114
+ 2B06AF352E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
115
+ isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
116
+ membershipExceptions = (
117
+ SpatialWebController.swift,
118
+ SpatialWebView.swift,
119
+ SpatialWebViewModel.swift,
120
+ );
121
+ target = 2B2F1D622BEBFAAA006897EE /* web-spatial */;
122
+ };
123
+ /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
124
+
125
+ /* Begin PBXFileSystemSynchronizedRootGroup section */
126
+ 2B06AEEC2E4C1AF8000327E9 /* manager */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (2B06AF302E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = manager; sourceTree = "<group>"; };
127
+ 2B06AEF32E4C1AF8000327E9 /* model */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (2B06AF312E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = model; sourceTree = "<group>"; };
128
+ 2B06AEF82E4C1AF8000327E9 /* protocol */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (2B06AF322E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = protocol; sourceTree = "<group>"; };
129
+ 2B06AEFC2E4C1AF8000327E9 /* types */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (2B06AF332E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = types; sourceTree = "<group>"; };
130
+ 2B06AEFF2E4C1AF8000327E9 /* Utils */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Utils; sourceTree = "<group>"; };
131
+ 2B06AF0C2E4C1AF8000327E9 /* view */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (2B06AF342E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = view; sourceTree = "<group>"; };
132
+ 2B06AF102E4C1AF8000327E9 /* webview */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (2B06AF352E4C1AF8000327E9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = webview; sourceTree = "<group>"; };
133
+ /* End PBXFileSystemSynchronizedRootGroup section */
134
+
106
135
  /* Begin PBXFrameworksBuildPhase section */
107
136
  2B2F1D602BEBFAAA006897EE /* Frameworks */ = {
108
137
  isa = PBXFrameworksBuildPhase;
@@ -122,19 +151,6 @@
122
151
  /* End PBXFrameworksBuildPhase section */
123
152
 
124
153
  /* Begin PBXGroup section */
125
- 2B0B1C0E2C494E4100E644F9 /* Utils */ = {
126
- isa = PBXGroup;
127
- children = (
128
- 2B48B3F02DF9866100826889 /* ColorExtension.swift */,
129
- 2B0FF4F32DD2711800C3F20A /* PerfClock.swift */,
130
- 2BD510552D54A2FF0001E5E6 /* SceneManager.swift */,
131
- 2B0B43092CBE21540003CEF3 /* CommandManager.swift */,
132
- 2B0B1C0F2C494E5400E644F9 /* Logger.swift */,
133
- 2B23CB3E2D0BEE6900E70D95 /* WindowContainerMgr.swift */,
134
- );
135
- path = Utils;
136
- sourceTree = "<group>";
137
- };
138
154
  2B2F1D5A2BEBFAAA006897EE = {
139
155
  isa = PBXGroup;
140
156
  children = (
@@ -157,12 +173,23 @@
157
173
  isa = PBXGroup;
158
174
  children = (
159
175
  2BDBF9B52C4ED9F600D269D7 /* static-web */,
160
- 2B2F1D972BEDA8BD006897EE /* views */,
161
- 2B2F1D8A2BED4CD0006897EE /* libs */,
162
- 2B2F1D6A2BEBFAAA006897EE /* web_spatialApp.swift */,
163
176
  2B2F1D702BEBFAAC006897EE /* Assets.xcassets */,
164
177
  2B2F1D752BEBFAAC006897EE /* Info.plist */,
165
178
  2B2F1D722BEBFAAC006897EE /* Preview Content */,
179
+ 2B06AEEC2E4C1AF8000327E9 /* manager */,
180
+ 2B06AEF32E4C1AF8000327E9 /* model */,
181
+ 2B06AEF82E4C1AF8000327E9 /* protocol */,
182
+ 2B06AEFC2E4C1AF8000327E9 /* types */,
183
+ 2B06AEFF2E4C1AF8000327E9 /* Utils */,
184
+ 2B06AF0C2E4C1AF8000327E9 /* view */,
185
+ 2B06AF102E4C1AF8000327E9 /* webview */,
186
+ 2B06AEBF2E4C1AE8000327E9 /* EventEmitter.swift */,
187
+ 2B06AEC02E4C1AE8000327E9 /* JSBCommand.swift */,
188
+ 2B89E38B2E699104004079AA /* WebMsgCommand.swift */,
189
+ 2B06AEC12E4C1AE8000327E9 /* manifest.swift */,
190
+ 2B06AEC22E4C1AE8000327E9 /* SpatialObject.swift */,
191
+ 2B06AEC32E4C1AE8000327E9 /* WebSpatialApp.swift */,
192
+ 2B06AEC42E4C1AE8000327E9 /* Window.swift */,
166
193
  );
167
194
  path = "web-spatial";
168
195
  sourceTree = "<group>";
@@ -183,89 +210,6 @@
183
210
  path = "Preview Content";
184
211
  sourceTree = "<group>";
185
212
  };
186
- 2B2F1D8A2BED4CD0006897EE /* libs */ = {
187
- isa = PBXGroup;
188
- children = (
189
- 2BAC1BDF2CDC34410022E29B /* SpatialViewComponent.swift */,
190
- 2BDBED5E2D3F885A0065443F /* SpatialModel3DComponent.swift */,
191
- 2BE1E8F92C90331C00EAE76A /* SpatialObject.swift */,
192
- 2BE1E90A2C905DA300EAE76A /* SpatialMeshResource.swift */,
193
- 2BE1E9102C90795D00EAE76A /* SpatialModelComponent.swift */,
194
- 2BE1E90C2C905FB800EAE76A /* SpatialPhysicallyBasedMaterial.swift */,
195
- 2BE1E9062C903E2C00EAE76A /* EventEmitter.swift */,
196
- 2BE1E8FE2C90359400EAE76A /* SpatialEntity.swift */,
197
- 2BE1E9082C90497C00EAE76A /* SpatialWindowComponent.swift */,
198
- 2BE1E9042C90375F00EAE76A /* SpatialWindowContainer.swift */,
199
- 2BE1E9002C9035AB00EAE76A /* SpatialComponent.swift */,
200
- 2BE1E9022C9035DB00EAE76A /* SpatialInputComponent.swift */,
201
- 2B0B1C0E2C494E4100E644F9 /* Utils */,
202
- 2B9909912C360594004826D1 /* uiKitDelegate */,
203
- 2B2F1D8C2BED4CE7006897EE /* json */,
204
- 2B2F1D8B2BED4CDA006897EE /* webView */,
205
- );
206
- path = libs;
207
- sourceTree = "<group>";
208
- };
209
- 2B2F1D8B2BED4CDA006897EE /* webView */ = {
210
- isa = PBXGroup;
211
- children = (
212
- 2B67BBAB2D151C1500BBC689 /* manifest.swift */,
213
- 2B85209B2BFD5FDB0038FE29 /* UpdateSystem.swift */,
214
- 2B2F1D8D2BED4CFA006897EE /* backend */,
215
- );
216
- path = webView;
217
- sourceTree = "<group>";
218
- };
219
- 2B2F1D8C2BED4CE7006897EE /* json */ = {
220
- isa = PBXGroup;
221
- children = (
222
- 2B2F1D8E2BED4D7A006897EE /* JsonParser.swift */,
223
- );
224
- path = json;
225
- sourceTree = "<group>";
226
- };
227
- 2B2F1D8D2BED4CFA006897EE /* backend */ = {
228
- isa = PBXGroup;
229
- children = (
230
- 2B2F1D902BED61A8006897EE /* NativeWebView.swift */,
231
- );
232
- path = backend;
233
- sourceTree = "<group>";
234
- };
235
- 2B2F1D972BEDA8BD006897EE /* views */ = {
236
- isa = PBXGroup;
237
- children = (
238
- 2BC261212D38F1DA00BCA977 /* ui */,
239
- 2BA06D702D4380C30020B505 /* LoadingView.swift */,
240
- 2BDBED622D3FE8EA0065443F /* SpatialModel3DView.swift */,
241
- 2B37E8E02D002C2B0096749A /* MaterialWithBorderCornerModifier.swift */,
242
- 2BC9A2202D1E829B00912170 /* HideViewModifier.swift */,
243
- 2BAC1BE12CDC49000022E29B /* SpatialViewUI.swift */,
244
- 2B2F1D982BEDA8EF006897EE /* VolumetricWindowContainerView.swift */,
245
- 2B2F1D9A2BEDA975006897EE /* PlainWindowContainerView.swift */,
246
- 2BE1E9142C9194DC00EAE76A /* SpatialWebViewUI.swift */,
247
- 2B2F1D6E2BEBFAAA006897EE /* ImmersiveView.swift */,
248
- 2BB28CCB2C747DB0007F4BDC /* OpenDismissHandlerUI.swift */,
249
- );
250
- path = views;
251
- sourceTree = "<group>";
252
- };
253
- 2B9909912C360594004826D1 /* uiKitDelegate */ = {
254
- isa = PBXGroup;
255
- children = (
256
- 2B9909922C3605A9004826D1 /* Window.swift */,
257
- );
258
- path = uiKitDelegate;
259
- sourceTree = "<group>";
260
- };
261
- 2BC261212D38F1DA00BCA977 /* ui */ = {
262
- isa = PBXGroup;
263
- children = (
264
- 2BC261202D38F1DA00BCA977 /* NavView.swift */,
265
- );
266
- path = ui;
267
- sourceTree = "<group>";
268
- };
269
213
  /* End PBXGroup section */
270
214
 
271
215
  /* Begin PBXNativeTarget section */
@@ -281,6 +225,9 @@
281
225
  );
282
226
  dependencies = (
283
227
  );
228
+ fileSystemSynchronizedGroups = (
229
+ 2B06AEFF2E4C1AF8000327E9 /* Utils */,
230
+ );
284
231
  name = "web-spatial";
285
232
  packageProductDependencies = (
286
233
  2B2F1D682BEBFAAA006897EE /* RealityKitContent */,
@@ -372,41 +319,13 @@
372
319
  isa = PBXSourcesBuildPhase;
373
320
  buildActionMask = 2147483647;
374
321
  files = (
375
- 2BE1E9092C90497C00EAE76A /* SpatialWindowComponent.swift in Sources */,
376
- 2BE1E90D2C905FB800EAE76A /* SpatialPhysicallyBasedMaterial.swift in Sources */,
377
- 2B85209C2BFD5FDB0038FE29 /* UpdateSystem.swift in Sources */,
378
- 2BE1E9032C9035DB00EAE76A /* SpatialInputComponent.swift in Sources */,
379
- 2B2F1D9B2BEDA975006897EE /* PlainWindowContainerView.swift in Sources */,
380
- 2BE1E8FA2C90332400EAE76A /* SpatialObject.swift in Sources */,
381
- 2B0FF4F42DD2711E00C3F20A /* PerfClock.swift in Sources */,
382
- 2BB28CCC2C747DB0007F4BDC /* OpenDismissHandlerUI.swift in Sources */,
383
- 2BDBED632D3FE8EC0065443F /* SpatialModel3DView.swift in Sources */,
384
- 2B67BBAC2D151C1A00BBC689 /* manifest.swift in Sources */,
385
- 2B2F1D8F2BED4D7A006897EE /* JsonParser.swift in Sources */,
386
- 2BE1E9012C9035AB00EAE76A /* SpatialComponent.swift in Sources */,
387
- 2BE1E9152C9194DC00EAE76A /* SpatialWebViewUI.swift in Sources */,
388
- 2B2F1D912BED61A8006897EE /* NativeWebView.swift in Sources */,
389
- 2B2F1D992BEDA8EF006897EE /* VolumetricWindowContainerView.swift in Sources */,
390
- 2BE1E9072C903E2C00EAE76A /* EventEmitter.swift in Sources */,
391
- 2BDBED5F2D3F885A0065443F /* SpatialModel3DComponent.swift in Sources */,
392
- 2B2F1D6B2BEBFAAA006897EE /* web_spatialApp.swift in Sources */,
393
- 2B0B1C102C494E5400E644F9 /* Logger.swift in Sources */,
394
- 2B48B3F12DF9866700826889 /* ColorExtension.swift in Sources */,
395
- 2B37E8E12D002C4D0096749A /* MaterialWithBorderCornerModifier.swift in Sources */,
396
- 2BC261222D38F1DA00BCA977 /* NavView.swift in Sources */,
397
- 2BAC1BE22CDC49040022E29B /* SpatialViewUI.swift in Sources */,
398
- 2B0B430A2CBE21580003CEF3 /* CommandManager.swift in Sources */,
399
- 2B23CB3F2D0BEE6900E70D95 /* WindowContainerMgr.swift in Sources */,
400
- 2BD510562D54A30D0001E5E6 /* SceneManager.swift in Sources */,
401
- 2BAC1BE02CDC34500022E29B /* SpatialViewComponent.swift in Sources */,
402
- 2BE1E9052C90375F00EAE76A /* SpatialWindowContainer.swift in Sources */,
403
- 2B2F1D6F2BEBFAAA006897EE /* ImmersiveView.swift in Sources */,
404
- 2BE1E9112C90795D00EAE76A /* SpatialModelComponent.swift in Sources */,
405
- 2B9909932C3605A9004826D1 /* Window.swift in Sources */,
406
- 2BC9A2212D1E829B00912170 /* HideViewModifier.swift in Sources */,
407
- 2BE1E8FF2C90359400EAE76A /* SpatialEntity.swift in Sources */,
408
- 2BA06D712D4380C60020B505 /* LoadingView.swift in Sources */,
409
- 2BE1E90B2C905DA300EAE76A /* SpatialMeshResource.swift in Sources */,
322
+ 2B06AEDB2E4C1AE8000327E9 /* Window.swift in Sources */,
323
+ 2B06AEDE2E4C1AE8000327E9 /* WebSpatialApp.swift in Sources */,
324
+ 2B06AEE12E4C1AE8000327E9 /* SpatialObject.swift in Sources */,
325
+ 2B06AEE42E4C1AE8000327E9 /* manifest.swift in Sources */,
326
+ 2B89E38C2E699104004079AA /* WebMsgCommand.swift in Sources */,
327
+ 2B06AEE62E4C1AE8000327E9 /* JSBCommand.swift in Sources */,
328
+ 2B06AEE92E4C1AE8000327E9 /* EventEmitter.swift in Sources */,
410
329
  );
411
330
  runOnlyForDeploymentPostprocessing = 0;
412
331
  };
@@ -570,7 +489,7 @@
570
489
  SWIFT_EMIT_LOC_STRINGS = YES;
571
490
  SWIFT_VERSION = 5.0;
572
491
  TARGETED_DEVICE_FAMILY = "1,2,7";
573
- XROS_DEPLOYMENT_TARGET = 2.1;
492
+ XROS_DEPLOYMENT_TARGET = 26.0;
574
493
  };
575
494
  name = Debug;
576
495
  };
@@ -597,7 +516,7 @@
597
516
  SWIFT_EMIT_LOC_STRINGS = YES;
598
517
  SWIFT_VERSION = 5.0;
599
518
  TARGETED_DEVICE_FAMILY = "1,2,7";
600
- XROS_DEPLOYMENT_TARGET = 2.1;
519
+ XROS_DEPLOYMENT_TARGET = 26.0;
601
520
  };
602
521
  name = Release;
603
522
  };
@@ -1,25 +0,0 @@
1
- class EventEmitter {
2
- private var listeners: [String: [(_ object: Any, _ data: Any) -> Void]] = [:]
3
-
4
- public func on(event: String, listener: @escaping (_ object: Any, _ data: Any) -> Void) {
5
- if listeners[event] == nil {
6
- listeners[event] = []
7
- }
8
- listeners[event]?.append(listener)
9
- }
10
-
11
- public func emit(event: String, data: Any) {
12
- listeners[event]?.forEach { listener in
13
- listener(self, data)
14
- }
15
- }
16
-
17
- public func off(event: String, listener: @escaping (_ object: Any, _ data: Any) -> Void) {
18
- listeners[event]?.removeAll(where: { $0 as AnyObject === listener as AnyObject })
19
- }
20
-
21
- // protected function
22
- func reset() {
23
- listeners = [:]
24
- }
25
- }
@@ -1,24 +0,0 @@
1
- import Foundation
2
-
3
- class SpatialComponent: SpatialObject {
4
- weak var entity: SpatialEntity? = nil
5
-
6
- func onAddToEntity() {}
7
-
8
- override func onDestroy() {
9
- entity = nil
10
- }
11
-
12
- override func inspect() -> [String: Any] {
13
- var inspectInfo: [String: Any] = [
14
- "entity": entity == nil ? "invalid" : entity!.id,
15
- "type": String(describing: type(of: self)),
16
- ]
17
-
18
- let baseInspectInfo = super.inspect()
19
- for (key, value) in baseInspectInfo {
20
- inspectInfo[key] = value
21
- }
22
- return inspectInfo
23
- }
24
- }
@@ -1,172 +0,0 @@
1
- import Combine
2
- import Foundation
3
- import RealityKit
4
- import typealias RealityKit.Entity
5
-
6
- enum CoordinateSpaceMode {
7
- case
8
- APP,
9
- DOM,
10
- ROOT
11
-
12
- var description: String {
13
- switch self {
14
- case .APP:
15
- return "APP"
16
- case .DOM:
17
- return "DOM"
18
- case .ROOT:
19
- return "ROOT"
20
- }
21
- }
22
- }
23
-
24
- // temp use SpatialBridgeComponent,
25
- // will be replaced when modelEntity is removed from SpatialEntity
26
- // then SpatialEntity have have a BridgeEntity instead
27
- class SpatialBridgeComponent: Component {
28
- let spatialEntity: SpatialEntity
29
-
30
- init(_ spatialEntity: SpatialEntity) {
31
- self.spatialEntity = spatialEntity
32
- }
33
- }
34
-
35
- // Entity
36
- @Observable
37
- class SpatialEntity: SpatialObject {
38
- var coordinateSpace = CoordinateSpaceMode.APP
39
- let modelEntity = ModelEntity()
40
- var zIndex: Double = 0
41
- var visible = true
42
-
43
- var forceUpdate = false
44
-
45
- override init() {
46
- super.init()
47
- modelEntity.components.set(SpatialBridgeComponent(self))
48
- modelEntity.model = ModelComponent(mesh: .generateBox(size: 0.0), materials: [])
49
- }
50
-
51
- // Entity can have a child/parent relationship
52
- private var childEntities = [String: SpatialEntity]()
53
- weak var parent: SpatialEntity? = nil
54
-
55
- public func getEntities() -> [String: SpatialEntity] {
56
- return childEntities
57
- }
58
-
59
- // Window container that this entity will be displayed in (not related to resource ownership)
60
- weak var parentWindowContainer: SpatialWindowContainer?
61
- public func setParentWindowContainer(wg: SpatialWindowContainer?) {
62
- if let g = parentWindowContainer {
63
- g.removeEntity(self)
64
- parentWindowContainer = nil
65
- }
66
- parentWindowContainer = wg
67
- if let g = parentWindowContainer {
68
- g.addEntity(self)
69
- }
70
-
71
- // @Trevor: I add this code to process parent
72
- // I think an entity can be either child of WindowContainer or SpatialEntity
73
- parent?.childEntities.removeValue(forKey: id)
74
- parent = nil
75
- }
76
-
77
- public func addChild(child: SpatialEntity) {
78
- child.setParent(parentEnt: self)
79
- }
80
-
81
- public func setParent(parentEnt: SpatialEntity?) {
82
- // Remove parent window container
83
- parentWindowContainer?.removeEntity(self)
84
- parentWindowContainer = nil
85
-
86
- // Remove from existing parent
87
- parent?.childEntities.removeValue(forKey: id)
88
- parentEnt?.modelEntity.removeChild(modelEntity)
89
-
90
- // Set new parent
91
- if let p = parentEnt {
92
- parent = p
93
- p.modelEntity.addChild(modelEntity)
94
- p.childEntities[id] = self
95
- }
96
- }
97
-
98
- // components
99
- private var components: [SpatialComponent] = []
100
-
101
- public func addComponent(_ component: SpatialComponent) {
102
- // first check component type
103
- components.append(component)
104
- component.entity = self
105
- component.onAddToEntity()
106
- }
107
-
108
- public func removeComponent(_ component: SpatialComponent) {
109
- if let index = components.firstIndex(of: component) {
110
- components.remove(at: index)
111
- component.entity = nil
112
- }
113
- }
114
-
115
- public func getComponent<T: SpatialComponent>(_ type: T.Type) -> T? {
116
- for component in components {
117
- if let specificComponent = component as? T {
118
- return specificComponent
119
- }
120
- }
121
- return nil
122
- }
123
-
124
- public func hasComponent<T: SpatialComponent>(_ type: T.Type) -> Bool {
125
- return getComponent(type) != nil
126
- }
127
-
128
- override func onDestroy() {
129
- if let wg = parentWindowContainer {
130
- wg.removeEntity(self)
131
- }
132
-
133
- // handle components destroy
134
- components.forEach { $0.destroy() }
135
- components = []
136
-
137
- setParent(parentEnt: nil)
138
- let keys = childEntities.map { $0.key }
139
- for k in keys {
140
- childEntities[k]!.setParent(parentEnt: nil)
141
- }
142
- childEntities = [String: SpatialEntity]()
143
-
144
- modelEntity.removeFromParent()
145
- modelEntity.components.removeAll()
146
- }
147
-
148
- override func inspect() -> [String: Any] {
149
- let childEntitiesInfo = childEntities.mapValues { entity in
150
- entity.inspect()
151
- }
152
- let componentsInfo = components.map { $0.inspect() }
153
-
154
- var inspectInfo: [String: Any] = [
155
- "position": modelEntity.position.description,
156
- "scale": modelEntity.scale.description,
157
- "zIndex": zIndex,
158
- "visible": visible,
159
- "childEntities": childEntitiesInfo,
160
- "coordinateSpace": coordinateSpace.description,
161
- "parent": parent != nil ? parent!.id : "null",
162
- "parentWindowContainer": parentWindowContainer != nil ? parentWindowContainer!.id : "null",
163
- "components": componentsInfo,
164
- ]
165
-
166
- let baseInspectInfo = super.inspect()
167
- for (key, value) in baseInspectInfo {
168
- inspectInfo[key] = value
169
- }
170
- return inspectInfo
171
- }
172
- }
@@ -1,19 +0,0 @@
1
- import Combine
2
- import Foundation
3
- import RealityKit
4
-
5
- @Observable
6
- class SpatialInputComponent: SpatialComponent {
7
- // @todo: ref to wv is a bad desgin, should refactor later
8
- weak var wv: SpatialWindowComponent?
9
- var itc = InputTargetComponent()
10
-
11
- var isDragging = false
12
- var trackedPosition: SIMD3<Float> = .zero
13
-
14
- override func onAddToEntity() {
15
- let e = entity!
16
- e.modelEntity.generateCollisionShapes(recursive: false)
17
- e.modelEntity.components.set(itc)
18
- }
19
- }