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 #define MAX_PHONGRES 1024
00011
00012 class BumpScope : public VisualBase
00013 {
00014 public:
00015 BumpScope();
00016 virtual ~BumpScope();
00017
00018 void resize(const QSize &size);
00019 bool process(VisualNode *node);
00020 bool draw(QPainter *p, const QColor &back);
00021 void handleKeyPress(const QString &action) {(void) action;}
00022
00023 private:
00024 void blur_8(unsigned char *ptr, int w, int h, int bpl);
00025
00026 void generate_cmap(unsigned int color);
00027 void generate_phongdat(void);
00028
00029 void translate(int x, int y, int *xo, int *yo, int *xd, int *yd,
00030 int *angle);
00031
00032 inline void draw_vert_line(unsigned char *buffer, int x, int y1, int y2);
00033 void render_light(int lx, int ly);
00034
00035 static void rgb_to_hsv(unsigned int color, double *h, double *s, double *v);
00036 static void hsv_to_rgb(double h, double s, double v, unsigned int *color);
00037
00038 QImage *m_image;
00039
00040 QSize m_size;
00041
00042 unsigned int m_color;
00043 unsigned int m_x;
00044 unsigned int m_y;
00045 unsigned int m_width;
00046 unsigned int m_height;
00047 unsigned int m_phongrad;
00048
00049 bool m_color_cycle;
00050 bool m_moving_light;
00051
00052
00053 int m_bpl;
00054
00055 vector<vector<unsigned char> > m_phongdat;
00056 unsigned char *m_rgb_buf;
00057 double m_intense1[256];
00058 double m_intense2[256];
00059
00060 int m_iangle;
00061 int m_ixo;
00062 int m_iyo;
00063 int m_ixd;
00064 int m_iyd;
00065 int m_ilx;
00066 int m_ily;
00067 int m_was_moving;
00068 int m_was_color;
00069 double m_ih;
00070 double m_is;
00071 double m_iv;
00072 double m_isd;
00073 int m_ihd;
00074 unsigned int m_icolor;
00075 };
00076
00077
00078 #endif