public void Load(string Path, ClientType myClientType) { this.path = Path; this.clientType = myClientType; BinaryReader binaryReader = new BinaryReader(File.Open(this.path, FileMode.Open)); string text = RoseFile.ReadFString(ref binaryReader, 7); if (text == "ZMD0003") { this.version = 3; } else { if (!(text == "ZMD0002")) { throw new Exception("Wrong file header " + text + " on " + this.path); } this.version = 2; } int num = binaryReader.ReadInt32(); for (int i = 0; i < num; i++) { ZMD.Bone bone = new ZMD.Bone(); bone.Dummy = false; bone.parentid = binaryReader.ReadInt32(); bone.name = RoseFile.ReadZString(ref binaryReader); bone.position = RoseFile.ReadVector3(ref binaryReader); bone.position /= 100f; bone.rotation = RoseFile.ReadVector4(ref binaryReader); bone.matrix = Matrix.CreateFromQuaternion(new Quaternion(bone.rotation.X, bone.rotation.Y, bone.rotation.Z, bone.rotation.W)); bone.matrix *= Matrix.CreateTranslation(bone.position); this.listBone.Add(bone); } int num2 = binaryReader.ReadInt32(); this.DummyOffset = num; for (int i = 0; i < num2; i++) { ZMD.Bone bone2 = new ZMD.Bone(); bone2.Dummy = true; bone2.name = RoseFile.ReadZString(ref binaryReader); bone2.parentid = binaryReader.ReadInt32(); bone2.position = RoseFile.ReadVector3(ref binaryReader); bone2.position /= 100f; bone2.matrix = Matrix.Identity; if (this.version == 3) { bone2.rotation = RoseFile.ReadVector4(ref binaryReader); bone2.matrix = Matrix.CreateFromQuaternion(new Quaternion(bone2.rotation.X, bone2.rotation.Y, bone2.rotation.Z, bone2.rotation.W)); } bone2.matrix *= Matrix.CreateTranslation(bone2.position); this.listBone.Add(bone2); } binaryReader.Close(); this.TransformChildren(0); }
public void read(ref BinaryReader br) { this.path = RoseFile.ReadZString(ref br); this.is_skin = br.ReadInt16(); this.alpha_enabled = br.ReadInt16(); this.two_sided = br.ReadInt16(); this.alpha_test_enabled = br.ReadInt16(); this.alpha_ref_enabled = br.ReadInt16(); this.z_write_enabled = br.ReadInt16(); this.z_test_enabled = br.ReadInt16(); this.blending_mode = br.ReadInt16(); this.specular_enabled = br.ReadInt16(); this.alpha = br.ReadSingle(); this.glow_type = br.ReadInt16(); this.red = br.ReadSingle(); this.green = br.ReadSingle(); this.blue = br.ReadSingle(); }
public void read(ref BinaryReader br) { this.path = RoseFile.ReadZString(ref br); }