erebus

view liberebus/src/erebus.h @ 47:4b91c9a501d8

minor fix of strange code structure in the thread func
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 01 Feb 2016 14:56:15 +0200
parents db8a90307386
children
line source
1 #ifndef LIBEREBUS_H_
2 #define LIBEREBUS_H_
4 struct erebus;
6 enum erb_option {
7 ERB_OPT_WIDTH,
8 ERB_OPT_HEIGHT,
9 ERB_OPT_MAX_ITER,
10 ERB_OPT_MAX_SAMPLES,
11 ERB_OPT_NUM_THREADS,
12 ERB_OPT_GAMMA,
14 ERB_NUM_OPTIONS
15 };
17 struct erb_render_status {
18 long progress_percent; // derived from the data below
19 long blocks, max_blocks; // completed pixel blocks in current sample pass
20 long samples, max_samples; // completed samples in current frame
21 long frames, max_frames; // completed frames in multi-frame job
22 };
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 struct erebus *erb_init(void);
29 void erb_destroy(struct erebus *ctx);
31 void erb_clear(struct erebus *ctx);
33 void erb_setopti(struct erebus *ctx, enum erb_option opt, int val);
34 void erb_setoptf(struct erebus *ctx, enum erb_option opt, float val);
35 void erb_setoptfv(struct erebus *ctx, enum erb_option opt, float *vec);
37 int erb_getopti(struct erebus *ctx, enum erb_option opt);
38 float erb_getoptf(struct erebus *ctx, enum erb_option opt);
39 float *erb_getoptfv(struct erebus *ctx, enum erb_option opt);
41 float *erb_get_framebuffer(struct erebus *ctx);
43 void erb_begin_frame(struct erebus *ctx, long ms);
44 void erb_end_frame(struct erebus *ctx);
46 int erb_render(struct erebus *ctx, long timeout);
47 int erb_render_rect(struct erebus *ctx, int x, int y, int width, int height, long timeout);
49 int erb_get_progress(struct erebus *ctx);
50 int erb_get_status(struct erebus *ctx, struct erb_render_status *stat);
52 int erb_load_scene(struct erebus *ctx, const char *fname);
53 int erb_proc_cmd(struct erebus *ctx, const char *cmd);
55 bool erb_input_keyboard(struct erebus *ctx, int key, bool pressed);
56 bool erb_input_mouse_button(struct erebus *ctx, int bn, bool pressed, int x, int y);
57 bool erb_input_mouse_motion(struct erebus *ctx, int x, int y);
58 bool erb_input_6dof_button(struct erebus *ctx, int bn, bool pressed);
59 bool erb_input_6dof_motion(struct erebus *ctx, float x, float y, float z);
61 #ifdef __cplusplus
62 }
63 #endif
66 #endif /* LIBEREBUS_H_ */