Skip to content

Commit

Permalink
Refactor: Renamed BiasSurface as BiasTracker
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Aug 2, 2013
1 parent fea7f99 commit b924a9b
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 82 deletions.
6 changes: 3 additions & 3 deletions doomsday/client/client.pro
Expand Up @@ -112,7 +112,7 @@ DENG_HEADERS += \
include/BiasDigest \
include/BiasIllum \
include/BiasSource \
include/BiasSurface \
include/BiasTracker \
include/BspLeaf \
include/BspNode \
include/EntityDatabase \
Expand Down Expand Up @@ -254,7 +254,7 @@ DENG_HEADERS += \
include/render/biasdigest.h \
include/render/biasillum.h \
include/render/biassource.h \
include/render/biassurface.h \
include/render/biastracker.h \
include/render/blockmapvisual.h \
include/render/huecirclevisual.h \
include/render/lightgrid.h \
Expand Down Expand Up @@ -557,7 +557,7 @@ SOURCES += \
src/render/biasdigest.cpp \
src/render/biasillum.cpp \
src/render/biassource.cpp \
src/render/biassurface.cpp \
src/render/biastracker.cpp \
src/render/blockmapvisual.cpp \
src/render/huecirclevisual.cpp \
src/render/lightgrid.cpp \
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/include/BiasSurface

This file was deleted.

1 change: 1 addition & 0 deletions doomsday/client/include/BiasTracker
@@ -0,0 +1 @@
#include "render/biastracker.h"
6 changes: 3 additions & 3 deletions doomsday/client/include/render/biasillum.h
Expand Up @@ -24,11 +24,11 @@

#include "render/rendpoly.h" /// @todo remove me

class BiasSurface;
class BiasTracker;

/**
* Stores map point lighting information for the Shadow Bias lighting model.
* Used in conjunction with a BiasSurface (for routing change notifications).
* Used in conjunction with a BiasTracker (for routing change notifications).
*
* @ingroup render
*/
Expand All @@ -42,7 +42,7 @@ class BiasIllum
static float const MIN_INTENSITY; // .005f

public:
BiasIllum(BiasSurface *surface);
BiasIllum(BiasTracker *surface);

/**
* To be called to register the commands and variables of this module.
Expand Down
@@ -1,4 +1,4 @@
/** @file biassurface.h Shadow Bias surface.
/** @file biastracker.h Shadow Bias illumination change tracker.
*
* @authors Copyright © 2005-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
Expand All @@ -17,8 +17,8 @@
* http://www.gnu.org/licenses</small>
*/

#ifndef DENG_RENDER_SHADOWBIAS_SURFACE_H
#define DENG_RENDER_SHADOWBIAS_SURFACE_H
#ifndef DENG_RENDER_SHADOWBIAS_TRACKER_H
#define DENG_RENDER_SHADOWBIAS_TRACKER_H

#include <de/Error>
#include <de/Vector>
Expand All @@ -29,21 +29,23 @@ class BiasSource;
class BiasDigest;

/**
* Map point illumination tracker for the Shadow Bias lighting model.
*
* @ingroup render
*/
class BiasSurface
class BiasTracker
{
public:
/// An unknown light contributor was referenced @ingroup errors
DENG2_ERROR(UnknownContributorError);

public:
/**
* Construct a new surface.
* Construct a new bias illumination tracker.
*
* @param size Number of vertices.
* @param size Number of illumination points to track for.
*/
BiasSurface(int size);
BiasTracker(int size);

/**
* To be called to register the commands and variables of this module.
Expand Down Expand Up @@ -98,13 +100,19 @@ class BiasSurface
*/
uint timeOfLatestContributorUpdate() const;

void updateAffection(BiasDigest &changes);
/**
* Interpret the bias change digest and schedule illumination updates as
* necessary (deferred until necessary, does not block).
*
* @param changes Digest of all changes to apply in the tracker.
*/
void applyChanges(BiasDigest &changes);

void updateAfterMove();
void updateAfterGeometryMove();

/**
* Perform lighting for the supplied geometry. It is assumed that this
* geometry has the @em same number of vertices as the bias surface.
* geometry has the @em same number of vertices as illumination points.
*
* @param surfaceNormal Normal of the surface being lit.
* @param biasTime Current time in milliseconds for bias.
Expand All @@ -120,4 +128,4 @@ class BiasSurface
DENG2_PRIVATE(d)
};

#endif // DENG_RENDER_SHADOWBIAS_SURFACE_H
#endif // DENG_RENDER_SHADOWBIAS_TRACKER_H
10 changes: 5 additions & 5 deletions doomsday/client/include/world/bspleaf.h
Expand Up @@ -32,7 +32,7 @@
#include "Mesh"

#ifdef __CLIENT__
# include "BiasSurface"
# include "BiasTracker"
#endif

class Sector;
Expand Down Expand Up @@ -273,12 +273,12 @@ class BspLeaf : public de::MapElement
int numFanVertices() const;

/**
* Retrieve the bias surface for specified geometry @a group. If no bias
* surface has yet been initialized for the group it will be at this time.
* Retrieve the bias tracker for the specified geometry @a group. If no
* tracker has yet been initialized for the group it will be at this time.
*
* @param group Geometry group identifier for the bias surface.
* @param group Geometry group identifier for the bias tracker.
*/
BiasSurface &biasSurface(int group);
BiasTracker &biasTracker(int group);

/**
* @param changes
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/world/map.h
Expand Up @@ -45,7 +45,7 @@ class Segment;
class Vertex;

#ifdef __CLIENT__
class BiasSurface;
class BiasTracker;

struct clmoinfo_s;

Expand Down
10 changes: 5 additions & 5 deletions doomsday/client/include/world/segment.h
Expand Up @@ -31,7 +31,7 @@
#include "Vertex"

#ifdef __CLIENT__
# include "BiasSurface"
# include "BiasTracker"
#endif

class Sector;
Expand Down Expand Up @@ -237,12 +237,12 @@ class Segment : public de::MapElement
#ifdef __CLIENT__

/**
* Retrieve the bias surface for specified geometry @a group. If no bias
* surface has yet been initialized for the group it will be at this time.
* Retrieve the bias tracker for the specified geometry @a group. If no
* tracker has yet been initialized for the group it will be at this time.
*
* @param group Geometry group identifier for the bias surface.
* @param group Geometry group identifier for the bias tracker.
*/
BiasSurface &biasSurface(int group);
BiasTracker &biasTracker(int group);

/**
* @param allChanges
Expand Down
8 changes: 4 additions & 4 deletions doomsday/client/src/render/biasillum.cpp
Expand Up @@ -24,7 +24,7 @@
#include "world/linesighttest.h"
#include "BspLeaf"

#include "BiasSurface"
#include "BiasTracker"

#include "render/biasillum.h"

Expand All @@ -35,7 +35,7 @@ static int devUseSightCheck = true; //cvar

DENG2_PIMPL_NOREF(BiasIllum)
{
BiasSurface *surface; ///< The "control" surface.
BiasTracker *surface; ///< The "control" surface.
Vector3f color; ///< Current light color.
Vector3f dest; ///< Destination light color (interpolated to).
uint updateTime; ///< When the value was calculated.
Expand All @@ -47,7 +47,7 @@ DENG2_PIMPL_NOREF(BiasIllum)
*/
Vector3f casted[MAX_CONTRIBUTORS];

Instance(BiasSurface *surface)
Instance(BiasTracker *surface)
: surface(surface),
updateTime(0),
interpolating(false)
Expand Down Expand Up @@ -208,7 +208,7 @@ DENG2_PIMPL_NOREF(BiasIllum)

float const BiasIllum::MIN_INTENSITY = .005f;

BiasIllum::BiasIllum(BiasSurface *surface) : d(new Instance(surface))
BiasIllum::BiasIllum(BiasTracker *surface) : d(new Instance(surface))
{}

void BiasIllum::evaluate(Vector3f &color, Vector3d const &point,
Expand Down
@@ -1,4 +1,4 @@
/** @file biassurface.cpp Shadow Bias surface.
/** @file biastracker.cpp Shadow Bias illumination tracker.
*
* @authors Copyright © 2005-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
Expand Down Expand Up @@ -31,7 +31,7 @@
#include "BiasSource"
#include "BiasDigest"

#include "render/biassurface.h"
#include "render/biastracker.h"

using namespace de;

Expand All @@ -51,7 +51,7 @@ struct Contributor
* @todo Do not observe source deletion. A better solution would represent any
* source deletions within the change tracker.
*/
DENG2_PIMPL_NOREF(BiasSurface),
DENG2_PIMPL_NOREF(BiasTracker),
DENG2_OBSERVES(BiasSource, Deletion)
{
QVector<BiasIllum *> illums; /// @todo use an external allocator.
Expand Down Expand Up @@ -99,31 +99,31 @@ DENG2_OBSERVES(BiasSource, Deletion)
}
};

BiasSurface::BiasSurface(int size) : d(new Instance(size))
BiasTracker::BiasTracker(int size) : d(new Instance(size))
{}

void BiasSurface::consoleRegister() // static
void BiasTracker::consoleRegister() // static
{
// Development variables.
C_VAR_INT("rend-dev-bias-affected", &devUpdateAffected, CVF_NO_ARCHIVE, 0, 1);
}

uint BiasSurface::lastUpdateOnFrame() const
uint BiasTracker::lastUpdateOnFrame() const
{
return d->lastUpdateOnFrame;
}

void BiasSurface::setLastUpdateOnFrame(uint newLastUpdateFrameNumber)
void BiasTracker::setLastUpdateOnFrame(uint newLastUpdateFrameNumber)
{
d->lastUpdateOnFrame = newLastUpdateFrameNumber;
}

void BiasSurface::clearContributors()
void BiasTracker::clearContributors()
{
d->activeContributors = 0;
}

void BiasSurface::addContributor(BiasSource *source, float intensity)
void BiasTracker::addContributor(BiasSource *source, float intensity)
{
if(!source) return;

Expand Down Expand Up @@ -199,7 +199,7 @@ void BiasSurface::addContributor(BiasSource *source, float intensity)
d->activeContributors |= 1 << slot;
}

BiasSource &BiasSurface::contributor(int index) const
BiasSource &BiasTracker::contributor(int index) const
{
if(index >= 0 && index < MAX_CONTRIBUTORS &&
(d->activeContributors & (1 << index)))
Expand All @@ -208,10 +208,10 @@ BiasSource &BiasSurface::contributor(int index) const
return *d->contributors[index].source;
}
/// @throw UnknownContributorError An invalid contributor index was specified.
throw UnknownContributorError("BiasSurface::lightContributor", QString("Index %1 invalid/out of range").arg(index));
throw UnknownContributorError("BiasTracker::lightContributor", QString("Index %1 invalid/out of range").arg(index));
}

uint BiasSurface::timeOfLatestContributorUpdate() const
uint BiasTracker::timeOfLatestContributorUpdate() const
{
uint latest = 0;

Expand Down Expand Up @@ -239,7 +239,7 @@ uint BiasSurface::timeOfLatestContributorUpdate() const
return latest;
}

void BiasSurface::updateAffection(BiasDigest &changes)
void BiasTracker::applyChanges(BiasDigest &changes)
{
// All contributions from changed sources will need to be updated.

Expand All @@ -261,7 +261,7 @@ void BiasSurface::updateAffection(BiasDigest &changes)
}
}

void BiasSurface::updateAfterMove()
void BiasTracker::updateAfterGeometryMove()
{
Contributor *ctbr = d->contributors;
for(int i = 0; i < MAX_CONTRIBUTORS; ++i, ctbr++)
Expand All @@ -273,7 +273,7 @@ void BiasSurface::updateAfterMove()
}
}

void BiasSurface::lightPoly(Vector3f const &surfaceNormal, uint biasTime,
void BiasTracker::lightPoly(Vector3f const &surfaceNormal, uint biasTime,
int vertCount, rvertex_t const *positions, ColorRawf *colors)
{
DENG_ASSERT(vertCount == d->illums.count()); // sanity check
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/src/render/rend_main.cpp
Expand Up @@ -50,7 +50,7 @@
#include "world/p_players.h"
#include "world/thinkers.h"

#include "BiasSurface"
#include "BiasTracker"
#include "BiasIllum"
#include "HueCircleVisual"
#include "SkyFixEdge"
Expand Down Expand Up @@ -245,7 +245,7 @@ void Rend_Register()
LO_Register();
Rend_DecorRegister();
BiasIllum::consoleRegister();
BiasSurface::consoleRegister();
BiasTracker::consoleRegister();
LightGrid::consoleRegister();
Sky_Register();
Rend_ModelRegister();
Expand Down

0 comments on commit b924a9b

Please sign in to comment.