added preview imange,
passed data to shader, need to process data in shader
This commit is contained in:
@@ -121,8 +121,9 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
|
||||
normMatrix.translate(-m_boundings.center[0], -m_boundings.center[1], -m_boundings.center[2]);
|
||||
program->setUniformValue("norm_matrix", normMatrix);
|
||||
|
||||
// Allways use texture unit 0
|
||||
// Allways use texture unit 0 and 1
|
||||
program->setUniformValue("texture", 0);
|
||||
program->setUniformValue("secondTexture", 1);
|
||||
|
||||
//setup the pipeline
|
||||
setupPipeline(program);
|
||||
@@ -133,23 +134,34 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
|
||||
{
|
||||
bool tmp_transparent(false);
|
||||
bool tmp_specular(false);
|
||||
bool tmp_normalmap(false);
|
||||
float shininess(0.0);
|
||||
QVector3D specularColor;
|
||||
|
||||
// bind the correct texture
|
||||
if (it.textureIndex < (unsigned)m_materials->size() && m_materials->at(it.textureIndex).texture0 != Q_NULLPTR)
|
||||
{
|
||||
m_materials->at(it.textureIndex).texture0->bind();
|
||||
m_materials->at(it.textureIndex).texture0->bind(0);
|
||||
tmp_transparent = m_materials->at(it.textureIndex).transparent;
|
||||
tmp_specular = m_materials->at(it.textureIndex).flags[7];
|
||||
shininess = m_materials->at(it.textureIndex).shininess;
|
||||
specularColor = m_materials->at(it.textureIndex).specularColor.toVector3D();
|
||||
|
||||
if (m_materials->at(it.textureIndex).rendertype == 27 || m_materials->at(it.textureIndex).rendertype == 28)
|
||||
{
|
||||
if (m_materials->at(it.textureIndex).texture1 != Q_NULLPTR)
|
||||
{
|
||||
tmp_normalmap = true;
|
||||
m_materials->at(it.textureIndex).texture1->bind(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_defaultMaterial->texture0->bind();
|
||||
m_defaultMaterial->texture0->bind(0);
|
||||
tmp_transparent = m_defaultMaterial->transparent;
|
||||
}
|
||||
|
||||
// Set model matrix
|
||||
program->setUniformValue("m_matrix", it.modelMatrix);
|
||||
|
||||
@@ -159,6 +171,7 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
|
||||
// set some more values
|
||||
program->setUniformValue("b_transparent", tmp_transparent);
|
||||
program->setUniformValue("b_specular", tmp_specular);
|
||||
program->setUniformValue("b_normalmap", tmp_normalmap);
|
||||
|
||||
// set some material attributes
|
||||
program->setUniformValue("materialShininess", shininess);
|
||||
|
Reference in New Issue
Block a user