Beispiel #1
0
        public void Read(AssetReader reader)
        {
            Heights = reader.ReadInt16Array();
            if (HasAlign(reader.Version))
            {
                reader.AlignStream();
            }
            if (HasShifts(reader.Version))
            {
                Shifts = reader.ReadAssetArray <Shift>();
                reader.AlignStream();
            }

            PrecomputedError   = reader.ReadSingleArray();
            MinMaxPatchHeights = reader.ReadSingleArray();
            if (HasDefaultPhysicMaterial(reader.Version))
            {
                DefaultPhysicMaterial.Read(reader);
            }

            Width  = reader.ReadInt32();
            Height = reader.ReadInt32();
            if (HasThickness(reader.Version))
            {
                Thickness = reader.ReadSingle();
            }

            Levels = reader.ReadInt32();
            Scale.Read(reader);
        }
Beispiel #2
0
        public void Read(AssetReader reader)
        {
            m_heights = reader.ReadInt16Array();
            if (IsReadAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadShifts(reader.Version))
            {
                m_shifts = reader.ReadArray <Shift>();
                reader.AlignStream(AlignType.Align4);
            }

            m_precomputedError   = reader.ReadSingleArray();
            m_minMaxPatchHeights = reader.ReadSingleArray();

            if (IsReadDefaultPhysicMaterial(reader.Version))
            {
                DefaultPhysicMaterial.Read(reader);
            }
            Width  = reader.ReadInt32();
            Height = reader.ReadInt32();
            if (IsReadThickness(reader.Version))
            {
                Thickness = reader.ReadSingle();
            }
            Levels = reader.ReadInt32();
            Scale.Read(reader);
        }
        public void Read(AssetReader reader)
        {
            Heights = reader.ReadInt16Array();
            if (HasHoles(reader.Version))
            {
                Holes    = reader.ReadByteArray();
                HolesLOD = reader.ReadByteArray();
                EnableHolesTextureCompression = reader.ReadBoolean();
            }
            if (HasAlign(reader.Version))
            {
                reader.AlignStream();
            }
            if (HasShifts(reader.Version))
            {
                Shifts = reader.ReadAssetArray <Shift>();
                reader.AlignStream();
            }

            PrecomputedError   = reader.ReadSingleArray();
            MinMaxPatchHeights = reader.ReadSingleArray();
            if (HasDefaultPhysicMaterial(reader.Version))
            {
                DefaultPhysicMaterial.Read(reader);
            }

            if (HasWidth(reader.Version))
            {
                Width  = reader.ReadInt32();
                Height = reader.ReadInt32();
            }
            if (HasThickness(reader.Version))
            {
                Thickness = reader.ReadSingle();
            }
            if (HasResolution(reader.Version))
            {
                Resolution = reader.ReadInt32();
            }

            Levels = reader.ReadInt32();
            Scale.Read(reader);
        }
Beispiel #4
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}'");
            }
        }