47 #include <Qt3DRender/qeffect.h>
48 #include <Qt3DRender/qtechnique.h>
49 #include <Qt3DRender/qshaderprogram.h>
50 #include <Qt3DRender/qparameter.h>
51 #include <Qt3DRender/qrenderpass.h>
53 #include <Qt3DRender/qgraphicsapifilter.h>
63 using namespace DISP3DLIB;
64 using namespace Qt3DRender;
76 , m_pEffect(new QEffect())
77 , m_pDiffuseParameter(new QParameter(QStringLiteral(
"kd"), QColor::fromRgbF(0.7f, 0.7f, 0.7f, 1.0f)))
78 , m_pSpecularParameter(new QParameter(QStringLiteral(
"ks"), QColor::fromRgbF(0.1f, 0.1f, 0.1f, 1.0f)))
79 , m_pShininessParameter(new QParameter(QStringLiteral(
"shininess"), 2.0f))
80 , m_pAlphaParameter(new QParameter(
"alpha", 0.75f))
81 , m_pDrawFilterKey(new QFilterKey)
82 , m_bUseSortPolicy(bUseSortPolicy)
111 QTechnique *pVertexGL3Technique =
new QTechnique;
112 QTechnique *pVertexGL2Technique =
new QTechnique;
113 QTechnique *pVertexES2Technique =
new QTechnique;
115 pVertexGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
116 pVertexGL3Technique->graphicsApiFilter()->setMajorVersion(3);
117 pVertexGL3Technique->graphicsApiFilter()->setMinorVersion(2);
118 pVertexGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
120 pVertexGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
121 pVertexGL2Technique->graphicsApiFilter()->setMajorVersion(2);
122 pVertexGL2Technique->graphicsApiFilter()->setMinorVersion(0);
123 pVertexGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
125 pVertexES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
126 pVertexES2Technique->graphicsApiFilter()->setMajorVersion(2);
127 pVertexES2Technique->graphicsApiFilter()->setMinorVersion(0);
128 pVertexES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
134 QRenderPass *pVertexGL3RenderPass =
new QRenderPass;
135 QRenderPass *pVertexGL2RenderPass =
new QRenderPass;
136 QRenderPass *pVertexES2RenderPass =
new QRenderPass;
139 pVertexGL3RenderPass->setObjectName(QStringLiteral(
"pVertexGL3RenderPass"));
140 pVertexGL2RenderPass->setObjectName(QStringLiteral(
"pVertexGL2RenderPass"));
141 pVertexES2RenderPass->setObjectName(QStringLiteral(
"pVertexES2RenderPass"));
143 pVertexGL3Technique->addRenderPass(pVertexGL3RenderPass);
144 pVertexGL2Technique->addRenderPass(pVertexGL2RenderPass);
145 pVertexES2Technique->addRenderPass(pVertexES2RenderPass);
147 m_pEffect->addTechnique(pVertexGL3Technique);
148 m_pEffect->addTechnique(pVertexGL2Technique);
149 m_pEffect->addTechnique(pVertexES2Technique);
163 if(QRenderPass *pRenderPass = this->findChild<QRenderPass*>(sObjectName)) {
164 pRenderPass->setShaderProgram(pShaderProgramm);
167 qDebug() <<
"AbstractPhongAlphaMaterial::addShaderToRenderPass: Renderpass " << sObjectName <<
" not found!";
175 if(fAlpha.canConvert<
float>())
177 float tempAlpha = fAlpha.toFloat();
179 if(tempAlpha >= 1.0f) {