| 29 | } |
| 30 | |
| 31 | func run(seed int) { |
| 32 | // fmt.Println(seed) |
| 33 | rand.Seed(int64(seed)) |
| 34 | eye := ln.Vector{} |
| 35 | center := ln.Vector{0.5, 0, 8} |
| 36 | up := ln.Vector{0, 0, 1} |
| 37 | scene := ln.Scene{} |
| 38 | n := 9.0 |
| 39 | points := pt.PoissonDisc(-n, -n, n, n, 2, 32) |
| 40 | for _, p := range points { |
| 41 | z := rand.Float64()*5 + 20 |
| 42 | v0 := ln.Vector{p.X, p.Y, 0} |
| 43 | v1 := ln.Vector{p.X, p.Y, z} |
| 44 | if v0.Distance(eye) < 1 { |
| 45 | continue |
| 46 | } |
| 47 | c := ln.NewTransformedOutlineCone(eye, up, v0, v1, z/64) |
| 48 | tree := Tree{c, v0, v1} |
| 49 | scene.Add(&tree) |
| 50 | } |
| 51 | width := 2048.0 |
| 52 | height := 2048.0 |
| 53 | fovy := 90.0 |
| 54 | paths := scene.Render(eye, center, up, width, height, fovy, 0.1, 100, 0.1) |
| 55 | path := fmt.Sprintf("out%d.png", seed) |
| 56 | paths.WriteToPNG(path, width, height) |
| 57 | paths.Print() |
| 58 | } |
| 59 | |
| 60 | func main() { |
| 61 | run(10) |