bots-garden/pov-ray-gopublic Fork
⑂ 3697170
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/pov-ray-go.git
git clone ssh://git@rickub.com/bots-garden/pov-ray-go.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

Make the library importable as rickub.com/bots-garden/pov-ray-go

- Rename the module from the go-povray placeholder to its real path
  (rickub.com serves the go-import meta tag) and update all imports.
- Lower the go directive to 1.22 so consumers are not forced onto 1.27.
- Document installation in the README; drop the item from the roadmap.
- procedural example: brighter lights, bigger spheres and boxes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agent committed 2026-11-22T05:22:28+01:00 Browse files
3697170 parent: 57a2dd3
modified README.md +12 -0
@@ -29,6 +29,18 @@ pov-ray-go/
2929 └── pathtrace/ path-traced room with emissive light panels
3030 ```
3131
32+## Use it in your project
33+
34+```bash
35+go get rickub.com/bots-garden/pov-ray-go@latest
36+```
37+
38+```go
39+import povray "rickub.com/bots-garden/pov-ray-go"
40+```
41+
42+The package name is `povray`. The module requires Go 1.22 or newer.
43+
3244 ## Quick start
3345
3446 ```go
@@ -29,6 +29,18 @@ pov-ray-go/
29 └── pathtrace/ path-traced room with emissive light panels29 └── pathtrace/ path-traced room with emissive light panels
30 ```30 ```
31 31
32+## Use it in your project
33+
34+```bash
35+go get rickub.com/bots-garden/pov-ray-go@latest
36+```
37+
38+```go
39+import povray "rickub.com/bots-garden/pov-ray-go"
40+```
41+
42+The package name is `povray`. The module requires Go 1.22 or newer.
43+
32 ## Quick start44 ## Quick start
33 45
34 ```go46 ```go
modified ROADMAP.md +1 -2
@@ -19,7 +19,6 @@ Status snapshot of the `povray` library and the work that remains, in order of i
1919
2020 ## 3. Engineering — what a publishable package needs
2121
22-- **Real module path** — `go-povray` is a placeholder; nobody can `go get` the package.
2322 - **CI** — no `.github/workflows`; a simple `go test` + `go vet` + `gofmt -l` on GitHub Actions.
2423 - **Test coverage** — examples have no tests; missing cases: `Box` seen from inside, nested `Group`, refraction through the glass sphere, `SavePNG` on a rendered (not 4×3) image.
2524 - **`go vet` clean everywhere** — unkeyed `Vec3{...}`/`Color{...}` literals in examples are still flagged; key them, add a `//nolint`, or provide constructors.
@@ -34,4 +33,4 @@ Status snapshot of the `povray` library and the work that remains, in order of i
3433 3. ~~**Path tracing**~~ — done (`pathtracer.go`, `examples/pathtrace`).
3534 4. ~~**Textures**~~ — done (`texture.go`, `examples/textures`).
3635
37-Package hygiene (real module path + `LICENSE` + CI + `Makefile`) is about an hour of work and makes the package publishable.
36+Package hygiene (`LICENSE` + CI + `Makefile`) is about an hour of work and makes the package publishable.
@@ -19,7 +19,6 @@ Status snapshot of the `povray` library and the work that remains, in order of i
19 19
20 ## 3. Engineering — what a publishable package needs20 ## 3. Engineering — what a publishable package needs
21 21
22-- **Real module path** — `go-povray` is a placeholder; nobody can `go get` the package.
23 - **CI** — no `.github/workflows`; a simple `go test` + `go vet` + `gofmt -l` on GitHub Actions.22 - **CI** — no `.github/workflows`; a simple `go test` + `go vet` + `gofmt -l` on GitHub Actions.
24 - **Test coverage** — examples have no tests; missing cases: `Box` seen from inside, nested `Group`, refraction through the glass sphere, `SavePNG` on a rendered (not 4×3) image.23 - **Test coverage** — examples have no tests; missing cases: `Box` seen from inside, nested `Group`, refraction through the glass sphere, `SavePNG` on a rendered (not 4×3) image.
25 - **`go vet` clean everywhere** — unkeyed `Vec3{...}`/`Color{...}` literals in examples are still flagged; key them, add a `//nolint`, or provide constructors.24 - **`go vet` clean everywhere** — unkeyed `Vec3{...}`/`Color{...}` literals in examples are still flagged; key them, add a `//nolint`, or provide constructors.
@@ -34,4 +33,4 @@ Status snapshot of the `povray` library and the work that remains, in order of i
34 3. ~~**Path tracing**~~ — done (`pathtracer.go`, `examples/pathtrace`).33 3. ~~**Path tracing**~~ — done (`pathtracer.go`, `examples/pathtrace`).
35 4. ~~**Textures**~~ — done (`texture.go`, `examples/textures`).34 4. ~~**Textures**~~ — done (`texture.go`, `examples/textures`).
36 35
37-Package hygiene (real module path + `LICENSE` + CI + `Makefile`) is about an hour of work and makes the package publishable.36+Package hygiene (`LICENSE` + CI + `Makefile`) is about an hour of work and makes the package publishable.
modified docs/TUTORIAL.md +1 -1
@@ -14,7 +14,7 @@ package main
1414 import (
1515 "log"
1616
17- "go-povray"
17+ povray "rickub.com/bots-garden/pov-ray-go"
1818 )
1919
2020 func main() {
@@ -14,7 +14,7 @@ package main
14 import (14 import (
15 "log"15 "log"
16 16
17- "go-povray"17+ povray "rickub.com/bots-garden/pov-ray-go"
18 )18 )
19 19
20 func main() {20 func main() {
modified examples/mirror/main.go +1 -1
@@ -6,7 +6,7 @@ import (
66 "fmt"
77 "log"
88
9- "go-povray"
9+ povray "rickub.com/bots-garden/pov-ray-go"
1010 )
1111
1212 func main() {
@@ -6,7 +6,7 @@ import (
6 "fmt"6 "fmt"
7 "log"7 "log"
8 8
9- "go-povray"9+ povray "rickub.com/bots-garden/pov-ray-go"
10 )10 )
11 11
12 func main() {12 func main() {
modified examples/pathtrace/main.go +1 -1
@@ -8,7 +8,7 @@ import (
88 "log"
99 "math"
1010
11- "go-povray"
11+ povray "rickub.com/bots-garden/pov-ray-go"
1212 )
1313
1414 func main() {
@@ -8,7 +8,7 @@ import (
8 "log"8 "log"
9 "math"9 "math"
10 10
11- "go-povray"11+ povray "rickub.com/bots-garden/pov-ray-go"
12 )12 )
13 13
14 func main() {14 func main() {
modified examples/procedural/main.go +24 -16
@@ -8,32 +8,32 @@ import (
88 "log"
99 "math"
1010
11- "go-povray"
11+ povray "rickub.com/bots-garden/pov-ray-go"
1212 )
1313
1414 func main() {
1515 scene := povray.NewScene()
16- scene.Background = povray.Color{0.02, 0.03, 0.08}
16+ scene.Background = povray.Color{0.08, 0.1, 0.18}
1717
1818 // Ground.
1919 groundMat := povray.Material{
2020 Diffuse: povray.Color{0.3, 0.32, 0.38},
2121 Specular: povray.Color{0.2, 0.2, 0.2},
2222 Shininess: 15,
23- Ambient: 0.25,
23+ Ambient: 0.15,
2424 }
2525 scene.AddObject(povray.NewPlaneXY(0), groundMat)
2626
2727 // A 6x6 grid of spheres; color and height vary with position.
2828 const n = 6
29- step := 1.6
29+ step := 2.2
3030 for i := 0; i < n; i++ {
3131 for j := 0; j < n; j++ {
3232 x := (float64(i) - float64(n-1)/2) * step
3333 z := (float64(j) - float64(n-1)/2) * step
3434 dist := math.Hypot(x, z)
35- r := 0.55 - 0.1*math.Min(1, dist/6)
36- h := r + 0.25*math.Sin(dist*0.8)
35+ r := 0.9 - 0.15*math.Min(1, dist/8)
36+ h := r + 0.35*math.Sin(dist*0.6)
3737
3838 // Hue sweep across the grid.
3939 t := float64(i+j) / float64(2*n)
@@ -53,29 +53,30 @@ func main() {
5353 const m = 12
5454 for k := 0; k < m; k++ {
5555 a := 2 * math.Pi * float64(k) / m
56- x, z := 7.5*math.Cos(a), 7.5*math.Sin(a)
57- h := 1 + 0.8*math.Sin(3*a)
56+ x, z := 10*math.Cos(a), 10*math.Sin(a)
57+ h := 1.8 + 1.2*math.Sin(3*a)
5858 c := hsv(0.55+0.08*math.Sin(2*a), 0.5, 0.8)
5959 mat := povray.Material{
6060 Diffuse: c,
6161 Specular: povray.White,
6262 Shininess: 25,
63- Ambient: 0.15,
63+ Ambient: 0.12,
6464 }
6565 scene.AddObject(povray.Box{
66- Min: povray.Vec3{x - 0.4, 0, z - 0.4},
67- Max: povray.Vec3{x + 0.4, h, z + 0.4},
66+ Min: povray.Vec3{x - 0.7, 0, z - 0.7},
67+ Max: povray.Vec3{x + 0.7, h, z + 0.7},
6868 }, mat)
6969 }
7070
71- // Three colored lights for a dramatic look.
71+ // Colored lights for a dramatic look, plus a white front light.
7272 scene.Lights = []povray.Light{
73- povray.NewLight(povray.Vec3{0, 12, 0}, povray.White),
74- povray.NewLight(povray.Vec3{10, 5, 10}, povray.Color{1, 0.4, 0.3}),
75- povray.NewLight(povray.Vec3{-10, 5, -10}, povray.Color{0.3, 0.4, 1}),
73+ light(povray.Vec3{0, 15, 0}, povray.White, 18),
74+ light(povray.Vec3{12, 6, 12}, povray.Color{1, 0.4, 0.3}, 14),
75+ light(povray.Vec3{-12, 6, -12}, povray.Color{0.3, 0.4, 1}, 14),
76+ light(povray.Vec3{0, 10, 20}, povray.White, 12),
7677 }
7778
78- cam := povray.NewCamera(povray.Vec3{0, 9, 16})
79+ cam := povray.NewCamera(povray.Vec3{0, 10, 17})
7980 cam.LookAt = povray.Vec3{0, 0.5, 0}
8081 cam.Fov = 50
8182
@@ -87,6 +88,13 @@ func main() {
8788 fmt.Println("wrote procedural.png")
8889 }
8990
91+// light returns a point light with the given intensity.
92+func light(pos povray.Vec3, c povray.Color, intensity float64) povray.Light {
93+ l := povray.NewLight(pos, c)
94+ l.Intensity = intensity
95+ return l
96+}
97+
9098 // hsv converts hue [0,1), saturation and value [0,1] to RGB.
9199 func hsv(h, s, v float64) povray.Color {
92100 h = math.Mod(h, 1)
@@ -8,32 +8,32 @@ import (
8 "log"8 "log"
9 "math"9 "math"
10 10
11- "go-povray"11+ povray "rickub.com/bots-garden/pov-ray-go"
12 )12 )
13 13
14 func main() {14 func main() {
15 scene := povray.NewScene()15 scene := povray.NewScene()
16- scene.Background = povray.Color{0.02, 0.03, 0.08}16+ scene.Background = povray.Color{0.08, 0.1, 0.18}
17 17
18 // Ground.18 // Ground.
19 groundMat := povray.Material{19 groundMat := povray.Material{
20 Diffuse: povray.Color{0.3, 0.32, 0.38},20 Diffuse: povray.Color{0.3, 0.32, 0.38},
21 Specular: povray.Color{0.2, 0.2, 0.2},21 Specular: povray.Color{0.2, 0.2, 0.2},
22 Shininess: 15,22 Shininess: 15,
23- Ambient: 0.25,23+ Ambient: 0.15,
24 }24 }
25 scene.AddObject(povray.NewPlaneXY(0), groundMat)25 scene.AddObject(povray.NewPlaneXY(0), groundMat)
26 26
27 // A 6x6 grid of spheres; color and height vary with position.27 // A 6x6 grid of spheres; color and height vary with position.
28 const n = 628 const n = 6
29- step := 1.629+ step := 2.2
30 for i := 0; i < n; i++ {30 for i := 0; i < n; i++ {
31 for j := 0; j < n; j++ {31 for j := 0; j < n; j++ {
32 x := (float64(i) - float64(n-1)/2) * step32 x := (float64(i) - float64(n-1)/2) * step
33 z := (float64(j) - float64(n-1)/2) * step33 z := (float64(j) - float64(n-1)/2) * step
34 dist := math.Hypot(x, z)34 dist := math.Hypot(x, z)
35- r := 0.55 - 0.1*math.Min(1, dist/6)35+ r := 0.9 - 0.15*math.Min(1, dist/8)
36- h := r + 0.25*math.Sin(dist*0.8)36+ h := r + 0.35*math.Sin(dist*0.6)
37 37
38 // Hue sweep across the grid.38 // Hue sweep across the grid.
39 t := float64(i+j) / float64(2*n)39 t := float64(i+j) / float64(2*n)
@@ -53,29 +53,30 @@ func main() {
53 const m = 1253 const m = 12
54 for k := 0; k < m; k++ {54 for k := 0; k < m; k++ {
55 a := 2 * math.Pi * float64(k) / m55 a := 2 * math.Pi * float64(k) / m
56- x, z := 7.5*math.Cos(a), 7.5*math.Sin(a)56+ x, z := 10*math.Cos(a), 10*math.Sin(a)
57- h := 1 + 0.8*math.Sin(3*a)57+ h := 1.8 + 1.2*math.Sin(3*a)
58 c := hsv(0.55+0.08*math.Sin(2*a), 0.5, 0.8)58 c := hsv(0.55+0.08*math.Sin(2*a), 0.5, 0.8)
59 mat := povray.Material{59 mat := povray.Material{
60 Diffuse: c,60 Diffuse: c,
61 Specular: povray.White,61 Specular: povray.White,
62 Shininess: 25,62 Shininess: 25,
63- Ambient: 0.15,63+ Ambient: 0.12,
64 }64 }
65 scene.AddObject(povray.Box{65 scene.AddObject(povray.Box{
66- Min: povray.Vec3{x - 0.4, 0, z - 0.4},66+ Min: povray.Vec3{x - 0.7, 0, z - 0.7},
67- Max: povray.Vec3{x + 0.4, h, z + 0.4},67+ Max: povray.Vec3{x + 0.7, h, z + 0.7},
68 }, mat)68 }, mat)
69 }69 }
70 70
71- // Three colored lights for a dramatic look.71+ // Colored lights for a dramatic look, plus a white front light.
72 scene.Lights = []povray.Light{72 scene.Lights = []povray.Light{
73- povray.NewLight(povray.Vec3{0, 12, 0}, povray.White),73+ light(povray.Vec3{0, 15, 0}, povray.White, 18),
74- povray.NewLight(povray.Vec3{10, 5, 10}, povray.Color{1, 0.4, 0.3}),74+ light(povray.Vec3{12, 6, 12}, povray.Color{1, 0.4, 0.3}, 14),
75- povray.NewLight(povray.Vec3{-10, 5, -10}, povray.Color{0.3, 0.4, 1}),75+ light(povray.Vec3{-12, 6, -12}, povray.Color{0.3, 0.4, 1}, 14),
76+ light(povray.Vec3{0, 10, 20}, povray.White, 12),
76 }77 }
77 78
78- cam := povray.NewCamera(povray.Vec3{0, 9, 16})79+ cam := povray.NewCamera(povray.Vec3{0, 10, 17})
79 cam.LookAt = povray.Vec3{0, 0.5, 0}80 cam.LookAt = povray.Vec3{0, 0.5, 0}
80 cam.Fov = 5081 cam.Fov = 50
81 82
@@ -87,6 +88,13 @@ func main() {
87 fmt.Println("wrote procedural.png")88 fmt.Println("wrote procedural.png")
88 }89 }
89 90
91+// light returns a point light with the given intensity.
92+func light(pos povray.Vec3, c povray.Color, intensity float64) povray.Light {
93+ l := povray.NewLight(pos, c)
94+ l.Intensity = intensity
95+ return l
96+}
97+
90 // hsv converts hue [0,1), saturation and value [0,1] to RGB.98 // hsv converts hue [0,1), saturation and value [0,1] to RGB.
91 func hsv(h, s, v float64) povray.Color {99 func hsv(h, s, v float64) povray.Color {
92 h = math.Mod(h, 1)100 h = math.Mod(h, 1)
modified examples/spheres/main.go +1 -1
@@ -6,7 +6,7 @@ import (
66 "fmt"
77 "log"
88
9- "go-povray"
9+ povray "rickub.com/bots-garden/pov-ray-go"
1010 )
1111
1212 func main() {
@@ -6,7 +6,7 @@ import (
6 "fmt"6 "fmt"
7 "log"7 "log"
8 8
9- "go-povray"9+ povray "rickub.com/bots-garden/pov-ray-go"
10 )10 )
11 11
12 func main() {12 func main() {
modified examples/textures-big/main.go +1 -1
@@ -9,7 +9,7 @@ import (
99 "log"
1010 "math"
1111
12- "go-povray"
12+ povray "rickub.com/bots-garden/pov-ray-go"
1313 )
1414
1515 func main() {
@@ -9,7 +9,7 @@ import (
9 "log"9 "log"
10 "math"10 "math"
11 11
12- "go-povray"12+ povray "rickub.com/bots-garden/pov-ray-go"
13 )13 )
14 14
15 func main() {15 func main() {
modified examples/textures/main.go +1 -1
@@ -7,7 +7,7 @@ import (
77 "fmt"
88 "log"
99
10- "go-povray"
10+ povray "rickub.com/bots-garden/pov-ray-go"
1111 )
1212
1313 func main() {
@@ -7,7 +7,7 @@ import (
7 "fmt"7 "fmt"
8 "log"8 "log"
9 9
10- "go-povray"10+ povray "rickub.com/bots-garden/pov-ray-go"
11 )11 )
12 12
13 func main() {13 func main() {
modified examples/transform/main.go +1 -1
@@ -8,7 +8,7 @@ import (
88 "log"
99 "math"
1010
11- "go-povray"
11+ povray "rickub.com/bots-garden/pov-ray-go"
1212 )
1313
1414 func main() {
@@ -8,7 +8,7 @@ import (
8 "log"8 "log"
9 "math"9 "math"
10 10
11- "go-povray"11+ povray "rickub.com/bots-garden/pov-ray-go"
12 )12 )
13 13
14 func main() {14 func main() {
modified go.mod +2 -2
@@ -1,3 +1,3 @@
1-module go-povray
1+module rickub.com/bots-garden/pov-ray-go
22
3-go 1.27.3
3+go 1.22
@@ -1,3 +1,3 @@
1-module go-povray1+module rickub.com/bots-garden/pov-ray-go
2 2
3-go 1.27.33+go 1.22