From 4ac373437543547923eb4e343e88ae0ba7cdf0b3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 7 Apr 2016 23:19:37 +0200 Subject: [PATCH] - floatified more of gl_wall.cpp. --- src/gl/scene/gl_wall.h | 22 +-- src/gl/scene/gl_walls.cpp | 305 +++++++++++++++++----------------- src/gl/unused/gl_sections.cpp | 12 +- 3 files changed, 173 insertions(+), 166 deletions(-) diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index 17c3c841f4..b71b194ef8 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -202,23 +202,23 @@ private: void DoMidTexture(seg_t * seg, bool drawfogboundary, sector_t * front, sector_t * back, sector_t * realfront, sector_t * realback, - fixed_t fch1, fixed_t fch2, fixed_t ffh1, fixed_t ffh2, - fixed_t bch1, fixed_t bch2, fixed_t bfh1, fixed_t bfh2); + float fch1, float fch2, float ffh1, float ffh2, + float bch1, float bch2, float bfh1, float bfh2); - void GetPlanePos(F3DFloor::planeref *planeref, fixed_t &left, fixed_t &right); + void GetPlanePos(F3DFloor::planeref * planeref, float & left, float & right); void BuildFFBlock(seg_t * seg, F3DFloor * rover, - fixed_t ff_topleft, fixed_t ff_topright, - fixed_t ff_bottomleft, fixed_t ff_bottomright); + float ff_topleft, float ff_topright, + float ff_bottomleft, float ff_bottomright); void InverseFloors(seg_t * seg, sector_t * frontsector, - fixed_t topleft, fixed_t topright, - fixed_t bottomleft, fixed_t bottomright); + float topleft, float topright, + float bottomleft, float bottomright); void ClipFFloors(seg_t * seg, F3DFloor * ffloor, sector_t * frontsector, - fixed_t topleft, fixed_t topright, - fixed_t bottomleft, fixed_t bottomright); + float topleft, float topright, + float bottomleft, float bottomright); void DoFFloorBlocks(seg_t * seg, sector_t * frontsector, sector_t * backsector, - fixed_t fch1, fixed_t fch2, fixed_t ffh1, fixed_t ffh2, - fixed_t bch1, fixed_t bch2, fixed_t bfh1, fixed_t bfh2); + float fch1, float fch2, float ffh1, float ffh2, + float bch1, float bch2, float bfh1, float bfh2); void DrawDecal(DBaseDecal *actor); void DoDrawDecals(); diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index a684185c64..0ce1eb304b 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -658,14 +658,14 @@ void GLWall::DoTexture(int _type,seg_t * seg, int peg, void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary, sector_t * front, sector_t * back, sector_t * realfront, sector_t * realback, - fixed_t fch1, fixed_t fch2, fixed_t ffh1, fixed_t ffh2, - fixed_t bch1, fixed_t bch2, fixed_t bfh1, fixed_t bfh2) + float fch1, float fch2, float ffh1, float ffh2, + float bch1, float bch2, float bfh1, float bfh2) { FTexCoordInfo tci; - fixed_t topleft,bottomleft,topright,bottomright; + float topleft,bottomleft,topright,bottomright; GLSeg glsave=glseg; - fixed_t texturetop, texturebottom; + float texturetop, texturebottom; bool wrap = (seg->linedef->flags&ML_WRAP_MIDTEX) || (seg->sidedef->Flags&WALLF_WRAP_MIDTEX); bool mirrory = false; @@ -686,16 +686,16 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary, tci.mRenderHeight = -tci.mRenderHeight; tci.mScaleY = -tci.mScaleY; } - fixed_t rowoffset = tci.RowOffset(seg->sidedef->GetTextureYOffset(side_t::mid)); + float rowoffset = FIXED2FLOAT(tci.RowOffset(seg->sidedef->GetTextureYOffset(side_t::mid))); if ((seg->linedef->flags & ML_DONTPEGBOTTOM) >0) { - texturebottom = MAX(realfront->GetPlaneTexZ(sector_t::floor), realback->GetPlaneTexZ(sector_t::floor)) + rowoffset; - texturetop = texturebottom + (tci.mRenderHeight << FRACBITS); + texturebottom = MAX(realfront->GetPlaneTexZF(sector_t::floor), realback->GetPlaneTexZF(sector_t::floor)) + rowoffset; + texturetop = texturebottom + tci.mRenderHeight; } else { - texturetop = MIN(realfront->GetPlaneTexZ(sector_t::ceiling), realback->GetPlaneTexZ(sector_t::ceiling)) + rowoffset; - texturebottom = texturetop - (tci.mRenderHeight << FRACBITS); + texturetop = MIN(realfront->GetPlaneTexZF(sector_t::ceiling), realback->GetPlaneTexZF(sector_t::ceiling)) + rowoffset; + texturebottom = texturetop - tci.mRenderHeight; } } else texturetop=texturebottom=0; @@ -804,22 +804,30 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary, // set up texture coordinate stuff // // - fixed_t t_ofs = seg->sidedef->GetTextureXOffset(side_t::mid); + float t_ofs = seg->sidedef->GetTextureXOffsetF(side_t::mid); if (gltexture) { // First adjust the texture offset so that the left edge of the linedef is inside the range [0..1]. - fixed_t texwidth = tci.TextureAdjustWidth()<= 0) + { + float div = t_ofs / texwidth; + t_ofs = (div - xs_FloorToInt(div)) * texwidth; + } + else + { + float div = (-t_ofs) / texwidth; + t_ofs = texwidth - (div - xs_FloorToInt(div)) * texwidth; + } // Now check whether the linedef is completely within the texture range of [0..1]. // If so we should use horizontal texture clamping to prevent filtering artifacts // at the edges. - fixed_t textureoffset = tci.TextureOffset(t_ofs); + fixed_t textureoffset = tci.TextureOffset(FLOAT2FIXED(t_ofs)); int righttex=(textureoffset>>FRACBITS)+seg->sidedef->TexelLength; if ((textureoffset == 0 && righttex <= tci.mRenderWidth) || @@ -841,7 +849,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary, tci.mRenderHeight = -tci.mRenderHeight; tci.mScaleY = -tci.mScaleY; } - SetWallCoordinates(seg, &tci, FIXED2FLOAT(texturetop), FIXED2FLOAT(topleft), FIXED2FLOAT(topright), FIXED2FLOAT(bottomleft), FIXED2FLOAT(bottomright), t_ofs); + SetWallCoordinates(seg, &tci, texturetop, topleft, topright, bottomleft, bottomright, FLOAT2FIXED(t_ofs)); // // @@ -976,15 +984,15 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary, // //========================================================================== void GLWall::BuildFFBlock(seg_t * seg, F3DFloor * rover, - fixed_t ff_topleft, fixed_t ff_topright, - fixed_t ff_bottomleft, fixed_t ff_bottomright) + float ff_topleft, float ff_topright, + float ff_bottomleft, float ff_bottomright) { side_t * mastersd = rover->master->sidedef[0]; float to; lightlist_t * light; bool translucent; - int savelight=lightlevel; - FColormap savecolor=Colormap; + int savelight = lightlevel; + FColormap savecolor = Colormap; float ul; float texlength; FTexCoordInfo tci; @@ -994,90 +1002,90 @@ void GLWall::BuildFFBlock(seg_t * seg, F3DFloor * rover, if (!gl_fixedcolormap) { // this may not yet be done - light=P_GetPlaneLight(rover->target, rover->top.plane,true); + light = P_GetPlaneLight(rover->target, rover->top.plane, true); Colormap.Clear(); - Colormap.LightColor=(light->extra_colormap)->Fade; + Colormap.LightColor = (light->extra_colormap)->Fade; // the fog plane defines the light level, not the front sector lightlevel = gl_ClampLight(*light->p_lightlevel); - gltexture=NULL; - type=RENDERWALL_FFBLOCK; + gltexture = NULL; + type = RENDERWALL_FFBLOCK; } else return; } else { - - if (rover->flags&FF_UPPERTEXTURE) + + if (rover->flags&FF_UPPERTEXTURE) { - gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::top), false, true); + gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::top), false, true); if (!gltexture) return; gltexture->GetTexCoordInfo(&tci, seg->sidedef->GetTextureXScale(side_t::top), seg->sidedef->GetTextureYScale(side_t::top)); } - else if (rover->flags&FF_LOWERTEXTURE) + else if (rover->flags&FF_LOWERTEXTURE) { gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::bottom), false, true); if (!gltexture) return; gltexture->GetTexCoordInfo(&tci, seg->sidedef->GetTextureXScale(side_t::bottom), seg->sidedef->GetTextureYScale(side_t::bottom)); } - else + else { gltexture = FMaterial::ValidateTexture(mastersd->GetTexture(side_t::mid), false, true); if (!gltexture) return; gltexture->GetTexCoordInfo(&tci, mastersd->GetTextureXScale(side_t::mid), mastersd->GetTextureYScale(side_t::mid)); } - - to=FIXED2FLOAT((rover->flags&(FF_UPPERTEXTURE|FF_LOWERTEXTURE))? + + to = FIXED2FLOAT((rover->flags&(FF_UPPERTEXTURE | FF_LOWERTEXTURE)) ? 0 : tci.TextureOffset(mastersd->GetTextureXOffset(side_t::mid))); - ul=tci.FloatToTexU(to + FIXED2FLOAT(tci.TextureOffset(seg->sidedef->GetTextureXOffset(side_t::mid)))); + ul = tci.FloatToTexU(to + FIXED2FLOAT(tci.TextureOffset(seg->sidedef->GetTextureXOffset(side_t::mid)))); texlength = tci.FloatToTexU(seg->sidedef->TexelLength); uplft.u = lolft.u = ul + texlength * glseg.fracleft; uprgt.u = lorgt.u = ul + texlength * glseg.fracright; - + fixed_t rowoffset = tci.RowOffset(seg->sidedef->GetTextureYOffset(side_t::mid)); - to= (rover->flags&(FF_UPPERTEXTURE|FF_LOWERTEXTURE))? - 0.f : FIXED2FLOAT(tci.RowOffset(mastersd->GetTextureYOffset(side_t::mid))); - + to = (rover->flags&(FF_UPPERTEXTURE | FF_LOWERTEXTURE)) ? + 0.f : FIXED2FLOAT(tci.RowOffset(mastersd->GetTextureYOffset(side_t::mid))); + to += FIXED2FLOAT(rowoffset) + rover->top.model->GetPlaneTexZF(rover->top.isceiling); - - uplft.v=tci.FloatToTexV(to + FIXED2FLOAT(-ff_topleft)); - uprgt.v=tci.FloatToTexV(to + FIXED2FLOAT(-ff_topright)); - lolft.v=tci.FloatToTexV(to + FIXED2FLOAT(-ff_bottomleft)); - lorgt.v=tci.FloatToTexV(to + FIXED2FLOAT(-ff_bottomright)); - type=RENDERWALL_FFBLOCK; + + uplft.v = tci.FloatToTexV(to - ff_topleft); + uprgt.v = tci.FloatToTexV(to - ff_topright); + lolft.v = tci.FloatToTexV(to - ff_bottomleft); + lorgt.v = tci.FloatToTexV(to - ff_bottomright); + type = RENDERWALL_FFBLOCK; CheckTexturePosition(); } - ztop[0]=FIXED2FLOAT(ff_topleft); - ztop[1]=FIXED2FLOAT(ff_topright); - zbottom[0]=FIXED2FLOAT(ff_bottomleft);//-0.001f; - zbottom[1]=FIXED2FLOAT(ff_bottomright); + ztop[0] = ff_topleft; + ztop[1] = ff_topright; + zbottom[0] = ff_bottomleft;//-0.001f; + zbottom[1] = ff_bottomright; - if (rover->flags&(FF_TRANSLUCENT|FF_ADDITIVETRANS|FF_FOG)) + if (rover->flags&(FF_TRANSLUCENT | FF_ADDITIVETRANS | FF_FOG)) { - alpha=rover->alpha/255.0f; - RenderStyle = (rover->flags&FF_ADDITIVETRANS)? STYLE_Add : STYLE_Translucent; - translucent=true; - type=gltexture? RENDERWALL_M2S:RENDERWALL_COLOR; + alpha = rover->alpha / 255.0f; + RenderStyle = (rover->flags&FF_ADDITIVETRANS) ? STYLE_Add : STYLE_Translucent; + translucent = true; + type = gltexture ? RENDERWALL_M2S : RENDERWALL_COLOR; } - else + else { - alpha=1.0f; - RenderStyle=STYLE_Normal; - translucent=false; + alpha = 1.0f; + RenderStyle = STYLE_Normal; + translucent = false; } - - sector_t * sec = sub? sub->sector : seg->frontsector; - if (sec->e->XFloor.lightlist.Size()==0 || gl_fixedcolormap) PutWall(translucent); + sector_t * sec = sub ? sub->sector : seg->frontsector; + + if (sec->e->XFloor.lightlist.Size() == 0 || gl_fixedcolormap) PutWall(translucent); else SplitWall(sec, translucent); - alpha=1.0f; + alpha = 1.0f; lightlevel = savelight; Colormap = savecolor; - flags&=~GLT_CLAMPY; + flags &= ~GLT_CLAMPY; } @@ -1087,10 +1095,10 @@ void GLWall::BuildFFBlock(seg_t * seg, F3DFloor * rover, // //========================================================================== -__forceinline void GLWall::GetPlanePos(F3DFloor::planeref *planeref, fixed_t &left, fixed_t &right) +__forceinline void GLWall::GetPlanePos(F3DFloor::planeref *planeref, float &left, float &right) { - left=planeref->plane->ZatPointFixed(vertexes[0]); - right=planeref->plane->ZatPointFixed(vertexes[1]); + left=planeref->plane->ZatPoint(vertexes[0]); + right=planeref->plane->ZatPoint(vertexes[1]); } //========================================================================== @@ -1099,49 +1107,48 @@ __forceinline void GLWall::GetPlanePos(F3DFloor::planeref *planeref, fixed_t &le // //========================================================================== void GLWall::InverseFloors(seg_t * seg, sector_t * frontsector, - fixed_t topleft, fixed_t topright, - fixed_t bottomleft, fixed_t bottomright) + float topleft, float topright, + float bottomleft, float bottomright) { - TArray & frontffloors=frontsector->e->XFloor.ffloors; + TArray & frontffloors = frontsector->e->XFloor.ffloors; - for(unsigned int i=0;iflags&FF_EXISTS)) continue; if (!(rover->flags&FF_RENDERSIDES)) continue; - if (!(rover->flags&(FF_INVERTSIDES|FF_ALLSIDES))) continue; + if (!(rover->flags&(FF_INVERTSIDES | FF_ALLSIDES))) continue; - fixed_t ff_topleft; - fixed_t ff_topright; - fixed_t ff_bottomleft; - fixed_t ff_bottomright; + float ff_topleft; + float ff_topright; + float ff_bottomleft; + float ff_bottomright; GetPlanePos(&rover->top, ff_topleft, ff_topright); GetPlanePos(&rover->bottom, ff_bottomleft, ff_bottomright); // above ceiling - if (ff_bottomleft>topleft && ff_bottomright>topright) continue; + if (ff_bottomleft > topleft && ff_bottomright > topright) continue; - if (ff_topleft>topleft && ff_topright>topright) + if (ff_topleft > topleft && ff_topright > topright) { // the new section overlaps with the previous one - clip it! - ff_topleft=topleft; - ff_topright=topright; + ff_topleft = topleft; + ff_topright = topright; } - if (ff_bottomleft & frontffloors=frontsector->e->XFloor.ffloors; + TArray & frontffloors = frontsector->e->XFloor.ffloors; - int flags = ffloor->flags & (FF_SWIMMABLE|FF_TRANSLUCENT); + int flags = ffloor->flags & (FF_SWIMMABLE | FF_TRANSLUCENT); - for(unsigned int i=0;iflags&FF_EXISTS)) continue; if (!(rover->flags&FF_RENDERSIDES)) continue; - if ((rover->flags&(FF_SWIMMABLE|FF_TRANSLUCENT))!=flags) continue; + if ((rover->flags&(FF_SWIMMABLE | FF_TRANSLUCENT)) != flags) continue; - fixed_t ff_topleft; - fixed_t ff_topright; - fixed_t ff_bottomleft; - fixed_t ff_bottomright; + float ff_topleft; + float ff_topright; + float ff_bottomleft; + float ff_bottomright; GetPlanePos(&rover->top, ff_topleft, ff_topright); // we are completely below the bottom so unless there are some // (unsupported) intersections there won't be any more floors that // could clip this one. - if (ff_topleftbottom, ff_bottomleft, ff_bottomright); // above top line? - if (ff_bottomleft>topleft && ff_bottomright>topright) continue; + if (ff_bottomleft > topleft && ff_bottomright > topright) continue; // overlapping the top line - if (ff_topleft>=topleft && ff_topright>=topright) + if (ff_topleft >= topleft && ff_topright >= topright) { // overlapping with the entire range - if (ff_bottomleft<=bottomleft && ff_bottomright<=bottomright) return; - else if (ff_bottomleft>bottomleft && ff_bottomright>bottomright) + if (ff_bottomleft <= bottomleft && ff_bottomright <= bottomright) return; + else if (ff_bottomleft > bottomleft && ff_bottomright > bottomright) { - topleft=ff_bottomleft; - topright=ff_bottomright; + topleft = ff_bottomleft; + topright = ff_bottomright; } else { @@ -1197,12 +1204,12 @@ void GLWall::ClipFFloors(seg_t * seg, F3DFloor * ffloor, sector_t * frontsector, // I don't need this right now. } } - else if (ff_topleft<=topleft && ff_topright<=topright) + else if (ff_topleft <= topleft && ff_topright <= topright) { BuildFFBlock(seg, ffloor, topleft, topright, ff_topleft, ff_topright); - if (ff_bottomleft<=bottomleft && ff_bottomright<=bottomright) return; - topleft=ff_bottomleft; - topright=ff_bottomright; + if (ff_bottomleft <= bottomleft && ff_bottomright <= bottomright) return; + topleft = ff_bottomleft; + topright = ff_bottomright; } else { @@ -1222,85 +1229,85 @@ done: // // //========================================================================== -void GLWall::DoFFloorBlocks(seg_t * seg,sector_t * frontsector,sector_t * backsector, - fixed_t fch1, fixed_t fch2, fixed_t ffh1, fixed_t ffh2, - fixed_t bch1, fixed_t bch2, fixed_t bfh1, fixed_t bfh2) +void GLWall::DoFFloorBlocks(seg_t * seg, sector_t * frontsector, sector_t * backsector, + float fch1, float fch2, float ffh1, float ffh2, + float bch1, float bch2, float bfh1, float bfh2) { - TArray & backffloors=backsector->e->XFloor.ffloors; - fixed_t topleft, topright, bottomleft, bottomright; - bool renderedsomething=false; + TArray & backffloors = backsector->e->XFloor.ffloors; + float topleft, topright, bottomleft, bottomright; + bool renderedsomething = false; // if the ceilings intersect use the backsector's height because this sector's ceiling will // obstruct the redundant parts. - if (fch1bfh1 && ffh2>bfh2) + if (ffh1 > bfh1 && ffh2 > bfh2) { - bottomleft=ffh1; - bottomright=ffh2; + bottomleft = ffh1; + bottomright = ffh2; } else { - bottomleft=bfh1; - bottomright=bfh2; + bottomleft = bfh1; + bottomright = bfh2; } - for(unsigned int i=0;iflags&FF_EXISTS)) continue; if (!(rover->flags&FF_RENDERSIDES) || (rover->flags&FF_INVERTSIDES)) continue; - fixed_t ff_topleft; - fixed_t ff_topright; - fixed_t ff_bottomleft; - fixed_t ff_bottomright; + float ff_topleft; + float ff_topright; + float ff_bottomleft; + float ff_bottomright; GetPlanePos(&rover->top, ff_topleft, ff_topright); GetPlanePos(&rover->bottom, ff_bottomleft, ff_bottomright); // completely above ceiling - if (ff_bottomleft>topleft && ff_bottomright>topright && !renderedsomething) continue; + if (ff_bottomleft > topleft && ff_bottomright > topright && !renderedsomething) continue; - if (ff_topleft>topleft && ff_topright>topright) + if (ff_topleft > topleft && ff_topright > topright) { // the new section overlaps with the previous one - clip it! - ff_topleft=topleft; - ff_topright=topright; + ff_topleft = topleft; + ff_topright = topright; } // do all inverse floors above the current one it there is a gap between the // last 3D floor and this one. - if (topleft>ff_topleft && topright>ff_topright) + if (topleft > ff_topleft && topright > ff_topright) InverseFloors(seg, frontsector, topleft, topright, ff_topleft, ff_topright); // if translucent or liquid clip away adjoining parts of the same type of FFloors on the other side - if (rover->flags&(FF_SWIMMABLE|FF_TRANSLUCENT)) + if (rover->flags&(FF_SWIMMABLE | FF_TRANSLUCENT)) ClipFFloors(seg, rover, frontsector, ff_topleft, ff_topright, ff_bottomleft, ff_bottomright); else BuildFFBlock(seg, rover, ff_topleft, ff_topright, ff_bottomleft, ff_bottomright); - topleft=ff_bottomleft; - topright=ff_bottomright; - renderedsomething=true; - if (topleft<=bottomleft && topright<=bottomright) return; + topleft = ff_bottomleft; + topright = ff_bottomright; + renderedsomething = true; + if (topleft <= bottomleft && topright <= bottomright) return; } // draw all inverse floors below the lowest one if (frontsector->e->XFloor.ffloors.Size() > 0) { - if (topleft>bottomleft || topright>bottomright) + if (topleft > bottomleft || topright > bottomright) InverseFloors(seg, frontsector, topleft, topright, bottomleft, bottomright); } } @@ -1323,7 +1330,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) sector_t * segback; #ifdef _DEBUG - if (seg->linedef-lines==904) + if (seg->linedef - lines == 904) { int a = 0; } @@ -1470,7 +1477,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) float bfh2 = segback->floorplane.ZatPoint(v2); float bch1 = segback->ceilingplane.ZatPoint(v1); float bch2 = segback->ceilingplane.ZatPoint(v2); - + SkyTop(seg, frontsector, backsector, v1, v2); SkyBottom(seg, frontsector, backsector, v1, v2); @@ -1540,7 +1547,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) if (gltexture || drawfogboundary) { DoMidTexture(seg, drawfogboundary, frontsector, backsector, realfront, realback, - FLOAT2FIXED(fch1), FLOAT2FIXED(fch2), FLOAT2FIXED(ffh1), FLOAT2FIXED(ffh2), FLOAT2FIXED(bch1), FLOAT2FIXED(bch2), FLOAT2FIXED(bfh1), FLOAT2FIXED(bfh2)); + fch1, fch2, ffh1, ffh2, bch1, bch2, bfh1, bfh2); } if (seg->linedef->isVisualPortal() && seg->sidedef == seg->linedef->sidedef[0]) @@ -1554,7 +1561,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else if (backsector->e->XFloor.ffloors.Size() || frontsector->e->XFloor.ffloors.Size()) { - DoFFloorBlocks(seg, frontsector, backsector, FLOAT2FIXED(fch1), FLOAT2FIXED(fch2), FLOAT2FIXED(ffh1), FLOAT2FIXED(ffh2), FLOAT2FIXED(bch1), FLOAT2FIXED(bch2), FLOAT2FIXED(bfh1), FLOAT2FIXED(bfh2)); + DoFFloorBlocks(seg, frontsector, backsector, fch1, fch2, ffh1, ffh2, bch1, bch2, bfh1, bfh2); } /* bottom texture */ @@ -1565,7 +1572,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) bfh2 = fch2; } - if (bfh1>ffh1 || bfh2>ffh2) + if (bfh1 > ffh1 || bfh2 > ffh2) { gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::bottom), false, true); if (gltexture) @@ -1617,8 +1624,8 @@ void GLWall::ProcessLowerMiniseg(seg_t *seg, sector_t * frontsector, sector_t * if (frontsector->GetTexture(sector_t::floor) == skyflatnum) return; lightlist = NULL; - fixed_t ffh = frontsector->GetPlaneTexZ(sector_t::floor); - fixed_t bfh = backsector->GetPlaneTexZ(sector_t::floor); + float ffh = frontsector->GetPlaneTexZF(sector_t::floor); + float bfh = backsector->GetPlaneTexZF(sector_t::floor); if (bfh > ffh) { this->seg = seg; @@ -1652,7 +1659,7 @@ void GLWall::ProcessLowerMiniseg(seg_t *seg, sector_t * frontsector, sector_t * bottomplane = frontsector->floorplane; dynlightindex = UINT_MAX; - zfloor[0] = zfloor[1] = FIXED2FLOAT(ffh); + zfloor[0] = zfloor[1] = ffh; gltexture = FMaterial::ValidateTexture(frontsector->GetTexture(sector_t::floor), false, true); @@ -1661,7 +1668,7 @@ void GLWall::ProcessLowerMiniseg(seg_t *seg, sector_t * frontsector, sector_t * FTexCoordInfo tci; type = RENDERWALL_BOTTOM; gltexture->GetTexCoordInfo(&tci, FRACUNIT, FRACUNIT); - SetWallCoordinates(seg, &tci, FIXED2FLOAT(bfh), FIXED2FLOAT(bfh), FIXED2FLOAT(bfh), FIXED2FLOAT(ffh), FIXED2FLOAT(ffh), 0); + SetWallCoordinates(seg, &tci, bfh, bfh, bfh, ffh, ffh, 0); PutWall(false); } } diff --git a/src/gl/unused/gl_sections.cpp b/src/gl/unused/gl_sections.cpp index b39db02925..34858bd3a6 100644 --- a/src/gl/unused/gl_sections.cpp +++ b/src/gl/unused/gl_sections.cpp @@ -735,12 +735,12 @@ void DumpSection(int no, FGLSection *sect) { vertex_t *v1 = V1(ln->sidedef); vertex_t *v2 = V2(ln->sidedef); - double dx = FIXED2FLOAT(v2->x-v1->x); - double dy = FIXED2FLOAT(v2->y-v1->y); - double dx1 = FIXED2FLOAT(ln->start->x-v1->x); - double dy1 = FIXED2FLOAT(ln->start->y-v1->y); - double dx2 = FIXED2FLOAT(ln->end->x-v1->x); - double dy2 = FIXED2FLOAT(ln->end->y-v1->y); + double dx = FIXED2DBL(v2->x-v1->x); + double dy = FIXED2DBL(v2->y-v1->y); + double dx1 = FIXED2DBL(ln->start->x-v1->x); + double dy1 = FIXED2DBL(ln->start->y-v1->y); + double dx2 = FIXED2DBL(ln->end->x-v1->x); + double dy2 = FIXED2DBL(ln->end->y-v1->y); double d = sqrt(dx*dx+dy*dy); double d1 = sqrt(dx1*dx1+dy1*dy1); double d2 = sqrt(dx2*dx2+dy2*dy2);