Merge branch 'master' into feature/radec-conversion

This commit is contained in:
Malin Ejdbo
2021-06-17 11:19:51 +02:00
23 changed files with 271 additions and 44 deletions

View File

@@ -263,7 +263,7 @@ QWidget* LauncherWindow::createCentralWidget() {
[this]() {
const std::string selection = _profileBox->currentText().toStdString();
int selectedIndex = _profileBox->currentIndex();
bool isUserProfile = selectedIndex <= _userAssetCount;
bool isUserProfile = selectedIndex < _userAssetCount;
openProfileEditor(selection, isUserProfile);
}
);

View File

@@ -0,0 +1,227 @@
local assetHelper = asset.require('util/asset_helper')
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
local model = asset.syncedResource({
Name = "Animated Box",
Type = "HttpSynchronization",
Identifier = "animated_box",
Version = 1
})
local StartTime = "2021 06 01 00:00:00";
local animationLoop = {
Identifier = "animationLoop",
Parent = transforms.EarthCenter.Identifier,
Transform = {
Translation = {
Type = "StaticTranslation",
Position = { 0.0, -11E7, 0.0 }
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = model .. "/BoxAnimated.glb",
EnableAnimation = true,
AnimationMode = "LoopFromStart",
AnimationStartTime = StartTime,
ModelScale = 3E7,
LightSources = {
{
Type = "SceneGraphLightSource",
Identifier = "Sun",
Node = sunTransforms.SolarSystemBarycenter.Identifier,
Intensity = 1.0
}
},
PerformShading = true,
DisableFaceCulling = true
},
GUI = {
Name = "Animated Model example (LoopFromStart)",
Path = "/Example",
Description = "Simple animated box model with the animation mode 'LoopFromStart'",
}
}
local animationLoopInf = {
Identifier = "animationLoopInf",
Parent = transforms.EarthCenter.Identifier,
Transform = {
Translation = {
Type = "StaticTranslation",
Position = { 0.0, 11E7, 0.0 }
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = model .. "/BoxAnimated.glb",
EnableAnimation = true,
AnimationMode = "LoopInfinitely",
AnimationStartTime = StartTime,
ModelScale = 3E7,
LightSources = {
{
Type = "SceneGraphLightSource",
Identifier = "Sun",
Node = sunTransforms.SolarSystemBarycenter.Identifier,
Intensity = 1.0
}
},
PerformShading = true,
DisableFaceCulling = true
},
GUI = {
Name = "Animated Model example (LoopInfinitely)",
Path = "/Example",
Description = "Simple animated box model with the animation mode 'LoopInfinitely'",
}
}
local animationOnce = {
Identifier = "animationOnce",
Parent = transforms.EarthCenter.Identifier,
Transform = {
Translation = {
Type = "StaticTranslation",
Position = { 11E7, 0.0, 0.0 }
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = model .. "/BoxAnimated.glb",
EnableAnimation = true,
AnimationMode = "Once",
AnimationStartTime = StartTime,
ModelScale = 3E7,
LightSources = {
{
Type = "SceneGraphLightSource",
Identifier = "Sun",
Node = sunTransforms.SolarSystemBarycenter.Identifier,
Intensity = 1.0
}
},
PerformShading = true,
DisableFaceCulling = true
},
GUI = {
Name = "Animated Model example (Once)",
Path = "/Example",
Description = "Simple animated box model with the animation mode 'Once'",
}
}
local animationBounceInf = {
Identifier = "animationBounceInf",
Parent = transforms.EarthCenter.Identifier,
Transform = {
Translation = {
Type = "StaticTranslation",
Position = { 0.0, 0.0, 11E7 }
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = model .. "/BoxAnimated.glb",
EnableAnimation = true,
AnimationMode = "BounceInfinitely",
AnimationStartTime = StartTime,
ModelScale = 3E7,
LightSources = {
{
Type = "SceneGraphLightSource",
Identifier = "Sun",
Node = sunTransforms.SolarSystemBarycenter.Identifier,
Intensity = 1.0
}
},
PerformShading = true,
DisableFaceCulling = true
},
GUI = {
Name = "Animated Model example (BounceInfinitely)",
Path = "/Example",
Description = "Simple animated box model with the animation mode 'BounceInfinitely'",
}
}
local animationBounce = {
Identifier = "animationBounce",
Parent = transforms.EarthCenter.Identifier,
Transform = {
Translation = {
Type = "StaticTranslation",
Position = { 0.0, 0.0, -11E7 }
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = model .. "/BoxAnimated.glb",
EnableAnimation = true,
AnimationMode = "BounceFromStart",
AnimationStartTime = StartTime,
ModelScale = 3E7,
LightSources = {
{
Type = "SceneGraphLightSource",
Identifier = "Sun",
Node = sunTransforms.SolarSystemBarycenter.Identifier,
Intensity = 1.0
}
},
PerformShading = true,
DisableFaceCulling = true
},
GUI = {
Name = "Animated Model example (BounceFromStart)",
Path = "/Example",
Description = "Simple animated box model with the animation mode 'BounceFromStart'",
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, {
animationLoop,
animationLoopInf,
animationOnce,
animationBounceInf,
animationBounce
})
-- Asset
asset.meta = {
Name = "Animation Example asset",
Version = "1.0",
Description = "Simple animation example asset with an animated box model",
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license",
Identifiers = {
"animationLoop",
"animationLoopInf",
"animationOnce",
"animationBounceInf",
"animationBounce"
}
}
-- Model
asset.meta = {
Name = "Animated Box Model",
Version = "1.0",
Description = "Simple animated box model",
Author = "Cesium, https://cesium.com/",
URL = "https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated",
License = [[
Creative Commons Attribution 4.0 International License,
https://creativecommons.org/licenses/by/4.0/
]],
Identifiers = {
"animationLoop",
"animationLoopInf",
"animationOnce",
"animationBounceInf",
"animationBounce"
}
}

View File

@@ -125,7 +125,7 @@ private:
bool _hasScheduledAssetLoading = false;
std::string _scheduledAssetPathToLoad;
glm::vec2 _mousePosition;
glm::vec2 _mousePosition = glm::vec2(0.f);
//grabs json from each module to pass to the documentation engine.
std::string _documentationJson;

View File

@@ -161,7 +161,7 @@ private:
glm::vec3 _ozoneExtinctionCoeff = glm::vec3(0.f);
glm::vec3 _mieScatteringCoeff = glm::vec3(0.f);
glm::vec3 _mieExtinctionCoeff = glm::vec3(0.f);
glm::dvec3 _ellipsoidRadii = glm::vec3(0.f);
glm::dvec3 _ellipsoidRadii = glm::dvec3(0.0);
// Atmosphere Textures Dimmensions
glm::ivec2 _transmittanceTableSize = glm::ivec2(256, 64);

View File

@@ -230,11 +230,11 @@ void RenderableSphericalGrid::update(const UpdateData&) {
normal = glm::normalize(normal);
}
glm::vec4 tmp(x, y, z, 1);
glm::vec4 tmp(x, y, z, 1.f);
glm::mat4 rot = glm::rotate(
glm::mat4(1),
glm::mat4(1.f),
glm::half_pi<float>(),
glm::vec3(1, 0, 0)
glm::vec3(1.f, 0.f, 0.f)
);
tmp = glm::vec4(glm::dmat4(rot) * glm::dvec4(tmp));

View File

@@ -80,7 +80,7 @@ ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictiona
glm::vec2 resolution = global::windowDelegate->currentDrawBufferResolution();
addProperty(_size);
_size.set(glm::vec4(0, 0, resolution.x,resolution.y));
_size.set(glm::vec4(0.f, 0.f, resolution.x, resolution.y));
}
ScreenSpaceFramebuffer::~ScreenSpaceFramebuffer() {} // NOLINT

View File

@@ -44,7 +44,7 @@ namespace {
namespace openspace {
GalaxyRaycaster::GalaxyRaycaster(ghoul::opengl::Texture& texture)
: _boundingBox(glm::vec3(1.0))
: _boundingBox(glm::vec3(1.f))
, _texture(texture)
, _textureUnit(nullptr)
{}
@@ -133,7 +133,7 @@ bool GalaxyRaycaster::isCameraInside(const RenderData& data, glm::vec3& localPos
glm::vec4 modelPos = glm::inverse(modelViewTransform(data)) *
glm::vec4(0.f, 0.f, 0.f, 1.f);
localPosition = (glm::vec3(modelPos) + glm::vec3(0.5));
localPosition = (glm::vec3(modelPos) + glm::vec3(0.5f));
return (localPosition.x > 0 && localPosition.x < 1 &&
localPosition.y > 0 && localPosition.y < 1 &&

View File

@@ -202,17 +202,17 @@ documentation::Documentation GlobeLabelsComponent::Documentation() {
GlobeLabelsComponent::GlobeLabelsComponent()
: properties::PropertyOwner({ "Labels" })
, _enabled(EnabledInfo, false)
, _fontSize(FontSizeInfo, 30, 1, 300)
, _fontSize(FontSizeInfo, 30.f, 1.f, 300.f)
, _minMaxSize(MinMaxSizeInfo, glm::ivec2(1, 1000), glm::ivec2(1), glm::ivec2(1000))
, _size(SizeInfo, 2.5, 0, 30)
, _heightOffset(HeightOffsetInfo, 100.0, 0.0, 10000.0)
, _heightOffset(HeightOffsetInfo, 100.f, 0.f, 10000.f)
, _color(ColorInfo, glm::vec3(1.f, 1.f, 0.f), glm::vec3(0.f), glm::vec3(1.f))
, _opacity(OpacityInfo, 1.f, 0.f, 1.f)
, _fadeDistances(
FadeDistancesInfo,
glm::vec2(1e4, 1e6),
glm::vec2(1e4f, 1e6f),
glm::vec2(1.f),
glm::vec2(1e8)
glm::vec2(1e8f)
)
, _fadeInEnabled(FadeInEnabledInfo, false)
, _fadeOutEnabled(FadeOutEnabledInfo, false)

View File

@@ -82,7 +82,7 @@ namespace {
const openspace::globebrowsing::AABB3 CullingFrustum{
glm::vec3(-1.f, -1.f, 0.f),
glm::vec3( 1.f, 1.f, 1e35)
glm::vec3( 1.f, 1.f, 1e35f)
};
constexpr const float DefaultHeight = 0.f;
@@ -464,7 +464,7 @@ std::array<glm::dvec4, 8> boundingCornersForChunk(const Chunk& chunk,
cornerGeodetic.geodetic2.lat += latDiff;
}
corners[i] = glm::dvec4(ellipsoid.cartesianPosition(cornerGeodetic), 1);
corners[i] = glm::dvec4(ellipsoid.cartesianPosition(cornerGeodetic), 1.0);
}
return corners;
@@ -1357,7 +1357,7 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d
const glm::dvec3 cornerModelSpace = _ellipsoid.cartesianSurfacePosition(corner);
cornersModelSpace[i] = cornerModelSpace;
const glm::dvec3 cornerCameraSpace = glm::dvec3(
modelViewTransform * glm::dvec4(cornerModelSpace, 1)
modelViewTransform * glm::dvec4(cornerModelSpace, 1.0)
);
cornersCameraSpace[i] = cornerCameraSpace;
}
@@ -2311,11 +2311,11 @@ bool RenderableGlobe::isCullableByHorizon(const Chunk& chunk,
// position needs to be transformed with the inverse model matrix
const GeodeticPatch& patch = chunk.surfacePatch;
const float maxHeight = heights.max;
const glm::dvec3 globePos = glm::dvec3(0, 0, 0); // In model space it is 0
const glm::dvec3 globePos = glm::dvec3(0.0, 0.0, 0.0); // In model space it is 0
const double minimumGlobeRadius = _ellipsoid.minimumRadius();
const glm::dvec3 cameraPos = glm::dvec3(
_cachedInverseModelTransform * glm::dvec4(renderData.camera.positionVec3(), 1)
_cachedInverseModelTransform * glm::dvec4(renderData.camera.positionVec3(), 1.0)
);
const glm::dvec3 globeToCamera = cameraPos;

View File

@@ -420,7 +420,7 @@ void RingsComponent::draw(const RenderData& data, RenderPass renderPass,
const glm::dmat4 inverseModelTransform = glm::inverse(modelTransform);
glm::vec3 sunPositionObjectSpace = glm::normalize(
glm::vec3(inverseModelTransform * glm::vec4(_sunPosition, 0.0))
glm::vec3(inverseModelTransform * glm::vec4(_sunPosition, 0.f))
);
_shader->setUniform(

View File

@@ -54,8 +54,8 @@ namespace documentation { struct Documentation; }
class ShadowComponent : public properties::PropertyOwner {
public:
struct ShadowMapData {
glm::dmat4 shadowMatrix;
GLuint shadowDepthTexture;
glm::dmat4 shadowMatrix = glm::dmat4(1.0);
GLuint shadowDepthTexture = 0;
};
ShadowComponent(const ghoul::Dictionary& dictionary);

View File

@@ -71,17 +71,17 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
_data.id = static_cast<int>(dictionary.value<double>("Id"));
_data.updateTime = static_cast<int>(dictionary.value<double>("UpdateTime"));
_data.spatialScale = glm::dvec4(0.f);
_data.spatialScale = glm::dvec4(0.0);
if (dictionary.hasValue<glm::dvec4>("SpatialScale")) {
_data.spatialScale = dictionary.value<glm::dvec4>("SpatialScale");
}
_data.gridMin = glm::dvec3(0.f);
_data.gridMin = glm::dvec3(0.0);
if (dictionary.hasValue<glm::dvec3>("GridMin")) {
_data.gridMin = dictionary.value<glm::dvec3>("GridMin");
}
_data.gridMax = glm::dvec3(0.f);
_data.gridMax = glm::dvec3(0.0);
if (dictionary.hasValue<glm::dvec3>("GridMax")) {
_data.gridMax = dictionary.value<glm::dvec3>("GridMax");
}
@@ -94,7 +94,7 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
}
double xOffset = 0.f;
double xOffset = 0.0;
if (dictionary.hasValue<double>("XOffset")) {
xOffset = dictionary.value<double>("XOffset");
}

View File

@@ -231,8 +231,8 @@ RenderableMultiresVolume::RenderableMultiresVolume(const ghoul::Dictionary& dict
return;
}
//_pscOffset = psc(glm::vec4(0.0));
//_boxScaling = glm::vec3(1.0);
//_pscOffset = psc(glm::vec4(0.f));
//_boxScaling = glm::vec3(1.f);
/*if (dictionary.hasKey(KeyBoxScaling)) {

View File

@@ -53,7 +53,7 @@ struct Dataset {
int orientationDataIndex = -1;
struct Entry {
glm::vec3 position;
glm::vec3 position = glm::vec3(0.f);
std::vector<float> data;
std::optional<std::string> comment;
};
@@ -67,7 +67,7 @@ struct Labelset {
int textColorIndex = -1;
struct Entry {
glm::vec3 position;
glm::vec3 position = glm::vec3(0.f);
std::string text;
};
std::vector<Entry> entries;

View File

@@ -1202,7 +1202,7 @@ void TouchInteraction::resetToDefault() {
_centroidStillThreshold.set(0.0018f);
_interpretPan.set(0.015f);
_slerpTime.set(3.0f);
_friction.set(glm::vec4(0.025, 0.025, 0.02, 0.02));
_friction.set(glm::vec4(0.025f, 0.025f, 0.02f, 0.02f));
}
void TouchInteraction::tap() {

View File

@@ -53,6 +53,7 @@ Profile = "default"
-- Profile = "gaia"
-- Profile = "insight"
-- Profile = "juno"
-- Profile = "jwst"
-- Profile = "mars"
-- Profile = "messenger"
-- Profile = "newhorizons"
@@ -71,6 +72,7 @@ ReadOnlyProfiles = {
"gaia",
"insight",
"juno",
"jwst",
"mars",
"messenger",
"newhorizons",

View File

@@ -48,7 +48,7 @@ namespace openspace::interaction {
InteractionMonitor::InteractionMonitor()
: properties::PropertyOwner({ "InteractionMonitor" })
, _isInActiveState(IsInActiveStateInfo, false)
, _idleTime(IdleTimeInfo, 120.f)
, _idleTime(IdleTimeInfo, 120.f, 0.f, 300.f)
{
addProperty(_isInActiveState);
addProperty(_idleTime);

View File

@@ -142,7 +142,7 @@ bool KeyframeNavigator::updateCamera(Camera* camera, const CameraPose prevPose,
// Linear interpolation
t = std::max(0.0, std::min(1.0, t));
glm::dvec3 nowCameraPosition = prevKeyframeCameraPosition * (1 - t) +
glm::dvec3 nowCameraPosition = prevKeyframeCameraPosition * (1.0 - t) +
nextKeyframeCameraPosition * t;
glm::dquat nowCameraRotation = glm::slerp(
prevKeyframeCameraRotation,
@@ -160,7 +160,7 @@ bool KeyframeNavigator::updateCamera(Camera* camera, const CameraPose prevPose,
const float prevInvScaleExp = glm::log(1.f / prevPose.scale);
const float nextInvScaleExp = glm::log(1.f / nextPose.scale);
const float interpolatedInvScaleExp = static_cast<float>(
prevInvScaleExp * (1 - t) + nextInvScaleExp * t
prevInvScaleExp * (1.0 - t) + nextInvScaleExp * t
);
camera->setScaling(1.f / glm::exp(interpolatedInvScaleExp));
}

View File

@@ -246,8 +246,8 @@ OrbitalNavigator::OrbitalNavigator()
, _retargetAim(RetargetAimInfo)
, _followAnchorNodeRotationDistance(FollowAnchorNodeInfo, 5.f, 0.f, 20.f)
, _minimumAllowedDistance(MinimumDistanceInfo, 10.0f, 0.0f, 10000.f)
, _flightDestinationDistance(FlightDestinationDistInfo, 2e8f, 0.0f, 1e10f)
, _flightDestinationFactor(FlightDestinationFactorInfo, 1E-4, 1E-6, 0.5)
, _flightDestinationDistance(FlightDestinationDistInfo, 2e8f, 10.f, 1e10f)
, _flightDestinationFactor(FlightDestinationFactorInfo, 1E-4, 1E-6, 0.5, 1E-3)
, _applyLinearFlight(ApplyLinearFlightInfo, false)
, _velocitySensitivity(VelocityZoomControlInfo, 3.5f, 0.001f, 20.f)
, _mouseSensitivity(MouseSensitivityInfo, 15.f, 1.f, 50.f)
@@ -269,7 +269,6 @@ OrbitalNavigator::OrbitalNavigator()
, _joystickStates(_joystickSensitivity * 0.1, 1 / (_friction.friction + 0.0000001))
, _websocketStates(_websocketSensitivity, 1 / (_friction.friction + 0.0000001))
{
_anchor.onChange([this]() {
if (_anchor.value().empty()) {
return;
@@ -385,6 +384,7 @@ OrbitalNavigator::OrbitalNavigator()
addProperty(_followAnchorNodeRotationDistance);
addProperty(_minimumAllowedDistance);
addProperty(_velocitySensitivity);
_flightDestinationDistance.setExponent(5.f);
addProperty(_flightDestinationDistance);
addProperty(_flightDestinationFactor);
addProperty(_applyLinearFlight);
@@ -1423,7 +1423,7 @@ SurfacePositionHandle OrbitalNavigator::calculateSurfacePositionHandle(
{
const glm::dmat4 inverseModelTransform = glm::inverse(node.modelTransform());
const glm::dvec3 cameraPositionModelSpace =
glm::dvec3(inverseModelTransform * glm::dvec4(cameraPositionWorldSpace, 1));
glm::dvec3(inverseModelTransform * glm::dvec4(cameraPositionWorldSpace, 1.0));
const SurfacePositionHandle posHandle =
node.calculateSurfacePositionHandle(cameraPositionModelSpace);

View File

@@ -375,9 +375,7 @@ RenderEngine::RenderEngine()
std::filesystem::path newFolder = absPath(
"${STARTUP_SCREENSHOT}/" + std::string(date)
);
if (!std::filesystem::is_directory(newFolder)) {
std::filesystem::create_directory(newFolder);
}
FileSys.registerPathToken(
"${SCREENSHOTS}",
newFolder,

View File

@@ -612,7 +612,7 @@ glm::dvec3 SpiceManager::targetPosition(const std::string& target,
);
}
else {
return glm::dvec3();
return glm::dvec3(0.0);
}
}
else if (targetHasCoverage && observerHasCoverage) {
@@ -1150,7 +1150,7 @@ glm::dvec3 SpiceManager::getEstimatedPosition(const std::string& target,
throw SpiceException(fmt::format("No position for '{}' at any time", target));
}
else {
return glm::dvec3();
return glm::dvec3(0.0);
}
}