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); }
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); }
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); } }
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); } }
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(); } }
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); }