QGIS API Documentation 3.99.0-Master (e9821da5c6b)
Loading...
Searching...
No Matches
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
19#include "qgsframegraph.h"
20
21#include <QString>
22#include <QUrl>
23#include <Qt3DRender/QParameter>
24
25#include "moc_qgsdepthentity.cpp"
26
27using namespace Qt::StringLiterals;
28
29QgsDepthEntity::QgsDepthEntity( Qt3DRender::QTexture2D *texture, Qt3DRender::QLayer *layer, QNode *parent )
30 : QgsRenderPassQuad( layer, parent )
31{
32 setObjectName( "depthRenderQuad" );
33
34 // construct material
35 Qt3DRender::QParameter *textureParameter = new Qt3DRender::QParameter( "depthTexture", texture );
36 mMaterial->addParameter( textureParameter );
37
38 const QString vertexShaderPath = u"qrc:/shaders/depth_render.vert"_s;
39 const QString fragmentShaderPath = u"qrc:/shaders/depth_render.frag"_s;
40
41 mShader->setVertexShaderCode( Qt3DRender::QShaderProgram::loadSource( QUrl( vertexShaderPath ) ) );
42 mShader->setFragmentShaderCode( Qt3DRender::QShaderProgram::loadSource( QUrl( fragmentShaderPath ) ) );
43}
QgsDepthEntity(Qt3DRender::QTexture2D *texture, Qt3DRender::QLayer *layer, QNode *parent=nullptr)
Constructor.
QgsRenderPassQuad(Qt3DRender::QLayer *layer, QNode *parent=nullptr)
Constructor.
Qt3DRender::QShaderProgram * mShader
Qt3DRender::QMaterial * mMaterial