/* * Q3DCameraWidget.h * * Created on: Aug 26, 2011 * Author: lyard */ #ifndef Q3DCAMERAWIDGET_H_ #define Q3DCAMERAWIDGET_H_ #include "BasicGlCamera.h" #include #include using namespace std; struct cameraLocation { float rotX; float rotY; float position[3]; cameraLocation() : rotX(0), rotY(0), position({0,0,0}) {} cameraLocation(float rx, float ry, float x, float y, float z): rotX(rx), rotY(ry), position({x,y,z}) {} }; struct float3 { float data[4]; float3() { data[0] = data[1] = data[2] = 0; data[3] = 1.f; } float& operator [] (int index) { return data[index]; } }; class Q3DCameraWidget : public BasicGlCamera { Q_OBJECT public: Q3DCameraWidget(QWidget* pparent = 0); ~Q3DCameraWidget(); void updateData(float* data); public Q_SLOTS: void timedUpdate(); Q_SIGNALS: void dataHasChanged(); protected: void paintGL(); void initializeGL(); void resizeGL(int cWidth, int cHeight); void drawCamera(bool alsoWire); void drawCameraBody(); float rotX, rotY; void mousePressEvent(QMouseEvent* event); void mouseDoubleClickEvent(QMouseEvent *cEvent); int PixelAtPosition(const QPoint &pos); void drawSpheres(); void UpdateText(); private: QTimer timer; cameraLocation currentLoc; int steps; int totalSteps; int currentView; int nextView; vector cameraViews; float fscTemps[60]; bool isPicking; vector highlightPatches; vector > tempPatches; bool initFinished; vector spheresColors; vector spheresRadius; vector spheresLocation; }; #endif /* Q3DCAMERAWIDGET_H_ */