Handle warnings and coding style adaptations

This commit is contained in:
Alexander Bock
2024-09-12 16:30:09 +02:00
parent 77672f0cc4
commit e24cff1d19
20 changed files with 54 additions and 49 deletions

View File

@@ -68,8 +68,8 @@ public:
* \param ignoreFutureKeyframes `true` if only past keyframes are to be used
* \return true only if a new future keyframe is available to set camera pose
*/
bool updateCamera(Camera& camera, bool ignoreFutureKeyframes);
static bool updateCamera(Camera* camera, const CameraPose& prevPose,
void updateCamera(Camera& camera, bool ignoreFutureKeyframes);
static void updateCamera(Camera* camera, const CameraPose& prevPose,
const CameraPose& nextPose, double t, bool ignoreFutureKeyframes);
Timeline<CameraPose>& timeline();

View File

@@ -170,10 +170,10 @@ SizeMappingComponent::SizeMappingComponent(const ghoul::Dictionary& dictionary)
const Parameters::ScaleUnit scaleUnit =
std::get<Parameters::ScaleUnit>(*p.scaleFactor);
const DistanceUnit distanceUnit = codegen::map<DistanceUnit>(scaleUnit);
scaleFactor = toMeter(distanceUnit);
scaleFactor = static_cast<float>(toMeter(distanceUnit));
}
else if (std::holds_alternative<double>(*p.scaleFactor)) {
scaleFactor = std::get<double>(*p.scaleFactor);
scaleFactor = static_cast<float>(std::get<double>(*p.scaleFactor));
}
}

View File

@@ -49,7 +49,7 @@ namespace {
// [[codegen::verbatim(RotationInfo.description)]]
std::optional<glm::dvec3> rotationAxis
[[codegen::inrange(glm::dvec3(-1.0), glm::dvec3(1.0))]];
// [[codegen::verbatim(RotationRateInfo.description)]]
std::optional<float> rotationRate;
};

View File

@@ -284,7 +284,8 @@ namespace {
* \param y The y value of the tile index
* \param level The level of the tile index
*/
[[codegen::luawrap]] void goToChunk(std::string globeIdentifier, int x, int y, int level) {
[[codegen::luawrap]] void goToChunk(std::string globeIdentifier, int x, int y, int level)
{
using namespace openspace;
using namespace globebrowsing;
@@ -495,8 +496,8 @@ void flyToGeoInternal(std::string globe, double latitude,
}
/**
* Fly the camera to a geographic coordinate (latitude, longitude and altitude) on a globe,
* using the path navigation system.
* Fly the camera to a geographic coordinate (latitude, longitude and altitude) on a
* globe, using the path navigation system.
*
* \param globe The identifier of a scene graph node that has a RenderableGlobe attached.
* If an empty string is provided, the current anchor node is used

View File

@@ -177,10 +177,6 @@ void LayerGroup::deleteLayer(const std::string& layerName) {
// which will no longer be valid once it is deleted
removePropertySubOwner(it->get());
(*it)->deinitialize();
properties::PropertyOwner* layerGroup = it->get()->owner();
properties::PropertyOwner* layerManager = layerGroup->owner();
properties::PropertyOwner* globe = layerManager->owner();
properties::PropertyOwner* sceneGraphNode = globe->owner();
// We need to keep the name of the layer since we only get it as a reference
// and the name needs to survive the deletion

View File

@@ -280,7 +280,7 @@ namespace {
std::optional<bool> useAccurateNormals;
// [[codegen::verbatim(AmbientIntensityInfo.description)]]
std::optional<double> ambientIntensity;
std::optional<float> ambientIntensity;
// [[codegen::verbatim(LightSourceNodeInfo.description)]]
std::optional<std::string> lightSourceNode;
@@ -289,10 +289,10 @@ namespace {
std::optional<bool> renderAtDistance;
// [[codegen::verbatim(TargetLodScaleFactorInfo.description)]]
std::optional<double> targetLodScaleFactor;
std::optional<float> targetLodScaleFactor;
// [[codegen::verbatim(OrenNayarRoughnessInfo.description)]]
std::optional<double> orenNayarRoughness;
std::optional<float> orenNayarRoughness;
// A list of layers that should be added to the globe.
std::optional<std::map<std::string, ghoul::Dictionary>> layers

View File

@@ -571,11 +571,11 @@ bool TSP::writeCache() {
}
float TSP::spatialError(unsigned int brickIndex) const {
return *reinterpret_cast<const float*>(_data[brickIndex*NUM_DATA + SPATIAL_ERR]);
return *reinterpret_cast<const float*>(&_data[brickIndex*NUM_DATA + SPATIAL_ERR]);
}
float TSP::temporalError(unsigned int brickIndex) const {
return *reinterpret_cast<const float*>(_data[brickIndex*NUM_DATA + TEMPORAL_ERR]);
return *reinterpret_cast<const float*>(&_data[brickIndex*NUM_DATA + TEMPORAL_ERR]);
}
unsigned int TSP::firstOctreeChild(unsigned int brickIndex) const {

View File

@@ -71,7 +71,9 @@ documentation::Documentation GenerateRawVolumeFromFileTask::Documentation() {
return codegen::doc<Parameters>("generate_raw_volume_task");
}
GenerateRawVolumeFromFileTask::GenerateRawVolumeFromFileTask(const ghoul::Dictionary& dictionary) {
GenerateRawVolumeFromFileTask::GenerateRawVolumeFromFileTask(
const ghoul::Dictionary& dictionary)
{
const Parameters p = codegen::bake<Parameters>(dictionary);
_inputFilePath = absPath(p.dataInputPath);
@@ -93,7 +95,7 @@ std::string GenerateRawVolumeFromFileTask::description() {
);
}
void GenerateRawVolumeFromFileTask::perform(const Task::ProgressCallback& progressCallback) {
void GenerateRawVolumeFromFileTask::perform(const ProgressCallback& progressCallback) {
dataloader::Dataset data = dataloader::csv::loadCsvFile(_inputFilePath);
progressCallback(0.3f);

View File

@@ -71,7 +71,9 @@ bool TransferFunction::setEnvelopesFromLua(lua_State* state) {
// lua_pushnil(state);
// while (lua_next(state, -2)) {
// PrintTable(state);
// std::string color = static_cast<std::string>(lua_tostring(state, -1));
// std::string color = static_cast<std::string>(
// lua_tostring(state, -1)
// );
// lua_pop(state, 1);
// lua_pushnil(state);
// lua_next(state, -2);

View File

@@ -49,7 +49,9 @@ void VolumeModule::internalInitialize(const ghoul::Dictionary&) {
ghoul::TemplateFactory<Task>* tFactory = FactoryManager::ref().factory<Task>();
ghoul_assert(tFactory, "No task factory existed");
tFactory->registerClass<GenerateRawVolumeTask>("GenerateRawVolumeTask");
tFactory->registerClass<GenerateRawVolumeFromFileTask>("GenerateRawVolumeFromFileTask");
tFactory->registerClass<GenerateRawVolumeFromFileTask>(
"GenerateRawVolumeFromFileTask"
);
}
std::vector<documentation::Documentation> VolumeModule::documentations() const {

View File

@@ -55,7 +55,7 @@ public:
bool OnCursorChange(CefRefPtr<CefBrowser> browser,
CefCursorHandle cursor,
cef_cursor_type_t type,
const CefCursorInfo& custom_cursor_info) override;
const CefCursorInfo& custom_cursor_info) override;
IMPLEMENT_REFCOUNTING(DisplayHandler);
};
BrowserClient(WebRenderHandler* handler, WebKeyboardHandler* keyboardHandler);

View File

@@ -69,7 +69,7 @@ public:
// Used when the "shared_texture" flag is set to true for CEF. Uses a shared texture
// from CEF that is allocated on another part of the GPU. Skip CPU allocationn for
// better performance. Needs OpenGl 4.5 or higher.
// better performance. Needs OpenGl 4.5 or higher.
void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser, PaintElementType type,
const RectList& dirtyRects, const CefAcceleratedPaintInfo& info) override;
@@ -78,7 +78,7 @@ public:
bool hasContent(int x, int y);
bool isTextureReady() const;
void updateTexture();
void updateTexture();
void bindTexture();
protected:

View File

@@ -83,9 +83,9 @@ bool BrowserClient::NoContextMenuHandler::RunContextMenu(CefRefPtr<CefBrowser>,
}
bool BrowserClient::DisplayHandler::OnCursorChange(CefRefPtr<CefBrowser> browser,
CefCursorHandle cursor,
CefCursorHandle,
cef_cursor_type_t type,
const CefCursorInfo& custom_cursor_info)
const CefCursorInfo&)
{
WindowDelegate::Cursor newCursor;
switch (type) {
@@ -101,13 +101,13 @@ bool BrowserClient::DisplayHandler::OnCursorChange(CefRefPtr<CefBrowser> browser
case cef_cursor_type_t::CT_HAND:
newCursor = WindowDelegate::Cursor::PointingHand;
break;
case cef_cursor_type_t::CT_EASTWESTRESIZE:
case cef_cursor_type_t::CT_EASTWESTRESIZE:
case cef_cursor_type_t::CT_COLUMNRESIZE:
case cef_cursor_type_t::CT_EASTRESIZE:
case cef_cursor_type_t::CT_WESTRESIZE:
newCursor = WindowDelegate::Cursor::ResizeEW;
break;
case cef_cursor_type_t::CT_NORTHSOUTHRESIZE:
case cef_cursor_type_t::CT_NORTHSOUTHRESIZE:
case cef_cursor_type_t::CT_ROWRESIZE:
case cef_cursor_type_t::CT_NORTHRESIZE:
case cef_cursor_type_t::CT_SOUTHRESIZE:

View File

@@ -117,7 +117,7 @@ void WebRenderHandler::OnPaint(CefRefPtr<CefBrowser>, CefRenderHandler::PaintEle
}
void WebRenderHandler::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
PaintElementType,
const RectList& dirtyRects,
const CefAcceleratedPaintInfo& info)
{
@@ -135,7 +135,7 @@ void WebRenderHandler::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
// @TODO (ylvse 2024-08-20): minimizing window should be handled with the appropriate
// function in the CefBrowser called WasHidden
if (dirtyRects[0].height <= 1 || dirtyRects[0].width <= 1) {
return;
return;
}
// This function is called asynchronously after a reshape which means we have to check
// for what we request. Validate the size. This prevents rendering a texture with the

View File

@@ -345,7 +345,7 @@ void KeyframeRecording::preSynchronization(double dt) {
SceneGraphNode* node = scene->sceneGraphNode(curr.focusNode);
global::navigationHandler->orbitalNavigator().setFocusNode(node);
bool success = interaction::KeyframeNavigator::updateCamera(
interaction::KeyframeNavigator::updateCamera(
global::navigationHandler->camera(),
curr,
next,

View File

@@ -2088,13 +2088,14 @@ bool SessionRecording::processCameraKeyframe(double now) {
global::navigationHandler->orbitalNavigator().setFocusNode(n->identifier());
}
return interaction::KeyframeNavigator::updateCamera(
interaction::KeyframeNavigator::updateCamera(
global::navigationHandler->camera(),
prevPose,
nextPose,
t,
_ignoreRecordedScale
);
return true;
}
bool SessionRecording::processScriptKeyframe() {

View File

@@ -45,12 +45,12 @@ KeyframeNavigator::CameraPose::CameraPose(datamessagestructures::CameraKeyframe&
, followFocusNodeRotation(kf._followNodeRotation)
{}
bool KeyframeNavigator::updateCamera(Camera& camera, bool ignoreFutureKeyframes) {
void KeyframeNavigator::updateCamera(Camera& camera, bool ignoreFutureKeyframes) {
const double now = currentTime();
bool foundPrevKeyframe = false;
if (_cameraPoseTimeline.nKeyframes() == 0) {
return false;
return;
}
const Keyframe<CameraPose>* nextKeyframe =
@@ -66,7 +66,7 @@ bool KeyframeNavigator::updateCamera(Camera& camera, bool ignoreFutureKeyframes)
if (ignoreFutureKeyframes) {
_cameraPoseTimeline.removeKeyframesBefore(now);
}
return false;
return;
}
double prevTime = 0.0;
@@ -87,14 +87,12 @@ bool KeyframeNavigator::updateCamera(Camera& camera, bool ignoreFutureKeyframes)
const CameraPose nextPose = nextKeyframe->data;
_cameraPoseTimeline.removeKeyframesBefore(prevTime);
if (!foundPrevKeyframe && ignoreFutureKeyframes) {
return false;
if (foundPrevKeyframe || !ignoreFutureKeyframes) {
updateCamera(&camera, prevPose, nextPose, t, ignoreFutureKeyframes);
}
return updateCamera(&camera, prevPose, nextPose, t, ignoreFutureKeyframes);
}
bool KeyframeNavigator::updateCamera(Camera* camera, const CameraPose& prevPose,
void KeyframeNavigator::updateCamera(Camera* camera, const CameraPose& prevPose,
const CameraPose& nextPose, double t,
bool ignoreFutureKeyframes)
{
@@ -103,7 +101,7 @@ bool KeyframeNavigator::updateCamera(Camera* camera, const CameraPose& prevPose,
SceneGraphNode* nextFocusNode = scene->sceneGraphNode(nextPose.focusNode);
if (!prevFocusNode || !nextFocusNode) {
return false;
return;
}
glm::dvec3 prevKeyframeCameraPosition = prevPose.position;
@@ -158,8 +156,6 @@ bool KeyframeNavigator::updateCamera(Camera* camera, const CameraPose& prevPose,
);
camera->setScaling(1.f / glm::exp(interpolatedInvScaleExp));
}
return true;
}
double KeyframeNavigator::currentTime() const {

View File

@@ -355,8 +355,8 @@ glm::dquat Path::linearPathRotation(double) const {
//const double tHalf = 0.5;
//if (t < tHalf) {
// // Interpolate to look at target
// const glm::dvec3 halfWayPosition = _curve->positionAt(tHalf);
// const glm::dquat q = ghoul::lookAtQuaternion(halfWayPosition, endNodePos, endUp);
// const glm::dvec3 halfWayPos = _curve->positionAt(tHalf);
// const glm::dquat q = ghoul::lookAtQuaternion(halfWayPos, endNodePos, endUp);
// const double tScaled = ghoul::sineEaseInOut(t / tHalf);
// return glm::slerp(_start.rotation(), q, tScaled);
@@ -375,13 +375,18 @@ glm::dquat Path::linearPathRotation(double) const {
//if (distanceToEnd < closingUpDistance) {
// // Interpolate to target rotation
// const double tScaled = ghoul::sineEaseInOut(1.0 - distanceToEnd / closingUpDistance);
// const double tScaled =
// ghoul::sineEaseInOut(1.0 - distanceToEnd / closingUpDistance);
// // Compute a position in front of the camera at the end orientation
// const double inFrontDistance = glm::distance(_end.position(), endNodePos);
// const glm::dvec3 viewDir = ghoul::viewDirection(_end.rotation());
// const glm::dvec3 inFrontOfEnd = _end.position() + inFrontDistance * viewDir;
// const glm::dvec3 lookAtPos = ghoul::interpolateLinear(tScaled, endNodePos, inFrontOfEnd);
// const glm::dvec3 lookAtPos = ghoul::interpolateLinear(
// tScaled,
// endNodePos,
// inFrontOfEnd
// );
// return ghoul::lookAtQuaternion(_prevPose.position, lookAtPos, endUp);
//}

View File

@@ -334,7 +334,7 @@ namespace {
//
// The nodes without a given value will be placed at the bottom of the list
// and sorted alphabetically.
std::optional<double> orderingNumber;
std::optional<float> orderingNumber;
};
// Additional information that is passed to GUI applications. These are all hints
// and do not have any impact on the actual function of the scene graph node