Handle mouse back/forward in RPF Explorer, Fix 2D mode ymap frustum culling, Added Disable embedded collisions flag name on Entity form

This commit is contained in:
dexy 2019-03-30 03:30:45 +11:00
parent 60b1570930
commit 4559312f1c
4 changed files with 50 additions and 14 deletions

View File

@ -349,5 +349,21 @@ namespace CodeWalker.World
}
return true;
}
public bool ContainsAABBNoFrontClipNoOpt(ref Vector3 bmin, ref Vector3 bmax)
{
var c = (bmax + bmin) * 0.5f - Position;
var e = (bmax - bmin) * 0.5f;
for (int i = 0; i < 4; i++)
{
var pd = Planes[i].D;
var pn = Planes[i].Normal;
var d = (c.X * pn.X) + (c.Y * pn.Y) + (c.Z * pn.Z);
var r = (e.X * (pn.X > 0 ? pn.X : -pn.X)) + (e.Y * (pn.Y > 0 ? pn.Y : -pn.Y)) + (e.Z * (pn.Z > 0 ? pn.Z : -pn.Z));
if ((d + r) < -pd) return false;
//if ((d - r) < -pd) ; //intersecting
}
return true;
}
}
}

View File

@ -3039,6 +3039,17 @@ namespace CodeWalker
protected override void WndProc(ref Message m)
{
//handle back/forward buttons globally for all the form
if (m.Msg == 0x319) //WM_APPCOMMAND
{
var cmd = (m.LParam.ToInt64() >> 16) & 0xFFF;
if (cmd == 1) GoBack(); //APPCOMMAND_BROWSER_BACKWARD
if (cmd == 2) GoForward(); //APPCOMMAND_BROWSER_FORWARD
}
base.WndProc(ref m);
}
private void ExploreForm_Load(object sender, EventArgs e)

View File

@ -31,6 +31,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditYmapEntityPanel));
this.EntityTabControl = new System.Windows.Forms.TabControl();
this.EntityGeneralTabPage = new System.Windows.Forms.TabPage();
this.EntityEditArchetypeButton = new System.Windows.Forms.Button();
this.EntityFlagsCheckedListBox = new System.Windows.Forms.CheckedListBox();
this.label13 = new System.Windows.Forms.Label();
this.label28 = new System.Windows.Forms.Label();
@ -91,7 +92,6 @@
this.label4 = new System.Windows.Forms.Label();
this.MiloEntitySetsListBox = new System.Windows.Forms.CheckedListBox();
this.label2 = new System.Windows.Forms.Label();
this.EntityEditArchetypeButton = new System.Windows.Forms.Button();
this.EntityTabControl.SuspendLayout();
this.EntityGeneralTabPage.SuspendLayout();
this.EntityLodTabPage.SuspendLayout();
@ -161,6 +161,17 @@
this.EntityGeneralTabPage.Text = "General";
this.EntityGeneralTabPage.UseVisualStyleBackColor = true;
//
// EntityEditArchetypeButton
//
this.EntityEditArchetypeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.EntityEditArchetypeButton.Location = new System.Drawing.Point(454, 59);
this.EntityEditArchetypeButton.Name = "EntityEditArchetypeButton";
this.EntityEditArchetypeButton.Size = new System.Drawing.Size(95, 23);
this.EntityEditArchetypeButton.TabIndex = 35;
this.EntityEditArchetypeButton.Text = "Edit Archetype...";
this.EntityEditArchetypeButton.UseVisualStyleBackColor = true;
this.EntityEditArchetypeButton.Click += new System.EventHandler(this.EntityEditArchetypeButton_Click);
//
// EntityFlagsCheckedListBox
//
this.EntityFlagsCheckedListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -170,7 +181,7 @@
this.EntityFlagsCheckedListBox.Items.AddRange(new object[] {
"1 - Allow full rotation",
"2 - Unk02",
"4 - Unk03",
"4 - Disable embedded collisions",
"8 - Unk04",
"16 - Unk05",
"32 - Static entity",
@ -793,17 +804,6 @@
this.label2.TabIndex = 3;
this.label2.Text = "DefaultEntitySets:";
//
// EntityEditArchetypeButton
//
this.EntityEditArchetypeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.EntityEditArchetypeButton.Location = new System.Drawing.Point(454, 59);
this.EntityEditArchetypeButton.Name = "EntityEditArchetypeButton";
this.EntityEditArchetypeButton.Size = new System.Drawing.Size(95, 23);
this.EntityEditArchetypeButton.TabIndex = 35;
this.EntityEditArchetypeButton.Text = "Edit Archetype...";
this.EntityEditArchetypeButton.UseVisualStyleBackColor = true;
this.EntityEditArchetypeButton.Click += new System.EventHandler(this.EntityEditArchetypeButton_Click);
//
// EditYmapEntityPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -1676,7 +1676,16 @@ namespace CodeWalker.Rendering
{
var eemin = ymap._CMapData.entitiesExtentsMin;
var eemax = ymap._CMapData.entitiesExtentsMax;
if (!camera.ViewFrustum.ContainsAABBNoClipNoOpt(ref eemin, ref eemax))
bool visible = false;
if (MapViewEnabled)//don't do front clipping in 2D mode
{
visible = camera.ViewFrustum.ContainsAABBNoFrontClipNoOpt(ref eemin, ref eemax);
}
else
{
visible = camera.ViewFrustum.ContainsAABBNoClipNoOpt(ref eemin, ref eemax);
}
if (!visible)
{
return false;
}