Beispiel #1
0
 public static AvatarBones FromByteArray(byte[] array)
 {
     using (MemoryStream memoryStream = new MemoryStream(array))
     {
         using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
         {
             AvatarBones boneList = new AvatarBones();
             boneList.name      = binaryReader.ReadString();
             boneList.boneCount = binaryReader.ReadInt32();
             boneList.bones     = new SerializedBoneData[boneList.boneCount];
             for (int i = 0; i < boneList.boneCount; i++)
             {
                 boneList.bones[i] = SerializedBoneData.FromByteArray(binaryReader.ReadBytes(binaryReader.ReadInt32()));
             }
             return(boneList);
         }
     }
 }
Beispiel #2
0
 public static SerializedBoneData FromByteArray(byte[] array)
 {
     using (MemoryStream memoryStream = new MemoryStream(array))
     {
         using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
         {
             SerializedBoneData boneData = new SerializedBoneData();
             boneData.name       = binaryReader.ReadString();
             boneData.damping    = binaryReader.ReadSingle();
             boneData.elasticity = binaryReader.ReadSingle();
             boneData.stiffness  = binaryReader.ReadSingle();
             boneData.inert      = binaryReader.ReadSingle();
             boneData.radius     = binaryReader.ReadSingle();
             boneData.endLength  = binaryReader.ReadSingle();
             boneData.endOffset  = new float3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
             boneData.gravity    = new float3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
             boneData.force      = new float3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
             return(boneData);
         }
     }
 }