mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Only draw thing if its in the subsector
This commit is contained in:
parent
d0f0500f0d
commit
2e2d6da00f
2 changed files with 20 additions and 6 deletions
|
@ -152,9 +152,9 @@ void RenderPolyBsp::RenderSubsector(subsector_t *sub)
|
||||||
for (AActor *thing = sub->sector->thinglist; thing != nullptr; thing = thing->snext)
|
for (AActor *thing = sub->sector->thinglist; thing != nullptr; thing = thing->snext)
|
||||||
{
|
{
|
||||||
if ((thing->renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
if ((thing->renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
||||||
AddWallSprite(thing);
|
AddWallSprite(thing, sub);
|
||||||
else
|
else
|
||||||
AddSprite(thing);
|
AddSprite(thing, sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ bool RenderPolyBsp::IsThingCulled(AActor *thing)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPolyBsp::AddSprite(AActor *thing)
|
void RenderPolyBsp::AddSprite(AActor *thing, subsector_t *sub)
|
||||||
{
|
{
|
||||||
if (IsThingCulled(thing))
|
if (IsThingCulled(thing))
|
||||||
return;
|
return;
|
||||||
|
@ -308,6 +308,20 @@ void RenderPolyBsp::AddSprite(AActor *thing)
|
||||||
{ pos.X + ViewSin * spriteHalfWidth, pos.Y - ViewCos * spriteHalfWidth }
|
{ pos.X + ViewSin * spriteHalfWidth, pos.Y - ViewCos * spriteHalfWidth }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Is this sprite inside? (To do: clip the points)
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < sub->numlines; i++)
|
||||||
|
{
|
||||||
|
seg_t *line = &sub->firstline[i];
|
||||||
|
double nx = line->v1->fY() - line->v2->fY();
|
||||||
|
double ny = line->v2->fX() - line->v1->fX();
|
||||||
|
double d = -(line->v1->fX() * nx + line->v1->fY() * ny);
|
||||||
|
if (pos.X * nx + pos.Y * ny + d > 0.0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//double depth = 1.0;
|
//double depth = 1.0;
|
||||||
//visstyle_t visstyle = GetSpriteVisStyle(thing, depth);
|
//visstyle_t visstyle = GetSpriteVisStyle(thing, depth);
|
||||||
// Rumor has it that AlterWeaponSprite needs to be called with visstyle passed in somewhere around here..
|
// Rumor has it that AlterWeaponSprite needs to be called with visstyle passed in somewhere around here..
|
||||||
|
@ -347,7 +361,7 @@ void RenderPolyBsp::AddSprite(AActor *thing)
|
||||||
TriangleDrawer::draw(worldToClip, vertices, 4, TriangleDrawMode::Fan, false, 0, viewwidth, cliptop, clipbottom, tex);
|
TriangleDrawer::draw(worldToClip, vertices, 4, TriangleDrawMode::Fan, false, 0, viewwidth, cliptop, clipbottom, tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPolyBsp::AddWallSprite(AActor *thing)
|
void RenderPolyBsp::AddWallSprite(AActor *thing, subsector_t *sub)
|
||||||
{
|
{
|
||||||
if (IsThingCulled(thing))
|
if (IsThingCulled(thing))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -62,8 +62,8 @@ private:
|
||||||
void AddLine(seg_t *line, sector_t *frontsector);
|
void AddLine(seg_t *line, sector_t *frontsector);
|
||||||
TriVertex PlaneVertex(vertex_t *v1, sector_t *sector, const secplane_t &plane);
|
TriVertex PlaneVertex(vertex_t *v1, sector_t *sector, const secplane_t &plane);
|
||||||
|
|
||||||
void AddSprite(AActor *thing);
|
void AddSprite(AActor *thing, subsector_t *sub);
|
||||||
void AddWallSprite(AActor *thing);
|
void AddWallSprite(AActor *thing, subsector_t *sub);
|
||||||
bool IsThingCulled(AActor *thing);
|
bool IsThingCulled(AActor *thing);
|
||||||
visstyle_t GetSpriteVisStyle(AActor *thing, double z);
|
visstyle_t GetSpriteVisStyle(AActor *thing, double z);
|
||||||
FTexture *GetSpriteTexture(AActor *thing, /*out*/ bool &flipX);
|
FTexture *GetSpriteTexture(AActor *thing, /*out*/ bool &flipX);
|
||||||
|
|
Loading…
Reference in a new issue