- adjustments.

This commit is contained in:
Christoph Oelckers 2016-03-30 20:01:44 +02:00
parent 251172c7f0
commit cf44d2e37a
18 changed files with 133 additions and 137 deletions

View file

@ -459,8 +459,8 @@ void gl_RecalcVertexHeights(vertex_t * v)
{
for(j=0;j<2;j++)
{
if (j==0) height=FIXED2FLOAT(v->sectors[i]->ceilingplane.ZatPoint(v));
else height=FIXED2FLOAT(v->sectors[i]->floorplane.ZatPoint(v));
if (j==0) height=v->sectors[i]->ceilingplane.ZatPoint(v);
else height=v->sectors[i]->floorplane.ZatPoint(v);
for(k=0;k<v->numheights;k++)
{

View file

@ -157,7 +157,7 @@ void FFlatVertex::SetFlatVertex(vertex_t *vt, const secplane_t & plane)
{
x = vt->fx;
y = vt->fy;
z = plane.ZatPoint(vt->fx, vt->fy);
z = plane.ZatPoint(vt->fx, vt->fy); // this is the original position without polyobject translation.
u = vt->fx/64.f;
v = -vt->fy/64.f;
}

View file

@ -176,7 +176,7 @@ void ADynamicLight::PostBeginPlay()
Activate (NULL);
}
subsector = R_PointInSubsector(_f_X(), _f_Y());
subsector = R_PointInSubsector(Pos());
}
@ -355,7 +355,7 @@ void ADynamicLight::UpdateLocation()
DVector3 pos = target->Vec3Offset(m_off.X * c + m_off.Y * s, m_off.X * s - m_off.Y * c, m_off.Z + target->GetBobOffset());
SetXYZ(pos); // attached lights do not need to go into the regular blockmap
Prev = target->Pos();
subsector = R_PointInSubsector(target->_f_X(), target->_f_Y());
subsector = R_PointInSubsector(Prev);
Sector = subsector->sector;
}
@ -507,7 +507,7 @@ static FLightNode * DeleteLightNode(FLightNode * node)
//
//==========================================================================
double ADynamicLight::DistToSeg(const fixedvec3 &pos, seg_t *seg)
double ADynamicLight::DistToSeg(const DVector3 &pos, seg_t *seg)
{
double u, px, py;
@ -515,15 +515,15 @@ double ADynamicLight::DistToSeg(const fixedvec3 &pos, seg_t *seg)
double seg_dy = seg->v2->fY() - seg->v1->fY();
double seg_length_sq = seg_dx * seg_dx + seg_dy * seg_dy;
u = ((FIXED2DBL(pos.x) - seg->v1->fX()) * seg_dx + (FIXED2DBL(pos.y) - seg->v1->fY()) * seg_dy) / seg_length_sq;
u = ((pos.X - seg->v1->fX()) * seg_dx + pos.Y - seg->v1->fY()) * seg_dy / seg_length_sq;
if (u < 0.) u = 0.; // clamp the test point to the line segment
if (u > 1.) u = 1.;
else if (u > 1.) u = 1.;
px = seg->v1->fX() + (u * seg_dx);
py = seg->v1->fY() + (u * seg_dy);
px -= FIXED2DBL(pos.x);
py -= FIXED2DBL(pos.y);
px -= pos.X;
py -= pos.Y;
return (px*px) + (py*py);
}
@ -536,7 +536,7 @@ double ADynamicLight::DistToSeg(const fixedvec3 &pos, seg_t *seg)
//
//==========================================================================
void ADynamicLight::CollectWithinRadius(const fixedvec3 &pos, subsector_t *subSec, float radius)
void ADynamicLight::CollectWithinRadius(const DVector3 &pos, subsector_t *subSec, float radius)
{
if (!subSec) return;
@ -556,7 +556,7 @@ void ADynamicLight::CollectWithinRadius(const fixedvec3 &pos, subsector_t *subSe
if (seg->sidedef && seg->linedef && seg->linedef->validcount!=::validcount)
{
// light is in front of the seg
if (DMulScale32(pos.y - seg->v1->fixY(), seg->v2->fixX() - seg->v1->fixX(), seg->v1->fixX() - pos.x, seg->v2->fixY() - seg->v1->fixY()) <= 0)
if ((pos.Y - seg->v1->fixY()) * (seg->v2->fX() - seg->v1->fixX()) + (seg->v1->fX() - pos.X * (seg->v2->fY() - seg->v1->fY())) <= 0)
{
seg->linedef->validcount = validcount;
touching_sides = AddLightNode(&seg->sidedef->lighthead, seg->sidedef, this, touching_sides);
@ -572,8 +572,8 @@ void ADynamicLight::CollectWithinRadius(const fixedvec3 &pos, subsector_t *subSe
line_t *other = port->mDestination;
if (other->validcount != ::validcount)
{
subsector_t *othersub = R_PointInSubsector(other->v1->fixX() + other->fixDx() / 2, other->v1->fixY() + other->fixDy() / 2);
if (othersub->validcount != ::validcount) CollectWithinRadius(_f_PosRelative(other), othersub, radius);
subsector_t *othersub = R_PointInSubsector(other->v1->fPos() + other->Delta() / 2);
if (othersub->validcount != ::validcount) CollectWithinRadius(PosRelative(other), othersub, radius);
}
}
}
@ -599,9 +599,9 @@ void ADynamicLight::CollectWithinRadius(const fixedvec3 &pos, subsector_t *subSe
AActor *sb = subSec->sector->SkyBoxes[sector_t::ceiling];
if (sb->specialf1 < Z() + radius)
{
fixedvec2 refpos = { other->v1->fixX() + other->fixDx() / 2 + FLOAT2FIXED(sb->Scale.X), other->v1->fixY() + other->fixDy() / 2 + FLOAT2FIXED(sb->Scale.Y) };
subsector_t *othersub = R_PointInSubsector(refpos.x, refpos.y);
if (othersub->validcount != ::validcount) CollectWithinRadius(_f_PosRelative(othersub->sector), othersub, radius);
DVector2 refpos = other->v1->fPos() + other->Delta() / 2 + sb->Scale;
subsector_t *othersub = R_PointInSubsector(refpos);
if (othersub->validcount != ::validcount) CollectWithinRadius(PosRelative(othersub->sector), othersub, radius);
}
}
if (!subSec->sector->PortalBlocksSight(sector_t::floor))
@ -610,9 +610,9 @@ void ADynamicLight::CollectWithinRadius(const fixedvec3 &pos, subsector_t *subSe
AActor *sb = subSec->sector->SkyBoxes[sector_t::floor];
if (sb->specialf1 > Z() - radius)
{
fixedvec2 refpos = { other->v1->fixX() + other->fixDx() / 2 + FLOAT2FIXED(sb->Scale.X), other->v1->fixY() + other->fixDy() / 2 + FLOAT2FIXED(sb->Scale.Y) };
subsector_t *othersub = R_PointInSubsector(refpos.x, refpos.y);
if (othersub->validcount != ::validcount) CollectWithinRadius(_f_PosRelative(othersub->sector), othersub, radius);
DVector2 refpos = other->v1->fPos() + other->Delta() / 2 + sb->Scale;
subsector_t *othersub = R_PointInSubsector(refpos);
if (othersub->validcount != ::validcount) CollectWithinRadius(PosRelative(othersub->sector), othersub, radius);
}
}
}
@ -649,10 +649,10 @@ void ADynamicLight::LinkLight()
if (radius>0)
{
// passing in radius*radius allows us to do a distance check without any calls to sqrtf
subsector_t * subSec = R_PointInSubsector(_f_X(), _f_Y());
// passing in radius*radius allows us to do a distance check without any calls to sqrt
subsector_t * subSec = R_PointInSubsector(Pos());
::validcount++;
CollectWithinRadius(_f_Pos(), subSec, radius*radius);
CollectWithinRadius(Pos(), subSec, radius*radius);
}

View file

@ -99,8 +99,8 @@ public:
FLightNode * touching_sector;
private:
double DistToSeg(const fixedvec3 &pos, seg_t *seg);
void CollectWithinRadius(const fixedvec3 &pos, subsector_t *subSec, float radius);
double DistToSeg(const DVector3 &pos, seg_t *seg);
void CollectWithinRadius(const DVector3 &pos, subsector_t *subSec, float radius);
protected:
DVector3 m_off;

View file

@ -87,20 +87,16 @@ CUSTOM_CVAR (Bool, gl_lights_additive, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG
//==========================================================================
bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bool forceadditive, FDynLightData &ldata)
{
Vector fn, pos;
int i = 0;
fixedvec3 lpos = light->_f_PosRelative(group);
float x = FIXED2FLOAT(lpos.x);
float y = FIXED2FLOAT(lpos.y);
float z = FIXED2FLOAT(lpos.z);
DVector3 pos = light->PosRelative(group);
float dist = fabsf(p.DistToPoint(x, z, y));
float dist = fabsf(p.DistToPoint(pos.X, pos.Z, pos.Y));
float radius = (light->GetRadius() * gl_lights_size);
if (radius <= 0.f) return false;
if (dist > radius) return false;
if (checkside && gl_lights_checkside && p.PointOnSide(x, z, y))
if (checkside && gl_lights_checkside && p.PointOnSide(pos.X, pos.Z, pos.Y))
{
return false;
}
@ -133,9 +129,9 @@ bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bo
}
float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(8)];
data[0] = x;
data[1] = z;
data[2] = y;
data[0] = pos.X;
data[1] = pos.Z;
data[2] = pos.Y;
data[3] = radius;
data[4] = r;
data[5] = g;

View file

@ -599,8 +599,8 @@ void FGLRenderer::FillSimplePoly(FTexture *texture, FVector2 *points, int npoint
int i;
bool dorotate = rotation != 0;
float cosrot = cos(ToRadians(rotation));
float sinrot = sin(ToRadians(rotation));
float cosrot = cos(rotation.Radians());
float sinrot = sin(rotation.Radians());
//float yoffs = GatheringWipeScreen ? 0 : LBOffset;
float uscale = float(1.f / (texture->GetScaledWidth() * scalex));

View file

@ -1165,8 +1165,8 @@ void FDrawInfo::FloodUpperGap(seg_t * seg)
// Although the plane can be sloped this code will only be called
// when the edge itself is not.
fixed_t backz = fakebsector->ceilingplane.ZatPoint(seg->v1);
fixed_t frontz = fakefsector->ceilingplane.ZatPoint(seg->v1);
fixed_t backz = fakebsector->ceilingplane.ZatPoint(seg->v1->x, seg->v1->y);
fixed_t frontz = fakefsector->ceilingplane.ZatPoint(seg->v1->x, seg->v1->y);
if (fakebsector->GetTexture(sector_t::ceiling)==skyflatnum) return;
if (backz < viewz) return;
@ -1217,8 +1217,8 @@ void FDrawInfo::FloodLowerGap(seg_t * seg)
// Although the plane can be sloped this code will only be called
// when the edge itself is not.
fixed_t backz = fakebsector->floorplane.ZatPoint(seg->v1);
fixed_t frontz = fakefsector->floorplane.ZatPoint(seg->v1);
fixed_t backz = fakebsector->floorplane.ZatPoint(seg->v1->x, seg->v1->y);
fixed_t frontz = fakefsector->floorplane.ZatPoint(seg->v1->x, seg->v1->y);
if (fakebsector->GetTexture(sector_t::floor) == skyflatnum) return;

View file

@ -57,14 +57,14 @@ CVAR(Bool, gltest_slopeopt, false, 0)
bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsector)
{
line_t *linedef = sidedef->linedef;
fixed_t bs_floorheight1;
fixed_t bs_floorheight2;
fixed_t bs_ceilingheight1;
fixed_t bs_ceilingheight2;
fixed_t fs_floorheight1;
fixed_t fs_floorheight2;
fixed_t fs_ceilingheight1;
fixed_t fs_ceilingheight2;
double bs_floorheight1;
double bs_floorheight2;
double bs_ceilingheight1;
double bs_ceilingheight2;
double fs_floorheight1;
double fs_floorheight2;
double fs_ceilingheight1;
double fs_ceilingheight2;
// Mirrors and horizons always block the view
//if (linedef->special==Line_Mirror || linedef->special==Line_Horizon) return true;
@ -82,82 +82,82 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
if (frontsector->ceilingplane.isSlope())
{
fs_ceilingheight1=frontsector->ceilingplane.ZatPoint(linedef->v1);
fs_ceilingheight2=frontsector->ceilingplane.ZatPoint(linedef->v2);
fs_ceilingheight1 = frontsector->ceilingplane.ZatPoint(linedef->v1);
fs_ceilingheight2 = frontsector->ceilingplane.ZatPoint(linedef->v2);
}
else
{
fs_ceilingheight2=fs_ceilingheight1=frontsector->ceilingplane.fixD();
fs_ceilingheight2 = fs_ceilingheight1 = frontsector->ceilingplane.fixD();
}
if (frontsector->floorplane.isSlope())
{
fs_floorheight1=frontsector->floorplane.ZatPoint(linedef->v1);
fs_floorheight2=frontsector->floorplane.ZatPoint(linedef->v2);
fs_floorheight1 = frontsector->floorplane.ZatPoint(linedef->v1);
fs_floorheight2 = frontsector->floorplane.ZatPoint(linedef->v2);
}
else
{
fs_floorheight2=fs_floorheight1=-frontsector->floorplane.fixD();
fs_floorheight2 = fs_floorheight1 = -frontsector->floorplane.fixD();
}
if (backsector->ceilingplane.isSlope())
{
bs_ceilingheight1=backsector->ceilingplane.ZatPoint(linedef->v1);
bs_ceilingheight2=backsector->ceilingplane.ZatPoint(linedef->v2);
bs_ceilingheight1 = backsector->ceilingplane.ZatPoint(linedef->v1);
bs_ceilingheight2 = backsector->ceilingplane.ZatPoint(linedef->v2);
}
else
{
bs_ceilingheight2=bs_ceilingheight1=backsector->ceilingplane.fixD();
bs_ceilingheight2 = bs_ceilingheight1 = backsector->ceilingplane.fixD();
}
if (backsector->floorplane.isSlope())
{
bs_floorheight1=backsector->floorplane.ZatPoint(linedef->v1);
bs_floorheight2=backsector->floorplane.ZatPoint(linedef->v2);
bs_floorheight1 = backsector->floorplane.ZatPoint(linedef->v1);
bs_floorheight2 = backsector->floorplane.ZatPoint(linedef->v2);
}
else
{
bs_floorheight2=bs_floorheight1=-backsector->floorplane.fixD();
bs_floorheight2 = bs_floorheight1 = -backsector->floorplane.fixD();
}
// now check for closed sectors!
if (bs_ceilingheight1<=fs_floorheight1 && bs_ceilingheight2<=fs_floorheight2)
if (bs_ceilingheight1 <= fs_floorheight1 && bs_ceilingheight2 <= fs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top));
if (!tex || tex->UseType==FTexture::TEX_Null) return false;
if (backsector->GetTexture(sector_t::ceiling)==skyflatnum &&
frontsector->GetTexture(sector_t::ceiling)==skyflatnum) return false;
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;
return true;
}
if (fs_ceilingheight1<=bs_floorheight1 && fs_ceilingheight2<=bs_floorheight2)
if (fs_ceilingheight1 <= bs_floorheight1 && fs_ceilingheight2 <= bs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType==FTexture::TEX_Null) return false;
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
// properly render skies (consider door "open" if both floors are sky):
if (backsector->GetTexture(sector_t::ceiling)==skyflatnum &&
frontsector->GetTexture(sector_t::ceiling)==skyflatnum) return false;
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;
return true;
}
if (bs_ceilingheight1<=bs_floorheight1 && bs_ceilingheight2<=bs_floorheight2)
if (bs_ceilingheight1 <= bs_floorheight1 && bs_ceilingheight2 <= bs_floorheight2)
{
// preserve a kind of transparent door/lift special effect:
if (bs_ceilingheight1 < fs_ceilingheight1 || bs_ceilingheight2 < fs_ceilingheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top));
if (!tex || tex->UseType==FTexture::TEX_Null) return false;
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
}
if (bs_floorheight1 > fs_floorheight1 || bs_floorheight2 > fs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType==FTexture::TEX_Null) return false;
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
}
if (backsector->GetTexture(sector_t::ceiling)==skyflatnum &&
frontsector->GetTexture(sector_t::ceiling)==skyflatnum) return false;
if (backsector->GetTexture(sector_t::floor)==skyflatnum && frontsector->GetTexture(sector_t::floor)
==skyflatnum) return false;
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;
if (backsector->GetTexture(sector_t::floor) == skyflatnum && frontsector->GetTexture(sector_t::floor)
== skyflatnum) return false;
return true;
}
@ -172,22 +172,22 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
void gl_CheckViewArea(vertex_t *v1, vertex_t *v2, sector_t *frontsector, sector_t *backsector)
{
if (in_area==area_default &&
if (in_area == area_default &&
(backsector->heightsec && !(backsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) &&
(!frontsector->heightsec || frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC))
{
sector_t * s = backsector->heightsec;
fixed_t cz1 = frontsector->ceilingplane.ZatPoint(v1);
fixed_t cz2 = frontsector->ceilingplane.ZatPoint(v2);
fixed_t fz1 = s->floorplane.ZatPoint(v1);
fixed_t fz2 = s->floorplane.ZatPoint(v2);
double cz1 = frontsector->ceilingplane.ZatPoint(v1);
double cz2 = frontsector->ceilingplane.ZatPoint(v2);
double fz1 = s->floorplane.ZatPoint(v1);
double fz2 = s->floorplane.ZatPoint(v2);
// allow some tolerance in case slopes are involved
if (cz1 <= fz1 + FRACUNIT/100 && cz2<=fz2 + FRACUNIT/100)
in_area=area_below;
if (cz1 <= fz1 + 1. / 100 && cz2 <= fz2 + 1. / 100)
in_area = area_below;
else
in_area=area_normal;
in_area = area_normal;
}
}

View file

@ -93,7 +93,7 @@ void gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * glte
{
yscale1 = 0 - yscale1;
}
float angle=-ANGLE2FLOAT(secplane->angle);
float angle=-AngleToFloat(secplane->angle);
float xscale2=64.f/gltexture->TextureWidth();
float yscale2=64.f/gltexture->TextureHeight();
@ -142,10 +142,10 @@ void GLFlat::SetupSubsectorLights(int pass, subsector_t * sub, int *dli)
// we must do the side check here because gl_SetupLight needs the correct plane orientation
// which we don't have for Legacy-style 3D-floors
fixed_t planeh = plane.plane.ZatPoint(light);
if (gl_lights_checkside && ((planeh<light->_f_Z() && ceiling) || (planeh>light->_f_Z() && !ceiling)))
double planeh = plane.plane.ZatPoint(light);
if (gl_lights_checkside && ((planeh<light->Z() && ceiling) || (planeh>light->Z() && !ceiling)))
{
node=node->nextLight;
node = node->nextLight;
continue;
}
@ -666,7 +666,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
if (rover->flags&FF_FOG && gl_fixedcolormap) continue;
if (!rover->top.copied && rover->flags&(FF_INVERTPLANES|FF_BOTHPLANES))
{
fixed_t ff_top=rover->top.plane->ZatPoint(sector->centerspot);
fixed_t ff_top=FLOAT2FIXED(rover->top.plane->ZatPoint(sector->centerspot));
if (ff_top<lastceilingheight)
{
if (FIXED2FLOAT(viewz) <= rover->top.plane->ZatPoint(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy)))
@ -680,7 +680,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
}
if (!rover->bottom.copied && !(rover->flags&FF_INVERTPLANES))
{
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sector->centerspot);
fixed_t ff_bottom=FLOAT2FIXED(rover->bottom.plane->ZatPoint(sector->centerspot));
if (ff_bottom<lastceilingheight)
{
if (FIXED2FLOAT(viewz)<=rover->bottom.plane->ZatPoint(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy)))
@ -706,7 +706,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
if (rover->flags&FF_FOG && gl_fixedcolormap) continue;
if (!rover->bottom.copied && rover->flags&(FF_INVERTPLANES|FF_BOTHPLANES))
{
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sector->centerspot);
fixed_t ff_bottom=FLOAT2FIXED(rover->bottom.plane->ZatPoint(sector->centerspot));
if (ff_bottom>lastfloorheight || (rover->flags&FF_FIX))
{
if (FIXED2FLOAT(viewz) >= rover->bottom.plane->ZatPoint(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy)))
@ -727,7 +727,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
}
if (!rover->top.copied && !(rover->flags&FF_INVERTPLANES))
{
fixed_t ff_top=rover->top.plane->ZatPoint(sector->centerspot);
fixed_t ff_top=FLOAT2FIXED(rover->top.plane->ZatPoint(sector->centerspot));
if (ff_top>lastfloorheight)
{
if (FIXED2FLOAT(viewz) >= rover->top.plane->ZatPoint(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy)))

View file

@ -659,11 +659,11 @@ void GLSkyboxPortal::DrawContents()
viewx = FLOAT2FIXED(viewpos.X);
viewy = FLOAT2FIXED(viewpos.Y);
viewz = FLOAT2FIXED(viewpos.Z);
viewangle += (origin->PrevAngles.Yaw + deltaangle(origin->PrevAngles.Yaw, origin->Angles.Yaw) * FIXED2DBL(r_TicFrac)).BAMs();
viewangle += (origin->PrevAngles.Yaw + deltaangle(origin->PrevAngles.Yaw, origin->Angles.Yaw) * r_TicFracF).BAMs();
// Don't let the viewpoint be too close to a floor or ceiling
fixed_t floorh = origin->Sector->floorplane.ZatPoint(origin);
fixed_t ceilh = origin->Sector->ceilingplane.ZatPoint(origin);
fixed_t floorh = origin->Sector->floorplane.ZatPoint(origin->_f_Pos());
fixed_t ceilh = origin->Sector->ceilingplane.ZatPoint(origin->_f_Pos());
if (viewz<floorh+4*FRACUNIT) viewz=floorh+4*FRACUNIT;
if (viewz>ceilh-4*FRACUNIT) viewz=ceilh-4*FRACUNIT;

View file

@ -118,7 +118,7 @@ angle_t FGLRenderer::FrustumAngle()
// ok, this is a gross hack that barely works...
// but at least it doesn't overestimate too much...
double floatangle=2.0+(45.0+((tilt/1.9)))*mCurrentFoV*48.0/BaseRatioSizes[WidescreenRatio][3]/90.0;
angle_t a1 = FLOAT2ANGLE(floatangle);
angle_t a1 = DAngle(floatangle).BAMs();
if (a1>=ANGLE_180) return 0xffffffff;
return a1;
}
@ -771,7 +771,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
SetViewArea();
// We have to scale the pitch to account for the pixel stretching, because the playsim doesn't know about this and treats it as 1:1.
double radPitch = ANGLE2RAD(viewpitch);
double radPitch = (viewpitch)* M_PI / 0x80000000;
if (radPitch > PI) radPitch -= 2 * PI;
radPitch = clamp(radPitch, -PI / 2, PI / 2);
@ -865,8 +865,8 @@ void FGLRenderer::RenderView (player_t* player)
ResetProfilingData();
// Get this before everything else
if (cl_capfps || r_NoInterpolate) r_TicFrac = FRACUNIT;
else r_TicFrac = I_GetTimeFrac (&r_FrameTime);
if (cl_capfps || r_NoInterpolate) r_TicFracF = 1.;
else r_TicFracF = I_GetTimeFrac (&r_FrameTime);
gl_frameMS = I_MSTime();
P_FindParticleSubsectors ();

View file

@ -92,7 +92,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
texture[0] = FMaterial::ValidateTexture(texno, false, true);
if (!texture[0] || texture[0]->tex->UseType == FTexture::TEX_Null) goto normalsky;
skytexno1 = texno;
x_offset[0] = ANGLE2FLOAT(s->GetTextureXOffset(pos));
x_offset[0] = AngleToFloat(s->GetTextureXOffset(pos));
y_offset = FIXED2FLOAT(s->GetTextureYOffset(pos));
mirrored = !l->args[2];
}
@ -279,7 +279,7 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex
{
ztop[0]=ztop[1]=32768.0f;
zbottom[0]=zbottom[1]=
FIXED2FLOAT(bs->ceilingplane.ZatPoint(v2) + seg->sidedef->GetTextureYOffset(side_t::mid));
bs->ceilingplane.ZatPoint(v2) + seg->sidedef->GetTextureYOffsetF(side_t::mid);
SkyPlane(fs, sector_t::ceiling, false);
return;
}
@ -298,8 +298,8 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex
}
else
{
zbottom[0]=FIXED2FLOAT(bs->ceilingplane.ZatPoint(v1));
zbottom[1]=FIXED2FLOAT(bs->ceilingplane.ZatPoint(v2));
zbottom[0] = bs->ceilingplane.ZatPoint(v1);
zbottom[1] = bs->ceilingplane.ZatPoint(v2);
flags|=GLWF_SKYHACK; // mid textures on such lines need special treatment!
}
}
@ -324,12 +324,10 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex
}
// stacked sectors
fixed_t fsc1=fs->ceilingplane.ZatPoint(v1);
fixed_t fsc2=fs->ceilingplane.ZatPoint(v2);
ztop[0] = ztop[1] = 32768.0f;
zbottom[0] = fs->ceilingplane.ZatPoint(v1);
zbottom[1] = fs->ceilingplane.ZatPoint(v2);
ztop[0]=ztop[1]=32768.0f;
zbottom[0]=FIXED2FLOAT(fsc1);
zbottom[1]=FIXED2FLOAT(fsc2);
}
SkyPlane(fs, sector_t::ceiling, true);
@ -375,8 +373,8 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver
}
else
{
ztop[0]=FIXED2FLOAT(bs->floorplane.ZatPoint(v1));
ztop[1]=FIXED2FLOAT(bs->floorplane.ZatPoint(v2));
ztop[0] = bs->floorplane.ZatPoint(v1);
ztop[1] = bs->floorplane.ZatPoint(v2);
flags|=GLWF_SKYHACK; // mid textures on such lines need special treatment!
}
}
@ -401,12 +399,9 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver
}
// stacked sectors
fixed_t fsc1=fs->floorplane.ZatPoint(v1);
fixed_t fsc2=fs->floorplane.ZatPoint(v2);
zbottom[0]=zbottom[1]=-32768.0f;
ztop[0]=FIXED2FLOAT(fsc1);
ztop[1]=FIXED2FLOAT(fsc2);
ztop[0] = fs->floorplane.ZatPoint(v1);
ztop[1] = fs->floorplane.ZatPoint(v2);
}
SkyPlane(fs, sector_t::floor, true);

View file

@ -282,7 +282,7 @@ void GLSprite::Draw(int pass)
float xcenter = (x1 + x2)*0.5;
float ycenter = (y1 + y2)*0.5;
float zcenter = (z1 + z2)*0.5;
float angleRad = ToRadians(270. - GLRenderer->mAngles.Yaw);
float angleRad = (270. - GLRenderer->mAngles.Yaw).Radians();
Matrix3x4 mat;
mat.MakeIdentity();
@ -423,7 +423,7 @@ void GLSprite::PerformSpriteClipAdjustment(AActor *thing, fixed_t thingx, fixed_
}
}
if (btm == 1000000.0f)
btm = FIXED2FLOAT(thing->Sector->floorplane.ZatPoint(thing)) - thing->Floorclip;
btm = thing->Sector->floorplane.ZatPoint(thing) - thing->Floorclip;
if (top == -1000000.0f)
top = FIXED2FLOAT(thing->Sector->ceilingplane.ZatPoint(thingx, thingy));

View file

@ -1105,8 +1105,8 @@ __forceinline void GLWall::GetPlanePos(F3DFloor::planeref *planeref, fixed_t &le
{
if (planeref->plane->isSlope())
{
left=planeref->plane->ZatPoint(vertexes[0]);
right=planeref->plane->ZatPoint(vertexes[1]);
left=planeref->plane->ZatPoint(vertexes[0]->x, vertexes[0]->y);
right=planeref->plane->ZatPoint(vertexes[1]->x, vertexes[1]->y);
}
else if(planeref->isceiling == sector_t::ceiling)
{
@ -1452,8 +1452,8 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
// Save a little time (up to 0.3 ms per frame ;) )
if (frontsector->floorplane.isSlope())
{
ffh1 = segfront->floorplane.ZatPoint(v1);
ffh2 = segfront->floorplane.ZatPoint(v2);
ffh1 = segfront->floorplane.ZatPoint(v1->x, v1->y);
ffh2 = segfront->floorplane.ZatPoint(v2->x, v2->y);
zfloor[0] = FIXED2FLOAT(ffh1);
zfloor[1] = FIXED2FLOAT(ffh2);
}
@ -1465,8 +1465,8 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
if (segfront->ceilingplane.isSlope())
{
fch1 = segfront->ceilingplane.ZatPoint(v1);
fch2 = segfront->ceilingplane.ZatPoint(v2);
fch1 = segfront->ceilingplane.ZatPoint(v1->x, v1->y);
fch2 = segfront->ceilingplane.ZatPoint(v2->x, v2->y);
zceil[0] = FIXED2FLOAT(fch1);
zceil[1] = FIXED2FLOAT(fch2);
}
@ -1522,8 +1522,8 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
if (segback->floorplane.isSlope())
{
bfh1 = segback->floorplane.ZatPoint(v1);
bfh2 = segback->floorplane.ZatPoint(v2);
bfh1 = segback->floorplane.ZatPoint(v1->x, v1->y);
bfh2 = segback->floorplane.ZatPoint(v2->x, v2->y);
}
else
{
@ -1532,8 +1532,8 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
if (segback->ceilingplane.isSlope())
{
bch1 = segback->ceilingplane.ZatPoint(v1);
bch2 = segback->ceilingplane.ZatPoint(v2);
bch1 = segback->ceilingplane.ZatPoint(v1->x, v1->y);
bch2 = segback->ceilingplane.ZatPoint(v2->x, v2->y);
}
else
{

View file

@ -346,8 +346,8 @@ void GLWall::RenderTextured(int rflags)
{
secplane_t &lowplane = i == (*lightlist).Size() - 1 ? bottomplane : (*lightlist)[i + 1].plane;
// this must use the exact same calculation method as GLWall::Process etc.
float low1 = FIXED2FLOAT(lowplane.ZatPoint(vertexes[0]));
float low2 = FIXED2FLOAT(lowplane.ZatPoint(vertexes[1]));
float low1 = lowplane.ZatPoint(vertexes[0]);
float low2 = lowplane.ZatPoint(vertexes[1]);
if (low1 < ztop[0] || low2 < ztop[1])
{

View file

@ -185,7 +185,7 @@ void CheckBench()
compose.Format("Map %s: \"%s\",\nx = %1.4f, y = %1.4f, z = %1.4f, angle = %1.4f, pitch = %1.4f\n",
level.MapName.GetChars(), level.LevelName.GetChars(), FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz),
ANGLE2FLOAT(viewangle), ANGLE2FLOAT(viewpitch));
AngleToFloat(viewangle), AngleToFloat(viewpitch));
AppendRenderStats(compose);
AppendRenderTimes(compose);

View file

@ -104,7 +104,7 @@ typedef double vtype;
struct vertex_t
{
private:
//private:
fixed_t x, y;
public:
@ -998,15 +998,15 @@ struct sector_t
for (unsigned i = 0; i < e->XFloor.attached.Size(); i++) e->XFloor.attached[i]->SetVerticesDirty();
}
void SetPlaneTexZ(int pos, fixed_t val, bool dirtify = false) // This mainly gets used by init code. The only place where it must set the vertex to dirty is the interpolation code.
void SetPlaneTexZ(int pos, fixed_t val)
{
planes[pos].TexZ = val;
if (dirtify) SetAllVerticesDirty();
}
void SetPlaneTexZ(int pos, double val)
void SetPlaneTexZ(int pos, double val, bool dirtify = false) // This mainly gets used by init code. The only place where it must set the vertex to dirty is the interpolation code.
{
planes[pos].TexZ = FLOAT2FIXED(val);
if (dirtify) SetAllVerticesDirty();
}
void ChangePlaneTexZ(int pos, fixed_t val)

View file

@ -72,6 +72,11 @@ struct DVector3a
subsector_t *R_PointInSubsector (fixed_t x, fixed_t y);
inline subsector_t *R_PointInSubsector(const DVector2 &pos)
{
return R_PointInSubsector(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y));
}
fixed_t R_PointToDist2 (fixed_t dx, fixed_t dy);
void R_ResetViewInterpolation ();
void R_RebuildViewInterpolation(player_t *player);