mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-13 06:49:05 -05:00
Remove fmt::format and replace with std::format
This commit is contained in:
@@ -181,7 +181,7 @@ RenderableInterpolatedPoints::Interpolation::Interpolation()
|
||||
addProperty(value);
|
||||
|
||||
auto triggerInterpolation = [](std::string_view identifier, float v, float d) {
|
||||
std::string script = fmt::format(
|
||||
std::string script = std::format(
|
||||
"openspace.setPropertyValueSingle(\"{}\", {}, {})",
|
||||
identifier, v, d
|
||||
);
|
||||
@@ -275,7 +275,7 @@ RenderableInterpolatedPoints::RenderableInterpolatedPoints(
|
||||
// corresponded to
|
||||
|
||||
if (_nDataPoints % nObjects != 0) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"Mismatch between provided number of data entries and the specified number "
|
||||
"of points. Expected the number of entries in the data file '{}' to be "
|
||||
"evenly divisible by the number of points", _dataFile
|
||||
@@ -445,11 +445,11 @@ void RenderableInterpolatedPoints::addColorAndSizeDataForPoint(unsigned int inde
|
||||
void RenderableInterpolatedPoints::initializeBufferData() {
|
||||
if (_vao == 0) {
|
||||
glGenVertexArrays(1, &_vao);
|
||||
LDEBUG(fmt::format("Generating Vertex Array id '{}'", _vao));
|
||||
LDEBUG(std::format("Generating Vertex Array id '{}'", _vao));
|
||||
}
|
||||
if (_vbo == 0) {
|
||||
glGenBuffers(1, &_vbo);
|
||||
LDEBUG(fmt::format("Generating Vertex Buffer Object id '{}'", _vbo));
|
||||
LDEBUG(std::format("Generating Vertex Buffer Object id '{}'", _vbo));
|
||||
}
|
||||
|
||||
const int attibutesPerPoint = nAttributesPerPoint();
|
||||
|
||||
@@ -635,7 +635,7 @@ RenderablePointCloud::RenderablePointCloud(const ghoul::Dictionary& dictionary)
|
||||
_texturesDirectory = absPath(*t.folder).string();
|
||||
|
||||
if (t.file.has_value()) {
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Both a single texture File and multi-texture Folder was provided. "
|
||||
"The folder '{}' has priority and the single texture with the "
|
||||
"following path will be ignored: '{}'", *t.folder, *t.file
|
||||
@@ -842,7 +842,7 @@ void RenderablePointCloud::initializeSingleTexture() {
|
||||
std::filesystem::path p = absPath(_texture.spriteTexturePath);
|
||||
|
||||
if (!std::filesystem::is_regular_file(p)) {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
throw ghoul::RuntimeError(std::format(
|
||||
"Could not find image file '{}'", p
|
||||
));
|
||||
}
|
||||
@@ -856,7 +856,7 @@ void RenderablePointCloud::initializeMultiTextures() {
|
||||
std::filesystem::path path = _texturesDirectory / tex.file;
|
||||
|
||||
if (!std::filesystem::is_regular_file(path)) {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
throw ghoul::RuntimeError(std::format(
|
||||
"Could not find image file '{}'", path
|
||||
));
|
||||
}
|
||||
@@ -899,14 +899,14 @@ void RenderablePointCloud::loadTexture(const std::filesystem::path& path, int in
|
||||
bool useAlpha = (t->numberOfChannels() > 3) && _texture.useAlphaChannel;
|
||||
|
||||
if (t) {
|
||||
LINFOC("RenderablePlanesCloud", fmt::format("Loaded texture {}", path));
|
||||
LINFOC("RenderablePlanesCloud", std::format("Loaded texture {}", path));
|
||||
// Do not upload the loaded texture to the GPU, we just want it to hold the data.
|
||||
// However, convert textures make sure they all use the same format
|
||||
ghoul::opengl::Texture::Format targetFormat = glFormat(useAlpha);
|
||||
convertTextureFormat(*t, targetFormat);
|
||||
}
|
||||
else {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
throw ghoul::RuntimeError(std::format(
|
||||
"Could not find image file {}", path
|
||||
));
|
||||
}
|
||||
@@ -1024,7 +1024,7 @@ void RenderablePointCloud::generateArrayTextures() {
|
||||
int nMaxTextureLayers = 0;
|
||||
glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &nMaxTextureLayers);
|
||||
if (static_cast<int>(layer) > nMaxTextureLayers) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"Too many layers bound in the same texture array. Found {} textures with "
|
||||
"resolution {}x{} pixels. Max supported is {}.",
|
||||
layer, res.x, res.y, nMaxTextureLayers
|
||||
@@ -1333,11 +1333,11 @@ void RenderablePointCloud::updateBufferData() {
|
||||
|
||||
if (_vao == 0) {
|
||||
glGenVertexArrays(1, &_vao);
|
||||
LDEBUG(fmt::format("Generating Vertex Array id '{}'", _vao));
|
||||
LDEBUG(std::format("Generating Vertex Array id '{}'", _vao));
|
||||
}
|
||||
if (_vbo == 0) {
|
||||
glGenBuffers(1, &_vbo);
|
||||
LDEBUG(fmt::format("Generating Vertex Buffer Object id '{}'", _vbo));
|
||||
LDEBUG(std::format("Generating Vertex Buffer Object id '{}'", _vbo));
|
||||
}
|
||||
|
||||
glBindVertexArray(_vao);
|
||||
|
||||
@@ -119,7 +119,7 @@ SizeMappingComponent::SizeMappingComponent(const ghoul::Dictionary& dictionary)
|
||||
parameterOption = indexOfProvidedOption;
|
||||
}
|
||||
else if (p.parameter.has_value()) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"Error when reading Parameter. Could not find provided parameter '{}' in "
|
||||
"list of parameter options. Using default.", *p.parameter
|
||||
));
|
||||
|
||||
@@ -357,7 +357,7 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_file = absPath(p.geometryFile.string());
|
||||
if (!std::filesystem::exists(_file)) {
|
||||
throw ghoul::RuntimeError(fmt::format("Cannot find model file '{}'", _file));
|
||||
throw ghoul::RuntimeError(std::format("Cannot find model file '{}'", _file));
|
||||
}
|
||||
|
||||
_invertModelScale = p.invertModelScale.value_or(_invertModelScale);
|
||||
@@ -469,7 +469,7 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_modelScale.onChange([this]() {
|
||||
if (!_geometry) {
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Cannot set scale for model '{}': not loaded yet", _file
|
||||
));
|
||||
return;
|
||||
@@ -487,12 +487,12 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_enableAnimation.onChange([this]() {
|
||||
if (!_modelHasAnimation) {
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Cannot enable animation for model '{}': it does not have any", _file
|
||||
));
|
||||
}
|
||||
else if (_enableAnimation && _animationStart.empty()) {
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Cannot enable animation for model '{}': it does not have a start time",
|
||||
_file
|
||||
));
|
||||
@@ -500,7 +500,7 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
else {
|
||||
if (!_geometry) {
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Cannot enable animation for model '{}': not loaded yet", _file
|
||||
));
|
||||
return;
|
||||
@@ -560,13 +560,13 @@ void RenderableModel::initializeGL() {
|
||||
|
||||
if (!_modelHasAnimation) {
|
||||
if (!_animationStart.empty()) {
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Animation start time given to model '{}' without animation", _file
|
||||
));
|
||||
}
|
||||
|
||||
if (_enableAnimation) {
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Cannot enable animation for model '{}': it does not have any", _file
|
||||
));
|
||||
_enableAnimation = false;
|
||||
@@ -576,13 +576,13 @@ void RenderableModel::initializeGL() {
|
||||
}
|
||||
else {
|
||||
if (_enableAnimation && _animationStart.empty()) {
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Cannot enable animation for model '{}': it does not have a start time",
|
||||
_file
|
||||
));
|
||||
}
|
||||
else if (!_enableAnimation) {
|
||||
LINFO(fmt::format(
|
||||
LINFO(std::format(
|
||||
"Model '{}' with deactivated animation was found. The animation can be "
|
||||
"activated by entering a start time in the asset file", _file
|
||||
));
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace {
|
||||
|
||||
SceneGraphNode* startNode = sceneGraphNode(nodeName);
|
||||
if (!startNode) {
|
||||
LERROR(fmt::format("Could not find start node '{}'", nodeName));
|
||||
LERROR(std::format("Could not find start node '{}'", nodeName));
|
||||
return;
|
||||
}
|
||||
const double boundingSphere = startNode->boundingSphere();
|
||||
@@ -242,7 +242,7 @@ namespace {
|
||||
else {
|
||||
// Recompute distance (previous value was in meters)
|
||||
if (boundingSphere < std::numeric_limits<double>::epsilon()) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"Start node '{}' has invalid bounding sphere", nodeName
|
||||
));
|
||||
return;
|
||||
@@ -383,12 +383,12 @@ void RenderableNodeArrow::updateShapeTransforms(const RenderData& data) {
|
||||
SceneGraphNode* endNode = sceneGraphNode(_end);
|
||||
|
||||
if (!startNode) {
|
||||
LERROR(fmt::format("Could not find start node '{}'", _start.value()));
|
||||
LERROR(std::format("Could not find start node '{}'", _start.value()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!endNode) {
|
||||
LERROR(fmt::format("Could not find end node '{}'", _end.value()));
|
||||
LERROR(std::format("Could not find end node '{}'", _end.value()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ void RenderableNodeArrow::updateShapeTransforms(const RenderData& data) {
|
||||
boundingSphere < std::numeric_limits<double>::epsilon();
|
||||
|
||||
if (hasNoBoundingSphere && (_useRelativeLength || _useRelativeOffset)) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"Node '{}' has no valid bounding sphere. Can not use relative values",
|
||||
_end.value()
|
||||
));
|
||||
|
||||
@@ -181,7 +181,7 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
|
||||
if (!node || node->boundingSphere() > 0.0) {
|
||||
return;
|
||||
}
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Setting StartOffset for node line '{}': Trying to use relative offsets "
|
||||
"for start node '{}' that has no bounding sphere. This will result in no "
|
||||
"offset. Use direct values by setting UseRelativeOffsets to false",
|
||||
@@ -198,7 +198,7 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
|
||||
if (!node || node->boundingSphere() > 0.0) {
|
||||
return;
|
||||
}
|
||||
LWARNING(fmt::format(
|
||||
LWARNING(std::format(
|
||||
"Setting EndOffset for node line '{}': Trying to use relative offsets "
|
||||
"for end node '{}' that has no bounding sphere. This will result in no "
|
||||
"offset. Use direct values by setting UseRelativeOffsets to false",
|
||||
@@ -213,7 +213,7 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
|
||||
SceneGraphNode* endNode = global::renderEngine->scene()->sceneGraphNode(_end);
|
||||
|
||||
if (!startNode) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"Error when recomputing node line offsets for scene graph node '{}'. "
|
||||
"Could not find start node '{}'", parent()->identifier(), _start.value()
|
||||
));
|
||||
@@ -221,7 +221,7 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
if (!endNode) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"Error when recomputing node line offsets for scene graph node '{}'. "
|
||||
"Could not find end node '{}'", parent()->identifier(), _end.value()
|
||||
));
|
||||
@@ -310,12 +310,12 @@ void RenderableNodeLine::updateVertexData() {
|
||||
SceneGraphNode* endNode = global::renderEngine->scene()->sceneGraphNode(_end);
|
||||
|
||||
if (!startNode) {
|
||||
LERROR(fmt::format("Could not find start node '{}'", _start.value()));
|
||||
LERROR(std::format("Could not find start node '{}'", _start.value()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!endNode) {
|
||||
LERROR(fmt::format("Could not find end node '{}'", _end.value()));
|
||||
LERROR(std::format("Could not find end node '{}'", _end.value()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ void RenderablePlaneImageLocal::loadTexture() {
|
||||
|
||||
LDEBUGC(
|
||||
"RenderablePlaneImageLocal",
|
||||
fmt::format("Loaded texture from '{}'", absPath(path))
|
||||
std::format("Loaded texture from '{}'", absPath(path))
|
||||
);
|
||||
texture->uploadTexture();
|
||||
texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap);
|
||||
|
||||
@@ -133,7 +133,7 @@ void RenderablePlaneImageOnline::update(const UpdateData& data) {
|
||||
if (imageFile.corrupted) {
|
||||
LERRORC(
|
||||
"ScreenSpaceImageOnline",
|
||||
fmt::format("Error loading image from URL '{}'", _texturePath.value())
|
||||
std::format("Error loading image from URL '{}'", _texturePath.value())
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ RenderablePlaneTimeVaryingImage::RenderablePlaneTimeVaryingImage(
|
||||
|
||||
_sourceFolder = p.sourceFolder;
|
||||
if (!std::filesystem::is_directory(absPath(_sourceFolder))) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"Time varying image, '{}' is not a valid directory",
|
||||
_sourceFolder.value()
|
||||
));
|
||||
@@ -174,7 +174,7 @@ bool RenderablePlaneTimeVaryingImage::extractMandatoryInfoFromDictionary() {
|
||||
std::sort(_sourceFiles.begin(), _sourceFiles.end());
|
||||
// Ensure that there are available and valid source files left
|
||||
if (_sourceFiles.empty()) {
|
||||
LERROR(fmt::format(
|
||||
LERROR(std::format(
|
||||
"{}: Plane sequence filepath '{}' was empty",
|
||||
_identifier, _sourceFolder.value()
|
||||
));
|
||||
|
||||
@@ -117,14 +117,14 @@ void RenderableSphereImageLocal::loadTexture() {
|
||||
if (!texture) {
|
||||
LWARNINGC(
|
||||
"RenderableSphereImageLocal",
|
||||
fmt::format("Could not load texture from '{}'", absPath(_texturePath))
|
||||
std::format("Could not load texture from '{}'", absPath(_texturePath))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
LDEBUGC(
|
||||
"RenderableSphereImageLocal",
|
||||
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
|
||||
std::format("Loaded texture from '{}'", absPath(_texturePath))
|
||||
);
|
||||
texture->uploadTexture();
|
||||
texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap);
|
||||
|
||||
@@ -53,13 +53,13 @@ namespace {
|
||||
[url](const DownloadManager::MemoryFile&) {
|
||||
LDEBUGC(
|
||||
"RenderableSphereImageOnline",
|
||||
fmt::format("Download to memory finished for image '{}'", url)
|
||||
std::format("Download to memory finished for image '{}'", url)
|
||||
);
|
||||
},
|
||||
[url](const std::string& err) {
|
||||
LDEBUGC(
|
||||
"RenderableSphereImageOnline",
|
||||
fmt::format("Download to memory failed for image '{}': {}", url, err)
|
||||
std::format("Download to memory failed for image '{}': {}", url, err)
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -120,7 +120,7 @@ void RenderableSphereImageOnline::update(const UpdateData& data) {
|
||||
if (imageFile.corrupted) {
|
||||
LERRORC(
|
||||
"RenderableSphereImageOnline",
|
||||
fmt::format("Error loading image from URL '{}'", _textureUrl.value())
|
||||
std::format("Error loading image from URL '{}'", _textureUrl.value())
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ ScreenSpaceImageLocal::ScreenSpaceImageLocal(const ghoul::Dictionary& dictionary
|
||||
if (!std::filesystem::is_regular_file(absPath(_texturePath))) {
|
||||
LWARNINGC(
|
||||
"ScreenSpaceImageLocal",
|
||||
fmt::format(
|
||||
std::format(
|
||||
"Image '{}' did not exist for '{}'", _texturePath.value(), _identifier
|
||||
)
|
||||
);
|
||||
@@ -103,7 +103,7 @@ ScreenSpaceImageLocal::ScreenSpaceImageLocal(const ghoul::Dictionary& dictionary
|
||||
else {
|
||||
LWARNINGC(
|
||||
"ScreenSpaceImageLocal",
|
||||
fmt::format(
|
||||
std::format(
|
||||
"Image '{}' did not exist for '{}'", *p.texturePath, _identifier
|
||||
)
|
||||
);
|
||||
|
||||
@@ -110,7 +110,7 @@ void ScreenSpaceImageOnline::update() {
|
||||
if (imageFile.corrupted) {
|
||||
LERRORC(
|
||||
"ScreenSpaceImageOnline",
|
||||
fmt::format("Error loading image from URL '{}'", _texturePath.value())
|
||||
std::format("Error loading image from URL '{}'", _texturePath.value())
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user