Merge branch 'master' into feature/PerformanceATMOnline

This commit is contained in:
Jonathas Costa
2018-03-07 19:07:45 -05:00
174 changed files with 1750 additions and 1352 deletions
@@ -331,9 +331,12 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
sourceArray.emplace_back(sourceName, sourceRadius);
}
else {
LWARNING("No Radius value expecified for Shadow Source Name "
<< sourceName << " from " << name
<< " planet.\nDisabling shadows for this planet.");
LWARNING(fmt::format(
"No Radius value expecified for Shadow Source Name '{}' from "
"'{}' planet. Disabling shadows for this planet.",
sourceName,
name
));
disableShadows = true;
break;
}
@@ -357,9 +360,12 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
casterArray.emplace_back(casterName, casterRadius);
}
else {
LWARNING("No Radius value expecified for Shadow Caster Name "
<< casterName << " from " << name
<< " planet.\nDisabling shadows for this planet.");
LWARNING(fmt::format(
"No Radius value expecified for Shadow Caster Name '{}' from "
"'{}' planet. Disabling shadows for this planet.",
casterName,
name
));
disableShadows = true;
break;
}
@@ -391,14 +397,20 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (success) {
if (!atmosphereDictionary.getValue(keyAtmosphereRadius, _atmosphereRadius)) {
errorReadingAtmosphereData = true;
LWARNING("No Atmosphere Radius value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet.");
LWARNINGC(
name,
"No Atmosphere Radius value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!atmosphereDictionary.getValue(keyPlanetRadius, _atmospherePlanetRadius)) {
errorReadingAtmosphereData = true;
LWARNING("No Planet Radius value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet.");
LWARNINGC(
name,
"No Planet Radius value expecified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!atmosphereDictionary.getValue(
@@ -406,10 +418,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_planetAverageGroundReflectance))
{
errorReadingAtmosphereData = true;
LWARNING(
"No Average Atmosphere Ground Reflectance value expecified for "
"Atmosphere Effects of " << name << " planet.\nDisabling atmosphere "
"effects for this planet."
LWARNINGC(
name,
"No Average Atmosphere Ground Reflectance value specified for "
"Atmosphere Effects. Disabling atmosphere effects for this planet."
);
}
@@ -418,10 +430,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_planetGroundRadianceEmittion))
{
errorReadingAtmosphereData = true;
LWARNING(
"No Ground Radiance Emitted percentage value expecified for Atmosphere "
"Effects of " << name << " planet.\nDisabling atmosphere effects for "
"this planet."
LWARNINGC(
name,
"No Ground Radiance Emitted percentage value specified for Atmosphere "
"Effects. Disabling atmosphere effects for this planet."
);
}
@@ -441,10 +453,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_rayleighScatteringCoeff))
{
errorReadingAtmosphereData = true;
LWARNING(
"No Rayleigh Scattering parameters expecified for Atmosphere Effects "
"of " << name << " planet.\nDisabling atmosphere effects for this "
"planet."
LWARNINGC(
name,
"No Rayleigh Scattering parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
@@ -453,16 +465,20 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_rayleighHeightScale))
{
errorReadingAtmosphereData = true;
LWARNING(
"No Rayleigh Height Scale value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Rayleigh Height Scale value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
}
else {
errorReadingAtmosphereData = true;
LWARNING("No Rayleigh parameters expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet.");
LWARNINGC(
name,
"No Rayleigh parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
ghoul::Dictionary ozoneDictionary;
@@ -489,41 +505,46 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (success) {
if (!mieDictionary.getValue(keyMieHeightScale, _mieHeightScale)) {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie Height Scale value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie Height Scale value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!mieDictionary.getValue("Coefficients.Scattering", _mieScatteringCoeff)) {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie Scattering parameters expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie Scattering parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!mieDictionary.getValue("Coefficients.Extinction", _mieExtinctionCoeff)) {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie Extinction parameters expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie Extinction parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!mieDictionary.getValue(keyMiePhaseConstant, _miePhaseConstant)) {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie Phase Constant value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie Phase Constant value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
}
else {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie parameters expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
@@ -531,7 +552,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
success = atmosphereDictionary.getValue(keyImage, ImageDictionary);
if (success) {
if (ImageDictionary.getValue(keyToneMappingOp, _preCalculatedTexturesScale)) {
LDEBUG("Atmosphere Texture Scaled to " << _preCalculatedTexturesScale);
LDEBUG(fmt::format(
"Atmosphere Texture Scaled to {}",
_preCalculatedTexturesScale
));
}
}
@@ -539,7 +563,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
success = atmosphereDictionary.getValue(keyATMDebug, debugDictionary);
if (success) {
if (debugDictionary.getValue(keyTextureScale, _preCalculatedTexturesScale)) {
LDEBUG("Atmosphere Texture Scaled to " << _preCalculatedTexturesScale);
LDEBUG(fmt::format(
"Atmosphere Texture Scaled to {}",
_preCalculatedTexturesScale
));
}
if (debugDictionary.getValue(keySaveTextures, _saveCalculationsToTexture)) {
-2
View File
@@ -64,8 +64,6 @@
#include <modules/base/scale/luascale.h>
#include <modules/base/scale/staticscale.h>
#include <ghoul/filesystem/filesystem>
namespace openspace {
BaseModule::BaseModule() : OpenSpaceModule(BaseModule::Name) {}
@@ -33,6 +33,7 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/util/camera.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -29,6 +29,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -34,6 +34,7 @@
#include <openspace/util/camera.h>
#include <openspace/util/distanceconversion.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -29,6 +29,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -31,6 +31,7 @@
#include <openspace/mission/missionmanager.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -33,6 +33,7 @@
#include <openspace/util/camera.h>
#include <openspace/util/distanceconversion.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -30,6 +30,7 @@
#include <openspace/util/timeconversion.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
+21 -8
View File
@@ -29,6 +29,7 @@
#include <openspace/util/factorymanager.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/misc/invariants.h>
@@ -208,7 +209,11 @@ bool ModelGeometry::loadObj(const std::string& filename) {
const bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO("Cached file '" << cachedFile << "' used for file '" << filename << "'");
LINFO(fmt::format(
"Cached file '{}' used for file '{}",
cachedFile,
filename
));
const bool success = loadCachedFile(cachedFile);
if (success) {
@@ -221,12 +226,14 @@ bool ModelGeometry::loadObj(const std::string& filename) {
// file for the next run
}
else {
LINFO(
"Cached file '" << cachedFile << "' for file '" << filename << "' not found"
);
LINFO(fmt::format(
"Cached file '{}' for file '{}' not found",
cachedFile,
filename
));
}
LINFO("Loading Model file '" << filename << "'");
LINFO(fmt::format("Loading Model file '{}'", filename));
const bool modelSuccess = loadModel(filename);
if (!modelSuccess) {
@@ -262,7 +269,7 @@ bool ModelGeometry::saveCachedFile(const std::string& filename) {
return fileStream.good();
}
else {
LERROR("Error opening file '" << filename << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", filename));
return false;
}
}
@@ -284,7 +291,10 @@ bool ModelGeometry::loadCachedFile(const std::string& filename) {
fileStream.read(reinterpret_cast<char*>(&iSize), sizeof(int64_t));
if (vSize == 0 || iSize == 0) {
LERROR("Error opening file '" << filename << "' for loading cache file");
LERROR(fmt::format(
"Error opening file '{}' for loading cache file",
filename
));
return false;
}
@@ -300,7 +310,10 @@ bool ModelGeometry::loadCachedFile(const std::string& filename) {
return fileStream.good();
}
else {
LERROR("Error opening file '" << filename << "' for loading cache file");
LERROR(fmt::format(
"Error opening file '{}' for loading cache file",
filename
));
return false;
}
}
+1 -1
View File
@@ -273,7 +273,7 @@ void RenderableModel::loadTexture() {
if (_texture) {
LDEBUGC(
"RenderableModel",
"Loaded texture from '" << absPath(_colorTexturePath) << "'"
fmt::format("Loaded texture from '{}'", absPath(_colorTexturePath))
);
_texture->uploadTexture();
_texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
+1 -1
View File
@@ -31,7 +31,7 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/misc/defer.h>
#include <ghoul/opengl/programobject.h>
@@ -118,7 +118,7 @@ void RenderablePlaneImageLocal::loadTexture() {
if (texture) {
LDEBUGC(
"RenderablePlane",
"Loaded texture from '" << absPath(_texturePath) << "'"
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
);
texture->uploadTexture();
@@ -117,7 +117,7 @@ void RenderablePlaneImageOnline::update(const UpdateData&) {
if (imageFile.corrupted) {
LERRORC(
"ScreenSpaceImageOnline",
"Error loading image from URL '" << _texturePath << "'"
fmt::format("Error loading image from URL '{}'", _texturePath)
);
return;
}
+1 -1
View File
@@ -386,7 +386,7 @@ void RenderableSphere::loadTexture() {
if (texture) {
LDEBUGC(
"RenderableSphere",
"Loaded texture from '" << absPath(_texturePath) << "'"
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
);
texture->uploadTexture();
@@ -33,7 +33,7 @@
#include <ghoul/opengl/programobject.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/opengl/textureconversion.h>
namespace {
@@ -31,9 +31,9 @@
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/opengl/programobject.h>
namespace {
constexpr const char* KeyName = "Name";
@@ -124,7 +124,7 @@ void ScreenSpaceImageOnline::update() {
if (imageFile.corrupted) {
LERRORC(
"ScreenSpaceImageOnline",
"Error loading image from URL '" << _texturePath << "'"
fmt::format("Error loading image from URL '{}'", _texturePath)
);
return;
}
+6 -2
View File
@@ -29,6 +29,7 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/query/query.h>
#include <ghoul/fmt.h>
#include <ghoul/misc/assert.h>
namespace {
@@ -550,8 +551,11 @@ glm::dmat3 FixedRotation::matrix(const Time&) const {
{
LWARNINGC(
"FixedRotation",
"Dangerously collinear vectors detected: " <<
"x: " << x << " y: " << y << " z: " << z
fmt::format("Dangerously collinear vectors detected: x ({}) y ({}) z ({})",
x,
y,
z
)
);
return glm::dmat3();
}
+2 -2
View File
@@ -105,7 +105,7 @@ glm::dmat3 LuaRotation::matrix(const Time& time) const {
if (!isFunction) {
LERRORC(
"LuaRotation",
"Script '" << _luaScriptFile << "' does not have a function 'rotation'"
fmt::format("Script '{}' does nto have a function 'rotation'", _luaScriptFile)
);
return glm::dmat3(1.0);
}
@@ -128,7 +128,7 @@ glm::dmat3 LuaRotation::matrix(const Time& time) const {
if (success != 0) {
LERRORC(
"LuaScale",
"Error executing 'rotation': " << lua_tostring(_state, -1)
fmt::format("Error executing 'rotation': {}", lua_tostring(_state, -1))
);
}
+2 -2
View File
@@ -96,7 +96,7 @@ double LuaScale::scaleValue(const Time& time) const {
if (!isFunction) {
LERRORC(
"LuaScale",
"Script '" << _luaScriptFile << "' does not have a function 'scale'"
fmt::format("Script '{}' does not have a function 'scale'", _luaScriptFile)
);
return 0.0;
}
@@ -119,7 +119,7 @@ double LuaScale::scaleValue(const Time& time) const {
if (success != 0) {
LERRORC(
"LuaScale",
"Error executing 'scale': " << lua_tostring(_state, -1)
fmt::format("Error executing 'scale': {}", lua_tostring(_state, -1))
);
}
+9 -2
View File
@@ -28,6 +28,7 @@
#include <openspace/documentation/verifier.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/fmt.h>
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/lua/lua_helper.h>
#include <ghoul/filesystem/filesystem.h>
@@ -107,7 +108,10 @@ glm::dvec3 LuaTranslation::position(const Time& time) const {
if (!isFunction) {
LERRORC(
"LuaScale",
"Script '" << _luaScriptFile << "' does not have a function 'translation'"
fmt::format(
"Script '{}' does not have a function 'translation'",
_luaScriptFile
)
);
return glm::dvec3(0.0);
}
@@ -130,7 +134,10 @@ glm::dvec3 LuaTranslation::position(const Time& time) const {
if (success != 0) {
LERRORC(
"LuaScale",
"Error executing 'translation': " << lua_tostring(_state, -1)
fmt::format(
"Error executing 'translation': {}",
lua_tostring(_state, -1)
)
);
}
@@ -33,7 +33,7 @@
#include <openspace/rendering/renderengine.h>
#include <modules/spacecraftinstruments/rendering/renderableplanetprojection.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
@@ -36,7 +36,7 @@
#include <modules/digitaluniverse/rendering/renderableplanescloud.h>
#include <modules/digitaluniverse/rendering/renderabledumeshes.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
namespace openspace {
@@ -30,7 +30,8 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -807,8 +808,6 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data,
const glm::dvec3& orthoUp,
float fadeInVariable)
{
RenderEngine& renderEngine = OsEng.renderEngine();
float scale = 0.0;
switch (_unit) {
case Meter:
@@ -993,11 +992,11 @@ void RenderableBillboardsCloud::update(const UpdateData&) {
if (_vao == 0) {
glGenVertexArrays(1, &_vao);
LDEBUG("Generating Vertex Array id '" << _vao << "'");
LDEBUG(fmt::format("Generating Vertex Array id '{}'", _vao));
}
if (_vbo == 0) {
glGenBuffers(1, &_vbo);
LDEBUG("Generating Vertex Buffer Object id '" << _vbo << "'");
LDEBUG(fmt::format("Generating Vertex Buffer Object id '{}'", _vbo));
}
glBindVertexArray(_vao);
@@ -1062,7 +1061,10 @@ void RenderableBillboardsCloud::update(const UpdateData&) {
absPath(_spriteTexturePath)
);
if (_spriteTexture) {
LINFO("Loaded texture from '" << absPath(_spriteTexturePath) << "'");
LINFO(fmt::format(
"Loaded texture from '{}'",
absPath(_spriteTexturePath)
));
_spriteTexture->uploadTexture();
}
_spriteTexture->setFilter(
@@ -1115,10 +1117,11 @@ bool RenderableBillboardsCloud::loadSpeckData() {
bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO(
"Cached file '" << cachedFile << "' used for Speck file '" <<
_file << "'"
);
LINFO(fmt::format(
"Cached file '{}' used for Speck file '{}'",
cachedFile,
_file
));
success = loadCachedFile(cachedFile);
if (success) {
@@ -1131,9 +1134,9 @@ bool RenderableBillboardsCloud::loadSpeckData() {
}
}
else {
LINFO("Cache for Speck file '" << _file << "' not found");
LINFO(fmt::format("Cache for Speck file '{}' not found", _file));
}
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
success = readSpeckFile();
if (!success) {
@@ -1159,10 +1162,11 @@ bool RenderableBillboardsCloud::loadLabelData() {
}
bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO(
"Cached file '" << cachedFile << "' used for Label file '" <<
labelFile << "'"
);
LINFO(fmt::format(
"Cached file '{}' used for Label file '{}'",
cachedFile,
labelFile
));
success &= loadCachedFile(cachedFile);
if (!success) {
@@ -1172,8 +1176,8 @@ bool RenderableBillboardsCloud::loadLabelData() {
}
}
else {
LINFO("Cache for Label file '" << labelFile << "' not found");
LINFO("Loading Label file '" << labelFile << "'");
LINFO(fmt::format("Cache for Label file '{}' not found", labelFile));
LINFO(fmt::format("Loading Label file '{}'", labelFile));
success &= readLabelFile();
if (!success) {
@@ -1190,7 +1194,7 @@ bool RenderableBillboardsCloud::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -1280,7 +1284,7 @@ bool RenderableBillboardsCloud::readColorMapFile() {
std::string _file = _colorMapFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Color Map file '" << _file << "'");
LERROR(fmt::format("Failed to open Color Map file '{}'", _file));
return false;
}
@@ -1329,7 +1333,7 @@ bool RenderableBillboardsCloud::readLabelFile() {
std::string _file = _labelFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Label file '" << _file << "'");
LERROR(fmt::format("Failed to open Label file '{}'", _file));
return false;
}
@@ -1464,7 +1468,7 @@ bool RenderableBillboardsCloud::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format("Error opening file '{}' for loading cache file", file));
return false;
}
}
@@ -1516,7 +1520,7 @@ bool RenderableBillboardsCloud::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}
@@ -30,7 +30,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -644,7 +644,7 @@ bool RenderableDUMeshes::loadData() {
// else
// {
// LINFO("Cache for Speck file '" << _file << "' not found");
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
success = readSpeckFile();
if (!success) {
@@ -679,7 +679,7 @@ bool RenderableDUMeshes::loadData() {
// }
// else {
// LINFO("Cache for Label file '" << labelFile << "' not found");
LINFO("Loading Label file '" << labelFile << "'");
LINFO(fmt::format("Loading Label file '{}'", labelFile));
success &= readLabelFile();
if (!success) {
@@ -696,7 +696,7 @@ bool RenderableDUMeshes::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -820,7 +820,7 @@ bool RenderableDUMeshes::readLabelFile() {
std::string _file = _labelFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Label file '" << _file << "'");
LERROR(fmt::format("Failed to open Label file '{}'", _file));
return false;
}
@@ -933,7 +933,7 @@ bool RenderableDUMeshes::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format("Error opening file '{}' for loading cache file", file));
return false;
}
}
@@ -966,7 +966,7 @@ bool RenderableDUMeshes::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}
@@ -30,7 +30,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -869,7 +869,7 @@ bool RenderablePlanesCloud::loadData() {
// else
// {
// LINFO("Cache for Speck file '" << _file << "' not found");
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
success = readSpeckFile();
if (!success) {
@@ -905,7 +905,7 @@ bool RenderablePlanesCloud::loadData() {
// else
// {
// LINFO("Cache for Label file '" << labelFile << "' not found");
LINFO("Loading Label file '" << labelFile << "'");
LINFO(fmt::format("Loading Label file '{}'", labelFile));
success &= readLabelFile();
if (!success) {
@@ -928,7 +928,7 @@ bool RenderablePlanesCloud::loadTextures() {
if (p.second) {
LINFOC(
"RenderablePlanesCloud",
"Loaded texture from '" << pair.second << "'"
fmt::format("Loaded texture from '{}'", pair.second)
);
auto it = p.first;
it->second->uploadTexture();
@@ -946,7 +946,7 @@ bool RenderablePlanesCloud::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -1117,7 +1117,7 @@ bool RenderablePlanesCloud::readLabelFile() {
std::string _file = _labelFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Label file '" << _file << "'");
LERROR(fmt::format("Failed to open Label file '{}'", _file));
return false;
}
@@ -1228,7 +1228,7 @@ bool RenderablePlanesCloud::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format("Error opening file '{}' for loading cache file", file));
return false;
}
}
@@ -1261,7 +1261,7 @@ bool RenderablePlanesCloud::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}
@@ -30,7 +30,8 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -369,11 +370,9 @@ void RenderablePoints::update(const UpdateData&) {
if (_vao == 0) {
glGenVertexArrays(1, &_vao);
LDEBUG("Generating Vertex Array id '" << _vao << "'");
}
if (_vbo == 0) {
glGenBuffers(1, &_vbo);
LDEBUG("Generating Vertex Buffer Object id '" << _vbo << "'");
}
glBindVertexArray(_vao);
@@ -436,7 +435,10 @@ void RenderablePoints::update(const UpdateData&) {
absPath(_spriteTexturePath)
);
if (_spriteTexture) {
LDEBUG("Loaded texture from '" << absPath(_spriteTexturePath) << "'");
LDEBUG(fmt::format(
"Loaded texture from '{}'",
absPath(_spriteTexturePath)
));
_spriteTexture->uploadTexture();
}
_spriteTexture->setFilter(
@@ -462,9 +464,11 @@ bool RenderablePoints::loadData() {
bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO(
"Cached file '" << cachedFile << "' used for Speck file '" << _file << "'"
);
LINFO(fmt::format(
"Cached file '{}' used for Speck file '{}'",
cachedFile,
_file
));
bool success = loadCachedFile(cachedFile);
if (success) {
@@ -480,9 +484,9 @@ bool RenderablePoints::loadData() {
}
}
else {
LINFO("Cache for Speck file '" << _file << "' not found");
LINFO(fmt::format("Cache for Speck file '{}' not found", _file));
}
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
bool success = readSpeckFile();
if (!success) {
@@ -503,7 +507,7 @@ bool RenderablePoints::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -571,7 +575,7 @@ bool RenderablePoints::readColorMapFile() {
std::string _file = _colorMapFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Color Map file '" << _file << "'");
LERROR(fmt::format("Failed to open Color Map file '{}'", _file));
return false;
}
@@ -643,7 +647,10 @@ bool RenderablePoints::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format(
"Error opening file '{}' for loading cache file",
file
));
return false;
}
}
@@ -676,7 +683,7 @@ bool RenderablePoints::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}
@@ -136,20 +136,17 @@ RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary)
bool success = dictionary.getValue(keyVectorField, _vectorFieldInfo);
if (!success) {
LERROR("Renderable does not contain a key for '" <<
keyVectorField << "'");
LERROR(fmt::format("Renderable does not contain a key for '{}'", keyVectorField));
}
success = dictionary.getValue(keyFieldlines, _fieldlineInfo);
if (!success) {
LERROR("Renderable does not contain a key for '" <<
keyFieldlines << "'");
LERROR(fmt::format("Renderable does not contain a key for '{}'", keyFieldlines));
}
success = dictionary.getValue(keySeedPoints, _seedPointsInfo);
if (!success) {
LERROR("Renderable does not contain a key for '" <<
keySeedPoints << "'");
LERROR(fmt::format("Renderable does not contain a key for '{}", keySeedPoints));
}
// @TODO a non-magic number perhaps ---abock
@@ -320,7 +317,7 @@ void RenderableFieldlines::update(const UpdateData&) {
fieldlines[j].end()
);
}
LDEBUG("Number of vertices : " << vertexData.size());
LDEBUG(fmt::format("Number of vertices: {}", vertexData.size()));
if (_fieldlineVAO == 0) {
glGenVertexArrays(1, &_fieldlineVAO);
@@ -383,13 +380,14 @@ void RenderableFieldlines::loadSeedPoints() {
}
void RenderableFieldlines::loadSeedPointsFromFile() {
LINFO("Reading seed points from file '" << _seedPointSourceFile.value() << "'");
LINFO(fmt::format("Reading seed points from '{}'", _seedPointSourceFile.value()));
std::ifstream seedFile(_seedPointSourceFile);
if (!seedFile.good())
LERROR(
"Could not open seed points file '" << _seedPointSourceFile.value() << "'"
);
LERROR(fmt::format(
"Could not open seed points file '{}'",
_seedPointSourceFile.value()
));
else {
std::string line;
glm::vec3 point;
@@ -419,8 +417,11 @@ std::vector<RenderableFieldlines::Line> RenderableFieldlines::generateFieldlines
std::string type;
bool success = _vectorFieldInfo.getValue(keyVectorFieldType, type);
if (!success) {
LERROR(keyVectorField << " does not contain a '" <<
keyVectorFieldType << "' key");
LERROR(fmt::format(
"{} does not contain a '{}' key",
keyVectorField,
keyVectorFieldType
));
return {};
}
@@ -428,8 +429,11 @@ std::vector<RenderableFieldlines::Line> RenderableFieldlines::generateFieldlines
return generateFieldlinesVolumeKameleon();
}
else {
LERROR(keyVectorField << "." << keyVectorFieldType <<
" does not name a valid type");
LERROR(fmt::format(
"{}.{} does not name a valid type",
keyVectorField,
keyVectorFieldType
));
return {};
}
}
@@ -440,14 +444,14 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon()
std::string model;
bool success = _vectorFieldInfo.getValue(keyVectorFieldVolumeModel, model);
if (!success) {
LERROR(keyVectorField << " does not name a model");
LERROR(fmt::format("{} does not name a model", keyVectorField));
return {};
}
std::string fileName;
success = _vectorFieldInfo.getValue(keyVectorFieldFile, fileName);
if (!success) {
LERROR(keyVectorField << " does not name a file");
LERROR(fmt::format("{} does not name a file", keyVectorField));
return {};
}
fileName = absPath(fileName);
@@ -456,8 +460,12 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon()
if (model != vectorFieldKameleonModelBATSRUS) {
//modelType = KameleonWrapper::Model::BATSRUS;
//else {
LERROR(keyVectorField << "." << keyVectorFieldVolumeModel << " model '" <<
model << "' not supported");
LERROR(fmt::format(
"{}.{} model '{}' not supported",
keyVectorField,
keyVectorFieldVolumeModel,
model
));
return {};
}
@@ -475,7 +483,7 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon()
(_vectorFieldInfo.value<std::string>(v1) == vectorFieldKameleonVariableLorentz);
if (!threeVariables && !lorentzForce) {
LERROR(keyVectorField << " does not name variables");
LERROR(fmt::format("'{}' does not name variables", keyVectorField));
return {};
}
@@ -213,8 +213,9 @@ namespace {
tmp = std::stof(input);
}
catch (const std::invalid_argument& ia) {
LWARNING("Invalid argument: " << ia.what() << ". '" << input <<
"' is NOT a valid number!");
LWARNING(fmt::format(
"Invalid argument: {}. '{}' is NOT a valid number", ia.what(), input
));
return backupValue;
}
return tmp;
@@ -364,8 +365,9 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
// ------------------- EXTRACT MANDATORY VALUES FROM DICTIONARY ------------------- //
std::string inputFileTypeString;
if (!_dictionary->getValue(KeyInputFileType, inputFileTypeString)) {
LERROR(_name << ": The field " << std::string(KeyInputFileType) << " is missing!");
return false;
LERROR(fmt::format(
"{}: The field {} is missing", _name, KeyInputFileType
));
}
else {
std::transform(
@@ -385,10 +387,10 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
sourceFileType = SourceFileType::Osfls;
}
else {
LERROR(
_name << ": " << inputFileTypeString << " is not a recognized " <<
KeyInputFileType
);
LERROR(fmt::format(
"{}: {} is not a recognized {}",
_name, inputFileTypeString, KeyInputFileType
));
sourceFileType = SourceFileType::Invalid;
return false;
}
@@ -396,7 +398,9 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
std::string sourceFolderPath;
if (!_dictionary->getValue(KeySourceFolder, sourceFolderPath)) {
LERROR(_name << ": The field " << std::string(KeySourceFolder) << " is missing!");
LERROR(fmt::format(
"{}: The field {} is missing", _name, KeySourceFolder
));
return false;
}
@@ -425,16 +429,17 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
}), _sourceFiles.end());
// Ensure that there are available and valid source files left
if (_sourceFiles.empty()) {
LERROR(
_name << ": " << sourceFolderPath << " contains no ." <<
inputFileTypeString << " files!"
);
LERROR(fmt::format(
"{}: {} contains no {} files",
_name, sourceFolderPath, inputFileTypeString
));
return false;
}
}
else {
LERROR(_name << ": FieldlinesSequence" << sourceFolderPath
<< " is not a valid directory!");
LERROR(fmt::format(
"{}: FieldlinesSequence {} is not a valid directory", _name, sourceFolderPath
));
return false;
}
@@ -451,10 +456,10 @@ void RenderableFieldlinesSequence::extractOptionalInfoFromDictionary(
outputFolderPath = absPath(outputFolderPath);
}
else {
LERROR(
_name << ": The specified output path: '" <<
outputFolderPath << "', does not exist!"
);
LERROR(fmt::format(
"{}: The specified output path: '{}', does not exist",
_name, outputFolderPath
));
outputFolderPath = "";
}
}
@@ -512,7 +517,9 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod
model = fls::stringToModel(modelStr);
}
else {
LERROR(_name << ": Must specify '" << KeyJsonSimulationModel << "'");
LERROR(fmt::format(
"{}: Must specify '{}'", _name, KeyJsonSimulationModel
));
return false;
}
@@ -521,8 +528,10 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod
_scalingFactor = scaleFactor;
}
else {
LWARNING(_name << ": Does not provide scalingFactor! " <<
"Assumes coordinates are already expressed in meters!");
LWARNING(fmt::format(
"{}: Does not provide scalingFactor. Assumes coordinates are in meters",
_name
));
}
return true;
}
@@ -573,7 +582,7 @@ void RenderableFieldlinesSequence::loadOsflsStatesIntoRAM(const std::string& out
}
}
else {
LWARNING("Failed to load state from: " << filePath);
LWARNING(fmt::format("Failed to load state from: {}", filePath));
}
}
}
@@ -584,8 +593,10 @@ void RenderableFieldlinesSequence::extractOsflsInfoFromDictionary() {
_loadingStatesDynamically = shouldLoadInRealtime;
}
else {
LWARNING(_name << ": " << KeyOslfsLoadAtRuntime <<
" isn't specified! States will be stored in RAM!");
LWARNING(fmt::format(
"{}: {} is not specified. States will be stored in RAM",
_name, KeyOslfsLoadAtRuntime
));
}
}
@@ -721,7 +732,9 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() {
_pFocusOnOriginBtn.onChange([this] {
SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(_name);
if (!node) {
LWARNING("Could not find a node in scenegraph called '" << _name << "'");
LWARNING(fmt::format(
"Could not find a node in scenegraph called '{}'", _name
));
return;
}
OsEng.navigationHandler().setFocusNode(node->parent());
@@ -868,20 +881,23 @@ bool RenderableFieldlinesSequence::extractCdfInfoFromDictionary(std::string& see
seedFilePath = absPath(seedFilePath);
}
else {
LERROR(_name << ": The specified seed point file: '" <<
seedFilePath << "', does not exist!");
LERROR(fmt::format(
"{}: The specified seed poitn file: '{}' does not exist",
_name, seedFilePath
));
return false;
}
}
else {
LERROR(_name << ": Must specify '" << KeyCdfSeedPointFile << "'");
LERROR(fmt::format("{}: Must specify '{}'", _name, KeyCdfSeedPointFile));
return false;
}
if (!_dictionary->getValue(KeyCdfTracingVariable, tracingVar)) {
tracingVar = "b"; // Magnetic field variable as default
LWARNING(_name << ": No '" << KeyCdfTracingVariable << "', using default: "
<< tracingVar);
LWARNING(fmt::format("{}: No '{}', using default '{}'",
_name, KeyCdfTracingVariable, tracingVar
));
}
ghoul::Dictionary extraQuantityNamesDictionary;
@@ -902,11 +918,11 @@ bool RenderableFieldlinesSequence::extractSeedPointsFromFile(const std::string&
std::ifstream seedFile(FileSys.relativePath(path));
if (!seedFile.good()) {
LERROR("Could not open seed points file '" << path << "'");
LERROR(fmt::format("Could not open seed points file '{}'", path));
return false;
}
LDEBUG("Reading seed points from file '" << path << "'");
LDEBUG(fmt::format("Reading seed points from file '{}'", path));
std::string line;
while (std::getline(seedFile, line)) {
glm::vec3 point;
@@ -918,7 +934,7 @@ bool RenderableFieldlinesSequence::extractSeedPointsFromFile(const std::string&
}
if (outVec.size() == 0) {
LERROR("Found no seed points in: " << path);
LERROR(fmt::format("Found no seed points in: {}", path));
return false;
}
@@ -25,6 +25,7 @@
#include <modules/fieldlinessequence/util/fieldlinesstate.h>
#include <openspace/util/time.h>
#include <ghoul/fmt.h>
#include <ghoul/logging/logmanager.h>
#include <ext/json/json.hpp>
#include <fstream>
@@ -142,7 +143,7 @@ bool FieldlinesState::loadStateFromJson(const std::string& pathToJsonFile,
std::ifstream ifs(pathToJsonFile);
if (!ifs.is_open()) {
LERROR("FAILED TO OPEN FILE: " << pathToJsonFile);
LERROR(fmt::format("FAILED TO OPEN FILE: {}", pathToJsonFile));
return false;
}
@@ -254,7 +255,9 @@ void FieldlinesState::saveStateToOsfls(const std::string& absPath) {
std::ofstream ofs(absPath + fileName, std::ofstream::binary | std::ofstream::trunc);
if (!ofs.is_open()) {
LERROR("Failed to save state to binary file: " << absPath << fileName);
LERROR(fmt::format(
"Failed to save state to binary file: {}{}", absPath, fileName
));
return;
}
@@ -326,10 +329,12 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
const char* ext = ".json";
std::ofstream ofs(absPath + ext, std::ofstream::trunc);
if (!ofs.is_open()) {
LERROR("Failed to save state to json file at location: " << absPath << ext);
LERROR(fmt::format(
"Failed to save state to json file at location: {}{}", absPath, ext
));
return;
}
LINFO("Saving fieldline state to: " << absPath << ext );
LINFO(fmt::format("Saving fieldline state to: {}{}", absPath, ext));
json jColumns = { "x", "y", "z" };
for (const std::string& s : _extraQuantityNames) {
@@ -369,7 +374,7 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
const int indentationSpaces = 2;
ofs << std::setw(indentationSpaces) << jFile << std::endl;
LINFO("Saved fieldline state to: " << absPath << ext );
LINFO(fmt::format("Saved fieldline state to: {}{}", absPath, ext));
}
// Returns one of the extra quantity vectors, _extraQuantities[index].
@@ -26,6 +26,7 @@
#include <modules/fieldlinessequence/util/commons.h>
#include <modules/fieldlinessequence/util/fieldlinesstate.h>
#include <ghoul/fmt.h>
#include <ghoul/logging/logmanager.h>
#include <memory>
@@ -151,8 +152,10 @@ bool addLinesToState(ccmc::Kameleon* kameleon, const std::vector<glm::vec3>& see
innerBoundaryLimit = 0.11f; // TODO specify in Lua?
break;
default:
LERROR("OpenSpace's fieldlines sequence currently only supports CDFs from "
<< "the BATSRUS and ENLIL models!");
LERROR(
"OpenSpace's fieldlines sequence currently only supports CDFs from the "
"BATSRUS and ENLIL models!"
);
return false;
}
@@ -302,14 +305,16 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
(model == fls::Model::Batsrus && (str == TAsPOverRho || str == "T" )))
{
LDEBUG("BATSRUS doesn't contain variable T for temperature. Trying to "
<< "calculate it using the ideal gas law: T = pressure/density");
"calculate it using the ideal gas law: T = pressure/density");
const std::string p = "p", r = "rho";
success = kameleon->doesVariableExist(p) && kameleon->loadVariable(p) &&
kameleon->doesVariableExist(r) && kameleon->loadVariable(r);
str = TAsPOverRho;
}
if (!success) {
LWARNING("Failed to load extra variable: '" << str << "'. Ignoring it!");
LWARNING(fmt::format(
"Failed to load extra variable: '{}'. Ignoring", str
));
extraScalarVars.erase(extraScalarVars.begin() + i);
--i;
} else {
@@ -346,9 +351,11 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
name = JParallelB;
}
if (!success) {
LWARNING("Failed to load at least one of the magnitude variables: "
<< s1 << ", " << s2 << " & " << s3
<< ". Removing ability to store corresponding magnitude!");
LWARNING(fmt::format(
"Failed to load at least one of the magnitude variables: {}, {}, {} "
"& {}. Removing ability to store corresponding magnitude",
s1, s2, s3
));
extraMagVars.erase(
extraMagVars.begin() + i,
extraMagVars.begin() + i + 3
@@ -361,9 +368,11 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
} else {
// WRONG NUMBER OF MAGNITUDE VARIABLES.. REMOVE ALL!
extraMagVars.clear();
LWARNING("Wrong number of variables provided for storing magnitudes. "
<< "Expects multiple of 3 but " << extraMagVars.size()
<< " are provided");
LWARNING(fmt::format(
"Wrong number of variables provided for storing magnitudes. Expects multiple "
"of 3 but {} are provided",
extraMagVars.size()
));
}
state.setExtraQuantityNames(std::move(extraQuantityNames));
}
+33 -2
View File
@@ -272,6 +272,14 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
"getGeoPosition",
&globebrowsing::luascriptfunctions::getGeoPosition,
{},
"name, latitude, longitude, altitude",
"Returns the specified surface position on the globe as three floating point "
"values"
},
{
"getGeoPositionForCamera",
&globebrowsing::luascriptfunctions::getGeoPositionForCamera,
{},
"void",
"Get geographic coordinates of the camera poosition in latitude, "
"longitude, and altitude"
@@ -348,6 +356,28 @@ void GlobeBrowsingModule::goToGeo(double latitude, double longitude,
);
}
glm::vec3 GlobeBrowsingModule::cartesianCoordinatesFromGeo(
globebrowsing::RenderableGlobe& globe,
double latitude, double longitude, double altitude)
{
using namespace globebrowsing;
Geodetic3 pos = {
{
Angle<double>::fromDegrees(latitude).asRadians(),
Angle<double>::fromDegrees(longitude).asRadians()
},
altitude
};
glm::dvec3 positionModelSpace = globe.ellipsoid().cartesianPosition(pos);
//glm::dmat4 modelTransform = globe.modelTransform();
//glm::dvec3 positionWorldSpace = glm::dvec3(modelTransform *
//glm::dvec4(positionModelSpace, 1.0));
return glm::vec3(positionModelSpace);
}
void GlobeBrowsingModule::goToChunk(Camera& camera, globebrowsing::TileIndex ti,
glm::vec2 uv, bool resetCameraDirection)
{
@@ -362,8 +392,9 @@ void GlobeBrowsingModule::goToChunk(Camera& camera, globebrowsing::TileIndex ti,
// Camera position in model space
glm::dvec3 camPos = camera.positionVec3();
glm::dmat4 inverseModelTransform = globe->inverseModelTransform();
glm::dvec3 cameraPositionModelSpace =
glm::dvec3(inverseModelTransform * glm::dvec4(camPos, 1));
glm::dvec3 cameraPositionModelSpace = glm::dvec3(
inverseModelTransform * glm::dvec4(camPos, 1)
);
GeodeticPatch patch(ti);
Geodetic2 corner = patch.getCorner(SOUTH_WEST);
@@ -53,6 +53,9 @@ public:
void goToGeo(double latitude, double longitude);
void goToGeo(double latitude, double longitude, double altitude);
glm::vec3 cartesianCoordinatesFromGeo(globebrowsing::RenderableGlobe& globe,
double latitude, double longitude, double altitude);
globebrowsing::cache::MemoryAwareTileCache* tileCache();
scripting::LuaLibrary luaLibrary() const override;
globebrowsing::RenderableGlobe* castFocusNodeRenderableToGlobe();
@@ -34,6 +34,7 @@
#include <openspace/rendering/renderable.h>
#include <openspace/scene/scene.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/query/query.h>
namespace openspace::globebrowsing::luascriptfunctions {
@@ -175,7 +176,40 @@ int goToGeo(lua_State* L) {
}
int getGeoPosition(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::getGeoPosition");
ghoul::lua::checkArgumentsAndThrow(L, 4, "lua::getGeoPosition");
std::string name = luaL_checkstring(L, 1);
double latitude = lua_tonumber(L, 2);
double longitude = lua_tonumber(L, 3);
double altitude = lua_tonumber(L, 4);
lua_settop(L, 0);
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
SceneGraphNode* n = sceneGraphNode(name);
Renderable* r = n->renderable();
RenderableGlobe* g = dynamic_cast<RenderableGlobe*>(r);
if (!g) {
return luaL_error(L, "Name must be a RenderableGlobe");
}
GlobeBrowsingModule& mod = *(OsEng.moduleEngine().module<GlobeBrowsingModule>());
glm::vec3 pos = mod.cartesianCoordinatesFromGeo(
*g,
latitude,
longitude,
altitude
);
lua_pushnumber(L, pos.x);
lua_pushnumber(L, pos.y);
lua_pushnumber(L, pos.z);
return 3;
}
int getGeoPositionForCamera(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::getGeoPositionForCamera");
GlobeBrowsingModule* module = OsEng.moduleEngine().module<GlobeBrowsingModule>();
RenderableGlobe* globe = module->castFocusNodeRenderableToGlobe();
@@ -65,14 +65,14 @@ namespace {
namespace openspace::globebrowsing {
void gdalErrorHandler(CPLErr eErrClass, int, const char *msg) {
void gdalErrorHandler(CPLErr eErrClass, int, const char* msg) {
if (GdalWrapper::ref().logGdalErrors()) {
switch (eErrClass) {
case CE_None: break;
case CE_Debug: LDEBUG ("GDAL " << msg); break;
case CE_Warning: LWARNING("GDAL " << msg); break;
case CE_Failure: LERROR ("GDAL " << msg); break;
case CE_Fatal: LFATAL ("GDAL " << msg); break;
case CE_Debug: LDEBUGC ("GDAL", msg); break;
case CE_Warning: LWARNINGC("GDAL", msg); break;
case CE_Failure: LERRORC ("GDAL", msg); break;
case CE_Fatal: LFATALC ("GDAL", msg); break;
}
}
}
@@ -188,12 +188,12 @@ void GdalWrapper::setGdalProxyConfiguration() {
if (success) {
std::string proxy = proxyAddress + ":" + proxyPort;
CPLSetConfigOption("GDAL_HTTP_PROXY", proxy.c_str());
LDEBUG("Using proxy server " << proxy);
LDEBUG(fmt::format("Using proxy server {}", proxy));
if (userAndPassword) {
std::string proxyUserPwd = proxyUser + ":" + proxyPassword;
CPLSetConfigOption("GDAL_HTTP_PROXYUSERPWD", proxyUserPwd.c_str());
CPLSetConfigOption("GDAL_HTTP_PROXYAUTH", proxyAuthString.c_str());
LDEBUG("Using authentication method: " << proxyAuthString);
LDEBUG(fmt::format("Using authentication method: {}", proxyAuthString));
}
} else {
LERROR("Invalid proxy settings for GDAL");
@@ -47,7 +47,8 @@
#include <modules/globebrowsing/geometry/angle.h>
#include <float.h>
#include <ghoul/fmt.h>
#include <fmt/ostream.h>
#include <sstream>
#include <algorithm>
@@ -151,7 +152,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -180,7 +181,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
format.glFormat = GL_RED;
break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -210,7 +211,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -240,12 +241,15 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
default:
LERROR("Unknown number of channels for OpenGL texture: " << rasterCount);
LERROR(fmt::format(
"Unknown number of channels for OpenGL texture: {}",
rasterCount
));
throw ghoul::MissingCaseException();
}
return format;
@@ -281,7 +285,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -310,7 +314,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
format.glFormat = GL_RED;
break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -340,7 +344,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -370,12 +374,12 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
default:
LERROR("Unknown number of channels for OpenGL texture: " << rasterCount);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
return format;
@@ -398,7 +402,7 @@ GLenum getOpenGLDataType(GDALDataType gdalType) {
case GDT_Float64:
return GL_DOUBLE;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
}
@@ -420,7 +424,7 @@ GDALDataType getGdalDataType(GLenum glType) {
case GL_DOUBLE:
return GDT_Float64;
default:
LERROR("OpenGL data type unknown to GDAL: " << glType);
LERROR(fmt::format("OpenGL data type unknown to GDAL: {}", glType));
throw ghoul::MissingCaseException();
}
}
@@ -441,7 +445,7 @@ size_t numberOfRasters(ghoul::opengl::Texture::Format format) {
return 4;
default: {
ghoul_assert(false, "Unknown format");
return 0;
throw ghoul::MissingCaseException();
}
}
}
@@ -526,7 +530,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_R16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RG:
@@ -545,7 +549,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RG16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RGB:
@@ -564,7 +568,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RGB16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RGBA:
@@ -583,7 +587,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RGBA16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::BGR:
@@ -602,7 +606,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RGB16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::BGRA:
@@ -621,16 +625,16 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RGBA16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
default:
LERROR(
"Unknown format for OpenGL texture: " <<
LERROR(fmt::format(
"Unknown format for OpenGL texture: {}",
static_cast<std::underlying_type_t<ghoul::opengl::Texture::Format>>(
format
)
);
));
throw ghoul::MissingCaseException();
}
}
@@ -39,7 +39,7 @@
#include <openspace/engine/moduleengine.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/opengl/texture.h>
@@ -92,7 +92,7 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
double pixelSize = 0.0;
int tilePixelSize = 0;
if (dictionary.getValue<double>(KeyTilePixelSize, pixelSize)) {
LDEBUG("Default pixel size overridden: " << pixelSize);
LDEBUG(fmt::format("Default pixel size overridden: {}", pixelSize));
tilePixelSize = static_cast<int>(pixelSize);
}
@@ -106,7 +106,10 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
_performPreProcessing =
LayerManager::shouldPerformPreProcessingOnLayergroup(_layerGroupID);
if (dictionary.getValue<bool>(KeyPerformPreProcessing, _performPreProcessing)) {
LDEBUG("Default PerformPreProcessing overridden: " << _performPreProcessing);
LDEBUG(fmt::format(
"Default PerformPreProcessing overridden: {}",
_performPreProcessing
));
}
if (dictionary.hasKeyAndValue<double>(KeyPreCacheLevel)) {
@@ -241,7 +244,11 @@ void DefaultTileProvider::initAsyncTileDataReader(TileTextureInitData initData)
// Tiles are only available for levels 2 and higher.
if (_preCacheLevel >= 2) {
LDEBUG("Precaching '" << _filePath << "' with level '" << _preCacheLevel << "'");
LDEBUG(fmt::format(
"Precaching '{}' with level '{}'",
_filePath.value(),
_preCacheLevel
));
for (int level = 0; level <= _preCacheLevel; ++level) {
for (int x = 0; x <= level * 2; ++x) {
for (int y = 0; y <= level; ++y) {
@@ -28,11 +28,12 @@
#include <modules/globebrowsing/tile/tileprovider/defaulttileprovider.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include "cpl_minixml.h"
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <fstream>
namespace {
@@ -105,7 +106,7 @@ bool TemporalTileProvider::initialize() {
bool success = TileProvider::initialize();
if (!_preCacheTimes.empty()) {
LINFO("Preloading: " << _filePath.value());
LINFO(fmt::format("Preloading: {}", _filePath.value()));
for (const Time& t : _preCacheTimes) {
getTileProvider(t);
}
+14 -7
View File
@@ -27,9 +27,9 @@
#include <modules/imgui/include/gui.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/settingsengine.h>
#include <openspace/engine/virtualpropertymanager.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/interaction/navigationhandler.h>
#include <openspace/interaction/luaconsole.h>
#include <openspace/network/parallelconnection.h>
@@ -67,7 +67,6 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[]() {
std::vector<properties::PropertyOwner*> res = {
&(OsEng.windowWrapper()),
&(OsEng.settingsEngine()),
&(OsEng.navigationHandler()),
&(OsEng.renderEngine()),
&(OsEng.parallelConnection()),
@@ -86,7 +85,15 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
}
);
gui._property.setSource(
gui._moduleProperty.setSource(
[]() {
std::vector<properties::PropertyOwner*> v;
v.push_back(&(OsEng.moduleEngine()));
return v;
}
);
gui._sceneProperty.setSource(
[]() {
const Scene* scene = OsEng.renderEngine().scene();
const std::vector<SceneGraphNode*>& nodes = scene ?
@@ -197,7 +204,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](Key key, KeyModifier mod, KeyAction action) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.keyCallback(key, mod, action);
}
@@ -211,7 +218,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](unsigned int codepoint, KeyModifier modifier) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.charCallback(codepoint, modifier);
}
@@ -225,7 +232,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](MouseButton button, MouseAction action) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.mouseButtonCallback(button, action);
}
@@ -239,7 +246,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](double, double posY) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.mouseWheelCallback(posY);
}
+4 -1
View File
@@ -75,9 +75,12 @@ public:
GuiGlobeBrowsingComponent _globeBrowsing;
#endif // GLOBEBROWSING_USE_GDAL
GuiPerformanceComponent _performance;
GuiPropertyComponent _globalProperty;
GuiPropertyComponent _property;
GuiPropertyComponent _sceneProperty;
GuiPropertyComponent _screenSpaceProperty;
GuiPropertyComponent _moduleProperty;
GuiPropertyComponent _virtualProperty;
GuiSpaceTimeComponent _spaceTime;
GuiMissionComponent _mission;
+36 -19
View File
@@ -51,7 +51,7 @@ const char* configurationFile = "imgui.ini";
//const char* GuiFont = "${FONTS}/ubuntu/Ubuntu-Regular.ttf";
const char* GuiFont = "${FONTS}/arimo/Arimo-Regular.ttf";
const float FontSize = 14.f;
const ImVec2 size = ImVec2(500, 500);
const ImVec2 Size = ImVec2(500, 500);
//GLuint fontTex = 0;
// A VBO max size of 0 will cause a lazy instantiation of the buffer
@@ -222,7 +222,7 @@ static void RenderDrawLists(ImDrawData* drawData) {
void addScreenSpaceRenderableLocal(std::string texturePath) {
if (!FileSys.fileExists(absPath(texturePath))) {
LWARNING("Could not find image '" << texturePath << "'");
LWARNING(fmt::format("Could not find image '{}'", texturePath));
return;
}
@@ -280,9 +280,10 @@ void CaptionText(const char* text) {
GUI::GUI()
: GuiComponent("Main")
, _globalProperty("Global")
, _property(
"Properties",
, _globalProperty("Global Properties")
, _moduleProperty("Module Properties")
, _sceneProperty(
"Scene Properties",
GuiPropertyComponent::UseTreeLayout::Yes
)
, _screenSpaceProperty("ScreenSpace Properties")
@@ -297,7 +298,8 @@ GUI::GUI()
addPropertySubOwner(_help);
addPropertySubOwner(_performance);
addPropertySubOwner(_globalProperty);
addPropertySubOwner(_property);
addPropertySubOwner(_moduleProperty);
addPropertySubOwner(_sceneProperty);
addPropertySubOwner(_screenSpaceProperty);
_featuredProperties.setEnabled(true);
addPropertySubOwner(_featuredProperties);
@@ -323,7 +325,8 @@ GUI::GUI()
#endif // GLOBEBROWSING_USE_GDAL
_performance.setShowHelpTooltip(_showHelpText);
_globalProperty.setShowHelpTooltip(_showHelpText);
_property.setShowHelpTooltip(_showHelpText);
_moduleProperty.setShowHelpTooltip(_showHelpText);
_sceneProperty.setShowHelpTooltip(_showHelpText);
_screenSpaceProperty.setShowHelpTooltip(_showHelpText);
_virtualProperty.setShowHelpTooltip(_showHelpText);
_spaceTime.setShowHelpTooltip(_showHelpText);
@@ -348,7 +351,8 @@ GUI::GUI()
#endif // GLOBEBROWSING_USE_GDAL
_performance.setShowHelpTooltipDelay(_helpTextDelay);
_globalProperty.setShowHelpTooltipDelay(_helpTextDelay);
_property.setShowHelpTooltipDelay(_helpTextDelay);
_moduleProperty.setShowHelpTooltipDelay(_helpTextDelay);
_sceneProperty.setShowHelpTooltipDelay(_helpTextDelay);
_screenSpaceProperty.setShowHelpTooltipDelay(_helpTextDelay);
_virtualProperty.setShowHelpTooltipDelay(_helpTextDelay);
_spaceTime.setShowHelpTooltipDelay(_helpTextDelay);
@@ -479,12 +483,14 @@ void GUI::initialize() {
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.44f, 0.63f, 1.00f, 0.35f);
style.Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
}
_property.initialize();
_property.setHasRegularProperties(true);
_sceneProperty.initialize();
_sceneProperty.setHasRegularProperties(true);
_screenSpaceProperty.initialize();
_screenSpaceProperty.setHasRegularProperties(true);
_globalProperty.initialize();
_globalProperty.setHasRegularProperties(true);
_moduleProperty.initialize();
_moduleProperty.setHasRegularProperties(true);
_featuredProperties.initialize();
_featuredProperties.setHasRegularProperties(true);
_virtualProperty.initialize();
@@ -518,6 +524,7 @@ void GUI::deinitialize() {
_help.deinitialize();
_performance.deinitialize();
_globalProperty.deinitialize();
_moduleProperty.deinitialize();
_featuredProperties.deinitialize();
_screenSpaceProperty.deinitialize();
_virtualProperty.deinitialize();
@@ -526,7 +533,7 @@ void GUI::deinitialize() {
#ifdef GLOBEBROWSING_USE_GDAL
_globeBrowsing.deinitialize();
#endif // GLOBEBROWSING_USE_GDAL
_property.deinitialize();
_sceneProperty.deinitialize();
delete iniFileBuffer;
}
@@ -614,9 +621,10 @@ void GUI::initializeGL() {
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
_property.initializeGL();
_sceneProperty.initializeGL();
_screenSpaceProperty.initializeGL();
_globalProperty.initializeGL();
_moduleProperty.initializeGL();
_featuredProperties.initializeGL();
_performance.initializeGL();
_help.initializeGL();
@@ -656,13 +664,14 @@ void GUI::deinitializeGL() {
_performance.deinitializeGL();
_featuredProperties.deinitializeGL();
_globalProperty.deinitializeGL();
_moduleProperty.deinitializeGL();
_screenSpaceProperty.deinitializeGL();
#ifdef GLOBEBROWSING_USE_GDAL
_globeBrowsing.deinitializeGL();
#endif // GLOBEBROWSING_USE_GDAL
_filePath.deinitializeGL();
_asset.deinitializeGL();
_property.deinitializeGL();
_sceneProperty.deinitializeGL();
}
void GUI::startFrame(float deltaTime, const glm::vec2& windowSize,
@@ -709,8 +718,11 @@ void GUI::endFrame() {
if (_globalProperty.isEnabled()) {
_globalProperty.render();
}
if (_property.isEnabled()) {
_property.render();
if (_moduleProperty.isEnabled()) {
_moduleProperty.render();
}
if (_sceneProperty.isEnabled()) {
_sceneProperty.render();
}
if (_screenSpaceProperty.isEnabled()) {
_screenSpaceProperty.render();
@@ -832,9 +844,9 @@ void GUI::render() {
_isCollapsed = ImGui::IsWindowCollapsed();
bool property = _property.isEnabled();
ImGui::Checkbox("Scene Graph Properties", &property);
_property.setEnabled(property);
bool sceneProperty = _sceneProperty.isEnabled();
ImGui::Checkbox("Scene Graph Properties", &sceneProperty);
_sceneProperty.setEnabled(sceneProperty);
bool screenSpaceProperty = _screenSpaceProperty.isEnabled();
ImGui::Checkbox("ScreenSpace Properties", &screenSpaceProperty);
@@ -848,6 +860,10 @@ void GUI::render() {
ImGui::Checkbox("Global Properties", &globalProperty);
_globalProperty.setEnabled(globalProperty);
bool moduleProperty = _moduleProperty.isEnabled();
ImGui::Checkbox("Module Properties", &moduleProperty);
_moduleProperty.setEnabled(moduleProperty);
bool spacetime = _spaceTime.isEnabled();
ImGui::Checkbox("Space/Time", &spacetime);
_spaceTime.setEnabled(spacetime);
@@ -961,7 +977,8 @@ void GUI::renderAndUpdatePropertyVisibility() {
_currentVisibility = static_cast<V>(t);
_globalProperty.setVisibility(_currentVisibility);
_property.setVisibility(_currentVisibility);
_moduleProperty.setVisibility(_currentVisibility);
_sceneProperty.setVisibility(_currentVisibility);
_screenSpaceProperty.setVisibility(_currentVisibility);
_virtualProperty.setVisibility(_currentVisibility);
_featuredProperties.setVisibility(_currentVisibility);
@@ -42,7 +42,7 @@
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/misc/defer.h>
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <numeric>
@@ -242,7 +242,7 @@ void GuiGlobeBrowsingComponent::render() {
if (cap.empty()) {
LWARNINGC(
"GlobeBrowsingGUI",
"Unknown server: '" << _currentServer << "'"
fmt::format("Unknown server: '{}'", _currentServer)
);
}
+2 -2
View File
@@ -27,7 +27,7 @@
#include <modules/imgui/include/imgui_include.h>
namespace {
const ImVec2 size = ImVec2(350, 500);
const ImVec2 Size = ImVec2(350, 500);
} // namespace
namespace openspace::gui {
@@ -40,7 +40,7 @@ void GuiHelpComponent::render() {
ImGui::SetNextWindowCollapsed(_isCollapsed);
bool v = _isEnabled;
ImGui::Begin("Help", &v, size, 0.5f);
ImGui::Begin("Help", &v, Size, 0.5f);
_isEnabled = v;
_isCollapsed = ImGui::IsWindowCollapsed();
ImGui::ShowUserGuide();
+1 -1
View File
@@ -33,7 +33,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/scripting/scriptengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <modules/iswa/ext/json.h>
+1 -1
View File
@@ -32,7 +32,7 @@
#include <openspace/network/parallelconnection.h>
#include <openspace/network/messagestructures.h>
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <algorithm>
#include <numeric>
@@ -33,7 +33,7 @@
#include <ghoul/misc/sharedmemory.h>
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <algorithm>
#include <numeric>
+2 -2
View File
@@ -35,7 +35,7 @@
#include <algorithm>
namespace {
const ImVec2 size = ImVec2(350, 500);
const ImVec2 Size = ImVec2(350, 500);
static const openspace::properties::Property::PropertyInfo UseTreeInfo = {
"TreeLayout",
@@ -252,7 +252,7 @@ void GuiPropertyComponent::render() {
ImGui::SetNextWindowCollapsed(_isCollapsed);
bool v = _isEnabled;
ImGui::Begin(name().c_str(), &v, size, 0.75f);
ImGui::Begin(name().c_str(), &v, Size, 0.75f);
_isEnabled = v;
_isCollapsed = ImGui::IsWindowCollapsed();
+2 -2
View File
@@ -111,12 +111,12 @@ void IswaKameleonGroup::registerProperties() {
}
void IswaKameleonGroup::readFieldlinePaths(std::string indexFile) {
LINFO("Reading seed points paths from file '" << indexFile << "'");
LINFO(fmt::format("Reading seed points paths from file '{}'", indexFile));
// Read the index file from disk
std::ifstream seedFile(indexFile);
if (!seedFile.good())
LERROR("Could not open seed points file '" << indexFile << "'");
LERROR(fmt::format("Could not open seed points file '{}'", indexFile));
else {
std::string line;
std::string fileContent;
+3 -3
View File
@@ -25,7 +25,7 @@
#include <fstream>
#include <modules/iswa/rendering/kameleonplane.h>
#include <modules/iswa/util/dataprocessorkameleon.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
@@ -318,7 +318,7 @@ void KameleonPlane::updateFieldlineSeeds() {
}
void KameleonPlane::readFieldlinePaths(std::string indexFile) {
LINFO("Reading seed points paths from file '" << indexFile << "'");
LINFO(fmt::format("Reading seed points paths from file '{}'", indexFile));
if (_group) {
std::dynamic_pointer_cast<IswaKameleonGroup>(_group)->setFieldlineInfo(
indexFile,
@@ -330,7 +330,7 @@ void KameleonPlane::readFieldlinePaths(std::string indexFile) {
// Read the index file from disk
std::ifstream seedFile(indexFile);
if (!seedFile.good()) {
LERROR("Could not open seed points file '" << indexFile << "'");
LERROR(fmt::format("Could not open seed points file '{}'", indexFile));
}
else {
try {
+1 -1
View File
@@ -24,7 +24,7 @@
#include <modules/iswa/rendering/screenspacecygnet.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <openspace/util/time.h>
#include <modules/iswa/util/iswamanager.h>
#include <openspace/engine/openspaceengine.h>
+3 -1
View File
@@ -48,7 +48,9 @@ bool TextureCygnet::updateTexture() {
);
if (texture) {
LDEBUG("Loaded texture from image iswa cygnet with id: '" << _data->id << "'");
LDEBUG(fmt::format(
"Loaded texture from image iswa cygnet with id: '{}'", _data->id
));
texture->uploadTexture();
// Textures of planets looks much smoother with AnisotropicMipMap
texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap);
@@ -24,6 +24,7 @@
#include <modules/iswa/util/dataprocessorkameleon.h>
//#include <algorithm>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/glm.h>
+1 -1
View File
@@ -38,7 +38,7 @@
#include <fstream>
#include <algorithm>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <modules/kameleon/include/kameleonwrapper.h>
#include <openspace/scene/scene.h>
#include <openspace/util/spicemanager.h>
+13 -8
View File
@@ -39,7 +39,7 @@
#endif // _MSC_VER
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
namespace {
std::string _loggerCat = "KameleonHelper";
@@ -57,14 +57,17 @@ std::unique_ptr<ccmc::Kameleon> createKameleonObject(const std::string& cdfFileP
// ---------------------------- CREATE KAMELEON OBJECT ---------------------------- //
std::unique_ptr<ccmc::Kameleon> kameleon = std::make_unique<ccmc::Kameleon>();
LDEBUG("\tOpening the cdf file: " << cdfFilePath);
LDEBUG(fmt::format("\tOpening the cdf file: {}", cdfFilePath));
long kamStatus = kameleon->open(cdfFilePath);
if (kamStatus != ccmc::FileReader::OK) {
LERROR("Failed to create a Kameleon Object from file: " << cdfFilePath);
LERROR(fmt::format(
"Failed to create a Kameleon Object from file: {}",
cdfFilePath
));
return nullptr;
}
LDEBUG("\tSuccessfully opened : " << cdfFilePath);
LDEBUG(fmt::format("\tSuccessfully opened: {}", cdfFilePath));
return kameleon;
}
@@ -123,8 +126,10 @@ double getTime(ccmc::Kameleon* kameleon) {
seqStartStr =
kameleon->getGlobalAttribute("tim_crstart_cal").getAttributeString();
} else {
LWARNING("No starting time attribute could be found in the .cdf file.\n\t" <<
"Starting time is set to 01.JAN.2000 12:00.");
LWARNING(
"No starting time attribute could be found in the .cdf file. Starting "
"time is set to 01.JAN.2000 12:00."
);
seqStartDbl = 0.0;
}
@@ -137,7 +142,7 @@ double getTime(ccmc::Kameleon* kameleon) {
Time::convertTime(
seqStartStr.substr(0, seqStartStr.length() - 2));
} else {
LWARNING("No starting time attribute could be found in the .cdf file.\n\t" <<
LWARNING("No starting time attribute could be found in the .cdf file."
"Starting time is set to 01.JAN.2000 12:00.");
seqStartDbl = 0.0;
}
@@ -154,7 +159,7 @@ double getTime(ccmc::Kameleon* kameleon) {
"time_physical_time").getAttributeFloat());
} else {
stateStartOffset = 0.0;
LWARNING("No time offset attribute could be found in the .cdf file.\n\t" <<
LWARNING("No time offset attribute could be found in the .cdf file."
"The current state starts the same time as the sequence!");
}
+53 -39
View File
@@ -26,6 +26,7 @@
//#include <openspace/util/progressbar.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#ifdef WIN32
@@ -50,6 +51,7 @@
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <ghoul/fmt.h>
#include <glm/gtx/rotate_vector.hpp>
@@ -127,9 +129,9 @@ bool KameleonWrapper::open(const std::string& filename) {
_gridType = getGridType(_xCoordVar, _yCoordVar, _zCoordVar);
_type = getModelType();
LDEBUG("x:" << _xCoordVar);
LDEBUG("y:" << _yCoordVar);
LDEBUG("z:" << _zCoordVar);
LDEBUG(fmt::format("x: {}", _xCoordVar));
LDEBUG(fmt::format("y: {}", _yCoordVar));
LDEBUG(fmt::format("z: {}", _zCoordVar));
_xMin =
_model->getVariableAttribute(_xCoordVar, "actual_min").getAttributeFloat();
@@ -165,18 +167,18 @@ bool KameleonWrapper::open(const std::string& filename) {
_zValidMax =
_model->getVariableAttribute(_zCoordVar, "valid_max").getAttributeFloat();
LDEBUG("_xMin: " << _xMin);
LDEBUG("_xMax: " << _xMax);
LDEBUG("_yMin: " << _yMin);
LDEBUG("_yMax: " << _yMax);
LDEBUG("_zMin: " << _zMin);
LDEBUG("_zMax: " << _zMax);
LDEBUG("_xValidMin: " << _xValidMin);
LDEBUG("_xValidMax: " << _xValidMax);
LDEBUG("_yValidMin: " << _yValidMin);
LDEBUG("_yValidMax: " << _yValidMax);
LDEBUG("_zValidMin: " << _zValidMin);
LDEBUG("_zValidMax: " << _zValidMax);
LDEBUG(fmt::format("_xMin: {}", _xMin));
LDEBUG(fmt::format("_xMax: {}", _xMax));
LDEBUG(fmt::format("_yMin: {}", _yMin));
LDEBUG(fmt::format("_yMax: {}", _yMax));
LDEBUG(fmt::format("_zMin: {}", _zMin));
LDEBUG(fmt::format("_zMax: {}", _zMax));
LDEBUG(fmt::format("_xValidMin: {}", _xValidMin));
LDEBUG(fmt::format("_xValidMax: {}", _xValidMax));
LDEBUG(fmt::format("_yValidMin: {}", _yValidMin));
LDEBUG(fmt::format("_yValidMax: {}", _yValidMax));
LDEBUG(fmt::format("_zValidMin: {}", _zValidMin));
LDEBUG(fmt::format("_zValidMax: {}", _zValidMax));
return true;
}
@@ -203,7 +205,7 @@ float* KameleonWrapper::getUniformSampledValues(
const glm::size3_t& outDimensions)
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO("Loading variable " << var << " from CDF data with a uniform sampling");
LINFO(fmt::format("Loading variable {} from CDF data with a uniform sampling", var));
unsigned int size = static_cast<unsigned int>(
outDimensions.x * outDimensions.y * outDimensions.z
@@ -218,8 +220,8 @@ float* KameleonWrapper::getUniformSampledValues(
double stepY = (_yMax-_yMin)/(static_cast<double>(outDimensions.y));
double stepZ = (_zMax-_zMin)/(static_cast<double>(outDimensions.z));
LDEBUG(var << "Min: " << varMin);
LDEBUG(var << "Max: " << varMax);
LDEBUG(fmt::format("{} Min: {}", var, varMin));
LDEBUG(fmt::format("{} Max: {}", var, varMax));
// HISTOGRAM
const int bins = 200;
@@ -348,7 +350,7 @@ float* KameleonWrapper::getUniformSampledValues(
// LDEBUG("====================");
break;
}
LDEBUG("histogram[" << i << "]: " << histogram[i]);
LDEBUG(fmt::format("histogram[{}]: {}", i, histogram[i]));
}
double dist = varMax - varMin;
@@ -362,10 +364,10 @@ float* KameleonWrapper::getUniformSampledValues(
data[i] = static_cast<float>(glm::clamp(normalizedVal, 0.0, 1.0));
if(data[i] < 0.0) {
LERROR("Datapoint " << i << " less than 0");
LERROR(fmt::format("Datapoint {} less than 0", i));
}
if(data[i] > 1.0) {
LERROR("Datapoint " << i << " more than 1");
LERROR(fmt::format("Datapoint {} more than 1", i));
}
}
@@ -384,7 +386,10 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var,
const float& slice)
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO("Loading variable " << var << " from CDF data with a uniform sampling");
LINFO(fmt::format(
"Loading variable {} from CDF data with a uniform sampling",
var
));
unsigned int size = static_cast<unsigned int>(
outDimensions.x * outDimensions.y * outDimensions.z
@@ -409,8 +414,8 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var,
double yDim = (!ySlice)? outDimensions.y-1 : 1.0;
double zDim = (!zSlice)? outDimensions.z-1 : 1.0;
LDEBUG(var << "Min: " << varMin);
LDEBUG(var << "Max: " << varMax);
LDEBUG(fmt::format("{} min: {}", var, varMin));
LDEBUG(fmt::format("{} max: {}", var, varMax));
//double maxValue = 0.0;
//double minValue = std::numeric_limits<double>::max();
@@ -513,10 +518,13 @@ float* KameleonWrapper::getUniformSampledVectorValues(const std::string& xVar,
const glm::size3_t& outDimensions)
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO(
"Loading variables " << xVar << " " << yVar << " " << zVar <<
" from CDF data with a uniform sampling"
);
LINFO(fmt::format(
"loading variables {} {} {} from CDF data with a uniform sampling",
xVar,
yVar,
zVar
));
int channels = 4;
unsigned int size = static_cast<unsigned int>(
@@ -590,10 +598,13 @@ KameleonWrapper::Fieldlines KameleonWrapper::getClassifiedFieldLines(
float stepSize )
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO(
"Creating " << seedPoints.size() << " fieldlines from variables " <<
xVar << " " << yVar << " " << zVar
);
LINFO(fmt::format(
"Creating {} fieldlines from variables {} {} {}",
seedPoints.size(),
xVar,
yVar,
zVar
));
std::vector<glm::vec3> fLine, bLine;
std::vector<std::vector<LinePoint> > fieldLines;
@@ -647,10 +658,13 @@ KameleonWrapper::Fieldlines KameleonWrapper::getFieldLines(const std::string& xV
const std::vector<glm::vec3>& seedPoints, float stepSize, const glm::vec4& color)
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO(
"Creating " << seedPoints.size() << " fieldlines from variables " <<
xVar << " " << yVar << " " << zVar
);
LINFO(fmt::format(
"Creating {} fieldlines from variables {} {} {}",
seedPoints.size(),
xVar,
yVar,
zVar
));
std::vector<glm::vec3> fLine, bLine;
Fieldlines fieldLines;
@@ -698,7 +712,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getFieldLines(const std::string& xV
KameleonWrapper::Fieldlines KameleonWrapper::getLorentzTrajectories(
const std::vector<glm::vec3>& seedPoints,const glm::vec4& /*color*/, float stepsize)
{
LINFO("Creating " << seedPoints.size() << " Lorentz force trajectories");
LINFO(fmt::format("Creating {} Lorentz force trajectories", seedPoints.size()));
Fieldlines trajectories;
std::vector<glm::vec3> plusTraj, minusTraj;
@@ -926,7 +940,7 @@ KameleonWrapper::TraceLine KameleonWrapper::traceCartesianFieldline(
++numSteps;
if (numSteps > maxSteps) {
LDEBUG("Max number of steps taken (" << maxSteps <<")");
LDEBUG(fmt::format("Max number of steps taken ({})", maxSteps));
break;
}
}
@@ -1031,7 +1045,7 @@ KameleonWrapper::TraceLine KameleonWrapper::traceLorentzTrajectory(
++numSteps;
if (numSteps > maxSteps) {
LDEBUG("Max number of steps taken (" << maxSteps <<")");
LDEBUG(fmt::format("Max number of steps taken ({})", maxSteps));
break;
}
}
@@ -24,6 +24,7 @@
#include <modules/kameleonvolume/kameleonvolumereader.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#ifdef WIN32
@@ -43,6 +44,8 @@
#pragma warning (pop)
#endif // WIN32
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "KameleonVolumeReader";
} // namespace
@@ -54,13 +57,13 @@ KameleonVolumeReader::KameleonVolumeReader(const std::string& path)
: _path(path)
{
if (!FileSys.fileExists(path)) {
LERROR(_path << " does not exist");
LERROR(fmt::format("'{}' does not exist", _path));
throw ghoul::FileNotFoundError(_path);
}
long status = _kameleon.open(_path);
if (status != ccmc::FileReader::OK) {
LERROR("Failed to open file " << _path << " with Kameleon");
LERROR(fmt::format("Failed to open file '{}' with Kameleon", _path));
throw ghoul::RuntimeError("Failed to open file: " + _path + " with Kameleon");
return;
}
@@ -332,14 +332,13 @@ void RenderableKameleonVolume::updateRaycasterModelTransform() {
_raycaster->setModelTransform(modelTransform);
}
bool RenderableKameleonVolume::cachingEnabled() {
return _cache;
}
void RenderableKameleonVolume::load() {
if (!FileSys.fileExists(ghoul::filesystem::File(_sourcePath))) {
LERROR("File " << _sourcePath << " does not exist.");
LERROR(fmt::format("File '{}' does not exist.", _sourcePath.value()));
return;
}
if (!cachingEnabled()) {
@@ -30,6 +30,7 @@
#include <iostream>
#include <fstream>
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "BrickManager";
@@ -68,20 +69,29 @@ bool BrickManager::readHeader() {
_header = _tsp->header();
LDEBUG("Grid type: " << _header.gridType_);
LDEBUG("Original num timesteps: " << _header.numOrigTimesteps_);
LDEBUG("Num timesteps: " << _header.numTimesteps_);
LDEBUG("Brick dims: " << _header.xBrickDim_ << " " << _header.yBrickDim_ << " " << _header.zBrickDim_);
LDEBUG("Num bricks: " << _header.xNumBricks_ << " " << _header.yNumBricks_ << " " << _header.zNumBricks_);
LDEBUG("");
LDEBUG(fmt::format("Grid type: {}", _header.gridType_));
LDEBUG(fmt::format("Original num timesteps: {}", _header.numOrigTimesteps_));
LDEBUG(fmt::format("Num timesteps: {}", _header.numTimesteps_));
LDEBUG(fmt::format(
"Brick dims: {} {} {}",
_header.xBrickDim_,
_header.yBrickDim_,
_header.zBrickDim_
));
LDEBUG(fmt::format(
"Num bricks: {} {} {}",
_header.xNumBricks_,
_header.yNumBricks_,
_header.zNumBricks_
));
brickDim_ = _header.xBrickDim_;
numBricks_ = _header.xNumBricks_;
paddedBrickDim_ = brickDim_ + paddingWidth_ * 2;
atlasDim_ = paddedBrickDim_*numBricks_;
LDEBUG("Padded brick dim: " << paddedBrickDim_);
LDEBUG("Atlas dim: " << atlasDim_);
LDEBUG(fmt::format("Padded brick dim: {}", paddedBrickDim_));
LDEBUG(fmt::format("Atlas dim: {}", atlasDim_));
numBrickVals_ = paddedBrickDim_*paddedBrickDim_*paddedBrickDim_;
// Number of bricks per frame
@@ -92,11 +102,11 @@ bool BrickManager::readHeader() {
unsigned int numOTNodes = static_cast<unsigned int>((pow(8, numOTLevels) - 1) / 7);
unsigned int numBSTNodes = static_cast<unsigned int>(_header.numTimesteps_ * 2 - 1);
numBricksTree_ = numOTNodes * numBSTNodes;
LDEBUG("Num OT levels: " << numOTLevels);
LDEBUG("Num OT nodes: " << numOTNodes);
LDEBUG("Num BST nodes: " << numBSTNodes);
LDEBUG("Num bricks in tree: " << numBricksTree_);
LDEBUG("Num values per brick: " << numBrickVals_);
LDEBUG(fmt::format("Num OT levels: {}", numOTLevels));
LDEBUG(fmt::format("Num OT nodes: {}", numOTNodes));
LDEBUG(fmt::format("Num BST nodes: {}", numBSTNodes));
LDEBUG(fmt::format("Num bricks in tree: {}", numBricksTree_));
LDEBUG(fmt::format("Num values per brick: {}", numBrickVals_));
brickSize_ = sizeof(float)*numBrickVals_;
volumeSize_ = brickSize_*numBricksFrame_;
@@ -110,8 +120,8 @@ bool BrickManager::readHeader() {
if (fileSize != calcFileSize) {
LERROR("Sizes don't match");
LERROR("calculated file size: " << calcFileSize);
LERROR("file size: " << fileSize);
LERROR(fmt::format("Calculated file size: {}", calcFileSize));
LERROR(fmt::format("File size: {}", fileSize));
return false;
}
@@ -33,6 +33,7 @@
#include <openspace/util/progressbar.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "ErrorHistogramManager";
@@ -62,7 +63,7 @@ bool ErrorHistogramManager::buildHistograms(int numBins) {
_numInnerNodes = _tsp->numTotalNodes() - numOtLeaves * numBstLeaves;
_histograms = std::vector<Histogram>(_numInnerNodes);
LINFO("Build " << _numInnerNodes << " histograms with " << numBins << " bins each");
LINFO(fmt::format("Build {} histograms with {} bins each", _numInnerNodes, numBins));
// All TSP Leaves
int numOtNodes = _tsp->numOTNodes();
@@ -33,6 +33,7 @@
#include <openspace/util/progressbar.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "LocalErrorHistogramManager";
@@ -45,7 +46,7 @@ LocalErrorHistogramManager::LocalErrorHistogramManager(TSP* tsp) : _tsp(tsp) {}
LocalErrorHistogramManager::~LocalErrorHistogramManager() {}
bool LocalErrorHistogramManager::buildHistograms(int numBins) {
LINFO("Build histograms with " << numBins << " bins each");
LINFO(fmt::format("Build histograms with {} bins each", numBins));
_numBins = numBins;
_file = &(_tsp->file());
@@ -133,7 +134,12 @@ bool LocalErrorHistogramManager::buildFromOctreeChild(unsigned int bstOffset, un
if (it != _voxelCache.end()) {
childValues = it->second;
} else {
LERROR("Child " << childIndex << " visited without cache, " << bstOffset << ", " << octreeOffset);
LERROR(fmt::format(
"Child {} visited without cache, {}, {}",
childIndex,
bstOffset,
octreeOffset
));
return false;
}
}
@@ -147,7 +153,7 @@ bool LocalErrorHistogramManager::buildFromOctreeChild(unsigned int bstOffset, un
if (it != _voxelCache.end()) {
parentValues = it->second;
} else {
LERROR("Parent " << parentIndex << " visited without cache");
LERROR(fmt::format("Parent {} visited without cache", parentIndex));
return false;
}
}
@@ -218,7 +224,7 @@ bool LocalErrorHistogramManager::buildFromBstChild(unsigned int bstOffset, unsig
if (it != _voxelCache.end()) {
childValues = it->second;
} else {
LERROR("Child " << childIndex << " visited without cache");
LERROR(fmt::format("Child {} visited without cache", childIndex));
return false;
}
}
@@ -232,7 +238,7 @@ bool LocalErrorHistogramManager::buildFromBstChild(unsigned int bstOffset, unsig
if (it != _voxelCache.end()) {
parentValues = it->second;
} else {
LERROR("Parent " << parentIndex << " visited without cache");
LERROR(fmt::format("Parent {} visited without cache", parentIndex));
return false;
}
}
@@ -194,7 +194,11 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic
_filename = "";
bool success = dictionary.getValue(KeyDataSource, _filename);
if (!success) {
LERROR("Node '" << name << "' did not contain a valid '" << KeyDataSource << "'");
LERROR(fmt::format(
"Node '{}' did not contain a valid '{}'",
name,
KeyDataSource
));
return;
}
_filename = absPath(_filename);
@@ -241,7 +245,11 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic
_loop = false;
} else {
_loop = true;
LWARNING("Node " << name << " does not provide valid time information. Viewing one image per frame.");
LWARNING(fmt::format(
"Node '{}' does not provide valid time information. Viewing one image per "
"frame.",
name
));
}
@@ -249,8 +257,11 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic
_transferFunctionPath = "";
success = dictionary.getValue(KeyTransferFunction, _transferFunctionPath);
if (!success) {
LERROR("Node '" << name << "' did not contain a valid '" <<
KeyTransferFunction << "'");
LERROR(fmt::format(
"Node '{}' did not contain a valid '{}'",
name,
KeyTransferFunction
));
return;
}
_transferFunctionPath = absPath(_transferFunctionPath);
@@ -505,18 +516,24 @@ bool RenderableMultiresVolume::initializeSelector() {
if (cacheFile.is_open()) {
// Read histograms from cache.
cacheFile.close();
LINFO("Loading histograms from cache: " << cacheFilename);
LINFO(fmt::format(
"Loading histograms from cache: {}",
cacheFilename
));
success &= _errorHistogramManager->loadFromFile(cacheFilename);
} else if (_errorHistogramsPath != "") {
// Read histograms from scene data.
LINFO("Loading histograms from scene data: " << _errorHistogramsPath);
LINFO(fmt::format(
"Loading histograms from scene data: {}",
_errorHistogramsPath
));
success &= _errorHistogramManager->loadFromFile(_errorHistogramsPath);
} else {
// Build histograms from tsp file.
LWARNING("Failed to open " << cacheFilename);
LWARNING(fmt::format("Failed to open {}", cacheFilename));
success &= _errorHistogramManager->buildHistograms(nHistograms);
if (success) {
LINFO("Writing cache to " << cacheFilename);
LINFO(fmt::format("Writing cache to {}", cacheFilename));
_errorHistogramManager->saveToFile(cacheFilename);
}
}
@@ -536,17 +553,17 @@ bool RenderableMultiresVolume::initializeSelector() {
if (cacheFile.is_open()) {
// Read histograms from cache.
cacheFile.close();
LINFO("Loading histograms from " << cacheFilename);
LINFO(fmt::format("Loading histograms from {}", cacheFilename));
success &= _histogramManager->loadFromFile(cacheFilename);
} else {
// Build histograms from tsp file.
LWARNING("Failed to open " << cacheFilename);
LWARNING(fmt::format("Failed to open '{}'", cacheFilename));
success &= _histogramManager->buildHistograms(
_tsp.get(),
nHistograms
);
if (success) {
LINFO("Writing cache to " << cacheFilename);
LINFO(fmt::format("Writing cache to {}", cacheFilename));
_histogramManager->saveToFile(cacheFilename);
}
}
@@ -566,14 +583,14 @@ bool RenderableMultiresVolume::initializeSelector() {
if (cacheFile.is_open()) {
// Read histograms from cache.
cacheFile.close();
LINFO("Loading histograms from " << cacheFilename);
LINFO(fmt::format("Loading histograms from {}", cacheFilename));
success &= _localErrorHistogramManager->loadFromFile(cacheFilename);
} else {
// Build histograms from tsp file.
LWARNING("Failed to open " << cacheFilename);
LWARNING(fmt::format("Failed to open {}", cacheFilename));
success &= _localErrorHistogramManager->buildHistograms(nHistograms);
if (success) {
LINFO("Writing cache to " << cacheFilename);
LINFO(fmt::format("Writing cache to {}", cacheFilename));
_localErrorHistogramManager->saveToFile(cacheFilename);
}
}
+36 -28
View File
@@ -24,12 +24,14 @@
#include <modules/multiresvolume/rendering/tsp.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/glm.h>
#include <algorithm>
#include <ghoul/fmt.h>
#include <math.h>
#include <queue>
@@ -119,9 +121,19 @@ bool TSP::readHeader() {
file.read(reinterpret_cast<char*>(&zNumBricks_), sizeof(unsigned int));
*/
LDEBUG("Grid type: " << _header.gridType_);
LDEBUG("Brick dimensions: " << _header.xBrickDim_ << " " << _header.yBrickDim_ << " " << _header.zBrickDim_);
LDEBUG("Num bricks: " << _header.xNumBricks_ << " " << _header.yNumBricks_ << " " << _header.zNumBricks_);
LDEBUG(fmt::format("Grid type: {}", _header.gridType_));
LDEBUG(fmt::format(
"Brick dimensions: {} {} {}",
_header.xBrickDim_,
_header.yBrickDim_,
_header.zBrickDim_
));
LDEBUG(fmt::format(
"Num bricks: {} {} {}",
_header.xNumBricks_,
_header.yNumBricks_,
_header.zNumBricks_
));
paddedBrickDim_ = _header.xBrickDim_ + 2 * paddingWidth_;
// TODO support dimensions of different size
@@ -131,21 +143,20 @@ bool TSP::readHeader() {
numBSTNodes_ = static_cast<unsigned int>(_header.numTimesteps_ * 2 - 1);
numTotalNodes_ = numOTNodes_ * numBSTNodes_;
LDEBUG("Num OT levels: " << numOTLevels_);
LDEBUG("Num OT nodes: " << numOTNodes_);
LDEBUG("Num BST levels: " << numBSTLevels_);
LDEBUG("Num BST nodes: " << numBSTNodes_);
LDEBUG("NUm total nodes: " << numTotalNodes_);
LDEBUG(fmt::format("Num OT levels: {}", numOTLevels_));
LDEBUG(fmt::format("Num OT nodes: {}", numOTNodes_));
LDEBUG(fmt::format("Num BST levels: {}", numBSTLevels_));
LDEBUG(fmt::format("Num BST nodes: {}", numBSTNodes_));
LDEBUG(fmt::format("Num total nodes: {}", numTotalNodes_));
// Allocate space for TSP structure
data_.resize(numTotalNodes_*NUM_DATA);
LDEBUG("data size: " << data_.size());
LDEBUG(fmt::format("Data size: {}", data_.size()));
return true;
}
bool TSP::construct() {
LDEBUG("Constructing TSP tree");
// Loop over the OTs (one per BST node)
@@ -412,9 +423,9 @@ bool TSP::calculateSpatialError() {
maxSpatialError_ = maxNorm;
medianSpatialError_ = medNorm;
LDEBUG("Min normalized spatial std dev: " << minNorm);
LDEBUG("Max normalized spatial std dev: " << maxNorm);
LDEBUG("Median normalized spatial std dev: " << medNorm);
LDEBUG(fmt::format("Min normalized spatial std dev: {}", minNorm));
LDEBUG(fmt::format("Max normalized spatial std dev: {}", maxNorm));
LDEBUG(fmt::format("Median normalized spatial std dev: {}", medNorm));
return true;
}
@@ -537,16 +548,14 @@ bool TSP::calculateTemporalError() {
maxTemporalError_ = maxNorm;
medianTemporalError_ = medNorm;
LDEBUG("Min normalized temporal std dev: " << minNorm);
LDEBUG("Max normalized temporal std dev: " << maxNorm);
LDEBUG("Median normalized temporal std dev: " << medNorm);
LDEBUG(fmt::format("Min normalized temporal std dev: {}", minNorm));
LDEBUG(fmt::format("Max normalized temporal std dev: {}", maxNorm));
LDEBUG(fmt::format("Median normalized temporal std dev: {}", medNorm));
return true;
}
bool TSP::readCache() {
if (!FileSys.cacheManager())
return false;
@@ -556,7 +565,7 @@ bool TSP::readCache() {
std::ifstream file(cacheFilename, std::ios::in | std::ios::binary);
if (!file.is_open()) {
LWARNING("Failed to open " << cacheFilename);
LWARNING(fmt::format("Failed to open {}", cacheFilename));
return false;
}
@@ -572,18 +581,17 @@ bool TSP::readCache() {
file.close();
LDEBUG("Cached errors:");
LDEBUG("Min spatial error: " << minSpatialError_);
LDEBUG("Max spatial error: " << maxSpatialError_);
LDEBUG("Median spatial error: " << medianSpatialError_);
LDEBUG("Min temporal error: " << minTemporalError_);
LDEBUG("Max temporal error: " << maxTemporalError_);
LDEBUG("Median temporal error: " << medianTemporalError_);
LDEBUG(fmt::format("Min spatial error: {}", minSpatialError_));
LDEBUG(fmt::format("Max spatial error: {}", maxSpatialError_));
LDEBUG(fmt::format("Median spatial error: {}", medianSpatialError_));
LDEBUG(fmt::format("Min temporal error: {}", minTemporalError_));
LDEBUG(fmt::format("Max temporal error: {}", maxTemporalError_));
LDEBUG(fmt::format("Median temporal error: {}", medianTemporalError_));
return true;
}
bool TSP::writeCache() {
if (!FileSys.cacheManager())
return false;
@@ -593,10 +601,10 @@ bool TSP::writeCache() {
std::ofstream file(cacheFilename, std::ios::out | std::ios::binary);
if (!file.is_open()) {
LWARNING("Failed to open " << cacheFilename);
LWARNING(fmt::format("Failed to open {}", cacheFilename));
return false;
}
LINFO("Writing cache to " << cacheFilename);
LINFO(fmt::format("Writing cache to {}", cacheFilename));
file.write(reinterpret_cast<char*>(&minSpatialError_), sizeof(float));
@@ -179,7 +179,7 @@ RenderableConstellationBounds::RenderableConstellationBounds(
// The user has specified a constellation name that doesn't exist
LWARNINGC(
"RenderableConstellationBounds",
"Option '" << s << "' not found in list of constellations"
fmt::format("Option '{}' not found in list of constellations", s)
);
}
else {
@@ -202,7 +202,6 @@ void RenderableConstellationBounds::initializeGL() {
absPath("${MODULE_SPACE}/shaders/constellationbounds_fs.glsl")
);
glGenVertexArrays(1, &_vao);
glBindVertexArray(_vao);
@@ -311,7 +310,11 @@ bool RenderableConstellationBounds::loadVertexFile() {
// means that the line was incomplete, so there was an error
LERRORC(
"RenderableConstellationBounds",
"Error reading file '" << fileName << "' at line #" << currentLineNumber
fmt::format(
"Error reading file '{}' at line #{}",
fileName,
currentLineNumber
)
);
break;
}
@@ -393,7 +396,7 @@ bool RenderableConstellationBounds::loadConstellationFile() {
if (it == _constellationBounds.end()) {
LERRORC(
"RenderableConstellationBounds",
"Could not find constellation '" << abbreviation << "' in list"
fmt::format("Could not find constellation '{}' in list", abbreviation)
);
return false;
}
+24 -12
View File
@@ -278,11 +278,12 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
sourceArray.emplace_back(sourceName, sourceRadius);
}
else {
LWARNING(
"No Radius value expecified for Shadow Source Name "
<< sourceName << " from " << name
<< " planet.\nDisabling shadows for this planet."
);
LWARNING(fmt::format(
"No Radius value specified for Shadow Source Name '{}' from "
"'{}' planet. Disabling shadows for this planet",
sourceName,
name
));
disableShadows = true;
break;
}
@@ -306,9 +307,12 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
casterArray.emplace_back(casterName, casterRadius);
}
else {
LWARNING("No Radius value expecified for Shadow Caster Name "
<< casterName << " from " << name
<< " planet.\nDisabling shadows for this planet.");
LWARNING(fmt::format(
"No Radius value expecified for Shadow Caster Name '{}' from "
"'{}' planet. Disabling shadows for this planet.",
casterName,
name
));
disableShadows = true;
break;
}
@@ -626,7 +630,7 @@ void RenderablePlanet::loadTexture() {
_texture->setSwizzleMask({ GL_RED, GL_RED, GL_RED, GL_RED });
}
LDEBUG("Loaded texture from '" << _colorTexturePath << "'");
LDEBUG(fmt::format("Loaded texture from '{}'", _colorTexturePath.value()));
_texture->uploadTexture();
// Textures of planets looks much smoother with AnisotropicMipMap rather than
@@ -644,9 +648,14 @@ void RenderablePlanet::loadTexture() {
absPath(_nightTexturePath)
);
if (_nightTexture) {
LDEBUG("Loaded texture from '" << _nightTexturePath << "'");
LDEBUG(fmt::format(
"Loaded texture from '{}'",
_nightTexturePath.value()
));
_nightTexture->uploadTexture();
_nightTexture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap);
_nightTexture->setFilter(
ghoul::opengl::Texture::FilterMode::LinearMipMap
);
//_nightTexture->setFilter(
// ghoul::opengl::Texture::FilterMode::AnisotropicMipMap
//);
@@ -661,7 +670,10 @@ void RenderablePlanet::loadTexture() {
absPath(_heightMapTexturePath)
);
if (_heightMapTexture) {
LDEBUG("Loaded texture from '" << _heightMapTexturePath << "'");
LDEBUG(fmt::format(
"Loaded texture from '{}'",
_heightMapTexturePath.value()
));
_heightMapTexture->uploadTexture();
_heightMapTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
//_nightTexture->setFilter(
+2 -2
View File
@@ -31,7 +31,7 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scene/scene.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
@@ -295,7 +295,7 @@ void RenderableRings::loadTexture() {
if (texture) {
LDEBUGC(
"RenderableRings",
"Loaded texture from '" << absPath(_texturePath) << "'"
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
);
_texture = std::move(texture);
+20 -13
View File
@@ -30,7 +30,8 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -381,11 +382,9 @@ void RenderableStars::update(const UpdateData&) {
if (_vao == 0) {
glGenVertexArrays(1, &_vao);
LDEBUG("Generating Vertex Array id '" << _vao << "'");
}
if (_vbo == 0) {
glGenBuffers(1, &_vbo);
LDEBUG("Generating Vertex Buffer Object id '" << _vbo << "'");
}
glBindVertexArray(_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
@@ -506,9 +505,10 @@ void RenderableStars::update(const UpdateData&) {
);
if (_pointSpreadFunctionTexture) {
LDEBUG("Loaded texture from '" <<
absPath(_pointSpreadFunctionTexturePath) << "'"
);
LDEBUG(fmt::format(
"Loaded texture from '{}'",
absPath(_pointSpreadFunctionTexturePath)
));
_pointSpreadFunctionTexture->uploadTexture();
}
_pointSpreadFunctionTexture->setFilter(
@@ -535,7 +535,10 @@ void RenderableStars::update(const UpdateData&) {
absPath(_colorTexturePath)
);
if (_colorTexture) {
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
LDEBUG(fmt::format(
"Loaded texture from '{}'",
absPath(_colorTexturePath)
));
_colorTexture->uploadTexture();
}
@@ -574,7 +577,11 @@ bool RenderableStars::loadData() {
bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO("Cached file '" << cachedFile << "' used for Speck file '" << _file << "'");
LINFO(fmt::format(
"Cached file '{}' used for Speck file '{}'",
cachedFile,
_file
));
bool success = loadCachedFile(cachedFile);
if (success) {
@@ -587,9 +594,9 @@ bool RenderableStars::loadData() {
}
}
else {
LINFO("Cache for Speck file '" << _file << "' not found");
LINFO(fmt::format("Cache for Speck file '{}' not found", _file));
}
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
bool success = readSpeckFile();
if (!success) {
@@ -606,7 +613,7 @@ bool RenderableStars::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -699,7 +706,7 @@ bool RenderableStars::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format("Error opening file '{}' for loading cache file", file));
return false;
}
}
@@ -727,7 +734,7 @@ bool RenderableStars::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}
@@ -29,7 +29,7 @@
#include <openspace/util/spicemanager.h>
#include <openspace/util/time.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
namespace {
@@ -25,6 +25,7 @@
#include <modules/space/translation/tletranslation.h>
#include <openspace/documentation/verifier.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/assert.h>
@@ -35,6 +35,7 @@
#include <openspace/util/timeconversion.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -384,7 +384,10 @@ void RenderableFov::initializeGL() {
}
const size_t sizeAfter = res.bounds.size();
LINFOC(_instrument.name, "Simplified from " << sizeBefore << " to " << sizeAfter);
LINFOC(
_instrument.name,
fmt::format("Simplified from {} to {}", sizeBefore, sizeAfter)
);
}
@@ -547,7 +547,7 @@ bool RenderableModelProjection::loadTextures() {
absPath(_colorTexturePath)
);
if (_baseTexture) {
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
LDEBUG(fmt::format("Loaded texture from '{}'", absPath(_colorTexturePath)));
_baseTexture->uploadTexture();
_baseTexture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap);
}
@@ -34,7 +34,7 @@
#include <openspace/util/spicemanager.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
@@ -31,6 +31,7 @@
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <fstream>
@@ -23,6 +23,7 @@
****************************************************************************************/
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/filesystem/directory.h>
#include <openspace/util/time.h>
@@ -40,6 +41,7 @@
#include <ghoul/misc/dictionary.h>
#include <ghoul/fmt.h>
#include <map>
#include <string>
#include <vector>
@@ -97,7 +99,7 @@ bool InstrumentTimesParser::create() {
using RawPath = ghoul::filesystem::Directory::RawPath;
ghoul::filesystem::Directory sequenceDir(_fileName, RawPath::Yes);
if (!FileSys.directoryExists(sequenceDir)) {
LERROR("Could not load Label Directory '" << sequenceDir.path() << "'");
LERROR(fmt::format("Could not load Label Directory '{}'", sequenceDir.path()));
return false;
}
@@ -110,7 +112,7 @@ bool InstrumentTimesParser::create() {
);
if (!FileSys.fileExists(filepath)) {
LERROR("Unable to read file " << filepath << ". Skipping file.");
LERROR(fmt::format("Unable to read file '{}'. Skipping file", filepath));
continue;
}
@@ -30,11 +30,13 @@
#include <openspace/util/time.h>
#include <ghoul/filesystem/directory.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/fmt.h>
#include <fstream>
#include <iterator>
#include <iomanip>
@@ -159,7 +161,7 @@ bool LabelParser::create() {
using RawPath = ghoul::filesystem::Directory::RawPath;
ghoul::filesystem::Directory sequenceDir(_fileName, RawPath::Yes);
if (!FileSys.directoryExists(sequenceDir)) {
LERROR("Could not load Label Directory '" << sequenceDir.path() << "'");
LERROR(fmt::format("Could not load Label Directory '{}'", sequenceDir.path()));
return false;
}
using Recursive = ghoul::filesystem::Directory::Recursive;
@@ -173,10 +175,10 @@ bool LabelParser::create() {
if (extension == "lbl" || extension == "LBL") { // discovered header file
std::ifstream file(currentFile.path());
if (!file.good()){
LERROR(
"Failed to open label file '" << currentFile.path() << "'"
);
if (!file.good()) {
LERROR(fmt::format(
"Failed to open label file '{}'", currentFile.path()
));
return false;
}
@@ -482,7 +482,7 @@ void ProjectionComponent::imageProjectBegin() {
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO);
if (_textureSizeDirty) {
LDEBUG("Changing texture size to " << std::to_string(_textureSize));
LDEBUG(fmt::format("Changing texture size to {}", std::to_string(_textureSize)));
// If the texture size has changed, we have to allocate new memory and copy
// the image texture to the new target
@@ -513,10 +513,11 @@ void ProjectionComponent::imageProjectBegin() {
GLenum status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
if (!FramebufferObject::errorChecking(status).empty()) {
LERROR(
"Read Buffer (" << msg << "): " <<
LERROR(fmt::format(
"Read Buffer ({}): {}",
msg,
FramebufferObject::errorChecking(status)
);
));
}
glFramebufferTexture(
@@ -528,10 +529,11 @@ void ProjectionComponent::imageProjectBegin() {
status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
if (!FramebufferObject::errorChecking(status).empty()) {
LERROR(
"Draw Buffer (" << msg << "): " <<
LERROR(fmt::format(
"Draw Buffer ({}): {}",
msg,
FramebufferObject::errorChecking(status)
);
));
}
glBlitFramebuffer(
@@ -554,10 +556,11 @@ void ProjectionComponent::imageProjectBegin() {
GLenum status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
if (!FramebufferObject::errorChecking(status).empty()) {
LERROR(
"Read Buffer (" << msg << "): " <<
LERROR(fmt::format(
"Read Buffer ({}): {}",
msg,
FramebufferObject::errorChecking(status)
);
));
}
glFramebufferTexture(
@@ -569,10 +572,11 @@ void ProjectionComponent::imageProjectBegin() {
status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
if (!FramebufferObject::errorChecking(status).empty()) {
LERROR(
"Draw Buffer (" << msg << "): " <<
LERROR(fmt::format(
"Draw Buffer ({}): {}",
msg,
FramebufferObject::errorChecking(status)
);
));
}
glBlitFramebuffer(
@@ -985,9 +989,8 @@ std::shared_ptr<ghoul::opengl::Texture> ProjectionComponent::loadProjectionTextu
}
bool ProjectionComponent::generateProjectionLayerTexture(const ivec2& size) {
LINFO(
"Creating projection texture of size '" << size.x << ", " << size.y << "'"
);
LINFO(fmt::format("Creating projection texture of size '{}, {}'", size.x, size.y));
using namespace ghoul::opengl;
_projectionTexture = std::make_unique<Texture>(
glm::uvec3(size, 1),
@@ -1033,9 +1036,7 @@ bool ProjectionComponent::generateProjectionLayerTexture(const ivec2& size) {
}
bool ProjectionComponent::generateDepthTexture(const ivec2& size) {
LINFO(
"Creating depth texture of size '" << size.x << ", " << size.y << "'"
);
LINFO(fmt::format("Creating depth texture of size '{}, {}'", size.x, size.y));
_shadowing.texture = std::make_unique<ghoul::opengl::Texture>(
glm::uvec3(size, 1),
+7 -5
View File
@@ -29,12 +29,14 @@
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/defer.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace {
constexpr const char* LoggerCat = "ScreenSpaceSpout";
const char* KeyName = "Name";
static const openspace::properties::Property::PropertyInfo NameInfo = {
@@ -204,8 +206,8 @@ void RenderablePlaneSpout::update(const UpdateData& data) {
if (!createSuccess) {
LWARNINGC(
"ScreenSpaceSpout",
"Could not create receiver for " << _currentSenderName
LoggerCat,
fmt::format("Could not create receiver for {}", _currentSenderName)
);
return;
}
@@ -222,8 +224,8 @@ void RenderablePlaneSpout::update(const UpdateData& data) {
if (!receiveSuccess && !_isErrorMessageDisplayed) {
LWARNINGC(
"ScreenSpaceSpout",
"Could not receive texture for " << _currentSenderName
LoggerCat,
fmt::format("Could not receive texture for {}", _currentSenderName)
);
_isErrorMessageDisplayed = true;
}
+2 -2
View File
@@ -206,7 +206,7 @@ void ScreenSpaceSpout::update() {
if (!createSuccess) {
LWARNINGC(
"ScreenSpaceSpout",
"Could not create receiver for " << _currentSenderName
fmt::format("Could not create receiver for {}", _currentSenderName)
);
return;
}
@@ -224,7 +224,7 @@ void ScreenSpaceSpout::update() {
if (!receiveSuccess && !_isErrorMessageDisplayed) {
LWARNINGC(
"ScreenSpaceSpout",
"Could not receive texture for " << _currentSenderName
fmt::format("Could not receive texture for {}", _currentSenderName)
);
_isErrorMessageDisplayed = true;
}
@@ -32,6 +32,7 @@
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <fstream>
+2 -2
View File
@@ -139,10 +139,10 @@ void SyncAssetTask::RequestListener::assetStateChanged(std::shared_ptr<Asset> as
Asset::State state)
{
if (state == Asset::State::LoadingFailed) {
LERROR("Failed to load asset " << asset->id());
LERROR(fmt::format("Failed to load asset: {}", asset->id()));
}
if (state == Asset::State::SyncRejected) {
LERROR("Failed to sync asset " << asset->id());
LERROR(fmt::format("Failed to sync asset: {}", asset->id()));
}
}
+6 -4
View File
@@ -46,6 +46,8 @@
#pragma warning (pop)
#endif // _MSC_VER
#include <ghoul/fmt.h>
#endif // SYNC_USE_LIBTORRENT
namespace {
@@ -189,11 +191,11 @@ TorrentClient::TorrentId TorrentClient::addTorrentFile(const std::string& torren
p.save_path = destination;
p.ti = std::make_shared<libtorrent::torrent_info>(torrentFile, ec);
if (ec) {
LERROR(torrentFile << ": " << ec.message());
LERROR(fmt::format("{}: {}", torrentFile, ec.message()));
}
libtorrent::torrent_handle h = _session.add_torrent(p, ec);
if (ec) {
LERROR(torrentFile << ": " << ec.message());
LERROR(fmt::format("{}: {}", torrentFile, ec.message()));
}
TorrentId id = h.id();
@@ -219,13 +221,13 @@ TorrentClient::TorrentId TorrentClient::addMagnetLink(const std::string& magnetL
libtorrent::error_code ec;
libtorrent::add_torrent_params p = libtorrent::parse_magnet_uri(magnetLink, ec);
if (ec) {
LERROR(magnetLink << ": " << ec.message());
LERROR(fmt::format("{}: {}", magnetLink, ec.message()));
}
p.save_path = destination;
p.storage_mode = libtorrent::storage_mode_allocate;
libtorrent::torrent_handle h = _session.add_torrent(p, ec);
if (ec) {
LERROR(magnetLink << ": " << ec.message());
LERROR(fmt::format("{}: {}", magnetLink, ec.message()));
}
TorrentId id = h.id();
+14 -13
View File
@@ -46,6 +46,7 @@
#endif
#include <cmath>
#include <ghoul/fmt.h>
#include <functional>
#include <fstream>
@@ -256,18 +257,18 @@ TouchInteraction::TouchInteraction()
_origin.onChange([this]() {
SceneGraphNode* node = sceneGraphNode(_origin.value());
if (!node) {
LWARNING(
"Could not find a node in scenegraph called '" << _origin.value() << "'"
);
return;
if (node) {
setFocusNode(node);
}
else {
LWARNING(fmt::format(
"Could not find a node in scenegraph called '{}'", _origin.value()
));
}
setFocusNode(node);
});
levmarq_init(&_lmstat);
_time.initSession();
}
@@ -319,12 +320,12 @@ bool TouchInteraction::guiMode(const std::vector<TuioCursor>& list) {
_guiON = !_guiON;
module.gui.setEnabled(_guiON);
std::string mode = (_guiON) ? "" : "de";
LINFO(
"GUI mode is " << mode << "activated. Inside box by: (" <<
static_cast<int>(100 * (pos.x / _guiButton.value().x)) << "%, " <<
static_cast<int>(100 * (pos.y / _guiButton.value().y)) << "%)\n"
);
LINFO(fmt::format(
"GUI mode is {}. Inside box by: ({}%, {}%)",
_guiON ? "activated" : "deactivated",
static_cast<int>(100 * (pos.x / _guiButton.value().x)),
static_cast<int>(100 * (pos.y / _guiButton.value().y))
));
}
else if (_guiON) {
module.touchInput = { _guiON, pos, 1 }; // emulate touch input as a mouse
-1
View File
@@ -25,7 +25,6 @@
#include <modules/touch/include/tuioear.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/settingsengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/interaction/navigationhandler.h>
#include <openspace/rendering/renderengine.h>
-1
View File
@@ -25,7 +25,6 @@
#include <modules/touch/touchmodule.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/settingsengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/interaction/navigationhandler.h>
#include <openspace/rendering/renderengine.h>
@@ -23,9 +23,9 @@
****************************************************************************************/
#include <modules/volume/rendering/renderabletimevaryingvolume.h>
#include <modules/volume/rawvolumereader.h>
#include <modules/volume/rawvolume.h>
#include <openspace/rendering/renderable.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
@@ -34,13 +34,12 @@
#include <openspace/documentation/verifier.h>
#include <openspace/util/timemanager.h>
#include <openspace/util/time.h>
#include <ghoul/glm.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
#include <glm/gtc/matrix_transform.hpp>
namespace {
@@ -222,7 +221,7 @@ void RenderableTimeVaryingVolume::initializeGL() {
ghoul::filesystem::Directory sequenceDir(_sourceDirectory, RawPath::Yes);
if (!FileSys.directoryExists(sequenceDir)) {
LERROR("Could not load sequence directory '" << sequenceDir.path() << "'");
LERROR(fmt::format("Could not load sequence directory '{}'", sequenceDir.path()));
return;
}
@@ -340,16 +339,11 @@ void RenderableTimeVaryingVolume::initializeGL() {
void RenderableTimeVaryingVolume::loadTimestepMetadata(const std::string& path) {
ghoul::Dictionary dictionary = ghoul::lua::loadDictionaryFromFile(path);
try {
documentation::testSpecificationAndThrow(
TimestepDocumentation(),
dictionary,
"TimeVaryingVolumeTimestep"
);
} catch (const documentation::SpecificationError& e) {
LERROR(e.message << e.component);
return;
}
documentation::testSpecificationAndThrow(
TimestepDocumentation(),
dictionary,
"TimeVaryingVolumeTimestep"
);
Timestep t;
t.baseName = ghoul::filesystem::File(path).baseName();