-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (32 loc) · 1.05 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"github.com/g3n/engine/util/application"
"github.com/g3n/engine/geometry"
"github.com/g3n/engine/material"
"github.com/g3n/engine/math32"
"github.com/g3n/engine/graphic"
"github.com/g3n/engine/light"
)
func main() {
app, _ := application.Create(application.Options{
Title: "Hello G3N",
Width: 800,
Height: 600,
})
// Create a blue torus and add it to the scene
geom := geometry.NewTorus(1, .4, 12, 32, math32.Pi*2)
mat := material.NewPhong(math32.NewColor("DarkBlue"))
torusMesh := graphic.NewMesh(geom, mat)
app.Scene().Add(torusMesh)
// Add lights to the scene
ambientLight := light.NewAmbient(&math32.Color{1.0, 1.0, 1.0}, 0.8)
app.Scene().Add(ambientLight)
pointLight := light.NewPoint(&math32.Color{1, 1, 1}, 5.0)
pointLight.SetPosition(1, 0, 2)
app.Scene().Add(pointLight)
// Add an axis helper to the scene
axis := graphic.NewAxisHelper(0.5)
app.Scene().Add(axis)
app.CameraPersp().SetPosition(0, 0, 3)
app.Run()
}