mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- floatified the remaining parts of gl_walls.cpp.
This commit is contained in:
parent
4ac3734375
commit
eaf055dff4
6 changed files with 50 additions and 50 deletions
|
@ -191,13 +191,13 @@ private:
|
||||||
bool DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2);
|
bool DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2);
|
||||||
|
|
||||||
bool SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float ceilingrefheight,
|
bool SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float ceilingrefheight,
|
||||||
float topleft, float topright, float bottomleft, float bottomright, fixed_t t_ofs);
|
float topleft, float topright, float bottomleft, float bottomright, float t_ofs);
|
||||||
|
|
||||||
void DoTexture(int type,seg_t * seg,int peg,
|
void DoTexture(int type,seg_t * seg,int peg,
|
||||||
fixed_t ceilingrefheight,fixed_t floorrefheight,
|
float ceilingrefheight, float floorrefheight,
|
||||||
float CeilingHeightstart,float CeilingHeightend,
|
float CeilingHeightstart,float CeilingHeightend,
|
||||||
float FloorHeightstart,float FloorHeightend,
|
float FloorHeightstart,float FloorHeightend,
|
||||||
fixed_t v_offset);
|
float v_offset);
|
||||||
|
|
||||||
void DoMidTexture(seg_t * seg, bool drawfogboundary,
|
void DoMidTexture(seg_t * seg, bool drawfogboundary,
|
||||||
sector_t * front, sector_t * back,
|
sector_t * front, sector_t * back,
|
||||||
|
|
|
@ -428,7 +428,7 @@ bool GLWall::DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float texturetop,
|
bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float texturetop,
|
||||||
float topleft, float topright, float bottomleft, float bottomright, fixed_t t_ofs)
|
float topleft, float topright, float bottomleft, float bottomright, float t_ofs)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -442,7 +442,7 @@ bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float textureto
|
||||||
{
|
{
|
||||||
float length = seg->sidedef ? seg->sidedef->TexelLength : Dist2(glseg.x1, glseg.y1, glseg.x2, glseg.y2);
|
float length = seg->sidedef ? seg->sidedef->TexelLength : Dist2(glseg.x1, glseg.y1, glseg.x2, glseg.y2);
|
||||||
|
|
||||||
l_ul = tci->FloatToTexU(FIXED2FLOAT(tci->TextureOffset(t_ofs)));
|
l_ul = tci->FloatToTexU(tci->TextureOffset(t_ofs));
|
||||||
texlength = tci->FloatToTexU(length);
|
texlength = tci->FloatToTexU(length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -593,16 +593,16 @@ void GLWall::CheckTexturePosition()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
void GLWall::DoTexture(int _type,seg_t * seg, int peg,
|
void GLWall::DoTexture(int _type,seg_t * seg, int peg,
|
||||||
fixed_t ceilingrefheight,fixed_t floorrefheight,
|
float ceilingrefheight,float floorrefheight,
|
||||||
float topleft,float topright,
|
float topleft,float topright,
|
||||||
float bottomleft,float bottomright,
|
float bottomleft,float bottomright,
|
||||||
fixed_t v_offset)
|
float v_offset)
|
||||||
{
|
{
|
||||||
if (topleft<=bottomleft && topright<=bottomright) return;
|
if (topleft<=bottomleft && topright<=bottomright) return;
|
||||||
|
|
||||||
// The Vertex values can be destroyed in this function and must be restored aferward!
|
// The Vertex values can be destroyed in this function and must be restored aferward!
|
||||||
GLSeg glsave=glseg;
|
GLSeg glsave=glseg;
|
||||||
int lh=ceilingrefheight-floorrefheight;
|
float flh=ceilingrefheight-floorrefheight;
|
||||||
int texpos;
|
int texpos;
|
||||||
|
|
||||||
switch (_type)
|
switch (_type)
|
||||||
|
@ -624,11 +624,11 @@ void GLWall::DoTexture(int _type,seg_t * seg, int peg,
|
||||||
|
|
||||||
type = _type;
|
type = _type;
|
||||||
|
|
||||||
float floatceilingref = FIXED2FLOAT(ceilingrefheight + tci.RowOffset(seg->sidedef->GetTextureYOffset(texpos)));
|
float floatceilingref = ceilingrefheight + tci.RowOffset(seg->sidedef->GetTextureYOffsetF(texpos));
|
||||||
if (peg) floatceilingref += tci.mRenderHeight - FIXED2FLOAT(lh + v_offset);
|
if (peg) floatceilingref += tci.mRenderHeight - flh - v_offset;
|
||||||
|
|
||||||
if (!SetWallCoordinates(seg, &tci, floatceilingref, topleft, topright, bottomleft, bottomright,
|
if (!SetWallCoordinates(seg, &tci, floatceilingref, topleft, topright, bottomleft, bottomright,
|
||||||
seg->sidedef->GetTextureXOffset(texpos))) return;
|
seg->sidedef->GetTextureXOffsetF(texpos))) return;
|
||||||
|
|
||||||
if (seg->linedef->special == Line_Mirror && _type == RENDERWALL_M1S && gl_mirrors)
|
if (seg->linedef->special == Line_Mirror && _type == RENDERWALL_M1S && gl_mirrors)
|
||||||
{
|
{
|
||||||
|
@ -686,7 +686,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
|
||||||
tci.mRenderHeight = -tci.mRenderHeight;
|
tci.mRenderHeight = -tci.mRenderHeight;
|
||||||
tci.mScaleY = -tci.mScaleY;
|
tci.mScaleY = -tci.mScaleY;
|
||||||
}
|
}
|
||||||
float rowoffset = FIXED2FLOAT(tci.RowOffset(seg->sidedef->GetTextureYOffset(side_t::mid)));
|
float rowoffset = tci.RowOffset(seg->sidedef->GetTextureYOffsetF(side_t::mid));
|
||||||
if ((seg->linedef->flags & ML_DONTPEGBOTTOM) >0)
|
if ((seg->linedef->flags & ML_DONTPEGBOTTOM) >0)
|
||||||
{
|
{
|
||||||
texturebottom = MAX(realfront->GetPlaneTexZF(sector_t::floor), realback->GetPlaneTexZF(sector_t::floor)) + rowoffset;
|
texturebottom = MAX(realfront->GetPlaneTexZF(sector_t::floor), realback->GetPlaneTexZF(sector_t::floor)) + rowoffset;
|
||||||
|
@ -827,8 +827,8 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
|
||||||
// If so we should use horizontal texture clamping to prevent filtering artifacts
|
// If so we should use horizontal texture clamping to prevent filtering artifacts
|
||||||
// at the edges.
|
// at the edges.
|
||||||
|
|
||||||
fixed_t textureoffset = tci.TextureOffset(FLOAT2FIXED(t_ofs));
|
float textureoffset = tci.TextureOffset(t_ofs);
|
||||||
int righttex=(textureoffset>>FRACBITS)+seg->sidedef->TexelLength;
|
int righttex = int(textureoffset) + seg->sidedef->TexelLength;
|
||||||
|
|
||||||
if ((textureoffset == 0 && righttex <= tci.mRenderWidth) ||
|
if ((textureoffset == 0 && righttex <= tci.mRenderWidth) ||
|
||||||
(textureoffset >= 0 && righttex == tci.mRenderWidth))
|
(textureoffset >= 0 && righttex == tci.mRenderWidth))
|
||||||
|
@ -849,7 +849,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
|
||||||
tci.mRenderHeight = -tci.mRenderHeight;
|
tci.mRenderHeight = -tci.mRenderHeight;
|
||||||
tci.mScaleY = -tci.mScaleY;
|
tci.mScaleY = -tci.mScaleY;
|
||||||
}
|
}
|
||||||
SetWallCoordinates(seg, &tci, texturetop, topleft, topright, bottomleft, bottomright, FLOAT2FIXED(t_ofs));
|
SetWallCoordinates(seg, &tci, texturetop, topleft, topright, bottomleft, bottomright, t_ofs);
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -1034,21 +1034,20 @@ void GLWall::BuildFFBlock(seg_t * seg, F3DFloor * rover,
|
||||||
gltexture->GetTexCoordInfo(&tci, mastersd->GetTextureXScale(side_t::mid), mastersd->GetTextureYScale(side_t::mid));
|
gltexture->GetTexCoordInfo(&tci, mastersd->GetTextureXScale(side_t::mid), mastersd->GetTextureYScale(side_t::mid));
|
||||||
}
|
}
|
||||||
|
|
||||||
to = FIXED2FLOAT((rover->flags&(FF_UPPERTEXTURE | FF_LOWERTEXTURE)) ?
|
to = (rover->flags&(FF_UPPERTEXTURE | FF_LOWERTEXTURE)) ? 0 : tci.TextureOffset(mastersd->GetTextureXOffsetF(side_t::mid));
|
||||||
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 + tci.TextureOffset(seg->sidedef->GetTextureXOffsetF(side_t::mid)));
|
||||||
|
|
||||||
texlength = tci.FloatToTexU(seg->sidedef->TexelLength);
|
texlength = tci.FloatToTexU(seg->sidedef->TexelLength);
|
||||||
|
|
||||||
uplft.u = lolft.u = ul + texlength * glseg.fracleft;
|
uplft.u = lolft.u = ul + texlength * glseg.fracleft;
|
||||||
uprgt.u = lorgt.u = ul + texlength * glseg.fracright;
|
uprgt.u = lorgt.u = ul + texlength * glseg.fracright;
|
||||||
|
|
||||||
fixed_t rowoffset = tci.RowOffset(seg->sidedef->GetTextureYOffset(side_t::mid));
|
float rowoffset = tci.RowOffset(seg->sidedef->GetTextureYOffsetF(side_t::mid));
|
||||||
to = (rover->flags&(FF_UPPERTEXTURE | FF_LOWERTEXTURE)) ?
|
to = (rover->flags&(FF_UPPERTEXTURE | FF_LOWERTEXTURE)) ?
|
||||||
0.f : FIXED2FLOAT(tci.RowOffset(mastersd->GetTextureYOffset(side_t::mid)));
|
0.f : tci.RowOffset(mastersd->GetTextureYOffsetF(side_t::mid));
|
||||||
|
|
||||||
to += FIXED2FLOAT(rowoffset) + rover->top.model->GetPlaneTexZF(rover->top.isceiling);
|
to += rowoffset + rover->top.model->GetPlaneTexZF(rover->top.isceiling);
|
||||||
|
|
||||||
uplft.v = tci.FloatToTexV(to - ff_topleft);
|
uplft.v = tci.FloatToTexV(to - ff_topleft);
|
||||||
uprgt.v = tci.FloatToTexV(to - ff_topright);
|
uprgt.v = tci.FloatToTexV(to - ff_topright);
|
||||||
|
@ -1324,6 +1323,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
float ffh1;
|
float ffh1;
|
||||||
float fch2;
|
float fch2;
|
||||||
float ffh2;
|
float ffh2;
|
||||||
|
float frefz, crefz;
|
||||||
sector_t * realfront;
|
sector_t * realfront;
|
||||||
sector_t * realback;
|
sector_t * realback;
|
||||||
sector_t * segfront;
|
sector_t * segfront;
|
||||||
|
@ -1354,6 +1354,8 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
segfront = frontsector;
|
segfront = frontsector;
|
||||||
segback = backsector;
|
segback = backsector;
|
||||||
}
|
}
|
||||||
|
frefz = realfront->GetPlaneTexZF(sector_t::floor);
|
||||||
|
crefz = realfront->GetPlaneTexZF(sector_t::ceiling);
|
||||||
|
|
||||||
if (seg->sidedef == seg->linedef->sidedef[0])
|
if (seg->sidedef == seg->linedef->sidedef[0])
|
||||||
{
|
{
|
||||||
|
@ -1466,7 +1468,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
if (gltexture)
|
if (gltexture)
|
||||||
{
|
{
|
||||||
DoTexture(RENDERWALL_M1S, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
DoTexture(RENDERWALL_M1S, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||||
realfront->GetPlaneTexZ(sector_t::ceiling), realfront->GetPlaneTexZ(sector_t::floor), // must come from the original!
|
crefz, frefz, // must come from the original!
|
||||||
fch1, fch2, ffh1, ffh2, 0);
|
fch1, fch2, ffh1, ffh2, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1501,7 +1503,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
if (gltexture)
|
if (gltexture)
|
||||||
{
|
{
|
||||||
DoTexture(RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0,
|
DoTexture(RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0,
|
||||||
realfront->GetPlaneTexZ(sector_t::ceiling), realback->GetPlaneTexZ(sector_t::ceiling),
|
frefz, crefz,
|
||||||
fch1, fch2, bch1a, bch2a, 0);
|
fch1, fch2, bch1a, bch2a, 0);
|
||||||
}
|
}
|
||||||
else if (!(seg->sidedef->Flags & WALLF_POLYOBJ))
|
else if (!(seg->sidedef->Flags & WALLF_POLYOBJ))
|
||||||
|
@ -1514,7 +1516,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
if (gltexture)
|
if (gltexture)
|
||||||
{
|
{
|
||||||
DoTexture(RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0,
|
DoTexture(RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0,
|
||||||
realfront->GetPlaneTexZ(sector_t::ceiling), realback->GetPlaneTexZ(sector_t::ceiling),
|
frefz, crefz,
|
||||||
fch1, fch2, bch1a, bch2a, 0);
|
fch1, fch2, bch1a, bch2a, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1523,7 +1525,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
// skip processing if the back is a malformed subsector
|
// skip processing if the back is a malformed subsector
|
||||||
if (seg->PartnerSeg != NULL && !(seg->PartnerSeg->Subsector->hacked & 4))
|
if (seg->PartnerSeg != NULL && !(seg->PartnerSeg->Subsector->hacked & 4))
|
||||||
{
|
{
|
||||||
gl_drawinfo->AddUpperMissingTexture(seg->sidedef, sub, bch1a);
|
gl_drawinfo->AddUpperMissingTexture(seg->sidedef, sub, FLOAT2FIXED(bch1a));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1578,11 +1580,11 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
if (gltexture)
|
if (gltexture)
|
||||||
{
|
{
|
||||||
DoTexture(RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
DoTexture(RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||||
realback->GetPlaneTexZ(sector_t::floor), realfront->GetPlaneTexZ(sector_t::floor),
|
frefz, crefz,
|
||||||
bfh1, bfh2, ffh1, ffh2,
|
bfh1, bfh2, ffh1, ffh2,
|
||||||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum && backsector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
frontsector->GetTexture(sector_t::ceiling) == skyflatnum && backsector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
||||||
realfront->GetPlaneTexZ(sector_t::floor) - realback->GetPlaneTexZ(sector_t::ceiling) :
|
frefz - realback->GetPlaneTexZF(sector_t::ceiling) :
|
||||||
realfront->GetPlaneTexZ(sector_t::floor) - realfront->GetPlaneTexZ(sector_t::ceiling));
|
frefz - crefz);
|
||||||
}
|
}
|
||||||
else if (!(seg->sidedef->Flags & WALLF_POLYOBJ))
|
else if (!(seg->sidedef->Flags & WALLF_POLYOBJ))
|
||||||
{
|
{
|
||||||
|
@ -1597,8 +1599,8 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
if (gltexture)
|
if (gltexture)
|
||||||
{
|
{
|
||||||
DoTexture(RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
DoTexture(RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||||
realback->GetPlaneTexZ(sector_t::floor), realfront->GetPlaneTexZ(sector_t::floor),
|
realback->GetPlaneTexZF(sector_t::floor), frefz,
|
||||||
bfh1, bfh2, ffh1, ffh2, realfront->GetPlaneTexZ(sector_t::floor) - realfront->GetPlaneTexZ(sector_t::ceiling));
|
bfh1, bfh2, ffh1, ffh2, frefz - crefz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (backsector->GetTexture(sector_t::floor) != skyflatnum)
|
else if (backsector->GetTexture(sector_t::floor) != skyflatnum)
|
||||||
|
@ -1606,7 +1608,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||||
// skip processing if the back is a malformed subsector
|
// skip processing if the back is a malformed subsector
|
||||||
if (seg->PartnerSeg != NULL && !(seg->PartnerSeg->Subsector->hacked & 4))
|
if (seg->PartnerSeg != NULL && !(seg->PartnerSeg->Subsector->hacked & 4))
|
||||||
{
|
{
|
||||||
gl_drawinfo->AddLowerMissingTexture(seg->sidedef, sub, bfh1);
|
gl_drawinfo->AddLowerMissingTexture(seg->sidedef, sub, FLOAT2FIXED(bfh1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,17 +327,17 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
fixed_t FTexCoordInfo::RowOffset(fixed_t rowoffset) const
|
float FTexCoordInfo::RowOffset(float rowoffset) const
|
||||||
{
|
{
|
||||||
if (mTempScaleY == FRACUNIT)
|
if (mTempScaleY == FRACUNIT)
|
||||||
{
|
{
|
||||||
if (mScaleY==FRACUNIT || mWorldPanning) return rowoffset;
|
if (mScaleY==FRACUNIT || mWorldPanning) return rowoffset;
|
||||||
else return FixedDiv(rowoffset, mScaleY);
|
else return rowoffset * FIXED2FLOAT(mScaleY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mWorldPanning) return FixedDiv(rowoffset, mTempScaleY);
|
if (mWorldPanning) return rowoffset * FIXED2FLOAT(mTempScaleY);
|
||||||
else return FixedDiv(rowoffset, mScaleY);
|
else return rowoffset * FIXED2FLOAT(mScaleY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,17 +347,17 @@ fixed_t FTexCoordInfo::RowOffset(fixed_t rowoffset) const
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
fixed_t FTexCoordInfo::TextureOffset(fixed_t textureoffset) const
|
float FTexCoordInfo::TextureOffset(float textureoffset) const
|
||||||
{
|
{
|
||||||
if (mTempScaleX == FRACUNIT)
|
if (mTempScaleX == FRACUNIT)
|
||||||
{
|
{
|
||||||
if (mScaleX==FRACUNIT || mWorldPanning) return textureoffset;
|
if (mScaleX==FRACUNIT || mWorldPanning) return textureoffset;
|
||||||
else return FixedDiv(textureoffset, mScaleX);
|
else return textureoffset * FIXED2FLOAT(mScaleX);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mWorldPanning) return FixedDiv(textureoffset, mTempScaleX);
|
if (mWorldPanning) return textureoffset * FIXED2FLOAT(mTempScaleX);
|
||||||
else return FixedDiv(textureoffset, mScaleX);
|
else return textureoffset * FIXED2FLOAT(mScaleX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ struct FTexCoordInfo
|
||||||
|
|
||||||
float FloatToTexU(float v) const { return v / mRenderWidth; }
|
float FloatToTexU(float v) const { return v / mRenderWidth; }
|
||||||
float FloatToTexV(float v) const { return v / mRenderHeight; }
|
float FloatToTexV(float v) const { return v / mRenderHeight; }
|
||||||
fixed_t RowOffset(fixed_t ofs) const;
|
float RowOffset(float ofs) const;
|
||||||
fixed_t TextureOffset(fixed_t ofs) const;
|
float TextureOffset(float ofs) const;
|
||||||
fixed_t TextureAdjustWidth() const;
|
fixed_t TextureAdjustWidth() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ void gl_GenerateGlobalBrightmapFromColormap()
|
||||||
// component becomes one.
|
// component becomes one.
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
PalEntry averageColor(const DWORD *data, int size, fixed_t maxout_factor)
|
PalEntry averageColor(const DWORD *data, int size, int maxout)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int r, g, b;
|
unsigned int r, g, b;
|
||||||
|
@ -203,12 +203,11 @@ PalEntry averageColor(const DWORD *data, int size, fixed_t maxout_factor)
|
||||||
|
|
||||||
int maxv=MAX(MAX(r,g),b);
|
int maxv=MAX(MAX(r,g),b);
|
||||||
|
|
||||||
if(maxv && maxout_factor)
|
if(maxv && maxout)
|
||||||
{
|
{
|
||||||
maxout_factor = FixedMul(maxout_factor, 255);
|
r = Scale(r, maxout, maxv);
|
||||||
r = Scale(r, maxout_factor, maxv);
|
g = Scale(g, maxout, maxv);
|
||||||
g = Scale(g, maxout_factor, maxv);
|
b = Scale(b, maxout, maxv);
|
||||||
b = Scale(b, maxout_factor, maxv);
|
|
||||||
}
|
}
|
||||||
return PalEntry(255,r,g,b);
|
return PalEntry(255,r,g,b);
|
||||||
}
|
}
|
||||||
|
@ -366,7 +365,7 @@ void FTexture::GetGlowColor(float *data)
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
gl_info.GlowColor = averageColor((DWORD *) buffer, w*h, 6*FRACUNIT/10);
|
gl_info.GlowColor = averageColor((DWORD *) buffer, w*h, 153);
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,14 +58,13 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
void gl_GenerateGlobalBrightmapFromColormap();
|
void gl_GenerateGlobalBrightmapFromColormap();
|
||||||
PalEntry averageColor(const DWORD *data, int size, fixed_t maxout);
|
PalEntry averageColor(const DWORD *data, int size, int maxout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, unsigned char *inputBuffer, const int inWidth, const int inHeight, int &outWidth, int &outHeight, bool hasAlpha );
|
unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, unsigned char *inputBuffer, const int inWidth, const int inHeight, int &outWidth, int &outHeight, bool hasAlpha );
|
||||||
int CheckDDPK3(FTexture *tex);
|
int CheckDDPK3(FTexture *tex);
|
||||||
int CheckExternalFile(FTexture *tex, bool & hascolorkey);
|
int CheckExternalFile(FTexture *tex, bool & hascolorkey);
|
||||||
PalEntry averageColor(const DWORD *data, int size, fixed_t maxout);
|
|
||||||
|
|
||||||
#endif // __GL_HQRESIZE_H__
|
#endif // __GL_HQRESIZE_H__
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue