mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
Align chat with full camera rotation (not just yaw).
This commit is contained in:
parent
27f4674c10
commit
bcd3833898
4 changed files with 12 additions and 15 deletions
|
@ -1667,13 +1667,13 @@ void Application::displaySide(Camera& whichCamera) {
|
||||||
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
|
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
|
||||||
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
|
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
|
||||||
Avatar *avatar = (Avatar *)agent->getLinkedData();
|
Avatar *avatar = (Avatar *)agent->getLinkedData();
|
||||||
avatar->render(false, _myCamera.getPosition());
|
avatar->render(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
agentList->unlock();
|
agentList->unlock();
|
||||||
|
|
||||||
// Render my own Avatar
|
// Render my own Avatar
|
||||||
_myAvatar.render(_lookingInMirror->isChecked(), _myCamera.getPosition());
|
_myAvatar.render(_lookingInMirror->isChecked());
|
||||||
_myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());
|
_myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
void wheelEvent(QWheelEvent* event);
|
void wheelEvent(QWheelEvent* event);
|
||||||
|
|
||||||
Avatar* getAvatar() { return &_myAvatar; }
|
Avatar* getAvatar() { return &_myAvatar; }
|
||||||
|
Camera* getCamera() { return &_myCamera; }
|
||||||
VoxelSystem* getVoxels() { return &_voxels; }
|
VoxelSystem* getVoxels() { return &_voxels; }
|
||||||
Environment* getEnvironment() { return &_environment; }
|
Environment* getEnvironment() { return &_environment; }
|
||||||
bool shouldEchoAudio() { return _echoAudioMode->isChecked(); }
|
bool shouldEchoAudio() { return _echoAudioMode->isChecked(); }
|
||||||
|
|
|
@ -758,9 +758,9 @@ void Avatar::setGravity(glm::vec3 gravity) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
|
void Avatar::render(bool lookingInMirror) {
|
||||||
|
|
||||||
_cameraPosition = cameraPosition;
|
_cameraPosition = Application::getInstance()->getCamera()->getPosition();
|
||||||
|
|
||||||
if (!_owningAgent && usingBigSphereCollisionTest) {
|
if (!_owningAgent && usingBigSphereCollisionTest) {
|
||||||
// show TEST big sphere
|
// show TEST big sphere
|
||||||
|
@ -799,18 +799,14 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
|
||||||
}
|
}
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
// extract the view direction from the modelview matrix: transform (0, 0, 1) by the
|
glm::vec3 chatPosition = _joint[AVATAR_JOINT_HEAD_BASE].springyPosition + getBodyUpDirection() * chatMessageHeight;
|
||||||
// transpose of the modelview to get its direction in world space, then use the X/Z
|
glTranslatef(chatPosition.x, chatPosition.y, chatPosition.z);
|
||||||
// components to determine the angle
|
glm::quat chatRotation = Application::getInstance()->getCamera()->getRotation();
|
||||||
float modelview[16];
|
glm::vec3 chatAxis = glm::axis(chatRotation);
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX, modelview);
|
glRotatef(glm::angle(chatRotation), chatAxis.x, chatAxis.y, chatAxis.z);
|
||||||
|
|
||||||
glTranslatef(_joint[AVATAR_JOINT_HEAD_BASE].springyPosition.x,
|
|
||||||
_joint[AVATAR_JOINT_HEAD_BASE].springyPosition.y + chatMessageHeight,
|
|
||||||
_joint[AVATAR_JOINT_HEAD_BASE].springyPosition.z);
|
|
||||||
glRotatef(atan2(-modelview[2], -modelview[10]) * 180 / PI, 0, 1, 0);
|
|
||||||
|
|
||||||
glColor3f(0, 0.8, 0);
|
glColor3f(0, 0.8, 0);
|
||||||
|
glRotatef(180, 0, 1, 0);
|
||||||
glRotatef(180, 0, 0, 1);
|
glRotatef(180, 0, 0, 1);
|
||||||
glScalef(chatMessageScale, chatMessageScale, 1.0f);
|
glScalef(chatMessageScale, chatMessageScale, 1.0f);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
void updateHeadFromGyros(float frametime, SerialInterface * serialInterface, glm::vec3 * gravity);
|
void updateHeadFromGyros(float frametime, SerialInterface * serialInterface, glm::vec3 * gravity);
|
||||||
void updateFromMouse(int mouseX, int mouseY, int screenWidth, int screenHeight);
|
void updateFromMouse(int mouseX, int mouseY, int screenWidth, int screenHeight);
|
||||||
void addBodyYaw(float y) {_bodyYaw += y;};
|
void addBodyYaw(float y) {_bodyYaw += y;};
|
||||||
void render(bool lookingInMirror, glm::vec3 cameraPosition);
|
void render(bool lookingInMirror);
|
||||||
|
|
||||||
//setters
|
//setters
|
||||||
void setMousePressed (bool mousePressed ) { _mousePressed = mousePressed;}
|
void setMousePressed (bool mousePressed ) { _mousePressed = mousePressed;}
|
||||||
|
|
Loading…
Reference in a new issue