diff --git a/src/gl/scene/gl_fakeflat.cpp b/src/gl/scene/gl_fakeflat.cpp index 57da91f634..29f2f52a30 100644 --- a/src/gl/scene/gl_fakeflat.cpp +++ b/src/gl/scene/gl_fakeflat.cpp @@ -87,7 +87,7 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto } else { - fs_ceilingheight2 = fs_ceilingheight1 = frontsector->ceilingplane.fixD(); + fs_ceilingheight2 = fs_ceilingheight1 = frontsector->ceilingplane.fD(); } if (frontsector->floorplane.isSlope()) @@ -97,7 +97,7 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto } else { - fs_floorheight2 = fs_floorheight1 = -frontsector->floorplane.fixD(); + fs_floorheight2 = fs_floorheight1 = -frontsector->floorplane.fD(); } if (backsector->ceilingplane.isSlope()) @@ -107,7 +107,7 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto } else { - bs_ceilingheight2 = bs_ceilingheight1 = backsector->ceilingplane.fixD(); + bs_ceilingheight2 = bs_ceilingheight1 = backsector->ceilingplane.fD(); } if (backsector->floorplane.isSlope()) @@ -117,7 +117,7 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto } else { - bs_floorheight2 = bs_floorheight1 = -backsector->floorplane.fixD(); + bs_floorheight2 = bs_floorheight1 = -backsector->floorplane.fD(); } // now check for closed sectors! diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 106d7adfb0..8e825ab5b9 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -78,31 +78,31 @@ static float tics; void gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * gltexture) { // only manipulate the texture matrix if needed. - if (secplane->xoffs != 0 || secplane->yoffs != 0 || - secplane->xscale != FRACUNIT || secplane->yscale != FRACUNIT || - secplane->angle != 0 || + if (!secplane->Offs.isZero() || + secplane->Scale.X != 1. || secplane->Scale.Y != 1 || + secplane->Angle != 0 || gltexture->TextureWidth() != 64 || gltexture->TextureHeight() != 64) { - float uoffs = FIXED2FLOAT(secplane->xoffs) / gltexture->TextureWidth(); - float voffs = FIXED2FLOAT(secplane->yoffs) / gltexture->TextureHeight(); + float uoffs = secplane->Offs.X / gltexture->TextureWidth(); + float voffs = secplane->Offs.Y / gltexture->TextureHeight(); - float xscale1=FIXED2FLOAT(secplane->xscale); - float yscale1=FIXED2FLOAT(secplane->yscale); + float xscale1 = secplane->Scale.X; + float yscale1 = secplane->Scale.Y; if (gltexture->tex->bHasCanvas) { yscale1 = 0 - yscale1; } - float angle=-AngleToFloat(secplane->angle); + float angle = -secplane->Angle; - float xscale2=64.f/gltexture->TextureWidth(); - float yscale2=64.f/gltexture->TextureHeight(); + float xscale2 = 64.f / gltexture->TextureWidth(); + float yscale2 = 64.f / gltexture->TextureHeight(); gl_RenderState.mTextureMatrix.loadIdentity(); - gl_RenderState.mTextureMatrix.scale(xscale1 ,yscale1,1.0f); - gl_RenderState.mTextureMatrix.translate(uoffs,voffs,0.0f); - gl_RenderState.mTextureMatrix.scale(xscale2 ,yscale2,1.0f); - gl_RenderState.mTextureMatrix.rotate(angle,0.0f,0.0f,1.0f); + gl_RenderState.mTextureMatrix.scale(xscale1, yscale1, 1.0f); + gl_RenderState.mTextureMatrix.translate(uoffs, voffs, 0.0f); + gl_RenderState.mTextureMatrix.scale(xscale2, yscale2, 1.0f); + gl_RenderState.mTextureMatrix.rotate(angle, 0.0f, 0.0f, 1.0f); gl_RenderState.EnableTextureMatrix(true); } } diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 6b47266e83..bc57674ca6 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -1115,7 +1115,7 @@ void GLHorizonPortal::DrawContents() gl_RenderState.SetCameraPos(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz)); - z=FIXED2FLOAT(sp->texheight); + z=sp->Texheight; if (gltexture && gltexture->tex->isFullbright()) @@ -1238,7 +1238,7 @@ void GLEEHorizonPortal::DrawContents() horz.colormap = origin->Sector->ColorMap; if (origin->special1 == SKYBOX_PLANE) { - horz.plane.texheight = viewz + abs(horz.plane.texheight); + horz.plane.Texheight = FIXED2FLOAT(viewz) + fabs(horz.plane.Texheight); } GLHorizonPortal ceil(&horz, true); ceil.DrawContents(); @@ -1251,7 +1251,7 @@ void GLEEHorizonPortal::DrawContents() horz.colormap = origin->Sector->ColorMap; if (origin->special1 == SKYBOX_PLANE) { - horz.plane.texheight = viewz - abs(horz.plane.texheight); + horz.plane.Texheight = FIXED2FLOAT(viewz) - fabs(horz.plane.Texheight); } GLHorizonPortal floor(&horz, true); floor.DrawContents(); diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index 864a0d2816..c04b90129b 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -173,8 +173,8 @@ void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect) } else if (allowreflect && sector->GetReflect(plane) > 0) { - if ((plane == sector_t::ceiling && viewz > sector->ceilingplane.fixD()) || - (plane == sector_t::floor && viewz < -sector->floorplane.fixD())) return; + if ((plane == sector_t::ceiling && FIXED2DBL(viewz) > sector->ceilingplane.fD()) || + (plane == sector_t::floor && FIXED2DBL(viewz) < -sector->floorplane.fD())) return; ptype = PORTALTYPE_PLANEMIRROR; planemirror = plane == sector_t::ceiling ? §or->ceilingplane : §or->floorplane; } diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index 91567ecb53..d71cccba54 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -72,21 +72,21 @@ struct GLSectorPlane { FTextureID texture; secplane_t plane; - fixed_t texheight; - fixed_t xoffs, yoffs; - fixed_t xscale, yscale; - angle_t angle; + float Texheight; + float Angle; + FVector2 Offs; + FVector2 Scale; void GetFromSector(sector_t * sec, int ceiling) { - xoffs = sec->GetXOffset(ceiling); - yoffs = sec->GetYOffset(ceiling); - xscale = sec->GetXScale(ceiling); - yscale = sec->GetYScale(ceiling); - angle = sec->GetAngle(ceiling); + Offs.X = (float)sec->GetXOffsetF(ceiling); + Offs.Y = (float)sec->GetYOffsetF(ceiling); + Scale.X = (float)sec->GetXScaleF(ceiling); + Scale.Y = (float)sec->GetYScaleF(ceiling); + Angle = (float)sec->GetAngleF(ceiling).Degrees; texture = sec->GetTexture(ceiling); plane = sec->GetSecPlane(ceiling); - texheight = (ceiling == sector_t::ceiling)? plane.fixD() : -plane.fixD(); + Texheight = (float)((ceiling == sector_t::ceiling)? plane.fD() : -plane.fD()); } }; diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 4a560e107a..590e7734fd 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -1110,11 +1110,11 @@ __forceinline void GLWall::GetPlanePos(F3DFloor::planeref *planeref, fixed_t &le } else if(planeref->isceiling == sector_t::ceiling) { - left = right = planeref->plane->fixD(); + left = right = FLOAT2FIXED(planeref->plane->fD()); } else { - left = right = -planeref->plane->fixD(); + left = right = -FLOAT2FIXED(planeref->plane->fD()); } } @@ -1459,7 +1459,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else { - ffh1 = ffh2 = -segfront->floorplane.fixD(); + ffh1 = ffh2 = -FLOAT2FIXED(segfront->floorplane.fD()); zfloor[0] = zfloor[1] = FIXED2FLOAT(ffh2); } @@ -1472,7 +1472,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else { - fch1 = fch2 = segfront->ceilingplane.fixD(); + fch1 = fch2 = FLOAT2FIXED(segfront->ceilingplane.fD()); zceil[0] = zceil[1] = FIXED2FLOAT(fch2); } @@ -1527,7 +1527,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else { - bfh1 = bfh2 = -segback->floorplane.fixD(); + bfh1 = bfh2 = -FLOAT2FIXED(segback->floorplane.fD()); } if (segback->ceilingplane.isSlope()) @@ -1537,7 +1537,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else { - bch1 = bch2 = segback->ceilingplane.fixD(); + bch1 = bch2 = FLOAT2FIXED(segback->ceilingplane.fD()); } SkyTop(seg, frontsector, backsector, v1, v2);