From d1e9deda37b2694ef6d6bc6185685a5ee2c6257f Mon Sep 17 00:00:00 2001 From: danij Date: Wed, 11 Sep 2013 16:20:55 +0100 Subject: [PATCH] Refactor|World|Plane|Surface: Disambiguate "visual height" wrt planes Since the introduction of mapped sector planes the "visual height" of a plane could be interpreted with two very different meanings depending on the context. Sector cluster allows mapping of planes for visual effect only and so the term "visual" is now overloaded (previously this identified the interpolated "smooth" height of a plane). To disambiguate, Plane's API now uses the term "smoothed" and for uniformity, Surface applies the same terminology when identifying the smoothed material origin. --- doomsday/client/include/world/bspleaf.h | 37 +++++---- doomsday/client/include/world/plane.h | 31 ++++--- doomsday/client/include/world/surface.h | 22 ++--- doomsday/client/src/render/biasillum.cpp | 4 +- doomsday/client/src/render/projector.cpp | 2 +- doomsday/client/src/render/r_main.cpp | 4 +- doomsday/client/src/render/r_things.cpp | 18 ++-- doomsday/client/src/render/rend_fakeradio.cpp | 56 ++++++------- doomsday/client/src/render/rend_main.cpp | 78 +++++++++--------- doomsday/client/src/render/shadowedge.cpp | 36 ++++---- doomsday/client/src/render/skyfixedge.cpp | 12 +-- .../client/src/render/surfacedecorator.cpp | 8 +- doomsday/client/src/render/vlight.cpp | 2 +- doomsday/client/src/render/walledge.cpp | 82 +++++++++---------- doomsday/client/src/world/bspleaf.cpp | 8 +- doomsday/client/src/world/map.cpp | 36 ++++---- doomsday/client/src/world/maputil.cpp | 28 +++---- doomsday/client/src/world/p_mobj.cpp | 6 +- doomsday/client/src/world/p_objlink.cpp | 18 ++-- doomsday/client/src/world/p_particle.cpp | 4 +- doomsday/client/src/world/p_players.cpp | 4 +- doomsday/client/src/world/plane.cpp | 30 ++++--- doomsday/client/src/world/surface.cpp | 32 ++++---- doomsday/client/src/world/vertex.cpp | 16 ++-- doomsday/client/src/world/world.cpp | 4 +- web/style.css | 5 +- 26 files changed, 293 insertions(+), 290 deletions(-) diff --git a/doomsday/client/include/world/bspleaf.h b/doomsday/client/include/world/bspleaf.h index 4f4a820f9f..65c998b394 100644 --- a/doomsday/client/include/world/bspleaf.h +++ b/doomsday/client/include/world/bspleaf.h @@ -283,33 +283,36 @@ class BspLeaf : public de::MapElement inline Plane &visCeiling() const { return visPlane(Sector::Ceiling); } /** - * Convenient method of accessing the visual (i.e., smoothed) height of the - * identified @em visual sector plane. + * Convenient method of accessing the @em smoothed height of the identified + * @em visual sector plane. * * @param planeIndex Index of the plane to return. * - * @see visPlane(), Plane::visHeight() + * @see visPlane(), Plane::heightSmoothed() */ - inline coord_t visPlaneHeight(int planeIndex) const { - return visPlane(planeIndex).visHeight(); + inline coord_t visPlaneHeightSmoothed(int planeIndex) const { + return visPlane(planeIndex).heightSmoothed(); } /** - * Convenient method of accessing the visual (i.e., smoothed) height of the - * @em visual floor plane. + * Convenient method of accessing the @em smoothed height of the @em visual + * floor plane. * - * @see visPlaneHeight() + * @see visPlaneHeightSmoothed() */ - inline coord_t visFloorHeight() const { return visPlaneHeight(Sector::Floor); } + inline coord_t visFloorHeightSmoothed() const { + return visPlaneHeightSmoothed(Sector::Floor); + } /** - * Convenient method of accessing the visual (i.e., smoothed) height of the - * @em visual ceiling plane. + * Convenient method of accessing the @em smoothed height of the @em visual + * ceiling plane. * - * @see visPlaneHeight() + * @see visPlaneHeightSmoothed() */ - inline coord_t visCeilingHeight() const { return visPlaneHeight(Sector::Ceiling); } - + inline coord_t visCeilingHeightSmoothed() const { + return visPlaneHeightSmoothed(Sector::Ceiling); + } #endif // __CLIENT__ /** @@ -367,10 +370,10 @@ class BspLeaf : public de::MapElement * - The height of floor is lower than that of the ceiling plane for the * attributed sector. * - * @param useVisualHeights @c true= use the visual (i.e., smoothed) plane - * heights instead of the @em sharp heights. + * @param useSmoothedHeights @c true= use the @em smoothed plane heights + * instead of the @em sharp heights. */ - bool hasWorldVolume(bool useVisualHeights = true) const; + bool hasWorldVolume(bool useSmoothedHeights = true) const; /** * Returns a pointer to the face geometry half-edge which has been chosen diff --git a/doomsday/client/include/world/plane.h b/doomsday/client/include/world/plane.h index af93e35285..c88c99cbef 100644 --- a/doomsday/client/include/world/plane.h +++ b/doomsday/client/include/world/plane.h @@ -52,6 +52,11 @@ class Plane : public de::MapElement */ DENG2_DEFINE_AUDIENCE(HeightChange, void planeHeightChanged(Plane &plane, coord_t oldHeight)) + /* + * Notified whenever a @em smoothed height change occurs. + */ + DENG2_DEFINE_AUDIENCE(SmoothedHeightChange, void planeSmoothedHeightChanged(Plane &plane, coord_t oldHeight)) + // Constants: static int const MAX_SMOOTH_MOVE = 64; ///< $smoothplane: Maximum speed for a smoothed plane. @@ -157,34 +162,34 @@ class Plane : public de::MapElement #ifdef __CLIENT__ /** - * Returns the current interpolated visual height of the plane in the map - * coordinate space. + * Returns the current smoothed height of the plane (interpolated) in the + * map coordinate space. * * @see targetHeight(), height() */ - coord_t visHeight() const; + coord_t heightSmoothed() const; /** - * Returns the delta between current height and the interpolated visual - * height of the plane in the map coordinate space. + * Returns the delta between current height and the smoothed height of the + * plane in the map coordinate space. * - * @see targetHeight() + * @see heightSmoothed(), targetHeight() */ - coord_t visHeightDelta() const; + coord_t heightSmoothedDelta() const; /** - * Set the visible offsets. + * Perform smoothed height interpolation. * - * @see visHeight(), targetHeight() + * @see heightSmoothed(), targetHeight() */ - void lerpVisHeight(); + void lerpSmoothedHeight(); /** - * Reset the plane's height tracking. + * Reset the plane's height tracking buffer (for smoothing). * - * @see visHeight(), targetHeight() + * @see heightSmoothed(), targetHeight() */ - void resetVisHeight(); + void resetSmoothedHeight(); /** * Roll the plane's height tracking buffer. diff --git a/doomsday/client/include/world/surface.h b/doomsday/client/include/world/surface.h index d2cc7f2e3f..ed0a8b5447 100644 --- a/doomsday/client/include/world/surface.h +++ b/doomsday/client/include/world/surface.h @@ -408,34 +408,34 @@ class Surface : public de::MapElement #ifdef __CLIENT__ /** - * Returns the current interpolated visual material origin of the surface + * Returns the current smoothed (interpolated) material origin for the plane * in the map coordinate space. * * @see setMaterialOrigin() */ - de::Vector2f const &visMaterialOrigin() const; + de::Vector2f const &materialOriginSmoothed() const; /** - * Returns the delta between current material origin and the interpolated - * visual origin of the material in the map coordinate space. + * Returns the delta between current and the smoothed material origin for + * the surface in the map coordinate space. * - * @see setMaterialOrigin(), visMaterialOrigin() + * @see setMaterialOrigin(), smoothMaterialOrigin() */ - de::Vector2f const &visMaterialOriginDelta() const; + de::Vector2f const &materialOriginSmoothedDelta() const; /** - * Interpolate the visible material origin. + * Perform smoothed material origin interpolation. * - * @see visMaterialOrigin() + * @see materialOriginSmoothed() */ - void lerpVisMaterialOrigin(); + void lerpSmoothedMaterialOrigin(); /** * Reset the surface's material origin tracking. * - * @see visMaterialOrigin() + * @see materialOriginSmoothed() */ - void resetVisMaterialOrigin(); + void resetSmoothedMaterialOrigin(); /** * Roll the surface's material origin tracking buffer. diff --git a/doomsday/client/src/render/biasillum.cpp b/doomsday/client/src/render/biasillum.cpp index 2e52003e35..3c6c69c09d 100644 --- a/doomsday/client/src/render/biasillum.cpp +++ b/doomsday/client/src/render/biasillum.cpp @@ -166,9 +166,9 @@ DENG2_PIMPL_NOREF(BiasIllum) /// @todo LineSightTest should (optionally) perform this test. BspLeaf &leaf = source.bspLeafAtOrigin(); if((!leaf.visFloor().surface().hasSkyMaskedMaterial() && - source.origin().z < leaf.visFloorHeight()) || + source.origin().z < leaf.visFloorHeightSmoothed()) || (!leaf.visCeiling().surface().hasSkyMaskedMaterial() && - source.origin().z > leaf.visCeilingHeight())) + source.origin().z > leaf.visCeilingHeightSmoothed())) { // This affecting source does not contribute any light. casted = Vector3f(); diff --git a/doomsday/client/src/render/projector.cpp b/doomsday/client/src/render/projector.cpp index 15c5677b3e..1cc97e037f 100644 --- a/doomsday/client/src/render/projector.cpp +++ b/doomsday/client/src/render/projector.cpp @@ -385,7 +385,7 @@ void Rend_ProjectPlaneGlows(BspLeaf *bspLeaf, Vector3d const &topLeft, for(int i = 0; i < bspLeaf->sector().planeCount(); ++i) { Plane &plane = bspLeaf->visPlane(i); - Vector3d pointOnPlane(bspLeaf->cluster().center(), plane.visHeight()); + Vector3d pointOnPlane(bspLeaf->cluster().center(), plane.heightSmoothed()); projectGlow(plane.surface(), pointOnPlane, parm); } diff --git a/doomsday/client/src/render/r_main.cpp b/doomsday/client/src/render/r_main.cpp index 4258f9479a..05c130c07d 100644 --- a/doomsday/client/src/render/r_main.cpp +++ b/doomsday/client/src/render/r_main.cpp @@ -1017,8 +1017,8 @@ void R_SetupPlayerSprites() spr->data.model.flags = 0; // 32 is the raised weapon height. spr->data.model.gzt = viewData->current.origin[VZ]; - spr->data.model.secFloor = ddpl->mo->bspLeaf->visFloorHeight(); - spr->data.model.secCeil = ddpl->mo->bspLeaf->visCeilingHeight(); + spr->data.model.secFloor = ddpl->mo->bspLeaf->visFloorHeightSmoothed(); + spr->data.model.secCeil = ddpl->mo->bspLeaf->visCeilingHeightSmoothed(); spr->data.model.pClass = 0; spr->data.model.floorClip = 0; diff --git a/doomsday/client/src/render/r_things.cpp b/doomsday/client/src/render/r_things.cpp index a41fa50fe0..0630998cb7 100644 --- a/doomsday/client/src/render/r_things.cpp +++ b/doomsday/client/src/render/r_things.cpp @@ -136,12 +136,12 @@ static int findMobjZOriginWorker(Sector *sector, void *parameters) if(p->floorAdjust && p->mo->origin[VZ] == sector->floor().height()) { - p->vis->origin.z = sector->floor().visHeight(); + p->vis->origin.z = sector->floor().heightSmoothed(); } if(p->mo->origin[VZ] + p->mo->height == sector->ceiling().height()) { - p->vis->origin.z = sector->ceiling().visHeight() - p->mo->height; + p->vis->origin.z = sector->ceiling().heightSmoothed() - p->mo->height; } return false; // Continue iteration. @@ -275,7 +275,7 @@ void R_ProjectSprite(mobj_t *mo) bool floorAdjust = false; if(!Mobj_OriginBehindVisPlane(mo)) { - floorAdjust = de::abs(floor.visHeight() - floor.height()) < 8; + floorAdjust = de::abs(floor.heightSmoothed() - floor.height()) < 8; findMobjZOrigin(mo, floorAdjust, vis); } @@ -380,14 +380,14 @@ void R_ProjectSprite(mobj_t *mo) // We must find the correct positioning using the sector floor // and ceiling heights as an aid. - if(ms.height() < ceiling.visHeight() - floor.visHeight()) + if(ms.height() < ceiling.heightSmoothed() - floor.heightSmoothed()) { // Sprite fits in, adjustment possible? - if(fitTop && gzt > ceiling.visHeight()) - gzt = ceiling.visHeight(); + if(fitTop && gzt > ceiling.heightSmoothed()) + gzt = ceiling.heightSmoothed(); - if(floorAdjust && fitBottom && gzt - ms.height() < floor.visHeight()) - gzt = floor.visHeight() + ms.height(); + if(floorAdjust && fitBottom && gzt - ms.height() < floor.heightSmoothed()) + gzt = floor.heightSmoothed() + ms.height(); } // Adjust by the floor clip. gzt -= floorClip; @@ -401,7 +401,7 @@ void R_ProjectSprite(mobj_t *mo) ambientColor.w = alpha; VisSprite_SetupSprite(vis->data.sprite, origin, vis->distance, visOff, - floor.visHeight(), ceiling.visHeight(), + floor.heightSmoothed(), ceiling.heightSmoothed(), floorClip, gzt, *mat, matFlipS, matFlipT, blendMode, ambientColor, vLightListIdx, mo->tclass, mo->tmap, diff --git a/doomsday/client/src/render/rend_fakeradio.cpp b/doomsday/client/src/render/rend_fakeradio.cpp index f7d33bdba6..1ac3f00568 100644 --- a/doomsday/client/src/render/rend_fakeradio.cpp +++ b/doomsday/client/src/render/rend_fakeradio.cpp @@ -180,8 +180,8 @@ static void scanNeighbor(bool scanTop, LineSide const &side, edge_t *edge, bool stopScan = false; bool closed; - coord_t fFloor = startSector->floor().visHeight(); - coord_t fCeil = startSector->ceiling().visHeight(); + coord_t fFloor = startSector->floor().heightSmoothed(); + coord_t fCeil = startSector->ceiling().heightSmoothed(); // Retrieve the start owner node. LineOwner *own = side.line().vertexOwner(side.vertex((int)!toLeft)); @@ -214,13 +214,13 @@ static void scanNeighbor(bool scanTop, LineSide const &side, edge_t *edge, // Pick plane heights for relative offset comparison. if(!stopScan) { - iFFloor = iter->frontSector().floor().visHeight(); - iFCeil = iter->frontSector().ceiling().visHeight(); + iFFloor = iter->frontSector().floor().heightSmoothed(); + iFCeil = iter->frontSector().ceiling().heightSmoothed(); if(iter->hasBackSector()) { - iBFloor = iter->backSector().floor().visHeight(); - iBCeil = iter->backSector().ceiling().visHeight(); + iBFloor = iter->backSector().floor().heightSmoothed(); + iBCeil = iter->backSector().ceiling().heightSmoothed(); } else iBFloor = iBCeil = 0; @@ -316,16 +316,16 @@ static void scanNeighbor(bool scanTop, LineSide const &side, edge_t *edge, // A height difference from the start sector? if(scanTop) { - if(scanSector->ceiling().visHeight() != fCeil && - scanSector->floor().visHeight() < - startSector->ceiling().visHeight()) + if(scanSector->ceiling().heightSmoothed() != fCeil && + scanSector->floor().heightSmoothed() < + startSector->ceiling().heightSmoothed()) stopScan = true; } else { - if(scanSector->floor().visHeight() != fFloor && - scanSector->ceiling().visHeight() > - startSector->floor().visHeight()) + if(scanSector->floor().heightSmoothed() != fFloor && + scanSector->ceiling().heightSmoothed() > + startSector->floor().heightSmoothed()) stopScan = true; } } @@ -345,10 +345,10 @@ static void scanNeighbor(bool scanTop, LineSide const &side, edge_t *edge, // heights are within accepted range. if(scanSector && side.back().hasSector() && scanSector != side.back().sectorPtr() && - ((scanTop && scanSector->ceiling().visHeight() == - startSector->ceiling().visHeight()) || - (!scanTop && scanSector->floor().visHeight() == - startSector->floor().visHeight()))) + ((scanTop && scanSector->ceiling().heightSmoothed() == + startSector->ceiling().heightSmoothed()) || + (!scanTop && scanSector->floor().heightSmoothed() == + startSector->floor().heightSmoothed()))) { // If the map is formed correctly, we should find a back // neighbor attached to this line. However, if this is not @@ -389,8 +389,8 @@ static void scanNeighbors(shadowcorner_t top[2], shadowcorner_t bottom[2], { if(side.line().isSelfReferencing()) return; - coord_t fFloor = side.sector().floor().visHeight(); - coord_t fCeil = side.sector().ceiling().visHeight(); + coord_t fFloor = side.sector().floor().heightSmoothed(); + coord_t fCeil = side.sector().ceiling().heightSmoothed(); edge_t edges[2]; // {bottom, top} std::memset(edges, 0, sizeof(edges)); @@ -450,13 +450,13 @@ static void scanNeighbors(shadowcorner_t top[2], shadowcorner_t bottom[2], corner->proximity = edge->sector; if(i == 0) // Floor. { - corner->pOffset = corner->proximity->floor().visHeight() - fFloor; - corner->pHeight = corner->proximity->floor().visHeight(); + corner->pOffset = corner->proximity->floor().heightSmoothed() - fFloor; + corner->pHeight = corner->proximity->floor().heightSmoothed(); } else // Ceiling. { - corner->pOffset = corner->proximity->ceiling().visHeight() - fCeil; - corner->pHeight = corner->proximity->ceiling().visHeight(); + corner->pOffset = corner->proximity->ceiling().heightSmoothed() - fCeil; + corner->pHeight = corner->proximity->ceiling().heightSmoothed(); } } else @@ -1108,10 +1108,10 @@ void Rend_RadioWallSection(WallEdge const &leftEdge, WallEdge const &rightEdge, LineSideRadioData &frData = Rend_RadioDataForLineSide(side); - coord_t const fFloor = leaf->visFloorHeight(); - coord_t const fCeil = leaf->visCeilingHeight(); - coord_t const bFloor = (backLeaf? backLeaf->visFloorHeight() : 0); - coord_t const bCeil = (backLeaf? backLeaf->visCeilingHeight() : 0); + coord_t const fFloor = leaf->visFloorHeightSmoothed(); + coord_t const fCeil = leaf->visCeilingHeightSmoothed(); + coord_t const bFloor = (backLeaf? backLeaf->visFloorHeightSmoothed() : 0); + coord_t const bCeil = (backLeaf? backLeaf->visCeilingHeightSmoothed() : 0); Vector3f rvertices[4] = { leftEdge.bottom().origin(), @@ -1324,7 +1324,7 @@ void Rend_RadioBspLeafEdges(BspLeaf &bspLeaf) { Plane const &plane = bspLeaf.visPlane(pln); - eyeToSurface.z = vOrigin[VY] - plane.visHeight(); + eyeToSurface.z = vOrigin[VY] - plane.heightSmoothed(); // Don't bother with planes facing away from the camera. if(eyeToSurface.dot(plane.surface().normal()) < 0) continue; @@ -1435,7 +1435,7 @@ void Rend_DrawShadowOffsetVerts() do { Vector2d xy = vtx.origin() + own->extendedShadowOffset(); - coord_t z = own->line().frontSector().floor().visHeight(); + coord_t z = own->line().frontSector().floor().heightSmoothed(); drawPoint(Vector3d(xy.x, xy.y, z), 1, yellow); xy = vtx.origin() + own->innerShadowOffset(); diff --git a/doomsday/client/src/render/rend_main.cpp b/doomsday/client/src/render/rend_main.cpp index 1ed8f531d8..60a5f17864 100644 --- a/doomsday/client/src/render/rend_main.cpp +++ b/doomsday/client/src/render/rend_main.cpp @@ -1695,7 +1695,7 @@ static void writeLeafPlane(Plane &plane) MaterialSnapshot const &ms = material->prepare(Rend_MapSurfaceMaterialSpec()); Vector2f materialOrigin = leaf->worldGridOffset() // Align to the worldwide grid. - + surface.visMaterialOrigin(); + + surface.materialOriginSmoothed(); // Add the Y offset to orient the Y flipped material. /// @todo fixme: What is this meant to do? -ds @@ -1709,10 +1709,10 @@ static void writeLeafPlane(Plane &plane) // Set the texture origin, Y is flipped for the ceiling. Vector3d topLeft(poly.aaBox().minX, poly.aaBox().arvec2[plane.isSectorFloor()? 1 : 0][VY], - plane.visHeight()); + plane.heightSmoothed()); Vector3d bottomRight(poly.aaBox().maxX, poly.aaBox().arvec2[plane.isSectorFloor()? 0 : 1][VY], - plane.visHeight()); + plane.heightSmoothed()); rendworldpoly_params_t parm; zap(parm); @@ -1795,7 +1795,7 @@ static void writeLeafPlane(Plane &plane) uint numVertices; Vector3f *posCoords; buildLeafPlaneGeometry(*leaf, (plane.isSectorCeiling())? Anticlockwise : Clockwise, - plane.visHeight(), + plane.heightSmoothed(), &posCoords, &numVertices); // Draw this section. @@ -1985,7 +1985,7 @@ static coord_t skyPlaneZ(BspLeaf *bspLeaf, int skyCap) if(!bspLeaf->hasSector() || !P_IsInVoid(viewPlayer)) return bspLeaf->map().skyFix(relPlane == Sector::Ceiling); - return bspLeaf->visPlaneHeight(relPlane); + return bspLeaf->visPlaneHeightSmoothed(relPlane); } /// @param skyCap @ref skyCapFlags. @@ -2073,10 +2073,10 @@ static bool coveredOpenRange(HEdge &hedge, coord_t middleBottomZ, coord_t middle BspLeaf const &leaf = hedge.face().mapElement()->as(); BspLeaf const &backLeaf = hedge.twin().face().mapElement()->as(); - coord_t const ffloor = leaf.visFloorHeight(); - coord_t const fceil = leaf.visCeilingHeight(); - coord_t const bfloor = backLeaf.visFloorHeight(); - coord_t const bceil = backLeaf.visCeilingHeight(); + coord_t const ffloor = leaf.visFloorHeightSmoothed(); + coord_t const fceil = leaf.visCeilingHeightSmoothed(); + coord_t const bfloor = backLeaf.visFloorHeightSmoothed(); + coord_t const bceil = backLeaf.visCeilingHeightSmoothed(); bool middleCoversOpening = false; if(wroteOpaqueMiddle) @@ -2085,8 +2085,8 @@ static bool coveredOpenRange(HEdge &hedge, coord_t middleBottomZ, coord_t middle coord_t xtop = de::min(bceil, fceil); Surface const &middle = front.middle(); - xbottom += middle.visMaterialOrigin().y; - xtop += middle.visMaterialOrigin().y; + xbottom += middle.materialOriginSmoothed().y; + xtop += middle.materialOriginSmoothed().y; middleCoversOpening = (middleTopZ >= xtop && middleBottomZ <= xbottom); @@ -2203,7 +2203,7 @@ static void writeLeafPlanes() // Skip planes facing away from the viewer. Vector3d const eye(vOrigin[VX], vOrigin[VZ], vOrigin[VY]); - Vector3d const pointOnPlane(leaf->poly().center(), plane.visHeight()); + Vector3d const pointOnPlane(leaf->poly().center(), plane.heightSmoothed()); if((eye - pointOnPlane).dot(plane.surface().normal()) < 0) continue; @@ -2292,23 +2292,23 @@ static void occludeLeaf(bool frontFacing) // Determine the opening between the visual sector planes at this edge. coord_t openBottom; - if(backLeaf.visFloorHeight() > leaf->visFloorHeight()) + if(backLeaf.visFloorHeightSmoothed() > leaf->visFloorHeightSmoothed()) { - openBottom = backLeaf.visFloorHeight(); + openBottom = backLeaf.visFloorHeightSmoothed(); } else { - openBottom = leaf->visFloorHeight(); + openBottom = leaf->visFloorHeightSmoothed(); } coord_t openTop; - if(backLeaf.visCeilingHeight() < leaf->visCeilingHeight()) + if(backLeaf.visCeilingHeightSmoothed() < leaf->visCeilingHeightSmoothed()) { - openTop = backLeaf.visCeilingHeight(); + openTop = backLeaf.visCeilingHeightSmoothed(); } else { - openTop = leaf->visCeilingHeight(); + openTop = leaf->visCeilingHeightSmoothed(); } // Choose start and end vertexes so that it's facing forward. @@ -2316,16 +2316,16 @@ static void occludeLeaf(bool frontFacing) Vertex const &to = frontFacing? hedge->twin().vertex() : hedge->vertex(); // Does the floor create an occlusion? - if(((openBottom > leaf->visFloorHeight() && vOrigin[VY] <= openBottom) - || (openBottom > backLeaf.visFloorHeight() && vOrigin[VY] >= openBottom)) + if(((openBottom > leaf->visFloorHeightSmoothed() && vOrigin[VY] <= openBottom) + || (openBottom > backLeaf.visFloorHeightSmoothed() && vOrigin[VY] >= openBottom)) && canOccludeEdgeBetweenPlanes(leaf->visFloor(), backLeaf.visFloor())) { C_AddViewRelOcclusion(from.origin(), to.origin(), openBottom, false); } // Does the ceiling create an occlusion? - if(((openTop < leaf->visCeilingHeight() && vOrigin[VY] >= openTop) - || (openTop < backLeaf.visCeilingHeight() && vOrigin[VY] <= openTop)) + if(((openTop < leaf->visCeilingHeightSmoothed() && vOrigin[VY] >= openTop) + || (openTop < backLeaf.visCeilingHeightSmoothed() && vOrigin[VY] <= openTop)) && canOccludeEdgeBetweenPlanes(leaf->visCeiling(), backLeaf.visCeiling())) { C_AddViewRelOcclusion(from.origin(), to.origin(), openTop, true); @@ -2423,8 +2423,8 @@ static int projectSpriteWorker(void *ptr, void * /*parameters*/) if(Material *material = R_MaterialForSprite(mo->sprite, mo->frame)) { if(!(mo->dPlayer && (mo->dPlayer->flags & DDPF_CAMERA)) - && mo->origin[VZ] <= leaf->visCeilingHeight() - && mo->origin[VZ] >= leaf->visFloorHeight()) + && mo->origin[VZ] <= leaf->visCeilingHeightSmoothed() + && mo->origin[VZ] >= leaf->visFloorHeightSmoothed()) { coord_t visibleTop = mo->origin[VZ] + material->height(); if(visibleTop > leaf->map().skyFixCeiling()) @@ -3279,8 +3279,8 @@ static void drawTangentVectorsForWallSections(HEdge const *hedge) BspLeaf &frontLeaf = line.definesPolyobj()? line.polyobj().bspLeaf() : hedge->face().mapElement()->as(); - coord_t const bottom = frontLeaf.visFloorHeight(); - coord_t const top = frontLeaf.visCeilingHeight(); + coord_t const bottom = frontLeaf.visFloorHeightSmoothed(); + coord_t const top = frontLeaf.visCeilingHeightSmoothed(); drawTangentVectorsForSurface(lineSide.middle(), Vector3d(center, bottom + (top - bottom) / 2)); @@ -3294,30 +3294,30 @@ static void drawTangentVectorsForWallSections(HEdge const *hedge) if(lineSide.middle().hasMaterial()) { - coord_t const bottom = frontLeaf.visFloorHeight(); - coord_t const top = frontLeaf.visCeilingHeight(); + coord_t const bottom = frontLeaf.visFloorHeightSmoothed(); + coord_t const top = frontLeaf.visCeilingHeightSmoothed(); drawTangentVectorsForSurface(lineSide.middle(), Vector3d(center, bottom + (top - bottom) / 2)); } - if(backLeaf.visCeilingHeight() < frontLeaf.visCeilingHeight() && + if(backLeaf.visCeilingHeightSmoothed() < frontLeaf.visCeilingHeightSmoothed() && !(frontLeaf.visCeiling().surface().hasSkyMaskedMaterial() && backLeaf.visCeiling().surface().hasSkyMaskedMaterial())) { - coord_t const bottom = backLeaf.visCeilingHeight(); - coord_t const top = frontLeaf.visCeilingHeight(); + coord_t const bottom = backLeaf.visCeilingHeightSmoothed(); + coord_t const top = frontLeaf.visCeilingHeightSmoothed(); drawTangentVectorsForSurface(lineSide.top(), Vector3d(center, bottom + (top - bottom) / 2)); } - if(backLeaf.visFloorHeight() > frontLeaf.visFloorHeight() && + if(backLeaf.visFloorHeightSmoothed() > frontLeaf.visFloorHeightSmoothed() && !(frontLeaf.visFloor().surface().hasSkyMaskedMaterial() && backLeaf.visFloor().surface().hasSkyMaskedMaterial())) { - coord_t const bottom = frontLeaf.visFloorHeight(); - coord_t const top = backLeaf.visFloorHeight(); + coord_t const bottom = frontLeaf.visFloorHeightSmoothed(); + coord_t const top = backLeaf.visFloorHeightSmoothed(); drawTangentVectorsForSurface(lineSide.bottom(), Vector3d(center, bottom + (top - bottom) / 2)); @@ -3367,7 +3367,7 @@ static void drawSurfaceTangentVectors(SectorCluster *cluster) } else { - height = plane.visHeight(); + height = plane.heightSmoothed(); } drawTangentVectorsForSurface(plane.surface(), @@ -3596,8 +3596,8 @@ static int drawPolyobjVertexes(Polyobj *po, void * /*context*/) if(alpha > 0) { - coord_t const bottom = bspLeaf.visFloorHeight(); - coord_t const top = bspLeaf.visCeilingHeight(); + coord_t const bottom = bspLeaf.visFloorHeightSmoothed(); + coord_t const top = bspLeaf.visCeilingHeightSmoothed(); glDisable(GL_DEPTH_TEST); @@ -3613,7 +3613,7 @@ static int drawPolyobjVertexes(Polyobj *po, void * /*context*/) if(devVertexIndices) { Vector3d const eye(vOrigin[VX], vOrigin[VZ], vOrigin[VY]); - Vector3d const origin(vtx.origin(), bspLeaf.visFloorHeight()); + Vector3d const origin(vtx.origin(), bspLeaf.visFloorHeightSmoothed()); ddouble distToEye = (eye - origin).length(); if(distToEye < MAX_VERTEX_POINT_DIST) @@ -3766,7 +3766,7 @@ static void drawSectors(Map &map) foreach(Sector *sector, map.sectors()) foreach(SectorCluster *cluster, sector->clusters()) { - Vector3d const origin(cluster->center(), cluster->visPlane(Sector::Floor).visHeight()); + Vector3d const origin(cluster->center(), cluster->visPlane(Sector::Floor).heightSmoothed()); ddouble distToEye = (eye - origin).length(); if(distToEye < MAX_LABEL_DIST) { diff --git a/doomsday/client/src/render/shadowedge.cpp b/doomsday/client/src/render/shadowedge.cpp index 1c3b892e58..222a1830da 100644 --- a/doomsday/client/src/render/shadowedge.cpp +++ b/doomsday/client/src/render/shadowedge.cpp @@ -106,23 +106,23 @@ static bool middleMaterialCoversOpening(LineSide const &side) // Determine the opening between the visual sector planes at this edge. coord_t openBottom; - if(backSec && backSec->floor().visHeight() > frontSec.floor().visHeight()) + if(backSec && backSec->floor().heightSmoothed() > frontSec.floor().heightSmoothed()) { - openBottom = backSec->floor().visHeight(); + openBottom = backSec->floor().heightSmoothed(); } else { - openBottom = frontSec.floor().visHeight(); + openBottom = frontSec.floor().heightSmoothed(); } coord_t openTop; - if(backSec && backSec->ceiling().visHeight() < frontSec.ceiling().visHeight()) + if(backSec && backSec->ceiling().heightSmoothed() < frontSec.ceiling().heightSmoothed()) { - openTop = backSec->ceiling().visHeight(); + openTop = backSec->ceiling().heightSmoothed(); } else { - openTop = frontSec.ceiling().visHeight(); + openTop = frontSec.ceiling().heightSmoothed(); } if(ms.height() >= openTop - openBottom) @@ -167,15 +167,15 @@ void ShadowEdge::prepare(int planeIndex) : lineSide.middle(); // Figure out the relative plane heights. - coord_t fz = plane.visHeight(); + coord_t fz = plane.heightSmoothed(); if(planeIndex == Sector::Ceiling) fz = -fz; - coord_t bz = backPlane.visHeight(); + coord_t bz = backPlane.heightSmoothed(); if(planeIndex == Sector::Ceiling) bz = -bz; - coord_t bhz = backLeaf.plane(otherPlaneIndex).visHeight(); + coord_t bhz = backLeaf.plane(otherPlaneIndex).heightSmoothed(); if(planeIndex == Sector::Ceiling) bhz = -bhz; @@ -185,7 +185,7 @@ void ShadowEdge::prepare(int planeIndex) d->sectorOpenness = 2; // Consider it fully open. } // Is the back sector a closed yet sky-masked surface? - else if(leaf.visFloorHeight() >= backLeaf.visCeilingHeight() && + else if(leaf.visFloorHeightSmoothed() >= backLeaf.visCeilingHeightSmoothed() && leaf.visPlane(otherPlaneIndex).surface().hasSkyMaskedMaterial() && backLeaf.visPlane(otherPlaneIndex).surface().hasSkyMaskedMaterial()) { @@ -241,19 +241,19 @@ void ShadowEdge::prepare(int planeIndex) // Its a normal neighbor. Sector const *backSec = neighborLineSide.back().sectorPtr(); if(backSec != leaf.sectorPtr() && - !((plane.isSectorFloor() && backSec->ceiling().visHeight() <= plane.visHeight()) || - (plane.isSectorCeiling() && backSec->floor().height() >= plane.visHeight()))) + !((plane.isSectorFloor() && backSec->ceiling().heightSmoothed() <= plane.heightSmoothed()) || + (plane.isSectorCeiling() && backSec->floor().height() >= plane.heightSmoothed()))) { // Figure out the relative plane heights. - coord_t fz = plane.visHeight(); + coord_t fz = plane.heightSmoothed(); if(planeIndex == Sector::Ceiling) fz = -fz; - coord_t bz = backSec->plane(planeIndex).visHeight(); + coord_t bz = backSec->plane(planeIndex).heightSmoothed(); if(planeIndex == Sector::Ceiling) bz = -bz; - coord_t bhz = backSec->plane(otherPlaneIndex).visHeight(); + coord_t bhz = backSec->plane(otherPlaneIndex).heightSmoothed(); if(planeIndex == Sector::Ceiling) bhz = -bhz; @@ -268,15 +268,15 @@ void ShadowEdge::prepare(int planeIndex) if(d->edge) vo = &vo->prev(); d->inner = Vector3d(lineSide.vertex(d->edge).origin() + vo->innerShadowOffset(), - plane.visHeight()); + plane.heightSmoothed()); } else { d->inner = Vector3d(lineSide.vertex(d->edge).origin() + vo->extendedShadowOffset(), - plane.visHeight()); + plane.heightSmoothed()); } - d->outer = Vector3d(lineSide.vertex(d->edge).origin(), plane.visHeight()); + d->outer = Vector3d(lineSide.vertex(d->edge).origin(), plane.heightSmoothed()); } Vector3d const &ShadowEdge::inner() const diff --git a/doomsday/client/src/render/skyfixedge.cpp b/doomsday/client/src/render/skyfixedge.cpp index 3181e92b3f..5375ba36fa 100644 --- a/doomsday/client/src/render/skyfixedge.cpp +++ b/doomsday/client/src/render/skyfixedge.cpp @@ -39,7 +39,7 @@ static coord_t skyFixFloorZ(Plane const *frontFloor, Plane const *backFloor) { DENG_UNUSED(backFloor); if(devRendSkyMode || P_IsInVoid(viewPlayer)) - return frontFloor->visHeight(); + return frontFloor->heightSmoothed(); return frontFloor->map().skyFixFloor(); } @@ -47,7 +47,7 @@ static coord_t skyFixCeilZ(Plane const *frontCeil, Plane const *backCeil) { DENG_UNUSED(backCeil); if(devRendSkyMode || P_IsInVoid(viewPlayer)) - return frontCeil->visHeight(); + return frontCeil->heightSmoothed(); return frontCeil->map().skyFixCeiling(); } @@ -155,14 +155,14 @@ DENG2_PIMPL(SkyFixEdge) } // Figure out the relative plane heights. - coord_t fz = front->visHeight(); + coord_t fz = front->heightSmoothed(); if(relPlane == Sector::Ceiling) fz = -fz; coord_t bz = 0; if(back) { - bz = back->visHeight(); + bz = back->heightSmoothed(); if(relPlane == Sector::Ceiling) bz = -bz; } @@ -194,11 +194,11 @@ DENG2_PIMPL(SkyFixEdge) if(fixType == Upper) { hi = skyFixCeilZ(fceil, bceil); - lo = de::max((backLeaf && bceil->surface().hasSkyMaskedMaterial() )? bceil->visHeight() : fceil->visHeight(), ffloor->visHeight()); + lo = de::max((backLeaf && bceil->surface().hasSkyMaskedMaterial() )? bceil->heightSmoothed() : fceil->heightSmoothed(), ffloor->heightSmoothed()); } else { - hi = de::min((backLeaf && bfloor->surface().hasSkyMaskedMaterial())? bfloor->visHeight() : ffloor->visHeight(), fceil->visHeight()); + hi = de::min((backLeaf && bfloor->surface().hasSkyMaskedMaterial())? bfloor->heightSmoothed() : ffloor->heightSmoothed(), fceil->heightSmoothed()); lo = skyFixFloorZ(ffloor, bfloor); } diff --git a/doomsday/client/src/render/surfacedecorator.cpp b/doomsday/client/src/render/surfacedecorator.cpp index 77dec1ddc3..0cb652fe64 100644 --- a/doomsday/client/src/render/surfacedecorator.cpp +++ b/doomsday/client/src/render/surfacedecorator.cpp @@ -259,14 +259,14 @@ void SurfaceDecorator::decorate(Surface &surface) Vector3d topLeft(sectorAABox.minX, plane.isSectorFloor()? sectorAABox.maxY : sectorAABox.minY, - plane.visHeight()); + plane.heightSmoothed()); Vector3d bottomRight(sectorAABox.maxX, plane.isSectorFloor()? sectorAABox.minY : sectorAABox.maxY, - plane.visHeight()); + plane.heightSmoothed()); - Vector2f offset(-fmod(sectorAABox.minX, 64) - surface.visMaterialOrigin().x, - -fmod(sectorAABox.minY, 64) - surface.visMaterialOrigin().y); + Vector2f offset(-fmod(sectorAABox.minX, 64) - surface.materialOriginSmoothed().x, + -fmod(sectorAABox.minY, 64) - surface.materialOriginSmoothed().y); d->plotSources(surface, offset, topLeft, bottomRight, §or); } diff --git a/doomsday/client/src/render/vlight.cpp b/doomsday/client/src/render/vlight.cpp index 20fc816508..7e3e83b399 100644 --- a/doomsday/client/src/render/vlight.cpp +++ b/doomsday/client/src/render/vlight.cpp @@ -279,7 +279,7 @@ static void lightWithPlaneGlows(Vector3d const &origin, BspLeaf &bspLeaf, uint l continue; // Not too small! // In front of the plane? - Vector3d pointOnPlane = Vector3d(bspLeaf.cluster().center(), plane.visHeight()); + Vector3d pointOnPlane = Vector3d(bspLeaf.cluster().center(), plane.heightSmoothed()); double dist = (origin - pointOnPlane).dot(surface.normal()); if(dist < 0) continue; diff --git a/doomsday/client/src/render/walledge.cpp b/doomsday/client/src/render/walledge.cpp index b516fabc80..0dc2f0c712 100644 --- a/doomsday/client/src/render/walledge.cpp +++ b/doomsday/client/src/render/walledge.cpp @@ -145,15 +145,15 @@ DENG2_PIMPL(WallEdge), public IHPlane { if(spec.section == LineSide::Middle) { - lo = leaf->visFloorHeight(); - hi = leaf->visCeilingHeight(); + lo = leaf->visFloorHeightSmoothed(); + hi = leaf->visCeilingHeightSmoothed(); } else { - lo = hi = leaf->visFloorHeight(); + lo = hi = leaf->visFloorHeightSmoothed(); } - materialOrigin = seg.lineSide().middle().visMaterialOrigin(); + materialOrigin = seg.lineSide().middle().materialOriginSmoothed(); if(unpegBottom) { materialOrigin.y -= hi - lo; @@ -178,12 +178,12 @@ DENG2_PIMPL(WallEdge), public IHPlane if(!line.isSelfReferencing()) { // Can't go over front ceiling (would induce geometry flaws). - if(bceil->visHeight() < ffloor->visHeight()) - lo = ffloor->visHeight(); + if(bceil->heightSmoothed() < ffloor->heightSmoothed()) + lo = ffloor->heightSmoothed(); else - lo = bceil->visHeight(); + lo = bceil->heightSmoothed(); - hi = fceil->visHeight(); + hi = fceil->heightSmoothed(); if(spec.flags.testFlag(WallSpec::SkyClip) && fceil->surface().hasSkyMaskedMaterial() @@ -192,11 +192,11 @@ DENG2_PIMPL(WallEdge), public IHPlane hi = lo; } - materialOrigin = seg.lineSide().middle().visMaterialOrigin(); + materialOrigin = seg.lineSide().middle().materialOriginSmoothed(); if(!unpegTop) { // Align with normal middle texture. - materialOrigin.y -= fceil->visHeight() - bceil->visHeight(); + materialOrigin.y -= fceil->heightSmoothed() - bceil->heightSmoothed(); } } break; @@ -208,22 +208,22 @@ DENG2_PIMPL(WallEdge), public IHPlane bool const raiseToBackFloor = (fceil->surface().hasSkyMaskedMaterial() && bceil->surface().hasSkyMaskedMaterial() - && fceil->visHeight() < bceil->visHeight() - && bfloor->visHeight() > fceil->visHeight()); + && fceil->heightSmoothed() < bceil->heightSmoothed() + && bfloor->heightSmoothed() > fceil->heightSmoothed()); - coord_t t = bfloor->visHeight(); + coord_t t = bfloor->heightSmoothed(); - lo = ffloor->visHeight(); + lo = ffloor->heightSmoothed(); // Can't go over the back ceiling, would induce polygon flaws. - if(bfloor->visHeight() > bceil->visHeight()) - t = bceil->visHeight(); + if(bfloor->heightSmoothed() > bceil->heightSmoothed()) + t = bceil->heightSmoothed(); // Can't go over front ceiling, would induce polygon flaws. // In the special case of a sky masked upper we must extend the bottom // section up to the height of the back floor. - if(t > fceil->visHeight() && !raiseToBackFloor) - t = fceil->visHeight(); + if(t > fceil->heightSmoothed() && !raiseToBackFloor) + t = fceil->heightSmoothed(); hi = t; @@ -234,18 +234,18 @@ DENG2_PIMPL(WallEdge), public IHPlane lo = hi; } - materialOrigin = seg.lineSide().bottom().visMaterialOrigin(); - if(bfloor->visHeight() > fceil->visHeight()) + materialOrigin = seg.lineSide().bottom().materialOriginSmoothed(); + if(bfloor->heightSmoothed() > fceil->heightSmoothed()) { - materialOrigin.y -= (raiseToBackFloor? t : fceil->visHeight()) - - bfloor->visHeight(); + materialOrigin.y -= (raiseToBackFloor? t : fceil->heightSmoothed()) + - bfloor->heightSmoothed(); } if(unpegBottom) { // Align with normal middle texture. - materialOrigin.y += (raiseToBackFloor? t : fceil->visHeight()) - - bfloor->visHeight(); + materialOrigin.y += (raiseToBackFloor? t : fceil->heightSmoothed()) + - bfloor->heightSmoothed(); } } break; @@ -256,17 +256,17 @@ DENG2_PIMPL(WallEdge), public IHPlane if(!line.isSelfReferencing()) { - lo = de::max(bfloor->visHeight(), ffloor->visHeight()); - hi = de::min(bceil->visHeight(), fceil->visHeight()); + lo = de::max(bfloor->heightSmoothed(), ffloor->heightSmoothed()); + hi = de::min(bceil->heightSmoothed(), fceil->heightSmoothed()); } else { // Use the unmapped heights for positioning purposes. - lo = lineSide.sector().floor().visHeight(); - hi = lineSide.back().sector().ceiling().visHeight(); + lo = lineSide.sector().floor().heightSmoothed(); + hi = lineSide.back().sector().ceiling().heightSmoothed(); } - materialOrigin = Vector2f(middle.visMaterialOrigin().x, 0); + materialOrigin = Vector2f(middle.materialOriginSmoothed().x, 0); // Perform clipping. if(middle.hasMaterial() @@ -280,20 +280,20 @@ DENG2_PIMPL(WallEdge), public IHPlane } else { - openBottom = ffloor->visHeight(); - openTop = fceil->visHeight(); + openBottom = ffloor->heightSmoothed(); + openTop = fceil->heightSmoothed(); } if(openTop > openBottom) { if(unpegBottom) { - lo += middle.visMaterialOrigin().y; + lo += middle.materialOriginSmoothed().y; hi = lo + middle.material().height(); } else { - hi += middle.visMaterialOrigin().y; + hi += middle.materialOriginSmoothed().y; lo = hi - middle.material().height(); } @@ -524,15 +524,15 @@ DENG2_PIMPL(WallEdge), public IHPlane if(scanSec) { - if(scanSec->ceiling().visHeight() - scanSec->floor().visHeight() > 0) + if(scanSec->ceiling().heightSmoothed() - scanSec->floor().heightSmoothed() > 0) { for(int j = 0; j < scanSec->planeCount() && !stopScan; ++j) { Plane const &plane = scanSec->plane(j); - if(plane.visHeight() > bottom && plane.visHeight() < top) + if(plane.heightSmoothed() > bottom && plane.heightSmoothed() < top) { - double distance = distanceTo(plane.visHeight()); + double distance = distanceTo(plane.heightSmoothed()); if(!haveEvent(distance)) { @@ -547,10 +547,10 @@ DENG2_PIMPL(WallEdge), public IHPlane if(!stopScan) { // Clip a range bound to this height? - if(plane.isSectorFloor() && plane.visHeight() > bottom) - bottom = plane.visHeight(); - else if(plane.isSectorCeiling() && plane.visHeight() < top) - top = plane.visHeight(); + if(plane.isSectorFloor() && plane.heightSmoothed() > bottom) + bottom = plane.heightSmoothed(); + else if(plane.isSectorCeiling() && plane.heightSmoothed() < top) + top = plane.heightSmoothed(); // All clipped away? if(bottom >= top) @@ -567,7 +567,7 @@ DENG2_PIMPL(WallEdge), public IHPlane * we automatically fix the case of a floor above a * ceiling by lowering the floor. */ - coord_t z = scanSec->ceiling().visHeight(); + coord_t z = scanSec->ceiling().heightSmoothed(); if(z > bottom && z < top) { diff --git a/doomsday/client/src/world/bspleaf.cpp b/doomsday/client/src/world/bspleaf.cpp index 31167085c9..629f4fd11c 100644 --- a/doomsday/client/src/world/bspleaf.cpp +++ b/doomsday/client/src/world/bspleaf.cpp @@ -239,7 +239,7 @@ DENG2_PIMPL(BspLeaf) Plane const &plane = cluster->visPlane(planeIndex); Surface const &surface = plane.surface(); - Vector3d surfacePoint(poly->center(), plane.visHeight()); + Vector3d surfacePoint(poly->center(), plane.heightSmoothed()); foreach(BiasSource *source, self.map().biasSources()) { @@ -417,13 +417,13 @@ bool BspLeaf::polyContains(Vector2d const &point) const #ifdef __CLIENT__ -bool BspLeaf::hasWorldVolume(bool useVisualHeights) const +bool BspLeaf::hasWorldVolume(bool useSmoothedHeights) const { if(!hasCluster()) return false; - if(useVisualHeights) + if(useSmoothedHeights) { - return visCeilingHeight() - visFloorHeight() > 0; + return visCeilingHeightSmoothed() - visFloorHeightSmoothed() > 0; } else { diff --git a/doomsday/client/src/world/map.cpp b/doomsday/client/src/world/map.cpp index b6dddcfcad..9c44ab7feb 100644 --- a/doomsday/client/src/world/map.cpp +++ b/doomsday/client/src/world/map.cpp @@ -1042,7 +1042,7 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) } /** - * $smoothplane: interpolate the visual offset of planes. + * Interpolate the smoothed height of planes. */ void lerpTrackedPlanes(bool resetNextViewer) { @@ -1051,26 +1051,24 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) // Reset the plane height trackers. foreach(Plane *plane, trackedPlanes) { - plane->resetVisHeight(); + plane->resetSmoothedHeight(); } // Tracked movement is now all done. trackedPlanes.clear(); } - // While the game is paused there is no need to calculate any - // visual plane offsets $smoothplane. + // While the game is paused there is no need to smooth. else //if(!clientPaused) { - // Set the visible offsets. QMutableSetIterator iter(trackedPlanes); while(iter.hasNext()) { Plane *plane = iter.next(); - plane->lerpVisHeight(); + plane->lerpSmoothedHeight(); // Has this plane reached its destination? - if(de::fequal(plane->visHeight(), plane->height())) + if(de::fequal(plane->heightSmoothed(), plane->height())) { iter.remove(); } @@ -1079,7 +1077,7 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) } /** - * $smoothmatoffset: interpolate the visual offset of surfaces. + * Interpolate the smoothed material origin of surfaces. */ void lerpScrollingSurfaces(bool resetNextViewer) { @@ -1088,26 +1086,24 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) // Reset the surface material origin trackers. foreach(Surface *surface, scrollingSurfaces) { - surface->resetVisMaterialOrigin(); + surface->resetSmoothedMaterialOrigin(); } // Tracked movement is now all done. scrollingSurfaces.clear(); } - // While the game is paused there is no need to calculate any - // visual material origin offsets $smoothmaterialorigin. + // While the game is paused there is no need to smooth. else //if(!clientPaused) { - // Set the visible origins. QMutableSetIterator iter(scrollingSurfaces); while(iter.hasNext()) { Surface *surface = iter.next(); - surface->lerpVisMaterialOrigin(); + surface->lerpSmoothedMaterialOrigin(); // Has this material reached its destination? - if(surface->visMaterialOrigin() == surface->materialOrigin()) + if(surface->materialOriginSmoothed() == surface->materialOrigin()) { iter.remove(); } @@ -2010,8 +2006,8 @@ void Map::link(mobj_t &mo, byte flags) if(bspLeaf.polyContains(player->mo->origin)) { #ifdef __CLIENT__ - if(player->mo->origin[VZ] < bspLeaf.visCeilingHeight() + 4 && - player->mo->origin[VZ] >= bspLeaf.visFloorHeight()) + if(player->mo->origin[VZ] < bspLeaf.visCeilingHeightSmoothed() + 4 && + player->mo->origin[VZ] >= bspLeaf.visFloorHeightSmoothed()) #else if(player->mo->origin[VZ] < bspLeaf.ceilingHeight() + 4 && player->mo->origin[VZ] >= bspLeaf.floorHeight()) @@ -2620,10 +2616,10 @@ void Map::initSkyFix() if(skyCeil) { // Adjust for the plane height. - if(sector->ceiling().visHeight() > d->skyCeilingHeight) + if(sector->ceiling().heightSmoothed() > d->skyCeilingHeight) { // Must raise the skyfix ceiling. - d->skyCeilingHeight = sector->ceiling().visHeight(); + d->skyCeilingHeight = sector->ceiling().heightSmoothed(); } // Check that all the mobjs in the sector fit in. @@ -2642,10 +2638,10 @@ void Map::initSkyFix() if(skyFloor) { // Adjust for the plane height. - if(sector->floor().visHeight() < d->skyFloorHeight) + if(sector->floor().heightSmoothed() < d->skyFloorHeight) { // Must lower the skyfix floor. - d->skyFloorHeight = sector->floor().visHeight(); + d->skyFloorHeight = sector->floor().heightSmoothed(); } } diff --git a/doomsday/client/src/world/maputil.cpp b/doomsday/client/src/world/maputil.cpp index 4dc79df261..f8bcac6383 100644 --- a/doomsday/client/src/world/maputil.cpp +++ b/doomsday/client/src/world/maputil.cpp @@ -55,23 +55,23 @@ static coord_t visOpenRange(LineSide const &side, coord_t *retBottom = 0, coord_ Sector const *backSec = side.back().sectorPtr(); coord_t bottom; - if(backSec && backSec->floor().visHeight() > frontSec->floor().visHeight()) + if(backSec && backSec->floor().heightSmoothed() > frontSec->floor().heightSmoothed()) { - bottom = backSec->floor().visHeight(); + bottom = backSec->floor().heightSmoothed(); } else { - bottom = frontSec->floor().visHeight(); + bottom = frontSec->floor().heightSmoothed(); } coord_t top; - if(backSec && backSec->ceiling().visHeight() < frontSec->ceiling().visHeight()) + if(backSec && backSec->ceiling().heightSmoothed() < frontSec->ceiling().heightSmoothed()) { - top = backSec->ceiling().visHeight(); + top = backSec->ceiling().heightSmoothed(); } else { - top = frontSec->ceiling().visHeight(); + top = frontSec->ceiling().heightSmoothed(); } if(retBottom) *retBottom = bottom; @@ -92,9 +92,9 @@ bool R_SideBackClosed(LineSide const &side, bool ignoreOpacity) Sector const &frontSec = side.sector(); Sector const &backSec = side.back().sector(); - if(backSec.floor().visHeight() >= backSec.ceiling().visHeight()) return true; - if(backSec.ceiling().visHeight() <= frontSec.floor().visHeight()) return true; - if(backSec.floor().visHeight() >= frontSec.ceiling().visHeight()) return true; + if(backSec.floor().heightSmoothed() >= backSec.ceiling().heightSmoothed()) return true; + if(backSec.ceiling().heightSmoothed() <= frontSec.floor().heightSmoothed()) return true; + if(backSec.floor().heightSmoothed() >= frontSec.ceiling().heightSmoothed()) return true; // Perhaps a middle material completely covers the opening? if(side.middle().hasMaterial()) @@ -217,11 +217,11 @@ Line *R_FindSolidLineNeighbor(Sector const *sector, Line const *line, if(!other->hasFrontSector()) return other; if(!other->hasBackSector()) return other; - if(other->frontSector().floor().visHeight() >= sector->ceiling().visHeight() || - other->frontSector().ceiling().visHeight() <= sector->floor().visHeight() || - other->backSector().floor().visHeight() >= sector->ceiling().visHeight() || - other->backSector().ceiling().visHeight() <= sector->floor().visHeight() || - other->backSector().ceiling().visHeight() <= other->backSector().floor().visHeight()) + if(other->frontSector().floor().heightSmoothed() >= sector->ceiling().heightSmoothed() || + other->frontSector().ceiling().heightSmoothed() <= sector->floor().heightSmoothed() || + other->backSector().floor().heightSmoothed() >= sector->ceiling().heightSmoothed() || + other->backSector().ceiling().heightSmoothed() <= sector->floor().heightSmoothed() || + other->backSector().ceiling().heightSmoothed() <= other->backSector().floor().heightSmoothed()) return other; // Both front and back MUST be open by this point. diff --git a/doomsday/client/src/world/p_mobj.cpp b/doomsday/client/src/world/p_mobj.cpp index dbac276a70..52d7178ad7 100644 --- a/doomsday/client/src/world/p_mobj.cpp +++ b/doomsday/client/src/world/p_mobj.cpp @@ -293,11 +293,11 @@ boolean Mobj_OriginBehindVisPlane(mobj_t *mo) return false; Plane const &visFloor = mo->bspLeaf->visFloor(); - if(&mo->bspLeaf->floor() != &visFloor && mo->origin[VZ] < visFloor.visHeight()) + if(&mo->bspLeaf->floor() != &visFloor && mo->origin[VZ] < visFloor.heightSmoothed()) return true; Plane const &visCeiling = mo->bspLeaf->visCeiling(); - if(&mo->bspLeaf->ceiling() != &visCeiling && mo->origin[VZ] > visCeiling.visHeight()) + if(&mo->bspLeaf->ceiling() != &visCeiling && mo->origin[VZ] > visCeiling.heightSmoothed()) return true; return false; @@ -364,7 +364,7 @@ void Mobj_GenerateLumobjs(mobj_t *mo) // Will the visual be allowed to go inside the floor? /// @todo Handle this as occlusion so that the halo fades smoothly. - coord_t impacted = mo->origin[VZ] + -tex.origin().y - ms.height() - mo->bspLeaf->visFloorHeight(); + coord_t impacted = mo->origin[VZ] + -tex.origin().y - ms.height() - mo->bspLeaf->visFloorHeightSmoothed(); // If the floor is a visual plane then no light should be emitted. if(impacted < 0 && &mo->bspLeaf->visFloor() != &mo->bspLeaf->floor()) diff --git a/doomsday/client/src/world/p_objlink.cpp b/doomsday/client/src/world/p_objlink.cpp index db4c8f01ee..bc28328da6 100644 --- a/doomsday/client/src/world/p_objlink.cpp +++ b/doomsday/client/src/world/p_objlink.cpp @@ -392,12 +392,12 @@ static void maybeSpreadOverEdge(HEdge *hedge, contactfinderparams_t *parms) // Do not spread if the sector on the back side is closed with no height. if(backLeaf.hasSector()) { - if(backLeaf.visCeilingHeight() <= backLeaf.visFloorHeight()) + if(backLeaf.visCeilingHeightSmoothed() <= backLeaf.visFloorHeightSmoothed()) return; if(leaf.hasSector() && - (backLeaf.visCeilingHeight() <= leaf.visFloorHeight() || - backLeaf.visFloorHeight() >= leaf.visCeilingHeight())) + (backLeaf.visCeilingHeightSmoothed() <= leaf.visFloorHeightSmoothed() || + backLeaf.visFloorHeightSmoothed() >= leaf.visCeilingHeightSmoothed())) return; } @@ -426,23 +426,23 @@ static void maybeSpreadOverEdge(HEdge *hedge, contactfinderparams_t *parms) // Determine the opening between the visual sector planes at this edge. coord_t openBottom; - if(toLeaf.hasSector() && toLeaf.visFloorHeight() > fromLeaf.visFloorHeight()) + if(toLeaf.hasSector() && toLeaf.visFloorHeightSmoothed() > fromLeaf.visFloorHeightSmoothed()) { - openBottom = toLeaf.visFloorHeight(); + openBottom = toLeaf.visFloorHeightSmoothed(); } else { - openBottom = fromLeaf.visFloorHeight(); + openBottom = fromLeaf.visFloorHeightSmoothed(); } coord_t openTop; - if(toLeaf.hasSector() && toLeaf.visCeilingHeight() < fromLeaf.visCeilingHeight()) + if(toLeaf.hasSector() && toLeaf.visCeilingHeightSmoothed() < fromLeaf.visCeilingHeightSmoothed()) { - openTop = toLeaf.visCeilingHeight(); + openTop = toLeaf.visCeilingHeightSmoothed(); } else { - openTop = fromLeaf.visCeilingHeight(); + openTop = fromLeaf.visCeilingHeightSmoothed(); } // Ensure we have up to date info about the material. diff --git a/doomsday/client/src/world/p_particle.cpp b/doomsday/client/src/world/p_particle.cpp index 3251e44b6a..5577cec4b9 100644 --- a/doomsday/client/src/world/p_particle.cpp +++ b/doomsday/client/src/world/p_particle.cpp @@ -867,9 +867,9 @@ float P_GetParticleRadius(ded_ptcstage_t const *def, int ptcIDX) float P_GetParticleZ(particle_t const *pt) { if(pt->origin[VZ] == DDMAXINT) - return pt->sector->ceiling().visHeight() - 2; + return pt->sector->ceiling().heightSmoothed() - 2; else if(pt->origin[VZ] == DDMININT) - return (pt->sector->floor().visHeight() + 2); + return (pt->sector->floor().heightSmoothed() + 2); return FIX2FLT(pt->origin[VZ]); } diff --git a/doomsday/client/src/world/p_players.cpp b/doomsday/client/src/world/p_players.cpp index 60741f2ce9..006de9d769 100644 --- a/doomsday/client/src/world/p_players.cpp +++ b/doomsday/client/src/world/p_players.cpp @@ -136,7 +136,7 @@ boolean P_IsInVoid(player_t *player) if(skyCeil < DDMAXFLOAT && ddpl->mo->origin[VZ] > skyCeil - 4) return true; } - else if(ddpl->mo->origin[VZ] > bspLeaf->visCeilingHeight() - 4) + else if(ddpl->mo->origin[VZ] > bspLeaf->visCeilingHeightSmoothed() - 4) #else if(ddpl->mo->origin[VZ] > bspLeaf->ceilingHeight() - 4) #endif @@ -151,7 +151,7 @@ boolean P_IsInVoid(player_t *player) if(skyFloor > DDMINFLOAT && ddpl->mo->origin[VZ] < skyFloor + 4) return true; } - else if(ddpl->mo->origin[VZ] < bspLeaf->visFloorHeight() + 4) + else if(ddpl->mo->origin[VZ] < bspLeaf->visFloorHeightSmoothed() + 4) #else if(ddpl->mo->origin[VZ] < bspLeaf->floorHeight() + 4) #endif diff --git a/doomsday/client/src/world/plane.cpp b/doomsday/client/src/world/plane.cpp index 8160f44c8a..68010d7f1e 100644 --- a/doomsday/client/src/world/plane.cpp +++ b/doomsday/client/src/world/plane.cpp @@ -48,10 +48,10 @@ DENG2_PIMPL(Plane) coord_t targetHeight; /// Visual plane height (smoothed). - coord_t visHeight; + coord_t heightSmoothed; /// Delta between the current @em sharp height and the visual height. - coord_t visHeightDelta; + coord_t heightSmoothedDelta; /// Movement speed (map space units per tic). coord_t speed; @@ -64,8 +64,8 @@ DENG2_PIMPL(Plane) indexInSector(-1), height(height), targetHeight(height), - visHeight(height), - visHeightDelta(0), + heightSmoothed(height), + heightSmoothedDelta(0), speed(0), surface(dynamic_cast(*i)) { @@ -251,34 +251,32 @@ coord_t Plane::speed() const #ifdef __CLIENT__ -coord_t Plane::visHeight() const +coord_t Plane::heightSmoothed() const { - // $smoothplane - return d->visHeight; + return d->heightSmoothed; } -coord_t Plane::visHeightDelta() const +coord_t Plane::heightSmoothedDelta() const { - // $smoothplane - return d->visHeightDelta; + return d->heightSmoothedDelta; } -void Plane::lerpVisHeight() +void Plane::lerpSmoothedHeight() { // $smoothplane - d->visHeightDelta = d->oldHeight[0] * (1 - frameTimePos) + d->height * frameTimePos - d->height; + d->heightSmoothedDelta = d->oldHeight[0] * (1 - frameTimePos) + d->height * frameTimePos - d->height; // Visible plane height. - d->visHeight = d->height + d->visHeightDelta; + d->heightSmoothed = d->height + d->heightSmoothedDelta; d->markDependantSurfacesForDecorationUpdate(); } -void Plane::resetVisHeight() +void Plane::resetSmoothedHeight() { // $smoothplane - d->visHeightDelta = 0; - d->visHeight = d->oldHeight[0] = d->oldHeight[1] = d->height; + d->heightSmoothedDelta = 0; + d->heightSmoothed = d->oldHeight[0] = d->oldHeight[1] = d->height; d->markDependantSurfacesForDecorationUpdate(); } diff --git a/doomsday/client/src/world/surface.cpp b/doomsday/client/src/world/surface.cpp index 6b25becce8..80fe0b097f 100644 --- a/doomsday/client/src/world/surface.cpp +++ b/doomsday/client/src/world/surface.cpp @@ -51,8 +51,8 @@ DENG2_PIMPL(Surface) #ifdef __CLIENT__ Vector2f oldMaterialOrigin[2]; ///< Old @em sharp surface space material origins, for smoothing. - Vector2f visMaterialOrigin; ///< @em smoothed surface space material origin. - Vector2f visMaterialOriginDelta; ///< Delta between @em sharp and @em smoothed. + Vector2f materialOriginSmoothed; ///< @em smoothed surface space material origin. + Vector2f materialOriginSmoothedDelta; ///< Delta between @em sharp and @em smoothed. /// @todo Decorations do not belong at this level. Plotting decorations /// requires knowledge of the geometry (a BiasSurface-like abstraction @@ -333,8 +333,8 @@ void Surface::setMaterialOrigin(Vector2f const &newOrigin) // During map setup we'll apply this immediately to the visual origin also. if(ddMapSetup) { - d->visMaterialOrigin = d->materialOrigin; - d->visMaterialOriginDelta.x = d->visMaterialOriginDelta.y = 0; + d->materialOriginSmoothed = d->materialOrigin; + d->materialOriginSmoothedDelta.x = d->materialOriginSmoothedDelta.y = 0; d->oldMaterialOrigin[0] = d->oldMaterialOrigin[1] = d->materialOrigin; } @@ -357,8 +357,8 @@ void Surface::setMaterialOriginComponent(int component, float newPosition) // During map setup we'll apply this immediately to the visual origin also. if(ddMapSetup) { - d->visMaterialOrigin[component] = d->materialOrigin[component]; - d->visMaterialOriginDelta[component] = 0; + d->materialOriginSmoothed[component] = d->materialOrigin[component]; + d->materialOriginSmoothedDelta[component] = 0; d->oldMaterialOrigin[0][component] = d->oldMaterialOrigin[1][component] = @@ -379,35 +379,35 @@ de::Uri Surface::composeMaterialUri() const #ifdef __CLIENT__ -Vector2f const &Surface::visMaterialOrigin() const +Vector2f const &Surface::materialOriginSmoothed() const { - return d->visMaterialOrigin; + return d->materialOriginSmoothed; } -Vector2f const &Surface::visMaterialOriginDelta() const +Vector2f const &Surface::materialOriginSmoothedDelta() const { - return d->visMaterialOriginDelta; + return d->materialOriginSmoothedDelta; } -void Surface::lerpVisMaterialOrigin() +void Surface::lerpSmoothedMaterialOrigin() { // $smoothmaterialorigin - d->visMaterialOriginDelta = d->oldMaterialOrigin[0] * (1 - frameTimePos) + d->materialOriginSmoothedDelta = d->oldMaterialOrigin[0] * (1 - frameTimePos) + d->materialOrigin * frameTimePos - d->materialOrigin; // Visible material origin. - d->visMaterialOrigin = d->materialOrigin + d->visMaterialOriginDelta; + d->materialOriginSmoothed = d->materialOrigin + d->materialOriginSmoothedDelta; #ifdef __CLIENT__ markAsNeedingDecorationUpdate(); #endif } -void Surface::resetVisMaterialOrigin() +void Surface::resetSmoothedMaterialOrigin() { // $smoothmaterialorigin - d->visMaterialOrigin = d->oldMaterialOrigin[0] = d->oldMaterialOrigin[1] = d->materialOrigin; - d->visMaterialOriginDelta.x = d->visMaterialOriginDelta.y = 0; + d->materialOriginSmoothed = d->oldMaterialOrigin[0] = d->oldMaterialOrigin[1] = d->materialOrigin; + d->materialOriginSmoothedDelta.x = d->materialOriginSmoothedDelta.y = 0; #ifdef __CLIENT__ markAsNeedingDecorationUpdate(); diff --git a/doomsday/client/src/world/vertex.cpp b/doomsday/client/src/world/vertex.cpp index ec713f4051..851b65dc2a 100644 --- a/doomsday/client/src/world/vertex.cpp +++ b/doomsday/client/src/world/vertex.cpp @@ -116,20 +116,20 @@ void Vertex::planeVisHeightMinMax(coord_t *min, coord_t *max) const if(li->hasFrontSector()) { - if(min && li->frontSector().floor().visHeight() < *min) - *min = li->frontSector().floor().visHeight(); + if(min && li->frontSector().floor().heightSmoothed() < *min) + *min = li->frontSector().floor().heightSmoothed(); - if(max && li->frontSector().ceiling().visHeight() > *max) - *max = li->frontSector().ceiling().visHeight(); + if(max && li->frontSector().ceiling().heightSmoothed() > *max) + *max = li->frontSector().ceiling().heightSmoothed(); } if(li->hasBackSector()) { - if(min && li->backSector().floor().visHeight() < *min) - *min = li->backSector().floor().visHeight(); + if(min && li->backSector().floor().heightSmoothed() < *min) + *min = li->backSector().floor().heightSmoothed(); - if(max && li->backSector().ceiling().visHeight() > *max) - *max = li->backSector().ceiling().visHeight(); + if(max && li->backSector().ceiling().heightSmoothed() > *max) + *max = li->backSector().ceiling().heightSmoothed(); } own = &own->next(); diff --git a/doomsday/client/src/world/world.cpp b/doomsday/client/src/world/world.cpp index 0ff7efb587..7f3e42aca6 100644 --- a/doomsday/client/src/world/world.cpp +++ b/doomsday/client/src/world/world.cpp @@ -592,8 +592,8 @@ DENG2_PIMPL(World) if(bspLeaf.hasSector() && !bspLeaf.isDegenerate()) { #ifdef __CLIENT__ - if(mo->origin[VZ] >= bspLeaf.visFloorHeight() && - mo->origin[VZ] < bspLeaf.visCeilingHeight() - 4) + if(mo->origin[VZ] >= bspLeaf.visFloorHeightSmoothed() && + mo->origin[VZ] < bspLeaf.visCeilingHeightSmoothed() - 4) #else if(mo->origin[VZ] >= bspLeaf.floorHeight() && mo->origin[VZ] < bspLeaf.ceilingHeight() - 4) diff --git a/web/style.css b/web/style.css index e26a0e1592..e1b61d3bc7 100644 --- a/web/style.css +++ b/web/style.css @@ -380,7 +380,8 @@ dl.codebox code:hover { overflow: auto; } -.block .newspost.content img { +.block .newspost.content img, +.block .blogpost.content img { max-width: 100%; margin-left: auto; margin-right: auto; @@ -388,7 +389,7 @@ dl.codebox code:hover { } /* Quick "fix" kludge to address link spacing in news posts on the homepage. */ -.block .newspost.content > a { +.block .newspost.content > a, .block .blogpost.content > a { display:inline-block; margin-left: 0.5ex; }