switch permutation type to ubyte

This commit is contained in:
2024-09-09 04:11:26 +10:00
parent 493790bd64
commit b6085c8f1c
4 changed files with 8 additions and 8 deletions

View File

@ -1,15 +1,15 @@
import Foundation
public struct ImprovedPerlin<Scalar: BinaryFloatingPoint & SIMDScalar>: CoherentNoise2D, CoherentNoise3D, CoherentNoiseRandomInit, CoherentNoiseTableInit {
private let p: [Int16]
private let p: [UInt8]
public init(permutation: [Int16]) {
public init(permutation: [UInt8]) {
assert(permutation.count == 0x100)
self.p = permutation
}
public init<Random: RandomProvider>(random: inout Random) {
self.p = (0..<0x100).map { Int16($0) }.shuffled(using: &random)
self.p = (0..<0x100).map { UInt8($0) }.shuffled(using: &random)
}
public func get(_ point: SIMD2<Scalar>) -> Scalar {