summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gldisc.cpp5
-rw-r--r--src/mmscene.cpp6
-rw-r--r--src/mmscene.h23
3 files changed, 34 insertions, 0 deletions
diff --git a/src/gldisc.cpp b/src/gldisc.cpp
index 601ef25..48cd8be 100644
--- a/src/gldisc.cpp
+++ b/src/gldisc.cpp
@@ -73,6 +73,11 @@ void GLDisc::makeSurface(QVector<GLPoint> *pointContainer, QVector<GLshort> *ind
bool GLDisc::isHit(QVector3D p1, QVector3D p2)
{
+ if(!GLBody::isHit(p1, p2))
+ {
+ return false;
+ }
+
}
diff --git a/src/mmscene.cpp b/src/mmscene.cpp
index 45b913f..2bd7536 100644
--- a/src/mmscene.cpp
+++ b/src/mmscene.cpp
@@ -72,6 +72,12 @@ void MMScene::setupGeometry()
m_geometryIsValid = true;
}
+void MMScene::mousePressed(int x, int y)
+{
+ renderer()->calculateMousePoints(&m_MouseNear, &m_mouseFar, QPoint(x, y));
+ renderer()->mouseIntersection(&m_lastIntersection, v_Y, 0.0, QPoint(x, y)); //get starting point
+}
+
void MMScene::drawTriangles()
{
renderer()->setLightingEnabled(m_lightingEnabled);
diff --git a/src/mmscene.h b/src/mmscene.h
index d68af98..78df57a 100644
--- a/src/mmscene.h
+++ b/src/mmscene.h
@@ -14,6 +14,9 @@ public:
MMScene(QQuickItem *parent = 0);
~MMScene();
+public slots:
+ void mousePressed(int x, int y);
+
protected:
/**
* @brief paintUnderQmlScene
@@ -75,6 +78,26 @@ private:
GLSphere *m_sphere;
GLDisc *m_disc;
+
+ /**
+ * @brief m_MouseNear
+ * The near point of a mouse click or movement.
+ * Needed in synchronizeThreads().
+ */
+ QVector3D m_MouseNear;
+
+ /**
+ * @brief m_MouseNear
+ * The far point of a mouse click or movement.
+ * Needed in synchronizeThreads().
+ */
+ QVector3D m_mouseFar;
+
+ /**
+ * @brief m_lastIntersection
+ * The last intersection of the mouse line with the chessboard.
+ */
+ QVector3D m_lastIntersection;
};
#endif // MMSCENE_H