1
0
mirror of synced 2024-11-14 11:07:39 +01:00

Default bc7 compression mode to fast

This commit is contained in:
KillzXGaming 2019-05-20 18:22:25 -04:00
parent cedaac5518
commit 0536f1a225
8 changed files with 37 additions and 5 deletions

Binary file not shown.

View File

@ -611,6 +611,9 @@ namespace Bfres.Structs
Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.WaitCursor;
bool ForceSkinInfluence = false;
int ForceSkinInfluenceMax = 4;
foreach (STGenericObject obj in csvModel.objects) foreach (STGenericObject obj in csvModel.objects)
{ {
FSHP shape = new FSHP(); FSHP shape = new FSHP();
@ -625,7 +628,7 @@ namespace Bfres.Structs
shape.Text = obj.ObjectName; shape.Text = obj.ObjectName;
shape.lodMeshes = obj.lodMeshes; shape.lodMeshes = obj.lodMeshes;
shape.CreateNewBoundingBoxes(); shape.CreateNewBoundingBoxes();
shape.CreateBoneList(obj, this); shape.CreateBoneList(obj, this, ForceSkinInfluence, ForceSkinInfluenceMax);
shape.CreateIndexList(obj, this); shape.CreateIndexList(obj, this);
shape.ApplyImportSettings(csvsettings, GetMaterial(shape.MaterialIndex)); shape.ApplyImportSettings(csvsettings, GetMaterial(shape.MaterialIndex));
shape.BoneIndices = shape.GetIndices(Skeleton); shape.BoneIndices = shape.GetIndices(Skeleton);
@ -925,6 +928,10 @@ namespace Bfres.Structs
Console.WriteLine("Processing Data. Object count " + assimp.objects.Count); Console.WriteLine("Processing Data. Object count " + assimp.objects.Count);
bool ForceSkinInfluence = true;
int ForceSkinInfluenceMax = 4;
int curShp = 0; int curShp = 0;
foreach (STGenericObject obj in assimp.objects) foreach (STGenericObject obj in assimp.objects)
{ {
@ -970,7 +977,7 @@ namespace Bfres.Structs
progressBar.Task = $"Creating Bone list. Mesh: {obj.ObjectName}"; progressBar.Task = $"Creating Bone list. Mesh: {obj.ObjectName}";
progressBar.Refresh(); progressBar.Refresh();
shape.CreateBoneList(obj, this); shape.CreateBoneList(obj, this, ForceSkinInfluence, ForceSkinInfluenceMax);
progressBar.Task = $"Creating Index list. Mesh: {obj.ObjectName}"; progressBar.Task = $"Creating Index list. Mesh: {obj.ObjectName}";
progressBar.Refresh(); progressBar.Refresh();

View File

@ -707,7 +707,7 @@ namespace Bfres.Structs
Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.WaitCursor;
VertexBufferIndex = obj.VertexBufferIndex; VertexBufferIndex = obj.VertexBufferIndex;
vertices = obj.vertices; vertices = obj.vertices;
CreateBoneList(obj, (FMDL)Parent.Parent); CreateBoneList(obj, (FMDL)Parent.Parent, false);
CreateIndexList(obj, (FMDL)Parent.Parent); CreateIndexList(obj, (FMDL)Parent.Parent);
VertexSkinCount = obj.GetMaxSkinInfluenceCount(); VertexSkinCount = obj.GetMaxSkinInfluenceCount();
vertexAttributes = settings.CreateNewAttributes(); vertexAttributes = settings.CreateNewAttributes();
@ -756,7 +756,7 @@ namespace Bfres.Structs
} }
} }
} }
public void CreateBoneList(STGenericObject ob, FMDL mdl) public void CreateBoneList(STGenericObject ob, FMDL mdl, bool ForceSkinCount, int ForcedSkinAmount = 4)
{ {
if (mdl.Skeleton.Node_Array == null) if (mdl.Skeleton.Node_Array == null)
mdl.Skeleton.Node_Array = new int[0]; mdl.Skeleton.Node_Array = new int[0];
@ -774,6 +774,19 @@ namespace Bfres.Structs
List<string> BonesNotMatched = new List<string>(); List<string> BonesNotMatched = new List<string>();
if (ForceSkinCount && !ob.HasIndices)
{
var attributeIndex = new FSHP.VertexAttribute();
attributeIndex.Format = ResGFX.AttribFormat.Format_8_8_8_8_UInt;
attributeIndex.Name = "_i0";
vertexAttributes.Add(attributeIndex);
var attributeWeight = new FSHP.VertexAttribute();
attributeWeight.Format = ResGFX.AttribFormat.Format_32_32_32_32_Single;
attributeWeight.Name = "_w0";
vertexAttributes.Add(attributeWeight);
}
int vtxIndex = 0; int vtxIndex = 0;
foreach (Vertex v in ob.vertices) foreach (Vertex v in ob.vertices)
{ {
@ -822,6 +835,18 @@ namespace Bfres.Structs
} }
} }
if (ForceSkinCount)
{
for (int i = 0; i < ForcedSkinAmount; i++)
{
if (v.boneIds.Count < ForcedSkinAmount)
{
v.boneIds.Add(0);
v.boneWeights.Add(1);
}
}
}
vtxIndex++; vtxIndex++;
} }

View File

@ -85,7 +85,7 @@ namespace FirstPlugin
compressionModeCB.SelectedIndex = 1; compressionModeCB.SelectedIndex = 0;
compressionModeCB.Enabled = false; compressionModeCB.Enabled = false;