diff --git a/OpenRA.Game/Graphics/Renderable.cs b/OpenRA.Game/Graphics/Renderable.cs index 819602581b..ddf1c1fc9e 100644 --- a/OpenRA.Game/Graphics/Renderable.cs +++ b/OpenRA.Game/Graphics/Renderable.cs @@ -30,7 +30,7 @@ namespace OpenRA.Graphics public interface ITintableRenderable { - IRenderable WithTint(float3 newTint); + IRenderable WithTint(in float3 newTint); } public interface IFinalizedRenderable diff --git a/OpenRA.Game/Graphics/RgbaColorRenderer.cs b/OpenRA.Game/Graphics/RgbaColorRenderer.cs index c129c6d1ee..796138c465 100644 --- a/OpenRA.Game/Graphics/RgbaColorRenderer.cs +++ b/OpenRA.Game/Graphics/RgbaColorRenderer.cs @@ -28,7 +28,7 @@ namespace OpenRA.Graphics this.parent = parent; } - public void DrawLine(float3 start, float3 end, float width, Color startColor, Color endColor) + public void DrawLine(in float3 start, in float3 end, float width, Color startColor, Color endColor) { var delta = (end - start) / (end - start).XY.Length; var corner = width / 2 * new float3(-delta.Y, delta.X, delta.Z); @@ -55,7 +55,7 @@ namespace OpenRA.Graphics parent.DrawRGBAVertices(vertices); } - public void DrawLine(float3 start, float3 end, float width, Color color) + public void DrawLine(in float3 start, in float3 end, float width, Color color) { var delta = (end - start) / (end - start).XY.Length; var corner = width / 2 * new float2(-delta.Y, delta.X); @@ -80,7 +80,7 @@ namespace OpenRA.Graphics /// Will behave badly if the lines are parallel. /// Z position is the average of a and b (ignores actual intersection point if it exists) /// - float3 IntersectionOf(float3 a, float3 da, float3 b, float3 db) + float3 IntersectionOf(in float3 a, in float3 da, in float3 b, in float3 db) { var crossA = a.X * (a.Y + da.Y) - a.Y * (a.X + da.X); var crossB = b.X * (b.Y + db.Y) - b.Y * (b.X + db.X); @@ -193,14 +193,14 @@ namespace OpenRA.Graphics DrawConnectedLine(vertices.Select(v => new float3(v, 0)).ToArray(), width, color, true); } - public void DrawRect(float3 tl, float3 br, float width, Color color) + public void DrawRect(in float3 tl, in float3 br, float width, Color color) { var tr = new float3(br.X, tl.Y, tl.Z); var bl = new float3(tl.X, br.Y, br.Z); DrawPolygon(new[] { tl, tr, br, bl }, width, color); } - public void FillTriangle(float3 a, float3 b, float3 c, Color color) + public void FillTriangle(in float3 a, in float3 b, in float3 c, Color color) { color = Util.PremultiplyAlpha(color); var cr = color.R / 255.0f; @@ -214,14 +214,14 @@ namespace OpenRA.Graphics parent.DrawRGBAVertices(vertices); } - public void FillRect(float3 tl, float3 br, Color color) + public void FillRect(in float3 tl, in float3 br, Color color) { var tr = new float3(br.X, tl.Y, tl.Z); var bl = new float3(tl.X, br.Y, br.Z); FillRect(tl, tr, br, bl, color); } - public void FillRect(float3 a, float3 b, float3 c, float3 d, Color color) + public void FillRect(in float3 a, in float3 b, in float3 c, in float3 d, Color color) { color = Util.PremultiplyAlpha(color); var cr = color.R / 255.0f; @@ -238,7 +238,7 @@ namespace OpenRA.Graphics parent.DrawRGBAVertices(vertices); } - public void FillRect(float3 a, float3 b, float3 c, float3 d, Color topLeftColor, Color topRightColor, Color bottomRightColor, Color bottomLeftColor) + public void FillRect(in float3 a, in float3 b, in float3 c, in float3 d, Color topLeftColor, Color topRightColor, Color bottomRightColor, Color bottomLeftColor) { vertices[0] = VertexWithColor(a + Offset, topLeftColor); vertices[1] = VertexWithColor(b + Offset, topRightColor); @@ -250,7 +250,7 @@ namespace OpenRA.Graphics parent.DrawRGBAVertices(vertices); } - static Vertex VertexWithColor(float3 xyz, Color color) + static Vertex VertexWithColor(in float3 xyz, Color color) { color = Util.PremultiplyAlpha(color); var cr = color.R / 255.0f; @@ -261,7 +261,7 @@ namespace OpenRA.Graphics return new Vertex(xyz, cr, cg, cb, ca, 0, 0); } - public void FillEllipse(float3 tl, float3 br, Color color, int vertices = 32) + public void FillEllipse(in float3 tl, in float3 br, Color color, int vertices = 32) { // TODO: Create an ellipse polygon instead var a = (br.X - tl.X) / 2; diff --git a/OpenRA.Game/Graphics/RgbaSpriteRenderer.cs b/OpenRA.Game/Graphics/RgbaSpriteRenderer.cs index 21f1b980c9..eca37f72b3 100644 --- a/OpenRA.Game/Graphics/RgbaSpriteRenderer.cs +++ b/OpenRA.Game/Graphics/RgbaSpriteRenderer.cs @@ -22,7 +22,7 @@ namespace OpenRA.Graphics this.parent = parent; } - public void DrawSprite(Sprite s, float3 location, float3 size) + public void DrawSprite(Sprite s, in float3 location, in float3 size) { if (s.Channel != TextureChannel.RGBA) throw new InvalidOperationException("DrawRGBASprite requires a RGBA sprite."); @@ -30,7 +30,7 @@ namespace OpenRA.Graphics parent.DrawSprite(s, location, 0, size); } - public void DrawSprite(Sprite s, float3 location) + public void DrawSprite(Sprite s, in float3 location) { if (s.Channel != TextureChannel.RGBA) throw new InvalidOperationException("DrawRGBASprite requires a RGBA sprite."); @@ -38,7 +38,7 @@ namespace OpenRA.Graphics parent.DrawSprite(s, location, 0, s.Size); } - public void DrawSprite(Sprite s, float3 a, float3 b, float3 c, float3 d) + public void DrawSprite(Sprite s, in float3 a, in float3 b, in float3 c, in float3 d) { if (s.Channel != TextureChannel.RGBA) throw new InvalidOperationException("DrawRGBASprite requires a RGBA sprite."); @@ -46,7 +46,7 @@ namespace OpenRA.Graphics parent.DrawSprite(s, a, b, c, d); } - public void DrawSpriteWithTint(Sprite s, float3 location, float3 size, float3 tint) + public void DrawSpriteWithTint(Sprite s, in float3 location, in float3 size, in float3 tint) { if (s.Channel != TextureChannel.RGBA) throw new InvalidOperationException("DrawRGBASprite requires a RGBA sprite."); @@ -54,7 +54,7 @@ namespace OpenRA.Graphics parent.DrawSpriteWithTint(s, location, 0, size, tint); } - public void DrawSpriteWithTint(Sprite s, float3 a, float3 b, float3 c, float3 d, float3 tint) + public void DrawSpriteWithTint(Sprite s, in float3 a, in float3 b, in float3 c, in float3 d, in float3 tint) { if (s.Channel != TextureChannel.RGBA) throw new InvalidOperationException("DrawRGBASprite requires a RGBA sprite."); diff --git a/OpenRA.Game/Graphics/SheetBuilder.cs b/OpenRA.Game/Graphics/SheetBuilder.cs index ca0578e453..474a9f3f61 100644 --- a/OpenRA.Game/Graphics/SheetBuilder.cs +++ b/OpenRA.Game/Graphics/SheetBuilder.cs @@ -76,7 +76,7 @@ namespace OpenRA.Graphics public Sprite Add(ISpriteFrame frame) { return Add(frame.Data, frame.Size, 0, frame.Offset); } public Sprite Add(byte[] src, Size size) { return Add(src, size, 0, float3.Zero); } - public Sprite Add(byte[] src, Size size, float zRamp, float3 spriteOffset) + public Sprite Add(byte[] src, Size size, float zRamp, in float3 spriteOffset) { // Don't bother allocating empty sprites if (size.Width == 0 || size.Height == 0) @@ -115,7 +115,7 @@ namespace OpenRA.Graphics } public Sprite Allocate(Size imageSize, float scale = 1f) { return Allocate(imageSize, 0, float3.Zero, scale); } - public Sprite Allocate(Size imageSize, float zRamp, float3 spriteOffset, float scale = 1f) + public Sprite Allocate(Size imageSize, float zRamp, in float3 spriteOffset, float scale = 1f) { if (imageSize.Width + p.X + margin > current.Size.Width) { diff --git a/OpenRA.Game/Graphics/Sprite.cs b/OpenRA.Game/Graphics/Sprite.cs index 897c340d0c..102fce3dd9 100644 --- a/OpenRA.Game/Graphics/Sprite.cs +++ b/OpenRA.Game/Graphics/Sprite.cs @@ -29,7 +29,7 @@ namespace OpenRA.Graphics public Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel, float scale = 1) : this(sheet, bounds, 0, float2.Zero, channel, BlendMode.Alpha, scale) { } - public Sprite(Sheet sheet, Rectangle bounds, float zRamp, float3 offset, TextureChannel channel, BlendMode blendMode = BlendMode.Alpha, float scale = 1f) + public Sprite(Sheet sheet, Rectangle bounds, float zRamp, in float3 offset, TextureChannel channel, BlendMode blendMode = BlendMode.Alpha, float scale = 1f) { Sheet = sheet; Bounds = bounds; diff --git a/OpenRA.Game/Graphics/SpriteRenderable.cs b/OpenRA.Game/Graphics/SpriteRenderable.cs index 135553c7d9..b3299d8494 100644 --- a/OpenRA.Game/Graphics/SpriteRenderable.cs +++ b/OpenRA.Game/Graphics/SpriteRenderable.cs @@ -58,7 +58,7 @@ namespace OpenRA.Graphics public IRenderable OffsetBy(WVec vec) { return new SpriteRenderable(sprite, pos + vec, offset, zOffset, palette, scale, tint, isDecoration, ignoreWorldTint); } public IRenderable AsDecoration() { return new SpriteRenderable(sprite, pos, offset, zOffset, palette, scale, tint, true, ignoreWorldTint); } - public IRenderable WithTint(float3 newTint) { return new SpriteRenderable(sprite, pos, offset, zOffset, palette, scale, newTint, isDecoration, ignoreWorldTint); } + public IRenderable WithTint(in float3 newTint) { return new SpriteRenderable(sprite, pos, offset, zOffset, palette, scale, newTint, isDecoration, ignoreWorldTint); } float3 ScreenPosition(WorldRenderer wr) { diff --git a/OpenRA.Game/Graphics/SpriteRenderer.cs b/OpenRA.Game/Graphics/SpriteRenderer.cs index 9ba6812f6e..695f3a3680 100644 --- a/OpenRA.Game/Graphics/SpriteRenderer.cs +++ b/OpenRA.Game/Graphics/SpriteRenderer.cs @@ -108,43 +108,43 @@ namespace OpenRA.Graphics return new int2(sheetIndex, secondarySheetIndex); } - internal void DrawSprite(Sprite s, float3 location, float paletteTextureIndex, float3 size) + internal void DrawSprite(Sprite s, in float3 location, float paletteTextureIndex, in float3 size) { var samplers = SetRenderStateForSprite(s); Util.FastCreateQuad(vertices, location + s.FractionalOffset * size, s, samplers, paletteTextureIndex, nv, size, float3.Ones); nv += 6; } - public void DrawSprite(Sprite s, float3 location, PaletteReference pal) + public void DrawSprite(Sprite s, in float3 location, PaletteReference pal) { DrawSprite(s, location, pal.TextureIndex, s.Size); } - public void DrawSprite(Sprite s, float3 location, PaletteReference pal, float3 size) + public void DrawSprite(Sprite s, in float3 location, PaletteReference pal, float3 size) { DrawSprite(s, location, pal.TextureIndex, size); } - public void DrawSprite(Sprite s, float3 a, float3 b, float3 c, float3 d) + public void DrawSprite(Sprite s, in float3 a, in float3 b, in float3 c, in float3 d) { var samplers = SetRenderStateForSprite(s); Util.FastCreateQuad(vertices, a, b, c, d, s, samplers, 0, float3.Ones, nv); nv += 6; } - internal void DrawSpriteWithTint(Sprite s, float3 location, float paletteTextureIndex, float3 size, float3 tint) + internal void DrawSpriteWithTint(Sprite s, in float3 location, float paletteTextureIndex, in float3 size, in float3 tint) { var samplers = SetRenderStateForSprite(s); Util.FastCreateQuad(vertices, location + s.FractionalOffset * size, s, samplers, paletteTextureIndex, nv, size, tint); nv += 6; } - public void DrawSpriteWithTint(Sprite s, float3 location, PaletteReference pal, float3 size, float3 tint) + public void DrawSpriteWithTint(Sprite s, in float3 location, PaletteReference pal, in float3 size, in float3 tint) { DrawSpriteWithTint(s, location, pal.TextureIndex, size, tint); } - public void DrawSpriteWithTint(Sprite s, float3 a, float3 b, float3 c, float3 d, float3 tint) + public void DrawSpriteWithTint(Sprite s, in float3 a, in float3 b, in float3 c, in float3 d, in float3 tint) { var samplers = SetRenderStateForSprite(s); Util.FastCreateQuad(vertices, a, b, c, d, s, samplers, 0, tint, nv); diff --git a/OpenRA.Game/Graphics/TerrainSpriteLayer.cs b/OpenRA.Game/Graphics/TerrainSpriteLayer.cs index 5794f63834..31ef7fcda6 100644 --- a/OpenRA.Game/Graphics/TerrainSpriteLayer.cs +++ b/OpenRA.Game/Graphics/TerrainSpriteLayer.cs @@ -137,7 +137,7 @@ namespace OpenRA.Graphics dirtyRows.Add(uv.V); } - public void Update(MPos uv, Sprite sprite, float3 pos, bool ignoreTint) + public void Update(MPos uv, Sprite sprite, in float3 pos, bool ignoreTint) { if (sprite != null) { diff --git a/OpenRA.Game/Graphics/Util.cs b/OpenRA.Game/Graphics/Util.cs index eba67ad7d3..977df163a3 100644 --- a/OpenRA.Game/Graphics/Util.cs +++ b/OpenRA.Game/Graphics/Util.cs @@ -20,7 +20,7 @@ namespace OpenRA.Graphics // yes, our channel order is nuts. static readonly int[] ChannelMasks = { 2, 1, 0, 3 }; - public static void FastCreateQuad(Vertex[] vertices, float3 o, Sprite r, int2 samplers, float paletteTextureIndex, int nv, float3 size, float3 tint) + public static void FastCreateQuad(Vertex[] vertices, in float3 o, Sprite r, int2 samplers, float paletteTextureIndex, int nv, in float3 size, in float3 tint) { var b = new float3(o.X + size.X, o.Y, o.Z); var c = new float3(o.X + size.X, o.Y + size.Y, o.Z + size.Z); @@ -29,9 +29,9 @@ namespace OpenRA.Graphics } public static void FastCreateQuad(Vertex[] vertices, - float3 a, float3 b, float3 c, float3 d, + in float3 a, in float3 b, in float3 c, in float3 d, Sprite r, int2 samplers, float paletteTextureIndex, - float3 tint, int nv) + in float3 tint, int nv) { float sl = 0; float st = 0; diff --git a/OpenRA.Game/Graphics/Vertex.cs b/OpenRA.Game/Graphics/Vertex.cs index a434a13872..2b45bdb31a 100644 --- a/OpenRA.Game/Graphics/Vertex.cs +++ b/OpenRA.Game/Graphics/Vertex.cs @@ -28,13 +28,13 @@ namespace OpenRA.Graphics // Color tint public readonly float R, G, B; - public Vertex(float3 xyz, float s, float t, float u, float v, float p, float c) + public Vertex(in float3 xyz, float s, float t, float u, float v, float p, float c) : this(xyz.X, xyz.Y, xyz.Z, s, t, u, v, p, c, float3.Ones) { } - public Vertex(float3 xyz, float s, float t, float u, float v, float p, float c, float3 tint) + public Vertex(in float3 xyz, float s, float t, float u, float v, float p, float c, in float3 tint) : this(xyz.X, xyz.Y, xyz.Z, s, t, u, v, p, c, tint.X, tint.Y, tint.Z) { } - public Vertex(float x, float y, float z, float s, float t, float u, float v, float p, float c, float3 tint) + public Vertex(float x, float y, float z, float s, float t, float u, float v, float p, float c, in float3 tint) : this(x, y, z, s, t, u, v, p, c, tint.X, tint.Y, tint.Z) { } public Vertex(float x, float y, float z, float s, float t, float u, float v, float p, float c, float r, float g, float b) diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 32fdcf9048..05aacec8ce 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -314,7 +314,7 @@ namespace OpenRA.Graphics public int2 ViewToWorldPx(int2 view) { return (graphicSettings.UIScale / Zoom * view.ToFloat2()).ToInt2() + TopLeft; } public int2 WorldToViewPx(int2 world) { return ((Zoom / graphicSettings.UIScale) * (world - TopLeft).ToFloat2()).ToInt2(); } - public int2 WorldToViewPx(float3 world) { return ((Zoom / graphicSettings.UIScale) * (world - TopLeft).XY).ToInt2(); } + public int2 WorldToViewPx(in float3 world) { return ((Zoom / graphicSettings.UIScale) * (world - TopLeft).XY).ToInt2(); } public void Center(IEnumerable actors) { diff --git a/OpenRA.Game/Primitives/float3.cs b/OpenRA.Game/Primitives/float3.cs index 9e20a35735..5b87260286 100644 --- a/OpenRA.Game/Primitives/float3.cs +++ b/OpenRA.Game/Primitives/float3.cs @@ -17,7 +17,7 @@ namespace OpenRA { [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Mimic a built-in type alias.")] [StructLayout(LayoutKind.Sequential)] - public struct float3 : IEquatable + public readonly struct float3 : IEquatable { public readonly float X, Y, Z; public float2 XY { get { return new float2(X, Y); } } @@ -28,13 +28,13 @@ namespace OpenRA public static implicit operator float3(int2 src) { return new float3(src.X, src.Y, 0); } public static implicit operator float3(float2 src) { return new float3(src.X, src.Y, 0); } - public static float3 operator +(float3 a, float3 b) { return new float3(a.X + b.X, a.Y + b.Y, a.Z + b.Z); } - public static float3 operator -(float3 a, float3 b) { return new float3(a.X - b.X, a.Y - b.Y, a.Z - b.Z); } - public static float3 operator -(float3 a) { return new float3(-a.X, -a.Y, -a.Z); } - public static float3 operator *(float3 a, float3 b) { return new float3(a.X * b.X, a.Y * b.Y, a.Z * b.Z); } - public static float3 operator *(float a, float3 b) { return new float3(a * b.X, a * b.Y, a * b.Z); } - public static float3 operator /(float3 a, float3 b) { return new float3(a.X / b.X, a.Y / b.Y, a.Z / b.Z); } - public static float3 operator /(float3 a, float b) { return new float3(a.X / b, a.Y / b, a.Z / b); } + public static float3 operator +(in float3 a, in float3 b) { return new float3(a.X + b.X, a.Y + b.Y, a.Z + b.Z); } + public static float3 operator -(in float3 a, in float3 b) { return new float3(a.X - b.X, a.Y - b.Y, a.Z - b.Z); } + public static float3 operator -(in float3 a) { return new float3(-a.X, -a.Y, -a.Z); } + public static float3 operator *(in float3 a, in float3 b) { return new float3(a.X * b.X, a.Y * b.Y, a.Z * b.Z); } + public static float3 operator *(float a, in float3 b) { return new float3(a * b.X, a * b.Y, a * b.Z); } + public static float3 operator /(in float3 a, in float3 b) { return new float3(a.X / b.X, a.Y / b.Y, a.Z / b.Z); } + public static float3 operator /(in float3 a, float b) { return new float3(a.X / b, a.Y / b, a.Z / b); } public static float3 Lerp(float3 a, float3 b, float t) { @@ -44,8 +44,8 @@ namespace OpenRA float2.Lerp(a.Z, b.Z, t)); } - public static bool operator ==(float3 me, float3 other) { return me.X == other.X && me.Y == other.Y && me.Z == other.Z; } - public static bool operator !=(float3 me, float3 other) { return !(me == other); } + public static bool operator ==(in float3 me, in float3 other) { return me.X == other.X && me.Y == other.Y && me.Z == other.Z; } + public static bool operator !=(in float3 me, in float3 other) { return !(me == other); } public override int GetHashCode() { return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); } public bool Equals(float3 other) diff --git a/OpenRA.Mods.Common/Graphics/ModelRenderable.cs b/OpenRA.Mods.Common/Graphics/ModelRenderable.cs index 1b34236543..7c91209ac9 100644 --- a/OpenRA.Mods.Common/Graphics/ModelRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/ModelRenderable.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Graphics IEnumerable models, WPos pos, int zOffset, in WRot camera, float scale, in WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor, PaletteReference color, PaletteReference normals, PaletteReference shadow, - float3 tint) + in float3 tint) { this.models = models; this.pos = pos; @@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Graphics public IRenderable AsDecoration() { return this; } - public IRenderable WithTint(float3 newTint) + public IRenderable WithTint(in float3 newTint) { return new ModelRenderable( models, pos, zOffset, camera, scale, @@ -195,7 +195,7 @@ namespace OpenRA.Mods.Common.Graphics static readonly uint[] CornerXIndex = new uint[] { 0, 0, 0, 0, 3, 3, 3, 3 }; static readonly uint[] CornerYIndex = new uint[] { 1, 1, 4, 4, 1, 1, 4, 4 }; static readonly uint[] CornerZIndex = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 }; - static void DrawBoundsBox(WorldRenderer wr, float3 pxPos, float[] transform, float[] bounds, float width, Color c) + static void DrawBoundsBox(WorldRenderer wr, in float3 pxPos, float[] transform, float[] bounds, float width, Color c) { var cr = Game.Renderer.RgbaColorRenderer; var corners = new float2[8]; diff --git a/OpenRA.Mods.Common/Traits/TerrainLighting.cs b/OpenRA.Mods.Common/Traits/TerrainLighting.cs index 1d00ea6e2d..4c060097e9 100644 --- a/OpenRA.Mods.Common/Traits/TerrainLighting.cs +++ b/OpenRA.Mods.Common/Traits/TerrainLighting.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits public readonly float Intensity; public readonly float3 Tint; - public LightSource(WPos pos, CPos cell, WDist range, float intensity, float3 tint) + public LightSource(WPos pos, CPos cell, WDist range, float intensity, in float3 tint) { Pos = pos; Cell = cell; @@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits return new Rectangle(c.X - r, c.Y - r, 2 * r, 2 * r); } - public int AddLightSource(WPos pos, WDist range, float intensity, float3 tint) + public int AddLightSource(WPos pos, WDist range, float intensity, in float3 tint) { var token = nextLightSourceToken++; var source = new LightSource(pos, map.CellContaining(pos), range, intensity, tint); diff --git a/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs b/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs index 21867ac33e..fc5b5f6186 100644 --- a/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs +++ b/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs @@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits public readonly float3 ScreenPosition; public readonly byte Variant; - public TileInfo(float3 screenPosition, byte variant) + public TileInfo(in float3 screenPosition, byte variant) { ScreenPosition = screenPosition; Variant = variant;