diff options
-rw-r--r-- | src/render/frontend/qparameter.cpp | 45 | ||||
-rw-r--r-- | src/render/frontend/qparameter.h | 37 | ||||
-rw-r--r-- | src/render/frontend/qparameter_p.h | 7 | ||||
-rw-r--r-- | src/render/qt3drenderer_global_p.h | 49 | ||||
-rw-r--r-- | src/render/render.pro | 1 |
5 files changed, 69 insertions, 70 deletions
diff --git a/src/render/frontend/qparameter.cpp b/src/render/frontend/qparameter.cpp index 415c76aa8..2b4a23017 100644 --- a/src/render/frontend/qparameter.cpp +++ b/src/render/frontend/qparameter.cpp @@ -52,10 +52,15 @@ namespace Qt3D { QParameterPrivate::QParameterPrivate(QParameter *qq) : QNodePrivate(qq) - , m_type(QParameter::Undefined) + , m_isTexture(false) { } +void QParameterPrivate::setValue(const QVariant &v) +{ + m_value = v; +} + QParameter::QParameter(QParameterPrivate &dd, QNode *parent) : QNode(dd, parent) @@ -75,13 +80,12 @@ QParameter::QParameter(QNode *parent) { } -QParameter::QParameter(const QString &name, const QVariant &value, QNode *parent, QParameter::OpenGLTypes ty) +QParameter::QParameter(const QString &name, const QVariant &value, QNode *parent) : QNode(*new QParameterPrivate(this), parent) { Q_D(QParameter); d->m_name = name; - d->m_value = value; - d->m_type = ty; + setValue(value); } QParameter::QParameter(const QString &name, QTexture *texture, QNode *parent) @@ -89,8 +93,7 @@ QParameter::QParameter(const QString &name, QTexture *texture, QNode *parent) { Q_D(QParameter); d->m_name = name; - d->m_value = QVariant::fromValue(texture); - d->m_type = Undefined; + setValue(QVariant::fromValue(texture)); } void QParameter::copy(const QNode *ref) @@ -101,7 +104,7 @@ void QParameter::copy(const QNode *ref) if (param != Q_NULLPTR) { d->m_name = param->name(); d->m_value = param->value(); - d->m_type = param->d_func()->m_type; + d->m_isTexture = param->isTextureType(); } } @@ -124,12 +127,12 @@ void QParameter::setValue(const QVariant &dv) { Q_D(QParameter); if (d->m_value != dv) { - d->m_value = dv; + d->setValue(dv); emit valueChanged(); // In case texture are declared inline QTexture *txt = dv.value<QTexture *>(); - if (txt != Q_NULLPTR && (!txt->parent() || txt->parent() == this)) + if ((d->m_isTexture = (txt != Q_NULLPTR)) && (!txt->parent() || txt->parent() == this)) QNode::addChild(txt); QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, this)); @@ -145,33 +148,11 @@ QVariant QParameter::value() const return d->m_value; } -QParameter::OpenGLTypes QParameter::datatype() const -{ - Q_D(const QParameter); - return d->m_type; -} - -void QParameter::setDatatype(OpenGLTypes type) -{ - Q_D(QParameter); - if (d->m_type != type) { - d->m_type = type; - emit datatypeChanged(); - } -} bool QParameter::isTextureType() const { Q_D(const QParameter); - switch (d->m_type) { - case Sampler1D: - case Sampler2D: - case Sampler3D: - case SamplerCube: - return true; - default: - return false; - } + return d->m_isTexture; } } // Qt3D diff --git a/src/render/frontend/qparameter.h b/src/render/frontend/qparameter.h index 6aad668f7..75ca0db9e 100644 --- a/src/render/frontend/qparameter.h +++ b/src/render/frontend/qparameter.h @@ -55,43 +55,12 @@ class QTexture; class QT3DRENDERERSHARED_EXPORT QParameter : public QNode { Q_OBJECT - Q_ENUMS(OpenGLTypes) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(OpenGLTypes datatype READ datatype WRITE setDatatype NOTIFY datatypeChanged) Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) public: - - enum OpenGLTypes - { - Undefined = 0, - Sampler1D, - Sampler2D, - Sampler3D, - SamplerCube, - Bool, - BoolVec2, - BoolVec3, - BoolVec4, - Double, - DoubleVec2, - DoubleVec3, - DoubleVec4, - Float, - FloatVec2, - FloatVec3, - FloatVec4, - FloatMat2, - FloatMat3, - FloatMat4, - Int, - IntVec2, - IntVec3, - IntVec4 - }; - explicit QParameter(QNode *parent = 0); - QParameter(const QString& name, const QVariant& value, QNode* parent = 0, OpenGLTypes ty = Undefined); + QParameter(const QString& name, const QVariant& value, QNode* parent = 0); QParameter(const QString &name, QTexture *texture, QNode *parent = 0); void copy(const QNode *ref) Q_DECL_OVERRIDE; @@ -106,15 +75,11 @@ public: void setValue(const QVariant& dv); QVariant value() const; - OpenGLTypes datatype() const; - void setDatatype(OpenGLTypes type); - bool isTextureType() const; Q_SIGNALS: void valueChanged(); void nameChanged(); - void datatypeChanged(); protected: Q_DECLARE_PRIVATE(QParameter) diff --git a/src/render/frontend/qparameter_p.h b/src/render/frontend/qparameter_p.h index 1f022aa4d..c32f9018a 100644 --- a/src/render/frontend/qparameter_p.h +++ b/src/render/frontend/qparameter_p.h @@ -43,6 +43,7 @@ #define QT3D_QPARAMETER_P_H #include <private/qnode_p.h> +#include <private/qt3drenderer_global_p.h> QT_BEGIN_NAMESPACE @@ -50,17 +51,19 @@ namespace Qt3D { class QParameter; -class QParameterPrivate : public QNodePrivate +class QT3DRENDERERSHARED_PRIVATE_EXPORT QParameterPrivate : public QNodePrivate { public: QParameterPrivate(QParameter *qq); Q_DECLARE_PUBLIC(QParameter) + virtual void setValue(const QVariant &v); + QString m_name; - QParameter::OpenGLTypes m_type; QVariant m_value; QString m_meshName; + bool m_isTexture; }; } // Qt3D diff --git a/src/render/qt3drenderer_global_p.h b/src/render/qt3drenderer_global_p.h new file mode 100644 index 000000000..e323d6376 --- /dev/null +++ b/src/render/qt3drenderer_global_p.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DRENDERER_GLOBAL_P_H +#define QT3DRENDERER_GLOBAL_P_H + +#include "qt3drenderer_global.h" + +#define QT3DRENDERERSHARED_PRIVATE_EXPORT QT3DRENDERERSHARED_EXPORT + +#endif // QT3DRENDERER_GLOBAL_P_H diff --git a/src/render/render.pro b/src/render/render.pro index 9363247ec..15001e95c 100644 --- a/src/render/render.pro +++ b/src/render/render.pro @@ -30,6 +30,7 @@ gcov { HEADERS += $$PRIVATE_HEADERS \ qt3drenderer_global.h \ + qt3drenderer_global_p.h \ renderlogging.h !contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL |