From f6b33acbb1ca042c5488ead2bb50be776e4b45bb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Apr 2016 12:22:47 +0200 Subject: [PATCH] - fixed plane access in GL code. --- src/gl/renderer/gl_renderstate.h | 12 ++++++++---- src/gl/utility/gl_geometric.cpp | 11 ++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/gl/renderer/gl_renderstate.h b/src/gl/renderer/gl_renderstate.h index 87df78a6b..7436135a6 100644 --- a/src/gl/renderer/gl_renderstate.h +++ b/src/gl/renderer/gl_renderstate.h @@ -275,14 +275,18 @@ public: void SetGlowPlanes(const secplane_t &top, const secplane_t &bottom) { - mGlowTopPlane.Set(top.fA(), top.fB(), 1. / top.fC(), top.fD()); - mGlowBottomPlane.Set(bottom.fA(), bottom.fB(), 1. / bottom.fC(), bottom.fD()); + DVector3 tn = top.Normal(); + DVector3 bn = bottom.Normal(); + mGlowTopPlane.Set(tn.X, tn.Y, 1. / tn.Z, top.fD()); + mGlowBottomPlane.Set(bn.X, bn.Y, 1. / bn.Z, bottom.fD()); } void SetSplitPlanes(const secplane_t &top, const secplane_t &bottom) { - mSplitTopPlane.Set(top.fA(), top.fB(), 1. / top.fC(), top.fD()); - mSplitBottomPlane.Set(bottom.fA(), bottom.fB(), 1. / bottom.fC(), bottom.fD()); + DVector3 tn = top.Normal(); + DVector3 bn = bottom.Normal(); + mSplitTopPlane.Set(tn.X, tn.Y, 1. / tn.Z, top.fD()); + mSplitBottomPlane.Set(bn.X, bn.Y, 1. / bn.Z, bottom.fD()); } void SetDynLight(float r, float g, float b) diff --git a/src/gl/utility/gl_geometric.cpp b/src/gl/utility/gl_geometric.cpp index ef9bc88d4..c2ea6da59 100644 --- a/src/gl/utility/gl_geometric.cpp +++ b/src/gl/utility/gl_geometric.cpp @@ -227,16 +227,9 @@ void Plane::Init(float a, float b, float c, float d) void Plane::Set(secplane_t &plane) { - float a, b, c, d; - - a = (float)plane.fA(); - b = (float)plane.fB(); - c = (float)plane.fC(); - d = (float)plane.fD(); - - m_normal.Set(a, c, b); + m_normal.Set(plane.Normal().X, plane.Normal().Z, plane.Normal().Y); //m_normal.Normalize(); the vector is already normalized - m_d = d; + m_d = plane.fD(); }