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>
This commit is contained in:
28
GasTankAR/Views/TankCatalogEnvironment.swift
Normal file
28
GasTankAR/Views/TankCatalogEnvironment.swift
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// TankCatalogEnvironment.swift
|
||||
// GasTankAR
|
||||
//
|
||||
// Created by Dennis Nemec on 14.09.26.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
private struct TankCatalogKey: EnvironmentKey {
|
||||
static let defaultValue: any TankCatalogProviding = TankCatalog.shared
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
/// Der in der View-Hierarchie verfügbare Tank-Katalog. Standard: der aus dem
|
||||
/// Bundle geladene `TankCatalog.shared`; in Tests/Previews überschreibbar.
|
||||
var tankCatalog: any TankCatalogProviding {
|
||||
get { self[TankCatalogKey.self] }
|
||||
set { self[TankCatalogKey.self] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
/// Injiziert einen Tank-Katalog in die View-Hierarchie.
|
||||
func tankCatalog(_ catalog: any TankCatalogProviding) -> some View {
|
||||
environment(\.tankCatalog, catalog)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user