clray

view src/rt.h @ 54:6a30f27fa1e6

separated the OpenGL visualization and added a CPU raytracing mode
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 10 Sep 2010 16:47:00 +0100
parents 30bf84881553
children df239a52a091
line source
1 #ifndef RT_H_
2 #define RT_H_
4 #include "scene.h"
6 enum {
7 ROPT_ITER,
8 ROPT_SHAD,
9 ROPT_REFL,
11 NUM_RENDER_OPTIONS
12 };
14 struct RendInfo {
15 float ambient[4];
16 int xsz, ysz;
17 int num_faces, num_lights;
18 int max_iter;
19 int cast_shadows;
20 };
22 struct Ray {
23 float origin[4], dir[4];
24 };
27 bool init_renderer(int xsz, int ysz, Scene *scn, unsigned int tex);
28 void destroy_renderer();
29 bool render();
30 void set_xform(float *matrix, float *invtrans);
32 const RendInfo *get_render_info();
34 void set_render_option(int opt, bool val);
35 void set_render_option(int opt, int val);
36 void set_render_option(int opt, float val);
38 bool get_render_option_bool(int opt);
39 int get_render_option_int(int opt);
40 float get_render_option_float(int opt);
42 // raytrace in the CPU
43 bool init_dbg_renderer(int xsz, int ysz, Scene *scn, unsigned int texid);
44 void destroy_dbg_renderer();
45 void dbg_set_primary_rays(const Ray *rays);
46 void dbg_render(const float *xform, const float *invtrans_xform, int num_threads = -1);
48 // visualize the scene using OpenGL
49 void dbg_render_gl(Scene *scn, bool show_tree = false, bool show_obj = true);
51 #endif /* RT_H_ */