Пример #1
0
        public void TestInstantation()
        {
            var testInstance = new SimpleArray();

            Assert.AreEqual(testInstance.GroceryList.Length, 4);
            Assert.AreEqual(testInstance.GroceryList[1], "Milk");
        }
        public static ChunkedMessage Decode(Stream inputStream)
        {
            if (inputStream == null || !inputStream.CanRead)
            {
                return(null);
            }
            ChunkedMessage instance = new ChunkedMessage();

            instance.PayloadHeader = ChunkedPayloadHeader.Decode(inputStream);
            ushort?seqValue = BaseType.ReadUInt16(inputStream);

            if (seqValue == null)
            {
                return(null);
            }
            instance.MessageSequenceNumber = seqValue.Value;
            uint?offSetValue = BaseType.ReadUInt32(inputStream);

            if (offSetValue == null)
            {
                return(null);
            }
            instance.ChunkOffset = offSetValue.Value;
            uint?sizeValue = BaseType.ReadUInt32(inputStream);

            if (sizeValue == null)
            {
                return(null);
            }
            instance.TotalSize = sizeValue.Value;
            instance.ChunkData = SimpleArray <byte> .Decode(inputStream, BaseType.ReadByte);

            return(instance);
        }
Пример #3
0
        public override void Rebuild()
        {
            base.Rebuild();

            if (Bounds is null || Bounds.data_items is null)
            {
                MaxNumBounds             = 0;
                NumBounds                = 0;
                CurrentMatrices          = null;
                LastMatrices             = null;
                ChildBoundingBoxes       = null;
                TypeAndIncludeFlags      = null;
                OwnedTypeAndIncludeFlags = null;
                return;
            }

            MaxNumBounds = (ushort)Bounds.Count;
            NumBounds    = MaxNumBounds;

            // TODO:    Try to reuse existing arrays if already of the required size
            UpdateChildrenAabb();

            // This should be invoked only if we aren't editing an existing asset, which might contain actual transform data!
            // TODO:    Once we have bounds wrappers, we should cache transform on loading so we can retrieve it on saving!
            //UpdateChildrenMatrices();
        }
Пример #4
0
        public void TestInstantiation()
        {
            var testInstance = new SimpleArray();

            Assert.AreEqual(testInstance.AdventurerList.Length, 4);
            Assert.AreEqual(testInstance.AdventurerList[1], "Conan");
        }
Пример #5
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.Geometries = reader.ReadBlock <ResourcePointerList64 <DrawableGeometry> >();
            this.GeometriesBoundsPointer = reader.ReadUInt64();
            this.ShaderMappingPointer    = reader.ReadUInt64();
            this.Unknown_28h             = reader.ReadByte();
            this.IsSkinned       = reader.ReadByte();
            this.Unknown_2Ah     = reader.ReadByte();
            this.RootBoneIndex   = reader.ReadByte();
            this.Mask            = reader.ReadByte();
            this.Unknown_2Dh     = reader.ReadByte();
            this.GeometriesCount = reader.ReadUInt16();

            // read reference data
            this.GeometriesBounds = reader.ReadBlockAt <SimpleArray <Aabb> >(
                this.GeometriesBoundsPointer, // offset
                this.GeometriesCount > 1 ? this.GeometriesCount + 1 : this.GeometriesCount
                );
            this.ShaderMapping = reader.ReadBlockAt <SimpleArray <ushort> >(
                this.ShaderMappingPointer, // offset
                this.GeometriesCount
                );
        }
Пример #6
0
        public static StructureField Decode(Stream inputStream)
        {
            if (inputStream == null || !inputStream.CanRead)
            {
                return(null);
            }
            StructureField instance = new StructureField();

            instance.Name        = String.Decode(inputStream);
            instance.Description = LocalizedText.Decode(inputStream);
            instance.DataType    = NodeID.Decode(inputStream);
            int?readInt32 = BaseType.ReadInt32(inputStream);

            if (readInt32 != null)
            {
                instance.ValueRank = readInt32.Value;
            }
            instance.ArrayDimension = SimpleArray <uint> .Decode(inputStream, BaseType.ReadUInt32);

            uint?readUInt32 = BaseType.ReadUInt32(inputStream);

            if (readUInt32 != null)
            {
                instance.MaxStringLength = readUInt32.Value;
            }
            instance.IsOptional = inputStream.ReadByte() != 0;
            return(instance);
        }
Пример #7
0
        public void ComputeIndices()
        {
            if (BoneData is null || BoneData.Bones is null)
            {
                return;
            }

            // Build ParentIndices array
            var parentIndices = new short[BonesCount];

            for (int i = 0; i < BonesCount; i++)
            {
                var bone = BoneData.Bones[i];
                parentIndices[i] = bone.ParentIndex;
                Debug.Assert(parentIndices[i] == ParentIndices[i]);
            }

            ParentIndices = new SimpleArray <short>(parentIndices);

            // Build ChildrenIndices array
            // TODO: try to replicate original order
            //       does order matter or they are just (short, short) tuples?
            List <short> childrenIndices = new List <short>();

            for (int i = 0; i < BonesCount; i++)
            {
                if (ParentIndices[i] != -1)
                {
                    childrenIndices.Add((short)i);
                    childrenIndices.Add(ParentIndices[i]);
                }
            }

            ChildrenIndices = new SimpleArray <short>(childrenIndices.ToArray());
        }
Пример #8
0
        public void SimpleArrayTest()
        {
            var testSimpleArrayInstance = new SimpleArray();

            Assert.AreEqual(4, testSimpleArrayInstance.GroceryList.Length);
            Assert.AreEqual("Milk", testSimpleArrayInstance.GroceryList[1]);
        }
Пример #9
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.MaterialsPointer              = reader.ReadUInt64();
            this.MaterialColoursPointer        = reader.ReadUInt64();
            this.Unknown_100h                  = reader.ReadUInt32();
            this.Unknown_104h                  = reader.ReadUInt32();
            this.Unknown_108h                  = reader.ReadUInt32();
            this.Unknown_10Ch                  = reader.ReadUInt32();
            this.Unknown_110h                  = reader.ReadUInt32();
            this.Unknown_114h                  = reader.ReadUInt32();
            this.PolygonMaterialIndicesPointer = reader.ReadUInt64();
            this.MaterialsCount                = reader.ReadByte();
            this.MaterialColoursCount          = reader.ReadByte();
            this.Unknown_122h                  = reader.ReadUInt16();
            this.Unknown_124h                  = reader.ReadUInt32();
            this.Unknown_128h                  = reader.ReadUInt32();
            this.Unknown_12Ch                  = reader.ReadUInt32();

            // read reference data
            this.Materials = reader.ReadBlockAt <SimpleArray <BoundMaterial> >(
                this.MaterialsPointer, // offset
                this.MaterialsCount
                );
            this.MaterialColours = reader.ReadBlockAt <SimpleArray <uint> >(
                this.MaterialColoursPointer, // offset
                this.MaterialColoursCount
                );
            this.PolygonMaterialIndices = reader.ReadBlockAt <SimpleArray <byte> >(
                this.PolygonMaterialIndicesPointer, // offset
                this.PrimitivesCount
                );
        }
Пример #10
0
        public override void Decode(Stream inputStream)
        {
            if (inputStream == null || !inputStream.CanRead)
            {
                return;
            }

            // 1. Content
            Content = SimpleArray <byte> .Decode(inputStream, BaseType.ReadByte);

            // 2. Path
            Path = String.Decode(inputStream);

            // 3. Timestamp
            long?readTime = BaseType.ReadInt64(inputStream);

            if (readTime != null)
            {
                Time = readTime.Value;
            }

            // 4. File type
            FileType = String.Decode(inputStream);

            // 5. Name (is not used via OPC UA but can be used for logging etc.)
            Name = System.IO.Path.GetFileName(Path.Value);
        }
    // Use this for initialization
    void Start()
    {
        //ScriptableObjectだけ
        var start = Environment.TickCount;
        var simples = new SimpleArray() {SimpleParams = Resources.Load<SimpleObject>("simples").SimpleParamses};
        var sl = Environment.TickCount - start;

        start = Environment.TickCount;
        var nest = new NestArray() {NestParams = Resources.Load<NestObject>("nests").NestParams};
        var nl = Environment.TickCount - start;
        OutputData(typeof (ScriptableObject), sl, nl, 0, 0);

        var parsers = GetComponents<IParser>();
        foreach (var parser in parsers)
        {
            var sText = parser.Serialize(simples);

            var nText = parser.Serialize(nest);

            var sObj = parser.Deserialize<SimpleArray>(sText);

            var nObj = parser.Deserialize<NestArray>(nText);

            OutputData(parser.GetType(), parser.DeserializeTimeList[0], parser.DeserializeTimeList[1], parser.SerializeTimeList[0], parser.SerializeTimeList[1]);
            ValidSimpleParams(simples,sObj);
            ValidNestParams(nest,nObj);
        }
    }
Пример #12
0
        public void TestIntantiation()
        {
            var testInstance = new SimpleArray();

            Assert.AreEqual(4, testInstance.GroceryList.Length, "it should have a length of 4");
            Assert.AreEqual("Cheese", testInstance.GroceryList[1], "it should return the string \"Cheese\"");
            Assert.AreEqual(5, testInstance.MultiDimensionArray[1, 1], "it should return 5");
        }
 public override void Encode(Stream outputStream)
 {
     if (outputStream == null || !outputStream.CanWrite)
     {
         return;
     }
     outputStream.WriteByte(Count);
     SimpleArray <ushort> .Encode(outputStream, DataSetWriterID, true);
 }
Пример #14
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.Unknown_10h       = reader.ReadUInt32();
            this.Unknown_14h       = reader.ReadUInt32();
            this.Unknown_18h       = reader.ReadUInt32();
            this.Unknown_1Ch       = reader.ReadUInt32();
            this.Unknown_20h       = reader.ReadUInt32();
            this.Unknown_24h       = reader.ReadUInt32();
            this.Unknown_28h       = reader.ReadUInt32();
            this.Unknown_2Ch       = reader.ReadUInt32();
            this.Unknown_30h       = reader.ReadUInt32();
            this.Unknown_34h       = reader.ReadUInt32();
            this.Unknown_38h       = reader.ReadUInt32();
            this.Unknown_3Ch       = reader.ReadUInt32();
            this.Unknown_40h       = reader.ReadUInt32();
            this.Unknown_44h       = reader.ReadUInt32();
            this.Unknown_48h       = reader.ReadUInt32();
            this.Unknown_4Ch       = reader.ReadUInt32();
            this.Unknown_50h       = reader.ReadUInt32();
            this.Unknown_54h       = reader.ReadUInt32();
            this.Unknown_58h       = reader.ReadUInt32();
            this.Unknown_5Ch       = reader.ReadUInt32();
            this.Unknown_60h       = reader.ReadUInt32();
            this.Unknown_64h       = reader.ReadUInt32();
            this.Unknown_68h       = reader.ReadUInt32();
            this.Unknown_6Ch       = reader.ReadUInt32();
            this.Unknown_70h       = reader.ReadUInt32();
            this.Unknown_74h       = reader.ReadUInt32();
            this.JointTypesPointer = reader.ReadUInt64();
            this.p2 = reader.ReadUInt64();
            this.c1 = reader.ReadByte();
            this.JointTypesCount = reader.ReadByte();
            this.Unknown_8Ah     = reader.ReadUInt16();
            this.Unknown_8Ch     = reader.ReadUInt32();
            this.Unknown_90h     = reader.ReadUInt32();
            this.Unknown_94h     = reader.ReadUInt32();
            this.Unknown_98h     = reader.ReadUInt32();
            this.Unknown_9Ch     = reader.ReadUInt32();
            this.Unknown_A0h     = reader.ReadUInt32();
            this.Unknown_A4h     = reader.ReadUInt32();
            this.Unknown_A8h     = reader.ReadUInt32();
            this.Unknown_ACh     = reader.ReadUInt32();

            // read reference data
            this.JointTypes = reader.ReadBlockAt <ResourcePointerArray64 <JointType> >(
                this.JointTypesPointer, // offset
                this.JointTypesCount
                );
            this.p2data = reader.ReadBlockAt <SimpleArray <Vector4> >(
                this.p2, // offset
                this.c1
                );
        }
Пример #15
0
        public void Read(BinaryReader br)
        {
            uint bonesOffset       = ResourceUtil.ReadOffset(br);
            uint unknownIntsOffset = ResourceUtil.ReadOffset(br);
            uint transforms1Offset = ResourceUtil.ReadOffset(br);
            uint transforms2Offset = ResourceUtil.ReadOffset(br);
            uint transforms3Offset = ResourceUtil.ReadOffset(br);

            BoneCount = br.ReadUInt16();
            Unknown0  = br.ReadInt16();
            Unknown1  = br.ReadInt32();
            Unknown2  = br.ReadInt32();

            BoneIDMappings = new SimpleCollection <BoneIDMapping>(br, r => new BoneIDMapping(r));

            Unknown3    = br.ReadInt32();
            UnknownHash = br.ReadUInt32();
            Unknown4    = br.ReadInt32();

            UnknownSubStruct = new SubStruct(br);

            // Data:

            br.BaseStream.Seek(bonesOffset, SeekOrigin.Begin);
            Bones = new SimpleArray <Bone>(br, BoneCount, r => new Bone(r));

            br.BaseStream.Seek(unknownIntsOffset, SeekOrigin.Begin);
            UnknownInts = new SimpleArray <int>(br, BoneCount, r => r.ReadInt32());

            br.BaseStream.Seek(transforms1Offset, SeekOrigin.Begin);
            Transforms1 = new SimpleArray <Matrix44>(br, BoneCount, r => new Matrix44(r));

            br.BaseStream.Seek(transforms2Offset, SeekOrigin.Begin);
            Transforms2 = new SimpleArray <Matrix44>(br, BoneCount, r => new Matrix44(r));

            br.BaseStream.Seek(transforms3Offset, SeekOrigin.Begin);
            Transforms3 = new SimpleArray <Matrix44>(br, BoneCount, r => new Matrix44(r));

            // Fun stuff...
            // Build a mapping of Offset -> Bone
            var boneOffsetMapping = new Dictionary <uint, Bone>();

            boneOffsetMapping.Add(0, null);
            foreach (var bone in Bones)
            {
                boneOffsetMapping.Add((uint)bone.Offset, bone);
            }

            // Now resolve all the bone offsets to the real bones
            foreach (var bone in Bones)
            {
                bone.Parent      = boneOffsetMapping[bone.ParentOffset];
                bone.FirstChild  = boneOffsetMapping[bone.FirstChildOffset];
                bone.NextSibling = boneOffsetMapping[bone.NextSiblingOffset];
            }
        }
Пример #16
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.Count       = reader.ReadUInt32();
            this.Unknown_14h = reader.ReadUInt32();
            this.Unknown_18h = reader.ReadUInt64();
            this.Data        = reader.ReadBlock <SimpleArray <Matrix4x4> >(
                Count
                );
        }
 void ValidSimpleParams(SimpleArray expect,SimpleArray actual)
 {
     var err = expect.SimpleParams.Select((e, n) => new {E = e, A = actual.SimpleParams[n],N = n}).FirstOrDefault(p => !p.E.Equals(p.A));
     if (err == null)
     {
         Debug.Log("Valid OK[Simple]");
     }
     else
     {
         Debug.Log("Error");
     }
 }
Пример #18
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.Unknown_70h           = reader.ReadUInt32();
            this.Unknown_74h           = reader.ReadUInt32();
            this.ShrunkVerticesPointer = reader.ReadUInt64();
            this.Unknown_80h           = reader.ReadUInt32();
            this.VerticesCount1        = reader.ReadUInt32();
            this.PrimitivesPointer     = reader.ReadUInt64();
            this.Quantum               = reader.ReadVector3();
            this.Unknown_9Ch           = reader.ReadSingle();
            this.Offset                = reader.ReadVector3();
            this.Unknown_ACh           = reader.ReadSingle();
            this.VerticesPointer       = reader.ReadUInt64();
            this.VerticesColorsPointer = reader.ReadUInt64();
            this.Unknown_C0h_Pointer   = reader.ReadUInt64();
            this.Unknown_C8h_Pointer   = reader.ReadUInt64();
            this.VerticesCount2        = reader.ReadUInt32();
            this.PrimitivesCount       = reader.ReadUInt32();
            this.Unknown_D8h           = reader.ReadUInt64();
            this.Unknown_E0h           = reader.ReadUInt64();
            this.Unknown_E8h           = reader.ReadUInt64();

            // read reference data
            this.ShrunkVertices = reader.ReadBlockAt <SimpleArray <BoundVertex> >(
                this.ShrunkVerticesPointer, // offset
                this.VerticesCount2
                );
            this.Primitives = reader.ReadBlockAt <SimpleArray <BoundPrimitive> >(
                this.PrimitivesPointer, // offset
                this.PrimitivesCount
                );
            this.Vertices = reader.ReadBlockAt <SimpleArray <BoundVertex> >(
                this.VerticesPointer, // offset
                this.VerticesCount2
                );
            this.VerticesColors = reader.ReadBlockAt <SimpleArray <uint> >(
                this.VerticesColorsPointer, // offset
                this.VerticesCount2
                );
            this.Unknown_C0h_Data = reader.ReadBlockAt <SimpleArray <uint> >(
                this.Unknown_C0h_Pointer, // offset
                8
                );
            this.Unknown_C8h_Data = reader.ReadBlockAt <SimpleArrayArray64 <uint> >(
                this.Unknown_C8h_Pointer, // offset
                8,
                this.Unknown_C0h_Data
                );
        }
Пример #19
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            // read structure data
            this.StructureNameHash = reader.ReadInt32();
            this.DataLength        = reader.ReadInt32();
            this.DataPointer       = reader.ReadInt64();

            // read reference data
            this.Data = reader.ReadBlockAt <SimpleArray <byte> >(
                (ulong)this.DataPointer, // offset
                this.DataLength
                );
        }
        public static DataSetPayloadHeader Decode(Stream inputStream)
        {
            if (inputStream == null || !inputStream.CanRead)
            {
                return(null);
            }
            DataSetPayloadHeader instance = new DataSetPayloadHeader();

            instance.Count           = (byte)inputStream.ReadByte();
            instance.DataSetWriterID = SimpleArray <ushort> .Decode(inputStream, BaseType.ReadUInt16, instance.Count);

            return(instance);
        }
Пример #21
0
    void ValidSimpleParams(SimpleArray expect, SimpleArray actual)
    {
        var err = expect.SimpleParams.Select((e, n) => new { E = e, A = actual.SimpleParams[n], N = n }).FirstOrDefault(p => !p.E.Equals(p.A));

        if (err == null)
        {
            Debug.Log("Valid OK[Simple]");
        }
        else
        {
            Debug.Log("Error");
        }
    }
Пример #22
0
        private void UpdateChildrenAabb()
        {
            Aabb[] boundingBoxes = new Aabb[NumBounds];

            for (int i = 0; i < NumBounds; i++)
            {
                var bound = Bounds[i];
                var min   = new Vector4(bound.BoundingBoxMin, BitConverter.Int32BitsToSingle((int)bound.RefCount));
                var max   = new Vector4(bound.BoundingBoxMax, bound.Margin);
                boundingBoxes[i] = new Aabb(min, max);
            }

            ChildBoundingBoxes = new SimpleArray <Aabb>(boundingBoxes);
        }
Пример #23
0
        public static FieldMetaData Decode(Stream inputStream, EncodingOptions options)
        {
            FieldMetaData instance = new FieldMetaData(options);

            // 1. Name
            instance.Name = String.Decode(inputStream);

            // 2. Description
            instance.Description = LocalizedText.Decode(inputStream);

            // 3. Field Flags
            instance.Flags = DataSetFieldFlags.Decode(inputStream, options);

            // 4. Built-in Type
            instance.Type = (BuiltinType)inputStream.ReadByte();

            // 5. DataType
            instance.DataType = NodeID.Decode(inputStream);

            // 6. Value Rank
            int?valueRank = BaseType.ReadInt32(inputStream);

            if (valueRank.HasValue)
            {
                instance.ValueRank = valueRank.Value;
            }

            // 7. Array Dimension
            instance.ArrayDimension = SimpleArray <uint> .Decode(inputStream, BaseType.ReadUInt32);

            // 8. Size
            uint?readUInt32 = BaseType.ReadUInt32(inputStream);

            if (readUInt32 != null)
            {
                instance.MaxStringLength = readUInt32.Value;
            }

            // 9. Field ID
            byte[] guidAsByte = Common.ReadBytes(inputStream, 16);
            if (guidAsByte != null && guidAsByte.Length == 16)
            {
                instance.FieldID = new Guid(guidAsByte);
            }

            // 10. Properties
            instance.Properties = ParseProperties(inputStream);
            return(instance);
        }
Пример #24
0
        public void Encode(Stream outputStream)
        {
            if (outputStream == null || !outputStream.CanWrite)
            {
                return;
            }
            Name.Encode(outputStream);
            Description.Encode(outputStream);
            DataType.Encode(outputStream);
            BaseType.WriteToStream(outputStream, BitConverter.GetBytes(ValueRank));
            SimpleArray <uint> .Encode(outputStream, ArrayDimension);

            BaseType.WriteToStream(outputStream, BitConverter.GetBytes(MaxStringLength));
            BaseType.WriteToStream(outputStream, BitConverter.GetBytes(IsOptional));
        }
Пример #25
0
        private void UpdateChildrenMatrices()
        {
            var mat = Matrix4x4.Identity;

            mat.M14 = FloatHelpers.SignalingNaN;
            mat.M24 = FloatHelpers.SignalingNaN;
            mat.M34 = FloatHelpers.SignalingNaN;
            mat.M44 = FloatHelpers.SignalingNaN;

            Matrix4x4[] matrices = new Matrix4x4[NumBounds];
            matrices.AsSpan().Fill(mat);

            CurrentMatrices = new SimpleArray <Matrix4x4>(matrices);
            LastMatrices    = new SimpleArray <Matrix4x4>((Matrix4x4[])matrices.Clone());
        }
Пример #26
0
        public new void Read(BinaryReader br)
        {
            base.Read(br);

            TextureDictionaryOffset = ResourceUtil.ReadOffset(br);

            // CPtrCollection<T>
            Shaders = new PtrCollection<ShaderFx>(br);

            Zeros = new SimpleArray<uint>(br, 12, r => r.ReadUInt32());

            VertexDeclarationUsageFlags = new SimpleCollection<uint>(br, reader => reader.ReadUInt32());

            Data3 = new SimpleCollection<uint>(br, reader => reader.ReadUInt32());
        }
Пример #27
0
        public new void Read(BinaryReader br)
        {
            base.Read(br);

            TextureDictionaryOffset = ResourceUtil.ReadOffset(br);

            // CPtrCollection<T>
            Shaders = new PtrCollection <ShaderFx>(br);

            Zeros = new SimpleArray <uint>(br, 12, r => r.ReadUInt32());

            VertexDeclarationUsageFlags = new SimpleCollection <uint>(br, reader => reader.ReadUInt32());

            Data3 = new SimpleCollection <uint>(br, reader => reader.ReadUInt32());
        }
Пример #28
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.Unknown_8h          = reader.ReadUInt64();
            this.Unknown_10h         = reader.ReadUInt64();
            this.VertexBufferPointer = reader.ReadUInt64();
            this.Unknown_20h         = reader.ReadUInt64();
            this.Unknown_28h         = reader.ReadUInt64();
            this.Unknown_30h         = reader.ReadUInt64();
            this.IndexBufferPointer  = reader.ReadUInt64();
            this.Unknown_40h         = reader.ReadUInt64();
            this.Unknown_48h         = reader.ReadUInt64();
            this.Unknown_50h         = reader.ReadUInt64();
            this.IndicesCount        = reader.ReadUInt32();
            this.FacesCount          = reader.ReadUInt32();
            this.VerticesCount       = reader.ReadUInt16();
            this.IndicesPerFace      = reader.ReadUInt16();
            this.Unknown_64h         = reader.ReadUInt32();
            this.BonesIdPointer      = reader.ReadUInt64();
            this.VertexStride        = reader.ReadUInt16();
            this.BonesCount          = reader.ReadUInt16();
            this.Unknown_74h         = reader.ReadUInt32();
            this.VertexDataPointer   = reader.ReadUInt64();
            this.Unknown_80h         = reader.ReadUInt64();
            this.Unknown_88h         = reader.ReadUInt64();
            this.Unknown_90h         = reader.ReadUInt64();
            this.Unknown_98h         = reader.ReadUInt64();

            // read reference data
            this.VertexBuffer = reader.ReadBlockAt <VertexBuffer>(
                this.VertexBufferPointer // offset
                );
            this.IndexBuffer = reader.ReadBlockAt <IndexBuffer>(
                this.IndexBufferPointer // offset
                );
            this.BonesId = reader.ReadBlockAt <SimpleArray <ushort> >(
                this.BonesIdPointer, // offset
                this.BonesCount
                );
            this.VertexData = reader.ReadBlockAt <VertexData_GTA5_pc>(
                this.VertexDataPointer, // offset
                this.VertexStride,
                this.VerticesCount,
                this.VertexBuffer.Info
                );
        }
Пример #29
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.NodesPointer        = reader.ReadUInt64();
            this.NodesCount          = reader.ReadUInt32();
            this.Unknown_1Ch         = reader.ReadUInt32();
            this.Unknown_20h         = reader.ReadUInt32();
            this.Unknown_24h         = reader.ReadUInt32();
            this.Unknown_28h_Pointer = reader.ReadUInt64();
            this.DataPointer1Length  = reader.ReadUInt32();
            this.Unknown_34h         = reader.ReadUInt32();
            this.Unknown_38h_Pointer = reader.ReadUInt64();
            this.Unknown_40h_Pointer = reader.ReadUInt64();
            this.Unknown_48h         = reader.ReadUInt32();
            this.Unknown_4Ch         = reader.ReadUInt32();
            this.Unknown_50h_Pointer = reader.ReadUInt64();
            this.cnt5a       = reader.ReadUInt16();
            this.cnt5b       = reader.ReadUInt16();
            this.Unknown_5Ch = reader.ReadUInt32();
            this.len4        = reader.ReadUInt32();
            this.len5        = reader.ReadUInt32();
            this.Unknown_68h = reader.ReadUInt32();
            this.Unknown_6Ch = reader.ReadUInt32();

            // read reference data
            this.Nodes = reader.ReadBlockAt <SimpleArray <Node> >(
                this.NodesPointer, // offset
                this.NodesCount
                );
            this.Unknown_28h_Data = reader.ReadBlockAt <SimpleArray <Unknown_ND_002> >(
                this.Unknown_28h_Pointer, // offset
                this.DataPointer1Length
                );
            this.Unknown_38h_Data = reader.ReadBlockAt <SimpleArray <Unknown_ND_003> >(
                this.Unknown_38h_Pointer, // offset
                this.len4
                );
            this.Unknown_40h_Data = reader.ReadBlockAt <SimpleArray <byte> >(
                this.Unknown_40h_Pointer, // offset
                this.len5
                );
            this.Unknown_50h_Data = reader.ReadBlockAt <SimpleArray <Unknown_ND_004> >(
                this.Unknown_50h_Pointer, // offset
                this.cnt5b
                );
        }
Пример #30
0
 /// <summary>
 /// Reads the data-block from a stream.
 /// </summary>
 public override void Read(ResourceDataReader reader, params object[] parameters)
 {
     // read structure data
     this.Unknown_0h  = reader.ReadUInt32();
     this.Unknown_4h  = reader.ReadUInt32();
     this.Unknown_8h  = reader.ReadUInt32();
     this.Unknown_Ch  = reader.ReadUInt32();
     this.cnt1        = reader.ReadByte();
     this.cnt2        = reader.ReadByte();
     this.Unknown_12h = reader.ReadUInt16();
     this.Unknown_14h = reader.ReadUInt32();
     this.Unknown_18h = reader.ReadUInt32();
     this.Unknown_1Ch = reader.ReadUInt32();
     this.Data        = reader.ReadBlock <SimpleArray <Matrix3x4> >(
         cnt1
         );
 }
Пример #31
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.BoundsPointer                   = reader.ReadUInt64();
            this.CurrentMatricesPointer          = reader.ReadUInt64();
            this.LastMatricesPointer             = reader.ReadUInt64();
            this.ChildBoundingBoxesPointer       = reader.ReadUInt64();
            this.TypeAndIncludeFlagsPointer      = reader.ReadUInt64();
            this.OwnedTypeAndIncludeFlagsPointer = reader.ReadUInt64();
            this.MaxNumBounds = reader.ReadUInt16();
            this.NumBounds    = reader.ReadUInt16();
            this.Unknown_A4h  = reader.ReadUInt32();
            this.BVHPointer   = reader.ReadUInt64();

            // read reference data
            this.Bounds = reader.ReadBlockAt <ResourcePointerArray64 <Bound> >(
                this.BoundsPointer, // offset
                this.MaxNumBounds
                );
            this.CurrentMatrices = reader.ReadBlockAt <SimpleArray <Matrix4x4> >(
                this.CurrentMatricesPointer, // offset
                this.MaxNumBounds
                );
            this.LastMatrices = reader.ReadBlockAt <SimpleArray <Matrix4x4> >(
                this.LastMatricesPointer, // offset
                this.MaxNumBounds
                );
            this.ChildBoundingBoxes = reader.ReadBlockAt <SimpleArray <Aabb> >(
                this.ChildBoundingBoxesPointer, // offset
                this.MaxNumBounds
                );
            this.TypeAndIncludeFlags = reader.ReadBlockAt <SimpleArray <ulong> >(
                this.TypeAndIncludeFlagsPointer, // offset
                this.MaxNumBounds
                );
            this.OwnedTypeAndIncludeFlags = reader.ReadBlockAt <SimpleArray <ulong> >(
                this.OwnedTypeAndIncludeFlagsPointer, // offset
                this.MaxNumBounds
                );
            this.BVH = reader.ReadBlockAt <BVH>(
                this.BVHPointer // offset
                );
        }
Пример #32
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.BoneMap         = reader.ReadBlock <HashMap>();
            this.BoneDataPointer = reader.ReadUInt64();
            this.InverseBindPoseMatricesPointer = reader.ReadUInt64();
            this.DefaultPoseMatricesPointer     = reader.ReadUInt64();
            this.ParentIndicesPointer           = reader.ReadUInt64();
            this.ChildrenIndicesPointer         = reader.ReadUInt64();
            this.Unknown_48h          = reader.ReadUInt64();
            this.Unknown_50h          = reader.ReadUInt32();
            this.Unknown_54h          = reader.ReadUInt32();
            this.DataCRC              = reader.ReadUInt32();
            this.Unknown_5Ch          = reader.ReadUInt16();
            this.BonesCount           = reader.ReadUInt16();
            this.ChildrenIndicesCount = reader.ReadUInt16();
            this.Unknown_62h          = reader.ReadUInt16();
            this.Unknown_64h          = reader.ReadUInt32();
            this.Unknown_68h          = reader.ReadUInt64();

            // read reference data
            this.BoneData = reader.ReadBlockAt <BoneData>(
                this.BoneDataPointer - 16, // offset
                this.BonesCount
                );
            this.InverseBindPoseMatrices = reader.ReadBlockAt <SimpleArray <Matrix4x4> >(
                this.InverseBindPoseMatricesPointer, // offset
                this.BonesCount
                );
            this.DefaultPoseMatrices = reader.ReadBlockAt <SimpleArray <Matrix4x4> >(
                this.DefaultPoseMatricesPointer, // offset
                this.BonesCount
                );
            this.ParentIndices = reader.ReadBlockAt <SimpleArray <short> >(
                this.ParentIndicesPointer, // offset
                this.BonesCount
                );
            this.ChildrenIndices = reader.ReadBlockAt <SimpleArray <short> >(
                this.ChildrenIndicesPointer, // offset
                this.ChildrenIndicesCount
                );
        }
Пример #33
0
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            // read structure data
            this.IndicesCount        = reader.ReadUInt16();
            this.Unknown_0Ah         = reader.ReadUInt16();
            this.Unknown_0Ch         = reader.ReadUInt32();
            this.Unknown_10h         = reader.ReadUInt32();
            this.Unknown_14h         = reader.ReadUInt32();
            this.IndicesPointer      = reader.ReadUInt64();
            this.Unknown_20h         = reader.ReadUInt64();
            this.Unknown_28h         = reader.ReadUInt64();
            this.Unknown_30h_Pointer = reader.ReadUInt64();
            this.Unknown_38h         = reader.ReadUInt64();

            // read reference data
            this.Indices          = reader.ReadBlockAt <SimpleArray <ushort> >(IndicesPointer, IndicesCount);
            this.Unknown_30h_Data = reader.ReadBlockAt <ShaderResourceView>(Unknown_30h_Pointer);
        }
Пример #34
0
        public new void Read(BinaryReader br)
        {
            base.Read(br);

            Geometries = new PtrCollection<Geometry>(br);

            var unknownVectorOffsets = ResourceUtil.ReadOffset(br);
            var materialMappingOffset = ResourceUtil.ReadOffset(br);

            Unknown1 = br.ReadUInt16();
            Unknown2 = br.ReadUInt16();

            Unknown3 = br.ReadUInt16();
            Unknown4 = br.ReadUInt16();

            //

            br.BaseStream.Seek(unknownVectorOffsets, SeekOrigin.Begin);
            UnknownVectors = new SimpleArray<Vector4>(br, 4, reader => new Vector4(reader));

            br.BaseStream.Seek(materialMappingOffset, SeekOrigin.Begin);
            ShaderMappings = new SimpleArray<ushort>(br, Geometries.Count, reader => reader.ReadUInt16());
        }
Пример #35
0
        public void Read(BinaryReader br)
        {
            br.BaseStream.Seek(0xB4, SeekOrigin.Begin);
            uint offset = ResourceUtil.ReadOffset(br);
            if (offset != 0)
            {
                Drawable = new DrawableModel();
                br.BaseStream.Seek(offset, SeekOrigin.Begin);
                Drawable.Read(br);
            }
            else
            {
                throw new Exception("No model in FragType");
            }

            br.BaseStream.Seek(0x1F3, SeekOrigin.Begin);
            int childCount = br.ReadByte();

            br.BaseStream.Seek(0xD4, SeekOrigin.Begin);
            uint childListOffset = ResourceUtil.ReadOffset(br);

            br.BaseStream.Seek(childListOffset, SeekOrigin.Begin);
            var childOffsets = new SimpleArray<uint>(br, childCount, ResourceUtil.ReadOffset);

            Children = new FragTypeChild[childCount];
            for(int i=0;i<childCount; i++)
            {
                br.BaseStream.Seek(childOffsets[i], SeekOrigin.Begin);
                Children[i] = new FragTypeChild(br);
            }

            foreach (var child in Children)
            {
                if (child.Drawable != null)
                {
                    child.Drawable.ShaderGroup = Drawable.ShaderGroup;
                }
            }
            
        }
Пример #36
0
 public DojoTeam()
 {
     CurrentTeamMembers = new SimpleArray<Coder>(TeamSize);
     Queue = new CoderQueue();
 }
Пример #37
0
        public void Read(BinaryReader br)
        {
            uint bonesOffset = ResourceUtil.ReadOffset(br);
            uint unknownIntsOffset = ResourceUtil.ReadOffset(br);
            uint transforms1Offset = ResourceUtil.ReadOffset(br);
            uint transforms2Offset = ResourceUtil.ReadOffset(br);
            uint transforms3Offset = ResourceUtil.ReadOffset(br);

            BoneCount = br.ReadUInt16();
            Unknown0 = br.ReadInt16();
            Unknown1 = br.ReadInt32();
            Unknown2 = br.ReadInt32();

            BoneIDMappings = new SimpleCollection<BoneIDMapping>(br, r => new BoneIDMapping(r));

            Unknown3 = br.ReadInt32();
            UnknownHash = br.ReadUInt32();
            Unknown4 = br.ReadInt32();

            UnknownSubStruct = new SubStruct(br);

            // Data:

            br.BaseStream.Seek(bonesOffset, SeekOrigin.Begin);
            Bones = new SimpleArray<Bone>(br, BoneCount, r => new Bone(r));

            br.BaseStream.Seek(unknownIntsOffset, SeekOrigin.Begin);
            UnknownInts = new SimpleArray<int>(br, BoneCount, r => r.ReadInt32());

            br.BaseStream.Seek(transforms1Offset, SeekOrigin.Begin);
            Transforms1 = new SimpleArray<Matrix44>(br, BoneCount, r => new Matrix44(r));

            br.BaseStream.Seek(transforms2Offset, SeekOrigin.Begin);
            Transforms2 = new SimpleArray<Matrix44>(br, BoneCount, r => new Matrix44(r));

            br.BaseStream.Seek(transforms3Offset, SeekOrigin.Begin);
            Transforms3 = new SimpleArray<Matrix44>(br, BoneCount, r => new Matrix44(r));

            // Fun stuff...
            // Build a mapping of Offset -> Bone
            var boneOffsetMapping = new Dictionary<uint, Bone>();
            boneOffsetMapping.Add(0, null);
            foreach (var bone in Bones)
            {
                boneOffsetMapping.Add((uint)bone.Offset, bone);
            }

            // Now resolve all the bone offsets to the real bones
            foreach (var bone in Bones)
            {
                bone.Parent = boneOffsetMapping[bone.ParentOffset];
                bone.FirstChild = boneOffsetMapping[bone.FirstChildOffset];
                bone.NextSibling = boneOffsetMapping[bone.NextSiblingOffset];
            }
        }
Пример #38
0
 public override object Clone()
 {
     SimpleArray newObj = new SimpleArray(this);
     array.CopyTo(newObj.array, 0);
     return newObj;
 }
Пример #39
0
			private SimpleArray(SimpleArray c) : base(c)
			{
				array = new _ElementType[c.Count];
			}