Example #1
0
 public void Read(AssetReader reader)
 {
     AvatarSkeleton.Read(reader);
     AvatarSkeletonPose.Read(reader);
     if (IsReadDefaultPose(reader.Version))
     {
         DefaultPose.Read(reader);
         m_skeletonNameIDArray = reader.ReadUInt32Array();
     }
     Human.Read(reader);
     m_humanSkeletonIndexArray = reader.ReadInt32Array();
     if (IsReadHumanSkeletonReverseIndexArray(reader.Version))
     {
         m_humanSkeletonReverseIndexArray = reader.ReadInt32Array();
     }
     RootMotionBoneIndex = reader.ReadInt32();
     RootMotionBoneX.Read(reader);
     if (IsReadRootMotionSkeleton(reader.Version))
     {
         RootMotionSkeleton.Read(reader);
         RootMotionSkeletonPose.Read(reader);
         m_rootMotionSkeletonIndexArray = reader.ReadInt32Array();
     }
 }
Example #2
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            m_navMeshTiles = reader.ReadArray <NavMeshTileData>();
            if (IsReadNavMeshParams(reader.Version))
            {
                NavMeshParams.Read(reader);
            }
            else
            {
                NavMeshBuildSettings.Read(reader);
            }
            m_heightmaps   = reader.ReadArray <HeightmapData>();
            m_heightMeshes = reader.ReadArray <HeightMeshData>();
            m_offMeshLinks = reader.ReadArray <AutoOffMeshLinkData>();
            if (IsReadSourceBounds(reader.Version))
            {
                SourceBounds.Read(reader);
                Rotation.Read(reader);
                Position.Read(reader);
                AgentTypeID = reader.ReadInt32();
            }
        }
        public void Read(AssetReader reader)
        {
            BlobIndex = reader.ReadUInt32();
            Channels.Read(reader);
            GlobalKeywordIndices = reader.ReadUInt16Array();
            if (IsAlignKeywordIndices(reader.Version))
            {
                reader.AlignStream();
            }
            if (HasLocalKeywordIndices(reader.Version))
            {
                LocalKeywordIndices = reader.ReadUInt16Array();
                reader.AlignStream();
            }

            ShaderHardwareTier = reader.ReadByte();
            GpuProgramType     = (ShaderGpuProgramType)reader.ReadByte();
            reader.AlignStream();

            VectorParams           = reader.ReadAssetArray <VectorParameter>();
            MatrixParams           = reader.ReadAssetArray <MatrixParameter>();
            TextureParams          = reader.ReadAssetArray <TextureParameter>();
            BufferParams           = reader.ReadAssetArray <BufferBinding>();
            ConstantBuffers        = reader.ReadAssetArray <ConstantBuffer>();
            ConstantBufferBindings = reader.ReadAssetArray <BufferBinding>();
            UAVParams = reader.ReadAssetArray <UAVParameter>();

            if (HasSamplers(reader.Version))
            {
                Samplers = reader.ReadAssetArray <SamplerParameter>();
            }
            if (HasShaderRequirements(reader.Version))
            {
                ShaderRequirements = reader.ReadInt32();
            }
        }
Example #4
0
        public void Read(AssetReader reader)
        {
            BlobIndex = reader.ReadUInt32();
            Channels.Read(reader);
            m_globalKeywordIndices = reader.ReadUInt16Array();
            if (IsAlignKeywordIndices(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadLocalKeywordIndices(reader.Version))
            {
                m_localKeywordIndices = reader.ReadUInt16Array();
                reader.AlignStream(AlignType.Align4);
            }

            ShaderHardwareTier = reader.ReadByte();
            GpuProgramType     = (ShaderGpuProgramType)reader.ReadByte();
            reader.AlignStream(AlignType.Align4);

            m_vectorParams           = reader.ReadAssetArray <VectorParameter>();
            m_matrixParams           = reader.ReadAssetArray <MatrixParameter>();
            m_textureParams          = reader.ReadAssetArray <TextureParameter>();
            m_bufferParams           = reader.ReadAssetArray <BufferBinding>();
            m_constantBuffers        = reader.ReadAssetArray <ConstantBuffer>();
            m_constantBufferBindings = reader.ReadAssetArray <BufferBinding>();
            m_UAVParams = reader.ReadAssetArray <UAVParameter>();

            if (IsReadSamplers(reader.Version))
            {
                m_samplers = reader.ReadAssetArray <SamplerParameter>();
            }
            if (IsReadShaderRequirements(reader.Version))
            {
                ShaderRequirements = reader.ReadInt32();
            }
        }
        public void Read(AssetReader reader)
        {
            BuildTarget          = reader.ReadString();
            MaxTextureSize       = reader.ReadInt32();
            ResizeAlgorithm      = (TextureResizeAlgorithm)reader.ReadInt32();
            TextureFormat        = (TextureFormat)reader.ReadInt32();
            TextureCompression   = (TextureImporterCompression)reader.ReadInt32();
            CompressionQuality   = reader.ReadInt32();
            CrunchedCompression  = reader.ReadBoolean();
            AllowsAlphaSplitting = reader.ReadBoolean();
            Overridden           = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);

            AndroidETC2FallbackOverride = (AndroidETC2FallbackOverride)reader.ReadInt32();
            if (IsReadForceMaximumCompressionQuality_BC6H_BC7(reader.Version))
            {
                ForceMaximumCompressionQuality_BC6H_BC7 = reader.ReadBoolean();
            }
        }
        public void Read(AssetReader reader)
        {
            BuildTarget    = reader.ReadString();
            MaxTextureSize = reader.ReadInt32();
            if (HasResizeAlgorithm(reader.Version))
            {
                ResizeAlgorithm = (TextureResizeAlgorithm)reader.ReadInt32();
            }
            TextureFormat = (TextureFormat)reader.ReadInt32();
            if (HasTextureCompression(reader.Version))
            {
                TextureCompression = (TextureImporterCompression)reader.ReadInt32();
            }
            if (HasCompressionQuality(reader.Version))
            {
                CompressionQuality = reader.ReadInt32();
            }
            if (HasCrunchedCompression(reader.Version))
            {
                CrunchedCompression = reader.ReadBoolean();
            }
            if (HasAllowsAlphaSplitting(reader.Version))
            {
                AllowsAlphaSplitting = reader.ReadBoolean();
            }
            if (HasOverridden(reader.Version))
            {
                Overridden = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasAndroidETC2FallbackOverride(reader.Version))
            {
                AndroidETC2FallbackOverride = (AndroidETC2FallbackOverride)reader.ReadInt32();
            }
            if (HasForceMaximumCompressionQuality_BC6H_BC7(reader.Version))
            {
                ForceMaximumCompressionQuality_BC6H_BC7 = reader.ReadBoolean();
            }
        }
Example #7
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            // All of these are 4 bytes long and Little Endian,
            // Re-alignment should not be needed because of this.
            MinDistance      = reader.ReadSingle();
            MaxDistance      = reader.ReadSingle();
            ReverbPreset     = reader.ReadInt32();
            Room             = reader.ReadInt32();
            RoomHF           = reader.ReadInt32();
            DecayTime        = reader.ReadSingle();
            DecayHFRatio     = reader.ReadSingle();
            Reflections      = reader.ReadInt32();
            ReflectionsDelay = reader.ReadSingle();
            Reverb           = reader.ReadInt32();
            ReverbDelay      = reader.ReadSingle();
            HFReference      = reader.ReadSingle();
            Diffusion        = reader.ReadSingle();
            Density          = reader.ReadSingle();
            LFReference      = reader.ReadSingle();
            RoomLF           = reader.ReadInt32();
        }
Example #8
0
        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 = reader.ReadAssetArray <PPtr <Texture> >();
            }
            if (IsReadShaderIsBaked(reader.Version))
            {
                ShaderIsBaked = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
        }
Example #9
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            LengthInSec = reader.ReadSingle();
            if (IsStartDelayFirst(reader.Version))
            {
                if (HasStartDelaySingle(reader.Version))
                {
                    StartDelaySingle = reader.ReadSingle();
                }
                else
                {
                    StartDelay.Read(reader);
                }
            }

            SimulationSpeed = reader.ReadSingle();
            if (HasStopAction(reader.Version))
            {
                StopAction = (ParticleSystemStopAction)reader.ReadInt32();
            }

            if (IsRandomSeedFirst(reader.Version))
            {
                RandomSeed = unchecked ((int)reader.ReadUInt32());
            }

            if (HasCullingMode(reader.Version))
            {
                CullingMode    = (ParticleSystemCullingMode)reader.ReadInt32();
                RingBufferMode = (ParticleSystemRingBufferMode)reader.ReadInt32();
                RingBufferLoopRange.Read(reader);
            }

            Looping     = reader.ReadBoolean();
            Prewarm     = reader.ReadBoolean();
            PlayOnAwake = reader.ReadBoolean();
            if (HasUseUnscaledTime(reader.Version))
            {
                UseUnscaledTime = reader.ReadBoolean();
            }
            if (IsMoveWithTransformBool(reader.Version))
            {
                MoveWithTransform = reader.ReadBoolean() ? ParticleSystemSimulationSpace.Local : ParticleSystemSimulationSpace.World;
            }
            if (HasAutoRandomSeed(reader.Version))
            {
                AutoRandomSeed = reader.ReadBoolean();
            }
            if (HasUseRigidbodyForVelocity(reader.Version))
            {
                UseRigidbodyForVelocity = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream();
            }

            if (!IsStartDelayFirst(reader.Version))
            {
                StartDelay.Read(reader);
                reader.AlignStream();
            }
            if (!IsMoveWithTransformBool(reader.Version))
            {
                MoveWithTransform = (ParticleSystemSimulationSpace)reader.ReadInt32();
                reader.AlignStream();
            }

            if (HasMoveWithCustomTransform(reader.Version))
            {
                MoveWithCustomTransform.Read(reader);
            }
            if (HasScalingMode(reader.Version))
            {
                ScalingMode = (ParticleSystemScalingMode)reader.ReadInt32();
            }
            if (!IsRandomSeedFirst(reader.Version))
            {
                RandomSeed = reader.ReadInt32();
            }

            InitialModule.Read(reader);
            ShapeModule.Read(reader);
            EmissionModule.Read(reader);
            SizeModule.Read(reader);
            RotationModule.Read(reader);
            ColorModule.Read(reader);
            UVModule.Read(reader);
            VelocityModule.Read(reader);
            if (HasInheritVelocityModule(reader.Version))
            {
                InheritVelocityModule.Read(reader);
            }
            ForceModule.Read(reader);
            if (HasExternalForcesModule(reader.Version))
            {
                ExternalForcesModule.Read(reader);
            }
            ClampVelocityModule.Read(reader);
            if (HasNoiseModule(reader.Version))
            {
                NoiseModule.Read(reader);
            }
            SizeBySpeedModule.Read(reader);
            RotationBySpeedModule.Read(reader);
            ColorBySpeedModule.Read(reader);
            CollisionModule.Read(reader);
            if (HasTriggerModule(reader.Version))
            {
                TriggerModule.Read(reader);
            }
            SubModule.Read(reader);
            if (HasLightsModule(reader.Version))
            {
                LightsModule.Read(reader);
                TrailModule.Read(reader);
            }
            if (HasCustomDataModule(reader.Version))
            {
                CustomDataModule.Read(reader);
            }
        }
Example #10
0
        public void Read(AssetReader reader)
        {
            int magic = reader.ReadInt32();

            if (magic != GetMagicNumber(reader.Version))
            {
                throw new Exception($"Magic number {magic} doesn't match");
            }

            ProgramType = (ShaderGpuProgramType)reader.ReadInt32();
            int unknown1 = reader.ReadInt32();
            int unknown2 = reader.ReadInt32();
            int unknown3 = reader.ReadInt32();

            if (HasUnknown4(reader.Version))
            {
                int unknown4 = reader.ReadInt32();
            }

            GlobalKeywords = reader.ReadStringArray();
            if (HasLocalKeywords(reader.Version))
            {
                LocalKeywords = reader.ReadStringArray();
            }
            ProgramData = reader.ReadByteArray();
            reader.AlignStream();

            int sourceMap = reader.ReadInt32();
            int bindCount = reader.ReadInt32();

            ShaderBindChannel[] channels = new ShaderBindChannel[bindCount];
            for (int i = 0; i < bindCount; i++)
            {
                ShaderChannel     source  = (ShaderChannel)reader.ReadUInt32();
                VertexComponent   target  = (VertexComponent)reader.ReadUInt32();
                ShaderBindChannel channel = new ShaderBindChannel(source, target);
                channels[i] = channel;
                sourceMap  |= 1 << (int)source;
            }
            BindChannels = new ParserBindChannels(channels, sourceMap);

            List <VectorParameter>  vectors        = new List <VectorParameter>();
            List <MatrixParameter>  matrices       = new List <MatrixParameter>();
            List <TextureParameter> textures       = new List <TextureParameter>();
            List <VectorParameter>  structVectors  = new List <VectorParameter>();
            List <MatrixParameter>  structMatrices = new List <MatrixParameter>();
            List <BufferBinding>    buffers        = new List <BufferBinding>();
            List <UAVParameter>     uavs           = HasUAVParameters(reader.Version) ? new List <UAVParameter>() : null;
            List <SamplerParameter> samplers       = HasSamplerParameters(reader.Version) ? new List <SamplerParameter>() : null;
            List <BufferBinding>    constBindings  = new List <BufferBinding>();
            List <StructParameter>  structs        = new List <StructParameter>();

            int paramGroupCount = reader.ReadInt32();

            ConstantBuffers = new ConstantBuffer[paramGroupCount - 1];
            for (int i = 0; i < paramGroupCount; i++)
            {
                vectors.Clear();
                matrices.Clear();
                structs.Clear();

                string name       = reader.ReadString();
                int    usedSize   = reader.ReadInt32();
                int    paramCount = reader.ReadInt32();
                for (int j = 0; j < paramCount; j++)
                {
                    string          paramName = reader.ReadString();
                    ShaderParamType paramType = (ShaderParamType)reader.ReadInt32();
                    int             rows      = reader.ReadInt32();
                    int             columns   = reader.ReadInt32();
                    bool            isMatrix  = reader.ReadInt32() > 0;
                    int             arraySize = reader.ReadInt32();
                    int             index     = reader.ReadInt32();

                    if (isMatrix)
                    {
                        MatrixParameter matrix = IsAllParamArgs(reader.Version) ?
                                                 new MatrixParameter(paramName, paramType, index, arraySize, rows, columns) :
                                                 new MatrixParameter(paramName, paramType, index, rows, columns);
                        matrices.Add(matrix);
                    }
                    else
                    {
                        VectorParameter vector = IsAllParamArgs(reader.Version) ?
                                                 new VectorParameter(paramName, paramType, index, arraySize, columns) :
                                                 new VectorParameter(paramName, paramType, index, columns);
                        vectors.Add(vector);
                    }
                }

                if (HasStructParameters(reader.Version))
                {
                    int structCount = reader.ReadInt32();
                    for (int j = 0; j < structCount; j++)
                    {
                        structVectors.Clear();
                        structMatrices.Clear();

                        string structName = reader.ReadString();
                        int    index      = reader.ReadInt32();
                        int    arraySize  = reader.ReadInt32();
                        int    structSize = reader.ReadInt32();

                        int strucParamCount = reader.ReadInt32();
                        for (int k = 0; k < strucParamCount; k++)
                        {
                            string paramName = reader.ReadString();
                            paramName = $"{structName}.{paramName}";
                            ShaderParamType paramType       = (ShaderParamType)reader.ReadInt32();
                            int             rows            = reader.ReadInt32();
                            int             columns         = reader.ReadInt32();
                            bool            isMatrix        = reader.ReadInt32() > 0;
                            int             vectorArraySize = reader.ReadInt32();
                            int             paramIndex      = reader.ReadInt32();

                            if (isMatrix)
                            {
                                MatrixParameter matrix = IsAllParamArgs(reader.Version) ?
                                                         new MatrixParameter(paramName, paramType, paramIndex, vectorArraySize, rows, columns) :
                                                         new MatrixParameter(paramName, paramType, paramIndex, rows, columns);
                                structMatrices.Add(matrix);
                            }
                            else
                            {
                                VectorParameter vector = IsAllParamArgs(reader.Version) ?
                                                         new VectorParameter(paramName, paramType, paramIndex, vectorArraySize, columns) :
                                                         new VectorParameter(paramName, paramType, paramIndex, columns);
                                structVectors.Add(vector);
                            }
                        }

                        StructParameter @struct = new StructParameter(structName, index, arraySize, structSize, structVectors.ToArray(), structMatrices.ToArray());
                        structs.Add(@struct);
                    }
                }
                if (i == 0)
                {
                    VectorParameters = vectors.ToArray();
                    MatrixParameters = matrices.ToArray();
                    StructParameters = structs.ToArray();
                }
                else
                {
                    ConstantBuffer constBuffer = new ConstantBuffer(name, matrices.ToArray(), vectors.ToArray(), structs.ToArray(), usedSize);
                    ConstantBuffers[i - 1] = constBuffer;
                }
            }

            int paramGroup2Count = reader.ReadInt32();

            for (int i = 0; i < paramGroup2Count; i++)
            {
                string name       = reader.ReadString();
                int    type       = reader.ReadInt32();
                int    index      = reader.ReadInt32();
                int    extraValue = reader.ReadInt32();

                if (type == 0)
                {
                    TextureParameter texture;
                    if (HasMultiSampled(reader.Version))
                    {
                        uint textureExtraValue = reader.ReadUInt32();
                        bool isMultiSampled    = (textureExtraValue & 1) == 1;
                        byte dimension         = (byte)(textureExtraValue >> 1);
                        texture = new TextureParameter(name, index, dimension, extraValue, isMultiSampled);
                    }
                    else
                    {
                        byte dimension    = unchecked ((byte)extraValue);
                        int  samplerIndex = extraValue >> 8;
                        if (samplerIndex == 0xFFFFFF)
                        {
                            samplerIndex = -1;
                        }
                        texture = new TextureParameter(name, index, dimension, samplerIndex);
                    }
                    textures.Add(texture);
                }
                else if (type == 1)
                {
                    BufferBinding binding = new BufferBinding(name, index);
                    constBindings.Add(binding);
                }
                else if (type == 2)
                {
                    BufferBinding buffer = new BufferBinding(name, index);
                    buffers.Add(buffer);
                }
                else if (type == 3 && HasUAVParameters(reader.Version))
                {
                    UAVParameter uav = new UAVParameter(name, index, extraValue);
                    uavs.Add(uav);
                }
                else if (type == 4 && HasSamplerParameters(reader.Version))
                {
                    SamplerParameter sampler = new SamplerParameter((uint)extraValue, index);
                    samplers.Add(sampler);
                }
                else
                {
                    throw new Exception($"Unupported parameter type {type}");
                }
            }
            TextureParameters = textures.ToArray();
            BufferParameters  = buffers.ToArray();
            if (HasUAVParameters(reader.Version))
            {
                UAVParameters = uavs.ToArray();
            }
            if (HasSamplerParameters(reader.Version))
            {
                SamplerParameters = samplers.ToArray();
            }
            ConstantBufferBindings = constBindings.ToArray();
            if (HasStructParameters(reader.Version))
            {
                StructParameters = structs.ToArray();
            }
        }
Example #11
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);
            }
        }
Example #12
0
        public void Read(AssetReader reader)
        {
            UseMultithreading     = reader.ReadBoolean();
            UseConsistencySorting = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);

            InterpolationPosesPerJob     = reader.ReadInt32();
            NewContactsPerJob            = reader.ReadInt32();
            CollideContactsPerJob        = reader.ReadInt32();
            ClearFlagsPerJob             = reader.ReadInt32();
            ClearBodyForcesPerJob        = reader.ReadInt32();
            SyncDiscreteFixturesPerJob   = reader.ReadInt32();
            SyncContinuousFixturesPerJob = reader.ReadInt32();
            FindNearestContactsPerJob    = reader.ReadInt32();
            UpdateTriggerContactsPerJob  = reader.ReadInt32();
            IslandSolverCostThreshold    = reader.ReadInt32();
            IslandSolverBodyCostScale    = reader.ReadInt32();
            IslandSolverContactCostScale = reader.ReadInt32();
            IslandSolverJointCostScale   = reader.ReadInt32();
            IslandSolverBodiesPerJob     = reader.ReadInt32();
            IslandSolverContactsPerJob   = reader.ReadInt32();
        }
        public override void Read(AssetReader reader)
        {
            if (IsReadRenderer(reader.Version))
            {
                base.Read(reader);
            }
            else
            {
                ReadBase(reader);
            }

            if (IsReadUpdateWhenOffscreen(reader.Version))
            {
                if (IsReadQualityFirst(reader.Version))
                {
                    Quality = reader.ReadInt32();
                }
                UpdateWhenOffscreen = reader.ReadBoolean();
                if (!IsReadQualityFirst(reader.Version))
                {
                    Quality = reader.ReadInt32();
                }
            }

            if (IsReadSkinNormals(reader.Version))
            {
                SkinNormals = reader.ReadBoolean();
            }
            if (IsReadSkinMotionVector(reader.Version))
            {
                SkinnedMotionVectors = reader.ReadBoolean();
            }
            if (IsAlignBools(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadOffscreen(reader.Version))
            {
                DisableAnimationWhenOffscreen.Read(reader);
            }

            if (IsReadMeshFirst(reader.Version))
            {
                Mesh.Read(reader);
            }

            if (IsReadAnimation(reader.Version))
            {
                Animation.Read(reader);
            }

            m_bones = reader.ReadAssetArray <PPtr <Transform> >();
            if (IsAlignBones(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (!IsReadMeshFirst(reader.Version))
            {
                Mesh.Read(reader);
            }

            if (IsReadBindPose(reader.Version))
            {
                m_bindPose = reader.ReadAssetArray <Matrix4x4f>();
            }
            if (IsReadCurrentPose(reader.Version))
            {
                CurrentPose.Read(reader);
            }

            if (IsReadWeights(reader.Version))
            {
                m_blendShapeWeights = reader.ReadSingleArray();
            }
            if (IsReadRootBone(reader.Version))
            {
                RootBone.Read(reader);
            }
            if (IsReadAABB(reader.Version))
            {
                AABB.Read(reader);
                DirtyAABB = reader.ReadBoolean();
                if (IsAlignDirty(reader.Version))
                {
                    reader.AlignStream(AlignType.Align4);
                }
            }
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasResolution(reader.Version))
            {
                Resolution = reader.ReadSingle();
            }
            ClusterResolution = reader.ReadSingle();
            IrradianceBudget  = reader.ReadInt32();
            if (HasIrradianceQuality(reader.Version))
            {
                IrradianceQuality = reader.ReadInt32();
            }
            BackFaceTolerance = reader.ReadSingle();
            if (HasEnvironmentResolution(reader.Version))
            {
                EnvironmentResolution = reader.ReadInt32();
            }
            if (HasIsTransparent(reader.Version))
            {
                IsTransparent      = reader.ReadInt32();
                ModellingTolerance = reader.ReadSingle();
            }
            SystemTag = reader.ReadInt32();
            if (HasEdgeStitching(reader.Version))
            {
                EdgeStitching       = reader.ReadInt32();
                BlurRadius          = reader.ReadInt32();
                DirectLightQuality  = reader.ReadInt32();
                AntiAliasingSamples = reader.ReadInt32();
            }
            if (HasPushoff(reader.Version))
            {
                if (IsPushoffFirst(reader.Version))
                {
                    Pushoff = reader.ReadSingle();
                }
            }
            if (HasBakedLightmapTag(reader.Version))
            {
                if (IsBakedLightmapTagFirst(reader.Version))
                {
                    BakedLightmapTag = reader.ReadInt32();
                }
            }
            if (HasPushoff(reader.Version))
            {
                if (!IsPushoffFirst(reader.Version))
                {
                    Pushoff = reader.ReadSingle();
                }
            }
            if (HasLimitLightmapCount(reader.Version))
            {
                LimitLightmapCount = reader.ReadBoolean();
                reader.AlignStream();

                MaxLightmapCount = reader.ReadInt32();
            }
            if (HasAOQuality(reader.Version))
            {
                AOQuality             = reader.ReadInt32();
                AOAntiAliasingSamples = reader.ReadInt32();
            }
            if (HasBakedLightmapTag(reader.Version))
            {
                if (!IsBakedLightmapTagFirst(reader.Version))
                {
                    BakedLightmapTag = reader.ReadInt32();
                }
            }
        }
Example #15
0
 public void Read(AssetReader reader)
 {
     FileIndex = reader.ReadInt32();
     PathID    = reader.Layout.PPtr.IsLongID ? reader.ReadInt64() : reader.ReadInt32();
 }
Example #16
0
        public void Read(AssetReader reader)
        {
            StyleName = reader.ReadString();
            Normal.Read(reader);
            Hover.Read(reader);
            Active.Read(reader);
            Focused.Read(reader);
            OnNormal.Read(reader);
            OnHover.Read(reader);
            OnActive.Read(reader);
            OnFocused.Read(reader);
            Border.Read(reader);
            if (IsBuiltIn(reader.Version))
            {
                Margin.Read(reader);
                Padding.Read(reader);
            }
            else
            {
                Padding.Read(reader);
                Margin.Read(reader);
            }
            Overflow.Read(reader);
            Font.Read(reader);

            if (IsBuiltIn(reader.Version))
            {
                FontSize  = reader.ReadInt32();
                FontStyle = (FontStyle)reader.ReadInt32();
                Alignment = (TextAnchor)reader.ReadInt32();
                WordWrap  = reader.ReadBoolean();
                RichText  = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);

                TextClipping  = (TextClipping)reader.ReadInt32();
                ImagePosition = (ImagePosition)reader.ReadInt32();
                ContentOffset.Read(reader);
                FixedWidth    = reader.ReadSingle();
                FixedHeight   = reader.ReadSingle();
                StretchWidth  = reader.ReadBoolean();
                StretchHeight = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            else
            {
                ImagePosition = (ImagePosition)reader.ReadInt32();
                Alignment     = (TextAnchor)reader.ReadInt32();
                WordWrap      = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);

                TextClipping = (TextClipping)reader.ReadInt32();
                ContentOffset.Read(reader);
                ClipOffset.Read(reader);
                FixedWidth  = reader.ReadSingle();
                FixedHeight = reader.ReadSingle();
                if (IsReadFontSize(reader.Version))
                {
                    FontSize  = reader.ReadInt32();
                    FontStyle = (FontStyle)reader.ReadInt32();
                }
                StretchWidth = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
                StretchHeight = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
        }
Example #17
0
 public void Read(AssetReader reader)
 {
     X = reader.ReadInt32();
     Y = reader.ReadInt32();
     Z = reader.ReadInt32();
 }
Example #18
0
 public void Read(AssetReader reader)
 {
     ParentId = reader.ReadInt32();
     AxesId   = reader.ReadInt32();
 }
 public void Read(AssetReader reader)
 {
     Passes = reader.ReadAssetArray <SerializedPass>();
     Tags.Read(reader);
     LOD = reader.ReadInt32();
 }
Example #20
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadIsPowerOfTwo(reader.Version))
            {
                if (IsReadIsPowerOfTwoFirst(reader.Version))
                {
                    IsPowerOfTwo = reader.ReadBoolean();
                }
            }
            Width  = reader.ReadInt32();
            Height = reader.ReadInt32();
            if (IsReadAntiAliasing(reader.Version))
            {
                AntiAliasing = reader.ReadInt32();
            }
            DepthFormat = reader.ReadInt32();
            if (IsReadColorFormat(reader.Version))
            {
                ColorFormat = (RenderTextureFormat)reader.ReadInt32();
            }
            if (IsReadIsPowerOfTwo(reader.Version))
            {
                if (!IsReadIsPowerOfTwoFirst(reader.Version))
                {
                    IsPowerOfTwo = reader.ReadBoolean();
                }
            }
            if (IsReadIsCubemap(reader.Version))
            {
                IsCubemap = reader.ReadBoolean();
            }
            if (IsReadMipMap(reader.Version))
            {
                MipMap = reader.ReadBoolean();
            }
            if (IsReadGenerateMips(reader.Version))
            {
                GenerateMips = reader.ReadBoolean();
            }
            if (IsReadSRGB(reader.Version))
            {
                SRGB = reader.ReadBoolean();
            }
            if (IsReadUseDynamicScale(reader.Version))
            {
                UseDynamicScale = reader.ReadBoolean();
                BindMS          = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            TextureSettings.Read(reader);
            if (IsReadDimension(reader.Version))
            {
                Dimension   = reader.ReadInt32();
                VolumeDepth = reader.ReadInt32();
            }
        }
Example #21
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            TerrainData.Read(reader);
            TreeDistance            = reader.ReadSingle();
            TreeBillboardDistance   = reader.ReadSingle();
            TreeCrossFadeLength     = reader.ReadSingle();
            TreeMaximumFullLODCount = reader.ReadInt32();
            DetailObjectDistance    = reader.ReadSingle();
            DetailObjectDensity     = reader.ReadSingle();
            HeightmapPixelError     = reader.ReadSingle();
            SplatMapDistance        = reader.ReadSingle();
            HeightmapMaximumLOD     = reader.ReadInt32();
            if (IsReadShadowCastingMode(reader.Version))
            {
                ShadowCastingMode = (ShadowCastingMode)reader.ReadInt32();
            }
            else
            {
                bool CastShadows = reader.ReadBoolean();
                ShadowCastingMode = CastShadows ? ShadowCastingMode.TwoSided : ShadowCastingMode.Off;
            }
            if (IsReadDrawHeightmap(reader.Version))
            {
                DrawHeightmap = reader.ReadBoolean();
            }
            if (IsReadDrawInstanced(reader.Version))
            {
                DrawInstanced = reader.ReadBoolean();
            }
            DrawTreesAndFoliage = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);

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

            if (IsReadBakeLightProbesForTrees(reader.Version))
            {
                BakeLightProbesForTrees = reader.ReadBoolean();
            }
            if (IsReadPreserveTreePrototypeLayers(reader.Version))
            {
                PreserveTreePrototypeLayers = reader.ReadBoolean();
            }
            if (IsReadDeringLightProbesForTrees(reader.Version, reader.Flags))
            {
                DeringLightProbesForTrees = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
#if UNIVERSAL
            if (IsReadScaleInLightmap(reader.Flags))
            {
                ScaleInLightmap = reader.ReadSingle();
                LightmapParameters.Read(reader);
            }
#endif
            if (IsReadDynamicUVST(reader.Version, reader.Flags))
            {
                DynamicUVST.Read(reader);
                ChunkDynamicUVST.Read(reader);
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadGroupingID(reader.Version))
            {
                GroupingID       = reader.ReadInt32();
                AllowAutoConnect = reader.ReadBoolean();
            }
        }
Example #22
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Type = (ParticleSystemShapeType)reader.ReadInt32();
            if (HasRadiusSingle(reader.Version))
            {
                float radius = reader.ReadSingle();
                Radius = new MultiModeParameter(radius);
            }
            Angle = reader.ReadSingle();
            if (HasLength(reader.Version))
            {
                Length = reader.ReadSingle();
            }
            if (HasBoxAxes(reader.Version))
            {
                float boxX = reader.ReadSingle();
                float boxY = reader.ReadSingle();
                float boxZ = reader.ReadSingle();
                Scale = Type.IsBoxAny() ? new Vector3f(boxX, boxY, boxZ) : Vector3f.One;
            }
            if (HasArcSingle(reader.Version))
            {
                float arc = reader.ReadSingle();
                Arc = new MultiModeParameter(arc);
            }
            if (HasRadius(reader.Version))
            {
                if (HasRadiusFirst(reader.Version))
                {
                    Radius.Read(reader);
                    Arc.Read(reader);
                }
            }
            if (HasBoxThickness(reader.Version))
            {
                BoxThickness.Read(reader);
                RadiusThickness = reader.ReadSingle();
                DonutRadius     = reader.ReadSingle();
                Position.Read(reader);
                Rotation.Read(reader);
                Scale.Read(reader);
            }
            PlacementMode = (PlacementMode)reader.ReadInt32();
            if (HasMeshMaterialIndex(reader.Version))
            {
                if (HasMeshMaterialIndexFirst(reader.Version))
                {
                    MeshMaterialIndex = reader.ReadInt32();
                    MeshNormalOffset  = reader.ReadSingle();
                }
            }
            if (HasMeshSpawn(reader.Version))
            {
                MeshSpawn.Read(reader, false);
            }
            Mesh.Read(reader);
            if (HasMeshRenderer(reader.Version))
            {
                MeshRenderer.Read(reader);
                SkinnedMeshRenderer.Read(reader);
            }
            if (HasSprite(reader.Version))
            {
                Sprite.Read(reader);
                SpriteRenderer.Read(reader);
            }
            if (HasMeshMaterialIndex(reader.Version))
            {
                if (!HasMeshMaterialIndexFirst(reader.Version))
                {
                    MeshMaterialIndex = reader.ReadInt32();
                    MeshNormalOffset  = reader.ReadSingle();
                }
            }
            if (HasMeshScale(reader.Version))
            {
                float meshScale = reader.ReadSingle();
                Scale = new Vector3f(meshScale, meshScale, meshScale);
            }
            if (HasUseMeshMaterialIndex(reader.Version))
            {
                UseMeshMaterialIndex = reader.ReadBoolean();
                UseMeshColors        = reader.ReadBoolean();
            }
            if (HasAlignToDirection(reader.Version))
            {
                AlignToDirection = reader.ReadBoolean();
            }
            if (HasRandomDirection(reader.Version))
            {
                bool randomDirection = reader.ReadBoolean();
                RandomDirectionAmount = randomDirection ? 1.0f : 0.0f;
            }
            reader.AlignStream();

            if (HasTexture(reader.Version))
            {
                Texture.Read(reader);
                TextureClipChannel           = reader.ReadInt32();
                TextureClipThreshold         = reader.ReadSingle();
                TextureUVChannel             = reader.ReadInt32();
                TextureColorAffectsParticles = reader.ReadBoolean();
                TextureAlphaAffectsParticles = reader.ReadBoolean();
                TextureBilinearFiltering     = reader.ReadBoolean();
                reader.AlignStream();
            }

            if (HasRandomDirectionAmount(reader.Version))
            {
                RandomDirectionAmount    = reader.ReadSingle();
                SphericalDirectionAmount = reader.ReadSingle();
            }
            if (HasRandomPositionAmount(reader.Version))
            {
                RandomPositionAmount = reader.ReadSingle();
            }
            if (HasRadius(reader.Version))
            {
                if (!HasRadiusFirst(reader.Version))
                {
                    Radius.Read(reader);
                    Arc.Read(reader);
                }
            }
        }
Example #23
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Volume = reader.ReadSingle();
            if (HasRolloffScale(reader.Version))
            {
                if (IsRolloffScaleFirst(reader.Version))
                {
                    RolloffScale = reader.ReadSingle();
                }
            }
            if (HasSpeedOfSound(reader.Version))
            {
                SpeedOfSound = reader.ReadSingle();
            }
            DopplerFactor = reader.ReadSingle();
            if (HasDefaultSpeakerMode(reader.Version))
            {
                DefaultSpeakerMode = (AudioSpeakerMode)reader.ReadInt32();
            }
            if (HasSampleRate(reader.Version))
            {
                SampleRate = reader.ReadInt32();
            }
            if (HasRolloffScale(reader.Version))
            {
                if (!IsRolloffScaleFirst(reader.Version))
                {
                    RolloffScale = reader.ReadSingle();
                }
            }
            if (HasDSPBufferSize(reader.Version))
            {
                DSPBufferSize = reader.ReadInt32();
            }
            if (HasVirtualVoiceCount(reader.Version))
            {
                VirtualVoiceCount = reader.ReadInt32();
                RealVoiceCount    = reader.ReadInt32();
            }
            if (HasSpatializerPlugin(reader.Version))
            {
                SpatializerPlugin = reader.ReadString();
            }
            if (HasAmbisonicDecoderPlugin(reader.Version))
            {
                AmbisonicDecoderPlugin = reader.ReadString();
            }
            if (HasDisableAudio(reader.Version))
            {
                DisableAudio = reader.ReadBoolean();
            }
            if (HasVirtualizeEffects(reader.Version))
            {
                VirtualizeEffects = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasRequestedDSPBufferSize(reader.Version))
            {
                RequestedDSPBufferSize = reader.ReadInt32();
            }
        }
Example #24
0
 public void Read(AssetReader reader)
 {
     Keywords = reader.ReadString();
     PassType = (PassType)reader.ReadInt32();
 }
Example #25
0
 public void Read(AssetReader reader)
 {
     ByteOffset = reader.ReadInt32();
     Curve.Read(reader);
     AttributeName = reader.ReadStringAligned();
 }
Example #26
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Type = (LightType)reader.ReadInt32();
            Color.Read(reader);
            if (IsReadAttenuate(reader.Version))
            {
                Attenuate = reader.ReadBoolean();
                if (IsAlign(reader.Version))
                {
                    reader.AlignStream(AlignType.Align4);
                }
            }
            if (IsReadIntensity(reader.Version))
            {
                Intensity = reader.ReadSingle();
            }
            Range     = reader.ReadSingle();
            SpotAngle = reader.ReadSingle();
            if (IsReadCookieSize(reader.Version))
            {
                CookieSize = reader.ReadSingle();
            }
            if (IsReadShadows(reader.Version))
            {
                Shadows.Read(reader);
            }
            Cookie.Read(reader);
            DrawHalo = reader.ReadBoolean();
            if (IsReadActuallyLightmapped(reader.Version))
            {
                ActuallyLightmapped = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadBakedIndex(reader.Version))
            {
                BakedIndex = reader.ReadInt32();
            }
            if (IsReadBakingOutput(reader.Version))
            {
                BakingOutput.Read(reader);
            }
            Flare.Read(reader);
            RenderMode = (LightRenderMode)reader.ReadInt32();
            if (IsReadCullingMask(reader.Version))
            {
                CullingMask.Read(reader);
            }
            if (IsReadLightmapping(reader.Version))
            {
                Lightmapping = (LightmappingMode)reader.ReadInt32();
            }
            if (IsReadLightShadowCasterMode(reader.Version))
            {
                LightShadowCasterMode = (LightShadowCasterMode)reader.ReadInt32();
            }
            if (IsReadAreaSize(reader.Version))
            {
                AreaSize.Read(reader);
            }
            if (IsReadBounceIntensity(reader.Version))
            {
                BounceIntensity = reader.ReadSingle();
            }
            if (IsReadFalloffTable(reader.Version))
            {
                FalloffTable.Read(reader);
            }
            if (IsReadColorTemperature(reader.Version))
            {
                ColorTemperature    = reader.ReadSingle();
                UseColorTemperature = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
        }
Example #27
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

#if UNIVERSAL
            if (IsReadAlphaIsTransparency(reader.Version, reader.Flags))
            {
                if (GetAlphaIsTransparencyPosition(reader.Version) == 0)
                {
                    AlphaIsTransparency = reader.ReadBoolean();
                    reader.AlignStream(AlignType.Align4);
                }
            }
#endif
            Width             = reader.ReadInt32();
            Height            = reader.ReadInt32();
            CompleteImageSize = reader.ReadInt32();
            TextureFormat     = (TextureFormat)reader.ReadInt32();

            if (IsBoolMinMap(reader.Version))
            {
                bool mipMap = reader.ReadBoolean();
                if (mipMap)
                {
                    int maxSide = Math.Max(Width, Height);
                    MipCount = Convert.ToInt32(Math.Log(maxSide) / Math.Log(2));
                }
                else
                {
                    MipCount = 1;
                }
            }
            else
            {
                MipCount = reader.ReadInt32();
            }

            if (IsReadIsReadable(reader.Version))
            {
                IsReadable = reader.ReadBoolean();
            }
            if (IsReadReadAllowed(reader.Version))
            {
                ReadAllowed = reader.ReadBoolean();
            }
            if (IsReadStreamingMipmaps(reader.Version))
            {
                StreamingMipmaps = reader.ReadBoolean();
            }
#if UNIVERSAL
            if (IsReadAlphaIsTransparency(reader.Version, reader.Flags))
            {
                if (GetAlphaIsTransparencyPosition(reader.Version) == 1)
                {
                    AlphaIsTransparency = reader.ReadBoolean();
                }
            }
#endif
            reader.AlignStream(AlignType.Align4);

            if (IsReadStreamingMipmapsPriority(reader.Version))
            {
                StreamingMipmapsPriority = reader.ReadInt32();
#if UNIVERSAL
                if (IsReadAlphaIsTransparency(reader.Version, reader.Flags))
                {
                    if (GetAlphaIsTransparencyPosition(reader.Version) == 2)
                    {
                        AlphaIsTransparency = reader.ReadBoolean();
                    }
                }
#endif
                reader.AlignStream(AlignType.Align4);
            }

            ImageCount       = reader.ReadInt32();
            TextureDimension = (TextureDimension)reader.ReadInt32();
            TextureSettings.Read(reader);

            if (IsReadLightmapFormat(reader.Version))
            {
                LightmapFormat = (TextureUsageMode)reader.ReadInt32();
            }
            if (IsReadColorSpace(reader.Version))
            {
                ColorSpace = (ColorSpace)reader.ReadInt32();
            }

            m_imageData = reader.ReadByteArray();
            reader.AlignStream(AlignType.Align4);
            if (IsReadStreamData(reader.Version))
            {
                StreamData.Read(reader);
            }
        }
Example #28
0
        public void Read(AssetReader reader)
        {
            Resolution     = reader.ReadSingle();
            BakeResolution = reader.ReadSingle();
            if (IsReadAtlasSize(reader.Version))
            {
                int AtlasSize = reader.ReadInt32();
                TextureWidth = TextureHeight = AtlasSize;
            }
            else
            {
                TextureWidth  = reader.ReadInt32();
                TextureHeight = reader.ReadInt32();
            }
            AO = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);

            AOMaxDistance        = reader.ReadSingle();
            CompAOExponent       = reader.ReadSingle();
            CompAOExponentDirect = reader.ReadSingle();
            if (IsReadExtractAmbientOcclusion(reader.Version))
            {
                ExtractAmbientOcclusion = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            Padding = reader.ReadInt32();
            LightmapParameters.Read(reader);
            LightmapsBakeMode    = (LightmapsMode)reader.ReadInt32();
            TextureCompression   = reader.ReadBoolean();
            FinalGather          = reader.ReadBoolean();
            FinalGatherFiltering = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);

            FinalGatherRayCount   = reader.ReadInt32();
            ReflectionCompression = (ReflectionCubemapCompression)reader.ReadInt32();
            MixedBakeMode         = (MixedLightingMode)reader.ReadInt32();
            BakeBackend           = (Lightmapper)reader.ReadInt32();
            PVRSampling           = (Sampling)reader.ReadInt32();
            PVRDirectSampleCount  = reader.ReadInt32();
            PVRSampleCount        = reader.ReadInt32();
            PVRBounces            = reader.ReadInt32();
            if (IsReadPVREnvironmentSampleCount(reader.Version))
            {
                PVREnvironmentSampleCount         = reader.ReadInt32();
                PVREnvironmentReferencePointCount = reader.ReadInt32();
                PVRFilteringMode        = (FilterMode)reader.ReadInt32();
                PVRDenoiserTypeDirect   = (DenoiserType)reader.ReadInt32();
                PVRDenoiserTypeIndirect = (DenoiserType)reader.ReadInt32();
                PVRDenoiserTypeAO       = (DenoiserType)reader.ReadInt32();
            }
            PVRFilterTypeDirect   = (FilterType)reader.ReadInt32();
            PVRFilterTypeIndirect = (FilterType)reader.ReadInt32();
            PVRFilterTypeAO       = (FilterType)reader.ReadInt32();
            if (IsReadPVREnvironmentMIS(reader.Version))
            {
                PVREnvironmentMIS = reader.ReadInt32();
            }
            if (!IsReadPVREnvironmentSampleCount(reader.Version))
            {
                PVRFilteringMode = (FilterMode)reader.ReadInt32();
            }
            PVRCulling = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);

            PVRFilteringGaussRadiusDirect           = reader.ReadInt32();
            PVRFilteringGaussRadiusIndirect         = reader.ReadInt32();
            PVRFilteringGaussRadiusAO               = reader.ReadInt32();
            PVRFilteringAtrousPositionSigmaDirect   = reader.ReadSingle();
            PVRFilteringAtrousPositionSigmaIndirect = reader.ReadSingle();
            PVRFilteringAtrousPositionSigmaAO       = reader.ReadSingle();
            if (IsReadShowResolutionOverlay(reader.Version))
            {
                ShowResolutionOverlay = reader.ReadBoolean();
            }
            reader.AlignStream(AlignType.Align4);

            if (IsReadExportTrainingData(reader.Version))
            {
                ExportTrainingData = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadTrainingDataDestination(reader.Version))
            {
                TrainingDataDestination = reader.ReadString();
            }
        }
Example #29
0
 public void Read(AssetReader reader)
 {
     ID = reader.ReadInt32();
 }
Example #30
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadDefaultStandaloneQuality(reader.Version))
            {
                QualityLevel defaultStandaloneQuality = (QualityLevel)reader.ReadInt32();
                QualityLevel defaultWebPlayerQuality  = (QualityLevel)reader.ReadInt32();
                m_perPlatformDefaultQuality = new Dictionary <string, int>();
                SetDefaultPlatformQuality(m_perPlatformDefaultQuality);
                m_perPlatformDefaultQuality[BuildTargetGroup.Standalone.ToExportString()] = (int)defaultStandaloneQuality;
                m_perPlatformDefaultQuality[BuildTargetGroup.WebPlayer.ToExportString()]  = (int)defaultStandaloneQuality;
            }
            if (IsReadDefaultMobileQuality(reader.Version))
            {
                QualityLevel defaultMobileQuality = (QualityLevel)reader.ReadInt32();
                m_perPlatformDefaultQuality[BuildTargetGroup.Android.ToExportString()] = (int)defaultMobileQuality;
                m_perPlatformDefaultQuality[BuildTargetGroup.iOS.ToExportString()]     = (int)defaultMobileQuality;
            }
            CurrentQuality = reader.ReadInt32();
            if (IsReadQualitySettingArray(reader.Version))
            {
                m_qualitySettings = reader.ReadAssetArray <QualitySetting>();
            }
            else
            {
                m_qualitySettings = new QualitySetting[6];
                QualitySetting fastest = reader.ReadAsset <QualitySetting>();
                fastest.Name = nameof(QualityLevel.Fastest);
                m_qualitySettings[(int)QualityLevel.Fastest] = fastest;

                QualitySetting fast = reader.ReadAsset <QualitySetting>();
                fast.Name = nameof(QualityLevel.Fast);
                m_qualitySettings[(int)QualityLevel.Fast] = fast;

                QualitySetting simple = reader.ReadAsset <QualitySetting>();
                simple.Name = nameof(QualityLevel.Simple);
                m_qualitySettings[(int)QualityLevel.Simple] = simple;

                QualitySetting good = reader.ReadAsset <QualitySetting>();
                good.Name = nameof(QualityLevel.Good);
                m_qualitySettings[(int)QualityLevel.Good] = good;

                QualitySetting beautiful = reader.ReadAsset <QualitySetting>();
                beautiful.Name = nameof(QualityLevel.Beautiful);
                m_qualitySettings[(int)QualityLevel.Beautiful] = beautiful;

                QualitySetting fantastic = reader.ReadAsset <QualitySetting>();
                fantastic.Name = nameof(QualityLevel.Fantastic);
                m_qualitySettings[(int)QualityLevel.Fantastic] = fantastic;
            }
            foreach (QualitySetting setting in m_qualitySettings)
            {
                switch (setting.Name)
                {
                case nameof(QualityLevel.Fastest):
                case "Very Low":
                    QualitySetting fastest = CreateFastestSettings();
                    setting.Merge(fastest, reader.Version, reader.Flags);
                    break;

                case nameof(QualityLevel.Fast):
                case "Low":
                    QualitySetting fast = CreateFastSettings();
                    setting.Merge(fast, reader.Version, reader.Flags);
                    break;

                case nameof(QualityLevel.Simple):
                case "Medium":
                    QualitySetting simple = CreateSimpleSettings();
                    setting.Merge(simple, reader.Version, reader.Flags);
                    break;

                case nameof(QualityLevel.Good):
                case "High":
                    QualitySetting good = CreateGoodSettings();
                    setting.Merge(good, reader.Version, reader.Flags);
                    break;

                case nameof(QualityLevel.Beautiful):
                case "Very High":
                    QualitySetting beautiful = CreateBeautifulSettings();
                    setting.Merge(beautiful, reader.Version, reader.Flags);
                    break;

                case nameof(QualityLevel.Fantastic):
                case "Ultra":
                default:
                    QualitySetting fantastic = CreateFantasticSettings();
                    setting.Merge(fantastic, reader.Version, reader.Flags);
                    break;
                }
            }

            if (IsReadWebPlayer(reader.Version))
            {
                QualitySetting webPlayer = reader.ReadAsset <QualitySetting>();
                webPlayer.Name = "WebPlayer";
            }

#if UNIVERSAL
            if (IsReadPerPlatformDefaultQuality(reader.Version, reader.Flags))
            {
                m_perPlatformDefaultQuality = new Dictionary <string, int>();
                m_perPlatformDefaultQuality.Read(reader);
            }
#endif
            if (IsReadStrippedMaximumLODLevel(reader.Version, reader.Flags))
            {
                StrippedMaximumLODLevel = reader.ReadInt32();
            }
        }