mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-25 13:38:35 -05:00
Global sweep to cleanup the handling of floating point numbers and glm default initialization
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user