private VoxelModelGenerationRequest(VoxelModelGenerateTask generator, bool async)
 {
     m_Generator = generator;
     if (async)
     {
         m_Task = TaskFactory.Instance.StartNew(generator);
     }
     else
     {
         m_Task = null;
         generator.ExecuteTask();
     }
     m_OutputMesh      = null;
     m_OutputMaterials = null;
 }
        public void GatherOutput(out Mesh mesh, out Material[] materials)
        {
            if (m_OutputMesh == null)
            {
                if (m_Task != null)
                {
                    m_Task.AwaitCompletion();
                }

                m_OutputMesh = new Mesh();
                m_Generator.UploadData(m_OutputMesh, out m_OutputMaterials);

                // Release everything except the output
                m_Task      = null;
                m_Generator = default;
            }

            mesh      = m_OutputMesh;
            materials = m_OutputMaterials;
        }