Optimized GameScreen.DrawMap
- Downscaled lightmap, since blurring will make this unnoticeable anyway (TODO: make this optional) - Render LOS in fewer passes by using a shader - Use light volume to calculate LOS - This also means we can use the override texture to render the diving suit obstruct effect - Don't render bunks and labels onto LOS background (TODO: add the option to render back into the LOS background, i.e. just use multiplicative blending as if it was the lightmap) - Prefer SpriteSortMode.Deferred over all others, prefer SamplerState.LinearClamp/PointClamp over all others - Remove shader blur in favor of geometry blur (TODO: improve on this further, right now it has a few artifacts) - Trim light volumes - Do some weird shit with the background particles (use DrawTiled instead of relying on SamplerState.LinearWrap, because that's faster somehow :/ ) - Pressing up/down in the console only returns a typed command now
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
using Barotrauma.Particles;
|
using Barotrauma.Particles;
|
||||||
using FarseerPhysics;
|
using FarseerPhysics;
|
||||||
using FarseerPhysics.Dynamics;
|
using FarseerPhysics.Dynamics;
|
||||||
@@ -299,6 +299,14 @@ namespace Barotrauma
|
|||||||
if (info != null)
|
if (info != null)
|
||||||
{
|
{
|
||||||
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;
|
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;
|
||||||
|
Vector2 screenSize = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
|
Vector2 viewportSize = new Vector2(cam.WorldView.Width, cam.WorldView.Height);
|
||||||
|
namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y;
|
||||||
|
namePos *= screenSize / viewportSize;
|
||||||
|
namePos.X = (float)Math.Floor(namePos.X); namePos.Y = (float)Math.Floor(namePos.Y);
|
||||||
|
namePos *= viewportSize / screenSize;
|
||||||
|
namePos.X += cam.WorldView.X; namePos.Y -= cam.WorldView.Y;
|
||||||
|
|
||||||
Color nameColor = Color.White;
|
Color nameColor = Color.White;
|
||||||
|
|
||||||
if (Character.Controlled != null && TeamID != Character.Controlled.TeamID)
|
if (Character.Controlled != null && TeamID != Character.Controlled.TeamID)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using EventInput;
|
using EventInput;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
@@ -130,40 +130,40 @@ namespace Barotrauma
|
|||||||
get { return new Vector2(rect.Center.X, rect.Center.Y); }
|
get { return new Vector2(rect.Center.X, rect.Center.Y); }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Rectangle ClampRect(Rectangle r)
|
protected Rectangle ClampRect(Rectangle r)
|
||||||
{
|
{
|
||||||
if (parent == null) return r;
|
if (parent == null) return r;
|
||||||
Rectangle parentRect = parent.ClampRect(parent.rect);
|
Rectangle parentRect = parent.ClampRect(parent.rect);
|
||||||
if (parentRect.Width <= 0 || parentRect.Height <= 0) return Rectangle.Empty;
|
if (parentRect.Width <= 0 || parentRect.Height <= 0) return Rectangle.Empty;
|
||||||
if (parentRect.X > r.X)
|
if (parentRect.X > r.X)
|
||||||
{
|
{
|
||||||
int diff = parentRect.X - r.X;
|
int diff = parentRect.X - r.X;
|
||||||
r.X = parentRect.X;
|
r.X = parentRect.X;
|
||||||
r.Width -= diff;
|
r.Width -= diff;
|
||||||
}
|
}
|
||||||
if (parentRect.Y > r.Y)
|
if (parentRect.Y > r.Y)
|
||||||
{
|
{
|
||||||
int diff = parentRect.Y - r.Y;
|
int diff = parentRect.Y - r.Y;
|
||||||
r.Y = parentRect.Y;
|
r.Y = parentRect.Y;
|
||||||
r.Height -= diff;
|
r.Height -= diff;
|
||||||
}
|
}
|
||||||
if (parentRect.X + parentRect.Width < r.X + r.Width)
|
if (parentRect.X + parentRect.Width < r.X + r.Width)
|
||||||
{
|
{
|
||||||
int diff = (r.X + r.Width) - (parentRect.X + parentRect.Width);
|
int diff = (r.X + r.Width) - (parentRect.X + parentRect.Width);
|
||||||
r.Width -= diff;
|
r.Width -= diff;
|
||||||
}
|
}
|
||||||
if (parentRect.Y + parentRect.Height < r.Y + r.Height)
|
if (parentRect.Y + parentRect.Height < r.Y + r.Height)
|
||||||
{
|
{
|
||||||
int diff = (r.Y + r.Height) - (parentRect.Y + parentRect.Height);
|
int diff = (r.Y + r.Height) - (parentRect.Y + parentRect.Height);
|
||||||
r.Height -= diff;
|
r.Height -= diff;
|
||||||
}
|
}
|
||||||
if (r.Width <= 0 || r.Height <= 0) return Rectangle.Empty;
|
if (r.Width <= 0 || r.Height <= 0) return Rectangle.Empty;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Rectangle Rect
|
public virtual Rectangle Rect
|
||||||
{
|
{
|
||||||
get { return rect; }
|
get { return rect; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
int prevX = rect.X, prevY = rect.Y;
|
int prevX = rect.X, prevY = rect.Y;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public GUIMessage(string text, Color color, Vector2 position, float lifeTime, Alignment textAlignment, bool centered)
|
public GUIMessage(string text, Color color, Vector2 position, float lifeTime, Alignment textAlignment, bool centered)
|
||||||
{
|
{
|
||||||
coloredText = new ColoredText(text, color);
|
coloredText = new ColoredText(text, color, false);
|
||||||
pos = position;
|
pos = position;
|
||||||
this.lifeTime = lifeTime;
|
this.lifeTime = lifeTime;
|
||||||
this.Alignment = textAlignment;
|
this.Alignment = textAlignment;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
@@ -63,7 +63,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override Rectangle MouseRect
|
public override Rectangle MouseRect
|
||||||
{
|
{
|
||||||
get { return ClampRect(box.Rect); }
|
get { return ClampRect(box.Rect); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ScalableFont Font
|
public override ScalableFont Font
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Barotrauma.Lights;
|
using Barotrauma.Lights;
|
||||||
using Barotrauma.Particles;
|
using Barotrauma.Particles;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
@@ -76,9 +76,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lightSource.Range = Math.Max(size.X, size.Y) * 10.0f / 2.0f;
|
|
||||||
lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f);
|
lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f);
|
||||||
lightSource.Position = position + Vector2.UnitY * 30.0f;
|
if (Math.Abs((lightSource.Range * 0.2f) - Math.Max(size.X, size.Y)) > 1.0f) lightSource.Range = Math.Max(size.X, size.Y) * 5.0f;
|
||||||
|
if (Vector2.DistanceSquared(lightSource.Position,position) > 5.0f) lightSource.Position = position + Vector2.UnitY * 30.0f;
|
||||||
|
|
||||||
if (size.X > 256.0f)
|
if (size.X > 256.0f)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -63,6 +63,7 @@ namespace Barotrauma
|
|||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
dustOffset -= Vector2.UnitY * 10.0f * deltaTime;
|
dustOffset -= Vector2.UnitY * 10.0f * deltaTime;
|
||||||
|
while (dustOffset.Y <= -1024.0f) dustOffset.Y += 1024.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VertexPositionColorTexture[] GetColoredVertices(VertexPositionTexture[] vertices, Color color)
|
public static VertexPositionColorTexture[] GetColoredVertices(VertexPositionTexture[] vertices, Color color)
|
||||||
@@ -108,7 +109,7 @@ namespace Barotrauma
|
|||||||
Vector2 backgroundPos = cam.WorldViewCenter;
|
Vector2 backgroundPos = cam.WorldViewCenter;
|
||||||
|
|
||||||
backgroundPos.Y = -backgroundPos.Y;
|
backgroundPos.Y = -backgroundPos.Y;
|
||||||
backgroundPos /= 20.0f;
|
backgroundPos *= 0.05f;
|
||||||
|
|
||||||
if (backgroundPos.Y < 1024)
|
if (backgroundPos.Y < 1024)
|
||||||
{
|
{
|
||||||
@@ -130,35 +131,38 @@ namespace Barotrauma
|
|||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||||
BlendState.AlphaBlend,
|
BlendState.AlphaBlend,
|
||||||
SamplerState.LinearWrap, DepthStencilState.Default, null, null,
|
SamplerState.LinearWrap, DepthStencilState.Default, null, null,
|
||||||
cam.Transform);
|
cam.Transform);
|
||||||
|
|
||||||
|
Vector2 origin = new Vector2(cam.WorldView.X, -cam.WorldView.Y);
|
||||||
|
Vector2 offset = -origin + dustOffset;
|
||||||
|
while (offset.X <= -1024.0f) offset.X += 1024.0f;
|
||||||
|
while (offset.X > 0.0f) offset.X -= 1024.0f;
|
||||||
|
while (offset.Y <= -1024.0f) offset.Y += 1024.0f;
|
||||||
|
while (offset.Y > 0.0f) offset.Y -= 1024.0f;
|
||||||
|
|
||||||
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawSprites(spriteBatch, cam);
|
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawSprites(spriteBatch, cam);
|
||||||
if (backgroundCreatureManager != null) backgroundCreatureManager.Draw(spriteBatch);
|
if (backgroundCreatureManager != null) backgroundCreatureManager.Draw(spriteBatch);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
float scale = 1.0f - i * 0.2f;
|
float scale = 1.0f - i * 0.2f;
|
||||||
|
float recipScale = 1.0f / scale;
|
||||||
|
|
||||||
//alpha goes from 1.0 to 0.0 when scale is in the range of 0.2-0.1
|
//alpha goes from 1.0 to 0.0 when scale is in the range of 0.5-0.25
|
||||||
float alpha = (cam.Zoom * scale) < 0.2f ? (cam.Zoom * scale - 0.1f) * 10.0f : 1.0f;
|
float alpha = (cam.Zoom * scale) < 0.5f ? (cam.Zoom * scale - 0.25f) * 40.0f : 1.0f;
|
||||||
if (alpha <= 0.0f) continue;
|
if (alpha <= 0.0f) continue;
|
||||||
|
|
||||||
Vector2 offset = (new Vector2(cam.WorldViewCenter.X, cam.WorldViewCenter.Y) + dustOffset) * scale;
|
Vector2 offsetS = offset * scale + new Vector2(cam.WorldView.Width, cam.WorldView.Height) * (1.0f - scale) * 0.5f - new Vector2(256.0f * i);
|
||||||
Vector3 origin = new Vector3(cam.WorldView.Width, cam.WorldView.Height, 0.0f) * 0.5f;
|
while (offsetS.X <= -1024.0f*scale) offsetS.X += 1024.0f*scale;
|
||||||
|
while (offsetS.X > 0.0f) offsetS.X -= 1024.0f*scale;
|
||||||
|
while (offsetS.Y <= -1024.0f*scale) offsetS.Y += 1024.0f*scale;
|
||||||
|
while (offsetS.Y > 0.0f) offsetS.Y -= 1024.0f*scale;
|
||||||
|
|
||||||
dustParticles.SourceRect = new Rectangle(
|
Rectangle srcRect = new Rectangle(0, 0, 2048, 2048);
|
||||||
(int)((offset.X - origin.X + (i * 256)) / scale),
|
dustParticles.DrawTiled(spriteBatch, origin + offsetS, new Vector2(cam.WorldView.Width - offsetS.X, cam.WorldView.Height - offsetS.Y), Vector2.Zero, srcRect, Color.White * alpha, new Vector2(scale));
|
||||||
(int)((-offset.Y - origin.Y + (i * 256)) / scale),
|
|
||||||
(int)((cam.WorldView.Width) / scale),
|
|
||||||
(int)((cam.WorldView.Height) / scale));
|
|
||||||
|
|
||||||
spriteBatch.Draw(dustParticles.Texture,
|
|
||||||
new Vector2(cam.WorldViewCenter.X, -cam.WorldViewCenter.Y),
|
|
||||||
dustParticles.SourceRect, Color.White * alpha, 0.0f,
|
|
||||||
new Vector2(cam.WorldView.Width, cam.WorldView.Height) * 0.5f / scale, scale, SpriteEffects.None, 1.0f - scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
@@ -13,7 +13,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public VertexPositionTexture[] vertices = new VertexPositionTexture[DefaultBufferSize];
|
public VertexPositionTexture[] vertices = new VertexPositionTexture[DefaultBufferSize];
|
||||||
|
|
||||||
private Effect waterEffect;
|
public Effect waterEffect
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
private BasicEffect basicEffect;
|
private BasicEffect basicEffect;
|
||||||
|
|
||||||
public int PositionInBuffer = 0;
|
public int PositionInBuffer = 0;
|
||||||
@@ -93,7 +97,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
basicEffect.CurrentTechnique.Passes[0].Apply();
|
basicEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
graphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
|
graphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
|
||||||
graphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);
|
graphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -23,7 +23,17 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
public Color AmbientLight;
|
public Color AmbientLight;
|
||||||
|
|
||||||
RenderTarget2D lightMap, losTexture;
|
private float lightmapScale = 0.5f;
|
||||||
|
public RenderTarget2D lightMap
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
public RenderTarget2D losTexture
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
BasicEffect lightEffect;
|
BasicEffect lightEffect;
|
||||||
|
|
||||||
@@ -36,8 +46,9 @@ namespace Barotrauma.Lights
|
|||||||
public bool LightingEnabled = true;
|
public bool LightingEnabled = true;
|
||||||
|
|
||||||
public bool ObstructVision;
|
public bool ObstructVision;
|
||||||
|
LightSource losSource;
|
||||||
|
|
||||||
private Texture2D visionCircle;
|
private Sprite visionCircle;
|
||||||
|
|
||||||
private Dictionary<Hull, Color> hullAmbientLights;
|
private Dictionary<Hull, Color> hullAmbientLights;
|
||||||
private Dictionary<Hull, Color> smoothedHullAmbientLights;
|
private Dictionary<Hull, Color> smoothedHullAmbientLights;
|
||||||
@@ -50,21 +61,26 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
AmbientLight = new Color(20, 20, 20, 255);
|
AmbientLight = new Color(20, 20, 20, 255);
|
||||||
|
|
||||||
visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");
|
//visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");
|
||||||
|
visionCircle = new Sprite("Content/Lights/visioncircle.png", new Vector2(0.2f, 0.5f));
|
||||||
|
|
||||||
var pp = graphics.PresentationParameters;
|
var pp = graphics.PresentationParameters;
|
||||||
|
|
||||||
lightMap = new RenderTarget2D(graphics,
|
lightMap = new RenderTarget2D(graphics,
|
||||||
GameMain.GraphicsWidth, GameMain.GraphicsHeight, false,
|
(int)(GameMain.GraphicsWidth*lightmapScale), (int)(GameMain.GraphicsHeight*lightmapScale), false,
|
||||||
pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
|
pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
|
||||||
RenderTargetUsage.DiscardContents);
|
RenderTargetUsage.DiscardContents);
|
||||||
|
|
||||||
losTexture = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
losTexture = new RenderTarget2D(graphics, (int)(GameMain.GraphicsWidth*lightmapScale), (int)(GameMain.GraphicsHeight*lightmapScale), false, SurfaceFormat.Alpha8, DepthFormat.None);
|
||||||
|
|
||||||
|
losSource = new LightSource(Vector2.Zero, GameMain.GraphicsWidth, Color.White, null, false);
|
||||||
|
losSource.texture = new Texture2D(graphics, 1, 1);
|
||||||
|
losSource.texture.SetData(new Color[] { Color.White });// fill the texture with white
|
||||||
|
|
||||||
if (lightEffect == null)
|
if (lightEffect == null)
|
||||||
{
|
{
|
||||||
lightEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
lightEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
||||||
lightEffect.VertexColorEnabled = false;
|
lightEffect.VertexColorEnabled = true;
|
||||||
|
|
||||||
lightEffect.TextureEnabled = true;
|
lightEffect.TextureEnabled = true;
|
||||||
lightEffect.Texture = LightSource.LightTexture;
|
lightEffect.Texture = LightSource.LightTexture;
|
||||||
@@ -141,9 +157,9 @@ namespace Barotrauma.Lights
|
|||||||
//clear to some small ambient light
|
//clear to some small ambient light
|
||||||
graphics.Clear(AmbientLight);
|
graphics.Clear(AmbientLight);
|
||||||
graphics.BlendState = BlendState.Additive;
|
graphics.BlendState = BlendState.Additive;
|
||||||
|
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, cam.Transform * Matrix.CreateScale(new Vector3(lightmapScale, lightmapScale, 1.0f)));
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, cam.Transform);
|
|
||||||
|
|
||||||
Matrix transform = cam.ShaderTransform
|
Matrix transform = cam.ShaderTransform
|
||||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||||
|
|
||||||
@@ -158,8 +174,8 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
lightEffect.World = Matrix.CreateTranslation(offset) * transform;
|
lightEffect.World = Matrix.CreateTranslation(offset) * transform;
|
||||||
|
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
//GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
||||||
|
|
||||||
if (Character.Controlled != null)
|
if (Character.Controlled != null)
|
||||||
{
|
{
|
||||||
@@ -201,56 +217,43 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
public void UpdateObstructVision(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Vector2 lookAtPosition)
|
public void UpdateObstructVision(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Vector2 lookAtPosition)
|
||||||
{
|
{
|
||||||
if (!LosEnabled && !ObstructVision) return;
|
if (!LosEnabled || ViewTarget == null) return;
|
||||||
|
|
||||||
graphics.SetRenderTarget(losTexture);
|
graphics.SetRenderTarget(losTexture);
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, cam.Transform);
|
//--------------------------------------
|
||||||
|
|
||||||
|
graphics.Clear(Color.Black);
|
||||||
if (ObstructVision)
|
if (ObstructVision)
|
||||||
{
|
{
|
||||||
//graphics.Clear(Color.Black);
|
|
||||||
|
|
||||||
Vector2 diff = lookAtPosition - ViewTarget.WorldPosition;
|
Vector2 diff = lookAtPosition - ViewTarget.WorldPosition;
|
||||||
diff.Y = -diff.Y;
|
|
||||||
float rotation = MathUtils.VectorToAngle(diff);
|
float rotation = MathUtils.VectorToAngle(diff);
|
||||||
|
|
||||||
Vector2 scale = new Vector2(MathHelper.Clamp(diff.Length()/256.0f, 2.0f, 5.0f), 2.0f);
|
|
||||||
|
|
||||||
spriteBatch.Draw(visionCircle, new Vector2(ViewTarget.WorldPosition.X, -ViewTarget.WorldPosition.Y), null, Color.White, rotation,
|
Vector2 scale = new Vector2(MathHelper.Clamp(diff.Length() / 256.0f, 2.0f, 5.0f), 2.0f) * 0.3f;
|
||||||
new Vector2(LightSource.LightTexture.Width*0.2f, LightSource.LightTexture.Height/2), scale, SpriteEffects.None, 0.0f);
|
|
||||||
|
visionCircle.size = new Vector2(visionCircle.SourceRect.Width * scale.X, visionCircle.SourceRect.Height * scale.Y);
|
||||||
|
losSource.overrideLightTexture = visionCircle;
|
||||||
|
losSource.Rotation = rotation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
graphics.Clear(Color.White);
|
losSource.overrideLightTexture = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
spriteBatch.End();
|
graphics.BlendState = BlendState.Additive;
|
||||||
|
|
||||||
//--------------------------------------
|
Vector2 pos = ViewTarget.Position;
|
||||||
|
losSource.Position = pos;
|
||||||
|
losSource.NeedsRecalculation = true;
|
||||||
|
losSource.ParentSub = ViewTarget.Submarine;
|
||||||
|
|
||||||
if (LosEnabled && ViewTarget != null)
|
Matrix transform = cam.ShaderTransform
|
||||||
{
|
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||||
Vector2 pos = ViewTarget.WorldPosition;
|
|
||||||
|
losSource.Draw(spriteBatch, lightEffect, transform);
|
||||||
|
|
||||||
Rectangle camView = new Rectangle(cam.WorldView.X, cam.WorldView.Y - cam.WorldView.Height, cam.WorldView.Width, cam.WorldView.Height);
|
graphics.BlendState = BlendState.AlphaBlend;
|
||||||
|
|
||||||
Matrix shadowTransform = cam.ShaderTransform
|
|
||||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
|
||||||
|
|
||||||
var convexHulls = ConvexHull.GetHullsInRange(viewTarget.Position, cam.WorldView.Width*0.75f, viewTarget.Submarine);
|
|
||||||
|
|
||||||
if (convexHulls != null)
|
|
||||||
{
|
|
||||||
foreach (ConvexHull convexHull in convexHulls)
|
|
||||||
{
|
|
||||||
if (!convexHull.Intersects(camView)) continue;
|
|
||||||
//if (!camView.Intersects(convexHull.BoundingBox)) continue;
|
|
||||||
|
|
||||||
convexHull.DrawShadows(graphics, cam, pos, shadowTransform);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
graphics.SetRenderTarget(null);
|
graphics.SetRenderTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,22 +341,11 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
if (!LightingEnabled) return;
|
if (!LightingEnabled) return;
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, effect);
|
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, null);
|
||||||
spriteBatch.Draw(lightMap, Vector2.Zero, Color.White);
|
spriteBatch.Draw(lightMap, new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsHeight), Color.White);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawLOS(SpriteBatch spriteBatch, Effect effect,bool renderingBackground)
|
|
||||||
{
|
|
||||||
if (!LosEnabled || ViewTarget == null) return;
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, renderingBackground ? CustomBlendStates.LOS : CustomBlendStates.Multiplicative, null, null, null, effect);
|
|
||||||
spriteBatch.Draw(losTexture, Vector2.Zero, Color.White);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
if (!renderingBackground) ObstructVision = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearLights()
|
public void ClearLights()
|
||||||
{
|
{
|
||||||
lights.Clear();
|
lights.Clear();
|
||||||
@@ -376,16 +368,10 @@ namespace Barotrauma.Lights
|
|||||||
MultiplyWithAlpha = new BlendState();
|
MultiplyWithAlpha = new BlendState();
|
||||||
MultiplyWithAlpha.ColorDestinationBlend = MultiplyWithAlpha.AlphaDestinationBlend = Blend.One;
|
MultiplyWithAlpha.ColorDestinationBlend = MultiplyWithAlpha.AlphaDestinationBlend = Blend.One;
|
||||||
MultiplyWithAlpha.ColorSourceBlend = MultiplyWithAlpha.AlphaSourceBlend = Blend.DestinationAlpha;
|
MultiplyWithAlpha.ColorSourceBlend = MultiplyWithAlpha.AlphaSourceBlend = Blend.DestinationAlpha;
|
||||||
|
|
||||||
LOS = new BlendState();
|
|
||||||
LOS.ColorSourceBlend = LOS.AlphaSourceBlend = Blend.Zero;
|
|
||||||
LOS.ColorDestinationBlend = LOS.AlphaDestinationBlend = Blend.InverseSourceColor;
|
|
||||||
LOS.ColorBlendFunction = LOS.AlphaBlendFunction = BlendFunction.Add;
|
|
||||||
}
|
}
|
||||||
public static BlendState Multiplicative { get; private set; }
|
public static BlendState Multiplicative { get; private set; }
|
||||||
public static BlendState WriteToAlpha { get; private set; }
|
public static BlendState WriteToAlpha { get; private set; }
|
||||||
public static BlendState MultiplyWithAlpha { get; private set; }
|
public static BlendState MultiplyWithAlpha { get; private set; }
|
||||||
public static BlendState LOS { get; private set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -17,8 +17,8 @@ namespace Barotrauma.Lights
|
|||||||
private Color color;
|
private Color color;
|
||||||
private float range;
|
private float range;
|
||||||
|
|
||||||
private Sprite overrideLightTexture;
|
public Sprite overrideLightTexture;
|
||||||
private Texture2D texture;
|
public Texture2D texture;
|
||||||
|
|
||||||
public Sprite LightSprite;
|
public Sprite LightSprite;
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LightSource(Vector2 position, float range, Color color, Submarine submarine)
|
public LightSource(Vector2 position, float range, Color color, Submarine submarine, bool addLight=true)
|
||||||
{
|
{
|
||||||
hullsInRange = new List<ConvexHullList>();
|
hullsInRange = new List<ConvexHullList>();
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
diffToSub = new Dictionary<Submarine, Vector2>();
|
diffToSub = new Dictionary<Submarine, Vector2>();
|
||||||
|
|
||||||
GameMain.LightManager.AddLight(this);
|
if (addLight) GameMain.LightManager.AddLight(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void DrawShadows(GraphicsDevice graphics, Camera cam, Matrix shadowTransform)
|
/*public void DrawShadows(GraphicsDevice graphics, Camera cam, Matrix shadowTransform)
|
||||||
@@ -322,6 +322,7 @@ namespace Barotrauma.Lights
|
|||||||
hulls.AddRange(chList.List);
|
hulls.AddRange(chList.List);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float bounds = range*2;
|
||||||
//find convexhull segments that are close enough and facing towards the light source
|
//find convexhull segments that are close enough and facing towards the light source
|
||||||
List<Segment> visibleSegments = new List<Segment>();
|
List<Segment> visibleSegments = new List<Segment>();
|
||||||
List<SegmentPoint> points = new List<SegmentPoint>();
|
List<SegmentPoint> points = new List<SegmentPoint>();
|
||||||
@@ -336,6 +337,10 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
points.Add(s.Start);
|
points.Add(s.Start);
|
||||||
points.Add(s.End);
|
points.Add(s.End);
|
||||||
|
if (Math.Abs(s.Start.WorldPos.X - drawPos.X) > bounds) bounds = Math.Abs(s.Start.WorldPos.X - drawPos.X);
|
||||||
|
if (Math.Abs(s.Start.WorldPos.Y - drawPos.Y) > bounds) bounds = Math.Abs(s.Start.WorldPos.Y - drawPos.Y);
|
||||||
|
if (Math.Abs(s.End.WorldPos.X - drawPos.X) > bounds) bounds = Math.Abs(s.End.WorldPos.X - drawPos.X);
|
||||||
|
if (Math.Abs(s.End.WorldPos.Y - drawPos.Y) > bounds) bounds = Math.Abs(s.End.WorldPos.Y - drawPos.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,14 +349,21 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
//(might be more effective to calculate if we actually need these extra points)
|
//(might be more effective to calculate if we actually need these extra points)
|
||||||
var boundaryCorners = new List<SegmentPoint> {
|
var boundaryCorners = new List<SegmentPoint> {
|
||||||
new SegmentPoint(new Vector2(drawPos.X + range*2, drawPos.Y + range*2)),
|
new SegmentPoint(new Vector2(drawPos.X + bounds, drawPos.Y + bounds)),
|
||||||
new SegmentPoint(new Vector2(drawPos.X + range*2, drawPos.Y - range*2)),
|
new SegmentPoint(new Vector2(drawPos.X + bounds, drawPos.Y - bounds)),
|
||||||
new SegmentPoint(new Vector2(drawPos.X - range*2, drawPos.Y - range*2)),
|
new SegmentPoint(new Vector2(drawPos.X - bounds, drawPos.Y - bounds)),
|
||||||
new SegmentPoint(new Vector2(drawPos.X - range*2, drawPos.Y + range*2))
|
new SegmentPoint(new Vector2(drawPos.X - bounds, drawPos.Y + bounds))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//points.Clear();
|
||||||
points.AddRange(boundaryCorners);
|
points.AddRange(boundaryCorners);
|
||||||
|
|
||||||
|
//visibleSegments.Clear();
|
||||||
|
for (int i=0;i<4;i++)
|
||||||
|
{
|
||||||
|
visibleSegments.Add(new Segment(boundaryCorners[i], boundaryCorners[(i + 1) % 4]));
|
||||||
|
}
|
||||||
|
|
||||||
var compareCCW = new CompareSegmentPointCW(drawPos);
|
var compareCCW = new CompareSegmentPointCW(drawPos);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -368,14 +380,16 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Vector2> output = new List<Vector2>();
|
List<Vector2> output = new List<Vector2>();
|
||||||
|
//List<Pair<int, Vector2>> preOutput = new List<Pair<int, Vector2>>();
|
||||||
|
|
||||||
//remove points that are very close to each other
|
//remove points that are very close to each other
|
||||||
for (int i = 0; i < points.Count - 1; i++)
|
for (int i = 0; i < points.Count - 1; i++)
|
||||||
{
|
{
|
||||||
if (Math.Abs(points[i].WorldPos.X - points[i + 1].WorldPos.X) < 3 &&
|
if (Math.Abs(points[i].WorldPos.X - points[i + 1].WorldPos.X) < 6 &&
|
||||||
Math.Abs(points[i].WorldPos.Y - points[i + 1].WorldPos.Y) < 3)
|
Math.Abs(points[i].WorldPos.Y - points[i + 1].WorldPos.Y) < 6)
|
||||||
{
|
{
|
||||||
points.RemoveAt(i + 1);
|
points.RemoveAt(i + 1);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,32 +399,52 @@ namespace Barotrauma.Lights
|
|||||||
Vector2 dirNormal = new Vector2(-dir.Y, dir.X)*3;
|
Vector2 dirNormal = new Vector2(-dir.Y, dir.X)*3;
|
||||||
|
|
||||||
//do two slightly offset raycasts to hit the segment itself and whatever's behind it
|
//do two slightly offset raycasts to hit the segment itself and whatever's behind it
|
||||||
Vector2 intersection1 = RayCast(drawPos, drawPos + dir * range * 2 - dirNormal, visibleSegments);
|
Pair<int,Vector2> intersection1 = RayCast(drawPos, drawPos + dir * bounds * 2 - dirNormal, visibleSegments);
|
||||||
Vector2 intersection2 = RayCast(drawPos, drawPos + dir * range * 2 + dirNormal, visibleSegments);
|
Pair<int,Vector2> intersection2 = RayCast(drawPos, drawPos + dir * bounds * 2 + dirNormal, visibleSegments);
|
||||||
|
|
||||||
//hit almost the same position -> only add one vertex to output
|
if (intersection1.First < 0) return new List<Vector2>();
|
||||||
if ((Math.Abs(intersection1.X - intersection2.X) < 5 &&
|
if (intersection2.First < 0) return new List<Vector2>();
|
||||||
Math.Abs(intersection1.Y - intersection2.Y) < 5))
|
Segment seg1 = visibleSegments[intersection1.First];
|
||||||
|
Segment seg2 = visibleSegments[intersection2.First];
|
||||||
|
|
||||||
|
bool isPoint1 = MathUtils.LineToPointDistance(seg1.Start.WorldPos, seg1.End.WorldPos, p.WorldPos) < 5.0f;
|
||||||
|
bool isPoint2 = MathUtils.LineToPointDistance(seg2.Start.WorldPos, seg2.End.WorldPos, p.WorldPos) < 5.0f;
|
||||||
|
|
||||||
|
//hit at the current segmentpoint -> place the segmentpoint into the list
|
||||||
|
if (isPoint1 && isPoint2)
|
||||||
{
|
{
|
||||||
output.Add(intersection1);
|
output.Add(p.WorldPos);
|
||||||
}
|
}
|
||||||
else
|
else if (intersection1.First != intersection2.First)
|
||||||
{
|
{
|
||||||
output.Add(intersection1);
|
output.Add(isPoint1 ? p.WorldPos : intersection1.Second);
|
||||||
output.Add(intersection2);
|
output.Add(isPoint2 ? p.WorldPos : intersection2.Second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//remove points that are very close to each other
|
||||||
|
for (int i = 0; i < output.Count - 1; i++)
|
||||||
|
{
|
||||||
|
if (Math.Abs(output[i].X - output[i + 1].X) < 6 &&
|
||||||
|
Math.Abs(output[i].Y - output[i + 1].Y) < 6)
|
||||||
|
{
|
||||||
|
output.RemoveAt(i + 1);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 RayCast(Vector2 rayStart, Vector2 rayEnd, List<Segment> segments)
|
private Pair<int,Vector2> RayCast(Vector2 rayStart, Vector2 rayEnd, List<Segment> segments)
|
||||||
{
|
{
|
||||||
float closestDist = 0.0f;
|
float closestDist = 0.0f;
|
||||||
Vector2? closestIntersection = null;
|
Vector2? closestIntersection = null;
|
||||||
|
int segment = -1;
|
||||||
foreach (Segment s in segments)
|
|
||||||
|
for (int i=0;i<segments.Count;i++)
|
||||||
{
|
{
|
||||||
|
Segment s = segments[i];
|
||||||
Vector2? intersection = MathUtils.GetAxisAlignedLineIntersection(rayStart, rayEnd, s.Start.WorldPos, s.End.WorldPos, s.IsHorizontal);
|
Vector2? intersection = MathUtils.GetAxisAlignedLineIntersection(rayStart, rayEnd, s.Start.WorldPos, s.End.WorldPos, s.IsHorizontal);
|
||||||
|
|
||||||
if (intersection != null)
|
if (intersection != null)
|
||||||
@@ -420,16 +454,20 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
closestDist = dist;
|
closestDist = dist;
|
||||||
closestIntersection = intersection;
|
closestIntersection = intersection;
|
||||||
|
segment = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return closestIntersection == null ? rayEnd : (Vector2)closestIntersection;
|
Pair<int,Vector2> retVal = new Pair<int,Vector2>();
|
||||||
|
retVal.Second = closestIntersection == null ? rayEnd : (Vector2)closestIntersection;
|
||||||
|
retVal.First = segment;
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateLightVertices(List<Vector2> rayCastHits)
|
private void CalculateLightVertices(List<Vector2> rayCastHits)
|
||||||
{
|
{
|
||||||
List<VertexPositionTexture> vertices = new List<VertexPositionTexture>();
|
List<VertexPositionColorTexture> vertices = new List<VertexPositionColorTexture>();
|
||||||
|
|
||||||
Vector2 drawPos = position;
|
Vector2 drawPos = position;
|
||||||
if (ParentSub != null) drawPos += ParentSub.DrawPosition;
|
if (ParentSub != null) drawPos += ParentSub.DrawPosition;
|
||||||
@@ -446,16 +484,19 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a vertex for the center of the mesh
|
// Add a vertex for the center of the mesh
|
||||||
vertices.Add(new VertexPositionTexture(new Vector3(position.X, position.Y, 0),
|
vertices.Add(new VertexPositionColorTexture(new Vector3(position.X, position.Y, 0),
|
||||||
new Vector2(0.5f, 0.5f) + uvOffset));
|
Color.White,new Vector2(0.5f, 0.5f) + uvOffset));
|
||||||
|
|
||||||
// Add all the other encounter points as vertices
|
// Add all the other encounter points as vertices
|
||||||
// storing their world position as UV coordinates
|
// storing their world position as UV coordinates
|
||||||
foreach (Vector2 vertex in rayCastHits)
|
for (int i = 0; i < rayCastHits.Count; i++)
|
||||||
{
|
{
|
||||||
|
Vector2 vertex = rayCastHits[i];
|
||||||
|
Vector2 prevVertex = rayCastHits[i > 0 ? i - 1 : rayCastHits.Count - 1];
|
||||||
|
Vector2 nextVertex = rayCastHits[i < rayCastHits.Count - 1 ? i + 1 : 0];
|
||||||
Vector2 rawDiff = vertex - drawPos;
|
Vector2 rawDiff = vertex - drawPos;
|
||||||
Vector2 diff = rawDiff;
|
Vector2 diff = rawDiff;
|
||||||
diff /= range*2.0f;
|
diff /= range * 2.0f;
|
||||||
if (overrideLightTexture != null)
|
if (overrideLightTexture != null)
|
||||||
{
|
{
|
||||||
Vector2 originDiff = diff;
|
Vector2 originDiff = diff;
|
||||||
@@ -467,22 +508,52 @@ namespace Barotrauma.Lights
|
|||||||
diff += uvOffset;
|
diff += uvOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
vertices.Add(new VertexPositionTexture(new Vector3(position.X + rawDiff.X, position.Y + rawDiff.Y, 0),
|
Vector2 nDiff1 = vertex - nextVertex;
|
||||||
new Vector2(0.5f, 0.5f) + diff));
|
float tx = nDiff1.X; nDiff1.X = -nDiff1.Y; nDiff1.Y = tx;
|
||||||
|
nDiff1 /= Math.Max(Math.Abs(nDiff1.X), Math.Abs(nDiff1.Y));
|
||||||
|
Vector2 nDiff2 = prevVertex - vertex;
|
||||||
|
tx = nDiff2.X; nDiff2.X = -nDiff2.Y; nDiff2.Y = tx;
|
||||||
|
nDiff2 /= Math.Max(Math.Abs(nDiff2.X),Math.Abs(nDiff2.Y));
|
||||||
|
Vector2 nDiff = nDiff1 + nDiff2;
|
||||||
|
nDiff /= Math.Max(Math.Abs(nDiff.X), Math.Abs(nDiff.Y));
|
||||||
|
nDiff *= 50.0f;
|
||||||
|
if (Vector2.DistanceSquared(nDiff, rawDiff) > Vector2.DistanceSquared(-nDiff, rawDiff)) nDiff = -nDiff;
|
||||||
|
VertexPositionColorTexture fadeVert = new VertexPositionColorTexture(new Vector3(position.X + rawDiff.X + nDiff.X, position.Y + rawDiff.Y + nDiff.Y, 0),
|
||||||
|
Color.White * 0.0f, new Vector2(0.5f, 0.5f) + diff);
|
||||||
|
|
||||||
|
vertices.Add(new VertexPositionColorTexture(new Vector3(position.X + rawDiff.X, position.Y + rawDiff.Y, 0),
|
||||||
|
Color.White, new Vector2(0.5f, 0.5f) + diff));
|
||||||
|
vertices.Add(fadeVert);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the indices to form triangles
|
// Compute the indices to form triangles
|
||||||
List<short> indices = new List<short>();
|
List<short> indices = new List<short>();
|
||||||
for (int i = 0; i < rayCastHits.Count - 1; i++)
|
for (int i = 0; i < rayCastHits.Count-1; i++)
|
||||||
{
|
{
|
||||||
indices.Add(0);
|
indices.Add(0);
|
||||||
indices.Add((short)((i + 2) % vertices.Count));
|
indices.Add((short)((i*2 + 3) % vertices.Count));
|
||||||
indices.Add((short)((i + 1) % vertices.Count));
|
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||||
|
|
||||||
|
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||||
|
indices.Add((short)((i*2 + 3) % vertices.Count));
|
||||||
|
indices.Add((short)((i*2 + 4) % vertices.Count));
|
||||||
|
|
||||||
|
indices.Add((short)((i*2 + 2) % vertices.Count));
|
||||||
|
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||||
|
indices.Add((short)((i*2 + 4) % vertices.Count));
|
||||||
}
|
}
|
||||||
|
|
||||||
indices.Add(0);
|
indices.Add(0);
|
||||||
indices.Add((short)(1));
|
indices.Add((short)(1));
|
||||||
indices.Add((short)(vertices.Count - 1));
|
indices.Add((short)(vertices.Count - 2));
|
||||||
|
|
||||||
|
indices.Add((short)(1));
|
||||||
|
indices.Add((short)(vertices.Count-1));
|
||||||
|
indices.Add((short)(vertices.Count-2));
|
||||||
|
|
||||||
|
indices.Add((short)(1));
|
||||||
|
indices.Add((short)(2));
|
||||||
|
indices.Add((short)(vertices.Count-1));
|
||||||
|
|
||||||
vertexCount = vertices.Count;
|
vertexCount = vertices.Count;
|
||||||
indexCount = indices.Count;
|
indexCount = indices.Count;
|
||||||
@@ -491,19 +562,19 @@ namespace Barotrauma.Lights
|
|||||||
//now we just create a buffer for 64 verts and make it larger if needed
|
//now we just create a buffer for 64 verts and make it larger if needed
|
||||||
if (lightVolumeBuffer == null)
|
if (lightVolumeBuffer == null)
|
||||||
{
|
{
|
||||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, Math.Max(64, (int)(vertexCount*1.5)), BufferUsage.None);
|
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColorTexture.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);
|
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), Math.Max(64*3, (int)(indexCount * 1.5)), BufferUsage.None);
|
||||||
}
|
}
|
||||||
else if (vertexCount > lightVolumeBuffer.VertexCount)
|
else if (vertexCount > lightVolumeBuffer.VertexCount || indexCount > lightVolumeIndexBuffer.IndexCount)
|
||||||
{
|
{
|
||||||
lightVolumeBuffer.Dispose();
|
lightVolumeBuffer.Dispose();
|
||||||
lightVolumeIndexBuffer.Dispose();
|
lightVolumeIndexBuffer.Dispose();
|
||||||
|
|
||||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, (int)(vertexCount*1.5), BufferUsage.None);
|
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColorTexture.VertexDeclaration, (int)(vertexCount*1.5), BufferUsage.None);
|
||||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), (int)(indexCount * 1.5), BufferUsage.None);
|
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), (int)(indexCount * 1.5), BufferUsage.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
lightVolumeBuffer.SetData<VertexPositionTexture>(vertices.ToArray());
|
lightVolumeBuffer.SetData<VertexPositionColorTexture>(vertices.ToArray());
|
||||||
lightVolumeIndexBuffer.SetData<short>(indices.ToArray());
|
lightVolumeIndexBuffer.SetData<short>(indices.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,7 +633,7 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lightEffect.Texture = LightTexture;
|
lightEffect.Texture = texture??LightTexture;
|
||||||
}
|
}
|
||||||
lightEffect.CurrentTechnique.Passes[0].Apply();
|
lightEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
@@ -571,6 +642,7 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
GameMain.Instance.GraphicsDevice.DrawIndexedPrimitives
|
GameMain.Instance.GraphicsDevice.DrawIndexedPrimitives
|
||||||
(
|
(
|
||||||
|
//PrimitiveType.LineList, 0, 0, indexCount / 2
|
||||||
PrimitiveType.TriangleList, 0, 0, indexCount / 3
|
PrimitiveType.TriangleList, 0, 0, indexCount / 3
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ namespace Barotrauma.Particles
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Hull newHull = Hull.FindHull(position);
|
Hull newHull = Hull.FindHull(position,currentHull);
|
||||||
if (newHull != currentHull)
|
if (newHull != currentHull)
|
||||||
{
|
{
|
||||||
currentHull = newHull;
|
currentHull = newHull;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
@@ -14,7 +14,7 @@ namespace Barotrauma
|
|||||||
readonly RenderTarget2D renderTargetBackground;
|
readonly RenderTarget2D renderTargetBackground;
|
||||||
readonly RenderTarget2D renderTarget;
|
readonly RenderTarget2D renderTarget;
|
||||||
readonly RenderTarget2D renderTargetWater;
|
readonly RenderTarget2D renderTargetWater;
|
||||||
readonly RenderTarget2D renderTargetAir;
|
readonly RenderTarget2D renderTargetFinal;
|
||||||
|
|
||||||
private Effect damageEffect;
|
private Effect damageEffect;
|
||||||
|
|
||||||
@@ -27,9 +27,9 @@ namespace Barotrauma
|
|||||||
cam.Translate(new Vector2(-10.0f, 50.0f));
|
cam.Translate(new Vector2(-10.0f, 50.0f));
|
||||||
|
|
||||||
renderTargetBackground = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
renderTargetBackground = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
|
||||||
renderTargetWater = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
renderTargetWater = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
renderTargetAir = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
renderTargetFinal = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false, SurfaceFormat.Color, DepthFormat.None);
|
||||||
|
|
||||||
|
|
||||||
#if LINUX
|
#if LINUX
|
||||||
@@ -97,7 +97,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (Submarine sub in Submarine.Loaded)
|
foreach (Submarine sub in Submarine.Loaded)
|
||||||
{
|
{
|
||||||
sub.UpdateTransform();
|
sub.UpdateTransform();
|
||||||
@@ -113,197 +112,137 @@ namespace Barotrauma
|
|||||||
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled.CursorWorldPosition);
|
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled.CursorWorldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//1. draw the background, characters and the parts of the submarine that are behind them
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
graphics.SetRenderTarget(renderTargetBackground);
|
graphics.SetRenderTarget(renderTargetBackground);
|
||||||
|
|
||||||
if (Level.Loaded == null)
|
if (Level.Loaded == null)
|
||||||
{
|
{
|
||||||
graphics.Clear(new Color(11, 18, 26, 255));
|
graphics.Clear(new Color(11, 18, 26, 255));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//graphics.Clear(new Color(255, 255, 255, 255));
|
||||||
Level.Loaded.DrawBack(graphics, spriteBatch, cam);
|
Level.Loaded.DrawBack(graphics, spriteBatch, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw structures that are in water and not part of any sub (e.g. ruins)
|
//draw alpha blended particles that are in water and behind subs
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, cam.Transform);
|
|
||||||
Submarine.DrawBack(spriteBatch, false, s => s is Structure && s.Submarine == null);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//draw alpha blended particles that are in water and behind subs
|
|
||||||
#if LINUX
|
#if LINUX
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
#else
|
#else
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
#endif
|
#endif
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.AlphaBlend);
|
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.AlphaBlend);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
//draw additive particles that are in water and behind subs
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.Additive);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//draw submarine structures that are behind water
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, cam.Transform);
|
|
||||||
Submarine.DrawBack(spriteBatch, false, s => s is Structure && s.Submarine != null);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
|
//draw additive particles that are in water and behind subs
|
||||||
|
//TODO: make these draw properly somehow, since they're not rendered into the lightmap anymore
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
|
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.Additive);
|
||||||
|
spriteBatch.End();
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
|
Submarine.DrawBack(spriteBatch, false, s => s is Structure && ((Structure)s).ResizeVertical && ((Structure)s).ResizeHorizontal);
|
||||||
|
foreach (Structure s in Structure.WallList)
|
||||||
|
{
|
||||||
|
if ((s.ResizeVertical != s.ResizeHorizontal) && s.CastShadow)
|
||||||
|
{
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Vector2(s.DrawPosition.X-s.WorldRect.Width/2,-s.DrawPosition.Y-s.WorldRect.Height/2), new Vector2(s.WorldRect.Width, s.WorldRect.Height), Color.Black, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spriteBatch.End();
|
||||||
graphics.SetRenderTarget(renderTarget);
|
graphics.SetRenderTarget(renderTarget);
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, null);
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
BlendState.Opaque);
|
spriteBatch.End();
|
||||||
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
spriteBatch.End();
|
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
|
||||||
|
Submarine.DrawBack(spriteBatch, false, s => s is Structure && !(((Structure)s).ResizeVertical && ((Structure)s).ResizeHorizontal));
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
|
||||||
BlendState.AlphaBlend,
|
|
||||||
null, null, null, null,
|
|
||||||
cam.Transform);
|
|
||||||
|
|
||||||
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
|
|
||||||
|
|
||||||
foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
|
foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, null, null, cam.Transform);
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//draw the rendertarget and particles that are only supposed to be drawn in water into renderTargetWater
|
|
||||||
graphics.SetRenderTarget(renderTargetWater);
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
|
|
||||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), waterColor);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//draw alpha blended particles that are inside a sub
|
|
||||||
#if LINUX
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
|
||||||
#else
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
|
||||||
#endif
|
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.AlphaBlend);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//draw additive particles that are inside a sub
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.Additive);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//draw the rendertarget and particles that are only supposed to be drawn in air into renderTargetAir
|
|
||||||
|
|
||||||
graphics.SetRenderTarget(renderTargetAir);
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
|
|
||||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//draw alpha blended particles that are not in water
|
|
||||||
#if LINUX
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
|
||||||
#else
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
|
||||||
#endif
|
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.AlphaBlend);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//draw additive particles that are not in water
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
if (Character.Controlled != null && GameMain.LightManager.LosEnabled)
|
|
||||||
{
|
|
||||||
graphics.SetRenderTarget(renderTarget);
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
|
||||||
BlendState.Opaque, null, null, null, lightBlur.Effect);
|
|
||||||
|
|
||||||
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
|
||||||
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
|
||||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
|
||||||
null, null, null,
|
|
||||||
cam.Transform);
|
|
||||||
|
|
||||||
Submarine.DrawDamageable(spriteBatch, null, false);
|
|
||||||
Submarine.DrawFront(spriteBatch, false, s => s is Structure);
|
|
||||||
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
graphics.SetRenderTarget(null);
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//2. pass the renderTarget to the water shader to do the water effect
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Hull.renderer.RenderBack(spriteBatch, renderTargetWater);
|
|
||||||
|
|
||||||
Array.Clear(Hull.renderer.vertices, 0, Hull.renderer.vertices.Length);
|
|
||||||
Hull.renderer.PositionInBuffer = 0;
|
|
||||||
foreach (Hull hull in Hull.hullList)
|
|
||||||
{
|
|
||||||
hull.Render(graphics, cam);
|
|
||||||
}
|
|
||||||
|
|
||||||
Hull.renderer.Render(graphics, cam, renderTargetAir, Cam.ShaderTransform);
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//3. draw the sections of the map that are on top of the water
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
|
||||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
|
||||||
null, null, null,
|
|
||||||
cam.Transform);
|
|
||||||
|
|
||||||
Submarine.DrawFront(spriteBatch, false, null);
|
Submarine.DrawFront(spriteBatch, false, null);
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
//draw the rendertarget and particles that are only supposed to be drawn in water into renderTargetWater
|
||||||
BlendState.NonPremultiplied, SamplerState.LinearWrap,
|
graphics.SetRenderTarget(renderTargetWater);
|
||||||
null, null,
|
|
||||||
damageEffect,
|
|
||||||
cam.Transform);
|
|
||||||
|
|
||||||
Submarine.DrawDamageable(spriteBatch, damageEffect, false);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
|
||||||
|
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), waterColor);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
spriteBatch.End();
|
//draw alpha blended particles that are inside a sub
|
||||||
|
#if LINUX
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||||
|
#else
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||||
|
#endif
|
||||||
|
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.AlphaBlend);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
GameMain.LightManager.DrawLightMap(spriteBatch, lightBlur.Effect);
|
graphics.SetRenderTarget(renderTarget);
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
//draw alpha blended particles that are not in water
|
||||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
#if LINUX
|
||||||
null, null, null,
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||||
cam.Transform);
|
#else
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||||
|
#endif
|
||||||
|
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.AlphaBlend);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch);
|
//draw additive particles that are not in water
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
|
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
graphics.SetRenderTarget(renderTargetFinal);
|
||||||
|
Hull.renderer.RenderBack(spriteBatch, renderTargetWater);
|
||||||
|
|
||||||
spriteBatch.End();
|
Array.Clear(Hull.renderer.vertices, 0, Hull.renderer.vertices.Length);
|
||||||
|
Hull.renderer.PositionInBuffer = 0;
|
||||||
|
foreach (Hull hull in Hull.hullList)
|
||||||
|
{
|
||||||
|
hull.Render(graphics, cam);
|
||||||
|
}
|
||||||
|
|
||||||
if (Character.Controlled != null && GameMain.LightManager.LosEnabled)
|
Hull.renderer.Render(graphics, cam, renderTarget, Cam.ShaderTransform);
|
||||||
{
|
|
||||||
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, false);
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
spriteBatch.Begin(SpriteSortMode.Immediate,
|
||||||
BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullNone, null);
|
BlendState.NonPremultiplied, SamplerState.LinearWrap,
|
||||||
|
null, null,
|
||||||
|
damageEffect,
|
||||||
|
cam.Transform);
|
||||||
|
Submarine.DrawDamageable(spriteBatch, damageEffect, false);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.5f);
|
//draw additive particles that are inside a sub
|
||||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
||||||
Color.Lerp(GameMain.LightManager.AmbientLight * 0.5f, Color.Red, r));
|
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.Additive);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
spriteBatch.End();
|
if (GameMain.LightManager.LightingEnabled)
|
||||||
}
|
{
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, Lights.CustomBlendStates.Multiplicative, null, DepthStencilState.None, null, null, null);
|
||||||
|
spriteBatch.Draw(GameMain.LightManager.lightMap, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
|
spriteBatch.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, null, null, cam.Transform);
|
||||||
|
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
||||||
|
|
||||||
|
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
|
graphics.SetRenderTarget(null);
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.PointClamp, DepthStencilState.None, null, null, null);
|
||||||
|
if (GameMain.LightManager.LosEnabled && Character.Controlled!=null)
|
||||||
|
{
|
||||||
|
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), new Color(10, 24, 30, 255));
|
||||||
|
spriteBatch.End();
|
||||||
|
Hull.renderer.waterEffect.CurrentTechnique = Hull.renderer.waterEffect.Techniques["LosShader"];
|
||||||
|
Hull.renderer.waterEffect.Parameters["xLosTexture"].SetValue(GameMain.LightManager.losTexture);
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, null, Hull.renderer.waterEffect, null);
|
||||||
|
}
|
||||||
|
spriteBatch.Draw(renderTargetFinal, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -186,18 +186,23 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color)
|
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color)
|
||||||
{
|
{
|
||||||
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color);
|
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color, Vector2.One);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color)
|
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color)
|
||||||
|
{
|
||||||
|
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color, Vector2.One);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color, Vector2 scale)
|
||||||
{
|
{
|
||||||
//pos.X = (int)pos.X;
|
//pos.X = (int)pos.X;
|
||||||
//pos.Y = (int)pos.Y;
|
//pos.Y = (int)pos.Y;
|
||||||
|
|
||||||
//how many times the texture needs to be drawn on the x-axis
|
//how many times the texture needs to be drawn on the x-axis
|
||||||
int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / sourceRect.Width);
|
int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / (sourceRect.Width*scale.X));
|
||||||
//how many times the texture needs to be drawn on the y-axis
|
//how many times the texture needs to be drawn on the y-axis
|
||||||
int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / sourceRect.Height);
|
int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / (sourceRect.Height*scale.Y));
|
||||||
|
|
||||||
Vector2 position = pos - startOffset;
|
Vector2 position = pos - startOffset;
|
||||||
Rectangle drawRect = sourceRect;
|
Rectangle drawRect = sourceRect;
|
||||||
@@ -211,11 +216,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (x == xTiles - 1)
|
if (x == xTiles - 1)
|
||||||
{
|
{
|
||||||
drawRect.Width -= (int)((position.X + sourceRect.Width) - (pos.X + targetSize.X));
|
drawRect.Width -= (int)((position.X + sourceRect.Width*scale.X) - (pos.X + targetSize.X));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawRect.Width = sourceRect.Width;
|
drawRect.Width = (int)(sourceRect.Width*scale.X);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position.X < pos.X)
|
if (position.X < pos.X)
|
||||||
@@ -234,11 +239,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (y == yTiles - 1)
|
if (y == yTiles - 1)
|
||||||
{
|
{
|
||||||
drawRect.Height -= (int)((position.Y + sourceRect.Height) - (pos.Y + targetSize.Y));
|
drawRect.Height -= (int)((position.Y + sourceRect.Height*scale.Y) - (pos.Y + targetSize.Y));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawRect.Height = sourceRect.Height;
|
drawRect.Height = (int)(sourceRect.Height*scale.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position.Y < pos.Y)
|
if (position.Y < pos.Y)
|
||||||
@@ -252,10 +257,10 @@ namespace Barotrauma
|
|||||||
spriteBatch.Draw(texture, position,
|
spriteBatch.Draw(texture, position,
|
||||||
drawRect, color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
drawRect, color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
||||||
|
|
||||||
position.Y += sourceRect.Height;
|
position.Y += sourceRect.Height*scale.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
position.X += sourceRect.Width;
|
position.X += sourceRect.Width*scale.X;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Color = Microsoft.Xna.Framework.Color;
|
using Color = Microsoft.Xna.Framework.Color;
|
||||||
@@ -44,7 +44,7 @@ namespace Barotrauma
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
using (Stream fileStream = File.OpenRead(path))
|
using (Stream fileStream = File.OpenRead(path))
|
||||||
{
|
{
|
||||||
var texture = Texture2D.FromStream(_graphicsDevice, fileStream);
|
var texture = Texture2D.FromStream(_graphicsDevice, fileStream);
|
||||||
texture = PreMultiplyAlpha(texture);
|
texture = PreMultiplyAlpha(texture);
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
// |-------|-------|-------|-------
|
// |-------|-------|-------|-------
|
||||||
// A B G R
|
// A B G R
|
||||||
private uint _packedValue;
|
private uint _packedValue;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs an RGBA color from a packed value.
|
/// Constructs an RGBA color from a packed value.
|
||||||
/// The value is a 32-bit unsigned integer, with R in the least significant octet.
|
/// The value is a 32-bit unsigned integer, with R in the least significant octet.
|
||||||
@@ -384,8 +384,8 @@ namespace Microsoft.Xna.Framework
|
|||||||
this._packedValue = (this._packedValue & 0x00ffffff) | ((uint)value << 24);
|
this._packedValue = (this._packedValue & 0x00ffffff) | ((uint)value << 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares whether two <see cref="Color"/> instances are equal.
|
/// Compares whether two <see cref="Color"/> instances are equal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="a"><see cref="Color"/> instance on the left of the equal sign.</param>
|
/// <param name="a"><see cref="Color"/> instance on the left of the equal sign.</param>
|
||||||
@@ -395,13 +395,13 @@ namespace Microsoft.Xna.Framework
|
|||||||
{
|
{
|
||||||
return (a._packedValue == b._packedValue);
|
return (a._packedValue == b._packedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares whether two <see cref="Color"/> instances are not equal.
|
/// Compares whether two <see cref="Color"/> instances are not equal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="a"><see cref="Color"/> instance on the left of the not equal sign.</param>
|
/// <param name="a"><see cref="Color"/> instance on the left of the not equal sign.</param>
|
||||||
/// <param name="b"><see cref="Color"/> instance on the right of the not equal sign.</param>
|
/// <param name="b"><see cref="Color"/> instance on the right of the not equal sign.</param>
|
||||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||||
public static bool operator !=(Color a, Color b)
|
public static bool operator !=(Color a, Color b)
|
||||||
{
|
{
|
||||||
return (a._packedValue != b._packedValue);
|
return (a._packedValue != b._packedValue);
|
||||||
@@ -415,7 +415,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
{
|
{
|
||||||
return this._packedValue.GetHashCode();
|
return this._packedValue.GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares whether current instance is equal to specified object.
|
/// Compares whether current instance is equal to specified object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -444,8 +444,8 @@ namespace Microsoft.Xna.Framework
|
|||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AliceBlue color (R:240,G:248,B:255,A:255).
|
/// AliceBlue color (R:240,G:248,B:255,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color AliceBlue
|
public static Color AliceBlue
|
||||||
@@ -466,13 +466,13 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Aqua color (R:0,G:255,B:255,A:255).
|
/// Aqua color (R:0,G:255,B:255,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Aqua
|
public static Color Aqua
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Aquamarine color (R:127,G:255,B:212,A:255).
|
/// Aquamarine color (R:127,G:255,B:212,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Aquamarine
|
public static Color Aquamarine
|
||||||
@@ -484,13 +484,13 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Azure color (R:240,G:255,B:255,A:255).
|
/// Azure color (R:240,G:255,B:255,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Azure
|
public static Color Azure
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Beige color (R:245,G:245,B:220,A:255).
|
/// Beige color (R:245,G:245,B:220,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Beige
|
public static Color Beige
|
||||||
@@ -610,13 +610,13 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cornsilk color (R:255,G:248,B:220,A:255).
|
/// Cornsilk color (R:255,G:248,B:220,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Cornsilk
|
public static Color Cornsilk
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Crimson color (R:220,G:20,B:60,A:255).
|
/// Crimson color (R:220,G:20,B:60,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Crimson
|
public static Color Crimson
|
||||||
@@ -637,13 +637,13 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DarkBlue color (R:0,G:0,B:139,A:255).
|
/// DarkBlue color (R:0,G:0,B:139,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color DarkBlue
|
public static Color DarkBlue
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DarkCyan color (R:0,G:139,B:139,A:255).
|
/// DarkCyan color (R:0,G:139,B:139,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color DarkCyan
|
public static Color DarkCyan
|
||||||
@@ -664,13 +664,13 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DarkGray color (R:169,G:169,B:169,A:255).
|
/// DarkGray color (R:169,G:169,B:169,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color DarkGray
|
public static Color DarkGray
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DarkGreen color (R:0,G:100,B:0,A:255).
|
/// DarkGreen color (R:0,G:100,B:0,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color DarkGreen
|
public static Color DarkGreen
|
||||||
@@ -733,7 +733,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DarkSalmon color (R:233,G:150,B:122,A:255).
|
/// DarkSalmon color (R:233,G:150,B:122,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color DarkSalmon
|
public static Color DarkSalmon
|
||||||
@@ -850,7 +850,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fuchsia color (R:255,G:0,B:255,A:255).
|
/// Fuchsia color (R:255,G:0,B:255,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Fuchsia
|
public static Color Fuchsia
|
||||||
@@ -1496,7 +1496,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SaddleBrown color (R:139,G:69,B:19,A:255).
|
/// SaddleBrown color (R:139,G:69,B:19,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color SaddleBrown
|
public static Color SaddleBrown
|
||||||
@@ -1504,7 +1504,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Salmon color (R:250,G:128,B:114,A:255).
|
/// Salmon color (R:250,G:128,B:114,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1532,7 +1532,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SeaShell color (R:255,G:245,B:238,A:255).
|
/// SeaShell color (R:255,G:245,B:238,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color SeaShell
|
public static Color SeaShell
|
||||||
@@ -1541,7 +1541,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sienna color (R:160,G:82,B:45,A:255).
|
/// Sienna color (R:160,G:82,B:45,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Sienna
|
public static Color Sienna
|
||||||
@@ -1550,7 +1550,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Silver color (R:192,G:192,B:192,A:255).
|
/// Silver color (R:192,G:192,B:192,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Silver
|
public static Color Silver
|
||||||
@@ -1649,7 +1649,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Turquoise color (R:64,G:224,B:208,A:255).
|
/// Turquoise color (R:64,G:224,B:208,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Turquoise
|
public static Color Turquoise
|
||||||
@@ -1670,12 +1670,12 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wheat color (R:245,G:222,B:179,A:255).
|
/// Wheat color (R:245,G:222,B:179,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Wheat
|
public static Color Wheat
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// White color (R:255,G:255,B:255,A:255).
|
/// White color (R:255,G:255,B:255,A:255).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1722,7 +1722,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <returns>Interpolated <see cref="Color"/>.</returns>
|
/// <returns>Interpolated <see cref="Color"/>.</returns>
|
||||||
public static Color Lerp(Color value1, Color value2, Single amount)
|
public static Color Lerp(Color value1, Color value2, Single amount)
|
||||||
{
|
{
|
||||||
amount = MathHelper.Clamp(amount, 0, 1);
|
amount = MathHelper.Clamp(amount, 0, 1);
|
||||||
return new Color(
|
return new Color(
|
||||||
(int)MathHelper.Lerp(value1.R, value2.R, amount),
|
(int)MathHelper.Lerp(value1.R, value2.R, amount),
|
||||||
(int)MathHelper.Lerp(value1.G, value2.G, amount),
|
(int)MathHelper.Lerp(value1.G, value2.G, amount),
|
||||||
@@ -1730,24 +1730,24 @@ namespace Microsoft.Xna.Framework
|
|||||||
(int)MathHelper.Lerp(value1.A, value2.A, amount) );
|
(int)MathHelper.Lerp(value1.A, value2.A, amount) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Multiply <see cref="Color"/> by value.
|
/// Multiply <see cref="Color"/> by value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">Source <see cref="Color"/>.</param>
|
/// <param name="value">Source <see cref="Color"/>.</param>
|
||||||
/// <param name="scale">Multiplicator.</param>
|
/// <param name="scale">Multiplicator.</param>
|
||||||
/// <returns>Multiplication result.</returns>
|
/// <returns>Multiplication result.</returns>
|
||||||
public static Color Multiply(Color value, float scale)
|
public static Color Multiply(Color value, float scale)
|
||||||
{
|
{
|
||||||
return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale));
|
return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Multiply <see cref="Color"/> by value.
|
/// Multiply <see cref="Color"/> by value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">Source <see cref="Color"/>.</param>
|
/// <param name="value">Source <see cref="Color"/>.</param>
|
||||||
/// <param name="scale">Multiplicator.</param>
|
/// <param name="scale">Multiplicator.</param>
|
||||||
/// <returns>Multiplication result.</returns>
|
/// <returns>Multiplication result.</returns>
|
||||||
public static Color operator *(Color value, float scale)
|
public static Color operator *(Color value, float scale)
|
||||||
{
|
{
|
||||||
return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale));
|
return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale));
|
||||||
}
|
}
|
||||||
@@ -1769,7 +1769,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
{
|
{
|
||||||
return new Vector4(R / 255.0f, G / 255.0f, B / 255.0f, A / 255.0f);
|
return new Vector4(R / 255.0f, G / 255.0f, B / 255.0f, A / 255.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets packed value of this <see cref="Color"/>.
|
/// Gets or sets packed value of this <see cref="Color"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1800,8 +1800,8 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// {R:[red] G:[green] B:[blue] A:[alpha]}
|
/// {R:[red] G:[green] B:[blue] A:[alpha]}
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><see cref="String"/> representation of this <see cref="Color"/>.</returns>
|
/// <returns><see cref="String"/> representation of this <see cref="Color"/>.</returns>
|
||||||
public override string ToString ()
|
public override string ToString ()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder(25);
|
StringBuilder sb = new StringBuilder(25);
|
||||||
sb.Append("{R:");
|
sb.Append("{R:");
|
||||||
sb.Append(R);
|
sb.Append(R);
|
||||||
@@ -1813,9 +1813,9 @@ namespace Microsoft.Xna.Framework
|
|||||||
sb.Append(A);
|
sb.Append(A);
|
||||||
sb.Append("}");
|
sb.Append("}");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Translate a non-premultipled alpha <see cref="Color"/> to a <see cref="Color"/> that contains premultiplied alpha.
|
/// Translate a non-premultipled alpha <see cref="Color"/> to a <see cref="Color"/> that contains premultiplied alpha.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="vector">A <see cref="Vector4"/> representing color.</param>
|
/// <param name="vector">A <see cref="Vector4"/> representing color.</param>
|
||||||
@@ -1824,8 +1824,8 @@ namespace Microsoft.Xna.Framework
|
|||||||
{
|
{
|
||||||
return new Color(vector.X * vector.W, vector.Y * vector.W, vector.Z * vector.W, vector.W);
|
return new Color(vector.X * vector.W, vector.Y * vector.W, vector.Z * vector.W, vector.W);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Translate a non-premultipled alpha <see cref="Color"/> to a <see cref="Color"/> that contains premultiplied alpha.
|
/// Translate a non-premultipled alpha <see cref="Color"/> to a <see cref="Color"/> that contains premultiplied alpha.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="r">Red component value.</param>
|
/// <param name="r">Red component value.</param>
|
||||||
@@ -1839,15 +1839,15 @@ namespace Microsoft.Xna.Framework
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region IEquatable<Color> Members
|
#region IEquatable<Color> Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares whether current instance is equal to specified <see cref="Color"/>.
|
/// Compares whether current instance is equal to specified <see cref="Color"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other">The <see cref="Color"/> to compare.</param>
|
/// <param name="other">The <see cref="Color"/> to compare.</param>
|
||||||
/// <returns><c>true</c> if the instances are equal; <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the instances are equal; <c>false</c> otherwise.</returns>
|
||||||
public bool Equals(Color other)
|
public bool Equals(Color other)
|
||||||
{
|
{
|
||||||
return this.PackedValue == other.PackedValue;
|
return this.PackedValue == other.PackedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// No options specified.
|
/// No options specified.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None = 0,
|
None = 0,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Render the sprite reversed along the X axis.
|
/// Render the sprite reversed along the X axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -44,15 +44,15 @@ namespace Microsoft.Xna.Framework.Input
|
|||||||
/// Identifies the state of a keyboard key.
|
/// Identifies the state of a keyboard key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum KeyState
|
public enum KeyState
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Key is released.
|
/// Key is released.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Up,
|
Up,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Key is pressed.
|
/// Key is pressed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Down,
|
Down,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Microsoft.Xna.Framework.Input
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Holds the state of keystrokes by a keyboard.
|
/// Holds the state of keystrokes by a keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct KeyboardState
|
public struct KeyboardState
|
||||||
{
|
{
|
||||||
// Used for the common situation where GetPressedKeys will return an empty array
|
// Used for the common situation where GetPressedKeys will return an empty array
|
||||||
static Keys[] empty = new Keys[0];
|
static Keys[] empty = new Keys[0];
|
||||||
|
|||||||
@@ -6,648 +6,648 @@ namespace Microsoft.Xna.Framework.Input
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the keys on a keyboard.
|
/// Defines the keys on a keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum Keys
|
public enum Keys
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reserved.
|
/// Reserved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None = 0,
|
None = 0,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// BACKSPACE key.
|
/// BACKSPACE key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Back = 8,
|
Back = 8,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TAB key.
|
/// TAB key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Tab = 9,
|
Tab = 9,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ENTER key.
|
/// ENTER key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Enter = 13,
|
Enter = 13,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CAPS LOCK key.
|
/// CAPS LOCK key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
CapsLock = 20,
|
CapsLock = 20,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ESC key.
|
/// ESC key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Escape = 27,
|
Escape = 27,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SPACEBAR key.
|
/// SPACEBAR key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Space = 32,
|
Space = 32,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PAGE UP key.
|
/// PAGE UP key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PageUp = 33,
|
PageUp = 33,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PAGE DOWN key.
|
/// PAGE DOWN key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PageDown = 34,
|
PageDown = 34,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// END key.
|
/// END key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
End = 35,
|
End = 35,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// HOME key.
|
/// HOME key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Home = 36,
|
Home = 36,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// LEFT ARROW key.
|
/// LEFT ARROW key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Left = 37,
|
Left = 37,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// UP ARROW key.
|
/// UP ARROW key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Up = 38,
|
Up = 38,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RIGHT ARROW key.
|
/// RIGHT ARROW key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Right = 39,
|
Right = 39,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DOWN ARROW key.
|
/// DOWN ARROW key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Down = 40,
|
Down = 40,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SELECT key.
|
/// SELECT key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Select = 41,
|
Select = 41,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PRINT key.
|
/// PRINT key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Print = 42,
|
Print = 42,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EXECUTE key.
|
/// EXECUTE key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Execute = 43,
|
Execute = 43,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PRINT SCREEN key.
|
/// PRINT SCREEN key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PrintScreen = 44,
|
PrintScreen = 44,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// INS key.
|
/// INS key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Insert = 45,
|
Insert = 45,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DEL key.
|
/// DEL key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Delete = 46,
|
Delete = 46,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// HELP key.
|
/// HELP key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Help = 47,
|
Help = 47,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D0 = 48,
|
D0 = 48,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D1 = 49,
|
D1 = 49,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D2 = 50,
|
D2 = 50,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D3 = 51,
|
D3 = 51,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D4 = 52,
|
D4 = 52,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D5 = 53,
|
D5 = 53,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D6 = 54,
|
D6 = 54,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D7 = 55,
|
D7 = 55,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D8 = 56,
|
D8 = 56,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D9 = 57,
|
D9 = 57,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A key.
|
/// A key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
A = 65,
|
A = 65,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// B key.
|
/// B key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
B = 66,
|
B = 66,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// C key.
|
/// C key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
C = 67,
|
C = 67,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// D key.
|
/// D key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
D = 68,
|
D = 68,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// E key.
|
/// E key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
E = 69,
|
E = 69,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F key.
|
/// F key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F = 70,
|
F = 70,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// G key.
|
/// G key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
G = 71,
|
G = 71,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// H key.
|
/// H key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
H = 72,
|
H = 72,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// I key.
|
/// I key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
I = 73,
|
I = 73,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// J key.
|
/// J key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
J = 74,
|
J = 74,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// K key.
|
/// K key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
K = 75,
|
K = 75,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// L key.
|
/// L key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
L = 76,
|
L = 76,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// M key.
|
/// M key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
M = 77,
|
M = 77,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// N key.
|
/// N key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
N = 78,
|
N = 78,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// O key.
|
/// O key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
O = 79,
|
O = 79,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// P key.
|
/// P key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
P = 80,
|
P = 80,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Q key.
|
/// Q key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Q = 81,
|
Q = 81,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// R key.
|
/// R key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
R = 82,
|
R = 82,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S key.
|
/// S key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
S = 83,
|
S = 83,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// T key.
|
/// T key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
T = 84,
|
T = 84,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// U key.
|
/// U key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
U = 85,
|
U = 85,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// V key.
|
/// V key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
V = 86,
|
V = 86,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// W key.
|
/// W key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
W = 87,
|
W = 87,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// X key.
|
/// X key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
X = 88,
|
X = 88,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Y key.
|
/// Y key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Y = 89,
|
Y = 89,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Z key.
|
/// Z key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Z = 90,
|
Z = 90,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Left Windows key.
|
/// Left Windows key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LeftWindows = 91,
|
LeftWindows = 91,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Right Windows key.
|
/// Right Windows key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RightWindows = 92,
|
RightWindows = 92,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applications key.
|
/// Applications key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Apps = 93,
|
Apps = 93,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Computer Sleep key.
|
/// Computer Sleep key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Sleep = 95,
|
Sleep = 95,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 0 key.
|
/// Numeric keypad 0 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad0 = 96,
|
NumPad0 = 96,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 1 key.
|
/// Numeric keypad 1 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad1 = 97,
|
NumPad1 = 97,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 2 key.
|
/// Numeric keypad 2 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad2 = 98,
|
NumPad2 = 98,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 3 key.
|
/// Numeric keypad 3 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad3 = 99,
|
NumPad3 = 99,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 4 key.
|
/// Numeric keypad 4 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad4 = 100,
|
NumPad4 = 100,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 5 key.
|
/// Numeric keypad 5 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad5 = 101,
|
NumPad5 = 101,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 6 key.
|
/// Numeric keypad 6 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad6 = 102,
|
NumPad6 = 102,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 7 key.
|
/// Numeric keypad 7 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad7 = 103,
|
NumPad7 = 103,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 8 key.
|
/// Numeric keypad 8 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad8 = 104,
|
NumPad8 = 104,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric keypad 9 key.
|
/// Numeric keypad 9 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumPad9 = 105,
|
NumPad9 = 105,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Multiply key.
|
/// Multiply key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Multiply = 106,
|
Multiply = 106,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add key.
|
/// Add key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Add = 107,
|
Add = 107,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Separator key.
|
/// Separator key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Separator = 108,
|
Separator = 108,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subtract key.
|
/// Subtract key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Subtract = 109,
|
Subtract = 109,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decimal key.
|
/// Decimal key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Decimal = 110,
|
Decimal = 110,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Divide key.
|
/// Divide key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Divide = 111,
|
Divide = 111,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F1 key.
|
/// F1 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F1 = 112,
|
F1 = 112,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F2 key.
|
/// F2 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F2 = 113,
|
F2 = 113,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F3 key.
|
/// F3 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F3 = 114,
|
F3 = 114,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F4 key.
|
/// F4 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F4 = 115,
|
F4 = 115,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F5 key.
|
/// F5 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F5 = 116,
|
F5 = 116,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F6 key.
|
/// F6 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F6 = 117,
|
F6 = 117,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F7 key.
|
/// F7 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F7 = 118,
|
F7 = 118,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F8 key.
|
/// F8 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F8 = 119,
|
F8 = 119,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F9 key.
|
/// F9 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F9 = 120,
|
F9 = 120,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F10 key.
|
/// F10 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F10 = 121,
|
F10 = 121,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F11 key.
|
/// F11 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F11 = 122,
|
F11 = 122,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F12 key.
|
/// F12 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F12 = 123,
|
F12 = 123,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F13 key.
|
/// F13 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F13 = 124,
|
F13 = 124,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F14 key.
|
/// F14 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F14 = 125,
|
F14 = 125,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F15 key.
|
/// F15 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F15 = 126,
|
F15 = 126,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F16 key.
|
/// F16 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F16 = 127,
|
F16 = 127,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F17 key.
|
/// F17 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F17 = 128,
|
F17 = 128,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F18 key.
|
/// F18 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F18 = 129,
|
F18 = 129,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F19 key.
|
/// F19 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F19 = 130,
|
F19 = 130,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F20 key.
|
/// F20 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F20 = 131,
|
F20 = 131,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F21 key.
|
/// F21 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F21 = 132,
|
F21 = 132,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F22 key.
|
/// F22 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F22 = 133,
|
F22 = 133,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F23 key.
|
/// F23 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F23 = 134,
|
F23 = 134,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// F24 key.
|
/// F24 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
F24 = 135,
|
F24 = 135,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// NUM LOCK key.
|
/// NUM LOCK key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NumLock = 144,
|
NumLock = 144,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SCROLL LOCK key.
|
/// SCROLL LOCK key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Scroll = 145,
|
Scroll = 145,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Left SHIFT key.
|
/// Left SHIFT key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LeftShift = 160,
|
LeftShift = 160,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Right SHIFT key.
|
/// Right SHIFT key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RightShift = 161,
|
RightShift = 161,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Left CONTROL key.
|
/// Left CONTROL key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LeftControl = 162,
|
LeftControl = 162,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Right CONTROL key.
|
/// Right CONTROL key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RightControl = 163,
|
RightControl = 163,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Left ALT key.
|
/// Left ALT key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LeftAlt = 164,
|
LeftAlt = 164,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Right ALT key.
|
/// Right ALT key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RightAlt = 165,
|
RightAlt = 165,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Browser Back key.
|
/// Browser Back key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BrowserBack = 166,
|
BrowserBack = 166,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Browser Forward key.
|
/// Browser Forward key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BrowserForward = 167,
|
BrowserForward = 167,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Browser Refresh key.
|
/// Browser Refresh key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BrowserRefresh = 168,
|
BrowserRefresh = 168,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Browser Stop key.
|
/// Browser Stop key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BrowserStop = 169,
|
BrowserStop = 169,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Browser Search key.
|
/// Browser Search key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BrowserSearch = 170,
|
BrowserSearch = 170,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Browser Favorites key.
|
/// Browser Favorites key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BrowserFavorites = 171,
|
BrowserFavorites = 171,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Browser Start and Home key.
|
/// Browser Start and Home key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BrowserHome = 172,
|
BrowserHome = 172,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Volume Mute key.
|
/// Volume Mute key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VolumeMute = 173,
|
VolumeMute = 173,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Volume Down key.
|
/// Volume Down key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VolumeDown = 174,
|
VolumeDown = 174,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Volume Up key.
|
/// Volume Up key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VolumeUp = 175,
|
VolumeUp = 175,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Next Track key.
|
/// Next Track key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MediaNextTrack = 176,
|
MediaNextTrack = 176,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Previous Track key.
|
/// Previous Track key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MediaPreviousTrack = 177,
|
MediaPreviousTrack = 177,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop Media key.
|
/// Stop Media key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MediaStop = 178,
|
MediaStop = 178,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Play/Pause Media key.
|
/// Play/Pause Media key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MediaPlayPause = 179,
|
MediaPlayPause = 179,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start Mail key.
|
/// Start Mail key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LaunchMail = 180,
|
LaunchMail = 180,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Select Media key.
|
/// Select Media key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SelectMedia = 181,
|
SelectMedia = 181,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start Application 1 key.
|
/// Start Application 1 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LaunchApplication1 = 182,
|
LaunchApplication1 = 182,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start Application 2 key.
|
/// Start Application 2 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LaunchApplication2 = 183,
|
LaunchApplication2 = 183,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The OEM Semicolon key on a US standard keyboard.
|
/// The OEM Semicolon key on a US standard keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemSemicolon = 186,
|
OemSemicolon = 186,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For any country/region, the '+' key.
|
/// For any country/region, the '+' key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemPlus = 187,
|
OemPlus = 187,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For any country/region, the ',' key.
|
/// For any country/region, the ',' key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemComma = 188,
|
OemComma = 188,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For any country/region, the '-' key.
|
/// For any country/region, the '-' key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemMinus = 189,
|
OemMinus = 189,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For any country/region, the '.' key.
|
/// For any country/region, the '.' key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemPeriod = 190,
|
OemPeriod = 190,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The OEM question mark key on a US standard keyboard.
|
/// The OEM question mark key on a US standard keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemQuestion = 191,
|
OemQuestion = 191,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The OEM tilde key on a US standard keyboard.
|
/// The OEM tilde key on a US standard keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemTilde = 192,
|
OemTilde = 192,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The OEM open bracket key on a US standard keyboard.
|
/// The OEM open bracket key on a US standard keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemOpenBrackets = 219,
|
OemOpenBrackets = 219,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The OEM pipe key on a US standard keyboard.
|
/// The OEM pipe key on a US standard keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemPipe = 220,
|
OemPipe = 220,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The OEM close bracket key on a US standard keyboard.
|
/// The OEM close bracket key on a US standard keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemCloseBrackets = 221,
|
OemCloseBrackets = 221,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The OEM singled/double quote key on a US standard keyboard.
|
/// The OEM singled/double quote key on a US standard keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemQuotes = 222,
|
OemQuotes = 222,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Oem8 = 223,
|
Oem8 = 223,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The OEM angle bracket or backslash key on the RT 102 key keyboard.
|
/// The OEM angle bracket or backslash key on the RT 102 key keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemBackslash = 226,
|
OemBackslash = 226,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IME PROCESS key.
|
/// IME PROCESS key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ProcessKey = 229,
|
ProcessKey = 229,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attn key.
|
/// Attn key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Attn = 246,
|
Attn = 246,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CrSel key.
|
/// CrSel key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Crsel = 247,
|
Crsel = 247,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ExSel key.
|
/// ExSel key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Exsel = 248,
|
Exsel = 248,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Erase EOF key.
|
/// Erase EOF key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EraseEof = 249,
|
EraseEof = 249,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Play key.
|
/// Play key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Play = 250,
|
Play = 250,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Zoom key.
|
/// Zoom key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Zoom = 251,
|
Zoom = 251,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PA1 key.
|
/// PA1 key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Pa1 = 253,
|
Pa1 = 253,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CLEAR key.
|
/// CLEAR key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemClear = 254,
|
OemClear = 254,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Green ChatPad key.
|
/// Green ChatPad key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ChatPadGreen = 0xCA,
|
ChatPadGreen = 0xCA,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Orange ChatPad key.
|
/// Orange ChatPad key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ChatPadOrange = 0xCB,
|
ChatPadOrange = 0xCB,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PAUSE key.
|
/// PAUSE key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Pause = 0x13,
|
Pause = 0x13,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IME Convert key.
|
/// IME Convert key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ImeConvert = 0x1c,
|
ImeConvert = 0x1c,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IME NoConvert key.
|
/// IME NoConvert key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ImeNoConvert = 0x1d,
|
ImeNoConvert = 0x1d,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kana key on Japanese keyboards.
|
/// Kana key on Japanese keyboards.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Kana = 0x15,
|
Kana = 0x15,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kanji key on Japanese keyboards.
|
/// Kanji key on Japanese keyboards.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Kanji = 0x19,
|
Kanji = 0x19,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OEM Auto key.
|
/// OEM Auto key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemAuto = 0xf3,
|
OemAuto = 0xf3,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OEM Copy key.
|
/// OEM Copy key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemCopy = 0xf2,
|
OemCopy = 0xf2,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OEM Enlarge Window key.
|
/// OEM Enlarge Window key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OemEnlW = 0xf4
|
OemEnlW = 0xf4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="a"><see cref="Point"/> instance on the left of the not equal sign.</param>
|
/// <param name="a"><see cref="Point"/> instance on the left of the not equal sign.</param>
|
||||||
/// <param name="b"><see cref="Point"/> instance on the right of the not equal sign.</param>
|
/// <param name="b"><see cref="Point"/> instance on the right of the not equal sign.</param>
|
||||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||||
public static bool operator !=(Point a, Point b)
|
public static bool operator !=(Point a, Point b)
|
||||||
{
|
{
|
||||||
return !a.Equals(b);
|
return !a.Equals(b);
|
||||||
|
|||||||
@@ -138,12 +138,12 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <returns>The result of the quaternion addition.</returns>
|
/// <returns>The result of the quaternion addition.</returns>
|
||||||
public static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2)
|
public static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
quaternion.X = quaternion1.X + quaternion2.X;
|
quaternion.X = quaternion1.X + quaternion2.X;
|
||||||
quaternion.Y = quaternion1.Y + quaternion2.Y;
|
quaternion.Y = quaternion1.Y + quaternion2.Y;
|
||||||
quaternion.Z = quaternion1.Z + quaternion2.Z;
|
quaternion.Z = quaternion1.Z + quaternion2.Z;
|
||||||
quaternion.W = quaternion1.W + quaternion2.W;
|
quaternion.W = quaternion1.W + quaternion2.W;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -154,10 +154,10 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="result">The result of the quaternion addition as an output parameter.</param>
|
/// <param name="result">The result of the quaternion addition as an output parameter.</param>
|
||||||
public static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
public static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
||||||
{
|
{
|
||||||
result.X = quaternion1.X + quaternion2.X;
|
result.X = quaternion1.X + quaternion2.X;
|
||||||
result.Y = quaternion1.Y + quaternion2.Y;
|
result.Y = quaternion1.Y + quaternion2.Y;
|
||||||
result.Z = quaternion1.Z + quaternion2.Z;
|
result.Z = quaternion1.Z + quaternion2.Z;
|
||||||
result.W = quaternion1.W + quaternion2.W;
|
result.W = quaternion1.W + quaternion2.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -171,8 +171,8 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="value2">The second <see cref="Quaternion"/> to concatenate.</param>
|
/// <param name="value2">The second <see cref="Quaternion"/> to concatenate.</param>
|
||||||
/// <returns>The result of rotation of <paramref name="value1"/> followed by <paramref name="value2"/> rotation.</returns>
|
/// <returns>The result of rotation of <paramref name="value1"/> followed by <paramref name="value2"/> rotation.</returns>
|
||||||
public static Quaternion Concatenate(Quaternion value1, Quaternion value2)
|
public static Quaternion Concatenate(Quaternion value1, Quaternion value2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
|
|
||||||
float x1 = value1.X;
|
float x1 = value1.X;
|
||||||
float y1 = value1.Y;
|
float y1 = value1.Y;
|
||||||
@@ -180,17 +180,17 @@ namespace Microsoft.Xna.Framework
|
|||||||
float w1 = value1.W;
|
float w1 = value1.W;
|
||||||
|
|
||||||
float x2 = value2.X;
|
float x2 = value2.X;
|
||||||
float y2 = value2.Y;
|
float y2 = value2.Y;
|
||||||
float z2 = value2.Z;
|
float z2 = value2.Z;
|
||||||
float w2 = value2.W;
|
float w2 = value2.W;
|
||||||
|
|
||||||
quaternion.X = ((x2 * w1) + (x1 * w2)) + ((y2 * z1) - (z2 * y1));
|
quaternion.X = ((x2 * w1) + (x1 * w2)) + ((y2 * z1) - (z2 * y1));
|
||||||
quaternion.Y = ((y2 * w1) + (y1 * w2)) + ((z2 * x1) - (x2 * z1));
|
quaternion.Y = ((y2 * w1) + (y1 * w2)) + ((z2 * x1) - (x2 * z1));
|
||||||
quaternion.Z = ((z2 * w1) + (z1 * w2)) + ((x2 * y1) - (y2 * x1));
|
quaternion.Z = ((z2 * w1) + (z1 * w2)) + ((x2 * y1) - (y2 * x1));
|
||||||
quaternion.W = (w2 * w1) - (((x2 * x1) + (y2 * y1)) + (z2 * z1));
|
quaternion.W = (w2 * w1) - (((x2 * x1) + (y2 * y1)) + (z2 * z1));
|
||||||
|
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="Quaternion"/> that contains concatenation between two quaternion.
|
/// Creates a new <see cref="Quaternion"/> that contains concatenation between two quaternion.
|
||||||
@@ -199,7 +199,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="value2">The second <see cref="Quaternion"/> to concatenate.</param>
|
/// <param name="value2">The second <see cref="Quaternion"/> to concatenate.</param>
|
||||||
/// <param name="result">The result of rotation of <paramref name="value1"/> followed by <paramref name="value2"/> rotation as an output parameter.</param>
|
/// <param name="result">The result of rotation of <paramref name="value1"/> followed by <paramref name="value2"/> rotation as an output parameter.</param>
|
||||||
public static void Concatenate(ref Quaternion value1, ref Quaternion value2, out Quaternion result)
|
public static void Concatenate(ref Quaternion value1, ref Quaternion value2, out Quaternion result)
|
||||||
{
|
{
|
||||||
float x1 = value1.X;
|
float x1 = value1.X;
|
||||||
float y1 = value1.Y;
|
float y1 = value1.Y;
|
||||||
float z1 = value1.Z;
|
float z1 = value1.Z;
|
||||||
@@ -224,11 +224,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// Transforms this quaternion into its conjugated version.
|
/// Transforms this quaternion into its conjugated version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Conjugate()
|
public void Conjugate()
|
||||||
{
|
{
|
||||||
X = -X;
|
X = -X;
|
||||||
Y = -Y;
|
Y = -Y;
|
||||||
Z = -Z;
|
Z = -Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="Quaternion"/> that contains conjugated version of the specified quaternion.
|
/// Creates a new <see cref="Quaternion"/> that contains conjugated version of the specified quaternion.
|
||||||
@@ -236,9 +236,9 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="value">The quaternion which values will be used to create the conjugated version.</param>
|
/// <param name="value">The quaternion which values will be used to create the conjugated version.</param>
|
||||||
/// <returns>The conjugate version of the specified quaternion.</returns>
|
/// <returns>The conjugate version of the specified quaternion.</returns>
|
||||||
public static Quaternion Conjugate(Quaternion value)
|
public static Quaternion Conjugate(Quaternion value)
|
||||||
{
|
{
|
||||||
return new Quaternion(-value.X,-value.Y,-value.Z,value.W);
|
return new Quaternion(-value.X,-value.Y,-value.Z,value.W);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="Quaternion"/> that contains conjugated version of the specified quaternion.
|
/// Creates a new <see cref="Quaternion"/> that contains conjugated version of the specified quaternion.
|
||||||
@@ -246,12 +246,12 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="value">The quaternion which values will be used to create the conjugated version.</param>
|
/// <param name="value">The quaternion which values will be used to create the conjugated version.</param>
|
||||||
/// <param name="result">The conjugated version of the specified quaternion as an output parameter.</param>
|
/// <param name="result">The conjugated version of the specified quaternion as an output parameter.</param>
|
||||||
public static void Conjugate(ref Quaternion value, out Quaternion result)
|
public static void Conjugate(ref Quaternion value, out Quaternion result)
|
||||||
{
|
{
|
||||||
result.X = -value.X;
|
result.X = -value.X;
|
||||||
result.Y = -value.Y;
|
result.Y = -value.Y;
|
||||||
result.Z = -value.Z;
|
result.Z = -value.Z;
|
||||||
result.W = value.W;
|
result.W = value.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -265,10 +265,10 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <returns>The new quaternion builded from axis and angle.</returns>
|
/// <returns>The new quaternion builded from axis and angle.</returns>
|
||||||
public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle)
|
public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle)
|
||||||
{
|
{
|
||||||
float half = angle * 0.5f;
|
float half = angle * 0.5f;
|
||||||
float sin = (float)Math.Sin(half);
|
float sin = (float)Math.Sin(half);
|
||||||
float cos = (float)Math.Cos(half);
|
float cos = (float)Math.Cos(half);
|
||||||
return new Quaternion(axis.X * sin, axis.Y * sin, axis.Z * sin, cos);
|
return new Quaternion(axis.X * sin, axis.Y * sin, axis.Z * sin, cos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -280,12 +280,12 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result)
|
public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result)
|
||||||
{
|
{
|
||||||
float half = angle * 0.5f;
|
float half = angle * 0.5f;
|
||||||
float sin = (float)Math.Sin(half);
|
float sin = (float)Math.Sin(half);
|
||||||
float cos = (float)Math.Cos(half);
|
float cos = (float)Math.Cos(half);
|
||||||
result.X = axis.X * sin;
|
result.X = axis.X * sin;
|
||||||
result.Y = axis.Y * sin;
|
result.Y = axis.Y * sin;
|
||||||
result.Z = axis.Z * sin;
|
result.Z = axis.Z * sin;
|
||||||
result.W = cos;
|
result.W = cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -304,51 +304,51 @@ namespace Microsoft.Xna.Framework
|
|||||||
float half;
|
float half;
|
||||||
float scale = matrix.M11 + matrix.M22 + matrix.M33;
|
float scale = matrix.M11 + matrix.M22 + matrix.M33;
|
||||||
|
|
||||||
if (scale > 0.0f)
|
if (scale > 0.0f)
|
||||||
{
|
{
|
||||||
sqrt = (float)Math.Sqrt(scale + 1.0f);
|
sqrt = (float)Math.Sqrt(scale + 1.0f);
|
||||||
quaternion.W = sqrt * 0.5f;
|
quaternion.W = sqrt * 0.5f;
|
||||||
sqrt = 0.5f / sqrt;
|
sqrt = 0.5f / sqrt;
|
||||||
|
|
||||||
quaternion.X = (matrix.M23 - matrix.M32) * sqrt;
|
quaternion.X = (matrix.M23 - matrix.M32) * sqrt;
|
||||||
quaternion.Y = (matrix.M31 - matrix.M13) * sqrt;
|
quaternion.Y = (matrix.M31 - matrix.M13) * sqrt;
|
||||||
quaternion.Z = (matrix.M12 - matrix.M21) * sqrt;
|
quaternion.Z = (matrix.M12 - matrix.M21) * sqrt;
|
||||||
|
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
if ((matrix.M11 >= matrix.M22) && (matrix.M11 >= matrix.M33))
|
if ((matrix.M11 >= matrix.M22) && (matrix.M11 >= matrix.M33))
|
||||||
{
|
{
|
||||||
sqrt = (float) Math.Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33);
|
sqrt = (float) Math.Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33);
|
||||||
half = 0.5f / sqrt;
|
half = 0.5f / sqrt;
|
||||||
|
|
||||||
quaternion.X = 0.5f * sqrt;
|
quaternion.X = 0.5f * sqrt;
|
||||||
quaternion.Y = (matrix.M12 + matrix.M21) * half;
|
quaternion.Y = (matrix.M12 + matrix.M21) * half;
|
||||||
quaternion.Z = (matrix.M13 + matrix.M31) * half;
|
quaternion.Z = (matrix.M13 + matrix.M31) * half;
|
||||||
quaternion.W = (matrix.M23 - matrix.M32) * half;
|
quaternion.W = (matrix.M23 - matrix.M32) * half;
|
||||||
|
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
if (matrix.M22 > matrix.M33)
|
if (matrix.M22 > matrix.M33)
|
||||||
{
|
{
|
||||||
sqrt = (float) Math.Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33);
|
sqrt = (float) Math.Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33);
|
||||||
half = 0.5f / sqrt;
|
half = 0.5f / sqrt;
|
||||||
|
|
||||||
quaternion.X = (matrix.M21 + matrix.M12) * half;
|
quaternion.X = (matrix.M21 + matrix.M12) * half;
|
||||||
quaternion.Y = 0.5f * sqrt;
|
quaternion.Y = 0.5f * sqrt;
|
||||||
quaternion.Z = (matrix.M32 + matrix.M23) * half;
|
quaternion.Z = (matrix.M32 + matrix.M23) * half;
|
||||||
quaternion.W = (matrix.M31 - matrix.M13) * half;
|
quaternion.W = (matrix.M31 - matrix.M13) * half;
|
||||||
|
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
sqrt = (float) Math.Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22);
|
sqrt = (float) Math.Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22);
|
||||||
half = 0.5f / sqrt;
|
half = 0.5f / sqrt;
|
||||||
|
|
||||||
quaternion.X = (matrix.M31 + matrix.M13) * half;
|
quaternion.X = (matrix.M31 + matrix.M13) * half;
|
||||||
quaternion.Y = (matrix.M32 + matrix.M23) * half;
|
quaternion.Y = (matrix.M32 + matrix.M23) * half;
|
||||||
quaternion.Z = 0.5f * sqrt;
|
quaternion.Z = 0.5f * sqrt;
|
||||||
quaternion.W = (matrix.M12 - matrix.M21) * half;
|
quaternion.W = (matrix.M12 - matrix.M21) * half;
|
||||||
|
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -417,7 +417,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="roll">Roll around the z axis in radians.</param>
|
/// <param name="roll">Roll around the z axis in radians.</param>
|
||||||
/// <returns>A new quaternion from the concatenated yaw, pitch, and roll angles.</returns>
|
/// <returns>A new quaternion from the concatenated yaw, pitch, and roll angles.</returns>
|
||||||
public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll)
|
public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll)
|
||||||
{
|
{
|
||||||
float halfRoll = roll * 0.5f;
|
float halfRoll = roll * 0.5f;
|
||||||
float halfPitch = pitch * 0.5f;
|
float halfPitch = pitch * 0.5f;
|
||||||
float halfYaw = yaw * 0.5f;
|
float halfYaw = yaw * 0.5f;
|
||||||
@@ -442,8 +442,8 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="pitch">Pitch around the x axis in radians.</param>
|
/// <param name="pitch">Pitch around the x axis in radians.</param>
|
||||||
/// <param name="roll">Roll around the z axis in radians.</param>
|
/// <param name="roll">Roll around the z axis in radians.</param>
|
||||||
/// <param name="result">A new quaternion from the concatenated yaw, pitch, and roll angles as an output parameter.</param>
|
/// <param name="result">A new quaternion from the concatenated yaw, pitch, and roll angles as an output parameter.</param>
|
||||||
public static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion result)
|
public static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion result)
|
||||||
{
|
{
|
||||||
float halfRoll = roll * 0.5f;
|
float halfRoll = roll * 0.5f;
|
||||||
float halfPitch = pitch * 0.5f;
|
float halfPitch = pitch * 0.5f;
|
||||||
float halfYaw = yaw * 0.5f;
|
float halfYaw = yaw * 0.5f;
|
||||||
@@ -474,25 +474,25 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2)
|
public static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
float x = quaternion1.X;
|
float x = quaternion1.X;
|
||||||
float y = quaternion1.Y;
|
float y = quaternion1.Y;
|
||||||
float z = quaternion1.Z;
|
float z = quaternion1.Z;
|
||||||
float w = quaternion1.W;
|
float w = quaternion1.W;
|
||||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||||
float num5 = 1f / num14;
|
float num5 = 1f / num14;
|
||||||
float num4 = -quaternion2.X * num5;
|
float num4 = -quaternion2.X * num5;
|
||||||
float num3 = -quaternion2.Y * num5;
|
float num3 = -quaternion2.Y * num5;
|
||||||
float num2 = -quaternion2.Z * num5;
|
float num2 = -quaternion2.Z * num5;
|
||||||
float num = quaternion2.W * num5;
|
float num = quaternion2.W * num5;
|
||||||
float num13 = (y * num2) - (z * num3);
|
float num13 = (y * num2) - (z * num3);
|
||||||
float num12 = (z * num4) - (x * num2);
|
float num12 = (z * num4) - (x * num2);
|
||||||
float num11 = (x * num3) - (y * num4);
|
float num11 = (x * num3) - (y * num4);
|
||||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||||
quaternion.X = ((x * num) + (num4 * w)) + num13;
|
quaternion.X = ((x * num) + (num4 * w)) + num13;
|
||||||
quaternion.Y = ((y * num) + (num3 * w)) + num12;
|
quaternion.Y = ((y * num) + (num3 * w)) + num12;
|
||||||
quaternion.Z = ((z * num) + (num2 * w)) + num11;
|
quaternion.Z = ((z * num) + (num2 * w)) + num11;
|
||||||
quaternion.W = (w * num) - num10;
|
quaternion.W = (w * num) - num10;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -504,23 +504,23 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
public static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
||||||
{
|
{
|
||||||
float x = quaternion1.X;
|
float x = quaternion1.X;
|
||||||
float y = quaternion1.Y;
|
float y = quaternion1.Y;
|
||||||
float z = quaternion1.Z;
|
float z = quaternion1.Z;
|
||||||
float w = quaternion1.W;
|
float w = quaternion1.W;
|
||||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||||
float num5 = 1f / num14;
|
float num5 = 1f / num14;
|
||||||
float num4 = -quaternion2.X * num5;
|
float num4 = -quaternion2.X * num5;
|
||||||
float num3 = -quaternion2.Y * num5;
|
float num3 = -quaternion2.Y * num5;
|
||||||
float num2 = -quaternion2.Z * num5;
|
float num2 = -quaternion2.Z * num5;
|
||||||
float num = quaternion2.W * num5;
|
float num = quaternion2.W * num5;
|
||||||
float num13 = (y * num2) - (z * num3);
|
float num13 = (y * num2) - (z * num3);
|
||||||
float num12 = (z * num4) - (x * num2);
|
float num12 = (z * num4) - (x * num2);
|
||||||
float num11 = (x * num3) - (y * num4);
|
float num11 = (x * num3) - (y * num4);
|
||||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||||
result.X = ((x * num) + (num4 * w)) + num13;
|
result.X = ((x * num) + (num4 * w)) + num13;
|
||||||
result.Y = ((y * num) + (num3 * w)) + num12;
|
result.Y = ((y * num) + (num3 * w)) + num12;
|
||||||
result.Z = ((z * num) + (num2 * w)) + num11;
|
result.Z = ((z * num) + (num2 * w)) + num11;
|
||||||
result.W = (w * num) - num10;
|
result.W = (w * num) - num10;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -572,7 +572,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <returns><c>true</c> if the instances are equal; <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the instances are equal; <c>false</c> otherwise.</returns>
|
||||||
public bool Equals(Quaternion other)
|
public bool Equals(Quaternion other)
|
||||||
{
|
{
|
||||||
return X == other.X &&
|
return X == other.X &&
|
||||||
Y == other.Y &&
|
Y == other.Y &&
|
||||||
Z == other.Z &&
|
Z == other.Z &&
|
||||||
W == other.W;
|
W == other.W;
|
||||||
@@ -599,13 +599,13 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion Inverse(Quaternion quaternion)
|
public static Quaternion Inverse(Quaternion quaternion)
|
||||||
{
|
{
|
||||||
Quaternion quaternion2;
|
Quaternion quaternion2;
|
||||||
float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
||||||
float num = 1f / num2;
|
float num = 1f / num2;
|
||||||
quaternion2.X = -quaternion.X * num;
|
quaternion2.X = -quaternion.X * num;
|
||||||
quaternion2.Y = -quaternion.Y * num;
|
quaternion2.Y = -quaternion.Y * num;
|
||||||
quaternion2.Z = -quaternion.Z * num;
|
quaternion2.Z = -quaternion.Z * num;
|
||||||
quaternion2.W = quaternion.W * num;
|
quaternion2.W = quaternion.W * num;
|
||||||
return quaternion2;
|
return quaternion2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -616,11 +616,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void Inverse(ref Quaternion quaternion, out Quaternion result)
|
public static void Inverse(ref Quaternion quaternion, out Quaternion result)
|
||||||
{
|
{
|
||||||
float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
||||||
float num = 1f / num2;
|
float num = 1f / num2;
|
||||||
result.X = -quaternion.X * num;
|
result.X = -quaternion.X * num;
|
||||||
result.Y = -quaternion.Y * num;
|
result.Y = -quaternion.Y * num;
|
||||||
result.Z = -quaternion.Z * num;
|
result.Z = -quaternion.Z * num;
|
||||||
result.W = quaternion.W * num;
|
result.W = quaternion.W * num;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -631,7 +631,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <returns>The magnitude of the quaternion components.</returns>
|
/// <returns>The magnitude of the quaternion components.</returns>
|
||||||
public float Length()
|
public float Length()
|
||||||
{
|
{
|
||||||
return (float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W));
|
return (float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -655,30 +655,30 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
|
public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
|
||||||
{
|
{
|
||||||
float num = amount;
|
float num = amount;
|
||||||
float num2 = 1f - num;
|
float num2 = 1f - num;
|
||||||
Quaternion quaternion = new Quaternion();
|
Quaternion quaternion = new Quaternion();
|
||||||
float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||||
if (num5 >= 0f)
|
if (num5 >= 0f)
|
||||||
{
|
{
|
||||||
quaternion.X = (num2 * quaternion1.X) + (num * quaternion2.X);
|
quaternion.X = (num2 * quaternion1.X) + (num * quaternion2.X);
|
||||||
quaternion.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y);
|
quaternion.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y);
|
||||||
quaternion.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z);
|
quaternion.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z);
|
||||||
quaternion.W = (num2 * quaternion1.W) + (num * quaternion2.W);
|
quaternion.W = (num2 * quaternion1.W) + (num * quaternion2.W);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
quaternion.X = (num2 * quaternion1.X) - (num * quaternion2.X);
|
quaternion.X = (num2 * quaternion1.X) - (num * quaternion2.X);
|
||||||
quaternion.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y);
|
quaternion.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y);
|
||||||
quaternion.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z);
|
quaternion.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z);
|
||||||
quaternion.W = (num2 * quaternion1.W) - (num * quaternion2.W);
|
quaternion.W = (num2 * quaternion1.W) - (num * quaternion2.W);
|
||||||
}
|
}
|
||||||
float num4 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
float num4 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
||||||
float num3 = 1f / ((float) Math.Sqrt((double) num4));
|
float num3 = 1f / ((float) Math.Sqrt((double) num4));
|
||||||
quaternion.X *= num3;
|
quaternion.X *= num3;
|
||||||
quaternion.Y *= num3;
|
quaternion.Y *= num3;
|
||||||
quaternion.Z *= num3;
|
quaternion.Z *= num3;
|
||||||
quaternion.W *= num3;
|
quaternion.W *= num3;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -691,28 +691,28 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)
|
public static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)
|
||||||
{
|
{
|
||||||
float num = amount;
|
float num = amount;
|
||||||
float num2 = 1f - num;
|
float num2 = 1f - num;
|
||||||
float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||||
if (num5 >= 0f)
|
if (num5 >= 0f)
|
||||||
{
|
{
|
||||||
result.X = (num2 * quaternion1.X) + (num * quaternion2.X);
|
result.X = (num2 * quaternion1.X) + (num * quaternion2.X);
|
||||||
result.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y);
|
result.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y);
|
||||||
result.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z);
|
result.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z);
|
||||||
result.W = (num2 * quaternion1.W) + (num * quaternion2.W);
|
result.W = (num2 * quaternion1.W) + (num * quaternion2.W);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.X = (num2 * quaternion1.X) - (num * quaternion2.X);
|
result.X = (num2 * quaternion1.X) - (num * quaternion2.X);
|
||||||
result.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y);
|
result.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y);
|
||||||
result.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z);
|
result.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z);
|
||||||
result.W = (num2 * quaternion1.W) - (num * quaternion2.W);
|
result.W = (num2 * quaternion1.W) - (num * quaternion2.W);
|
||||||
}
|
}
|
||||||
float num4 = (((result.X * result.X) + (result.Y * result.Y)) + (result.Z * result.Z)) + (result.W * result.W);
|
float num4 = (((result.X * result.X) + (result.Y * result.Y)) + (result.Z * result.Z)) + (result.W * result.W);
|
||||||
float num3 = 1f / ((float) Math.Sqrt((double) num4));
|
float num3 = 1f / ((float) Math.Sqrt((double) num4));
|
||||||
result.X *= num3;
|
result.X *= num3;
|
||||||
result.Y *= num3;
|
result.Y *= num3;
|
||||||
result.Z *= num3;
|
result.Z *= num3;
|
||||||
result.W *= num3;
|
result.W *= num3;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -730,33 +730,33 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
|
public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
|
||||||
{
|
{
|
||||||
float num2;
|
float num2;
|
||||||
float num3;
|
float num3;
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
float num = amount;
|
float num = amount;
|
||||||
float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
if (num4 < 0f)
|
if (num4 < 0f)
|
||||||
{
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
num4 = -num4;
|
num4 = -num4;
|
||||||
}
|
}
|
||||||
if (num4 > 0.999999f)
|
if (num4 > 0.999999f)
|
||||||
{
|
{
|
||||||
num3 = 1f - num;
|
num3 = 1f - num;
|
||||||
num2 = flag ? -num : num;
|
num2 = flag ? -num : num;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float num5 = (float) Math.Acos((double) num4);
|
float num5 = (float) Math.Acos((double) num4);
|
||||||
float num6 = (float) (1.0 / Math.Sin((double) num5));
|
float num6 = (float) (1.0 / Math.Sin((double) num5));
|
||||||
num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6;
|
num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6;
|
||||||
num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6);
|
num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6);
|
||||||
}
|
}
|
||||||
quaternion.X = (num3 * quaternion1.X) + (num2 * quaternion2.X);
|
quaternion.X = (num3 * quaternion1.X) + (num2 * quaternion2.X);
|
||||||
quaternion.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y);
|
quaternion.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y);
|
||||||
quaternion.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z);
|
quaternion.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z);
|
||||||
quaternion.W = (num3 * quaternion1.W) + (num2 * quaternion2.W);
|
quaternion.W = (num3 * quaternion1.W) + (num2 * quaternion2.W);
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -769,31 +769,31 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)
|
public static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)
|
||||||
{
|
{
|
||||||
float num2;
|
float num2;
|
||||||
float num3;
|
float num3;
|
||||||
float num = amount;
|
float num = amount;
|
||||||
float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
if (num4 < 0f)
|
if (num4 < 0f)
|
||||||
{
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
num4 = -num4;
|
num4 = -num4;
|
||||||
}
|
}
|
||||||
if (num4 > 0.999999f)
|
if (num4 > 0.999999f)
|
||||||
{
|
{
|
||||||
num3 = 1f - num;
|
num3 = 1f - num;
|
||||||
num2 = flag ? -num : num;
|
num2 = flag ? -num : num;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float num5 = (float) Math.Acos((double) num4);
|
float num5 = (float) Math.Acos((double) num4);
|
||||||
float num6 = (float) (1.0 / Math.Sin((double) num5));
|
float num6 = (float) (1.0 / Math.Sin((double) num5));
|
||||||
num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6;
|
num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6;
|
||||||
num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6);
|
num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6);
|
||||||
}
|
}
|
||||||
result.X = (num3 * quaternion1.X) + (num2 * quaternion2.X);
|
result.X = (num3 * quaternion1.X) + (num2 * quaternion2.X);
|
||||||
result.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y);
|
result.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y);
|
||||||
result.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z);
|
result.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z);
|
||||||
result.W = (num3 * quaternion1.W) + (num2 * quaternion2.W);
|
result.W = (num3 * quaternion1.W) + (num2 * quaternion2.W);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -809,11 +809,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2)
|
public static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
quaternion.X = quaternion1.X - quaternion2.X;
|
quaternion.X = quaternion1.X - quaternion2.X;
|
||||||
quaternion.Y = quaternion1.Y - quaternion2.Y;
|
quaternion.Y = quaternion1.Y - quaternion2.Y;
|
||||||
quaternion.Z = quaternion1.Z - quaternion2.Z;
|
quaternion.Z = quaternion1.Z - quaternion2.Z;
|
||||||
quaternion.W = quaternion1.W - quaternion2.W;
|
quaternion.W = quaternion1.W - quaternion2.W;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -825,9 +825,9 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
public static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
||||||
{
|
{
|
||||||
result.X = quaternion1.X - quaternion2.X;
|
result.X = quaternion1.X - quaternion2.X;
|
||||||
result.Y = quaternion1.Y - quaternion2.Y;
|
result.Y = quaternion1.Y - quaternion2.Y;
|
||||||
result.Z = quaternion1.Z - quaternion2.Z;
|
result.Z = quaternion1.Z - quaternion2.Z;
|
||||||
result.W = quaternion1.W - quaternion2.W;
|
result.W = quaternion1.W - quaternion2.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -843,23 +843,23 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2)
|
public static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
float x = quaternion1.X;
|
float x = quaternion1.X;
|
||||||
float y = quaternion1.Y;
|
float y = quaternion1.Y;
|
||||||
float z = quaternion1.Z;
|
float z = quaternion1.Z;
|
||||||
float w = quaternion1.W;
|
float w = quaternion1.W;
|
||||||
float num4 = quaternion2.X;
|
float num4 = quaternion2.X;
|
||||||
float num3 = quaternion2.Y;
|
float num3 = quaternion2.Y;
|
||||||
float num2 = quaternion2.Z;
|
float num2 = quaternion2.Z;
|
||||||
float num = quaternion2.W;
|
float num = quaternion2.W;
|
||||||
float num12 = (y * num2) - (z * num3);
|
float num12 = (y * num2) - (z * num3);
|
||||||
float num11 = (z * num4) - (x * num2);
|
float num11 = (z * num4) - (x * num2);
|
||||||
float num10 = (x * num3) - (y * num4);
|
float num10 = (x * num3) - (y * num4);
|
||||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||||
quaternion.X = ((x * num) + (num4 * w)) + num12;
|
quaternion.X = ((x * num) + (num4 * w)) + num12;
|
||||||
quaternion.Y = ((y * num) + (num3 * w)) + num11;
|
quaternion.Y = ((y * num) + (num3 * w)) + num11;
|
||||||
quaternion.Z = ((z * num) + (num2 * w)) + num10;
|
quaternion.Z = ((z * num) + (num2 * w)) + num10;
|
||||||
quaternion.W = (w * num) - num9;
|
quaternion.W = (w * num) - num9;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -871,11 +871,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion Multiply(Quaternion quaternion1, float scaleFactor)
|
public static Quaternion Multiply(Quaternion quaternion1, float scaleFactor)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
quaternion.X = quaternion1.X * scaleFactor;
|
quaternion.X = quaternion1.X * scaleFactor;
|
||||||
quaternion.Y = quaternion1.Y * scaleFactor;
|
quaternion.Y = quaternion1.Y * scaleFactor;
|
||||||
quaternion.Z = quaternion1.Z * scaleFactor;
|
quaternion.Z = quaternion1.Z * scaleFactor;
|
||||||
quaternion.W = quaternion1.W * scaleFactor;
|
quaternion.W = quaternion1.W * scaleFactor;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -887,9 +887,9 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result)
|
public static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result)
|
||||||
{
|
{
|
||||||
result.X = quaternion1.X * scaleFactor;
|
result.X = quaternion1.X * scaleFactor;
|
||||||
result.Y = quaternion1.Y * scaleFactor;
|
result.Y = quaternion1.Y * scaleFactor;
|
||||||
result.Z = quaternion1.Z * scaleFactor;
|
result.Z = quaternion1.Z * scaleFactor;
|
||||||
result.W = quaternion1.W * scaleFactor;
|
result.W = quaternion1.W * scaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -901,21 +901,21 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
public static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
||||||
{
|
{
|
||||||
float x = quaternion1.X;
|
float x = quaternion1.X;
|
||||||
float y = quaternion1.Y;
|
float y = quaternion1.Y;
|
||||||
float z = quaternion1.Z;
|
float z = quaternion1.Z;
|
||||||
float w = quaternion1.W;
|
float w = quaternion1.W;
|
||||||
float num4 = quaternion2.X;
|
float num4 = quaternion2.X;
|
||||||
float num3 = quaternion2.Y;
|
float num3 = quaternion2.Y;
|
||||||
float num2 = quaternion2.Z;
|
float num2 = quaternion2.Z;
|
||||||
float num = quaternion2.W;
|
float num = quaternion2.W;
|
||||||
float num12 = (y * num2) - (z * num3);
|
float num12 = (y * num2) - (z * num3);
|
||||||
float num11 = (z * num4) - (x * num2);
|
float num11 = (z * num4) - (x * num2);
|
||||||
float num10 = (x * num3) - (y * num4);
|
float num10 = (x * num3) - (y * num4);
|
||||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||||
result.X = ((x * num) + (num4 * w)) + num12;
|
result.X = ((x * num) + (num4 * w)) + num12;
|
||||||
result.Y = ((y * num) + (num3 * w)) + num11;
|
result.Y = ((y * num) + (num3 * w)) + num11;
|
||||||
result.Z = ((z * num) + (num2 * w)) + num10;
|
result.Z = ((z * num) + (num2 * w)) + num10;
|
||||||
result.W = (w * num) - num9;
|
result.W = (w * num) - num9;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -929,7 +929,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <returns>The result of the quaternion negation.</returns>
|
/// <returns>The result of the quaternion negation.</returns>
|
||||||
public static Quaternion Negate(Quaternion quaternion)
|
public static Quaternion Negate(Quaternion quaternion)
|
||||||
{
|
{
|
||||||
return new Quaternion(-quaternion.X, -quaternion.Y, -quaternion.Z, -quaternion.W);
|
return new Quaternion(-quaternion.X, -quaternion.Y, -quaternion.Z, -quaternion.W);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -940,9 +940,9 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static void Negate(ref Quaternion quaternion, out Quaternion result)
|
public static void Negate(ref Quaternion quaternion, out Quaternion result)
|
||||||
{
|
{
|
||||||
result.X = -quaternion.X;
|
result.X = -quaternion.X;
|
||||||
result.Y = -quaternion.Y;
|
result.Y = -quaternion.Y;
|
||||||
result.Z = -quaternion.Z;
|
result.Z = -quaternion.Z;
|
||||||
result.W = -quaternion.W;
|
result.W = -quaternion.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -954,11 +954,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Normalize()
|
public void Normalize()
|
||||||
{
|
{
|
||||||
float num = 1f / ((float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W)));
|
float num = 1f / ((float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W)));
|
||||||
X *= num;
|
X *= num;
|
||||||
Y *= num;
|
Y *= num;
|
||||||
Z *= num;
|
Z *= num;
|
||||||
W *= num;
|
W *= num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -969,12 +969,12 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion Normalize(Quaternion quaternion)
|
public static Quaternion Normalize(Quaternion quaternion)
|
||||||
{
|
{
|
||||||
Quaternion result;
|
Quaternion result;
|
||||||
float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W)));
|
float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W)));
|
||||||
result.X = quaternion.X * num;
|
result.X = quaternion.X * num;
|
||||||
result.Y = quaternion.Y * num;
|
result.Y = quaternion.Y * num;
|
||||||
result.Z = quaternion.Z * num;
|
result.Z = quaternion.Z * num;
|
||||||
result.W = quaternion.W * num;
|
result.W = quaternion.W * num;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -984,11 +984,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="result">The unit length quaternion an output parameter.</param>
|
/// <param name="result">The unit length quaternion an output parameter.</param>
|
||||||
public static void Normalize(ref Quaternion quaternion, out Quaternion result)
|
public static void Normalize(ref Quaternion quaternion, out Quaternion result)
|
||||||
{
|
{
|
||||||
float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W)));
|
float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W)));
|
||||||
result.X = quaternion.X * num;
|
result.X = quaternion.X * num;
|
||||||
result.Y = quaternion.Y * num;
|
result.Y = quaternion.Y * num;
|
||||||
result.Z = quaternion.Z * num;
|
result.Z = quaternion.Z * num;
|
||||||
result.W = quaternion.W * num;
|
result.W = quaternion.W * num;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -1025,11 +1025,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2)
|
public static Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
quaternion.X = quaternion1.X + quaternion2.X;
|
quaternion.X = quaternion1.X + quaternion2.X;
|
||||||
quaternion.Y = quaternion1.Y + quaternion2.Y;
|
quaternion.Y = quaternion1.Y + quaternion2.Y;
|
||||||
quaternion.Z = quaternion1.Z + quaternion2.Z;
|
quaternion.Z = quaternion1.Z + quaternion2.Z;
|
||||||
quaternion.W = quaternion1.W + quaternion2.W;
|
quaternion.W = quaternion1.W + quaternion2.W;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1041,25 +1041,25 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2)
|
public static Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
float x = quaternion1.X;
|
float x = quaternion1.X;
|
||||||
float y = quaternion1.Y;
|
float y = quaternion1.Y;
|
||||||
float z = quaternion1.Z;
|
float z = quaternion1.Z;
|
||||||
float w = quaternion1.W;
|
float w = quaternion1.W;
|
||||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||||
float num5 = 1f / num14;
|
float num5 = 1f / num14;
|
||||||
float num4 = -quaternion2.X * num5;
|
float num4 = -quaternion2.X * num5;
|
||||||
float num3 = -quaternion2.Y * num5;
|
float num3 = -quaternion2.Y * num5;
|
||||||
float num2 = -quaternion2.Z * num5;
|
float num2 = -quaternion2.Z * num5;
|
||||||
float num = quaternion2.W * num5;
|
float num = quaternion2.W * num5;
|
||||||
float num13 = (y * num2) - (z * num3);
|
float num13 = (y * num2) - (z * num3);
|
||||||
float num12 = (z * num4) - (x * num2);
|
float num12 = (z * num4) - (x * num2);
|
||||||
float num11 = (x * num3) - (y * num4);
|
float num11 = (x * num3) - (y * num4);
|
||||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||||
quaternion.X = ((x * num) + (num4 * w)) + num13;
|
quaternion.X = ((x * num) + (num4 * w)) + num13;
|
||||||
quaternion.Y = ((y * num) + (num3 * w)) + num12;
|
quaternion.Y = ((y * num) + (num3 * w)) + num12;
|
||||||
quaternion.Z = ((z * num) + (num2 * w)) + num11;
|
quaternion.Z = ((z * num) + (num2 * w)) + num11;
|
||||||
quaternion.W = (w * num) - num10;
|
quaternion.W = (w * num) - num10;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1078,14 +1078,14 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="quaternion1"><see cref="Quaternion"/> instance on the left of the not equal sign.</param>
|
/// <param name="quaternion1"><see cref="Quaternion"/> instance on the left of the not equal sign.</param>
|
||||||
/// <param name="quaternion2"><see cref="Quaternion"/> instance on the right of the not equal sign.</param>
|
/// <param name="quaternion2"><see cref="Quaternion"/> instance on the right of the not equal sign.</param>
|
||||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||||
public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2)
|
public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
if (((quaternion1.X == quaternion2.X) && (quaternion1.Y == quaternion2.Y)) && (quaternion1.Z == quaternion2.Z))
|
if (((quaternion1.X == quaternion2.X) && (quaternion1.Y == quaternion2.Y)) && (quaternion1.Z == quaternion2.Z))
|
||||||
{
|
{
|
||||||
return (quaternion1.W != quaternion2.W);
|
return (quaternion1.W != quaternion2.W);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1097,23 +1097,23 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2)
|
public static Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
float x = quaternion1.X;
|
float x = quaternion1.X;
|
||||||
float y = quaternion1.Y;
|
float y = quaternion1.Y;
|
||||||
float z = quaternion1.Z;
|
float z = quaternion1.Z;
|
||||||
float w = quaternion1.W;
|
float w = quaternion1.W;
|
||||||
float num4 = quaternion2.X;
|
float num4 = quaternion2.X;
|
||||||
float num3 = quaternion2.Y;
|
float num3 = quaternion2.Y;
|
||||||
float num2 = quaternion2.Z;
|
float num2 = quaternion2.Z;
|
||||||
float num = quaternion2.W;
|
float num = quaternion2.W;
|
||||||
float num12 = (y * num2) - (z * num3);
|
float num12 = (y * num2) - (z * num3);
|
||||||
float num11 = (z * num4) - (x * num2);
|
float num11 = (z * num4) - (x * num2);
|
||||||
float num10 = (x * num3) - (y * num4);
|
float num10 = (x * num3) - (y * num4);
|
||||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||||
quaternion.X = ((x * num) + (num4 * w)) + num12;
|
quaternion.X = ((x * num) + (num4 * w)) + num12;
|
||||||
quaternion.Y = ((y * num) + (num3 * w)) + num11;
|
quaternion.Y = ((y * num) + (num3 * w)) + num11;
|
||||||
quaternion.Z = ((z * num) + (num2 * w)) + num10;
|
quaternion.Z = ((z * num) + (num2 * w)) + num10;
|
||||||
quaternion.W = (w * num) - num9;
|
quaternion.W = (w * num) - num9;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1125,11 +1125,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion operator *(Quaternion quaternion1, float scaleFactor)
|
public static Quaternion operator *(Quaternion quaternion1, float scaleFactor)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
quaternion.X = quaternion1.X * scaleFactor;
|
quaternion.X = quaternion1.X * scaleFactor;
|
||||||
quaternion.Y = quaternion1.Y * scaleFactor;
|
quaternion.Y = quaternion1.Y * scaleFactor;
|
||||||
quaternion.Z = quaternion1.Z * scaleFactor;
|
quaternion.Z = quaternion1.Z * scaleFactor;
|
||||||
quaternion.W = quaternion1.W * scaleFactor;
|
quaternion.W = quaternion1.W * scaleFactor;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1141,11 +1141,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2)
|
public static Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2)
|
||||||
{
|
{
|
||||||
Quaternion quaternion;
|
Quaternion quaternion;
|
||||||
quaternion.X = quaternion1.X - quaternion2.X;
|
quaternion.X = quaternion1.X - quaternion2.X;
|
||||||
quaternion.Y = quaternion1.Y - quaternion2.Y;
|
quaternion.Y = quaternion1.Y - quaternion2.Y;
|
||||||
quaternion.Z = quaternion1.Z - quaternion2.Z;
|
quaternion.Z = quaternion1.Z - quaternion2.Z;
|
||||||
quaternion.W = quaternion1.W - quaternion2.W;
|
quaternion.W = quaternion1.W - quaternion2.W;
|
||||||
return quaternion;
|
return quaternion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1157,11 +1157,11 @@ namespace Microsoft.Xna.Framework
|
|||||||
public static Quaternion operator -(Quaternion quaternion)
|
public static Quaternion operator -(Quaternion quaternion)
|
||||||
{
|
{
|
||||||
Quaternion quaternion2;
|
Quaternion quaternion2;
|
||||||
quaternion2.X = -quaternion.X;
|
quaternion2.X = -quaternion.X;
|
||||||
quaternion2.Y = -quaternion.Y;
|
quaternion2.Y = -quaternion.Y;
|
||||||
quaternion2.Z = -quaternion.Z;
|
quaternion2.Z = -quaternion.Z;
|
||||||
quaternion2.W = -quaternion.W;
|
quaternion2.W = -quaternion.W;
|
||||||
return quaternion2;
|
return quaternion2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// <param name="x">The x coordinate of the point to check for containment.</param>
|
/// <param name="x">The x coordinate of the point to check for containment.</param>
|
||||||
/// <param name="y">The y coordinate of the point to check for containment.</param>
|
/// <param name="y">The y coordinate of the point to check for containment.</param>
|
||||||
/// <returns><c>true</c> if the provided coordinates lie inside this <see cref="Rectangle"/>; <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the provided coordinates lie inside this <see cref="Rectangle"/>; <c>false</c> otherwise.</returns>
|
||||||
public bool Contains(int x, int y)
|
public bool Contains(int x, int y)
|
||||||
{
|
{
|
||||||
return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height)));
|
return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height)));
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
{
|
{
|
||||||
return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height)));
|
return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets whether or not the provided <see cref="Point"/> lies within the bounds of this <see cref="Rectangle"/>.
|
/// Gets whether or not the provided <see cref="Point"/> lies within the bounds of this <see cref="Rectangle"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -517,7 +517,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
result.Width = Math.Max(value1.Right, value2.Right) - result.X;
|
result.Width = Math.Max(value1.Right, value2.Right) - result.X;
|
||||||
result.Height = Math.Max(value1.Bottom, value2.Bottom) - result.Y;
|
result.Height = Math.Max(value1.Bottom, value2.Bottom) - result.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1120,7 +1120,7 @@ namespace Microsoft.Xna.Framework
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value1"><see cref="Vector4"/> instance on the left of the not equal sign.</param>
|
/// <param name="value1"><see cref="Vector4"/> instance on the left of the not equal sign.</param>
|
||||||
/// <param name="value2"><see cref="Vector4"/> instance on the right of the not equal sign.</param>
|
/// <param name="value2"><see cref="Vector4"/> instance on the right of the not equal sign.</param>
|
||||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||||
public static bool operator !=(Vector4 value1, Vector4 value2)
|
public static bool operator !=(Vector4 value1, Vector4 value2)
|
||||||
{
|
{
|
||||||
return !(value1 == value2);
|
return !(value1 == value2);
|
||||||
|
|||||||
@@ -48,8 +48,9 @@ float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoor
|
|||||||
float4 main2(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
float4 main2(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
{
|
{
|
||||||
float4 losColor = tex2D(LosSampler, texCoord);
|
float4 losColor = tex2D(LosSampler, texCoord);
|
||||||
|
float4 sample = tex2D(TextureSampler, texCoord);
|
||||||
|
|
||||||
float4 outColor = float4(losColor.x, losColor.y, losColor.z, color.w);
|
float4 outColor = float4(sample.x, sample.y, sample.z, losColor.x);
|
||||||
|
|
||||||
return outColor;
|
return outColor;
|
||||||
}
|
}
|
||||||
@@ -69,4 +70,4 @@ technique LosShader
|
|||||||
{
|
{
|
||||||
PixelShader = compile ps_4_0_level_9_1 main2();
|
PixelShader = compile ps_4_0_level_9_1 main2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Regular → Executable
BIN
Binary file not shown.
@@ -13,13 +13,15 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public string Text;
|
public string Text;
|
||||||
public Color Color;
|
public Color Color;
|
||||||
|
public bool IsCommand;
|
||||||
|
|
||||||
public readonly string Time;
|
public readonly string Time;
|
||||||
|
|
||||||
public ColoredText(string text, Color color)
|
public ColoredText(string text, Color color, bool isCommand)
|
||||||
{
|
{
|
||||||
this.Text = text;
|
this.Text = text;
|
||||||
this.Color = color;
|
this.Color = color;
|
||||||
|
this.IsCommand = isCommand;
|
||||||
|
|
||||||
Time = DateTime.Now.ToString();
|
Time = DateTime.Now.ToString();
|
||||||
}
|
}
|
||||||
@@ -1028,9 +1030,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
direction = MathHelper.Clamp(direction, -1, 1);
|
direction = MathHelper.Clamp(direction, -1, 1);
|
||||||
|
|
||||||
selectedIndex += direction;
|
int i = 0;
|
||||||
if (selectedIndex < 0) selectedIndex = Messages.Count - 1;
|
do
|
||||||
selectedIndex = selectedIndex % Messages.Count;
|
{
|
||||||
|
selectedIndex += direction;
|
||||||
|
if (selectedIndex < 0) selectedIndex = Messages.Count - 1;
|
||||||
|
selectedIndex = selectedIndex % Messages.Count;
|
||||||
|
if (++i >= Messages.Count) break;
|
||||||
|
} while (!Messages[selectedIndex].IsCommand);
|
||||||
|
|
||||||
return Messages[selectedIndex].Text;
|
return Messages[selectedIndex].Text;
|
||||||
}
|
}
|
||||||
@@ -1042,7 +1049,7 @@ namespace Barotrauma
|
|||||||
#if CLIENT
|
#if CLIENT
|
||||||
activeQuestionText = null;
|
activeQuestionText = null;
|
||||||
#endif
|
#endif
|
||||||
NewMessage(command, Color.White);
|
NewMessage(command, Color.White, true);
|
||||||
//reset the variable before invoking the delegate because the method may need to activate another question
|
//reset the variable before invoking the delegate because the method may need to activate another question
|
||||||
var temp = activeQuestionCallback;
|
var temp = activeQuestionCallback;
|
||||||
activeQuestionCallback = null;
|
activeQuestionCallback = null;
|
||||||
@@ -1056,7 +1063,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!splitCommand[0].ToLowerInvariant().Equals("admin"))
|
if (!splitCommand[0].ToLowerInvariant().Equals("admin"))
|
||||||
{
|
{
|
||||||
NewMessage(command, Color.White);
|
NewMessage(command, Color.White, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !DEBUG && CLIENT
|
#if !DEBUG && CLIENT
|
||||||
@@ -1131,12 +1138,12 @@ namespace Barotrauma
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void NewMessage(string msg, Color color)
|
public static void NewMessage(string msg, Color color, bool isCommand = false)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty((msg))) return;
|
if (string.IsNullOrEmpty((msg))) return;
|
||||||
|
|
||||||
#if SERVER
|
#if SERVER
|
||||||
Messages.Add(new ColoredText(msg, color));
|
Messages.Add(new ColoredText(msg, color, isCommand));
|
||||||
|
|
||||||
//TODO: REMOVE
|
//TODO: REMOVE
|
||||||
Console.ForegroundColor = XnaToConsoleColor.Convert(color);
|
Console.ForegroundColor = XnaToConsoleColor.Convert(color);
|
||||||
@@ -1151,7 +1158,7 @@ namespace Barotrauma
|
|||||||
#elif CLIENT
|
#elif CLIENT
|
||||||
lock (queuedMessages)
|
lock (queuedMessages)
|
||||||
{
|
{
|
||||||
queuedMessages.Enqueue(new ColoredText(msg, color));
|
queuedMessages.Enqueue(new ColoredText(msg, color, isCommand));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1204,7 +1204,7 @@ namespace Barotrauma
|
|||||||
Color color = Color.Red;
|
Color color = Color.Red;
|
||||||
if (ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false)) color = Color.Orange;
|
if (ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false)) color = Color.Orange;
|
||||||
|
|
||||||
texts.Add(new ColoredText(ic.Msg, color));
|
texts.Add(new ColoredText(ic.Msg, color, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return texts;
|
return texts;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Created by SharpDevelop.
|
* Created by SharpDevelop.
|
||||||
* User: Burhan
|
* User: Burhan
|
||||||
* Date: 17/06/2014
|
* Date: 17/06/2014
|
||||||
@@ -8,31 +8,31 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2011 James Humphreys. All rights reserved.
|
Copyright 2011 James Humphreys. All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are
|
Redistribution and use in source and binary forms, with or without modification, are
|
||||||
permitted provided that the following conditions are met:
|
permitted provided that the following conditions are met:
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
conditions and the following disclaimer.
|
conditions and the following disclaimer.
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
of conditions and the following disclaimer in the documentation and/or other materials
|
of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
provided with the distribution.
|
provided with the distribution.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY James Humphreys ``AS IS\" AND ANY EXPRESS OR IMPLIED
|
THIS SOFTWARE IS PROVIDED BY James Humphreys ``AS IS\" AND ANY EXPRESS OR IMPLIED
|
||||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
The views and conclusions contained in the software and documentation are those of the
|
The views and conclusions contained in the software and documentation are those of the
|
||||||
authors and should not be interpreted as representing official policies, either expressed
|
authors and should not be interpreted as representing official policies, either expressed
|
||||||
or implied, of James Humphreys.
|
or implied, of James Humphreys.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -58,63 +58,63 @@ using System.Collections.Generic;
|
|||||||
namespace Voronoi2
|
namespace Voronoi2
|
||||||
{
|
{
|
||||||
public class Point
|
public class Point
|
||||||
{
|
{
|
||||||
public double x, y;
|
public double x, y;
|
||||||
|
|
||||||
public void setPoint ( double x, double y )
|
public void setPoint ( double x, double y )
|
||||||
{
|
{
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// use for sites and vertecies
|
// use for sites and vertecies
|
||||||
public class Site
|
public class Site
|
||||||
{
|
{
|
||||||
public Point coord;
|
public Point coord;
|
||||||
public int sitenbr;
|
public int sitenbr;
|
||||||
|
|
||||||
public void SetPoint(Vector2 point)
|
public void SetPoint(Vector2 point)
|
||||||
{
|
{
|
||||||
coord.setPoint(point.X, point.Y);
|
coord.setPoint(point.X, point.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Site ()
|
public Site ()
|
||||||
{
|
{
|
||||||
coord = new Point();
|
coord = new Point();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Edge
|
public class Edge
|
||||||
{
|
{
|
||||||
public double a = 0, b = 0, c = 0;
|
public double a = 0, b = 0, c = 0;
|
||||||
public Site[] ep;
|
public Site[] ep;
|
||||||
public Site[] reg;
|
public Site[] reg;
|
||||||
public int edgenbr;
|
public int edgenbr;
|
||||||
|
|
||||||
public Edge ()
|
public Edge ()
|
||||||
{
|
{
|
||||||
ep = new Site[2];
|
ep = new Site[2];
|
||||||
reg = new Site[2];
|
reg = new Site[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class Halfedge
|
public class Halfedge
|
||||||
{
|
{
|
||||||
public Halfedge ELleft, ELright;
|
public Halfedge ELleft, ELright;
|
||||||
public Edge ELedge;
|
public Edge ELedge;
|
||||||
public bool deleted;
|
public bool deleted;
|
||||||
public int ELpm;
|
public int ELpm;
|
||||||
public Site vertex;
|
public Site vertex;
|
||||||
public double ystar;
|
public double ystar;
|
||||||
public Halfedge PQnext;
|
public Halfedge PQnext;
|
||||||
|
|
||||||
public Halfedge ()
|
public Halfedge ()
|
||||||
{
|
{
|
||||||
PQnext = null;
|
PQnext = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CellType
|
public enum CellType
|
||||||
{
|
{
|
||||||
@@ -187,11 +187,11 @@ namespace Voronoi2
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GraphEdge
|
public class GraphEdge
|
||||||
{
|
{
|
||||||
public Vector2 point1, point2;
|
public Vector2 point1, point2;
|
||||||
public Site site1, site2;
|
public Site site1, site2;
|
||||||
public VoronoiCell cell1, cell2;
|
public VoronoiCell cell1, cell2;
|
||||||
|
|
||||||
public bool isSolid;
|
public bool isSolid;
|
||||||
@@ -239,20 +239,20 @@ namespace Voronoi2
|
|||||||
|
|
||||||
return normal;
|
return normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// للترتيب
|
// للترتيب
|
||||||
public class SiteSorterYX : IComparer<Site>
|
public class SiteSorterYX : IComparer<Site>
|
||||||
{
|
{
|
||||||
public int Compare ( Site p1, Site p2 )
|
public int Compare ( Site p1, Site p2 )
|
||||||
{
|
{
|
||||||
Point s1 = p1.coord;
|
Point s1 = p1.coord;
|
||||||
Point s2 = p2.coord;
|
Point s2 = p2.coord;
|
||||||
if ( s1.y < s2.y ) return -1;
|
if ( s1.y < s2.y ) return -1;
|
||||||
if ( s1.y > s2.y ) return 1;
|
if ( s1.y > s2.y ) return 1;
|
||||||
if ( s1.x < s2.x ) return -1;
|
if ( s1.x < s2.x ) return -1;
|
||||||
if ( s1.x > s2.x ) return 1;
|
if ( s1.x > s2.x ) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,11 +89,11 @@ namespace Barotrauma
|
|||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool ResizeHorizontal
|
public bool ResizeHorizontal
|
||||||
{
|
{
|
||||||
get { return prefab != null && prefab.ResizeHorizontal; }
|
get { return prefab != null && prefab.ResizeHorizontal; }
|
||||||
}
|
}
|
||||||
protected bool ResizeVertical
|
public bool ResizeVertical
|
||||||
{
|
{
|
||||||
get { return prefab != null && prefab.ResizeVertical; }
|
get { return prefab != null && prefab.ResizeVertical; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -94,9 +94,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Key
|
class Key
|
||||||
{
|
{
|
||||||
private bool hit, hitQueue;
|
private bool hit, hitQueue;
|
||||||
private bool held, heldQueue;
|
private bool held, heldQueue;
|
||||||
|
|
||||||
|
|
||||||
@@ -106,23 +106,23 @@ namespace Barotrauma
|
|||||||
//{
|
//{
|
||||||
// get { return canBeHeld; }
|
// get { return canBeHeld; }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public Key(KeyOrMouse binding)
|
public Key(KeyOrMouse binding)
|
||||||
{
|
{
|
||||||
this.binding = binding;
|
this.binding = binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Hit
|
public bool Hit
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
hit = value;
|
hit = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Held
|
public bool Held
|
||||||
{
|
{
|
||||||
@@ -141,14 +141,14 @@ namespace Barotrauma
|
|||||||
get { return binding; }
|
get { return binding; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetState()
|
public void SetState()
|
||||||
{
|
{
|
||||||
hit = binding.IsHit();
|
hit = binding.IsHit();
|
||||||
if (hit) hitQueue = true;
|
if (hit) hitQueue = true;
|
||||||
|
|
||||||
held = binding.IsDown();
|
held = binding.IsDown();
|
||||||
if (held) heldQueue = true;
|
if (held) heldQueue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetState(bool hit, bool held)
|
public void SetState(bool hit, bool held)
|
||||||
{
|
{
|
||||||
@@ -156,12 +156,12 @@ namespace Barotrauma
|
|||||||
if (held) heldQueue = true;
|
if (held) heldQueue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DequeueHit()
|
public bool DequeueHit()
|
||||||
{
|
{
|
||||||
bool value = hitQueue;
|
bool value = hitQueue;
|
||||||
hitQueue = false;
|
hitQueue = false;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DequeueHeld()
|
public bool DequeueHeld()
|
||||||
{
|
{
|
||||||
@@ -187,11 +187,11 @@ namespace Barotrauma
|
|||||||
held = false;
|
held = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetHit()
|
public void ResetHit()
|
||||||
{
|
{
|
||||||
hit = false;
|
hit = false;
|
||||||
//stateQueue = false;
|
//stateQueue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ResetHeld()
|
public void ResetHeld()
|
||||||
@@ -199,5 +199,5 @@ namespace Barotrauma
|
|||||||
held = false;
|
held = false;
|
||||||
//stateQueue = false;
|
//stateQueue = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user