Handle dynamic lights correctly
This commit is contained in:
parent
a0790f50bd
commit
5beba9f9f4
|
@ -690,13 +690,13 @@ public class WorldRep : IChunk
|
|||
if (dynamicLight)
|
||||
{
|
||||
DynamicLightCount++;
|
||||
Lights.Add(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
Lights.Insert(LightCount, data);
|
||||
LightCount++;
|
||||
}
|
||||
|
||||
Lights.Add(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ public class Light
|
|||
public int ObjId;
|
||||
public int LightTableIndex;
|
||||
public bool Anim;
|
||||
public bool Dynamic;
|
||||
|
||||
public WorldRep.LightTable.LightData ToLightData(float lightScale)
|
||||
{
|
||||
|
|
|
@ -293,7 +293,7 @@ public class LightMapper
|
|||
}
|
||||
}
|
||||
|
||||
if (propAnimLight != null && !propAnimLight.Dynamic)
|
||||
if (propAnimLight != null)
|
||||
{
|
||||
var lightIndex = lightTable.LightCount;
|
||||
propAnimLight.LightTableLightIndex = (ushort)lightIndex;
|
||||
|
@ -310,6 +310,7 @@ public class LightMapper
|
|||
ObjId = id,
|
||||
LightTableIndex = propAnimLight.LightTableLightIndex,
|
||||
Anim = true,
|
||||
Dynamic = propAnimLight.Dynamic,
|
||||
SpotlightInnerAngle = -1f,
|
||||
};
|
||||
|
||||
|
@ -324,7 +325,7 @@ public class LightMapper
|
|||
light.ApplyTransforms(vhotLightPos, vhotLightDir, translate, rotate, scale);
|
||||
|
||||
_lights.Add(light);
|
||||
lightTable.AddLight(light.ToLightData(32.0f));
|
||||
lightTable.AddLight(light.ToLightData(32.0f), propAnimLight.Dynamic);
|
||||
}
|
||||
|
||||
if (propLight != null && propLight.Brightness != 0)
|
||||
|
@ -486,7 +487,7 @@ public class LightMapper
|
|||
for (var j = 0; j < _lights.Count; j++)
|
||||
{
|
||||
var light = _lights[j];
|
||||
if (!MathUtils.Intersects(new MathUtils.Sphere(light.Position, light.Radius), cellAabb))
|
||||
if (light.Dynamic || !MathUtils.Intersects(new MathUtils.Sphere(light.Position, light.Radius), cellAabb))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue