mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-25 21:31:14 +00:00
Optimize SRB2 NiGHTS/zoom tube/polyobject rendering
(Text labels are removed because of performance issues)
This commit is contained in:
parent
2e2ad2688d
commit
ba67a87c75
22 changed files with 236 additions and 243 deletions
|
@ -7,6 +7,8 @@ using CodeImp.DoomBuilder.Map;
|
|||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -828,6 +830,207 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
return circles;
|
||||
}
|
||||
|
||||
public static List<Line3D> GetSRB2Lines()
|
||||
{
|
||||
List<Line3D> eventlines = new List<Line3D>();
|
||||
//List<ITextLabel> textlabels = new List<ITextLabel>();
|
||||
|
||||
if (!(General.Settings.SRB2RenderNiGHTS || General.Settings.SRB2RenderZoomTubes || General.Settings.SRB2RenderPolyobjects))
|
||||
return eventlines;
|
||||
|
||||
List<Thing> axes = new List<Thing>();
|
||||
List<Thing> axistransferlines = new List<Thing>();
|
||||
List<Thing> waypoints = new List<Thing>();
|
||||
List<Thing> polyanchors = new List<Thing>();
|
||||
List<Thing> polyspawns = new List<Thing>();
|
||||
List<Linedef> firstlines = new List<Linedef>();
|
||||
|
||||
// Collect relevant things
|
||||
foreach (Thing t in General.Map.Map.Things)
|
||||
{
|
||||
if (General.Settings.SRB2RenderNiGHTS && t.Type == 1700)
|
||||
axes.Add(t);
|
||||
else if (General.Settings.SRB2RenderNiGHTS && t.Type == 1702)
|
||||
axistransferlines.Add(t);
|
||||
else if (General.Settings.SRB2RenderZoomTubes && t.Type == 753)
|
||||
waypoints.Add(t);
|
||||
else if (General.Settings.SRB2RenderPolyobjects && t.Type == 760)
|
||||
polyanchors.Add(t);
|
||||
else if (General.Settings.SRB2RenderPolyobjects && (t.Type == 761 || t.Type == 762))
|
||||
polyspawns.Add(t);
|
||||
}
|
||||
|
||||
// Sort by axis number and mare number.
|
||||
axistransferlines = axistransferlines.OrderBy(x => x.Args[0]).ThenBy(x => x.Args[1]).ToList();
|
||||
|
||||
// Sort waypoints by order and sequence number.
|
||||
waypoints = waypoints.OrderBy(x => x.Args[0]).ThenBy(x => x.Args[1]).ToList();
|
||||
|
||||
// Sort polyobject stuff by "angle"/tag
|
||||
polyanchors.Sort((x, y) => x.Tag.CompareTo(y.Tag));
|
||||
polyspawns.Sort((x, y) => x.Tag.CompareTo(y.Tag));
|
||||
|
||||
// Collect relevant lines
|
||||
if (General.Settings.SRB2RenderPolyobjects)
|
||||
{
|
||||
foreach (Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
if (l.Action == 20) firstlines.Add(l);
|
||||
}
|
||||
|
||||
//Sort polyobject first lines by tag
|
||||
firstlines.Sort((x, y) => x.Args[0].CompareTo(y.Args[0]));
|
||||
}
|
||||
|
||||
//Render (zoom tube) waypoint sequences.
|
||||
if (General.Settings.SRB2RenderZoomTubes)
|
||||
{
|
||||
int i = 0;
|
||||
int size = waypoints.Count;
|
||||
int seqStart = 0;
|
||||
while (i < size)
|
||||
{
|
||||
int iNext = i + 1;
|
||||
if (waypoints[i].Args[1] == 0) // start of a new sequence?
|
||||
{
|
||||
seqStart = i;
|
||||
//TextLabel l = new TextLabel();
|
||||
//l.Text = waypoints[i].Args[0].ToString();
|
||||
//l.Location = waypoints[i].Position;
|
||||
//l.Color = PixelColor.FromColor(Color.FromArgb(255, 0, 255, 192));
|
||||
//l.TransformCoords = true;
|
||||
//textlabels.Add(l);
|
||||
}
|
||||
|
||||
if (iNext < size)
|
||||
{
|
||||
// draw line between this waypoint and the next
|
||||
if (waypoints[iNext].Args[1] == waypoints[i].Args[1] + 1)
|
||||
eventlines.Add(new Line3D(waypoints[i].Position, waypoints[iNext].Position, PixelColor.FromColor(Color.FromArgb(255, 0, 255, 192))));
|
||||
|
||||
// mark duplicate waypoints
|
||||
else if (waypoints[iNext].Args[1] == waypoints[i].Args[1])
|
||||
{
|
||||
eventlines.AddRange(MakeCircleLines(waypoints[i].Position, PixelColor.FromColor(Color.Red), 32, CIRCLE_SIDES));
|
||||
eventlines.AddRange(MakeCircleLines(waypoints[iNext].Position, PixelColor.FromColor(Color.Red), 32, CIRCLE_SIDES));
|
||||
}
|
||||
|
||||
// mark inaccessible waypoints
|
||||
else if (i > 0 && waypoints[i].Args[1] - waypoints[i - 1].Args[1] > 1)
|
||||
eventlines.AddRange(MakeCircleLines(waypoints[i].Position, PixelColor.FromColor(Color.Red), 32, CIRCLE_SIDES));
|
||||
|
||||
// draw different line between last and first waypoint of this sequence
|
||||
else if (waypoints[i].Args[0] == waypoints[seqStart].Args[0] && waypoints[iNext].Args[0] > waypoints[i].Args[0])
|
||||
eventlines.Add(new Line3D(waypoints[i].Position, waypoints[seqStart].Position, PixelColor.FromColor(Color.FromArgb(255, 0, 192, 255))));
|
||||
}
|
||||
i = iNext;
|
||||
}
|
||||
}
|
||||
|
||||
//Render axis transfer lines.
|
||||
if (General.Settings.SRB2RenderNiGHTS)
|
||||
{
|
||||
int i = 0;
|
||||
int size = axistransferlines.Count;
|
||||
while (i < size - 1)
|
||||
{
|
||||
int iNext = i;
|
||||
while (iNext < size - 1 && axistransferlines[++iNext].Args[1] <= axistransferlines[i].Args[1]) ;
|
||||
|
||||
if (iNext < size && axistransferlines[iNext].Args[1] == axistransferlines[i].Args[1] + 1)
|
||||
{
|
||||
int mare = axistransferlines[i].Args[0];
|
||||
eventlines.Add(new Line3D(axistransferlines[i].Position, axistransferlines[iNext].Position, General.Colors.GetNiGHTSColor(mare)));
|
||||
/* Start looking for partners for the one beyond iNext. */
|
||||
i = iNext + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No partner, so start looking for partners for iNext. */
|
||||
i = iNext;
|
||||
}
|
||||
}
|
||||
//Render axes.
|
||||
foreach (Thing axis in axes)
|
||||
{
|
||||
int mare = axis.Args[0];
|
||||
eventlines.AddRange(MakeCircleLines(axis.Position, General.Colors.GetNiGHTSColor(mare), axis.Args[2], CIRCLE_SIDES * 2));
|
||||
}
|
||||
}
|
||||
|
||||
if (General.Settings.SRB2RenderPolyobjects)
|
||||
{
|
||||
int i = 0, j = 0, k = 0;
|
||||
Sector s = null;
|
||||
while (i < polyanchors.Count && j < polyspawns.Count && k < firstlines.Count)
|
||||
{
|
||||
while (j + 1 < polyspawns.Count && polyanchors[i].Tag > polyspawns[j].Tag) j++;
|
||||
while (k + 1 < firstlines.Count && polyanchors[i].Tag > firstlines[k].Args[0]) k++;
|
||||
|
||||
if (polyanchors[i].Tag == firstlines[k].Args[0])
|
||||
s = firstlines[k].Back.Sector;
|
||||
else
|
||||
s = null;
|
||||
|
||||
if (polyanchors[i].Tag == polyspawns[j].Tag && s != null)
|
||||
{
|
||||
while (j + 1 < polyspawns.Count && polyspawns[j].Tag == polyspawns[j + 1].Tag)
|
||||
{
|
||||
//TextLabel l = new TextLabel();
|
||||
//l.Text = polyspawns[j].Tag.ToString();
|
||||
//l.Location = polyspawns[j].Position;
|
||||
//l.Color = PixelColor.FromColor(Color.Red);
|
||||
//l.TransformCoords = true;
|
||||
//textlabels.Add(l);
|
||||
j++;
|
||||
}
|
||||
|
||||
double xdiff = polyanchors[i].Position.x - polyspawns[j].Position.x;
|
||||
double ydiff = polyanchors[i].Position.y - polyspawns[j].Position.y;
|
||||
|
||||
foreach (Sidedef side in s.Sidedefs)
|
||||
{
|
||||
Vector2D start = side.Line.Start.Position;
|
||||
Vector2D end = side.Line.End.Position;
|
||||
start.x -= xdiff;
|
||||
start.y -= ydiff;
|
||||
end.x -= xdiff;
|
||||
end.y -= ydiff;
|
||||
eventlines.Add(new Line3D(start, end, PixelColor.FromColor(Color.FromArgb(255, 128, 255, 0)), false));
|
||||
}
|
||||
|
||||
//TextLabel ls = new TextLabel();
|
||||
//ls.Text = polyspawns[j].Tag.ToString();
|
||||
//ls.Location = polyspawns[j].Position;
|
||||
//ls.Color = PixelColor.FromColor(Color.FromArgb(255, 128, 255, 0));
|
||||
//ls.TransformCoords = true;
|
||||
//textlabels.Add(ls);
|
||||
|
||||
//TextLabel la = new TextLabel();
|
||||
//la.Text = polyanchors[j].Tag.ToString();
|
||||
//la.Location = polyanchors[j].Position;
|
||||
//la.Color = PixelColor.FromColor(Color.FromArgb(255, 255, 192, 0));
|
||||
//la.TransformCoords = true;
|
||||
//textlabels.Add(la);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TextLabel l = new TextLabel();
|
||||
//l.Text = polyanchors[j].Tag.ToString();
|
||||
//l.Location = polyanchors[j].Position;
|
||||
//l.Color = PixelColor.FromColor(Color.Red);
|
||||
//l.TransformCoords = true;
|
||||
//textlabels.Add(l);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
//General.Map.Renderer2D.RenderText(textlabels);
|
||||
return eventlines;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Utility
|
||||
|
|
|
@ -69,12 +69,13 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
void PlotVerticesSet(ICollection<Vertex> vertices, bool checkMode = true);
|
||||
void RenderThing(Thing t, PixelColor c, float alpha);
|
||||
void RenderThingSet(ICollection<Thing> things, float alpha);
|
||||
void RenderSRB2Extras();
|
||||
void RenderRectangle(RectangleF rect, float bordersize, PixelColor c, bool transformrect);
|
||||
void RenderRectangleFilled(RectangleF rect, PixelColor c, bool transformrect);
|
||||
void RenderRectangleFilled(RectangleF rect, PixelColor c, bool transformrect, ImageData texture);
|
||||
void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords);
|
||||
void RenderArrows(ICollection<Line3D> line); //mxd
|
||||
void RenderArrows(ICollection<Line3D> line, bool transformcoords); //mxd
|
||||
void RenderArrows(ICollection<Line3D> line, bool transformcoords, bool sizecheck); //mxd
|
||||
void RenderText(TextLabel text); //mxd, DB2 compatibility
|
||||
void RenderText(ITextLabel text); //mxd
|
||||
void RenderText(IList<ITextLabel> labels); //mxd
|
||||
|
|
|
@ -112,17 +112,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Presentation
|
||||
private Presentation present;
|
||||
|
||||
// SRB2 stuff
|
||||
private List<Thing> axes;
|
||||
private List<Thing> axistransferlines;
|
||||
private List<Thing> waypoints;
|
||||
private List<Thing> polyanchors;
|
||||
private List<Thing> polyspawns;
|
||||
private List<Linedef> firstlines;
|
||||
|
||||
private TextLabel spawnlabel;
|
||||
private TextLabel anchorlabel;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -163,24 +152,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Create rendertargets
|
||||
CreateRendertargets();
|
||||
|
||||
anchorlabel = new TextLabel() // create sequence ID label
|
||||
{
|
||||
Text = "0",
|
||||
AlignX = TextAlignmentX.Center,
|
||||
AlignY = TextAlignmentY.Middle,
|
||||
Color = PixelColor.FromColor(Color.FromArgb(255, 255, 192, 0)),
|
||||
TransformCoords = true
|
||||
};
|
||||
|
||||
spawnlabel = new TextLabel() // create sequence ID label
|
||||
{
|
||||
Text = "0",
|
||||
AlignX = TextAlignmentX.Center,
|
||||
AlignY = TextAlignmentY.Middle,
|
||||
Color = PixelColor.FromColor(Color.FromArgb(255, 128, 255, 0)),
|
||||
TransformCoords = true
|
||||
};
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
@ -1594,7 +1565,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd. Render thing boxes
|
||||
RenderArrows(bboxes, false);
|
||||
RenderArrows(bboxes, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1615,194 +1586,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
public void RenderSRB2Extras()
|
||||
{
|
||||
if (!(General.Settings.SRB2RenderNiGHTS || General.Settings.SRB2RenderZoomTubes || General.Settings.SRB2RenderPolyobjects)) return;
|
||||
|
||||
axes = new List<Thing>();
|
||||
axistransferlines = new List<Thing>();
|
||||
waypoints = new List<Thing>();
|
||||
polyanchors = new List<Thing>();
|
||||
polyspawns = new List<Thing>();
|
||||
firstlines = new List<Linedef>();
|
||||
|
||||
// Collect relevant things
|
||||
foreach (Thing t in General.Map.Map.Things)
|
||||
{
|
||||
if (General.Settings.SRB2RenderNiGHTS && t.Type == 1700)
|
||||
axes.Add(t);
|
||||
else if (General.Settings.SRB2RenderNiGHTS && t.Type == 1702)
|
||||
axistransferlines.Add(t);
|
||||
else if (General.Settings.SRB2RenderZoomTubes && t.Type == 753)
|
||||
waypoints.Add(t);
|
||||
else if (General.Settings.SRB2RenderPolyobjects && t.Type == 760)
|
||||
polyanchors.Add(t);
|
||||
else if (General.Settings.SRB2RenderPolyobjects && (t.Type == 761 || t.Type == 762))
|
||||
polyspawns.Add(t);
|
||||
}
|
||||
|
||||
// Sort waypoints by order and sequence number.
|
||||
waypoints = waypoints.OrderBy(x => x.Args[0]).ThenBy(x => x.Args[1]).ToList();
|
||||
|
||||
// Sort polyobject stuff by "angle"/tag
|
||||
polyanchors.Sort((x, y) => x.Tag.CompareTo(y.Tag));
|
||||
polyspawns.Sort((x, y) => x.Tag.CompareTo(y.Tag));
|
||||
|
||||
// Sort by axis number and mare number.
|
||||
axistransferlines = axistransferlines.OrderBy(x => x.Args[0]).ThenBy(x => x.Args[1]).ToList();
|
||||
|
||||
// Collect relevant lines
|
||||
if (General.Settings.SRB2RenderPolyobjects)
|
||||
{
|
||||
foreach (Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
if (l.Action == 20) firstlines.Add(l);
|
||||
}
|
||||
|
||||
//Sort polyobject first lines by tag
|
||||
firstlines.Sort((x, y) => x.Args[0].CompareTo(y.Args[0]));
|
||||
}
|
||||
|
||||
//Render (zoom tube) waypoint sequences.
|
||||
if (General.Settings.SRB2RenderZoomTubes)
|
||||
{
|
||||
int i = 0;
|
||||
int size = waypoints.Count;
|
||||
int seqStart = 0;
|
||||
ITextLabel[] sequencelabels = new ITextLabel[256];
|
||||
while (i < size)
|
||||
{
|
||||
int iNext = i + 1;
|
||||
if (waypoints[i].Args[1] == 0) // start of a new sequence?
|
||||
{
|
||||
seqStart = i;
|
||||
sequencelabels[waypoints[i].Args[0]] = new TextLabel() // create sequence ID label
|
||||
{
|
||||
Text = waypoints[i].Args[0].ToString(),
|
||||
AlignX = TextAlignmentX.Center,
|
||||
AlignY = TextAlignmentY.Middle,
|
||||
Color = PixelColor.FromColor(Color.FromArgb(255, 0, 255, 192)),
|
||||
TransformCoords = true,
|
||||
Location = waypoints[i].Position
|
||||
};
|
||||
}
|
||||
|
||||
if (iNext < size)
|
||||
{
|
||||
// draw line between this waypoint and the next
|
||||
if (waypoints[iNext].Args[1] == waypoints[i].Args[1] + 1)
|
||||
RenderLine(waypoints[i].Position, waypoints[iNext].Position, 1.5f, PixelColor.FromColor(Color.FromArgb(255, 0, 255, 192)), true);
|
||||
|
||||
// mark duplicate waypoints
|
||||
else if (waypoints[iNext].Args[1] == waypoints[i].Args[1])
|
||||
{
|
||||
RenderCircle(waypoints[i].Position, 32f, 1f, PixelColor.FromColor(Color.Red), true);
|
||||
RenderCircle(waypoints[iNext].Position, 32f, 1f, PixelColor.FromColor(Color.Red), true);
|
||||
}
|
||||
|
||||
// mark inaccessible waypoints
|
||||
else if (i > 0 && waypoints[i].Args[1] - waypoints[i - 1].Args[1] > 1)
|
||||
RenderCircle(waypoints[i].Position, 32f, 1f, PixelColor.FromColor(Color.Red), true);
|
||||
|
||||
// draw different line between last and first waypoint of this sequence
|
||||
else if (waypoints[i].Args[0] == waypoints[seqStart].Args[0] && waypoints[iNext].Args[0] > waypoints[i].Args[0])
|
||||
RenderLine(waypoints[i].Position, waypoints[seqStart].Position, 0.75f, PixelColor.FromColor(Color.FromArgb(255, 0, 192, 255)), true);
|
||||
}
|
||||
i = iNext;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
if (sequencelabels[i] != null) RenderText(sequencelabels[i]);
|
||||
}
|
||||
|
||||
//Render axis transfer lines.
|
||||
if (General.Settings.SRB2RenderNiGHTS)
|
||||
{
|
||||
int i = 0;
|
||||
int size = axistransferlines.Count;
|
||||
while (i < size - 1)
|
||||
{
|
||||
int iNext = i;
|
||||
while (iNext < size - 1 && axistransferlines[++iNext].Args[1] <= axistransferlines[i].Args[1]) ;
|
||||
|
||||
if (iNext < size && axistransferlines[iNext].Args[1] == axistransferlines[i].Args[1] + 1)
|
||||
{
|
||||
int mare = axistransferlines[i].Args[0];
|
||||
RenderLine(axistransferlines[i].Position, axistransferlines[iNext].Position, 1f, General.Colors.GetNiGHTSColor(mare), true);
|
||||
/* Start looking for partners for the one beyond iNext. */
|
||||
i = iNext + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No partner, so start looking for partners for iNext. */
|
||||
i = iNext;
|
||||
}
|
||||
}
|
||||
//Render axes.
|
||||
foreach (Thing axis in axes)
|
||||
{
|
||||
int mare = axis.Args[0];
|
||||
RenderCircle(axis.Position, axis.Args[2], 1f, General.Colors.GetNiGHTSColor(mare), true);
|
||||
}
|
||||
}
|
||||
|
||||
if (General.Settings.SRB2RenderPolyobjects)
|
||||
{
|
||||
int i = 0, j = 0, k = 0;
|
||||
Sector s = null;
|
||||
while (i < polyanchors.Count && j < polyspawns.Count && k < firstlines.Count)
|
||||
{
|
||||
while (j + 1 < polyspawns.Count && polyanchors[i].Tag > polyspawns[j].Tag) j++;
|
||||
while (k + 1 < firstlines.Count && polyanchors[i].Tag > firstlines[k].Args[0]) k++;
|
||||
|
||||
if (polyanchors[i].Tag == firstlines[k].Args[0])
|
||||
s = firstlines[k].Back.Sector;
|
||||
else
|
||||
s = null;
|
||||
|
||||
if (polyanchors[i].Tag == polyspawns[j].Tag && s != null)
|
||||
{
|
||||
while (j + 1 < polyspawns.Count && polyspawns[j].Tag == polyspawns[j + 1].Tag)
|
||||
{
|
||||
// Mark redundant spawnpoints
|
||||
spawnlabel.Text = polyspawns[j].Tag.ToString();
|
||||
spawnlabel.Location = polyspawns[j].Position;
|
||||
spawnlabel.Color = PixelColor.FromColor(Color.Red);
|
||||
RenderText((ITextLabel)spawnlabel);
|
||||
j++;
|
||||
}
|
||||
|
||||
double xdiff = polyanchors[i].Position.x - polyspawns[j].Position.x;
|
||||
double ydiff = polyanchors[i].Position.y - polyspawns[j].Position.y;
|
||||
|
||||
foreach (Sidedef side in s.Sidedefs)
|
||||
{
|
||||
Vector2D start = side.Line.Start.Position;
|
||||
Vector2D end = side.Line.End.Position;
|
||||
start.x -= xdiff;
|
||||
start.y -= ydiff;
|
||||
end.x -= xdiff;
|
||||
end.y -= ydiff;
|
||||
RenderLine(start, end, 1.0f, PixelColor.FromColor(Color.FromArgb(255, 128, 255, 0)), true);
|
||||
}
|
||||
anchorlabel.Color = PixelColor.FromColor(Color.FromArgb(255, 255, 192, 0));
|
||||
spawnlabel.Color = PixelColor.FromColor(Color.FromArgb(255, 128, 255, 0));
|
||||
|
||||
spawnlabel.Text = polyspawns[j].Tag.ToString();
|
||||
spawnlabel.Location = polyspawns[j].Position;
|
||||
RenderText((ITextLabel)spawnlabel);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mark unused polyobject anchors
|
||||
anchorlabel.Color = PixelColor.FromColor(Color.Red);
|
||||
}
|
||||
|
||||
anchorlabel.Text = polyanchors[i].Tag.ToString();
|
||||
anchorlabel.Location = polyanchors[i].Position;
|
||||
RenderText((ITextLabel)anchorlabel);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
RenderArrows(LinksCollector.GetSRB2Lines(), true, false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -2108,8 +1892,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
public void RenderArrows(ICollection<Line3D> lines) { RenderArrows(lines, true); }
|
||||
public void RenderArrows(ICollection<Line3D> lines, bool transformcoords)
|
||||
public void RenderArrows(ICollection<Line3D> lines) { RenderArrows(lines, true, true); }
|
||||
public void RenderArrows(ICollection<Line3D> lines, bool transformcoords, bool sizecheck)
|
||||
{
|
||||
if(lines.Count == 0) return;
|
||||
int pointscount = 0;
|
||||
|
@ -2130,7 +1914,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
float miny = (float)Math.Min(line.Start2D.y, line.End2D.y);
|
||||
|
||||
// Too small / not on screen?
|
||||
if(((line.End2D - line.Start2D).GetLengthSq() < MINIMUM_SPRITE_RADIUS) || ((maxx <= 0.0f) || (minx >= windowsize.Width) || (maxy <= 0.0f) || (miny >= windowsize.Height)))
|
||||
if(((line.End2D - line.Start2D).GetLengthSq() < MINIMUM_SPRITE_RADIUS && sizecheck) || ((maxx <= 0.0f && sizecheck) || (minx >= windowsize.Width) || (maxy <= 0.0f && sizecheck) || (miny >= windowsize.Height)))
|
||||
{
|
||||
line.SkipRendering = true;
|
||||
}
|
||||
|
@ -2496,23 +2280,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
// This renders a circle with given color
|
||||
public void RenderCircle(Vector2D center, float radius, float thickness, PixelColor c, bool transformcoords)
|
||||
{
|
||||
int CIRCLE_PRECISION = 128;
|
||||
Vector2D[] points = new Vector2D[CIRCLE_PRECISION];
|
||||
for (int i = 0; i < CIRCLE_PRECISION; i++)
|
||||
{
|
||||
float fAngle = i * 2 * (float)Math.PI / CIRCLE_PRECISION;
|
||||
points[i].x = center.x + ((float)Math.Cos(fAngle) * radius);
|
||||
points[i].y = center.y + ((float)Math.Sin(fAngle) * radius);
|
||||
}
|
||||
for (int i = 0; i < CIRCLE_PRECISION; i++)
|
||||
{
|
||||
RenderLine(points[i], points[(i + 1) % CIRCLE_PRECISION], thickness, c, transformcoords);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -786,6 +786,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
|
|||
if (renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, 1.0f);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -210,6 +210,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
renderer.RenderSRB2Extras();
|
||||
|
||||
renderer.Finish();
|
||||
}
|
||||
|
|
|
@ -840,6 +840,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -373,6 +373,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
@ -154,6 +155,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(unselectedthings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderThingSet(selectedthings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
@ -154,6 +155,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(unselectedthings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderThingSet(selectedthings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -320,6 +320,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(unmovingthings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderThingSet(dragthings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
|
||||
// Draw the dragged item highlighted
|
||||
// This is important to know, because this item is used
|
||||
|
|
|
@ -106,6 +106,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +140,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(unselectedthings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderThingSet(selectedthings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -900,6 +900,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -1962,7 +1962,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, General.Settings.ActiveThingsAlpha);
|
||||
if(highlighted is Thing) renderer.RenderThing((Thing)highlighted, General.Colors.Highlight, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
if (highlighted is Thing) renderer.RenderThing((Thing)highlighted, General.Colors.Highlight, General.Settings.ActiveThingsAlpha);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
//foreach(ErrorResult result in selection) result.RenderThingsSelection(renderer); //mxd
|
||||
renderer.Finish();
|
||||
}
|
||||
|
|
|
@ -142,7 +142,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, General.Settings.ActiveThingsAlpha);
|
||||
if(BuilderPlug.Me.FindReplaceForm.Finder != null)
|
||||
renderer.RenderSRB2Extras();
|
||||
if (BuilderPlug.Me.FindReplaceForm.Finder != null)
|
||||
BuilderPlug.Me.FindReplaceForm.Finder.RenderThingsSelection(renderer, selection);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
|
|
@ -877,6 +877,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -701,6 +701,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -344,6 +344,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -952,6 +952,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -249,8 +249,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
float alpha = (General.Settings.FixedThingsScale ? Presentation.THINGS_ALPHA : General.Settings.ActiveThingsAlpha); //mxd
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, alpha);
|
||||
|
||||
if(highlighted != null && !highlighted.IsDisposed)
|
||||
renderer.RenderSRB2Extras();
|
||||
|
||||
if (highlighted != null && !highlighted.IsDisposed)
|
||||
{
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight, alpha);
|
||||
highlightasso.Render();
|
||||
|
|
|
@ -183,6 +183,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, General.Settings.HiddenThingsAlpha);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -1481,6 +1481,7 @@ namespace CodeImp.DoomBuilder.StairSectorBuilderMode
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, General.Settings.ActiveThingsAlpha);
|
||||
renderer.RenderSRB2Extras();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue