From 7eb880f0b716f93db991e9e52a158c1e0c5ccf12 Mon Sep 17 00:00:00 2001 From: a dinosaur Date: Thu, 22 Aug 2024 03:49:50 +1000 Subject: [PATCH] linearise block colours at generation time --- Sources/Voxelotl/Chunk.swift | 2 +- Sources/Voxelotl/Game.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Voxelotl/Chunk.swift b/Sources/Voxelotl/Chunk.swift index 0ca60d8..543b67a 100644 --- a/Sources/Voxelotl/Chunk.swift +++ b/Sources/Voxelotl/Chunk.swift @@ -112,7 +112,7 @@ public struct Chunk { public enum BlockType: Equatable { case air - case solid(_ color: Color) + case solid(_ color: Color) } public struct Block { diff --git a/Sources/Voxelotl/Game.swift b/Sources/Voxelotl/Game.swift index e850c4b..027d2c6 100644 --- a/Sources/Voxelotl/Game.swift +++ b/Sources/Voxelotl/Game.swift @@ -36,7 +36,7 @@ class Game: GameDelegate { var random = DarwinRandom(seed: Arc4Random.instance.next(in: DarwinRandom.max)) self.chunk.fill(allBy: { if (random.next() & 0x1) == 0x1 { - .solid(.init(rgb888: UInt32(random.next(in: 0..<0xFFFFFF+1)))) + .solid(.init(rgb888: UInt32(random.next(in: 0..<0xFFFFFF+1))).linear) } else { .air } @@ -84,7 +84,7 @@ class Game: GameDelegate { Instance( position: SIMD3(position) + 0.5, scale: .init(repeating: 0.5), - color: Color(color).linear) + color: color) } else { nil } } if !instances.isEmpty {