mirror of
				https://github.com/GayPizzaSpecifications/voxelotl-engine.git
				synced 2025-11-03 18:49:38 +00:00 
			
		
		
		
	linearise block colours at generation time
This commit is contained in:
		@ -112,7 +112,7 @@ public struct Chunk {
 | 
			
		||||
 | 
			
		||||
public enum BlockType: Equatable {
 | 
			
		||||
  case air
 | 
			
		||||
  case solid(_ color: Color<UInt8>)
 | 
			
		||||
  case solid(_ color: Color<Float16>)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public struct Block {
 | 
			
		||||
 | 
			
		||||
@ -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<Float>(position) + 0.5,
 | 
			
		||||
          scale:    .init(repeating: 0.5),
 | 
			
		||||
          color:    Color<Float16>(color).linear)
 | 
			
		||||
          color:    color)
 | 
			
		||||
      } else { nil }
 | 
			
		||||
    }
 | 
			
		||||
    if !instances.isEmpty {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user