From 78565064ef630b0f56475b2180f297939ee26d89 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Fri, 2 Aug 2024 01:02:33 -0400 Subject: [PATCH] Forgot that this is only useful for camera --- renderer1/hrend/math.go | 10 +++++----- renderer1/main.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/renderer1/hrend/math.go b/renderer1/hrend/math.go index aaa433d..870332e 100644 --- a/renderer1/hrend/math.go +++ b/renderer1/hrend/math.go @@ -158,8 +158,8 @@ func (m *Mat44f) SetRotationZ(radang float32) { m[2] = -m[4] } -// TODO: need roll too -func (m *Mat44f) SetModel(loc *Vec3f, yaw float32, pitch float32, scale float32, up *Vec3f) Vec3f { +// Camera is easier to deal with using yaw and pitch, since we're not supporting roll +func (m *Mat44f) SetCamera(loc *Vec3f, yaw float32, pitch float32, up *Vec3f) Vec3f { // Use sphere equation to compute lookat vector through the two // player-controled angles (pitch and yaw) lookvec := Vec3f{ @@ -168,9 +168,9 @@ func (m *Mat44f) SetModel(loc *Vec3f, yaw float32, pitch float32, scale float32, Y: float32(math.Cos(float64(pitch))), } m.SetLookAt(loc, loc.Add(&lookvec), up) - m.Set(0, 0, m.Get(0, 0)*scale) - m.Set(1, 1, m.Get(1, 1)*scale) - m.Set(2, 2, m.Get(2, 2)*scale) + //m.Set(0, 0, m.Get(0, 0)*scale) + //m.Set(1, 1, m.Get(1, 1)*scale) + //m.Set(2, 2, m.Get(2, 2)*scale) return lookvec } diff --git a/renderer1/main.go b/renderer1/main.go index 369b7df..70d17af 100644 --- a/renderer1/main.go +++ b/renderer1/main.go @@ -162,7 +162,7 @@ func main() { camtrans = *camtrans.Add(&newcamtrans) // The camera is really just a model - lookvec := camera.SetModel(&camtrans, yaw, pitch, 1.0, &camup) + lookvec := camera.SetCamera(&camtrans, yaw, pitch, &camup) screenmat := camera.Inverse().Multiply(&projection) screenmat = screenmat.Multiply(&viewport)