Various code cleanup

This commit is contained in:
Alexander Bock
2019-06-18 10:47:15 +02:00
parent 8f6520ea8f
commit d0c04cfc6b
26 changed files with 154 additions and 123 deletions

View File

@@ -105,7 +105,7 @@ public:
* will just contain one item, but some modules may wish to provide
* multiple templates for subtypes, etc
*/
void writeDocumentationHtml(const std::string path, const std::string data);
void writeDocumentationHtml(const std::string& path, std::string data);
std::string generateJson() const override;

View File

@@ -117,7 +117,7 @@ private:
//grabs json from each module to pass to the documentation engine.
std::string _documentationJson;
ShutdownInformation _shutdown;
// The first frame might take some more time in the update loop, so we need to know to

View File

@@ -283,7 +283,7 @@ private:
bool _playbackActive_script = false;
bool _hasHitEndOfCameraKeyframes = false;
bool _setSimulationTimeWithNextCameraKeyframe = false;
bool _saveRenderingDuringPlayback = false;
double _saveRenderingDeltaTime = 1.0 / 30.0;
double _saveRenderingCurrentRecordedTime;

View File

@@ -91,7 +91,7 @@ public:
void update() override;
void performRaycasterTasks(const std::vector<RaycasterTask>& tasks);
void performDeferredTasks(const std::vector<DeferredcasterTask>& tasks,
void performDeferredTasks(const std::vector<DeferredcasterTask>& tasks,
float blackoutFactor);
void render(Scene* scene, Camera* camera, float blackoutFactor) override;

View File

@@ -407,10 +407,9 @@ std::pair<glm::dvec3, std::string> DashboardItemDistance::positionAndLabel(
if (!anchor) {
return { glm::dvec3(0.0), "Unknown" };
}
return {
global::navigationHandler.orbitalNavigator().anchorNode()->worldPosition(),
"focus"
};
else {
return { anchor->worldPosition(), "focus" };
}
}
case Type::Camera:
return { global::renderEngine.scene()->camera()->positionVec3(), "camera" };

View File

@@ -197,8 +197,13 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
, _specularIntensity(SpecularIntensityInfo, 1.f, 0.f, 1.f)
, _performShading(ShadingInfo, true)
, _disableFaceCulling(DisableFaceCullingInfo, false)
, _modelTransform(ModelTransformInfo, glm::dmat3(1.0), glm::dmat3(-1.0), glm::dmat3(1.0))
, _rotationVec(RotationVecInfo, glm::dvec3(0), glm::dvec3(0), glm::dvec3(360))
, _modelTransform(
ModelTransformInfo,
glm::dmat3(1.0),
glm::dmat3(-1.0),
glm::dmat3(1.0)
)
, _rotationVec(RotationVecInfo, glm::dvec3(0.0), glm::dvec3(0.0), glm::dvec3(360.0))
, _lightSourcePropertyOwner({ "LightSources", "Light Sources" })
{
documentation::testSpecificationAndThrow(
@@ -274,10 +279,12 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
_rotationVec.onChange([this]() {
glm::vec3 degreeVector = _rotationVec;
glm::vec3 radianVector = glm::vec3(glm::radians(degreeVector.x),
glm::radians(degreeVector.y), glm::radians(degreeVector.z));
_modelTransform = glm::mat4_cast(
glm::quat(radianVector));
glm::vec3 radianVector = glm::vec3(
glm::radians(degreeVector.x),
glm::radians(degreeVector.y),
glm::radians(degreeVector.z)
);
_modelTransform = glm::mat4_cast(glm::quat(radianVector));
});
}
@@ -405,13 +412,13 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
if (_disableFaceCulling) {
glDisable(GL_CULL_FACE);
}
_geometry->render();
if (_disableFaceCulling) {
glEnable(GL_CULL_FACE);
}
_program->deactivate();
}

View File

@@ -42,7 +42,7 @@ namespace {
"This value specifies an image that is loaded from disk and is used as a texture "
"that is applied to this plane. This image has to be square."
};
constexpr openspace::properties::Property::PropertyInfo RenderableTypeInfo = {
"RenderableType",
"RenderableType",

View File

@@ -747,7 +747,7 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data,
glEnablei(GL_BLEND, 0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
_program->activate();
const glm::dmat4 projMatrix = glm::dmat4(data.camera.projectionMatrix());

View File

@@ -183,10 +183,14 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
_wmsCacheLocation = dict.value<std::string>(WMSCacheLocationInfo.identifier);
}
if (dict.hasKeyAndValue<double>(WMSCacheSizeInfo.identifier)) {
_wmsCacheSizeMB = static_cast<int>(dict.value<double>(WMSCacheSizeInfo.identifier));
_wmsCacheSizeMB = static_cast<int>(
dict.value<double>(WMSCacheSizeInfo.identifier)
);
}
if (dict.hasKeyAndValue<double>(TileCacheSizeInfo.identifier)) {
_tileCacheSizeMB = static_cast<int>(dict.value<double>(TileCacheSizeInfo.identifier));
_tileCacheSizeMB = static_cast<int>(
dict.value<double>(TileCacheSizeInfo.identifier)
);
}
// Sanity check
@@ -207,7 +211,9 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
// Initialize
global::callback::initializeGL.emplace_back([&]() {
_tileCache = std::make_unique<globebrowsing::cache::MemoryAwareTileCache>(_tileCacheSizeMB);
_tileCache = std::make_unique<globebrowsing::cache::MemoryAwareTileCache>(
_tileCacheSizeMB
);
addPropertySubOwner(*_tileCache);
tileprovider::initializeDefaultTile();
@@ -486,9 +492,10 @@ void GlobeBrowsingModule::goToGeodetic2(Camera& camera, globebrowsing::Geodetic2
return;
}
const glm::dvec3 cameraPosition = global::navigationHandler.camera()->positionVec3();
interaction::NavigationHandler& nav = global::navigationHandler;
const glm::dvec3 cameraPosition = nav.camera()->positionVec3();
const glm::dmat4 inverseModelTransform =
global::navigationHandler.orbitalNavigator().anchorNode()->inverseModelTransform();
nav.orbitalNavigator().anchorNode()->inverseModelTransform();
const glm::dvec3 cameraPositionModelSpace =
glm::dvec3(inverseModelTransform * glm::dvec4(cameraPosition, 1.0));
const SurfacePositionHandle posHandle = globe->calculateSurfacePositionHandle(

View File

@@ -207,7 +207,7 @@ int getGeoPositionForCamera(lua_State* L) {
}
const glm::dvec3 cameraPosition = global::navigationHandler.camera()->positionVec3();
const SceneGraphNode* anchor =
const SceneGraphNode* anchor =
global::navigationHandler.orbitalNavigator().anchorNode();
const glm::dmat4 inverseModelTransform = anchor->inverseModelTransform();
const glm::dvec3 cameraPositionModelSpace =

View File

@@ -306,7 +306,7 @@ GlobeLabelsComponent::GlobeLabelsComponent()
addProperty(_labelAlignmentOption);
}
void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary,
void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary,
globebrowsing::RenderableGlobe* globe)
{
documentation::testSpecificationAndThrow(
@@ -314,7 +314,7 @@ void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary,
dictionary,
"GlobeLabelsComponent"
);
_globe = globe;
// Reads labels' file and build cache file if necessary
@@ -339,7 +339,7 @@ void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary,
// enables the label automatically.
_labelsEnabled = true;
}
if (dictionary.hasKey(LabelsFontSizeInfo.identifier)) {
_labelsFontSize = dictionary.value<float>(LabelsFontSizeInfo.identifier);
_labelsFontSize.onChange([this]() { initializeFonts(); });
@@ -475,7 +475,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) {
if (!csvLabelFile.is_open()) {
return false;
}
_labels.labelsArray.clear();
std::string sline;
@@ -488,14 +488,14 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) {
std::istringstream iss(sline);
std::string token;
std::getline(iss, token, ',');
// First line is just the Header
if (token == "Feature_Name") {
continue;
}
LabelEntry lEntry;
// Non-ascii characters aren't displayed correctly by the text
// rendering (We don't have the non-ascii character in the texture
// atlas)
@@ -516,16 +516,16 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) {
}
std::getline(iss, token, ','); // Target is not used
std::getline(iss, token, ','); // Diameter
lEntry.diameter = std::stof(token);
std::getline(iss, token, ','); // Latitude
lEntry.latitude = std::stof(token);
std::getline(iss, token, ','); // Longitude
lEntry.longitude = std::stof(token);
std::getline(iss, token, ','); // Coord System
std::string coordinateSystem(token);
std::size_t found = coordinateSystem.find("West");
@@ -552,7 +552,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) {
_labels.labelsArray.push_back(lEntry);
}
return true;
}
catch (const std::fstream::failure& e) {
@@ -623,9 +623,9 @@ void GlobeLabelsComponent::draw(const RenderData& data) {
viewTransform;
glm::dmat4 mvp = vp * _globe->modelTransform();
glm::dvec3 globePositionWorld = glm::dvec3(_globe->modelTransform() *
glm::dvec3 globePositionWorld = glm::dvec3(_globe->modelTransform() *
glm::vec4(0.f, 0.f, 0.f, 1.f));
glm::dvec3 cameraToGlobeDistanceWorld = globePositionWorld -
glm::dvec3 cameraToGlobeDistanceWorld = globePositionWorld -
data.camera.positionVec3();
double distanceCameraGlobeWorld = glm::length(cameraToGlobeDistanceWorld);
@@ -667,7 +667,7 @@ void GlobeLabelsComponent::draw(const RenderData& data) {
}
void GlobeLabelsComponent::renderLabels(const RenderData& data,
const glm::dmat4& modelViewProjectionMatrix,
const glm::dmat4& modelViewProjectionMatrix,
float distToCamera,
float fadeInVariable
) {
@@ -682,7 +682,7 @@ void GlobeLabelsComponent::renderLabels(const RenderData& data,
glm::dvec4 cameraPosWorld = invCombinedView * glm::dvec4(0.0, 0.0, 0.0, 1.0);
glm::dvec3 cameraPosObj = glm::dvec3(invMP * cameraPosWorld);
glm::dvec4 cameraUpVecWorld = glm::dvec4(data.camera.lookUpVectorWorldSpace(), 0.0);
glm::dvec4 cameraUpVecWorld = glm::dvec4(data.camera.lookUpVectorWorldSpace(), 0.0);
glm::dvec3 cameraLookUpObj = glm::dvec3(invMP * cameraUpVecWorld);
glm::dmat4 VP = glm::dmat4(data.camera.sgctInternal.projectionMatrix()) *

View File

@@ -41,7 +41,7 @@ namespace ghoul::opengl { class ProgramObject; }
namespace openspace {
struct RenderData;
namespace documentation { struct Documentation; }
namespace globebrowsing { class RenderableGlobe; }

View File

@@ -475,10 +475,10 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
addProperty(_generalProperties.useAccurateNormals);
addProperty(_generalProperties.eclipseShadowsEnabled);
addProperty(_generalProperties.eclipseHardShadows);
_generalProperties.targetLodScaleFactor.onChange([this]() {
_generalProperties.targetLodScaleFactor.onChange([this]() {
float sf = _generalProperties.targetLodScaleFactor;
_generalProperties.currentLodScaleFactor = sf;
_lodScaleFactorDirty = true;
_lodScaleFactorDirty = true;
});
addProperty(_generalProperties.targetLodScaleFactor);
addProperty(_generalProperties.currentLodScaleFactor);
@@ -2197,7 +2197,6 @@ bool RenderableGlobe::updateChunkTree(Chunk& cn, const RenderData& data) {
if (isLeaf(cn)) {
updateChunk(cn, data);
if (cn.status == Chunk::Status::WantSplit) {
splitChunkNode(cn, 1);
}

View File

@@ -271,7 +271,7 @@ private:
size_t _iterationsOfUnavailableData = 0;
Layer* _lastChangedLayer = nullptr;
// Labels
// Labels
GlobeLabelsComponent _globeLabelsComponent;
ghoul::Dictionary _labelsDictionary;
};

View File

@@ -80,7 +80,7 @@ void TimeTopic::handleJson(const nlohmann::json& json) {
sendCurrentTime();
}
});
_deltaTimeCallbackHandle = global::timeManager.addDeltaTimeChangeCallback([this]() {
// Throttle by last update,
// but force update if pause state or target delta changes.

View File

@@ -54,10 +54,10 @@ namespace {
constexpr const char* KeyStaticFilterReplacement = "StaticFilterReplacement";
constexpr const std::array<const char*, 16> UniformNames = {
"modelMatrix", "cameraUp", "cameraViewProjectionMatrix",
"colorOption", "magnitudeExponent", "eyePosition", "psfParamConf",
"lumCent", "radiusCent", "brightnessCent", "colorTexture",
"alphaValue", "psfTexture", "otherDataTexture", "otherDataRange",
"modelMatrix", "cameraUp", "cameraViewProjectionMatrix",
"colorOption", "magnitudeExponent", "eyePosition", "psfParamConf",
"lumCent", "radiusCent", "brightnessCent", "colorTexture",
"alphaValue", "psfTexture", "otherDataTexture", "otherDataRange",
"filterOutOfRange"
};
@@ -96,7 +96,7 @@ namespace {
"Speck File",
"The speck file that is loaded to get the data for rendering these stars."
};
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
"ColorMap",
"ColorBV Texture",
@@ -172,7 +172,7 @@ namespace {
"Stars closer than this distance are given full opacity. "
"Farther away, stars dim proportionally to the logarithm of their distance."
};
constexpr openspace::properties::Property::PropertyInfo RenderMethodOptionInfo = {
"RenderMethod",
"Render Method",
@@ -214,7 +214,7 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo LumPercentInfo = {
"LumPercent",
"Luminosity Contribution",
"Luminosity Contribution."
"Luminosity Contribution."
};
constexpr openspace::properties::Property::PropertyInfo RadiusPercentInfo = {
@@ -398,8 +398,14 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
, _filterOutOfRange(FilterOutOfRangeInfo, false)
, _pointSpreadFunctionTexturePath(PsfTextureInfo)
, _alphaValue(TransparencyInfo, 1.f, 0.f, 1.f)
, _psfMethodOption(PSFMethodOptionInfo, properties::OptionProperty::DisplayType::Dropdown)
, _psfMultiplyOption(SizeCompositionOptionInfo, properties::OptionProperty::DisplayType::Dropdown)
, _psfMethodOption(
PSFMethodOptionInfo,
properties::OptionProperty::DisplayType::Dropdown
)
, _psfMultiplyOption(
SizeCompositionOptionInfo,
properties::OptionProperty::DisplayType::Dropdown
)
, _lumCent(LumPercentInfo, 0.5f, 0.f, 3.f)
, _radiusCent(RadiusPercentInfo, 0.5f, 0.f, 3.f)
, _brightnessCent(BrightnessPercentInfo, 0.5f, 0.f, 3.f)
@@ -447,7 +453,7 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
dictionary.value<std::string>(OtherDataColorMapInfo.identifier)
);
}
_colorOption.addOptions({
{ ColorOption::Color, "Color" },
{ ColorOption::Velocity, "Velocity" },
@@ -475,7 +481,7 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
addProperty(_colorOption);
_colorTexturePath.onChange([&] { _colorTextureIsDirty = true; });
_colorTextureFile->setCallback([&](const File&) {
_colorTextureFile->setCallback([&](const File&) {
_colorTextureIsDirty = true;
});
addProperty(_colorTexturePath);
@@ -520,10 +526,10 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
"Point Spread Function Based"
);
_renderingMethodOption.addOption(RenderOptionTexture, "Textured Based");
addProperty(_renderingMethodOption);
addProperty(_renderingMethodOption);
if (dictionary.hasKey(RenderMethodOptionInfo.identifier)) {
std::string renderingMethod =
std::string renderingMethod =
dictionary.value<std::string>(RenderMethodOptionInfo.identifier);
if (renderingMethod == "PSF") {
_renderingMethodOption = RenderOptionPointSpreadFunction;
@@ -540,14 +546,14 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
PsfTextureInfo.identifier
));
_pointSpreadFunctionFile = std::make_unique<File>(_pointSpreadFunctionTexturePath);
_pointSpreadFunctionTexturePath.onChange([&]() {
_pointSpreadFunctionTextureIsDirty = true;
_pointSpreadFunctionTexturePath.onChange([&]() {
_pointSpreadFunctionTextureIsDirty = true;
});
_pointSpreadFunctionFile->setCallback([&](const File&) {
_pointSpreadFunctionFile->setCallback([&](const File&) {
_pointSpreadFunctionTextureIsDirty = true;
});
_userProvidedTextureOwner.addProperty(_pointSpreadFunctionTexturePath);
if (dictionary.hasKey(TransparencyInfo.identifier)) {
_alphaValue = static_cast<float>(
dictionary.value<double>(TransparencyInfo.identifier)
@@ -569,9 +575,9 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
_psfMultiplyOption.addOption(5, "Distance Modulus");
if (dictionary.hasKey(MagnitudeExponentInfo.identifier)) {
std::string sizeCompositionOption =
std::string sizeCompositionOption =
dictionary.value<std::string>(SizeCompositionOptionInfo.identifier);
if (sizeCompositionOption == "App Brightness") {
_psfMultiplyOption = 0;
} else if (sizeCompositionOption == "Lum and Size") {
@@ -782,9 +788,9 @@ void RenderableStars::renderPSFToTexture() {
glBindFramebuffer(GL_FRAMEBUFFER, psfFBO);
GLenum drawBuffers[1] = { GL_COLOR_ATTACHMENT0 };
glDrawBuffers(1, drawBuffers);
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _psfTexture, 0);
glViewport(0, 0, _psfTextureSize, _psfTextureSize);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -812,7 +818,7 @@ void RenderableStars::renderPSFToTexture() {
glBindVertexArray(_psfVao);
glDrawArrays(GL_TRIANGLES, 0, 6);
glBindVertexArray(0);
program->deactivate();
// JCC: Convolution is disabled while FFT is not enabled
@@ -824,9 +830,9 @@ void RenderableStars::renderPSFToTexture() {
//glDrawBuffers(1, drawBuffers);
//glFramebufferTexture(
// GL_FRAMEBUFFER,
// GL_COLOR_ATTACHMENT0,
// _convolvedTexture,
// GL_FRAMEBUFFER,
// GL_COLOR_ATTACHMENT0,
// _convolvedTexture,
// 0
//);
@@ -853,7 +859,7 @@ void RenderableStars::renderPSFToTexture() {
//programConvolve->setUniform("psfTextureSize", _psfTextureSize);
//programConvolve->setUniform(
// "convolvedfTextureSize",
// "convolvedfTextureSize",
// _convolvedfTextureSize
//);
@@ -884,7 +890,7 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) {
if (_fullData.empty()) {
return;
}
// Saving current OpenGL state
GLenum blendEquationRGB;
GLenum blendEquationAlpha;
@@ -934,14 +940,14 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) {
);
_program->setUniform(_uniformCache.colorOption, _colorOption);
_program->setUniform(_uniformCache.magnitudeExponent, _magnitudeExponent);
_program->setUniform(_uniformCache.psfParamConf, _psfMultiplyOption.value());
_program->setUniform(_uniformCache.lumCent, _lumCent);
_program->setUniform(_uniformCache.radiusCent, _radiusCent);
_program->setUniform(_uniformCache.brightnessCent, _brightnessCent);
_program->setUniform(_uniformCache.alphaValue, _alphaValue);
ghoul::opengl::TextureUnit psfUnit;
psfUnit.activate();
@@ -1361,7 +1367,7 @@ void RenderableStars::readSpeckFile() {
// +3 because the position x, y, z
if (name == "lum") {
_lumArrayPos = _nValuesPerStar + 3;
_lumArrayPos = _nValuesPerStar + 3;
}
else if (name == "absmag") {
_absMagArrayPos = _nValuesPerStar + 3;
@@ -1404,9 +1410,9 @@ void RenderableStars::readSpeckFile() {
break;
}
}
minLumValue = values[_lumArrayPos] < minLumValue ?
minLumValue = values[_lumArrayPos] < minLumValue ?
values[_lumArrayPos] : minLumValue;
maxLumValue = values[_lumArrayPos] > maxLumValue ?
maxLumValue = values[_lumArrayPos] > maxLumValue ?
values[_lumArrayPos] : maxLumValue;
if (!nullArray) {
_fullData.insert(_fullData.end(), values.begin(), values.end());
@@ -1415,7 +1421,7 @@ void RenderableStars::readSpeckFile() {
// Normalize Luminosity:
for (size_t i = 0; i < _fullData.size(); i += _nValuesPerStar) {
_fullData[i + _lumArrayPos] =
_fullData[i + _lumArrayPos] =
(_fullData[i + _lumArrayPos] - minLumValue) / (maxLumValue - minLumValue);
}
}
@@ -1494,7 +1500,7 @@ void RenderableStars::saveCachedFile(const std::string& file) const {
fileStream.write(reinterpret_cast<const char*>(&_appMagArrayPos), sizeof(int32_t));
fileStream.write(reinterpret_cast<const char*>(&_bvColorArrayPos), sizeof(int32_t));
fileStream.write(reinterpret_cast<const char*>(&_velocityArrayPos), sizeof(int32_t));
fileStream.write(reinterpret_cast<const char*>(&_speedArrayPos), sizeof(int32_t));
fileStream.write(reinterpret_cast<const char*>(&_speedArrayPos), sizeof(int32_t));
// -3 as we don't want to save the xyz values that are in the beginning of the file
for (int i = 0; i < _nValuesPerStar - 3; ++i) {
@@ -1516,7 +1522,11 @@ void RenderableStars::createDataSlice(ColorOption option) {
);
for (size_t i = 0; i < _fullData.size(); i += _nValuesPerStar) {
glm::vec3 position = glm::vec3(_fullData[i + 0], _fullData[i + 1], _fullData[i + 2]);
glm::vec3 position = glm::vec3(
_fullData[i + 0],
_fullData[i + 1],
_fullData[i + 2]
);
position *= openspace::distanceconstants::Parsec;
switch (option) {
@@ -1606,8 +1616,8 @@ void RenderableStars::createDataSlice(ColorOption option) {
layout.value.position = { { position[0], position[1], position[2] } };
int index = _otherDataOption.value();
// plus 3 because of the position
layout.value.value = _fullData[i + index + 3];
// plus 3 because of the position
layout.value.value = _fullData[i + index + 3];
if (_staticFilterValue.has_value() &&
layout.value.value == _staticFilterValue)

View File

@@ -93,8 +93,8 @@ private:
//properties::StringProperty _shapeTexturePath;
//std::unique_ptr<ghoul::opengl::Texture> _shapeTexture;
//std::unique_ptr<ghoul::filesystem::File> _shapeTextureFile;
properties::OptionProperty _colorOption;
properties::OptionProperty _colorOption;
properties::OptionProperty _otherDataOption;
properties::StringProperty _otherDataColorMapPath;
properties::Vec2Property _otherDataRange;
@@ -103,7 +103,7 @@ private:
properties::StringProperty _pointSpreadFunctionTexturePath;
std::unique_ptr<ghoul::opengl::Texture> _pointSpreadFunctionTexture;
std::unique_ptr<ghoul::filesystem::File> _pointSpreadFunctionFile;
properties::FloatProperty _alphaValue;
properties::OptionProperty _psfMethodOption;
properties::OptionProperty _psfMultiplyOption;
@@ -126,13 +126,13 @@ private:
std::unique_ptr<ghoul::opengl::ProgramObject> _program;
UniformCache(
modelMatrix, cameraUp, cameraViewProjectionMatrix,
colorOption, magnitudeExponent, eyePosition, psfParamConf,
lumCent, radiusCent, brightnessCent, colorTexture,
alphaValue, psfTexture, otherDataTexture, otherDataRange,
modelMatrix, cameraUp, cameraViewProjectionMatrix,
colorOption, magnitudeExponent, eyePosition, psfParamConf,
lumCent, radiusCent, brightnessCent, colorTexture,
alphaValue, psfTexture, otherDataTexture, otherDataRange,
filterOutOfRange
) _uniformCache;
bool _speckFileIsDirty = true;
bool _pointSpreadFunctionTextureIsDirty = true;
bool _colorTextureIsDirty = true;
@@ -145,7 +145,7 @@ private:
std::vector<float> _slicedData;
std::vector<float> _fullData;
int _nValuesPerStar = 0;
std::string _queuedOtherData;
std::vector<std::string> _dataNames;

View File

@@ -69,8 +69,9 @@ void registerCoreClasses(documentation::DocumentationEngine& engine) {
engine.addDocumentation(LightSource::Documentation());
}
//NOTE: should this be in the documentation/core_reg.cpp file? Seems to be here just because it has the same
//method name (and similar implementaiton) as the documentation version.
// NOTE: should this be in the documentation/core_reg.cpp file? Seems to be here just
// because it has the same method name (and similar implementaiton) as the
// documentation version.
void registerCoreClasses(scripting::ScriptEngine& engine) {
engine.addLibrary(Dashboard::luaLibrary());
engine.addLibrary(MissionManager::luaLibrary());

View File

@@ -178,16 +178,21 @@ void DocumentationEngine::addDocumentation(Documentation documentation) {
}
}
void DocumentationEngine::addHandlebarTemplates(std::vector<HandlebarTemplate> templates) {
_handlebarTemplates.insert(std::end(_handlebarTemplates), std::begin(templates), std::end(templates));
void DocumentationEngine::addHandlebarTemplates(std::vector<HandlebarTemplate> templates)
{
_handlebarTemplates.insert(
std::end(_handlebarTemplates),
std::begin(templates), std::end(templates)
);
}
std::vector<Documentation> DocumentationEngine::documentations() const {
return _documentations;
}
void DocumentationEngine::writeDocumentationHtml(const std::string path, const std::string data) {
void DocumentationEngine::writeDocumentationHtml(const std::string& path,
std::string data)
{
std::ifstream handlebarsInput;
handlebarsInput.exceptions(~std::ofstream::goodbit);
handlebarsInput.open(absPath(HandlebarsFilename));
@@ -285,7 +290,7 @@ void DocumentationEngine::writeDocumentationHtml(const std::string path, const s
file
<< " " << "<script id=\"" << DataId
<< "\" type=\"text/application/json\">" << '\n'
<< " " << data << '\n'
<< " " << std::move(data) << '\n'
<< " " << "</script>" << '\n';

View File

@@ -921,7 +921,7 @@ void OpenSpaceEngine::loadFonts() {
}
void OpenSpaceEngine::writeSceneDocumentation() {
// Write documentation to json files if config file supplies path for doc files to be placed.
// Write documentation to json files if config file supplies path for doc files
std::string path = global::configuration.documentation.path;
if (!path.empty()) {

View File

@@ -105,30 +105,28 @@ void ExternInteraction::scriptInteraction(datamessagestructures::ScriptMessage s
}
datamessagestructures::CameraKeyframe ExternInteraction::generateCameraKeyframe() {
interaction::NavigationHandler& navHandler = global::navigationHandler;
datamessagestructures::CameraKeyframe kf;
const SceneGraphNode* focusNode =
global::navigationHandler.orbitalNavigator().anchorNode();
const SceneGraphNode* focusNode = navHandler.orbitalNavigator().anchorNode();
if (!focusNode) {
return kf;
}
//kf._position = global::navigationHandler.camera()->positionVec3();
kf._position = global::navigationHandler.orbitalNavigator().anchorNodeToCameraVector();
kf._position = navHandler.orbitalNavigator().anchorNodeToCameraVector();
kf._followNodeRotation =
global::navigationHandler.orbitalNavigator().followingNodeRotation();
kf._followNodeRotation = navHandler.orbitalNavigator().followingNodeRotation();
if (kf._followNodeRotation) {
kf._position = glm::inverse(focusNode->worldRotationMatrix()) * kf._position;
kf._rotation =
global::navigationHandler.orbitalNavigator().anchorNodeToCameraRotation();
kf._rotation = navHandler.orbitalNavigator().anchorNodeToCameraRotation();
}
else {
kf._rotation = global::navigationHandler.camera()->rotationQuaternion();
kf._rotation = navHandler.camera()->rotationQuaternion();
}
kf._focusNode = focusNode->identifier();
kf._scale = global::navigationHandler.camera()->scaling();
kf._scale = navHandler.camera()->scaling();
// Timestamp as current runtime of OpenSpace instance
kf._timestamp = global::windowDelegate.applicationTime();

View File

@@ -48,7 +48,9 @@ namespace {
constexpr const bool UsingTimeKeyframes = false;
const std::string FileHeaderTitle = "OpenSpace_record/playback";
constexpr const size_t FileHeaderVersionLength = 5;
constexpr const char FileHeaderVersion[FileHeaderVersionLength] = { '0', '0', '.', '8', '5' };
constexpr const char FileHeaderVersion[FileHeaderVersionLength] = {
'0', '0', '.', '8', '5'
};
constexpr const char DataFormatAsciiTag = 'A';
constexpr const char DataFormatBinaryTag = 'B';
@@ -203,7 +205,10 @@ bool SessionRecording::startPlayback(const std::string& filename,
// Open in ASCII first
_playbackFile.open(_playbackFilename, std::ifstream::in);
// Read header
std::string readBackHeaderString = readHeaderElement(_playbackFile, FileHeaderTitle.length());
std::string readBackHeaderString = readHeaderElement(
_playbackFile,
FileHeaderTitle.length()
);
if (readBackHeaderString != FileHeaderTitle) {
LERROR("Specified playback file does not contain expected header.");
cleanUpPlayback();
@@ -764,7 +769,7 @@ double SessionRecording::fixedDeltaTimeDuringFrameOutput() const {
}
else {
return 0;
}
}
}
void SessionRecording::playbackCamera() {
@@ -1022,7 +1027,7 @@ void SessionRecording::moveAheadInTime() {
if (!focusRenderable || focusRenderable->renderedWithDesiredData()) {
_saveRenderingCurrentRecordedTime += _saveRenderingDeltaTime;
global::renderEngine.takeScreenShot();
}
}
}
}

View File

@@ -585,29 +585,29 @@ const std::string& ParallelPeer::hostName() {
}
void ParallelPeer::sendCameraKeyframe() {
interaction::NavigationHandler& navHandler = global::navigationHandler;
const SceneGraphNode* focusNode =
global::navigationHandler.orbitalNavigator().anchorNode();
navHandler.orbitalNavigator().anchorNode();
if (!focusNode) {
return;
}
// Create a keyframe with current position and orientation of camera
datamessagestructures::CameraKeyframe kf;
kf._position = global::navigationHandler.orbitalNavigator().anchorNodeToCameraVector();
kf._position = navHandler.orbitalNavigator().anchorNodeToCameraVector();
kf._followNodeRotation =
global::navigationHandler.orbitalNavigator().followingNodeRotation();
kf._followNodeRotation = navHandler.orbitalNavigator().followingNodeRotation();
if (kf._followNodeRotation) {
kf._position = glm::inverse(focusNode->worldRotationMatrix()) * kf._position;
kf._rotation =
global::navigationHandler.orbitalNavigator().anchorNodeToCameraRotation();
kf._rotation = navHandler.orbitalNavigator().anchorNodeToCameraRotation();
}
else {
kf._rotation = global::navigationHandler.camera()->rotationQuaternion();
kf._rotation = navHandler.camera()->rotationQuaternion();
}
kf._focusNode = focusNode->identifier();
kf._scale = global::navigationHandler.camera()->scaling();
kf._scale = navHandler.camera()->scaling();
// Timestamp as current runtime of OpenSpace instance
kf._timestamp = global::windowDelegate.applicationTime();

View File

@@ -555,7 +555,7 @@ int removeSceneGraphNode(lua_State* L) {
}
// Add all the children
std::function<void(SceneGraphNode*, std::vector<SceneGraphNode*>&)> markNode =
std::function<void(SceneGraphNode*, std::vector<SceneGraphNode*>&)> markNode =
[&markNode](SceneGraphNode* node, std::vector<SceneGraphNode*>& markedList)
{
std::vector<SceneGraphNode*> children = node->children();

View File

@@ -55,7 +55,7 @@ void VersionChecker::requestLatestVersion(const std::string& url) {
bool VersionChecker::hasLatestVersionInfo() {
if (_latestVersion.has_value()) {
return true;
return true;
}
if (_request) {
if (_request->hasSucceeded()) {