public void ReadCompiledBone_900(BinaryReader b) { ControllerID = b.ReadUInt32(); // unique id of bone (generated from bone name) limbID = b.ReadInt32(); offsetParent = b.ReadInt32(); Quaternion relativeQuat = new Quaternion { x = b.ReadSingle(), y = b.ReadSingle(), z = b.ReadSingle(), w = b.ReadSingle() }; Vector3 relativeTransform = new Vector3 { x = b.ReadSingle(), y = b.ReadSingle(), z = b.ReadSingle() }; Quaternion worldQuat = new Quaternion { x = b.ReadSingle(), y = b.ReadSingle(), z = b.ReadSingle(), w = b.ReadSingle() }; Vector3 worldTransform = new Vector3 { x = b.ReadSingle(), y = b.ReadSingle(), z = b.ReadSingle() }; worldToBone = new WORLDTOBONE(worldQuat.ConvertToRotationalMatrix(), worldTransform); boneToWorld = new BONETOWORLD(relativeQuat.ConvertToRotationalMatrix(), relativeTransform); }
public void ReadCompiledBone_801(BinaryReader b) { // Reads just a single 3xx byte entry of a bone. ControllerID = b.ReadUInt32(); // unique id of bone (generated from bone name) limbID = b.ReadInt32(); b.BaseStream.Seek(208, SeekOrigin.Current); boneName = b.ReadFString(48); offsetParent = b.ReadInt32(); numChildren = b.ReadUInt32(); offsetChild = b.ReadInt32(); // TODO: This may be quaternion and translation vectors. boneToWorld = new BONETOWORLD(); boneToWorld.ReadBoneToWorld(b); worldToBone = new WORLDTOBONE(); worldToBone.worldToBone = new double[3, 4]; worldToBone.worldToBone[0, 0] = boneToWorld.boneToWorld[0, 0]; worldToBone.worldToBone[0, 1] = boneToWorld.boneToWorld[0, 1]; worldToBone.worldToBone[0, 2] = boneToWorld.boneToWorld[0, 2]; worldToBone.worldToBone[0, 3] = boneToWorld.boneToWorld[0, 3]; worldToBone.worldToBone[1, 0] = boneToWorld.boneToWorld[1, 0]; worldToBone.worldToBone[1, 1] = boneToWorld.boneToWorld[1, 1]; worldToBone.worldToBone[1, 2] = boneToWorld.boneToWorld[1, 2]; worldToBone.worldToBone[1, 3] = boneToWorld.boneToWorld[1, 3]; worldToBone.worldToBone[2, 0] = boneToWorld.boneToWorld[2, 0]; worldToBone.worldToBone[2, 1] = boneToWorld.boneToWorld[2, 1]; worldToBone.worldToBone[2, 2] = boneToWorld.boneToWorld[2, 2]; worldToBone.worldToBone[2, 3] = boneToWorld.boneToWorld[2, 3]; childIDs = new List <uint>(); // Calculated }
public void ReadCompiledBone(BinaryReader b) { // Reads just a single 584 byte entry of a bone. ControllerID = b.ReadUInt32(); // unique id of bone (generated from bone name) physicsGeometry = new PhysicsGeometry[2]; physicsGeometry[0].ReadPhysicsGeometry(b); // LOD 0 is the physics of alive body, physicsGeometry[1].ReadPhysicsGeometry(b); // LOD 1 is the physics of a dead body mass = b.ReadSingle(); worldToBone = new WORLDTOBONE(); worldToBone.GetWorldToBone(b); boneToWorld = new BONETOWORLD(); boneToWorld.ReadBoneToWorld(b); boneName = b.ReadFString(256); limbID = b.ReadInt32(); offsetParent = b.ReadInt32(); numChildren = b.ReadUInt32(); offsetChild = b.ReadInt32(); }
public String[] childNames; // Not part of read struct. Contains the keys of the children to this bone public void ReadCompiledBone(BinaryReader b) { // Reads just a single 584 byte entry of a bone. At the end the seek position will be advanced, so keep that in mind. controllerID = b.ReadUInt32(); physicsGeometry = new PhysicsGeometry[2]; physicsGeometry[0].ReadPhysicsGeometry(b); physicsGeometry[1].ReadPhysicsGeometry(b); mass = b.ReadSingle(); worldToBone = new WORLDTOBONE(); worldToBone.GetWorldToBone(b); boneToWorld = new BONETOWORLD(); boneToWorld.GetBoneToWorld(b); boneName = b.ReadFString(256); limbID = b.ReadUInt32(); offsetParent = b.ReadInt32(); numChildren = b.ReadUInt32(); offsetChild = b.ReadInt32(); childNames = new String[numChildren]; }