summaryrefslogtreecommitdiffstats
path: root/src/render/frontend/qshaderprogram.h
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2014-07-08 17:17:52 +0200
committerSean Harmer <sean.harmer@kdab.com>2014-07-09 16:01:17 +0200
commit54e8e8714fdadb5b98a33ca5026049818ea49c45 (patch)
tree943a122f27fe3702710198203fc27c800c506508 /src/render/frontend/qshaderprogram.h
parent527c58e8f06a44ba12868ebeecc3bc4286462bc8 (diff)
Renamed ShaderProgram to QShaderProgram
Change-Id: I7a9fd824f1975791ee7448023d089e06c34de69d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/frontend/qshaderprogram.h')
-rw-r--r--src/render/frontend/qshaderprogram.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/src/render/frontend/qshaderprogram.h b/src/render/frontend/qshaderprogram.h
new file mode 100644
index 000000000..c995133f6
--- /dev/null
+++ b/src/render/frontend/qshaderprogram.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** 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 QT3D_QSHADERPROGRAM_H
+#define QT3D_QSHADERPROGRAM_H
+
+#include <QUuid>
+#include <Qt3DCore/qabstractshader.h>
+#include <Qt3DRenderer/qt3drenderer_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+class QT3DRENDERERSHARED_EXPORT QShaderProgram : public QAbstractShader
+{
+ Q_OBJECT
+ Q_PROPERTY(QString vertexSourceFile READ vertexSourceFile WRITE setVertexSourceFile NOTIFY vertexSourceFileChanged)
+ Q_PROPERTY(QString fragmentSourceFile READ fragmentSourceFile WRITE setFragmentSourceFile NOTIFY fragmentSourceFileChanged)
+ Q_PROPERTY(QByteArray vertexShader READ vertexSourceCode WRITE setVertexShader NOTIFY vertexShaderChanged)
+ Q_PROPERTY(QByteArray fragmentShader READ fragmentSourceCode WRITE setFragmentShader NOTIFY fragmentShaderChanged)
+
+public:
+ explicit QShaderProgram(QNode *parent = 0);
+
+ void setVertexSourceFile(const QString &vertexSourceFile);
+ QString vertexSourceFile() const;
+
+ void setFragmentSourceFile(const QString &fragmentSource);
+ QString fragmentSourceFile() const;
+
+ void setVertexShader(const QByteArray &vertexShader);
+ void setFragmentShader(const QByteArray &fragmentShader);
+
+ QByteArray vertexSourceCode() const;
+ QByteArray fragmentSourceCode() const;
+
+ bool isLoaded() const;
+
+ /**
+ * @brief load - call from main / worker thread to do synchronous
+ * loading of shader source files
+ */
+ void load();
+
+Q_SIGNALS:
+ void vertexSourceFileChanged();
+ void fragmentSourceFileChanged();
+ void vertexShaderChanged();
+ void fragmentShaderChanged();
+
+private:
+ QString m_vertexSourceFile;
+ QString m_fragmentSourceFile;
+
+ bool m_sourcesDirty, m_isLoaded;
+ QByteArray m_cachedVertexCode,
+ m_cachedFragmentCode;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QT3D_QSHADERPROGRAM_H