Skip to content

Commit

Permalink
Renderer|BspLeaf|Line|SectorCluster: SectorCluster is responsible for…
Browse files Browse the repository at this point in the history
… BiasIllum management

SectorCluster is now responsible for the generation of map geometry
"Shards" within the cluster and allocates bias illumination points as
needed when first drawn. "Splitting a Cluster into Shards" has quite
a nice ring to it :)

The now redundant BiasSurface was removed.

At present a Shard consists of the Bias lighting data only. No vertex
geometry is yet stored here.

Todo: The Shard struct should now begin to evolved towards the 2.0
map renderer design for this component. Presently its internal to
SectorCluster as nobody else needs access to it.
  • Loading branch information
danij-deng committed Apr 29, 2014
1 parent 0105827 commit ddde675
Show file tree
Hide file tree
Showing 13 changed files with 387 additions and 537 deletions.
3 changes: 0 additions & 3 deletions doomsday/client/client.pro
Expand Up @@ -116,7 +116,6 @@ DENG_CONVENIENCE_HEADERS += \
include/BiasDigest \
include/BiasIllum \
include/BiasSource \
include/BiasSurface \
include/BiasTracker \
include/BitmapFont \
include/BspLeaf \
Expand Down Expand Up @@ -281,7 +280,6 @@ DENG_HEADERS += \
include/render/biasdigest.h \
include/render/biasillum.h \
include/render/biassource.h \
include/render/biassurface.h \
include/render/biastracker.h \
include/render/billboard.h \
include/render/blockmapvisual.h \
Expand Down Expand Up @@ -617,7 +615,6 @@ SOURCES += \
src/render/biasdigest.cpp \
src/render/biasillum.cpp \
src/render/biassource.cpp \
src/render/biassurface.cpp \
src/render/biastracker.cpp \
src/render/billboard.cpp \
src/render/blockmapvisual.cpp \
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/include/BiasSurface

This file was deleted.

62 changes: 0 additions & 62 deletions doomsday/client/include/render/biassurface.h

This file was deleted.

30 changes: 0 additions & 30 deletions doomsday/client/include/world/bspleaf.h
Expand Up @@ -27,18 +27,13 @@

#include "Mesh"

#ifdef __CLIENT__
# include "BiasSurface"
#endif

#include <de/Error>
#include <de/Vector>
#include <QSet>

class SectorCluster;
struct polyobj_s;
#ifdef __CLIENT__
class BiasDigest;
class Lumobj;
#endif

Expand All @@ -60,9 +55,6 @@ class Lumobj;
* @ingroup world
*/
class BspLeaf : public de::MapElement
#ifdef __CLIENT__
, public BiasSurface
#endif
{
DENG2_NO_COPY (BspLeaf)
DENG2_NO_ASSIGN(BspLeaf)
Expand Down Expand Up @@ -273,28 +265,6 @@ class BspLeaf : public de::MapElement
*/
int numFanVertices() const;

/**
* Perform bias lighting for the supplied geometry.
*
* @important It is assumed there are least @ref numFanVertices() elements!
*
* @param group Geometry group identifier.
* @param posCoords World coordinates for each vertex.
* @param colorCoords Final lighting values will be written here.
*/
void lightBiasPoly(int group, de::Vector3f const *posCoords,
de::Vector4f *colorCoords);

void updateBiasAfterGeometryMove(int group);

/**
* Apply bias lighting changes to @em all map element geometries at this
* leaf of the BSP.
*
* @param changes Digest of lighting changes to be applied.
*/
void applyBiasDigest(BiasDigest &changes);

/**
* Recalculate the environmental audio characteristics (reverb) of the BSP leaf.
*/
Expand Down
29 changes: 0 additions & 29 deletions doomsday/client/include/world/line.h
Expand Up @@ -27,10 +27,6 @@
#include "Polyobj"
#include "Vertex"

#ifdef __CLIENT__
# include "BiasSurface"
#endif

#include <de/Error>
#include <de/Observers>
#include <de/Vector>
Expand Down Expand Up @@ -121,9 +117,6 @@ class Line : public de::MapElement
* Side geometry segment on the XY plane.
*/
class Segment : public de::MapElement
#ifdef __CLIENT__
, public BiasSurface
#endif
{
DENG2_NO_COPY (Segment)
DENG2_NO_ASSIGN(Segment)
Expand Down Expand Up @@ -194,28 +187,6 @@ class Line : public de::MapElement
*/
void setFrontFacing(bool yes = true);

/**
* Perform bias lighting for the supplied geometry.
*
* @important It is assumed there are least @em four elements!
*
* @param group Geometry group identifier.
* @param posCoords World coordinates for each vertex.
* @param colorCoords Final lighting values will be written here.
*/
void lightBiasPoly(int group, de::Vector3f const *posCoords,
de::Vector4f *colorCoords);

void updateBiasAfterGeometryMove(int group);

/**
* Apply bias lighting changes to @em all map element geometries
* for the segment.
*
* @param changes Digest of lighting changes to be applied.
*/
void applyBiasDigest(BiasDigest &changes);

#endif // __CLIENT__

private:
Expand Down
39 changes: 32 additions & 7 deletions doomsday/client/include/world/sectorcluster.h
Expand Up @@ -233,13 +233,6 @@ class SectorCluster
*/
AudioEnvironmentFactors const &reverb() const;

/**
* Apply bias lighting changes to @em all surfaces within the cluster.
*
* @param changes Digest of lighting changes to be applied.
*/
void applyBiasDigest(BiasDigest &changes);

/**
* Returns the unique identifier of the light source.
*/
Expand Down Expand Up @@ -271,8 +264,40 @@ class SectorCluster
*/
int blockLightSourceZBias();

/**
* Apply bias lighting changes to @em all geometry Shards within the cluster.
*
* @param changes Digest of lighting changes to be applied.
*/
void applyBiasDigest(BiasDigest &changes);

/**
* Perform bias lighting for the supplied Shard geometry.
*
* @param mapElement MapElement for the geometry to be lit.
* @param geomId MapElement-unique geometry id.
* @param posCoords World coordinates for each vertex.
* @param colorCoords Final lighting values will be written here.
*/
void applyBiasLightSources(de::MapElement &mapElement, int geomId,
de::Vector3f const *posCoords, de::Vector4f *colorCoords);

/**
* Schedule a lighting update to a geometry Shard following a move of some
* other element of dependent geometry.
*
* @param mapElement MapElement for the geometry to be updated.
* @param geomId MapElement-unique geometry id.
*/
void updateBiasAfterGeometryMove(de::MapElement &mapElement, int geomId);

#endif // __CLIENT__

/**
* To be called to register the commands and variables of this module.
*/
static void consoleRegister();

private:
DENG2_PRIVATE(d)
};
Expand Down
29 changes: 0 additions & 29 deletions doomsday/client/src/render/biassurface.cpp

This file was deleted.

10 changes: 4 additions & 6 deletions doomsday/client/src/render/rend_main.cpp
Expand Up @@ -62,7 +62,6 @@
#include "Surface"

#include "BiasIllum"
#include "BiasSurface"
#include "HueCircleVisual"
#include "LightDecoration"
#include "Lumobj"
Expand Down Expand Up @@ -423,7 +422,6 @@ void Rend_Register()
C_CMD_FLAGS ("texreset", "s", TexReset, CMDF_NO_DEDICATED);

BiasIllum::consoleRegister();
BiasSurface::consoleRegister();
LightDecoration::consoleRegister();
LightGrid::consoleRegister();
Lumobj::consoleRegister();
Expand Down Expand Up @@ -1001,7 +999,7 @@ struct rendworldpoly_params_t
uint shadowListIdx; // List of shadows that affect this poly.
float glowing;
bool forceOpaque;
BiasSurface *bsuf;
MapElement *mapElement;
int geomGroup;

bool isWall;
Expand Down Expand Up @@ -1169,7 +1167,7 @@ static bool renderWorldPoly(Vector3f *posCoords, uint numVertices,
}

// Apply bias light source contributions.
p.bsuf->lightBiasPoly(p.geomGroup, posCoords, colorCoords);
leaf->cluster().applyBiasLightSources(*p.mapElement, p.geomGroup, posCoords, colorCoords);

// Apply surface glow.
if(p.glowing > 0)
Expand Down Expand Up @@ -1861,7 +1859,7 @@ static void writeWallSection(HEdge &hedge, int section,
Vector3d bottomRight = rightEdge.bottom().origin();

parm.skyMasked = skyMasked;
parm.bsuf = &segment;
parm.mapElement = &segment;
parm.geomGroup = wallSpec.section;
parm.topLeft = &topLeft;
parm.bottomRight = &bottomRight;
Expand Down Expand Up @@ -2088,7 +2086,7 @@ static void writeLeafPlane(Plane &plane)

rendworldpoly_params_t parm; zap(parm);

parm.bsuf = leaf;
parm.mapElement = leaf;
parm.geomGroup = plane.indexInSector();
parm.topLeft = &topLeft;
parm.bottomRight = &bottomRight;
Expand Down

0 comments on commit ddde675

Please sign in to comment.