Skip to content

Commit

Permalink
- fixed mirrors and reflections in hardware renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed May 28, 2018
1 parent 36779cf commit 0187b0a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/gl/scene/gl_portal.cpp
Expand Up @@ -606,10 +606,7 @@ void GLSkyboxPortal::DrawContents(FDrawInfo *di)
di->SetViewArea();
ClearClipper(di);

int mapsection = R_PointInSubsector(r_viewpoint.Pos)->mapsection;

di->CurrentMapSections.Zero();
di->CurrentMapSections.Set(mapsection);
di->UpdateCurrentMapSection();

drawer->DrawScene(di, DM_SKYPORTAL);
portal->mFlags &= ~PORTSF_INSKYBOX;
Expand Down Expand Up @@ -770,6 +767,8 @@ void GLPlaneMirrorPortal::DrawContents(FDrawInfo *di)
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
ClearClipper(di);

di->UpdateCurrentMapSection();

gl_RenderState.SetClipHeight(planez, PlaneMirrorMode < 0 ? -1.f : 1.f);
drawer->DrawScene(di, DM_PORTAL);
gl_RenderState.SetClipHeight(0.f, 0.f);
Expand Down Expand Up @@ -944,6 +943,8 @@ void GLMirrorPortal::DrawContents(FDrawInfo *di)
angle_t a1 = linedef->v2->GetClipAngle();
di->mClipper->SafeAddClipRange(a1,a2);

di->UpdateCurrentMapSection();

gl_RenderState.SetClipLine(linedef);
gl_RenderState.EnableClipLine(true);
drawer->DrawScene(di, DM_PORTAL);
Expand Down
1 change: 0 additions & 1 deletion src/gl/scene/gl_scenedrawer.h
Expand Up @@ -32,7 +32,6 @@ class GLSceneDrawer

angle_t FrustumAngle();
void SetViewMatrix(float vx, float vy, float vz, bool mirror, bool planemirror);
void SetViewArea();
void SetupView(float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror);
void SetViewAngle(DAngle viewangle);
void SetProjection(VSMatrix matrix);
Expand Down
2 changes: 2 additions & 0 deletions src/hwrenderer/scene/hw_drawinfo.h
Expand Up @@ -175,6 +175,8 @@ struct HWDrawInfo
void PreparePlayerSprites(sector_t * viewsector, area_t in_area);
void PrepareTargeterSprites();

void UpdateCurrentMapSection();

virtual void DrawWall(GLWall *wall, int pass) = 0;
virtual void DrawFlat(GLFlat *flat, int pass, bool trans) = 0;
virtual void DrawSprite(GLSprite *sprite, int pass) = 0;
Expand Down
6 changes: 6 additions & 0 deletions src/hwrenderer/scene/hw_renderhacks.cpp
Expand Up @@ -86,6 +86,12 @@ void HWDrawInfo::ClearBuffers()
mClipPortal = nullptr;
}

void HWDrawInfo::UpdateCurrentMapSection()
{
const int mapsection = R_PointInSubsector(r_viewpoint.Pos)->mapsection;
CurrentMapSections.Set(mapsection);
}

//==========================================================================
//
// Adds a subsector plane to a sector's render list
Expand Down

0 comments on commit 0187b0a

Please sign in to comment.