IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QRenderStateSet Class

The QRenderStateSet FrameGraph node offers a way of specifying a set of QRenderState objects to be applied during the execution of a framegraph branch.

This class was introduced in Qt 5.5.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QRenderStateSet Class

  • Header: QRenderStateSet

  • Since: Qt 5.5

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS 3drender)

    target_link_libraries(mytarget PRIVATE Qt6::3drender)

  • qmake: QT += 3drender

  • Inherited By:

  • Instantiated By: qml-qt3d-render-renderstateset.xml

  • Inherits: Qt3DRender::QFrameGraphNode

Detailed Description

States set on a QRenderStateSet are set globally, contrary to the per-material states that can be set on a QRenderPass. By default, an empty QRenderStateSet will result in all render states being disabled when executed. Adding a QRenderState state explicitly enables that render state at runtime.

The RenderStateSet is enabled when added to the active frame graph:

 
Sélectionnez
// using namespace Qt3DRender;

Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();

QRenderSettings *renderSettings = new QRenderSettings();

QViewport *viewport = new QViewport();
QCameraSelector *cameraSelector = new QCameraSelector(viewport);

QClearBuffers *clearBuffers = new QClearBuffers(cameraSelector);
clearBuffers->setBuffers(QClearBuffers::ColorDepthBuffer);

QRenderStateSet *renderStateSet = new QRenderStateSet(cameraSelector);
QCullFace *cullFace = new QCullFace(renderStateSet);
cullFace->setMode(QCullFace::Front);
renderStateSet->addRenderState(cullFace);

renderSettings->setActiveFrameGraph(viewport);

rootEntity->addComponent(renderSettings);

See Also

Member Function Documentation

 

void QRenderStateSet::addRenderState(Qt3DRender::QRenderState *state)

Adds a new QRenderState state to the QRenderStateSet instance.

Not setting any QRenderState state on a QRenderStateSet instance implies all the render states will be disabled at render time.

void QRenderStateSet::removeRenderState(Qt3DRender::QRenderState *state)

Removes the QRenderState state from the QRenderStateSet instance.

QList<Qt3DRender::QRenderState *> QRenderStateSet::renderStates() const

Returns the list of QRenderState objects that compose the QRenderStateSet instance.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+