Esempio n. 1
0
 public void Read(AssetReader reader)
 {
     Stream    = reader.ReadByte();
     Offset    = reader.ReadByte();
     Format    = (ChannelFormat)reader.ReadByte();
     Dimension = reader.ReadByte();
 }
Esempio n. 2
0
 public void Read(AssetReader reader)
 {
     Stream       = reader.ReadByte();
     Offset       = reader.ReadByte();
     Format       = reader.ReadByte();
     RawDimension = reader.ReadByte();
 }
Esempio n. 3
0
        public void Read(AssetReader reader)
        {
            BlobIndex = reader.ReadUInt32();
            Channels.Read(reader);
            m_keywordIndices = reader.ReadUInt16Array();
            if (IsAlignKeywordIndices(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

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

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

            if (IsReadSamplers(reader.Version))
            {
                m_samplers = reader.ReadArray <SamplerParameter>();
            }
            if (IsReadShaderRequirements(reader.Version))
            {
                ShaderRequirements = reader.ReadInt32();
            }
        }
Esempio n. 4
0
 public void Read(AssetReader reader)
 {
     Start.Read(reader);
     End.Read(reader);
     Radius        = reader.ReadSingle();
     LinkType      = reader.ReadUInt16();
     Area          = reader.ReadByte();
     LinkDirection = reader.ReadByte();
 }
Esempio n. 5
0
 public void Read(AssetReader reader)
 {
     NameIndex = reader.ReadInt32();
     Index     = reader.ReadInt32();
     ArraySize = reader.ReadInt32();
     Type      = (ShaderParamType)reader.ReadByte();
     Dim       = reader.ReadByte();
     reader.AlignStream(AlignType.Align4);
 }
Esempio n. 6
0
 public void Read(AssetReader reader)
 {
     NameIndex   = reader.ReadInt32();
     Index       = reader.ReadInt32();
     ArraySize   = reader.ReadInt32();
     Type        = (ShaderParamType)reader.ReadByte();
     RowCount    = reader.ReadByte();
     ColumnCount = 0;
     reader.AlignStream();
 }
Esempio n. 7
0
        public void Read(AssetReader reader)
        {
            GradientLayout layout = reader.Layout.Serialized.Gradient;

            if (layout.Version == 1)
            {
                Key0_32 = reader.ReadAsset <ColorRGBA32>();
                Key1_32 = reader.ReadAsset <ColorRGBA32>();
                Key2_32 = reader.ReadAsset <ColorRGBA32>();
                Key3_32 = reader.ReadAsset <ColorRGBA32>();
                Key4_32 = reader.ReadAsset <ColorRGBA32>();
                Key5_32 = reader.ReadAsset <ColorRGBA32>();
                Key6_32 = reader.ReadAsset <ColorRGBA32>();
                Key7_32 = reader.ReadAsset <ColorRGBA32>();
            }
            else
            {
                Key0.Read(reader);
                Key1.Read(reader);
                Key2.Read(reader);
                Key3.Read(reader);
                Key4.Read(reader);
                Key5.Read(reader);
                Key6.Read(reader);
                Key7.Read(reader);
            }

            Ctime0 = reader.ReadUInt16();
            Ctime1 = reader.ReadUInt16();
            Ctime2 = reader.ReadUInt16();
            Ctime3 = reader.ReadUInt16();
            Ctime4 = reader.ReadUInt16();
            Ctime5 = reader.ReadUInt16();
            Ctime6 = reader.ReadUInt16();
            Ctime7 = reader.ReadUInt16();
            Atime0 = reader.ReadUInt16();
            Atime1 = reader.ReadUInt16();
            Atime2 = reader.ReadUInt16();
            Atime3 = reader.ReadUInt16();
            Atime4 = reader.ReadUInt16();
            Atime5 = reader.ReadUInt16();
            Atime6 = reader.ReadUInt16();
            Atime7 = reader.ReadUInt16();
            if (layout.HasMode)
            {
                Mode = (GradientMode)reader.ReadInt32();
            }

            NumColorKeys = reader.ReadByte();
            NumAlphaKeys = reader.ReadByte();
            reader.AlignStream();
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasBodyType(reader.Version))
            {
                BodyType  = (RigidbodyType2D)reader.ReadInt32();
                Simulated = reader.ReadBoolean();
                UseFullKinematicContacts = reader.ReadBoolean();
            }
            if (HasUseAutoMass(reader.Version))
            {
                UseAutoMass = reader.ReadBoolean();
                reader.AlignStream();
            }

            Mass         = reader.ReadSingle();
            LinearDrag   = reader.ReadSingle();
            AngularDrag  = reader.ReadSingle();
            GravityScale = reader.ReadSingle();
            if (HasMaterial(reader.Version))
            {
                Material.Read(reader);
            }

            if (HasFixedAngle(reader.Version))
            {
                bool fixedAngle = reader.ReadBoolean();
                Constraints = fixedAngle ? RigidbodyConstraints2D.FreezeRotation : RigidbodyConstraints2D.None;
            }
            if (HasIsKinematic(reader.Version))
            {
                bool isKinematic = reader.ReadBoolean();
                BodyType           = isKinematic ? RigidbodyType2D.Kinematic : RigidbodyType2D.Static;
                Interpolate        = (RigidbodyInterpolation2D)reader.ReadByte();
                SleepingMode       = (RigidbodySleepMode2D)reader.ReadByte();
                CollisionDetection = (CollisionDetectionMode2D)reader.ReadByte();
                reader.AlignStream();
            }

            if (HasInterpolate(reader.Version))
            {
                Interpolate        = (RigidbodyInterpolation2D)reader.ReadInt32();
                SleepingMode       = (RigidbodySleepMode2D)reader.ReadInt32();
                CollisionDetection = (CollisionDetectionMode2D)reader.ReadInt32();
            }
            if (!HasFixedAngle(reader.Version))
            {
                Constraints = (RigidbodyConstraints2D)reader.ReadInt32();
            }
        }
Esempio n. 9
0
        public void Read(AssetReader reader)
        {
            if (IsColor32(reader.Version))
            {
                Key0.Read32(reader);
                Key1.Read32(reader);
                Key2.Read32(reader);
                Key3.Read32(reader);
                Key4.Read32(reader);
                Key5.Read32(reader);
                Key6.Read32(reader);
                Key7.Read32(reader);
            }
            else
            {
                Key0.Read(reader);
                Key1.Read(reader);
                Key2.Read(reader);
                Key3.Read(reader);
                Key4.Read(reader);
                Key5.Read(reader);
                Key6.Read(reader);
                Key7.Read(reader);
            }

            Ctime0 = reader.ReadUInt16();
            Ctime1 = reader.ReadUInt16();
            Ctime2 = reader.ReadUInt16();
            Ctime3 = reader.ReadUInt16();
            Ctime4 = reader.ReadUInt16();
            Ctime5 = reader.ReadUInt16();
            Ctime6 = reader.ReadUInt16();
            Ctime7 = reader.ReadUInt16();
            Atime0 = reader.ReadUInt16();
            Atime1 = reader.ReadUInt16();
            Atime2 = reader.ReadUInt16();
            Atime3 = reader.ReadUInt16();
            Atime4 = reader.ReadUInt16();
            Atime5 = reader.ReadUInt16();
            Atime6 = reader.ReadUInt16();
            Atime7 = reader.ReadUInt16();
            if (HasMode(reader.Version))
            {
                Mode = (GradientMode)reader.ReadInt32();
            }

            NumColorKeys = reader.ReadByte();
            NumAlphaKeys = reader.ReadByte();
            reader.AlignStream();
        }
Esempio n. 10
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            IsEnabled = reader.ReadByte() == 0 ? false : true;
            reader.AlignStream(AlignType.Align4);
        }
Esempio n. 11
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Mass        = reader.ReadSingle();
            Drag        = reader.ReadSingle();
            AngularDrag = reader.ReadSingle();
            UseGravity  = reader.ReadBoolean();
            IsKinematic = reader.ReadBoolean();
            if (IsReadInterpolate(reader.Version))
            {
                Interpolate = (RigidbodyInterpolation)reader.ReadByte();
                if (IsAlign(reader.Version))
                {
                    reader.AlignStream(AlignType.Align4);
                }
            }

            if (IsReadFreezeRotation(reader.Version))
            {
                bool freezeRotation = reader.ReadBoolean();
                Constraints = freezeRotation ? RigidbodyConstraints.FreezeRotation : RigidbodyConstraints.None;
            }
            else
            {
                Constraints = (RigidbodyConstraints)reader.ReadInt32();
            }
            if (IsReadCollisionDetection(reader.Version))
            {
                CollisionDetection = (CollisionDetectionMode)reader.ReadInt32();
            }
        }
Esempio n. 12
0
        public void Read(AssetReader reader)
        {
            ChannelMask = reader.ReadUInt32();
            Offset      = reader.ReadUInt32();

            if (IsReadAlign(reader.Version))
            {
                Stride = reader.ReadUInt32();
                Align  = reader.ReadUInt32();
            }
            else
            {
                Stride    = reader.ReadByte();
                DividerOp = reader.ReadByte();
                Frequency = reader.ReadUInt16();
            }
        }
Esempio n. 13
0
 public void Read(AssetReader reader)
 {
     NumItems = reader.ReadUInt32();
     m_data   = reader.ReadByteArray();
     reader.AlignStream(AlignType.Align4);
     BitSize = reader.ReadByte();
     reader.AlignStream(AlignType.Align4);
 }
Esempio n. 14
0
 public void Read(AssetReader reader)
 {
     NumItems = (int)reader.ReadUInt32();
     Range    = reader.ReadSingle();
     Start    = reader.ReadSingle();
     Data     = reader.ReadByteArray();
     reader.AlignStream(AlignType.Align4);
     BitSize = reader.ReadByte();
     reader.AlignStream(AlignType.Align4);
 }
Esempio n. 15
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Enabled = reader.ReadByte();
            if (IsAlign(reader.Version))
            {
                reader.AlignStream();
            }
        }
Esempio n. 16
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            BehaviourLayout layout = reader.Layout.Behaviour;

            Enabled = reader.ReadByte();
            if (layout.IsAlignEnabled)
            {
                reader.AlignStream();
            }
        }
Esempio n. 17
0
        public void Read(AssetReader reader)
        {
            NameIndex    = reader.ReadInt32();
            Index        = reader.ReadInt32();
            SamplerIndex = reader.ReadInt32();

            if (IsReadMultiSampled(reader.Version))
            {
                MultiSampled = reader.ReadBoolean();
            }
            Dim = reader.ReadByte();
            reader.AlignStream(AlignType.Align4);
        }
Esempio n. 18
0
        public void Read(AssetReader reader)
        {
            Path      = reader.ReadUInt32();
            Attribute = reader.ReadUInt32();
            Script.Read(reader);

            if (IsInt32ID(reader.Version))
            {
                ClassID = (ClassIDType)reader.ReadInt32();
            }
            else
            {
                ClassID = (ClassIDType)reader.ReadUInt16();
            }

            CustomType  = (BindingCustomType)reader.ReadByte();
            IsPPtrCurve = reader.ReadByte() == 0 ? false : true;
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
        }
Esempio n. 19
0
        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();
            }
        }
Esempio n. 20
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadAlpha(reader.Version))
            {
                Alpha = reader.ReadSingle();
            }
            RenderMode = (RenderMode)reader.ReadInt32();
            Camera.Read(reader);
            if (IsReadNormals(reader.Version))
            {
                Normals     = reader.ReadBoolean();
                PositionUVs = reader.ReadBoolean();
            }

            if (IsReadPlaneDistance(reader.Version))
            {
                PlaneDistance = reader.ReadSingle();
            }
            PixelPerfect = reader.ReadBoolean();

            if (IsReadRecievesEvents(reader.Version))
            {
                RecievesEvents       = reader.ReadBoolean();
                OverrideSorting      = reader.ReadBoolean();
                OverridePixelPerfect = reader.ReadBoolean();
                if (IsReadSortingBucketNormalizedSize(reader.Version))
                {
                    SortingBucketNormalizedSize = reader.ReadSingle();
                }
                if (IsReadAdditionalShaderChannelsFlag(reader.Version))
                {
                    AdditionalShaderChannelsFlag = reader.ReadInt32();
                }
                reader.AlignStream(AlignType.Align4);

                SortingLayerID = reader.ReadInt32();
                SortingOrder   = reader.ReadInt16();
            }
            if (IsReadTargetDisplay(reader.Version))
            {
                TargetDisplay = reader.ReadByte();
            }
        }
Esempio n. 21
0
        public void Read(AssetReader reader)
        {
            switch (Type.Type)
            {
            case PrimitiveType.Bool:
                if (IsArray)
                {
                    Value = reader.ReadBooleanArray();
                }
                else
                {
                    Value = reader.ReadBoolean();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Char:
                if (IsArray)
                {
                    Value = reader.ReadCharArray();
                }
                else
                {
                    Value = reader.ReadChar();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.SByte:
                if (IsArray)
                {
                    Value = reader.ReadByteArray();
                }
                else
                {
                    Value = reader.ReadSByte();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Byte:
                if (IsArray)
                {
                    Value = reader.ReadByteArray();
                }
                else
                {
                    Value = reader.ReadByte();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Short:
                if (IsArray)
                {
                    Value = reader.ReadInt16Array();
                }
                else
                {
                    Value = reader.ReadInt16();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.UShort:
                if (IsArray)
                {
                    Value = reader.ReadUInt16Array();
                }
                else
                {
                    Value = reader.ReadUInt16();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Int:
                if (IsArray)
                {
                    Value = reader.ReadInt32Array();
                }
                else
                {
                    Value = reader.ReadInt32();
                }
                break;

            case PrimitiveType.UInt:
                if (IsArray)
                {
                    Value = reader.ReadUInt32Array();
                }
                else
                {
                    Value = reader.ReadUInt32();
                }
                break;

            case PrimitiveType.Long:
                if (IsArray)
                {
                    Value = reader.ReadInt64Array();
                }
                else
                {
                    Value = reader.ReadInt64();
                }
                break;

            case PrimitiveType.ULong:
                if (IsArray)
                {
                    Value = reader.ReadUInt64Array();
                }
                else
                {
                    Value = reader.ReadUInt64();
                }
                break;

            case PrimitiveType.Single:
                if (IsArray)
                {
                    Value = reader.ReadSingleArray();
                }
                else
                {
                    Value = reader.ReadSingle();
                }
                break;

            case PrimitiveType.Double:
                if (IsArray)
                {
                    Value = reader.ReadDoubleArray();
                }
                else
                {
                    Value = reader.ReadDouble();
                }
                break;

            case PrimitiveType.String:
                if (IsArray)
                {
                    Value = reader.ReadStringArray();
                }
                else
                {
                    Value = reader.ReadString();
                }
                break;

            case PrimitiveType.Complex:
                if (IsArray)
                {
                    int count = reader.ReadInt32();
                    IScriptStructure[] structures = new IScriptStructure[count];
                    for (int i = 0; i < count; i++)
                    {
                        IScriptStructure structure = Type.ComplexType.CreateCopy();
                        structure.Read(reader);
                        structures[i] = structure;
                    }
                    Value = structures;
                }
                else
                {
                    IScriptStructure structure = Type.ComplexType.CreateCopy();
                    structure.Read(reader);
                    Value = structure;
                }
                break;

            default:
                throw new NotImplementedException($"Unknown {nameof(PrimitiveType)} '{Type.Type}'");
            }
        }
Esempio n. 22
0
 public void Read(AssetReader reader)
 {
     Flags = reader.ReadByte();
     reader.AlignStream(AlignType.Align4);
 }
Esempio n. 23
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);
            }
        }
 public void Read(AssetReader reader)
 {
     Source = reader.ReadByte();
     Target = (VertexComponent)reader.ReadByte();
 }
Esempio n. 25
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasEnabled(reader.Version))
            {
                Enabled = reader.ReadBoolean();
            }
            if (IsAlign1(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasCastShadows(reader.Version))
            {
                CastShadows    = (ShadowCastingMode)reader.ReadByte();
                ReceiveShadows = reader.ReadByte();
            }
            if (HasDynamicOccludee(reader.Version))
            {
                DynamicOccludee = reader.ReadByte();
            }
            if (HasMotionVector(reader.Version))
            {
                MotionVectors   = (MotionVectorGenerationMode)reader.ReadByte();
                LightProbeUsage = (LightProbeUsage)reader.ReadByte();
            }
            if (HasReflectUsage(reader.Version))
            {
                if (IsReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadByte();
                }
            }
            if (IsAlign2(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasRenderingLayerMask(reader.Version))
            {
                RenderingLayerMask = reader.ReadUInt32();
            }
            if (HasRendererPriority(reader.Version))
            {
                RendererPriority = reader.ReadInt32();
            }

            if (HasLightmapIndex(reader.Version, reader.Flags))
            {
                LightmapIndex = IsLightmapIndexShort(reader.Version) ? reader.ReadUInt16() : reader.ReadByte();
            }
            if (HasLightmapIndexDynamic(reader.Version, reader.Flags))
            {
                LightmapIndexDynamic = reader.ReadUInt16();
            }

            if (IsMaterialFirst(reader.Version))
            {
                Materials = reader.ReadAssetArray <PPtr <Material> >();
            }

            if (HasLightmapTilingOffset(reader.Version, reader.Flags))
            {
                LightmapTilingOffset.Read(reader);
            }
            if (HasLightmapTilingOffsetDynamic(reader.Version, reader.Flags))
            {
                LightmapTilingOffsetDynamic.Read(reader);
            }

            if (!IsMaterialFirst(reader.Version))
            {
                Materials = reader.ReadAssetArray <PPtr <Material> >();
            }

            if (HasStaticBatchInfo(reader.Version))
            {
                StaticBatchInfo.Read(reader);
            }
            else if (HasSubsetIndices(reader.Version))
            {
                SubsetIndices = reader.ReadUInt32Array();
            }
            if (HasStaticBatchRoot(reader.Version))
            {
                StaticBatchRoot.Read(reader);
            }

            if (HasUseLight(reader.Version))
            {
                bool UseLightProbes = reader.ReadBoolean();
                LightProbeUsage = UseLightProbes ? LightProbeUsage.BlendProbes : LightProbeUsage.Off;
            }
            if (HasUseReflectionProbes(reader.Version))
            {
                bool UseReflectionProbes = reader.ReadBoolean();
                ReflectionProbeUsage = UseReflectionProbes ? ReflectionProbeUsage.Simple : ReflectionProbeUsage.Off;
            }
            if (HasUseLight(reader.Version))
            {
                reader.AlignStream();
            }
            if (HasReflectUsage(reader.Version))
            {
                if (!IsReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadInt32();
                }
            }

            if (HasProbeAnchor(reader.Version))
            {
                ProbeAnchor.Read(reader);
            }
            if (HasLightOverride(reader.Version))
            {
                LightProbeVolumeOverride.Read(reader);
            }
#if UNIVERSAL
            if (HasScaleInLightmap(reader.Version, reader.Flags))
            {
                ScaleInLightmap = reader.ReadSingle();
            }
            if (HasReceiveGI(reader.Version, reader.Flags))
            {
                ReceiveGI = (ReceiveGI)reader.ReadInt32();
            }
            if (HasPreserveUVs(reader.Version, reader.Flags))
            {
                PreserveUVs = reader.ReadBoolean();
            }
            if (HasIgnoreNormalsForChartDetection(reader.Version, reader.Flags))
            {
                IgnoreNormalsForChartDetection = reader.ReadBoolean();
            }
            if (HasImportantGI(reader.Version, reader.Flags))
            {
                ImportantGI = reader.ReadBoolean();
            }
            if (HasSelectedWireframeHidden(reader.Version, reader.Flags))
            {
                SelectedWireframeHidden = reader.ReadBoolean();
            }
            if (HasStitchLightmapSeams(reader.Version, reader.Flags))
            {
                StitchLightmapSeams = reader.ReadBoolean();
                reader.AlignStream();
            }
            if (HasSelectedEditorRenderState(reader.Version, reader.Flags))
            {
                SelectedEditorRenderState = (EditorSelectedRenderState)reader.ReadInt32();
            }
            if (HasMinimumChartSize(reader.Version, reader.Flags))
            {
                MinimumChartSize = reader.ReadInt32();
            }
            if (HasAutoUVMaxDistance(reader.Version, reader.Flags))
            {
                AutoUVMaxDistance = reader.ReadSingle();
                AutoUVMaxAngle    = reader.ReadSingle();
                LightmapParameters.Read(reader);
            }
            if (HasGIBackfaceCull(reader.Version, reader.Flags))
            {
                GIBackfaceCull = reader.ReadBoolean();
                reader.AlignStream();
            }
#endif
            if (IsAlign3(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasSortingLayerID(reader.Version))
            {
                SortingLayerID = reader.ReadInt32();
            }
            if (HasSortingLayer(reader.Version))
            {
                SortingLayer = reader.ReadInt16();
            }
            if (HasSortingOrder(reader.Version))
            {
                SortingOrder = reader.ReadInt16();
            }
            if (IsAlign4(reader.Version))
            {
                reader.AlignStream();
            }
        }
Esempio n. 26
0
        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(AlignType.Align4);
                }
                SubMeshes = reader.ReadAssetArray <SubMesh>();
            }

            if (HasBlendShapes(reader.Version))
            {
                if (HasBlendChannels(reader.Version))
                {
                    Shapes.Read(reader);
                }
                else
                {
                    BlendShapes = reader.ReadAssetArray <BlendShape>();
                    reader.AlignStream(AlignType.Align4);
                    ShapeVertices = reader.ReadAssetArray <BlendShapeVertex>();
                }
            }
            if (HasBindPose(reader.Version))
            {
                if (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(AlignType.Align4);
            }

            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))
            {
                if (!IsIndexBufferFirst(reader.Version))
                {
                    IndexBuffer = reader.ReadByteArray();
                    reader.AlignStream(AlignType.Align4);
                }
            }

            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))
            {
                if (!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(AlignType.Align4);
            }

            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(AlignType.Align4);
                StreamData.Read(reader);
            }
        }
Esempio n. 27
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

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

            if (IsReadBlendShapes(reader.Version))
            {
                Shapes.Read(reader);
            }
            if (IsReadBindPosesFirst(reader.Version))
            {
                m_bindPoses = reader.ReadArray <Matrix4x4f>();
            }
            if (IsReadBoneNameHashes(reader.Version))
            {
                m_boneNameHashes = reader.ReadUInt32Array();
                RootBoneNameHash = reader.ReadUInt32();
            }

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

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

            if (IsReadVertexData(reader.Version))
            {
                if (IsReadOnlyVertexData(reader.Version))
                {
                    VertexData.Read(reader);
                }
                else
                {
                    if (MeshCompression == 0)
                    {
                        VertexData.Read(reader);
                    }
                    else
                    {
                        m_UV       = reader.ReadArray <Vector2f>();
                        m_UV1      = reader.ReadArray <Vector2f>();
                        m_tangents = reader.ReadArray <Vector4f>();
                        m_normals  = reader.ReadArray <Vector3f>();
                        m_colors   = reader.ReadArray <ColorRGBA32>();
                    }
                }
            }
            else
            {
                m_UV = reader.ReadArray <Vector2f>();
                if (IsReadUV1(reader.Version))
                {
                    m_UV1 = reader.ReadArray <Vector2f>();
                }
                if (IsReadTangentSpace(reader.Version))
                {
                    m_tangentSpace = reader.ReadArray <Tangent>();
                }
                else
                {
                    m_tangents = reader.ReadArray <Vector4f>();
                    m_normals  = reader.ReadArray <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.ReadArray <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 (IsReadStreamData(reader.Version))
            {
                StreamData.Read(reader);
            }
        }
Esempio n. 28
0
        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>();
            }
        }