-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27f4ce4
commit 18c7320
Showing
10 changed files
with
190 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// Created by HifiExperiments on 10/30/2024 | ||
// Copyright 2024 Overte e.V. | ||
// | ||
// Distributed under the Apache License, Version 2.0. | ||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | ||
// | ||
|
||
#include "CameraRootTransformNode.h" | ||
|
||
#include "Application.h" | ||
#include "DependencyManager.h" | ||
#include "avatar/AvatarManager.h" | ||
#include "avatar/MyAvatar.h" | ||
|
||
Transform CameraRootTransformNode::getTransform() { | ||
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); | ||
|
||
glm::vec3 pos; | ||
glm::quat ori; | ||
|
||
CameraMode mode = qApp->getCamera().getMode(); | ||
if (mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_THIRD_PERSON) { | ||
pos = myAvatar->getDefaultEyePosition(); | ||
ori = myAvatar->getHeadOrientation(); | ||
} else if (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT) { | ||
pos = myAvatar->getCameraEyesPosition(0.0f); | ||
ori = myAvatar->getLookAtRotation(); | ||
} else { | ||
ori = myAvatar->getLookAtRotation(); | ||
pos = myAvatar->getLookAtPivotPoint(); | ||
|
||
if (mode == CAMERA_MODE_SELFIE) { | ||
ori = ori * glm::angleAxis(PI, ori * Vectors::UP); | ||
} | ||
} | ||
|
||
ori = ori * glm::angleAxis(-PI / 2.0f, Vectors::RIGHT); | ||
|
||
glm::vec3 scale = glm::vec3(myAvatar->scaleForChildren()); | ||
return Transform(ori, scale, pos); | ||
} | ||
|
||
QVariantMap CameraRootTransformNode::toVariantMap() const { | ||
QVariantMap map; | ||
map["joint"] = "CameraRoot"; | ||
return map; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Created by HifiExperiments on 10/30/2024 | ||
// Copyright 2024 Overte e.V. | ||
// | ||
// Distributed under the Apache License, Version 2.0. | ||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | ||
// | ||
#ifndef hifi_CameraRootTransformNode_h | ||
#define hifi_CameraRootTransformNode_h | ||
|
||
#include "TransformNode.h" | ||
|
||
class CameraRootTransformNode : public TransformNode { | ||
public: | ||
CameraRootTransformNode() {} | ||
Transform getTransform() override; | ||
QVariantMap toVariantMap() const override; | ||
}; | ||
|
||
#endif // hifi_CameraRootTransformNode_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters