diff options
Diffstat (limited to 'examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc')
-rw-r--r-- | examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc index 1529649798..5d83b9fa5f 100644 --- a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc +++ b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc @@ -47,7 +47,7 @@ material state is what we assign to each individual node, in this case to give them different colors. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 1 + \snippet scenegraph/simplematerial/simplematerial.cpp 1 The first thing we do when creating custom materials with the simplified scheme is to create a state class. In this case the @@ -55,7 +55,7 @@ compare function which the scene graph can use to reorder the node rendering. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 2 + \snippet scenegraph/simplematerial/simplematerial.cpp 2 Next we define the material shader, by subclassing a template instantiation of \l QSGSimpleMaterialShader with our \c State. @@ -74,21 +74,21 @@ classes. Using the same \c State class in multiple shaders will will lead to undefined behavior. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 3 + \snippet scenegraph/simplematerial/simplematerial.cpp 3 Next comes the declaration of the shader source code, where we define a vertex and fragment shader. The simple material assumes the presence of \c qt_Matrix in the vertex shader and \c qt_Opacity in the fragment shader. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 4 + \snippet scenegraph/simplematerial/simplematerial.cpp 4 We reimplement the \c attributes function to return the name of the \c aVertex and \c aTexCoord attribute names. These attributes will be mapped to attribute indices 0 and 1 in the node's geometry. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 6 + \snippet scenegraph/simplematerial/simplematerial.cpp 6 Uniforms can be accessed either by name or by index, where index is faster than name, so we reimplement the \c resolveUniforms() @@ -96,7 +96,7 @@ to worry about resolving \c qt_Opacity or \c qt_Matrix as these are handled by the baseclass. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 5 + \snippet scenegraph/simplematerial/simplematerial.cpp 5 The \c updateState() function is called once for every unique state and we use it to update the shader program with the current @@ -105,7 +105,7 @@ usecase, where all the colors are different, the updateState will be called once for every node. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 7 + \snippet scenegraph/simplematerial/simplematerial.cpp 7 The \c ColorNode class is supposed to draw something, so it needs to be a subclass of \l QSGGeometryNode. @@ -129,12 +129,12 @@ Finally, we tell the node to take ownership of the material, so we do not have to explicitly memorymanage it. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 8 + \snippet scenegraph/simplematerial/simplematerial.cpp 8 Since the Item is providing its own graphics to the scene graph, we set the flag \l QQuickItem::ItemHasContents. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 9 + \snippet scenegraph/simplematerial/simplematerial.cpp 9 Whenever the Item has changed graphically, the \l QQuickItem::updatePaintNode() function is called. @@ -157,23 +157,23 @@ state. Finally, we notify the scene graph that the node has undergone changes to its geometry and material. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 11 + \snippet scenegraph/simplematerial/simplematerial.cpp 11 The \c main() function of the application adds the custom QML type using \l qmlRegisterType() and opens up a \l QQuickView with our QML file. - \snippet quick/scenegraph/simplematerial/main.qml 1 + \snippet scenegraph/simplematerial/main.qml 1 In the QML file, we import our custom type so we can instantiate it. - \snippet quick/scenegraph/simplematerial/main.qml 2 + \snippet scenegraph/simplematerial/main.qml 2 Then we create a column of three instances of our custom item, each with a different color. - \snippet quick/scenegraph/simplematerial/main.qml 3 + \snippet scenegraph/simplematerial/main.qml 3 And finally we overlay a short descriptive text. |