internal void UpdateTexturesOfCurrentModel(Dictionary <Material, Image> snapshot) { void updateTextures(Renderer rndr) { foreach (var kvp in snapshot) { if (kvp.Value != kvp.Key.Image) { rndr.UpdateTexture(kvp.Value, kvp.Key.Image); } } } if (cVisualMap is object && Maps.rndrVisualMap is object) { updateTextures(rndrVisualMap); } foreach (var rndrObj in Main.ObjectModels.Values) { updateTextures(rndrObj); } Ogl.Invalidate(); }
internal void LoadAreaModel(ModelDrawMod modelMode) { if (Main.CArea is object) { Main.ProgressControl(true); switch (modelMode) { case ModelDrawMod.Collision: { if (cCollisionMap is null) { LoadAreaCollisionAsObject3D(); rndrCollisionMap?.ReleaseBuffers(); rndrCollisionMap = null; } if (rndrCollisionMap is null) { rndrCollisionMap = new Renderer(cCollisionMap); rndrCollisionMap.RenderModel(); } break; } case ModelDrawMod.VisualMap: { if (cVisualMap is null) { LoadAreaVisualMapAsObject3D(); rndrVisualMap?.ReleaseBuffers(); rndrVisualMap = null; } if (rndrVisualMap is null) { rndrVisualMap = new Renderer(cVisualMap); rndrVisualMap.RenderModel(); } break; } } Ogl.Invalidate(); Main.ProgressControl(false); // Console.WriteLine("Done!") } }
internal void CheckAndLoadNew() { Ogl.MakeCurrent(); bool loadAreaIDs = false; if (Main.CArea is null) { loadAreaIDs = true; } if (Main.CLevel.Areas.Count != Main.ComboBoxItem_Area.Items.Count) { loadAreaIDs = true; } else { foreach (ComboItem ci in Main.ComboBoxItem_Area.Items) { if (!Main.CLevel.Areas.Contains((LevelArea)ci.Tag)) { loadAreaIDs = true; } } } if (loadAreaIDs) { Main.LoadAreaIDs(); } else { bool loadAreaMdl = false; if (hashCollisionMap != Main.CArea.AreaModel.Collision.GetHashCode()) { hashCollisionMap = 0; cCollisionMap = null; if (Ogl.CurrentModelDrawMod == ModelDrawMod.Collision) { loadAreaMdl = true; } } if (hashVisualMap != Main.CArea.AreaModel.Fast3DBuffer.GetBuffer().GetHashCode()) { hashVisualMap = 0; cVisualMap = null; if (Ogl.CurrentModelDrawMod == ModelDrawMod.VisualMap) { loadAreaMdl = true; } } if (loadAreaMdl) { Maps.LoadAreaModel(); } else { Ogl.Invalidate(); } } }