コード例 #1
0
 public void Read(AssetReader reader)
 {
     TransformParent.Read(reader);
     m_modifications     = reader.ReadAssetArray <PropertyModification>();
     m_removedComponents = reader.ReadAssetArray <PPtr <Object> >();
 }
コード例 #2
0
ファイル: EmissionModule.cs プロジェクト: zbx91/UtinyRipper
        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.ReadAssetArray <ParticleSystemEmissionBurst>();
            }
        }
コード例 #3
0
 public void Read(AssetReader reader)
 {
     m_valueArray = reader.ReadAssetArray <ValueConstant>();
 }
コード例 #4
0
ファイル: Renderer.cs プロジェクト: w2lf/UtinyRipper
        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);
            }
        }
コード例 #5
0
ファイル: ShaderInfo.cs プロジェクト: Ecstasyzzz/UtinyRipper
 public void Read(AssetReader reader)
 {
     Variants = reader.ReadAssetArray <VariantInfo>();
 }
コード例 #6
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Axes = reader.ReadAssetArray <InputAxis>();
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasDeferred(reader.Version))
            {
                Deferred.Read(reader);
            }
            if (HasDeferredReflections(reader.Version))
            {
                DeferredReflections.Read(reader);
            }
            if (HasScreenSpaceShadows(reader.Version))
            {
                ScreenSpaceShadows.Read(reader);
            }
            if (HasLegacyDeferred(reader.Version))
            {
                LegacyDeferred.Read(reader);
            }
            if (HasDepthNormals(reader.Version))
            {
                DepthNormals.Read(reader);
                MotionVectors.Read(reader);
                LightHalo.Read(reader);
                LensFlare.Read(reader);
            }

            if (HasAlwaysIncludedShaders(reader.Version))
            {
                AlwaysIncludedShaders = reader.ReadAssetArray <PPtr <Shader> >();
            }

            if (HasPreloadedShaders(reader.Version))
            {
                PreloadedShaders = reader.ReadAssetArray <PPtr <ShaderVariantCollection> >();
            }
            if (HasSpritesDefaultMaterial(reader.Version))
            {
                SpritesDefaultMaterial.Read(reader);
            }
            if (HasCustomRenderPipeline(reader.Version))
            {
                CustomRenderPipeline.Read(reader);
            }
            if (HasTransparencySortMode(reader.Version))
            {
                TransparencySortMode = (TransparencySortMode)reader.ReadInt32();
                TransparencySortAxis.Read(reader);
            }

            if (HasTierSettings(reader.Version))
            {
                if (HasPlatformSettings(reader.Version))
                {
                    if (HasPlatformSettingsTiers(reader.Version))
                    {
                        PlatformSettings    = new PlatformShaderSettings[3];
                        PlatformSettings[0] = reader.ReadAsset <PlatformShaderSettings>();
                        PlatformSettings[1] = reader.ReadAsset <PlatformShaderSettings>();
                        PlatformSettings[2] = reader.ReadAsset <PlatformShaderSettings>();
                    }
                    else
                    {
                        PlatformSettings    = new PlatformShaderSettings[1];
                        PlatformSettings[0] = reader.ReadAsset <PlatformShaderSettings>();
                    }
                }
                else
                {
                    if (HasStaticTierGraphicsSettings(reader.Version, reader.Flags))
                    {
                        TierGraphicSettings    = new TierGraphicsSettings[3];
                        TierGraphicSettings[0] = reader.ReadAsset <TierGraphicsSettings>();
                        TierGraphicSettings[1] = reader.ReadAsset <TierGraphicsSettings>();
                        TierGraphicSettings[2] = reader.ReadAsset <TierGraphicsSettings>();
                    }
                }
            }

#if UNIVERSAL
            if (HasEditorSettings(reader.Flags))
            {
                if (HasDefaultRenderingPath(reader.Version))
                {
                    DefaultRenderingPath       = (RenderingPath)reader.ReadInt32();
                    DefaultMobileRenderingPath = (RenderingPath)reader.ReadInt32();
                }
                if (HasTierSettings(reader.Version))
                {
                    TierSettings = reader.ReadAssetArray <TierSettings>();
                }

                if (HasLightmapStripping(reader.Version))
                {
                    LightmapStripping = (LightmapStrippingMode)reader.ReadInt32();
                }
                if (HasFogStripping(reader.Version))
                {
                    if (IsFogStrippingFirst(reader.Version))
                    {
                        FogStripping = (LightmapStrippingMode)reader.ReadInt32();
                    }
                }
                if (HasInstancingStripping(reader.Version))
                {
                    InstancingStripping = (InstancingStrippingVariant)reader.ReadInt32();
                }

                if (HasLightmapKeepPlain(reader.Version))
                {
                    LightmapKeepPlain       = reader.ReadBoolean();
                    LightmapKeepDirCombined = reader.ReadBoolean();
                }
                if (HasLightmapKeepDirSeparate(reader.Version))
                {
                    LightmapKeepDirSeparate = reader.ReadBoolean();
                }

                if (HasLightmapKeepDynamicPlain(reader.Version))
                {
                    if (HasLightmapKeepDynamic(reader.Version))
                    {
                        bool lightmapKeepDynamic = reader.ReadBoolean();
                        reader.AlignStream();

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

                if (HasLightmapKeepShadowMask(reader.Version))
                {
                    LightmapKeepShadowMask  = reader.ReadBoolean();
                    LightmapKeepSubtractive = reader.ReadBoolean();
                }
                if (HasFogStripping(reader.Version))
                {
                    if (!IsFogStrippingFirst(reader.Version))
                    {
                        FogStripping = (LightmapStrippingMode)reader.ReadInt32();
                    }
                }
                if (HasFogKeepLinear(reader.Version))
                {
                    FogKeepLinear = reader.ReadBoolean();
                    FogKeepExp    = reader.ReadBoolean();
                    FogKeepExp2   = reader.ReadBoolean();
                    reader.AlignStream();
                }

                if (HasAlbedoSwatchInfos(reader.Version))
                {
                    AlbedoSwatchInfos = reader.ReadAssetArray <AlbedoSwatchInfo>();
                }
            }
            else
#endif
            {
                if (HasShaderDefinesPerShaderCompiler(reader.Version))
                {
                    ShaderDefinesPerShaderCompiler = reader.ReadAssetArray <PlatformShaderDefines>();
                }
            }

            if (HasLightsUseLinearIntensity(reader.Version))
            {
                LightsUseLinearIntensity  = reader.ReadBoolean();
                LightsUseColorTemperature = reader.ReadBoolean();
            }
            if (HasLogWhenShaderIsCompiled(reader.Version))
            {
                LogWhenShaderIsCompiled = reader.ReadBoolean();
            }
            if (HasAllowEnlightenSupportForUpgradedProject(reader.Version))
            {
                AllowEnlightenSupportForUpgradedProject = reader.ReadBoolean();
            }
        }
コード例 #8
0
ファイル: MeshData.cs プロジェクト: Zvirtuosity/UtinyRipper
 public void Read(AssetReader reader)
 {
     Faces  = reader.ReadAssetArray <Face>();
     Strips = reader.ReadUInt16Array();
 }
コード例 #9
0
 public void Read(AssetReader reader)
 {
     Object.Read(reader);
     m_dependencies = reader.ReadAssetArray <PPtr <Object> >();
 }
コード例 #10
0
 public void Read(AssetReader reader)
 {
     Time     = reader.ReadSingle();
     m_curves = reader.ReadAssetArray <StreamedCurveKey>();
 }
コード例 #11
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadComponents(reader.Version, reader.Flags))
            {
                Component = reader.ReadAssetArray <ComponentPair>();
            }

            if (IsReadIsActiveFirst(reader.Version))
            {
                IsActive = reader.ReadBoolean();
                Layer    = reader.ReadUInt32();
                Tag      = reader.ReadUInt16();
                Name     = reader.ReadString();
            }
            else
            {
                Layer = reader.ReadUInt32();
                Name  = reader.ReadString();

                if (IsReadTag(reader.Flags))
                {
                    Tag = reader.ReadUInt16();
                }
#if UNIVERSAL
                else
                {
                    TagString = reader.ReadString();
                }
                if (IsReadIcon(reader.Version, reader.Flags))
                {
                    if (IsReadIconFirst(reader.Version))
                    {
                        Icon.Read(reader);
                    }
                }
                if (IsReadNavMeshLayer(reader.Version, reader.Flags))
                {
                    NavMeshLayer      = reader.ReadUInt32();
                    StaticEditorFlags = reader.ReadUInt32();
                }
#endif
                IsActive = reader.ReadBoolean();


#if UNIVERSAL
                if (IsReadIsStatic(reader.Version))
                {
                    StaticEditorFlags = reader.ReadBoolean() ? uint.MaxValue : 0;
                }
                if (IsReadIcon(reader.Version, reader.Flags))
                {
                    if (!IsReadIconFirst(reader.Version))
                    {
                        Icon.Read(reader);
                    }
                }
#endif
            }
        }
コード例 #12
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadLODData(reader.Version))
            {
                m_LODData = reader.ReadAssetArray <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.ReadAssetArray <SubMesh>();
            }

            if (IsReadBlendShapes(reader.Version))
            {
                Shapes.Read(reader);
            }
            if (IsReadBindPosesFirst(reader.Version))
            {
                m_bindPoses = reader.ReadAssetArray <Matrix4x4f>();
            }
            if (IsReadBoneNameHashes(reader.Version))
            {
                m_boneNameHashes = reader.ReadUInt32Array();
                RootBoneNameHash = reader.ReadUInt32();
            }
            if (IsReadBonesAABB(reader.Version))
            {
                m_bonesAABB = reader.ReadAssetArray <MinMaxAABB>();
                VariableBoneCountWeights.Read(reader);
            }

            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 = (IndexFormat)reader.ReadInt32();
                    }
                }
                else
                {
                    IndexFormat = (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.ReadAssetArray <Vector3f>();
                    }
                }
                else
                {
                    m_vertices = reader.ReadAssetArray <Vector3f>();
                }
            }

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

            if (IsReadVertexData(reader.Version))
            {
                if (IsReadOnlyVertexData(reader.Version))
                {
                    VertexData.Read(reader);
                }
                else
                {
                    if (MeshCompression == 0)
                    {
                        VertexData.Read(reader);
                    }
                    else
                    {
                        m_UV       = reader.ReadAssetArray <Vector2f>();
                        m_UV1      = reader.ReadAssetArray <Vector2f>();
                        m_tangents = reader.ReadAssetArray <Vector4f>();
                        m_normals  = reader.ReadAssetArray <Vector3f>();
                        m_colors   = reader.ReadAssetArray <ColorRGBA32>();
                    }
                }
            }
            else
            {
                m_UV = reader.ReadAssetArray <Vector2f>();
                if (IsReadUV1(reader.Version))
                {
                    m_UV1 = reader.ReadAssetArray <Vector2f>();
                }
                if (IsReadTangentSpace(reader.Version))
                {
                    m_tangentSpace = reader.ReadAssetArray <Tangent>();
                }
                else
                {
                    m_tangents = reader.ReadAssetArray <Vector4f>();
                    m_normals  = reader.ReadAssetArray <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.ReadAssetArray <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();
            }
#if UNIVERSAL
            if (IsReadMeshOptimized(reader.Version, reader.Flags))
            {
                MeshOptimizationFlags = reader.ReadBoolean() ? MeshOptimizationFlags.Everything : 0;
            }
            else if (IsReadMeshOptimizationFlags(reader.Version, reader.Flags))
            {
                MeshOptimizationFlags = (MeshOptimizationFlags)reader.ReadInt32();
            }
#endif
            if (IsReadStreamData(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
                StreamData.Read(reader);
            }
        }
コード例 #13
0
 public void Read(AssetReader reader)
 {
     m_data = reader.ReadAssetArray <SkeletonMaskElement>();
 }
コード例 #14
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.ReadTupleIntSingleArray();
                }
            }

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

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

#warning TODO: dictionary with non unique keys
            if (IsByteKerningValues(reader.Version))
            {
                Dictionary <Tuple <byte, byte>, float> kerningValues = new Dictionary <Tuple <byte, byte>, float>();
                kerningValues.ReadSafe(reader);
                foreach (var kvp in kerningValues)
                {
                    Tuple <ushort, ushort> key = new Tuple <ushort, ushort>(kvp.Key.Item1, kvp.Key.Item2);
                    m_kerningValues.Add(key, kvp.Value);
                }
            }
            else
            {
                m_kerningValues.ReadSafe(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.ReadAssetArray <PPtr <Font> >();
                reader.AlignStream(AlignType.Align4);

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

            if (IsReadUseLegacyBoundsCalculation(reader.Version))
            {
                UseLegacyBoundsCalculation = reader.ReadBoolean();
            }
            if (IsReadShouldRoundAdvanceValue(reader.Version))
            {
                ShouldRoundAdvanceValue = reader.ReadBoolean();
            }
        }
コード例 #15
0
 public void Read(AssetReader reader)
 {
     m_channels = reader.ReadAssetArray <ShaderBindChannel>();
     reader.AlignStream(AlignType.Align4);
     SourceMap = reader.ReadInt32();
 }
        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();
                }
            }
        }
コード例 #17
0
        public override void Read(AssetReader reader)
        {
            if (IsSerialized(reader.Version))
            {
                ReadBase(reader);

                ParsedForm.Read(reader);

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

                SubProgramBlobs = new ShaderSubProgramBlob[Platforms.Length];
                using (MemoryStream memStream = new MemoryStream(compressedBlob))
                {
                    for (int i = 0; i < 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))
                        {
                            lz4Stream.ReadBuffer(decompressedBuffer, 0, decompressedBuffer.Length);
                        }

                        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);
                                SubProgramBlobs[i] = blob;
                            }
                        }
                    }
                }
            }
            else
            {
                base.Read(reader);

                if (IsEncoded(reader.Version))
                {
                    uint decompressedSize = reader.ReadUInt32();
                    int  comressedSize    = reader.ReadInt32();
                    if (comressedSize > 0 && decompressedSize > 0)
                    {
                        byte[] subProgramBlob = new byte[comressedSize];
                        reader.ReadBuffer(subProgramBlob, 0, comressedSize);

                        byte[] decompressedBuffer = new byte[decompressedSize];
                        using (MemoryStream memStream = new MemoryStream(subProgramBlob))
                        {
                            using (Lz4DecodeStream lz4Stream = new Lz4DecodeStream(memStream))
                            {
                                lz4Stream.ReadBuffer(decompressedBuffer, 0, decompressedBuffer.Length);
                            }
                        }

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

                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))
            {
                Dependencies = reader.ReadAssetArray <PPtr <Shader> >();
            }
            if (IsReadNonModifiableTextures(reader.Version))
            {
                NonModifiableTextures = new Dictionary <string, PPtr <Texture> >();
                NonModifiableTextures.Read(reader);
            }
            if (IsReadShaderIsBaked(reader.Version))
            {
                ShaderIsBaked = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }

#if UNIVERSAL
            if (IsReadErrors(reader.Version, reader.Flags))
            {
                Errors = reader.ReadAssetArray <ShaderError>();
            }
            if (IsReadDefaultTextures(reader.Version, reader.Flags))
            {
                DefaultTextures = new Dictionary <string, PPtr <Texture> >();
                DefaultTextures.Read(reader);
            }
            if (IsReadCompileInfo(reader.Version, reader.Flags))
            {
                CompileInfo.Read(reader);
            }
#endif
        }
コード例 #18
0
 public void Read(AssetReader reader)
 {
     m_passes = reader.ReadAssetArray <SerializedPass>();
     Tags.Read(reader);
     LOD = reader.ReadInt32();
 }
コード例 #19
0
        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.ReadAssetArray <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);
        }
コード例 #20
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();
                }
            }
        }
コード例 #21
0
        public void Read(AssetReader reader)
        {
            Code         = reader.ReadString();
            AssetPath    = reader.ReadString();
            PlatformMask = reader.ReadUInt32();
            if (HasHardwareTierVariantsMask(reader.Version))
            {
                HardwareTierVariantsMask = reader.ReadUInt32();
            }
            if (HasStartLine(reader.Version))
            {
                StartLine = reader.ReadInt32();
            }
            TypesMask = reader.ReadUInt32();
            IncludesHash.Read(reader);
            if (HasCodeHash(reader.Version))
            {
                CodeHash.Read(reader);
            }
            if (HasTarget(reader.Version))
            {
                if (HasTargetFirst(reader.Version))
                {
                    Target = reader.ReadInt32();
                }
            }
            if (HasIsGLSL(reader.Version))
            {
                bool IsGLSL = reader.ReadBoolean();
                Language = IsGLSL ? 1 : 0;
            }
            FromOther = reader.ReadBoolean();
            if (HasForceSyncCompilation(reader.Version))
            {
                ForceSyncCompilation = reader.ReadBoolean();
            }
            reader.AlignStream();

            if (HasLanguage(reader.Version))
            {
                Language = reader.ReadInt32();
            }

            if (HasKeywordCombinations(reader.Version))
            {
                KeywordCombinations0 = reader.ReadStringArrayArray();
                KeywordCombinations1 = reader.ReadStringArrayArray();
                KeywordCombinations2 = reader.ReadStringArrayArray();
                KeywordCombinations3 = reader.ReadStringArrayArray();
                KeywordCombinations4 = reader.ReadStringArrayArray();
                KeywordCombinations5 = reader.ReadStringArrayArray();
            }
            else
            {
                VariantsUserGlobal0 = reader.ReadStringArrayArray();
                VariantsUserGlobal1 = reader.ReadStringArrayArray();
                VariantsUserGlobal2 = reader.ReadStringArrayArray();
                VariantsUserGlobal3 = reader.ReadStringArrayArray();
                VariantsUserGlobal4 = reader.ReadStringArrayArray();
                VariantsUserGlobal5 = reader.ReadStringArrayArray();
                if (HasVariant6(reader.Version))
                {
                    VariantsUserGlobal6 = reader.ReadStringArrayArray();
                }

                if (HasVariantsUserLocal(reader.Version))
                {
                    VariantsUserLocal0 = reader.ReadStringArrayArray();
                    VariantsUserLocal1 = reader.ReadStringArrayArray();
                    VariantsUserLocal2 = reader.ReadStringArrayArray();
                    VariantsUserLocal3 = reader.ReadStringArrayArray();
                    VariantsUserLocal4 = reader.ReadStringArrayArray();
                    VariantsUserLocal5 = reader.ReadStringArrayArray();
                    if (HasVariant6(reader.Version))
                    {
                        VariantsUserLocal6 = reader.ReadStringArrayArray();
                    }
                }

                VariantsBuiltin0 = reader.ReadStringArrayArray();
                VariantsBuiltin1 = reader.ReadStringArrayArray();
                VariantsBuiltin2 = reader.ReadStringArrayArray();
                VariantsBuiltin3 = reader.ReadStringArrayArray();
                VariantsBuiltin4 = reader.ReadStringArrayArray();
                VariantsBuiltin5 = reader.ReadStringArrayArray();
                if (HasVariant6(reader.Version))
                {
                    VariantsBuiltin6 = reader.ReadStringArrayArray();
                }
            }

            if (HasTarget(reader.Version))
            {
                if (!HasTargetFirst(reader.Version))
                {
                    Target = reader.ReadInt32();
                }
            }

            if (HasTargetVariants(reader.Version))
            {
                TargetVariants0 = reader.ReadStringArray();
                TargetVariants1 = reader.ReadStringArray();
                TargetVariants2 = reader.ReadStringArray();
                TargetVariants3 = reader.ReadStringArray();
                TargetVariants4 = reader.ReadStringArray();
                TargetVariants5 = reader.ReadStringArray();
            }

            if (HasBaseRequirements(reader.Version))
            {
                BaseRequirements  = reader.ReadInt32();
                KeywordTargetInfo = reader.ReadAssetArray <KeywordTargetInfo>();
            }
            if (HasNonStrippedUserKeywords(reader.Version))
            {
                NonStrippedUserKeywords = reader.ReadString();
                BuiltinKeywords         = reader.ReadString();
            }
        }
コード例 #22
0
		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);
		}
コード例 #23
0
ファイル: Mesh.cs プロジェクト: jack111331/UtinyRipper
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasLODData(reader.Version))
            {
                LODData = reader.ReadAssetArray <LOD>();
            }
            else
            {
                if (HasUse16bitIndices(reader.Version))
                {
                    Use16BitIndices = reader.ReadUInt32();
                }
                if (IsIndexBufferFirst(reader.Version))
                {
                    IndexBuffer = reader.ReadByteArray();
                    reader.AlignStream();
                }
                SubMeshes = reader.ReadAssetArray <SubMesh>();
            }

            if (HasBlendShapes(reader.Version))
            {
                if (HasBlendChannels(reader.Version))
                {
                    Shapes.Read(reader);
                }
                else
                {
                    BlendShapes = reader.ReadAssetArray <BlendShape>();
                    reader.AlignStream();
                    ShapeVertices = reader.ReadAssetArray <BlendShapeVertex>();
                }
            }
            if (HasBindPose(reader.Version) && IsBindPoseFirst(reader.Version))
            {
                BindPose = reader.ReadAssetArray <Matrix4x4f>();
            }
            if (HasBoneNameHashes(reader.Version))
            {
                BoneNameHashes   = reader.ReadUInt32Array();
                RootBoneNameHash = reader.ReadUInt32();
            }
            if (HasBonesAABB(reader.Version))
            {
                BonesAABB = reader.ReadAssetArray <MinMaxAABB>();
                VariableBoneCountWeights.Read(reader);
            }

            if (HasMeshCompression(reader.Version))
            {
                MeshCompression = (MeshCompression)reader.ReadByte();
            }
            if (HasStreamCompression(reader.Version))
            {
                StreamCompression = reader.ReadByte();
            }
            if (HasIsReadable(reader.Version))
            {
                IsReadable   = reader.ReadBoolean();
                KeepVertices = reader.ReadBoolean();
                KeepIndices  = reader.ReadBoolean();
            }
            if (IsAlignFlags(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasIndexFormat(reader.Version))
            {
                if (IsIndexFormatCondition(reader.Version))
                {
                    if (MeshCompression == MeshCompression.Off)
                    {
                        IndexFormat = (IndexFormat)reader.ReadInt32();
                    }
                }
                else
                {
                    IndexFormat = (IndexFormat)reader.ReadInt32();
                }
            }

            if (!HasLODData(reader.Version) && !IsIndexBufferFirst(reader.Version))
            {
                IndexBuffer = reader.ReadByteArray();
                reader.AlignStream();
            }

            if (HasVertexData(reader.Version))
            {
                if (!IsOnlyVertexData(reader.Version))
                {
                    if (MeshCompression != MeshCompression.Off)
                    {
                        Vertices = reader.ReadAssetArray <Vector3f>();
                    }
                }
            }
            else
            {
                Vertices = reader.ReadAssetArray <Vector3f>();
            }

            if (HasSkin(reader.Version))
            {
                Skin = reader.ReadAssetArray <BoneWeights4>();
            }
            if (HasBindPose(reader.Version) && !IsBindPoseFirst(reader.Version))
            {
                BindPose = reader.ReadAssetArray <Matrix4x4f>();
            }

            if (HasVertexData(reader.Version))
            {
                if (IsOnlyVertexData(reader.Version))
                {
                    VertexData.Read(reader);
                }
                else
                {
                    if (MeshCompression == MeshCompression.Off)
                    {
                        VertexData.Read(reader);
                    }
                    else
                    {
                        UV       = reader.ReadAssetArray <Vector2f>();
                        UV1      = reader.ReadAssetArray <Vector2f>();
                        Tangents = reader.ReadAssetArray <Vector4f>();
                        Normals  = reader.ReadAssetArray <Vector3f>();
                        Colors   = reader.ReadAssetArray <ColorRGBA32>();
                    }
                }
            }
            else
            {
                UV = reader.ReadAssetArray <Vector2f>();
                if (HasUV1(reader.Version))
                {
                    UV1 = reader.ReadAssetArray <Vector2f>();
                }
                if (HasTangentSpace(reader.Version))
                {
                    TangentSpace = reader.ReadAssetArray <Tangent>();
                }
                else
                {
                    Tangents = reader.ReadAssetArray <Vector4f>();
                    Normals  = reader.ReadAssetArray <Vector3f>();
                }
            }
            if (IsAlignVertex(reader.Version))
            {
                reader.AlignStream();
            }

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

            LocalAABB.Read(reader);
            if (!HasVertexData(reader.Version))
            {
                Colors = reader.ReadAssetArray <ColorRGBA32>();
            }
            if (HasCollisionTriangles(reader.Version))
            {
                CollisionTriangles   = reader.ReadUInt32Array();
                CollisionVertexCount = reader.ReadInt32();
            }
            if (HasMeshUsageFlags(reader.Version))
            {
                MeshUsageFlags = reader.ReadInt32();
            }

            if (HasCollision(reader.Version))
            {
                CollisionData.Read(reader);
            }
            if (HasMeshMetrics(reader.Version))
            {
                MeshMetrics    = new float[2];
                MeshMetrics[0] = reader.ReadSingle();
                MeshMetrics[1] = reader.ReadSingle();
            }
#if UNIVERSAL
            if (HasMeshOptimization(reader.Version, reader.Flags))
            {
                if (IsMeshOptimizationFlags(reader.Version))
                {
                    MeshOptimizationFlags = (MeshOptimizationFlags)reader.ReadInt32();
                }
                else
                {
                    MeshOptimized = reader.ReadBoolean();
                }
            }
#endif
            if (HasStreamData(reader.Version))
            {
                reader.AlignStream();
                StreamData.Read(reader);
            }
        }
コード例 #24
0
ファイル: Shader.cs プロジェクト: kandaStroge/UtinyRipper
        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
        }
コード例 #25
0
 public void Read(AssetReader reader)
 {
     m_node      = reader.ReadAssetArray <Node>();
     m_ID        = reader.ReadUInt32Array();
     m_axesArray = reader.ReadAssetArray <Axes>();
 }
コード例 #26
0
 public void Read(AssetReader reader)
 {
     SubPrograms = reader.ReadAssetArray <SerializedSubProgram>();
 }
コード例 #27
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadClassIDToTrack(reader.Version, reader.Flags))
            {
                m_classIDToTrack = new Dictionary <int, PPtr <BaseAnimationTrack> >();
                m_classIDToTrack.Read(reader);
                m_childTracks = reader.ReadAssetArray <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.ReadAssetArray <QuaternionCurve>();
            }
            if (IsReadCompressedRotationCurves(reader.Version))
            {
                m_compressedRotationCurves = reader.ReadAssetArray <CompressedAnimationCurve>();
            }
            if (IsReadEulerCurves(reader.Version))
            {
                m_eulerCurves = reader.ReadAssetArray <Vector3Curve>();
            }
            if (IsReadCurves(reader.Version))
            {
                m_positionCurves = reader.ReadAssetArray <Vector3Curve>();
                m_scaleCurves    = reader.ReadAssetArray <Vector3Curve>();
                m_floatCurves    = reader.ReadAssetArray <FloatCurve>();
            }
            if (IsReadPPtrCurves(reader.Version))
            {
                m_PPtrCurves = reader.ReadAssetArray <PPtrCurve>();
            }

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

            if (IsReadWrapMode(reader.Version))
            {
                WrapMode = (WrapMode)reader.ReadInt32();
            }
            if (IsReadBounds(reader.Version))
            {
                Bounds.Read(reader);
            }
            if (IsReadMuscleClip(reader.Version, reader.Flags))
            {
                MuscleClipSize = reader.ReadUInt32();
                MuscleClip     = new ClipMuscleConstant();
                MuscleClip.Read(reader);
            }
            if (IsReadClipBindingConstant(reader.Version))
            {
                ClipBindingConstant.Read(reader);
            }
#if UNIVERSAL
            if (IsReadAnimationClipSettings(reader.Version, reader.Flags))
            {
                AnimationClipSettings = new AnimationClipSettings();
                AnimationClipSettings.Read(reader);
            }
            if (IsReadEditorCurves(reader.Version, reader.Flags))
            {
                m_editorCurves      = reader.ReadAssetArray <FloatCurve>();
                m_eulerEditorCurves = reader.ReadAssetArray <FloatCurve>();
            }
#endif

            if (IsReadHasGenericRootTransform(reader.Version, reader.Flags))
            {
                HasGenericRootTransform = reader.ReadBoolean();
            }
            if (IsReadHasMotionFloatCurves(reader.Version, reader.Flags))
            {
                HasMotionFloatCurves = reader.ReadBoolean();
            }
#if UNIVERSAL
            if (IsReadGenerateMotionCurves(reader.Version, reader.Flags))
            {
                GenerateMotionCurves = reader.ReadBoolean();
            }
#endif
            if (IsReadHasGenericRootTransform(reader.Version, reader.Flags))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadEvents(reader.Version))
            {
                m_events = reader.ReadAssetArray <AnimationEvent>();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

#if UNIVERSAL
            if (IsReadRuntimeEvents(reader.Version, reader.Flags))
            {
                m_runetimeEvents = reader.ReadAssetArray <AnimationEvent>();
            }
#endif
        }
コード例 #28
0
 public void Read(AssetReader reader)
 {
     Props = reader.ReadAssetArray <SerializedProperty>();
 }