Skip to content

Commit

Permalink
Map Renderer: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed May 2, 2013
1 parent 085b4a5 commit 59ae4be
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 36 deletions.
12 changes: 5 additions & 7 deletions doomsday/client/src/render/rend_dynlight.cpp
Expand Up @@ -104,17 +104,15 @@ static void drawDynlight(dynlight_t const &dyn, renderlightprojectionparams_t &p
{
SectionEdge const &leftEdge = *parm.wall.leftEdge;
SectionEdge const &rightEdge = *parm.wall.rightEdge;
int const leftInterceptCount = leftEdge.divisionCount();
int const rightInterceptCount = rightEdge.divisionCount();

RL_AddPolyWithCoords(PT_FAN, RPF_DEFAULT|RPF_LIGHT,
3 + rightInterceptCount,
rvertices + 3 + leftInterceptCount,
rcolors + 3 + leftInterceptCount,
rtexcoords + 3 + leftInterceptCount, 0);
3 + rightEdge.divisionCount(),
rvertices + 3 + leftEdge.divisionCount(),
rcolors + 3 + leftEdge.divisionCount(),
rtexcoords + 3 + leftEdge.divisionCount(), 0);

RL_AddPolyWithCoords(PT_FAN, RPF_DEFAULT|RPF_LIGHT,
3 + leftInterceptCount,
3 + leftEdge.divisionCount(),
rvertices, rcolors, rtexcoords, 0);
}
else
Expand Down
14 changes: 6 additions & 8 deletions doomsday/client/src/render/rend_fakeradio.cpp
Expand Up @@ -983,13 +983,11 @@ static void drawWallSectionShadow(rvertex_t const *origVertices,
DENG_ASSERT(origVertices);
SectionEdge const &leftEdge = *parms.leftEdge;
SectionEdge const &rightEdge = *parms.rightEdge;
int const leftInterceptCount = leftEdge.divisionCount();
int const rightInterceptCount = rightEdge.divisionCount();
bool const mustSubdivide = (leftEdge.divisionCount() || rightEdge.divisionCount());

uint realNumVertices = 4;
if(mustSubdivide)
realNumVertices = 3 + leftInterceptCount + 3 + rightInterceptCount;
realNumVertices = 3 + leftEdge.divisionCount() + 3 + rightEdge.divisionCount();
else
realNumVertices = 4;

Expand Down Expand Up @@ -1047,13 +1045,13 @@ static void drawWallSectionShadow(rvertex_t const *origVertices,
R_DivVertColors(rcolors, origColors, leftEdge, rightEdge, bL, tL, bR, tR);

RL_AddPolyWithCoords(PT_FAN, RPF_DEFAULT|RPF_SHADOW,
3 + rightInterceptCount,
rvertices + 3 + leftInterceptCount,
rcolors + 3 + leftInterceptCount,
rtexcoords + 3 + leftInterceptCount,
3 + rightEdge.divisionCount(),
rvertices + 3 + leftEdge.divisionCount(),
rcolors + 3 + leftEdge.divisionCount(),
rtexcoords + 3 + leftEdge.divisionCount(),
0);
RL_AddPolyWithCoords(PT_FAN, RPF_DEFAULT|RPF_SHADOW,
3 + leftInterceptCount,
3 + leftEdge.divisionCount(),
rvertices, rcolors, rtexcoords, 0);

R_FreeRendVertices(rvertices);
Expand Down
26 changes: 12 additions & 14 deletions doomsday/client/src/render/rend_main.cpp
Expand Up @@ -1084,8 +1084,6 @@ static bool renderWorldPoly(rvertex_t *rvertices, uint numVertices,
{
SectionEdge const &leftEdge = *p.wall.leftEdge;
SectionEdge const &rightEdge = *p.wall.rightEdge;
int const leftInterceptCount = leftEdge.divisionCount();
int const rightInterceptCount = rightEdge.divisionCount();

/*
* Need to swap indices around into fans set the position
Expand Down Expand Up @@ -1153,18 +1151,18 @@ static bool renderWorldPoly(rvertex_t *rvertices, uint numVertices,
}

RL_AddPolyWithCoordsModulationReflection(PT_FAN, p.flags | (hasDynlights? RPF_HAS_DYNLIGHTS : 0),
3 + rightInterceptCount,
rvertices + 3 + leftInterceptCount,
rcolors? rcolors + 3 + leftInterceptCount : 0,
primaryCoords + 3 + leftInterceptCount,
interCoords? interCoords + 3 + leftInterceptCount : 0,
modTex, &modColor, modCoords? modCoords + 3 + leftInterceptCount : 0,
shinyColors + 3 + leftInterceptCount,
shinyTexCoords? shinyTexCoords + 3 + leftInterceptCount : 0,
shinyMaskRTU? primaryCoords + 3 + leftInterceptCount : 0);
3 + rightEdge.divisionCount(),
rvertices + 3 + leftEdge.divisionCount(),
rcolors? rcolors + 3 + leftEdge.divisionCount() : 0,
primaryCoords + 3 + leftEdge.divisionCount(),
interCoords? interCoords + 3 + leftEdge.divisionCount() : 0,
modTex, &modColor, modCoords? modCoords + 3 + leftEdge.divisionCount() : 0,
shinyColors + 3 + leftEdge.divisionCount(),
shinyTexCoords? shinyTexCoords + 3 + leftEdge.divisionCount() : 0,
shinyMaskRTU? primaryCoords + 3 + leftEdge.divisionCount() : 0);

RL_AddPolyWithCoordsModulationReflection(PT_FAN, p.flags | (hasDynlights? RPF_HAS_DYNLIGHTS : 0),
3 + leftInterceptCount,
3 + leftEdge.divisionCount(),
rvertices, rcolors, primaryCoords, interCoords,
modTex, &modColor, modCoords,
shinyColors, shinyTexCoords,
Expand Down Expand Up @@ -1945,8 +1943,8 @@ static void wallSectionSectors(HEdge &hedge, Sector **frontSec, Sector **backSec
* Prepare wall section edge data for a map line segment.
*
* Return values:
* @param leftEdge Edge data the left of the wall section is written here.
* @param rightEdge Edge data the right of the wall section is written here.
* @param leftEdge Edge data for the left of the wall section is written here.
* @param rightEdge Edge data for the right of the wall section is written here.
* @param materialOrigin Material origin offset data is written here.
*
* @return @c true iff the resultant edges describe a polygon with a positive area.
Expand Down
12 changes: 5 additions & 7 deletions doomsday/client/src/render/rend_shadow.cpp
Expand Up @@ -276,17 +276,15 @@ static void drawShadow(shadowprojection_t const &sp, rendershadowprojectionparam
{
SectionEdge const &leftEdge = *parm.wall.leftEdge;
SectionEdge const &rightEdge = *parm.wall.rightEdge;
int const leftInterceptCount = leftEdge.divisionCount();
int const rightInterceptCount = rightEdge.divisionCount();

RL_AddPolyWithCoords(PT_FAN, RPF_DEFAULT|RPF_SHADOW,
3 + rightInterceptCount,
rvertices + 3 + leftInterceptCount,
rcolors + 3 + leftInterceptCount,
rtexcoords + 3 + leftInterceptCount,
3 + rightEdge.divisionCount(),
rvertices + 3 + leftEdge.divisionCount(),
rcolors + 3 + leftEdge.divisionCount(),
rtexcoords + 3 + leftEdge.divisionCount(),
0);
RL_AddPolyWithCoords(PT_FAN, RPF_DEFAULT|RPF_SHADOW,
3 + leftInterceptCount,
3 + leftEdge.divisionCount(),
rvertices, rcolors, rtexcoords, 0);
}
else
Expand Down

0 comments on commit 59ae4be

Please sign in to comment.