public TextureImporter(Version version) : base(version) { EnableMipMap = 1; SRGBTexture = 1; AlphaTestReferenceValue = 0.5f; MipMapFadeDistanceStart = 1; MipMapFadeDistanceEnd = 3; HeightScale = 0.25f; GenerateCubemap = TextureImporterGenerateCubemap.AutoCubemap; TextureFormat = TextureFormat.Alpha8; MaxTextureSize = 2048; TextureSettings = new GLTextureSettings(version); NPOTScale = TextureImporterNPOTScale.ToNearest; CompressionQuality = 50; SpriteMode = SpriteImportMode.Single; SpriteExtrude = 1; SpriteMeshType = SpriteMeshType.Tight; SpritePivot = new Vector2f(0.5f, 0.5f); SpritePixelsToUnits = 100.0f; SpriteGenerateFallbackPhysicsShape = 1; AlphaUsage = TextureImporterAlphaSource.FromInput; AlphaIsTransparency = 0; SpriteTessellationDetail = -1; TextureShape = TextureImporterShape.Texture2D; PlatformSettings = new TextureImporterPlatformSettings[] { new TextureImporterPlatformSettings(version) }; SpriteSheet = new SpriteSheetMetaData(version); SpritePackingTag = string.Empty; Output = new TextureImportOutput(version); }
public Texture2DArray(ObjectReader reader) : base(reader) { m_Width = reader.ReadInt32(); m_Height = reader.ReadInt32(); m_Depth = reader.ReadInt32(); m_TextureFormat = (TextureFormat)reader.ReadInt32(); m_MipCount = reader.ReadInt32(); m_DataSize = reader.ReadUInt32(); m_TextureSettings = new GLTextureSettings(reader); m_ColorSpace = reader.ReadInt32(); m_IsReadable = reader.ReadBoolean(); reader.AlignStream(); var image_data_size = reader.ReadInt32(); if (image_data_size == 0) { m_StreamData = new StreamingInfo(reader); } if (!string.IsNullOrEmpty(m_StreamData?.path)) { image_data = new ResourceReader(m_StreamData.path, assetsFile, m_StreamData.offset, (int)m_StreamData.size); } else { image_data = new ResourceReader(reader, reader.BaseStream.Position, image_data_size); } }
public Texture2D(ObjectReader reader) : base(reader) { m_Width = reader.ReadInt32(); m_Height = reader.ReadInt32(); var m_CompleteImageSize = reader.ReadInt32(); if (version[0] >= 2020) //2020.1 and up { var m_MipsStripped = reader.ReadInt32(); } m_TextureFormat = (TextureFormat)reader.ReadInt32(); if (version[0] < 5 || (version[0] == 5 && version[1] < 2)) //5.2 down { m_MipMap = reader.ReadBoolean(); } else { m_MipCount = reader.ReadInt32(); } if (version[0] > 2 || (version[0] == 2 && version[1] >= 6)) //2.6.0 and up { var m_IsReadable = reader.ReadBoolean(); } if (version[0] >= 2020) //2020.1 and up { var m_IsPreProcessed = reader.ReadBoolean(); } if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up { var m_IgnoreMasterTextureLimit = reader.ReadBoolean(); } if (version[0] >= 3) //3.0.0 - 5.4 { if (version[0] < 5 || (version[0] == 5 && version[1] <= 4)) { var m_ReadAllowed = reader.ReadBoolean(); } } if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 2)) //2018.2 and up { var m_StreamingMipmaps = reader.ReadBoolean(); } reader.AlignStream(); if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 2)) //2018.2 and up { var m_StreamingMipmapsPriority = reader.ReadInt32(); } var m_ImageCount = reader.ReadInt32(); var m_TextureDimension = reader.ReadInt32(); m_TextureSettings = new GLTextureSettings(reader); if (version[0] >= 3) //3.0 and up { var m_LightmapFormat = reader.ReadInt32(); } if (version[0] > 3 || (version[0] == 3 && version[1] >= 5)) //3.5.0 and up { var m_ColorSpace = reader.ReadInt32(); } var image_data_size = reader.ReadInt32(); if (image_data_size == 0 && ((version[0] == 5 && version[1] >= 3) || version[0] > 5))//5.3.0 and up { m_StreamData = new StreamingInfo(reader); } ResourceReader resourceReader; if (!string.IsNullOrEmpty(m_StreamData?.path)) { resourceReader = new ResourceReader(m_StreamData.path, assetsFile, m_StreamData.offset, (int)m_StreamData.size); } else { resourceReader = new ResourceReader(reader, reader.BaseStream.Position, image_data_size); } image_data = resourceReader; }
protected override void Read() { m_TextureFormat = TextureFormat.BGRA32; m_TextureSettings = new GLTextureSettings(); MxrObjectReader.Read <TextureField>(this, ClassIDType.Texture2D, ReadField); }