Minor optimizations + Potential bugfixes

This commit is contained in:
juanjp600
2017-10-11 22:52:13 -03:00
parent f46dc5da28
commit 3a67418985
4 changed files with 26 additions and 5 deletions

View File

@@ -111,6 +111,7 @@ namespace Barotrauma
public GameMain()
{
GraphicsDeviceManager = new GraphicsDeviceManager(this);
Window.Title = "Barotrauma";
Instance = this;
@@ -145,6 +146,9 @@ namespace Barotrauma
{
GraphicsWidth = Config.GraphicsWidth;
GraphicsHeight = Config.GraphicsHeight;
GraphicsDeviceManager.GraphicsProfile = GraphicsProfile.HiDef;
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Bgra32;
GraphicsDeviceManager.PreferMultiSampling = false;
GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
if (Config.WindowMode == WindowMode.Windowed)

View File

@@ -23,6 +23,9 @@ namespace Barotrauma.Particles
private float angularVelocity;
private Vector2 dragVec = Vector2.Zero;
private int dragWait = 0;
private Vector2 size;
private Vector2 sizeChange;
@@ -271,10 +274,24 @@ namespace Barotrauma.Particles
private void ApplyDrag(float dragCoefficient, float deltaTime)
{
if (velocity.LengthSquared() < dragVec.LengthSquared())
{
velocity = Vector2.Zero;
return;
}
if (Math.Abs(velocity.X) < 0.0001f && Math.Abs(velocity.Y) < 0.0001f) return;
float speed = velocity.Length();
velocity -= (velocity / speed) * Math.Min(speed * speed * dragCoefficient * deltaTime, 1.0f);
dragWait--;
if (dragWait<=0)
{
dragWait = 30;
float speed = velocity.Length();
dragVec = (velocity / speed) * Math.Min(speed * speed * dragCoefficient * deltaTime, 1.0f);
}
velocity -= dragVec;
}
private void OnWallCollisionInside(Hull prevHull, Vector2 collisionNormal)

View File

@@ -5,7 +5,7 @@
/intermediateDir:obj/$(Platform)
/platform:Windows
/config:
/profile:Reach
/profile:HiDef
/compress:False
#-------------------------------- References --------------------------------#

View File

@@ -27,7 +27,7 @@ float2 xBumpPos;
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
float4 bumpColor = tex2D(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))/2.0f;
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))*0.5f;
float2 samplePos = texCoord;
@@ -40,7 +40,7 @@ float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoor
sample += tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y-xBlurDistance));
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y+xBlurDistance));
sample = sample / 4;
sample = sample * 0.25;
return sample;
}