mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- partial adjustments.
No point changing all the viewx/y/z stuff when that is about to get floatified next.
This commit is contained in:
parent
466c4c75df
commit
a27181cb0b
7 changed files with 35 additions and 35 deletions
|
@ -119,19 +119,19 @@ void gl_InitGlow(FScanner &sc)
|
|||
// Checks whether a sprite should be affected by a glow
|
||||
//
|
||||
//==========================================================================
|
||||
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, int x, int y, int z)
|
||||
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, const DVector3 &pos)
|
||||
{
|
||||
FTextureID floorpic = sec->GetTexture(sector_t::floor);
|
||||
FTexture *tex = TexMan[floorpic];
|
||||
if (tex != NULL && tex->isGlowing())
|
||||
{
|
||||
fixed_t floordiff = z - sec->floorplane.ZatPoint(x, y);
|
||||
if (floordiff < tex->gl_info.GlowHeight*FRACUNIT && tex->gl_info.GlowHeight != 0)
|
||||
double floordiff = pos.Z - sec->floorplane.ZatPoint(pos);
|
||||
if (floordiff < tex->gl_info.GlowHeight && tex->gl_info.GlowHeight != 0)
|
||||
{
|
||||
int maxlight = (255+lightlevel)>>1;
|
||||
fixed_t lightfrac = floordiff / tex->gl_info.GlowHeight;
|
||||
if (lightfrac<0) lightfrac=0;
|
||||
lightlevel= (lightfrac*lightlevel + maxlight*(FRACUNIT-lightfrac))>>FRACBITS;
|
||||
int maxlight = (255 + lightlevel) >> 1;
|
||||
double lightfrac = floordiff / tex->gl_info.GlowHeight;
|
||||
if (lightfrac < 0) lightfrac = 0;
|
||||
lightlevel = int(lightfrac*lightlevel + maxlight*(1 - lightfrac));
|
||||
}
|
||||
}
|
||||
return lightlevel;
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
struct sector_t;
|
||||
|
||||
void gl_InitGlow(const char * lumpnm);
|
||||
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, int x, int y, int z);
|
||||
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, const DVector3 &pos);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -639,55 +639,55 @@ void GLPortal::RestoreMapSection()
|
|||
static int skyboxrecursion=0;
|
||||
void GLSkyboxPortal::DrawContents()
|
||||
{
|
||||
int old_pm=PlaneMirrorMode;
|
||||
int old_pm = PlaneMirrorMode;
|
||||
int saved_extralight = extralight;
|
||||
|
||||
if (skyboxrecursion>=3)
|
||||
if (skyboxrecursion >= 3)
|
||||
{
|
||||
ClearScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
skyboxrecursion++;
|
||||
origin->flags|=MF_JUSTHIT;
|
||||
origin->flags |= MF_JUSTHIT;
|
||||
extralight = 0;
|
||||
|
||||
PlaneMirrorMode=0;
|
||||
PlaneMirrorMode = 0;
|
||||
|
||||
bool oldclamp = gl_RenderState.SetDepthClamp(false);
|
||||
DVector3 viewpos = origin->InterpolatedPosition(r_TicFracF);
|
||||
viewx = FLOAT2FIXED(viewpos.X);
|
||||
viewy = FLOAT2FIXED(viewpos.Y);
|
||||
viewz = FLOAT2FIXED(viewpos.Z);
|
||||
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->_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;
|
||||
double floorh = origin->Sector->floorplane.ZatPoint(origin->Pos());
|
||||
double ceilh = origin->Sector->ceilingplane.ZatPoint(origin->Pos());
|
||||
if (viewpos.Z < floorh + 4) viewpos.Z = floorh + 4;
|
||||
if (viewpos.Z > ceilh - 4) viewz = ceilh - 4;
|
||||
|
||||
viewx = FLOAT2FIXED(viewpos.X);
|
||||
viewy = FLOAT2FIXED(viewpos.Y);
|
||||
viewz = FLOAT2FIXED(viewpos.Z);
|
||||
|
||||
GLRenderer->mViewActor = origin;
|
||||
|
||||
validcount++;
|
||||
inskybox=true;
|
||||
GLRenderer->SetupView(viewx, viewy, viewz, viewangle, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
||||
inskybox = true;
|
||||
GLRenderer->SetupView(viewx, viewy, viewz, viewangle, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
|
||||
GLRenderer->SetViewArea();
|
||||
ClearClipper();
|
||||
|
||||
int mapsection = R_PointInSubsector(viewx, viewy)->mapsection;
|
||||
|
||||
SaveMapSection();
|
||||
currentmapsection[mapsection>>3] |= 1 << (mapsection & 7);
|
||||
currentmapsection[mapsection >> 3] |= 1 << (mapsection & 7);
|
||||
|
||||
GLRenderer->DrawScene();
|
||||
origin->flags&=~MF_JUSTHIT;
|
||||
inskybox=false;
|
||||
origin->flags &= ~MF_JUSTHIT;
|
||||
inskybox = false;
|
||||
gl_RenderState.SetDepthClamp(oldclamp);
|
||||
skyboxrecursion--;
|
||||
|
||||
PlaneMirrorMode=old_pm;
|
||||
PlaneMirrorMode = old_pm;
|
||||
extralight = saved_extralight;
|
||||
|
||||
RestoreMapSection();
|
||||
|
|
|
@ -186,8 +186,8 @@ struct GLLinePortal : public GLPortal
|
|||
{
|
||||
v1 = line->v1;
|
||||
v2 = line->v2;
|
||||
dx = line->fixDx();
|
||||
dy = line->fixDy();
|
||||
dx = FLOAT2FIXED(line->Delta().X);
|
||||
dy = FLOAT2FIXED(line->Delta().Y);
|
||||
}
|
||||
|
||||
GLLinePortal(FGLLinePortal *line)
|
||||
|
@ -198,8 +198,8 @@ struct GLLinePortal : public GLPortal
|
|||
line_t *lline = line->reference->mDestination;
|
||||
v1 = lline->v1;
|
||||
v2 = lline->v2;
|
||||
dx = lline->fixDy();
|
||||
dy = lline->fixDy();
|
||||
dx = FLOAT2FIXED(lline->Delta().X);
|
||||
dy = FLOAT2FIXED(lline->Delta().Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -532,8 +532,8 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
|||
{
|
||||
if (!(thing->flags7 & MF7_FLYCHEAT) && thing->target==GLRenderer->mViewActor && GLRenderer->mViewActor != NULL)
|
||||
{
|
||||
fixed_t clipdist = FLOAT2FIXED(clamp(thing->Speed, thing->target->radius, thing->target->radius*2));
|
||||
if (P_AproxDistance(FLOAT2FIXED(thingpos.X)-viewx, FLOAT2FIXED(thingpos.Y)-viewy) < clipdist) return;
|
||||
double clipdist = clamp(thing->Speed, thing->target->radius, thing->target->radius*2);
|
||||
if (P_AproxDistance(thingpos.X-viewx, thingpos.Y-viewy) < clipdist) return;
|
||||
}
|
||||
thing->flags7 |= MF7_FLYCHEAT; // do this only once for the very first frame, but not if it gets into range again.
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
|||
rendersector->GetCeilingLight() : rendersector->GetFloorLight());
|
||||
foglevel = (BYTE)clamp<short>(rendersector->lightlevel, 0, 255);
|
||||
|
||||
lightlevel = (byte)gl_CheckSpriteGlow(rendersector, lightlevel, FLOAT2FIXED(thingpos.X), FLOAT2FIXED(thingpos.Y), FLOAT2FIXED(thingpos.Z));
|
||||
lightlevel = (byte)gl_CheckSpriteGlow(rendersector, lightlevel, thingpos);
|
||||
|
||||
ThingColor = (thing->RenderStyle.Flags & STYLEF_ColorIsFixed) ? thing->fillcolor : 0xffffff;
|
||||
ThingColor.a = 255;
|
||||
|
|
|
@ -134,8 +134,8 @@ void GLWall::PutWall(bool translucent)
|
|||
|
||||
if (translucent) // translucent walls
|
||||
{
|
||||
viewdistance = P_AproxDistance(((seg->linedef->v1->fixX() + seg->linedef->v2->fixX()) >> 1) - viewx,
|
||||
((seg->linedef->v1->fixY() + seg->linedef->v2->fixY()) >> 1) - viewy);
|
||||
viewdistance = P_AproxDistance(((seg->linedef->v1->fX() + seg->linedef->v2->fX()) /2) - viewx,
|
||||
((seg->linedef->v1->fY() + seg->linedef->v2->fY()) /2) - viewy);
|
||||
gl_drawinfo->drawlists[GLDL_TRANSLUCENT].AddWall(this);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -250,7 +250,7 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
|
||||
lightlevel = (1.0 - min_L) * 255;
|
||||
}
|
||||
lightlevel = gl_CheckSpriteGlow(viewsector, lightlevel, playermo->_f_X(), playermo->_f_Y(), playermo->_f_Z());
|
||||
lightlevel = gl_CheckSpriteGlow(viewsector, lightlevel, playermo->Pos());
|
||||
|
||||
// calculate colormap for weapon sprites
|
||||
if (viewsector->e->XFloor.ffloors.Size() && !glset.nocoloredspritelighting)
|
||||
|
|
Loading…
Reference in a new issue