render: move render_world_helper, remove chunks drawn behind view

This commit is contained in:
2022-01-27 01:09:45 +08:00
parent d8df67bc20
commit 7b6c16789c
11 changed files with 257 additions and 56 deletions

View File

@@ -145,6 +145,12 @@ func (g *Game) Init(win *glfw.Window) {
g.fullscreen = true
}
win.MakeContextCurrent()
glfw.SwapInterval(1)
}
if key == glfw.KeyF3 {
io.ShowDebugInfo = !io.ShowDebugInfo
}
}
})
@@ -225,6 +231,8 @@ func (g *Game) Update(win *glfw.Window, delta time.Duration) {
g.player.Update(g.world, delta)
g.view.LookAt(g.player.EyePosition().ToFloat32(), g.rotY, itype.Degrees(g.rotZ))
io.ViewPos = g.player.EyePosition()
io.ViewDir = itype.Vec3d(mgl64.Rotate3DY(float64(g.rotY.Radians())).Mul3(mgl64.Rotate3DZ(float64(itype.Degrees(g.rotZ)))).Mul3x1(mgl64.Vec3{1, 0, 0}))
render.Framewire.PushBox(g.player.WorldHitbox().ToFloat32(), color.White)