Visual mode: fixed a crash when trying to render a thing after resetting D3D device.

This commit is contained in:
MaxED 2016-04-19 23:20:41 +00:00
parent 3eb05509af
commit 44496c32be
2 changed files with 6 additions and 11 deletions

View file

@ -224,12 +224,6 @@ namespace CodeImp.DoomBuilder.VisualModes
geobuffers = null;
}
if(textures != null) //mxd
{
foreach(ImageData texture in textures) texture.Dispose();
textures = null;
}
if(cagebuffer != null) cagebuffer.Dispose(); //mxd
cagebuffer = null; //mxd
updategeo = true;

View file

@ -276,14 +276,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. Create verts for all sprite angles
WorldVertex[][] allverts = new WorldVertex[info.SpriteFrame.Length][];
base.textures = new ImageData[info.SpriteFrame.Length];
isloaded = true;
for(int i = 0; i < sprites.Length; i++)
{
// Check if the texture is loaded
ImageData sprite = sprites[i];
sprite.LoadImage();
isloaded = sprite.IsImageLoaded;
if(isloaded)
if(sprite.IsImageLoaded)
{
float offsetx = 0.0f;
float offsety = 0.0f;
@ -337,6 +337,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
else
{
isloaded = false;
base.textures[i] = General.Map.Data.Hourglass3D;
// Determine sprite size
@ -493,17 +494,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!isloaded)
{
//mxd. Rebuild sprite geometry when all sprites are loaded
bool allloaded = true;
isloaded = true;
foreach(ImageData sprite in sprites)
{
if(!sprite.IsImageLoaded)
{
allloaded = false;
isloaded = false;
break;
}
}
if(allloaded) Setup();
if(isloaded) Setup();
}
// Let the base update