private Bone ReadBone(IoBuffer reader) { var bone = new Bone(); bone.Unknown = reader.ReadInt32(); bone.Name = reader.ReadPascalString(); bone.ParentName = reader.ReadPascalString(); bone.HasProps = reader.ReadByte(); if (bone.HasProps != 0) { var propertyCount = reader.ReadInt32(); var property = new PropertyListItem(); for (var i = 0; i < propertyCount; i++) { var pairCount = reader.ReadInt32(); for (var x = 0; x < pairCount; x++) { property.KeyPairs.Add(new KeyValuePair <string, string>( reader.ReadPascalString(), reader.ReadPascalString() )); } } bone.Properties.Add(property); } var xx = -reader.ReadFloat(); bone.Translation = new Vector3( xx, reader.ReadFloat(), reader.ReadFloat() ); bone.Rotation = new Quaternion( reader.ReadFloat(), -reader.ReadFloat(), -reader.ReadFloat(), -reader.ReadFloat() ); bone.CanTranslate = reader.ReadInt32(); bone.CanRotate = reader.ReadInt32(); bone.CanBlend = reader.ReadInt32(); bone.WiggleValue = reader.ReadFloat(); bone.WigglePower = reader.ReadFloat(); return(bone); }
private PropertyList ReadPropertyList(IoBuffer io) { var propsCount = io.ReadUInt32(); var result = new PropertyListItem[propsCount]; for (var y = 0; y < propsCount; y++) { var item = new PropertyListItem(); var pairsCount = io.ReadUInt32(); for (var z = 0; z < pairsCount; z++) { item.KeyPairs.Add(new KeyValuePair <string, string>( io.ReadPascalString(), io.ReadPascalString() )); } result[y] = item; } return(new PropertyList { Items = result }); }
/// <summary> /// Reads a bone from a IOBuffer. /// </summary> /// <param name="reader">An IOBuffer instance used to read from a stream holding a skeleton.</param> /// <returns>A Bone instance.</returns> private Bone ReadBone(IoBuffer reader) { var bone = new Bone(); bone.Unknown = reader.ReadInt32(); bone.Name = reader.ReadPascalString(); bone.ParentName = reader.ReadPascalString(); bone.HasProps = reader.ReadByte(); if (bone.HasProps != 0) { var propertyCount = reader.ReadInt32(); var property = new PropertyListItem(); for (var i = 0; i < propertyCount; i++) { var pairCount = reader.ReadInt32(); for (var x = 0; x < pairCount; x++) { property.KeyPairs.Add(new KeyValuePair<string, string>( reader.ReadPascalString(), reader.ReadPascalString() )); } } bone.Properties.Add(property); } var xx = -reader.ReadFloat(); bone.Translation = new Vector3( xx, reader.ReadFloat(), reader.ReadFloat() ); bone.Rotation = new Quaternion( reader.ReadFloat(), -reader.ReadFloat(), -reader.ReadFloat(), -reader.ReadFloat() ); bone.CanTranslate = reader.ReadInt32(); bone.CanRotate = reader.ReadInt32(); bone.CanBlend = reader.ReadInt32(); bone.WiggleValue = reader.ReadFloat(); bone.WigglePower = reader.ReadFloat(); return bone; }
/// <summary> /// Reads a property list from a stream. /// </summary> /// <param name="io">IOBuffer instance used to read an animation.</param> /// <returns>A PropertyList instance.</returns> private PropertyList ReadPropertyList(IoBuffer io) { var propsCount = io.ReadUInt32(); var result = new PropertyListItem[propsCount]; for (var y = 0; y < propsCount; y++) { var item = new PropertyListItem(); var pairsCount = io.ReadUInt32(); for (var z = 0; z < pairsCount; z++) { item.KeyPairs.Add(new KeyValuePair<string, string>( io.ReadPascalString(), io.ReadPascalString() )); } result[y] = item; } return new PropertyList { Items = result }; }