mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-26 14:08:53 -05:00
Coding style adaptations
This commit is contained in:
@@ -78,7 +78,10 @@ void JoystickCameraStates::updateStateFromInput(
|
||||
|
||||
if ((t.joystickType == JoystickType::JoystickLike &&
|
||||
std::abs(value) <= t.deadzone) ||
|
||||
(t.joystickType == JoystickType::TriggerLike && value <= -1.f + t.deadzone))
|
||||
(
|
||||
t.joystickType == JoystickType::TriggerLike &&
|
||||
value <= -1.f + t.deadzone
|
||||
))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -150,8 +153,10 @@ void JoystickCameraStates::updateStateFromInput(
|
||||
localRotation.second.y += value;
|
||||
break;
|
||||
case AxisType::Property:
|
||||
std::string script = fmt::format("openspace.setPropertyValue('{}', {});",
|
||||
t.propertyUri, value);
|
||||
std::string script = fmt::format(
|
||||
"openspace.setPropertyValue('{}', {});",
|
||||
t.propertyUri, value
|
||||
);
|
||||
|
||||
global::scriptEngine->queueScript(
|
||||
script,
|
||||
@@ -173,7 +178,9 @@ void JoystickCameraStates::updateStateFromInput(
|
||||
if (active) {
|
||||
global::scriptEngine->queueScript(
|
||||
it->second.command,
|
||||
scripting::ScriptEngine::RemoteScripting(it->second.synchronization)
|
||||
scripting::ScriptEngine::RemoteScripting(
|
||||
it->second.synchronization
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ float JoystickInputStates::axis(const std::string& joystickName, int axis) const
|
||||
}
|
||||
);
|
||||
|
||||
// If multiple joysticks are connected, we might get values outside the -1,1 range by
|
||||
// summing them up
|
||||
// If multiple joysticks are connected, we might get values outside the -1,1 range
|
||||
// by summing them up
|
||||
glm::clamp(res, -1.f, 1.f);
|
||||
return res;
|
||||
}
|
||||
@@ -69,7 +69,9 @@ float JoystickInputStates::axis(const std::string& joystickName, int axis) const
|
||||
return state->axes[axis];
|
||||
}
|
||||
|
||||
bool JoystickInputStates::button(const std::string& joystickName, int button, JoystickAction action) const {
|
||||
bool JoystickInputStates::button(const std::string& joystickName, int button,
|
||||
JoystickAction action) const
|
||||
{
|
||||
ghoul_precondition(button >= 0, "button must be 0 or positive");
|
||||
|
||||
if (joystickName.empty()) {
|
||||
|
||||
@@ -238,7 +238,7 @@ bool SessionRecording::startRecording(const std::string& filename) {
|
||||
_timestampRecordStarted = global::windowDelegate->applicationTime();
|
||||
|
||||
// Record the current delta time as the first property to save in the file.
|
||||
// This needs to be saved as a baseline whether or not it changes during recording.
|
||||
// This needs to be saved as a baseline whether or not it changes during recording
|
||||
_timestamps3RecordStarted = {
|
||||
_timestampRecordStarted,
|
||||
0.0,
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace {
|
||||
*/
|
||||
[[codegen::luawrap]] void startRecordingAscii(std::string recordFilePath) {
|
||||
using namespace openspace;
|
||||
|
||||
|
||||
if (recordFilePath.empty()) {
|
||||
throw ghoul::lua::LuaError("Filepath string is empty");
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace {
|
||||
bool loop = false)
|
||||
{
|
||||
using namespace openspace;
|
||||
|
||||
|
||||
if (file.empty()) {
|
||||
throw ghoul::lua::LuaError("Filepath string is empty");
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace {
|
||||
*/
|
||||
[[codegen::luawrap]] void startPlaybackApplicationTime(std::string file) {
|
||||
using namespace openspace;
|
||||
|
||||
|
||||
if (file.empty()) {
|
||||
throw ghoul::lua::LuaError("Filepath string is empty");
|
||||
}
|
||||
@@ -115,7 +115,7 @@ namespace {
|
||||
*/
|
||||
[[codegen::luawrap]] void startPlaybackRecordedTime(std::string file, bool loop = false) {
|
||||
using namespace openspace;
|
||||
|
||||
|
||||
if (file.empty()) {
|
||||
throw ghoul::lua::LuaError("Filepath string is empty");
|
||||
}
|
||||
@@ -134,7 +134,7 @@ namespace {
|
||||
*/
|
||||
[[codegen::luawrap]] void startPlaybackSimulationTime(std::string file) {
|
||||
using namespace openspace;
|
||||
|
||||
|
||||
if (file.empty()) {
|
||||
throw ghoul::lua::LuaError("Filepath string is empty");
|
||||
}
|
||||
|
||||
@@ -274,7 +274,10 @@ joystickAxis(std::string joystickName, int axis)
|
||||
* currently bound to the button identified by the second argument.
|
||||
*/
|
||||
[[codegen::luawrap]] void clearJoystickButton(std::string joystickName, int button) {
|
||||
openspace::global::navigationHandler->clearJoystickButtonCommand(joystickName, button);
|
||||
openspace::global::navigationHandler->clearJoystickButtonCommand(
|
||||
joystickName,
|
||||
button
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -440,7 +440,8 @@ SceneGraphNode* findNodeNearTarget(const SceneGraphNode* node) {
|
||||
bool isSame = (n->identifier() == node->identifier());
|
||||
// If the nodes are in the very same position, they are probably representing
|
||||
// the same object
|
||||
isSame |= glm::distance(n->worldPosition(), node->worldPosition()) < LengthEpsilon;
|
||||
isSame |=
|
||||
glm::distance(n->worldPosition(), node->worldPosition()) < LengthEpsilon;
|
||||
|
||||
if (isSame) {
|
||||
continue;
|
||||
|
||||
@@ -113,7 +113,9 @@ void PathCurve::initializeParameterData() {
|
||||
double s = sStart + arcLength(uStart, u);
|
||||
// Identify samples that are indistinguishable due to precision limitations
|
||||
if (std::abs(s - _parameterSamples.back().s) < LengthEpsilon) {
|
||||
throw InsufficientPrecisionError("Insufficient precision due to path length");
|
||||
throw InsufficientPrecisionError(
|
||||
"Insufficient precision due to path length"
|
||||
);
|
||||
}
|
||||
_parameterSamples.push_back({ u, s });
|
||||
}
|
||||
@@ -241,7 +243,7 @@ double PathCurve::arcLength(double lowerLimit, double upperLimit) const {
|
||||
|
||||
glm::dvec3 PathCurve::interpolate(double u) const {
|
||||
const double max = _curveParameterSteps.back();
|
||||
ghoul_assert(u >= 0 && u <= max, "Interpolation variable must be in range [0,_nSegments]");
|
||||
ghoul_assert(u >= 0 && u <= max, "Interpolation variable must be in [0, _nSegments]");
|
||||
|
||||
if (u <= 0.0) {
|
||||
return _points[1];
|
||||
|
||||
@@ -93,7 +93,9 @@ AvoidCollisionCurve::AvoidCollisionCurve(const Waypoint& start, const Waypoint&
|
||||
const double maxRadius = std::max(startNodeRadius, endNodeRadius);
|
||||
bool nodesAreDifferent = start.nodeIdentifier() != end.nodeIdentifier();
|
||||
if (glm::length(startToEnd) > 0.5 * maxRadius && nodesAreDifferent) {
|
||||
double cosAngleToTarget = glm::dot(normalize(-startViewDir), normalize(startToEnd));
|
||||
double cosAngleToTarget = glm::dot(
|
||||
normalize(-startViewDir), normalize(startToEnd)
|
||||
);
|
||||
bool targetInOppositeDirection = cosAngleToTarget > 0.7;
|
||||
|
||||
if (targetInOppositeDirection) {
|
||||
|
||||
@@ -135,7 +135,10 @@ PathNavigator::PathNavigator()
|
||||
{ static_cast<int>(Path::Type::AvoidCollision), "AvoidCollision" },
|
||||
{ static_cast<int>(Path::Type::ZoomOutOverview), "ZoomOutOverview" },
|
||||
{ static_cast<int>(Path::Type::Linear), "Linear" },
|
||||
{ static_cast<int>(Path::Type::AvoidCollisionWithLookAt), "AvoidCollisionWithLookAt"}
|
||||
{
|
||||
static_cast<int>(Path::Type::AvoidCollisionWithLookAt),
|
||||
"AvoidCollisionWithLookAt"
|
||||
}
|
||||
});
|
||||
addProperty(_defaultPathType);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
****************************************************************************************/
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
// Returns true if a camera path is currently running, and false otherwise.
|
||||
[[codegen::luawrap]] bool isFlying() {
|
||||
using namespace openspace;
|
||||
|
||||
@@ -125,7 +125,8 @@ ghoul::mm_unique_ptr<Renderable> Renderable::createFromDictionary(
|
||||
documentation::testSpecificationAndThrow(Documentation(), dictionary, "Renderable");
|
||||
|
||||
std::string renderableType = dictionary.value<std::string>(KeyType);
|
||||
ghoul::TemplateFactory<Renderable>* factory = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul::TemplateFactory<Renderable>* factory =
|
||||
FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(factory, "Renderable factory did not exist");
|
||||
Renderable* result = factory->create(
|
||||
renderableType,
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ void Asset::addIdentifier(std::string identifier) {
|
||||
if (!_metaInformation.has_value()) {
|
||||
_metaInformation = MetaInformation();
|
||||
}
|
||||
|
||||
|
||||
_metaInformation->identifiers.push_back(std::move(identifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace {
|
||||
* builtInFrames. Returns User loaded frames if !builtInFrames.
|
||||
*/
|
||||
[[codegen::luawrap]] std::map<std::string, std::string> spiceBodies(bool includeBuiltIn) {
|
||||
std::vector<std::pair<int, std::string>> bodies =
|
||||
std::vector<std::pair<int, std::string>> bodies =
|
||||
openspace::SpiceManager::ref().spiceBodies(includeBuiltIn);
|
||||
|
||||
std::map<std::string, std::string> res;
|
||||
@@ -93,7 +93,7 @@ namespace {
|
||||
std::string frame, std::string date)
|
||||
{
|
||||
using namespace openspace;
|
||||
|
||||
|
||||
const double ephemerisTime = SpiceManager::ref().ephemerisTimeFromDate(date);
|
||||
glm::dvec3 position = SpiceManager::ref().targetPosition(
|
||||
target,
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace {
|
||||
std::optional<double> interpolationDuration)
|
||||
{
|
||||
using namespace openspace;
|
||||
|
||||
|
||||
double interp = interpolationDuration.value_or(
|
||||
global::timeManager->defaultDeltaTimeInterpolationDuration()
|
||||
);
|
||||
|
||||
@@ -44,7 +44,7 @@ VersionChecker::~VersionChecker() {
|
||||
void VersionChecker::requestLatestVersion(const std::string& url) {
|
||||
using GCC = ghoul::systemcapabilities::GeneralCapabilitiesComponent;
|
||||
std::string operatingSystem = SysCap.component<GCC>().operatingSystemString();
|
||||
|
||||
|
||||
// Need to escape non-http characters when passing the operating system in the url
|
||||
for (size_t i = 0; i < operatingSystem.size(); i++) {
|
||||
if (operatingSystem[i] == ' ') {
|
||||
|
||||
Reference in New Issue
Block a user