Merge branch 'master' into new-netcode
Conflicts: Subsurface/Source/GUI/GUITextBlock.cs Subsurface/Source/GameMain.cs Subsurface/Source/Items/Components/Machines/Radar.cs Subsurface/Source/Networking/GameClient.cs
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Barotrauma
|
||||
|
||||
if (wallEdgeEffect == null)
|
||||
{
|
||||
wallEdgeEffect = new BasicEffect(GameMain.CurrGraphicsDevice)
|
||||
wallEdgeEffect = new BasicEffect(GameMain.Instance.GraphicsDevice)
|
||||
{
|
||||
DiffuseColor = new Vector3(0.8f, 0.8f, 0.8f),
|
||||
VertexColorEnabled = false,
|
||||
@@ -53,7 +53,7 @@ namespace Barotrauma
|
||||
|
||||
if (wallCenterEffect == null)
|
||||
{
|
||||
wallCenterEffect = new BasicEffect(GameMain.CurrGraphicsDevice)
|
||||
wallCenterEffect = new BasicEffect(GameMain.Instance.GraphicsDevice)
|
||||
{
|
||||
VertexColorEnabled = false,
|
||||
TextureEnabled = true,
|
||||
@@ -90,13 +90,13 @@ namespace Barotrauma
|
||||
|
||||
public void SetWallVertices(VertexPositionTexture[] vertices)
|
||||
{
|
||||
wallVertices = new VertexBuffer(GameMain.CurrGraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length,BufferUsage.WriteOnly);
|
||||
wallVertices = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length,BufferUsage.WriteOnly);
|
||||
wallVertices.SetData(vertices);
|
||||
}
|
||||
|
||||
public void SetBodyVertices(VertexPositionTexture[] vertices)
|
||||
{
|
||||
bodyVertices = new VertexBuffer(GameMain.CurrGraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
|
||||
bodyVertices = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
|
||||
bodyVertices.SetData(vertices);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Barotrauma
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
RenderWalls(GameMain.CurrGraphicsDevice, cam);
|
||||
RenderWalls(GameMain.Instance.GraphicsDevice, cam);
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Barotrauma
|
||||
|
||||
if (basicEffect == null)
|
||||
{
|
||||
basicEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
basicEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
||||
basicEffect.VertexColorEnabled = false;
|
||||
|
||||
basicEffect.TextureEnabled = true;
|
||||
|
||||
@@ -113,13 +113,13 @@ namespace Barotrauma
|
||||
|
||||
public void SetWallVertices(VertexPositionTexture[] vertices)
|
||||
{
|
||||
wallVertices = new VertexBuffer(GameMain.CurrGraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
|
||||
wallVertices = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
|
||||
wallVertices.SetData(vertices);
|
||||
}
|
||||
|
||||
public void SetBodyVertices(VertexPositionColor[] vertices)
|
||||
{
|
||||
bodyVertices = new VertexBuffer(GameMain.CurrGraphicsDevice, VertexPositionColor.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
|
||||
bodyVertices = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColor.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
|
||||
bodyVertices.SetData(vertices);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
if (enabled == value) return;
|
||||
enabled = value;
|
||||
LastVertexChangeTime = (float)GameMain.Instance.TotalElapsedTime;
|
||||
LastVertexChangeTime = (float)Timing.TotalTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,12 +173,12 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
if (shadowEffect == null)
|
||||
{
|
||||
shadowEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
shadowEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
||||
shadowEffect.VertexColorEnabled = true;
|
||||
}
|
||||
if (penumbraEffect == null)
|
||||
{
|
||||
penumbraEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
penumbraEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
||||
penumbraEffect.TextureEnabled = true;
|
||||
//shadowEffect.VertexColorEnabled = true;
|
||||
penumbraEffect.LightingEnabled = false;
|
||||
@@ -264,7 +264,7 @@ namespace Barotrauma.Lights
|
||||
segments[i].End.Pos += amount;
|
||||
}
|
||||
|
||||
LastVertexChangeTime = (float)GameMain.Instance.TotalElapsedTime;
|
||||
LastVertexChangeTime = (float)Timing.TotalTime;
|
||||
|
||||
CalculateDimensions();
|
||||
}
|
||||
@@ -273,7 +273,7 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
Debug.Assert(points.Length == 4, "Only rectangular convex hulls are supported");
|
||||
|
||||
LastVertexChangeTime = (float)GameMain.Instance.TotalElapsedTime;
|
||||
LastVertexChangeTime = (float)Timing.TotalTime;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -601,7 +601,7 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
|
||||
CalculateShadowVertices(lightSourcePos, los);
|
||||
ShadowBuffer = new VertexBuffer(GameMain.CurrGraphicsDevice, VertexPositionColor.VertexDeclaration, 6 * 2, BufferUsage.None);
|
||||
ShadowBuffer = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColor.VertexDeclaration, 6 * 2, BufferUsage.None);
|
||||
ShadowBuffer.SetData(shadowVertices, 0, shadowVertices.Length);
|
||||
|
||||
graphicsDevice.SetVertexBuffer(ShadowBuffer);
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
if (lightEffect == null)
|
||||
{
|
||||
lightEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
lightEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
||||
lightEffect.VertexColorEnabled = false;
|
||||
|
||||
lightEffect.TextureEnabled = true;
|
||||
|
||||
@@ -490,16 +490,16 @@ namespace Barotrauma.Lights
|
||||
//now we just create a buffer for 64 verts and make it larger if needed
|
||||
if (lightVolumeBuffer == null)
|
||||
{
|
||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.CurrGraphicsDevice, VertexPositionTexture.VertexDeclaration, Math.Max(64, (int)(vertexCount*1.5)), BufferUsage.None);
|
||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.CurrGraphicsDevice, typeof(short), Math.Max(64*3, (int)(indexCount * 1.5)), BufferUsage.None);
|
||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, Math.Max(64, (int)(vertexCount*1.5)), BufferUsage.None);
|
||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), Math.Max(64*3, (int)(indexCount * 1.5)), BufferUsage.None);
|
||||
}
|
||||
else if (vertexCount > lightVolumeBuffer.VertexCount)
|
||||
{
|
||||
lightVolumeBuffer.Dispose();
|
||||
lightVolumeIndexBuffer.Dispose();
|
||||
|
||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.CurrGraphicsDevice, VertexPositionTexture.VertexDeclaration, (int)(vertexCount*1.5), BufferUsage.None);
|
||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.CurrGraphicsDevice, typeof(short), (int)(indexCount * 1.5), BufferUsage.None);
|
||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, (int)(vertexCount*1.5), BufferUsage.None);
|
||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), (int)(indexCount * 1.5), BufferUsage.None);
|
||||
}
|
||||
|
||||
lightVolumeBuffer.SetData<VertexPositionTexture>(vertices.ToArray());
|
||||
@@ -549,7 +549,7 @@ namespace Barotrauma.Lights
|
||||
var verts = FindRaycastHits();
|
||||
CalculateLightVertices(verts);
|
||||
|
||||
lastRecalculationTime = (float)GameMain.Instance.TotalElapsedTime;
|
||||
lastRecalculationTime = (float)Timing.TotalTime;
|
||||
NeedsRecalculation = false;
|
||||
}
|
||||
|
||||
@@ -566,10 +566,10 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
lightEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
GameMain.CurrGraphicsDevice.SetVertexBuffer(lightVolumeBuffer);
|
||||
GameMain.CurrGraphicsDevice.Indices = lightVolumeIndexBuffer;
|
||||
|
||||
GameMain.CurrGraphicsDevice.DrawIndexedPrimitives
|
||||
GameMain.Instance.GraphicsDevice.SetVertexBuffer(lightVolumeBuffer);
|
||||
GameMain.Instance.GraphicsDevice.Indices = lightVolumeIndexBuffer;
|
||||
|
||||
GameMain.Instance.GraphicsDevice.DrawIndexedPrimitives
|
||||
(
|
||||
PrimitiveType.TriangleList, 0, 0, indexCount / 3
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user