calculate normal matrix once in cpp (performance),
added bool variable to turn light on/off (still needs button),
This commit is contained in:
@@ -191,6 +191,9 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program, bool wireframe)
|
||||
// Set model matrix
|
||||
program->setUniformValue("m_matrix", it.modelMatrix);
|
||||
|
||||
// Set normal matrix
|
||||
program->setUniformValue("n_matrix", (normMatrix * it.modelMatrix).normalMatrix());
|
||||
|
||||
// decide if this is transparent
|
||||
program->setUniformValue("b_transparent", tmp_transparent);
|
||||
|
||||
|
@@ -226,7 +226,8 @@ void OglViewerWidget::paintGL()
|
||||
// Set view-projection matrix
|
||||
m_program.setUniformValue("vp_matrix", m_projection * view);
|
||||
|
||||
// Set Light
|
||||
// Set Light values
|
||||
m_program.setUniformValue("b_light", m_lightOn);
|
||||
m_program.setUniformValue("light.position", m_light.position);
|
||||
m_program.setUniformValue("light.intensities", m_light.intensities);
|
||||
|
||||
|
Reference in New Issue
Block a user