diff options
author | Svenn-Arne Dragly <svenn-arne.dragly@qt.io> | 2017-12-07 19:15:38 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2018-01-25 06:27:43 +0000 |
commit | e680fe041700296be5e6e4a132e2cfc6f54d4e77 (patch) | |
tree | c6d394a88c84779e26f1467e45245270363657ad /src | |
parent | 1d449ab5027abe297b01aa5f276d21dcb57af94c (diff) |
Doc: Add examples and enumeration to QCullFace documentation
Change-Id: I0196e0305d205b7499c77644c0fdd42eb671a309
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/render/renderstates/qcullface.cpp | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/src/render/renderstates/qcullface.cpp b/src/render/renderstates/qcullface.cpp index e96346287..4be395464 100644 --- a/src/render/renderstates/qcullface.cpp +++ b/src/render/renderstates/qcullface.cpp @@ -50,7 +50,7 @@ namespace Qt3DRender { /*! \class Qt3DRender::QCullFace \brief The QCullFace class specifies whether front or back face culling - are enabled + is enabled. \since 5.7 \inmodule Qt3DRender \ingroup renderstates @@ -58,13 +58,43 @@ namespace Qt3DRender { QCullFace sets whether the front or back facets are culled. Facets include triangles, quadrilaterals, polygons and rectangles. + It can be added by calling the addRenderState() method on a QRenderPass: + + \code + // using namespace Qt3DRender; + + QRenderPass *renderPass = new QRenderPass(); + + // Create a front face culling render state + QCullFace *cullFront = new QCullFace(); + cullFront->setMode(QCullFace::Front); + + // Add the render state to the render pass + renderPass->addRenderState(cullFront); + \endcode + + Or by calling the addRenderState() method on a QRenderStateSet: + + \code + // using namespace Qt3DRender; + + QRenderStateSet *renderStateSet = new QRenderStateSet(); + + // Create a front face culling render state + QCullFace *cullFront = new QCullFace(); + cullFront->setMode(QCullFace::Front); + + // Add the render state to the render pass + renderStateSet->addRenderState(cullFront); + \endcode + \sa QFrontFace */ /*! \qmltype CullFace \brief The CullFace type specifies whether front or back face culling - are enabled + is enabled. \since 5.7 \inqmlmodule Qt3D.Render \instantiates Qt3DRender::QCullFace @@ -74,6 +104,33 @@ namespace Qt3DRender { CullFace sets whether the front or back facets are culled. Facets include triangles, quadrilaterals, polygons and rectangles. + It can be added to the renderStates property of a RenderPass: + + \qml + RenderPass { + shaderProgram: ShaderProgram { + // ... + } + renderStates: [ + CullFace { + mode: CullFace.Front + } + ] + } + \endqml + + Or added to the renderStates property of a RenderStateSet: + + \qml + RenderStateSet { + renderStates: [ + CullFace { + mode: CullFace.Front + } + ] + } + \endqml + \sa FrontFace */ @@ -81,15 +138,23 @@ namespace Qt3DRender { \enum Qt3DRender::QCullFace::CullingMode This enumeration specifies values for the culling mode. - \value NoCulling culling is disabled + + \value NoCulling Culling is disabled \value Front Culling is enabled for front facing polygons \value Back Culling is enabled for back facing polygons - \value FrontAndBack Culling is enabled for all polygons, points and lines are drawn. + \value FrontAndBack Culling is enabled for all polygons, points and lines are drawn */ /*! \qmlproperty enumeration CullFace::mode Holds the culling mode used by CullFace. Default is set to QCullFace.Back. + + \list + \li CullFace.NoCulling - culling is disabled + \li CullFace.Front - culling is enabled for front facing polygons + \li CullFace.Back - culling is enabled for back facing polygons + \li CullFace.FrontAndBack - culling is enabled for all polygons, but points and lines are drawn + \endlist */ /*! |