00001
00002 #ifndef RAYTRACE_DEFS_H
00003 #define RAYTRACE_DEFS_H
00004
00005 #include <Magick++.h>
00006 #include <ncurses.h>
00007 #include <time.h>
00008 #include <syslog.h>
00009
00010 #include "point3d.h"
00011 #include "scene.h"
00012
00014 typedef unsigned char uchar;
00015
00017 static const int HEIGHT = 512;
00018
00020 static const int WIDTH = 512;
00021
00023 const double INF = 1000000000.0;
00024
00026 const int REPORT_FACTOR = 5000;
00027
00028
00030 const int SUBPIXEL_SQRT = 2;
00031
00033 const int PPM_MAX_VAL = 255;
00034
00036 const double OPAQUE = 0.0;
00037
00039 const double TRANSPARENT = 1.0;
00040
00042 enum {
00043 RED = 0,
00044 GREEN,
00045 BLUE
00046 };
00047
00049 #define log_info(fmt, ...) syslog(LOG_INFO, fmt,##__VA_ARGS__)
00050
00052 #define log_debug(fmt, ...) syslog(LOG_DEBUG, fmt,##__VA_ARGS__)
00053
00055 #define log_notice(fmt, ...) syslog(LOG_NOTICE, fmt,##__VA_ARGS__)
00056
00058 #define log_warn(fmt, ...) syslog(LOG_WARNING, fmt,##__VA_ARGS__)
00059
00061 #define log_err(fmt, ...) syslog(LOG_ERR, fmt,##__VA_ARGS__)
00062
00064 #define log_crit(fmt, ...) syslog(LOG_CRIT, fmt,##__VA_ARGS__)
00065
00067 #define log_alert(fmt, ...) syslog(LOG_ALERT, fmt,##__VA_ARGS__)
00068
00070 #define log_emerg(fmt, ...) syslog(LOG_EMERG, fmt,##__VA_ARGS__)
00071
00073
00074 struct raytrace_info {
00076 unsigned long traced_rays;
00077
00079 unsigned long primary_rays;
00080
00082 unsigned long secondary_rays;
00083
00085 unsigned long total_primary_rays;
00086
00088 unsigned long rendered_pixels;
00089
00091 time_t start_time;
00092
00094 raytrace_info() :
00095 traced_rays(0),
00096 primary_rays(0),
00097 secondary_rays(0),
00098 total_primary_rays(0),
00099 start_time(time(NULL)) {}
00100 };
00101
00102
00104
00105 inline double jitter(double limit) {
00106 double rv = -limit;
00107 rv += drand48() * (2 * limit);
00108 return rv;
00109 }
00110
00111
00113
00114 inline void exit_mbrt(int code) {
00115 endwin();
00116 log_info("****************** Aborting mbrt with status (%i) ******************\n", code);
00117 closelog();
00118 exit(code);
00119 }
00120
00121 #endif
00122
00123