From 76d8f8a5d3a6229c49b072c5872cd99649210107 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 11 Jun 2013 20:47:54 +0200 Subject: Graph example Change-Id: I4a7b52f6e14182aed31354dc3860ef187e1899a4 Reviewed-by: Alan Alpert --- .../scenegraph/graph/doc/images/graph-example.jpg | Bin 0 -> 18923 bytes examples/quick/scenegraph/graph/doc/src/graph.qdoc | 38 ++++++ examples/quick/scenegraph/graph/graph.cpp | 128 +++++++++++++++++ examples/quick/scenegraph/graph/graph.h | 67 +++++++++ examples/quick/scenegraph/graph/graph.pro | 34 +++++ examples/quick/scenegraph/graph/graph.qrc | 9 ++ examples/quick/scenegraph/graph/gridnode.cpp | 95 +++++++++++++ examples/quick/scenegraph/graph/gridnode.h | 59 ++++++++ examples/quick/scenegraph/graph/linenode.cpp | 151 +++++++++++++++++++++ examples/quick/scenegraph/graph/linenode.h | 58 ++++++++ examples/quick/scenegraph/graph/main.cpp | 60 ++++++++ examples/quick/scenegraph/graph/main.qml | 85 ++++++++++++ examples/quick/scenegraph/graph/noisynode.cpp | 142 +++++++++++++++++++ examples/quick/scenegraph/graph/noisynode.h | 56 ++++++++ examples/quick/scenegraph/graph/shaders/line.fsh | 54 ++++++++ examples/quick/scenegraph/graph/shaders/line.vsh | 56 ++++++++ examples/quick/scenegraph/graph/shaders/noisy.fsh | 55 ++++++++ examples/quick/scenegraph/graph/shaders/noisy.vsh | 54 ++++++++ 18 files changed, 1201 insertions(+) create mode 100644 examples/quick/scenegraph/graph/doc/images/graph-example.jpg create mode 100644 examples/quick/scenegraph/graph/doc/src/graph.qdoc create mode 100644 examples/quick/scenegraph/graph/graph.cpp create mode 100644 examples/quick/scenegraph/graph/graph.h create mode 100644 examples/quick/scenegraph/graph/graph.pro create mode 100644 examples/quick/scenegraph/graph/graph.qrc create mode 100644 examples/quick/scenegraph/graph/gridnode.cpp create mode 100644 examples/quick/scenegraph/graph/gridnode.h create mode 100644 examples/quick/scenegraph/graph/linenode.cpp create mode 100644 examples/quick/scenegraph/graph/linenode.h create mode 100644 examples/quick/scenegraph/graph/main.cpp create mode 100644 examples/quick/scenegraph/graph/main.qml create mode 100644 examples/quick/scenegraph/graph/noisynode.cpp create mode 100644 examples/quick/scenegraph/graph/noisynode.h create mode 100644 examples/quick/scenegraph/graph/shaders/line.fsh create mode 100644 examples/quick/scenegraph/graph/shaders/line.vsh create mode 100644 examples/quick/scenegraph/graph/shaders/noisy.fsh create mode 100644 examples/quick/scenegraph/graph/shaders/noisy.vsh (limited to 'examples/quick/scenegraph') diff --git a/examples/quick/scenegraph/graph/doc/images/graph-example.jpg b/examples/quick/scenegraph/graph/doc/images/graph-example.jpg new file mode 100644 index 0000000000..74975ee7c4 Binary files /dev/null and b/examples/quick/scenegraph/graph/doc/images/graph-example.jpg differ diff --git a/examples/quick/scenegraph/graph/doc/src/graph.qdoc b/examples/quick/scenegraph/graph/doc/src/graph.qdoc new file mode 100644 index 0000000000..d5a07cdc48 --- /dev/null +++ b/examples/quick/scenegraph/graph/doc/src/graph.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example scenegraph/graph + \title Scene Graph - Graph + \ingroup qtquickexamples + + \brief Demonstrates how one can combine custom materials and geometries + under a single QQuickItem. + + \image graph-example.jpg + + */ diff --git a/examples/quick/scenegraph/graph/graph.cpp b/examples/quick/scenegraph/graph/graph.cpp new file mode 100644 index 0000000000..ad75307e57 --- /dev/null +++ b/examples/quick/scenegraph/graph/graph.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "graph.h" + +#include "noisynode.h" +#include "gridnode.h" +#include "linenode.h" + +Graph::Graph() + : m_samplesChanged(false) + , m_geometryChanged(false) +{ + setFlag(ItemHasContents, true); +} + + +void Graph::appendSample(qreal value) +{ + m_samples << value; + m_samplesChanged = true; + update(); +} + + +void Graph::removeFirstSample() +{ + m_samples.removeFirst(); + m_samplesChanged = true; + update(); +} + +void Graph::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + m_geometryChanged = true; + update(); + QQuickItem::geometryChanged(newGeometry, oldGeometry); +} + + +class GraphNode : public QSGNode +{ +public: + NoisyNode *background; + GridNode *grid; + LineNode *line; + LineNode *shadow; +}; + + +QSGNode *Graph::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) +{ + GraphNode *n= static_cast(oldNode); + + QRectF rect = boundingRect(); + + if (rect.isEmpty()) { + delete n; + return 0; + } + + if (!n) { + n = new GraphNode(); + + n->background = new NoisyNode(window()); + n->grid = new GridNode(); + n->line = new LineNode(10, 0.5, QColor("steelblue")); + n->shadow = new LineNode(20, 0.2, QColor::fromRgbF(0.2, 0.2, 0.2, 0.4)); + + n->appendChildNode(n->background); + n->appendChildNode(n->grid); + n->appendChildNode(n->shadow); + n->appendChildNode(n->line); + } + + if (m_geometryChanged) { + n->background->setRect(rect); + n->grid->setRect(rect); + } + + if (m_geometryChanged || m_samplesChanged) { + n->line->updateGeometry(rect, m_samples); + // We don't need to calculate the geometry twice, so just steal it from the other one... + n->shadow->setGeometry(n->line->geometry()); + } + + m_geometryChanged = false; + m_samplesChanged = false; + + return n; +} diff --git a/examples/quick/scenegraph/graph/graph.h b/examples/quick/scenegraph/graph/graph.h new file mode 100644 index 0000000000..28d14f166a --- /dev/null +++ b/examples/quick/scenegraph/graph/graph.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GRAPH_H +#define GRAPH_H + +#include + +class Graph : public QQuickItem +{ + Q_OBJECT +public: + Graph(); + +protected: + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + +public slots: + void appendSample(qreal value); + void removeFirstSample(); + +private: + QList m_samples; + + bool m_samplesChanged; + bool m_geometryChanged; +}; + +#endif // GRAPH_H diff --git a/examples/quick/scenegraph/graph/graph.pro b/examples/quick/scenegraph/graph/graph.pro new file mode 100644 index 0000000000..5991f799dc --- /dev/null +++ b/examples/quick/scenegraph/graph/graph.pro @@ -0,0 +1,34 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2013-06-11T13:13:18 +# +#------------------------------------------------- + +QT += core gui quick + +TARGET = graph + +TEMPLATE = app + +SOURCES += main.cpp \ + graph.cpp \ + noisynode.cpp \ + gridnode.cpp \ + linenode.cpp + +HEADERS += \ + graph.h \ + noisynode.h \ + gridnode.h \ + linenode.h + +RESOURCES += \ + graph.qrc + +OTHER_FILES += \ + main.qml \ + shaders/noisy.vsh \ + shaders/noisy.fsh \ + shaders/line.fsh \ + shaders/line.vsh + diff --git a/examples/quick/scenegraph/graph/graph.qrc b/examples/quick/scenegraph/graph/graph.qrc new file mode 100644 index 0000000000..2adaeac751 --- /dev/null +++ b/examples/quick/scenegraph/graph/graph.qrc @@ -0,0 +1,9 @@ + + + main.qml + shaders/noisy.vsh + shaders/noisy.fsh + shaders/line.vsh + shaders/line.fsh + + diff --git a/examples/quick/scenegraph/graph/gridnode.cpp b/examples/quick/scenegraph/graph/gridnode.cpp new file mode 100644 index 0000000000..2b5e8cac16 --- /dev/null +++ b/examples/quick/scenegraph/graph/gridnode.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "gridnode.h" + +#include "qmath.h" + +#define GRID_SIZE 32 + +GridNode::GridNode() + : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 0) +{ + setGeometry(&m_geometry); + m_geometry.setDrawingMode(GL_LINES); + + setMaterial(&m_material); + m_material.setColor(Qt::gray); +} + +/* + * The function hardcodes a fixed set of grid lines and scales + * those to the bounding rect. + */ +void GridNode::setRect(const QRectF &rect) +{ + int vCount = int((rect.width() - 1) / GRID_SIZE); + int hCount = int((rect.height() - 1) / GRID_SIZE); + + int lineCount = vCount + hCount; + + QSGGeometry *g = geometry(); + + g->allocate(lineCount * 2); + + float x = rect.x(); + float y = rect.y(); + float w = rect.width(); + float h = rect.height(); + + QSGGeometry::Point2D *v = g->vertexDataAsPoint2D(); + + // Then write the vertical lines + for (int i=0; i +#include + +class GridNode : public QSGGeometryNode +{ +public: + GridNode(); + + void setRect(const QRectF &rect); + +private: + QSGFlatColorMaterial m_material; + QSGGeometry m_geometry; +}; + +#endif // GRIDNODE_H diff --git a/examples/quick/scenegraph/graph/linenode.cpp b/examples/quick/scenegraph/graph/linenode.cpp new file mode 100644 index 0000000000..0d1229cf1d --- /dev/null +++ b/examples/quick/scenegraph/graph/linenode.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "linenode.h" + +#include + +#include + +#include + +struct LineMaterial +{ + QColor color; + float spread; + float size; +}; + +class LineShader : public QSGSimpleMaterialShader +{ + QSG_DECLARE_SIMPLE_SHADER(LineShader, LineMaterial) + +public: + const char *vertexShader() const { + QResource r(":/scenegraph/graph/shaders/line.vsh"); + Q_ASSERT(r.isValid()); + return (const char *) r.data(); + } + + const char *fragmentShader() const { + QResource r(":/scenegraph/graph/shaders/line.fsh"); + Q_ASSERT(r.isValid()); + return (const char *) r.data(); + } + + QList attributes() const { return QList() << "pos" << "t"; } + + void updateState(const LineMaterial *m, const LineMaterial *) { + program()->setUniformValue(id_color, m->color); + program()->setUniformValue(id_spread, m->spread); + program()->setUniformValue(id_size, m->size); + } + + void resolveUniforms() { + id_spread = program()->uniformLocation("spread"); + id_size = program()->uniformLocation("size"); + id_color = program()->uniformLocation("color"); + } + +private: + int id_color; + int id_spread; + int id_size; +}; + +struct LineVertex { + float x; + float y; + float t; + inline void set(float xx, float yy, float tt) { x = xx; y = yy; t = tt; } +}; + +static const QSGGeometry::AttributeSet &attributes() +{ + static QSGGeometry::Attribute attr[] = { + QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true), + QSGGeometry::Attribute::create(1, 1, GL_FLOAT) + }; + static QSGGeometry::AttributeSet set = { 2, 3 * sizeof(float), attr }; + return set; +} + +LineNode::LineNode(float size, float spread, const QColor &color) + : m_geometry(attributes(), 0) +{ + setGeometry(&m_geometry); + m_geometry.setDrawingMode(GL_TRIANGLE_STRIP); + + QSGSimpleMaterial *m = LineShader::createMaterial(); + m->state()->color = color; + m->state()->size = size; + m->state()->spread = spread; + m->setFlag(QSGMaterial::Blending); + setMaterial(m); + setFlag(OwnsMaterial); +} + +/* + * Assumes that samples have values in the range of 0 to 1 and scales them to + * the height of bounds. The samples are stretched out horizontally along the + * width of the bounds. + * + * The position of each pair of points is identical, but we use the third value + * "t" to shift the point up or down and to add antialiasing. + */ +void LineNode::updateGeometry(const QRectF &bounds, const QList &samples) +{ + m_geometry.allocate(samples.size() * 2); + + float x = bounds.x(); + float y = bounds.y(); + float w = bounds.width(); + float h = bounds.height(); + + float dx = w / (samples.size() - 1); + + LineVertex *v = (LineVertex *) m_geometry.vertexData(); + for (int i=0; i + +class LineNode : public QSGGeometryNode +{ +public: + LineNode(float size, float spread, const QColor &color); + + void updateGeometry(const QRectF &bounds, const QList &samples); + +private: + QSGGeometry m_geometry; + +}; + +#endif // LINENODE_H diff --git a/examples/quick/scenegraph/graph/main.cpp b/examples/quick/scenegraph/graph/main.cpp new file mode 100644 index 0000000000..ed54ae59b1 --- /dev/null +++ b/examples/quick/scenegraph/graph/main.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "graph.h" +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication a(argc, argv); + + qmlRegisterType("Graph", 1, 0, "Graph"); + + QQuickView view; + view.resize(800, 400); + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl("qrc:///scenegraph/graph/main.qml")); + view.show(); + + return a.exec(); +} diff --git a/examples/quick/scenegraph/graph/main.qml b/examples/quick/scenegraph/graph/main.qml new file mode 100644 index 0000000000..ad952bcf1a --- /dev/null +++ b/examples/quick/scenegraph/graph/main.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +import Graph 1.0 + +Item { + width: 800 + height: 400 + + Graph { + id: graph + anchors.fill: parent + anchors.margins: 100 + + function newSample(i) { + return (Math.sin(i / 100.0 * Math.PI * 2) + 1) * 0.4 + Math.random() * 0.05; + } + + Component.onCompleted: { + for (var i=0; i<100; ++i) + appendSample(newSample(i)); + } + + property int offset: 100; + } + + Timer { + id: timer + interval: 500 + repeat: true + running: true + onTriggered: { + graph.removeFirstSample(); + graph.appendSample(graph.newSample(++graph.offset)); + } + + } + + Rectangle { + anchors.fill: graph + color: "transparent" + border.color: "black" + border.width: 2 + } + +} diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp new file mode 100644 index 0000000000..1fc87a2b97 --- /dev/null +++ b/examples/quick/scenegraph/graph/noisynode.cpp @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "noisynode.h" + +#include + +#include +#include +#include + +#define NOISE_SIZE 64 + +struct NoisyMaterial +{ + ~NoisyMaterial() { + delete texture; + } + + QColor color; + QSGTexture *texture; +}; + +class NoisyShader : public QSGSimpleMaterialShader +{ + 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(); + } + + QList attributes() const { return QList() << "aVertex" << "aTexCoord"; } + + void updateState(const NoisyMaterial *m, const NoisyMaterial *) { + + // Set the color + program()->setUniformValue(id_color, m->color); + + // Bind the texture and set program to use texture unit 0 (the default) + m->texture->bind(); + + // Then set the texture size so we can adjust the texture coordinates accordingly in the + // vertex shader.. + QSize s = m->texture->textureSize(); + program()->setUniformValue(id_textureSize, QSizeF(1.0 / s.width(), 1.0 / s.height())); + } + + void resolveUniforms() { + id_texture = program()->uniformLocation("texture"); + id_textureSize = program()->uniformLocation("textureSize"); + id_color = program()->uniformLocation("color"); + + // We will only use texture unit 0, so set it only once. + program()->setUniformValue(id_texture, 0); + } + +private: + int id_color; + int id_texture; + int id_textureSize; +}; + +NoisyNode::NoisyNode(QQuickWindow *window) +{ + // Make some noise... + QImage image(NOISE_SIZE, NOISE_SIZE, QImage::Format_RGB32); + uint *data = (uint *) image.bits(); + for (int i=0; icreateTextureFromImage(image); + t->setFiltering(QSGTexture::Nearest); + t->setHorizontalWrapMode(QSGTexture::Repeat); + t->setVerticalWrapMode(QSGTexture::Repeat); + + QSGSimpleMaterial *m = NoisyShader::createMaterial(); + m->state()->texture = t; + m->state()->color = QColor::fromRgbF(0.95, 0.95, 0.97); + m->setFlag(QSGMaterial::Blending); + + setMaterial(m); + setFlag(OwnsMaterial, true); + + QSGGeometry *g = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4); + QSGGeometry::updateTexturedRectGeometry(g, QRect(), QRect()); + setGeometry(g); + setFlag(OwnsGeometry, true); +} + +void NoisyNode::setRect(const QRectF &bounds) +{ + QSGGeometry::updateTexturedRectGeometry(geometry(), bounds, QRectF(0, 0, 1, 1)); + markDirty(QSGNode::DirtyGeometry); +} diff --git a/examples/quick/scenegraph/graph/noisynode.h b/examples/quick/scenegraph/graph/noisynode.h new file mode 100644 index 0000000000..b5a291330f --- /dev/null +++ b/examples/quick/scenegraph/graph/noisynode.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef NOISYNODE_H +#define NOISYNODE_H + +#include + +class QQuickWindow; + +class NoisyNode : public QSGGeometryNode +{ +public: + NoisyNode(QQuickWindow *window); + + void setRect(const QRectF &bounds); +}; + +#endif // NOISYNODE_H diff --git a/examples/quick/scenegraph/graph/shaders/line.fsh b/examples/quick/scenegraph/graph/shaders/line.fsh new file mode 100644 index 0000000000..b07558c2ab --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/line.fsh @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +uniform lowp vec4 color; +uniform lowp float qt_Opacity; +uniform lowp float spread; + +varying lowp float vT; + +#define PI 3.14159265359 + +void main(void) +{ + lowp float tt = smoothstep(spread, 1.0, sin(vT * PI)); + + gl_FragColor = color * qt_Opacity * tt; +} diff --git a/examples/quick/scenegraph/graph/shaders/line.vsh b/examples/quick/scenegraph/graph/shaders/line.vsh new file mode 100644 index 0000000000..84353b852c --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/line.vsh @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +attribute highp vec4 pos; +attribute highp float t; + +uniform lowp float size; +uniform highp mat4 qt_Matrix; + +varying lowp float vT; + +void main(void) +{ + vec4 adjustedPos = pos; + adjustedPos.y += (t * size); + gl_Position = qt_Matrix * adjustedPos; + + vT = t; +} diff --git a/examples/quick/scenegraph/graph/shaders/noisy.fsh b/examples/quick/scenegraph/graph/shaders/noisy.fsh new file mode 100644 index 0000000000..227c2b5974 --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/noisy.fsh @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +uniform sampler2D texture; +uniform lowp float qt_Opacity; +uniform lowp vec4 color; + +varying highp vec2 vTexCoord; +varying lowp vec2 vShadeCoord; + +#define PI 3.14159265359 + +void main() +{ + lowp float shade = texture2D(texture, vTexCoord).r * 0.05 - length(vec2(0.5, 0.4) - vShadeCoord) * 0.3; + lowp vec4 c = vec4(color.xyz + shade, color.w); + gl_FragColor = c * qt_Opacity; +} diff --git a/examples/quick/scenegraph/graph/shaders/noisy.vsh b/examples/quick/scenegraph/graph/shaders/noisy.vsh new file mode 100644 index 0000000000..ce648e51b9 --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/noisy.vsh @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +attribute highp vec4 aVertex; +attribute highp vec2 aTexCoord; + +uniform highp mat4 qt_Matrix; +uniform highp vec2 textureSize; + +varying highp vec2 vTexCoord; +varying lowp vec2 vShadeCoord; + +void main() { + gl_Position = qt_Matrix * aVertex; + vTexCoord = aVertex.xy * textureSize; + vShadeCoord = aTexCoord; +} -- cgit v1.2.3