- made adjustments to floating point bounding boxes for nodes and changes to the WarpBuffer function.

This commit is contained in:
Christoph Oelckers 2016-05-01 11:56:45 +02:00
parent 737646b45d
commit 24526f7da5
3 changed files with 7 additions and 32 deletions

View file

@ -396,27 +396,6 @@ void R_SetView()
viewy = FLOAT2FIXED(ViewPos.Y);
}
angle_t R_PointToPseudoAngle (fixed_t x, fixed_t y)
{
double vecx = double(x-viewx);
double vecy = double(y-viewy);
if (vecx == 0 && vecy == 0)
{
return 0;
}
else
{
double result = vecy / (fabs(vecx) + fabs(vecy));
if (vecx < 0)
{
result = 2.f - result;
}
return xs_Fix<30>::ToFix(result);
}
}
angle_t R_PointToPseudoAngle(double x, double y)
{
double vecx = x - ViewPos.X;
@ -447,7 +426,7 @@ angle_t R_PointToPseudoAngle(double x, double y)
// if some part of the bbox might be visible.
//
//-----------------------------------------------------------------------------
static const int checkcoord[12][4] = // killough -- static const
static const BYTE checkcoord[12][4] = // killough -- static const
{
{3,0,2,1},
{3,0,2,0},
@ -462,17 +441,17 @@ angle_t R_PointToPseudoAngle(double x, double y)
{2,1,3,0}
};
bool Clipper::CheckBox(const fixed_t *bspcoord)
bool Clipper::CheckBox(const float *bspcoord)
{
angle_t angle1, angle2;
int boxpos;
const int* check;
const BYTE* check;
// Find the corners of the box
// that define the edges from current viewpoint.
boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT ] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP ] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
boxpos = (ViewPos.X <= bspcoord[BOXLEFT] ? 0 : ViewPos.X < bspcoord[BOXRIGHT ] ? 1 : 2) +
(ViewPos.Y >= bspcoord[BOXTOP ] ? 0 : ViewPos.Y > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5) return true;

View file

@ -129,13 +129,12 @@ public:
SafeRemoveClipRange(AngleToPseudo(startangle), AngleToPseudo(endangle));
}
bool CheckBox(const fixed_t *bspcoord);
bool CheckBox(const float *bspcoord);
};
extern Clipper clipper;
angle_t R_PointToPseudoAngle (fixed_t x, fixed_t y);
angle_t R_PointToPseudoAngle(double x, double y);
void R_SetView();

View file

@ -315,10 +315,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
// need to do software warping
FWarpTexture *wt = static_cast<FWarpTexture*>(tex);
unsigned char *warpbuffer = new unsigned char[w*h*4];
if (tex->bWarped != 2)
WarpBufferType1((DWORD*)warpbuffer, (const DWORD*)buffer, w, h, wt->WidthOffsetMultiplier, wt->HeightOffsetMultiplier, r_FrameTime, wt->Speed);
else
WarpBufferType2((DWORD*)warpbuffer, (const DWORD*)buffer, w, h, wt->WidthOffsetMultiplier, wt->HeightOffsetMultiplier, r_FrameTime, wt->Speed);
WarpBuffer((DWORD*)warpbuffer, (const DWORD*)buffer, w, h, wt->WidthOffsetMultiplier, wt->HeightOffsetMultiplier, r_FrameTime, wt->Speed, tex->bWarped);
delete[] buffer;
buffer = warpbuffer;
wt->GenTime = r_FrameTime;