421 const glm::vec3 projected = glm::project( |
421 const glm::vec3 projected = glm::project( |
422 point, |
422 point, |
423 this->viewMatrix * this->modelMatrix, |
423 this->viewMatrix * this->modelMatrix, |
424 this->projectionMatrix, |
424 this->projectionMatrix, |
425 this->viewportVector); |
425 this->viewportVector); |
426 return toQPointF(glm::vec2{projected.x, this->height() - projected.y}); |
426 return toQPointF(glm::vec2{projected.x, static_cast<float>(this->height()) - projected.y}); |
427 } |
427 } |
428 |
428 |
429 bool PartRenderer::isDark() const |
429 bool PartRenderer::isDark() const |
430 { |
430 { |
431 return luma(this->renderPreferences.backgroundColor) < 0.25; |
431 return luma(this->renderPreferences.backgroundColor) < 0.25; |
444 * @return model coordinates |
444 * @return model coordinates |
445 */ |
445 */ |
446 glm::vec3 PartRenderer::unproject(const glm::vec3& win) const |
446 glm::vec3 PartRenderer::unproject(const glm::vec3& win) const |
447 { |
447 { |
448 return glm::unProject( |
448 return glm::unProject( |
449 glm::vec3{win.x, this->height() - win.y, win.z}, |
449 glm::vec3{win.x, static_cast<float>(this->height()) - win.y, win.z}, |
450 this->viewMatrix * this->modelMatrix, |
450 this->viewMatrix * this->modelMatrix, |
451 this->projectionMatrix, |
451 this->projectionMatrix, |
452 viewportVector); |
452 viewportVector); |
453 } |
453 } |
454 |
454 |