public static SSubMeshArray Deserialize(byte[] input)
        {
            if (input == null || input.Length == 0)
                return null;

            SSubMeshArray result = new SSubMeshArray();
            ComposedByteStream merged = ComposedByteStream.FromByteArray(input);

            ComposedByteStream triangleStream = ComposedByteStream.FromByteArray(merged.ReadNextStream<byte>());
            result.materialIDs = merged.ReadNextStream<int>();

            //--------------- Triangles --------------------
            if (triangleStream != null && triangleStream.streamCount > 0) {
                int i = triangleStream.streamCount;
                result.triangles = new int[i][];

                while (--i > -1)
                    result.triangles[i] = triangleStream.ReadNextStream<int>();
            }
            //--------------- Triangles --------------------

            merged.Dispose();
            triangleStream.Dispose();
            return result;
        }
        //--------------- Serialize / Deserialize --------------------
        public static byte[] Serialize(SSubMeshArray input)
        {
            if (input == null || input.triangles == null || input.materialIDs == null)
                return null;

            //--------------- Triangles --------------------
            int i = input.triangles.Length;
            ComposedByteStream triangleStream = new ComposedByteStream(i);

            while (--i > -1)
                triangleStream.AddStream(input.triangles[i]);
            //--------------- Triangles --------------------

            ComposedByteStream merged = new ComposedByteStream(2);
            merged.AddStream(triangleStream.Compose());
            merged.AddStream(input.materialIDs);
            return merged.Compose();
        }
        public override void Dispose()
        {
            base.Dispose();

            if (header != null) header.Dispose();
            if (subMeshes != null) subMeshes.Dispose();
            if (vertices != null) vertices.Dispose();
            if (uv != null) uv.Dispose();
            if (uv1 != null) uv1.Dispose();
            if (uv2 != null) uv2.Dispose();
            if (uv3 != null) uv3.Dispose();
            if (uv4 != null) uv4.Dispose();
            if (bindPoses != null) bindPoses.Dispose();
            if (bones != null) bones.Dispose();
            if (boneWeights != null) boneWeights.Dispose();

            header = null;
            subMeshes = null;
            triangles = null;
            vertices = null;
            uv = null;
            uv1 = null;
            uv2 = null;
            uv3 = null;
            uv4 = null;
            bindPoses = null;
            bones = null;
            boneWeights = null;
        }