| 1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qplanegeometryview.h" |
| 5 | |
| 6 | #include <Qt3DExtras/qplanegeometry.h> |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | namespace Qt3DExtras { |
| 11 | |
| 12 | /*! |
| 13 | * \qmltype PlaneGeometryView |
| 14 | * \nativetype Qt3DExtras::QPlaneGeometryView |
| 15 | * \inqmlmodule Qt3D.Extras |
| 16 | * \brief A square planar mesh. |
| 17 | */ |
| 18 | |
| 19 | /*! |
| 20 | * \qmlproperty real PlaneGeometryView::width |
| 21 | * |
| 22 | * Holds the plane width. |
| 23 | */ |
| 24 | |
| 25 | /*! |
| 26 | * \qmlproperty real PlaneGeometryView::height |
| 27 | * |
| 28 | * Holds the plane height. |
| 29 | */ |
| 30 | |
| 31 | /*! |
| 32 | * \qmlproperty size PlaneGeometryView::meshResolution |
| 33 | * |
| 34 | * Holds the plane resolution. |
| 35 | * The width and height values of this property specify the number of vertices generated for |
| 36 | * the mesh in the respective dimensions. |
| 37 | */ |
| 38 | |
| 39 | /*! |
| 40 | * \qmlproperty bool PlaneGeometryView::mirrored |
| 41 | * |
| 42 | * Controls if the UV coordinates of the plane should be flipped vertically. |
| 43 | */ |
| 44 | |
| 45 | /*! |
| 46 | * \class Qt3DExtras::QPlaneGeometryView |
| 47 | \ingroup qt3d-extras-geometries |
| 48 | * \inheaderfile Qt3DExtras/QPlaneGeometryView |
| 49 | * \inmodule Qt3DExtras |
| 50 | * |
| 51 | * \inherits Qt3DRender::QGeometryRenderer |
| 52 | * |
| 53 | * \brief A square planar mesh. |
| 54 | */ |
| 55 | |
| 56 | /*! |
| 57 | * Constructs a new QPlaneGeometryView with \a parent. |
| 58 | */ |
| 59 | QPlaneGeometryView::(QNode *parent) |
| 60 | : Qt3DCore::QGeometryView(parent) |
| 61 | { |
| 62 | QPlaneGeometry *geometry = new QPlaneGeometry(this); |
| 63 | QObject::connect(sender: geometry, signal: &QPlaneGeometry::widthChanged, context: this, slot: &QPlaneGeometryView::widthChanged); |
| 64 | QObject::connect(sender: geometry, signal: &QPlaneGeometry::heightChanged, context: this, slot: &QPlaneGeometryView::heightChanged); |
| 65 | QObject::connect(sender: geometry, signal: &QPlaneGeometry::resolutionChanged, context: this, slot: &QPlaneGeometryView::meshResolutionChanged); |
| 66 | QObject::connect(sender: geometry, signal: &QPlaneGeometry::mirroredChanged, context: this, slot: &QPlaneGeometryView::mirroredChanged); |
| 67 | QGeometryView::setGeometry(geometry); |
| 68 | } |
| 69 | |
| 70 | /*! \internal */ |
| 71 | QPlaneGeometryView::() |
| 72 | { |
| 73 | } |
| 74 | |
| 75 | void QPlaneGeometryView::(float width) |
| 76 | { |
| 77 | static_cast<QPlaneGeometry *>(geometry())->setWidth(width); |
| 78 | } |
| 79 | |
| 80 | /*! |
| 81 | * \property Qt3DExtras::QPlaneGeometryView::width |
| 82 | * |
| 83 | * Holds the plane width. |
| 84 | */ |
| 85 | float QPlaneGeometryView::() const |
| 86 | { |
| 87 | return static_cast<QPlaneGeometry *>(geometry())->width(); |
| 88 | } |
| 89 | |
| 90 | void QPlaneGeometryView::(float height) |
| 91 | { |
| 92 | static_cast<QPlaneGeometry *>(geometry())->setHeight(height); |
| 93 | } |
| 94 | |
| 95 | /*! |
| 96 | * \property Qt3DExtras::QPlaneGeometryView::height |
| 97 | * |
| 98 | * Holds the plane height. |
| 99 | */ |
| 100 | float QPlaneGeometryView::() const |
| 101 | { |
| 102 | return static_cast<QPlaneGeometry *>(geometry())->height(); |
| 103 | } |
| 104 | |
| 105 | void QPlaneGeometryView::(const QSize &resolution) |
| 106 | { |
| 107 | static_cast<QPlaneGeometry *>(geometry())->setResolution(resolution); |
| 108 | } |
| 109 | |
| 110 | /*! |
| 111 | * \property Qt3DExtras::QPlaneGeometryView::meshResolution |
| 112 | * |
| 113 | * Holds the plane resolution. |
| 114 | * The width and height values of this property specify the number of vertices generated for |
| 115 | * the mesh in the respective dimensions. |
| 116 | */ |
| 117 | QSize QPlaneGeometryView::() const |
| 118 | { |
| 119 | return static_cast<QPlaneGeometry *>(geometry())->resolution(); |
| 120 | } |
| 121 | |
| 122 | void QPlaneGeometryView::(bool mirrored) |
| 123 | { |
| 124 | static_cast<QPlaneGeometry *>(geometry())->setMirrored(mirrored); |
| 125 | } |
| 126 | |
| 127 | /*! |
| 128 | * \property Qt3DExtras::QPlaneGeometryView::mirrored |
| 129 | * |
| 130 | * Controls if the UV coordinates of the plane should be flipped vertically. |
| 131 | */ |
| 132 | bool QPlaneGeometryView::() const |
| 133 | { |
| 134 | return static_cast<QPlaneGeometry *>(geometry())->mirrored(); |
| 135 | } |
| 136 | |
| 137 | } // namespace Qt3DExtras |
| 138 | |
| 139 | QT_END_NAMESPACE |
| 140 | |
| 141 | #include "moc_qplanegeometryview.cpp" |
| 142 | |