--- a/src/gl/partrenderer.cpp Sun Apr 09 00:56:49 2023 +0300 +++ b/src/gl/partrenderer.cpp Sun Apr 09 01:12:00 2023 +0300 @@ -237,7 +237,7 @@ void PartRenderer::updateModelMatrix() { - this->modelMatrix = glm::mat4_cast(this->modelQuaternion); + this->modelMatrix = glm::translate(glm::mat4_cast(this->modelQuaternion), -this->modelViewOrigin); gl::setShaderUniformMatrix(&this->shaders, "modelMatrix", modelMatrix); Q_EMIT this->modelMatrixChanged(this->modelMatrix); this->update(); @@ -420,6 +420,12 @@ return lineFromPoints(p1, p2); } +void PartRenderer::setModelViewOrigin(const glm::vec3& newViewOrigin) +{ + this->modelViewOrigin = newViewOrigin; + this->updateModelMatrix(); +} + /** * @brief Unprojects the specified window coordinates to model coordinates * @param win Window coordinates to project. Z-coordinate indicates depth