示例#1
0
 protected override void WriteObject(AssetsWriter writer)
 {
     base.WriteBase(writer);
     writer.Write(Name);
     writer.Write(ForcedFallbackFormat);
     writer.Write(DownscaleFallback);
     writer.AlignTo(4);
     writer.Write(Width);
     writer.Write(Height);
     writer.Write(CompleteImageSize);
     writer.Write((int)TextureFormat);
     writer.Write(MipCount);
     writer.Write(IsReadable);
     writer.Write(StreamingMipmaps);
     writer.AlignTo(4);
     writer.Write(StreamingMipmapsPriority);
     writer.Write(ImageCount);
     writer.Write(TextureDimension);
     TextureSettings.Write(writer);
     writer.Write(LightmapFormat);
     writer.Write(ColorSpace);
     writer.Write(ImageData.Length);
     writer.Write(ImageData);
     writer.AlignTo(4);
     StreamData.Write(writer);
 }
示例#2
0
        public override void Write(AssetWriter writer)
        {
            base.Write(writer);

            TextureSettings.Write(writer);
            writer.Write(IsReadable);
            if (HasSRGBTexture(writer.Version))
            {
                writer.Write(SRGBTexture);
            }
            if (HasStreamingMipmaps(writer.Version))
            {
                writer.Write(StreamingMipmaps);
                writer.AlignStream();

                writer.Write(StreamingMipmapsPriority);
            }
            writer.AlignStream();

            PostWrite(writer);
        }
        public override void Write(AssetWriter writer)
        {
            base.Write(writer);

            bool isBoolFlags = IsBoolFlags(writer.Version);

            writer.Write((int)MipMapMode);
            if (isBoolFlags)
            {
                writer.Write(EnableMipMapBool);
                writer.Write(CorrectGammaBool);
                writer.Write(FadeOutBool);
                writer.Write(BorderMipMapBool);
            }
            else
            {
                writer.Write(EnableMipMap);
                if (HasSRGBTexture(writer.Version))
                {
                    writer.Write(SRGBTexture);
                }
                if (HasLinearTexture(writer.Version))
                {
                    writer.Write(LinearTexture);
                }
                if (HasCorrectGamma(writer.Version))
                {
                    writer.Write(CorrectGamma);
                }
                writer.Write(FadeOut);
                writer.Write(BorderMipMap);
            }

            if (HasMipMapsPreserveCoverage(writer.Version))
            {
                writer.Write(MipMapsPreserveCoverage);
                writer.Write(AlphaTestReferenceValue);
            }

            writer.Write(MipMapFadeDistanceStart);
            writer.Write(MipMapFadeDistanceEnd);
            if (isBoolFlags)
            {
                writer.Write(ConvertToNormalMapBool);
                if (HasIsReadable(writer.Version))
                {
                    writer.Write(IsReadableBool);
                }
            }
            else
            {
                writer.Write(ConvertToNormalMap);
                writer.Write(ExternalNormalMap);
                if (IsReadableFirst(writer.Version))
                {
                    writer.Write(IsReadable);
                    writer.AlignStream();
                }
            }

            writer.Write(HeightScale);
            writer.Write((int)NormalMapFilter);
            if (!IsReadableFirst(writer.Version))
            {
                writer.Write(IsReadable);
            }
            if (HasStreamingMipmaps(writer.Version))
            {
                writer.Write(StreamingMipmaps);
                writer.Write(StreamingMipmapsPriority);
            }
            if (isBoolFlags)
            {
                writer.Write(GrayScaleToAlphaBool);
            }
            else
            {
                writer.Write(GrayScaleToAlpha);
            }
            if (IsAlignGrayScaleToAlpha(writer.Version))
            {
                writer.AlignStream();
            }

            writer.Write((int)GenerateCubemap);
            if (HasCubemapConvolution(writer.Version))
            {
                writer.Write(CubemapConvolution);
            }
            if (HasCubemapConvolutionSteps(writer.Version))
            {
                writer.Write(CubemapConvolutionSteps);
                writer.Write(CubemapConvolutionExponent);
            }
            if (HasSeamlessCubemap(writer.Version))
            {
                writer.Write(SeamlessCubemap);
            }

            writer.Write((int)TextureFormat);
            if (IsAlignTextureFormat(writer.Version))
            {
                writer.AlignStream();
            }

            if (HasRecommendedTextureFormat(writer.Version) && RecommendedTextureFormatFirst(writer.Version))
            {
                writer.Write(RecommendedTextureFormat);
                writer.AlignStream();
            }

            writer.Write(MaxTextureSize);
            TextureSettings.Write(writer);
            writer.Write((int)NPOTScale);
            if (HasLightmap(writer.Version))
            {
                writer.Write(Lightmap);
            }
            if (HasRGBM(writer.Version))
            {
                writer.Write(RGBM);
            }
            if (HasCompressionQuality(writer.Version))
            {
                writer.Write(CompressionQuality);
            }
            if (HasAllowsAlphaSplitting(writer.Version))
            {
                writer.Write(AllowsAlphaSplitting);
                writer.AlignStream();
            }
            if (HasSprite(writer.Version))
            {
                writer.Write((int)SpriteMode);
                writer.Write(SpriteExtrude);
                writer.Write((int)SpriteMeshType);
                writer.Write((int)Alignment);
                SpritePivot.Write(writer);
            }
            if (HasSprite(writer.Version) && SpritePixelsToUnitsFirst(writer.Version))
            {
                writer.Write(SpritePixelsToUnits);
            }
            if (HasSpriteBorder(writer.Version))
            {
                SpriteBorder.Write(writer);
            }
            if (HasSprite(writer.Version) && !SpritePixelsToUnitsFirst(writer.Version))
            {
                writer.Write(SpritePixelsToUnits);
            }
            if (HasSpriteGenerateFallbackPhysicsShape(writer.Version))
            {
                writer.Write(SpriteGenerateFallbackPhysicsShape);
            }
            if (HasAlphaUsage(writer.Version))
            {
                writer.Write((int)AlphaUsage);
            }
            if (HasAlphaIsTransparency(writer.Version))
            {
                writer.Write(AlphaIsTransparency);
            }
            if (HasSpriteTessellationDetail(writer.Version))
            {
                writer.Write(SpriteTessellationDetail);
            }
            if (HasTextureType(writer.Version))
            {
                writer.Write((int)TextureType);
            }
            if (HasRecommendedTextureFormat(writer.Version) && !RecommendedTextureFormatFirst(writer.Version))
            {
                writer.Write(RecommendedTextureFormat);
            }
            if (HasSourceTextureInformation(writer.Version))
            {
                SourceTextureInformation.Write(writer);
                writer.AlignStream();
            }
            if (HasTextureShape(writer.Version))
            {
                writer.Write((int)TextureShape);
            }
            if (HasSingleChannelComponent(writer.Version))
            {
                writer.Write(SingleChannelComponent);
            }
            if (HasMaxTextureSizeSet(writer.Version))
            {
                writer.Write(MaxTextureSizeSet);
                writer.Write(CompressionQualitySet);
                writer.Write(TextureFormatSet);
            }
            writer.AlignStream();

            if (HasPlatformSettings(writer.Version))
            {
                PlatformSettings.Write(writer);
            }
            if (HasSprite(writer.Version))
            {
                SpriteSheet.Write(writer);
                writer.Write(SpritePackingTag);
            }
            if (HasOutput(writer.Version))
            {
                Output.Write(writer);
            }
            if (HasPSDRemoveMatte(writer.Version))
            {
                writer.Write(PSDRemoveMatte);
                writer.Write(PSDShowRemoveMatteOption);
            }
            writer.AlignStream();

            PostWrite(writer);
        }