summaryrefslogtreecommitdiffstats
path: root/src/render/renderstates/qclipplane.cpp
diff options
context:
space:
mode:
authorRobert Brock <robert.brock@kdab.com>2016-02-29 15:24:29 +0000
committerSean Harmer <sean.harmer@kdab.com>2016-03-08 15:38:15 +0000
commite0b120eff6a2de9214bb37323b5a0b444620027a (patch)
tree10dfcc074d7f64268c4ae2da123440e09df8d61a /src/render/renderstates/qclipplane.cpp
parent2a98c7e7d20bf720c4f4b6444d6317e99face7ec (diff)
QClipPlane rename and added properties
- storing values in backend - new functions being added renamed plane to planeIndex added QVector3D normal property added float distance property As per API review Task-number: QTBUG-51435 Change-Id: Ie52804716510981af1467e96003304324fadd4d8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/renderstates/qclipplane.cpp')
-rw-r--r--src/render/renderstates/qclipplane.cpp54
1 files changed, 45 insertions, 9 deletions
diff --git a/src/render/renderstates/qclipplane.cpp b/src/render/renderstates/qclipplane.cpp
index 0d01bbf74..8b0f9299c 100644
--- a/src/render/renderstates/qclipplane.cpp
+++ b/src/render/renderstates/qclipplane.cpp
@@ -49,10 +49,14 @@ class QClipPlanePrivate : public QRenderStatePrivate
public:
QClipPlanePrivate()
: QRenderStatePrivate(QRenderState::ClipPlane)
- , m_plane(0)
+ , m_planeIndex(0)
+ , m_normal()
+ , m_distance(0.0f)
{}
- int m_plane;
+ int m_planeIndex;
+ QVector3D m_normal;
+ float m_distance;
};
/*!
@@ -97,22 +101,52 @@ QClipPlane::~QClipPlane()
* Returns the index of the clip plane.
* \note usually between 0-7
*/
-int QClipPlane::plane() const
+int QClipPlane::planeIndex() const
{
Q_D(const QClipPlane);
- return d->m_plane;
+ return d->m_planeIndex;
+}
+
+QVector3D QClipPlane::normal() const
+{
+ Q_D(const QClipPlane);
+ return d->m_normal;
+}
+
+float QClipPlane::distance() const
+{
+ Q_D(const QClipPlane);
+ return d->m_distance;
}
/*!
* Sets the index of the clip plane to \a plane.
* \note above 7, support is not garanteed
*/
-void QClipPlane::setPlane(int plane)
+void QClipPlane::setPlaneIndex(int planeIndex)
+{
+ Q_D(QClipPlane);
+ if (planeIndex != d->m_planeIndex) {
+ d->m_planeIndex = planeIndex;
+ Q_EMIT planeIndexChanged(planeIndex);
+ }
+}
+
+void QClipPlane::setNormal(QVector3D normal)
+{
+ Q_D(QClipPlane);
+ if (normal != d->m_normal) {
+ d->m_normal = normal;
+ Q_EMIT normalChanged(normal);
+ }
+}
+
+void QClipPlane::setDistance(float distance)
{
Q_D(QClipPlane);
- if (plane != d->m_plane) {
- d->m_plane = plane;
- Q_EMIT planeChanged(plane);
+ if (distance != d->m_distance) {
+ d->m_distance = distance;
+ Q_EMIT distanceChanged(distance);
}
}
@@ -120,7 +154,9 @@ void QClipPlane::copy(const QNode *ref)
{
QRenderState::copy(ref);
const QClipPlane *refClip = static_cast<const QClipPlane *>(ref);
- d_func()->m_plane = refClip->plane();
+ d_func()->m_planeIndex = refClip->planeIndex();
+ d_func()->m_normal = refClip->normal();
+ d_func()->m_distance = refClip->distance();
}
} // namespace Qt3DRender