mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
ready for pull request
This commit is contained in:
parent
4028e66c08
commit
2e19ad48a7
1 changed files with 9 additions and 6 deletions
|
@ -666,14 +666,17 @@ void Avatar::renderDisplayName() {
|
||||||
// we need "always facing camera": we must remove the camera rotation from the stack
|
// we need "always facing camera": we must remove the camera rotation from the stack
|
||||||
glm::quat rotation = Application::getInstance()->getCamera()->getRotation();
|
glm::quat rotation = Application::getInstance()->getCamera()->getRotation();
|
||||||
|
|
||||||
glm::vec3 frontAxis(0.f, 0.f, 1.f);
|
glm::vec3 frontAxis(1.f, 0.f, 0.f);
|
||||||
frontAxis = glm::rotate(rotation, frontAxis);
|
frontAxis = glm::rotate(rotation, frontAxis);
|
||||||
frontAxis = glm::normalize(glm::vec3(frontAxis.x, 0.f, frontAxis.z));
|
frontAxis = glm::normalize(glm::vec3(frontAxis.x, 0.f, frontAxis.z));
|
||||||
glm::vec3 euler = glm::eulerAngles(rotation);
|
|
||||||
float angle = acos(frontAxis.z) * ((frontAxis.y < 0) ? 1.f : -1.f);
|
// TODO : test this secodn solution which should be better wfor occulus
|
||||||
//glm::vec3 axis = glm::axis(rotation);
|
//glm::vec3 camPosition = Application::getInstance()->getCamera()->getPosition();
|
||||||
glRotatef(glm::degrees(-euler.y), 0.0f, 1.0f, 0.0f);
|
//glm::vec3 frontAxis = camPosition - textPosition;
|
||||||
//angleglRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
//frontAxis = glm::normalize(glm::vec3(frontAxis.z, 0.f, -frontAxis.x));
|
||||||
|
|
||||||
|
float angle = acos(frontAxis.x) * ((frontAxis.z < 0) ? 1.f : -1.f);
|
||||||
|
glRotatef(glm::degrees(angle), 0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
// We need to compute the scale factor such as the text remains with fixed size respect to window coordinates
|
// We need to compute the scale factor such as the text remains with fixed size respect to window coordinates
|
||||||
// We project a unit vector and check the difference in screen coordinates, to check which is the
|
// We project a unit vector and check the difference in screen coordinates, to check which is the
|
||||||
|
|
Loading…
Reference in a new issue