So I have a voxel terrain engine, and I have an interface that all meshing jobs should inherit from. That looks like this (simplified from the actual):
public interface IMesherJob : IJob
{
VoxelDataVolume<byte> VoxelData { get; set; }
NativeArray<MeshingVertexData> OutputVertices { get; set; }
NativeArray<ushort> OutputTriangles { get; set; }
}
One example of a meshing job is marching cubes, which looks like this: public struct MarchingCubesJob : IMesherJob
So here’s my question: If I have a reference to an IMesherJob
, can I somehow call Schedule
on it? If I have a reference to MarchingCubesJob
, I can call Schedule
on it:
This works:
MarchingCubesJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64)
But this does not work:
IMesherJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64);
I noticed that Schedule()
is an extension method for T where T : struct, IJob
so that might be interfering with it, but it should still work because IMesherJob
inherits from IJob