switched to freeglut for now. seems to work slightly better with all the
[erebus2020] / liberebus / src / erebus.h
index a2566d8..e6e067b 100644 (file)
@@ -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);