Moved renderentities check

This commit is contained in:
Carmine 2018-08-12 18:04:34 +02:00
parent 1b94cd4f04
commit aec2426d7b

View File

@ -1537,34 +1537,34 @@ namespace CodeWalker.Rendering
//if an entity is not fully loaded, set a flag for its parent, then traverse to root //if an entity is not fully loaded, set a flag for its parent, then traverse to root
//until found an entity that is fully loaded. //until found an entity that is fully loaded.
//on a second loop, build a final render list based on the flags. //on a second loop, build a final render list based on the flags.
if(renderentities)
for (int i = 0; i < renderworldentities.Count; i++)
{ {
var ent = renderworldentities[i];
for (int i = 0; i < renderworldentities.Count; i++) var arch = ent.Archetype;
var pent = ent.Parent;
var drawable = gameFileCache.TryGetDrawable(arch);
Renderable rndbl = TryGetRenderable(arch, drawable);
if ((rndbl != null) && rndbl.IsLoaded && (rndbl.AllTexturesLoaded || !waitforchildrentoload))
{ {
var ent = renderworldentities[i]; RenderableEntity rent = new RenderableEntity();
var arch = ent.Archetype; rent.Entity = ent;
var pent = ent.Parent; rent.Renderable = rndbl;
var drawable = gameFileCache.TryGetDrawable(arch); renderworldrenderables.Add(rent);
Renderable rndbl = TryGetRenderable(arch, drawable); }
if ((rndbl != null) && rndbl.IsLoaded && (rndbl.AllTexturesLoaded || !waitforchildrentoload)) else if (waitforchildrentoload)
{ {
RenderableEntity rent = new RenderableEntity(); //todo: render parent if children loading.......
rent.Entity = ent;
rent.Renderable = rndbl;
renderworldrenderables.Add(rent);
}
else if (waitforchildrentoload)
{
//todo: render parent if children loading.......
}
if (ent.IsMlo && rendercollisionmeshes && renderinteriors)
{
RenderInteriorCollisionMesh(ent);
}
} }
if (ent.IsMlo && rendercollisionmeshes && renderinteriors)
{
RenderInteriorCollisionMesh(ent);
}
}
if(renderentities)
{
for (int i = 0; i < renderworldrenderables.Count; i++) for (int i = 0; i < renderworldrenderables.Count; i++)
{ {
var rent = renderworldrenderables[i]; var rent = renderworldrenderables[i];