public override void Read(AssetReader reader) { if (IsReadRenderer(reader.Version)) { base.Read(reader); } else { ReadBase(reader); } if (IsReadUpdateWhenOffscreen(reader.Version)) { if (IsReadQualityFirst(reader.Version)) { Quality = reader.ReadInt32(); } UpdateWhenOffscreen = reader.ReadBoolean(); if (!IsReadQualityFirst(reader.Version)) { Quality = reader.ReadInt32(); } } if (IsReadSkinNormals(reader.Version)) { SkinNormals = reader.ReadBoolean(); } if (IsReadSkinMotionVector(reader.Version)) { SkinnedMotionVectors = reader.ReadBoolean(); } if (IsAlignBools(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (IsReadOffscreen(reader.Version)) { DisableAnimationWhenOffscreen.Read(reader); } if (IsReadMeshFirst(reader.Version)) { Mesh.Read(reader); } if (IsReadAnimation(reader.Version)) { Animation.Read(reader); } m_bones = reader.ReadAssetArray <PPtr <Transform> >(); if (IsAlignBones(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (!IsReadMeshFirst(reader.Version)) { Mesh.Read(reader); } if (IsReadBindPose(reader.Version)) { m_bindPose = reader.ReadAssetArray <Matrix4x4f>(); } if (IsReadCurrentPose(reader.Version)) { CurrentPose.Read(reader); } if (IsReadWeights(reader.Version)) { m_blendShapeWeights = reader.ReadSingleArray(); } if (IsReadRootBone(reader.Version)) { RootBone.Read(reader); } if (IsReadAABB(reader.Version)) { AABB.Read(reader); DirtyAABB = reader.ReadBoolean(); if (IsAlignDirty(reader.Version)) { reader.AlignStream(AlignType.Align4); } } }
public override void Read(EndianStream stream) { base.Read(stream); Quality = stream.ReadInt32(); UpdateWhenOffscreen = stream.ReadBoolean(); if (IsReadSkinNormals) { SkinNormals = stream.ReadBoolean(); } if (IsReadSkinMotionVector) { SkinnedMotionVectors = stream.ReadBoolean(); } stream.AlignStream(AlignType.Align4); if (IsReadOffscreen) { DisableAnimationWhenOffscreen.Read(stream); } Mesh.Read(stream); int bonesCount = stream.ReadInt32(); m_bones = new PPtr <Transform> [bonesCount]; for (int i = 0; i < bonesCount; i++) { PPtr <Transform> bone = new PPtr <Transform>(AssetsFile); bone.Read(stream); m_bones[i] = bone; } stream.AlignStream(AlignType.Align4); if (IsReadBindPose) { BindPose.Read(stream); } if (IsReadAABB) { if (IsReadWeights) { int weightCount = stream.ReadInt32(); m_blendShapeWeights = new float[weightCount]; for (int i = 0; i < weightCount; i++) { float weight = stream.ReadSingle(); m_blendShapeWeights[i] = weight; } } if (IsReadRootBone) { RootBone.Read(stream); } AABB.Read(stream); DirtyAABB = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); } }