summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2021-05-25 12:51:50 +0200
committerxengineering <mail2xengineering@protonmail.com>2021-05-25 12:51:50 +0200
commit4ab710eba1708966f8ae9e637deafa5be060b6d5 (patch)
tree88c2a8b51a5d0963c1571563fc396500541fee0f /app.go
parente03455a979abf4444d4362dacbbf55c6915d3b69 (diff)
downloadstlscope-4ab710eba1708966f8ae9e637deafa5be060b6d5.tar
stlscope-4ab710eba1708966f8ae9e637deafa5be060b6d5.tar.zst
stlscope-4ab710eba1708966f8ae9e637deafa5be060b6d5.zip
Implement Home View
Diffstat (limited to 'app.go')
-rw-r--r--app.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/app.go b/app.go
index 0591be9..22548a3 100644
--- a/app.go
+++ b/app.go
@@ -18,11 +18,14 @@ const (
type App struct {
window *glfw.Window
graphics *Graphics
+ stl *StlModel
+ homeTrafo mgl32.Mat4
}
-func newApp() App {
+func newApp(stl *StlModel) App {
var app App = App{}
+ app.stl = stl
var err error
log.Println("GLFW init")
@@ -44,6 +47,8 @@ func newApp() App {
}
app.window.MakeContextCurrent()
+ app.homeTrafo = stl.surface.getHomeView()
+
return app
}
@@ -52,10 +57,8 @@ func (application *App) handle() {
application.window.SwapBuffers()
// generate and set transformation
- var scale float32 = 0.01
- trafo := mgl32.Ident4()
- trafo = trafo.Mul4(mgl32.HomogRotate3D(float32(glfw.GetTime()) * 3, mgl32.Vec3{0, 1, 1}))
- trafo = trafo.Mul4(mgl32.Scale3D(scale, scale, scale))
+ trafo := application.homeTrafo
+ trafo = mgl32.HomogRotate3D(float32(glfw.GetTime()) * 3, mgl32.Vec3{0, 1, 0}).Mul4(trafo) // apply time-based rotation
application.graphics.setTrafo(trafo)
}