Ejemplo n.º 1
0
    private byte[] ReadChunk(Stream glbStream, OVRChunkType type)
    {
        uint chunkLength;

        if (ValidateChunk(glbStream, type, out chunkLength))
        {
            byte[] chunkBuffer = new byte[chunkLength];
            glbStream.Read(chunkBuffer, 0, (int)chunkLength);
            return(chunkBuffer);
        }
        return(null);
    }
Ejemplo n.º 2
0
    private bool ValidateChunk(Stream glbStream, OVRChunkType type, out uint chunkLength)
    {
        int uint32Size = sizeof(uint);

        byte[] buffer = new byte[uint32Size];
        glbStream.Read(buffer, 0, uint32Size);
        chunkLength = BitConverter.ToUInt32(buffer, 0);

        glbStream.Read(buffer, 0, uint32Size);
        uint chunkType = BitConverter.ToUInt32(buffer, 0);

        if (chunkType != (uint)type)
        {
            Debug.LogError("Read chunk does not match type.");
            return(false);
        }
        return(true);
    }