コード例 #1
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
#warning TODO: serialized version acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = base.ExportYAMLRoot(container);
            node.Add("m_Enabled", Enabled);
            node.Add("m_CastShadows", (byte)CastShadows);
            node.Add("m_ReceiveShadows", ReceiveShadows);
            node.Add("m_DynamicOccludee", GetDynamicOccludee(container.Version));
            node.Add("m_MotionVectors", (byte)GetMotionVectors(container.Version));
            node.Add("m_LightProbeUsage", (byte)LightProbeUsage);
            node.Add("m_ReflectionProbeUsage", (byte)GetReflectionProbeUsage(container.Version));
            node.Add("m_Materials", Materials.ExportYAML(container));
            node.Add("m_StaticBatchInfo", GetStaticBatchInfo(container.Version).ExportYAML(container));
            node.Add("m_StaticBatchRoot", StaticBatchRoot.ExportYAML(container));
            node.Add("m_ProbeAnchor", ProbeAnchor.ExportYAML(container));
            node.Add("m_LightProbeVolumeOverride", LightProbeVolumeOverride.ExportYAML(container));
            node.Add("m_ScaleInLightmap", GetScaleInLightmap(container.Flags));
            node.Add("m_PreserveUVs", GetPreserveUVs(container.Flags));
            node.Add("m_IgnoreNormalsForChartDetection", GetIgnoreNormalsForChartDetection(container.Flags));
            node.Add("m_ImportantGI", GetImportantGI(container.Flags));
            node.Add("m_StitchLightmapSeams", GetStitchLightmapSeams(container.Flags));
            node.Add("m_SelectedEditorRenderState", (int)GetSelectedEditorRenderState(container.Flags));
            node.Add("m_MinimumChartSize", GetMinimumChartSize(container.Flags));
            node.Add("m_AutoUVMaxDistance", GetAutoUVMaxDistance(container.Flags));
            node.Add("m_AutoUVMaxAngle", GetAutoUVMaxAngle(container.Flags));
            node.Add("m_LightmapParameters", GetLightmapParameters(container.Flags).ExportYAML(container));
            node.Add("m_SortingLayerID", SortingLayerID);
            node.Add("m_SortingLayer", SortingLayer);
            node.Add("m_SortingOrder", SortingOrder);
            return(node);
        }
コード例 #2
0
 protected override void WriteObject(AssetsWriter writer)
 {
     base.WriteBase(writer);
     writer.Write(IsEnabled);
     writer.Write(CastShadows);
     writer.Write(ReceiveShadows);
     writer.Write(DynamicOcclude);
     writer.Write(MotionVectors);
     writer.Write(LightProbeUsage);
     writer.Write(ReflectionProbeUsage);
     writer.AlignTo(4);
     writer.Write(RenderingLayerMask);
     if (ObjectInfo.ParentFile.Metadata.VersionGte("2018.3"))
     {
         writer.Write(RendererPriority);
     }
     writer.Write(LightmapIndex);
     writer.Write(LightmapIndexDynamic);
     LightmapTilingOffset.Write(writer);
     LightmapTilingOffsetDynamic.Write(writer);
     writer.WriteArrayOf(Materials, (o, w) => o.Write(w));
     StaticBatchInfo.Write(writer);
     StaticBatchRoot.Write(writer);
     ProbeAnchor.Write(writer);
     LightProbeVolumeOverride.Write(writer);
     writer.Write(SortingLayerID);
     writer.Write(SortingLayer);
     writer.Write(SortingOrder);
     AdditionalVertexStreams.Write(writer);
 }
コード例 #3
0
ファイル: Renderer.cs プロジェクト: fangguanya/UtinyRipper
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
#warning TODO: serialized version acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = base.ExportYAMLRoot(container);
            node.Add(EnabledName, Enabled);
            node.Add(CastShadowsName, (byte)CastShadows);
            node.Add(CastShadowsName, ReceiveShadows);
            node.Add(DynamicOccludeeName, GetDynamicOccludee(container.Version));
            node.Add(MotionVectorsName, (byte)GetMotionVectors(container.Version));
            node.Add(LightProbeUsageName, (byte)LightProbeUsage);
            node.Add(ReflectionProbeUsageName, (byte)GetReflectionProbeUsage(container.Version));
            node.Add(MaterialsName, Materials.ExportYAML(container));
            node.Add(StaticBatchInfoName, GetStaticBatchInfo(container.Version).ExportYAML(container));
            node.Add(StaticBatchRootName, StaticBatchRoot.ExportYAML(container));
            node.Add(ProbeAnchorName, ProbeAnchor.ExportYAML(container));
            node.Add(LightProbeVolumeOverrideName, LightProbeVolumeOverride.ExportYAML(container));
            node.Add(ScaleInLightmapName, GetScaleInLightmap(container.Flags));
            node.Add(PreserveUVsName, GetPreserveUVs(container.Flags));
            node.Add(IgnoreNormalsForChartDetectionName, GetIgnoreNormalsForChartDetection(container.Flags));
            node.Add(ImportantGIName, GetImportantGI(container.Flags));
            node.Add(StitchLightmapSeamsName, GetStitchLightmapSeams(container.Flags));
            node.Add(SelectedEditorRenderStateName, (int)GetSelectedEditorRenderState(container.Flags));
            node.Add(MinimumChartSizeName, GetMinimumChartSize(container.Flags));
            node.Add(AutoUVMaxDistanceName, GetAutoUVMaxDistance(container.Flags));
            node.Add(AutoUVMaxAngleName, GetAutoUVMaxAngle(container.Flags));
            node.Add(LightmapParametersName, GetLightmapParameters(container.Flags).ExportYAML(container));
            node.Add(SortingLayerIDName, SortingLayerID);
            node.Add(SortingLayerName, SortingLayer);
            node.Add(SortingOrderName, SortingOrder);
            return(node);
        }
コード例 #4
0
        protected override YAMLMappingNode ExportYAMLRoot(IAssetsExporter exporter)
        {
#warning TODO: check undefined vars
#warning TODO: serialized version acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = base.ExportYAMLRoot(exporter);
            node.Add("m_Enabled", Enabled);
            node.Add("m_CastShadows", CastShadows);
            node.Add("m_ReceiveShadows", ReceiveShadows);
            if (IsReadDynamicOccludee(exporter.Version))
            {
#warning TODO:
                node.Add("m_DynamicOccludee", 1);
            }
            else
            {
                node.Add("m_DynamicOccludee", 1);
            }
            node.Add("m_MotionVectors", MotionVectors);
            node.Add("m_LightProbeUsage", LightProbeUsage);
            node.Add("m_ReflectionProbeUsage", ReflectionProbeUsage);
            node.Add("m_Materials", Materials.ExportYAML(exporter));
            if (IsReadSubsetIndices(exporter.Version))
            {
                StaticBatchInfo staticBatchInfo = new StaticBatchInfo(SubsetIndices);
                node.Add("m_StaticBatchInfo", staticBatchInfo.ExportYAML(exporter));
            }
            else
            {
                node.Add("m_StaticBatchInfo", StaticBatchInfo.ExportYAML(exporter));
            }
            node.Add("m_StaticBatchRoot", StaticBatchRoot.ExportYAML(exporter));
            node.Add("m_ProbeAnchor", ProbeAnchor.ExportYAML(exporter));
            node.Add("m_LightProbeVolumeOverride", LightProbeVolumeOverride.ExportYAML(exporter));
#warning what are those vars?
            node.Add("m_ScaleInLightmap", 1);
            node.Add("m_PreserveUVs", 0);
            node.Add("m_IgnoreNormalsForChartDetection", 0);
            node.Add("m_ImportantGI", 0);
#warning TODO? Should I read this parameter or just write default value?
            node.Add("m_StitchLightmapSeams", 0);
            node.Add("m_SelectedEditorRenderState", 3);
            node.Add("m_MinimumChartSize", 4);
            node.Add("m_AutoUVMaxDistance", 0.5f);
            node.Add("m_AutoUVMaxAngle", 89);
#warning TODO?
            node.Add("m_LightmapParameters", default(PPtr <Object>).ExportYAML(exporter));
            node.Add("m_SortingLayerID", SortingLayerID);
            node.Add("m_SortingLayer", SortingLayer);
            node.Add("m_SortingOrder", SortingOrder);
            return(node);
        }
コード例 #5
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            node.Add(EnabledName, GetEnabled(container.Version));
            node.Add(CastShadowsName, (byte)GetCastShadows(container.Version));
            node.Add(ReceiveShadowsName, GetReceiveShadows(container.Version));
            node.Add(DynamicOccludeeName, GetDynamicOccludee(container.Version));
            node.Add(MotionVectorsName, (byte)GetMotionVectors(container.Version));
            node.Add(LightProbeUsageName, (byte)LightProbeUsage);
            node.Add(ReflectionProbeUsageName, (byte)GetReflectionProbeUsage(container.Version));
            if (HasRayTracingMode(container.ExportVersion))
            {
                node.Add(RayTracingModeName, (byte)RayTracingMode);
            }
            if (HasRenderingLayerMask(container.ExportVersion))
            {
                node.Add(RenderingLayerMaskName, GetRenderingLayerMask(container.Version));
            }
            if (HasRendererPriority(container.ExportVersion))
            {
                node.Add(RendererPriorityName, RendererPriority);
            }
            node.Add(MaterialsName, Materials.ExportYAML(container));
            node.Add(StaticBatchInfoName, GetStaticBatchInfo(container.Version).ExportYAML(container));
            node.Add(StaticBatchRootName, StaticBatchRoot.ExportYAML(container));
            node.Add(ProbeAnchorName, ProbeAnchor.ExportYAML(container));
            node.Add(LightProbeVolumeOverrideName, LightProbeVolumeOverride.ExportYAML(container));
            node.Add(ScaleInLightmapName, GetScaleInLightmap(container.Version, container.Flags));
            if (HasReceiveGI(container.ExportVersion, container.ExportFlags))
            {
                node.Add(ReceiveGIName, (int)GetReceiveGI(container.Version, container.Flags));
            }
            node.Add(PreserveUVsName, GetPreserveUVs(container.Version, container.Flags));
            node.Add(IgnoreNormalsForChartDetectionName, GetIgnoreNormalsForChartDetection(container.Version, container.Flags));
            node.Add(ImportantGIName, GetImportantGI(container.Version, container.Flags));
            node.Add(StitchLightmapSeamsName, GetStitchLightmapSeams(container.Version, container.Flags));
            node.Add(SelectedEditorRenderStateName, (int)GetSelectedEditorRenderState(container.Version, container.Flags));
            node.Add(MinimumChartSizeName, GetMinimumChartSize(container.Version, container.Flags));
            node.Add(AutoUVMaxDistanceName, GetAutoUVMaxDistance(container.Version, container.Flags));
            node.Add(AutoUVMaxAngleName, GetAutoUVMaxAngle(container.Version, container.Flags));
            node.Add(LightmapParametersName, GetLightmapParameters().ExportYAML(container));
            node.Add(SortingLayerIDName, SortingLayerID);
            node.Add(SortingLayerName, SortingLayer);
            node.Add(SortingOrderName, SortingOrder);
            return(node);
        }
コード例 #6
0
        protected override YAMLMappingNode ExportYAMLRoot()
        {
#warning TODO: check undefined vars
#warning TODO: write according to version
            YAMLMappingNode node = base.ExportYAMLRoot();
            node.Add("m_Enabled", Enabled);
            node.Add("m_CastShadows", CastShadows);
            node.Add("m_ReceiveShadows", ReceiveShadows);
            if (IsReadDynamicOccludee)
            {
#warning TODO:
                node.Add("m_DynamicOccludee", 1);
            }
            else
            {
                node.Add("m_DynamicOccludee", 1);
            }
            node.Add("m_MotionVectors", MotionVectors);
            node.Add("m_LightProbeUsage", LightProbeUsage);
            node.Add("m_ReflectionProbeUsage", ReflectionProbeUsage);
            node.Add("m_Materials", Materials.ExportYAML());
            node.Add("m_StaticBatchInfo", StaticBatchInfo.ExportYAML());
            node.Add("m_StaticBatchRoot", StaticBatchRoot.ExportYAML());
            node.Add("m_ProbeAnchor", ProbeAnchor.ExportYAML());
            node.Add("m_LightProbeVolumeOverride", LightProbeVolumeOverride.ExportYAML());
#warning what are those vars?
            node.Add("m_ScaleInLightmap", 1);
            node.Add("m_PreserveUVs", 0);
            node.Add("m_IgnoreNormalsForChartDetection", 0);
            node.Add("m_ImportantGI", 0);
#warning TODO? is read this parameter or just write default value?
            node.Add("m_StitchLightmapSeams", 0);
            node.Add("m_SelectedEditorRenderState", 3);
            node.Add("m_MinimumChartSize", 4);
            node.Add("m_AutoUVMaxDistance", 0.5f);
            node.Add("m_AutoUVMaxAngle", 89);
            node.Add("m_LightmapParameters", PPtr <Object> .Empty.ExportYAML());
            node.Add("m_SortingLayerID", SortingLayerID);
            node.Add("m_SortingLayer", SortingLayer);
            node.Add("m_SortingOrder", SortingOrder);
            return(node);
        }
コード例 #7
0
        public override IEnumerable <Object> FetchDependencies(bool isLog = false)
        {
            foreach (Object @object in base.FetchDependencies(isLog))
            {
                yield return(@object);
            }

            foreach (PPtr <Material> ptr in Materials)
            {
                if (ptr.IsNull)
                {
                    continue;
                }

                Material mat = ptr.FindObject();
                if (mat == null)
                {
                    if (isLog)
                    {
                        Logger.Log(LogType.Warning, LogCategory.Export, $"{ToLogString()} m_Materials {ptr.ToLogString()} wasn't found ");
                    }
                }
                else
                {
                    yield return(mat);
                }
            }
            if (!StaticBatchRoot.IsNull)
            {
                yield return(StaticBatchRoot.GetObject());
            }
            if (!ProbeAnchor.IsNull)
            {
                yield return(ProbeAnchor.GetObject());
            }
            if (!LightProbeVolumeOverride.IsNull)
            {
                yield return(LightProbeVolumeOverride.GetObject());
            }
        }
コード例 #8
0
        public override IEnumerable <Object> FetchDependencies(ISerializedFile file, bool isLog = false)
        {
            foreach (Object asset in base.FetchDependencies(file, isLog))
            {
                yield return(asset);
            }

            foreach (PPtr <Material> material in Materials)
            {
                yield return(material.FetchDependency(file, isLog, ToLogString, "m_Materials"));
            }
            if (!StaticBatchRoot.IsNull)
            {
                yield return(StaticBatchRoot.GetAsset(file));
            }
            if (!ProbeAnchor.IsNull)
            {
                yield return(ProbeAnchor.GetAsset(file));
            }
            if (!LightProbeVolumeOverride.IsNull)
            {
                yield return(LightProbeVolumeOverride.GetAsset(file));
            }
        }
コード例 #9
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);
            }
        }
コード例 #10
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);
            }
        }
コード例 #11
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();
            }
        }
コード例 #12
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);
        }