aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-08-27 11:23:39 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-08-27 11:23:39 +0200
commitbf6560bb2007581892932a367f4319f2f2a01919 (patch)
treee25324d3ba5225e8abca83a57c2af10c64c10cda /main.go
parent4c823f57959a5d821a9f00d8e8c7f57c08ac2ded (diff)
Make old project runnable on Go 1.27 with mise and READMEHEADmaster
- init go.mod (Go 1.27, progressbar/v3 v3.19.1) and fix import - fix FMin returning max, remove deprecated RenderBlank, apply go fix range loops - add mise.toml (go 1.27, tasks: build/run/check with go fix -diff/clean) - add focused README and update .gitignore for build artifacts
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/main.go b/main.go
index 957fc92..1330e74 100644
--- a/main.go
+++ b/main.go
@@ -5,7 +5,7 @@ import (
"math"
"math/rand"
- "github.com/schollz/progressbar"
+ "github.com/schollz/progressbar/v3"
)
const (
@@ -55,14 +55,13 @@ func main() {
// move := Vec3D{2.0, 0.0, 0.0}
frame := Frame{}
bar := progressbar.New(Height)
- bar.RenderBlank()
// for k := 0; k < FPS*DURATION; k++ {
// origin := AddVec3D(start, ScalarProduct(float64(k)/float64(FPS*DURATION), move))
// camera.origin = origin
- for x := 0; x < Height; x++ {
- for y := 0; y < Width; y++ {
+ for x := range Height {
+ for y := range Width {
var colorList [RaysPerPixel]Color
- for it := 0; it < RaysPerPixel; it++ {
+ for it := range RaysPerPixel {
u := (float64(y) + rand.Float64()) / float64(Width)
v := (float64(x) + rand.Float64()) / float64(Height)
ray := camera.GetRay(u, v)