public void Write(BinaryWriter binaryWriter)
        {
            // triangles
            MyMwcMessageOut.WriteInt32(VoxelTrianglesCount, binaryWriter);
            for (int i = 0; i < VoxelTrianglesCount; i++)
            {
                MyDataCellReadWriteHelper.WriteVoxelTriangle(VoxelTriangles[i], binaryWriter);
            }

            // vertices
            MyMwcMessageOut.WriteInt32(VoxelVerticesCount, binaryWriter);
            for (int i = 0; i < VoxelVerticesCount; i++)
            {
                MyDataCellReadWriteHelper.WriteVoxelVertex(VoxelVertices[i], binaryWriter);
            }
        }
        public bool Read(BinaryReader binaryReader, EndPoint senderEndPoint)
        {
            //  triangles
            int?voxelTrianglesCount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);

            if (voxelTrianglesCount == null)
            {
                return(false);
            }
            VoxelTrianglesCount = voxelTrianglesCount.Value;
            MyMwcLog.IfNetVerbose_AddToLog("voxelTrianglesCount: " + VoxelTrianglesCount);
            VoxelTriangles = new MyVoxelTriangle[VoxelTrianglesCount];
            for (int i = 0; i < VoxelTrianglesCount; i++)
            {
                var voxelTriangle = MyDataCellReadWriteHelper.ReadVoxelTriangleEx(binaryReader, senderEndPoint);
                if (voxelTriangle == null)
                {
                    return(false);
                }
                VoxelTriangles[i] = voxelTriangle.Value;
            }

            // vertices
            int?voxelVerticesCount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);

            if (voxelVerticesCount == null)
            {
                return(false);
            }
            VoxelVerticesCount = voxelVerticesCount.Value;
            MyMwcLog.IfNetVerbose_AddToLog("voxelVerticesCount: " + VoxelVerticesCount);
            VoxelVertices = new MyVoxelVertex[VoxelVerticesCount];
            for (int i = 0; i < VoxelVerticesCount; i++)
            {
                var voxelVertex = MyDataCellReadWriteHelper.ReadVoxelVertexEx(binaryReader, senderEndPoint);
                if (voxelVertex == null)
                {
                    return(false);
                }
                VoxelVertices[i] = voxelVertex.Value;
            }

            return(true);
        }