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 (HasRayTracingMode(reader.Version))
            {
                RayTracingMode = (RayTracingMode)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 (HasSortingLayerID(reader.Version, reader.Flags))
            {
                if (IsSortingLayerIDFirst(reader.Version))
                {
                    SortingLayerID = reader.ReadInt32();
                }
            }
            if (IsAlign3(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasSortingLayerID(reader.Version, reader.Flags))
            {
                if (!IsSortingLayerIDFirst(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();
            }
        }
示例#2
0
        public override void Read(EndianStream stream)
        {
            base.Read(stream);

            Enabled = stream.ReadBoolean();
            if (IsReadAlign)
            {
                stream.AlignStream(AlignType.Align4);
            }

            CastShadows    = stream.ReadByte();
            ReceiveShadows = stream.ReadByte();
            if (IsReadAlign)
            {
                stream.AlignStream(AlignType.Align4);
            }

            if (IsReadMotionVector)
            {
                MotionVectors        = stream.ReadByte();
                LightProbeUsage      = stream.ReadByte();
                ReflectionProbeUsage = stream.ReadByte();
                stream.AlignStream(AlignType.Align4);
            }

            if (IsSmallLightIndex)
            {
                LightmapIndex = stream.ReadByte();
            }
            else
            {
                LightmapIndex = stream.ReadUInt16();
            }

            if (IsReadLightDynamic)
            {
                LightmapIndexDynamic = stream.ReadUInt16();
            }

            if (IsReadTileOffset)
            {
                LightmapTilingOffset.Read(stream);
            }
            if (IsReadTileDynamic)
            {
                LightmapTilingOffsetDynamic.Read(stream);
            }

            m_materials = stream.ReadArray(() => new PPtr <Material>(AssetsFile));

            if (IsReadSubsetIndices)
            {
                m_subsetIndices = stream.ReadUInt32Array();
            }
            else
            {
                StaticBatchInfo.Read(stream);
            }

            StaticBatchRoot.Read(stream);

            if (IsReadUseLight)
            {
                UseLightProbes = stream.ReadBoolean();
                stream.AlignStream(AlignType.Align4);
                if (IsReadReflectUsage)
                {
                    ReflectionProbeUsage = stream.ReadInt32();
                }
            }

            ProbeAnchor.Read(stream);
            if (IsReadLightOverride)
            {
                LightProbeVolumeOverride.Read(stream);
            }
            stream.AlignStream(AlignType.Align4);

            SortingLayerID = stream.ReadInt32();

            if (IsReadLayer)
            {
                SortingLayer = stream.ReadInt16();
            }

            SortingOrder = stream.ReadInt16();
            stream.AlignStream(AlignType.Align4);
        }
示例#3
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.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);
            }
        }
示例#4
0
        public override void Read(AssetStream stream)
        {
            base.Read(stream);

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

            CastShadows    = stream.ReadByte();
            ReceiveShadows = stream.ReadByte();
            if (IsAlignEnabled(stream.Version))
            {
                stream.AlignStream(AlignType.Align4);
            }

            if (IsReadMotionVector(stream.Version))
            {
                MotionVectors        = stream.ReadByte();
                LightProbeUsage      = stream.ReadByte();
                ReflectionProbeUsage = stream.ReadByte();
                stream.AlignStream(AlignType.Align4);
            }

            if (IsReadRenderingLayerMask(stream.Version))
            {
                RenderingLayerMask = stream.ReadUInt32();
            }
            if (IsReadLightmapIndex(stream.Version))
            {
                LightmapIndex = IsByteLightIndex(stream.Version) ? stream.ReadByte() : stream.ReadUInt16();
            }

            if (IsReadLightDynamic(stream.Version))
            {
                LightmapIndexDynamic = stream.ReadUInt16();
            }

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

            if (IsReadTileOffset(stream.Version))
            {
                LightmapTilingOffset.Read(stream);
            }
            if (IsReadTileDynamic(stream.Version))
            {
                LightmapTilingOffsetDynamic.Read(stream);
            }

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

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

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

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

            if (IsReadProbeAnchor(stream.Version))
            {
                ProbeAnchor.Read(stream);
            }
            if (IsReadLightOverride(stream.Version))
            {
                LightProbeVolumeOverride.Read(stream);
            }
            if (IsAlignLightProbe(stream.Version))
            {
                stream.AlignStream(AlignType.Align4);
            }

            if (IsReadSortingLayerID(stream.Version))
            {
                SortingLayerID = stream.ReadInt32();
            }
            if (IsReadSortingLayer(stream.Version))
            {
                SortingLayer = stream.ReadInt16();
            }
            if (IsReadSortingOrder(stream.Version))
            {
                SortingOrder = stream.ReadInt16();
            }
            if (IsAlignSortingOrder(stream.Version))
            {
                stream.AlignStream(AlignType.Align4);
            }
        }