public static PmxIK Parse(BinaryReader br, PmxDocument doc) { return new PmxIK { TargetBone = doc.ReadBone(br), LoopCount = br.ReadInt32(), AngleLimitUnit = br.ReadSingle(), BindedBones = Enumerable.Range(0, br.ReadInt32()).Select(_ => PmxIKBinding.Parse(br, doc)).ToList(), }; }
public static PmxIKBinding Parse(BinaryReader br, PmxDocument doc) { var rt = new PmxIKBinding { Bone = doc.ReadBone(br), IsAngleLimitEnabled = br.ReadBoolean(), }; if (rt.IsAngleLimitEnabled) { rt.LowerAngleLimit = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; rt.HigherAngleLimit = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; } return rt; }
public static PmxDisplayItem Parse(BinaryReader br, PmxDocument doc) { switch ((PmxDisplayItemKind)br.ReadByte()) { case PmxDisplayItemKind.Bone: return new PmxBoneDisplayItem { Bone = doc.ReadBone(br), }; case PmxDisplayItemKind.Morph: return new PmxMorphDisplayItem { Morph = doc.ReadMorph(br), }; default: throw new InvalidOperationException(); } }
public override void Read(BinaryReader br, PmxDocument doc) { this.Bone = doc.ReadBone(br); this.MovementOffset = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; this.RotationOffset = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; }
public override void Read(BinaryReader br, PmxDocument doc) { this.Bones = Enumerable.Range(0, 2).Select(_ => doc.ReadBone(br)).ToArray(); this.Weight = br.ReadSingle(); }
public override void Read(BinaryReader br, PmxDocument doc) { this.Bone = doc.ReadBone(br); }
public static PmxRigidBody Parse(BinaryReader br, PmxDocument doc) { return new PmxRigidBody { Name = doc.ReadString(br), EnglishName = doc.ReadString(br), RelatedBone = doc.ReadBone(br), Group = br.ReadByte(), CollidableGroups = (PmdRigidGroups)br.ReadUInt16(), Shape = (PmdRigidShape)br.ReadByte(), Size = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }, Position = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }, Rotation = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }, Mass = br.ReadSingle(), LinearDamping = br.ReadSingle(), AngularDamping = br.ReadSingle(), Restitution = br.ReadSingle(), Friction = br.ReadSingle(), Kind = (PmxRigidKind)br.ReadByte(), }; }
public void Parse(BinaryReader br, PmxDocument doc) { this.Name = doc.ReadString(br); this.EnglishName = doc.ReadString(br); this.Position = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; this.ParentBone = doc.ReadBone(br); this.Priority = br.ReadInt32(); this.Capabilities = (PmxBoneCapabilities)br.ReadUInt16(); if (this.Capabilities.HasFlag(PmxBoneCapabilities.ConnectToBone)) this.ConnectToBone = doc.ReadBone(br); else this.ConnectToOffset = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; if (this.Capabilities.HasFlag(PmxBoneCapabilities.RotationAffected) || this.Capabilities.HasFlag(PmxBoneCapabilities.MovementAffected)) { this.AffectedBone = doc.ReadBone(br); this.AffectionRate = br.ReadSingle(); } if (this.Capabilities.HasFlag(PmxBoneCapabilities.FixedAxis)) this.FixedAxis = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; if (this.Capabilities.HasFlag(PmxBoneCapabilities.LocalAxis)) { this.LocalVectorX = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; this.LocalVectorZ = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() }; } if (this.Capabilities.HasFlag(PmxBoneCapabilities.TransformByExternalParent)) this.ExternalParentKey = br.ReadInt32(); if (this.Capabilities.HasFlag(PmxBoneCapabilities.IK)) this.IK = PmxIK.Parse(br, doc); }