예제 #1
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 (IsReadShadowCastingMode(reader.Version))
            {
                ShadowCastingMode = (ShadowCastingMode)reader.ReadInt32();
            }
            else
            {
                bool CastShadows = reader.ReadBoolean();
                ShadowCastingMode = CastShadows ? ShadowCastingMode.TwoSided : ShadowCastingMode.Off;
            }
            if (IsReadDrawHeightmap(reader.Version))
            {
                DrawHeightmap = reader.ReadBoolean();
            }
            if (IsReadDrawInstanced(reader.Version))
            {
                DrawInstanced = reader.ReadBoolean();
            }
            DrawTreesAndFoliage = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);

            if (IsReadReflectionProbeUsage(reader.Version))
            {
                ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadInt32();
            }
            if (IsReadMaterialType(reader.Version))
            {
                MaterialType = (MaterialType)reader.ReadInt32();
                LegacySpecular.Read(reader);
                LegacyShininess = reader.ReadSingle();
            }
            if (IsReadDefaultSmoothness(reader.Version))
            {
                UseDefaultSmoothness = reader.ReadBoolean();
                DefaultSmoothness    = reader.ReadSingle();
            }
            MaterialTemplate.Read(reader);
            if (IsReadLightmapIndex(reader.Flags))
            {
                LightmapIndex        = reader.ReadUInt16();
                LightmapIndexDynamic = reader.ReadUInt16();
                LightmapTilingOffset.Read(reader);
                LightmapTilingOffsetDynamic.Read(reader);
            }
            if (IsReadExplicitProbeSetHash(reader.Version, reader.Flags))
            {
                ExplicitProbeSetHash.Read(reader);
            }

            if (IsReadBakeLightProbesForTrees(reader.Version))
            {
                BakeLightProbesForTrees = reader.ReadBoolean();
            }
            if (IsReadPreserveTreePrototypeLayers(reader.Version))
            {
                PreserveTreePrototypeLayers = reader.ReadBoolean();
            }
            if (IsReadDeringLightProbesForTrees(reader.Version, reader.Flags))
            {
                DeringLightProbesForTrees = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
#if UNIVERSAL
            if (IsReadScaleInLightmap(reader.Flags))
            {
                ScaleInLightmap = reader.ReadSingle();
                LightmapParameters.Read(reader);
            }
#endif
            if (IsReadDynamicUVST(reader.Version, reader.Flags))
            {
                DynamicUVST.Read(reader);
                ChunkDynamicUVST.Read(reader);
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadGroupingID(reader.Version))
            {
                GroupingID       = reader.ReadInt32();
                AllowAutoConnect = reader.ReadBoolean();
            }
        }
예제 #2
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 (IsReadRendererPriority(reader.Version))
            {
                RendererPriority = reader.ReadInt32();
            }

            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.ReadAssetArray <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.ReadAssetArray <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);
            }
        }
예제 #3
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasEnabled(reader.Version))
            {
                Enabled = reader.ReadBoolean();
            }
            if (IsAlign1(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasCastShadows(reader.Version))
            {
                CastShadows    = (ShadowCastingMode)reader.ReadByte();
                ReceiveShadows = reader.ReadByte();
            }
            if (HasDynamicOccludee(reader.Version))
            {
                DynamicOccludee = reader.ReadByte();
            }
            if (HasMotionVector(reader.Version))
            {
                MotionVectors   = (MotionVectorGenerationMode)reader.ReadByte();
                LightProbeUsage = (LightProbeUsage)reader.ReadByte();
            }
            if (HasReflectUsage(reader.Version))
            {
                if (IsReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadByte();
                }
            }
            if (IsAlign2(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasRenderingLayerMask(reader.Version))
            {
                RenderingLayerMask = reader.ReadUInt32();
            }
            if (HasRendererPriority(reader.Version))
            {
                RendererPriority = reader.ReadInt32();
            }

            if (HasLightmapIndex(reader.Version, reader.Flags))
            {
                LightmapIndex = IsLightmapIndexShort(reader.Version) ? reader.ReadUInt16() : reader.ReadByte();
            }
            if (HasLightmapIndexDynamic(reader.Version, reader.Flags))
            {
                LightmapIndexDynamic = reader.ReadUInt16();
            }

            if (IsMaterialFirst(reader.Version))
            {
                Materials = reader.ReadAssetArray <PPtr <Material> >();
            }

            if (HasLightmapTilingOffset(reader.Version, reader.Flags))
            {
                LightmapTilingOffset.Read(reader);
            }
            if (HasLightmapTilingOffsetDynamic(reader.Version, reader.Flags))
            {
                LightmapTilingOffsetDynamic.Read(reader);
            }

            if (!IsMaterialFirst(reader.Version))
            {
                Materials = reader.ReadAssetArray <PPtr <Material> >();
            }

            if (HasStaticBatchInfo(reader.Version))
            {
                StaticBatchInfo.Read(reader);
            }
            else if (HasSubsetIndices(reader.Version))
            {
                SubsetIndices = reader.ReadUInt32Array();
            }
            if (HasStaticBatchRoot(reader.Version))
            {
                StaticBatchRoot.Read(reader);
            }

            if (HasUseLight(reader.Version))
            {
                bool UseLightProbes = reader.ReadBoolean();
                LightProbeUsage = UseLightProbes ? LightProbeUsage.BlendProbes : LightProbeUsage.Off;
            }
            if (HasUseReflectionProbes(reader.Version))
            {
                bool UseReflectionProbes = reader.ReadBoolean();
                ReflectionProbeUsage = UseReflectionProbes ? ReflectionProbeUsage.Simple : ReflectionProbeUsage.Off;
            }
            if (HasUseLight(reader.Version))
            {
                reader.AlignStream();
            }
            if (HasReflectUsage(reader.Version))
            {
                if (!IsReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadInt32();
                }
            }

            if (HasProbeAnchor(reader.Version))
            {
                ProbeAnchor.Read(reader);
            }
            if (HasLightOverride(reader.Version))
            {
                LightProbeVolumeOverride.Read(reader);
            }
#if UNIVERSAL
            if (HasScaleInLightmap(reader.Version, reader.Flags))
            {
                ScaleInLightmap = reader.ReadSingle();
            }
            if (HasReceiveGI(reader.Version, reader.Flags))
            {
                ReceiveGI = (ReceiveGI)reader.ReadInt32();
            }
            if (HasPreserveUVs(reader.Version, reader.Flags))
            {
                PreserveUVs = reader.ReadBoolean();
            }
            if (HasIgnoreNormalsForChartDetection(reader.Version, reader.Flags))
            {
                IgnoreNormalsForChartDetection = reader.ReadBoolean();
            }
            if (HasImportantGI(reader.Version, reader.Flags))
            {
                ImportantGI = reader.ReadBoolean();
            }
            if (HasSelectedWireframeHidden(reader.Version, reader.Flags))
            {
                SelectedWireframeHidden = reader.ReadBoolean();
            }
            if (HasStitchLightmapSeams(reader.Version, reader.Flags))
            {
                StitchLightmapSeams = reader.ReadBoolean();
                reader.AlignStream();
            }
            if (HasSelectedEditorRenderState(reader.Version, reader.Flags))
            {
                SelectedEditorRenderState = (EditorSelectedRenderState)reader.ReadInt32();
            }
            if (HasMinimumChartSize(reader.Version, reader.Flags))
            {
                MinimumChartSize = reader.ReadInt32();
            }
            if (HasAutoUVMaxDistance(reader.Version, reader.Flags))
            {
                AutoUVMaxDistance = reader.ReadSingle();
                AutoUVMaxAngle    = reader.ReadSingle();
                LightmapParameters.Read(reader);
            }
            if (HasGIBackfaceCull(reader.Version, reader.Flags))
            {
                GIBackfaceCull = reader.ReadBoolean();
                reader.AlignStream();
            }
#endif
            if (IsAlign3(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasSortingLayerID(reader.Version))
            {
                SortingLayerID = reader.ReadInt32();
            }
            if (HasSortingLayer(reader.Version))
            {
                SortingLayer = reader.ReadInt16();
            }
            if (HasSortingOrder(reader.Version))
            {
                SortingOrder = reader.ReadInt16();
            }
            if (IsAlign4(reader.Version))
            {
                reader.AlignStream();
            }
        }