2022-06-08 12:47:24 +00:00
|
|
|
// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2014-05-05 09:04:06 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
#ifndef ENTITY_H
|
|
|
|
#define ENTITY_H
|
2015-11-03 07:32:21 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
#include <Qt3DCore/QEntity>
|
|
|
|
#include <QtGui/QColor>
|
|
|
|
#include <QtGui/QVector3D>
|
2014-05-05 09:04:06 +00:00
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
2015-10-12 19:45:19 +00:00
|
|
|
namespace Qt3DCore {
|
2014-07-04 08:48:23 +00:00
|
|
|
class QTransform;
|
2015-11-07 19:02:14 +00:00
|
|
|
}
|
|
|
|
|
2017-09-10 10:49:46 +00:00
|
|
|
namespace Qt3DRender {
|
2017-09-10 11:17:32 +00:00
|
|
|
class QEffect;
|
2017-09-10 10:49:46 +00:00
|
|
|
class QGeometryRenderer;
|
2017-09-10 11:17:32 +00:00
|
|
|
class QMaterial;
|
|
|
|
class QParameter;
|
2015-11-07 19:02:14 +00:00
|
|
|
}
|
2014-06-02 07:08:10 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
QT_END_NAMESPACE
|
2014-05-05 09:04:06 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
class Entity : public Qt3DCore::QEntity
|
2014-05-05 09:04:06 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2015-11-07 19:02:14 +00:00
|
|
|
Q_PROPERTY(float theta READ theta WRITE setTheta NOTIFY thetaChanged)
|
|
|
|
Q_PROPERTY(float phi READ phi WRITE setPhi NOTIFY phiChanged)
|
|
|
|
Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
|
|
|
|
Q_PROPERTY(QColor diffuseColor READ diffuseColor WRITE setDiffuseColor NOTIFY diffuseColorChanged)
|
|
|
|
|
2014-05-05 09:04:06 +00:00
|
|
|
public:
|
2017-09-10 11:17:32 +00:00
|
|
|
Entity(Qt3DRender::QEffect *effect, Qt3DCore::QNode *parent = 0);
|
2014-05-05 09:04:06 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
float theta() const;
|
|
|
|
float phi() const;
|
|
|
|
QVector3D position() const;
|
|
|
|
QColor diffuseColor() const;
|
2014-06-02 07:08:10 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
public slots:
|
|
|
|
void setTheta(float theta);
|
|
|
|
void setPhi(float phi);
|
|
|
|
void setPosition(QVector3D position);
|
|
|
|
void setDiffuseColor(QColor diffuseColor);
|
2014-05-05 09:04:06 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
signals:
|
|
|
|
void thetaChanged(float theta);
|
|
|
|
void phiChanged(float phi);
|
|
|
|
void positionChanged(QVector3D position);
|
|
|
|
void diffuseColorChanged(QColor diffuseColor);
|
2014-05-05 09:04:06 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
private:
|
|
|
|
void updateTransform();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Qt3DCore::QTransform *m_transform;
|
2017-09-10 11:17:32 +00:00
|
|
|
Qt3DRender::QMaterial *m_material;
|
|
|
|
Qt3DRender::QParameter *m_diffuseColorParam;
|
2015-11-07 19:02:14 +00:00
|
|
|
float m_theta;
|
|
|
|
float m_phi;
|
|
|
|
QVector3D m_position;
|
|
|
|
};
|
2014-05-05 09:04:06 +00:00
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
#endif // ENTITY_H
|