Compare commits

..

2 Commits

3 changed files with 7 additions and 5 deletions

View File

@ -690,13 +690,13 @@ public class WorldRep : IChunk
if (dynamicLight) if (dynamicLight)
{ {
DynamicLightCount++; DynamicLightCount++;
Lights.Add(data);
} }
else else
{ {
Lights.Insert(LightCount, data);
LightCount++; LightCount++;
} }
Lights.Add(data);
} }
} }

View File

@ -21,6 +21,7 @@ public class Light
public int ObjId; public int ObjId;
public int LightTableIndex; public int LightTableIndex;
public bool Anim; public bool Anim;
public bool Dynamic;
public WorldRep.LightTable.LightData ToLightData(float lightScale) public WorldRep.LightTable.LightData ToLightData(float lightScale)
{ {

View File

@ -310,6 +310,7 @@ public class LightMapper
ObjId = id, ObjId = id,
LightTableIndex = propAnimLight.LightTableLightIndex, LightTableIndex = propAnimLight.LightTableLightIndex,
Anim = true, Anim = true,
Dynamic = propAnimLight.Dynamic,
SpotlightInnerAngle = -1f, SpotlightInnerAngle = -1f,
}; };
@ -324,10 +325,10 @@ public class LightMapper
light.ApplyTransforms(vhotLightPos, vhotLightDir, translate, rotate, scale); light.ApplyTransforms(vhotLightPos, vhotLightDir, translate, rotate, scale);
_lights.Add(light); _lights.Add(light);
lightTable.AddLight(light.ToLightData(32.0f)); lightTable.AddLight(light.ToLightData(32.0f), propAnimLight.Dynamic);
} }
if (propLight != null) if (propLight != null && propLight.Brightness != 0)
{ {
var light = new Light var light = new Light
{ {
@ -486,7 +487,7 @@ public class LightMapper
for (var j = 0; j < _lights.Count; j++) for (var j = 0; j < _lights.Count; j++)
{ {
var light = _lights[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; continue;
} }