mirror of
https://github.com/Smaug123/ray-tracing-fsharp
synced 2025-10-17 17:48:40 +00:00
Writer
This commit is contained in:
22
RayTracing/SampleImages.fs
Normal file
22
RayTracing/SampleImages.fs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace RayTracing
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module SampleImages =
|
||||
|
||||
let gradient (progressIncrement : float<progress> -> unit) : float<progress> * Image Async =
|
||||
let pixelAt i j =
|
||||
{
|
||||
Red = (byte i)
|
||||
Green = (byte j)
|
||||
Blue = 64uy
|
||||
}
|
||||
|
||||
256.0<progress>,
|
||||
async {
|
||||
return Array.init 256 (fun i ->
|
||||
let output = Array.init 256 (pixelAt i)
|
||||
progressIncrement 1.0<progress>
|
||||
output
|
||||
)
|
||||
|> Image
|
||||
}
|
Reference in New Issue
Block a user