Пример #1
0
        public override void Read(AssetStream stream)
        {
            base.Read(stream);

            Width             = stream.ReadInt32();
            Height            = stream.ReadInt32();
            CompleteImageSize = stream.ReadInt32();
            TextureFormat     = (TextureFormat)stream.ReadInt32();

            if (IsBoolMinMap(stream.Version))
            {
                MipMap = stream.ReadBoolean();
                if (MipMap)
                {
                    int maxSide = Math.Max(Width, Height);
                    MipCount = Convert.ToInt32(Math.Log(maxSide) / Math.Log(2));
                }
                else
                {
                    MipCount = 1;
                }
            }
            else
            {
                MipCount = stream.ReadInt32();
            }

            if (IsReadIsReadable(stream.Version))
            {
                IsReadable = stream.ReadBoolean();
            }
            if (IsReadReadAllowed(stream.Version))
            {
                ReadAllowed = stream.ReadBoolean();
            }
            stream.AlignStream(AlignType.Align4);

            ImageCount       = stream.ReadInt32();
            TextureDimension = stream.ReadInt32();
            TextureSettings.Read(stream);

            if (IsReadLightmapFormat(stream.Version))
            {
                LightmapFormat = stream.ReadInt32();
            }
            if (IsReadColorSpace(stream.Version))
            {
                ColorSpace = (ColorSpace)stream.ReadInt32();
            }

            m_imageData = stream.ReadByteArray();
            stream.AlignStream(AlignType.Align4);
            if (IsReadStreamData(stream.Version))
            {
                StreamData.Read(stream);
            }
        }
Пример #2
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            TextureSettings.Read(reader);
            IsReadable = reader.ReadBoolean();
            if (HasSRGBTexture(reader.Version))
            {
                SRGBTexture = reader.ReadBoolean();
            }
            if (HasStreamingMipmaps(reader.Version))
            {
                StreamingMipmaps = reader.ReadBoolean();
                reader.AlignStream();

                StreamingMipmapsPriority = reader.ReadInt32();
            }
            reader.AlignStream();

            PostRead(reader);
        }
Пример #3
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

#if UNIVERSAL
            if (IsReadAlphaIsTransparency(reader.Version, reader.Flags))
            {
                if (GetAlphaIsTransparencyPosition(reader.Version) == 0)
                {
                    AlphaIsTransparency = reader.ReadBoolean();
                    reader.AlignStream(AlignType.Align4);
                }
            }
#endif
            Width             = reader.ReadInt32();
            Height            = reader.ReadInt32();
            CompleteImageSize = reader.ReadInt32();
            TextureFormat     = (TextureFormat)reader.ReadInt32();

            if (IsBoolMinMap(reader.Version))
            {
                bool mipMap = reader.ReadBoolean();
                if (mipMap)
                {
                    int maxSide = Math.Max(Width, Height);
                    MipCount = Convert.ToInt32(Math.Log(maxSide) / Math.Log(2));
                }
                else
                {
                    MipCount = 1;
                }
            }
            else
            {
                MipCount = reader.ReadInt32();
            }

            if (IsReadIsReadable(reader.Version))
            {
                IsReadable = reader.ReadBoolean();
            }
            if (IsReadReadAllowed(reader.Version))
            {
                ReadAllowed = reader.ReadBoolean();
            }
            if (IsReadStreamingMipmaps(reader.Version))
            {
                StreamingMipmaps = reader.ReadBoolean();
            }
#if UNIVERSAL
            if (IsReadAlphaIsTransparency(reader.Version, reader.Flags))
            {
                if (GetAlphaIsTransparencyPosition(reader.Version) == 1)
                {
                    AlphaIsTransparency = reader.ReadBoolean();
                }
            }
#endif
            reader.AlignStream(AlignType.Align4);

            if (IsReadStreamingMipmapsPriority(reader.Version))
            {
                StreamingMipmapsPriority = reader.ReadInt32();
#if UNIVERSAL
                if (IsReadAlphaIsTransparency(reader.Version, reader.Flags))
                {
                    if (GetAlphaIsTransparencyPosition(reader.Version) == 2)
                    {
                        AlphaIsTransparency = reader.ReadBoolean();
                    }
                }
#endif
                reader.AlignStream(AlignType.Align4);
            }

            ImageCount       = reader.ReadInt32();
            TextureDimension = (TextureDimension)reader.ReadInt32();
            TextureSettings.Read(reader);

            if (IsReadLightmapFormat(reader.Version))
            {
                LightmapFormat = (TextureUsageMode)reader.ReadInt32();
            }
            if (IsReadColorSpace(reader.Version))
            {
                ColorSpace = (ColorSpace)reader.ReadInt32();
            }

            m_imageData = reader.ReadByteArray();
            reader.AlignStream(AlignType.Align4);
            if (IsReadStreamData(reader.Version))
            {
                StreamData.Read(reader);
            }
        }
Пример #4
0
        public override void Read(AssetStream stream)
        {
            base.Read(stream);

            if (IsReadIsPowerOfTwo(stream.Version))
            {
                if (IsReadIsPowerOfTwoFirst(stream.Version))
                {
                    IsPowerOfTwo = stream.ReadBoolean();
                }
            }
            Width  = stream.ReadInt32();
            Height = stream.ReadInt32();
            if (IsReadAntiAliasing(stream.Version))
            {
                AntiAliasing = stream.ReadInt32();
            }
            DepthFormat = stream.ReadInt32();
            if (IsReadColorFormat(stream.Version))
            {
                ColorFormat = (RenderTextureFormat)stream.ReadInt32();
            }
            if (IsReadIsPowerOfTwo(stream.Version))
            {
                if (!IsReadIsPowerOfTwoFirst(stream.Version))
                {
                    IsPowerOfTwo = stream.ReadBoolean();
                }
            }
            if (IsReadIsCubemap(stream.Version))
            {
                IsCubemap = stream.ReadBoolean();
            }
            if (IsReadMipMap(stream.Version))
            {
                MipMap = stream.ReadBoolean();
            }
            if (IsReadGenerateMips(stream.Version))
            {
                GenerateMips = stream.ReadBoolean();
            }
            if (IsReadSRGB(stream.Version))
            {
                SRGB = stream.ReadBoolean();
            }
            if (IsReadUseDynamicScale(stream.Version))
            {
                UseDynamicScale = stream.ReadBoolean();
                BindMS          = stream.ReadBoolean();
            }
            if (IsAlign(stream.Version))
            {
                stream.AlignStream(AlignType.Align4);
            }

            TextureSettings.Read(stream);
            if (IsReadDimension(stream.Version))
            {
                Dimension   = stream.ReadInt32();
                VolumeDepth = stream.ReadInt32();
            }
        }
Пример #5
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadIsPowerOfTwo(reader.Version))
            {
                if (IsReadIsPowerOfTwoFirst(reader.Version))
                {
                    IsPowerOfTwo = reader.ReadBoolean();
                }
            }
            Width  = reader.ReadInt32();
            Height = reader.ReadInt32();
            if (IsReadAntiAliasing(reader.Version))
            {
                AntiAliasing = reader.ReadInt32();
            }
            DepthFormat = reader.ReadInt32();
            if (IsReadColorFormat(reader.Version))
            {
                ColorFormat = (RenderTextureFormat)reader.ReadInt32();
            }
            if (IsReadIsPowerOfTwo(reader.Version))
            {
                if (!IsReadIsPowerOfTwoFirst(reader.Version))
                {
                    IsPowerOfTwo = reader.ReadBoolean();
                }
            }
            if (IsReadIsCubemap(reader.Version))
            {
                IsCubemap = reader.ReadBoolean();
            }
            if (IsReadMipMap(reader.Version))
            {
                MipMap = reader.ReadBoolean();
            }
            if (IsReadGenerateMips(reader.Version))
            {
                GenerateMips = reader.ReadBoolean();
            }
            if (IsReadSRGB(reader.Version))
            {
                SRGB = reader.ReadBoolean();
            }
            if (IsReadUseDynamicScale(reader.Version))
            {
                UseDynamicScale = reader.ReadBoolean();
                BindMS          = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            TextureSettings.Read(reader);
            if (IsReadDimension(reader.Version))
            {
                Dimension   = reader.ReadInt32();
                VolumeDepth = reader.ReadInt32();
            }
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            bool isBoolFlags = IsBoolFlags(reader.Version);

            MipMapMode = (TextureImporterMipFilter)reader.ReadInt32();
            if (isBoolFlags)
            {
                EnableMipMapBool = reader.ReadBoolean();
                CorrectGammaBool = reader.ReadBoolean();
                FadeOutBool      = reader.ReadBoolean();
                BorderMipMapBool = reader.ReadBoolean();
            }
            else
            {
                EnableMipMap = reader.ReadInt32();
                if (HasSRGBTexture(reader.Version))
                {
                    SRGBTexture = reader.ReadInt32();
                }
                if (HasLinearTexture(reader.Version))
                {
                    LinearTexture = reader.ReadInt32();
                }
                if (HasCorrectGamma(reader.Version))
                {
                    CorrectGamma = reader.ReadInt32();
                }
                FadeOut      = reader.ReadInt32();
                BorderMipMap = reader.ReadInt32();
            }

            if (HasMipMapsPreserveCoverage(reader.Version))
            {
                MipMapsPreserveCoverage = reader.ReadInt32();
                AlphaTestReferenceValue = reader.ReadSingle();
            }

            MipMapFadeDistanceStart = reader.ReadInt32();
            MipMapFadeDistanceEnd   = reader.ReadInt32();
            if (isBoolFlags)
            {
                ConvertToNormalMapBool = reader.ReadBoolean();
                if (HasIsReadable(reader.Version))
                {
                    IsReadableBool = reader.ReadBoolean();
                }
            }
            else
            {
                ConvertToNormalMap = reader.ReadInt32();
                ExternalNormalMap  = reader.ReadInt32();
                if (IsReadableFirst(reader.Version))
                {
                    IsReadable = reader.ReadInt32();
                    reader.AlignStream();
                }
            }

            HeightScale     = reader.ReadSingle();
            NormalMapFilter = (TextureImporterNormalFilter)reader.ReadInt32();
            if (!IsReadableFirst(reader.Version))
            {
                IsReadable = reader.ReadInt32();
            }
            if (HasStreamingMipmaps(reader.Version))
            {
                StreamingMipmaps         = reader.ReadInt32();
                StreamingMipmapsPriority = reader.ReadInt32();
            }
            if (isBoolFlags)
            {
                GrayScaleToAlphaBool = reader.ReadBoolean();
            }
            else
            {
                GrayScaleToAlpha = reader.ReadInt32();
            }
            if (IsAlignGrayScaleToAlpha(reader.Version))
            {
                reader.AlignStream();
            }

            GenerateCubemap = (TextureImporterGenerateCubemap)reader.ReadInt32();
            if (HasCubemapConvolution(reader.Version))
            {
                CubemapConvolution = reader.ReadInt32();
            }
            if (HasCubemapConvolutionSteps(reader.Version))
            {
                CubemapConvolutionSteps    = reader.ReadInt32();
                CubemapConvolutionExponent = reader.ReadSingle();
            }
            if (HasSeamlessCubemap(reader.Version))
            {
                SeamlessCubemap = reader.ReadInt32();
            }

            TextureFormat = (TextureFormat)reader.ReadInt32();
            if (IsAlignTextureFormat(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasRecommendedTextureFormat(reader.Version) && RecommendedTextureFormatFirst(reader.Version))
            {
                RecommendedTextureFormat = reader.ReadInt32();
                reader.AlignStream();
            }

            MaxTextureSize = reader.ReadInt32();
            TextureSettings.Read(reader);
            NPOTScale = (TextureImporterNPOTScale)reader.ReadInt32();
            if (HasLightmap(reader.Version))
            {
                Lightmap = reader.ReadInt32();
            }
            if (HasRGBM(reader.Version))
            {
                RGBM = reader.ReadInt32();
            }
            if (HasCompressionQuality(reader.Version))
            {
                CompressionQuality = reader.ReadInt32();
            }
            if (HasAllowsAlphaSplitting(reader.Version))
            {
                AllowsAlphaSplitting = reader.ReadInt32();
                reader.AlignStream();
            }
            if (HasSprite(reader.Version))
            {
                SpriteMode     = (SpriteImportMode)reader.ReadInt32();
                SpriteExtrude  = reader.ReadUInt32();
                SpriteMeshType = (SpriteMeshType)reader.ReadInt32();
                Alignment      = (SpriteAlignment)reader.ReadInt32();
                SpritePivot.Read(reader);
            }
            if (HasSprite(reader.Version) && SpritePixelsToUnitsFirst(reader.Version))
            {
                SpritePixelsToUnits = reader.ReadSingle();
            }
            if (HasSpriteBorder(reader.Version))
            {
                SpriteBorder.Read(reader);
            }
            if (HasSprite(reader.Version) && !SpritePixelsToUnitsFirst(reader.Version))
            {
                SpritePixelsToUnits = reader.ReadSingle();
            }
            if (HasSpriteGenerateFallbackPhysicsShape(reader.Version))
            {
                SpriteGenerateFallbackPhysicsShape = reader.ReadInt32();
            }
            if (HasAlphaUsage(reader.Version))
            {
                AlphaUsage = (TextureImporterAlphaSource)reader.ReadInt32();
            }
            if (HasAlphaIsTransparency(reader.Version))
            {
                AlphaIsTransparency = reader.ReadInt32();
            }
            if (HasSpriteTessellationDetail(reader.Version))
            {
                SpriteTessellationDetail = reader.ReadSingle();
            }
            if (HasTextureType(reader.Version))
            {
                TextureType = (TextureImporterType)reader.ReadInt32();
            }
            if (HasRecommendedTextureFormat(reader.Version) && !RecommendedTextureFormatFirst(reader.Version))
            {
                RecommendedTextureFormat = reader.ReadInt32();
            }
            if (HasSourceTextureInformation(reader.Version))
            {
                SourceTextureInformation = reader.ReadAsset <SourceTextureInformation>();
                reader.AlignStream();
            }
            if (HasTextureShape(reader.Version))
            {
                TextureShape = (TextureImporterShape)reader.ReadInt32();
            }
            if (HasSingleChannelComponent(reader.Version))
            {
                SingleChannelComponent = reader.ReadInt32();
            }
            if (HasMaxTextureSizeSet(reader.Version))
            {
                MaxTextureSizeSet     = reader.ReadInt32();
                CompressionQualitySet = reader.ReadInt32();
                TextureFormatSet      = reader.ReadInt32();
            }
            reader.AlignStream();

            if (HasPlatformSettings(reader.Version))
            {
                PlatformSettings = reader.ReadAssetArray <TextureImporterPlatformSettings>();
            }
            if (HasSprite(reader.Version))
            {
                SpriteSheet.Read(reader);
                SpritePackingTag = reader.ReadString();
            }
            if (HasOutput(reader.Version))
            {
                Output.Read(reader);
            }
            if (HasPSDRemoveMatte(reader.Version))
            {
                PSDRemoveMatte           = reader.ReadBoolean();
                PSDShowRemoveMatteOption = reader.ReadBoolean();
            }
            reader.AlignStream();

            PostRead(reader);
        }
Пример #7
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

#if UNIVERSAL
            bool hasAlphaIsTransparency   = HasAlphaIsTransparency(reader.Version, reader.Flags);
            int  alphaIsTransparencyOrder = GetAlphaIsTransparencyOrder(reader.Version);
            if (hasAlphaIsTransparency && alphaIsTransparencyOrder == 0)
            {
                AlphaIsTransparency = reader.ReadBoolean();
                reader.AlignStream();
            }
#endif
            Width             = reader.ReadInt32();
            Height            = reader.ReadInt32();
            CompleteImageSize = reader.ReadInt32();
            TextureFormat     = (TextureFormat)reader.ReadInt32();

            if (IsBoolMinMap(reader.Version))
            {
                bool mipMap = reader.ReadBoolean();
                if (mipMap)
                {
                    int maxSide = Math.Max(Width, Height);
                    MipCount = System.Convert.ToInt32(Math.Log(maxSide) / Math.Log(2));
                }
                else
                {
                    MipCount = 1;
                }
            }
            else
            {
                MipCount = reader.ReadInt32();
            }

            if (HasReadable(reader.Version))
            {
                IsReadable = reader.ReadBoolean();
            }
            if (HasIgnoreMasterTextureLimit(reader.Version))
            {
                IgnoreMasterTextureLimit = reader.ReadBoolean();
            }
            if (HasIsPreProcessed(reader.Version))
            {
                IsPreProcessed = reader.ReadBoolean();
            }
            if (HasReadAllowed(reader.Version))
            {
                ReadAllowed = reader.ReadBoolean();
            }
            if (HasStreamingMipmaps(reader.Version))
            {
                StreamingMipmaps = reader.ReadBoolean();
            }
#if UNIVERSAL
            if (hasAlphaIsTransparency && alphaIsTransparencyOrder == 1)
            {
                AlphaIsTransparency = reader.ReadBoolean();
            }
#endif
            reader.AlignStream();

            if (HasStreamingMipmapsPriority(reader.Version))
            {
                StreamingMipmapsPriority = reader.ReadInt32();
#if UNIVERSAL
                if (hasAlphaIsTransparency && alphaIsTransparencyOrder == 2)
                {
                    AlphaIsTransparency = reader.ReadBoolean();
                }
#endif
                reader.AlignStream();
            }

            ImageCount       = reader.ReadInt32();
            TextureDimension = (TextureDimension)reader.ReadInt32();
            TextureSettings.Read(reader);

            if (HasLightmapFormat(reader.Version))
            {
                LightmapFormat = (TextureUsageMode)reader.ReadInt32();
            }
            if (HasColorSpace(reader.Version))
            {
                ColorSpace = (ColorSpace)reader.ReadInt32();
            }

            m_imageData = reader.ReadByteArray();
            reader.AlignStream();
            if (HasStreamData(reader.Version))
            {
                StreamData.Read(reader);
            }
        }
Пример #8
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasColorSpace(reader.Version))
            {
                if (IsColorSpaceFirst(reader.Version))
                {
                    ColorSpace = (ColorSpace)reader.ReadInt32();
                }
            }
            if (IsFormatFirst(reader.Version))
            {
                Format = (TextureFormat)reader.ReadInt32();
            }

            Width  = reader.ReadInt32();
            Height = reader.ReadInt32();
            if (HasDepth(reader.Version))
            {
                Depth = reader.ReadInt32();
            }
            if (IsDataSizeFirst(reader.Version))
            {
                DataSize = reader.ReadInt32();
            }
            if (!IsFormatFirst(reader.Version))
            {
                Format = (TextureFormat)reader.ReadInt32();
            }

            if (IsBoolMinMap(reader.Version))
            {
                bool mipMap = reader.ReadBoolean();
                if (mipMap)
                {
                    int maxSide = Math.Max(Width, Height);
                    MipCount = System.Convert.ToInt32(Math.Log(maxSide) / Math.Log(2));
                }
                else
                {
                    MipCount = 1;
                }
            }
            else
            {
                MipCount = reader.ReadInt32();
            }

            if (!IsDataSizeFirst(reader.Version))
            {
                DataSize = reader.ReadInt32();
            }
            if (IsReadableFirst(reader.Version))
            {
                IsReadable = reader.ReadBoolean();
            }
            if (HasReadAllowed(reader.Version))
            {
                ReadAllowed = reader.ReadBoolean();
            }
            reader.AlignStream();

            if (HasImageCount(reader.Version))
            {
                ImageCount       = reader.ReadInt32();
                TextureDimension = (TextureDimension)reader.ReadInt32();
            }
            TextureSettings.Read(reader);

            if (IsReadableSecond(reader.Version))
            {
                IsReadable = reader.ReadBoolean();
                reader.AlignStream();
            }
            if (HasLightmapFormat(reader.Version))
            {
                LightmapFormat = (TextureUsageMode)reader.ReadInt32();
            }
            if (HasColorSpace(reader.Version))
            {
                if (!IsColorSpaceFirst(reader.Version))
                {
                    ColorSpace = (ColorSpace)reader.ReadInt32();
                }
            }

            m_imageData = reader.ReadByteArray();
            reader.AlignStream();
            if (HasStreamData(reader.Version))
            {
                StreamData.Read(reader);
            }
        }
Пример #9
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasIsPowerOfTwo(reader.Version))
            {
                if (HasIsPowerOfTwoFirst(reader.Version))
                {
                    IsPowerOfTwo = reader.ReadBoolean();
                }
            }
            Width  = reader.ReadInt32();
            Height = reader.ReadInt32();
            if (HasAntiAliasing(reader.Version))
            {
                AntiAliasing = reader.ReadInt32();
            }
            if (HasMipCount(reader.Version))
            {
                MipCount = reader.ReadInt32();
            }
            DepthFormat = reader.ReadInt32();
            if (HasColorFormat(reader.Version))
            {
                ColorFormat = (RenderTextureFormat)reader.ReadInt32();
            }
            if (HasIsPowerOfTwo(reader.Version))
            {
                if (!HasIsPowerOfTwoFirst(reader.Version))
                {
                    IsPowerOfTwo = reader.ReadBoolean();
                }
            }
            if (HasIsCubemap(reader.Version))
            {
                IsCubemap = reader.ReadBoolean();
            }
            if (HasMipMap(reader.Version))
            {
                MipMap = reader.ReadBoolean();
            }
            if (HasGenerateMips(reader.Version))
            {
                GenerateMips = reader.ReadBoolean();
            }
            if (HasSRGB(reader.Version))
            {
                SRGB = reader.ReadBoolean();
            }
            if (HasUseDynamicScale(reader.Version))
            {
                UseDynamicScale = reader.ReadBoolean();
                BindMS          = reader.ReadBoolean();
            }
            if (HasEnableCompatibleFormat(reader.Version))
            {
                EnableCompatibleFormat = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream();
            }

            TextureSettings.Read(reader);
            if (HasDimension(reader.Version))
            {
                Dimension   = reader.ReadInt32();
                VolumeDepth = reader.ReadInt32();
            }
        }