Beispiel #1
0
        internal override int Read(BinaryReader br, IVoxLoader loader)
        {
            int readSize = base.Read(br, loader);

            Int32 id = br.ReadInt32();
            Dictionary <string, byte[]> attributes = GenericsReader.ReadDict(br, ref readSize);

            Int32 childNodeId = br.ReadInt32();
            Int32 reservedId  = br.ReadInt32();
            Int32 layerId     = br.ReadInt32();
            Int32 numOfFrames = br.ReadInt32();

            readSize += sizeof(Int32) * 5;

            Dictionary <string, byte[]>[] framesAttributes = new Dictionary <string, byte[]> [numOfFrames];

            for (int fnum = 0; fnum < numOfFrames; fnum++)
            {
                framesAttributes[fnum] = GenericsReader.ReadDict(br, ref readSize);

                /*int[] rotationMatrix = GenericsReader.ReadRotation(br, ref readSize);
                 * int[] translationVector = { 0, 0, 0 };
                 * translationVector[0] = br.ReadInt32();
                 * translationVector[1] = br.ReadInt32();
                 * translationVector[2] = br.ReadInt32();*/
                // TODO: Add frame info
            }

            // TODO: Notify the IVoxLoader of the transform node
            loader.NewTransformNode(id, childNodeId, layerId, framesAttributes);
            return(readSize);
        }
Beispiel #2
0
        internal override int Read(BinaryReader br, IVoxLoader loader)
        {
            int readSize = base.Read(br, loader);

            Int32 id = br.ReadInt32();
            Dictionary <string, byte[]> attributes = GenericsReader.ReadDict(br, ref readSize);

            readSize += sizeof(Int32);

            loader.NewMaterial(id, attributes);
            return(readSize);
        }
        internal override int Read(BinaryReader br, IVoxLoader loader)
        {
            int readSize = base.Read(br, loader);

            Int32 id = br.ReadInt32();
            Dictionary <string, byte[]> attributes = GenericsReader.ReadDict(br, ref readSize);

            Int32 numChildrenNodes = br.ReadInt32();

            Int32[] childrenIds = new Int32[numChildrenNodes];
            readSize += sizeof(Int32) * (numChildrenNodes + 2);

            for (int cnum = 0; cnum < numChildrenNodes; cnum++)
            {
                childrenIds[cnum] = br.ReadInt32();
            }

            loader.NewGroupNode(id, attributes, childrenIds);
            return(readSize);
        }
        internal override int Read(BinaryReader br, IVoxLoader loader)
        {
            int readSize = base.Read(br, loader);

            Int32 id = br.ReadInt32();
            Dictionary <string, byte[]> attributes = GenericsReader.ReadDict(br, ref readSize);

            Int32 numModels = br.ReadInt32();

            readSize += sizeof(Int32) * 2;

            Int32[] modelIds = new Int32[numModels];
            Dictionary <string, byte[]>[] modelsAttributes = new Dictionary <string, byte[]> [numModels];

            for (int mnum = 0; mnum < numModels; mnum++)
            {
                modelIds[mnum]         = br.ReadInt32();
                modelsAttributes[mnum] = GenericsReader.ReadDict(br, ref readSize);
                readSize += sizeof(Int32);
            }

            loader.NewShapeNode(id, attributes, modelIds, modelsAttributes);
            return(readSize);
        }