mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-04 09:59:44 -05:00
Merging with master
This commit is contained in:
@@ -53,6 +53,7 @@ namespace configuration { struct Configuration; }
|
||||
namespace interaction {
|
||||
struct JoystickInputStates;
|
||||
struct WebsocketInputStates;
|
||||
class InteractionMonitor;
|
||||
class KeybindingManager;
|
||||
class NavigationHandler;
|
||||
class SessionRecording;
|
||||
@@ -87,6 +88,7 @@ VersionChecker& gVersionChecker();
|
||||
VirtualPropertyManager& gVirtualPropertyManager();
|
||||
WindowDelegate& gWindowDelegate();
|
||||
configuration::Configuration& gConfiguration();
|
||||
interaction::InteractionMonitor& gInteractionMonitor();
|
||||
interaction::JoystickInputStates& gJoystickInputStates();
|
||||
interaction::WebsocketInputStates& gWebsocketInputStates();
|
||||
interaction::KeybindingManager& gKeybindingManager();
|
||||
@@ -120,6 +122,7 @@ static VersionChecker& versionChecker = detail::gVersionChecker();
|
||||
static VirtualPropertyManager& virtualPropertyManager = detail::gVirtualPropertyManager();
|
||||
static WindowDelegate& windowDelegate = detail::gWindowDelegate();
|
||||
static configuration::Configuration& configuration = detail::gConfiguration();
|
||||
static interaction::InteractionMonitor& interactionMonitor = detail::gInteractionMonitor();
|
||||
static interaction::JoystickInputStates& joystickInputStates =
|
||||
detail::gJoystickInputStates();
|
||||
static interaction::WebsocketInputStates& websocketInputStates =
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <openspace/util/keys.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
#include <openspace/util/touch.h>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
@@ -53,6 +54,10 @@ std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>>& gMouseB
|
||||
std::vector<std::function<void(double, double)>>& gMousePosition();
|
||||
std::vector<std::function<bool(double, double)>>& gMouseScrollWheel();
|
||||
|
||||
std::vector<std::function<bool(TouchInput)>>& gTouchDetected();
|
||||
std::vector<std::function<bool(TouchInput)>>& gTouchUpdated();
|
||||
std::vector<std::function<void(TouchInput)>>& gTouchExit();
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace callback {
|
||||
@@ -76,7 +81,12 @@ static std::vector<std::function<void(double, double)>>& mousePosition =
|
||||
detail::gMousePosition();
|
||||
static std::vector<std::function<bool(double, double)>>& mouseScrollWheel =
|
||||
detail::gMouseScrollWheel();
|
||||
|
||||
static std::vector<std::function<bool(TouchInput)>>& touchDetected =
|
||||
detail::gTouchDetected();
|
||||
static std::vector<std::function<bool(TouchInput)>>& touchUpdated =
|
||||
detail::gTouchUpdated();
|
||||
static std::vector<std::function<void(TouchInput)>>& touchExit =
|
||||
detail::gTouchExit();
|
||||
|
||||
/**
|
||||
* If the framerate becomes slow, Chromium Embedded Framework (used in Web Browser Module)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/keys.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
#include <openspace/util/touch.h>
|
||||
#include <openspace/util/versionchecker.h>
|
||||
#include <ghoul/glm.h>
|
||||
#include <memory>
|
||||
@@ -80,7 +81,9 @@ public:
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action, KeyModifier mods);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double posX, double posY);
|
||||
void externalControlCallback(const char* receivedChars, int size, int clientId);
|
||||
void touchDetectionCallback(TouchInput input);
|
||||
void touchUpdateCallback(TouchInput input);
|
||||
void touchExitCallback(TouchInput input);
|
||||
std::vector<char> encode();
|
||||
void decode(std::vector<char> data);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ struct WindowDelegate {
|
||||
|
||||
bool (*isFisheyeRendering)() = []() { return false; };
|
||||
|
||||
void (*takeScreenshot)(bool applyWarping) = [](bool) { };
|
||||
unsigned int(*takeScreenshot)(bool applyWarping) = [](bool) { return 0u; };
|
||||
|
||||
void (*swapBuffer)() = []() {};
|
||||
|
||||
@@ -118,6 +118,10 @@ struct WindowDelegate {
|
||||
double (*getHorizFieldOfView)() = []() { return 0.0; };
|
||||
|
||||
void (*setHorizFieldOfView)(float hFovDeg) = [](float) { };
|
||||
|
||||
void* (*getNativeWindowHandle)(size_t windowIndex) = [](size_t) -> void* {
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
using GLProcAddress = void(*)(void);
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2019 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___INTERACTIONMONITOR___H__
|
||||
#define __OPENSPACE_CORE___INTERACTIONMONITOR___H__
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
|
||||
namespace openspace::interaction {
|
||||
|
||||
/**
|
||||
* The class InteractionMonitor keeps track of user interactions during an OpenSpace
|
||||
* session. It keeps track of when the latest interaction was made and of when the state
|
||||
* changes to idle.
|
||||
*/
|
||||
class InteractionMonitor : public properties::PropertyOwner {
|
||||
public:
|
||||
InteractionMonitor();
|
||||
|
||||
void setActivityState(bool isActive);
|
||||
void setIdleTime(float time);
|
||||
|
||||
/*
|
||||
* Called every frame from OpenSpaceEngine and calculates the activity state depending
|
||||
* on the last registered interaction.
|
||||
*/
|
||||
void updateActivityState();
|
||||
|
||||
/*
|
||||
* Called from all places we want to mark activity from. Updates the last registered
|
||||
* interaction time
|
||||
*/
|
||||
void markInteraction();
|
||||
|
||||
private:
|
||||
double _lastInteractionTime = 0;
|
||||
properties::BoolProperty _isInActiveState;
|
||||
properties::FloatProperty _idleTime; // in seconds
|
||||
|
||||
// @TODO (lovisa) make a list of interactions to listen for
|
||||
// and only allow registering updates from those interactions
|
||||
};
|
||||
|
||||
} // namespace openspace::interaction
|
||||
|
||||
#endif // __OPENSPACE_CORE___INTERACTIONMONITOR___H__
|
||||
@@ -136,6 +136,7 @@ public:
|
||||
WebsocketCameraStates::AxisNormalize shouldNormalize =
|
||||
WebsocketCameraStates::AxisNormalize::No);
|
||||
|
||||
NavigationState navigationState() const;
|
||||
NavigationState navigationState(const SceneGraphNode& referenceFrame) const;
|
||||
|
||||
void saveNavigationState(const std::string& filepath,
|
||||
|
||||
@@ -395,9 +395,7 @@ public:
|
||||
/**
|
||||
* Default view options that can be used in the Property::setViewOption method. The
|
||||
* values are: Property::ViewOptions::Color = \c color,
|
||||
* Property::ViewOptions::LightPosition = \c lightPosition,
|
||||
* Property::ViewOptions::PowerScaledScalar = \c powerScaledScalar, and
|
||||
* Property::ViewOptions::PowerScaledCoordinate = \c powerScaledCoordinate.
|
||||
* Property::ViewOptions::LightPosition = \c lightPosition
|
||||
*/
|
||||
struct ViewOptions {
|
||||
static const char* Color;
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
void updateDeferredcastData();
|
||||
void updateHDRAndFiltering();
|
||||
void updateFXAA();
|
||||
void updateDownscaledVolume();
|
||||
|
||||
void setResolution(glm::ivec2 res) override;
|
||||
void setHDRExposure(float hdrExposure) override;
|
||||
@@ -110,6 +111,9 @@ private:
|
||||
void resolveMSAA(float blackoutFactor);
|
||||
void applyTMO(float blackoutFactor);
|
||||
void applyFXAA();
|
||||
void updateDownscaleTextures();
|
||||
void updateExitVolumeTextures();
|
||||
void writeDownscaledVolume();
|
||||
|
||||
std::map<VolumeRaycaster*, RaycastData> _raycastData;
|
||||
RaycasterProgObjMap _exitPrograms;
|
||||
@@ -122,10 +126,13 @@ private:
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _hdrFilteringProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _tmoProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _fxaaProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _downscaledVolumeProgram;
|
||||
|
||||
UniformCache(hdrFeedingTexture, blackoutFactor, hdrExposure, gamma,
|
||||
Hue, Saturation, Value) _hdrUniformCache;
|
||||
UniformCache(renderedTexture, inverseScreenSize) _fxaaUniformCache;
|
||||
UniformCache(downscaledRenderedVolume, downscaledRenderedVolumeDepth)
|
||||
_writeDownscaledVolumeUniformCache;
|
||||
|
||||
GLint _defaultFBO;
|
||||
GLuint _screenQuad;
|
||||
@@ -157,6 +164,13 @@ private:
|
||||
GLuint fxaaTexture;
|
||||
} _fxaaBuffers;
|
||||
|
||||
struct {
|
||||
GLuint framebuffer;
|
||||
GLuint colorTexture;
|
||||
GLuint depthbuffer;
|
||||
float currentDownscaleFactor = 1.f;
|
||||
} _downscaleVolumeRendering;
|
||||
|
||||
unsigned int _pingPongIndex = 0u;
|
||||
|
||||
bool _dirtyDeferredcastData;
|
||||
|
||||
@@ -142,9 +142,14 @@ public:
|
||||
void setResolveData(ghoul::Dictionary resolveData);
|
||||
|
||||
/**
|
||||
* Mark that one screenshot should be taken
|
||||
* Take a screenshot and store in the ${SCREENSHOTS} directory
|
||||
*/
|
||||
void takeScreenShot();
|
||||
void takeScreenshot();
|
||||
|
||||
/**
|
||||
* Get the filename of the latest screenshot
|
||||
*/
|
||||
unsigned int latestScreenshotNumber() const;
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
@@ -187,8 +192,6 @@ private:
|
||||
properties::BoolProperty _showVersionInfo;
|
||||
properties::BoolProperty _showCameraInfo;
|
||||
|
||||
properties::TriggerProperty _takeScreenshot;
|
||||
bool _shouldTakeScreenshot = false;
|
||||
properties::BoolProperty _applyWarping;
|
||||
properties::BoolProperty _showFrameInformation;
|
||||
#ifdef OPENSPACE_WITH_INSTRUMENTATION
|
||||
@@ -226,6 +229,7 @@ private:
|
||||
properties::Vec3Property _masterRotation;
|
||||
|
||||
uint64_t _frameNumber = 0;
|
||||
unsigned int _latestScreenshotNumber = 0;
|
||||
|
||||
std::vector<ghoul::opengl::ProgramObject*> _programs;
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ public:
|
||||
|
||||
protected:
|
||||
void createShaders();
|
||||
std::string makeUniqueIdentifier(std::string name);
|
||||
|
||||
glm::mat4 scaleMatrix();
|
||||
glm::mat4 globalRotationMatrix();
|
||||
glm::mat4 translationMatrix();
|
||||
|
||||
@@ -128,6 +128,25 @@ public:
|
||||
* helper file) which should be a prefix to all symbols defined by the helper
|
||||
*/
|
||||
virtual std::string helperPath() const = 0;
|
||||
|
||||
void setMaxSteps(int nsteps);
|
||||
|
||||
int maxSteps() const;
|
||||
|
||||
void setDownscaleRender(float value);
|
||||
|
||||
float downscaleRender() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Maximum number of integration steps to be executed by the volume integrator.
|
||||
*/
|
||||
int _rayCastMaxSteps = 1000;
|
||||
|
||||
/**
|
||||
* Enable and set the downscale rendering of the volume. Used to improve performance.
|
||||
*/
|
||||
float _downscaleRenderConst = 1.0f;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#ifndef __OPENSPACE_CORE___CAMERA___H__
|
||||
#define __OPENSPACE_CORE___CAMERA___H__
|
||||
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/syncdata.h>
|
||||
#include <ghoul/glm.h>
|
||||
#include <mutex>
|
||||
@@ -36,7 +35,6 @@ class SceneGraphNode;
|
||||
|
||||
/**
|
||||
* This class still needs some more love. Suggested improvements:
|
||||
* - Remove psc from the camera class interface.
|
||||
* - Accessors should return constant references to double precision class members.
|
||||
* - Remove the scaling variable (What is it used for?)
|
||||
* - Remove the maxFov and sinMaxfov variables. Redundant since the fov is embedded
|
||||
@@ -101,7 +99,6 @@ public:
|
||||
// Right now this function returns the actual combined matrix which makes some
|
||||
// of the old calls to the function wrong..
|
||||
const glm::dmat4& combinedViewMatrix() const;
|
||||
const glm::dmat4& combinedViewMatrixNoScale() const;
|
||||
|
||||
void invalidateCache();
|
||||
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2019 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___POWERSCALEDCOORDINATE___H__
|
||||
#define __OPENSPACE_CORE___POWERSCALEDCOORDINATE___H__
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class PowerScaledScalar;
|
||||
|
||||
class PowerScaledCoordinate {
|
||||
public:
|
||||
// constructors
|
||||
PowerScaledCoordinate() = default;
|
||||
|
||||
PowerScaledCoordinate(PowerScaledCoordinate&& rhs);
|
||||
PowerScaledCoordinate(const PowerScaledCoordinate& rhs);
|
||||
|
||||
// Sets the power scaled coordinates directly
|
||||
PowerScaledCoordinate(glm::vec4 v);
|
||||
PowerScaledCoordinate(float f1, float f2, float f3, float f4);
|
||||
// Sets the power scaled coordinates with w = 0
|
||||
PowerScaledCoordinate(glm::vec3 v);
|
||||
|
||||
static PowerScaledCoordinate CreatePowerScaledCoordinate(double d1, double d2,
|
||||
double d3);
|
||||
|
||||
// get functions
|
||||
// return the full, unmodified PSC
|
||||
const glm::vec4& vec4() const;
|
||||
|
||||
// returns the rescaled, "normal" coordinates
|
||||
glm::vec3 vec3() const;
|
||||
|
||||
// return the full psc as dvec4()
|
||||
glm::dvec4 dvec4() const;
|
||||
|
||||
// rescaled return as dvec3
|
||||
glm::dvec3 dvec3() const;
|
||||
|
||||
// length of the vector as a pss
|
||||
float length() const;
|
||||
glm::vec3 direction() const;
|
||||
|
||||
// operator overloading
|
||||
PowerScaledCoordinate& operator=(const PowerScaledCoordinate& rhs);
|
||||
PowerScaledCoordinate& operator=(PowerScaledCoordinate&& rhs);
|
||||
PowerScaledCoordinate& operator+=(const PowerScaledCoordinate& rhs);
|
||||
PowerScaledCoordinate operator+(const PowerScaledCoordinate& rhs) const;
|
||||
PowerScaledCoordinate& operator-=(const PowerScaledCoordinate& rhs);
|
||||
PowerScaledCoordinate operator-(const PowerScaledCoordinate& rhs) const;
|
||||
float& operator[](unsigned int idx);
|
||||
float operator[](unsigned int idx) const;
|
||||
double dot(const PowerScaledCoordinate& rhs) const;
|
||||
double angle(const PowerScaledCoordinate& rhs) const;
|
||||
|
||||
// scalar operators
|
||||
PowerScaledCoordinate operator*(const double& rhs) const;
|
||||
PowerScaledCoordinate operator*(const float& rhs) const;
|
||||
PowerScaledCoordinate operator*(const glm::mat4& matrix) const;
|
||||
|
||||
|
||||
// comparison
|
||||
bool operator==(const PowerScaledCoordinate& other) const;
|
||||
bool operator!=(const PowerScaledCoordinate& other) const;
|
||||
bool operator<(const PowerScaledCoordinate& other) const;
|
||||
bool operator>(const PowerScaledCoordinate& other) const;
|
||||
bool operator<=(const PowerScaledCoordinate& other) const;
|
||||
bool operator>=(const PowerScaledCoordinate& other) const;
|
||||
|
||||
// glm integration
|
||||
PowerScaledCoordinate& operator=(const glm::dvec4& rhs);
|
||||
PowerScaledCoordinate& operator=(const glm::vec4& rhs);
|
||||
PowerScaledCoordinate& operator=(const glm::dvec3& rhs);
|
||||
PowerScaledCoordinate& operator=(const glm::vec3& rhs);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const PowerScaledCoordinate& rhs);
|
||||
|
||||
// allow the power scaled scalars to access private members
|
||||
friend class PowerScaledScalar;
|
||||
|
||||
private:
|
||||
// internal glm vector
|
||||
glm::vec4 _vec = glm::vec4(0.f);
|
||||
};
|
||||
|
||||
typedef PowerScaledCoordinate psc;
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___POWERSCALEDCOORDINATE___H__
|
||||
@@ -22,22 +22,20 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___POWERSCALEDSPHERE___H__
|
||||
#define __OPENSPACE_CORE___POWERSCALEDSPHERE___H__
|
||||
#ifndef __OPENSPACE_CORE___SPHERE___H__
|
||||
#define __OPENSPACE_CORE___SPHERE___H__
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class PowerScaledSphere;
|
||||
|
||||
class PowerScaledSphere {
|
||||
class Sphere {
|
||||
public:
|
||||
PowerScaledSphere(float radius, int segments = 8);
|
||||
PowerScaledSphere(glm::vec3 radius, int segments);
|
||||
PowerScaledSphere(const PowerScaledSphere& cpy);
|
||||
~PowerScaledSphere();
|
||||
Sphere(float radius, int segments = 8);
|
||||
Sphere(glm::vec3 radius, int segments);
|
||||
Sphere(const Sphere& cpy);
|
||||
~Sphere();
|
||||
|
||||
bool initialize();
|
||||
|
||||
@@ -62,4 +60,4 @@ public:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___POWERSCALEDSPHERE___H__
|
||||
#endif // __OPENSPACE_CORE___SPHERE___H__
|
||||
@@ -652,36 +652,6 @@ public:
|
||||
FieldOfViewMethod method, AberrationCorrection aberrationCorrection,
|
||||
double& ephemerisTime) const;
|
||||
|
||||
/**
|
||||
* Determine whether a specific \p target is in the field-of-view of a specified
|
||||
* \p instrument or an \p observer at a given time. The reference frame used is
|
||||
* derived from the \p target by converting it into an \c IAU inertial reference
|
||||
* frame.
|
||||
*
|
||||
* \param target The name or NAIF ID code string of the target
|
||||
* \param observer The name or NAIF ID code string of the observer
|
||||
* \param instrument The name or NAIF ID code string of the instrument
|
||||
* \param method The type of shape model used for the target
|
||||
* \param aberrationCorrection The aberration correction method
|
||||
* \param ephemerisTime Time of the observation (seconds past J2000)
|
||||
* \return \c true if the target is visible, \c false otherwise
|
||||
*
|
||||
* \throw SpiceException If the \p target or \p observer do not name valid
|
||||
* NAIF objects, the \p target or \p observer name the same NAIF object, the
|
||||
* \p instrument does not name a valid NAIF object, or insufficient kernel
|
||||
* information has been loaded.
|
||||
* \pre \p target must not be empty.
|
||||
* \pre \p observer must not be empty.
|
||||
* \pre \p target and \p observer must not be different strings
|
||||
* \pre \p referenceFrame must not be empty.
|
||||
* \pre \p instrument must not be empty.
|
||||
*
|
||||
* \sa http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/fovtrg_c.html
|
||||
*/
|
||||
bool isTargetInFieldOfView(const std::string& target, const std::string& observer,
|
||||
const std::string& instrument, FieldOfViewMethod method,
|
||||
AberrationCorrection aberrationCorrection, double& ephemerisTime) const;
|
||||
|
||||
/// Struct that is used as the return value from the #targetState method
|
||||
struct TargetStateResult {
|
||||
/// The target position
|
||||
@@ -902,26 +872,6 @@ public:
|
||||
AberrationCorrection aberrationCorrection, double ephemerisTime,
|
||||
int numberOfTerminatorPoints);
|
||||
|
||||
/**
|
||||
* This function adds a frame to a body.
|
||||
*
|
||||
* \param body - the name of the body
|
||||
* \param frame - the name of the frame
|
||||
* \return false if the arguments are empty
|
||||
*
|
||||
* \todo I think this function should die ---abock
|
||||
*/
|
||||
bool addFrame(std::string body, std::string frame);
|
||||
|
||||
/**
|
||||
* This function returns the frame of a body if defined, otherwise it returns
|
||||
* IAU_ + body (most frames are known by the International Astronomical Union)
|
||||
* \param body - the name of the body
|
||||
* \return the frame of the body
|
||||
* \todo I think this function should die ---abock
|
||||
*/
|
||||
std::string frameFromBody(const std::string& body) const;
|
||||
|
||||
/**
|
||||
* Sets the SpiceManager's exception handling. If UseException::No is passed to this
|
||||
* function, all subsequent calls will not throw an error, but fail silently instead.
|
||||
@@ -1048,8 +998,6 @@ private:
|
||||
std::map<int, std::vector< std::pair<double, double>>> _spkIntervals;
|
||||
std::map<int, std::set<double>> _ckCoverageTimes;
|
||||
std::map<int, std::set<double>> _spkCoverageTimes;
|
||||
// Vector of pairs: Body, Frame
|
||||
std::vector<std::pair<std::string, std::string>> _frameByBody;
|
||||
|
||||
/// Stores whether the SpiceManager throws exceptions (Yes) or fails silently (No)
|
||||
UseException _useExceptions = UseException::Yes;
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___TOUCH___H__
|
||||
#define __OPENSPACE_CORE___TOUCH___H__
|
||||
|
||||
#include <glm/detail/type_vec2.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct TouchInput {
|
||||
TouchInput(size_t touchDeviceId, size_t fingerId, float x, float y, double timestamp);
|
||||
glm::vec2 screenCoordinates(glm::vec2 resolution) const;
|
||||
glm::vec2 currentWindowCoordinates() const;
|
||||
bool isMoving() const;
|
||||
float distanceToPos(float otherX, float otherY) const;
|
||||
float angleToPos(float otherX, float otherY) const;
|
||||
|
||||
size_t touchDeviceId;
|
||||
size_t fingerId;
|
||||
float x;
|
||||
float y;
|
||||
float dx = 0.f; // movement in x direction since last touch input
|
||||
float dy = 0.f; // movement in y direction since last touch input
|
||||
double timestamp; // timestamp in seconds from global touch initialization
|
||||
};
|
||||
|
||||
class TouchInputHolder {
|
||||
public:
|
||||
TouchInputHolder(TouchInput input);
|
||||
|
||||
// tryAddInput:
|
||||
// Succeeds upon a different input than last.
|
||||
// Fails upon a too similar input as last.
|
||||
bool tryAddInput(TouchInput input);
|
||||
void clearInputs();
|
||||
|
||||
bool holdsInput(const TouchInput &input) const;
|
||||
|
||||
size_t touchDeviceId() const;
|
||||
size_t fingerId() const;
|
||||
|
||||
float speedX() const;
|
||||
float speedY() const;
|
||||
|
||||
bool isMoving() const;
|
||||
float gestureDistance() const;
|
||||
double gestureTime() const;
|
||||
|
||||
size_t numInputs() const;
|
||||
const TouchInput& latestInput() const;
|
||||
const std::deque<TouchInput>& peekInputs() const;
|
||||
|
||||
private:
|
||||
//A deque of recorded inputs. Adding newer points to the front of the queue
|
||||
std::deque<TouchInput> _inputs;
|
||||
|
||||
size_t _touchDeviceId;
|
||||
size_t _fingerId;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___TOUCH___H__
|
||||
@@ -26,7 +26,6 @@
|
||||
#define __OPENSPACE_CORE___UPDATESTRUCTURES___H__
|
||||
|
||||
#include <openspace/util/camera.h>
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/time.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Reference in New Issue
Block a user