mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-24 13:28:55 -05:00
Change how the calculation of the fine tuning is done
This commit is contained in:
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
// Mouse interaction
|
||||
void startFinetuningTarget();
|
||||
void fineTuneTarget(const glm::vec2& startMouse, const glm::vec2& translation);
|
||||
void fineTuneTarget(const glm::vec2& translation);
|
||||
void synchronizeAim();
|
||||
|
||||
// Browser
|
||||
|
||||
@@ -693,18 +693,15 @@ namespace {
|
||||
* and third is the end position of the drag.
|
||||
*/
|
||||
[[codegen::luawrap]] void finetuneTargetPosition(std::string identifier,
|
||||
glm::vec2 startPosition,
|
||||
glm::vec2 endPosition)
|
||||
glm::dvec2 translation)
|
||||
{
|
||||
using namespace openspace;
|
||||
|
||||
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
|
||||
TargetBrowserPair* pair = module->pair(identifier);
|
||||
if (pair) {
|
||||
glm::vec2 startScreenSpace = skybrowser::pixelToScreenSpace2d(startPosition);
|
||||
glm::vec2 endScreenSpace = skybrowser::pixelToScreenSpace2d(endPosition);
|
||||
glm::vec2 translation = endScreenSpace - startScreenSpace;
|
||||
pair->fineTuneTarget(startScreenSpace, translation);
|
||||
pair->fineTuneTarget(translation);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,22 +85,14 @@ void TargetBrowserPair::startFinetuningTarget() {
|
||||
// The fine tune of the target is a way to "drag and drop" the target with right click
|
||||
// drag on the sky browser window. This is to be able to drag the target around when it
|
||||
// has a very small field of view
|
||||
void TargetBrowserPair::fineTuneTarget(const glm::vec2& startMouse,
|
||||
const glm::vec2& translation)
|
||||
void TargetBrowserPair::fineTuneTarget(const glm::vec2& translation)
|
||||
{
|
||||
glm::vec2 fineTune = _browser->fineTuneVector(translation);
|
||||
glm::vec2 endMouse = startMouse + fineTune;
|
||||
|
||||
// Translation world
|
||||
glm::dvec3 startWorld = skybrowser::localCameraToGalactic(
|
||||
glm::vec3(startMouse, skybrowser::ScreenSpaceZ)
|
||||
glm::dvec2 startRaDec = skybrowser::cartesianToSpherical(
|
||||
skybrowser::galacticToEquatorial(glm::normalize(_startTargetPosition))
|
||||
);
|
||||
glm::dvec3 endWorld = skybrowser::localCameraToGalactic(
|
||||
glm::vec3(endMouse, skybrowser::ScreenSpaceZ)
|
||||
);
|
||||
|
||||
glm::dvec3 translationWorld = endWorld - startWorld;
|
||||
aimTargetGalactic(_startTargetPosition + translationWorld);
|
||||
glm::dvec2 newRaDec = startRaDec + glm::dvec2(translation);
|
||||
glm::dvec3 newCartesian = skybrowser::sphericalToCartesian(newRaDec);
|
||||
aimTargetGalactic(skybrowser::equatorialToGalactic(newCartesian));
|
||||
}
|
||||
|
||||
void TargetBrowserPair::synchronizeAim() {
|
||||
|
||||
Reference in New Issue
Block a user