Files
Gas-Tank-AR-App/GasTankAR/Model/Tank.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

66 lines
1.9 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.

//
// Tank.swift
// GasTankAR
//
// Created by Dennis Nemec on 25.08.26.
//
import Foundation
/// Verfügbare Tankgrößen. Die Enum-Fälle sind reine, stabile Identitäten
/// (werden so persistiert). Anzeigenamen und 3D-Modelle liefert der
/// `TankCatalog` (aus `Tanks.json`) – siehe `TankDefinition`.
nonisolated enum TankSize: String, CaseIterable, Identifiable, Codable, Hashable {
case t1_2
case t2_1
case t2_9
var id: String { rawValue }
}
/// Verfügbare Tankfarben. Welche Farben tatsächlich auswählbar sind, ergibt
/// sich dynamisch aus dem `TankCatalog` (abhängig von Größe & Aufstellungsart).
nonisolated enum TankColor: String, CaseIterable, Identifiable, Codable, Hashable {
case white
case green
case olive
var id: String { rawValue }
}
/// Aufstellungsart des Tanks. Steuert neben der Modellauswahl auch das
/// AR-Verhalten (Grube, Occlusion, „nur Deckel").
nonisolated enum TankPlacement: String, CaseIterable, Identifiable, Codable, Hashable {
case aboveGround
case belowGround
var id: String { rawValue }
var displayName: String {
switch self {
case .aboveGround: "Oberirdisch"
case .belowGround: "Unterirdisch"
}
}
/// Name des Asset-Icons für diese Aufstellungsart.
var imageName: String {
switch self {
case .aboveGround: "tank-upper"
case .belowGround: "tank-lower"
}
}
}
/// Die für ein Projekt getroffene Tank-Auswahl. `Tank` ist die persistierte
/// Identität (Größe, Farbe, Aufstellungsart); die zugehörigen Anzeigenamen und
/// das 3D-Modell werden über den `TankCatalog` aufgelöst.
nonisolated struct Tank: Hashable, Codable {
var size: TankSize = .t1_2
var color: TankColor = .white
var placement: TankPlacement = .aboveGround
/// Optionale Darstellung, bei der nur der Deckel sichtbar ist.
var showLidOnly: Bool = false
}