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 renderproxies = false;
public bool renderchildents = false;//when rendering single ymap, render root only or not...
public bool renderentities = true;
public bool rendergrass = 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
//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++)
if(renderentities)
{
var ent = renderworldentities[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))
for (int i = 0; i < renderworldentities.Count; i++)
{
RenderableEntity rent = new RenderableEntity();
rent.Entity = ent;
rent.Renderable = rndbl;
renderworldrenderables.Add(rent);
}
else if (waitforchildrentoload)
{
//todo: render parent if children loading.......
var ent = renderworldentities[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))
{
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)

26
WorldForm.Designer.cs generated
View File

@ -109,6 +109,7 @@ namespace CodeWalker
this.tabPage4 = new System.Windows.Forms.TabPage();
this.OptionsTabControl = new System.Windows.Forms.TabControl();
this.tabPage8 = new System.Windows.Forms.TabPage();
this.RenderEntitiesCheckBox = new System.Windows.Forms.CheckBox();
this.AdvancedSettingsButton = new System.Windows.Forms.Button();
this.ControlSettingsButton = new System.Windows.Forms.Button();
this.MapViewDetailLabel = new System.Windows.Forms.Label();
@ -1295,6 +1296,7 @@ namespace CodeWalker
//
// tabPage8
//
this.tabPage8.Controls.Add(this.RenderEntitiesCheckBox);
this.tabPage8.Controls.Add(this.AdvancedSettingsButton);
this.tabPage8.Controls.Add(this.ControlSettingsButton);
this.tabPage8.Controls.Add(this.MapViewDetailLabel);
@ -1327,6 +1329,19 @@ namespace CodeWalker
this.tabPage8.Text = "General";
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
//
this.AdvancedSettingsButton.Location = new System.Drawing.Point(101, 456);
@ -1411,7 +1426,7 @@ namespace CodeWalker
this.WaterQuadsCheckBox.AutoSize = true;
this.WaterQuadsCheckBox.Checked = true;
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.Size = new System.Drawing.Size(114, 17);
this.WaterQuadsCheckBox.TabIndex = 39;
@ -1440,7 +1455,7 @@ namespace CodeWalker
// TimedEntitiesAlwaysOnCheckBox
//
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.Size = new System.Drawing.Size(58, 17);
this.TimedEntitiesAlwaysOnCheckBox.TabIndex = 37;
@ -1453,7 +1468,7 @@ namespace CodeWalker
this.GrassCheckBox.AutoSize = true;
this.GrassCheckBox.Checked = true;
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.Size = new System.Drawing.Size(81, 17);
this.GrassCheckBox.TabIndex = 35;
@ -1466,7 +1481,7 @@ namespace CodeWalker
this.InteriorsCheckBox.AutoSize = true;
this.InteriorsCheckBox.Checked = true;
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.Size = new System.Drawing.Size(92, 17);
this.InteriorsCheckBox.TabIndex = 38;
@ -1586,7 +1601,7 @@ namespace CodeWalker
this.TimedEntitiesCheckBox.AutoSize = true;
this.TimedEntitiesCheckBox.Checked = true;
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.Size = new System.Drawing.Size(117, 17);
this.TimedEntitiesCheckBox.TabIndex = 36;
@ -3581,5 +3596,6 @@ namespace CodeWalker
private System.Windows.Forms.ToolStripMenuItem ToolbarSnapToGroundGridButton;
private System.Windows.Forms.NumericUpDown SnapGridSizeUpDown;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.CheckBox RenderEntitiesCheckBox;
}
}

View File

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