|  | @@ -1,4 +1,5 @@
 | 
		
	
		
			
			| 1 | 1 |  #include "renderwidget.h"
 | 
		
	
		
			
			|  | 2 | +#include <GL/glu.h>
 | 
		
	
		
			
			| 2 | 3 |  #include <QTimer>
 | 
		
	
		
			
			| 3 | 4 |  #include <math.h>
 | 
		
	
		
			
			| 4 | 5 |  #include <QDebug>
 | 
		
	
	
		
			
			|  | @@ -19,7 +20,7 @@ RenderWidget::RenderWidget(QWidget *parent) :
 | 
		
	
		
			
			| 19 | 20 |      cube->move(Vector3D(0, 1, 0));
 | 
		
	
		
			
			| 20 | 21 |      _engine->addEntity(cube);
 | 
		
	
		
			
			| 21 | 22 |      _engine->addEntity(new UGEEntityAxes(_engine));
 | 
		
	
		
			
			| 22 |  | -    setMouseTracking(false);
 | 
		
	
		
			
			|  | 23 | +    setMouseTracking(true);
 | 
		
	
		
			
			| 23 | 24 |      setFocusPolicy(Qt::StrongFocus);
 | 
		
	
		
			
			| 24 | 25 |  }
 | 
		
	
		
			
			| 25 | 26 |  
 | 
		
	
	
		
			
			|  | @@ -42,6 +43,7 @@ void RenderWidget::paintGL()
 | 
		
	
		
			
			| 42 | 43 |                  );
 | 
		
	
		
			
			| 43 | 44 |      _device->lookAt(center, Vector3D(0.0f, 0.0f, 0.0f));
 | 
		
	
		
			
			| 44 | 45 |      _engine->draw();
 | 
		
	
		
			
			|  | 46 | +//    _device->drawLine(ColorVector3D(Qt::black, 0, 0, 0), ColorVector3D(Qt::black, wx, wy, wz));
 | 
		
	
		
			
			| 45 | 47 |  }
 | 
		
	
		
			
			| 46 | 48 |  
 | 
		
	
		
			
			| 47 | 49 |  void RenderWidget::resizeGL(int width, int height)
 | 
		
	
	
		
			
			|  | @@ -67,11 +69,23 @@ void RenderWidget::mousePressEvent(QMouseEvent *event)
 | 
		
	
		
			
			| 67 | 69 |  
 | 
		
	
		
			
			| 68 | 70 |  void RenderWidget::mouseMoveEvent(QMouseEvent *event)
 | 
		
	
		
			
			| 69 | 71 |  {
 | 
		
	
		
			
			| 70 |  | -    QPoint diff = event->pos() - _lastPoint;
 | 
		
	
		
			
			|  | 72 | +    if (event->buttons() & Qt::LeftButton) {
 | 
		
	
		
			
			|  | 73 | +        QPoint diff = event->pos() - _lastPoint;
 | 
		
	
		
			
			| 71 | 74 |  
 | 
		
	
		
			
			| 72 |  | -    rotate(-diff.x(), -diff.y());
 | 
		
	
		
			
			|  | 75 | +        rotate(-diff.x(), -diff.y());
 | 
		
	
		
			
			| 73 | 76 |  
 | 
		
	
		
			
			| 74 |  | -    _lastPoint = event->pos();
 | 
		
	
		
			
			|  | 77 | +        _lastPoint = event->pos();
 | 
		
	
		
			
			|  | 78 | +    }
 | 
		
	
		
			
			|  | 79 | +//    double modelMatrix[16];
 | 
		
	
		
			
			|  | 80 | +//    double projMatrix[16];
 | 
		
	
		
			
			|  | 81 | +//    GLint viewport[4];
 | 
		
	
		
			
			|  | 82 | +//    glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
 | 
		
	
		
			
			|  | 83 | +//    glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
 | 
		
	
		
			
			|  | 84 | +//    glGetIntegerv(GL_VIEWPORT, viewport);
 | 
		
	
		
			
			|  | 85 | +
 | 
		
	
		
			
			|  | 86 | +//    gluUnProject(event->x(), height() - event->y(), 0, modelMatrix, projMatrix, viewport, &wx, &wy, &wz);
 | 
		
	
		
			
			|  | 87 | +//    qDebug() << event->pos() << wx << wy << wz;
 | 
		
	
		
			
			|  | 88 | +//    update();
 | 
		
	
		
			
			| 75 | 89 |  }
 | 
		
	
		
			
			| 76 | 90 |  
 | 
		
	
		
			
			| 77 | 91 |  void RenderWidget::wheelEvent(QWheelEvent *event)
 |