public void AddDummyPoly(FLVER2.Dummy dmy) { lock (_lock_everything_monkaS) { var di = new DummyPolyInfo(dmy, MODEL.Skeleton); DummyPoly.Add(di); if (!_dummyPolyByRefID.ContainsKey(dmy.ReferenceID)) { _dummyPolyByRefID.Add(dmy.ReferenceID, new List <DummyPolyInfo>()); } if (!_dummyPolyByRefID[dmy.ReferenceID].Contains(di)) { _dummyPolyByRefID[dmy.ReferenceID].Add(di); } if (!_dummyPolyByBoneID.ContainsKey(dmy.AttachBoneIndex)) { _dummyPolyByBoneID.Add(dmy.AttachBoneIndex, new List <DummyPolyInfo>()); } if (!_dummyPolyByBoneID[dmy.AttachBoneIndex].Contains(di)) { _dummyPolyByBoneID[dmy.AttachBoneIndex].Add(di); } } }
//public IDbgPrim AddHitbox(int dmy1, int dmy2, float radius) //{ // if (dmy1 >= 0 && dmy2 < 0) // { // var dummy1 = DummyPoly.First(d => d.ReferenceID == dmy1); // return AddHitboxSphere(dummy1, radius); // } // else if (dmy1 < 0 && dmy2 >= 0) // { // var dummy2 = DummyPoly.First(d => d.ReferenceID == dmy2); // return AddHitboxSphere(dummy2, radius); // } // else if (dmy1 >= 0 && dmy2 >= 0) // { // var dummy1 = DummyPoly.First(d => d.ReferenceID == dmy1); // var dummy2 = DummyPoly.First(d => d.ReferenceID == dmy2); // return AddHitboxCapsule(dummy1, dummy2, radius); // } // return null; //} //private DbgPrimWireCapsule AddHitboxCapsule(FLVER2.Dummy dmy1, FLVER2.Dummy dmy2, float radius) //{ // Vector3 dmy1Pos = GetDummyPosition(dmy1); // Vector3 dmy2Pos = GetDummyPosition(dmy2); // Vector3 dummyDif = dmy2Pos - dmy1Pos; // Quaternion capsuleAngle = Quaternion.CreateFromAxisAngle(Vector3.Normalize(dummyDif), 0); // float capsuleLength = dummyDif.Length(); // var capsule = new DbgPrimWireCapsule(new Transform() // { // OverrideMatrixWorld = Matrix.CreateFromQuaternion(capsuleAngle) // * Matrix.CreateTranslation(dmy1Pos) // }, capsuleLength, radius, 24, Color.White) // { // Category = DbgPrimCategory.DummyPolyHelper, // OverrideColor = Color.Red, // }; // Children.Add(capsule); // return capsule; //} //private DbgPrimWireSphere AddHitboxSphere(FLVER2.Dummy dmy, float radius) //{ // Vector3 dmyPos = GetDummyPosition(dmy); // var sphere = new DbgPrimWireSphere(new Transform() // { // OverrideMatrixWorld = Matrix.CreateTranslation(dmyPos) // }, radius, 24, 24, Color.White) // { // Category = DbgPrimCategory.DummyPolyHelper, // OverrideColor = Color.Red, // }; // Children.Add(sphere); // return sphere; //} public Vector3 GetDummyPosition(FLVER2.Dummy dmy, bool isAbsolute) { var m = GetDummyPolyMatrix(dmy); if (isAbsolute) { m *= Transform.WorldMatrix; } return(Vector3.Transform(Vector3.Zero, m)); }
//public int ID { get; private set; } //private float _helperSize; //public float HelperSize //{ // get => _helperSize; // set // { // if (value > 0) // { // if (!Children.Contains(Helper)) // Children.Add(Helper); // } // else if (value <= 0) // { // if (Children.Contains(Helper)) // Children.Remove(Helper); // } // _helperSize = value; // } //} Matrix GetDummyPolyMatrix(FLVER2.Dummy dummy, bool useScale = true) { var dummyMatrix = GetBoneParentMatrix(BoneList[dummy.DummyBoneIndex]); return((useScale ? Matrix.CreateScale(RenderSize * GlobalRenderSizeMult) : Matrix.Identity) * Matrix.CreateLookAt( Vector3.Zero, new Vector3(dummy.Forward.X, dummy.Forward.Y, dummy.Forward.Z), dummy.UseUpwardVector ? new Vector3(dummy.Upward.X, dummy.Upward.Y, dummy.Upward.Z) : Vector3.Up) * Matrix.CreateTranslation(new Vector3(dummy.Position.X, dummy.Position.Y, dummy.Position.Z)) * dummyMatrix); }
private void AddDummy(FLVER2.Dummy dummy) { float forwardLength = dummy.Forward.Length(); var m = GetDummyPolyMatrix(dummy); //var dummyMatrix = GetBoneParentMatrix(BoneList[dummy.DummyBoneIndex]); //Children.Add(new DbgPrimWireSphere(new Transform(Vector3.Transform(Vector3.Zero, m), Vector3.Zero), 1, 24, 24, Color.White) //{ // Category = DbgPrimCategory.DummyPolyHelper, // OverrideColor = Color.Red, // ExtraData = dummy.ReferenceID, //}); AddLine(Vector3.Transform(Vector3.Zero, m), Vector3.Transform(Vector3.Up * forwardLength * 1.5f, m), Color.Lime); AddLine(Vector3.Transform(Vector3.Zero, m), Vector3.Transform(Vector3.Forward * forwardLength * 1.5f, m), Color.Blue); AddLine(Vector3.Transform(Vector3.Zero, m), Vector3.Transform(Vector3.Left * forwardLength * 1.5f, m), Color.Red); AddDbgLabel(m, 1, dummy.ReferenceID.ToString(), new Color(dummy.Color.R, dummy.Color.G, dummy.Color.B, dummy.Color.A)); }
public DummyPolyInfo(FLVER2.Dummy dmy, NewAnimSkeleton skeleton) { ReferenceID = dmy.ReferenceID; FollowBoneIndex = dmy.AttachBoneIndex; ReferenceMatrix = Matrix.CreateWorld( Vector3.Zero, Vector3.Normalize(new Vector3(dmy.Forward.X, dmy.Forward.Y, dmy.Forward.Z)), dmy.UseUpwardVector ? Vector3.Normalize(new Vector3(dmy.Upward.X, dmy.Upward.Y, dmy.Upward.Z)) : Vector3.Up) * Matrix.CreateTranslation(new Vector3(dmy.Position.X, dmy.Position.Y, dmy.Position.Z)) * (dmy.DummyBoneIndex >= 0 ? skeleton.FlverSkeleton[dmy.DummyBoneIndex].ReferenceMatrix : Matrix.Identity); CurrentMatrix = ReferenceMatrix; ArrowPrimitive = new DbgPrimWireArrow("DummyPoly Spawns", Transform.Default, Color.White) { //Wireframe = true, //BackfaceCulling = true, //DisableLighting = true, Category = DbgPrimCategory.DummyPolySpawnArrow, OverrideColor = Color.Cyan, }; SpawnPrinter.Font = DBG.DEBUG_FONT_SMALL; SpawnPrinter.FullyOutlined = true; }