mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 08:14:21 +02:00
Stop rendering our head in first person camera mode.
This commit is contained in:
parent
98967189ac
commit
aa3a1a9a72
5 changed files with 22 additions and 4 deletions
|
@ -2884,7 +2884,8 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_avatarManager.renderAvatars(whichCamera.getMode() == CAMERA_MODE_MIRROR, selfAvatarOnly);
|
bool renderMyHead = (whichCamera.getInterpolatedMode() != CAMERA_MODE_FIRST_PERSON);
|
||||||
|
_avatarManager.renderAvatars(renderMyHead, selfAvatarOnly);
|
||||||
|
|
||||||
if (!selfAvatarOnly) {
|
if (!selfAvatarOnly) {
|
||||||
// Render the world box
|
// Render the world box
|
||||||
|
|
|
@ -36,6 +36,7 @@ Camera::Camera() {
|
||||||
_modeShiftRate = 1.0f;
|
_modeShiftRate = 1.0f;
|
||||||
_linearModeShift = 0.0f;
|
_linearModeShift = 0.0f;
|
||||||
_mode = CAMERA_MODE_THIRD_PERSON;
|
_mode = CAMERA_MODE_THIRD_PERSON;
|
||||||
|
_prevMode = CAMERA_MODE_THIRD_PERSON;
|
||||||
_tightness = 10.0f; // default
|
_tightness = 10.0f; // default
|
||||||
_fieldOfView = DEFAULT_FIELD_OF_VIEW_DEGREES;
|
_fieldOfView = DEFAULT_FIELD_OF_VIEW_DEGREES;
|
||||||
_aspectRatio = 16.f/9.f;
|
_aspectRatio = 16.f/9.f;
|
||||||
|
@ -123,6 +124,7 @@ void Camera::setModeShiftRate ( float rate ) {
|
||||||
|
|
||||||
void Camera::setMode(CameraMode m) {
|
void Camera::setMode(CameraMode m) {
|
||||||
|
|
||||||
|
_prevMode = _mode;
|
||||||
_mode = m;
|
_mode = m;
|
||||||
_modeShift = 0.0;
|
_modeShift = 0.0;
|
||||||
_linearModeShift = 0.0;
|
_linearModeShift = 0.0;
|
||||||
|
@ -199,6 +201,17 @@ bool Camera::getFrustumNeedsReshape() const {
|
||||||
return _frustumNeedsReshape;
|
return _frustumNeedsReshape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// call this when deciding whether to render the head or not
|
||||||
|
CameraMode Camera::getInterpolatedMode() const {
|
||||||
|
const float SHIFT_THRESHOLD_INTO_FIRST_PERSON = 0.7f;
|
||||||
|
const float SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON = 0.6f;
|
||||||
|
if (_mode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_INTO_FIRST_PERSON ||
|
||||||
|
_prevMode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON) {
|
||||||
|
return _prevMode;
|
||||||
|
}
|
||||||
|
return _mode;
|
||||||
|
}
|
||||||
|
|
||||||
// call this after reshaping the view frustum
|
// call this after reshaping the view frustum
|
||||||
void Camera::setFrustumWasReshaped() {
|
void Camera::setFrustumWasReshaped() {
|
||||||
_frustumNeedsReshape = false;
|
_frustumNeedsReshape = false;
|
||||||
|
|
|
@ -61,6 +61,8 @@ public:
|
||||||
const glm::quat& getEyeOffsetOrientation () const { return _eyeOffsetOrientation; }
|
const glm::quat& getEyeOffsetOrientation () const { return _eyeOffsetOrientation; }
|
||||||
float getScale () const { return _scale; }
|
float getScale () const { return _scale; }
|
||||||
|
|
||||||
|
CameraMode getInterpolatedMode() const;
|
||||||
|
|
||||||
bool getFrustumNeedsReshape() const; // call to find out if the view frustum needs to be reshaped
|
bool getFrustumNeedsReshape() const; // call to find out if the view frustum needs to be reshaped
|
||||||
void setFrustumWasReshaped(); // call this after reshaping the view frustum.
|
void setFrustumWasReshaped(); // call this after reshaping the view frustum.
|
||||||
|
|
||||||
|
@ -68,6 +70,7 @@ private:
|
||||||
|
|
||||||
bool _needsToInitialize;
|
bool _needsToInitialize;
|
||||||
CameraMode _mode;
|
CameraMode _mode;
|
||||||
|
CameraMode _prevMode;
|
||||||
bool _frustumNeedsReshape;
|
bool _frustumNeedsReshape;
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
glm::vec3 _idealPosition;
|
glm::vec3 _idealPosition;
|
||||||
|
|
|
@ -242,7 +242,9 @@ void Avatar::renderBody(bool forceRenderHead) {
|
||||||
glm::vec3 pos = getPosition();
|
glm::vec3 pos = getPosition();
|
||||||
//printf("Render other at %.3f, %.2f, %.2f\n", pos.x, pos.y, pos.z);
|
//printf("Render other at %.3f, %.2f, %.2f\n", pos.x, pos.y, pos.z);
|
||||||
_skeletonModel.render(1.0f);
|
_skeletonModel.render(1.0f);
|
||||||
_head.render(1.0f);
|
if (forceRenderHead) {
|
||||||
|
_head.render(1.0f);
|
||||||
|
}
|
||||||
_hand.render(false);
|
_hand.render(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,6 @@ void AvatarManager::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) {
|
||||||
bool renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors);
|
bool renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors);
|
||||||
|
|
||||||
if (!selfAvatarOnly) {
|
if (!selfAvatarOnly) {
|
||||||
// Render avatars of other nodes
|
|
||||||
foreach (const AvatarSharedPointer& avatarPointer, _avatarHash) {
|
foreach (const AvatarSharedPointer& avatarPointer, _avatarHash) {
|
||||||
Avatar* avatar = static_cast<Avatar*>(avatarPointer.data());
|
Avatar* avatar = static_cast<Avatar*>(avatarPointer.data());
|
||||||
if (!avatar->isInitialized()) {
|
if (!avatar->isInitialized()) {
|
||||||
|
@ -84,7 +83,7 @@ void AvatarManager::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) {
|
||||||
if (avatar == static_cast<Avatar*>(_myAvatar.data())) {
|
if (avatar == static_cast<Avatar*>(_myAvatar.data())) {
|
||||||
avatar->render(forceRenderHead);
|
avatar->render(forceRenderHead);
|
||||||
} else {
|
} else {
|
||||||
avatar->render(false);
|
avatar->render(true);
|
||||||
}
|
}
|
||||||
avatar->setDisplayingLookatVectors(renderLookAtVectors);
|
avatar->setDisplayingLookatVectors(renderLookAtVectors);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue