mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 17:30:04 -05:00
Merge in initialization of camera pos from feature/interaction
This commit is contained in:
@@ -820,7 +820,11 @@ void OrbitalInteractionMode::updateCameraStateFromMouseStates() {
|
||||
glm::normalize(glm::quat_cast(glm::inverse(lookAtMat)));
|
||||
}
|
||||
{ // Move position towards or away from focus node
|
||||
newPosition += -posDiff * _truckMovementMouseState.velocity.get().y;
|
||||
glm::dvec3 centerToBoundingSphere =
|
||||
glm::normalize(posDiff) *
|
||||
static_cast<double>(_focusNode->boundingSphere().lengthf());
|
||||
newPosition += -(posDiff + centerToBoundingSphere) *
|
||||
_truckMovementMouseState.velocity.get().y;
|
||||
}
|
||||
{ // Do roll
|
||||
glm::dquat cameraRollRotation =
|
||||
|
||||
@@ -187,8 +187,6 @@ bool RenderEngine::initialize() {
|
||||
|
||||
// init camera and set temporary position and scaling
|
||||
_mainCamera = new Camera();
|
||||
_mainCamera->setScaling(glm::vec2(1.0, -8.0));
|
||||
_mainCamera->setPosition(psc(0.5f, 0.f, 1.499823f, 11.f));
|
||||
|
||||
OsEng.interactionHandler().setCamera(_mainCamera);
|
||||
if (_renderer) {
|
||||
|
||||
+8
-3
@@ -301,9 +301,10 @@ bool Scene::loadSceneInternal(const std::string& sceneDescriptionFilePath) {
|
||||
if (!fn) {
|
||||
throw ghoul::RuntimeError("Could not find focus node");
|
||||
}
|
||||
// Check crash for when fn == nullptr
|
||||
glm::mat4 la = glm::lookAt(glm::vec3(0,0,0), fn->worldPosition().vec3() - cameraPosition.vec3(), c->lookUpVectorCameraSpace());
|
||||
//glm::mat4 la = glm::lookAt(cameraPosition.vec3(), fn->worldPosition().vec3(), glm::vec3(c->lookUpVectorCameraSpace()));
|
||||
|
||||
// Check crash for when fn == nullptr
|
||||
glm::vec3 target = glm::normalize(fn->worldPosition().vec3() - cameraPosition.vec3());
|
||||
glm::mat4 la = glm::lookAt(glm::vec3(0, 0, 0), target, glm::vec3(c->lookUpVectorCameraSpace()));
|
||||
|
||||
c->setRotation(glm::quat_cast(la));
|
||||
c->setPosition(cameraPosition);
|
||||
@@ -316,6 +317,10 @@ bool Scene::loadSceneInternal(const std::string& sceneDescriptionFilePath) {
|
||||
c->rotate(rot);
|
||||
}
|
||||
|
||||
// explicitly update and sync the camera
|
||||
c->preSynchronization();
|
||||
c->postSynchronizationPreDraw();
|
||||
|
||||
|
||||
for (SceneGraphNode* node : _graph.nodes()) {
|
||||
std::vector<properties::Property*> properties = node->propertiesRecursive();
|
||||
|
||||
Reference in New Issue
Block a user