From 4ab710eba1708966f8ae9e637deafa5be060b6d5 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 25 May 2021 12:51:50 +0200 Subject: Implement Home View --- app.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'app.go') 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) } -- cgit v1.2.3-70-g09d2