QGIS API Documentation 3.43.0-Master (5df50c54ce9)
qgsdepthentity.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsdepthentity.cpp
3 --------------------------------------
4 Date : June 2024
5 Copyright : (C) 2024 by Benoit De Mezzo
6 Email : benoit dot de dot mezzo at oslandia dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgsdepthentity.h"
17#include "moc_qgsdepthentity.cpp"
18
19#include <Qt3DRender/QParameter>
20#include <QUrl>
21
22#include "qgsframegraph.h"
24
25QgsDepthEntity::QgsDepthEntity( Qt3DRender::QTexture2D *texture, Qt3DRender::QLayer *layer, QNode *parent )
26 : QgsRenderPassQuad( layer, parent )
27{
28 setObjectName( "depthRenderQuad" );
29
30 // construct material
31 Qt3DRender::QParameter *textureParameter = new Qt3DRender::QParameter( "depthTexture", texture );
32 mMaterial->addParameter( textureParameter );
33
34 const QString vertexShaderPath = QStringLiteral( "qrc:/shaders/depth_render.vert" );
35 const QString fragmentShaderPath = QStringLiteral( "qrc:/shaders/depth_render.frag" );
36
37 mShader->setVertexShaderCode( Qt3DRender::QShaderProgram::loadSource( QUrl( vertexShaderPath ) ) );
38 mShader->setFragmentShaderCode( Qt3DRender::QShaderProgram::loadSource( QUrl( fragmentShaderPath ) ) );
39}
QgsDepthEntity(Qt3DRender::QTexture2D *texture, Qt3DRender::QLayer *layer, QNode *parent=nullptr)
Constructor.
An entity that is responsible for rendering a screen quad for a specific rendering pass.
Qt3DRender::QShaderProgram * mShader
Qt3DRender::QMaterial * mMaterial