Beispiel #1
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Scenes = reader.ReadStringArray();
            if (HasPreloadPlugin(reader.Version))
            {
                PreloadedPlugins = reader.ReadStringArray();
            }

            if (HasEnabledVRDevices(reader.Version))
            {
                EnabledVRDevices = reader.ReadStringArray();
            }
            if (HasBuildTags(reader.Version))
            {
                BuildTags = reader.ReadStringArray();
            }
            if (HasBuildGUID(reader.Version))
            {
                BuildGUID.Read(reader);
            }

            if (HasHasRenderTexture(reader.Version))
            {
                HasRenderTexture = reader.ReadBoolean();
            }
            HasPROVersion = reader.ReadBoolean();
            if (HasIsNoWatermarkBuild(reader.Version))
            {
                IsNoWatermarkBuild = reader.ReadBoolean();
                IsPrototypingBuild = reader.ReadBoolean();
            }
            if (HasIsEducationalBuild(reader.Version))
            {
                IsEducationalBuild = reader.ReadBoolean();
            }
            if (HasIsEmbedded(reader.Version))
            {
                IsEmbedded = reader.ReadBoolean();
            }
            HasPublishingRights = reader.ReadBoolean();
            if (HasHasShadows(reader.Version))
            {
                HasShadows = reader.ReadBoolean();
            }
            if (HasHasSoftShadows(reader.Version))
            {
                HasSoftShadows       = reader.ReadBoolean();
                HasLocalLightShadows = reader.ReadBoolean();
            }
            if (HasHasAdvancedVersion(reader.Version))
            {
                HasAdvancedVersion    = reader.ReadBoolean();
                EnableDynamicBatching = reader.ReadBoolean();
                IsDebugBuild          = reader.ReadBoolean();
            }
            if (HasUsesOnMouseEvents(reader.Version))
            {
                UsesOnMouseEvents = reader.ReadBoolean();
            }
            if (HasEnableMultipleDisplays(reader.Version))
            {
                EnableMultipleDisplays = reader.ReadBoolean();
            }
            if (HasHasOculusPlugin(reader.Version))
            {
                HasOculusPlugin = reader.ReadBoolean();
            }
            if (HasHasClusterRendering(reader.Version))
            {
                HasClusterRendering = reader.ReadBoolean();
            }
            if (IsAlignBools(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasVersion(reader.Version))
            {
                Version = reader.ReadString();
            }
            if (HasAuthToken(reader.Version))
            {
                AuthToken = reader.ReadString();
            }

            if (HasRuntimeClassHashes(reader.Version))
            {
                RuntimeClassHashes = new Dictionary <int, Hash128>();
                if (IsRuntimeClassHashesUInt32(reader.Version))
                {
                    Dictionary <int, uint> runtimeClassHashes = new Dictionary <int, uint>();
                    runtimeClassHashes.Read(reader);
                    foreach (KeyValuePair <int, uint> kvp in runtimeClassHashes)
                    {
                        RuntimeClassHashes.Add(kvp.Key, new Hash128(kvp.Value));
                    }
                }
                else
                {
                    RuntimeClassHashes.Read(reader);
                }
            }
            if (HasScriptHashes(reader.Version))
            {
                ScriptHashes = new Dictionary <Hash128, Hash128>();
                ScriptHashes.Read(reader);
            }
            if (HasGraphicsAPIs(reader.Version))
            {
                GraphicsAPIs = reader.ReadInt32Array();
            }
        }
Beispiel #2
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadFontImpl(reader.Version))
            {
                LineSpacing = reader.ReadSingle();
                DefaultMaterial.Read(reader);
                FontSize = reader.ReadSingle();
                Texture.Read(reader);
                reader.AlignStream(AlignType.Align4);
            }

            if (IsShortAsciiStartOffset(reader.Version))
            {
                AsciiStartOffset = reader.ReadInt16();
                FontCountX       = reader.ReadInt16();
                FontCountY       = reader.ReadInt16();
            }
            else
            {
                AsciiStartOffset = reader.ReadInt32();
                if (IsReadFontCount(reader.Version))
                {
                    FontCountX = reader.ReadInt32();
                    FontCountY = reader.ReadInt32();
                }
            }

            if (IsReadKerning(reader.Version))
            {
                Kerning = reader.ReadSingle();
            }
            if (IsReadTracking(reader.Version))
            {
                Tracking = reader.ReadSingle();
            }

            if (!IsReadFontImpl(reader.Version))
            {
                LineSpacing = reader.ReadSingle();
            }

            if (IsReadCharacterSpacing(reader.Version))
            {
                CharacterSpacing = reader.ReadInt32();
                CharacterPadding = reader.ReadInt32();
            }

            if (IsReadPerCharacterKerning(reader.Version))
            {
                if (IsBytePerCharacterKerning(reader.Version))
                {
                    m_perCharacterKerningByte = reader.ReadTupleByteSingleArray();
                }
                else
                {
                    m_perCharacterKerning = reader.ReadTupleIntFloatArray();
                }
            }

            ConvertCase = reader.ReadInt32();
            if (!IsReadFontImpl(reader.Version))
            {
                DefaultMaterial.Read(reader);
            }
            m_characterRects = reader.ReadArray <CharacterInfo>();
            if (!IsReadFontImpl(reader.Version))
            {
                Texture.Read(reader);
            }

            if (IsReadGridFont(reader.Version))
            {
                if (IsGridFontFirst(reader.Version))
                {
                    GridFont = reader.ReadBoolean();
                }
            }

            if (IsByteKerningValues(reader.Version))
            {
                m_kerningValuesByte = new Dictionary <Tuple <byte, byte>, float>();
                m_kerningValuesByte.Read(reader);
            }
            else
            {
                m_kerningValues.Read(reader);
            }

            if (IsReadPixelScale(reader.Version))
            {
                PixelScale = reader.ReadSingle();
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadGridFont(reader.Version))
            {
                if (!IsGridFontFirst(reader.Version))
                {
                    GridFont = reader.ReadBoolean();
                    if (IsAlign(reader.Version))
                    {
                        reader.AlignStream(AlignType.Align4);
                    }
                }
            }

            if (IsReadFontData(reader.Version))
            {
                m_fontData = reader.ReadByteArray();
                reader.AlignStream(AlignType.Align4);

                if (!IsReadFontImpl(reader.Version))
                {
                    FontSize = reader.ReadSingle();
                }
                Ascent = reader.ReadSingle();
            }
            if (IsReadDescent(reader.Version))
            {
                Descent = reader.ReadSingle();
            }
            if (IsReadDefaultStyle(reader.Version))
            {
                DefaultStyle = (FontStyle)reader.ReadUInt32();
                m_fontNames  = reader.ReadStringArray();
            }

            if (IsReadFallbackFonts(reader.Version))
            {
                m_fallbackFonts = reader.ReadArray <PPtr <Font> >();
                reader.AlignStream(AlignType.Align4);

                FontRenderingMode = (FontRenderingMode)reader.ReadInt32();
            }

            if (IsReadUseLegacyBoundsCalculation(reader.Version))
            {
                UseLegacyBoundsCalculation = reader.ReadBoolean();
            }
            if (IsReadShouldRoundAdvanceValue(reader.Version))
            {
                ShouldRoundAdvanceValue = reader.ReadBoolean();
            }
        }
Beispiel #3
0
        public void Read(AssetReader reader)
        {
            if (IsReadName(reader.Version))
            {
                Name = reader.ReadString();
            }
            PixelLightCount = reader.ReadInt32();
            if (IsReadShadows(reader.Version))
            {
                Shadows          = (ShadowQuality)reader.ReadInt32();
                ShadowResolution = (ShadowResolution)reader.ReadInt32();
            }
            if (IsReadShadowProjection(reader.Version))
            {
                ShadowProjection = (ShadowProjection)reader.ReadInt32();
            }
            if (IsReadShadowCascades(reader.Version))
            {
                ShadowCascades = (ShadowCascades)reader.ReadInt32();
                ShadowDistance = reader.ReadSingle();
            }
            if (IsReadShadowNearPlaneOffset(reader.Version))
            {
                ShadowNearPlaneOffset = reader.ReadSingle();
            }
            if (IsReadShadowCascade2Split(reader.Version))
            {
                ShadowCascade2Split = reader.ReadSingle();
                ShadowCascade4Split.Read(reader);
            }
            if (IsReadShadowmaskMode(reader.Version))
            {
                ShadowmaskMode = (ShadowmaskMode)reader.ReadInt32();
            }

            SkinWeights         = (SkinWeights)reader.ReadInt32();
            TextureQuality      = (TextureQuality)reader.ReadInt32();
            AnisotropicTextures = (AnisotropicFiltering)reader.ReadInt32();
            AntiAliasing        = (AntiAliasing)reader.ReadInt32();
            if (IsReadSoftParticles(reader.Version))
            {
                SoftParticles = reader.ReadBoolean();
            }
            if (IsReadSoftVegetation(reader.Version))
            {
                SoftVegetation = reader.ReadBoolean();
            }
            if (IsReadRealtimeReflectionProbes(reader.Version))
            {
                RealtimeReflectionProbes = reader.ReadBoolean();
            }
            if (IsReadBillboardsFaceCameraPosition(reader.Version))
            {
                BillboardsFaceCameraPosition = reader.ReadBoolean();
            }
            if (IsReadSyncToVBL(reader.Version))
            {
                SyncToVBL = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadVSyncCount(reader.Version))
            {
                VSyncCount = (VSyncCount)reader.ReadInt32();
            }
            if (IsReadLodBias(reader.Version))
            {
                LodBias         = reader.ReadSingle();
                MaximumLODLevel = reader.ReadInt32();
            }

            if (IsReadStreamingMipmapsActive(reader.Version))
            {
                StreamingMipmapsActive        = reader.ReadBoolean();
                StreamingMipmapsAddAllCameras = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);

                StreamingMipmapsMemoryBudget      = reader.ReadSingle();
                StreamingMipmapsRenderersPerFrame = reader.ReadInt32();
                StreamingMipmapsMaxLevelReduction = reader.ReadInt32();
                StreamingMipmapsMaxFileIORequests = reader.ReadInt32();
            }
            if (IsReadParticleRaycastBudget(reader.Version))
            {
                ParticleRaycastBudget = reader.ReadInt32();
            }
            if (IsReadAsyncUploadTimeSlice(reader.Version))
            {
                AsyncUploadTimeSlice  = reader.ReadInt32();
                AsyncUploadBufferSize = reader.ReadInt32();
            }
            if (IsReadAsyncUploadPersistentBuffer(reader.Version))
            {
                AsyncUploadPersistentBuffer = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadResolutionScalingFixedDPIFactor(reader.Version))
            {
                ResolutionScalingFixedDPIFactor = reader.ReadSingle();
            }
            if (IsReadVSyncCount(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

#if UNIVERSAL
            if (IsReadExcludedTargetPlatforms(reader.Version, reader.Flags))
            {
                m_excludedTargetPlatforms = reader.ReadStringArray();
            }
#endif
        }
Beispiel #4
0
        public void Read(AssetReader reader)
        {
            switch (Type.Type)
            {
            case PrimitiveType.Bool:
                if (IsArray)
                {
                    Value = reader.ReadBooleanArray();
                }
                else
                {
                    Value = reader.ReadBoolean();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Byte:
                if (IsArray)
                {
                    Value = reader.ReadByteArray();
                }
                else
                {
                    Value = reader.ReadByte();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Char:
                if (IsArray)
                {
                    Value = reader.ReadCharArray();
                }
                else
                {
                    Value = reader.ReadChar();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Short:
                if (IsArray)
                {
                    Value = reader.ReadInt16Array();
                }
                else
                {
                    Value = reader.ReadInt16();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.UShort:
                if (IsArray)
                {
                    Value = reader.ReadUInt16Array();
                }
                else
                {
                    Value = reader.ReadUInt16();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Int:
                if (IsArray)
                {
                    Value = reader.ReadInt32Array();
                }
                else
                {
                    Value = reader.ReadInt32();
                }
                break;

            case PrimitiveType.UInt:
                if (IsArray)
                {
                    Value = reader.ReadUInt32Array();
                }
                else
                {
                    Value = reader.ReadUInt32();
                }
                break;

            case PrimitiveType.Long:
                if (IsArray)
                {
                    Value = reader.ReadInt64Array();
                }
                else
                {
                    Value = reader.ReadInt64();
                }
                break;

            case PrimitiveType.ULong:
                if (IsArray)
                {
                    Value = reader.ReadUInt64Array();
                }
                else
                {
                    Value = reader.ReadUInt64();
                }
                break;

            case PrimitiveType.Single:
                if (IsArray)
                {
                    Value = reader.ReadSingleArray();
                }
                else
                {
                    Value = reader.ReadSingle();
                }
                break;

            case PrimitiveType.Double:
                if (IsArray)
                {
                    Value = reader.ReadDoubleArray();
                }
                else
                {
                    Value = reader.ReadDouble();
                }
                break;

            case PrimitiveType.String:
                if (IsArray)
                {
                    Value = reader.ReadStringArray();
                }
                else
                {
                    Value = reader.ReadStringAligned();
                }
                break;

            case PrimitiveType.Complex:
                if (IsArray)
                {
                    int count = reader.ReadInt32();
                    IScriptStructure[] structures = new IScriptStructure[count];
                    for (int i = 0; i < count; i++)
                    {
                        IScriptStructure structure = Type.ComplexType.CreateCopy();
                        structure.Read(reader);
                        structures[i] = structure;
                    }
                    Value = structures;
                }
                else
                {
                    IScriptStructure structure = Type.ComplexType.CreateCopy();
                    structure.Read(reader);
                    Value = structure;
                }
                break;

            default:
                throw new NotImplementedException($"Unknown {nameof(PrimitiveType)} '{Type.Type}'");
            }
        }
Beispiel #5
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Gravity.Read(reader);
            DefaultMaterial.Read(reader);
            BounceThreshold = reader.ReadSingle();
            if (IsReadSleepThreshold(reader.Version))
            {
                SleepThreshold = reader.ReadSingle();
            }
            else
            {
                SleepVelocity        = reader.ReadSingle();
                SleepAngularVelocity = reader.ReadSingle();
            }
            if (IsReadSleepAngularVelocity(reader.Version))
            {
                MaxAngularVelocity = reader.ReadSingle();
            }
            if (IsReadDefaultContactOffset(reader.Version))
            {
                DefaultContactOffset = reader.ReadSingle();
            }
            else
            {
                MinPenetrationForPenalty = reader.ReadSingle();
            }
            DefaultSolverIterations = reader.ReadInt32();
            if (IsReadDefaultSolverVelocityIterations(reader.Version))
            {
                DefaultSolverVelocityIterations = reader.ReadInt32();
            }
            if (IsReadQueriesHitBackfaces(reader.Version))
            {
                QueriesHitBackfaces = reader.ReadBoolean();
            }
            if (IsReadQueriesHitTriggers(reader.Version))
            {
                QueriesHitTriggers = reader.ReadBoolean();
            }
            if (IsReadEnableAdaptiveForce(reader.Version))
            {
                EnableAdaptiveForce = reader.ReadBoolean();
            }
            if (IsReadEnablePCM(reader.Version))
            {
                EnablePCM = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadClothInterCollisionDistance(reader.Version))
            {
                ClothInterCollisionDistance  = reader.ReadSingle();
                ClothInterCollisionStiffness = reader.ReadSingle();
                ContactsGeneration           = (ContactsGeneration)reader.ReadInt32();
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadLayerCollisionMatrix(reader.Version))
            {
                m_layerCollisionMatrix = reader.ReadUInt32Array();
            }

            if (IsReadAutoSimulation(reader.Version))
            {
                AutoSimulation = reader.ReadBoolean();
            }
            if (IsReadAutoSyncTransforms(reader.Version))
            {
                AutoSyncTransforms = reader.ReadBoolean();
            }
            if (IsReadClothInterCollisionSettingsToggle(reader.Version))
            {
                ClothInterCollisionSettingsToggle = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadClothGravity(reader.Version))
            {
                ClothGravity.Read(reader);
            }
            if (IsReadContactPairsMode(reader.Version))
            {
                ContactPairsMode = (ContactPairsMode)reader.ReadInt32();
                BroadphaseType   = (BroadphaseType)reader.ReadInt32();
                WorldBounds.Read(reader);
                WorldSubdivisions = reader.ReadInt32();
            }
            if (IsReadFrictionType(reader.Version))
            {
                FrictionType = (FrictionType)reader.ReadInt32();
                EnableEnhancedDeterminism = reader.ReadBoolean();
                EnableUnifiedHeightmaps   = reader.ReadBoolean();
            }
            if (IsReadDefaultMaxAngularSpeed(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);

                DefaultMaxAngularSpeed = reader.ReadSingle();
            }
        }
Beispiel #6
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            TerrainData.Read(reader);
            TreeDistance            = reader.ReadSingle();
            TreeBillboardDistance   = reader.ReadSingle();
            TreeCrossFadeLength     = reader.ReadSingle();
            TreeMaximumFullLODCount = reader.ReadInt32();
            DetailObjectDistance    = reader.ReadSingle();
            DetailObjectDensity     = reader.ReadSingle();
            HeightmapPixelError     = reader.ReadSingle();
            SplatMapDistance        = reader.ReadSingle();
            HeightmapMaximumLOD     = reader.ReadInt32();
            if (HasShadowCastingMode(reader.Version))
            {
                ShadowCastingMode = (ShadowCastingMode)reader.ReadInt32();
            }
            else
            {
                bool CastShadows = reader.ReadBoolean();
                ShadowCastingMode = CastShadows ? ShadowCastingMode.TwoSided : ShadowCastingMode.Off;
            }
            if (HasDrawHeightmap(reader.Version))
            {
                DrawHeightmap = reader.ReadBoolean();
            }
            if (HasDrawInstanced(reader.Version))
            {
                DrawInstanced = reader.ReadBoolean();
            }
            DrawTreesAndFoliage = reader.ReadBoolean();
            reader.AlignStream();

            if (HasReflectionProbeUsage(reader.Version))
            {
                ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadInt32();
            }
            if (HasMaterialType(reader.Version))
            {
                MaterialType = (MaterialType)reader.ReadInt32();
                LegacySpecular.Read(reader);
                LegacyShininess = reader.ReadSingle();
            }
            if (HasDefaultSmoothness(reader.Version))
            {
                UseDefaultSmoothness = reader.ReadBoolean();
                DefaultSmoothness    = reader.ReadSingle();
            }
            MaterialTemplate.Read(reader);
            if (HasLightmapIndex(reader.Flags))
            {
                LightmapIndex        = reader.ReadUInt16();
                LightmapIndexDynamic = reader.ReadUInt16();
                LightmapTilingOffset.Read(reader);
                LightmapTilingOffsetDynamic.Read(reader);
            }
            if (HasExplicitProbeSetHash(reader.Version, reader.Flags))
            {
                ExplicitProbeSetHash.Read(reader);
            }

            if (HasBakeLightProbesForTrees(reader.Version))
            {
                BakeLightProbesForTrees = reader.ReadBoolean();
            }
            if (HasPreserveTreePrototypeLayers(reader.Version))
            {
                PreserveTreePrototypeLayers = reader.ReadBoolean();
            }
            if (HasDeringLightProbesForTrees(reader.Version, reader.Flags))
            {
                DeringLightProbesForTrees = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream();
            }
#if UNIVERSAL
            if (HasScaleInLightmap(reader.Flags))
            {
                ScaleInLightmap = reader.ReadSingle();
                LightmapParameters.Read(reader);
            }
#endif
            if (HasDynamicUVST(reader.Version, reader.Flags))
            {
                DynamicUVST.Read(reader);
                ChunkDynamicUVST.Read(reader);
                reader.AlignStream();
            }
            if (HasGroupingID(reader.Version))
            {
                GroupingID       = reader.ReadInt32();
                AllowAutoConnect = reader.ReadBoolean();
            }
        }
Beispiel #7
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadLoadType(reader.Version))
            {
                LoadType      = (AudioClipLoadType)reader.ReadInt32();
                Channels      = reader.ReadInt32();
                Frequency     = reader.ReadInt32();
                BitsPerSample = reader.ReadInt32();
                Length        = reader.ReadSingle();

                if (IsReadIsTrackerFormat(reader.Version))
                {
                    IsTrackerFormat = reader.ReadBoolean();
                }
                if (IsReadAmbisonic(reader.Version))
                {
                    Ambisonic = reader.ReadBoolean();
                }
                if (IsAlignTrackerFormat(reader.Version))
                {
                    reader.AlignStream(AlignType.Align4);
                }

                if (IsReadAudioClipFlags(reader.Version))
                {
                    AudioClipFlags = reader.ReadInt32();
                }
                if (IsReadFSBResourceFirst(reader.Version))
                {
                    FSBResource.Read(reader);
                }

                SubsoundIndex    = reader.ReadInt32();
                PreloadAudioData = reader.ReadBoolean();
                LoadInBackground = reader.ReadBoolean();
                Legacy3D         = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);

                if (!IsReadFSBResourceFirst(reader.Version))
                {
                    FSBResource.Read(reader);
                }

                if (IsReadType(reader.Version))
                {
                    Type = (FMODSoundType)reader.ReadInt32();
                }
                if (IsReadCompressionFormat(reader.Version))
                {
                    CompressionFormat = (AudioCompressionFormat)reader.ReadInt32();
                }
                reader.AlignStream(AlignType.Align4);

#if UNIVERSAL
                if (IsReadEditorResource(reader.Flags))
                {
                    EditorResource.Read(reader);
                    if (IsReadCompressionFormat(reader.Version))
                    {
                        EditorCompressionFormat = (AudioCompressionFormat)reader.ReadInt32();
                    }
                }
#endif
            }
            else
            {
                if (IsReadDecompressOnLoadFirst(reader.Version))
                {
                    DecompressOnLoad = reader.ReadBoolean();
                }

                Format = (FMODSoundFormat)reader.ReadInt32();
                if (IsReadType(reader.Version))
                {
                    Type = (FMODSoundType)reader.ReadInt32();
                }
                if (IsReadLength(reader.Version))
                {
                    Length    = reader.ReadSingle();
                    Frequency = reader.ReadInt32();
                    Size      = reader.ReadInt32();
                }

                if (IsReadDecompressOnLoadSecond(reader.Version))
                {
                    DecompressOnLoad = reader.ReadBoolean();
                }
                if (IsRead3D(reader.Version))
                {
                    Legacy3D = reader.ReadBoolean();
                }
                if (IsReadUseHardware(reader.Version))
                {
                    UseHardware = reader.ReadBoolean();
                }
                if (IsAlignBools(reader.Version))
                {
                    reader.AlignStream(AlignType.Align4);
                }

                if (IsStreamInt32(reader.Version))
                {
                    LoadType = (AudioClipLoadType)reader.ReadInt32();
                }

                if (IsReadStreamingInfo(reader.Version))
                {
                    bool isInnerData = true;
                    if (LoadType == AudioClipLoadType.Streaming)
                    {
                        using (ResourcesFile res = File.Collection.FindResourcesFile(File, StreamingFileName))
                        {
                            isInnerData = res == null;
                        }
                    }
                    if (isInnerData)
                    {
                        m_audioData = reader.ReadByteArray();
                        reader.AlignStream(AlignType.Align4);
                    }
                    else
                    {
                        StreamingInfo.Read(reader, StreamingFileName);
                    }
                }
                else
                {
                    m_audioData = reader.ReadByteArray();
                    if (IsAlignAudioData(reader.Version))
                    {
                        reader.AlignStream(AlignType.Align4);
                    }
                }

                if (IsReadDecompressOnLoadThird(reader.Version))
                {
                    DecompressOnLoad = reader.ReadBoolean();
                }

                if (IsReadStream(reader.Version))
                {
                    if (!IsStreamInt32(reader.Version))
                    {
                        LoadType = reader.ReadBoolean() ? AudioClipLoadType.CompressedInMemory : AudioClipLoadType.DecompressOnLoad;
                    }
                }
            }
        }
Beispiel #8
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadDeferred(reader.Version))
            {
                Deferred.Read(reader);
            }
            if (IsReadDeferredReflections(reader.Version))
            {
                DeferredReflections.Read(reader);
            }
            if (IsReadScreenSpaceShadows(reader.Version))
            {
                ScreenSpaceShadows.Read(reader);
            }
            if (IsReadLegacyDeferred(reader.Version))
            {
                LegacyDeferred.Read(reader);
            }
            if (IsReadDepthNormals(reader.Version))
            {
                DepthNormals.Read(reader);
                MotionVectors.Read(reader);
                LightHalo.Read(reader);
                LensFlare.Read(reader);
            }

            if (IsReadAlwaysIncludedShaders(reader.Version))
            {
                m_alwaysIncludedShaders = reader.ReadAssetArray <PPtr <Shader> >();
            }

            if (IsReadPreloadedShaders(reader.Version))
            {
                m_preloadedShaders = reader.ReadAssetArray <PPtr <ShaderVariantCollection> >();
            }
            if (IsReadSpritesDefaultMaterial(reader.Version))
            {
                SpritesDefaultMaterial.Read(reader);
            }
            if (IsReadCustomRenderPipeline(reader.Version))
            {
                CustomRenderPipeline.Read(reader);
                TransparencySortMode = (TransparencySortMode)reader.ReadInt32();
                TransparencySortAxis.Read(reader);
            }

            if (IsReadTierSettings(reader.Version))
            {
                if (IsReadPlatformSettings(reader.Version))
                {
                    if (IsReadPlatformSettingsTiers(reader.Version))
                    {
                        m_platformSettings    = new PlatformShaderSettings[3];
                        m_platformSettings[0] = reader.ReadAsset <PlatformShaderSettings>();
                        m_platformSettings[1] = reader.ReadAsset <PlatformShaderSettings>();
                        m_platformSettings[2] = reader.ReadAsset <PlatformShaderSettings>();
                    }
                    else
                    {
                        m_platformSettings    = new PlatformShaderSettings[1];
                        m_platformSettings[0] = reader.ReadAsset <PlatformShaderSettings>();
                    }
                }
                else
                {
                    if (IsReadStaticTierGraphicsSettings(reader.Version, reader.Flags))
                    {
                        m_tierGraphicSettings    = new TierGraphicsSettings[3];
                        m_tierGraphicSettings[0] = reader.ReadAsset <TierGraphicsSettings>();
                        m_tierGraphicSettings[1] = reader.ReadAsset <TierGraphicsSettings>();
                        m_tierGraphicSettings[2] = reader.ReadAsset <TierGraphicsSettings>();
                    }
                }
            }

#if UNIVERSAL
            if (IsReadEditorSettings(reader.Flags))
            {
                if (IsReadDefaultRenderingPath(reader.Version))
                {
                    DefaultRenderingPath       = (RenderingPath)reader.ReadInt32();
                    DefaultMobileRenderingPath = (RenderingPath)reader.ReadInt32();
                }
                if (IsReadTierSettings(reader.Version))
                {
                    m_tierSettings = reader.ReadAssetArray <TierSettings>();
                }

                if (IsReadLightmapStripping(reader.Version))
                {
                    LightmapStripping = (LightmapStrippingMode)reader.ReadInt32();
                }
                if (IsReadFogStripping(reader.Version))
                {
                    if (IsReadFogStrippingFirst(reader.Version))
                    {
                        FogStripping = (LightmapStrippingMode)reader.ReadInt32();
                    }
                }
                if (IsReadInstancingStripping(reader.Version))
                {
                    InstancingStripping = (InstancingStrippingVariant)reader.ReadInt32();
                }

                if (IsReadLightmapKeepPlain(reader.Version))
                {
                    LightmapKeepPlain       = reader.ReadBoolean();
                    LightmapKeepDirCombined = reader.ReadBoolean();
                }
                if (IsReadLightmapKeepDirSeparate(reader.Version))
                {
                    LightmapKeepDirSeparate = reader.ReadBoolean();
                }

                if (IsReadLightmapKeepDynamicPlain(reader.Version))
                {
                    if (IsReadLightmapKeepDynamic(reader.Version))
                    {
                        bool lightmapKeepDynamic = reader.ReadBoolean();
                        reader.AlignStream(AlignType.Align4);

                        LightmapKeepDynamicPlain       = lightmapKeepDynamic;
                        LightmapKeepDynamicDirCombined = lightmapKeepDynamic;
                        LightmapKeepDynamicDirSeparate = lightmapKeepDynamic;
                    }
                    else
                    {
                        LightmapKeepDynamicPlain       = reader.ReadBoolean();
                        LightmapKeepDynamicDirCombined = reader.ReadBoolean();
                    }
                }
                if (IsReadLightmapKeepDynamicDirSeparate(reader.Version))
                {
                    LightmapKeepDynamicDirSeparate = reader.ReadBoolean();
                }
                if (IsAlign(reader.Version))
                {
                    reader.AlignStream(AlignType.Align4);
                }

                if (IsReadLightmapKeepShadowMask(reader.Version))
                {
                    LightmapKeepShadowMask  = reader.ReadBoolean();
                    LightmapKeepSubtractive = reader.ReadBoolean();
                }
                if (IsReadFogStripping(reader.Version))
                {
                    if (!IsReadFogStrippingFirst(reader.Version))
                    {
                        FogStripping = (LightmapStrippingMode)reader.ReadInt32();
                    }
                }
                if (IsReadFogKeepLinear(reader.Version))
                {
                    FogKeepLinear = reader.ReadBoolean();
                    FogKeepExp    = reader.ReadBoolean();
                    FogKeepExp2   = reader.ReadBoolean();
                    reader.AlignStream(AlignType.Align4);
                }

                if (IsReadAlbedoSwatchInfos(reader.Version))
                {
                    m_albedoSwatchInfos = reader.ReadAssetArray <AlbedoSwatchInfo>();
                }
            }
            else
#endif
            {
                if (IsReadShaderDefinesPerShaderCompiler(reader.Version))
                {
                    m_shaderDefinesPerShaderCompiler = reader.ReadAssetArray <PlatformShaderDefines>();
                }
            }

            if (IsReadLightsUseLinearIntensity(reader.Version))
            {
                LightsUseLinearIntensity  = reader.ReadBoolean();
                LightsUseColorTemperature = reader.ReadBoolean();
            }
        }
Beispiel #9
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasMode(reader.Version))
            {
                Mode = (ParticleSystemAnimationMode)reader.ReadInt32();
            }
            if (HasTimeMode(reader.Version))
            {
                TimeMode = (ParticleSystemAnimationTimeMode)reader.ReadInt32();
                FPS      = reader.ReadSingle();
            }
            FrameOverTime.Read(reader);
            if (HasStartFrame(reader.Version))
            {
                StartFrame.Read(reader);
            }
            if (HasSpeedRange(reader.Version))
            {
                SpeedRange.Read(reader);
            }
            TilesX        = reader.ReadInt32();
            TilesY        = reader.ReadInt32();
            AnimationType = (ParticleSystemAnimationType)reader.ReadInt32();
            RowIndex      = reader.ReadInt32();
            Cycles        = reader.ReadSingle();
            if (HasUvChannelMask(reader.Version))
            {
                UvChannelMask = reader.ReadInt32();
            }
            if (HasFlipU(reader.Version))
            {
                if (HasFlipUFirst(reader.Version))
                {
                    FlipU = reader.ReadSingle();
                    FlipV = reader.ReadSingle();
                }
            }
            if (HasRowMode(reader.Version))
            {
                RowMode = (ParticleSystemAnimationRowMode)reader.ReadInt32();
            }
            else
            {
                bool RandomRow = reader.ReadBoolean();
                RowMode = RandomRow ? ParticleSystemAnimationRowMode.Random : ParticleSystemAnimationRowMode.Custom;
                reader.AlignStream();
            }

            if (HasSprites(reader.Version))
            {
                Sprites = reader.ReadAssetArray <SpriteData>();
            }
            if (HasFlipU(reader.Version))
            {
                if (!HasFlipUFirst(reader.Version))
                {
                    FlipU = reader.ReadSingle();
                    FlipV = reader.ReadSingle();
                }
            }
        }
Beispiel #10
0
 public void Read(AssetReader reader)
 {
     Enabled = reader.ReadBoolean();
     reader.AlignStream(AlignType.Align4);
 }
Beispiel #11
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Enabled = reader.ReadBoolean();
            if (IsAlignEnabled(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            CastShadows    = (ShadowCastingMode)reader.ReadByte();
            ReceiveShadows = reader.ReadByte();
            if (IsReadDynamicOccludee(reader.Version))
            {
                DynamicOccludee = reader.ReadByte();
            }
            if (IsAlignEnabled(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadMotionVector(reader.Version))
            {
                MotionVectors   = (MotionVectorGenerationMode)reader.ReadByte();
                LightProbeUsage = (LightProbeUsage)reader.ReadByte();
            }
            if (IsReadReflectUsage(reader.Version))
            {
                if (IsReadReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadByte();
                    reader.AlignStream(AlignType.Align4);
                }
            }

            if (IsReadRenderingLayerMask(reader.Version))
            {
                RenderingLayerMask = reader.ReadUInt32();
            }

            if (IsReadLightmapIndex(reader.Version, reader.Flags))
            {
                LightmapIndex = IsByteLightIndex(reader.Version) ? reader.ReadByte() : reader.ReadUInt16();
            }

            if (IsReadLightmapIndexDynamic(reader.Version, reader.Flags))
            {
                LightmapIndexDynamic = reader.ReadUInt16();
            }

            if (IsReadMaterialFirst(reader.Version))
            {
                m_materials = reader.ReadArray <PPtr <Material> >();
            }

            if (IsReadLightmapTilingOffset(reader.Version, reader.Flags))
            {
                LightmapTilingOffset.Read(reader);
            }
            if (IsReadLightmapTilingOffsetDynamic(reader.Version, reader.Flags))
            {
                LightmapTilingOffsetDynamic.Read(reader);
            }

            if (!IsReadMaterialFirst(reader.Version))
            {
                m_materials = reader.ReadArray <PPtr <Material> >();
            }

            if (IsReadSubsetIndices(reader.Version))
            {
                m_subsetIndices = reader.ReadUInt32Array();
            }
            if (IsReadStaticBatchInfo(reader.Version))
            {
                StaticBatchInfo.Read(reader);
            }

            if (IsReadStaticBatchRoot(reader.Version))
            {
                StaticBatchRoot.Read(reader);
            }

            if (IsReadUseLight(reader.Version))
            {
                UseLightProbes = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadReflectUsage(reader.Version))
            {
                if (!IsReadReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadInt32();
                }
            }

            if (IsReadProbeAnchor(reader.Version))
            {
                ProbeAnchor.Read(reader);
            }
            if (IsReadLightOverride(reader.Version))
            {
                LightProbeVolumeOverride.Read(reader);
            }
#if UNIVERSAL
            if (IsReadScaleInLightmap(reader.Flags))
            {
#warning TODO: separate by version
                ScaleInLightmap = reader.ReadSingle();
                PreserveUVs     = reader.ReadBoolean();
                IgnoreNormalsForChartDetection = reader.ReadBoolean();
                ImportantGI         = reader.ReadBoolean();
                StitchLightmapSeams = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);

                SelectedEditorRenderState = (EditorSelectedRenderState)reader.ReadInt32();
                MinimumChartSize          = reader.ReadInt32();
                AutoUVMaxDistance         = reader.ReadSingle();
                AutoUVMaxAngle            = reader.ReadSingle();
                LightmapParameters.Read(reader);
            }
#endif
            if (IsAlignLightProbe(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadSortingLayerID(reader.Version))
            {
                SortingLayerID = reader.ReadInt32();
            }
            if (IsReadSortingLayer(reader.Version))
            {
                SortingLayer = reader.ReadInt16();
            }
            if (IsReadSortingOrder(reader.Version))
            {
                SortingOrder = reader.ReadInt16();
            }
            if (IsAlignSortingOrder(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
        }
        public void Read(AssetReader reader)
        {
            DeltaPose.Read(reader);
            StartX.Read(reader);
            if (IsReadStopX(reader.Version))
            {
                StopX.Read(reader);
            }
            LeftFootStartX.Read(reader);
            RightFootStartX.Read(reader);

            if (IsReadMotion(reader.Version))
            {
                MotionStartX.Read(reader);
                MotionStopX.Read(reader);
            }

            if (IsVector3(reader.Version))
            {
                AverageSpeed.Read3(reader);
            }
            else
            {
                AverageSpeed.Read(reader);
            }

            Clip.Read(reader);

            StartTime          = reader.ReadSingle();
            StopTime           = reader.ReadSingle();
            OrientationOffsetY = reader.ReadSingle();
            Level               = reader.ReadSingle();
            CycleOffset         = reader.ReadSingle();
            AverageAngularSpeed = reader.ReadSingle();

            m_indexArray = reader.ReadInt32Array();
            if (IsReadAdditionalCurveIndexArray(reader.Version))
            {
                m_additionalCurveIndexArray = reader.ReadInt32Array();
            }
            m_valueArrayDelta = reader.ReadArray <ValueDelta>();

            if (IsReadValueArrayReferencePose(reader.Version))
            {
                m_valueArrayReferencePose = reader.ReadSingleArray();
            }

            Mirror = reader.ReadBoolean();
            if (IsReadLoopTime(reader.Version))
            {
                LoopTime = reader.ReadBoolean();
            }
            LoopBlend            = reader.ReadBoolean();
            LoopBlendOrientation = reader.ReadBoolean();
            LoopBlendPositionY   = reader.ReadBoolean();
            LoopBlendPositionXZ  = reader.ReadBoolean();

            if (IsReadStartAtOrigin(reader.Version))
            {
                StartAtOrigin = reader.ReadBoolean();
            }

            KeepOriginalOrientation = reader.ReadBoolean();
            KeepOriginalPositionY   = reader.ReadBoolean();
            KeepOriginalPositionXZ  = reader.ReadBoolean();
            HeightFromFeet          = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);
        }
Beispiel #13
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 = System.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);
            }
        }
Beispiel #14
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Type = (ParticleSystemCollisionType)reader.ReadInt32();
            if (IsReadCollisionMode(reader.Version))
            {
                CollisionMode = (ParticleSystemCollisionMode)reader.ReadInt32();
            }
            if (IsReadColliderForce(reader.Version))
            {
                ColliderForce = reader.ReadSingle();
                MultiplyColliderForceByParticleSize   = reader.ReadBoolean();
                MultiplyColliderForceByParticleSpeed  = reader.ReadBoolean();
                MultiplyColliderForceByCollisionAngle = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }

            Plane0.Read(reader);
            Plane1.Read(reader);
            Plane2.Read(reader);
            Plane3.Read(reader);
            Plane4.Read(reader);
            Plane5.Read(reader);

            if (IsReadDampenSingle(reader.Version))
            {
                float dampenSingle = reader.ReadSingle();
                float bounceSingle = reader.ReadSingle();
                float energyLossOnCollisionSingle = reader.ReadSingle();
                Dampen = new MinMaxCurve(dampenSingle);
                Bounce = new MinMaxCurve(bounceSingle);
                EnergyLossOnCollision = new MinMaxCurve(energyLossOnCollisionSingle);
            }
            else
            {
                Dampen.Read(reader);
                Bounce.Read(reader);
                EnergyLossOnCollision.Read(reader);
            }

            MinKillSpeed = reader.ReadSingle();
            if (IsReadMaxKillSpeed(reader.Version))
            {
                MaxKillSpeed = reader.ReadSingle();
            }
            if (IsReadRadiusScale(reader.Version))
            {
                RadiusScale = reader.ReadSingle();
                CollidesWith.Read(reader);
            }
            if (IsReadMaxCollisionShapes(reader.Version))
            {
                MaxCollisionShapes = reader.ReadInt32();
            }
            if (IsReadQuality(reader.Version))
            {
                Quality   = (ParticleSystemCollisionQuality)reader.ReadInt32();
                VoxelSize = reader.ReadSingle();
            }
            if (IsReadCollisionMessages(reader.Version))
            {
                CollisionMessages = reader.ReadBoolean();
            }
            if (IsReadCollidesWithDynamic(reader.Version))
            {
                CollidesWithDynamic = reader.ReadBoolean();
                InteriorCollisions  = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
        }
Beispiel #15
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadExternalVersionControl(reader.Version))
            {
                ExternalVersionControl support = (ExternalVersionControl)reader.ReadInt32();
                switch (support)
                {
                case ExternalVersionControl.AutoDetect:
                    ExternalVersionControlSupport = "Auto detect";
                    break;

                case ExternalVersionControl.Disabled:
                    ExternalVersionControlSupport = HiddenMeta;
                    break;

                case ExternalVersionControl.Generic:
                case ExternalVersionControl.AssetServer:
                    ExternalVersionControlSupport = VisibleMeta;
                    break;

                case ExternalVersionControl.Subversion:
                case ExternalVersionControl.Perforce:
                    ExternalVersionControlSupport = support.ToString();
                    break;

                default:
                    ExternalVersionControlSupport = HiddenMeta;
                    break;
                }
            }
            else
            {
                ExternalVersionControlSupport = reader.ReadString();
                switch (ExternalVersionControlSupport)
                {
                case "Disabled":
                    ExternalVersionControlSupport = HiddenMeta;
                    break;

                case "Meta Files":
                case "Asset Server":
                    ExternalVersionControlSupport = VisibleMeta;
                    break;
                }
            }
            SerializationMode = (SerializationMode)reader.ReadInt32();
            if (IsReadWebSecurityEmulationEnabled(reader.Version))
            {
                WebSecurityEmulationEnabled = reader.ReadInt32();
                WebSecurityEmulationHostUrl = reader.ReadString();
            }
            reader.AlignStream(AlignType.Align4);

            if (IsReadLineEndingsForNewScripts(reader.Version))
            {
                LineEndingsForNewScripts = (LineEndingsMode)reader.ReadInt32();
            }
            if (IsReadDefaultBehaviorMode(reader.Version))
            {
                DefaultBehaviorMode = (EditorBehaviorMode)reader.ReadInt32();
            }
            if (IsReadPrefabRegularEnvironment(reader.Version))
            {
                PrefabRegularEnvironment.Read(reader);
                PrefabUIEnvironment.Read(reader);
            }
            if (IsReadSpritePackerMode(reader.Version))
            {
                SpritePackerMode = (SpritePackerMode)reader.ReadInt32();
            }

            if (IsReadSpritePackerPaddingPower(reader.Version))
            {
                SpritePackerPaddingPower = reader.ReadInt32();
            }
            if (IsReadEtcTextureCompressorBehavior(reader.Version))
            {
                EtcTextureCompressorBehavior = reader.ReadInt32();
                EtcTextureFastCompressor     = reader.ReadInt32();
                EtcTextureNormalCompressor   = reader.ReadInt32();
                EtcTextureBestCompressor     = reader.ReadInt32();
            }
            if (IsReadProjectGenerationIncludedExtensions(reader.Version))
            {
                ProjectGenerationIncludedExtensions = reader.ReadString();
                ProjectGenerationRootNamespace      = reader.ReadString();
            }
            if (IsReadUserGeneratedProjectSuffix(reader.Version))
            {
                UserGeneratedProjectSuffix = reader.ReadString();
            }
            if (IsReadCollabEditorSettings(reader.Version))
            {
                CollabEditorSettings.Read(reader);
            }
            if (IsReadEnableTextureStreamingInEditMode(reader.Version))
            {
                EnableTextureStreamingInEditMode = reader.ReadBoolean();
            }
            if (IsReadEnableTextureStreamingInPlayMode(reader.Version))
            {
                EnableTextureStreamingInPlayMode = reader.ReadBoolean();
            }
            if (IsReadAsyncShaderCompilation(reader.Version))
            {
                AsyncShaderCompilation = reader.ReadBoolean();
            }
            if (IsAlign1(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadShowLightmapResolutionOverlay(reader.Version))
            {
                ShowLightmapResolutionOverlay = reader.ReadBoolean();
            }
            if (IsAlign2(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadEnlightenSceneMapping(reader.Version, reader.Flags))
            {
                EnlightenSceneMapping.Read(reader);
            }
            if (IsReadGIWorkflowMode(reader.Version, reader.Flags))
            {
                GIWorkflowMode = reader.ReadInt32();
            }

            if (IsReadLightProbes(reader.Version, reader.Flags))
            {
                LightProbes.Read(reader);
            }
            if (IsReadLightmaps(reader.Flags))
            {
                m_lightmaps = reader.ReadArray <LightmapData>();
            }
            if (IsAlign1(reader.Version, reader.Flags))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadLightmapsMode(reader.Version, reader.Flags))
            {
                LightmapsMode = (LightmapsMode)reader.ReadInt32();
            }
            if (IsReadBakedColorSpace(reader.Version))
            {
                BakedColorSpace = reader.ReadInt32();
            }
            if (IsReadUseDualLightmapsInForward(reader.Version))
            {
                UseDualLightmapsInForward = reader.ReadBoolean();
            }
            if (IsAlign2(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadGISettings(reader.Version))
            {
                GISettings.Read(reader);
            }

            if (IsReadLightmapEditorSettings(reader.Version, reader.Flags))
            {
                LightmapEditorSettings.Read(reader);
            }
            if (IsReadLightingDataAsset(reader.Version, reader.Flags))
            {
                LightingDataAsset.Read(reader);
            }
            if (IsReadRuntimeCPUUsage(reader.Version))
            {
                RuntimeCPUUsage = reader.ReadInt32();
            }
            if (IsReadUseShadowmask(reader.Version))
            {
                if (IsBoolShadowmask(reader.Version))
                {
                    UseShadowmask = reader.ReadBoolean();
                }
                else
                {
                    UseShadowmask = reader.ReadInt32() == 0 ? false : true;
                }
            }
        }
Beispiel #17
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Type = (LightType)reader.ReadInt32();
            Color.Read(reader);
            if (IsReadAttenuate(reader.Version))
            {
                Attenuate = reader.ReadBoolean();
                if (IsAlign(reader.Version))
                {
                    reader.AlignStream(AlignType.Align4);
                }
            }
            if (IsReadIntensity(reader.Version))
            {
                Intensity = reader.ReadSingle();
            }
            Range     = reader.ReadSingle();
            SpotAngle = reader.ReadSingle();
            if (IsReadInnerSpotAngle(reader.Version))
            {
                InnerSpotAngle = reader.ReadSingle();
            }
            if (IsReadCookieSize(reader.Version))
            {
                CookieSize = reader.ReadSingle();
            }
            if (IsReadShadows(reader.Version))
            {
                Shadows.Read(reader);
            }
            Cookie.Read(reader);
            DrawHalo = reader.ReadBoolean();
            if (IsReadActuallyLightmapped(reader.Version))
            {
                ActuallyLightmapped = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadBakedIndex(reader.Version))
            {
                BakedIndex = reader.ReadInt32();
            }
            if (IsReadBakingOutput(reader.Version, reader.Flags))
            {
                BakingOutput.Read(reader);
            }
            Flare.Read(reader);
            RenderMode = (LightRenderMode)reader.ReadInt32();
            if (IsReadCullingMask(reader.Version))
            {
                CullingMask.Read(reader);
            }
            if (IsReadRenderingLayerMask(reader.Version))
            {
                RenderingLayerMask = reader.ReadInt32();
            }
            if (IsReadLightmapping(reader.Version))
            {
                Lightmapping = (LightmappingMode)reader.ReadInt32();
            }
            if (IsReadLightShadowCasterMode(reader.Version))
            {
                LightShadowCasterMode = (LightShadowCasterMode)reader.ReadInt32();
            }
            if (IsReadAreaSize(reader.Version))
            {
                AreaSize.Read(reader);
            }
            if (IsReadBounceIntensity(reader.Version))
            {
                BounceIntensity = reader.ReadSingle();
            }
            if (IsReadFalloffTable(reader.Version))
            {
                FalloffTable.Read(reader);
            }
            if (IsReadColorTemperature(reader.Version))
            {
                ColorTemperature = reader.ReadSingle();
            }
            if (IsReadUseColorTemperature(reader.Version))
            {
                UseColorTemperature = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadBoundingSphereOverride(reader.Version))
            {
                BoundingSphereOverride.Read(reader);
                UseBoundingSphereOverride = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
#if UNIVERSAL
            if (IsReadShadowRadius(reader.Version, reader.Flags))
            {
                ShadowRadius = reader.ReadSingle();
                ShadowAngle  = reader.ReadSingle();
            }
#endif
        }
Beispiel #18
0
 public void Read(AssetReader reader)
 {
     Collider.Read(reader);
     ColliderPaths = reader.ReadAssetArrayArray <IntPoint>();
     reader.AlignStream();
 }
Beispiel #19
0
        public override void Read(AssetReader reader)
        {
            if (IsSerialized(reader.Version))
            {
                ReadBase(reader);

                ParsedForm.Read(reader);

                m_platforms = reader.ReadEnum32Array((t) => (GPUPlatform)t);
                uint[] offsets             = reader.ReadUInt32Array();
                uint[] compressedLengths   = reader.ReadUInt32Array();
                uint[] decompressedLengths = reader.ReadUInt32Array();
                byte[] compressedBlob      = reader.ReadByteArray();
                reader.AlignStream(AlignType.Align4);

                m_subProgramBlobs = new ShaderSubProgramBlob[m_platforms.Length];
                using (MemoryStream memStream = new MemoryStream(compressedBlob))
                {
                    for (int i = 0; i < m_platforms.Length; i++)
                    {
                        uint offset             = offsets[i];
                        uint compressedLength   = compressedLengths[i];
                        uint decompressedLength = decompressedLengths[i];

                        memStream.Position = offset;
                        byte[] decompressedBuffer = new byte[decompressedLength];
                        using (Lz4DecodeStream lz4Stream = new Lz4DecodeStream(memStream, (int)compressedLength))
                        {
                            int read = lz4Stream.Read(decompressedBuffer, 0, decompressedBuffer.Length);
                            if (read != decompressedLength)
                            {
                                throw new Exception($"Can't properly decode shader blob. Read {read} but expected {decompressedLength}");
                            }
                        }

                        using (MemoryStream blobMem = new MemoryStream(decompressedBuffer))
                        {
                            using (AssetReader blobReader = new AssetReader(blobMem, reader.Version, reader.Platform, reader.Flags))
                            {
                                ShaderSubProgramBlob blob = new ShaderSubProgramBlob();
                                blob.Read(blobReader);
                                m_subProgramBlobs[i] = blob;
                            }
                        }
                    }
                }
            }
            else
            {
                base.Read(reader);

                if (IsEncoded(reader.Version))
                {
                    uint decompressedSize = reader.ReadUInt32();
                    int  comressedSize    = reader.ReadInt32();

                    byte[] subProgramBlob = new byte[comressedSize];
                    reader.Read(subProgramBlob, 0, comressedSize);
                    reader.AlignStream(AlignType.Align4);

                    if (comressedSize > 0 && decompressedSize > 0)
                    {
                        byte[] decompressedBuffer = new byte[decompressedSize];
                        using (MemoryStream memStream = new MemoryStream(subProgramBlob))
                        {
                            using (Lz4DecodeStream lz4Stream = new Lz4DecodeStream(memStream))
                            {
                                int read = lz4Stream.Read(decompressedBuffer, 0, decompressedBuffer.Length);
                                if (read != decompressedSize)
                                {
                                    throw new Exception($"Can't properly decode sub porgram blob. Read {read} but expected {decompressedSize}");
                                }
                            }
                        }

                        using (MemoryStream memStream = new MemoryStream(decompressedBuffer))
                        {
                            using (AssetReader blobReader = new AssetReader(memStream, reader.Version, reader.Platform, reader.Flags))
                            {
                                SubProgramBlob.Read(blobReader);
                            }
                        }
                    }
                }

                if (IsReadFallback(reader.Version))
                {
                    Fallback.Read(reader);
                }
                if (IsReadDefaultProperties(reader.Version))
                {
                    DefaultProperties.Read(reader);
                }
                if (IsReadStaticProperties(reader.Version))
                {
                    StaticProperties.Read(reader);
                }
            }

            if (IsReadDependencies(reader.Version))
            {
                m_dependencies = reader.ReadAssetArray <PPtr <Shader> >();
            }
            if (IsReadNonModifiableTextures(reader.Version))
            {
                m_nonModifiableTextures = new Dictionary <string, PPtr <Texture> >();
                m_nonModifiableTextures.Read(reader);
            }
            if (IsReadShaderIsBaked(reader.Version))
            {
                ShaderIsBaked = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            // editor DefaultTextures
            // editor CompileInfo
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Fog = reader.ReadBoolean();
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            FogColor.Read(reader);
            if (IsReadFogMode(reader.Version))
            {
                FogMode = (FogMode)reader.ReadInt32();
            }
            FogDensity = reader.ReadSingle();
            if (IsReadLinearFogStart(reader.Version))
            {
                LinearFogStart = reader.ReadSingle();
                LinearFogEnd   = reader.ReadSingle();
            }
            AmbientSkyColor.Read(reader);
            if (IsReadAmbientEquatorColor(reader.Version))
            {
                AmbientEquatorColor.Read(reader);
                AmbientGroundColor.Read(reader);
                AmbientIntensity = reader.ReadSingle();
            }
            if (IsReadAmbientProbe(reader.Version, reader.Flags))
            {
                if (IsReadAmbientProbeFirst(reader.Version))
                {
                    AmbientProbe.Read(reader);
                }
            }
            if (IsReadAmbientSkyboxLight(reader.Version))
            {
                AmbientSkyboxLight.Read(reader);
            }
            if (IsReadAmbientMode(reader.Version))
            {
                AmbientMode = (AmbientMode)reader.ReadInt32();
                if (IsReadCreateAmbientLight(reader.Version))
                {
                    CreateAmbientLight = reader.ReadBoolean();
                }
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadSubtractiveShadowColor(reader.Version))
            {
                SubtractiveShadowColor.Read(reader);
            }

            SkyboxMaterial.Read(reader);
            HaloStrength  = reader.ReadSingle();
            FlareStrength = reader.ReadSingle();
            if (IsReadFlareFadeSpeed(reader.Version))
            {
                FlareFadeSpeed = reader.ReadSingle();
            }
            if (IsReadPixelLightCount(reader.Version))
            {
                PixelLightCount = reader.ReadInt32();
            }
            HaloTexture.Read(reader);
            if (IsReadAmbientLightScale(reader.Version))
            {
                AmbientLightScale = reader.ReadSingle();
            }
            if (IsReadSpecularTex(reader.Version))
            {
                SpecularTexture.Read(reader);
            }
            SpotCookie.Read(reader);
            if (IsReadDefaultReflectionMode(reader.Version))
            {
                DefaultReflectionMode = reader.ReadInt32();
            }
            if (IsReadDefaultReflectionResolution(reader.Version))
            {
                DefaultReflectionResolution = reader.ReadInt32();
                ReflectionBounces           = reader.ReadInt32();
                ReflectionIntensity         = reader.ReadSingle();
            }
            if (IsReadCustomReflection(reader.Version))
            {
                CustomReflection.Read(reader);
            }
            if (IsReadAmbientProbe(reader.Version, reader.Flags))
            {
                if (!IsReadAmbientProbeFirst(reader.Version))
                {
                    AmbientProbe.Read(reader);
                }
            }
            if (IsReadAmbientProbeInGamma(reader.Version, reader.Flags))
            {
                AmbientProbeInGamma.Read(reader);
            }
            if (IsReadGeneratedSkyboxReflection(reader.Version, reader.Flags))
            {
                GeneratedSkyboxReflection.Read(reader);
            }
            if (IsReadSun(reader.Version))
            {
                Sun.Read(reader);
            }
            if (IsReadIndirectSpecularColor(reader.Version))
            {
                IndirectSpecularColor.Read(reader);
            }
            if (IsReadUseRadianceAmbientProbe(reader.Version))
            {
                UseRadianceAmbientProbe = reader.ReadBoolean();
            }
        }
Beispiel #21
0
 public void Read(AssetReader reader)
 {
     m_channels = reader.ReadAssetArray <ShaderBindChannel>();
     reader.AlignStream(AlignType.Align4);
     SourceMap = reader.ReadInt32();
 }
Beispiel #22
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadClassIDToTrack(reader.Version))
            {
                m_classIDToTrack = new Dictionary <int, PPtr <BaseAnimationTrack> >();
                m_classIDToTrack.Read(reader);
                m_childTracks = reader.ReadArray <ChildTrack>();
            }

            if (IsReadAnimationType(reader.Version))
            {
                AnimationType = (AnimationType)reader.ReadInt32();
            }
            if (IsReadLegacy(reader.Version))
            {
                Legacy = reader.ReadBoolean();
            }

            if (IsReadCompressed(reader.Version))
            {
                Compressed = reader.ReadBoolean();
            }
            if (IsReadUseHightQualityCurve(reader.Version))
            {
                UseHightQualityCurve = reader.ReadBoolean();
            }
            if (IsAlignCompressed(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadCurves(reader.Version))
            {
                m_rotationCurves = reader.ReadArray <QuaternionCurve>();
            }
            if (IsReadCompressedRotationCurves(reader.Version))
            {
                m_compressedRotationCurves = reader.ReadArray <CompressedAnimationCurve>();
            }
            if (IsReadEulerCurves(reader.Version))
            {
                m_eulerCurves = reader.ReadArray <Vector3Curve>();
            }
            if (IsReadCurves(reader.Version))
            {
                m_positionCurves = reader.ReadArray <Vector3Curve>();
                m_scaleCurves    = reader.ReadArray <Vector3Curve>();
                m_floatCurves    = reader.ReadArray <FloatCurve>();
            }
            if (IsReadPPtrCurves(reader.Version))
            {
                m_PPtrCurves = reader.ReadArray <PPtrCurve>();
            }

            if (IsReadSampleRate(reader.Version))
            {
                SampleRate = reader.ReadSingle();
            }

            if (IsReadWrapMode(reader.Version))
            {
                WrapMode = (WrapMode)reader.ReadInt32();
            }
            if (IsReadBounds(reader.Version))
            {
                Bounds.Read(reader);
            }
            if (IsReadMuscleClipSize(reader.Version))
            {
                MuscleClipSize = reader.ReadUInt32();
                MuscleClip.Read(reader);
            }
            if (IsReadClipBindingConstant(reader.Version))
            {
                ClipBindingConstant.Read(reader);
            }

            if (IsReadEvents(reader.Version))
            {
                m_events = reader.ReadArray <AnimationEvent>();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
        }
Beispiel #23
0
        public void Read(AssetReader reader)
        {
            int magic = reader.ReadInt32();

            if (magic != GetMagicNumber(reader.Version))
            {
                throw new Exception($"Magic number {magic} doesn't match");
            }

            ProgramType = reader.ReadInt32();
            Unknown1    = reader.ReadInt32();
            Unknown2    = reader.ReadInt32();
            Unknown3    = reader.ReadInt32();
            if (HasUnknown4(reader.Version))
            {
                Unknown4 = reader.ReadInt32();
            }

            GlobalKeywords = reader.ReadStringArray();
            if (HasLocalKeywords(reader.Version))
            {
                LocalKeywords = reader.ReadStringArray();
            }
            ProgramData = reader.ReadByteArray();
            reader.AlignStream();

            int sourceMap = reader.ReadInt32();
            int bindCount = reader.ReadInt32();

            ShaderBindChannel[] channels = new ShaderBindChannel[bindCount];
            for (int i = 0; i < bindCount; i++)
            {
                uint              source  = reader.ReadUInt32();
                VertexComponent   target  = (VertexComponent)reader.ReadUInt32();
                ShaderBindChannel channel = new ShaderBindChannel(source, target);
                channels[i] = channel;
                sourceMap  |= 1 << (int)source;
            }
            BindChannels = new ParserBindChannels(channels, sourceMap);

            List <VectorParameter>  vectors        = new List <VectorParameter>();
            List <MatrixParameter>  matrices       = new List <MatrixParameter>();
            List <TextureParameter> textures       = new List <TextureParameter>();
            List <VectorParameter>  structVectors  = new List <VectorParameter>();
            List <MatrixParameter>  structMatrices = new List <MatrixParameter>();
            List <BufferBinding>    buffers        = new List <BufferBinding>();
            List <UAVParameter>     uavs           = HasUAVParameters(reader.Version) ? new List <UAVParameter>() : null;
            List <SamplerParameter> samplers       = HasSamplerParameters(reader.Version) ? new List <SamplerParameter>() : null;
            List <BufferBinding>    constBindings  = new List <BufferBinding>();
            List <StructParameter>  structs        = new List <StructParameter>();

            int paramGroupCount = reader.ReadInt32();

            ConstantBuffers = new ConstantBuffer[paramGroupCount - 1];
            for (int i = 0; i < paramGroupCount; i++)
            {
                vectors.Clear();
                matrices.Clear();
                structs.Clear();

                string name       = reader.ReadString();
                int    usedSize   = reader.ReadInt32();
                int    paramCount = reader.ReadInt32();
                for (int j = 0; j < paramCount; j++)
                {
                    string          paramName = reader.ReadString();
                    ShaderParamType paramType = (ShaderParamType)reader.ReadInt32();
                    int             rows      = reader.ReadInt32();
                    int             columns   = reader.ReadInt32();
                    bool            isMatrix  = reader.ReadInt32() > 0;
                    int             arraySize = reader.ReadInt32();
                    int             index     = reader.ReadInt32();

                    if (isMatrix)
                    {
                        MatrixParameter matrix = IsAllParamArgs(reader.Version) ?
                                                 new MatrixParameter(paramName, paramType, index, arraySize, rows, columns) :
                                                 new MatrixParameter(paramName, paramType, index, rows, columns);
                        matrices.Add(matrix);
                    }
                    else
                    {
                        VectorParameter vector = IsAllParamArgs(reader.Version) ?
                                                 new VectorParameter(paramName, paramType, index, arraySize, columns) :
                                                 new VectorParameter(paramName, paramType, index, columns);
                        vectors.Add(vector);
                    }
                }

                if (HasStructParameters(reader.Version))
                {
                    int structCount = reader.ReadInt32();
                    for (int j = 0; j < structCount; j++)
                    {
                        structVectors.Clear();
                        structMatrices.Clear();

                        string structName = reader.ReadString();
                        int    index      = reader.ReadInt32();
                        int    arraySize  = reader.ReadInt32();
                        int    structSize = reader.ReadInt32();

                        int strucParamCount = reader.ReadInt32();
                        for (int k = 0; k < strucParamCount; k++)
                        {
                            string paramName = reader.ReadString();
                            paramName = $"{structName}.{paramName}";
                            ShaderParamType paramType       = (ShaderParamType)reader.ReadInt32();
                            int             rows            = reader.ReadInt32();
                            int             columns         = reader.ReadInt32();
                            bool            isMatrix        = reader.ReadInt32() > 0;
                            int             vectorArraySize = reader.ReadInt32();
                            int             paramIndex      = reader.ReadInt32();

                            if (isMatrix)
                            {
                                MatrixParameter matrix = IsAllParamArgs(reader.Version) ?
                                                         new MatrixParameter(paramName, paramType, paramIndex, vectorArraySize, rows, columns) :
                                                         new MatrixParameter(paramName, paramType, paramIndex, rows, columns);
                                structMatrices.Add(matrix);
                            }
                            else
                            {
                                VectorParameter vector = IsAllParamArgs(reader.Version) ?
                                                         new VectorParameter(paramName, paramType, paramIndex, vectorArraySize, columns) :
                                                         new VectorParameter(paramName, paramType, paramIndex, columns);
                                structVectors.Add(vector);
                            }
                        }

                        StructParameter @struct = new StructParameter(structName, index, arraySize, structSize, structVectors.ToArray(), structMatrices.ToArray());
                        structs.Add(@struct);
                    }
                }
                if (i == 0)
                {
                    VectorParameters = vectors.ToArray();
                    MatrixParameters = matrices.ToArray();
                    StructParameters = structs.ToArray();
                }
                else
                {
                    ConstantBuffer constBuffer = new ConstantBuffer(name, matrices.ToArray(), vectors.ToArray(), structs.ToArray(), usedSize);
                    ConstantBuffers[i - 1] = constBuffer;
                }
            }

            int paramGroup2Count = reader.ReadInt32();

            for (int i = 0; i < paramGroup2Count; i++)
            {
                string name       = reader.ReadString();
                int    type       = reader.ReadInt32();
                int    index      = reader.ReadInt32();
                int    extraValue = reader.ReadInt32();

                if (type == 0)
                {
                    TextureParameter texture;
                    if (HasNewTextureParams(reader.Version))
                    {
                        uint textureExtraValue = reader.ReadUInt32();
                        bool isMultiSampled    = (textureExtraValue & 1) == 1;
                        byte dimension         = (byte)(textureExtraValue >> 1);
                        int  samplerIndex      = extraValue;
                        texture = new TextureParameter(name, index, dimension, samplerIndex, isMultiSampled);
                    }
                    else if (HasMultiSampled(reader.Version))
                    {
                        uint textureExtraValue = reader.ReadUInt32();
                        bool isMultiSampled    = textureExtraValue == 1;
                        byte dimension         = unchecked ((byte)extraValue);
                        int  samplerIndex      = extraValue >> 8;
                        if (samplerIndex == 0xFFFFFF)
                        {
                            samplerIndex = -1;
                        }
                        texture = new TextureParameter(name, index, dimension, samplerIndex, isMultiSampled);
                    }
                    else
                    {
                        byte dimension    = unchecked ((byte)extraValue);
                        int  samplerIndex = extraValue >> 8;
                        if (samplerIndex == 0xFFFFFF)
                        {
                            samplerIndex = -1;
                        }
                        texture = new TextureParameter(name, index, dimension, samplerIndex);
                    }
                    textures.Add(texture);
                }
                else if (type == 1)
                {
                    BufferBinding binding = new BufferBinding(name, index);
                    constBindings.Add(binding);
                }
                else if (type == 2)
                {
                    BufferBinding buffer = new BufferBinding(name, index);
                    buffers.Add(buffer);
                }
                else if (type == 3 && HasUAVParameters(reader.Version))
                {
                    UAVParameter uav = new UAVParameter(name, index, extraValue);
                    uavs.Add(uav);
                }
                else if (type == 4 && HasSamplerParameters(reader.Version))
                {
                    SamplerParameter sampler = new SamplerParameter((uint)extraValue, index);
                    samplers.Add(sampler);
                }
                else
                {
                    throw new Exception($"Unupported parameter type {type}");
                }
            }
            TextureParameters = textures.ToArray();
            BufferParameters  = buffers.ToArray();
            if (HasUAVParameters(reader.Version))
            {
                UAVParameters = uavs.ToArray();
            }
            if (HasSamplerParameters(reader.Version))
            {
                SamplerParameters = samplers.ToArray();
            }
            ConstantBufferBindings = constBindings.ToArray();
            if (HasStructParameters(reader.Version))
            {
                StructParameters = structs.ToArray();
            }
        }
		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();
			}
			if (HasApplyGammaDecoding(reader.Version))
			{
				ApplyGammaDecoding = 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);
		}
Beispiel #25
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

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

            if (IsBoolMinMap(reader.Version))
            {
                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();
            }
            reader.AlignStream(AlignType.Align4);

            if (IsReadStreamingMipmapsPriority(reader.Version))
            {
                StreamingMipmapsPriority = reader.ReadInt32();
            }
            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);
            }
        }
Beispiel #26
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadLODData(reader.Version))
            {
                m_LODData = reader.ReadArray <LOD>();
            }
            if (IsReadUse16bitIndices(reader.Version))
            {
                Use16bitIndices = reader.ReadInt32() > 0;
            }
            if (IsReadIndexBuffer(reader.Version))
            {
                if (IsReadIndexBufferFirst(reader.Version))
                {
                    m_indexBuffer = reader.ReadByteArray();
                    reader.AlignStream(AlignType.Align4);
                }
            }
            if (IsReadSubMeshes(reader.Version))
            {
                m_subMeshes = reader.ReadArray <SubMesh>();
            }

            if (IsReadBlendShapes(reader.Version))
            {
                Shapes.Read(reader);
            }
            if (IsReadBindPosesFirst(reader.Version))
            {
                m_bindPoses = reader.ReadArray <Matrix4x4f>();
            }
            if (IsReadBoneNameHashes(reader.Version))
            {
                m_boneNameHashes = reader.ReadUInt32Array();
                RootBoneNameHash = reader.ReadUInt32();
            }

            if (IsReadMeshCompression(reader.Version))
            {
                MeshCompression = (MeshCompression)reader.ReadByte();
            }
            if (IsReadStreamCompression(reader.Version))
            {
                StreamCompression = reader.ReadByte();
            }
            if (IsReadIsReadable(reader.Version))
            {
                IsReadable   = reader.ReadBoolean();
                KeepVertices = reader.ReadBoolean();
                KeepIndices  = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadIndexFormat(reader.Version))
            {
                if (IsReadIndexFormatCondition(reader.Version))
                {
                    if (MeshCompression == 0)
                    {
                        IndexFormat = reader.ReadInt32();
                    }
                }
                else
                {
                    IndexFormat = reader.ReadInt32();
                }
            }

            if (IsReadIndexBuffer(reader.Version))
            {
                if (!IsReadIndexBufferFirst(reader.Version))
                {
                    m_indexBuffer = reader.ReadByteArray();
                    reader.AlignStream(AlignType.Align4);
                }
            }

            if (IsReadVertices(reader.Version))
            {
                if (IsReadVertexData(reader.Version))
                {
                    if (MeshCompression != 0)
                    {
                        m_vertices = reader.ReadArray <Vector3f>();
                    }
                }
                else
                {
                    m_vertices = reader.ReadArray <Vector3f>();
                }
            }

            if (IsReadSkin(reader.Version))
            {
                m_skin = reader.ReadArray <BoneWeights4>();
            }
            if (IsReadBindPoses(reader.Version))
            {
                if (!IsReadBindPosesFirst(reader.Version))
                {
                    m_bindPoses = reader.ReadArray <Matrix4x4f>();
                }
            }

            if (IsReadVertexData(reader.Version))
            {
                if (IsReadOnlyVertexData(reader.Version))
                {
                    VertexData.Read(reader);
                }
                else
                {
                    if (MeshCompression == 0)
                    {
                        VertexData.Read(reader);
                    }
                    else
                    {
                        m_UV       = reader.ReadArray <Vector2f>();
                        m_UV1      = reader.ReadArray <Vector2f>();
                        m_tangents = reader.ReadArray <Vector4f>();
                        m_normals  = reader.ReadArray <Vector3f>();
                        m_colors   = reader.ReadArray <ColorRGBA32>();
                    }
                }
            }
            else
            {
                m_UV = reader.ReadArray <Vector2f>();
                if (IsReadUV1(reader.Version))
                {
                    m_UV1 = reader.ReadArray <Vector2f>();
                }
                if (IsReadTangentSpace(reader.Version))
                {
                    m_tangentSpace = reader.ReadArray <Tangent>();
                }
                else
                {
                    m_tangents = reader.ReadArray <Vector4f>();
                    m_normals  = reader.ReadArray <Vector3f>();
                }
            }
            if (IsReadAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadCompressedMesh(reader.Version))
            {
                CompressedMesh.Read(reader);
            }

            LocalAABB.Read(reader);
            if (IsReadColors(reader.Version))
            {
                if (!IsReadVertexData(reader.Version))
                {
                    m_colors = reader.ReadArray <ColorRGBA32>();
                }
            }
            if (IsReadCollisionTriangles(reader.Version))
            {
                m_collisionTriangles = reader.ReadUInt32Array();
                CollisionVertexCount = reader.ReadInt32();
            }
            if (IsReadMeshUsageFlags(reader.Version))
            {
                MeshUsageFlags = reader.ReadInt32();
            }

            if (IsReadCollision(reader.Version))
            {
                CollisionData.Read(reader);
            }
            if (IsReadMeshMetrics(reader.Version))
            {
                m_meshMetrics    = new float[2];
                m_meshMetrics[0] = reader.ReadSingle();
                m_meshMetrics[1] = reader.ReadSingle();
            }
        }
Beispiel #27
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadType(reader.Version))
            {
                EmissionType type = (EmissionType)reader.ReadInt32();
                if (type == EmissionType.Time)
                {
                    RateOverTime.Read(reader);
                    RateOverDistance = new MinMaxCurve(0.0f);
                }
                else
                {
                    RateOverTime = new MinMaxCurve(0.0f);
                    RateOverDistance.Read(reader);
                }
            }
            else
            {
                RateOverTime.Read(reader);
                RateOverDistance.Read(reader);
            }

            if (IsReadCnt(reader.Version))
            {
                int cnt0 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt1 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt2 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt3 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();

                int cntMax0 = cnt0;
                int cntMax1 = cnt1;
                int cntMax2 = cnt2;
                int cntMax3 = cnt3;
                if (IsReadCntMax(reader.Version))
                {
                    cntMax0 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax1 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax2 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax3 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                }

                float time0 = reader.ReadSingle();
                float time1 = reader.ReadSingle();
                float time2 = reader.ReadSingle();
                float time3 = reader.ReadSingle();

                BurstCount = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadByte();
                reader.AlignStream(AlignType.Align4);

                m_bursts = new ParticleSystemEmissionBurst[BurstCount];
                if (BurstCount > 0)
                {
                    m_bursts[0] = new ParticleSystemEmissionBurst(time0, cnt0, cntMax0);
                    if (BurstCount > 1)
                    {
                        m_bursts[1] = new ParticleSystemEmissionBurst(time1, cnt1, cntMax1);
                        if (BurstCount > 2)
                        {
                            m_bursts[2] = new ParticleSystemEmissionBurst(time2, cnt2, cntMax2);
                            if (BurstCount > 3)
                            {
                                m_bursts[3] = new ParticleSystemEmissionBurst(time3, cnt3, cntMax3);
                            }
                        }
                    }
                }
            }
            else
            {
                BurstCount = reader.ReadInt32();
                reader.AlignStream(AlignType.Align4);

                m_bursts = reader.ReadArray <ParticleSystemEmissionBurst>();
            }
        }
Beispiel #28
0
        public override void Read(AssetReader reader)
        {
            if (IsReadRenderer(reader.Version))
            {
                base.Read(reader);
            }
            else
            {
                ReadBase(reader);
            }

            if (IsReadQuality(reader.Version))
            {
                if (IsReadQualityFirst(reader.Version))
                {
                    Quality = reader.ReadInt32();
                }
            }
            if (IsReadUpdateWhenOffscreen(reader.Version))
            {
                UpdateWhenOffscreen = reader.ReadBoolean();
            }
            if (IsReadQuality(reader.Version))
            {
                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.ReadArray <PPtr <Transform> >();
            if (IsAlignBones(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (!IsReadMeshFirst(reader.Version))
            {
                Mesh.Read(reader);
            }

            if (IsReadBindPose(reader.Version))
            {
                m_bindPose = reader.ReadArray <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);
                }
            }
        }
Beispiel #29
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasClassIDToTrack(reader.Version, reader.Flags))
            {
                ClassIDToTrack = new Dictionary <int, PPtr <BaseAnimationTrack> >();
                ClassIDToTrack.Read(reader);
                ChildTracks = reader.ReadAssetArray <ChildTrack>();
            }

            if (HasAnimationType(reader.Version))
            {
                AnimationType = (AnimationType)reader.ReadInt32();
            }
            if (HasLegacy(reader.Version))
            {
                Legacy = reader.ReadBoolean();
            }

            if (HasCompressed(reader.Version))
            {
                Compressed = reader.ReadBoolean();
            }
            if (HasUseHightQualityCurve(reader.Version))
            {
                UseHightQualityCurve = reader.ReadBoolean();
            }
            if (IsAlignCompressed(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasCurves(reader.Version))
            {
                RotationCurves = reader.ReadAssetArray <QuaternionCurve>();
            }
            if (HasCompressedRotationCurves(reader.Version))
            {
                CompressedRotationCurves = reader.ReadAssetArray <CompressedAnimationCurve>();
            }
            if (HasEulerCurves(reader.Version))
            {
                EulerCurves = reader.ReadAssetArray <Vector3Curve>();
            }
            if (HasCurves(reader.Version))
            {
                PositionCurves = reader.ReadAssetArray <Vector3Curve>();
                ScaleCurves    = reader.ReadAssetArray <Vector3Curve>();
                FloatCurves    = reader.ReadAssetArray <FloatCurve>();
            }
            if (HasPPtrCurves(reader.Version))
            {
                PPtrCurves = reader.ReadAssetArray <PPtrCurve>();
            }

            if (HasSampleRate(reader.Version))
            {
                SampleRate = reader.ReadSingle();
            }

            if (HasWrapMode(reader.Version))
            {
                WrapMode = (WrapMode)reader.ReadInt32();
            }
            if (HasBounds(reader.Version))
            {
                Bounds.Read(reader);
            }
            if (HasMuscleClip(reader.Version, reader.Flags))
            {
                MuscleClipSize = reader.ReadUInt32();
                MuscleClip     = new ClipMuscleConstant();
                MuscleClip.Read(reader);
            }
            if (HasClipBindingConstant(reader.Version))
            {
                ClipBindingConstant.Read(reader);
            }
#if UNIVERSAL
            if (HasAnimationClipSettings(reader.Version, reader.Flags))
            {
                AnimationClipSettings = new AnimationClipSettings();
                AnimationClipSettings.Read(reader);
            }
            if (HasEditorCurves(reader.Version, reader.Flags))
            {
                EditorCurves      = reader.ReadAssetArray <FloatCurve>();
                EulerEditorCurves = reader.ReadAssetArray <FloatCurve>();
            }
#endif

            if (HasHasGenericRootTransform(reader.Version, reader.Flags))
            {
                HasGenericRootTransform = reader.ReadBoolean();
            }
            if (HasHasMotionFloatCurves(reader.Version, reader.Flags))
            {
                HasMotionFloatCurves = reader.ReadBoolean();
            }
#if UNIVERSAL
            if (HasGenerateMotionCurves(reader.Version, reader.Flags))
            {
                GenerateMotionCurves = reader.ReadBoolean();
            }
#endif
            if (HasHasGenericRootTransform(reader.Version, reader.Flags))
            {
                reader.AlignStream();
            }

            if (HasEvents(reader.Version))
            {
                Events = reader.ReadAssetArray <AnimationEvent>();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream();
            }

#if UNIVERSAL
            if (HasRuntimeEvents(reader.Version, reader.Flags))
            {
                RunetimeEvents = reader.ReadAssetArray <AnimationEvent>();
            }
#endif
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasLightProbesLegacy(reader.Version))
            {
                LightProbesLegacy.Read(reader);
            }
            if (HasEnlightenSceneMapping(reader.Version, reader.Flags))
            {
                EnlightenSceneMapping.Read(reader);
            }
            if (HasGIWorkflowMode(reader.Version, reader.Flags))
            {
                GIWorkflowMode = (GIWorkflowMode)reader.ReadInt32();
            }
            if (HasLightProbes(reader.Version, reader.Flags))
            {
                LightProbes.Read(reader);
            }
            if (HasLightmaps(reader.Version, reader.Flags))
            {
                Lightmaps = reader.ReadAssetArray <LightmapData>();
            }
            if (IsAlign1(reader.Version, reader.Flags))
            {
                reader.AlignStream();
            }

            if (HasLightmapsModeLegacy(reader.Version))
            {
                LightmapsModeLegacy = (LightmapsMode)reader.ReadInt32();
            }
            if (HasLightmapsMode(reader.Version, reader.Flags))
            {
                LightmapsMode = (LightmapsMode)reader.ReadInt32();
            }
            if (HasBakedColorSpace(reader.Version))
            {
                BakedColorSpace = (ColorSpace)reader.ReadInt32();
            }
            if (HasUseDualLightmapsInForward(reader.Version))
            {
                UseDualLightmapsInForward = reader.ReadBoolean();
            }
            if (IsAlign2(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasGISettings(reader.Version))
            {
                GISettings.Read(reader);
            }

#if UNIVERSAL
            if (HasLightmapEditorSettings(reader.Version, reader.Flags))
            {
                LightmapEditorSettings.Read(reader);
            }
            if (HasLightingDataAsset(reader.Version, reader.Flags))
            {
                LightingDataAsset.Read(reader);
            }
#endif
            if (HasRuntimeCPUUsage(reader.Version))
            {
                RuntimeCPUUsage = reader.ReadInt32();
            }
            if (HasUseShadowmask(reader.Version))
            {
                if (IsBoolShadowmask(reader.Version))
                {
                    UseShadowmask = reader.ReadBoolean();
                }
                else
                {
                    ShadowMaskMode = reader.ReadInt32();
                }
            }
        }