- rewrote dynamic lights to not use actors for the internal representation and made DynamicLight a purely scripted class.
This should be less of a drag on the playsim than having each light a separate actor. A quick check with ZDCMP2 showed that the light processing time was reduced to 1/3rd from 0.5 ms to 0.17 ms per tic. It's also one native actor class less.
This commit is contained in:
parent
99479d84b1
commit
d654e02dea
34 changed files with 438 additions and 412 deletions
|
|
@ -32,7 +32,7 @@ class RenderMemory;
|
|||
class PolyTranslucentObject;
|
||||
class PolyDrawSectorPortal;
|
||||
class PolyDrawLinePortal;
|
||||
class ADynamicLight;
|
||||
struct FDynamicLight;
|
||||
|
||||
class PolyRenderThread
|
||||
{
|
||||
|
|
@ -54,7 +54,7 @@ public:
|
|||
std::vector<std::unique_ptr<PolyDrawSectorPortal>> SectorPortals;
|
||||
std::vector<std::unique_ptr<PolyDrawLinePortal>> LinePortals;
|
||||
|
||||
TArray<ADynamicLight*> AddedLightsArray;
|
||||
TArray<FDynamicLight*> AddedLightsArray;
|
||||
|
||||
// Make sure texture can accessed safely
|
||||
void PrepareTexture(FSoftwareTexture *texture, FRenderStyle style);
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@ void PolyModelRenderer::AddLights(AActor *actor)
|
|||
FLightNode * node = subsector->section->lighthead;
|
||||
while (node) // check all lights touching a subsector
|
||||
{
|
||||
ADynamicLight *light = node->lightsource;
|
||||
if (light->visibletoplayer && !(light->flags2&MF2_DORMANT) && (!(light->lightflags&LF_DONTLIGHTSELF) || light->target != actor) && !(light->lightflags&LF_DONTLIGHTACTORS))
|
||||
FDynamicLight *light = node->lightsource;
|
||||
if (light->ShouldLightActor(actor))
|
||||
{
|
||||
int group = subsector->sector->PortalGroup;
|
||||
DVector3 pos = light->PosRelative(group);
|
||||
|
|
@ -153,7 +153,7 @@ void PolyModelRenderer::AddLights(AActor *actor)
|
|||
Lights = Thread->FrameMemory->AllocMemory<PolyLight>(NumLights);
|
||||
for (int i = 0; i < NumLights; i++)
|
||||
{
|
||||
ADynamicLight *lightsource = addedLights[i];
|
||||
FDynamicLight *lightsource = addedLights[i];
|
||||
|
||||
bool is_point_light = (lightsource->lightflags & LF_ATTENUATE) != 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ void RenderPolyPlane::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args,
|
|||
FLightNode *cur_node = light_list;
|
||||
while (cur_node)
|
||||
{
|
||||
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
|
||||
if (cur_node->lightsource->IsActive())
|
||||
max_lights++;
|
||||
cur_node = cur_node->nextLight;
|
||||
}
|
||||
|
|
@ -307,7 +307,7 @@ void RenderPolyPlane::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args,
|
|||
cur_node = light_list;
|
||||
while (cur_node)
|
||||
{
|
||||
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
|
||||
if (cur_node->lightsource->IsActive())
|
||||
{
|
||||
bool is_point_light = (cur_node->lightsource->lightflags & LF_ATTENUATE) != 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -391,8 +391,8 @@ void RenderPolySprite::SetDynlight(AActor *thing, PolyDrawArgs &args)
|
|||
auto node = thing->section->lighthead;
|
||||
while (node != nullptr)
|
||||
{
|
||||
ADynamicLight *light = node->lightsource;
|
||||
if (light->visibletoplayer && !(light->flags2&MF2_DORMANT) && (!(light->lightflags&LF_DONTLIGHTSELF) || light->target != thing) && !(light->lightflags&LF_DONTLIGHTACTORS))
|
||||
FDynamicLight *light = node->lightsource;
|
||||
if (light->ShouldLightActor(thing))
|
||||
{
|
||||
float lx = (float)(light->X() - thing->X());
|
||||
float ly = (float)(light->Y() - thing->Y());
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ void RenderPolyWall::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args)
|
|||
FLightNode *cur_node = light_list;
|
||||
while (cur_node)
|
||||
{
|
||||
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
|
||||
if (cur_node->lightsource->IsActive())
|
||||
max_lights++;
|
||||
cur_node = cur_node->nextLight;
|
||||
}
|
||||
|
|
@ -443,7 +443,7 @@ void RenderPolyWall::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args)
|
|||
cur_node = light_list;
|
||||
while (cur_node)
|
||||
{
|
||||
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
|
||||
if (cur_node->lightsource->IsActive())
|
||||
{
|
||||
bool is_point_light = (cur_node->lightsource->lightflags & LF_ATTENUATE) != 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue