func main() { scene := pt.Scene{} scene.SetColor(pt.Color{1, 1, 1}) meshes := []*pt.Mesh{ CreateBrick(1), // white CreateBrick(21), // bright red CreateBrick(23), // bright blue CreateBrick(24), // bright yellow CreateBrick(26), // black CreateBrick(28), // dark green } for x := -30; x <= 50; x += 2 { for y := -50; y <= 20; y += 4 { h := rand.Intn(5) + 1 for i := 0; i < h; i++ { dy := 0 if (x/2+i)%2 == 0 { dy = 2 } z := float64(i) * H mesh := meshes[rand.Intn(len(meshes))] m := pt.Translate(pt.Vector{float64(x), float64(y + dy), z}) scene.Add(pt.NewTransformedShape(mesh, m)) } } } // light := pt.LightMaterial(pt.Color{0.2, 0.2, 0.2}, 10, pt.QuadraticAttenuation(0.01)) // scene.Add(pt.NewSphere(pt.Vector{0, 0, 25}, 1, light)) camera := pt.LookAt(pt.Vector{-23, 13, 20}, pt.Vector{0, 0, 0}, pt.Vector{0, 0, 1}, 45) pt.RenderToWindow(pt.Render(&scene, &camera)) }
func main() { scene := pt.Scene{} meshes := []pt.Shape{ createMesh(pt.GlossyMaterial(pt.HexColor(0x3B596A), 1.5, pt.Radians(20))), createMesh(pt.GlossyMaterial(pt.HexColor(0x427676), 1.5, pt.Radians(20))), createMesh(pt.GlossyMaterial(pt.HexColor(0x3F9A82), 1.5, pt.Radians(20))), createMesh(pt.GlossyMaterial(pt.HexColor(0xA1CD73), 1.5, pt.Radians(20))), createMesh(pt.GlossyMaterial(pt.HexColor(0xECDB60), 1.5, pt.Radians(20))), } for x := -8; x <= 8; x++ { for z := -12; z <= 12; z++ { fx := float64(x) fy := rand.Float64() * 2 fz := float64(z) scene.Add(pt.NewTransformedShape(meshes[rand.Intn(len(meshes))], pt.Translate(pt.Vector{fx, fy, fz}))) scene.Add(pt.NewTransformedShape(meshes[rand.Intn(len(meshes))], pt.Translate(pt.Vector{fx, fy - 1, fz}))) } } scene.Add(pt.NewSphere(pt.Vector{8, 10, 0}, 3, pt.LightMaterial(pt.Color{1, 1, 1}, 1, pt.NoAttenuation))) camera := pt.LookAt(pt.Vector{-10, 10, 0}, pt.Vector{-2, 0, 0}, pt.Vector{0, 1, 0}, 45) pt.RenderConfig.CameraSamples = 80 pt.RenderToWindow(pt.Render(&scene, &camera)) }
func main() { scene := pt.Scene{} meshes := []pt.Shape{ createMesh(pt.GlossyMaterial(pt.HexColor(0x730046), 1.6, pt.Radians(45))), createMesh(pt.GlossyMaterial(pt.HexColor(0xBFBB11), 1.6, pt.Radians(45))), createMesh(pt.GlossyMaterial(pt.HexColor(0xFFC200), 1.6, pt.Radians(45))), createMesh(pt.GlossyMaterial(pt.HexColor(0xE88801), 1.6, pt.Radians(45))), createMesh(pt.GlossyMaterial(pt.HexColor(0xC93C00), 1.6, pt.Radians(45))), } for x := -6; x <= 3; x++ { mesh := meshes[(x+6)%len(meshes)] for y := -5; y <= 4; y++ { fx := float64(x) / 2 fy := float64(y) fz := float64(x) / 2 scene.Add(pt.NewTransformedShape(mesh, pt.Translate(pt.Vector{fx, fy, fz}))) } } scene.Add(pt.NewSphere(pt.Vector{1, 0, 10}, 3, pt.LightMaterial(pt.Color{1, 1, 1}, 1, pt.NoAttenuation))) camera := pt.LookAt(pt.Vector{-5, 0, 5}, pt.Vector{1, 0, 0}, pt.Vector{0, 0, 1}, 45) pt.RenderToWindow(pt.Render(&scene, &camera)) }