mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
changed some rendering calls for seperate rendering to different layers
This commit is contained in:
parent
406f828473
commit
3d43205f2c
13 changed files with 282 additions and 181 deletions
|
@ -121,8 +121,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
{
|
||||
bool viewchanged = CheckViewChanged();
|
||||
|
||||
// Start rendering
|
||||
if(renderer.Start(true, viewchanged))
|
||||
// Start rendering structure
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Uncomment this to see triangulation
|
||||
/*
|
||||
|
@ -137,13 +137,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
}
|
||||
*/
|
||||
|
||||
// Redraw things when view changed
|
||||
if(viewchanged)
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
}
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(unselectedlines);
|
||||
renderer.RenderLinedefSet(selectedlines);
|
||||
|
@ -157,6 +150,19 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
if(viewchanged)
|
||||
{
|
||||
// Start rendering things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -126,33 +126,32 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// This redraws the display
|
||||
public unsafe override void RedrawDisplay()
|
||||
{
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
// Render lines
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Render things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
|
||||
// Render lines
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
|
||||
// Render highlighted item
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderLinedef(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Render vertices
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// This highlights a new item
|
||||
protected void Highlight(Linedef l)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
|
@ -175,6 +174,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Show highlight info
|
||||
|
@ -220,13 +220,14 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
highlighted.Selected = !highlighted.Selected;
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderLinedef(highlighted, renderer.DetermineLinedefColor(highlighted));
|
||||
renderer.RenderVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
|
||||
renderer.RenderVertex(highlighted.End, renderer.DetermineVertexColor(highlighted.End));
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,13 +247,14 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
}
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderLinedef(highlighted, renderer.DetermineLinedefColor(highlighted));
|
||||
renderer.RenderVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
|
||||
renderer.RenderVertex(highlighted.End, renderer.DetermineVertexColor(highlighted.End));
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,13 +271,14 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.RenderLinedef(highlighted, General.Colors.Highlight);
|
||||
renderer.RenderVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
|
||||
renderer.RenderVertex(highlighted.End, renderer.DetermineVertexColor(highlighted.End));
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Edit button?
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
bool viewchanged = CheckViewChanged();
|
||||
|
||||
// Start rendering
|
||||
if(renderer.Start(true, viewchanged))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Uncomment this to see triangulation
|
||||
/*
|
||||
|
@ -142,13 +142,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Redraw things when view changed
|
||||
if(viewchanged)
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
}
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(unselectedlines);
|
||||
|
@ -163,6 +156,19 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Redraw things when view changed
|
||||
if(viewchanged)
|
||||
{
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -140,31 +140,32 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// This redraws the display
|
||||
public unsafe override void RedrawDisplay()
|
||||
{
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Render things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Render highlighted item
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderSector(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// This highlights a new item
|
||||
protected void Highlight(Sector s)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
|
@ -193,6 +194,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Show highlight info
|
||||
|
@ -266,11 +268,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
SelectSector(highlighted, !highlighted.Selected);
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderSector(highlighted);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,11 +294,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
}
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderSector(highlighted);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,11 +316,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.RenderSector(highlighted, General.Colors.Highlight);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Edit button?
|
||||
|
|
|
@ -128,30 +128,31 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// This redraws the display
|
||||
public unsafe override void RedrawDisplay()
|
||||
{
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Do not show things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Render highlighted item
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderSector(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Do not show things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// This highlights a new item
|
||||
protected void Highlight(Sector s)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
// Redraw lines
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
|
@ -166,6 +167,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Show highlight info
|
||||
|
@ -248,11 +250,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
}
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderSector(highlighted);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -295,11 +298,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
triangles = t.PerformTriangulation(General.GetByIndex<Sector>(selected, 0));
|
||||
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Do not show things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
@ -314,6 +314,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
|
@ -329,11 +330,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
triangles.AddRange(t.PerformTriangulation(s));
|
||||
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Do not show things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
@ -348,6 +346,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
|
@ -363,11 +362,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
Thread.Sleep(20);
|
||||
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Do not show things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
@ -377,6 +373,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Wait a bit
|
||||
|
@ -394,11 +391,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
Application.DoEvents();
|
||||
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Do not show things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
@ -408,6 +402,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Wait a bit
|
||||
|
@ -427,11 +422,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
Thread.Sleep(10);
|
||||
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Do not show things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
@ -450,6 +442,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Wait a bit
|
||||
|
@ -465,11 +458,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
for(int a = 0; a < 5; a++)
|
||||
{
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Do not show things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
@ -500,15 +490,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
Thread.Sleep(10);
|
||||
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Do not show things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
@ -531,6 +519,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
Thread.Sleep(20);
|
||||
}
|
||||
|
|
|
@ -130,23 +130,25 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// This redraws the display
|
||||
public unsafe override void RedrawDisplay()
|
||||
{
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Render things
|
||||
renderer.SetThingsRenderOrder(true);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null) DrawHighlight(true);
|
||||
|
||||
// Done
|
||||
if((highlighted != null) && !(highlighted is Thing)) DrawHighlight(true);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(true);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
if((highlighted != null) && (highlighted is Thing)) DrawHighlight(true);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// This draws the highlighted item
|
||||
|
@ -217,23 +219,44 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// This highlights a new item
|
||||
protected void Highlight(object h)
|
||||
{
|
||||
bool renderresult;
|
||||
|
||||
// Changes?
|
||||
if(highlighted != h)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(highlighted != null)
|
||||
{
|
||||
// Start update
|
||||
if(highlighted is Thing)
|
||||
renderresult = renderer.StartThings(false);
|
||||
else
|
||||
renderresult = renderer.StartPlotter(false);
|
||||
|
||||
// Undraw previous highlight
|
||||
if(highlighted != null) DrawHighlight(false);
|
||||
if(renderresult)
|
||||
{
|
||||
DrawHighlight(false);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
// Set new highlight
|
||||
highlighted = h;
|
||||
|
||||
// Set new highlight
|
||||
highlighted = h;
|
||||
if(highlighted != null)
|
||||
{
|
||||
// Start update
|
||||
if(highlighted is Thing)
|
||||
renderresult = renderer.StartThings(false);
|
||||
else
|
||||
renderresult = renderer.StartPlotter(false);
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null) DrawHighlight(true);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
// Undraw previous highlight
|
||||
if(renderresult)
|
||||
{
|
||||
DrawHighlight(true);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
// Hide info
|
||||
|
@ -252,6 +275,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
else if(highlighted is Thing)
|
||||
General.Interface.ShowThingInfo(highlighted as Thing);
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -209,16 +209,20 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
{
|
||||
bool viewchanged = CheckViewChanged();
|
||||
|
||||
// Start with a clear display
|
||||
if(renderer.Start(viewchanged, true))
|
||||
if(viewchanged)
|
||||
{
|
||||
if(viewchanged)
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
// Render things
|
||||
renderer.SetThingsRenderOrder(true);
|
||||
renderer.RenderThingSet(unselectedthings);
|
||||
|
@ -232,6 +236,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Cancelled
|
||||
|
|
|
@ -110,31 +110,32 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// This redraws the display
|
||||
public unsafe override void RedrawDisplay()
|
||||
{
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Render things
|
||||
renderer.SetThingsRenderOrder(true);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
|
||||
// Render highlighted item
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(true);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// This highlights a new item
|
||||
protected void Highlight(Thing t)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartThings(false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
|
@ -149,6 +150,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Show highlight info
|
||||
|
@ -194,11 +196,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
highlighted.Selected = !highlighted.Selected;
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartThings(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -218,11 +221,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
}
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartThings(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,11 +243,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartThings(false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Edit button?
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
bool viewchanged = CheckViewChanged();
|
||||
|
||||
// Start rendering
|
||||
if(renderer.Start(true, viewchanged))
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Uncomment this to see triangulation
|
||||
/*
|
||||
|
@ -133,13 +133,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Redraw things when view changed
|
||||
if(viewchanged)
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
}
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
|
@ -154,6 +147,19 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Redraw things when view changed
|
||||
if(viewchanged)
|
||||
{
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -126,31 +126,32 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// This redraws the display
|
||||
public unsafe override void RedrawDisplay()
|
||||
{
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
// Render things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Render highlighted item
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderVertex(highlighted, ColorCollection.HIGHLIGHT);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// This highlights a new item
|
||||
protected void Highlight(Vertex v)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
|
@ -165,6 +166,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Show highlight info
|
||||
|
@ -212,13 +214,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
{
|
||||
// Flip selection
|
||||
highlighted.Selected = !highlighted.Selected;
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
|
||||
// Redraw highlight to show selection
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderVertex(highlighted, renderer.DetermineVertexColor(highlighted));
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,12 +234,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
// Render highlighted item
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.RenderVertex(highlighted, ColorCollection.HIGHLIGHT);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -600,7 +600,10 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// This redraws the display on the next paint event
|
||||
public void RedrawDisplay()
|
||||
{
|
||||
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.RedrawDisplay();
|
||||
if((General.Map != null) && (General.Map.Mode != null))
|
||||
{
|
||||
General.Map.Mode.RedrawDisplay();
|
||||
}
|
||||
//display.Invalidate();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
int DetermineVertexColor(Vertex v);
|
||||
|
||||
// Rendering management methods
|
||||
bool Start(bool clearstructs, bool clearthings);
|
||||
bool StartPlotter(bool clear);
|
||||
bool StartThings(bool clear);
|
||||
void Finish();
|
||||
void SetThingsRenderOrder(bool front);
|
||||
void Present();
|
||||
|
||||
// Drawing methods
|
||||
void RenderLine(Vector2D start, Vector2D end, PixelColor c);
|
||||
|
|
|
@ -39,6 +39,21 @@ using CodeImp.DoomBuilder.Editing;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Rendering
|
||||
{
|
||||
|
||||
/* This renders a 2D presentation of the map
|
||||
* This is done in several layers:
|
||||
*
|
||||
* 1) Background image
|
||||
*
|
||||
* 2) Things
|
||||
*
|
||||
* 3) Plotter (grid and geometric structures)
|
||||
*
|
||||
* 4) Overlay
|
||||
*
|
||||
* The order of layers 2 and 3 can be changed by
|
||||
* calling SetThingsRenderOrder.
|
||||
*/
|
||||
internal unsafe sealed class Renderer2D : Renderer, IRenderer2D
|
||||
{
|
||||
#region ================== Constants
|
||||
|
@ -58,11 +73,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
// Rendertargets
|
||||
private Texture backtex;
|
||||
private Texture structtex;
|
||||
private Texture plottertex;
|
||||
private Texture thingstex;
|
||||
|
||||
// Locking data
|
||||
private LockedRect structlocked;
|
||||
private LockedRect plotlocked;
|
||||
private Surface thingssurface;
|
||||
|
||||
// Rendertarget sizes
|
||||
|
@ -208,8 +223,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
graphics.Device.SetTexture(0, structtex);
|
||||
graphics.Shaders.Display2D.Texture1 = structtex;
|
||||
graphics.Device.SetTexture(0, plottertex);
|
||||
graphics.Shaders.Display2D.Texture1 = plottertex;
|
||||
graphics.Shaders.Display2D.SetSettings(1f / structsize.Width, 1f / structsize.Height, FSAA_BLEND_FACTOR, 1f);
|
||||
|
||||
// Draw the lines and vertices texture
|
||||
|
@ -290,11 +305,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
public void DestroyRendertargets()
|
||||
{
|
||||
// Trash rendertargets
|
||||
if(structtex != null) structtex.Dispose();
|
||||
if(plottertex != null) plottertex.Dispose();
|
||||
if(thingstex != null) thingstex.Dispose();
|
||||
if(backtex != null) backtex.Dispose();
|
||||
if(screenverts != null) screenverts.Dispose();
|
||||
structtex = null;
|
||||
plottertex = null;
|
||||
thingstex = null;
|
||||
backtex = null;
|
||||
screenverts = null;
|
||||
|
@ -322,12 +337,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
windowsize.Height = graphics.RenderTarget.ClientSize.Height;
|
||||
|
||||
// Create rendertargets textures
|
||||
structtex = new Texture(graphics.Device, windowsize.Width, windowsize.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
|
||||
plottertex = new Texture(graphics.Device, windowsize.Width, windowsize.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
|
||||
thingstex = new Texture(graphics.Device, windowsize.Width, windowsize.Height, 1, Usage.RenderTarget, Format.A8R8G8B8, Pool.Default);
|
||||
backtex = new Texture(graphics.Device, windowsize.Width, windowsize.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
|
||||
|
||||
// Get the real surface sizes
|
||||
sd = structtex.GetLevelDescription(0);
|
||||
sd = plottertex.GetLevelDescription(0);
|
||||
structsize.Width = sd.Width;
|
||||
structsize.Height = sd.Height;
|
||||
sd = thingstex.GetLevelDescription(0);
|
||||
|
@ -780,38 +795,69 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Basic Tools
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Rendering
|
||||
|
||||
// This begins a drawing session
|
||||
public unsafe bool Start(bool clearstructs, bool clearthings)
|
||||
public unsafe bool StartPlotter(bool clear)
|
||||
{
|
||||
// Rendertargets available?
|
||||
if((structtex != null) && (thingstex != null))
|
||||
if(plottertex != null)
|
||||
{
|
||||
// Lock structures rendertarget memory
|
||||
structlocked = structtex.LockRectangle(0, LockFlags.NoSystemLock);
|
||||
plotlocked = plottertex.LockRectangle(0, LockFlags.NoSystemLock);
|
||||
|
||||
// Create structures plotter
|
||||
plotter = new Plotter((PixelColor*)structlocked.Data.DataPointer.ToPointer(), structlocked.Pitch / sizeof(PixelColor), structsize.Height, structsize.Width, structsize.Height);
|
||||
if(clearstructs) plotter.Clear();
|
||||
plotter = new Plotter((PixelColor*)plotlocked.Data.DataPointer.ToPointer(), plotlocked.Pitch / sizeof(PixelColor), structsize.Height, structsize.Width, structsize.Height);
|
||||
if(clear) plotter.Clear();
|
||||
|
||||
// Redraw grid when structures image was cleared
|
||||
if(clearstructs) RenderBackgroundGrid();
|
||||
if(clear) RenderBackgroundGrid();
|
||||
|
||||
// Always trash things batch buffer
|
||||
if(thingsvertices != null) thingsvertices.Dispose();
|
||||
thingsvertices = null;
|
||||
numthings = 0;
|
||||
maxthings = 0;
|
||||
|
||||
// Setup vertices for background image
|
||||
SetupBackground();
|
||||
|
||||
// Ready for rendering
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can't render!
|
||||
Finish();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// This begins a drawing session
|
||||
public unsafe bool StartThings(bool clear)
|
||||
{
|
||||
// Rendertargets available?
|
||||
if(thingstex != null)
|
||||
{
|
||||
// Always trash things batch buffer
|
||||
if(thingsvertices != null) thingsvertices.Dispose();
|
||||
thingsvertices = null;
|
||||
numthings = 0;
|
||||
maxthings = 0;
|
||||
|
||||
// Setup vertices for background image
|
||||
SetupBackground();
|
||||
|
||||
// Set the rendertarget to the things texture
|
||||
thingssurface = thingstex.GetSurfaceLevel(0);
|
||||
if(graphics.StartRendering(clearthings, 0, thingssurface, null))
|
||||
if(graphics.StartRendering(clear, 0, thingssurface, null))
|
||||
{
|
||||
// Ready for rendering
|
||||
return true;
|
||||
|
@ -846,14 +892,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
catch(Exception) { }
|
||||
|
||||
// Clean up
|
||||
if(structtex != null) structtex.UnlockRectangle(0);
|
||||
if(structlocked.Data != null) structlocked.Data.Dispose();
|
||||
if(plottertex != null) plottertex.UnlockRectangle(0);
|
||||
if(plotlocked.Data != null) plotlocked.Data.Dispose();
|
||||
if(thingssurface != null) thingssurface.Dispose();
|
||||
thingssurface = null;
|
||||
plotter = null;
|
||||
|
||||
// Present new image
|
||||
Present();
|
||||
}
|
||||
|
||||
// This adds a thing in the things buffer for rendering
|
||||
|
|
Loading…
Reference in a new issue