1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
#include "../../../common/binary_reader.h" #include "../binary_parse_visitor.h" namespace whiteout { namespace m2 { using common::BinaryReader; void BinaryParseVisitor::visit(SkinSection& section) { section.skinSectionId = reader.read<u16>(); section.level = reader.read<u16>(); section.vertexStart = reader.read<u16>(); section.vertexCount = reader.read<u16>(); section.indexStart = reader.read<u16>(); section.indexCount = reader.read<u16>(); section.boneCount = reader.read<u16>(); section.boneComboIndex = reader.read<u16>(); section.boneInfluences = reader.read<u16>(); section.centerBoneIndex = reader.read<u16>(); section.centerPosition = reader.read<Vector3f>(); section.sortCenterPosition = reader.read<Vector3f>(); section.sortRadius = reader.read<f32>(); } void BinaryParseVisitor::visit(Batch& batch) { batch.flags = reader.read<u8>(); batch.priorityPlane = reader.read<i8>(); batch.shaderId = reader.read<u16>(); batch.skinSectionIndex = reader.read<u16>(); batch.geosetIndex = reader.read<u16>(); batch.colorIndex = reader.read<i16>(); batch.materialIndex = reader.read<u16>(); batch.materialLayer = reader.read<u16>(); batch.textureCount = reader.read<u16>(); batch.textureComboIndex = reader.read<u16>(); batch.textureCoordComboIndex = reader.read<u16>(); batch.textureWeightComboIndex = reader.read<u16>(); batch.textureTransformComboIndex = reader.read<u16>(); } void BinaryParseVisitor::visit(ShadowBatch& batch) { batch.flags = reader.read<u8>(); batch.flags2 = reader.read<u8>(); batch.unknown0 = reader.read<u16>(); batch.submeshId = reader.read<u16>(); batch.textureId = reader.read<u16>(); batch.colorId = reader.read<u16>(); batch.transparencyId = reader.read<u16>(); } void BinaryParseVisitor::visit(SkinProfile& profile) { if (version >= M2_VERSION_WOTLK) { // Read the magic (void)reader.read<u32>(); } visit(profile.vertices); visit(profile.indices); visit(profile.bones); visit(profile.submeshes); visit(profile.batches); profile.lodVertexBase = reader.read<u32>(); if (version >= M2_VERSION_CATA) { visit(profile.shadowBatches); } else { profile.shadowBatches.clear(); } } void BinaryParseVisitor::visit(SkinFile& file) { visit(file.profile); } } // namespace m2 } // namespace whiteout