Skip to content

Commit

Permalink
Merged with latest master and made small change (zcenter -> center.Z)…
Browse files Browse the repository at this point in the history
… to hw_sprites.cpp. Now compiles and works.
  • Loading branch information
dileepvr authored and madame-rachelle committed Jan 21, 2024
1 parent e171f4e commit c8a7507
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/rendering/hwrenderer/scene/hw_sprites.cpp
@@ -1,4 +1,4 @@
//
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2002-2016 Christoph Oelckers
Expand Down Expand Up @@ -94,7 +94,7 @@ CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE)

//==========================================================================
//
//
//
//
//==========================================================================

Expand All @@ -103,7 +103,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
bool additivefog = false;
bool foglayer = false;
int rel = fullbright ? 0 : getExtraLight();
auto &vp = di->Viewpoint;
auto &vp = di->Viewpoint;

if (translucent)
{
Expand Down Expand Up @@ -336,7 +336,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down Expand Up @@ -391,7 +391,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)

return true;
}

// [BB] Billboard stuff
const bool drawWithXYBillboard = ((particle && gl_billboard_particles && !(particle->flags & SPF_NO_XY_BILLBOARD)) || (!(actor && actor->renderflags & RF_FORCEYBILLBOARD)
//&& di->mViewActor != nullptr
Expand Down Expand Up @@ -453,7 +453,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
float rollDegrees = doRoll ? Angles.Roll.Degrees() : 0;
float angleRad = (FAngle::fromDeg(270.) - HWAngles.Yaw).Radians();

// [fgsfds] Rotate the sprite about the sight vector (roll)
// [fgsfds] Rotate the sprite about the sight vector (roll)
if (isWallSprite)
{
float yawvecX = Angles.Yaw.Cos();
Expand All @@ -477,9 +477,9 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
// Rotate the sprite about the vector starting at the center of the sprite
// triangle strip and with direction orthogonal to where the player is looking
// in the x/y plane.
if(r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE)) mat.Translate(0.0, z2 - zcenter, 0.0);
if(r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE)) mat.Translate(0.0, z2 - center.Z, 0.0);
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
if(r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE)) mat.Translate(0.0, zcenter - z2, 0.0);
if(r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE)) mat.Translate(0.0, center.Z - z2, 0.0);
}

mat.Translate(-center.X, -center.Z, -center.Y); // retreat from sprite center
Expand All @@ -497,7 +497,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)

if (!offset.isZero())
HandleSpriteOffsets(&mat, &HWAngles, &offset, false);

if (doRoll)
{
// Compute center of sprite
Expand All @@ -513,7 +513,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
v[1] = mat * FVector3(x2, z1, y2);
v[2] = mat * FVector3(x1, z2, y1);
v[3] = mat * FVector3(x2, z2, y2);

}
else
{
Expand All @@ -522,14 +522,14 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
v[2] = FVector3(x1, z2, y1);
v[3] = FVector3(x2, z2, y2);
}

}
return false;
}

//==========================================================================
//
//
//
//
//==========================================================================

Expand All @@ -554,7 +554,7 @@ inline void HWSprite::PutSprite(HWDrawInfo *di, bool translucent)

//==========================================================================
//
//
//
//
//==========================================================================

Expand All @@ -579,7 +579,7 @@ void HWSprite::CreateVertices(HWDrawInfo *di)

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down Expand Up @@ -618,7 +618,7 @@ void HWSprite::SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool transluc
}

z1=copySprite.z2=lightbottom;
vt=copySprite.vb=copySprite.vt+
vt=copySprite.vb=copySprite.vt+
(lightbottom-copySprite.z1)*(copySprite.vb-copySprite.vt)/(z2-copySprite.z1);
copySprite.PutSprite(di, translucent);
put=true;
Expand All @@ -628,7 +628,7 @@ void HWSprite::SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool transluc

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down Expand Up @@ -713,7 +713,7 @@ void HWSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp
z1 -= difft;
}
}
if (diffb <= (0 - (float)gl_sclipthreshold)) // such a large displacement can't be correct!
if (diffb <= (0 - (float)gl_sclipthreshold)) // such a large displacement can't be correct!
{
// for living monsters standing on the floor allow a little more.
if (!(thing->flags3&MF3_ISMONSTER) || (thing->flags&MF_NOGRAVITY) || (thing->flags&MF_CORPSE) || diffb < (-1.8*(float)gl_sclipthreshold))
Expand All @@ -728,7 +728,7 @@ void HWSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down Expand Up @@ -807,7 +807,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
if (thruportal == 1) vieworigin += di->Level->Displacements.getOffset(viewmaster->Sector->PortalGroup, sector->PortalGroup);
if (fabs(vieworigin.X - vp.ActorPos.X) < 2 && fabs(vieworigin.Y - vp.ActorPos.Y) < 2) return;

// Necessary in order to prevent sprite pop-ins with viewpos and models.
// Necessary in order to prevent sprite pop-ins with viewpos and models.
auto* sec = viewmaster->Sector;
if (sec && !sec->PortalBlocksMovement(sector_t::ceiling))
{
Expand Down Expand Up @@ -1304,7 +1304,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t

//==========================================================================
//
//
//
//
//==========================================================================

Expand All @@ -1330,7 +1330,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
this->particle = particle;
fullbright = particle->flags & SPF_FULLBRIGHT;

if (di->isFullbrightScene())
if (di->isFullbrightScene())
{
Colormap.Clear();
}
Expand Down Expand Up @@ -1389,7 +1389,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
{
bool has_texture = particle->texture.isValid();
bool custom_animated_texture = (particle->flags & SPF_LOCAL_ANIM) && particle->animData.ok;

int particle_style = has_texture ? 2 : gl_particles_style; // Treat custom texture the same as smooth particles

// [BB] Load the texture for round or smooth particles
Expand Down Expand Up @@ -1448,7 +1448,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
float rvf = (particle->RollVel) * timefrac;
Angles.Roll = TAngle<double>::fromDeg(particle->Roll + rvf);
}

float factor;
if (particle_style == 1) factor = 1.3f / 7.f;
else if (particle_style == 2) factor = 2.5f / 7.f;
Expand All @@ -1466,7 +1466,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
z2=z+scalefac;

depth = (float)((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin);

// [BB] Translucent particles have to be rendered without the alpha test.
if (particle_style != 2 && trans>=1.0f-FLT_EPSILON) hw_styleflags = STYLEHW_Solid;
else hw_styleflags = STYLEHW_NoAlphaTest;
Expand All @@ -1482,7 +1482,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
}

// [MC] VisualThinkers are to be rendered akin to actor sprites. The reason this whole system
// is hitching a ride on particle_t is because of the large number of checks with
// is hitching a ride on particle_t is because of the large number of checks with
// HWSprite elsewhere in the draw lists.
void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t* sector)
{
Expand All @@ -1493,7 +1493,7 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t

if (paused || spr->isFrozen())
timefrac = 0.;

bool custom_anim = ((spr->PT.flags & SPF_LOCAL_ANIM) && spr->PT.animData.ok);

texture = TexMan.GetGameTexture(
Expand Down Expand Up @@ -1525,7 +1525,7 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t
auto r = spi.GetSpriteRect();
r.Scale(spr->Scale.X, spr->Scale.Y);

if (spr->bXFlip)
if (spr->bXFlip)
{
std::swap(ul,ur);
r.left = -r.width - r.left; // mirror the sprite's x-offset
Expand All @@ -1552,7 +1552,7 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down

0 comments on commit c8a7507

Please sign in to comment.