Skip to content

Commit

Permalink
BiasSurface: Further revised the internal design of this component
Browse files Browse the repository at this point in the history
In this iteration vertex illumination is fully decoupled from the
"surface", whose main job now is tracking changes and routing through
update notifications from sources to vertexes.

The next step is separating the illumination form the surface so it
can again be managed with an external buffer (the difference being
that now these are thinking VertexIllum instances).
  • Loading branch information
danij-deng committed Aug 1, 2013
1 parent 3342336 commit 34c6c4c
Show file tree
Hide file tree
Showing 5 changed files with 321 additions and 228 deletions.
29 changes: 24 additions & 5 deletions doomsday/client/include/render/biassurface.h
Expand Up @@ -20,6 +20,7 @@
#ifndef DENG_RENDER_SHADOWBIAS_SURFACE_H
#define DENG_RENDER_SHADOWBIAS_SURFACE_H

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

#include "MapElement"
Expand All @@ -33,6 +34,10 @@ class BiasTracker;
*/
class BiasSurface
{
public:
/// An unknown light contributor was referenced @ingroup errors
DENG2_ERROR(UnknownContributorError);

public:
/**
* Construct a new surface.
Expand All @@ -58,16 +63,30 @@ class BiasSurface

void updateAfterMove();

/**
* Returns a light source contributor by @a index.
*/
BiasSource &contributor(int index) const;

/**
* Determine the earliest time in milliseconds that an affecting source
* was changed/deleted.
*/
uint timeOfLatestContributorUpdate() const;

/**
* Perform lighting for the supplied geometry. It is assumed that this
* geometry has the @em same number of vertices as the bias surface.
*
* @param vertCount Number of vertices to be lit.
* @param positions World coordinates for each vertex.
* @param colors Final lighting values will be written here.
* @param surfaceNormal Normal of the surface being lit.
* @param biasTime Current time in milliseconds for bias.
* @param vertCount Number of vertices to be lit.
* @param positions World coordinates for each vertex.
* @param colors Final lighting values will be written here.
*/
void lightPoly(de::Vector3f const &surfaceNormal, int vertCount,
struct rvertex_s const *positions, struct ColorRawf_s *colors);
void lightPoly(de::Vector3f const &surfaceNormal, uint biasTime,
int vertCount, struct rvertex_s const *positions,
struct ColorRawf_s *colors);

private:
DENG2_PRIVATE(d)
Expand Down

0 comments on commit 34c6c4c

Please sign in to comment.