Skip to content

Commit

Permalink
Fixed|Renderer: Align plane textures with non-64x64 size
Browse files Browse the repository at this point in the history
IssueID #2442
  • Loading branch information
skyjake committed Jan 13, 2021
1 parent bd6d667 commit 61f94b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
8 changes: 0 additions & 8 deletions doomsday/apps/client/include/world/convexsubspace.h
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions doomsday/apps/client/src/render/rend_main.cpp
Expand Up @@ -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())
Expand Down
12 changes: 1 addition & 11 deletions doomsday/apps/client/src/world/convexsubspace.cpp
Expand Up @@ -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<Lumobj *> lumobjs; // Linked lumobjs (not owned).
Set<LineSide *> shadowLines; // Linked map lines for fake radio shadowing.

Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit 61f94b5

Please sign in to comment.