46 #include <Qt3DRender/qeffect.h>
47 #include <Qt3DRender/qtechnique.h>
48 #include <Qt3DRender/qshaderprogram.h>
49 #include <Qt3DRender/qparameter.h>
50 #include <Qt3DRender/qrenderpass.h>
52 #include <Qt3DRender/qgraphicsapifilter.h>
62 using namespace DISP3DLIB;
63 using namespace Qt3DRender;
71 , m_pVertexEffect(new QEffect())
72 , m_pVertexGL3Technique(new QTechnique())
73 , m_pVertexGL3RenderPass(new QRenderPass())
74 , m_pVertexGL3Shader(new QShaderProgram())
75 , m_pFilterKey(new QFilterKey)
82 void ShowNormalsMaterial::init()
85 m_pVertexGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral(
"qrc:/engine/model/materials/shaders/gl3/shownormals.vert"))));
86 m_pVertexGL3Shader->setGeometryShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral(
"qrc:/engine/model/materials/shaders/gl3/shownormals.geom"))));
87 m_pVertexGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral(
"qrc:/engine/model/materials/shaders/gl3/shownormals.frag"))));
88 m_pVertexGL3RenderPass->setShaderProgram(m_pVertexGL3Shader);
91 m_pVertexGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
92 m_pVertexGL3Technique->graphicsApiFilter()->setMajorVersion(3);
93 m_pVertexGL3Technique->graphicsApiFilter()->setMinorVersion(2);
94 m_pVertexGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
96 m_pFilterKey->setName(QStringLiteral(
"renderingStyle"));
97 m_pFilterKey->setValue(QStringLiteral(
"forwardTransparent"));
98 m_pVertexGL3Technique->addFilterKey(m_pFilterKey);
100 m_pVertexGL3Technique->addRenderPass(m_pVertexGL3RenderPass);
102 m_pVertexEffect->addTechnique(m_pVertexGL3Technique);
104 this->setEffect(m_pVertexEffect);