Skip to content

Commit

Permalink
Fixed|Models|Renderer: df_brightshadow2 and transparency
Browse files Browse the repository at this point in the history
With "df_brightshadow2", the alpha multiplier of the submodel needs
to be applied even though the object has another kind of transparency
(MF_SHADOW).

IssueID #1725
  • Loading branch information
skyjake committed Apr 21, 2014
1 parent 14be0d6 commit f9fd727
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions doomsday/client/src/render/rend_model.cpp
Expand Up @@ -667,10 +667,13 @@ static void drawSubmodel(uint number, drawmodelparams_t const &parm)
return;

float alpha = parm.ambientColor[CA];

// Is the submodel-defined alpha multiplier in effect?
if(!(parm.flags & (DDMF_BRIGHTSHADOW|DDMF_SHADOW|DDMF_ALTSHADOW)))
// With df_brightshadow2, the alpha multiplier will be applied anyway.
if(smf.testFlag(MFF_BRIGHTSHADOW2) ||
!(parm.flags & (DDMF_BRIGHTSHADOW|DDMF_SHADOW|DDMF_ALTSHADOW)))
{
alpha *= smf.alpha * reciprocal255;
alpha *= smf.alpha / 255.f;
}

// Would this be visible?
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/resource/resourcesystem.cpp
Expand Up @@ -1629,7 +1629,7 @@ DENG2_PIMPL(ResourceSystem)
if(sub->frame < 0) sub->frame = 0;
sub->frameRange = de::max(1, subdef->frameRange); // Frame range must always be greater than zero.

sub->alpha = byte(255 - subdef->alpha * 255);
sub->alpha = byte(de::clamp(0, int(255 - subdef->alpha * 255), 255));
sub->blendMode = subdef->blendMode;

// Submodel-specific flags cancel out model-scope flags!
Expand Down

0 comments on commit f9fd727

Please sign in to comment.