mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 17:30:04 -05:00
changed how a position is read from default script.
This commit is contained in:
@@ -382,6 +382,10 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath)
|
||||
Camera* c = OsEng.ref().renderEngine().camera();
|
||||
auto focusIterator = _allNodes.find(_focus);
|
||||
|
||||
glm::vec2 cameraScaling(1);
|
||||
psc cameraPosition(0,0,1,0);
|
||||
glm::vec3 cameraDirection = glm::vec3(0, 0, -1);
|
||||
|
||||
if (focusIterator != _allNodes.end()) {
|
||||
LDEBUG("Camera focus is '" << _focus << "'");
|
||||
SceneGraphNode* focusNode = focusIterator->second;
|
||||
@@ -395,17 +399,24 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath)
|
||||
|
||||
// this part is full of magic!
|
||||
glm::vec2 boundf = bound.vec2();
|
||||
glm::vec2 scaling{1.0f, -boundf[1]};
|
||||
//glm::vec2 scaling{1.0f, -boundf[1]};
|
||||
cameraScaling = glm::vec2(1.f, -boundf[1]);
|
||||
boundf[0] *= 5.0f;
|
||||
|
||||
psc cameraPosition = focusNode->position();
|
||||
cameraPosition += psc(glm::vec4(0.f, 0.f, boundf));
|
||||
//psc cameraPosition = focusNode->position();
|
||||
//cameraPosition += psc(glm::vec4(0.f, 0.f, boundf));
|
||||
|
||||
cameraPosition = psc(glm::vec4(0.f, 0.f, 1.f,0.f));
|
||||
//cameraPosition = psc(glm::vec4(0.f, 0.f, 1.f,0.f));
|
||||
|
||||
c->setPosition(cameraPosition);
|
||||
c->setCameraDirection(glm::vec3(0, 0, -1));
|
||||
c->setScaling(scaling);
|
||||
cameraPosition = focusNode->position();
|
||||
cameraPosition += psc(glm::vec4(0.f, 0.f, boundf));
|
||||
|
||||
//why this line? (JK)
|
||||
cameraPosition = psc(glm::vec4(0.f, 0.f, 1.f, 0.f));
|
||||
|
||||
//c->setPosition(cameraPosition);
|
||||
// c->setCameraDirection(glm::vec3(0, 0, -1));
|
||||
// c->setScaling(scaling);
|
||||
|
||||
// Set the focus node for the interactionhandler
|
||||
OsEng.interactionHandler().setFocusNode(focusNode);
|
||||
@@ -421,15 +432,20 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath)
|
||||
<< position[2] << ", "
|
||||
<< position[3] << ")");
|
||||
|
||||
c->setPosition(position);
|
||||
cameraPosition = psc(position);
|
||||
//c->setPosition(position);
|
||||
}
|
||||
|
||||
// the camera position
|
||||
const SceneGraphNode* fn = OsEng.interactionHandler().focusNode();
|
||||
psc relative = fn->worldPosition() - c->position();
|
||||
//psc relative = fn->worldPosition() - c->position();
|
||||
psc relative = fn->worldPosition() - cameraPosition;
|
||||
|
||||
glm::mat4 la = glm::lookAt(cameraPosition.vec3(), fn->worldPosition().vec3(), c->lookUpVector());
|
||||
|
||||
glm::mat4 la = glm::lookAt(c->position().vec3(), fn->worldPosition().vec3(), c->lookUpVector());
|
||||
c->setRotation(la);
|
||||
c->setPosition(cameraPosition);
|
||||
c->setScaling(cameraScaling);
|
||||
|
||||
glm::vec3 viewOffset;
|
||||
if (cameraDictionary.hasKey(constants::scenegraph::keyViewOffset)
|
||||
|
||||
Reference in New Issue
Block a user