Added "Fixed Things Scale" setting (available in the View menu, as a button on the View toolbar and as the "Toggle Fixed Things Scale" action). When enabled, Things will no longer be scaled based on current zoom level in Classic modes, instead, thing bounding box will be drawn when appropriate (this option mimics DB1 things rendering style).

Internal: removed some remnants of fixed rendering pipeline from Renderer2D and Renderer3D.
This commit is contained in:
MaxED 2016-02-22 15:20:08 +00:00
parent f228648b12
commit 80861be6ab
14 changed files with 126 additions and 35 deletions

View file

@ -1124,6 +1124,7 @@
<None Include="Resources\GroupRemove.png" /> <None Include="Resources\GroupRemove.png" />
<None Include="Resources\GridDecrease.png" /> <None Include="Resources\GridDecrease.png" />
<None Include="Resources\GridIncrease.png" /> <None Include="Resources\GridIncrease.png" />
<None Include="Resources\FixedThingsScale.png" />
<Content Include="Resources\Light.png" /> <Content Include="Resources\Light.png" />
<None Include="Resources\Lightbulb.png" /> <None Include="Resources\Lightbulb.png" />
<None Include="Resources\LightDisabled.png" /> <None Include="Resources\LightDisabled.png" />

View file

@ -125,7 +125,8 @@ namespace CodeImp.DoomBuilder.Config
private bool autoClearSideTextures; private bool autoClearSideTextures;
private bool storeSelectedEditTab; private bool storeSelectedEditTab;
private bool checkforupdates; private bool checkforupdates;
private bool rendercomments; private bool rendercomments; //mxd
private bool fixedthingsscale; //mxd
private bool rendergrid; private bool rendergrid;
private bool dynamicgridsize; private bool dynamicgridsize;
private int ignoredremoterevision; private int ignoredremoterevision;
@ -226,6 +227,7 @@ namespace CodeImp.DoomBuilder.Config
public bool StoreSelectedEditTab { get { return storeSelectedEditTab; } internal set { storeSelectedEditTab = value; } } public bool StoreSelectedEditTab { get { return storeSelectedEditTab; } internal set { storeSelectedEditTab = value; } }
internal bool CheckForUpdates { get { return checkforupdates; } set { checkforupdates = value; } } //mxd internal bool CheckForUpdates { get { return checkforupdates; } set { checkforupdates = value; } } //mxd
public bool RenderComments { get { return rendercomments; } internal set { rendercomments = value; } } //mxd public bool RenderComments { get { return rendercomments; } internal set { rendercomments = value; } } //mxd
public bool FixedThingsScale { get { return fixedthingsscale; } internal set { fixedthingsscale = value; } } //mxd
public bool RenderGrid { get { return rendergrid; } internal set { rendergrid = value; } } //mxd public bool RenderGrid { get { return rendergrid; } internal set { rendergrid = value; } } //mxd
public bool DynamicGridSize { get { return dynamicgridsize; } internal set { dynamicgridsize = value; } } //mxd public bool DynamicGridSize { get { return dynamicgridsize; } internal set { dynamicgridsize = value; } } //mxd
internal int IgnoredRemoteRevision { get { return ignoredremoterevision; } set { ignoredremoterevision = value; } } //mxd internal int IgnoredRemoteRevision { get { return ignoredremoterevision; } set { ignoredremoterevision = value; } } //mxd
@ -348,6 +350,7 @@ namespace CodeImp.DoomBuilder.Config
storeSelectedEditTab = cfg.ReadSetting("storeselectededittab", true); storeSelectedEditTab = cfg.ReadSetting("storeselectededittab", true);
checkforupdates = cfg.ReadSetting("checkforupdates", true); //mxd checkforupdates = cfg.ReadSetting("checkforupdates", true); //mxd
rendercomments = cfg.ReadSetting("rendercomments", true); //mxd rendercomments = cfg.ReadSetting("rendercomments", true); //mxd
fixedthingsscale = cfg.ReadSetting("fixedthingsscale", false); //mxd
rendergrid = cfg.ReadSetting("rendergrid", true); //mxd rendergrid = cfg.ReadSetting("rendergrid", true); //mxd
dynamicgridsize = cfg.ReadSetting("dynamicgridsize", true); //mxd dynamicgridsize = cfg.ReadSetting("dynamicgridsize", true); //mxd
ignoredremoterevision = cfg.ReadSetting("ignoredremoterevision", 0); //mxd ignoredremoterevision = cfg.ReadSetting("ignoredremoterevision", 0); //mxd
@ -454,6 +457,7 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("storeselectededittab", storeSelectedEditTab); cfg.WriteSetting("storeselectededittab", storeSelectedEditTab);
cfg.WriteSetting("checkforupdates", checkforupdates); //mxd cfg.WriteSetting("checkforupdates", checkforupdates); //mxd
cfg.WriteSetting("rendercomments", rendercomments); //mxd cfg.WriteSetting("rendercomments", rendercomments); //mxd
cfg.WriteSetting("fixedthingsscale", fixedthingsscale); //mxd
cfg.WriteSetting("rendergrid", rendergrid); //mxd cfg.WriteSetting("rendergrid", rendergrid); //mxd
cfg.WriteSetting("dynamicgridsize", dynamicgridsize); //mxd cfg.WriteSetting("dynamicgridsize", dynamicgridsize); //mxd
cfg.WriteSetting("ignoredremoterevision", ignoredremoterevision); //mxd cfg.WriteSetting("ignoredremoterevision", ignoredremoterevision); //mxd

View file

@ -22,6 +22,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry
{ {
this.Start = start; this.Start = start;
this.End = end; this.End = end;
this.Start2D = start;
this.End2D = end;
this.Color = General.Colors.InfoLine; this.Color = General.Colors.InfoLine;
this.RenderArrowhead = true; this.RenderArrowhead = true;
} }
@ -30,6 +32,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry
{ {
this.Start = start; this.Start = start;
this.End = end; this.End = end;
this.Start2D = start;
this.End2D = end;
this.Color = General.Colors.InfoLine; this.Color = General.Colors.InfoLine;
this.RenderArrowhead = renderArrowhead; this.RenderArrowhead = renderArrowhead;
} }
@ -38,6 +42,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry
{ {
this.Start = start; this.Start = start;
this.End = end; this.End = end;
this.Start2D = start;
this.End2D = end;
this.Color = color; this.Color = color;
this.RenderArrowhead = true; this.RenderArrowhead = true;
} }
@ -46,6 +52,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Geometry
{ {
this.Start = start; this.Start = start;
this.End = end; this.End = end;
this.Start2D = start;
this.End2D = end;
this.Color = color; this.Color = color;
this.RenderArrowhead = renderArrowhead; this.RenderArrowhead = renderArrowhead;
} }

View file

@ -2727,7 +2727,7 @@ namespace CodeImp.DoomBuilder.Map
{ {
float px = t.Position.x; float px = t.Position.x;
float py = t.Position.y; float py = t.Position.y;
float ts = ((t.FixedSize && General.Map.Renderer2D.Scale > 1.0f) ? t.Size / General.Map.Renderer2D.Scale : t.Size); float ts = (((t.FixedSize || General.Settings.FixedThingsScale) && General.Map.Renderer2D.Scale > 1.0f) ? t.Size / General.Map.Renderer2D.Scale : t.Size);
//mxd. Within range? //mxd. Within range?
if(px < range.Left - ts || px > range.Right + ts || py < range.Top - ts || py > range.Bottom + ts) continue; if(px < range.Left - ts || px > range.Right + ts || py < range.Top - ts || py > range.Bottom + ts) continue;

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.5485 // Runtime Version:2.0.50727.5466
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -270,6 +270,13 @@ namespace CodeImp.DoomBuilder.Properties {
} }
} }
internal static System.Drawing.Bitmap FixedThingsScale {
get {
object obj = ResourceManager.GetObject("FixedThingsScale", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap fog { internal static System.Drawing.Bitmap fog {
get { get {
object obj = ResourceManager.GetObject("fog", resourceCulture); object obj = ResourceManager.GetObject("fog", resourceCulture);

View file

@ -562,4 +562,7 @@
<data name="ScriptProperty" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ScriptProperty" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ScriptProperty.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ScriptProperty.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="FixedThingsScale" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FixedThingsScale.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

View file

@ -73,6 +73,7 @@ namespace CodeImp.DoomBuilder.Rendering
void RenderRectangleFilled(RectangleF rect, PixelColor c, bool transformrect, ImageData texture); void RenderRectangleFilled(RectangleF rect, PixelColor c, bool transformrect, ImageData texture);
void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords); void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords);
void RenderArrows(ICollection<Line3D> line); //mxd void RenderArrows(ICollection<Line3D> line); //mxd
void RenderArrows(ICollection<Line3D> line, bool transformcoords); //mxd
void RenderText(TextLabel text); void RenderText(TextLabel text);
void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords); void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords);
void RenderHighlight(FlatVertex[] vertices, int color); //mxd void RenderHighlight(FlatVertex[] vertices, int color); //mxd

View file

@ -251,7 +251,6 @@ namespace CodeImp.DoomBuilder.Rendering
// BACKGROUND // BACKGROUND
case RendererLayer.Background: case RendererLayer.Background:
if((backimageverts == null) || (General.Map.Grid.Background.Texture == null)) break; if((backimageverts == null) || (General.Map.Grid.Background.Texture == null)) break;
graphics.Device.SetTexture(0, General.Map.Grid.Background.Texture);
graphics.Shaders.Display2D.Texture1 = General.Map.Grid.Background.Texture; graphics.Shaders.Display2D.Texture1 = General.Map.Grid.Background.Texture;
graphics.Shaders.Display2D.SetSettings(1f / windowsize.Width, 1f / windowsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.SetSettings(1f / windowsize.Width, 1f / windowsize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.Shaders.Display2D.BeginPass(aapass); graphics.Shaders.Display2D.BeginPass(aapass);
@ -262,7 +261,6 @@ namespace CodeImp.DoomBuilder.Rendering
// GRID // GRID
case RendererLayer.Grid: case RendererLayer.Grid:
graphics.Device.SetTexture(0, backtex);
graphics.Shaders.Display2D.Texture1 = backtex; graphics.Shaders.Display2D.Texture1 = backtex;
graphics.Shaders.Display2D.SetSettings(1f / backsize.Width, 1f / backsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.SetSettings(1f / backsize.Width, 1f / backsize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.Shaders.Display2D.BeginPass(aapass); graphics.Shaders.Display2D.BeginPass(aapass);
@ -272,7 +270,6 @@ namespace CodeImp.DoomBuilder.Rendering
// GEOMETRY // GEOMETRY
case RendererLayer.Geometry: case RendererLayer.Geometry:
graphics.Device.SetTexture(0, plottertex);
graphics.Shaders.Display2D.Texture1 = plottertex; graphics.Shaders.Display2D.Texture1 = plottertex;
graphics.Shaders.Display2D.SetSettings(1f / structsize.Width, 1f / structsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.SetSettings(1f / structsize.Width, 1f / structsize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.Shaders.Display2D.BeginPass(aapass); graphics.Shaders.Display2D.BeginPass(aapass);
@ -282,7 +279,6 @@ namespace CodeImp.DoomBuilder.Rendering
// THINGS // THINGS
case RendererLayer.Things: case RendererLayer.Things:
graphics.Device.SetTexture(0, thingstex);
graphics.Shaders.Display2D.Texture1 = thingstex; graphics.Shaders.Display2D.Texture1 = thingstex;
graphics.Shaders.Display2D.SetSettings(1f / thingssize.Width, 1f / thingssize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.SetSettings(1f / thingssize.Width, 1f / thingssize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.Shaders.Display2D.BeginPass(aapass); graphics.Shaders.Display2D.BeginPass(aapass);
@ -292,7 +288,6 @@ namespace CodeImp.DoomBuilder.Rendering
// OVERLAY // OVERLAY
case RendererLayer.Overlay: case RendererLayer.Overlay:
graphics.Device.SetTexture(0, overlaytex);
graphics.Shaders.Display2D.Texture1 = overlaytex; graphics.Shaders.Display2D.Texture1 = overlaytex;
graphics.Shaders.Display2D.SetSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.SetSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.Shaders.Display2D.BeginPass(aapass); graphics.Shaders.Display2D.BeginPass(aapass);
@ -302,7 +297,6 @@ namespace CodeImp.DoomBuilder.Rendering
// SURFACE // SURFACE
case RendererLayer.Surface: case RendererLayer.Surface:
graphics.Device.SetTexture(0, surfacetex);
graphics.Shaders.Display2D.Texture1 = surfacetex; graphics.Shaders.Display2D.Texture1 = surfacetex;
graphics.Shaders.Display2D.SetSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.Display2D.SetSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.Shaders.Display2D.BeginPass(aapass); graphics.Shaders.Display2D.BeginPass(aapass);
@ -318,7 +312,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Present(); graphics.Present();
// Release binds // Release binds
graphics.Device.SetTexture(0, null);
graphics.Shaders.Display2D.Texture1 = null; graphics.Shaders.Display2D.Texture1 = null;
graphics.Device.SetStreamSource(0, null, 0, 0); graphics.Device.SetStreamSource(0, null, 0, 0);
} }
@ -964,19 +957,21 @@ namespace CodeImp.DoomBuilder.Rendering
// This makes vertices for a thing // This makes vertices for a thing
// Returns false when not on the screen // Returns false when not on the screen
private bool CreateThingBoxVerts(Thing t, ref FlatVertex[] verts, Dictionary<Thing, Vector2D> thingsByPosition, int offset, PixelColor c) private bool CreateThingBoxVerts(Thing t, ref FlatVertex[] verts, ref List<Line3D> bboxes, Dictionary<Thing, Vector2D> thingsByPosition, int offset, PixelColor c, byte bboxalpha)
{ {
if(t.Size * scale < MINIMUM_THING_RADIUS) return false; //mxd. Don't render tiny little things if(t.Size * scale < MINIMUM_THING_RADIUS) return false; //mxd. Don't render tiny little things
// Determine size // Determine sizes
float circlesize = (t.FixedSize && (scale > 1.0f) ? t.Size /* * THING_CIRCLE_SIZE*/ : t.Size * scale /* * THING_CIRCLE_SIZE*/); float circlesize = ((t.FixedSize || General.Settings.FixedThingsScale) && (scale > 1.0f) ? t.Size : t.Size * scale);
float bboxsize = ((!t.FixedSize && General.Settings.FixedThingsScale) && (scale > 1.0f) ? t.Size * scale : -1); //mxd
float screensize = Math.Max(circlesize, bboxsize); //mxd
// Transform to screen coordinates // Transform to screen coordinates
Vector2D screenpos = ((Vector2D)t.Position).GetTransformed(translatex, translatey, scale, -scale); Vector2D screenpos = ((Vector2D)t.Position).GetTransformed(translatex, translatey, scale, -scale);
// Check if the thing is actually on screen // Check if the thing is actually on screen
if(((screenpos.x + circlesize) <= 0.0f) || ((screenpos.x - circlesize) >= windowsize.Width) || if(((screenpos.x + screensize) <= 0.0f) || ((screenpos.x - screensize) >= windowsize.Width) ||
((screenpos.y + circlesize) <= 0.0f) || ((screenpos.y - circlesize) >= windowsize.Height)) ((screenpos.y + screensize) <= 0.0f) || ((screenpos.y - screensize) >= windowsize.Height))
return false; return false;
// Get integral color // Get integral color
@ -1014,6 +1009,22 @@ namespace CodeImp.DoomBuilder.Rendering
//mxd. Add to list //mxd. Add to list
thingsByPosition.Add(t, screenpos); thingsByPosition.Add(t, screenpos);
//mxd. Add bounding box?
if(bboxsize > 0)
{
PixelColor boxcolor = c.WithAlpha(bboxalpha);
Vector2D tl = new Vector2D(screenpos.x - bboxsize, screenpos.y - bboxsize);
Vector2D tr = new Vector2D(screenpos.x + bboxsize, screenpos.y - bboxsize);
Vector2D bl = new Vector2D(screenpos.x - bboxsize, screenpos.y + bboxsize);
Vector2D br = new Vector2D(screenpos.x + bboxsize, screenpos.y + bboxsize);
bboxes.Add(new Line3D(tl, tr, boxcolor, false));
bboxes.Add(new Line3D(tr, br, boxcolor, false));
bboxes.Add(new Line3D(bl, br, boxcolor, false));
bboxes.Add(new Line3D(tl, bl, boxcolor, false));
}
// Done // Done
return true; return true;
} }
@ -1022,7 +1033,7 @@ namespace CodeImp.DoomBuilder.Rendering
private void CreateThingArrowVerts(Thing t, ref FlatVertex[] verts, Vector2D screenpos, int offset) private void CreateThingArrowVerts(Thing t, ref FlatVertex[] verts, Vector2D screenpos, int offset)
{ {
// Determine size // Determine size
float arrowsize = (t.FixedSize && (scale > 1.0f) ? t.Size : t.Size * scale) * THING_ARROW_SIZE; //mxd float arrowsize = ((t.FixedSize || General.Settings.FixedThingsScale) && (scale > 1.0f) ? t.Size : t.Size * scale) * THING_ARROW_SIZE; //mxd
// Setup rotated rect for arrow // Setup rotated rect for arrow
float sinarrowsize = (float)Math.Sin(t.Angle + Angle2D.PI * 0.25f) * arrowsize; float sinarrowsize = (float)Math.Sin(t.Angle + Angle2D.PI * 0.25f) * arrowsize;
@ -1100,6 +1111,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Make alpha color // Make alpha color
Color4 alphacolor = new Color4(alpha, 1.0f, 1.0f, 1.0f); Color4 alphacolor = new Color4(alpha, 1.0f, 1.0f, 1.0f);
byte bboxalpha = (byte)(alpha * (General.Editing.Mode.GetType().Name == "ThingsMode" ? 128 : 255));
// Set renderstates for things rendering // Set renderstates for things rendering
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None); graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
@ -1113,7 +1125,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride); graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride);
// Set things texture // Set things texture
graphics.Device.SetTexture(0, thingtexture.Texture);
graphics.Shaders.Things2D.Texture1 = thingtexture.Texture; graphics.Shaders.Things2D.Texture1 = thingtexture.Texture;
SetWorldTransformation(false); SetWorldTransformation(false);
graphics.Shaders.Things2D.SetSettings(alpha); graphics.Shaders.Things2D.SetSettings(alpha);
@ -1125,6 +1136,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Determine next lock size // Determine next lock size
int locksize = (things.Count > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : things.Count; int locksize = (things.Count > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : things.Count;
FlatVertex[] verts = new FlatVertex[THING_BUFFER_SIZE * 6]; FlatVertex[] verts = new FlatVertex[THING_BUFFER_SIZE * 6];
List<Line3D> bboxes = new List<Line3D>(locksize); //mxd
//mxd //mxd
Dictionary<int, List<Thing>> thingsByType = new Dictionary<int, List<Thing>>(); Dictionary<int, List<Thing>> thingsByType = new Dictionary<int, List<Thing>>();
@ -1148,7 +1160,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Create vertices // Create vertices
PixelColor tc = fixedcolor ? c : DetermineThingColor(t); PixelColor tc = fixedcolor ? c : DetermineThingColor(t);
if(CreateThingBoxVerts(t, ref verts, thingsByPosition, buffercount * 6, tc)) if(CreateThingBoxVerts(t, ref verts, ref bboxes, thingsByPosition, buffercount * 6, tc, bboxalpha))
{ {
buffercount++; buffercount++;
@ -1211,8 +1223,8 @@ namespace CodeImp.DoomBuilder.Rendering
} }
if(sprite.Texture == null) sprite.CreateTexture(); if(sprite.Texture == null) sprite.CreateTexture();
graphics.Device.SetTexture(0, sprite.Texture);
graphics.Shaders.Things2D.Texture1 = sprite.Texture; graphics.Shaders.Things2D.Texture1 = sprite.Texture;
graphics.Shaders.Things2D.ApplySettings();
// Determine next lock size // Determine next lock size
locksize = (group.Value.Count > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : group.Value.Count; locksize = (group.Value.Count > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : group.Value.Count;
@ -1223,7 +1235,7 @@ namespace CodeImp.DoomBuilder.Rendering
totalcount = 0; totalcount = 0;
float spriteWidth, spriteHeight; float spriteWidth, spriteHeight;
float spriteScale = (group.Value[0].FixedSize && (scale > 1.0f)) ? 1.0f : scale; float spriteScale = ((group.Value[0].FixedSize || General.Settings.FixedThingsScale) && (scale > 1.0f)) ? 1.0f : scale;
if(sprite.Width > sprite.Height) if(sprite.Width > sprite.Height)
{ {
@ -1285,7 +1297,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.Things2D.EndPass(); graphics.Shaders.Things2D.EndPass();
//mxd. Render thing arrows //mxd. Render thing arrows
graphics.Device.SetTexture(0, thingtexture.Texture);
graphics.Shaders.Things2D.Texture1 = thingtexture.Texture; graphics.Shaders.Things2D.Texture1 = thingtexture.Texture;
graphics.Shaders.Things2D.BeginPass(0); graphics.Shaders.Things2D.BeginPass(0);
@ -1393,6 +1404,9 @@ namespace CodeImp.DoomBuilder.Rendering
} }
graphics.Shaders.Things2D.End(); graphics.Shaders.Things2D.End();
//mxd. Render thing boxes
RenderArrows(bboxes, false);
} }
} }
@ -1501,7 +1515,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false); graphics.Device.SetRenderState(RenderState.FogEnable, false);
graphics.Shaders.Display2D.Texture1 = t; graphics.Shaders.Display2D.Texture1 = t;
graphics.Device.SetTexture(0, t);
SetWorldTransformation(transformcoords); SetWorldTransformation(transformcoords);
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
@ -1558,7 +1571,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.Display2D.Texture1 = graphics.FontTexture; graphics.Shaders.Display2D.Texture1 = graphics.FontTexture;
SetWorldTransformation(false); SetWorldTransformation(false);
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, true); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, true);
graphics.Device.SetTexture(0, graphics.FontTexture);
graphics.Device.SetStreamSource(0, text.VertexBuffer, 0, FlatVertex.Stride); graphics.Device.SetStreamSource(0, text.VertexBuffer, 0, FlatVertex.Stride);
// Draw // Draw
@ -1621,7 +1633,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false); graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(false); SetWorldTransformation(false);
graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture);
graphics.Shaders.Display2D.Texture1 = 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); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
@ -1660,7 +1671,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false); graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(false); SetWorldTransformation(false);
graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture);
graphics.Shaders.Display2D.Texture1 = 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); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
@ -1696,7 +1706,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false); graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(false); SetWorldTransformation(false);
graphics.Device.SetTexture(0, texture.Texture);
graphics.Shaders.Display2D.Texture1 = texture.Texture; graphics.Shaders.Display2D.Texture1 = texture.Texture;
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
@ -1709,7 +1718,8 @@ namespace CodeImp.DoomBuilder.Rendering
} }
//mxd //mxd
public void RenderArrows(ICollection<Line3D> lines) public void RenderArrows(ICollection<Line3D> lines) { RenderArrows(lines, true); }
public void RenderArrows(ICollection<Line3D> lines, bool transformcoords)
{ {
if(lines.Count == 0) return; if(lines.Count == 0) return;
int pointscount = 0; int pointscount = 0;
@ -1717,9 +1727,12 @@ namespace CodeImp.DoomBuilder.Rendering
// Translate to screen coords, determine renderability // Translate to screen coords, determine renderability
foreach(Line3D line in lines) foreach(Line3D line in lines)
{ {
// Calculate screen positions // Calculate screen positions?
line.Start2D = ((Vector2D)line.Start).GetTransformed(translatex, translatey, scale, -scale); //start if(transformcoords)
line.End2D = ((Vector2D)line.End).GetTransformed(translatex, translatey, scale, -scale); //end {
line.Start2D = ((Vector2D)line.Start).GetTransformed(translatex, translatey, scale, -scale); //start
line.End2D = ((Vector2D)line.End).GetTransformed(translatex, translatey, scale, -scale); //end
}
float maxx = Math.Max(line.Start2D.x, line.End2D.x); float maxx = Math.Max(line.Start2D.x, line.End2D.x);
float minx = Math.Min(line.Start2D.x, line.End2D.x); float minx = Math.Min(line.Start2D.x, line.End2D.x);
@ -1798,7 +1811,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false); graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(false); SetWorldTransformation(false);
graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture);
graphics.Shaders.Display2D.Texture1 = 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); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
@ -1854,7 +1866,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.TextureFactor, -1); graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Device.SetRenderState(RenderState.FogEnable, false); graphics.Device.SetRenderState(RenderState.FogEnable, false);
SetWorldTransformation(false); SetWorldTransformation(false);
graphics.Device.SetTexture(0, General.Map.Data.WhiteTexture.Texture);
graphics.Shaders.Display2D.Texture1 = 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); graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);

View file

@ -1814,13 +1814,11 @@ namespace CodeImp.DoomBuilder.Rendering
if(crosshairbusy) if(crosshairbusy)
{ {
if(General.Map.Data.CrosshairBusy3D.Texture == null) General.Map.Data.CrosshairBusy3D.CreateTexture(); if(General.Map.Data.CrosshairBusy3D.Texture == null) General.Map.Data.CrosshairBusy3D.CreateTexture();
graphics.Device.SetTexture(0, General.Map.Data.CrosshairBusy3D.Texture);
graphics.Shaders.Display2D.Texture1 = General.Map.Data.CrosshairBusy3D.Texture; graphics.Shaders.Display2D.Texture1 = General.Map.Data.CrosshairBusy3D.Texture;
} }
else else
{ {
if(General.Map.Data.Crosshair3D.Texture == null) General.Map.Data.Crosshair3D.CreateTexture(); if(General.Map.Data.Crosshair3D.Texture == null) General.Map.Data.Crosshair3D.CreateTexture();
graphics.Device.SetTexture(0, General.Map.Data.Crosshair3D.Texture);
graphics.Shaders.Display2D.Texture1 = General.Map.Data.Crosshair3D.Texture; graphics.Shaders.Display2D.Texture1 = General.Map.Data.Crosshair3D.Texture;
} }

View file

@ -1026,6 +1026,16 @@ togglecomments //mxd
allowscroll = false; allowscroll = false;
} }
togglefixedthingsscale //mxd
{
title = "Toggle Fixed Things Scale";
category = "view";
description = "When enabled, Things will no longer be scaled based on current zoom level in Classic modes.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
}
togglebrightness //mxd togglebrightness //mxd
{ {
title = "Toggle Full Brightness"; title = "Toggle Full Brightness";

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -181,6 +181,7 @@ namespace CodeImp.DoomBuilder.Windows
this.buttonviewceilings = new System.Windows.Forms.ToolStripButton(); this.buttonviewceilings = new System.Windows.Forms.ToolStripButton();
this.seperatorviews = new System.Windows.Forms.ToolStripSeparator(); this.seperatorviews = new System.Windows.Forms.ToolStripSeparator();
this.buttontogglecomments = new System.Windows.Forms.ToolStripButton(); this.buttontogglecomments = new System.Windows.Forms.ToolStripButton();
this.buttontogglefixedthingsscale = new System.Windows.Forms.ToolStripButton();
this.buttonsnaptogrid = new System.Windows.Forms.ToolStripButton(); this.buttonsnaptogrid = new System.Windows.Forms.ToolStripButton();
this.buttonautomerge = new System.Windows.Forms.ToolStripButton(); this.buttonautomerge = new System.Windows.Forms.ToolStripButton();
this.buttonautoclearsidetextures = new System.Windows.Forms.ToolStripButton(); this.buttonautoclearsidetextures = new System.Windows.Forms.ToolStripButton();
@ -255,6 +256,7 @@ namespace CodeImp.DoomBuilder.Windows
this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.modecontrolsloolbar = new System.Windows.Forms.ToolStrip(); this.modecontrolsloolbar = new System.Windows.Forms.ToolStrip();
this.itemtogglecomments = new System.Windows.Forms.ToolStripMenuItem(); this.itemtogglecomments = new System.Windows.Forms.ToolStripMenuItem();
this.itemtogglefixedthingsscale = new System.Windows.Forms.ToolStripMenuItem();
this.itemdynamicgridsize = new System.Windows.Forms.ToolStripMenuItem(); this.itemdynamicgridsize = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
@ -738,6 +740,7 @@ namespace CodeImp.DoomBuilder.Windows
this.itemfullbrightness, this.itemfullbrightness,
this.itemtogglegrid, this.itemtogglegrid,
this.itemtogglecomments, this.itemtogglecomments,
this.itemtogglefixedthingsscale,
this.toolStripSeparator4, this.toolStripSeparator4,
this.menuzoom, this.menuzoom,
this.itemgotocoords, this.itemgotocoords,
@ -1243,6 +1246,7 @@ namespace CodeImp.DoomBuilder.Windows
this.buttonfullbrightness, this.buttonfullbrightness,
this.buttontogglegrid, this.buttontogglegrid,
this.buttontogglecomments, this.buttontogglecomments,
this.buttontogglefixedthingsscale,
this.separatorfullbrightness, this.separatorfullbrightness,
this.buttonviewnormal, this.buttonviewnormal,
this.buttonviewbrightness, this.buttonviewbrightness,
@ -1658,6 +1662,19 @@ namespace CodeImp.DoomBuilder.Windows
this.buttontogglecomments.Text = "Show Comments"; this.buttontogglecomments.Text = "Show Comments";
this.buttontogglecomments.Click += new System.EventHandler(this.InvokeTaggedAction); this.buttontogglecomments.Click += new System.EventHandler(this.InvokeTaggedAction);
// //
// buttontogglefixedthingsscale
//
this.buttontogglefixedthingsscale.Checked = true;
this.buttontogglefixedthingsscale.CheckState = System.Windows.Forms.CheckState.Checked;
this.buttontogglefixedthingsscale.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.buttontogglefixedthingsscale.Image = global::CodeImp.DoomBuilder.Properties.Resources.FixedThingsScale;
this.buttontogglefixedthingsscale.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttontogglefixedthingsscale.Name = "buttontogglefixedthingsscale";
this.buttontogglefixedthingsscale.Size = new System.Drawing.Size(23, 22);
this.buttontogglefixedthingsscale.Tag = "builder_togglefixedthingsscale";
this.buttontogglefixedthingsscale.Text = "Fixed Things Scale";
this.buttontogglefixedthingsscale.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// buttonsnaptogrid // buttonsnaptogrid
// //
this.buttonsnaptogrid.Checked = true; this.buttonsnaptogrid.Checked = true;
@ -2429,6 +2446,18 @@ namespace CodeImp.DoomBuilder.Windows
this.itemtogglecomments.Text = "Show Comments"; this.itemtogglecomments.Text = "Show Comments";
this.itemtogglecomments.Click += new System.EventHandler(this.InvokeTaggedAction); this.itemtogglecomments.Click += new System.EventHandler(this.InvokeTaggedAction);
// //
// itemtogglefixedthingsscale
//
this.itemtogglefixedthingsscale.Checked = true;
this.itemtogglefixedthingsscale.CheckOnClick = true;
this.itemtogglefixedthingsscale.CheckState = System.Windows.Forms.CheckState.Checked;
this.itemtogglefixedthingsscale.Image = global::CodeImp.DoomBuilder.Properties.Resources.FixedThingsScale;
this.itemtogglefixedthingsscale.Name = "itemtogglefixedthingsscale";
this.itemtogglefixedthingsscale.Size = new System.Drawing.Size(215, 22);
this.itemtogglefixedthingsscale.Tag = "builder_togglefixedthingsscale";
this.itemtogglefixedthingsscale.Text = "Fixed Things Scale";
this.itemtogglefixedthingsscale.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// itemdynamicgridsize // itemdynamicgridsize
// //
this.itemdynamicgridsize.Checked = true; this.itemdynamicgridsize.Checked = true;
@ -2694,6 +2723,7 @@ namespace CodeImp.DoomBuilder.Windows
private ToolStripMenuItem item2zoom800; private ToolStripMenuItem item2zoom800;
private ToolStripMenuItem itemzoom800; private ToolStripMenuItem itemzoom800;
private ToolStripButton buttontogglecomments; private ToolStripButton buttontogglecomments;
private ToolStripButton buttontogglefixedthingsscale;
private ToolStripMenuItem itemlinedefcolors; private ToolStripMenuItem itemlinedefcolors;
private ToolStripSeparator separatorlinecolors; private ToolStripSeparator separatorlinecolors;
private ToolStripButton buttonlinededfcolors; private ToolStripButton buttonlinededfcolors;
@ -2704,5 +2734,6 @@ namespace CodeImp.DoomBuilder.Windows
private ToolStripButton buttontoggledynamicgrid; private ToolStripButton buttontoggledynamicgrid;
private ToolStripMenuItem itemdynamicgridsize; private ToolStripMenuItem itemdynamicgridsize;
private ToolStripMenuItem itemtogglecomments; private ToolStripMenuItem itemtogglecomments;
private ToolStripMenuItem itemtogglefixedthingsscale;
} }
} }

View file

@ -2021,6 +2021,8 @@ namespace CodeImp.DoomBuilder.Windows
buttontogglegrid.Checked = General.Settings.RenderGrid; //mxd buttontogglegrid.Checked = General.Settings.RenderGrid; //mxd
buttontogglecomments.Visible = General.Settings.ToolbarViewModes && maploaded && General.Map.UDMF; //mxd buttontogglecomments.Visible = General.Settings.ToolbarViewModes && maploaded && General.Map.UDMF; //mxd
buttontogglecomments.Checked = General.Settings.RenderComments; //mxd buttontogglecomments.Checked = General.Settings.RenderComments; //mxd
buttontogglefixedthingsscale.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
buttontogglefixedthingsscale.Checked = General.Settings.FixedThingsScale; //mxd
separatorfullbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd separatorfullbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
buttonviewbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; buttonviewbrightness.Visible = General.Settings.ToolbarViewModes && maploaded;
buttonviewceilings.Visible = General.Settings.ToolbarViewModes && maploaded; buttonviewceilings.Visible = General.Settings.ToolbarViewModes && maploaded;
@ -2764,6 +2766,19 @@ namespace CodeImp.DoomBuilder.Windows
RedrawDisplay(); RedrawDisplay();
} }
//mxd. Action to toggle fixed things scale
[BeginAction("togglefixedthingsscale")]
internal void ToggleFixedThingsScale()
{
buttontogglefixedthingsscale.Checked = !buttontogglefixedthingsscale.Checked;
itemtogglefixedthingsscale.Checked = buttontogglefixedthingsscale.Checked;
General.Settings.FixedThingsScale = buttontogglefixedthingsscale.Checked;
DisplayStatus(StatusType.Action, "Fixed things scale is " + (buttontogglefixedthingsscale.Checked ? "ENABLED" : "DISABLED"));
// Redraw display to show changes
RedrawDisplay();
}
// Action to toggle snap to grid // Action to toggle snap to grid
[BeginAction("togglesnap")] [BeginAction("togglesnap")]
internal void ToggleSnapToGrid() internal void ToggleSnapToGrid()
@ -2864,6 +2879,8 @@ namespace CodeImp.DoomBuilder.Windows
itemtoggleinfo.Checked = IsInfoPanelExpanded; itemtoggleinfo.Checked = IsInfoPanelExpanded;
itemtogglecomments.Visible = (General.Map != null && General.Map.UDMF); //mxd itemtogglecomments.Visible = (General.Map != null && General.Map.UDMF); //mxd
itemtogglecomments.Checked = General.Settings.RenderComments; //mxd itemtogglecomments.Checked = General.Settings.RenderComments; //mxd
itemtogglefixedthingsscale.Visible = (General.Map != null); //mxd
itemtogglefixedthingsscale.Checked = General.Settings.FixedThingsScale; //mxd
// View mode items // View mode items
if(General.Map != null) if(General.Map != null)

View file

@ -760,7 +760,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(t.Fields.ContainsKey("comment")) if(t.Fields.ContainsKey("comment"))
{ {
float size = ((t.FixedSize && renderer.Scale > 1.0f) ? t.Size / renderer.Scale : t.Size); float size = (((t.FixedSize || General.Settings.FixedThingsScale) && renderer.Scale > 1.0f) ? t.Size / renderer.Scale : t.Size);
if(size * renderer.Scale < 1.5f) return; // Thing is too small to render if(size * renderer.Scale < 1.5f) return; // Thing is too small to render
int iconindex = 0; int iconindex = 0;