diff --git a/include/light/light.hh b/include/light/light.hh index a7f023a9..4f1c3c5b 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -78,11 +78,6 @@ public: const img::texture *suntexture_value; }; -struct texorg_t -{ - qmat4x4f texSpaceToWorld; -}; - class modelinfo_t; namespace settings { @@ -136,8 +131,6 @@ struct lightsurf_t */ std::vector pvs; - /* stuff used by CalcPoint */ - texorg_t texorg; int width, height; /* for lit water. receive light from either front or back. */ diff --git a/light/ltface.cc b/light/ltface.cc index e1b18857..f57fe9df 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -374,9 +374,9 @@ static position_t PositionSamplePointOnFace( return position_t(face, point, pointNormal); } -constexpr qvec3d TexCoordToWorld(vec_t s, vec_t t, const texorg_t *texorg) +constexpr qvec3d TexCoordToWorld(vec_t s, vec_t t, const qmat4x4f &texSpaceToWorld) { - return (texorg->texSpaceToWorld * qvec4f(s, t, /* one "unit" in front of surface */ 1.0, 1.0)).xyz(); + return (texSpaceToWorld * qvec4f(s, t, /* one "unit" in front of surface */ 1.0, 1.0)).xyz(); } /* @@ -417,7 +417,7 @@ static void CalcPoints( const vec_t us = starts + s * st_step; const vec_t ut = startt + t * st_step; - point = TexCoordToWorld(us, ut, &surf->texorg); + point = TexCoordToWorld(us, ut, surf->extents.texCoordToWorldMatrix); // do this before correcting the point, so we can wrap around the inside of pipes const bool phongshaded = (surf->curved && cfg.phongallowed.value()); @@ -695,9 +695,6 @@ static std::unique_ptr Lightsurf_Init(const modelinfo_t *modelinfo, plane = bsp->dplanes[face->planenum]; } - /* Set up the texorg for coordinate transformation */ - lightsurf->texorg.texSpaceToWorld = spaceToWorld; - const mtexinfo_t *tex = &bsp->texinfo[face->texinfo]; lightsurf->snormal = qv::normalize(tex->vecs.row(0).xyz()); lightsurf->tnormal = -qv::normalize(tex->vecs.row(1).xyz());