Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from quephird/implememt_soft_shadows
Implememt soft shadows
- Loading branch information
Showing
12 changed files
with
590 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// Jitter.swift | ||
// | ||
// | ||
// Created by Danielle Kefford on 10/11/22. | ||
// | ||
|
||
public protocol Jitter { | ||
mutating func next() -> Double | ||
} | ||
|
||
public struct NoJitter: Jitter { | ||
public mutating func next() -> Double { | ||
return 0.5 | ||
} | ||
} | ||
|
||
public struct PseudorandomJitter: Jitter { | ||
var index: Int = 0 | ||
var values: [Double] | ||
|
||
public init(_ values: [Double]) { | ||
self.values = values | ||
} | ||
|
||
public mutating func next() -> Double { | ||
let nextValue = self.values[index] | ||
index = (index+1) % self.values.count | ||
return nextValue | ||
} | ||
} | ||
|
||
public struct RandomJitter: Jitter { | ||
public func next() -> Double { | ||
return Double.random(in: 0.0...1.0) | ||
} | ||
} |
Oops, something went wrong.