Revert "Fix geometry constantly being rebuilt in some situations"

This reverts commit 4f4f074c3f.
This commit is contained in:
spherallic 2023-04-20 12:26:53 +02:00
parent a74ce69297
commit 8c12299583
3 changed files with 35 additions and 49 deletions

View file

@ -55,11 +55,7 @@ namespace CodeImp.DoomBuilder.VisualModes
internal List<VisualGeometry> FixedGeometry { get { return fixedgeometry; } }
internal List<VisualGeometry> AllGeometry { get { return allgeometry; } }
internal VertexBuffer GeometryBuffer { get { return geobuffer; } }
internal bool NeedsUpdateGeo
{
get { return updategeo; }
set { updategeo |= value; }
}
internal bool NeedsUpdateGeo { get { return updategeo; } set { updategeo |= value; } }
public bool IsDisposed { get { return isdisposed; } }
public Sector Sector { get { return sector; } }
@ -111,7 +107,7 @@ namespace CodeImp.DoomBuilder.VisualModes
// Trash geometry buffer
if(geobuffer != null) geobuffer.Dispose();
geobuffer = null;
NeedsUpdateGeo = true;
updategeo = true;
}
// This is called resets when the device is reset
@ -173,7 +169,7 @@ namespace CodeImp.DoomBuilder.VisualModes
/// </summary>
public void AddGeometry(VisualGeometry geo)
{
NeedsUpdateGeo = true;
updategeo = true;
allgeometry.Add(geo);
if(geo.Sidedef != null)
{
@ -195,7 +191,7 @@ namespace CodeImp.DoomBuilder.VisualModes
allgeometry.Clear();
fixedgeometry.Clear();
sidedefgeometry.Clear();
NeedsUpdateGeo = true;
updategeo = true;
}
// This gets the geometry list for the specified sidedef

View file

@ -44,7 +44,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected readonly BaseVisualMode mode;
protected long setuponloadedtexture;
private long lastsetuponloadedtexture;
// This is only used to see if this object has already received a change
// in a multiselection. The Changed property on the BaseVisualSector is
@ -611,20 +610,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
public virtual void OnProcess(long deltatime)
{
// If the texture was not loaded, but is loaded now, then re-setup geometry
if(setuponloadedtexture != lastsetuponloadedtexture)
{
if (setuponloadedtexture != 0)
if(setuponloadedtexture != 0)
{
ImageData t = General.Map.Data.GetFlatImage(setuponloadedtexture);
if (t != null && t.IsImageLoaded)
if(t != null)
{
lastsetuponloadedtexture = setuponloadedtexture;
if(t.IsImageLoaded)
{
setuponloadedtexture = 0;
Setup();
}
}
else
{
lastsetuponloadedtexture = setuponloadedtexture;
}
}
}

View file

@ -48,7 +48,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected Plane top;
protected Plane bottom;
protected long setuponloadedtexture;
private long lastsetuponloadedtexture;
// UV dragging
private float dragstartanglexy;
@ -836,21 +835,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
public virtual void OnProcess(long deltatime)
{
// If the texture was not loaded, but is loaded now, then re-setup geometry
if (setuponloadedtexture != lastsetuponloadedtexture)
{
if (setuponloadedtexture != 0)
if(setuponloadedtexture != 0)
{
ImageData t = General.Map.Data.GetTextureImage(setuponloadedtexture);
if (t != null && t.IsImageLoaded)
if(t != null)
{
lastsetuponloadedtexture = setuponloadedtexture;
if(t.IsImageLoaded)
{
setuponloadedtexture = 0;
Setup();
}
}
else
{
lastsetuponloadedtexture = setuponloadedtexture;
}
}
}