Skip to content

Commit

Permalink
Fixed|Renderer: Torch light is broken
Browse files Browse the repository at this point in the history
Light contribution from torches was unclamped. Removed the unused
additive torch light option.

IssueID #2212
  • Loading branch information
skyjake committed Mar 14, 2017
1 parent e3907b6 commit d0377de
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/render/rend_main.h
Expand Up @@ -86,7 +86,7 @@ DENG_EXTERN_C int useMultiTexDetails;

DENG_EXTERN_C int dynlightBlend;

DENG_EXTERN_C int torchAdditive;
//DENG_EXTERN_C int torchAdditive;
DENG_EXTERN_C de::Vector3f torchColor;

DENG_EXTERN_C int rAmbient;
Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/client/src/dd_main.cpp
Expand Up @@ -1777,8 +1777,8 @@ void *DD_GetVariable(dint ddvalue)
case DD_TORCH_BLUE:
return &torchColor.z;

case DD_TORCH_ADDITIVE:
return &torchAdditive;
//case DD_TORCH_ADDITIVE:
// return &torchAdditive;

# ifdef WIN32
case DD_WINDOW_HANDLE:
Expand Down Expand Up @@ -1851,9 +1851,9 @@ void DD_SetVariable(dint ddvalue, void *parm)
torchColor.z = de::clamp(0.f, *((dfloat*) parm), 1.f);
return;

case DD_TORCH_ADDITIVE:
torchAdditive = (*(dint*) parm)? true : false;
break;
//case DD_TORCH_ADDITIVE:
// torchAdditive = (*(dint*) parm)? true : false;
// break;
#endif

default:
Expand Down
11 changes: 2 additions & 9 deletions doomsday/apps/client/src/render/rend_main.cpp
Expand Up @@ -175,7 +175,7 @@ dint useMultiTexDetails = true;
dint dynlightBlend;

Vector3f torchColor(1, 1, 1);
dint torchAdditive = true;
//dint torchAdditive = true;

dint useShinySurfaces = true;

Expand Down Expand Up @@ -618,14 +618,7 @@ void Rend_ApplyTorchLight(Vector4f &color, dfloat distance)
d *= (1024 - distance) / 1024.0f;
}

if (torchAdditive)
{
color += torchColor * d;
}
else
{
color += ((color * torchColor) - color) * d;
}
color = color.max(torchColor * d);
}
}

Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/libdoomsday/include/doomsday/gameapi.h
Expand Up @@ -119,7 +119,7 @@ enum {
DD_TORCH_RED,
DD_TORCH_GREEN,
DD_TORCH_BLUE,
DD_TORCH_ADDITIVE,
DD_TORCH_ADDITIVE_obsolete,
DD_TM_FLOOR_Z, ///< output from P_CheckPosition
DD_TM_CEILING_Z, ///< output from P_CheckPosition
DD_SHIFT_DOWN,
Expand Down

0 comments on commit d0377de

Please sign in to comment.