00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LUX_WXGLVIEWER_H
00024 #define LUX_WXGLVIEWER_H
00025
00026 #ifdef LUX_USE_OPENGL
00027 #include "wx/wx.h"
00028 #include "wx/glcanvas.h"
00029 #endif // LUX_USE_OPENGL
00030
00031 namespace lux
00032 {
00033
00034 #ifdef LUX_USE_OPENGL
00035
00036 class LuxGLViewer : public wxGLCanvas {
00037 public:
00038 LuxGLViewer(wxWindow *parent, int textureW = 256, int textureH = 256);
00039
00040 protected:
00041 DECLARE_EVENT_TABLE()
00042 virtual void Refresh(bool eraseBackground = true, const wxRect* rect = NULL);
00043 void OnPaint(wxPaintEvent &event);
00044 void OnEraseBackground(wxEraseEvent &event);
00045 void OnSize(wxSizeEvent &event);
00046 void OnMouse(wxMouseEvent &event);
00047
00048 wxGLContext m_glContext;
00049
00050 int m_imageW, m_imageH;
00051 int m_tilesX, m_tilesY, m_tilesNr;
00052 bool m_firstDraw;
00053 bool m_imageChanged;
00054 const int m_textureW;
00055 const int m_textureH;
00056 int m_offsetX, m_offsetY, m_scaleXo2, m_scaleYo2, m_scaleXo, m_scaleYo, m_lastX, m_lastY;
00057 float m_scale;
00058 float m_scaleExp;
00059 int m_lastW, m_lastH;
00060
00061 };
00062
00063 #else // LUX_USE_OPENGL
00064
00065
00066 class LuxGLViewer : public wxWindow {
00067 public:
00068 LuxGLViewer(wxWindow *parent, int textureW = 256, int textureH = 256) {}
00069 };
00070
00071 #endif // LUX_USE_OPENGL
00072
00073 }
00074
00075 #endif // LUX_WXGLVIEWER_H