Fix setting light poition for models.
This commit is contained in:
		
							parent
							
								
									95fd1e9977
								
							
						
					
					
						commit
						5984763d43
					
				@ -485,7 +485,7 @@ void QtkScene::update()
 | 
				
			|||||||
  // Helper lambda to set the light position used by GLSL shaders on the model.
 | 
					  // Helper lambda to set the light position used by GLSL shaders on the model.
 | 
				
			||||||
  // TODO: This could be a helper function on the Model class.
 | 
					  // TODO: This could be a helper function on the Model class.
 | 
				
			||||||
  auto setLightPosition = [](const std::string & lightName, Model * model) {
 | 
					  auto setLightPosition = [](const std::string & lightName, Model * model) {
 | 
				
			||||||
    if (auto light = Model::getInstance(lightName.c_str()); light) {
 | 
					    if (auto light = MeshRenderer::getInstance(lightName.c_str()); light) {
 | 
				
			||||||
      QVector3D position = light->getTransform().getTranslation();
 | 
					      QVector3D position = light->getTransform().getTranslation();
 | 
				
			||||||
      model->setUniform("uLight.position", position);
 | 
					      model->setUniform("uLight.position", position);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user