Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/skyjake/Doomsday-Engine
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Oct 30, 2016
2 parents 9da38c2 + 53fe5e6 commit bc2b64b
Show file tree
Hide file tree
Showing 45 changed files with 667 additions and 293 deletions.
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/client/clientsubsector.h
Expand Up @@ -48,7 +48,7 @@ class ClientSubsector : public Subsector, public de::LightGrid::IBlockLightSourc
*
* @param subspaces Set of subspaces comprising the resulting subsector.
*/
ClientSubsector(QList<ConvexSubspace *> const &subspaces);
ClientSubsector(QVector<ConvexSubspace *> const &subspaces);

/**
* Returns a human-friendly, textual description of the subsector.
Expand Down
4 changes: 4 additions & 0 deletions doomsday/apps/client/include/misc/hedge.h
Expand Up @@ -26,6 +26,8 @@
#include "Mesh"
#include "Vertex"

namespace world { class Subsector; }

namespace de {

/**
Expand Down Expand Up @@ -190,6 +192,8 @@ class HEdge : public MeshElement
*/
inline void setPrev(HEdge *newPrev) { setNeighbor(Anticlockwise, newPrev); }

world::Subsector *subsector() const;

private:
DENG2_PRIVATE(d)
};
Expand Down
13 changes: 12 additions & 1 deletion doomsday/apps/client/include/render/drawlist.h
Expand Up @@ -154,7 +154,7 @@ class DrawList
* @param modTexture GL-name of the modulation texture; otherwise @c 0.
* @param modColor Modulation color.
*/
DrawList &write(Store const &buffer, de::gl::Primitive primitive, Indices const &indices,
DrawList &write(Store const &buffer, de::gl::Primitive primitive, de::duint const *indices, int indexCount,
blendmode_t blendMode = BM_NORMAL,
bool oneLight = false,
bool manyLights = false,
Expand All @@ -165,6 +165,17 @@ class DrawList
GLuint modTexture = 0,
de::Vector3f const &modColor = de::Vector3f());

DrawList &write(Store const &buffer, de::gl::Primitive primitive, Indices const &indices,
blendmode_t blendMode = BM_NORMAL,
bool oneLight = false,
bool manyLights = false,
de::Vector2f const &texScale = de::Vector2f(1, 1),
de::Vector2f const &texOffset = de::Vector2f(0, 0),
de::Vector2f const &detailTexScale = de::Vector2f(1, 1),
de::Vector2f const &detailTexOffset = de::Vector2f(0, 0),
GLuint modTexture = 0,
de::Vector3f const &modColor = de::Vector3f());

void draw(DrawMode mode, TexUnitMap const &texUnitMap) const;

/**
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/render/rend_fakeradio.h
Expand Up @@ -75,7 +75,7 @@ DENG2_EXTERN_C byte devFakeRadioUpdate;
* @param rightEdge Geometry for the right edge of the wall section.
* @param ambientLight Ambient light level/luminosity.
*/
void Rend_DrawWallRadio(de::WallEdge const &leftEdge, de::WallEdge const &rightEdge, de::dfloat ambientLight);
void Rend_DrawWallRadio(WallEdge const &leftEdge, WallEdge const &rightEdge, de::dfloat ambientLight);

/**
* Render FakeRadio for the given subspace. Draws all shadow geometry linked to the ConvexSubspace,
Expand Down
6 changes: 3 additions & 3 deletions doomsday/apps/client/include/render/rend_main.h
Expand Up @@ -291,12 +291,12 @@ TextureVariantSpec const &Rend_MapSurfaceShinyTextureSpec();
TextureVariantSpec const &Rend_MapSurfaceShinyMaskTextureSpec();

void R_DivVerts(de::Vector3f *dst, de::Vector3f const *src,
de::WorldEdge const &leftEdge, de::WorldEdge const &rightEdge);
WorldEdge const &leftEdge, WorldEdge const &rightEdge);

void R_DivTexCoords(de::Vector2f *dst, de::Vector2f const *src,
de::WorldEdge const &leftEdge, de::WorldEdge const &rightEdge);
WorldEdge const &leftEdge, WorldEdge const &rightEdge);

void R_DivVertColors(de::Vector4f *dst, de::Vector4f const *src,
de::WorldEdge const &leftEdge, de::WorldEdge const &rightEdge);
WorldEdge const &leftEdge, WorldEdge const &rightEdge);

#endif // CLIENT_RENDER_MAIN_H
38 changes: 10 additions & 28 deletions doomsday/apps/client/include/render/trianglestripbuilder.h
Expand Up @@ -25,8 +25,6 @@
#include <de/libcore.h>
#include <de/Vector>

namespace de {

/**
* Abstract interface for a component that can be interpreted as an "edge"
* geometry.
Expand Down Expand Up @@ -58,10 +56,6 @@ class IEdge
virtual IEvent const &last() const = 0;
};

} // namespace de

namespace de {

/**
* @ingroup render
*/
Expand All @@ -78,7 +72,7 @@ class AbstractEdge : public IEdge
public:
virtual ~Event() {}

virtual Vector3d origin() const = 0;
virtual de::Vector3d origin() const = 0;
};

public:
Expand All @@ -88,15 +82,11 @@ class AbstractEdge : public IEdge

virtual Event const &last() const = 0;

virtual Vector2f materialOrigin() const { return Vector2f(); }
virtual de::Vector2f materialOrigin() const { return de::Vector2f(); }

virtual Vector3f normal() const { return Vector3f(); }
virtual de::Vector3f normal() const { return de::Vector3f(); }
};

} // namespace de

namespace de {

/**
* @ingroup world
*/
Expand All @@ -107,22 +97,20 @@ class WorldEdge : public AbstractEdge
{
public:
virtual ~Event() {}

virtual Vector3d origin() const = 0;

virtual de::Vector3d origin() const = 0;
inline double z() const { return origin().z; }
};

public:
WorldEdge(Vector2d origin_) : AbstractEdge(), _origin(origin_)
WorldEdge(de::Vector2d origin_) : AbstractEdge(), _origin(origin_)
{}

virtual ~WorldEdge() {}

/**
* Returns the X|Y origin of the edge in the map coordinate space.
*/
Vector2d const &origin() const { return _origin; }
de::Vector2d const &origin() const { return _origin; }

virtual Event const &first() const = 0;

Expand All @@ -137,15 +125,11 @@ class WorldEdge : public AbstractEdge
virtual EventIndex lastDivision() const { return InvalidIndex; }

private:
Vector2d _origin;
de::Vector2d _origin;
};

} // namespace de

namespace de {

typedef QVarLengthArray<Vector3f, 24> PositionBuffer;
typedef QVarLengthArray<Vector2f, 24> TexCoordBuffer;
typedef QVarLengthArray<de::Vector3f, 24> PositionBuffer;
typedef QVarLengthArray<de::Vector2f, 24> TexCoordBuffer;

/**
* Abstract triangle strip geometry builder.
Expand Down Expand Up @@ -187,7 +171,7 @@ class TriangleStripBuilder
* by minimizing dynamic memory allocations. If the estimate is off the only
* side effect is reduced performance.
*/
void begin(ClockDirection direction, int reserveElements = 0);
void begin(de::ClockDirection direction, int reserveElements = 0);

/**
* Submit an edge geometry to extend the current triangle strip geometry.
Expand Down Expand Up @@ -232,6 +216,4 @@ class TriangleStripBuilder
DENG2_PRIVATE(d)
};

} // namespace de

#endif // DENG_RENDER_TRIANGLE_STRIP_BUILDER
46 changes: 25 additions & 21 deletions doomsday/apps/client/include/render/walledge.h
Expand Up @@ -20,7 +20,8 @@
#ifndef RENDER_WALLEDGE
#define RENDER_WALLEDGE

#include <QList>
#include <QVector>
#include <QQueue>

#include <de/Error>
#include <de/Vector>
Expand All @@ -36,9 +37,7 @@ class Surface;
/// Maximum number of intercepts in a WallEdge.
#define WALLEDGE_MAX_INTERCEPTS 64

namespace de {

class HEdge;
namespace de { class HEdge; }

/**
* Helper/utility class intended to simplify the process of generating sections of wall
Expand All @@ -55,41 +54,43 @@ class WallEdge : public WorldEdge
/// Invalid range geometry was found during prepare() @ingroup errors
DENG2_ERROR(InvalidError);

class Event : public WorldEdge::Event, public IHPlane::IIntercept
class Event : public WorldEdge::Event, public de::IHPlane::IIntercept
{
public:
Event(WallEdge &owner, ddouble distance = 0);
Event();
Event(WallEdge &owner, de::ddouble distance = 0);

Event &operator = (Event const &other);
bool operator < (Event const &other) const;

ddouble distance() const;

Vector3d origin() const;
de::ddouble distance() const;
de::Vector3d origin() const;

private:
DENG2_PRIVATE(d)
WallEdge *_owner;
};

typedef QList<Event *> Events;
typedef QVector<Event> Events;

public:
/**
* @param spec Geometry specification for the wall section. A copy is made.
*
* @param hedge Assumed to have a mapped LineSideSegment with sections.
*/
WallEdge(WallSpec const &spec, HEdge &hedge, dint edge);
WallEdge(WallSpec const &spec, de::HEdge &hedge, int edge);

virtual ~WallEdge();

inline Event const &operator [] (EventIndex index) const {
return at(index);
}

Vector3d const &pOrigin() const;
Vector3d const &pDirection() const;
de::Vector3d const &pOrigin() const;
de::Vector3d const &pDirection() const;

Vector2f materialOrigin() const;
de::Vector2f materialOrigin() const;

Vector3f normal() const;
de::Vector3f normal() const;

WallSpec const &spec() const;

Expand All @@ -110,7 +111,7 @@ class WallEdge : public WorldEdge
/// Implement IEdge.
Event const &last() const;

dint divisionCount() const;
int divisionCount() const;

EventIndex firstDivision() const;

Expand All @@ -124,9 +125,12 @@ class WallEdge : public WorldEdge
Event const &at(EventIndex index) const;

private:
DENG2_PRIVATE(d)
};
struct Impl;
Impl *d;

} // namespace de
static QQueue<WallEdge::Impl *> recycledImpls;
static Impl *getRecycledImpl();
static void recycleImpl(Impl *d);
};

#endif // RENDER_WALLEDGE
6 changes: 1 addition & 5 deletions doomsday/apps/client/include/render/wallspec.h
Expand Up @@ -24,8 +24,6 @@

#include "Line"

namespace de {

/**
* Wall geometry specification. The members are public for convenient access.
*/
Expand Down Expand Up @@ -81,7 +79,7 @@ class WallSpec
/**
* Construct a default wall geometry specification for the specifed @a section.
*/
WallSpec(int section, Flags flags = DefaultFlags) : flags(flags), section(section)
WallSpec(int section = 0, Flags flags = DefaultFlags) : flags(flags), section(section)
{}

/**
Expand All @@ -94,6 +92,4 @@ class WallSpec

Q_DECLARE_OPERATORS_FOR_FLAGS(WallSpec::Flags)

} // namespace de

#endif // DENG_RENDER_WALLSPEC
4 changes: 2 additions & 2 deletions doomsday/apps/client/include/world/sector.h
Expand Up @@ -190,7 +190,7 @@ class Sector : public world::MapElement

//- Subsectors --------------------------------------------------------------------------

typedef std::function<world::Subsector * (QList<world::ConvexSubspace *> const &)> SubsectorConstructor;
typedef std::function<world::Subsector * (QVector<world::ConvexSubspace *> const &)> SubsectorConstructor;

static void setSubsectorConstructor(SubsectorConstructor func);

Expand Down Expand Up @@ -236,7 +236,7 @@ class Sector : public world::MapElement
*
* @return The newly constructed Subsector (ownership retained); otherwise @c nullptr
*/
world::Subsector *addSubsector(QList<world::ConvexSubspace *> const &subspaces);
world::Subsector *addSubsector(QVector<world::ConvexSubspace *> const &subspaces);

//- Sides -------------------------------------------------------------------------------

Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/client/include/world/subsector.h
Expand Up @@ -55,7 +55,7 @@ class Subsector
*
* @param subspaces Set of subspaces comprising the resulting subsector.
*/
Subsector(QList<ConvexSubspace *> const &subspaces);
Subsector(QVector<ConvexSubspace *> const &subspaces);

virtual ~Subsector();

Expand Down Expand Up @@ -165,7 +165,7 @@ class SubsectorCirculator
SubsectorCirculator(de::HEdge *hedge = nullptr)
: _hedge(hedge)
, _current(hedge)
, _subsec(hedge? getSubsector(*hedge) : nullptr)
, _subsec(hedge? hedge->subsector() : nullptr)
{}

/**
Expand All @@ -176,7 +176,7 @@ class SubsectorCirculator
*/
static de::HEdge &findBackNeighbor(de::HEdge const &hedge, de::ClockDirection direction)
{
return getNeighbor(hedge, direction, getSubsector(hedge)).twin();
return getNeighbor(hedge, direction, hedge.subsector()).twin();
}

/**
Expand Down Expand Up @@ -220,7 +220,7 @@ class SubsectorCirculator
/// Makes the circulator operate on @a hedge.
SubsectorCirculator &operator = (de::HEdge &hedge) {
_hedge = _current = &hedge;
_subsec = getSubsector(hedge);
_subsec = hedge.subsector();
return *this;
}

Expand All @@ -239,7 +239,7 @@ class SubsectorCirculator
de::HEdge *operator -> () { return _current; }

private:
static Subsector *getSubsector(de::HEdge const &hedge);
//static Subsector *getSubsector(de::HEdge const &hedge);

static de::HEdge &getNeighbor(de::HEdge const &hedge, de::ClockDirection direction,
Subsector const *subsector = nullptr);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/client/clientsubsector.cpp
Expand Up @@ -1300,7 +1300,7 @@ DENG2_PIMPL(ClientSubsector)
}
};

ClientSubsector::ClientSubsector(QList<ConvexSubspace *> const &subspaces)
ClientSubsector::ClientSubsector(QVector<ConvexSubspace *> const &subspaces)
: Subsector(subspaces)
, d(new Impl(this))
{
Expand Down

0 comments on commit bc2b64b

Please sign in to comment.