Skip to content

Commit

Permalink
Fixed|Map Renderer: Glow strength factor "rend-glow" not applied cons…
Browse files Browse the repository at this point in the history
…istently

The global strength factor "rend_glow" was applied incorrectly,
preventing glowing materials from being disabled completely.
  • Loading branch information
danij-deng committed Mar 19, 2013
1 parent a98e068 commit 60f40ac
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
18 changes: 9 additions & 9 deletions doomsday/client/src/map/r_world.cpp
Expand Up @@ -1234,17 +1234,17 @@ boolean R_IsGlowingPlane(Plane const *pln)
float R_GlowStrength(Plane const *pln)
{
#ifdef __CLIENT__
Material *material = pln->surface.material;
if(material)
if(glowFactor > .0001f)
{
if(material->isDrawable() && !pln->surface.isSkyMasked())
Material *material = pln->surface.material;
if(material)
{
MaterialSnapshot const &ms = material->prepare(Rend_MapSurfaceMaterialSpec());

float glowStrength = ms.glowStrength();
if(glowFactor > .0001f)
glowStrength *= glowFactor; // Global scale factor.
return glowStrength;
if(material->isDrawable() && !pln->surface.isSkyMasked())
{
MaterialSnapshot const &ms = material->prepare(Rend_MapSurfaceMaterialSpec());
float glowStrength = ms.glowStrength() * glowFactor; // Global scale factor.
return glowStrength;
}
}
}
#else
Expand Down
13 changes: 8 additions & 5 deletions doomsday/client/src/render/lumobj.cpp
Expand Up @@ -984,9 +984,15 @@ static void createGlowLightForSurface(Surface &suf)
if(!sec->bspLeafCount || sec->SP_floorvisheight >= sec->SP_ceilvisheight)
break;

// Are we glowing at this moment in time?
MaterialSnapshot const &ms = suf.material->prepare(Rend_MapSurfaceMaterialSpec());
if(!(ms.glowStrength() > .001f)) break;

// Are we glowing at this moment in time?
float glowStrength = 0;
if(glowFactor > .0001f)
{
glowStrength = ms.glowStrength() * glowFactor; // Global scale factor.
}
if(!(glowStrength > .0001f)) break;

averagecolor_analysis_t const *avgColorAmplified = reinterpret_cast<averagecolor_analysis_t const *>(ms.texture(MTU_PRIMARY).generalCase().analysisDataPointer(Texture::AverageColorAmplifiedAnalysis));
if(!avgColorAmplified) throw Error("createGlowLightForSurface", QString("Texture \"%1\" has no AverageColorAmplifiedAnalysis").arg(ms.texture(MTU_PRIMARY).generalCase().manifest().composeUri()));
Expand All @@ -999,9 +1005,6 @@ static void createGlowLightForSurface(Surface &suf)
V3f_Copy(LUM_PLANE(lum)->normal, pln->PS_normal);
V3f_Copy(LUM_PLANE(lum)->color, avgColorAmplified->color.rgb);

float glowStrength = ms.glowStrength();
if(glowFactor > .0001f)
glowStrength *= glowFactor; // Global scale factor.
LUM_PLANE(lum)->intensity = glowStrength;
lum->maxDistance = 0;
lum->decorSource = 0;
Expand Down
31 changes: 16 additions & 15 deletions doomsday/client/src/render/rend_main.cpp
Expand Up @@ -1239,9 +1239,8 @@ static boolean doRenderHEdge(HEdge* hedge, const pvec3f_t normal,
params.sectorLightColor = lightColor;
params.surfaceColor = color;
params.wall.surfaceColor2 = color2;
params.glowing = ms.glowStrength();
if(glowFactor > .0001f)
params.glowing *= glowFactor; // Global scale factor.
params.glowing = ms.glowStrength() * glowFactor; // Global scale factor.
params.blendMode = blendMode;
params.texOffset = texOffset;
params.texScale = texScale;
Expand Down Expand Up @@ -1436,21 +1435,23 @@ static void renderPlane(BspLeaf* bspLeaf, planetype_t type, coord_t height,

if(!(params.flags & RPF_SKYMASK))
{
if(texMode != 2)
{
params.glowing = ms.glowStrength();
}
else
if(glowFactor > .0001f)
{
Surface *suf = &bspLeaf->sector->planes[elmIdx]->surface;
Material *mat = suf->material? suf->material : &App_Materials().find(de::Uri("System", Path("missing"))).material();
if(texMode != 2)
{
params.glowing = ms.glowStrength();
}
else
{
Surface *suf = &bspLeaf->sector->planes[elmIdx]->surface;
Material *mat = suf->material? suf->material : &App_Materials().find(de::Uri("System", Path("missing"))).material();

MaterialSnapshot const &ms = mat->prepare(Rend_MapSurfaceMaterialSpec());
params.glowing = ms.glowStrength();
}
MaterialSnapshot const &ms = mat->prepare(Rend_MapSurfaceMaterialSpec());
params.glowing = ms.glowStrength();
}

if(glowFactor > .0001f)
params.glowing *= glowFactor; // Global scale factor.
}

// Dynamic lights?
if(addDLights && params.glowing < 1 && !(!useDynLights && !useWallGlow))
Expand Down Expand Up @@ -1671,9 +1672,9 @@ static boolean rendHEdgeSection(HEdge* hedge, SideDefSection section,
if(surface->inFlags & SUIF_NO_RADIO)
flags &= ~RHF_ADD_RADIO;

float glowStrength = ms.glowStrength();
float glowStrength = 0;
if(glowFactor > .0001f)
glowStrength *= glowFactor; // Global scale factor.
glowStrength = ms.glowStrength() * glowFactor; // Global scale factor.

// Dynamic Lights?
if((flags & RHF_ADD_DYNLIGHTS) &&
Expand Down

0 comments on commit 60f40ac

Please sign in to comment.