world view ray casting

This commit is contained in:
2022-02-22 14:28:59 +08:00
parent 3595c32ae5
commit c2a69d7cd0
5 changed files with 170 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import (
"os"
"time"
"edgaru089.ml/go/gl01/internal/igwrap"
"edgaru089.ml/go/gl01/internal/igwrap/backend"
"edgaru089.ml/go/gl01/internal/io"
"edgaru089.ml/go/gl01/internal/render"
@@ -249,6 +250,10 @@ func (g *Game) Update(win *glfw.Window, delta time.Duration) {
imgui.ShowDemoWindow(nil)
g.imgui()
if ok, bc, face, _, _ := g.world.CastViewRay(io.ViewPos, io.ViewDir.Normalize(), 10); ok {
igwrap.TextBackground("Looking At: (%d %d %d) facing %s", bc[0], bc[1], bc[2], itype.DirectionName[face])
}
io.Diagnostics.Times.GUI = clock.Restart()
}