45 #include <Qt3DRender/qeffect.h>
46 #include <Qt3DRender/qtechnique.h>
47 #include <Qt3DRender/qshaderprogram.h>
48 #include <Qt3DRender/qparameter.h>
49 #include <Qt3DRender/qrenderpass.h>
50 #include <Qt3DRender/qgraphicsapifilter.h>
58 using namespace DISP3DLIB;
59 using namespace Qt3DRender;
67 , m_pInnerTessParameter(new QParameter(
"innerTess", 1.0f))
68 , m_pOuterTessParameter(new QParameter(
"outerTess", 1.0f))
69 , m_pTriangleScaleParameter(new QParameter(
"triangleScale", 1.0f))
70 , m_pVertexGL4Technique(new QTechnique())
71 , m_pVertexGL4RenderPass(new QRenderPass())
72 , m_pVertexGL4Shader(new QShaderProgram())
80 void PerVertexTessPhongAlphaMaterial::init()
83 m_pVertexGL4Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
84 m_pVertexGL4Technique->graphicsApiFilter()->setMajorVersion(4);
85 m_pVertexGL4Technique->graphicsApiFilter()->setMinorVersion(0);
86 m_pVertexGL4Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
90 m_pVertexGL4Technique->addRenderPass(m_pVertexGL4RenderPass);
92 m_pEffect->addTechnique(m_pVertexGL4Technique);
98 m_pEffect->addParameter(m_pInnerTessParameter);
99 m_pEffect->addParameter(m_pOuterTessParameter);
100 m_pEffect->addParameter(m_pTriangleScaleParameter);
107 void PerVertexTessPhongAlphaMaterial::setShaderCode()
109 m_pVertexGL4Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral(
"qrc:/engine/model/materials/shaders/gl4/pervertextessphongalpha.vert"))));
110 m_pVertexGL4Shader->setTessellationControlShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral(
"qrc:/engine/model/materials/shaders/gl4/pervertextessphongalpha.tcs"))));
112 m_pVertexGL4Shader->setTessellationEvaluationShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral(
"qrc:/engine/model/materials/shaders/gl4/pervertextessphongalpha_pn_triangles.tes"))));
113 m_pVertexGL4Shader->setGeometryShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral(
"qrc:/engine/model/materials/shaders/gl4/pervertextessphongalpha.geom"))));
114 m_pVertexGL4Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral(
"qrc:/engine/model/materials/shaders/gl4/pervertextessphongalpha.frag"))));
116 m_pVertexGL4RenderPass->setShaderProgram(m_pVertexGL4Shader);