public SpriteAtlasData(ObjectReader reader) { var version = reader.version; texture = new PPtr <Texture2D>(reader); alphaTexture = new PPtr <Texture2D>(reader); textureRect = new Rectf(reader); textureRectOffset = reader.ReadVector2(); if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up { atlasRectOffset = reader.ReadVector2(); } uvTransform = reader.ReadVector4(); downscaleMultiplier = reader.ReadSingle(); settingsRaw = new SpriteSettings(reader); if (version[0] > 2020 || (version[0] == 2020 && version[1] >= 2)) //2020.2 and up { var secondaryTexturesSize = reader.ReadInt32(); secondaryTextures = new SecondarySpriteTexture[secondaryTexturesSize]; for (int i = 0; i < secondaryTexturesSize; i++) { secondaryTextures[i] = new SecondarySpriteTexture(reader); } reader.AlignStream(); } }
public Sprite(ObjectReader reader) : base(reader) { m_Rect = reader.ReadRectangleF(); m_Offset = reader.ReadVector2(); if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up { m_Border = reader.ReadVector4(); } m_PixelsToUnits = reader.ReadSingle(); if (version[0] > 5 || (version[0] == 5 && version[1] > 4) || (version[0] == 5 && version[1] == 4 && version[2] >= 2)) //5.4.2 and up { m_Pivot = reader.ReadVector2(); } m_Extrude = reader.ReadUInt32(); if (version[0] > 5 || (version[0] == 5 && version[1] >= 3)) //5.3 and up { m_IsPolygon = reader.ReadBoolean(); reader.AlignStream(4); } if (version[0] >= 2017) //2017 and up { var first = new Guid(reader.ReadBytes(16)); var second = reader.ReadInt64(); m_RenderDataKey = new KeyValuePair <Guid, long>(first, second); var m_AtlasTagsSize = reader.ReadInt32(); m_AtlasTags = new string[m_AtlasTagsSize]; for (int i = 0; i < m_AtlasTagsSize; i++) { m_AtlasTags[i] = reader.ReadAlignedString(); } m_SpriteAtlas = new PPtr <SpriteAtlas>(reader); } m_RD = new SpriteRenderData(reader); if (version[0] >= 2017) //2017 and up { var m_PhysicsShapeSize = reader.ReadInt32(); m_PhysicsShape = new Vector2[m_PhysicsShapeSize][]; for (int i = 0; i < m_PhysicsShapeSize; i++) { m_PhysicsShape[i] = reader.ReadVector2Array(reader.ReadInt32()); } } //vector m_Bones 2018 and up }
public SpriteAtlasData(ObjectReader reader) { var version = reader.version; texture = new PPtr <Texture2D>(reader); alphaTexture = new PPtr <Texture2D>(reader); textureRect = reader.ReadRectangleF(); textureRectOffset = reader.ReadVector2(); if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up { atlasRectOffset = reader.ReadVector2(); } uvTransform = reader.ReadVector4(); downscaleMultiplier = reader.ReadSingle(); settingsRaw = new SpriteSettings(reader); }
public SpriteVertex(ObjectReader reader) { var version = reader.version; pos = reader.ReadVector3(); if (version[0] < 4 || (version[0] == 4 && version[1] <= 3)) //4.3 and down { uv = reader.ReadVector2(); } }
public UnityTexEnv(ObjectReader reader) { m_Texture = new PPtr <Texture>(reader); m_Scale = reader.ReadVector2(); m_Offset = reader.ReadVector2(); }
public SpriteRenderData(ObjectReader reader) { var version = reader.version; texture = new PPtr <Texture2D>(reader); if (version[0] > 5 || (version[0] == 5 && version[1] >= 2)) //5.2 and up { alphaTexture = new PPtr <Texture2D>(reader); } if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up { var m_SubMeshesSize = reader.ReadInt32(); m_SubMeshes = new SubMesh[m_SubMeshesSize]; for (int i = 0; i < m_SubMeshesSize; i++) { m_SubMeshes[i] = new SubMesh(reader); } m_IndexBuffer = reader.ReadBytes(reader.ReadInt32()); reader.AlignStream(4); m_VertexData = new VertexData(reader); } else { var verticesSize = reader.ReadInt32(); vertices = new SpriteVertex[verticesSize]; for (int i = 0; i < verticesSize; i++) { vertices[i] = new SpriteVertex(reader); } indices = reader.ReadUInt16Array(reader.ReadInt32()); reader.AlignStream(4); } if (version[0] >= 2018) //2018 and up { m_Bindpose = reader.ReadMatrixArray(reader.ReadInt32()); if (version[0] == 2018 && version[1] < 2) //2018.2 down { var m_SourceSkinSize = reader.ReadInt32(); for (int i = 0; i < m_SourceSkinSize; i++) { m_SourceSkin[i] = new BoneWeights4(reader); } } } textureRect = reader.ReadRectangleF(); textureRectOffset = reader.ReadVector2(); if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up { atlasRectOffset = reader.ReadVector2(); } settingsRaw = new SpriteSettings(reader); if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up { uvTransform = reader.ReadVector4(); } if (version[0] >= 2017) //2017 and up { downscaleMultiplier = reader.ReadSingle(); } }
protected Renderer(ObjectReader reader, bool isSkinned = false) : base(reader) { if (version[0] < 5) //5.0 down { var m_Enabled = reader.ReadBoolean(); var m_CastShadows = reader.ReadBoolean(); var m_ReceiveShadows = reader.ReadBoolean(); var m_LightmapIndex = reader.ReadByte(); } else //5.0 and up { if (version[0] > 5 || (version[0] == 5 && version[1] >= 4)) //5.4 and up { var m_Enabled = reader.ReadBoolean(); var m_CastShadows = reader.ReadByte(); var m_ReceiveShadows = reader.ReadByte(); if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up { var m_DynamicOccludee = reader.ReadByte(); } if (version[0] >= 2021) //2021.1 and up { var m_StaticShadowCaster = reader.ReadByte(); } var m_MotionVectors = reader.ReadByte(); var m_LightProbeUsage = reader.ReadByte(); var m_ReflectionProbeUsage = reader.ReadByte(); if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up { var m_RayTracingMode = reader.ReadByte(); } if (version[0] >= 2020) //2020.1 and up { var m_RayTraceProcedural = reader.ReadByte(); } reader.AlignStream(); } else { var m_Enabled = reader.ReadBoolean(); reader.AlignStream(); var m_CastShadows = reader.ReadByte(); var m_ReceiveShadows = reader.ReadBoolean(); reader.AlignStream(); } if (version[0] >= 2018) //2018 and up { var m_RenderingLayerMask = reader.ReadUInt32(); } if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 3)) //2018.3 and up { var m_RendererPriority = reader.ReadInt32(); } // ??? //var unk1 = reader.ReadBytes(isSkinned ? 0xC : 0x10); var unk1 = reader.ReadBytes(0x10); var m_LightmapIndex = reader.ReadUInt16(); var m_LightmapIndexDynamic = reader.ReadUInt16(); } if (version[0] >= 3) //3.0 and up { var m_LightmapTilingOffset = reader.ReadVector4(); } if (version[0] >= 5) //5.0 and up { var m_LightmapTilingOffsetDynamic = reader.ReadVector4(); } // ??? var unk2 = reader.ReadVector2(); var m_MaterialsSize = reader.ReadInt32(); m_Materials = new PPtr <Material> [m_MaterialsSize]; for (int i = 0; i < m_MaterialsSize; i++) { m_Materials[i] = new PPtr <Material>(reader); } if (version[0] < 3) //3.0 down { var m_LightmapTilingOffset = reader.ReadVector4(); } else //3.0 and up { if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up { m_StaticBatchInfo = new StaticBatchInfo(reader); } else { m_SubsetIndices = reader.ReadUInt32Array(); } var m_StaticBatchRoot = new PPtr <Transform>(reader); } if (version[0] > 5 || (version[0] == 5 && version[1] >= 4)) //5.4 and up { var m_ProbeAnchor = new PPtr <Transform>(reader); var m_LightProbeVolumeOverride = new PPtr <GameObject>(reader); } else if (version[0] > 3 || (version[0] == 3 && version[1] >= 5)) //3.5 - 5.3 { var m_UseLightProbes = reader.ReadBoolean(); reader.AlignStream(); if (version[0] >= 5)//5.0 and up { var m_ReflectionProbeUsage = reader.ReadInt32(); } var m_LightProbeAnchor = new PPtr <Transform>(reader); //5.0 and up m_ProbeAnchor } if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up { if (version[0] == 4 && version[1] == 3) //4.3 { var m_SortingLayer = reader.ReadInt16(); } else { var m_SortingLayerID = reader.ReadUInt32(); } //SInt16 m_SortingLayer 5.6 and up var m_SortingOrder = reader.ReadInt16(); reader.AlignStream(); } }
public PointF[][] m_PhysicsShape; //Vector2[][] public Sprite(ObjectReader reader) : base(reader) { //Rectf m_Rect m_Rect = reader.ReadRectangleF(); //Vector2f m_Offset reader.Position += 8; if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up { //Vector4f m_Border reader.Position += 16; } m_PixelsToUnits = reader.ReadSingle(); if (version[0] > 5 || (version[0] == 5 && version[1] > 4) || (version[0] == 5 && version[1] == 4 && version[2] >= 2)) //5.4.2 and up { //Vector2f m_Pivot m_Pivot = reader.ReadVector2(); } var m_Extrude = reader.ReadUInt32(); if (version[0] > 5 || (version[0] == 5 && version[1] >= 3)) //5.3 and up { var m_IsPolygon = reader.ReadBoolean(); reader.AlignStream(4); } if (version[0] >= 2017) //2017 and up { //pair m_RenderDataKey var first = new Guid(reader.ReadBytes(16)); var second = reader.ReadInt64(); m_RenderDataKey = new Tuple <Guid, long>(first, second); //vector m_AtlasTags var size = reader.ReadInt32(); for (int i = 0; i < size; i++) { var data = reader.ReadAlignedString(); } //PPtr<SpriteAtlas> m_SpriteAtlas m_SpriteAtlas = reader.ReadPPtr(); } //SpriteRenderData m_RD // PPtr<Texture2D> texture texture = reader.ReadPPtr(); // PPtr<Texture2D> alphaTexture if (version[0] > 5 || (version[0] == 5 && version[1] >= 2)) //5.2 and up { var alphaTexture = reader.ReadPPtr(); } if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up { // vector m_SubMeshes var size = reader.ReadInt32(); // SubMesh data if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3)) //2017.3 and up { reader.Position += 48 * size; } else { reader.Position += 44 * size; } // vector m_IndexBuffer size = reader.ReadInt32(); reader.Position += size; //UInt8 data reader.AlignStream(4); // VertexData m_VertexData if (version[0] < 2018)//2018 down { var m_CurrentChannels = reader.ReadInt32(); } var m_VertexCount = reader.ReadUInt32(); // vector m_Channels size = reader.ReadInt32(); reader.Position += size * 4; //ChannelInfo data // TypelessData m_DataSize size = reader.ReadInt32(); reader.Position += size; //UInt8 data reader.AlignStream(4); if (version[0] >= 2018)//2018 and up { // vector m_Bindpose // Matrix4x4f data size = reader.ReadInt32(); reader.Position += size * 64; if (version[0] == 2018 && version[1] < 2) //2018.2 down { // vector m_SourceSkin // BoneWeights4 data size = reader.ReadInt32(); reader.Position += size * 32; } } } else { // vector vertices var size = reader.ReadInt32(); for (int i = 0; i < size; i++) { //SpriteVertex data reader.Position += 12; //Vector3f pos if (version[0] < 4 || (version[0] == 4 && version[1] <= 3)) //4.3 and down { reader.Position += 8; //Vector2f uv } } // vector indices size = reader.ReadInt32(); reader.Position += 2 * size; //UInt16 data reader.AlignStream(4); } // Rectf textureRect textureRect = reader.ReadRectangleF(); // Vector2f textureRectOffset reader.Position += 8; // Vector2f atlasRectOffset - 5.6 and up if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up { reader.Position += 8; } // unsigned int settingsRaw settingsRaw = new SpriteSettings(reader); // Vector4f uvTransform - 4.5 and up if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up { reader.Position += 16; } if (version[0] >= 2017) //2017 and up { // float downscaleMultiplier - 2017 and up reader.Position += 4; //vector m_PhysicsShape - 2017 and up var m_PhysicsShape_size = reader.ReadInt32(); m_PhysicsShape = new PointF[m_PhysicsShape_size][]; for (int i = 0; i < m_PhysicsShape_size; i++) { var data_size = reader.ReadInt32(); //Vector2f m_PhysicsShape[i] = new PointF[data_size]; for (int j = 0; j < data_size; j++) { m_PhysicsShape[i][j] = new PointF(reader.ReadSingle(), reader.ReadSingle()); } } } //vector m_Bones 2018 and up }