| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef ENTITY_H |
| 5 |
#define ENTITY_H |
| 6 |
|
| 7 |
#include <Qt3DCore/QEntity> |
| 8 |
#include <QtGui/QColor> |
| 9 |
#include <QtGui/QVector3D> |
| 10 |
|
| 11 |
QT_BEGIN_NAMESPACE |
| 12 |
|
| 13 |
namespace Qt3DCore { |
| 14 |
class QTransform; |
| 15 |
} |
| 16 |
|
| 17 |
namespace Qt3DRender { |
| 18 |
class QEffect; |
| 19 |
class QGeometryRenderer; |
| 20 |
class QMaterial; |
| 21 |
class QParameter; |
| 22 |
} |
| 23 |
|
| 24 |
QT_END_NAMESPACE |
| 25 |
|
| 26 |
class Entity : public Qt3DCore::QEntity |
| 27 |
{ |
| 28 |
Q_OBJECT |
| 29 |
Q_PROPERTY(float theta READ theta WRITE setTheta NOTIFY thetaChanged) |
| 30 |
Q_PROPERTY(float phi READ phi WRITE setPhi NOTIFY phiChanged) |
| 31 |
Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged) |
| 32 |
Q_PROPERTY(QColor diffuseColor READ diffuseColor WRITE setDiffuseColor NOTIFY diffuseColorChanged) |
| 33 |
|
| 34 |
public: |
| 35 |
Entity(Qt3DRender::QEffect *effect, Qt3DCore::QNode *parent = 0); |
| 36 |
|
| 37 |
float theta() const; |
| 38 |
float phi() const; |
| 39 |
QVector3D position() const; |
| 40 |
QColor diffuseColor() const; |
| 41 |
|
| 42 |
public slots: |
| 43 |
void setTheta(float theta); |
| 44 |
void setPhi(float phi); |
| 45 |
void setPosition(QVector3D position); |
| 46 |
void setDiffuseColor(QColor diffuseColor); |
| 47 |
|
| 48 |
signals: |
| 49 |
void thetaChanged(float theta); |
| 50 |
void phiChanged(float phi); |
| 51 |
void positionChanged(QVector3D position); |
| 52 |
void diffuseColorChanged(QColor diffuseColor); |
| 53 |
|
| 54 |
private: |
| 55 |
void updateTransform(); |
| 56 |
|
| 57 |
private: |
| 58 |
Qt3DCore::QTransform *m_transform; |
| 59 |
Qt3DRender::QMaterial *m_material; |
| 60 |
Qt3DRender::QParameter *m_diffuseColorParam; |
| 61 |
float m_theta; |
| 62 |
float m_phi; |
| 63 |
QVector3D m_position; |
| 64 |
}; |
| 65 |
|
| 66 |
#endif |