Beispiel #1
0
 public FrameObjectModel(FrameObjectModel other) : base(other)
 {
     blendInfoIndex        = other.blendInfoIndex;
     skeletonIndex         = other.skeletonIndex;
     skeletonHierachyIndex = other.skeletonHierachyIndex;
     skeleton  = other.skeleton;
     blendInfo = other.blendInfo;
     restPose  = new TransformMatrix[skeleton.NumBones[0]];
     for (int i = 0; i != restPose.Length; i++)
     {
         restPose[i] = new TransformMatrix(other.restPose[i]);
     }
     unkTrasform          = other.unkTrasform;
     attachmentReferences = new AttachmentReference[other.attachmentReferences.Length];
     for (int i = 0; i != attachmentReferences.Length; i++)
     {
         attachmentReferences[i] = new AttachmentReference(other.attachmentReferences[i]);
     }
     unkFlags        = other.unkFlags;
     physSplitSize   = other.physSplitSize;
     hitBoxSize      = other.hitBoxSize;
     nPhysSplits     = other.nPhysSplits;
     blendMeshSplits = new WeightedByMeshSplit[nPhysSplits];
     for (int i = 0; i != blendMeshSplits.Length; i++)
     {
         blendMeshSplits[i] = new WeightedByMeshSplit(other.blendMeshSplits[i]);
     }
     hitBoxInfo = new HitBoxInfo[other.hitBoxInfo.Length];
     for (int i = 0; i != hitBoxInfo.Length; i++)
     {
         hitBoxInfo[i] = new HitBoxInfo(hitBoxInfo[i]);
     }
 }
Beispiel #2
0
 public WeightedByMeshSplit(WeightedByMeshSplit other)
 {
     blendIndex = other.blendIndex;
     data       = new BlendMeshSplitInfo[other.data.Length];
     for (int i = 0; i != other.data.Length; i++)
     {
         data[i] = other.data[i];
     }
     jointName = other.jointName;
 }
        public void ReadFromFilePart2(BinaryReader reader, FrameSkeleton skeleton, FrameBlendInfo blendInfo)
        {
            this.skeleton  = skeleton;
            this.blendInfo = blendInfo;

            //do rest matrices.
            restPose = new TransformMatrix[skeleton.NumBones[0]];
            for (int i = 0; i != restPose.Length; i++)
            {
                restPose[i] = new TransformMatrix(reader);
            }

            //unknown transform.
            unkTrasform = new TransformMatrix(reader);

            //attachments.
            int length1 = reader.ReadInt32();

            attachmentReferences = new AttachmentReference[length1];

            for (int i = 0; i != length1; i++)
            {
                attachmentReferences[i] = new AttachmentReference(reader);
            }

            //unknwon.
            unkFlags      = reader.ReadUInt32();
            physSplitSize = reader.ReadInt32();
            hitBoxSize    = reader.ReadInt32();

            if (physSplitSize > 0)
            {
                nPhysSplits = reader.ReadInt16();
            }
            else
            {
                nPhysSplits = 0;
            }

            int totalSplits = 0;

            blendMeshSplits = new WeightedByMeshSplit[nPhysSplits];
            for (int i = 0; i != nPhysSplits; i++)
            {
                blendMeshSplits[i] = new WeightedByMeshSplit(reader);
                totalSplits       += blendMeshSplits[i].Data.Length;
            }

            hitBoxInfo = new HitBoxInfo[totalSplits];
            for (int i = 0; i != hitBoxInfo.Length; i++)
            {
                hitBoxInfo[i] = new HitBoxInfo(reader);
            }
        }
        public void ReadFromFilePart2(MemoryStream stream, bool isBigEndian)
        {
            //do rest matrices.
            restTransform = new Matrix[skeleton.NumBones[0]];
            for (int i = 0; i != restTransform.Length; i++)
            {
                restTransform[i] = MatrixExtensions.ReadFromFile(stream, isBigEndian);
            }


            //unknown transform.
            unkTransform = MatrixExtensions.ReadFromFile(stream, isBigEndian);

            //attachments.
            int length1 = stream.ReadInt32(isBigEndian);

            attachmentReferences = new AttachmentReference[length1];

            for (int i = 0; i != length1; i++)
            {
                attachmentReferences[i] = new AttachmentReference(stream, isBigEndian);
            }

            //unknwon.
            unkFlags      = stream.ReadUInt32(isBigEndian);
            physSplitSize = stream.ReadInt32(isBigEndian);
            hitBoxSize    = stream.ReadInt32(isBigEndian);

            if (physSplitSize > 0)
            {
                nPhysSplits = stream.ReadInt16(isBigEndian);
            }
            else
            {
                nPhysSplits = 0;
            }

            int totalSplits = 0;

            blendMeshSplits = new WeightedByMeshSplit[nPhysSplits];
            for (int i = 0; i != nPhysSplits; i++)
            {
                blendMeshSplits[i] = new WeightedByMeshSplit(stream, isBigEndian);
                int index = blendInfo.BoneIndexInfos[0].IDs[blendMeshSplits[i].BlendIndex];
                blendMeshSplits[i].JointName = skeleton.BoneNames[index].ToString();
                totalSplits += blendMeshSplits[i].Data.Length;
            }

            hitBoxInfo = new HitBoxInfo[totalSplits];
            for (int i = 0; i != hitBoxInfo.Length; i++)
            {
                hitBoxInfo[i] = new HitBoxInfo(stream, isBigEndian);
            }
        }