replate-camera 0.17.0 → 0.17.2

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 (30) hide show
  1. package/android/src/main/java/com/replatecamera/ReplateCameraView.kt +23 -7
  2. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/AppDelegate.swift +32 -0
  3. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Assets.xcassets/Add.imageset/Close.png +0 -0
  4. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Assets.xcassets/Add.imageset/Contents.json +12 -0
  5. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
  6. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Assets.xcassets/Contents.json +6 -0
  7. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Assets.xcassets/Open.imageset/Contents.json +12 -0
  8. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Assets.xcassets/Open.imageset/Open.png +0 -0
  9. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Base.lproj/LaunchScreen.storyboard +25 -0
  10. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/BasicARView.swift +31 -0
  11. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/ContentView.swift +33 -0
  12. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/FocusARView.swift +61 -0
  13. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Info.plist +50 -0
  14. package/ios/FocusEntity/FocusEntity-Example/FocusEntity-Example/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
  15. package/ios/FocusEntity/LICENSE +21 -0
  16. package/ios/FocusEntity/LICENSE.origin +8 -0
  17. package/ios/FocusEntity/Package.swift +17 -0
  18. package/ios/FocusEntity/README.md +62 -0
  19. package/ios/FocusEntity/Sources/FocusEntity/FocusEntity+Alignment.swift +178 -0
  20. package/ios/FocusEntity/Sources/FocusEntity/FocusEntity+Classic.swift +109 -0
  21. package/ios/FocusEntity/Sources/FocusEntity/FocusEntity+Colored.swift +50 -0
  22. package/ios/FocusEntity/Sources/FocusEntity/FocusEntity+Segment.swift +148 -0
  23. package/ios/FocusEntity/Sources/FocusEntity/FocusEntity.docc/FocusEntity.md +42 -0
  24. package/ios/FocusEntity/Sources/FocusEntity/FocusEntity.swift +399 -0
  25. package/ios/FocusEntity/Sources/FocusEntity/FocusEntityComponent.swift +99 -0
  26. package/ios/FocusEntity/Sources/FocusEntity/float4x4+Extension.swift +32 -0
  27. package/ios/FocusEntity/install_swiftlint.sh +23 -0
  28. package/ios/FocusEntity/media/focusentity-dali.gif +0 -0
  29. package/ios/ReplateCameraViewManager.swift +216 -80
  30. package/package.json +1 -1
@@ -34,6 +34,7 @@ import com.google.ar.core.Plane
34
34
  import com.google.ar.core.TrackingState
35
35
  import com.google.ar.sceneform.*
36
36
  import com.google.ar.sceneform.math.Vector3
37
+ import com.google.ar.sceneform.math.Quaternion
37
38
  import com.google.ar.sceneform.rendering.Color
38
39
  import com.google.ar.sceneform.rendering.Material
39
40
  import com.google.ar.sceneform.rendering.MaterialFactory
@@ -84,7 +85,10 @@ class ReplateCameraView @JvmOverloads constructor(
84
85
  private const val ANGLE_INCREMENT_DEGREES = 5f
85
86
 
86
87
  // Initial defaults that match the Swift code
87
- private const val DEFAULT_SPHERE_RADIUS = 0.004f
88
+ private const val DEFAULT_SPHERE_RADIUS = 0.0015f
89
+ private const val DEFAULT_LINE_HEIGHT = 0.02f // vertical length
90
+ private const val DEFAULT_LINE_LENGTH = 0.003f // thin width
91
+ private const val GREEN_HEIGHT_SCALE = 0.7f
88
92
  private const val DEFAULT_SPHERES_RADIUS = 0.13f
89
93
  private const val DEFAULT_SPHERES_HEIGHT = 0.10f
90
94
  private const val DEFAULT_DISTANCE_BETWEEN_CIRCLES = 0.10f
@@ -124,6 +128,8 @@ class ReplateCameraView @JvmOverloads constructor(
124
128
 
125
129
  // Scene geometry
126
130
  private var sphereRadius = DEFAULT_SPHERE_RADIUS
131
+ private var lineHeight = DEFAULT_LINE_HEIGHT
132
+ private var lineLength = DEFAULT_LINE_LENGTH
127
133
  private var spheresRadius = DEFAULT_SPHERES_RADIUS
128
134
  private var sphereAngle = ANGLE_INCREMENT_DEGREES // If you want to “scale angle”
129
135
  private var spheresHeight = DEFAULT_SPHERES_HEIGHT
@@ -270,12 +276,19 @@ class ReplateCameraView @JvmOverloads constructor(
270
276
  private fun createSphere(position: Vector3) {
271
277
  MaterialFactory.makeOpaqueWithColor(context, Color(android.graphics.Color.WHITE))
272
278
  .thenAccept { material: Material ->
273
- val sphereRenderable = ShapeFactory.makeSphere(sphereRadius, Vector3.zero(), material)
274
- val sphereNode = TransformableNode(arFragment.transformationSystem)
275
- sphereNode.renderable = sphereRenderable
276
- sphereNode.worldPosition = position
277
- sphereNode.setParent(anchorNode)
278
- spheresModels.add(sphereNode)
279
+ val center = Vector3.zero()
280
+ val thickness = sphereRadius * 2
281
+ // ShapeFactory.makeCube already produces a 6-face box; keep zero corner radius for the flattest look.
282
+ val lineRenderable = ShapeFactory.makeCube(Vector3(lineLength, lineHeight, thickness), center, material)
283
+ val lineNode = TransformableNode(arFragment.transformationSystem)
284
+ lineNode.renderable = lineRenderable
285
+ lineNode.worldPosition = position
286
+ // Orient tangentially around the ring
287
+ val angleRad = Math.atan2(position.z.toDouble(), position.x.toDouble())
288
+ val angleDeg = Math.toDegrees(angleRad).toFloat() + 90f
289
+ lineNode.localRotation = Quaternion.axisAngle(Vector3(0f, 1f, 0f), angleDeg)
290
+ lineNode.setParent(anchorNode)
291
+ spheresModels.add(lineNode)
279
292
  }
280
293
  }
281
294
 
@@ -510,6 +523,7 @@ class ReplateCameraView @JvmOverloads constructor(
510
523
  val material = node.renderable?.material?.makeCopy()
511
524
  material?.setFloat4("color", color)
512
525
  node.renderable?.material = material
526
+ node.localScale = Vector3(1f, GREEN_HEIGHT_SCALE, 1f)
513
527
  }
514
528
  }
515
529
 
@@ -790,6 +804,8 @@ class ReplateCameraView @JvmOverloads constructor(
790
804
 
791
805
  // Reset geometry
792
806
  sphereRadius = DEFAULT_SPHERE_RADIUS
807
+ lineHeight = DEFAULT_LINE_HEIGHT
808
+ lineLength = DEFAULT_LINE_LENGTH
793
809
  spheresRadius = DEFAULT_SPHERES_RADIUS
794
810
  sphereAngle = ANGLE_INCREMENT_DEGREES
795
811
  spheresHeight = DEFAULT_SPHERES_HEIGHT
@@ -0,0 +1,32 @@
1
+ //
2
+ // AppDelegate.swift
3
+ // FocusEntity-Example
4
+ //
5
+ // Created by Max Cobb on 8/26/19.
6
+ // Copyright © 2019 Max Cobb. All rights reserved.
7
+ //
8
+
9
+ import UIKit
10
+ import SwiftUI
11
+
12
+ @UIApplicationMain
13
+ class AppDelegate: UIResponder, UIApplicationDelegate {
14
+
15
+ var window: UIWindow?
16
+
17
+ func application(
18
+ _ application: UIApplication,
19
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
20
+ ) -> Bool {
21
+
22
+ // Create the SwiftUI view that provides the window contents.
23
+ let contentView = ContentView()
24
+
25
+ // Use a UIHostingController as window root view controller.
26
+ let window = UIWindow(frame: UIScreen.main.bounds)
27
+ window.rootViewController = UIHostingController(rootView: contentView)
28
+ self.window = window
29
+ window.makeKeyAndVisible()
30
+ return true
31
+ }
32
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "filename" : "Close.png",
5
+ "idiom" : "universal"
6
+ }
7
+ ],
8
+ "info" : {
9
+ "author" : "xcode",
10
+ "version" : 1
11
+ }
12
+ }
@@ -0,0 +1,98 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "iphone",
5
+ "size" : "20x20",
6
+ "scale" : "2x"
7
+ },
8
+ {
9
+ "idiom" : "iphone",
10
+ "size" : "20x20",
11
+ "scale" : "3x"
12
+ },
13
+ {
14
+ "idiom" : "iphone",
15
+ "size" : "29x29",
16
+ "scale" : "2x"
17
+ },
18
+ {
19
+ "idiom" : "iphone",
20
+ "size" : "29x29",
21
+ "scale" : "3x"
22
+ },
23
+ {
24
+ "idiom" : "iphone",
25
+ "size" : "40x40",
26
+ "scale" : "2x"
27
+ },
28
+ {
29
+ "idiom" : "iphone",
30
+ "size" : "40x40",
31
+ "scale" : "3x"
32
+ },
33
+ {
34
+ "idiom" : "iphone",
35
+ "size" : "60x60",
36
+ "scale" : "2x"
37
+ },
38
+ {
39
+ "idiom" : "iphone",
40
+ "size" : "60x60",
41
+ "scale" : "3x"
42
+ },
43
+ {
44
+ "idiom" : "ipad",
45
+ "size" : "20x20",
46
+ "scale" : "1x"
47
+ },
48
+ {
49
+ "idiom" : "ipad",
50
+ "size" : "20x20",
51
+ "scale" : "2x"
52
+ },
53
+ {
54
+ "idiom" : "ipad",
55
+ "size" : "29x29",
56
+ "scale" : "1x"
57
+ },
58
+ {
59
+ "idiom" : "ipad",
60
+ "size" : "29x29",
61
+ "scale" : "2x"
62
+ },
63
+ {
64
+ "idiom" : "ipad",
65
+ "size" : "40x40",
66
+ "scale" : "1x"
67
+ },
68
+ {
69
+ "idiom" : "ipad",
70
+ "size" : "40x40",
71
+ "scale" : "2x"
72
+ },
73
+ {
74
+ "idiom" : "ipad",
75
+ "size" : "76x76",
76
+ "scale" : "1x"
77
+ },
78
+ {
79
+ "idiom" : "ipad",
80
+ "size" : "76x76",
81
+ "scale" : "2x"
82
+ },
83
+ {
84
+ "idiom" : "ipad",
85
+ "size" : "83.5x83.5",
86
+ "scale" : "2x"
87
+ },
88
+ {
89
+ "idiom" : "ios-marketing",
90
+ "size" : "1024x1024",
91
+ "scale" : "1x"
92
+ }
93
+ ],
94
+ "info" : {
95
+ "version" : 1,
96
+ "author" : "xcode"
97
+ }
98
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "info" : {
3
+ "author" : "xcode",
4
+ "version" : 1
5
+ }
6
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "filename" : "Open.png",
5
+ "idiom" : "universal"
6
+ }
7
+ ],
8
+ "info" : {
9
+ "author" : "xcode",
10
+ "version" : 1
11
+ }
12
+ }
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3
+ <dependencies>
4
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5
+ <capability name="Safe area layout guides" minToolsVersion="9.0"/>
6
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7
+ </dependencies>
8
+ <scenes>
9
+ <!--View Controller-->
10
+ <scene sceneID="EHf-IW-A2E">
11
+ <objects>
12
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
13
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
14
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16
+ <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
17
+ <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18
+ </view>
19
+ </viewController>
20
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
21
+ </objects>
22
+ <point key="canvasLocation" x="53" y="375"/>
23
+ </scene>
24
+ </scenes>
25
+ </document>
@@ -0,0 +1,31 @@
1
+ //
2
+ // BasicARView.swift
3
+ // FocusEntity-Example
4
+ //
5
+ // Created by Max Cobb on 12/04/2023.
6
+ // Copyright © 2023 Max Cobb. All rights reserved.
7
+ //
8
+
9
+ import SwiftUI
10
+ import RealityKit
11
+ import FocusEntity
12
+ import ARKit
13
+
14
+ struct BasicARView: UIViewRepresentable {
15
+ typealias UIViewType = ARView
16
+ func makeUIView(context: Context) -> ARView {
17
+ let arView = ARView(frame: .zero)
18
+ let arConfig = ARWorldTrackingConfiguration()
19
+ arConfig.planeDetection = [.horizontal, .vertical]
20
+ arView.session.run(arConfig)
21
+ _ = FocusEntity(on: arView, style: .classic())
22
+ return arView
23
+ }
24
+ func updateUIView(_ uiView: ARView, context: Context) {}
25
+ }
26
+
27
+ struct BasicARView_Previews: PreviewProvider {
28
+ static var previews: some View {
29
+ BasicARView()
30
+ }
31
+ }
@@ -0,0 +1,33 @@
1
+ //
2
+ // ContentView.swift
3
+ // FocusEntity-Example
4
+ //
5
+ // Created by Max Cobb on 8/26/19.
6
+ // Copyright © 2019 Max Cobb. All rights reserved.
7
+ //
8
+
9
+ import SwiftUI
10
+ import RealityKit
11
+
12
+ struct ContentView: View {
13
+ var body: some View {
14
+ BasicARView().edgesIgnoringSafeArea(.all)
15
+ // Uncomment the next line for a more complex example
16
+ // ARViewContainer().edgesIgnoringSafeArea(.all)
17
+ }
18
+ }
19
+
20
+ struct ARViewContainer: UIViewRepresentable {
21
+ func makeUIView(context: Context) -> FocusARView {
22
+ FocusARView(frame: .zero)
23
+ }
24
+ func updateUIView(_ uiView: FocusARView, context: Context) {}
25
+ }
26
+
27
+ #if DEBUG
28
+ struct ContentView_Previews: PreviewProvider {
29
+ static var previews: some View {
30
+ ContentView()
31
+ }
32
+ }
33
+ #endif
@@ -0,0 +1,61 @@
1
+ //
2
+ // FocusARView.swift
3
+ // FocusEntity-Example
4
+ //
5
+ // Created by Max Cobb on 8/26/19.
6
+ // Copyright © 2019 Max Cobb. All rights reserved.
7
+ //
8
+
9
+ import RealityKit
10
+ import FocusEntity
11
+ import Combine
12
+ import ARKit
13
+
14
+ class FocusARView: ARView {
15
+ enum FocusStyleChoices {
16
+ case classic
17
+ case material
18
+ case color
19
+ }
20
+
21
+ /// Style to be displayed in the example
22
+ let focusStyle: FocusStyleChoices = .classic
23
+ var focusEntity: FocusEntity?
24
+ required init(frame frameRect: CGRect) {
25
+ super.init(frame: frameRect)
26
+ self.setupConfig()
27
+
28
+ switch self.focusStyle {
29
+ case .color:
30
+ self.focusEntity = FocusEntity(on: self, focus: .plane)
31
+ case .material:
32
+ do {
33
+ let onColor: MaterialColorParameter = try .texture(.load(named: "Add"))
34
+ let offColor: MaterialColorParameter = try .texture(.load(named: "Open"))
35
+ self.focusEntity = FocusEntity(
36
+ on: self,
37
+ style: .colored(
38
+ onColor: onColor, offColor: offColor,
39
+ nonTrackingColor: offColor
40
+ )
41
+ )
42
+ } catch {
43
+ self.focusEntity = FocusEntity(on: self, focus: .classic)
44
+ print("Unable to load plane textures")
45
+ print(error.localizedDescription)
46
+ }
47
+ default:
48
+ self.focusEntity = FocusEntity(on: self, focus: .classic)
49
+ }
50
+ }
51
+
52
+ func setupConfig() {
53
+ let config = ARWorldTrackingConfiguration()
54
+ config.planeDetection = [.horizontal, .vertical]
55
+ session.run(config)
56
+ }
57
+
58
+ @objc required dynamic init?(coder decoder: NSCoder) {
59
+ fatalError("init(coder:) has not been implemented")
60
+ }
61
+ }
@@ -0,0 +1,50 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7
+ <key>CFBundleDisplayName</key>
8
+ <string>FocusEnt-Clone</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>$(EXECUTABLE_NAME)</string>
11
+ <key>CFBundleIdentifier</key>
12
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
+ <key>CFBundleInfoDictionaryVersion</key>
14
+ <string>6.0</string>
15
+ <key>CFBundleName</key>
16
+ <string>$(PRODUCT_NAME)</string>
17
+ <key>CFBundlePackageType</key>
18
+ <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
19
+ <key>CFBundleShortVersionString</key>
20
+ <string>1.0</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1</string>
23
+ <key>LSRequiresIPhoneOS</key>
24
+ <true/>
25
+ <key>NSCameraUsageDescription</key>
26
+ <string></string>
27
+ <key>UILaunchStoryboardName</key>
28
+ <string>LaunchScreen</string>
29
+ <key>UIRequiredDeviceCapabilities</key>
30
+ <array>
31
+ <string>armv7</string>
32
+ <string>arkit</string>
33
+ </array>
34
+ <key>UIStatusBarHidden</key>
35
+ <true/>
36
+ <key>UISupportedInterfaceOrientations</key>
37
+ <array>
38
+ <string>UIInterfaceOrientationPortrait</string>
39
+ <string>UIInterfaceOrientationLandscapeLeft</string>
40
+ <string>UIInterfaceOrientationLandscapeRight</string>
41
+ </array>
42
+ <key>UISupportedInterfaceOrientations~ipad</key>
43
+ <array>
44
+ <string>UIInterfaceOrientationPortrait</string>
45
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
46
+ <string>UIInterfaceOrientationLandscapeLeft</string>
47
+ <string>UIInterfaceOrientationLandscapeRight</string>
48
+ </array>
49
+ </dict>
50
+ </plist>
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Max Fraser Cobb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ Copyright © 2018 Apple Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
@@ -0,0 +1,17 @@
1
+ // swift-tools-version:5.5
2
+ // The swift-tools-version declares the minimum version of Swift required to build this package.
3
+
4
+ import PackageDescription
5
+
6
+ let package = Package(
7
+ name: "FocusEntity",
8
+ platforms: [.iOS(.v13), .macOS(.v10_15)],
9
+ products: [
10
+ .library(name: "FocusEntity", targets: ["FocusEntity"])
11
+ ],
12
+ dependencies: [],
13
+ targets: [
14
+ .target(name: "FocusEntity", dependencies: [])
15
+ ],
16
+ swiftLanguageVersions: [.v5]
17
+ )
@@ -0,0 +1,62 @@
1
+ # FocusEntity
2
+
3
+ This package is based on [ARKit-FocusNode](https://github.com/maxxfrazer/ARKit-FocusNode), but adapted to work in Apple's framework RealityKit.
4
+
5
+ <p align="center">
6
+ <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fmaxxfrazer%2FFocusEntity%2Fbadge%3Ftype%3Dswift-versions"/>
7
+ <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fmaxxfrazer%2FFocusEntity%2Fbadge%3Ftype%3Dplatforms"/></br>
8
+ <img src="https://github.com/maxxfrazer/FocusEntity/workflows/swiftlint/badge.svg"/>
9
+ <img src="https://github.com/maxxfrazer/FocusEntity/workflows/build/badge.svg"/>
10
+ <img src="https://img.shields.io/github/license/maxxfrazer/FocusEntity"/>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <img src="media/focusentity-dali.gif"/>
15
+ </p>
16
+
17
+ [The Example](./FocusEntity-Example) looks identical to the above GIF, which uses the FocusEntity classic style.
18
+
19
+ See the [documentation](https://maxxfrazer.github.io/FocusEntity/documentation/focusentity/) for more.
20
+
21
+ ## Minimum Requirements
22
+ - Swift 5.2
23
+ - iOS 13.0 (RealityKit)
24
+ - Xcode 11
25
+
26
+ If you're unfamiliar with using RealityKit, I would also recommend reading my articles on [Getting Started with RealityKit](https://medium.com/@maxxfrazer/getting-started-with-realitykit-3b401d6f6f).
27
+
28
+ ## Installation
29
+
30
+ ### Swift Package Manager
31
+
32
+ Add the URL of this repository to your Xcode 11+ Project.
33
+
34
+ Go to File > Swift Packages > Add Package Dependency, and paste in this link:
35
+ `https://github.com/maxxfrazer/FocusEntity`
36
+
37
+ ---
38
+ ## Usage
39
+
40
+ See the [Example project](./FocusEntity-Example) for a full working example as can be seen in the GIF above
41
+
42
+ 1. Install `FocusEntity` with Swift Package Manager
43
+
44
+ ```
45
+ https://github.com/maxxfrazer/FocusEntity.git
46
+ ```
47
+
48
+ 2. Create an instance of FocusEntity, referencing your ARView:
49
+
50
+ ```swift
51
+ let focusSquare = FocusEntity(on: self.arView, focus: .classic)
52
+ ```
53
+
54
+ And that's it! The FocusEntity should already be tracking around your AR scene. There are options to turn the entity off or change its properties.
55
+ Check out [the documentation](https://maxxfrazer.github.io/FocusEntity/documentation/focusentity/) or [example project](FocusEntity-Example) to learn more.
56
+
57
+ ---
58
+
59
+ Feel free to [send me a tweet](https://twitter.com/maxxfrazer) if you have any problems using FocusEntity, or open an Issue or PR!
60
+
61
+
62
+ > The original code to create this repository has been adapted from one of Apple's examples from 2018, [license also included](LICENSE.origin). I have adapted the code to be used and distributed from within a Swift Package, and now further adapted to work with [RealityKit](https://developer.apple.com/documentation/realitykit).