General code cleanup

This commit is contained in:
Alexander Bock
2020-04-14 15:48:58 +02:00
parent 660533e840
commit f1fe2f197b
54 changed files with 339 additions and 309 deletions

View File

@@ -122,7 +122,8 @@ 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::InteractionMonitor& interactionMonitor =
detail::gInteractionMonitor();
static interaction::JoystickInputStates& joystickInputStates =
detail::gJoystickInputStates();
static interaction::WebsocketInputStates& websocketInputStates =

View File

@@ -112,9 +112,9 @@ struct WindowDelegate {
double (*getHorizFieldOfView)() = []() { return 0.0; };
void (*setHorizFieldOfView)(float hFovDeg) = [](float) { };
void* (*getNativeWindowHandle)(size_t windowIndex) = [](size_t) -> void* {
return nullptr;
void* (*getNativeWindowHandle)(size_t windowIndex) = [](size_t) -> void* {
return nullptr;
};
using GLProcAddress = void(*)(void);

View File

@@ -135,7 +135,7 @@ public:
WebsocketCameraStates::AxisInvert::No,
WebsocketCameraStates::AxisNormalize shouldNormalize =
WebsocketCameraStates::AxisNormalize::No);
NavigationState navigationState() const;
NavigationState navigationState(const SceneGraphNode& referenceFrame) const;

View File

@@ -79,10 +79,10 @@ public:
JoystickCameraStates& joystickStates();
const JoystickCameraStates& joystickStates() const;
WebsocketCameraStates& websocketStates();
const WebsocketCameraStates& websocketStates() const;
ScriptCameraStates& scriptStates();
const ScriptCameraStates& scriptStates() const;
@@ -246,19 +246,22 @@ private:
* Translates the horizontal direction. If far from the anchor object, this will
* result in an orbital rotation around the object. This function does not affect the
* rotation but only the position.
* \returns a position vector adjusted in the horizontal direction.
*
* \return a position vector adjusted in the horizontal direction.
*/
glm::dvec3 translateHorizontally(double deltaTime, const glm::dvec3& cameraPosition,
const glm::dvec3& objectPosition, const glm::dquat& globalCameraRotation,
const SurfacePositionHandle& positionHandle) const;
/**
* Moves the camera along a vector, camPosToCenterPosDiff, until it reaches the focusLimit.
* The velocity of the zooming depend on distFromCameraToFocus and the final frame
* where the camera stops moving depends on the distance set in the variable focusLimit.
* The bool determines whether to move/fly towards the focus node or away from it.
* \returns a new position of the camera, closer to the focusLimit than the previous
* position.
* Moves the camera along a vector, camPosToCenterPosDiff, until it reaches the
* focusLimit. The velocity of the zooming depend on distFromCameraToFocus and the
* final frame where the camera stops moving depends on the distance set in the
* variable focusLimit. The bool determines whether to move/fly towards the focus node
* or away from it.
*
* \return a new position of the camera, closer to the focusLimit than the previous
* position
*/
glm::dvec3 moveCameraAlongVector(const glm::dvec3& camPos,
double distFromCameraToFocus, const glm::dvec3& camPosToCenterPosDiff,
@@ -267,14 +270,16 @@ private:
/*
* Adds rotation to the camera position so that it follows the rotation of the anchor
* node defined by the differential anchorNodeRotationDiff.
* \returns a position updated with the rotation defined by anchorNodeRotationDiff
*
* \return a position updated with the rotation defined by anchorNodeRotationDiff
*/
glm::dvec3 followAnchorNodeRotation(const glm::dvec3& cameraPosition,
const glm::dvec3& objectPosition, const glm::dquat& anchorNodeRotationDiff) const;
/**
* Updates the global rotation so that it points towards the anchor node.
* \returns a global rotation quaternion defining a rotation towards the anchor node.
*
* \return a global rotation quaternion defining a rotation towards the anchor node
*/
glm::dquat rotateGlobally(const glm::dquat& globalCameraRotation,
const glm::dquat& aimNodeRotationDiff,
@@ -290,7 +295,8 @@ private:
/**
* Rotates the camera around the out vector of the surface.
* \returns a quaternion adjusted to rotate around the out vector of the surface.
*
* \return a quaternion adjusted to rotate around the out vector of the surface
*/
glm::dquat rotateHorizontally(double deltaTime,
const glm::dquat& globalCameraRotation,
@@ -298,8 +304,9 @@ private:
/**
* Push the camera out to the surface of the object.
* \returns a position vector adjusted to be at least minHeightAboveGround meters
* above the actual surface of the object
*
* \return a position vector adjusted to be at least minHeightAboveGround meters
* above the actual surface of the object
*/
glm::dvec3 pushToSurface(double minHeightAboveGround,
const glm::dvec3& cameraPosition, const glm::dvec3& objectPosition,

View File

@@ -106,7 +106,8 @@ private:
namespace ghoul {
template <>
std::string to_string(const openspace::interaction::WebsocketCameraStates::AxisType& type);
std::string to_string(
const openspace::interaction::WebsocketCameraStates::AxisType& type);
template <>
openspace::interaction::WebsocketCameraStates::AxisType

View File

@@ -84,9 +84,9 @@ constexpr const int MaxWebsockets = 16;
struct WebsocketInputStates : public std::unordered_map<size_t, WebsocketInputState*> {
/**
* This function adds the contributions of all connected websockets for the provided
* \p axis. After adding each websockets contribution, the result is clamped to [-1,1].
* If a websocket does not possess a particular axis, it's does not contribute to the
* sum.
* \p axis. After adding each websockets contribution, the result is clamped to
* [-1,1]. If a websocket does not possess a particular axis, it's does not contribute
* to the sum.
*
* \param axis The numerical axis for which the values are added
* \return The summed axis values of all connected websockets

View File

@@ -80,7 +80,6 @@ public:
void setLightness(float lightness) override;
void setColorSpace(unsigned int colorspace) override;
void enableBloom(bool enable) override;
void enableHistogram(bool enable) override;

View File

@@ -71,17 +71,17 @@ public:
void updateHDRAndFiltering();
void updateFXAA();
void updateDownscaledVolume();
void setResolution(glm::ivec2 res) override;
void setHDRExposure(float hdrExposure) override;
void setGamma(float gamma) override;
void setHue(float hue) override;
void setValue(float value) override;
void setSaturation(float sat) override;
void enableFXAA(bool enable) override;
void setDisableHDR(bool disable) override;
void update() override;
void performRaycasterTasks(const std::vector<RaycasterTask>& tasks);
void performDeferredTasks(const std::vector<DeferredcasterTask>& tasks);
@@ -114,7 +114,7 @@ private:
void updateDownscaleTextures();
void updateExitVolumeTextures();
void writeDownscaledVolume();
std::map<VolumeRaycaster*, RaycastData> _raycastData;
RaycasterProgObjMap _exitPrograms;
RaycasterProgObjMap _raycastPrograms;
@@ -131,7 +131,7 @@ private:
UniformCache(hdrFeedingTexture, blackoutFactor, hdrExposure, gamma,
Hue, Saturation, Value) _hdrUniformCache;
UniformCache(renderedTexture, inverseScreenSize) _fxaaUniformCache;
UniformCache(downscaledRenderedVolume, downscaledRenderedVolumeDepth)
UniformCache(downscaledRenderedVolume, downscaledRenderedVolumeDepth)
_writeDownscaledVolumeUniformCache;
GLint _defaultFBO;
@@ -158,7 +158,7 @@ private:
GLuint hdrFilteringFramebuffer;
GLuint hdrFilteringTexture;
} _hdrBuffers;
struct {
GLuint fxaaFramebuffer;
GLuint fxaaTexture;
@@ -176,18 +176,18 @@ private:
bool _dirtyDeferredcastData;
bool _dirtyRaycastData;
bool _dirtyResolution;
glm::ivec2 _resolution = glm::ivec2(0);
int _nAaSamples;
bool _enableFXAA = true;
bool _disableHDR = false;
float _hdrExposure = 3.7f;
float _gamma = 0.95f;
float _hue = 1.f;
float _saturation = 1.f;
float _value = 1.f;
ghoul::Dictionary _rendererData;
};

View File

@@ -211,7 +211,7 @@ private:
properties::BoolProperty _disableMasterRendering;
properties::FloatProperty _globalBlackOutFactor;
properties::BoolProperty _enableFXAA;
properties::BoolProperty _disableHDRPipeline;
@@ -221,13 +221,13 @@ private:
properties::FloatProperty _hue;
properties::FloatProperty _saturation;
properties::FloatProperty _value;
properties::FloatProperty _horizFieldOfView;
properties::Vec3Property _globalRotation;
properties::Vec3Property _screenSpaceRotation;
properties::Vec3Property _masterRotation;
uint64_t _frameNumber = 0;
unsigned int _latestScreenshotNumber = 0;

View File

@@ -139,7 +139,7 @@ public:
private:
/**
* Maximum number of integration steps to be executed by the volume integrator.
* Maximum number of integration steps to be executed by the volume integrator.
*/
int _rayCastMaxSteps = 1000;

View File

@@ -198,7 +198,7 @@ private:
properties::DoubleProperty _distFromCamToNode;
properties::DoubleProperty _screenSizeRadius;
properties::FloatProperty _visibilityDistance;
// This variable is used for the rate-limiting of the screenspace positions (if they
// are calculated when _computeScreenSpaceValues is true)
std::chrono::high_resolution_clock::time_point _lastScreenSpaceUpdateTime;

View File

@@ -52,7 +52,7 @@ struct TouchInput {
double timestamp; // timestamp in seconds from global touch initialization
};
// The TouchInputHolder holds one or many TouchInputs, in order to track the history of
// The TouchInputHolder holds one or many TouchInputs, in order to track the history of
// the finger/input device
class TouchInputHolder {
public:
@@ -62,7 +62,7 @@ public:
// Fails upon a too similar input as last.
// Updates time for the last input if same position.
bool tryAddInput(TouchInput input);
void clearInputs();
// Checks whether or not this Holder actually holds a specific input (based on IDs)