mirror of
https://github.com/overte-org/overte.git
synced 2025-06-26 23:29:47 +02:00
Transmit the eye offset position along with the rest of the frustum
parameters.
This commit is contained in:
parent
dd8a40decd
commit
4961913fc4
5 changed files with 11 additions and 2 deletions
|
@ -1803,7 +1803,7 @@ void Application::update(float deltaTime) {
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {
|
||||||
if (_faceshift.isActive()) {
|
if (_faceshift.isActive()) {
|
||||||
const float EYE_OFFSET_SCALE = 0.1f;
|
const float EYE_OFFSET_SCALE = 0.005f;
|
||||||
glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE;
|
glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE;
|
||||||
_myCamera.setEyeOffsetPosition(glm::vec3(-position.x, position.y, position.z));
|
_myCamera.setEyeOffsetPosition(glm::vec3(-position.x, position.y, position.z));
|
||||||
resizeGL(_glWidget->width(), _glWidget->height());
|
resizeGL(_glWidget->width(), _glWidget->height());
|
||||||
|
@ -1912,6 +1912,7 @@ void Application::updateAvatar(float deltaTime) {
|
||||||
_myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio());
|
_myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio());
|
||||||
_myAvatar.setCameraNearClip(_viewFrustum.getNearClip());
|
_myAvatar.setCameraNearClip(_viewFrustum.getNearClip());
|
||||||
_myAvatar.setCameraFarClip(_viewFrustum.getFarClip());
|
_myAvatar.setCameraFarClip(_viewFrustum.getFarClip());
|
||||||
|
_myAvatar.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition());
|
||||||
|
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
if (nodeList->getOwnerID() != UNKNOWN_NODE_ID) {
|
if (nodeList->getOwnerID() != UNKNOWN_NODE_ID) {
|
||||||
|
|
|
@ -165,6 +165,8 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
destinationBuffer += packFloatRatioToTwoByte(destinationBuffer, _cameraAspectRatio);
|
destinationBuffer += packFloatRatioToTwoByte(destinationBuffer, _cameraAspectRatio);
|
||||||
destinationBuffer += packClipValueToTwoByte(destinationBuffer, _cameraNearClip);
|
destinationBuffer += packClipValueToTwoByte(destinationBuffer, _cameraNearClip);
|
||||||
destinationBuffer += packClipValueToTwoByte(destinationBuffer, _cameraFarClip);
|
destinationBuffer += packClipValueToTwoByte(destinationBuffer, _cameraFarClip);
|
||||||
|
memcpy(destinationBuffer, &_cameraEyeOffsetPosition, sizeof(_cameraEyeOffsetPosition));
|
||||||
|
destinationBuffer += sizeof(_cameraEyeOffsetPosition);
|
||||||
|
|
||||||
// chat message
|
// chat message
|
||||||
*destinationBuffer++ = _chatMessage.size();
|
*destinationBuffer++ = _chatMessage.size();
|
||||||
|
@ -274,6 +276,8 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
sourceBuffer += unpackFloatRatioFromTwoByte(sourceBuffer,_cameraAspectRatio);
|
sourceBuffer += unpackFloatRatioFromTwoByte(sourceBuffer,_cameraAspectRatio);
|
||||||
sourceBuffer += unpackClipValueFromTwoByte(sourceBuffer,_cameraNearClip);
|
sourceBuffer += unpackClipValueFromTwoByte(sourceBuffer,_cameraNearClip);
|
||||||
sourceBuffer += unpackClipValueFromTwoByte(sourceBuffer,_cameraFarClip);
|
sourceBuffer += unpackClipValueFromTwoByte(sourceBuffer,_cameraFarClip);
|
||||||
|
memcpy(&_cameraEyeOffsetPosition, sourceBuffer, sizeof(_cameraEyeOffsetPosition));
|
||||||
|
sourceBuffer += sizeof(_cameraEyeOffsetPosition);
|
||||||
|
|
||||||
// the rest is a chat message
|
// the rest is a chat message
|
||||||
int chatMessageSize = *sourceBuffer++;
|
int chatMessageSize = *sourceBuffer++;
|
||||||
|
|
|
@ -88,6 +88,7 @@ public:
|
||||||
float getCameraAspectRatio() const { return _cameraAspectRatio; }
|
float getCameraAspectRatio() const { return _cameraAspectRatio; }
|
||||||
float getCameraNearClip() const { return _cameraNearClip; }
|
float getCameraNearClip() const { return _cameraNearClip; }
|
||||||
float getCameraFarClip() const { return _cameraFarClip; }
|
float getCameraFarClip() const { return _cameraFarClip; }
|
||||||
|
const glm::vec3& getCameraEyeOffsetPosition() const { return _cameraEyeOffsetPosition; }
|
||||||
|
|
||||||
glm::vec3 calculateCameraDirection() const;
|
glm::vec3 calculateCameraDirection() const;
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ public:
|
||||||
void setCameraAspectRatio(float aspectRatio) { _cameraAspectRatio = aspectRatio; }
|
void setCameraAspectRatio(float aspectRatio) { _cameraAspectRatio = aspectRatio; }
|
||||||
void setCameraNearClip(float nearClip) { _cameraNearClip = nearClip; }
|
void setCameraNearClip(float nearClip) { _cameraNearClip = nearClip; }
|
||||||
void setCameraFarClip(float farClip) { _cameraFarClip = farClip; }
|
void setCameraFarClip(float farClip) { _cameraFarClip = farClip; }
|
||||||
|
void setCameraEyeOffsetPosition(const glm::vec3& eyeOffsetPosition) { _cameraEyeOffsetPosition = eyeOffsetPosition; }
|
||||||
|
|
||||||
// key state
|
// key state
|
||||||
void setKeyState(KeyState s) { _keyState = s; }
|
void setKeyState(KeyState s) { _keyState = s; }
|
||||||
|
@ -151,6 +153,7 @@ protected:
|
||||||
float _cameraAspectRatio;
|
float _cameraAspectRatio;
|
||||||
float _cameraNearClip;
|
float _cameraNearClip;
|
||||||
float _cameraFarClip;
|
float _cameraFarClip;
|
||||||
|
glm::vec3 _cameraEyeOffsetPosition;
|
||||||
|
|
||||||
// key state
|
// key state
|
||||||
KeyState _keyState;
|
KeyState _keyState;
|
||||||
|
|
|
@ -20,7 +20,7 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case PACKET_TYPE_HEAD_DATA:
|
case PACKET_TYPE_HEAD_DATA:
|
||||||
return 4;
|
return 5;
|
||||||
|
|
||||||
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -73,6 +73,7 @@ bool VoxelNodeData::updateCurrentViewFrustum() {
|
||||||
newestViewFrustum.setAspectRatio(getCameraAspectRatio());
|
newestViewFrustum.setAspectRatio(getCameraAspectRatio());
|
||||||
newestViewFrustum.setNearClip(getCameraNearClip());
|
newestViewFrustum.setNearClip(getCameraNearClip());
|
||||||
newestViewFrustum.setFarClip(getCameraFarClip());
|
newestViewFrustum.setFarClip(getCameraFarClip());
|
||||||
|
newestViewFrustum.setEyeOffsetPosition(getCameraEyeOffsetPosition());
|
||||||
|
|
||||||
// if there has been a change, then recalculate
|
// if there has been a change, then recalculate
|
||||||
if (!newestViewFrustum.matches(_currentViewFrustum)) {
|
if (!newestViewFrustum.matches(_currentViewFrustum)) {
|
||||||
|
|
Loading…
Reference in a new issue