00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifdef __RT_OPENGL__ // You need to enable this to compile OpenGL related stuff
00019
00020 #ifndef __RT_WXGL_H__
00021 #define __RT_WXGL_H__
00022
00023 #include "robwxvis.h"
00024 #define NOMINMAX // Windows headers need this, otherwise they will #define min to something!
00025 #include <wx/wx.h>
00026 #include <wx/glcanvas.h>
00027
00028 class GLFieldPanel : public wxGLCanvas, public FieldDisplay
00029 {
00030 public:
00031 GLFieldPanel(wxWindow* parent, RobVisFrame* vframe, wxWindowID id);
00032 ~GLFieldPanel();
00033 void EnterSim(const SimInfo& info);
00034
00035 void StepSim(const lrt::Vector<BotInfo>& status);
00036 void ExitSim();
00037
00038 void Update(bool force = false);
00039 bool Show(bool doShow);
00040 void HandleProgramColourChange();
00041 wxWindow* GetAsWindow();
00042
00043 void SetUseHQ(bool hq) { useHQ = hq; }
00044 bool GetUseHQ() { return useHQ; }
00045
00046 DECLARE_EVENT_TABLE()
00047 private:
00048 void OnPaint(wxPaintEvent& event);
00049 void OnSize(wxSizeEvent& event);
00050 void OnEraseBackground(wxEraseEvent& event);
00051 void OnKeyDown(wxKeyEvent& event);
00052
00053 void OnLeftDown(wxMouseEvent& event);
00054 void OnRightDown(wxMouseEvent& event);
00055 void OnLeftUp(wxMouseEvent& event);
00056 void OnRightUp(wxMouseEvent& event);
00057 void OnMouseMotion(wxMouseEvent& event);
00058 void OnMouseWheel(wxMouseEvent& event);
00059 void OnEnterWindow(wxMouseEvent& event);
00060 void OnLeaveWindow(wxMouseEvent& event);
00061
00062 void InitGL();
00063 void GenLists();
00064 void LoadTextures();
00065 void DrawField(int x, int z, const BotInfo& info);
00066 void MakeGLColour(const wxColour& wc, float factor, float* dest);
00067 int LoadTexture(const wxBitmap& bmp);
00068 void UpdateBigFieldIfNeeded();
00069
00070 bool glInitDone;
00071 bool useHQ;
00072 float posDist, angUp, angSide;
00073 int listBot, listBotHQ, listHead;
00074 void* quadric;
00075
00076 unsigned int texField, texIset[3];
00077 int listBigField; int lbfX, lbfY;
00078
00079 SimInfo simInfo;
00080 lrt::Vector<BotInfo> status;
00081
00082 wxPoint dragPoint;
00083 bool isClickEvent;
00084
00085
00086 double fieldModelMatrix[16], projMatrix[16];
00087 int viewport[4];
00088 };
00089
00090
00091 #endif // include file
00092 #endif // __RT_OPENGL__ enabled