00001 #ifndef BUMPSCOPE
00002 #define BUMPSCOPE
00003
00004 #include "mainvisual.h"
00005 #include "config.h"
00006
00007 #include <vector>
00008 using namespace std;
00009
00010 #ifdef SDL_SUPPORT
00011 #include <SDL.h>
00012
00013 #define MAX_PHONGRES 1024
00014
00015 class BumpScope : public VisualBase
00016 {
00017 public:
00018 BumpScope(long int winid);
00019 virtual ~BumpScope();
00020
00021 void resize(const QSize &size);
00022 bool process(VisualNode *node);
00023 bool draw(QPainter *p, const QColor &back);
00024 void handleKeyPress(const QString &action) {(void) action;}
00025
00026 private:
00027 void blur_8(unsigned char *ptr, int w, int h, int bpl);
00028
00029 void generate_intense(void);
00030 void generate_cmap(unsigned int color);
00031 void generate_phongdat(void);
00032
00033 void translate(int x, int y, int *xo, int *yo, int *xd, int *yd,
00034 int *angle);
00035
00036 inline void draw_vert_line(unsigned char *buffer, int x, int y1, int y2);
00037 void render_light(int lx, int ly);
00038
00039 void rgb_to_hsv(unsigned int color, double *h, double *s, double *v);
00040 void hsv_to_rgb(double h, double s, double v, unsigned int *color);
00041
00042 QSize size;
00043
00044 SDL_Surface *surface;
00045
00046 unsigned int m_color;
00047 unsigned int m_x, m_y, m_width, m_height;
00048 unsigned int m_phongrad;
00049
00050 bool color_cycle;
00051 bool moving_light;
00052 bool diamond;
00053
00054 int bpl;
00055
00056 vector<vector<unsigned char> > phongdat;
00057 unsigned char *rgb_buf;
00058 double intense1[256], intense2[256];
00059
00060 int iangle, ixo, iyo, ixd, iyd, ilx, ily;
00061 int was_moving, was_color;
00062 double ih, is, iv, isd;
00063 int ihd;
00064 unsigned int icolor;
00065 };
00066
00067
00068 #endif
00069
00070 #endif // __mainvisual_h