From 61f94b5e134dd6012fbb176935f28a8d0b0da2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Wed, 13 Jan 2021 22:06:48 +0200 Subject: [PATCH] Fixed|Renderer: Align plane textures with non-64x64 size IssueID #2442 --- doomsday/apps/client/include/world/convexsubspace.h | 8 -------- doomsday/apps/client/src/render/rend_main.cpp | 8 ++++++-- doomsday/apps/client/src/world/convexsubspace.cpp | 12 +----------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/doomsday/apps/client/include/world/convexsubspace.h b/doomsday/apps/client/include/world/convexsubspace.h index a3aab7afd9..ec3bf67a2d 100644 --- a/doomsday/apps/client/include/world/convexsubspace.h +++ b/doomsday/apps/client/include/world/convexsubspace.h @@ -36,14 +36,6 @@ class ConvexSubspace : public world::ConvexSubspace public: ConvexSubspace(mesh::Face &convexPolygon, world::BspLeaf *bspLeaf = nullptr); - /** - * Returns the vector described by the offset from the map coordinate space origin to - * the top most, left most point of the geometry of the subspace. - * - * @see bounds() - */ - const de::Vec2d &worldGridOffset() const; - /** * Returns a pointer to the face geometry half-edge which has been chosen for use as * the base for a triangle fan GL primitive. May return @c nullptr if no suitable base diff --git a/doomsday/apps/client/src/render/rend_main.cpp b/doomsday/apps/client/src/render/rend_main.cpp index 9447bde090..2e554371b6 100644 --- a/doomsday/apps/client/src/render/rend_main.cpp +++ b/doomsday/apps/client/src/render/rend_main.cpp @@ -2892,8 +2892,12 @@ static void writeSubspacePlane(Plane &plane) MaterialAnimator &matAnimator = material->getAnimator(Rend_MapSurfaceMaterialSpec()); - Vec2f materialOrigin = curSubspace->worldGridOffset() // Align to the worldwide grid. - + surface.originSmoothed(); + Vec2f materialOrigin = + // Align to the worldwide grid. + Vec2d(fmod(curSubspace->poly().bounds().minX, material->width()), + fmod(curSubspace->poly().bounds().maxY, material->height())) + + surface.originSmoothed(); + // Add the Y offset to orient the Y flipped material. /// @todo fixme: What is this meant to do? -ds if (plane.isSectorCeiling()) diff --git a/doomsday/apps/client/src/world/convexsubspace.cpp b/doomsday/apps/client/src/world/convexsubspace.cpp index 95b15a87dc..b109f21a4c 100644 --- a/doomsday/apps/client/src/world/convexsubspace.cpp +++ b/doomsday/apps/client/src/world/convexsubspace.cpp @@ -41,7 +41,6 @@ static double triangleArea(const Vec2d &v1, const Vec2d &v2, const Vec2d &v3) DE_PIMPL(ConvexSubspace) { - Vec2d worldGridOffset; // For aligning the materials to the map space grid. Set lumobjs; // Linked lumobjs (not owned). Set shadowLines; // Linked map lines for fake radio shadowing. @@ -134,16 +133,7 @@ DE_PIMPL(ConvexSubspace) ConvexSubspace::ConvexSubspace(mesh::Face &face, world::BspLeaf *bspLeaf) : world::ConvexSubspace(face, bspLeaf) , d(new Impl(this)) -{ - // Determine the world grid offset. - d->worldGridOffset = Vec2d(fmod(poly().bounds().minX, 64), - fmod(poly().bounds().maxY, 64)); -} - -const Vec2d &ConvexSubspace::worldGridOffset() const -{ - return d->worldGridOffset; -} +{} int ConvexSubspace::shadowLineCount() const {