X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=erebus2020;a=blobdiff_plain;f=liberebus%2Fsrc%2Ferebus.h;h=e6e067b338375a16fb8e4728694ec38dcfe380a9;hp=a2566d89fa2316c62bec06406ec5cee157a02b15;hb=11a8b7dc9f82d6ed298cb18c94b8053c41832fa1;hpb=29ae0aac16008cd44d73f2ac8320504b907be607 diff --git a/liberebus/src/erebus.h b/liberebus/src/erebus.h index a2566d8..e6e067b 100644 --- a/liberebus/src/erebus.h +++ b/liberebus/src/erebus.h @@ -10,11 +10,18 @@ struct erb_ray; struct erb_hit; struct erb_aabb; +struct erb_rect { + int x, y, w, h; +}; + typedef int (*erb_intersect_func)(struct erb_surf *surf, struct erb_ray *ray, struct erb_hit *hit); typedef void (*erb_hitgeom_func)(struct erb_surf *surf, struct erb_hit *hit); typedef void (*erb_sample_func)(struct erb_surf *surf, cgm_vec3 *pos); typedef void (*erb_bbox_func)(struct erb_surf *surf, struct erb_aabb *bb); +/* job (block/frame) completion callback type */ +typedef void (*erb_done_func)(unsigned int job, struct erb_rect *rect, void *cls); + struct erb_aabb { cgm_vec3 pos, sz; }; @@ -70,8 +77,11 @@ void erb_begin(struct erb_rend *erb); /* finalizes the frame, averaging samples (optional) */ float *erb_end(struct erb_rend *erb); -void erb_queue_frame(struct erb_rend *erb); -void erb_queue_block(struct erb_rend *erb, int x, int y, int width, int height); +void erb_set_done_callback(struct erb_rend *erb, erb_done_func donecb, void *cls); + +void erb_queue_frame(struct erb_rend *erb, unsigned int job_id); +void erb_queue_block(struct erb_rend *erb, unsigned int job_id, int x, int y, + int width, int height); void erb_wait(struct erb_rend *erb); void erb_primary_ray(struct erb_rend *erb, struct erb_ray *ray, int sample);