Skip to content

Commit

Permalink
Re-enable depth test after drawing particles
Browse files Browse the repository at this point in the history
While the depth-test was already re-enabled in most cases, sometimes it
was not. This could cause some (spell) effects to shine through walls
while the player was casting.

Fixes bug #278
  • Loading branch information
dscharrer committed Jun 19, 2012
1 parent 2251770 commit 2102e19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/core/ArxGame.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ void ArxGame::Render() {
) )
{ {
ARX_MAGICAL_FLARES_Draw(FRAMETICKS); ARX_MAGICAL_FLARES_Draw(FRAMETICKS);
FRAMETICKS = (unsigned long)(arxtime); FRAMETICKS = (unsigned long)(arxtime);
} }
} }
#ifdef BUILD_EDITOR #ifdef BUILD_EDITOR
Expand Down
2 changes: 1 addition & 1 deletion src/core/Core.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3274,7 +3274,7 @@ void DrawMagicSightInterface()


if (Flying_Eye) if (Flying_Eye)
{ {
GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendInvSrcColor); GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendInvSrcColor);
float col=(0.75f+PULSATE*( 1.0f / 20 )); float col=(0.75f+PULSATE*( 1.0f / 20 ));


if (col>1.f) col=1.f; if (col>1.f) col=1.f;
Expand Down
12 changes: 7 additions & 5 deletions src/graphics/particle/ParticleEffects.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -918,19 +918,20 @@ void ManageTorch()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ARX_MAGICAL_FLARES_Draw(long FRAMETICKS) void ARX_MAGICAL_FLARES_Draw(long FRAMETICKS)
{ {
/////////FLARE
GRenderer->SetRenderState(Renderer::DepthWrite, false);
GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
GRenderer->SetRenderState(Renderer::AlphaBlending, true);


shinum++; shinum++;


if (shinum>=10) shinum=1; if (shinum>=10) shinum=1;


long TICKS = long(arxtime) - FRAMETICKS; long TICKS = long(arxtime) - FRAMETICKS;


if (TICKS<0) if (TICKS<0)
return; return;

/////////FLARE
GRenderer->SetRenderState(Renderer::DepthWrite, false);
GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
GRenderer->SetRenderState(Renderer::AlphaBlending, true);


float z,s,r,g,b; float z,s,r,g,b;


Expand Down Expand Up @@ -2311,6 +2312,7 @@ void ARX_PARTICLES_Render(EERIE_CAMERA * cam)
if (pcc<=0) if (pcc<=0)
{ {
GRenderer->SetFogColor(ulBKGColor); GRenderer->SetFogColor(ulBKGColor);
GRenderer->SetRenderState(Renderer::DepthTest, true);
return; return;
} }
} }
Expand Down

0 comments on commit 2102e19

Please sign in to comment.