Waiting for textures to load before rendering

This commit is contained in:
dexy 2019-01-09 16:55:11 +11:00
parent 55ae14f1b0
commit dd3b8bdab4
4 changed files with 27 additions and 34 deletions

View File

@ -92,7 +92,7 @@
<value>True</value> <value>True</value>
</setting> </setting>
<setting name="WaitForChildren" serializeAs="String"> <setting name="WaitForChildren" serializeAs="String">
<value>False</value> <value>True</value>
</setting> </setting>
<setting name="CacheSize" serializeAs="String"> <setting name="CacheSize" serializeAs="String">
<value>2147483648</value> <value>2147483648</value>
@ -153,7 +153,8 @@
</setting> </setting>
<setting name="KeyBindings" serializeAs="Xml"> <setting name="KeyBindings" serializeAs="Xml">
<value> <value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>Move Forwards: W</string> <string>Move Forwards: W</string>
<string>Move Backwards: S</string> <string>Move Backwards: S</string>
<string>Move Left: A</string> <string>Move Left: A</string>

View File

@ -12,7 +12,7 @@ namespace CodeWalker.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -349,7 +349,7 @@ namespace CodeWalker.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")] [global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool WaitForChildren { public bool WaitForChildren {
get { get {
return ((bool)(this["WaitForChildren"])); return ((bool)(this["WaitForChildren"]));

View File

@ -84,7 +84,7 @@
<Value Profile="(Default)">True</Value> <Value Profile="(Default)">True</Value>
</Setting> </Setting>
<Setting Name="WaitForChildren" Type="System.Boolean" Scope="User"> <Setting Name="WaitForChildren" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">True</Value>
</Setting> </Setting>
<Setting Name="CacheSize" Type="System.Int64" Scope="User"> <Setting Name="CacheSize" Type="System.Int64" Scope="User">
<Value Profile="(Default)">2147483648</Value> <Value Profile="(Default)">2147483648</Value>

View File

@ -1585,10 +1585,6 @@ namespace CodeWalker.Rendering
if (renderentities) if (renderentities)
{ {
//go through the render list, and try ensure renderables and textures for all.
//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.
//on a second loop, build a final render list based on the flags.
for (int i = 0; i < renderworldentities.Count; i++) for (int i = 0; i < renderworldentities.Count; i++)
{ {
var ent = renderworldentities[i]; var ent = renderworldentities[i];
@ -2741,7 +2737,7 @@ namespace CodeWalker.Rendering
//bool alltexsloaded = true; bool alltexsloaded = true;
for (int mi = 0; mi < rndbl.AllModels.Length; mi++) for (int mi = 0; mi < rndbl.AllModels.Length; mi++)
@ -2774,7 +2770,7 @@ namespace CodeWalker.Rendering
if (dtex == null) //else //if (texDict != 0) if (dtex == null) //else //if (texDict != 0)
{ {
var waitingforload = false; bool waitingforload = false;
if (rndbl.SDtxds != null) if (rndbl.SDtxds != null)
{ {
//check the SD texture hierarchy //check the SD texture hierarchy
@ -2792,16 +2788,32 @@ namespace CodeWalker.Rendering
} }
if (dtex != null) break; if (dtex != null) break;
} }
if (waitingforload)
{
alltexsloaded = false;
}
} }
if ((dtex == null) && (!waitingforload)) if ((dtex == null) && (!waitingforload))
{ {
//not present in dictionary... check already loaded texture dicts... (maybe resident?) //not present in dictionary... check already loaded texture dicts... (maybe resident?)
var ytd2 = gameFileCache.TryGetTextureDictForTexture(tex.NameHash); var ytd2 = gameFileCache.TryGetTextureDictForTexture(tex.NameHash);
if ((ytd2 != null) && (ytd2.Loaded) && (ytd2.TextureDict != null)) if (ytd2 != null)
{
if (ytd2.Loaded)
{
if (ytd2.TextureDict != null)
{ {
dtex = ytd2.TextureDict.Lookup(tex.NameHash); dtex = ytd2.TextureDict.Lookup(tex.NameHash);
} }
}
else
{
alltexsloaded = false;
}
}
//else { } //couldn't find texture dict? //else { } //couldn't find texture dict?
if ((dtex == null) && (ytd2 == null))// rndbl.SDtxds.Length == 0)//texture not found.. if ((dtex == null) && (ytd2 == null))// rndbl.SDtxds.Length == 0)//texture not found..
@ -2879,28 +2891,8 @@ namespace CodeWalker.Rendering
} }
} }
//if (rndbl.SDtxds != null)
//{
// for (int i = 0; i < rndbl.SDtxds.Length; i++)
// {
// if (!rndbl.SDtxds[i].Loaded)
// {
// alltexsloaded = false;
// }
// }
//}
//if (rndbl.HDtxds != null)
//{
// for (int i = 0; i < rndbl.HDtxds.Length; i++)
// {
// if (!rndbl.HDtxds[i].Loaded)
// {
// rndbl.AllTexturesLoaded = false;
// }
// }
//}
rndbl.AllTexturesLoaded = true;// alltexsloaded;// || (missingtexcount < 2); rndbl.AllTexturesLoaded = alltexsloaded;
return rndbl; return rndbl;