public static SHP1 Create(Scene scene, Dictionary <string, int> boneNames, VertexData vertData, EVP1 evp1, DRW1 drw1, string tristrip_mode = "static") { SHP1 shp1 = new SHP1(scene, vertData, boneNames, evp1, drw1, tristrip_mode); return(shp1); }
private SHP1(Assimp.Scene scene, VertexData vertData, Dictionary <string, int> boneNames, EVP1 envelopes, DRW1 partialWeight, string tristrip_mode = "static") { Shapes = new List <Shape>(); RemapTable = new List <int>(); foreach (Mesh mesh in scene.Meshes) { Shape meshShape = new Shape(); meshShape.SetDescriptorAttributes(mesh, boneNames.Count); if (boneNames.Count > 1) { meshShape.ProcessVerticesWithWeights(mesh, vertData, boneNames, envelopes, partialWeight, tristrip_mode == "all"); } else { meshShape.ProcessVerticesWithoutWeights(mesh, vertData); partialWeight.WeightTypeCheck.Add(false); partialWeight.Indices.Add(0); } Shapes.Add(meshShape); } }
public void SetVertexWeights(EVP1 envelopes, DRW1 drawList) { for (int i = 0; i < Shapes.Count; i++) { for (int j = 0; j < Shapes[i].Packets.Count; j++) { foreach (Primitive prim in Shapes[i].Packets[j].Primitives) { foreach (Vertex vert in prim.Vertices) { if (Shapes[i].Descriptor.CheckAttribute(GXVertexAttribute.PositionMatrixIdx)) { int drw1Index = Shapes[i].Packets[j].MatrixIndices[(int)vert.PositionMatrixIDxIndex]; int curPacketIndex = j; while (drw1Index == -1) { curPacketIndex--; drw1Index = Shapes[i].Packets[curPacketIndex].MatrixIndices[(int)vert.PositionMatrixIDxIndex]; } if (drawList.WeightTypeCheck[(int)drw1Index]) { int evp1Index = drawList.Indices[(int)drw1Index]; vert.SetWeight(envelopes.Weights[evp1Index]); } else { Weight vertWeight = new Weight(); vertWeight.AddWeight(1.0f, drawList.Indices[(int)drw1Index]); vert.SetWeight(vertWeight); } } else { Weight vertWeight = new Weight(); vertWeight.AddWeight(1.0f, drawList.Indices[Shapes[i].Packets[j].MatrixIndices[0]]); vert.SetWeight(vertWeight); } } } } } }
public static SHP1 Create(Scene scene, Dictionary <string, int> boneNames, VertexData vertData, EVP1 evp1, DRW1 drw1, string tristrip_mode = "static", bool degenerateTriangles = false) { SHP1 shp1 = new SHP1(scene, vertData, boneNames, evp1, drw1, tristrip_mode, degenerateTriangles); return(shp1); }
private SHP1(Assimp.Scene scene, VertexData vertData, Dictionary <string, int> boneNames, EVP1 envelopes, DRW1 partialWeight, string tristripMode = "static", bool degenerateTriangles = false) { Shapes = new List <Shape>(); RemapTable = new List <int>(); foreach (Mesh mesh in scene.Meshes) { Console.Write(mesh.Name + ": "); Shape meshShape; /*if (mesh.Name.Contains("Bill0")) { * meshShape = new Shape(0); // Matrix Type 0, unknown * }*/ if (mesh.Name.Contains("BillXY")) { meshShape = new Shape(MatrixType.BillboardXY); // Matrix Type 1, XY Billboard Console.Write("Billboarding on the X & Y axis"); } else if (mesh.Name.Contains("BillX")) { meshShape = new Shape(MatrixType.BillboardX); // Matrix Type 2, X Billboard, i.e. the X axis is always turned towards camera Console.Write("Billboarding on the X axis"); } else { meshShape = new Shape(); // Matrix Type 3, normal Console.Write("Normal Mesh"); } meshShape.SetDescriptorAttributes(mesh, boneNames.Count); if (boneNames.Count > 1) { meshShape.ProcessVerticesWithWeights(mesh, vertData, boneNames, envelopes, partialWeight, tristripMode == "all", degenerateTriangles); } else { meshShape.ProcessVerticesWithoutWeights(mesh, vertData, degenerateTriangles); partialWeight.WeightTypeCheck.Add(false); partialWeight.Indices.Add(0); } Shapes.Add(meshShape); Console.WriteLine(); } }