Move BeamRenderable into Mods.RA.

This commit is contained in:
Paul Chote
2014-07-22 16:25:02 +12:00
parent 51abbad5ff
commit 6005262992
3 changed files with 3 additions and 2 deletions

View File

@@ -1,59 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System.Drawing;
namespace OpenRA.Graphics
{
public struct BeamRenderable : IRenderable
{
readonly WPos pos;
readonly int zOffset;
readonly WVec length;
readonly Color color;
readonly float width;
public BeamRenderable(WPos pos, int zOffset, WVec length, float width, Color color)
{
this.pos = pos;
this.zOffset = zOffset;
this.length = length;
this.color = color;
this.width = width;
}
public WPos Pos { get { return pos; } }
public float Scale { get { return 1f; } }
public PaletteReference Palette { get { return null; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } }
public IRenderable WithScale(float newScale) { return new BeamRenderable(pos, zOffset, length, width, color); }
public IRenderable WithPalette(PaletteReference newPalette) { return new BeamRenderable(pos, zOffset, length, width, color); }
public IRenderable WithZOffset(int newOffset) { return new BeamRenderable(pos, zOffset, length, width, color); }
public IRenderable OffsetBy(WVec vec) { return new BeamRenderable(pos + vec, zOffset, length, width, color); }
public IRenderable AsDecoration() { return this; }
public void BeforeRender(WorldRenderer wr) {}
public void Render(WorldRenderer wr)
{
var wlr = Game.Renderer.WorldLineRenderer;
var src = wr.ScreenPosition(pos);
var dest = wr.ScreenPosition(pos + length);
var oldWidth = wlr.LineWidth;
wlr.LineWidth = wr.Viewport.Zoom * width;
wlr.DrawLine(src, dest, color, color);
wlr.LineWidth = oldWidth;
}
public void RenderDebugGeometry(WorldRenderer wr) {}
}
}

View File

@@ -200,7 +200,6 @@
<Compile Include="Graphics\VoxelAnimation.cs" />
<Compile Include="Graphics\VoxelRenderable.cs" />
<Compile Include="Graphics\TextRenderable.cs" />
<Compile Include="Graphics\BeamRenderable.cs" />
<Compile Include="Graphics\ContrailRenderable.cs" />
<Compile Include="Widgets\ViewportControllerWidget.cs" />
<Compile Include="Traits\Player\FrozenActorLayer.cs" />