mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:52:26 +02:00
Don't compute avatar anchor specs if uneeded
This commit is contained in:
parent
0edcd732fe
commit
7d40790260
1 changed files with 18 additions and 6 deletions
|
@ -61,17 +61,29 @@ void Overlays::render3D() {
|
||||||
if (_overlays3D.size() == 0) {
|
if (_overlays3D.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MyAvatar* avatar = Application::getInstance()->getAvatar();
|
bool myAvatarComputed = false;
|
||||||
glm::quat myAvatarRotation = avatar->getOrientation();
|
MyAvatar* avatar;
|
||||||
glm::vec3 myAvatarPosition = avatar->getPosition();
|
glm::quat myAvatarRotation;
|
||||||
float angle = glm::degrees(glm::angle(myAvatarRotation));
|
glm::vec3 myAvatarPosition;
|
||||||
glm::vec3 axis = glm::axis(myAvatarRotation);
|
float angle;
|
||||||
float myAvatarScale = avatar->getScale();
|
glm::vec3 axis;
|
||||||
|
float myAvatarScale;
|
||||||
|
|
||||||
foreach(Overlay* thisOverlay, _overlays3D) {
|
foreach(Overlay* thisOverlay, _overlays3D) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
switch (thisOverlay->getAnchor()) {
|
switch (thisOverlay->getAnchor()) {
|
||||||
case Overlay::MY_AVATAR:
|
case Overlay::MY_AVATAR:
|
||||||
|
if (!myAvatarComputed) {
|
||||||
|
avatar = Application::getInstance()->getAvatar();
|
||||||
|
myAvatarRotation = avatar->getOrientation();
|
||||||
|
myAvatarPosition = avatar->getPosition();
|
||||||
|
angle = glm::degrees(glm::angle(myAvatarRotation));
|
||||||
|
axis = glm::axis(myAvatarRotation);
|
||||||
|
myAvatarScale = avatar->getScale();
|
||||||
|
|
||||||
|
myAvatarComputed = true;
|
||||||
|
}
|
||||||
|
|
||||||
glTranslatef(myAvatarPosition.x, myAvatarPosition.y, myAvatarPosition.z);
|
glTranslatef(myAvatarPosition.x, myAvatarPosition.y, myAvatarPosition.z);
|
||||||
glRotatef(angle, axis.x, axis.y, axis.z);
|
glRotatef(angle, axis.x, axis.y, axis.z);
|
||||||
glScalef(myAvatarScale, myAvatarScale, myAvatarScale);
|
glScalef(myAvatarScale, myAvatarScale, myAvatarScale);
|
||||||
|
|
Loading…
Reference in a new issue