Skip to content

Commit

Permalink
Fixed|World: Plane heights not initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 14, 2020
1 parent eb927d7 commit cc6773d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/world/polyobjdata.h
Expand Up @@ -26,7 +26,7 @@ class ClPolyMover;
class PolyobjData : public world::PolyobjData
{
public:
PolyobjData();
PolyobjData() = default;

void addMover(ClPolyMover &mover);
void removeMover(ClPolyMover &mover);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/src/render/rend_main.cpp
Expand Up @@ -3849,12 +3849,12 @@ static void traverseBspTreeAndDrawSubspaces(const world::BspTree *bspTree)
if (auto *subspace = bspTree->userData()->as<world::BspLeaf>().subspacePtr())
{
DE_ASSERT(subspace->hasSubsector());

// Skip zero-volume subspaces.
// (Neighbors handle the angle clipper ranges.)
if (!subspace->subsector().as<Subsector>().hasWorldVolume())
return;

// Is this subspace visible?
if (!::firstSubspace && !clipper.isPolyVisible(subspace->poly()))
return;
Expand Down
6 changes: 6 additions & 0 deletions doomsday/apps/client/src/world/base/clientserverworld.cpp
Expand Up @@ -41,6 +41,7 @@
# include "client/cledgeloop.h"
# include "gl/gl_main.h"
# include "world/contact.h"
# include "world/polyobjdata.h"
# include "world/subsector.h"
# include "world/vertex.h"
# include "Lumobj"
Expand Down Expand Up @@ -70,6 +71,7 @@
#include <doomsday/world/MaterialManifest>
#include <doomsday/world/Materials>
#include <doomsday/world/plane.h>
#include <doomsday/world/polyobjdata.h>
#include <doomsday/world/subsector.h>
#include <doomsday/world/surface.h>
#include <doomsday/world/thinkers.h>
Expand Down Expand Up @@ -310,6 +312,9 @@ DE_PIMPL(ClientServerWorld)
Factory::setPlaneConstructor([](world::Sector &sec, const Vec3f &norm, double hgt) -> world::Plane * {
return new Plane(sec, norm, hgt);
});
Factory::setPolyobjDataConstructor([]() -> world::PolyobjData * {
return new PolyobjData();
});
Factory::setSkyConstructor([](const defn::Sky *def) -> world::Sky * {
return new Sky(def);
});
Expand Down Expand Up @@ -344,6 +349,7 @@ DE_PIMPL(ClientServerWorld)
Factory::setPlaneConstructor([](world::Sector &sec, const Vec3f &norm, double hgt) {
return new world::Plane(sec, norm, hgt);
});
Factory::setPolyobjDataConstructor([]() { return new world::PolyobjData(); });
Factory::setSkyConstructor([](const defn::Sky *def) { return new world::Sky(def); });
Factory::setSubsectorConstructor([] (const List<world::ConvexSubspace *> &sl) {
return new world::Subsector(sl);
Expand Down
3 changes: 2 additions & 1 deletion doomsday/apps/client/src/world/plane.cpp
Expand Up @@ -36,8 +36,9 @@ using namespace de;
Plane::Plane(world::Sector &sector, const Vec3f &normal, double height)
: world::Plane(sector, normal, height)
{
setHeight(height); // init smooth height

surface().audienceForMaterialChange() += this;

audienceForHeightChange() += [this]() {
if (!World::ddMapSetup)
{
Expand Down
6 changes: 4 additions & 2 deletions doomsday/apps/client/src/world/subsector.cpp
Expand Up @@ -1608,11 +1608,13 @@ bool Subsector::hasWorldVolume(bool useSmoothedHeights) const
d->validFrame = currentFrame;
if (useSmoothedHeights)
{
d->hasWorldVolumeInValidFrame = visCeiling().heightSmoothed() - visFloor().heightSmoothed() > 0;
// debug("ceiling %f -- floor %f (%f, %f)", visCeiling().heightSmoothed(), visFloor().heightSmoothed(),
// sector().ceiling().height(), sector().floor().height());
d->hasWorldVolumeInValidFrame = visCeiling().heightSmoothed() > visFloor().heightSmoothed();
}
else
{
d->hasWorldVolumeInValidFrame = sector().ceiling().height() - sector().floor().height() > 0;
d->hasWorldVolumeInValidFrame = sector().ceiling().height() > sector().floor().height();
}
}
return d->hasWorldVolumeInValidFrame;
Expand Down
4 changes: 1 addition & 3 deletions doomsday/libs/doomsday/include/doomsday/world/polyobjdata.h
Expand Up @@ -39,6 +39,7 @@ class LIBDOOMSDAY_PUBLIC PolyobjData : public Thinker::IData
typedef de::List<de::Vec2d> VertexCoords;

public:
PolyobjData();
~PolyobjData();

void setThinker(thinker_s *thinker);
Expand All @@ -54,9 +55,6 @@ class LIBDOOMSDAY_PUBLIC PolyobjData : public Thinker::IData
de::List<Vertex *> uniqueVertexes;
VertexCoords originalPts; ///< Used as the base for the rotations.
VertexCoords prevPts; ///< Use to restore the old point values.

protected:
PolyobjData();

private:
polyobj_s *_polyobj = nullptr;
Expand Down

0 comments on commit cc6773d

Please sign in to comment.