mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
Classic modes: changed the way event lines are rendered. Should work much faster now. Event lines are now displayed while panning the view.
This commit is contained in:
parent
97d54d2070
commit
540eb2fda8
12 changed files with 196 additions and 226 deletions
|
@ -18,7 +18,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
public bool ProcessPolyobjects;
|
||||
}
|
||||
|
||||
public static List<Line3D> GetThingLinks(ICollection<VisualThing> visualThings)
|
||||
public static List<List<Line3D>> GetThingLinks(ICollection<VisualThing> visualThings)
|
||||
{
|
||||
List<Thing> things = new List<Thing>();
|
||||
foreach (VisualThing vt in visualThings) things.Add(vt.Thing);
|
||||
|
@ -26,15 +26,15 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
ThingsCheckResult result = CheckThings(things);
|
||||
if (result.ProcessPathNodes || result.ProcessInterpolationPoints || result.ProcessThingsWithGoal || result.ProcessCameras || result.ProcessPolyobjects)
|
||||
return GetThingLinks(result, true);
|
||||
return new List<Line3D>();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Line3D> GetThingLinks(ICollection<Thing> things)
|
||||
public static List<List<Line3D>> GetThingLinks(ICollection<Thing> things)
|
||||
{
|
||||
ThingsCheckResult result = CheckThings(things);
|
||||
if (result.ProcessPathNodes || result.ProcessInterpolationPoints || result.ProcessThingsWithGoal || result.ProcessCameras || result.ProcessPolyobjects)
|
||||
return GetThingLinks(result, false);
|
||||
return new List<Line3D>();
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ThingsCheckResult CheckThings(ICollection<Thing> things)
|
||||
|
@ -62,9 +62,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
return result;
|
||||
}
|
||||
|
||||
private static List<Line3D> GetThingLinks(ThingsCheckResult result, bool correctHeight)
|
||||
private static List<List<Line3D>> GetThingLinks(ThingsCheckResult result, bool correctHeight)
|
||||
{
|
||||
List<Line3D> lines = new List<Line3D>();
|
||||
List<List<Line3D>> lines = new List<List<Line3D>> { new List<Line3D>(), new List<Line3D>() };
|
||||
Dictionary<int, List<Thing>> pathNodes = new Dictionary<int, List<Thing>>();
|
||||
Dictionary<int, List<Thing>> interpolationPoints = new Dictionary<int, List<Thing>>();
|
||||
List<Thing> thingsWithGoal = new List<Thing>();
|
||||
|
@ -152,7 +152,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
{
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += GetCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end));
|
||||
lines[0].Add(new Line3D(start, end));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
end = tt.Position;
|
||||
if(correctHeight) end.z += GetCorrectHeight(tt);
|
||||
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
lines[1].Add(new Line3D(start, end, General.Colors.Selection));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
{
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += GetCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end));
|
||||
lines[0].Add(new Line3D(start, end));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
{
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += GetCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
lines[1].Add(new Line3D(start, end, General.Colors.Selection));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
{
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += GetCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
lines[1].Add(new Line3D(start, end, General.Colors.Selection));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
{
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += GetCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
lines[1].Add(new Line3D(start, end, General.Colors.Selection));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
{
|
||||
end = startspot.Position;
|
||||
if(correctHeight) end.z += GetCorrectHeight(startspot);
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
lines[1].Add(new Line3D(start, end, General.Colors.Selection));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,29 @@
|
|||
using System;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
|
||||
namespace CodeImp.DoomBuilder.GZBuilder.Geometry
|
||||
{
|
||||
public enum Line3DType
|
||||
{
|
||||
DEFAULT,
|
||||
ACTIVATOR,
|
||||
}
|
||||
|
||||
public class Line3D
|
||||
{
|
||||
// Coordinates
|
||||
public Vector3D v1;
|
||||
public Vector3D v2;
|
||||
public Line3DType LineType { get { return lineType; } }
|
||||
private Line3DType lineType;
|
||||
public PixelColor color;
|
||||
|
||||
// Constructors
|
||||
public Line3D(Vector3D v1, Vector3D v2)
|
||||
{
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.lineType = Line3DType.DEFAULT;
|
||||
this.color = General.Colors.InfoLine;
|
||||
}
|
||||
|
||||
public Line3D(Vector3D v1, Vector3D v2, Line3DType lineType)
|
||||
public Line3D(Vector3D v1, Vector3D v2, PixelColor color)
|
||||
{
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.lineType = lineType;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public Vector3D GetDelta() { return v2 - v1; }
|
||||
|
@ -39,7 +33,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry
|
|||
{
|
||||
// Calculate and return the angle
|
||||
Vector2D d = GetDelta();
|
||||
return -(float)Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;//mxd // (float)Math.PI * 0.5f;
|
||||
return -(float)Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
public struct FlatVertex
|
||||
{
|
||||
// Vertex format
|
||||
public const int Stride = 6 * 4;
|
||||
public const int Stride = 24; //6 * 4
|
||||
|
||||
// Members
|
||||
public float x;
|
||||
|
|
|
@ -58,8 +58,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
void Present();
|
||||
|
||||
// Drawing methods
|
||||
void RenderArrow(Line3D line, PixelColor c); //mxd
|
||||
void PlotArrow(Line3D line, PixelColor c); //mxd
|
||||
void PlotLine(Vector2D start, Vector2D end, PixelColor c);
|
||||
void PlotLinedef(Linedef l, PixelColor c);
|
||||
void PlotLinedefSet(ICollection<Linedef> linedefs);
|
||||
|
@ -74,6 +72,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
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(List<Line3D> line); //mxd
|
||||
void RenderText(TextLabel text);
|
||||
void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords);
|
||||
void RenderHighlight(FlatVertex[] vertices, int color); //mxd
|
||||
|
|
|
@ -1687,27 +1687,73 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
public void RenderArrow(Line3D line, PixelColor c)
|
||||
{
|
||||
float scaler = 20f / scale;
|
||||
|
||||
RenderLine(line.v1, line.v2, 0.8f, c, true);
|
||||
float angle = line.GetAngle();
|
||||
//arrowhead
|
||||
RenderLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle - 0.46f), line.v2.y + scaler * (float)Math.Cos(angle - 0.46f)), 0.8f, c, true);
|
||||
RenderLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle + 0.46f), line.v2.y + scaler * (float)Math.Cos(angle + 0.46f)), 0.8f, c, true);
|
||||
}
|
||||
|
||||
//mxd
|
||||
public void PlotArrow(Line3D line, PixelColor c)
|
||||
public void RenderArrows(List<Line3D> lines)
|
||||
{
|
||||
if(lines.Count == 0) return;
|
||||
FlatVertex[] verts = new FlatVertex[lines.Count * 6]; //2 verts per line * 3 lines
|
||||
float scaler = 16f / scale;
|
||||
int color;
|
||||
|
||||
PlotLine(line.v1, line.v2, c);
|
||||
float angle = line.GetAngle();
|
||||
//arrowhead
|
||||
PlotLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle - 0.46f), line.v2.y + scaler * (float)Math.Cos(angle - 0.46f)), c);
|
||||
PlotLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle + 0.46f), line.v2.y + scaler * (float)Math.Cos(angle + 0.46f)), c);
|
||||
// Create verts array
|
||||
for(int i = 0; i < lines.Count; i++)
|
||||
{
|
||||
color = lines[i].color.ToInt();
|
||||
|
||||
// Calculate positions
|
||||
Vector2D v1 = ((Vector2D)lines[i].v1).GetTransformed(translatex, translatey, scale, -scale); //start
|
||||
Vector2D v2 = ((Vector2D)lines[i].v2).GetTransformed(translatex, translatey, scale, -scale); //end
|
||||
|
||||
float angle = lines[i].GetAngle();
|
||||
Vector2D v3 = new Vector2D(lines[i].v2.x - scaler * (float)Math.Sin(angle - 0.46f), lines[i].v2.y + scaler * (float)Math.Cos(angle - 0.46f)).GetTransformed(translatex, translatey, scale, -scale); //arrowhead end 1
|
||||
Vector2D v4 = new Vector2D(lines[i].v2.x - scaler * (float)Math.Sin(angle + 0.46f), lines[i].v2.y + scaler * (float)Math.Cos(angle + 0.46f)).GetTransformed(translatex, translatey, scale, -scale); //arrowhead end 2
|
||||
|
||||
verts[i * 6].x = v1.x;
|
||||
verts[i * 6].y = v1.y;
|
||||
verts[i * 6].c = color;
|
||||
|
||||
verts[i * 6 + 1].x = v2.x;
|
||||
verts[i * 6 + 1].y = v2.y;
|
||||
verts[i * 6 + 1].c = color;
|
||||
|
||||
// Arrowhead
|
||||
verts[i * 6 + 2] = verts[i * 6 + 1];
|
||||
verts[i * 6 + 3].x = v3.x;
|
||||
verts[i * 6 + 3].y = v3.y;
|
||||
verts[i * 6 + 3].c = color;
|
||||
|
||||
verts[i * 6 + 4] = verts[i * 6 + 1];
|
||||
verts[i * 6 + 5].x = v4.x;
|
||||
verts[i * 6 + 5].y = v4.y;
|
||||
verts[i * 6 + 5].c = color;
|
||||
}
|
||||
|
||||
// Write to buffer
|
||||
VertexBuffer vb = new VertexBuffer(General.Map.Graphics.Device, FlatVertex.Stride * verts.Length, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
|
||||
DataStream s = vb.Lock(0, FlatVertex.Stride * verts.Length, LockFlags.Discard);
|
||||
s.WriteRange(verts);
|
||||
vb.Unlock();
|
||||
s.Dispose();
|
||||
|
||||
// Set renderstates for rendering
|
||||
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||
graphics.Device.SetRenderState(RenderState.ZEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
graphics.Device.SetRenderState(RenderState.FogEnable, false);
|
||||
SetWorldTransformation(false);
|
||||
graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture);
|
||||
graphics.Shaders.Display2D.Texture1 = General.Map.Data.WhiteTexture.Texture;
|
||||
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
|
||||
|
||||
// Draw
|
||||
graphics.Shaders.Display2D.Begin();
|
||||
graphics.Shaders.Display2D.BeginPass(1);
|
||||
graphics.Device.SetStreamSource(0, vb, 0, FlatVertex.Stride);
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.LineList, 0, lines.Count * 3);
|
||||
graphics.Shaders.Display2D.EndPass();
|
||||
graphics.Shaders.Display2D.End();
|
||||
vb.Dispose();
|
||||
}
|
||||
|
||||
// This renders a line with given color
|
||||
|
@ -1759,7 +1805,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Draw
|
||||
graphics.Shaders.Display2D.Begin();
|
||||
graphics.Shaders.Display2D.BeginPass(0);
|
||||
graphics.Device.DrawUserPrimitives<FlatVertex>(PrimitiveType.TriangleStrip, 0, 2, verts);
|
||||
graphics.Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 0, 2, verts);
|
||||
graphics.Shaders.Display2D.EndPass();
|
||||
graphics.Shaders.Display2D.End();
|
||||
}
|
||||
|
|
|
@ -466,26 +466,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
//mxd. LINKS
|
||||
if (General.Settings.GZShowEventLines)
|
||||
{
|
||||
//mxd. gather links
|
||||
List<Line3D> lines = LinksCollector.GetThingLinks(thingsbydistance);
|
||||
if(lines.Count > 0)
|
||||
{
|
||||
List<Line3D> normalLines = new List<Line3D>();
|
||||
List<Line3D> activatorLines = new List<Line3D>();
|
||||
|
||||
foreach(Line3D l in lines)
|
||||
{
|
||||
if(l.LineType == Line3DType.DEFAULT)
|
||||
normalLines.Add(l);
|
||||
else
|
||||
activatorLines.Add(l);
|
||||
}
|
||||
|
||||
if(normalLines.Count > 0)
|
||||
RenderArrows(normalLines, General.Colors.InfoLine.ToColorValue());
|
||||
if(activatorLines.Count > 0)
|
||||
RenderArrows(activatorLines, General.Colors.Selection3D.ToColorValue());
|
||||
}
|
||||
List<List<Line3D>> lines = LinksCollector.GetThingLinks(thingsbydistance);
|
||||
if(lines != null) foreach(List<Line3D> list in lines) if(list.Count > 0) RenderArrows(list);
|
||||
}
|
||||
|
||||
// ADDITIVE PASS
|
||||
|
@ -680,7 +662,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void RenderArrows(List<Line3D> lines, Color4 color)
|
||||
private void RenderArrows(List<Line3D> lines)
|
||||
{
|
||||
//create vertices
|
||||
WorldVertex[] verts = new WorldVertex[lines.Count * 6];
|
||||
|
@ -718,7 +700,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
ApplyMatrices3D();
|
||||
|
||||
// Setup color
|
||||
graphics.Shaders.World3D.VertexColor = color;
|
||||
graphics.Shaders.World3D.VertexColor = lines[0].color.ToColorValue();
|
||||
|
||||
//render
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
public struct WorldVertex
|
||||
{
|
||||
// Vertex format
|
||||
public const int Stride = 9 * 4; //mxd: was 6 * 4
|
||||
public const int Stride = 36; //mxd: 9 * 4, was 6 * 4
|
||||
|
||||
// Members
|
||||
public float x;
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
if(datastream.Position == datastream.Length) //mxd
|
||||
{
|
||||
// ZDoom doesn't give even a warning message about this, so we shouldn't report error or fail parsing.
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "DECORATE warning in '" + sourcename + "', line " + GetCurrentLineNumber() + ". Block comment is not closed");
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "DECORATE warning in '" + sourcename + "', line " + GetCurrentLineNumber() + ". Block comment is not closed.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,16 +21,17 @@ using System.Collections.Generic;
|
|||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Tools;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
using CodeImp.DoomBuilder.Types;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Tools;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -362,17 +363,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public override void OnRedrawDisplay()
|
||||
{
|
||||
renderer.RedrawSurface();
|
||||
List<Line3D> eventlines = new List<Line3D>(); //mxd
|
||||
|
||||
// Render lines
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
renderer.PlotLinedefSet(General.Map.Map.Linedefs);
|
||||
if(!panning) //mxd
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) BuilderPlug.Me.PlotAssociations(renderer, association[i]);
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) BuilderPlug.PlotAssociations(renderer, association[i], eventlines);
|
||||
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
if(!panning) BuilderPlug.Me.PlotReverseAssociations(renderer, highlightasso);
|
||||
BuilderPlug.PlotReverseAssociations(renderer, highlightasso, eventlines);
|
||||
renderer.PlotLinedef(highlighted, General.Colors.Highlight);
|
||||
}
|
||||
renderer.PlotVerticesSet(General.Map.Map.Vertices);
|
||||
|
@ -390,12 +391,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render selection
|
||||
if(renderer.StartOverlay(true))
|
||||
{
|
||||
if(!panning && !selecting) //mxd
|
||||
if(!selecting) //mxd
|
||||
{
|
||||
for (int i = 0; i < Linedef.NUM_ARGS; i++) BuilderPlug.Me.RenderAssociations(renderer, association[i]);
|
||||
if ((highlighted != null) && !highlighted.IsDisposed) BuilderPlug.Me.RenderReverseAssociations(renderer, highlightasso); //mxd
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) BuilderPlug.RenderAssociations(renderer, association[i], eventlines);
|
||||
if((highlighted != null) && !highlighted.IsDisposed) BuilderPlug.RenderReverseAssociations(renderer, highlightasso, eventlines); //mxd
|
||||
}
|
||||
if(selecting) RenderMultiSelection();
|
||||
renderer.RenderArrows(eventlines); //mxd
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
@ -549,7 +551,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if(panning) return; //mxd. Skip all this jass while panning
|
||||
if(panning) return; //mxd. Skip all this jazz while panning
|
||||
|
||||
//mxd
|
||||
if(selectpressed && !editpressed && !selecting)
|
||||
|
@ -611,15 +613,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//render preview
|
||||
if(renderer.StartOverlay(true))
|
||||
{
|
||||
if(!panning)
|
||||
{
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) BuilderPlug.Me.RenderAssociations(renderer, association[i]);
|
||||
if((highlighted != null) && !highlighted.IsDisposed) BuilderPlug.Me.RenderReverseAssociations(renderer, highlightasso); //mxd
|
||||
}
|
||||
List<Line3D> eventlines = new List<Line3D>(); //mxd
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) BuilderPlug.RenderAssociations(renderer, association[i], eventlines);
|
||||
if((highlighted != null) && !highlighted.IsDisposed) BuilderPlug.RenderReverseAssociations(renderer, highlightasso, eventlines); //mxd
|
||||
|
||||
float dist = Math.Min(Vector2D.Distance(mousemappos, insertPreview), BuilderPlug.Me.SplitLinedefsRange);
|
||||
byte alpha = (byte)(255 - (dist / BuilderPlug.Me.SplitLinedefsRange) * 128);
|
||||
float vsize = (renderer.VertexSize + 1.0f) / renderer.Scale;
|
||||
renderer.RenderRectangleFilled(new RectangleF(insertPreview.x - vsize, insertPreview.y - vsize, vsize * 2.0f, vsize * 2.0f), General.Colors.InfoLine.WithAlpha(alpha), true);
|
||||
renderer.RenderArrows(eventlines); //mxd
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
@ -631,11 +633,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//undraw preveiw
|
||||
if(renderer.StartOverlay(true))
|
||||
{
|
||||
if(!panning)
|
||||
{
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) BuilderPlug.Me.RenderAssociations(renderer, association[i]);
|
||||
if((highlighted != null) && !highlighted.IsDisposed) BuilderPlug.Me.RenderReverseAssociations(renderer, highlightasso); //mxd
|
||||
}
|
||||
List<Line3D> eventlines = new List<Line3D>(); //mxd
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) BuilderPlug.RenderAssociations(renderer, association[i], eventlines);
|
||||
if((highlighted != null) && !highlighted.IsDisposed) BuilderPlug.RenderReverseAssociations(renderer, highlightasso, eventlines); //mxd
|
||||
|
||||
renderer.RenderArrows(eventlines); //mxd
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
|
|
@ -18,18 +18,19 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
using CodeImp.DoomBuilder.BuilderModes.Interface;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Tools;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
using CodeImp.DoomBuilder.Types;
|
||||
using CodeImp.DoomBuilder.BuilderModes.Interface;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Tools;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -714,6 +715,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public override void OnRedrawDisplay()
|
||||
{
|
||||
renderer.RedrawSurface();
|
||||
List<Line3D> eventlines = new List<Line3D>(); //mxd
|
||||
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
|
@ -723,7 +725,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
renderer.PlotSector(highlighted, General.Colors.Highlight);
|
||||
if(!panning) BuilderPlug.Me.PlotReverseAssociations(renderer, highlightasso);
|
||||
BuilderPlug.PlotReverseAssociations(renderer, highlightasso, eventlines);
|
||||
}
|
||||
renderer.Finish();
|
||||
}
|
||||
|
@ -742,8 +744,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render selection
|
||||
if(renderer.StartOverlay(false))
|
||||
{
|
||||
if(!panning && highlighted != null && !highlighted.IsDisposed) BuilderPlug.Me.RenderReverseAssociations(renderer, highlightasso); //mxd
|
||||
if(highlighted != null && !highlighted.IsDisposed) BuilderPlug.RenderReverseAssociations(renderer, highlightasso, eventlines); //mxd
|
||||
if(selecting) RenderMultiSelection();
|
||||
renderer.RenderArrows(eventlines); //mxd
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -151,17 +151,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public override void OnRedrawDisplay()
|
||||
{
|
||||
renderer.RedrawSurface();
|
||||
List<Line3D> eventlines = new List<Line3D>(); //mxd
|
||||
|
||||
// Render lines and vertices
|
||||
if (renderer.StartPlotter(true))
|
||||
{
|
||||
renderer.PlotLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.PlotVerticesSet(General.Map.Map.Vertices);
|
||||
if(!panning) //mxd
|
||||
{
|
||||
for(int i = 0; i < Thing.NUM_ARGS; i++) BuilderPlug.Me.PlotAssociations(renderer, association[i]);
|
||||
if((highlighted != null) && !highlighted.IsDisposed) BuilderPlug.Me.PlotReverseAssociations(renderer, highlightasso);
|
||||
}
|
||||
|
||||
for(int i = 0; i < Thing.NUM_ARGS; i++) BuilderPlug.PlotAssociations(renderer, association[i], eventlines);
|
||||
if((highlighted != null) && !highlighted.IsDisposed) BuilderPlug.PlotReverseAssociations(renderer, highlightasso, eventlines);
|
||||
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
@ -170,22 +170,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
if(!panning) //mxd
|
||||
for(int i = 0; i < Thing.NUM_ARGS; i++) BuilderPlug.Me.RenderAssociations(renderer, association[i]);
|
||||
for(int i = 0; i < Thing.NUM_ARGS; i++) BuilderPlug.RenderAssociations(renderer, association[i], eventlines);
|
||||
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight, 1.0f);
|
||||
if(!panning) BuilderPlug.Me.RenderReverseAssociations(renderer, highlightasso); //mxd
|
||||
BuilderPlug.RenderReverseAssociations(renderer, highlightasso, eventlines); //mxd
|
||||
}
|
||||
|
||||
//mxd
|
||||
if(!panning && General.Settings.GZShowEventLines)
|
||||
if(General.Settings.GZShowEventLines)
|
||||
{
|
||||
List<Line3D> lines = GZBuilder.Data.LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings);
|
||||
|
||||
foreach(Line3D l in lines)
|
||||
List<List<Line3D>> lines = GZBuilder.Data.LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings);
|
||||
if(lines != null)
|
||||
{
|
||||
renderer.RenderArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
lines[0].AddRange(eventlines);
|
||||
foreach(List<Line3D> list in lines) if(list.Count > 0) renderer.RenderArrows(list);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.RenderArrows(eventlines);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,7 +475,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if(panning) return; //mxd. Skip all this jass while panning
|
||||
if(panning) return; //mxd. Skip all this jazz while panning
|
||||
|
||||
//mxd
|
||||
if(selectpressed && !editpressed && !selecting)
|
||||
|
|
|
@ -522,106 +522,78 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// This renders the associated sectors/linedefs with the indication color
|
||||
public void PlotAssociations(IRenderer2D renderer, Association asso)
|
||||
public static void PlotAssociations(IRenderer2D renderer, Association asso, List<Line3D> eventlines)
|
||||
{
|
||||
// Tag must be above zero
|
||||
if(asso.tag < 1) return;
|
||||
|
||||
// Sectors?
|
||||
if(asso.type == UniversalType.SectorTag)
|
||||
switch(asso.type)
|
||||
{
|
||||
List<Line3D> lines = new List<Line3D>(); //mxd
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
if(s.Tag == asso.tag)
|
||||
case UniversalType.SectorTag: {
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
if(s.Tag != asso.tag) continue;
|
||||
renderer.PlotSector(s, General.Colors.Indication);
|
||||
if (General.Settings.GZShowEventLines)
|
||||
{
|
||||
Vector2D end = (s.Labels.Count > 0 ? s.Labels[0].position : new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
|
||||
lines.Add(new Line3D(asso.Center, end)); //mxd
|
||||
}
|
||||
|
||||
if(!General.Settings.GZShowEventLines) continue;
|
||||
Vector2D end = (s.Labels.Count > 0 ? s.Labels[0].position : new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
|
||||
eventlines.Add(new Line3D(asso.Center, end)); //mxd
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
{
|
||||
foreach(Line3D l in lines)
|
||||
renderer.PlotArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
// Linedefs?
|
||||
else if(asso.type == UniversalType.LinedefTag)
|
||||
{
|
||||
List<Line3D> lines = new List<Line3D>(); //mxd
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
if(l.Tag == asso.tag)
|
||||
case UniversalType.LinedefTag: {
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
if(l.Tag != asso.tag) continue;
|
||||
renderer.PlotLinedef(l, General.Colors.Indication);
|
||||
if(General.Settings.GZShowEventLines)
|
||||
lines.Add(new Line3D(asso.Center, l.GetCenterPoint()));//mxd
|
||||
if(General.Settings.GZShowEventLines) eventlines.Add(new Line3D(asso.Center, l.GetCenterPoint())); //mxd
|
||||
}
|
||||
}
|
||||
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
{
|
||||
foreach(Line3D l in lines)
|
||||
renderer.PlotArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This renders the associated things with the indication color
|
||||
public void RenderAssociations(IRenderer2D renderer, Association asso)
|
||||
public static void RenderAssociations(IRenderer2D renderer, Association asso, List<Line3D> eventlines)
|
||||
{
|
||||
// Tag must be above zero
|
||||
if(asso.tag < 1) return;
|
||||
|
||||
// Things?
|
||||
if(asso.type == UniversalType.ThingTag)
|
||||
switch(asso.type)
|
||||
{
|
||||
List<Line3D> lines = new List<Line3D>(); //mxd
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
{
|
||||
if(t.Tag == asso.tag)
|
||||
case UniversalType.ThingTag: {
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
{
|
||||
if(t.Tag != asso.tag) continue;
|
||||
renderer.RenderThing(t, General.Colors.Indication, 1.0f);
|
||||
if(General.Settings.GZShowEventLines)
|
||||
lines.Add(new Line3D(asso.Center, t.Position));//mxd
|
||||
if(General.Settings.GZShowEventLines) eventlines.Add(new Line3D(asso.Center, t.Position)); //mxd
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
{
|
||||
foreach(Line3D l in lines)
|
||||
renderer.RenderArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
else if(asso.type == UniversalType.SectorTag) //mxd. Render sector highlight
|
||||
{
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
if(s.Tag == asso.tag)
|
||||
|
||||
case UniversalType.SectorTag:
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
if(s.Tag != asso.tag) continue;
|
||||
int highlightedColor = General.Colors.Highlight.WithAlpha(128).ToInt();
|
||||
FlatVertex[] verts = new FlatVertex[s.FlatVertices.Length];
|
||||
s.FlatVertices.CopyTo(verts, 0);
|
||||
for(int i = 0; i < verts.Length; i++) verts[i].c = highlightedColor;
|
||||
renderer.RenderGeometry(verts, null, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// This renders the associated sectors/linedefs with the indication color
|
||||
public void PlotReverseAssociations(IRenderer2D renderer, Association asso)
|
||||
public static void PlotReverseAssociations(IRenderer2D renderer, Association asso, List<Line3D> eventlines)
|
||||
{
|
||||
// Tag must be above zero
|
||||
if(asso.tag < 1) return;
|
||||
|
||||
List<Line3D> lines = new List<Line3D>(); //mxd
|
||||
|
||||
// Doom style referencing to sectors?
|
||||
if(General.Map.Config.LineTagIndicatesSectors && (asso.type == UniversalType.SectorTag))
|
||||
{
|
||||
|
@ -629,64 +601,39 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
// Any action on this line?
|
||||
if(l.Action > 0)
|
||||
{
|
||||
if(l.Tag == asso.tag)
|
||||
{
|
||||
renderer.PlotLinedef(l, General.Colors.Indication);
|
||||
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
lines.Add(new Line3D(l.GetCenterPoint(), asso.Center)); //mxd
|
||||
}
|
||||
}
|
||||
}
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
{
|
||||
foreach(Line3D l in lines)
|
||||
renderer.PlotArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
if(l.Action <= 0 || l.Tag != asso.tag) continue;
|
||||
renderer.PlotLinedef(l, General.Colors.Indication);
|
||||
if(General.Settings.GZShowEventLines) eventlines.Add(new Line3D(l.GetCenterPoint(), asso.Center)); //mxd
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// Linedefs
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
// Linedefs
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
// Known action on this line?
|
||||
if((l.Action > 0) && General.Map.Config.LinedefActions.ContainsKey(l.Action))
|
||||
{
|
||||
// Known action on this line?
|
||||
if((l.Action > 0) && General.Map.Config.LinedefActions.ContainsKey(l.Action))
|
||||
LinedefActionInfo action = General.Map.Config.LinedefActions[l.Action];
|
||||
if( ((action.Args[0].Type == (int)asso.type) && (l.Args[0] == asso.tag)) ||
|
||||
((action.Args[1].Type == (int)asso.type) && (l.Args[1] == asso.tag)) ||
|
||||
((action.Args[2].Type == (int)asso.type) && (l.Args[2] == asso.tag)) ||
|
||||
((action.Args[3].Type == (int)asso.type) && (l.Args[3] == asso.tag)) ||
|
||||
((action.Args[4].Type == (int)asso.type) && (l.Args[4] == asso.tag)) )
|
||||
{
|
||||
LinedefActionInfo action = General.Map.Config.LinedefActions[l.Action];
|
||||
if( ((action.Args[0].Type == (int)asso.type) && (l.Args[0] == asso.tag)) ||
|
||||
((action.Args[1].Type == (int)asso.type) && (l.Args[1] == asso.tag)) ||
|
||||
((action.Args[2].Type == (int)asso.type) && (l.Args[2] == asso.tag)) ||
|
||||
((action.Args[3].Type == (int)asso.type) && (l.Args[3] == asso.tag)) ||
|
||||
((action.Args[4].Type == (int)asso.type) && (l.Args[4] == asso.tag)) )
|
||||
{
|
||||
|
||||
renderer.PlotLinedef(l, General.Colors.Indication);
|
||||
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
lines.Add(new Line3D(l.GetCenterPoint(), asso.Center));
|
||||
}
|
||||
renderer.PlotLinedef(l, General.Colors.Indication);
|
||||
if(General.Settings.GZShowEventLines) eventlines.Add(new Line3D(l.GetCenterPoint(), asso.Center)); //mxd
|
||||
}
|
||||
}
|
||||
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
{
|
||||
foreach(Line3D l in lines)
|
||||
renderer.PlotArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This renders the associated things with the indication color
|
||||
public void RenderReverseAssociations(IRenderer2D renderer, Association asso)
|
||||
public static void RenderReverseAssociations(IRenderer2D renderer, Association asso, List<Line3D> eventlines)
|
||||
{
|
||||
// Tag must be above zero
|
||||
if(asso.tag < 1) return;
|
||||
|
||||
List<Line3D> lines = new List<Line3D>(); //mxd
|
||||
|
||||
// Things
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
{
|
||||
|
@ -701,17 +648,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
((action.Args[4].Type == (int)asso.type) && (t.Args[4] == asso.tag)) )
|
||||
{
|
||||
renderer.RenderThing(t, General.Colors.Indication, 1.0f);
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
lines.Add(new Line3D(t.Position, asso.Center));
|
||||
if(General.Settings.GZShowEventLines) eventlines.Add(new Line3D(t.Position, asso.Center)); //mxd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
{
|
||||
foreach(Line3D l in lines)
|
||||
renderer.RenderArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue