BFRES : Add option to create dummy LODs that point to first level.
This commit is contained in:
parent
7c75bb3a47
commit
f345e5ec59
@ -174,6 +174,7 @@ namespace Bfres.Structs
|
|||||||
|
|
||||||
ToolStripMenuItem lodMenu = new ToolStripMenuItem("Level Of Detail");
|
ToolStripMenuItem lodMenu = new ToolStripMenuItem("Level Of Detail");
|
||||||
lodMenu.DropDownItems.Add(new ToolStripMenuItem("Clear LOD Meshes", null, ClearLODMeshes));
|
lodMenu.DropDownItems.Add(new ToolStripMenuItem("Clear LOD Meshes", null, ClearLODMeshes));
|
||||||
|
lodMenu.DropDownItems.Add(new ToolStripMenuItem("Add dummy LOD Meshes", null, GenerateDummyLODMeshesAction));
|
||||||
Items.Add(lodMenu);
|
Items.Add(lodMenu);
|
||||||
|
|
||||||
ToolStripMenuItem boundingsMenu = new ToolStripMenuItem("Boundings");
|
ToolStripMenuItem boundingsMenu = new ToolStripMenuItem("Boundings");
|
||||||
@ -355,6 +356,38 @@ namespace Bfres.Structs
|
|||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GenerateDummyLODMeshesAction(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
|
GenerateDummyLODMeshes();
|
||||||
|
Cursor.Current = Cursors.Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateDummyLODMeshes()
|
||||||
|
{
|
||||||
|
var mesh = lodMeshes.FirstOrDefault();
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (lodMeshes.Count >= 3)
|
||||||
|
break;
|
||||||
|
|
||||||
|
LOD_Mesh lod = new LOD_Mesh();
|
||||||
|
lod.faces.AddRange(mesh.faces);
|
||||||
|
lod.IndexFormat = mesh.IndexFormat;
|
||||||
|
lodMeshes.Add(lod);
|
||||||
|
|
||||||
|
var subMesh = new LOD_Mesh.SubMesh();
|
||||||
|
subMesh.offset = mesh.subMeshes[0].offset;
|
||||||
|
subMesh.size = mesh.subMeshes[0].size;
|
||||||
|
lod.subMeshes.Add(subMesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateNewBoundingBoxes();
|
||||||
|
SaveShape(GetResFileU() != null);
|
||||||
|
UpdateVertexData();
|
||||||
|
GenerateBoundingNodes();
|
||||||
|
}
|
||||||
|
|
||||||
private void GenerateLODMeshes(object sender, EventArgs args)
|
private void GenerateLODMeshes(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
Cursor.Current = Cursors.WaitCursor;
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
|
@ -167,16 +167,11 @@ namespace FirstPlugin
|
|||||||
faceList.Add((uint)f);
|
faceList.Add((uint)f);
|
||||||
}
|
}
|
||||||
if (faceList.Count > 65000)
|
if (faceList.Count > 65000)
|
||||||
{
|
|
||||||
MessageBox.Show($"Warning! Your poly count for a single mesh {fshp.Text} is pretty high! ({faceList.Count})." +
|
|
||||||
$" You may want to split this!");
|
|
||||||
msh.SetIndices(faceList, IndexFormat.UInt32);
|
msh.SetIndices(faceList, IndexFormat.UInt32);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
msh.SetIndices(faceList, IndexFormat.UInt16);
|
msh.SetIndices(faceList, IndexFormat.UInt16);
|
||||||
|
|
||||||
Shape.Meshes.Add(msh);
|
Shape.Meshes.Add(msh);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return Shape;
|
return Shape;
|
||||||
}
|
}
|
||||||
|
@ -936,15 +936,12 @@ namespace FirstPlugin
|
|||||||
}
|
}
|
||||||
if (faceList.Count > 65000)
|
if (faceList.Count > 65000)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"Warning! Your poly count for a single mesh {fshp.Text} is pretty high! ({faceList.Count})." +
|
|
||||||
$" You may want to split this!");
|
|
||||||
msh.SetIndices(faceList, GX2IndexFormat.UInt32);
|
msh.SetIndices(faceList, GX2IndexFormat.UInt32);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
msh.SetIndices(faceList, GX2IndexFormat.UInt16);
|
msh.SetIndices(faceList, GX2IndexFormat.UInt16);
|
||||||
|
|
||||||
ShapeU.Meshes.Add(msh);
|
ShapeU.Meshes.Add(msh);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return ShapeU;
|
return ShapeU;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user