Lighting optimization (caching shadow vertices & only checking hulls in range if the position or range of the light changes), ragdoll optimization, itemcomponent optimization, dragging stunned/dead characters

This commit is contained in:
Regalis11
2015-10-11 21:04:42 +03:00
parent 0a96254696
commit 8df9133e84
25 changed files with 377 additions and 201 deletions
@@ -79,23 +79,22 @@ namespace Subsurface.Items.Components
//lightColor = new Color(ToolBox.GetAttributeVector4(element, "color", Vector4.One));
}
public override void Update(float deltaTime, Camera cam)
{
base.Update(deltaTime, cam);
if (item.body != null)
{
light.Position = ConvertUnits.ToDisplayUnits(item.body.SimPosition);
}
Pickable pickable = item.GetComponent<Pickable>();
if (item.container!= null)
if (item.container != null)
{
light.Color = Color.Transparent;
return;
}
if (item.body != null)
{
light.Position = ConvertUnits.ToDisplayUnits(item.body.SimPosition);
}
if (powerConsumption == 0.0f)
{
voltage = 1.0f;
@@ -116,7 +115,6 @@ namespace Subsurface.Items.Components
}
light.Color = lightColor * lightBrightness * (1.0f-Rand.Range(0.0f,Flicker));
light.Range = range * (float)Math.Sqrt(lightBrightness);
voltage = 0.0f;
@@ -35,6 +35,8 @@ namespace Subsurface.Items.Components
Nodes = new List<Vector2>();
connections = new Connection[2];
IsActive = false;
}
public override void Move(Vector2 amount)