mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 10:32:27 +00:00
- pass a floating point view position to the bunch drawer
This commit is contained in:
parent
16f61800ef
commit
bbf77c908b
3 changed files with 15 additions and 14 deletions
|
@ -53,15 +53,15 @@
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, vec2_t& view, angle_t a1, angle_t a2)
|
||||
void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, const DVector2& view, angle_t a1, angle_t a2)
|
||||
{
|
||||
ang1 = a1;
|
||||
ang2 = a2;
|
||||
angrange = ang2 - ang1;
|
||||
di = _di;
|
||||
clipper = c;
|
||||
viewx = view.X * (1/ 16.f);
|
||||
viewy = view.Y * -(1/ 16.f);
|
||||
viewx = view.X;
|
||||
viewy = view.Y;
|
||||
viewz = (float)di->Viewpoint.Pos.Z;
|
||||
|
||||
StartScene();
|
||||
|
@ -72,7 +72,9 @@ void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, vec2_t& view, angle_t a1, an
|
|||
for (auto& w : wall)
|
||||
{
|
||||
// Precalculate the clip angles to avoid doing this repeatedly during level traversal.
|
||||
auto vv = w.wall_int_pos() - view;
|
||||
DVector2 vv;
|
||||
vv.X = w.pos.X - view.X;
|
||||
vv.Y = w.pos.Y + view.Y; // beware of different coordinate systems!
|
||||
w.clipangle = RAD2BAM(atan2(vv.Y, vv.X));
|
||||
}
|
||||
memset(sectionstartang.Data(), -1, sectionstartang.Size() * sizeof(sectionstartang[0]));
|
||||
|
|
|
@ -59,7 +59,7 @@ private:
|
|||
void ProcessSection(int sectnum, bool portal);
|
||||
|
||||
public:
|
||||
void Init(HWDrawInfo* _di, Clipper* c, vec2_t& view, angle_t a1, angle_t a2);
|
||||
void Init(HWDrawInfo* _di, Clipper* c, const DVector2& view, angle_t a1, angle_t a2);
|
||||
void RenderScene(const int* viewsectors, unsigned sectcount, bool portal);
|
||||
const BitArray& GotSector() const { return gotsector; }
|
||||
};
|
||||
|
|
|
@ -380,19 +380,18 @@ void HWDrawInfo::CreateScene(bool portal)
|
|||
ingeo = false;
|
||||
geoofs = { 0,0 };
|
||||
|
||||
vec2_t view = { int(vp.Pos.X * 16), int(vp.Pos.Y * -16) };
|
||||
|
||||
if(!portal) mClipper->SetVisibleRange(vp.RotAngle, a1);
|
||||
|
||||
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, vp.RotAngle - a1, vp.RotAngle + a1);
|
||||
else mDrawer.Init(this, mClipper, view, 0, 0);
|
||||
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos, vp.RotAngle - a1, vp.RotAngle + a1);
|
||||
else mDrawer.Init(this, mClipper, vp.Pos, 0, 0);
|
||||
if (vp.SectNums)
|
||||
mDrawer.RenderScene(vp.SectNums, vp.SectCount, portal);
|
||||
else
|
||||
mDrawer.RenderScene(&vp.SectCount, 1, portal);
|
||||
|
||||
SetupSprite.Clock();
|
||||
gi->processSprites(tsprites, view.X, view.Y, vp.Pos.Z * -256, DAngle::fromBam(vp.RotAngle), vp.TicFrac);
|
||||
// vp is in render space, so we must convert back.
|
||||
gi->processSprites(tsprites, vp.Pos.X * 16, vp.Pos.Y * -16, vp.Pos.Z * -256, DAngle::fromBam(vp.RotAngle), vp.TicFrac);
|
||||
DispatchSprites();
|
||||
SetupSprite.Unclock();
|
||||
|
||||
|
@ -420,8 +419,8 @@ void HWDrawInfo::CreateScene(bool portal)
|
|||
if (eff.geosector[i] == drawsectp) drawsectp = eff.geosectorwarp[i];
|
||||
}
|
||||
|
||||
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, vp.RotAngle - a1, vp.RotAngle + a1);
|
||||
else mDrawer.Init(this, mClipper, view, 0, 0);
|
||||
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos, vp.RotAngle - a1, vp.RotAngle + a1);
|
||||
else mDrawer.Init(this, mClipper, vp.Pos, 0, 0);
|
||||
|
||||
int drawsect = sectnum(drawsectp);
|
||||
mDrawer.RenderScene(&drawsect, 1, false);
|
||||
|
@ -452,8 +451,8 @@ void HWDrawInfo::CreateScene(bool portal)
|
|||
if (eff.geosector[i] == orgdrawsectp) drawsectp = eff.geosectorwarp2[i];
|
||||
}
|
||||
|
||||
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, view, vp.RotAngle - a1, vp.RotAngle + a1);
|
||||
else mDrawer.Init(this, mClipper, view, 0, 0);
|
||||
if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos, vp.RotAngle - a1, vp.RotAngle + a1);
|
||||
else mDrawer.Init(this, mClipper, vp.Pos, 0, 0);
|
||||
drawsect = sectnum(drawsectp);
|
||||
mDrawer.RenderScene(&drawsect, 1, false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue