From e7b107a96e2c4cf9432b7cc2a4bf4852c0f125ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=27=C3=A9lectron=20rare?= <108685187+electron-rare@users.noreply.github.com> Date: Fri, 26 Jun 2026 12:13:55 +0200 Subject: [PATCH] feat(avlivebody): render settings state object Add RenderSettings ObservableObject with Published defaults for layer visibility, mesh material, video opacity, light intensities, camera FOV, and panel toggle. Add RenderSettingsTests asserting all eleven defaults via TDD red-green cycle. --- .../Sources/AVLiveBody/RenderSettings.swift | 31 +++++++++++++++++++ .../AVLiveBodyTests/RenderSettingsTests.swift | 21 +++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 avlivebody-mac/Sources/AVLiveBody/RenderSettings.swift create mode 100644 avlivebody-mac/Tests/AVLiveBodyTests/RenderSettingsTests.swift diff --git a/avlivebody-mac/Sources/AVLiveBody/RenderSettings.swift b/avlivebody-mac/Sources/AVLiveBody/RenderSettings.swift new file mode 100644 index 0000000..3cc821e --- /dev/null +++ b/avlivebody-mac/Sources/AVLiveBody/RenderSettings.swift @@ -0,0 +1,31 @@ +// avlivebody-mac/Sources/AVLiveBody/RenderSettings.swift +import SwiftUI + +/// Live visual settings for AVLiveBody. ContentView observes this and +/// pushes changes to SceneController. Defaults chosen so the scene is +/// lit and everything visible out of the box. +@MainActor +final class RenderSettings: ObservableObject { + // Layer visibility + @Published var showSkeleton: Bool = true + @Published var showMesh: Bool = true + @Published var showVideo: Bool = true + + // Mesh material + @Published var meshMetallic: Bool = false + @Published var meshRoughness: Double = 0.6 + + // Video quad + @Published var videoOpacity: Double = 1.0 + + // Lights (RealityKit DirectionalLight intensities) + @Published var keyIntensity: Double = 4000 + @Published var fillIntensity: Double = 1500 + @Published var rimIntensity: Double = 2000 + + // Camera + @Published var fieldOfView: Double = 55 + + // Panel visibility + @Published var showPanel: Bool = false +} diff --git a/avlivebody-mac/Tests/AVLiveBodyTests/RenderSettingsTests.swift b/avlivebody-mac/Tests/AVLiveBodyTests/RenderSettingsTests.swift new file mode 100644 index 0000000..ac9dcd4 --- /dev/null +++ b/avlivebody-mac/Tests/AVLiveBodyTests/RenderSettingsTests.swift @@ -0,0 +1,21 @@ +// avlivebody-mac/Tests/AVLiveBodyTests/RenderSettingsTests.swift +import XCTest +@testable import AVLiveBody + +@MainActor +final class RenderSettingsTests: XCTestCase { + func testDefaults() { + let s = RenderSettings() + XCTAssertTrue(s.showSkeleton) + XCTAssertTrue(s.showMesh) + XCTAssertTrue(s.showVideo) + XCTAssertFalse(s.meshMetallic) + XCTAssertEqual(s.meshRoughness, 0.6, accuracy: 1e-9) + XCTAssertEqual(s.videoOpacity, 1.0, accuracy: 1e-9) + XCTAssertEqual(s.keyIntensity, 4000, accuracy: 1e-9) + XCTAssertEqual(s.fillIntensity, 1500, accuracy: 1e-9) + XCTAssertEqual(s.rimIntensity, 2000, accuracy: 1e-9) + XCTAssertEqual(s.fieldOfView, 55, accuracy: 1e-9) + XCTAssertFalse(s.showPanel) + } +}