Backported vsync changes from new-netcode, WIP hull visibility culling

The hull culling functions are there, they just aren't being used right now because there are some annoying bugs.
This commit is contained in:
juanjp600
2016-10-02 22:24:31 -03:00
parent 75e7b3a94e
commit e1296e4a8e
27 changed files with 316 additions and 99 deletions
@@ -95,6 +95,11 @@ namespace Barotrauma.Items.Components
}
}
public Rectangle WindowRect
{
get { return window; }
}
[Editable, HasDefaultValue(false, true)]
public bool IsOpen
{
@@ -463,7 +463,9 @@ namespace Barotrauma.Items.Components
//}
public virtual void DrawHUD(SpriteBatch spriteBatch, Character character) { }
public virtual void UpdateHUD(Character character) { }
/// <returns>true if the operation was completed</returns>
public virtual bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective)
{
@@ -82,10 +82,14 @@ namespace Barotrauma.Items.Components
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
GuiFrame.Update((float)Physics.step);
GuiFrame.Draw(spriteBatch);
}
public override void UpdateHUD(Character character)
{
GuiFrame.Update((float)Physics.step);
}
private bool ToggleActive(GUIButton button, object obj)
{
SetActive(!IsActive);
@@ -119,6 +119,11 @@ namespace Barotrauma.Items.Components
}
public override void UpdateHUD(Character character)
{
GuiFrame.Update(1.0f / 60.0f);
}
public override void UpdateBroken(float deltaTime, Camera cam)
{
force = MathHelper.Lerp(force, 0.0f, 0.1f);
@@ -338,6 +338,11 @@ namespace Barotrauma.Items.Components
}
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
GuiFrame.Draw(spriteBatch);
}
public override void UpdateHUD(Character character)
{
FabricableItem targetItem = itemList.SelectedData as FabricableItem;
if (targetItem != null)
@@ -346,7 +351,6 @@ namespace Barotrauma.Items.Components
}
GuiFrame.Update((float)Physics.step);
GuiFrame.Draw(spriteBatch);
}
private bool CanBeFabricated(FabricableItem fabricableItem, Character user)
@@ -155,14 +155,18 @@ namespace Barotrauma.Items.Components
{
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
GuiFrame.Update(1.0f / 60.0f);
GuiFrame.Draw(spriteBatch);
spriteBatch.DrawString(GUI.Font, "Pumping speed: " + (int)flowPercentage + " %", new Vector2(x + 40, y + 85), Color.White);
}
public override void UpdateHUD(Character character)
{
GuiFrame.Update(1.0f / 60.0f);
}
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power=0.0f)
{
base.ReceiveSignal(stepsTaken, signal, connection, sender, power);
@@ -438,7 +438,6 @@ namespace Barotrauma.Items.Components
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
GuiFrame.Update(1.0f / 60.0f);
GuiFrame.Draw(spriteBatch);
float xOffset = (graphTimer / (float)updateGraphInterval);
@@ -481,6 +480,11 @@ namespace Barotrauma.Items.Components
//y = y - 260;
}
public override void UpdateHUD(Character character)
{
GuiFrame.Update(1.0f / 60.0f);
}
private bool ToggleAutoTemp(GUITickBox tickBox)
{
unsentChanges = true;
@@ -160,8 +160,7 @@ namespace Barotrauma.Items.Components
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
GuiFrame.Update(1.0f / 60.0f);
GuiFrame.Draw(spriteBatch);
if (voltage < minVoltage && powerConsumption > 0.0f) return;
@@ -210,6 +209,11 @@ namespace Barotrauma.Items.Components
}
}
public override void UpdateHUD(Character character)
{
GuiFrame.Update(1.0f / 60.0f);
}
private void UpdateAutoPilot(float deltaTime)
{
if (posToMaintain != null)
@@ -246,6 +246,11 @@ namespace Barotrauma.Items.Components
spriteBatch.DrawString(GUI.Font, "Recharge rate: " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", new Vector2(x + 30, y + 95), Color.White);
}
public override void UpdateHUD(Character character)
{
GuiFrame.Update(1.0f / 60.0f);
}
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
{
message.WriteRangedSingle(MathHelper.Clamp(rechargeSpeed / MaxRechargeSpeed, 0.0f, 1.0f), 0.0f, 1.0f, 8);
@@ -186,6 +186,11 @@ namespace Barotrauma.Items.Components
spriteBatch.DrawString(GUI.Font, "Load: " + (int)powerLoad + " kW", new Vector2(x + 30, y + 100), Color.White);
}
public override void UpdateHUD(Character character)
{
GuiFrame.Update(1.0f / 60.0f);
}
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power)
{
base.ReceiveSignal(stepsTaken, signal, connection, sender, power);
@@ -122,7 +122,7 @@ namespace Barotrauma.Items.Components
base.Update(deltaTime, cam);
light.ParentSub = item.Submarine;
ApplyStatusEffects(ActionType.OnActive, deltaTime);
if (item.Container != null)