diff options
author | xengineering <mail2xengineering@protonmail.com> | 2021-05-25 12:51:50 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2021-05-25 12:51:50 +0200 |
commit | 4ab710eba1708966f8ae9e637deafa5be060b6d5 (patch) | |
tree | 88c2a8b51a5d0963c1571563fc396500541fee0f /app.go | |
parent | e03455a979abf4444d4362dacbbf55c6915d3b69 (diff) | |
download | stlscope-4ab710eba1708966f8ae9e637deafa5be060b6d5.tar stlscope-4ab710eba1708966f8ae9e637deafa5be060b6d5.tar.zst stlscope-4ab710eba1708966f8ae9e637deafa5be060b6d5.zip |
Implement Home View
Diffstat (limited to 'app.go')
-rw-r--r-- | app.go | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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) } |