Handle dynamic lights correctly
This commit is contained in:
parent
a0790f50bd
commit
5beba9f9f4
|
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -293,7 +293,7 @@ public class LightMapper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propAnimLight != null && !propAnimLight.Dynamic)
|
if (propAnimLight != null)
|
||||||
{
|
{
|
||||||
var lightIndex = lightTable.LightCount;
|
var lightIndex = lightTable.LightCount;
|
||||||
propAnimLight.LightTableLightIndex = (ushort)lightIndex;
|
propAnimLight.LightTableLightIndex = (ushort)lightIndex;
|
||||||
|
@ -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,7 +325,7 @@ 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 && propLight.Brightness != 0)
|
if (propLight != null && propLight.Brightness != 0)
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue