Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick calibration #90

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions RealityMixer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
A3837F6D263A239F0053951E /* next.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = A3837F6B263A239F0053951E /* next.mp3 */; };
A3837F6E263A239F0053951E /* reset.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = A3837F6C263A239F0053951E /* reset.mp3 */; };
A39033ED256859A8004CB638 /* Shaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = A39033EC256859A8004CB638 /* Shaders.swift */; };
A39F72CD269D277800501C49 /* QuickCalibrationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A39F72CB269D277800501C49 /* QuickCalibrationViewController.swift */; };
A39F72CE269D277800501C49 /* QuickCalibrationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A39F72CC269D277800501C49 /* QuickCalibrationViewController.xib */; };
A39F72D1269D306900501C49 /* UIScreenExtension in Frameworks */ = {isa = PBXBuildFile; productRef = A39F72D0269D306900501C49 /* UIScreenExtension */; };
A3A50C0725F4945700413E01 /* SwiftlyAttributedStrings in Frameworks */ = {isa = PBXBuildFile; productRef = A3A50C0625F4945700413E01 /* SwiftlyAttributedStrings */; };
A3A50C0C25F57AB700413E01 /* ProjectionPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3A50C0A25F57AB700413E01 /* ProjectionPickerViewController.swift */; };
A3A50C0D25F57AB700413E01 /* ProjectionPickerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3A50C0B25F57AB700413E01 /* ProjectionPickerViewController.xib */; };
Expand Down Expand Up @@ -167,6 +170,8 @@
A3837F6B263A239F0053951E /* next.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = next.mp3; sourceTree = "<group>"; };
A3837F6C263A239F0053951E /* reset.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = reset.mp3; sourceTree = "<group>"; };
A39033EC256859A8004CB638 /* Shaders.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shaders.swift; sourceTree = "<group>"; };
A39F72CB269D277800501C49 /* QuickCalibrationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickCalibrationViewController.swift; sourceTree = "<group>"; };
A39F72CC269D277800501C49 /* QuickCalibrationViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = QuickCalibrationViewController.xib; sourceTree = "<group>"; };
A3A50C0A25F57AB700413E01 /* ProjectionPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectionPickerViewController.swift; sourceTree = "<group>"; };
A3A50C0B25F57AB700413E01 /* ProjectionPickerViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProjectionPickerViewController.xib; sourceTree = "<group>"; };
A3A50C4425F5B71000413E01 /* FFmpeg.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = FFmpeg.xcframework; path = Frameworks/FFmpeg.xcframework; sourceTree = "<group>"; };
Expand All @@ -186,6 +191,7 @@
A328D96B253C95BD00B90E62 /* AudioToolbox.framework in Frameworks */,
A328D96D253C95C300B90E62 /* CoreMedia.framework in Frameworks */,
A328D966253C95AD00B90E62 /* libiconv.tbd in Frameworks */,
A39F72D1269D306900501C49 /* UIScreenExtension in Frameworks */,
A3A50C4525F5B71000413E01 /* FFmpeg.xcframework in Frameworks */,
A328D969253C95B700B90E62 /* VideoToolbox.framework in Frameworks */,
A328D963253C95A000B90E62 /* libz.tbd in Frameworks */,
Expand Down Expand Up @@ -278,6 +284,8 @@
A32416342554E41E008D4B90 /* ProjectionViewController.xib */,
A3A50C0A25F57AB700413E01 /* ProjectionPickerViewController.swift */,
A3A50C0B25F57AB700413E01 /* ProjectionPickerViewController.xib */,
A39F72CB269D277800501C49 /* QuickCalibrationViewController.swift */,
A39F72CC269D277800501C49 /* QuickCalibrationViewController.xib */,
);
path = ViewControllers;
sourceTree = "<group>";
Expand Down Expand Up @@ -483,6 +491,7 @@
packageProductDependencies = (
A3A50C0625F4945700413E01 /* SwiftlyAttributedStrings */,
A3A50C4025F5B3B100413E01 /* SwiftSocket */,
A39F72D0269D306900501C49 /* UIScreenExtension */,
);
productName = MRTest2;
productReference = A328D8AC253C8C4000B90E62 /* RealityMixer.app */;
Expand Down Expand Up @@ -515,6 +524,7 @@
packageReferences = (
A3A50C0525F4945700413E01 /* XCRemoteSwiftPackageReference "swiftly-attributed-strings" */,
A3A50C3F25F5B3B100413E01 /* XCRemoteSwiftPackageReference "SwiftSocket" */,
A39F72CF269D306900501C49 /* XCRemoteSwiftPackageReference "UIScreenExtension" */,
);
productRefGroup = A328D8AD253C8C4000B90E62 /* Products */;
projectDirPath = "";
Expand All @@ -541,6 +551,7 @@
A31C0A2126435F980059A492 /* avatar1.usdz in Resources */,
A324162B2554E1B8008D4B90 /* CalibrationViewController.xib in Resources */,
A3837F6E263A239F0053951E /* reset.mp3 in Resources */,
A39F72CE269D277800501C49 /* QuickCalibrationViewController.xib in Resources */,
A31C0A2226435F980059A492 /* avatar4.usdz in Resources */,
A3837F6D263A239F0053951E /* next.mp3 in Resources */,
A324161F2554DABE008D4B90 /* InitialViewController.xib in Resources */,
Expand All @@ -563,6 +574,7 @@
A32285AF25580A8800FF3200 /* Definitions.swift in Sources */,
A3228605255B864900FF3200 /* AudioDataHeader.m in Sources */,
A328D8B4253C8C4000B90E62 /* MixedRealityConnectionViewController.swift in Sources */,
A39F72CD269D277800501C49 /* QuickCalibrationViewController.swift in Sources */,
A324161E2554DABE008D4B90 /* InitialViewController.swift in Sources */,
A30B22EA2693D9F2005EB78F /* CameraPermissionHelper.swift in Sources */,
A32285AA2558050600FF3200 /* AboutViewController.swift in Sources */,
Expand Down Expand Up @@ -809,6 +821,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
A39F72CF269D306900501C49 /* XCRemoteSwiftPackageReference "UIScreenExtension" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/marchv/UIScreenExtension";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.0.9;
};
};
A3A50C0525F4945700413E01 /* XCRemoteSwiftPackageReference "swiftly-attributed-strings" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/fabio914/swiftly-attributed-strings.git";
Expand All @@ -828,6 +848,11 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
A39F72D0269D306900501C49 /* UIScreenExtension */ = {
isa = XCSwiftPackageProductDependency;
package = A39F72CF269D306900501C49 /* XCRemoteSwiftPackageReference "UIScreenExtension" */;
productName = UIScreenExtension;
};
A3A50C0625F4945700413E01 /* SwiftlyAttributedStrings */ = {
isa = XCSwiftPackageProductDependency;
package = A3A50C0525F4945700413E01 /* XCRemoteSwiftPackageReference "swiftly-attributed-strings" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
import UIKit
import SwiftSocket

enum CalibrationType {
case quick
case standard
}

final class CalibrationConnectionViewController: UIViewController {

@IBOutlet private weak var scrollView: UIScrollView!
Expand All @@ -17,6 +22,8 @@ final class CalibrationConnectionViewController: UIViewController {
@IBOutlet private weak var scaleSegmentedControl: UISegmentedControl!
@IBOutlet private weak var poorPerformanceWarningLabel: UILabel!

@IBOutlet private weak var calibrationTypeSegmentedControl: UISegmentedControl!

@IBOutlet private weak var showInstructionsButton: UIButton!
@IBOutlet private weak var instructionsContainer: UIStackView!
@IBOutlet private weak var infoLabel: UILabel!
Expand Down Expand Up @@ -82,7 +89,7 @@ final class CalibrationConnectionViewController: UIViewController {
"""
}

private func startConnection(address: String, port: Int32) {
private func startConnection(address: String, port: Int32, calibrationType: CalibrationType) {
let connectionAlert = UIAlertController(title: "Connecting...", message: nil, preferredStyle: .alert)

present(connectionAlert, animated: true, completion: { [weak self] in
Expand Down Expand Up @@ -119,12 +126,22 @@ final class CalibrationConnectionViewController: UIViewController {
let scaleFactor = (Double(self.scaleSegmentedControl.selectedSegmentIndex) + 1.0)/Double(self.scaleSegmentedControl.numberOfSegments)

connectionAlert.dismiss(animated: false, completion: { [weak self] in

let viewController = CalibrationViewController(
client: client,
scaleFactor: scaleFactor,
delegate: self
)
let viewController: UIViewController

switch calibrationType {
case .quick:
viewController = QuickCalibrationViewController(
client: client,
scaleFactor: scaleFactor,
delegate: self
)
case .standard:
viewController = CalibrationViewController(
client: client,
scaleFactor: scaleFactor,
delegate: self
)
}

viewController.modalPresentationStyle = .overFullScreen
self?.present(viewController, animated: true, completion: nil)
Expand All @@ -148,8 +165,10 @@ final class CalibrationConnectionViewController: UIViewController {
return
}

let calibrationType: CalibrationType = calibrationTypeSegmentedControl.selectedSegmentIndex == 0 ? .standard:.quick

CameraPermissionHelper.ensurePermission(from: self, completion: { [weak self] in
self?.startConnection(address: address, port: port)
self?.startConnection(address: address, port: port, calibrationType: calibrationType)
})
}

Expand All @@ -172,6 +191,20 @@ final class CalibrationConnectionViewController: UIViewController {
present(alert, animated: true, completion: nil)
}

@IBAction private func openCalibrationTypeInstructions(_ sender: Any) {
// TODO
let alert = UIAlertController(
title: "TODO",
message: """
TODO
""",
preferredStyle: .alert
)

alert.addAction(.init(title: "OK", style: .default, handler: nil))
present(alert, animated: true, completion: nil)
}

@IBAction private func downloadMRCAction(_ sender: Any) {
UIApplication.shared.open(Definitions.oculusMRCapp, options: [:], completionHandler: nil)
}
Expand Down
Loading