#include "linenode.h"
-#include <QtCore/QResource>
-
#include <QtGui/QColor>
#include <QtQuick/QSGSimpleMaterial>
QSG_DECLARE_SIMPLE_SHADER(LineShader, LineMaterial)
public:
- LineShader()
- : vsh(readResource(":/scenegraph/graph/shaders/line.vsh")),
- fsh(readResource(":/scenegraph/graph/shaders/line.fsh"))
- {}
-
- const char *vertexShader() const { return vsh.constData(); }
-
- const char *fragmentShader() const { return fsh.constData(); }
+ LineShader() {
+ setShaderSourceFile(QOpenGLShader::Vertex, ":/scenegraph/graph/shaders/line.vsh");
+ setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/line.fsh");
+ }
QList<QByteArray> attributes() const { return QList<QByteArray>() << "pos" << "t"; }
id_color = program()->uniformLocation("color");
}
- static QByteArray readResource(const char *path) {
- QResource r(path);
- Q_ASSERT(r.isValid());
- return QByteArray((const char *)r.data(), r.size());
- }
-
private:
- QByteArray vsh;
- QByteArray fsh;
int id_color;
int id_spread;
int id_size;
#include "noisynode.h"
-#include <QtCore/QResource>
-
#include <QtQuick/QSGSimpleMaterialShader>
#include <QtQuick/QSGTexture>
#include <QtQuick/QQuickWindow>
QSG_DECLARE_SIMPLE_SHADER(NoisyShader, NoisyMaterial)
public:
- const char *vertexShader() const {
- QResource r(":/scenegraph/graph/shaders/noisy.vsh");
- Q_ASSERT(r.isValid());
- return (const char *) r.data();
- }
-
- const char *fragmentShader() const {
- QResource r(":/scenegraph/graph/shaders/noisy.fsh");
- Q_ASSERT(r.isValid());
- return (const char *) r.data();
+ NoisyShader() {
+ setShaderSourceFile(QOpenGLShader::Vertex, ":/scenegraph/graph/shaders/noisy.vsh");
+ setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/noisy.fsh");
}
QList<QByteArray> attributes() const { return QList<QByteArray>() << "aVertex" << "aTexCoord"; }
#define NOISYNODE_H
#include <QSGGeometryNode>
-
-class QQuickWindow;
+#include <QQuickWindow>
class NoisyNode : public QSGGeometryNode
{