Minor optimizations + Potential bugfixes
This commit is contained in:
@@ -111,6 +111,7 @@ namespace Barotrauma
|
|||||||
public GameMain()
|
public GameMain()
|
||||||
{
|
{
|
||||||
GraphicsDeviceManager = new GraphicsDeviceManager(this);
|
GraphicsDeviceManager = new GraphicsDeviceManager(this);
|
||||||
|
|
||||||
Window.Title = "Barotrauma";
|
Window.Title = "Barotrauma";
|
||||||
|
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@@ -145,6 +146,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GraphicsWidth = Config.GraphicsWidth;
|
GraphicsWidth = Config.GraphicsWidth;
|
||||||
GraphicsHeight = Config.GraphicsHeight;
|
GraphicsHeight = Config.GraphicsHeight;
|
||||||
|
GraphicsDeviceManager.GraphicsProfile = GraphicsProfile.HiDef;
|
||||||
|
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Bgra32;
|
||||||
|
GraphicsDeviceManager.PreferMultiSampling = false;
|
||||||
GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
|
GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
|
||||||
|
|
||||||
if (Config.WindowMode == WindowMode.Windowed)
|
if (Config.WindowMode == WindowMode.Windowed)
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ namespace Barotrauma.Particles
|
|||||||
|
|
||||||
private float angularVelocity;
|
private float angularVelocity;
|
||||||
|
|
||||||
|
private Vector2 dragVec = Vector2.Zero;
|
||||||
|
private int dragWait = 0;
|
||||||
|
|
||||||
private Vector2 size;
|
private Vector2 size;
|
||||||
private Vector2 sizeChange;
|
private Vector2 sizeChange;
|
||||||
|
|
||||||
@@ -271,10 +274,24 @@ namespace Barotrauma.Particles
|
|||||||
|
|
||||||
private void ApplyDrag(float dragCoefficient, float deltaTime)
|
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;
|
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)
|
private void OnWallCollisionInside(Hull prevHull, Vector2 collisionNormal)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/intermediateDir:obj/$(Platform)
|
/intermediateDir:obj/$(Platform)
|
||||||
/platform:Windows
|
/platform:Windows
|
||||||
/config:
|
/config:
|
||||||
/profile:Reach
|
/profile:HiDef
|
||||||
/compress:False
|
/compress:False
|
||||||
|
|
||||||
#-------------------------------- References --------------------------------#
|
#-------------------------------- References --------------------------------#
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ float2 xBumpPos;
|
|||||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
{
|
{
|
||||||
float4 bumpColor = tex2D(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
|
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;
|
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 += 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;
|
return sample;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user