Files
Gas-Tank-AR-App/GasTankAR/Views/SettingsView.swift
Dennis Nemec b8536d4182 Add tank catalog with USDZ models and tank selection
Introduce TankDefinition/TankCatalog loaded from Tanks.json, bundle the
Drachengas USDZ tank models, add tank selection and preview views, and
update the AR experience, editor and project views to use the catalog.
Includes tests for catalog loading and model selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 19:12:39 +02:00

74 lines
2.6 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// SettingsView.swift
// GasTankAR
//
// Created by Dennis Nemec on 26.08.26.
//
import SwiftUI
import ARKit
/// Zentraler Schlüssel für die LiDAR-Einstellung (in AppStorage/UserDefaults).
enum SettingsKeys {
static let lidarFeaturesEnabled = "lidarFeaturesEnabled"
static let arExposure = "arExposure"
}
struct SettingsView: View {
@AppStorage(SettingsKeys.lidarFeaturesEnabled) private var lidarEnabled = false
@AppStorage(SettingsKeys.arExposure) private var arExposure = 1.0
@Environment(\.dismiss) private var dismiss
/// LiDAR ist verfügbar, wenn das Gerät Scene-Reconstruction (Mesh) unterstützt.
private var lidarSupported: Bool {
ARWorldTrackingConfiguration.supportsSceneReconstruction(.mesh)
}
var body: some View {
NavigationStack {
Form {
Section {
Toggle("LiDAR-Funktionen aktivieren", isOn: $lidarEnabled)
.disabled(!lidarSupported)
} header: {
Text("Augmented Reality")
} footer: {
if lidarSupported {
Text("Nutzt den LiDAR-Scanner für präzisere Flächenerkennung, Tiefe und realistische Verdeckung. Änderungen greifen beim nächsten Start des AR-Modus.")
} else {
Text("Dieses Gerät hat keinen LiDAR-Scanner. Die App nutzt automatisch das Verfahren ohne LiDAR.")
}
}
Section {
HStack {
Text("Belichtung")
Spacer()
Text(arExposure.formatted(.number.precision(.fractionLength(1))) + "×")
.foregroundStyle(.secondary)
.monospacedDigit()
}
Slider(value: $arExposure, in: 0.5...2.0, step: 0.1)
.accessibilityLabel("AR-Belichtung")
.accessibilityValue(arExposure.formatted(.number.precision(.fractionLength(1))) + " mal")
} header: {
Text("Darstellung")
} footer: {
Text("Passt die zusätzliche Beleuchtung der oberirdischen Tanks an. Änderungen greifen beim nächsten Start des AR-Modus.")
}
}
.navigationTitle("Einstellungen")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Fertig") { dismiss() }
}
}
}
}
}
#Preview {
SettingsView()
}