Added checkbox to disable rendering of drawables

This commit is contained in:
Carmine 2018-08-11 17:58:52 +02:00
parent 4c131fa0af
commit f27672d6ad
3 changed files with 57 additions and 33 deletions

View File

@ -98,7 +98,7 @@ namespace CodeWalker.Rendering
public bool renderinteriors = true; public bool renderinteriors = true;
public bool renderproxies = false; public bool renderproxies = false;
public bool renderchildents = false;//when rendering single ymap, render root only or not... public bool renderchildents = false;//when rendering single ymap, render root only or not...
public bool renderentities = true;
public bool rendergrass = true; public bool rendergrass = true;
public bool renderdistlodlights = true; public bool renderdistlodlights = true;
@ -1537,41 +1537,44 @@ 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];
var arch = ent.Archetype; for (int i = 0; i < renderworldentities.Count; i++)
var pent = ent.Parent;
var drawable = gameFileCache.TryGetDrawable(arch);
Renderable rndbl = TryGetRenderable(arch, drawable);
if ((rndbl != null) && rndbl.IsLoaded && (rndbl.AllTexturesLoaded || !waitforchildrentoload))
{ {
RenderableEntity rent = new RenderableEntity(); var ent = renderworldentities[i];
rent.Entity = ent; var arch = ent.Archetype;
rent.Renderable = rndbl; var pent = ent.Parent;
renderworldrenderables.Add(rent); var drawable = gameFileCache.TryGetDrawable(arch);
} Renderable rndbl = TryGetRenderable(arch, drawable);
else if (waitforchildrentoload) if ((rndbl != null) && rndbl.IsLoaded && (rndbl.AllTexturesLoaded || !waitforchildrentoload))
{ {
//todo: render parent if children loading....... RenderableEntity rent = new RenderableEntity();
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) for (int i = 0; i < renderworldrenderables.Count; i++)
{ {
RenderInteriorCollisionMesh(ent); var rent = renderworldrenderables[i];
var ent = rent.Entity;
var arch = ent.Archetype;
RenderArchetype(arch, ent, rent.Renderable, false);
} }
} }
for (int i = 0; i < renderworldrenderables.Count; i++)
{
var rent = renderworldrenderables[i];
var ent = rent.Entity;
var arch = ent.Archetype;
RenderArchetype(arch, ent, rent.Renderable, false);
}
if (rendergrass) if (rendergrass)

26
WorldForm.Designer.cs generated
View File

@ -109,6 +109,7 @@ namespace CodeWalker
this.tabPage4 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage();
this.OptionsTabControl = new System.Windows.Forms.TabControl(); this.OptionsTabControl = new System.Windows.Forms.TabControl();
this.tabPage8 = new System.Windows.Forms.TabPage(); this.tabPage8 = new System.Windows.Forms.TabPage();
this.RenderEntitiesCheckBox = new System.Windows.Forms.CheckBox();
this.AdvancedSettingsButton = new System.Windows.Forms.Button(); this.AdvancedSettingsButton = new System.Windows.Forms.Button();
this.ControlSettingsButton = new System.Windows.Forms.Button(); this.ControlSettingsButton = new System.Windows.Forms.Button();
this.MapViewDetailLabel = new System.Windows.Forms.Label(); this.MapViewDetailLabel = new System.Windows.Forms.Label();
@ -1295,6 +1296,7 @@ namespace CodeWalker
// //
// tabPage8 // tabPage8
// //
this.tabPage8.Controls.Add(this.RenderEntitiesCheckBox);
this.tabPage8.Controls.Add(this.AdvancedSettingsButton); this.tabPage8.Controls.Add(this.AdvancedSettingsButton);
this.tabPage8.Controls.Add(this.ControlSettingsButton); this.tabPage8.Controls.Add(this.ControlSettingsButton);
this.tabPage8.Controls.Add(this.MapViewDetailLabel); this.tabPage8.Controls.Add(this.MapViewDetailLabel);
@ -1327,6 +1329,19 @@ namespace CodeWalker
this.tabPage8.Text = "General"; this.tabPage8.Text = "General";
this.tabPage8.UseVisualStyleBackColor = true; this.tabPage8.UseVisualStyleBackColor = true;
// //
// EntitiesCheckBox
//
this.RenderEntitiesCheckBox.AutoSize = true;
this.RenderEntitiesCheckBox.Checked = true;
this.RenderEntitiesCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.RenderEntitiesCheckBox.Location = new System.Drawing.Point(10, 32);
this.RenderEntitiesCheckBox.Name = "EntitiesCheckBox";
this.RenderEntitiesCheckBox.Size = new System.Drawing.Size(89, 17);
this.RenderEntitiesCheckBox.TabIndex = 67;
this.RenderEntitiesCheckBox.Text = "Show entities";
this.RenderEntitiesCheckBox.UseVisualStyleBackColor = true;
this.RenderEntitiesCheckBox.CheckedChanged += new System.EventHandler(this.RenderEntitiesCheckBox_CheckedChanged);
//
// AdvancedSettingsButton // AdvancedSettingsButton
// //
this.AdvancedSettingsButton.Location = new System.Drawing.Point(101, 456); this.AdvancedSettingsButton.Location = new System.Drawing.Point(101, 456);
@ -1411,7 +1426,7 @@ namespace CodeWalker
this.WaterQuadsCheckBox.AutoSize = true; this.WaterQuadsCheckBox.AutoSize = true;
this.WaterQuadsCheckBox.Checked = true; this.WaterQuadsCheckBox.Checked = true;
this.WaterQuadsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.WaterQuadsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.WaterQuadsCheckBox.Location = new System.Drawing.Point(10, 104); this.WaterQuadsCheckBox.Location = new System.Drawing.Point(10, 129);
this.WaterQuadsCheckBox.Name = "WaterQuadsCheckBox"; this.WaterQuadsCheckBox.Name = "WaterQuadsCheckBox";
this.WaterQuadsCheckBox.Size = new System.Drawing.Size(114, 17); this.WaterQuadsCheckBox.Size = new System.Drawing.Size(114, 17);
this.WaterQuadsCheckBox.TabIndex = 39; this.WaterQuadsCheckBox.TabIndex = 39;
@ -1440,7 +1455,7 @@ namespace CodeWalker
// TimedEntitiesAlwaysOnCheckBox // TimedEntitiesAlwaysOnCheckBox
// //
this.TimedEntitiesAlwaysOnCheckBox.AutoSize = true; this.TimedEntitiesAlwaysOnCheckBox.AutoSize = true;
this.TimedEntitiesAlwaysOnCheckBox.Location = new System.Drawing.Point(131, 58); this.TimedEntitiesAlwaysOnCheckBox.Location = new System.Drawing.Point(131, 83);
this.TimedEntitiesAlwaysOnCheckBox.Name = "TimedEntitiesAlwaysOnCheckBox"; this.TimedEntitiesAlwaysOnCheckBox.Name = "TimedEntitiesAlwaysOnCheckBox";
this.TimedEntitiesAlwaysOnCheckBox.Size = new System.Drawing.Size(58, 17); this.TimedEntitiesAlwaysOnCheckBox.Size = new System.Drawing.Size(58, 17);
this.TimedEntitiesAlwaysOnCheckBox.TabIndex = 37; this.TimedEntitiesAlwaysOnCheckBox.TabIndex = 37;
@ -1453,7 +1468,7 @@ namespace CodeWalker
this.GrassCheckBox.AutoSize = true; this.GrassCheckBox.AutoSize = true;
this.GrassCheckBox.Checked = true; this.GrassCheckBox.Checked = true;
this.GrassCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.GrassCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.GrassCheckBox.Location = new System.Drawing.Point(10, 35); this.GrassCheckBox.Location = new System.Drawing.Point(10, 57);
this.GrassCheckBox.Name = "GrassCheckBox"; this.GrassCheckBox.Name = "GrassCheckBox";
this.GrassCheckBox.Size = new System.Drawing.Size(81, 17); this.GrassCheckBox.Size = new System.Drawing.Size(81, 17);
this.GrassCheckBox.TabIndex = 35; this.GrassCheckBox.TabIndex = 35;
@ -1466,7 +1481,7 @@ namespace CodeWalker
this.InteriorsCheckBox.AutoSize = true; this.InteriorsCheckBox.AutoSize = true;
this.InteriorsCheckBox.Checked = true; this.InteriorsCheckBox.Checked = true;
this.InteriorsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.InteriorsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.InteriorsCheckBox.Location = new System.Drawing.Point(10, 81); this.InteriorsCheckBox.Location = new System.Drawing.Point(10, 106);
this.InteriorsCheckBox.Name = "InteriorsCheckBox"; this.InteriorsCheckBox.Name = "InteriorsCheckBox";
this.InteriorsCheckBox.Size = new System.Drawing.Size(92, 17); this.InteriorsCheckBox.Size = new System.Drawing.Size(92, 17);
this.InteriorsCheckBox.TabIndex = 38; this.InteriorsCheckBox.TabIndex = 38;
@ -1586,7 +1601,7 @@ namespace CodeWalker
this.TimedEntitiesCheckBox.AutoSize = true; this.TimedEntitiesCheckBox.AutoSize = true;
this.TimedEntitiesCheckBox.Checked = true; this.TimedEntitiesCheckBox.Checked = true;
this.TimedEntitiesCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.TimedEntitiesCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.TimedEntitiesCheckBox.Location = new System.Drawing.Point(10, 58); this.TimedEntitiesCheckBox.Location = new System.Drawing.Point(10, 83);
this.TimedEntitiesCheckBox.Name = "TimedEntitiesCheckBox"; this.TimedEntitiesCheckBox.Name = "TimedEntitiesCheckBox";
this.TimedEntitiesCheckBox.Size = new System.Drawing.Size(117, 17); this.TimedEntitiesCheckBox.Size = new System.Drawing.Size(117, 17);
this.TimedEntitiesCheckBox.TabIndex = 36; this.TimedEntitiesCheckBox.TabIndex = 36;
@ -3581,5 +3596,6 @@ namespace CodeWalker
private System.Windows.Forms.ToolStripMenuItem ToolbarSnapToGroundGridButton; private System.Windows.Forms.ToolStripMenuItem ToolbarSnapToGroundGridButton;
private System.Windows.Forms.NumericUpDown SnapGridSizeUpDown; private System.Windows.Forms.NumericUpDown SnapGridSizeUpDown;
private System.Windows.Forms.Label label26; private System.Windows.Forms.Label label26;
private System.Windows.Forms.CheckBox RenderEntitiesCheckBox;
} }
} }

View File

@ -7553,6 +7553,11 @@ namespace CodeWalker
{ {
SnapGridSize = (float)SnapGridSizeUpDown.Value; SnapGridSize = (float)SnapGridSizeUpDown.Value;
} }
private void RenderEntitiesCheckBox_CheckedChanged(object sender, EventArgs e)
{
Renderer.renderentities = RenderEntitiesCheckBox.Checked;
}
} }