Пример #1
0
        public VertexShapeLODElement(Stream stream)
        {
            versionNumber = StreamUtils.ReadInt16(stream);

            BindingAttributes      = StreamUtils.ReadInt32(stream);
            QuantizationParameters = new QuantizationParameters(stream);
        }
Пример #2
0
 public CountRange(Stream stream)
 {
     data = new int[]
     {
         StreamUtils.ReadInt32(stream),
         StreamUtils.ReadInt32(stream)
     };
 }
Пример #3
0
 public VertexShapeNodeElement(Stream stream)
     : base(stream)
 {
     NormalBinding          = StreamUtils.ReadInt32(stream);
     TextureBinding         = StreamUtils.ReadInt32(stream);
     ColourBinding          = StreamUtils.ReadInt32(stream);
     QuantizationParameters = new QuantizationParameters(stream);
 }
Пример #4
0
        public Vec(Stream stream)
        {
            data = new T[StreamUtils.ReadInt32(stream)];

            for (int i = 0, c = data.Length; i < c; ++i)
            {
                data[i] = StreamUtils.Read <T>(stream);
            }
        }
Пример #5
0
        public ElementHeader(Stream stream)
        {
            ElementLength = StreamUtils.ReadInt32(stream);
            ObjectTypeID  = new GUID(stream);

            if (ObjectTypeID.ToString() != ConstUtils.EndOfElementAsString)
            {
                ObjectBaseType = StreamUtils.ReadByte(stream);
            }
        }
        public PropertyProxyMetaDataElement(Stream stream)
        {
            PropertyKeys       = new List <MbString>();
            PropertyValueTypes = new List <byte>();
            PropertyValues     = new List <object>();

            var propertyKey = new MbString(stream);

            while (propertyKey.Count > 0)
            {
                PropertyKeys.Add(propertyKey);

                var propertyValueType = StreamUtils.ReadByte(stream);

                PropertyValueTypes.Add(propertyValueType);

                switch (propertyValueType)
                {
                case 1:
                {
                    PropertyValues.Add(new MbString(stream));         // MbString

                    break;
                }

                case 2:
                {
                    PropertyValues.Add(StreamUtils.ReadInt32(stream));         // Int32

                    break;
                }

                case 3:
                {
                    PropertyValues.Add(StreamUtils.ReadFloat(stream));         // Single

                    break;
                }

                case 4:
                {
                    PropertyValues.Add(new Date(stream));         // Date

                    break;
                }

                default:
                {
                    throw new Exception(String.Format("Property Value Type {0} is not recognised.", propertyValueType));
                }
                }

                propertyKey = new MbString(stream);
            }
        }
Пример #7
0
        public FileHeader(Stream stream)
        {
            Version   = StreamUtils.ReadBytes(stream, 80, false);
            ByteOrder = StreamUtils.ReadByte(stream);

            StreamUtils.DataIsLittleEndian = ByteOrder == 0;

            ReservedField = StreamUtils.ReadInt32(stream);
            TOCOffset     = StreamUtils.ReadInt32(stream);
            LSGSegmentID  = new GUID(stream);
        }
Пример #8
0
        public TOCSegment(Stream stream)
        {
            EntryCount = StreamUtils.ReadInt32(stream);

            TOCEntries = new TOCEntry[EntryCount];

            for (int i = 0; i < EntryCount; ++i)
            {
                TOCEntries[i] = new TOCEntry(stream);
            }
        }
Пример #9
0
 public BaseShapeNodeElement(Stream stream)
     : base(stream)
 {
     TransformedBBox   = new BBoxF32(stream);
     UntransformedBBox = new BBoxF32(stream);
     Area              = StreamUtils.ReadFloat(stream);
     VertexCountRange  = new CountRange(stream);
     NodeCountRange    = new CountRange(stream);
     PolygonCountRange = new CountRange(stream);
     Size              = StreamUtils.ReadInt32(stream);
     CompressionLevel  = StreamUtils.ReadFloat(stream);
 }
Пример #10
0
        public GroupNodeElement(Stream stream)
            : base(stream)
        {
            var childCount = StreamUtils.ReadInt32(stream);

            ChildNodeObjectIds = new List <int>(childCount);

            for (int i = 0; i < childCount; ++i)
            {
                ChildNodeObjectIds.Add(StreamUtils.ReadInt32(stream));
            }
        }
Пример #11
0
        public BaseNodeElement(Stream stream)
        {
            ObjectId  = StreamUtils.ReadInt32(stream);
            NodeFlags = StreamUtils.ReadUInt32(stream);

            var attributeCount = StreamUtils.ReadInt32(stream);

            AttributeObjectIds = new List <int>(attributeCount);

            for (int i = 0; i < attributeCount; ++i)
            {
                AttributeObjectIds.Add(StreamUtils.ReadInt32(stream));
            }
        }
Пример #12
0
        public PropertyTable(Stream stream)
        {
            VersionNumber          = StreamUtils.ReadInt16(stream);
            NodePropertyTableCount = StreamUtils.ReadInt32(stream);

            NodeObjectIDs      = new Int32[NodePropertyTableCount];
            NodePropertyTables = new NodePropertyTable[NodePropertyTableCount];

            for (int i = 0; i < NodePropertyTableCount; ++i)
            {
                NodeObjectIDs[i]      = StreamUtils.ReadInt32(stream);
                NodePropertyTables[i] = new NodePropertyTable(stream);
            }
        }
Пример #13
0
        public NodePropertyTable(Stream stream)
        {
            KeyPropertyAtomObjectIDs   = new List <Int32>();
            ValuePropertyAtomObjectIDs = new List <Int32>();

            var keyPropertyAtomObjectID = StreamUtils.ReadInt32(stream);

            while (keyPropertyAtomObjectID != 0)
            {
                KeyPropertyAtomObjectIDs.Add(keyPropertyAtomObjectID);
                ValuePropertyAtomObjectIDs.Add(StreamUtils.ReadInt32(stream));

                keyPropertyAtomObjectID = StreamUtils.ReadInt32(stream);
            }
        }
Пример #14
0
        public PartitionNodeElement(Stream stream)
            : base(stream)
        {
            PartitionFlags    = StreamUtils.ReadInt32(stream);
            FileName          = new MbString(stream);
            TransformedBBox   = new BBoxF32(stream);
            Area              = StreamUtils.ReadFloat(stream);
            VertexCountRange  = new CountRange(stream);
            NodeCountRange    = new CountRange(stream);
            PolygonCountRange = new CountRange(stream);

            if ((PartitionFlags & 0x00000001) != 0)
            {
                UntransformedBBox = new BBoxF32(stream);
            }
        }
        public LosslessCompressedRawVertexData(Stream stream)
        {
            StreamUtils.ReadInt32(stream); //uncompressedDataSize
            var compressedDataSize = StreamUtils.ReadInt32(stream);

            if (compressedDataSize > 0)
            {
                CompressedVertexData = StreamUtils.ReadBytes(stream, compressedDataSize, false);
            }
            else if (compressedDataSize < 0)
            {
                VertexData = StreamUtils.ReadBytes(stream, Math.Abs(compressedDataSize), false);
            }
            else
            {
                VertexData = CompressedVertexData = new byte[0];
            }
        }
Пример #16
0
 public BaseAttributeElement(Stream stream)
 {
     ObjectId          = StreamUtils.ReadInt32(stream);
     StateFlags        = StreamUtils.ReadByte(stream);
     FieldInhibitFlags = StreamUtils.ReadUInt32(stream);
 }
Пример #17
0
 public BasePropertyAtomElement(Stream stream)
 {
     ObjectID   = StreamUtils.ReadInt32(stream);
     StateFlags = StreamUtils.ReadUInt32(stream);
 }
Пример #18
0
 public LateLoadedPropertyAtomElement(Stream stream)
     : base(stream)
 {
     SegmentId   = new GUID(stream);
     SegmentType = StreamUtils.ReadInt32(stream);
 }
Пример #19
0
        private static int[] DecodeBytes(Stream stream)
        {
            var codecType = (CODECType)StreamUtils.ReadByte(stream);

            Int32ProbabilityContexts int32ProbabilityContexts = null;

            //int outOfBandValueCount;
            //int[] outOfBandValues;

            if (codecType == CODECType.Huffman || codecType == CODECType.Arithmetic)
            {
                throw new NotImplementedException("Huffman && Arithmetic codec NOT IMPLEMENTED");

                /*int32ProbabilityContexts = new Int32ProbabilityContexts(stream);
                 * outOfBandValueCount = StreamUtils.ReadInt32(stream);
                 *
                 * if (outOfBandValueCount > 0)
                 * {
                 *  outOfBandValues = DecodeBytes(stream);
                 * }*/
            }

            if (codecType != CODECType.Null)
            {
                var codeTextLength    = StreamUtils.ReadInt32(stream);
                var valueElementCount = StreamUtils.ReadInt32(stream);
                //var symbolCount = valueElementCount;

                if (int32ProbabilityContexts != null && int32ProbabilityContexts.ProbabilityContextTableEntries.Length > 1)
                {
                    StreamUtils.ReadInt32(stream); //symbolCount
                }

                var wordsToRead = StreamUtils.ReadInt32(stream);
                var codeText    = new uint[wordsToRead];
                for (int i = 0; i < wordsToRead; ++i)
                {
                    UInt32 codeTextWord;

                    if (StreamUtils.DataIsLittleEndian) // Convert to BigEndian
                    {
                        var bytes = StreamUtils.ReadBytes(stream, 4, true);
                        Array.Reverse(bytes);

                        /*var result = new UInt32[1];
                         * Buffer.BlockCopy(bytes, 0, result, 0, 4);
                         *
                         * codeTextWord = result[0];*/

                        codeTextWord = Convert.FromBytes <UInt32>(bytes);
                    }

                    else
                    {
                        codeTextWord = StreamUtils.ReadUInt32(stream);
                    }

                    codeText[i] = codeTextWord;
                }

                switch (codecType)
                {
                case CODECType.Bitlength:
                    return(BitlengthCoder.Decode(codeText, valueElementCount, codeTextLength));

                case CODECType.Huffman:
                    throw new NotImplementedException("Huffman codec NOT IMPLEMENTED");

                case CODECType.Arithmetic:
                    throw new NotImplementedException("Huffman codec NOT IMPLEMENTED");
                }
            }

            else
            {
                var integersToRead = StreamUtils.ReadInt32(stream);

                var decodedSymbols = new int[integersToRead];

                for (int i = 0; i < integersToRead; ++i)
                {
                    decodedSymbols[i] = StreamUtils.ReadInt32(stream);
                }

                return(decodedSymbols);
            }

            return(new int[0]);
        }
Пример #20
0
 public LogicElementHeaderZLIB(Stream stream)
 {
     CompressionFlag      = StreamUtils.ReadInt32(stream);
     CompressedDataLength = StreamUtils.ReadInt32(stream);
     CompressionAlgorithm = StreamUtils.ReadByte(stream);
 }
Пример #21
0
 public LODNodeElement(Stream stream)
     : base(stream)
 {
     reservedField1 = new VecF32(stream);
     reservedField2 = StreamUtils.ReadInt32(stream);
 }
Пример #22
0
 public InstanceNodeElement(Stream stream)
     : base(stream)
 {
     ChildNodeObjectID = StreamUtils.ReadInt32(stream);
 }
Пример #23
0
 public SegmentHeader(Stream stream) : this(new GUID(stream), StreamUtils.ReadInt32(stream), StreamUtils.ReadInt32(stream))
 {
 }
Пример #24
0
 public TOCEntry(Stream stream) : this(new GUID(stream), StreamUtils.ReadInt32(stream), StreamUtils.ReadInt32(stream), StreamUtils.ReadUInt32(stream))
 {
 }
Пример #25
0
 public IntegerPropertyAtomElement(Stream stream)
     : base(stream)
 {
     Value = StreamUtils.ReadInt32(stream);
 }
Пример #26
0
 public GUID(Stream stream)
 {
     guid = new Guid(StreamUtils.ReadInt32(stream), StreamUtils.ReadInt16(stream), StreamUtils.ReadInt16(stream), StreamUtils.ReadBytes(stream, 8, false));
 }
Пример #27
0
 public PartNodeElement(Stream stream)
     : base(stream)
 {
     versionNumber = StreamUtils.ReadInt16(stream);
     reservedField = StreamUtils.ReadInt32(stream);
 }