mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 03:54:09 +02:00
Merge pull request #1894 from AndrewMeadows/issue-1880
fix for visibility of head geometry when in first-person
This commit is contained in:
commit
6e6eece814
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) {
|
||||
// Render the world box
|
||||
|
|
|
@ -36,6 +36,7 @@ Camera::Camera() {
|
|||
_modeShiftRate = 1.0f;
|
||||
_linearModeShift = 0.0f;
|
||||
_mode = CAMERA_MODE_THIRD_PERSON;
|
||||
_prevMode = CAMERA_MODE_THIRD_PERSON;
|
||||
_tightness = 10.0f; // default
|
||||
_fieldOfView = DEFAULT_FIELD_OF_VIEW_DEGREES;
|
||||
_aspectRatio = 16.f/9.f;
|
||||
|
@ -123,6 +124,7 @@ void Camera::setModeShiftRate ( float rate ) {
|
|||
|
||||
void Camera::setMode(CameraMode m) {
|
||||
|
||||
_prevMode = _mode;
|
||||
_mode = m;
|
||||
_modeShift = 0.0;
|
||||
_linearModeShift = 0.0;
|
||||
|
@ -199,6 +201,17 @@ bool Camera::getFrustumNeedsReshape() const {
|
|||
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
|
||||
void Camera::setFrustumWasReshaped() {
|
||||
_frustumNeedsReshape = false;
|
||||
|
|
|
@ -61,6 +61,8 @@ public:
|
|||
const glm::quat& getEyeOffsetOrientation () const { return _eyeOffsetOrientation; }
|
||||
float getScale () const { return _scale; }
|
||||
|
||||
CameraMode getInterpolatedMode() const;
|
||||
|
||||
bool getFrustumNeedsReshape() const; // call to find out if the view frustum needs to be reshaped
|
||||
void setFrustumWasReshaped(); // call this after reshaping the view frustum.
|
||||
|
||||
|
@ -68,6 +70,7 @@ private:
|
|||
|
||||
bool _needsToInitialize;
|
||||
CameraMode _mode;
|
||||
CameraMode _prevMode;
|
||||
bool _frustumNeedsReshape;
|
||||
glm::vec3 _position;
|
||||
glm::vec3 _idealPosition;
|
||||
|
|
|
@ -242,7 +242,9 @@ void Avatar::renderBody(bool forceRenderHead) {
|
|||
glm::vec3 pos = getPosition();
|
||||
//printf("Render other at %.3f, %.2f, %.2f\n", pos.x, pos.y, pos.z);
|
||||
_skeletonModel.render(1.0f);
|
||||
_head.render(1.0f);
|
||||
if (forceRenderHead) {
|
||||
_head.render(1.0f);
|
||||
}
|
||||
_hand.render(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ void AvatarManager::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) {
|
|||
bool renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors);
|
||||
|
||||
if (!selfAvatarOnly) {
|
||||
// Render avatars of other nodes
|
||||
foreach (const AvatarSharedPointer& avatarPointer, _avatarHash) {
|
||||
Avatar* avatar = static_cast<Avatar*>(avatarPointer.data());
|
||||
if (!avatar->isInitialized()) {
|
||||
|
@ -84,7 +83,7 @@ void AvatarManager::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) {
|
|||
if (avatar == static_cast<Avatar*>(_myAvatar.data())) {
|
||||
avatar->render(forceRenderHead);
|
||||
} else {
|
||||
avatar->render(false);
|
||||
avatar->render(true);
|
||||
}
|
||||
avatar->setDisplayingLookatVectors(renderLookAtVectors);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue