mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +00:00
- implemented rendering of wall sprites.
This commit is contained in:
parent
398d902e7e
commit
b3e0d93385
2 changed files with 33 additions and 15 deletions
|
@ -678,7 +678,7 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
||||||
bool mirror;
|
bool mirror;
|
||||||
FTextureID patch = gl_GetSpriteFrame(spritenum, thing->frame, -1, ang - thing->angle, &mirror);
|
FTextureID patch = gl_GetSpriteFrame(spritenum, thing->frame, -1, ang - thing->angle, &mirror);
|
||||||
if (!patch.isValid()) return;
|
if (!patch.isValid()) return;
|
||||||
gltexture=FMaterial::ValidateTexture(patch, false);
|
gltexture = FMaterial::ValidateTexture(patch, false);
|
||||||
if (!gltexture) return;
|
if (!gltexture) return;
|
||||||
|
|
||||||
vt = gltexture->GetSpriteVT();
|
vt = gltexture->GetSpriteVT();
|
||||||
|
@ -686,7 +686,7 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
||||||
gltexture->GetRect(&r, GLUSE_SPRITE);
|
gltexture->GetRect(&r, GLUSE_SPRITE);
|
||||||
if (mirror)
|
if (mirror)
|
||||||
{
|
{
|
||||||
r.left=-r.width-r.left; // mirror the sprite's x-offset
|
r.left = -r.width - r.left; // mirror the sprite's x-offset
|
||||||
ul = gltexture->GetSpriteUL();
|
ul = gltexture->GetSpriteUL();
|
||||||
ur = gltexture->GetSpriteUR();
|
ur = gltexture->GetSpriteUR();
|
||||||
}
|
}
|
||||||
|
@ -696,28 +696,46 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
||||||
ur = gltexture->GetSpriteUL();
|
ur = gltexture->GetSpriteUL();
|
||||||
}
|
}
|
||||||
|
|
||||||
r.Scale(FIXED2FLOAT(spritescaleX),FIXED2FLOAT(spritescaleY));
|
r.Scale(FIXED2FLOAT(spritescaleX), FIXED2FLOAT(spritescaleY));
|
||||||
|
|
||||||
float rightfac=-r.left;
|
float rightfac = -r.left;
|
||||||
float leftfac=rightfac-r.width;
|
float leftfac = rightfac - r.width;
|
||||||
|
|
||||||
z1=z-r.top;
|
z1 = z - r.top;
|
||||||
z2=z1-r.height;
|
z2 = z1 - r.height;
|
||||||
|
|
||||||
float spriteheight = FIXED2FLOAT(spritescaleY) * gltexture->GetScaledHeightFloat(GLUSE_SPRITE);
|
float spriteheight = FIXED2FLOAT(spritescaleY) * gltexture->GetScaledHeightFloat(GLUSE_SPRITE);
|
||||||
|
|
||||||
// Tests show that this doesn't look good for many decorations and corpses
|
// Tests show that this doesn't look good for many decorations and corpses
|
||||||
if (spriteheight > 0 && gl_spriteclip > 0 && (thing->renderflags & RF_SPRITETYPEMASK) == RF_FACESPRITE)
|
if (spriteheight > 0 && gl_spriteclip > 0 && (thing->renderflags & RF_SPRITETYPEMASK) == RF_FACESPRITE)
|
||||||
{
|
{
|
||||||
PerformSpriteClipAdjustment(thing, thingx, thingy, spriteheight);
|
PerformSpriteClipAdjustment(thing, thingx, thingy, spriteheight);
|
||||||
}
|
}
|
||||||
float viewvecX = GLRenderer->mViewVector.X;
|
|
||||||
float viewvecY = GLRenderer->mViewVector.Y;
|
|
||||||
|
|
||||||
x1=x-viewvecY*leftfac;
|
float viewvecX;
|
||||||
x2=x-viewvecY*rightfac;
|
float viewvecY;
|
||||||
y1=y+viewvecX*leftfac;
|
switch (thing->renderflags & RF_SPRITETYPEMASK)
|
||||||
y2=y+viewvecX*rightfac;
|
{
|
||||||
|
case RF_FACESPRITE:
|
||||||
|
viewvecX = GLRenderer->mViewVector.X;
|
||||||
|
viewvecY = GLRenderer->mViewVector.Y;
|
||||||
|
|
||||||
|
x1 = x - viewvecY*leftfac;
|
||||||
|
x2 = x - viewvecY*rightfac;
|
||||||
|
y1 = y + viewvecX*leftfac;
|
||||||
|
y2 = y + viewvecX*rightfac;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RF_WALLSPRITE:
|
||||||
|
viewvecX = FIXED2FLOAT(finecosine[thing->angle >> ANGLETOFINESHIFT]);
|
||||||
|
viewvecY = FIXED2FLOAT(finesine[thing->angle >> ANGLETOFINESHIFT]);
|
||||||
|
|
||||||
|
x1 = x + viewvecY*leftfac;
|
||||||
|
x2 = x + viewvecY*rightfac;
|
||||||
|
y1 = y - viewvecX*leftfac;
|
||||||
|
y2 = y - viewvecX*rightfac;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -887,6 +905,7 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
||||||
particle=NULL;
|
particle=NULL;
|
||||||
|
|
||||||
const bool drawWithXYBillboard = ( !(actor->renderflags & RF_FORCEYBILLBOARD)
|
const bool drawWithXYBillboard = ( !(actor->renderflags & RF_FORCEYBILLBOARD)
|
||||||
|
&& (actor->renderflags & RF_SPRITETYPEMASK) == RF_FACESPRITE
|
||||||
&& players[consoleplayer].camera
|
&& players[consoleplayer].camera
|
||||||
&& (gl_billboard_mode == 1 || actor->renderflags & RF_FORCEXYBILLBOARD ) );
|
&& (gl_billboard_mode == 1 || actor->renderflags & RF_FORCEXYBILLBOARD ) );
|
||||||
|
|
||||||
|
|
|
@ -1858,7 +1858,6 @@ void P_SpawnThings (int position)
|
||||||
{
|
{
|
||||||
SetMapThingUserData(actor, *udi);
|
SetMapThingUserData(actor, *udi);
|
||||||
}
|
}
|
||||||
if (actor != NULL) actor->renderflags |= RF_WALLSPRITE;
|
|
||||||
}
|
}
|
||||||
for(int i=0; i<MAXPLAYERS; i++)
|
for(int i=0; i<MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue