Implement Logger to replace raw cerr/cout and DPRINTF usage
parent
b94d084af3
commit
14af83a391
985
po/celestia.pot
985
po/celestia.pot
File diff suppressed because it is too large
Load Diff
1010
po/pt_BR.po
1010
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1017
po/zh_CN.po
1017
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1010
po/zh_TW.po
1010
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
|
@ -16,13 +16,14 @@
|
|||
#include <utility>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <fmt/ostream.h>
|
||||
|
||||
#include <celutil/binaryread.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "3dsmodel.h"
|
||||
#include "3dsread.h"
|
||||
|
||||
namespace celutil = celestia::util;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -133,7 +134,8 @@ std::int32_t read3DSChunk(std::istream& in,
|
|||
default:
|
||||
if (processedSize != contentSize)
|
||||
{
|
||||
fmt::print(std::clog, "Chunk type {:04x}, expected {} bytes but read {}\n", chunkType, contentSize, processedSize);
|
||||
GetLogger()->error("Chunk type {:04x}, expected {} bytes but read {}\n",
|
||||
static_cast<int>(chunkType), contentSize, processedSize);
|
||||
return READ_FAILURE;
|
||||
}
|
||||
return chunkSize;
|
||||
|
@ -153,7 +155,7 @@ std::int32_t read3DSChunks(std::istream& in,
|
|||
{
|
||||
std::int32_t chunkSize = read3DSChunk(in, chunkFunc, obj);
|
||||
if (chunkSize < 0) {
|
||||
fmt::print(std::clog, "Failed to read 3DS chunk\n");
|
||||
GetLogger()->error("Failed to read 3DS chunk\n");
|
||||
return READ_FAILURE;
|
||||
}
|
||||
bytesRead += chunkSize;
|
||||
|
@ -161,7 +163,7 @@ std::int32_t read3DSChunks(std::istream& in,
|
|||
|
||||
if (bytesRead != nBytes)
|
||||
{
|
||||
fmt::print(std::clog, "Multiple chunks, expected {} bytes but read {}\n", nBytes, bytesRead);
|
||||
GetLogger()->error("Multiple chunks, expected {} bytes but read {}\n", nBytes, bytesRead);
|
||||
return READ_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -573,18 +575,18 @@ std::unique_ptr<M3DScene> Read3DSFile(std::istream& in)
|
|||
M3DChunkType chunkType;
|
||||
if (!readChunkType(in, chunkType) || chunkType != M3DChunkType::Magic)
|
||||
{
|
||||
fmt::print(std::clog, "Read3DSFile: Wrong magic number in header\n");
|
||||
GetLogger()->error("Read3DSFile: Wrong magic number in header\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::int32_t chunkSize;
|
||||
if (!celutil::readLE<std::int32_t>(in, chunkSize) || chunkSize < 6)
|
||||
{
|
||||
fmt::print(std::clog, "Read3DSFile: Error reading 3DS file top level chunk size\n");
|
||||
GetLogger()->error("Read3DSFile: Error reading 3DS file top level chunk size\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fmt::print(std::clog, "3DS file, {} bytes\n", chunkSize + 6);
|
||||
GetLogger()->verbose("3DS file, {} bytes\n", chunkSize + 6);
|
||||
|
||||
auto scene = std::make_unique<M3DScene>();
|
||||
std::int32_t contentSize = chunkSize - 6;
|
||||
|
@ -605,7 +607,7 @@ std::unique_ptr<M3DScene> Read3DSFile(const fs::path& filename)
|
|||
std::ifstream in(filename.string(), std::ios::in | std::ios::binary);
|
||||
if (!in.good())
|
||||
{
|
||||
fmt::print(std::clog, "Read3DSFile: Error opening {}\n", filename);
|
||||
GetLogger()->error("Read3DSFile: Error opening {}\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
#include "stardb.h"
|
||||
#include "asterism.h"
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
|
||||
using namespace std;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
Asterism::Asterism(string _name) :
|
||||
name(std::move(_name))
|
||||
|
@ -115,7 +115,7 @@ AsterismList* ReadAsterismList(istream& in, const StarDatabase& stardb)
|
|||
{
|
||||
if (tokenizer.getTokenType() != Tokenizer::TokenString)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing asterism file.\n");
|
||||
GetLogger()->error("Error parsing asterism file.\n");
|
||||
for_each(asterisms->begin(), asterisms->end(), [](Asterism* ast) { delete ast; });
|
||||
delete asterisms;
|
||||
return nullptr;
|
||||
|
@ -127,7 +127,7 @@ AsterismList* ReadAsterismList(istream& in, const StarDatabase& stardb)
|
|||
Value* chainsValue = parser.readValue();
|
||||
if (chainsValue == nullptr || chainsValue->getType() != Value::ArrayType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing asterism %s\n", name.c_str());
|
||||
GetLogger()->error("Error parsing asterism {}\n", name);
|
||||
for_each(asterisms->begin(), asterisms->end(), [](Asterism* ast) { delete ast; });
|
||||
delete ast;
|
||||
delete asterisms;
|
||||
|
@ -157,7 +157,7 @@ AsterismList* ReadAsterismList(istream& in, const StarDatabase& stardb)
|
|||
if (star != nullptr)
|
||||
new_chain->push_back(star->getPosition());
|
||||
else
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error loading star \"%s\" for asterism \"%s\".\n", name.c_str(), i->getString().c_str());
|
||||
GetLogger()->error("Error loading star \"{}\" for asterism \"{}\".\n", name, i->getString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "parseobject.h"
|
||||
#include "astroobj.h"
|
||||
#include "category.h"
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
void AstroObject::setIndex(AstroCatalog::IndexNumber nr)
|
||||
{
|
||||
if (m_mainIndexNumber != AstroCatalog::InvalidIndex)
|
||||
DPRINTF(LOG_LEVEL_WARNING, "AstroObject::setIndex(%u) on object with already set index: %u!\n", nr, m_mainIndexNumber);
|
||||
GetLogger()->warn("AstroObject::setIndex({}) on object with already set index: {}!\n", nr, m_mainIndexNumber);
|
||||
m_mainIndexNumber = nr;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#include <iostream>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celengine/astroobj.h>
|
||||
#include "category.h"
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
UserCategory::UserCategory(const std::string &n, UserCategory *p, const std::string &domain) :
|
||||
m_name(n),
|
||||
m_name(n),
|
||||
m_parent(p)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
|
@ -95,19 +97,19 @@ bool UserCategory::hasChild(const std::string &n) const
|
|||
|
||||
void UserCategory::cleanup()
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_INFO, "UserCategory::cleanup()\n");
|
||||
DPRINTF(LOG_LEVEL_INFO, " Objects: %i\n", m_objlist.size());
|
||||
DPRINTF(LOG_LEVEL_INFO, " Categories: %i\n", m_catlist.size());
|
||||
GetLogger()->debug("UserCategory::cleanup()\n Objects: {}\n Categories: {}\n",
|
||||
m_objlist.size(), m_catlist.size());
|
||||
|
||||
while(!m_objlist.empty())
|
||||
{
|
||||
auto it = m_objlist.begin();
|
||||
DPRINTF(LOG_LEVEL_INFO, "Removing object: %s\n", it->getName());
|
||||
GetLogger()->debug("Removing object: {}\n", it->getName());
|
||||
removeObject(*it);
|
||||
}
|
||||
while(!m_catlist.empty())
|
||||
{
|
||||
auto it = m_catlist.begin();
|
||||
DPRINTF(LOG_LEVEL_INFO, "Removing category: %s\n", (*it)->name());
|
||||
GetLogger()->debug("Removing category: {}\n", (*it)->name());
|
||||
deleteChild(*it);
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +139,7 @@ UserCategory *UserCategory::find(const std::string &s)
|
|||
{
|
||||
if (m_allcats.count(s) == 0)
|
||||
return nullptr;
|
||||
DPRINTF(LOG_LEVEL_INFO, "UserCategory::find(%s): exists\n", s.c_str());
|
||||
GetLogger()->info("UserCategory::find({}): exists\n", s.c_str());
|
||||
return m_allcats.find(s)->second;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "nebula.h"
|
||||
#include "opencluster.h"
|
||||
#include <celengine/selection.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celmath/intersect.h>
|
||||
|
||||
using namespace Eigen;
|
||||
|
|
|
@ -17,21 +17,19 @@
|
|||
|
||||
#include <fmt/printf.h>
|
||||
|
||||
#include <celutil/debug.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/bytes.h>
|
||||
#include <celutil/utf8.h>
|
||||
#include <celengine/dsodb.h>
|
||||
#include <config.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
#include "astro.h"
|
||||
#include "parser.h"
|
||||
#include "parseobject.h"
|
||||
#include "multitexture.h"
|
||||
#include "meshmanager.h"
|
||||
#include <celutil/tokenizer.h>
|
||||
#include <celutil/debug.h>
|
||||
|
||||
#include <celengine/dsodb.h>
|
||||
#include <celengine/galaxy.h>
|
||||
#include <celengine/globular.h>
|
||||
#include <celengine/opencluster.h>
|
||||
|
@ -42,7 +40,7 @@
|
|||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
constexpr const float DSO_OCTREE_MAGNITUDE = 8.0f;
|
||||
//constexpr const float DSO_EXTRA_ROOM = 0.01f; // Reserve 1% capacity for extra DSOs
|
||||
|
@ -241,7 +239,7 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
|
|||
|
||||
if (tokenizer.getTokenType() != Tokenizer::TokenName)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing deep sky catalog file.\n");
|
||||
GetLogger()->error("Error parsing deep sky catalog file.\n");
|
||||
return false;
|
||||
}
|
||||
objType = tokenizer.getNameValue();
|
||||
|
@ -262,7 +260,7 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
|
|||
|
||||
if (tokenizer.nextToken() != Tokenizer::TokenString)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing deep sky catalog file: bad name.\n");
|
||||
GetLogger()->error("Error parsing deep sky catalog file: bad name.\n");
|
||||
return false;
|
||||
}
|
||||
objName = tokenizer.getStringValue();
|
||||
|
@ -271,7 +269,7 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
|
|||
if (objParamsValue == nullptr ||
|
||||
objParamsValue->getType() != Value::HashType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing deep sky catalog entry %s\n", objName.c_str());
|
||||
GetLogger()->error("Error parsing deep sky catalog entry {}\n", objName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -347,7 +345,7 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_WARNING, "Bad Deep Sky Object definition--will continue parsing file.\n");
|
||||
GetLogger()->warn("Bad Deep Sky Object definition--will continue parsing file.\n");
|
||||
delete objParamsValue;
|
||||
return false;
|
||||
}
|
||||
|
@ -376,13 +374,13 @@ void DSODatabase::finish()
|
|||
DSOs[i]->setAbsoluteMagnitude((float)avgAbsMag);
|
||||
}
|
||||
*/
|
||||
clog << fmt::sprintf(_("Loaded %i deep space objects\n"), nDSOs);
|
||||
GetLogger()->info(_("Loaded {} deep space objects\n"), nDSOs);
|
||||
}
|
||||
|
||||
|
||||
void DSODatabase::buildOctree()
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_INFO, "Sorting DSOs into octree . . .\n");
|
||||
GetLogger()->debug("Sorting DSOs into octree . . .\n");
|
||||
float absMag = astro::appToAbsMag(DSO_OCTREE_MAGNITUDE, DSO_OCTREE_ROOT_SIZE * (float) sqrt(3.0));
|
||||
|
||||
// TODO: investigate using a different center--it's possible that more
|
||||
|
@ -394,7 +392,7 @@ void DSODatabase::buildOctree()
|
|||
root->insertObject(DSOs[i], DSO_OCTREE_ROOT_SIZE);
|
||||
}
|
||||
|
||||
DPRINTF(LOG_LEVEL_INFO, "Spatially sorting DSOs for improved locality of reference . . .\n");
|
||||
GetLogger()->debug("Spatially sorting DSOs for improved locality of reference . . .\n");
|
||||
DeepSkyObject** sortedDSOs = new DeepSkyObject*[nDSOs];
|
||||
DeepSkyObject** firstDSO = sortedDSOs;
|
||||
|
||||
|
@ -402,11 +400,11 @@ void DSODatabase::buildOctree()
|
|||
// are storing pointers to objects and not the objects themselves:
|
||||
root->rebuildAndSort(octreeRoot, firstDSO);
|
||||
|
||||
DPRINTF(LOG_LEVEL_INFO, "%d DSOs total\n", (int) (firstDSO - sortedDSOs));
|
||||
DPRINTF(LOG_LEVEL_INFO, "Octree has %d nodes and %d DSOs.\n",
|
||||
1 + octreeRoot->countChildren(), octreeRoot->countObjects());
|
||||
//cout<<"DSOs: "<< octreeRoot->countObjects()<<" Nodes:"
|
||||
// <<octreeRoot->countChildren() <<endl;
|
||||
GetLogger()->debug("{} DSOs total.\nOctree has {} nodes and {} DSOs.\n",
|
||||
static_cast<int>(firstDSO - sortedDSOs),
|
||||
1 + octreeRoot->countChildren(),
|
||||
octreeRoot->countObjects());
|
||||
|
||||
// Clean up . . .
|
||||
delete[] DSOs;
|
||||
delete root;
|
||||
|
@ -439,7 +437,7 @@ void DSODatabase::buildIndexes()
|
|||
// This should only be called once for the database
|
||||
// assert(catalogNumberIndexes[0] == nullptr);
|
||||
|
||||
DPRINTF(LOG_LEVEL_INFO, "Building catalog number indexes . . .\n");
|
||||
GetLogger()->debug("Building catalog number indexes . . .\n");
|
||||
|
||||
catalogNumberIndex = new DeepSkyObject*[nDSOs];
|
||||
for (int i = 0; i < nDSOs; ++i)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <celmath/ray.h>
|
||||
#include <celmath/randutils.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celcompat/filesystem.h>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <algorithm>
|
||||
#include <celutil/debug.h>
|
||||
#include "glcontext.h"
|
||||
#include "glsupport.h"
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <celmath/intersect.h>
|
||||
#include <celmath/ray.h>
|
||||
#include <celmath/randutils.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include "astro.h"
|
||||
#include "globular.h"
|
||||
|
|
|
@ -8,9 +8,11 @@
|
|||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <iostream>
|
||||
#include <celutil/logger.h>
|
||||
#include "glshader.h"
|
||||
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
static const string GetInfoLog(GLuint obj);
|
||||
|
@ -392,7 +394,7 @@ GetInfoLog(GLuint obj)
|
|||
}
|
||||
else
|
||||
{
|
||||
cerr << "Unknown object passed to GetInfoLog()!\n";
|
||||
GetLogger()->error("Unknown object passed to GetInfoLog()!\n");
|
||||
return string();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,8 @@
|
|||
#include <cassert>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <fmt/ostream.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <celengine/glsupport.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/filetype.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celimage/imageformats.h>
|
||||
|
@ -22,6 +20,7 @@
|
|||
|
||||
using namespace std;
|
||||
using celestia::PixelFormat;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -288,7 +287,7 @@ Image* LoadImageFromFile(const fs::path& filename)
|
|||
ContentType type = DetermineFileType(filename);
|
||||
Image* img = nullptr;
|
||||
|
||||
clog << fmt::sprintf(_("Loading image from file %s\n"), filename);
|
||||
GetLogger()->verbose(_("Loading image from file {}\n"), filename);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -311,7 +310,7 @@ Image* LoadImageFromFile(const fs::path& filename)
|
|||
img = LoadDDSImage(filename);
|
||||
break;
|
||||
default:
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: unrecognized or unsupported image file type.\n", filename);
|
||||
GetLogger()->error("{}: unrecognized or unsupported image file type.\n", filename);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,13 @@
|
|||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/fsutils.h>
|
||||
#include "mapmanager.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace celestia;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
static std::array<const char*, 1> extensions = {"map"};
|
||||
|
||||
|
@ -147,25 +148,25 @@ WarpMesh* WarpMeshInfo::load(const fs::path& name)
|
|||
int type, nx, ny;
|
||||
if (!(f >> type))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Failed to read mesh header\n");
|
||||
GetLogger()->error("Failed to read mesh header\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (type != MESHTYPE_RECT)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Unsupported mesh type found: %d\n", type);
|
||||
GetLogger()->error("Unsupported mesh type found: {}\n", type);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!(f >> nx >> ny))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Failed to read mesh header\n");
|
||||
GetLogger()->error("Failed to read mesh header\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (nx < 2 || ny < 2)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Row and column numbers should be larger than 2\n");
|
||||
GetLogger()->error("Row and column numbers should be larger than 2\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -177,12 +178,12 @@ WarpMesh* WarpMeshInfo::load(const fs::path& name)
|
|||
float *base = &data[(y * nx + x) * 5];
|
||||
if (!(f >> base[0] >> base[1] >> base[2] >> base[3] >> base[4]))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Failed to read mesh data\n");
|
||||
GetLogger()->error("Failed to read mesh data\n");
|
||||
delete[] data;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
DPRINTF(LOG_LEVEL_INFO, "Read a mesh of %d * %d\n", nx, ny);
|
||||
GetLogger()->info("Read a mesh of {} x {}\n", nx, ny);
|
||||
return new WarpMesh(nx, ny, data);
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#include <celmodel/mesh.h>
|
||||
#include <celmodel/model.h>
|
||||
#include <celmodel/modelfile.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/filetype.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
#include "meshmanager.h"
|
||||
#include "modelgeometry.h"
|
||||
|
@ -45,6 +45,8 @@
|
|||
#include "particlesystemfile.h"
|
||||
#endif
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -83,7 +85,7 @@ LoadCelestiaMesh(const fs::path& filename)
|
|||
std::ifstream meshFile(filename.string(), std::ios::in);
|
||||
if (!meshFile.good())
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error opening mesh file: %s\n", filename);
|
||||
GetLogger()->error("Error opening mesh file: {}\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -92,13 +94,13 @@ LoadCelestiaMesh(const fs::path& filename)
|
|||
|
||||
if (tokenizer.nextToken() != Tokenizer::TokenName)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Mesh file %s is invalid.\n", filename);
|
||||
GetLogger()->error("Mesh file {} is invalid.\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (tokenizer.getStringValue() != "SphereDisplacementMesh")
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: Unrecognized mesh type %s.\n",
|
||||
GetLogger()->error("{}: Unrecognized mesh type {}.\n",
|
||||
filename, tokenizer.getStringValue());
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -106,13 +108,13 @@ LoadCelestiaMesh(const fs::path& filename)
|
|||
Value* meshDefValue = parser.readValue();
|
||||
if (meshDefValue == nullptr)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: Bad mesh file.\n", filename);
|
||||
GetLogger()->error("{}: Bad mesh file.\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (meshDefValue->getType() != Value::HashType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: Bad mesh file.\n", filename);
|
||||
GetLogger()->error("{}: Bad mesh file.\n", filename);
|
||||
delete meshDefValue;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "multitexture.h"
|
||||
#include "texmanager.h"
|
||||
#include <celutil/debug.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include "name.h"
|
||||
|
||||
|
@ -14,7 +14,7 @@ void NameDatabase::add(const AstroCatalog::IndexNumber catalogNumber, const std:
|
|||
#ifdef DEBUG
|
||||
AstroCatalog::IndexNumber tmp;
|
||||
if ((tmp = getCatalogNumberByName(name, false)) != AstroCatalog::InvalidIndex)
|
||||
DPRINTF(LOG_LEVEL_INFO,"Duplicated name '%s' on object with catalog numbers: %d and %d\n", name.c_str(), tmp, catalogNumber);
|
||||
celestia::util::GetLogger()->debug("Duplicated name '{}' on object with catalog numbers: {} and {}\n", name, tmp, catalogNumber);
|
||||
#endif
|
||||
// Add the new name
|
||||
//nameIndex.insert(NameIndex::value_type(name, catalogNumber));
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <iostream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/stringutils.h>
|
||||
#include <celutil/utf8.h>
|
||||
#include <celengine/astroobj.h>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include "astro.h"
|
||||
#include "meshmanager.h"
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "opencluster.h"
|
||||
#include "meshmanager.h"
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <celmath/geomutil.h>
|
||||
#include <celttf/truetypefont.h>
|
||||
#include <celutil/color.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/utf8.h>
|
||||
#include "overlay.h"
|
||||
#include "rectangle.h"
|
||||
|
|
|
@ -25,12 +25,13 @@
|
|||
#include <celephem/scriptorbit.h>
|
||||
#include <celephem/scriptrotation.h>
|
||||
#include <celmath/geomutil.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <cassert>
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
/**
|
||||
* Returns the default units scale for orbits.
|
||||
|
@ -150,7 +151,7 @@ CreateEllipticalOrbit(Hash* orbitData,
|
|||
{
|
||||
if (!orbitData->getLength("PericenterDistance", pericenterDistance, 1.0, distanceScale))
|
||||
{
|
||||
clog << "SemiMajorAxis/PericenterDistance missing! Skipping planet . . .\n";
|
||||
GetLogger()->error("SemiMajorAxis/PericenterDistance missing! Skipping planet . . .\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +159,7 @@ CreateEllipticalOrbit(Hash* orbitData,
|
|||
double period = 0.0;
|
||||
if (!orbitData->getTime("Period", period, 1.0, timeScale))
|
||||
{
|
||||
clog << "Period missing! Skipping planet . . .\n";
|
||||
GetLogger()->error("Period missing! Skipping planet . . .\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -231,7 +232,7 @@ CreateSampledTrajectory(Hash* trajData, const fs::path& path)
|
|||
string sourceName;
|
||||
if (!trajData->getString("Source", sourceName))
|
||||
{
|
||||
clog << "SampledTrajectory is missing a source.\n";
|
||||
GetLogger()->error("SampledTrajectory is missing a source.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -246,7 +247,7 @@ CreateSampledTrajectory(Hash* trajData, const fs::path& path)
|
|||
else if (!compareIgnoringCase(interpolationString, "cubic"))
|
||||
interpolation = TrajectoryInterpolationCubic;
|
||||
else
|
||||
clog << "Unknown interpolation type " << interpolationString << endl; // non-fatal error
|
||||
GetLogger()->warn("Unknown interpolation type {}\n", interpolationString); // non-fatal error
|
||||
}
|
||||
|
||||
// Double precision is true by default
|
||||
|
@ -254,12 +255,12 @@ CreateSampledTrajectory(Hash* trajData, const fs::path& path)
|
|||
trajData->getBoolean("DoublePrecision", useDoublePrecision);
|
||||
TrajectoryPrecision precision = useDoublePrecision ? TrajectoryPrecisionDouble : TrajectoryPrecisionSingle;
|
||||
|
||||
DPRINTF(LOG_LEVEL_INFO, "Attempting to load sampled trajectory from source '%s'\n", sourceName.c_str());
|
||||
GetLogger()->verbose("Attempting to load sampled trajectory from source '{}'\n", sourceName);
|
||||
ResourceHandle orbitHandle = GetTrajectoryManager()->getHandle(TrajectoryInfo(sourceName, path, interpolation, precision));
|
||||
Orbit* orbit = GetTrajectoryManager()->find(orbitHandle);
|
||||
if (orbit == nullptr)
|
||||
{
|
||||
clog << "Could not load sampled trajectory from '" << sourceName << "'\n";
|
||||
GetLogger()->error("Could not load sampled trajectory from '{}'\n", sourceName);
|
||||
}
|
||||
|
||||
return orbit;
|
||||
|
@ -297,7 +298,7 @@ CreateFixedPosition(Hash* trajData, const Selection& centralObject, bool usePlan
|
|||
{
|
||||
if (centralObject.getType() != Selection::Type_Body)
|
||||
{
|
||||
clog << "FixedPosition planetographic coordinates aren't valid for stars.\n";
|
||||
GetLogger()->error("FixedPosition planetographic coordinates aren't valid for stars.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -309,7 +310,7 @@ CreateFixedPosition(Hash* trajData, const Selection& centralObject, bool usePlan
|
|||
{
|
||||
if (centralObject.getType() != Selection::Type_Body)
|
||||
{
|
||||
clog << "FixedPosition planetocentric coordinates aren't valid for stars.\n";
|
||||
GetLogger()->error("FixedPosition planetocentric coordinates aren't valid for stars.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -318,7 +319,7 @@ CreateFixedPosition(Hash* trajData, const Selection& centralObject, bool usePlan
|
|||
}
|
||||
else
|
||||
{
|
||||
clog << "Missing coordinates for FixedPosition\n";
|
||||
GetLogger()->error("Missing coordinates for FixedPosition\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -418,20 +419,20 @@ CreateSpiceOrbit(Hash* orbitData,
|
|||
// the kernel pool.
|
||||
if (!ParseStringList(orbitData, "Kernel", kernelList))
|
||||
{
|
||||
clog << "Kernel list for SPICE orbit is neither a string nor array of strings\n";
|
||||
GetLogger()->error("Kernel list for SPICE orbit is neither a string nor array of strings\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!orbitData->getString("Target", targetBodyName))
|
||||
{
|
||||
clog << "Target name missing from SPICE orbit\n";
|
||||
GetLogger()->error("Target name missing from SPICE orbit\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!orbitData->getString("Origin", originName))
|
||||
{
|
||||
clog << "Origin name missing from SPICE orbit\n";
|
||||
GetLogger()->error("Origin name missing from SPICE orbit\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -439,7 +440,7 @@ CreateSpiceOrbit(Hash* orbitData,
|
|||
double boundingRadius = 0.0;
|
||||
if (!orbitData->getLength("BoundingRadius", boundingRadius, 1.0, distanceScale))
|
||||
{
|
||||
clog << "Bounding Radius missing from SPICE orbit\n";
|
||||
GetLogger()->error("Bounding Radius missing from SPICE orbit\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -455,13 +456,13 @@ CreateSpiceOrbit(Hash* orbitData,
|
|||
Value* endingDate = orbitData->getValue("Ending");
|
||||
if (beginningDate != nullptr && endingDate == nullptr)
|
||||
{
|
||||
clog << "Beginning specified for SPICE orbit, but ending is missing.\n";
|
||||
GetLogger()->error("Beginning specified for SPICE orbit, but ending is missing.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (endingDate != nullptr && beginningDate == nullptr)
|
||||
{
|
||||
clog << "Ending specified for SPICE orbit, but beginning is missing.\n";
|
||||
GetLogger()->error("Ending specified for SPICE orbit, but beginning is missing.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -471,14 +472,14 @@ CreateSpiceOrbit(Hash* orbitData,
|
|||
double beginningTDBJD = 0.0;
|
||||
if (!ParseDate(orbitData, "Beginning", beginningTDBJD))
|
||||
{
|
||||
clog << "Invalid beginning date specified for SPICE orbit.\n";
|
||||
GetLogger()->error("Invalid beginning date specified for SPICE orbit.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
double endingTDBJD = 0.0;
|
||||
if (!ParseDate(orbitData, "Ending", endingTDBJD))
|
||||
{
|
||||
clog << "Invalid ending date specified for SPICE orbit.\n";
|
||||
GetLogger()->error("Invalid ending date specified for SPICE orbit.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -553,14 +554,14 @@ CreateSpiceRotation(Hash* rotationData,
|
|||
// the kernel pool.
|
||||
if (!ParseStringList(rotationData, "Kernel", kernelList))
|
||||
{
|
||||
clog << "Kernel list for SPICE rotation is neither a string nor array of strings\n";
|
||||
GetLogger()->warn("Kernel list for SPICE rotation is neither a string nor array of strings\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rotationData->getString("Frame", frameName))
|
||||
{
|
||||
clog << "Frame name missing from SPICE rotation\n";
|
||||
GetLogger()->error("Frame name missing from SPICE rotation\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -578,13 +579,13 @@ CreateSpiceRotation(Hash* rotationData,
|
|||
Value* endingDate = rotationData->getValue("Ending");
|
||||
if (beginningDate != nullptr && endingDate == nullptr)
|
||||
{
|
||||
clog << "Beginning specified for SPICE rotation, but ending is missing.\n";
|
||||
GetLogger()->error("Beginning specified for SPICE rotation, but ending is missing.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (endingDate != nullptr && beginningDate == nullptr)
|
||||
{
|
||||
clog << "Ending specified for SPICE rotation, but beginning is missing.\n";
|
||||
GetLogger()->error("Ending specified for SPICE rotation, but beginning is missing.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -594,14 +595,14 @@ CreateSpiceRotation(Hash* rotationData,
|
|||
double beginningTDBJD = 0.0;
|
||||
if (!ParseDate(rotationData, "Beginning", beginningTDBJD))
|
||||
{
|
||||
clog << "Invalid beginning date specified for SPICE rotation.\n";
|
||||
GetLogger()->error("Invalid beginning date specified for SPICE rotation.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
double endingTDBJD = 0.0;
|
||||
if (!ParseDate(rotationData, "Ending", endingTDBJD))
|
||||
{
|
||||
clog << "Invalid ending date specified for SPICE rotation.\n";
|
||||
GetLogger()->error("Invalid ending date specified for SPICE rotation.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -636,7 +637,7 @@ CreateScriptedOrbit(Hash* orbitData,
|
|||
const fs::path& path)
|
||||
{
|
||||
#if !defined(CELX)
|
||||
clog << "ScriptedOrbit not usable without scripting support.\n";
|
||||
GetLogger()->warn("ScriptedOrbit not usable without scripting support.\n");
|
||||
return nullptr;
|
||||
#else
|
||||
|
||||
|
@ -644,7 +645,7 @@ CreateScriptedOrbit(Hash* orbitData,
|
|||
string funcName;
|
||||
if (!orbitData->getString("Function", funcName))
|
||||
{
|
||||
clog << "Function name missing from script orbit definition.\n";
|
||||
GetLogger()->error("Function name missing from script orbit definition.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -683,8 +684,7 @@ CreateOrbit(const Selection& centralObject,
|
|||
{
|
||||
return orbit;
|
||||
}
|
||||
clog << "Could not find custom orbit named '" << customOrbitName <<
|
||||
"'\n";
|
||||
GetLogger()->error("Could not find custom orbit named '{}'\n", customOrbitName);
|
||||
}
|
||||
|
||||
#ifdef USE_SPICE
|
||||
|
@ -693,7 +693,7 @@ CreateOrbit(const Selection& centralObject,
|
|||
{
|
||||
if (spiceOrbitDataValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect spice orbit syntax.\n";
|
||||
GetLogger()->error("Object has incorrect spice orbit syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
|
@ -703,8 +703,8 @@ CreateOrbit(const Selection& centralObject,
|
|||
{
|
||||
return orbit;
|
||||
}
|
||||
clog << "Bad spice orbit\n";
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Could not load SPICE orbit\n");
|
||||
GetLogger()->error("Bad spice orbit\n");
|
||||
GetLogger()->error("Could not load SPICE orbit\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -715,7 +715,7 @@ CreateOrbit(const Selection& centralObject,
|
|||
{
|
||||
if (scriptedOrbitValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect scripted orbit syntax.\n";
|
||||
GetLogger()->error("Object has incorrect scripted orbit syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ CreateOrbit(const Selection& centralObject,
|
|||
{
|
||||
if (sampledTrajDataValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect syntax for SampledTrajectory.\n";
|
||||
GetLogger()->error("Object has incorrect syntax for SampledTrajectory.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -743,8 +743,7 @@ CreateOrbit(const Selection& centralObject,
|
|||
string sampOrbitFile;
|
||||
if (planetData->getString("SampledOrbit", sampOrbitFile))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_INFO, "Attempting to load sampled orbit file '%s'\n",
|
||||
sampOrbitFile.c_str());
|
||||
GetLogger()->verbose("Attempting to load sampled orbit file '{}'\n", sampOrbitFile);
|
||||
ResourceHandle orbitHandle =
|
||||
GetTrajectoryManager()->getHandle(TrajectoryInfo(sampOrbitFile,
|
||||
path,
|
||||
|
@ -755,7 +754,7 @@ CreateOrbit(const Selection& centralObject,
|
|||
{
|
||||
return orbit;
|
||||
}
|
||||
clog << "Could not load sampled orbit file '" << sampOrbitFile << "'\n";
|
||||
GetLogger()->error("Could not load sampled orbit file '{}'\n", sampOrbitFile);
|
||||
}
|
||||
|
||||
Value* orbitDataValue = planetData->getValue("EllipticalOrbit");
|
||||
|
@ -763,7 +762,7 @@ CreateOrbit(const Selection& centralObject,
|
|||
{
|
||||
if (orbitDataValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect elliptical orbit syntax.\n";
|
||||
GetLogger()->error("Object has incorrect elliptical orbit syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -805,7 +804,7 @@ CreateOrbit(const Selection& centralObject,
|
|||
return CreateFixedPosition(fixedPositionValue->getHash(), centralObject, usePlanetUnits);
|
||||
}
|
||||
|
||||
clog << "Object has incorrect FixedPosition syntax.\n";
|
||||
GetLogger()->error("Object has incorrect FixedPosition syntax.\n");
|
||||
}
|
||||
|
||||
// LongLat will make an object fixed relative to the surface of its center
|
||||
|
@ -1007,7 +1006,7 @@ CreateScriptedRotation(Hash* rotationData,
|
|||
const fs::path& path)
|
||||
{
|
||||
#if !defined(CELX)
|
||||
clog << "ScriptedRotation not usable without scripting support.\n";
|
||||
GetLogger()->warn("ScriptedRotation not usable without scripting support.\n");
|
||||
return nullptr;
|
||||
#else
|
||||
|
||||
|
@ -1015,7 +1014,7 @@ CreateScriptedRotation(Hash* rotationData,
|
|||
string funcName;
|
||||
if (!rotationData->getString("Function", funcName))
|
||||
{
|
||||
clog << "Function name missing from scripted rotation definition.\n";
|
||||
GetLogger()->error("Function name missing from scripted rotation definition.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1068,8 +1067,8 @@ CreateRotationModel(Hash* planetData,
|
|||
{
|
||||
return rotationModel;
|
||||
}
|
||||
clog << "Could not find custom rotation model named '" <<
|
||||
customRotationModelName << "'\n";
|
||||
GetLogger()->error("Could not find custom rotation model named '{}'\n",
|
||||
customRotationModelName);
|
||||
}
|
||||
|
||||
#ifdef USE_SPICE
|
||||
|
@ -1078,7 +1077,7 @@ CreateRotationModel(Hash* planetData,
|
|||
{
|
||||
if (spiceRotationDataValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect spice rotation syntax.\n";
|
||||
GetLogger()->error("Object has incorrect spice rotation syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
|
@ -1088,8 +1087,7 @@ CreateRotationModel(Hash* planetData,
|
|||
{
|
||||
return rotationModel;
|
||||
}
|
||||
clog << "Bad spice rotation model\n";
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Could not load SPICE rotation model\n");
|
||||
GetLogger()->error("Bad spice rotation model\nCould not load SPICE rotation model\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1099,7 +1097,7 @@ CreateRotationModel(Hash* planetData,
|
|||
{
|
||||
if (scriptedRotationValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect scripted rotation syntax.\n";
|
||||
GetLogger()->error("Object has incorrect scripted rotation syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1112,8 +1110,7 @@ CreateRotationModel(Hash* planetData,
|
|||
string sampOrientationFile;
|
||||
if (planetData->getString("SampledOrientation", sampOrientationFile))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_INFO, "Attempting to load orientation file '%s'\n",
|
||||
sampOrientationFile.c_str());
|
||||
GetLogger()->verbose("Attempting to load orientation file '{}'\n", sampOrientationFile);
|
||||
ResourceHandle orientationHandle =
|
||||
GetRotationModelManager()->getHandle(RotationModelInfo(sampOrientationFile, path));
|
||||
rotationModel = GetRotationModelManager()->find(orientationHandle);
|
||||
|
@ -1122,8 +1119,7 @@ CreateRotationModel(Hash* planetData,
|
|||
return rotationModel;
|
||||
}
|
||||
|
||||
clog << "Could not load rotation model file '" <<
|
||||
sampOrientationFile << "'\n";
|
||||
GetLogger()->error("Could not load rotation model file '{}'\n", sampOrientationFile);
|
||||
}
|
||||
|
||||
Value* precessingRotationValue = planetData->getValue("PrecessingRotation");
|
||||
|
@ -1131,7 +1127,7 @@ CreateRotationModel(Hash* planetData,
|
|||
{
|
||||
if (precessingRotationValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect syntax for precessing rotation.\n";
|
||||
GetLogger()->error("Object has incorrect syntax for precessing rotation.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1144,7 +1140,7 @@ CreateRotationModel(Hash* planetData,
|
|||
{
|
||||
if (uniformRotationValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect UniformRotation syntax.\n";
|
||||
GetLogger()->error("Object has incorrect UniformRotation syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
return CreateUniformRotationModel(uniformRotationValue->getHash(),
|
||||
|
@ -1156,7 +1152,7 @@ CreateRotationModel(Hash* planetData,
|
|||
{
|
||||
if (fixedRotationValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect FixedRotation syntax.\n";
|
||||
GetLogger()->error("Object has incorrect FixedRotation syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1168,7 +1164,7 @@ CreateRotationModel(Hash* planetData,
|
|||
{
|
||||
if (fixedAttitudeValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect FixedAttitude syntax.\n";
|
||||
GetLogger()->error("Object has incorrect FixedAttitude syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1288,14 +1284,14 @@ getFrameCenter(const Universe& universe, Hash* frameData, const Selection& defau
|
|||
if (!frameData->getString("Center", centerName))
|
||||
{
|
||||
if (defaultCenter.empty())
|
||||
cerr << "No center specified for reference frame.\n";
|
||||
GetLogger()->warn("No center specified for reference frame.\n");
|
||||
return defaultCenter;
|
||||
}
|
||||
|
||||
Selection centerObject = universe.findPath(centerName, nullptr, 0);
|
||||
if (centerObject.empty())
|
||||
{
|
||||
cerr << "Center object '" << centerName << "' of reference frame not found.\n";
|
||||
GetLogger()->error("Center object '{}' of reference frame not found.\n", centerName);
|
||||
return Selection();
|
||||
}
|
||||
|
||||
|
@ -1336,12 +1332,12 @@ CreateMeanEquatorFrame(const Universe& universe,
|
|||
obj = universe.findPath(objName, nullptr, 0);
|
||||
if (obj.empty())
|
||||
{
|
||||
clog << "Object '" << objName << "' for mean equator frame not found.\n";
|
||||
GetLogger()->error("Object '{}' for mean equator frame not found.\n", objName);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
clog << "CreateMeanEquatorFrame " << center.getName() << ", " << obj.getName() << "\n";
|
||||
GetLogger()->debug("CreateMeanEquatorFrame {}, {}\n", center.getName(), obj.getName());
|
||||
|
||||
double freezeEpoch = 0.0;
|
||||
BodyMeanEquatorFrame *ptr;
|
||||
|
@ -1408,14 +1404,14 @@ getAxis(Hash* vectorData)
|
|||
string axisLabel;
|
||||
if (!vectorData->getString("Axis", axisLabel))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Bad two-vector frame: missing axis label for vector.\n");
|
||||
GetLogger()->error("Bad two-vector frame: missing axis label for vector.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int axis = parseAxisLabel(axisLabel);
|
||||
if (axis == 0)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Bad two-vector frame: vector has invalid axis label.\n");
|
||||
GetLogger()->error("Bad two-vector frame: vector has invalid axis label.\n");
|
||||
}
|
||||
|
||||
// Permute axis labels to match non-standard Celestia coordinate
|
||||
|
@ -1448,14 +1444,15 @@ getVectorTarget(const Universe& universe, Hash* vectorData)
|
|||
string targetName;
|
||||
if (!vectorData->getString("Target", targetName))
|
||||
{
|
||||
clog << "Bad two-vector frame: no target specified for vector.\n";
|
||||
GetLogger()->warn("Bad two-vector frame: no target specified for vector.\n");
|
||||
return Selection();
|
||||
}
|
||||
|
||||
Selection targetObject = universe.findPath(targetName, nullptr, 0);
|
||||
if (targetObject.empty())
|
||||
{
|
||||
clog << "Bad two-vector frame: target object '" << targetName << "' of vector not found.\n";
|
||||
GetLogger()->warn("Bad two-vector frame: target object '{}' of vector not found.\n",
|
||||
targetName);
|
||||
return Selection();
|
||||
}
|
||||
|
||||
|
@ -1481,7 +1478,8 @@ getVectorObserver(const Universe& universe, Hash* vectorData)
|
|||
Selection obsObject = universe.findPath(obsName, nullptr, 0);
|
||||
if (obsObject.empty())
|
||||
{
|
||||
clog << "Bad two-vector frame: observer object '" << obsObject.getName() << "' of vector not found.\n";
|
||||
GetLogger()->warn("Bad two-vector frame: observer object '{}' of vector not found.\n",
|
||||
obsObject.getName());
|
||||
return Selection();
|
||||
}
|
||||
|
||||
|
@ -1536,7 +1534,7 @@ CreateFrameVector(const Universe& universe,
|
|||
constVecData->getVector("Vector", vec);
|
||||
if (vec.norm() == 0.0)
|
||||
{
|
||||
clog << "Bad two-vector frame: constant vector has length zero\n";
|
||||
GetLogger()->error("Bad two-vector frame: constant vector has length zero\n");
|
||||
return nullptr;
|
||||
}
|
||||
vec.normalize();
|
||||
|
@ -1557,7 +1555,7 @@ CreateFrameVector(const Universe& universe,
|
|||
}
|
||||
else
|
||||
{
|
||||
clog << "Bad two-vector frame: unknown vector type\n";
|
||||
GetLogger()->error("Bad two-vector frame: unknown vector type\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1576,28 +1574,28 @@ CreateTwoVectorFrame(const Universe& universe,
|
|||
Value* primaryValue = frameData->getValue("Primary");
|
||||
if (primaryValue == nullptr)
|
||||
{
|
||||
clog << "Primary axis missing from two-vector frame.\n";
|
||||
GetLogger()->error("Primary axis missing from two-vector frame.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Hash* primaryData = primaryValue->getHash();
|
||||
if (primaryData == nullptr)
|
||||
{
|
||||
clog << "Bad syntax for primary axis of two-vector frame.\n";
|
||||
GetLogger()->error("Bad syntax for primary axis of two-vector frame.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Value* secondaryValue = frameData->getValue("Secondary");
|
||||
if (secondaryValue == nullptr)
|
||||
{
|
||||
clog << "Secondary axis missing from two-vector frame.\n";
|
||||
GetLogger()->error("Secondary axis missing from two-vector frame.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Hash* secondaryData = secondaryValue->getHash();
|
||||
if (secondaryData == nullptr)
|
||||
{
|
||||
clog << "Bad syntax for secondary axis of two-vector frame.\n";
|
||||
GetLogger()->error("Bad syntax for secondary axis of two-vector frame.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1614,7 +1612,7 @@ CreateTwoVectorFrame(const Universe& universe,
|
|||
|
||||
if (abs(primaryAxis) == abs(secondaryAxis))
|
||||
{
|
||||
clog << "Bad two-vector frame: axes for vectors are collinear.\n";
|
||||
GetLogger()->error("Bad two-vector frame: axes for vectors are collinear.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1741,7 +1739,7 @@ CreateTopocentricFrame(const Universe& universe,
|
|||
center = universe.findPath(centerName, nullptr, 0);
|
||||
if (center.empty())
|
||||
{
|
||||
cerr << "Center object '" << centerName << "' for topocentric frame not found.\n";
|
||||
GetLogger()->error("Center object '{}' for topocentric frame not found.\n", centerName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1763,7 +1761,7 @@ CreateTopocentricFrame(const Universe& universe,
|
|||
{
|
||||
if (target.empty())
|
||||
{
|
||||
cerr << "No target specified for topocentric frame.\n";
|
||||
GetLogger()->error("No target specified for topocentric frame.\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1772,7 +1770,7 @@ CreateTopocentricFrame(const Universe& universe,
|
|||
target = universe.findPath(targetName, nullptr, 0);
|
||||
if (target.empty())
|
||||
{
|
||||
cerr << "Target object '" << targetName << "' for topocentric frame not found.\n";
|
||||
GetLogger()->error("Target object '{}' for topocentric frame not found.\n", targetName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1786,7 +1784,7 @@ CreateTopocentricFrame(const Universe& universe,
|
|||
{
|
||||
if (observer.empty())
|
||||
{
|
||||
cerr << "No observer specified for topocentric frame.\n";
|
||||
GetLogger()->error("No observer specified for topocentric frame.\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1795,7 +1793,7 @@ CreateTopocentricFrame(const Universe& universe,
|
|||
observer = universe.findPath(observerName, nullptr, 0);
|
||||
if (observer.empty())
|
||||
{
|
||||
cerr << "Observer object '" << observerName << "' for topocentric frame not found.\n";
|
||||
GetLogger()->error("Observer object '{}' for topocentric frame not found.\n", observerName);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1812,7 +1810,7 @@ CreateComplexFrame(const Universe& universe, Hash* frameData, const Selection& d
|
|||
{
|
||||
if (value->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect body-fixed frame syntax.\n";
|
||||
GetLogger()->error("Object has incorrect body-fixed frame syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1824,7 +1822,7 @@ CreateComplexFrame(const Universe& universe, Hash* frameData, const Selection& d
|
|||
{
|
||||
if (value->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect mean equator frame syntax.\n";
|
||||
GetLogger()->error("Object has incorrect mean equator frame syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1836,7 +1834,7 @@ CreateComplexFrame(const Universe& universe, Hash* frameData, const Selection& d
|
|||
{
|
||||
if (value->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect two-vector frame syntax.\n";
|
||||
GetLogger()->error("Object has incorrect two-vector frame syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1848,7 +1846,7 @@ CreateComplexFrame(const Universe& universe, Hash* frameData, const Selection& d
|
|||
{
|
||||
if (value->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect topocentric frame syntax.\n";
|
||||
GetLogger()->error("Object has incorrect topocentric frame syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1860,7 +1858,7 @@ CreateComplexFrame(const Universe& universe, Hash* frameData, const Selection& d
|
|||
{
|
||||
if (value->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect J2000 ecliptic frame syntax.\n";
|
||||
GetLogger()->error("Object has incorrect J2000 ecliptic frame syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1872,14 +1870,14 @@ CreateComplexFrame(const Universe& universe, Hash* frameData, const Selection& d
|
|||
{
|
||||
if (value->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Object has incorrect J2000 equator frame syntax.\n";
|
||||
GetLogger()->error("Object has incorrect J2000 equator frame syntax.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return CreateJ2000EquatorFrame(universe, value->getHash(), defaultCenter);
|
||||
}
|
||||
|
||||
clog << "Frame definition does not have a valid frame type.\n";
|
||||
GetLogger()->error("Frame definition does not have a valid frame type.\n");
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1893,12 +1891,12 @@ ReferenceFrame::SharedConstPtr CreateReferenceFrame(const Universe& universe,
|
|||
if (frameValue->getType() == Value::StringType)
|
||||
{
|
||||
// TODO: handle named frames
|
||||
clog << "Invalid syntax for frame definition.\n";
|
||||
GetLogger()->error("Invalid syntax for frame definition.\n");
|
||||
return nullptr;
|
||||
}
|
||||
if (frameValue->getType() != Value::HashType)
|
||||
{
|
||||
clog << "Invalid syntax for frame definition.\n";
|
||||
GetLogger()->error("Invalid syntax for frame definition.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <cmath>
|
||||
#include <Eigen/Geometry>
|
||||
#include <celmath/intersect.h>
|
||||
#include <celutil/debug.h>
|
||||
#include "body.h"
|
||||
#include "planetgrid.h"
|
||||
#include "render.h"
|
||||
|
|
|
@ -73,7 +73,7 @@ std::ofstream hdrlog;
|
|||
#include <celmath/distance.h>
|
||||
#include <celmath/intersect.h>
|
||||
#include <celmath/geomutil.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/utf8.h>
|
||||
#include <celutil/timer.h>
|
||||
#include <celttf/truetypefont.h>
|
||||
|
@ -98,6 +98,7 @@ using namespace Eigen;
|
|||
using namespace std;
|
||||
using namespace celestia;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
#define FOV 45.0f
|
||||
#define NEAR_DIST 0.5f
|
||||
|
@ -5802,7 +5803,7 @@ Renderer::createShadowFBO()
|
|||
FramebufferObject::DepthAttachment));
|
||||
if (!m_shadowFBO->isValid())
|
||||
{
|
||||
clog << "Error creating shadow FBO.\n";
|
||||
GetLogger()->warn("Error creating shadow FBO.\n");
|
||||
m_shadowFBO = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#include "rotationmanager.h"
|
||||
#include <config.h>
|
||||
#include <celephem/samporient.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
static RotationModelManager* rotationModelManager = nullptr;
|
||||
|
||||
|
@ -44,7 +44,7 @@ fs::path RotationModelInfo::resolve(const fs::path& baseDir)
|
|||
|
||||
RotationModel* RotationModelInfo::load(const fs::path& filename)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_INFO, "Loading rotation model: %s\n", filename);
|
||||
GetLogger()->verbose("Loading rotation model: {}\n", filename);
|
||||
|
||||
return LoadSampledOrientation(filename);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <celutil/debug.h>
|
||||
#include <cassert>
|
||||
#include "astro.h"
|
||||
#include "selection.h"
|
||||
|
|
|
@ -15,12 +15,11 @@
|
|||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <tuple>
|
||||
#include <fmt/ostream.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <Eigen/Geometry>
|
||||
#include <celcompat/filesystem.h>
|
||||
#include <celmath/geomutil.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "glsupport.h"
|
||||
#include "vecgl.h"
|
||||
#include "shadermanager.h"
|
||||
|
@ -29,6 +28,7 @@
|
|||
using namespace celestia;
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
// GLSL on Mac OS X appears to have a bug that precludes us from using structs
|
||||
#define USE_GLSL_STRUCTS
|
||||
|
@ -410,21 +410,21 @@ ShaderManager::getShader(const string& name)
|
|||
uintmax_t fsSize = fs::file_size(fsName, ecf);
|
||||
if (ecv || ecf)
|
||||
{
|
||||
fmt::print(cerr, "Failed to get file size of {} or {}\n", vsName, fsName);
|
||||
GetLogger()->error("Failed to get file size of {} or {}\n", vsName, fsName);
|
||||
return getShader(name, errorVertexShaderSource, errorFragmentShaderSource);
|
||||
}
|
||||
|
||||
ifstream vsf(vsName.string());
|
||||
if (!vsf.good())
|
||||
{
|
||||
fmt::print(cerr, "Failed to open {}\n", vsName);
|
||||
GetLogger()->error("Failed to open {}\n", vsName);
|
||||
return getShader(name, errorVertexShaderSource, errorFragmentShaderSource);
|
||||
}
|
||||
|
||||
ifstream fsf(fsName.string());
|
||||
if (!fsf.good())
|
||||
{
|
||||
fmt::print(cerr, "Failed to open {}\n", fsName);
|
||||
GetLogger()->error("Failed to open {}\n", fsName);
|
||||
return getShader(name, errorVertexShaderSource, errorFragmentShaderSource);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,13 +15,12 @@
|
|||
#include <limits>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <fmt/ostream.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
#include "astro.h"
|
||||
#include "parser.h"
|
||||
#include <celutil/tokenizer.h>
|
||||
#include "texmanager.h"
|
||||
#include "meshmanager.h"
|
||||
#include "universe.h"
|
||||
|
@ -35,6 +34,7 @@
|
|||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
enum BodyType
|
||||
{
|
||||
|
@ -78,16 +78,11 @@ enum BodyType
|
|||
The name and parent name are both mandatory.
|
||||
*/
|
||||
|
||||
static void errorMessagePrelude(const Tokenizer& tok)
|
||||
{
|
||||
cerr << fmt::sprintf(_("Error in .ssc file (line %d): "), tok.getLineNumber());
|
||||
}
|
||||
|
||||
static void sscError(const Tokenizer& tok,
|
||||
const string& msg)
|
||||
{
|
||||
errorMessagePrelude(tok);
|
||||
cerr << msg << '\n';
|
||||
GetLogger()->error(_("Error in .ssc file (line {}): {}\n"),
|
||||
tok.getLineNumber(), msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -296,7 +291,7 @@ TimelinePhase::SharedConstPtr CreateTimelinePhase(Body* body,
|
|||
bool hasBeginning = ParseDate(phaseData, "Beginning", beginning);
|
||||
if (!isFirstPhase && hasBeginning)
|
||||
{
|
||||
clog << "Error: Beginning can only be specified for initial phase of timeline.\n";
|
||||
GetLogger()->error("Error: Beginning can only be specified for initial phase of timeline.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -304,7 +299,7 @@ TimelinePhase::SharedConstPtr CreateTimelinePhase(Body* body,
|
|||
bool hasEnding = ParseDate(phaseData, "Ending", ending);
|
||||
if (!isLastPhase && !hasEnding)
|
||||
{
|
||||
clog << "Error: Ending is required for all timeline phases other than the final one.\n";
|
||||
GetLogger()->error("Error: Ending is required for all timeline phases other than the final one.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -350,7 +345,7 @@ TimelinePhase::SharedConstPtr CreateTimelinePhase(Body* body,
|
|||
Orbit* orbit = CreateOrbit(orbitFrame->getCenter(), phaseData, path, usePlanetUnits);
|
||||
if (!orbit)
|
||||
{
|
||||
clog << "Error: missing orbit in timeline phase.\n";
|
||||
GetLogger()->error("Error: missing orbit in timeline phase.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -395,7 +390,7 @@ Timeline* CreateTimelineFromArray(Body* body,
|
|||
Hash* phaseData = (*iter)->getHash();
|
||||
if (phaseData == nullptr)
|
||||
{
|
||||
clog << "Error in timeline of '" << body->getName() << "': phase " << iter - timelineArray->begin() + 1 << " is not a property group.\n";
|
||||
GetLogger()->error("Error in timeline of '{}': phase {} is not a property group.\n", body->getName(), iter - timelineArray->begin() + 1);
|
||||
delete timeline;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -410,7 +405,9 @@ Timeline* CreateTimelineFromArray(Body* body,
|
|||
isFirstPhase, isLastPhase, previousEnding);
|
||||
if (phase == nullptr)
|
||||
{
|
||||
clog << "Error in timeline of '" << body->getName() << "', phase " << iter - timelineArray->begin() + 1 << endl;
|
||||
GetLogger()->error("Error in timeline of '{}', phase {}.\n",
|
||||
body->getName(),
|
||||
iter - timelineArray->begin() + 1);
|
||||
delete timeline;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -473,7 +470,7 @@ static bool CreateTimeline(Body* body,
|
|||
{
|
||||
if (value->getType() != Value::ArrayType)
|
||||
{
|
||||
clog << "Error: Timeline must be an array\n";
|
||||
GetLogger()->error("Error: Timeline must be an array\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -573,7 +570,7 @@ static bool CreateTimeline(Body* body,
|
|||
}
|
||||
else
|
||||
{
|
||||
clog << "No valid orbit specified for object '" << body->getName() << "'. Skipping.\n";
|
||||
GetLogger()->error("No valid orbit specified for object '{}'. Skipping.\n", body->getName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -619,7 +616,7 @@ static bool CreateTimeline(Body* body,
|
|||
{
|
||||
if (beginning >= ending)
|
||||
{
|
||||
clog << "Beginning time must be before Ending time.\n";
|
||||
GetLogger()->error("Beginning time must be before Ending time.\n");
|
||||
delete rotationModel;
|
||||
return false;
|
||||
}
|
||||
|
@ -639,7 +636,7 @@ static bool CreateTimeline(Body* body,
|
|||
assert(phase != nullptr);
|
||||
if (phase == nullptr)
|
||||
{
|
||||
clog << "Internal error creating TimelinePhase.\n";
|
||||
GetLogger()->error("Internal error creating TimelinePhase.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -654,13 +651,13 @@ static bool CreateTimeline(Body* body,
|
|||
// multiphase timelines.
|
||||
if (newOrbitFrame && isFrameCircular(*body->getOrbitFrame(0.0), ReferenceFrame::PositionFrame))
|
||||
{
|
||||
clog << "Orbit frame for " << body->getName() << " is nested too deep (probably circular)\n";
|
||||
GetLogger()->error("Orbit frame for '{}' is nested too deep (probably circular)\n", body->getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newBodyFrame && isFrameCircular(*body->getBodyFrame(0.0), ReferenceFrame::OrientationFrame))
|
||||
{
|
||||
clog << "Body frame for " << body->getName() << " is nested too deep (probably circular)\n";
|
||||
GetLogger()->error("Body frame for '{}' is nested too deep (probably circular)\n", body->getName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -799,7 +796,7 @@ static Body* CreateBody(const string& name,
|
|||
{
|
||||
// Relative URL, the base directory is the current one,
|
||||
// not the main installation directory
|
||||
const string &p = path.string();
|
||||
string p = path.string();
|
||||
if (p[1] == ':')
|
||||
// Absolute Windows path, file:/// is required
|
||||
infoURL = "file:///" + p + "/" + infoURL;
|
||||
|
@ -812,7 +809,8 @@ static Body* CreateBody(const string& name,
|
|||
double t;
|
||||
if (planetData->getNumber("Albedo", t))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_WARNING, "Deprecated parameter Albedo used in %s definition.\nUse GeomAlbedo & BondAlbedo instead.\n", name);
|
||||
// TODO: make this warn
|
||||
GetLogger()->verbose("Deprecated parameter Albedo used in {} definition.\nUse GeomAlbedo & BondAlbedo instead.\n", name);
|
||||
body->setGeomAlbedo((float) t);
|
||||
}
|
||||
|
||||
|
@ -829,7 +827,7 @@ static Body* CreateBody(const string& name,
|
|||
}
|
||||
else
|
||||
{
|
||||
fmt::print(cerr, _("Incorrect GeomAlbedo value: {}\n"), t);
|
||||
GetLogger()->error(_("Incorrect GeomAlbedo value: {}\n"), t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -838,7 +836,7 @@ static Body* CreateBody(const string& name,
|
|||
if (t >= 0.0 && t <= 1.0)
|
||||
body->setReflectivity((float) t);
|
||||
else
|
||||
fmt::print(cerr, _("Incorrect Reflectivity value: {}\n"), t);
|
||||
GetLogger()->error(_("Incorrect Reflectivity value: {}\n"), t);
|
||||
}
|
||||
|
||||
if (planetData->getNumber("BondAlbedo", t))
|
||||
|
@ -846,7 +844,7 @@ static Body* CreateBody(const string& name,
|
|||
if (t >= 0.0 && t <= 1.0)
|
||||
body->setBondAlbedo((float) t);
|
||||
else
|
||||
fmt::print(cerr, _("Incorrect BondAlbedo value: {}\n"), t);
|
||||
GetLogger()->error(_("Incorrect BondAlbedo value: {}\n"), t);
|
||||
}
|
||||
|
||||
if (planetData->getNumber("Temperature", t))
|
||||
|
@ -1249,8 +1247,7 @@ bool LoadSolarSystemObjects(istream& in,
|
|||
}
|
||||
else
|
||||
{
|
||||
errorMessagePrelude(tokenizer);
|
||||
cerr << fmt::sprintf(_("parent body '%s' of '%s' not found.\n"), parentName, primaryName);
|
||||
sscError(tokenizer, fmt::sprintf(_("parent body '%s' of '%s' not found.\n"), parentName, primaryName));
|
||||
}
|
||||
|
||||
if (parentSystem != nullptr)
|
||||
|
@ -1260,8 +1257,7 @@ bool LoadSolarSystemObjects(istream& in,
|
|||
{
|
||||
if (disposition == DataDisposition::Add)
|
||||
{
|
||||
errorMessagePrelude(tokenizer);
|
||||
cerr << fmt::sprintf(_("warning duplicate definition of %s %s\n"), parentName, primaryName);
|
||||
sscError(tokenizer, fmt::sprintf(_("warning duplicate definition of %s %s\n"), parentName, primaryName));
|
||||
}
|
||||
else if (disposition == DataDisposition::Replace)
|
||||
{
|
||||
|
@ -1312,8 +1308,7 @@ bool LoadSolarSystemObjects(istream& in,
|
|||
}
|
||||
else
|
||||
{
|
||||
errorMessagePrelude(tokenizer);
|
||||
cerr << fmt::sprintf(_("parent body '%s' of '%s' not found.\n"), parentName, primaryName);
|
||||
sscError(tokenizer, fmt::sprintf(_("parent body '%s' of '%s' not found.\n"), parentName, primaryName));
|
||||
}
|
||||
}
|
||||
delete objectDataValue;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <celmath/mathlib.h>
|
||||
#include <celengine/selection.h>
|
||||
#include <cassert>
|
||||
#include <celutil/debug.h>
|
||||
#include <config.h>
|
||||
#include "astro.h"
|
||||
#include "star.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <algorithm>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celutil/binaryread.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
#include "stardb.h"
|
||||
|
@ -31,6 +31,7 @@
|
|||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
namespace celutil = celestia::util;
|
||||
|
||||
|
@ -580,7 +581,7 @@ bool StarDatabase::loadCrossIndex(const Catalog catalog, istream& in)
|
|||
if (!in.read(header, headerLength).good()
|
||||
|| strncmp(header, CROSSINDEX_FILE_HEADER, headerLength))
|
||||
{
|
||||
cerr << _("Bad header for cross index\n");
|
||||
GetLogger()->error(_("Bad header for cross index\n"));
|
||||
delete[] header;
|
||||
return false;
|
||||
}
|
||||
|
@ -592,7 +593,7 @@ bool StarDatabase::loadCrossIndex(const Catalog catalog, istream& in)
|
|||
std::uint16_t version;
|
||||
if (!celutil::readLE<std::uint16_t>(in, version) || version != 0x0100)
|
||||
{
|
||||
std::cerr << _("Bad version for cross index\n");
|
||||
GetLogger()->error(_("Bad version for cross index\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -606,14 +607,14 @@ bool StarDatabase::loadCrossIndex(const Catalog catalog, istream& in)
|
|||
if (!celutil::readLE<AstroCatalog::IndexNumber>(in, ent.catalogNumber))
|
||||
{
|
||||
if (in.eof()) { break; }
|
||||
std::cerr << _("Loading cross index failed\n");
|
||||
GetLogger()->error(_("Loading cross index failed\n"));
|
||||
delete xindex;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!celutil::readLE<AstroCatalog::IndexNumber>(in, ent.celCatalogNumber))
|
||||
{
|
||||
std::cerr << fmt::sprintf(_("Loading cross index failed at record %u\n"), record);
|
||||
GetLogger()->error(_("Loading cross index failed at record {}\n"), record);
|
||||
delete xindex;
|
||||
return false;
|
||||
}
|
||||
|
@ -691,7 +692,7 @@ bool StarDatabase::loadBinary(istream& in)
|
|||
|
||||
if (details == nullptr)
|
||||
{
|
||||
cerr << fmt::sprintf(_("Bad spectral type in star database, star #%u\n"), nStars);
|
||||
GetLogger()->error(_("Bad spectral type in star database, star #{}\n"), nStars);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -705,8 +706,8 @@ bool StarDatabase::loadBinary(istream& in)
|
|||
if (in.bad())
|
||||
return false;
|
||||
|
||||
DPRINTF(LOG_LEVEL_ERROR, "StarDatabase::read: nStars = %d\n", nStarsInFile);
|
||||
clog << fmt::sprintf(_("%d stars in binary database\n"), nStars);
|
||||
GetLogger()->debug("StarDatabase::read: nStars = {}\n", nStarsInFile);
|
||||
GetLogger()->info(_("{} stars in binary database\n"), nStars);
|
||||
|
||||
// Create the temporary list of stars sorted by catalog number; this
|
||||
// will be used to lookup stars during file loading. After loading is
|
||||
|
@ -730,7 +731,7 @@ bool StarDatabase::loadBinary(istream& in)
|
|||
|
||||
void StarDatabase::finish()
|
||||
{
|
||||
clog << fmt::sprintf(_("Total star count: %d\n"), nStars);
|
||||
GetLogger()->info(_("Total star count: {}\n"), nStars);
|
||||
|
||||
buildOctree();
|
||||
buildIndexes();
|
||||
|
@ -764,7 +765,7 @@ void StarDatabase::finish()
|
|||
static void stcError(const Tokenizer& tok,
|
||||
const string& msg)
|
||||
{
|
||||
cerr << fmt::sprintf( _("Error in .stc file (line %i): %s\n"), tok.getLineNumber(), msg);
|
||||
GetLogger()->error(_("Error in .stc file (line {}): {}\n"), tok.getLineNumber(), msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -794,7 +795,7 @@ bool StarDatabase::createStar(Star* star,
|
|||
details = StarDetails::GetStarDetails(sc);
|
||||
if (details == nullptr)
|
||||
{
|
||||
cerr << _("Invalid star: bad spectral type.\n");
|
||||
GetLogger()->error(_("Invalid star: bad spectral type.\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -803,7 +804,7 @@ bool StarDatabase::createStar(Star* star,
|
|||
// Spectral type is required for new stars
|
||||
if (disposition != DataDisposition::Modify)
|
||||
{
|
||||
cerr << _("Invalid star: missing spectral type.\n");
|
||||
GetLogger()->error(_("Invalid star: missing spectral type.\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +991,7 @@ bool StarDatabase::createStar(Star* star,
|
|||
|
||||
if (!hasBarycenter)
|
||||
{
|
||||
cerr << fmt::sprintf(_("Barycenter %s does not exist.\n"), barycenterName);
|
||||
GetLogger()->error(_("Barycenter {} does not exist.\n"), barycenterName);
|
||||
delete rm;
|
||||
if (free_details)
|
||||
delete details;
|
||||
|
@ -1046,7 +1047,7 @@ bool StarDatabase::createStar(Star* star,
|
|||
{
|
||||
if (disposition != DataDisposition::Modify)
|
||||
{
|
||||
cerr << _("Invalid star: missing right ascension\n");
|
||||
GetLogger()->error(_("Invalid star: missing right ascension\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1059,7 +1060,7 @@ bool StarDatabase::createStar(Star* star,
|
|||
{
|
||||
if (disposition != DataDisposition::Modify)
|
||||
{
|
||||
cerr << _("Invalid star: missing declination.\n");
|
||||
GetLogger()->error(_("Invalid star: missing declination.\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1072,7 +1073,7 @@ bool StarDatabase::createStar(Star* star,
|
|||
{
|
||||
if (disposition != DataDisposition::Modify)
|
||||
{
|
||||
cerr << _("Invalid star: missing distance.\n");
|
||||
GetLogger()->error(_("Invalid star: missing distance.\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1106,7 +1107,7 @@ bool StarDatabase::createStar(Star* star,
|
|||
{
|
||||
if (disposition != DataDisposition::Modify)
|
||||
{
|
||||
clog << _("Invalid star: missing magnitude.\n");
|
||||
GetLogger()->error(_("Invalid star: missing magnitude.\n"));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -1123,7 +1124,7 @@ bool StarDatabase::createStar(Star* star,
|
|||
// origin.
|
||||
if (distance < 1e-5f)
|
||||
{
|
||||
clog << _("Invalid star: absolute (not apparent) magnitude must be specified for star near origin\n");
|
||||
GetLogger()->error(_("Invalid star: absolute (not apparent) magnitude must be specified for star near origin\n"));
|
||||
return false;
|
||||
}
|
||||
magnitude = astro::appToAbsMag(magnitude, distance);
|
||||
|
@ -1320,13 +1321,13 @@ bool StarDatabase::load(istream& in, const fs::path& resourcePath)
|
|||
Value* starDataValue = parser.readValue();
|
||||
if (starDataValue == nullptr)
|
||||
{
|
||||
clog << "Error reading star.\n";
|
||||
GetLogger()->error("Error reading star.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (starDataValue->getType() != Value::HashType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Bad star definition.\n");
|
||||
GetLogger()->error("Bad star definition.\n");
|
||||
delete starDataValue;
|
||||
return false;
|
||||
}
|
||||
|
@ -1338,7 +1339,7 @@ bool StarDatabase::load(istream& in, const fs::path& resourcePath)
|
|||
bool ok = false;
|
||||
if (isNewStar && disposition == DataDisposition::Modify)
|
||||
{
|
||||
clog << "Modify requested for nonexistent star.\n";
|
||||
GetLogger()->warn("Modify requested for nonexistent star.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1388,7 +1389,7 @@ bool StarDatabase::load(istream& in, const fs::path& resourcePath)
|
|||
{
|
||||
if (isNewStar)
|
||||
delete star;
|
||||
DPRINTF(LOG_LEVEL_INFO, "Bad star definition--will continue parsing file.\n");
|
||||
GetLogger()->info("Bad star definition--will continue parsing file.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1402,7 @@ void StarDatabase::buildOctree()
|
|||
// This should only be called once for the database
|
||||
// ASSERT(octreeRoot == nullptr);
|
||||
|
||||
DPRINTF(LOG_LEVEL_INFO, "Sorting stars into octree . . .\n");
|
||||
GetLogger()->debug("Sorting stars into octree . . .\n");
|
||||
float absMag = astro::appToAbsMag(STAR_OCTREE_MAGNITUDE,
|
||||
STAR_OCTREE_ROOT_SIZE * (float) sqrt(3.0));
|
||||
DynamicStarOctree* root = new DynamicStarOctree(Vector3f(1000.0f, 1000.0f, 1000.0f),
|
||||
|
@ -1411,15 +1412,15 @@ void StarDatabase::buildOctree()
|
|||
root->insertObject(unsortedStars[i], STAR_OCTREE_ROOT_SIZE);
|
||||
}
|
||||
|
||||
DPRINTF(LOG_LEVEL_INFO, "Spatially sorting stars for improved locality of reference . . .\n");
|
||||
GetLogger()->debug("Spatially sorting stars for improved locality of reference . . .\n");
|
||||
Star* sortedStars = new Star[nStars];
|
||||
Star* firstStar = sortedStars;
|
||||
root->rebuildAndSort(octreeRoot, firstStar);
|
||||
|
||||
// ASSERT((int) (firstStar - sortedStars) == nStars);
|
||||
DPRINTF(LOG_LEVEL_INFO, "%d stars total\n", (int) (firstStar - sortedStars));
|
||||
DPRINTF(LOG_LEVEL_INFO, "Octree has %d nodes and %d stars.\n",
|
||||
1 + octreeRoot->countChildren(), octreeRoot->countObjects());
|
||||
GetLogger()->debug("{} stars total\nOctree has {} nodes and {} stars.\n",
|
||||
static_cast<int>(firstStar - sortedStars),
|
||||
1 + octreeRoot->countChildren(), octreeRoot->countObjects());
|
||||
#ifdef PROFILE_OCTREE
|
||||
vector<OctreeLevelStatistics> stats;
|
||||
octreeRoot->computeStatistics(stats);
|
||||
|
@ -1450,7 +1451,7 @@ void StarDatabase::buildIndexes()
|
|||
// This should only be called once for the database
|
||||
// assert(catalogNumberIndexes[0] == nullptr);
|
||||
|
||||
DPRINTF(LOG_LEVEL_INFO, "Building catalog number indexes . . .\n");
|
||||
GetLogger()->info("Building catalog number indexes . . .\n");
|
||||
|
||||
catalogNumberIndex = new Star*[nStars];
|
||||
for (int i = 0; i < nStars; ++i)
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <cstring>
|
||||
#include <fmt/printf.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <cassert>
|
||||
#include <config.h>
|
||||
#include "stellarclass.h"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/fsutils.h>
|
||||
#include <fstream>
|
||||
#include <array>
|
||||
|
@ -16,6 +16,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace celestia;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
static TextureManager* textureManager = nullptr;
|
||||
|
||||
|
@ -101,14 +102,10 @@ Texture* TextureInfo::load(const fs::path& name)
|
|||
|
||||
if (bumpHeight == 0.0f)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Loading texture: %s\n", name);
|
||||
// cout << "Loading texture: " << name << '\n';
|
||||
|
||||
GetLogger()->debug("Loading texture: {}\n", name);
|
||||
return LoadTextureFromFile(name, addressMode, mipMode);
|
||||
}
|
||||
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Loading bump map: %s\n", name);
|
||||
// cout << "Loading texture: " << name << '\n';
|
||||
|
||||
GetLogger()->debug("Loading bump map: {}\n", name);
|
||||
return LoadHeightMapFromFile(name, bumpHeight, addressMode);
|
||||
}
|
||||
|
|
|
@ -14,13 +14,12 @@
|
|||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <fmt/printf.h>
|
||||
#include <Eigen/Core>
|
||||
#include "glsupport.h"
|
||||
|
||||
#include <celutil/filetype.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "framebuffer.h"
|
||||
#include "texture.h"
|
||||
#include "virtualtex.h"
|
||||
|
@ -29,6 +28,7 @@
|
|||
using namespace celestia;
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
struct TextureCaps
|
||||
{
|
||||
|
@ -925,12 +925,14 @@ static Texture* CreateTextureFromImage(Image& img,
|
|||
// The texture is too large; we need to split it.
|
||||
int uSplit = max(1, img.getWidth() / maxDim);
|
||||
int vSplit = max(1, img.getHeight() / maxDim);
|
||||
clog << fmt::sprintf(_("Creating tiled texture. Width=%i, max=%i\n"), img.getWidth(), maxDim);
|
||||
GetLogger()->info(_("Creating tiled texture. Width={}, max={}\n"),
|
||||
img.getWidth(), maxDim);
|
||||
tex = new TiledTexture(img, uSplit, vSplit, mipMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
clog << fmt::sprintf(_("Creating ordinary texture: %ix%i\n"), img.getWidth(), img.getHeight());
|
||||
GetLogger()->info(_("Creating ordinary texture: {}x{}\n"),
|
||||
img.getWidth(), img.getHeight());
|
||||
tex = new ImageTexture(img, addressMode, mipMode);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,18 +8,16 @@
|
|||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <config.h>
|
||||
#include "trajmanager.h"
|
||||
#include <celephem/samporbit.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/filetype.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include <celutil/debug.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <celephem/samporbit.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/filetype.h>
|
||||
#include "trajmanager.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
static TrajectoryManager* trajectoryManager = nullptr;
|
||||
|
||||
|
@ -65,7 +63,7 @@ Orbit* TrajectoryInfo::load(const fs::path& filename)
|
|||
fs::path strippedFilename = filename.string().substr(0, uniquifyingSuffixStart);
|
||||
ContentType filetype = DetermineFileType(strippedFilename);
|
||||
|
||||
DPRINTF(LOG_LEVEL_INFO, "Loading trajectory: %s\n", strippedFilename);
|
||||
GetLogger()->debug("Loading trajectory: {}\n", strippedFilename);
|
||||
|
||||
Orbit* sampTrajectory = nullptr;
|
||||
|
||||
|
|
|
@ -15,17 +15,17 @@
|
|||
#include <string>
|
||||
#include <utility>
|
||||
#include <fmt/format.h>
|
||||
#include <celutil/debug.h>
|
||||
#include "glsupport.h"
|
||||
#include <celutil/debug.h>
|
||||
#include <celcompat/filesystem.h>
|
||||
#include <celutil/filetype.h>
|
||||
#include "parser.h"
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
#include "glsupport.h"
|
||||
#include "parser.h"
|
||||
#include "virtualtex.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
static const int MaxResolutionLevels = 13;
|
||||
|
||||
|
@ -317,7 +317,7 @@ static VirtualTexture* CreateVirtualTexture(Hash* texParams,
|
|||
string imageDirectory;
|
||||
if (!texParams->getString("ImageDirectory", imageDirectory))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "ImageDirectory missing in virtual texture.\n");
|
||||
GetLogger()->error("ImageDirectory missing in virtual texture.\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -325,14 +325,14 @@ static VirtualTexture* CreateVirtualTexture(Hash* texParams,
|
|||
if (!texParams->getNumber("BaseSplit", baseSplit) ||
|
||||
baseSplit < 0.0 || baseSplit != floor(baseSplit))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "BaseSplit in virtual texture missing or has bad value\n");
|
||||
GetLogger()->error("BaseSplit in virtual texture missing or has bad value\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
double tileSize = 0.0;
|
||||
if (!texParams->getNumber("TileSize", tileSize))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "TileSize is missing from virtual texture\n");
|
||||
GetLogger()->error("TileSize is missing from virtual texture\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ static VirtualTexture* CreateVirtualTexture(Hash* texParams,
|
|||
tileSize < 64.0 ||
|
||||
!isPow2((int) tileSize))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Virtual texture tile size must be a power of two >= 64\n");
|
||||
GetLogger()->error("Virtual texture tile size must be a power of two >= 64\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ static VirtualTexture* LoadVirtualTexture(istream& in, const fs::path& path)
|
|||
Value* texParamsValue = parser.readValue();
|
||||
if (texParamsValue == nullptr || texParamsValue->getType() != Value::HashType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing virtual texture\n");
|
||||
GetLogger()->error("Error parsing virtual texture\n");
|
||||
delete texParamsValue;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ VirtualTexture* LoadVirtualTexture(const fs::path& filename)
|
|||
|
||||
if (!in.good())
|
||||
{
|
||||
//DPRINTF(LOG_LEVEL_ERROR, "Error opening virtual texture file: %s\n", filename.c_str());
|
||||
GetLogger()->error("Error opening virtual texture file: {}\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,15 +13,15 @@
|
|||
#include <celengine/astro.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celmath/geomutil.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <celutil/debug.h>
|
||||
#include <fmt/ostream.h>
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
#define TWOPI 6.28318530717958647692
|
||||
|
@ -3164,11 +3164,11 @@ Orbit* GetCustomOrbit(const string& name)
|
|||
ephemType = fmt::format("DE{}", jpleph->getDENumber());
|
||||
else
|
||||
ephemType = "INPOP";
|
||||
fmt::print(clog, "Loaded {} ephemeris. Valid from JD {:.8f} to JD {:.8f}\n",
|
||||
ephemType, jpleph->getStartDate(), jpleph->getEndDate());
|
||||
fmt::print(clog, "Ephemeris record size: {} doubles, with {} endianess.\n",
|
||||
jpleph->getRecordSize(),
|
||||
jpleph->getByteSwap() ? "non-native" : "native");
|
||||
GetLogger()->debug("Loaded {} ephemeris. Valid from JD {:.8f} to JD {:.8f}\n",
|
||||
ephemType, jpleph->getStartDate(), jpleph->getEndDate());
|
||||
GetLogger()->debug("Ephemeris record size: {} doubles, with {} endianess.\n",
|
||||
jpleph->getRecordSize(),
|
||||
jpleph->getByteSwap() ? "non-native" : "native");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ double EllipticalOrbit::eccentricAnomaly(double M) const
|
|||
// much faster converging iteration.
|
||||
Solution sol = solve_iteration_fixed(SolveKeplerFunc2(eccentricity, M), M, 6);
|
||||
// Debugging
|
||||
// DPRINTF(LOG_LEVEL_INFO, "ecc: %f, error: %f mas\n",
|
||||
// GetLogger()->debug("ecc: {}, error: {} mas\n",
|
||||
// eccentricity, radToDeg(sol.second) * 3600000);
|
||||
return sol.first;
|
||||
}
|
||||
|
|
|
@ -13,13 +13,11 @@
|
|||
#include "orbit.h"
|
||||
#include "samporbit.h"
|
||||
#include "xyzvbinary.h"
|
||||
#include <fmt/ostream.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <celengine/astro.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celutil/bytes.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
@ -32,6 +30,7 @@
|
|||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
// Trajectories are sampled adaptively for rendering. MaxSampleInterval
|
||||
// is the maximum time (in days) between samples. The threshold angle
|
||||
|
@ -832,35 +831,35 @@ LoadSampledOrbitXYZVBinary(const fs::path& filename, TrajectoryInterpolation int
|
|||
ifstream in(filename.string(), ios::binary);
|
||||
if (!in.good())
|
||||
{
|
||||
cerr << fmt::sprintf(_("Error opening %s.\n"), filename);
|
||||
GetLogger()->error(_("Error opening {}.\n"), filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
XYZVBinaryHeader header;
|
||||
if (!in.read(reinterpret_cast<char*>(&header), sizeof(header)))
|
||||
{
|
||||
cerr << fmt::sprintf(_("Error reading header of %s.\n"), filename);
|
||||
GetLogger()->error(_("Error reading header of {}.\n"), filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (string(header.magic) != "CELXYZV")
|
||||
{
|
||||
cerr << fmt::sprintf(_("Bad binary xyzv file %s.\n"), filename);
|
||||
GetLogger()->error(_("Bad binary xyzv file {}.\n"), filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (header.byteOrder != __BYTE_ORDER__)
|
||||
{
|
||||
cerr << fmt::sprintf(_("Unsupported byte order %i, expected %i.\n"),
|
||||
header.byteOrder, __BYTE_ORDER__);
|
||||
GetLogger()->error(_("Unsupported byte order {}, expected {}.\n"),
|
||||
header.byteOrder, __BYTE_ORDER__);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
if (header.digits != std::numeric_limits<double>::digits)
|
||||
{
|
||||
cerr << fmt::sprintf(_("Unsupported digits number %i, expected %i.\n"),
|
||||
header.digits, std::numeric_limits<double>::digits);
|
||||
GetLogger()->error(_("Unsupported digits number {}, expected {}.\n"),
|
||||
header.digits, std::numeric_limits<double>::digits);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <celutil/debug.h>
|
||||
#include <fmt/printf.h>
|
||||
|
||||
#include "scriptobject.h"
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
#include <celutil/logger.h>
|
||||
#include "scriptobject.h"
|
||||
#include "scriptorbit.h"
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
/*! Initialize the script orbit.
|
||||
|
@ -53,7 +53,7 @@ ScriptedOrbit::initialize(const std::string& moduleName,
|
|||
luaState = GetScriptedObjectContext();
|
||||
if (luaState == nullptr)
|
||||
{
|
||||
clog << "ScriptedOrbits are currently disabled.\n";
|
||||
GetLogger()->warn("ScriptedOrbits are currently disabled.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ ScriptedOrbit::initialize(const std::string& moduleName,
|
|||
lua_getglobal(luaState, "require");
|
||||
if (!lua_isfunction(luaState, -1))
|
||||
{
|
||||
clog << "Cannot load ScriptedOrbit package: 'require' function is unavailable\n";
|
||||
GetLogger()->error("Cannot load ScriptedOrbit package: 'require' function is unavailable\n");
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ ScriptedOrbit::initialize(const std::string& moduleName,
|
|||
lua_pushstring(luaState, moduleName.c_str());
|
||||
if (lua_pcall(luaState, 1, 1, 0) != 0)
|
||||
{
|
||||
clog << "Failed to load module for ScriptedOrbit: " << lua_tostring(luaState, -1) << "\n";
|
||||
GetLogger()->error("Failed to load module for ScriptedOrbit: {}\n", lua_tostring(luaState, -1));
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ ScriptedOrbit::initialize(const std::string& moduleName,
|
|||
// No function with the requested name; pop whatever value we
|
||||
// did receive along with the table of arguments.
|
||||
lua_pop(luaState, 1);
|
||||
clog << "No Lua function named " << funcName << " found.\n";
|
||||
GetLogger()->error("No Lua function named {} found.\n", funcName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -97,8 +97,8 @@ ScriptedOrbit::initialize(const std::string& moduleName,
|
|||
if (lua_pcall(luaState, 1, 1, 0) != 0)
|
||||
{
|
||||
// Some sort of error occurred--the error message is atop the stack
|
||||
clog << "Error calling ScriptedOrbit generator function: " <<
|
||||
lua_tostring(luaState, -1) << "\n";
|
||||
GetLogger()->error("Error calling ScriptedOrbit generator function: {}\n",
|
||||
lua_tostring(luaState, -1));
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ ScriptedOrbit::initialize(const std::string& moduleName,
|
|||
{
|
||||
// We have an object, but it's not a table. Pop it off the
|
||||
// stack and report failure.
|
||||
clog << "ScriptedOrbit generator function returned bad value.\n";
|
||||
GetLogger()->error("ScriptedOrbit generator function returned bad value.\n");
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ ScriptedOrbit::initialize(const std::string& moduleName,
|
|||
lua_gettable(luaState, -2);
|
||||
if (lua_isnumber(luaState, -1) == 0)
|
||||
{
|
||||
clog << "Bad or missing boundingRadius for ScriptedOrbit object\n";
|
||||
GetLogger()->error("Bad or missing boundingRadius for ScriptedOrbit object\n");
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -143,13 +143,13 @@ ScriptedOrbit::initialize(const std::string& moduleName,
|
|||
// Perform some sanity checks on the orbit parameters
|
||||
if (validRangeEnd < validRangeBegin)
|
||||
{
|
||||
clog << "Bad script orbit: valid range end < begin\n";
|
||||
GetLogger()->error("Bad script orbit: valid range end < begin\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (boundingRadius <= 0.0)
|
||||
{
|
||||
clog << "Bad script object: bounding radius must be positive\n";
|
||||
GetLogger()->error("Bad script object: bounding radius must be positive\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
#include <celutil/logger.h>
|
||||
#include "scriptobject.h"
|
||||
#include "scriptrotation.h"
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
/*! Initialize the script rotation
|
||||
|
@ -51,7 +51,7 @@ ScriptedRotation::initialize(const std::string& moduleName,
|
|||
luaState = GetScriptedObjectContext();
|
||||
if (luaState == nullptr)
|
||||
{
|
||||
clog << "ScriptedRotations are currently disabled.\n";
|
||||
GetLogger()->warn("ScriptedRotations are currently disabled.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ ScriptedRotation::initialize(const std::string& moduleName,
|
|||
lua_getglobal(luaState, "require");
|
||||
if (!lua_isfunction(luaState, -1))
|
||||
{
|
||||
clog << "Cannot load ScriptedRotation package: 'require' function is unavailable\n";
|
||||
GetLogger()->error("Cannot load ScriptedRotation package: 'require' function is unavailable\n");
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ ScriptedRotation::initialize(const std::string& moduleName,
|
|||
lua_pushstring(luaState, moduleName.c_str());
|
||||
if (lua_pcall(luaState, 1, 1, 0) != 0)
|
||||
{
|
||||
clog << "Failed to load module for ScriptedRotation: " << lua_tostring(luaState, -1) << "\n";
|
||||
GetLogger()->error("Failed to load module for ScriptedRotation: {}\n", lua_tostring(luaState, -1));
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ ScriptedRotation::initialize(const std::string& moduleName,
|
|||
// No function with the requested name; pop whatever value we
|
||||
// did receive along with the table of arguments.
|
||||
lua_pop(luaState, 1);
|
||||
clog << "No Lua function named " << funcName << " found.\n";
|
||||
GetLogger()->error("No Lua function named {} found.\n", funcName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,8 @@ ScriptedRotation::initialize(const std::string& moduleName,
|
|||
if (lua_pcall(luaState, 1, 1, 0) != 0)
|
||||
{
|
||||
// Some sort of error occurred--the error message is atop the stack
|
||||
clog << "Error calling ScriptedRotation generator function: " <<
|
||||
lua_tostring(luaState, -1) << "\n";
|
||||
GetLogger()->error("Error calling ScriptedRotation generator function: {}\n",
|
||||
lua_tostring(luaState, -1));
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ ScriptedRotation::initialize(const std::string& moduleName,
|
|||
{
|
||||
// We have an object, but it's not a table. Pop it off the
|
||||
// stack and report failure.
|
||||
clog << "ScriptedRotation generator function returned bad value.\n";
|
||||
GetLogger()->error("ScriptedRotation generator function returned bad value.\n");
|
||||
lua_pop(luaState, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ ScriptedRotation::initialize(const std::string& moduleName,
|
|||
// Perform some sanity checks on the rotation parameters
|
||||
if (validRangeEnd < validRangeBegin)
|
||||
{
|
||||
clog << "Bad script rotation: valid range end < begin\n";
|
||||
GetLogger()->error("Bad script rotation: valid range end < begin\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ ScriptedRotation::spin(double tjd) const
|
|||
else
|
||||
{
|
||||
// Function call failed for some reason
|
||||
//clog << "ScriptedRotation failed: " << lua_tostring(luaState, -1) << "\n";
|
||||
GetLogger()->warn("ScriptedRotation failed: {}\n", lua_tostring(luaState, -1));
|
||||
lua_pop(luaState, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,10 @@
|
|||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <set>
|
||||
#include <celutil/logger.h>
|
||||
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
// Track loaded SPICE kernels in order to avoid loading the same kernel
|
||||
|
@ -99,7 +101,7 @@ bool LoadSpiceKernel(const fs::path& filepath)
|
|||
{
|
||||
char errMsg[1024];
|
||||
getmsg_c("long", sizeof(errMsg), errMsg);
|
||||
clog << errMsg << "\n";
|
||||
GetLogger()->error("{}\n", errMsg);
|
||||
|
||||
// Reset the SPICE error state so that future calls to
|
||||
// SPICE can still succeed.
|
||||
|
@ -108,6 +110,6 @@ bool LoadSpiceKernel(const fs::path& filepath)
|
|||
return false;
|
||||
}
|
||||
|
||||
clog << "Loaded SPK file " << filepath << "\n";
|
||||
GetLogger()->info("Loaded SPK file {}\n", filepath);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -14,12 +14,13 @@
|
|||
#include <utility>
|
||||
#include "SpiceUsr.h"
|
||||
#include <celengine/astro.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "spiceorbit.h"
|
||||
#include "spiceinterface.h"
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
static const double MILLISEC = astro::secsToDays(0.001);
|
||||
|
||||
|
@ -105,14 +106,14 @@ SpiceOrbit::init(const fs::path& path,
|
|||
// Get the ID codes for the target
|
||||
if (!GetNaifId(targetBodyName, &targetID))
|
||||
{
|
||||
clog << "Couldn't find SPICE ID for " << targetBodyName << "\n";
|
||||
GetLogger()->error("Couldn't find SPICE ID for {}\n", targetBodyName);
|
||||
spiceErr = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetNaifId(originName, &originID))
|
||||
{
|
||||
clog << "Couldn't find SPICE ID for " << originName << "\n";
|
||||
GetLogger()->error("Couldn't find SPICE ID for {}", originName);
|
||||
spiceErr = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -151,7 +152,7 @@ SpiceOrbit::init(const fs::path& path,
|
|||
SpiceInt nIntervals = card_c(&targetCoverage) / 2;
|
||||
if (nIntervals <= 0 && targetID != 0)
|
||||
{
|
||||
clog << "Couldn't find object " << targetBodyName << " in SPICE kernel pool.\n";
|
||||
GetLogger()->error("Couldn't find object {} in SPICE kernel pool.\n", targetBodyName);
|
||||
spiceErr = true;
|
||||
if (failed_c())
|
||||
{
|
||||
|
@ -202,7 +203,7 @@ SpiceOrbit::init(const fs::path& path,
|
|||
if (targetID != 0 &&
|
||||
!wnincd_c(beginningSecondsJ2000, endingSecondsJ2000, &targetCoverage))
|
||||
{
|
||||
clog << "Specified time interval for target " << targetBodyName << " not available.\n";
|
||||
GetLogger()->error("Specified time interval for target {} not available.\n", targetBodyName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +223,7 @@ SpiceOrbit::init(const fs::path& path,
|
|||
// Print the error message
|
||||
char errMsg[1024];
|
||||
getmsg_c("long", sizeof(errMsg), errMsg);
|
||||
clog << errMsg << "\n";
|
||||
GetLogger()->error("{}\n", errMsg);
|
||||
spiceErr = true;
|
||||
|
||||
reset_c();
|
||||
|
@ -265,7 +266,7 @@ SpiceOrbit::computePosition(double jd) const
|
|||
// Print the error message
|
||||
char errMsg[1024];
|
||||
getmsg_c("long", sizeof(errMsg), errMsg);
|
||||
clog << errMsg << "\n";
|
||||
GetLogger()->warn("{}\n", errMsg);
|
||||
|
||||
// Reset the error state
|
||||
reset_c();
|
||||
|
@ -310,7 +311,7 @@ SpiceOrbit::computeVelocity(double jd) const
|
|||
// Print the error message
|
||||
char errMsg[1024];
|
||||
getmsg_c("long", sizeof(errMsg), errMsg);
|
||||
clog << errMsg << "\n";
|
||||
GetLogger()->warn("{}\n", errMsg);
|
||||
|
||||
// Reset the error state
|
||||
reset_c();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <celengine/astro.h>
|
||||
#include <celmath/geomutil.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "SpiceUsr.h"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
@ -23,7 +24,7 @@
|
|||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using namespace celmath;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
static const double MILLISEC = astro::secsToDays(0.001);
|
||||
static const Quaterniond Rx90 = XRotation(PI / 2.0);
|
||||
|
@ -124,7 +125,7 @@ SpiceRotation::init(const fs::path& path,
|
|||
// Print the error message
|
||||
char errMsg[1024];
|
||||
getmsg_c("long", sizeof(errMsg), errMsg);
|
||||
clog << errMsg << "\n";
|
||||
GetLogger()->error("{}\n", errMsg);
|
||||
m_spiceErr = true;
|
||||
|
||||
reset_c();
|
||||
|
@ -159,7 +160,7 @@ SpiceRotation::computeSpin(double jd) const
|
|||
// Print the error message
|
||||
char errMsg[1024];
|
||||
getmsg_c("long", sizeof(errMsg), errMsg);
|
||||
clog << errMsg << "\n";
|
||||
GetLogger()->error("{}\n", errMsg);
|
||||
|
||||
// Reset the error state
|
||||
reset_c();
|
||||
|
|
|
@ -10,10 +10,12 @@
|
|||
#include <windowsx.h>
|
||||
#include <celengine/pixelformat.h>
|
||||
#include <celengine/render.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "avicapture.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace celestia;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
AVICapture::AVICapture(const Renderer *r) :
|
||||
MovieCapture(r)
|
||||
|
@ -57,7 +59,7 @@ bool AVICapture::start(const fs::path& filename,
|
|||
nullptr);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
DPRINTF(0, "Erroring creating avi file for capture.\n");
|
||||
GetLogger()->error("Erroring creating avi file for capture.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -72,7 +74,7 @@ bool AVICapture::start(const fs::path& filename,
|
|||
hr = AVIFileCreateStream(aviFile, &aviStream, &info);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
DPRINTF(0, "Error %08x creating AVI stream.\n", hr);
|
||||
GetLogger()->error("Error {:08x} creating AVI stream.\n", hr);
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
@ -93,7 +95,7 @@ bool AVICapture::start(const fs::path& filename,
|
|||
hr = AVIMakeCompressedStream(&compAviStream, aviStream, &options, nullptr);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
DPRINTF(0, "Error %08x creating compressed AVI stream.\n", hr);
|
||||
GetLogger()->error("Error {:08x} creating compressed AVI stream.\n", hr);
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
@ -115,7 +117,7 @@ bool AVICapture::start(const fs::path& filename,
|
|||
hr = AVIStreamSetFormat(compAviStream, 0, &bi, sizeof bi);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
DPRINTF(0, "AVIStreamSetFormat failed: %08x\n", hr);
|
||||
GetLogger()->error("AVIStreamSetFormat failed: {:08x}\n", hr);
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
@ -165,7 +167,7 @@ bool AVICapture::captureFrame()
|
|||
&bytesWritten);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
DPRINTF(0, "AVIStreamWrite failed on frame %d\n", frameCounter);
|
||||
GetLogger()->error("AVIStreamWrite failed on frame {}\n", frameCounter);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <celutil/filetype.h>
|
||||
#include <celutil/formatnum.h>
|
||||
#include <celutil/fsutils.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/utf8.h>
|
||||
#include <celcompat/filesystem.h>
|
||||
|
@ -90,10 +90,6 @@ static const double OneFtInKm = 0.0003048;
|
|||
static const double OneLbInKg = 0.45359237;
|
||||
static const double OneLbPerFt3InKgPerM3 = OneLbInKg / pow(OneFtInKm * 1000.0, 3);
|
||||
|
||||
static void warning(string s)
|
||||
{
|
||||
cout << s;
|
||||
}
|
||||
|
||||
static bool is_valid_directory(const fs::path& dir)
|
||||
{
|
||||
|
@ -103,7 +99,7 @@ static bool is_valid_directory(const fs::path& dir)
|
|||
std::error_code ec;
|
||||
if (!fs::is_directory(dir, ec))
|
||||
{
|
||||
cerr << fmt::sprintf(_("Path %s doesn't exist or isn't a directory\n"), dir);
|
||||
GetLogger()->error(_("Path {} doesn't exist or isn't a directory\n"), dir);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -156,6 +152,8 @@ CelestiaCore::CelestiaCore() :
|
|||
m_tee(std::cout, std::cerr)
|
||||
{
|
||||
|
||||
CreateLogger();
|
||||
|
||||
for (int i = 0; i < KeyCount; i++)
|
||||
{
|
||||
keysPressed[i] = false;
|
||||
|
@ -179,6 +177,8 @@ CelestiaCore::~CelestiaCore()
|
|||
|
||||
if (m_logfile.good())
|
||||
m_logfile.close();
|
||||
|
||||
DestroyLogger();
|
||||
}
|
||||
|
||||
void CelestiaCore::readFavoritesFile()
|
||||
|
@ -200,7 +200,7 @@ void CelestiaCore::readFavoritesFile()
|
|||
{
|
||||
favorites = ReadFavoritesList(in);
|
||||
if (favorites == nullptr)
|
||||
warning(fmt::format(_("Error reading favorites file {}.\n"), path));
|
||||
GetLogger()->error(_("Error reading favorites file {}.\n"), path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ void CelestiaCore::writeFavoritesFile()
|
|||
bool isDir = fs::is_directory(path.parent_path(), ec);
|
||||
if (ec)
|
||||
{
|
||||
warning(fmt::format(_("Failed to check directory existance for favorites file {}\n"), path));
|
||||
GetLogger()->error(_("Failed to check directory existance for favorites file {}\n"), path);
|
||||
return;
|
||||
}
|
||||
if (!isDir)
|
||||
|
@ -229,7 +229,7 @@ void CelestiaCore::writeFavoritesFile()
|
|||
fs::create_directory(path.parent_path(), ec);
|
||||
if (ec)
|
||||
{
|
||||
warning(fmt::format(_("Failed to create a directory for favorites file {}\n"), path));
|
||||
GetLogger()->error(_("Failed to create a directory for favorites file {}\n"), path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ void showSelectionInfo(const Selection& sel)
|
|||
|
||||
AngleAxisf aa(orientation);
|
||||
|
||||
DPRINTF(LOG_LEVEL_VERBOSE, "%s\nOrientation: [%f, %f, %f], %.1f\n", sel.getName(), aa.axis().x(), aa.axis().y(), aa.axis().z(), radToDeg(aa.angle()));
|
||||
GetLogger()->info("{}\nOrientation: [{}, {}, {}], {:.1f}\n", sel.getName(), aa.axis().x(), aa.axis().y(), aa.axis().z(), radToDeg(aa.angle()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2210,7 +2210,7 @@ void CelestiaCore::draw(View* view)
|
|||
if (viewportEffect->render(renderer, fbo, viewWidth, viewHeight))
|
||||
viewportEffectUsed = true;
|
||||
else
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Unable to render viewport effect.\n");
|
||||
GetLogger()->error("Unable to render viewport effect.\n");
|
||||
}
|
||||
isViewportEffectUsed = viewportEffectUsed;
|
||||
}
|
||||
|
@ -3638,10 +3638,10 @@ class SolarSystemLoader
|
|||
|
||||
if (find(begin(skip), end(skip), filepath) != end(skip))
|
||||
{
|
||||
clog << fmt::sprintf(_("Skipping solar system catalog: %s\n"), filepath);
|
||||
GetLogger()->info(_("Skipping solar system catalog: {}\n"), filepath);
|
||||
return;
|
||||
}
|
||||
clog << fmt::sprintf(_("Loading solar system catalog: %s\n"), filepath);
|
||||
GetLogger()->info(_("Loading solar system catalog: {}\n"), filepath);
|
||||
if (notifier != nullptr)
|
||||
notifier->update(filepath.filename().string());
|
||||
|
||||
|
@ -3684,10 +3684,10 @@ template <class OBJDB> class CatalogLoader
|
|||
|
||||
if (find(begin(skip), end(skip), filepath) != end(skip))
|
||||
{
|
||||
clog << fmt::sprintf(_("Skipping %s catalog: %s\n"), typeDesc, filepath);
|
||||
GetLogger()->info(_("Skipping {} catalog: {}\n"), typeDesc, filepath);
|
||||
return;
|
||||
}
|
||||
clog << fmt::sprintf(_("Loading %s catalog: %s\n"), typeDesc, filepath);
|
||||
GetLogger()->info(_("Loading {} catalog: {}\n"), typeDesc, filepath);
|
||||
if (notifier != nullptr)
|
||||
notifier->update(filepath.filename().string());
|
||||
|
||||
|
@ -3695,7 +3695,7 @@ template <class OBJDB> class CatalogLoader
|
|||
if (catalogFile.good())
|
||||
{
|
||||
if (!objDB->load(catalogFile, filepath.parent_path()))
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error reading %s catalog file: %s\n", typeDesc, filepath);
|
||||
GetLogger()->error(_("Error reading {} catalog file: {}\n"), typeDesc, filepath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -3798,11 +3798,11 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
|
|||
ifstream dsoFile(file.string(), ios::in);
|
||||
if (!dsoFile.good())
|
||||
{
|
||||
warning(fmt::sprintf(_("Error opening deepsky catalog file %s.\n"), file));
|
||||
GetLogger()->error(_("Error opening deepsky catalog file {}.\n"), file);
|
||||
}
|
||||
if (!dsoDB->load(dsoFile, ""))
|
||||
{
|
||||
warning(fmt::sprintf(_("Cannot read Deep Sky Objects database %s.\n"), file));
|
||||
GetLogger()->error(_("Cannot read Deep Sky Objects database {}.\n"), file);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3851,7 +3851,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
|
|||
ifstream solarSysFile(file.string(), ios::in);
|
||||
if (!solarSysFile.good())
|
||||
{
|
||||
warning(fmt::sprintf(_("Error opening solar system catalog %s.\n"), file));
|
||||
GetLogger()->error(_("Error opening solar system catalog {}.\n"), file);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3891,8 +3891,8 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
|
|||
ifstream asterismsFile(config->asterismsFile.string(), ios::in);
|
||||
if (!asterismsFile.good())
|
||||
{
|
||||
warning(fmt::sprintf(_("Error opening asterisms file %s.\n"),
|
||||
config->asterismsFile));
|
||||
GetLogger()->error(_("Error opening asterisms file {}.\n"),
|
||||
config->asterismsFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3907,8 +3907,8 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
|
|||
ifstream boundariesFile(config->boundariesFile.string(), ios::in);
|
||||
if (!boundariesFile.good())
|
||||
{
|
||||
warning(fmt::sprintf(_("Error opening constellation boundaries file %s.\n"),
|
||||
config->boundariesFile));
|
||||
GetLogger()->error(_("Error opening constellation boundaries file {}.\n"),
|
||||
config->boundariesFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3935,7 +3935,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
|
|||
else if (config->projectionMode == "fisheye")
|
||||
renderer->setProjectionMode(Renderer::ProjectionMode::FisheyeMode);
|
||||
else
|
||||
DPRINTF(LOG_LEVEL_WARNING, "Unknown projection mode %s\n", config->projectionMode);
|
||||
GetLogger()->warn("Unknown projection mode {}\n", config->projectionMode);
|
||||
}
|
||||
|
||||
if (!config->viewportEffect.empty() && config->viewportEffect != "none")
|
||||
|
@ -3946,7 +3946,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
|
|||
{
|
||||
if (config->warpMeshFile.empty())
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_WARNING, "No warp mesh file specified for this effect\n");
|
||||
GetLogger()->warn("No warp mesh file specified for this effect\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3955,11 +3955,13 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
|
|||
if (mesh != nullptr)
|
||||
viewportEffect = unique_ptr<ViewportEffect>(new WarpMeshViewportEffect(mesh));
|
||||
else
|
||||
DPRINTF(LOG_LEVEL_WARNING, "Failed to read warp mesh file %s\n", config->warpMeshFile);
|
||||
GetLogger()->error("Failed to read warp mesh file {}\n", config->warpMeshFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
DPRINTF(LOG_LEVEL_WARNING, "Unknown viewport effect %s\n", config->viewportEffect);
|
||||
{
|
||||
GetLogger()->warn("Unknown viewport effect {}\n", config->viewportEffect);
|
||||
}
|
||||
}
|
||||
|
||||
if (!config->measurementSystem.empty())
|
||||
|
@ -3969,7 +3971,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
|
|||
else if (compareIgnoringCase(config->measurementSystem, "metric") == 0)
|
||||
measurement = Metric;
|
||||
else
|
||||
DPRINTF(LOG_LEVEL_WARNING, "Unknown measurement system %s\n", config->measurementSystem);
|
||||
GetLogger()->warn("Unknown measurement system {}\n", config->measurementSystem);
|
||||
}
|
||||
|
||||
sim = new Simulation(universe);
|
||||
|
@ -4022,7 +4024,7 @@ bool CelestiaCore::initRenderer()
|
|||
context->init(config->ignoreGLExtensions);
|
||||
// Choose the render path, starting with the least desirable
|
||||
context->setRenderPath(GLContext::GLPath_GLSL);
|
||||
//DPRINTF(LOG_LEVEL_VERBOSE, "render path: %i\n", context->getRenderPath());
|
||||
//GetLogger()->verbose("render path: {}\n", context->getRenderPath());
|
||||
#endif
|
||||
|
||||
Renderer::DetailOptions detailOptions;
|
||||
|
@ -4104,9 +4106,9 @@ static void loadCrossIndex(StarDatabase* starDB,
|
|||
if (xrefFile.good())
|
||||
{
|
||||
if (!starDB->loadCrossIndex(catalog, xrefFile))
|
||||
cerr << fmt::sprintf(_("Error reading cross index %s\n"), filename);
|
||||
GetLogger()->error(_("Error reading cross index {}\n"), filename);
|
||||
else
|
||||
clog << fmt::sprintf(_("Loaded cross index %s\n"), filename);
|
||||
GetLogger()->info(_("Loaded cross index {}\n"), filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4123,11 +4125,11 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
|
|||
{
|
||||
starNameDB = StarNameDatabase::readNames(starNamesFile);
|
||||
if (starNameDB == nullptr)
|
||||
cerr << _("Error reading star names file\n");
|
||||
GetLogger()->error(_("Error reading star names file\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << fmt::sprintf(_("Error opening %s\n"), cfg.starNamesFile);
|
||||
GetLogger()->error(_("Error opening {}\n"), cfg.starNamesFile);
|
||||
}
|
||||
|
||||
// First load the binary star database file. The majority of stars
|
||||
|
@ -4141,7 +4143,7 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
|
|||
ifstream starFile(cfg.starDatabaseFile.string(), ios::in | ios::binary);
|
||||
if (!starFile.good())
|
||||
{
|
||||
cerr << fmt::sprintf(_("Error opening %s\n"), cfg.starDatabaseFile);
|
||||
GetLogger()->error(_("Error opening {}\n"), cfg.starDatabaseFile);
|
||||
delete starDB;
|
||||
delete starNameDB;
|
||||
return false;
|
||||
|
@ -4149,7 +4151,7 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
|
|||
|
||||
if (!starDB->loadBinary(starFile))
|
||||
{
|
||||
cerr << _("Error reading stars file\n");
|
||||
GetLogger()->error(_("Error reading stars file\n"));
|
||||
delete starDB;
|
||||
delete starNameDB;
|
||||
return false;
|
||||
|
@ -4175,7 +4177,7 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
|
|||
if (starFile.good())
|
||||
starDB->load(starFile);
|
||||
else
|
||||
cerr << fmt::sprintf(_("Error opening star catalog %s\n"), file);
|
||||
GetLogger()->error(_("Error opening star catalog {}\n"), file);
|
||||
}
|
||||
|
||||
// Now, read supplemental star files from the extras directories
|
||||
|
@ -4235,12 +4237,16 @@ void CelestiaCore::setFaintestAutoMag()
|
|||
void CelestiaCore::fatalError(const string& msg, bool visual)
|
||||
{
|
||||
if (alerter == nullptr)
|
||||
{
|
||||
if (visual)
|
||||
flash(msg);
|
||||
else
|
||||
cerr << msg;
|
||||
GetLogger()->error(msg.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
alerter->fatalError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void CelestiaCore::setAlerter(Alerter* a)
|
||||
|
@ -4758,7 +4764,7 @@ Image CelestiaCore::captureImage() const
|
|||
viewport[2], viewport[3],
|
||||
format, image.getPixels()))
|
||||
{
|
||||
fmt::print(cerr, _("Unable to capture a frame!\n"));
|
||||
GetLogger()->error(_("Unable to capture a frame!\n"));
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
@ -4770,7 +4776,7 @@ bool CelestiaCore::saveScreenShot(const fs::path& filename, ContentType type) co
|
|||
|
||||
if (type != Content_JPEG && type != Content_PNG)
|
||||
{
|
||||
fmt::print(cerr, _("Unsupported image type: {}!\n"), filename);
|
||||
GetLogger()->error(_("Unsupported image type: {}!\n"), filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4815,6 +4821,6 @@ void CelestiaCore::setLogFile(const fs::path &fn)
|
|||
}
|
||||
else
|
||||
{
|
||||
fmt::print(cerr, "Unable to open log file {}\n", fn);
|
||||
GetLogger()->error("Unable to open log file {}\n", fn);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/fsutils.h>
|
||||
#include <celengine/texmanager.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
|
@ -37,7 +37,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
ifstream configFile(filename.string());
|
||||
if (!configFile.good())
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error opening config file '%s'.\n", filename);
|
||||
GetLogger()->error("Error opening config file '{}'.\n", filename);
|
||||
return config;
|
||||
}
|
||||
|
||||
|
@ -46,22 +46,22 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
|
||||
if (tokenizer.nextToken() != Tokenizer::TokenName)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s:%d 'Configuration' expected.\n", filename,
|
||||
tokenizer.getLineNumber());
|
||||
GetLogger()->error("{}:{} 'Configuration' expected.\n", filename,
|
||||
tokenizer.getLineNumber());
|
||||
return config;
|
||||
}
|
||||
|
||||
if (tokenizer.getStringValue() != "Configuration")
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s:%d 'Configuration' expected.\n", filename,
|
||||
tokenizer.getLineNumber());
|
||||
GetLogger()->error("{}:{} 'Configuration' expected.\n", filename,
|
||||
tokenizer.getLineNumber());
|
||||
return config;
|
||||
}
|
||||
|
||||
Value* configParamsValue = parser.readValue();
|
||||
if (configParamsValue == nullptr || configParamsValue->getType() != Value::HashType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: Bad configuration file.\n", filename);
|
||||
GetLogger()->error("{}: Bad configuration file.\n", filename);
|
||||
return config;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
{
|
||||
if (solarSystemsVal->getType() != Value::ArrayType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: SolarSystemCatalogs must be an array.\n", filename);
|
||||
GetLogger()->error("{}: SolarSystemCatalogs must be an array.\n", filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: Solar system catalog name must be a string.\n", filename);
|
||||
GetLogger()->error("{}: Solar system catalog name must be a string.\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
{
|
||||
if (starCatalogsVal->getType() != Value::ArrayType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: StarCatalogs must be an array.\n", filename);
|
||||
GetLogger()->error("{}: StarCatalogs must be an array.\n", filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: Star catalog name must be a string.\n", filename);
|
||||
GetLogger()->error("{}: Star catalog name must be a string.\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
{
|
||||
if (dsoCatalogsVal->getType() != Value::ArrayType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: DeepSkyCatalogs must be an array.\n", filename);
|
||||
GetLogger()->error("{}: DeepSkyCatalogs must be an array.\n", filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -213,7 +213,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: DeepSky catalog name must be a string.\n", filename);
|
||||
GetLogger()->error("{}: DeepSky catalog name must be a string.\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: Extras directory name must be a string.\n", filename);
|
||||
GetLogger()->error("{}: Extras directory name must be a string.\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: ExtrasDirectories must be an array or a string.\n", filename);
|
||||
GetLogger()->error("{}: ExtrasDirectories must be an array or a string.\n", filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: Skipped file name must be a string.\n", filename);
|
||||
GetLogger()->error("{}: Skipped file name must be a string.\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: SkipExtras must be an array or a string.\n", filename);
|
||||
GetLogger()->error("{}: SkipExtras must be an array or a string.\n", filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
{
|
||||
if (ignoreExtVal->getType() != Value::ArrayType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: IgnoreGLExtensions must be an array.\n", filename);
|
||||
GetLogger()->error("{}: IgnoreGLExtensions must be an array.\n", filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -298,7 +298,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: extension name must be a string.\n", filename);
|
||||
GetLogger()->error("{}: extension name must be a string.\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
|
|||
{
|
||||
if (starTexValue->getType() != Value::HashType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "%s: StarTextures must be a property list.\n", filename);
|
||||
GetLogger()->error("{}: StarTextures must be a property list.\n", filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <algorithm>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/stringutils.h>
|
||||
#include <celengine/astro.h>
|
||||
#include <celengine/parser.h>
|
||||
|
@ -17,7 +17,7 @@
|
|||
#include "destination.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
DestinationList* ReadDestinationList(istream& in)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ DestinationList* ReadDestinationList(istream& in)
|
|||
{
|
||||
if (tokenizer.getTokenType() != Tokenizer::TokenBeginGroup)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing destinations file.\n");
|
||||
GetLogger()->error("Error parsing destinations file.\n");
|
||||
for_each(destinations->begin(), destinations->end(), [](Destination* dest) { delete dest; });
|
||||
delete destinations;
|
||||
return nullptr;
|
||||
|
@ -39,7 +39,7 @@ DestinationList* ReadDestinationList(istream& in)
|
|||
Value* destValue = parser.readValue();
|
||||
if (destValue == nullptr || destValue->getType() != Value::HashType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing destination.\n");
|
||||
GetLogger()->error("Error parsing destination.\n");
|
||||
for_each(destinations->begin(), destinations->end(), [](Destination* dest) { delete dest; });
|
||||
delete destinations;
|
||||
if (destValue != nullptr)
|
||||
|
@ -52,7 +52,7 @@ DestinationList* ReadDestinationList(istream& in)
|
|||
|
||||
if (!destParams->getString("Name", dest->name))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_INFO, "Skipping unnamed destination\n");
|
||||
GetLogger()->warn("Skipping unnamed destination\n");
|
||||
delete dest;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
#include <iomanip>
|
||||
#include <celengine/parser.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "favorites.h"
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
FavoritesList* ReadFavoritesList(istream& in)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ FavoritesList* ReadFavoritesList(istream& in)
|
|||
{
|
||||
if (tokenizer.getTokenType() != Tokenizer::TokenString)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing favorites file.\n");
|
||||
GetLogger()->error("Error parsing favorites file.\n");
|
||||
for_each(favorites->begin(), favorites->end(), [](FavoritesEntry* fav) { delete fav; });
|
||||
delete favorites;
|
||||
return nullptr;
|
||||
|
@ -42,7 +42,7 @@ FavoritesList* ReadFavoritesList(istream& in)
|
|||
Value* favParamsValue = parser.readValue();
|
||||
if (favParamsValue == nullptr || favParamsValue->getType() != Value::HashType)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error parsing favorites entry %s\n", fav->name.c_str());
|
||||
GetLogger()->error("Error parsing favorites entry {}\n", fav->name);
|
||||
for_each(favorites->begin(), favorites->end(), [](FavoritesEntry* fav) { delete fav; });
|
||||
delete favorites;
|
||||
if (favParamsValue != nullptr)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#endif
|
||||
#include <fmt/printf.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/tzutil.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celengine/astro.h>
|
||||
|
@ -40,6 +40,7 @@
|
|||
|
||||
using namespace celestia;
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
char AppName[] = "Celestia";
|
||||
|
@ -464,31 +465,32 @@ int main(int argc, char* argv[])
|
|||
ready = false;
|
||||
|
||||
char c;
|
||||
int startfile = 0;
|
||||
while ((c = getopt(argc, argv, "v::f")) > -1)
|
||||
const char* startfile = nullptr;
|
||||
Level verbosity = Level::Info;
|
||||
while ((c = getopt(argc, argv, "vdf:")) > -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '?':
|
||||
cout << "Usage: celestia [-v] [-f <filename>]\n";
|
||||
cout << "Usage: celestia [-v] [-d] [-f <filename>]\n";
|
||||
exit(1);
|
||||
case 'v':
|
||||
if(optarg)
|
||||
SetDebugVerbosity(atoi(optarg));
|
||||
else
|
||||
SetDebugVerbosity(0);
|
||||
verbosity = Level::Verbose;
|
||||
break;
|
||||
case 'd':
|
||||
verbosity = Level::Debug;
|
||||
case 'f':
|
||||
startfile = 1;
|
||||
if (optarg == nullptr)
|
||||
{
|
||||
cerr << "Missing Filename.\n";
|
||||
return 1;
|
||||
}
|
||||
startfile = optarg;
|
||||
}
|
||||
}
|
||||
|
||||
appCore = new CelestiaCore();
|
||||
if (appCore == nullptr)
|
||||
{
|
||||
cerr << "Out of memory.\n";
|
||||
return 1;
|
||||
}
|
||||
GetLogger()->setLevel(verbosity);
|
||||
|
||||
if (!appCore->initSimulation())
|
||||
{
|
||||
|
@ -519,7 +521,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
if (!gl::init(appCore->getConfig()->ignoreGLExtensions) || !gl::checkVersion(gl::GL_2_1))
|
||||
{
|
||||
cout << _("Celestia was unable to initialize OpenGL 2.1.\n");
|
||||
cerr << _("Celestia was unable to initialize OpenGL 2.1.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -540,14 +542,9 @@ int main(int argc, char* argv[])
|
|||
appCore->setTimeZoneBias(dstBias);
|
||||
}
|
||||
|
||||
if (startfile == 1) {
|
||||
if (argv[argc - 1][0] == '-') {
|
||||
cout << "Missing Filename.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
cout << "*** Using CEL File: " << argv[argc - 1] << endl;
|
||||
appCore->runScript(argv[argc - 1]);
|
||||
if (startfile != nullptr) {
|
||||
cout << "*** Using CEL File: " << startfile << endl;
|
||||
appCore->runScript(startfile);
|
||||
}
|
||||
|
||||
ready = true;
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <celutil/debug.h>
|
||||
|
||||
#include "dialog-options.h"
|
||||
#include "common.h"
|
||||
#include "ui.h"
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <celengine/glsupport.h>
|
||||
#include <celengine/simulation.h>
|
||||
#include <celestia/celestiacore.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/gettext.h>
|
||||
|
||||
/* Includes for the GNOME front-end */
|
||||
|
@ -381,14 +380,7 @@ int main(int argc, char* argv[])
|
|||
SplashData* ss = splashStart(app, !noSplash);
|
||||
splashSetText(ss, "Initializing...");
|
||||
|
||||
SetDebugVerbosity(0);
|
||||
|
||||
app->core = new CelestiaCore();
|
||||
if (app->core == NULL)
|
||||
{
|
||||
cerr << "Failed to initialize Celestia core.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
app->renderer = app->core->getRenderer();
|
||||
g_assert(app->renderer);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "celengine/astro.h"
|
||||
#include "celutil/filetype.h"
|
||||
#include "celutil/debug.h"
|
||||
#include "celutil/gettext.h"
|
||||
#include "celestia/celestiacore.h"
|
||||
#include "celengine/simulation.h"
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <celestia/celestiacore.h>
|
||||
#include <celengine/astro.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/utf8.h>
|
||||
#include <celengine/universe.h>
|
||||
#include <QTextBrowser>
|
||||
|
@ -24,6 +25,7 @@
|
|||
using namespace std;
|
||||
using namespace Eigen;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
// TODO: This should be moved to astro.cpp
|
||||
struct OrbitalElements
|
||||
|
@ -431,10 +433,10 @@ static void CalculateOsculatingElements(const Orbit& orbit,
|
|||
double beginTime = 0.0;
|
||||
double endTime = 0.0;
|
||||
orbit.getValidRange(beginTime, endTime);
|
||||
clog << "t+dt: " << t + dt << ", endTime: " << endTime << endl;
|
||||
GetLogger()->debug("t+dt: {}, endTime: {}\n", t + dt, endTime);
|
||||
if (t + dt > endTime)
|
||||
{
|
||||
clog << "REVERSE\n";
|
||||
GetLogger()->debug("REVERSE\n");
|
||||
sdt = -dt;
|
||||
}
|
||||
}
|
||||
|
@ -448,9 +450,9 @@ static void CalculateOsculatingElements(const Orbit& orbit,
|
|||
Vector3d r = p0;
|
||||
double GM = accel * r.squaredNorm();
|
||||
|
||||
clog << "vel: " << v0.norm() / 86400.0 << endl;
|
||||
clog << "vel (est): " << (p1 - p0).norm() / sdt / 86400 << endl;
|
||||
clog << "osc: " << t << ", " << dt << ", " << accel << ", GM=" << GM << endl;
|
||||
GetLogger()->debug("vel: {}\n", v0.norm() / 86400.0);
|
||||
GetLogger()->debug("vel (est): {}\n", (p1 - p0).norm() / sdt / 86400);
|
||||
GetLogger()->debug("osc: {}, {}, {}, GM={}\n", t, dt, accel, GM);
|
||||
|
||||
StateVectorToElements(p0, v0, GM, elements);
|
||||
}
|
||||
|
|
|
@ -11,15 +11,14 @@
|
|||
|
||||
#include "scriptmenu.h"
|
||||
#include <iostream>
|
||||
#include <fmt/printf.h>
|
||||
#include <fmt/ostream.h>
|
||||
#include <celcompat/filesystem.h>
|
||||
#include <celutil/filetype.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
static const char TitleTag[] = "Title:";
|
||||
|
||||
|
@ -85,7 +84,7 @@ ScanScriptsDirectory(const fs::path& scriptsDir, bool deep)
|
|||
std::error_code ec;
|
||||
if (!fs::is_directory(scriptsDir, ec))
|
||||
{
|
||||
cerr << fmt::sprintf(_("Path %s doesn't exist or isn't a directory\n"), scriptsDir);
|
||||
GetLogger()->warn(_("Path {} doesn't exist or isn't a directory\n"), scriptsDir);
|
||||
return scripts;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
#include <celcompat/charconv.h>
|
||||
#include <celutil/bigfix.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/stringutils.h>
|
||||
#include "celestiacore.h"
|
||||
#include "url.h"
|
||||
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -309,7 +311,7 @@ Url::decodeString(celestia::compat::string_view str)
|
|||
}
|
||||
else
|
||||
{
|
||||
fmt::print(std::cerr, _("Incorrect hex value \"{}\"\n"), c_code);
|
||||
GetLogger()->warn(_("Incorrect hex value \"{}\"\n"), c_code);
|
||||
out += '%';
|
||||
out.append(c_code.data(), c_code.length());
|
||||
}
|
||||
|
@ -392,7 +394,7 @@ bool Url::parse(celestia::compat::string_view urlStr)
|
|||
// proper URL string must start with protocol (cel://)
|
||||
if (urlStr.compare(0, Url::proto().length(), Url::proto()) != 0)
|
||||
{
|
||||
std::cerr << fmt::sprintf(_("URL must start with \"%s\"!\n"), Url::proto());
|
||||
GetLogger()->error(_("URL must start with \"{}\"!\n"), Url::proto());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -408,7 +410,7 @@ bool Url::parse(celestia::compat::string_view urlStr)
|
|||
pos = pathStr.find('/');
|
||||
if (pos == npos)
|
||||
{
|
||||
std::cerr << _("URL must have at least mode and time!\n");
|
||||
GetLogger()->error(_("URL must have at least mode and time!\n"));
|
||||
return false;
|
||||
}
|
||||
auto modeStr = pathStr.substr(0, pos);
|
||||
|
@ -419,7 +421,7 @@ bool Url::parse(celestia::compat::string_view urlStr)
|
|||
auto it = std::find_if(std::begin(modes), std::end(modes), lambda);
|
||||
if (it == std::end(modes))
|
||||
{
|
||||
std::cerr << fmt::sprintf(_("Unsupported URL mode \"%s\"!\n"), modeStr);
|
||||
GetLogger()->error(_("Unsupported URL mode \"{}\"!\n"), modeStr);
|
||||
return false;
|
||||
}
|
||||
state.m_coordSys = it->mode;
|
||||
|
@ -437,7 +439,7 @@ bool Url::parse(celestia::compat::string_view urlStr)
|
|||
{
|
||||
if (pos != npos)
|
||||
{
|
||||
std::cerr << _("URL must contain only one body\n");
|
||||
GetLogger()->error(_("URL must contain only one body\n"));
|
||||
return false;
|
||||
}
|
||||
auto body = Url::decodeString(bodiesStr);
|
||||
|
@ -449,7 +451,7 @@ bool Url::parse(celestia::compat::string_view urlStr)
|
|||
{
|
||||
if (pos == npos || bodiesStr.find('/', pos + 1) != npos)
|
||||
{
|
||||
std::cerr << _("URL must contain 2 bodies\n");
|
||||
GetLogger()->error(_("URL must contain 2 bodies\n"));
|
||||
return false;
|
||||
}
|
||||
auto body = Url::decodeString(bodiesStr.substr(0, pos));
|
||||
|
@ -490,14 +492,14 @@ bool Url::parse(celestia::compat::string_view urlStr)
|
|||
auto &p = params["ver"];
|
||||
if (!to_number(p, version))
|
||||
{
|
||||
std::cerr << fmt::sprintf(_("Invalid URL version \"%s\"!\n"), p);
|
||||
GetLogger()->error(_("Invalid URL version \"{}\"!\n"), p);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (version != 3 && version != 4)
|
||||
{
|
||||
std::cerr << fmt::sprintf(_("Unsupported URL version: %i\n"), version);
|
||||
GetLogger()->error(_("Unsupported URL version: {}\n"), version);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -529,7 +531,7 @@ auto ParseURLParams(celestia::compat::string_view paramsStr)
|
|||
auto vpos = kv.find('=');
|
||||
if (vpos == npos)
|
||||
{
|
||||
std::cerr << _("URL parameter must look like key=value\n");
|
||||
GetLogger()->error(_("URL parameter must look like key=value\n"));
|
||||
break;
|
||||
}
|
||||
params[kv.substr(0, vpos)] = Url::decodeString(kv.substr(vpos + 1));
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
#include <celengine/render.h>
|
||||
#include <celengine/framebuffer.h>
|
||||
#include <celutil/color.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "view.h"
|
||||
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
View::View(View::Type _type,
|
||||
Renderer *_renderer,
|
||||
|
@ -271,7 +273,7 @@ void View::updateFBO(int gWidth, int gHeight)
|
|||
FramebufferObject::ColorAttachment | FramebufferObject::DepthAttachment));
|
||||
if (!fbo->isValid())
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error creating view FBO.\n");
|
||||
GetLogger()->error("Error creating view FBO.\n");
|
||||
fbo = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
|
||||
#include "winbookmarks.h"
|
||||
#include "res/resource.h"
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/winutil.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
bool dragging;
|
||||
HTREEITEM hDragItem;
|
||||
|
@ -295,7 +297,7 @@ void BuildFavoritesMenu(HMENU menuBar,
|
|||
if (!child->isFolder &&
|
||||
child->parentFolder == folderName)
|
||||
{
|
||||
clog << " " << child->name << '\n';
|
||||
GetLogger()->debug(" {}\n", child->name);
|
||||
// Add item to sub menu
|
||||
menuInfo.cbSize = sizeof(MENUITEMINFO);
|
||||
menuInfo.fMask = MIIM_TYPE | MIIM_ID;
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celutil/array_view.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/fsutils.h>
|
||||
#include <celutil/winutil.h>
|
||||
#include <celutil/tzutil.h>
|
||||
#include <celutil/filetype.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celengine/astro.h>
|
||||
#include <celscript/legacy/cmdparser.h>
|
||||
|
||||
|
@ -170,7 +170,9 @@ static LRESULT CALLBACK MainWindowProc(HWND hWnd,
|
|||
#define MENU_CHOOSE_SURFACE 31000
|
||||
|
||||
|
||||
bool ignoreOldFavorites = false;
|
||||
static bool ignoreOldFavorites = false;
|
||||
|
||||
static Level verbosity = Level::Info;
|
||||
|
||||
struct AppPreferences
|
||||
{
|
||||
|
@ -2766,7 +2768,10 @@ static void HandleCaptureMovie(HWND hWnd)
|
|||
if (nFileType != 1)
|
||||
{
|
||||
// Invalid file extension specified.
|
||||
DPRINTF(0, "Unknown file extension specified for movie capture.\n");
|
||||
MessageBox(hWnd,
|
||||
_("Unknown file extension specified for movie capture."),
|
||||
_("Error"),
|
||||
MB_OK | MB_ICONERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2996,7 +3001,11 @@ static bool parseCommandLine(int argc, char* argv[])
|
|||
bool isLastArg = (i == argc - 1);
|
||||
if (strcmp(argv[i], "--verbose") == 0)
|
||||
{
|
||||
SetDebugVerbosity(1);
|
||||
verbosity = Level::Verbose;
|
||||
}
|
||||
else if (strcmp(argv[i], "--debug") == 0)
|
||||
{
|
||||
verbosity = Level::Debug;
|
||||
}
|
||||
else if (strcmp(argv[i], "--fullscreen") == 0)
|
||||
{
|
||||
|
@ -3233,6 +3242,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
}
|
||||
|
||||
appCore = new CelestiaCore();
|
||||
GetLogger()->setLevel(verbosity);
|
||||
|
||||
// Gettext integration
|
||||
setlocale(LC_ALL, "");
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <celengine/image.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
|
||||
extern "C" {
|
||||
#include <avif/avif.h>
|
||||
}
|
||||
|
||||
using celestia::PixelFormat;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
Image* LoadAVIFImage(const fs::path& filename)
|
||||
{
|
||||
|
@ -23,7 +24,7 @@ Image* LoadAVIFImage(const fs::path& filename)
|
|||
avifResult result = avifDecoderSetIOFile(decoder, filename.string().c_str());
|
||||
if (result != AVIF_RESULT_OK)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Cannot open file for read: '%s'\n", filename);
|
||||
GetLogger()->error("Cannot open file for read: '{}'\n", filename);
|
||||
avifDecoderDestroy(decoder);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -31,14 +32,14 @@ Image* LoadAVIFImage(const fs::path& filename)
|
|||
result = avifDecoderParse(decoder);
|
||||
if (result != AVIF_RESULT_OK)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Failed to decode image: %s\n", avifResultToString(result));
|
||||
GetLogger()->error("Failed to decode image: {}\n", avifResultToString(result));
|
||||
avifDecoderDestroy(decoder);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (avifDecoderNextImage(decoder) != AVIF_RESULT_OK)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "No image available: %s\n", filename);
|
||||
GetLogger()->error("No image available: {}\n", filename);
|
||||
avifDecoderDestroy(decoder);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -53,7 +54,7 @@ Image* LoadAVIFImage(const fs::path& filename)
|
|||
|
||||
if (avifImageYUVToRGB(decoder->image, &rgb) != AVIF_RESULT_OK)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Conversion from YUV failed: %s\n", filename);
|
||||
GetLogger()->error("Conversion from YUV failed: {}\n", filename);
|
||||
delete image;
|
||||
avifDecoderDestroy(decoder);
|
||||
return nullptr;
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
#include <celengine/image.h>
|
||||
#include <celutil/binaryread.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
|
||||
namespace celutil = celestia::util;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -84,7 +85,7 @@ Image* LoadBMPImage(std::istream& in)
|
|||
std::vector<uint8_t> palette;
|
||||
if (imageHeader.bpp == 8)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_DEBUG, "Reading %u color palette\n", imageHeader.colorsUsed);
|
||||
GetLogger()->debug("Reading {} color palette\n", imageHeader.colorsUsed);
|
||||
palette.resize(imageHeader.colorsUsed * 4);
|
||||
if (!in.read(reinterpret_cast<char*>(palette.data()), imageHeader.colorsUsed * 4).good())
|
||||
{
|
||||
|
|
|
@ -15,12 +15,13 @@
|
|||
#include <memory>
|
||||
#include <celengine/glsupport.h>
|
||||
#include <celengine/image.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/bytes.h>
|
||||
#include "dds_decompress.h"
|
||||
|
||||
using namespace celestia;
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
struct DDPixelFormat
|
||||
|
@ -139,7 +140,7 @@ Image* LoadDDSImage(const fs::path& filename)
|
|||
ifstream in(filename.string(), ios::in | ios::binary);
|
||||
if (!in.good())
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error opening DDS texture file %s.\n", filename);
|
||||
GetLogger()->error("Error opening DDS texture file {}.\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -148,14 +149,14 @@ Image* LoadDDSImage(const fs::path& filename)
|
|||
|| header[0] != 'D' || header[1] != 'D'
|
||||
|| header[2] != 'S' || header[3] != ' ')
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "DDS texture file %s has bad header.\n", filename);
|
||||
GetLogger()->error("DDS texture file {} has bad header.\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DDSurfaceDesc ddsd;
|
||||
if (!in.read(reinterpret_cast<char*>(&ddsd), sizeof ddsd).good())
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "DDS file %s has bad surface desc.\n", filename);
|
||||
GetLogger()->error("DDS file {} has bad surface desc.\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
LE_TO_CPU_INT32(ddsd.size, ddsd.size);
|
||||
|
@ -189,12 +190,12 @@ Image* LoadDDSImage(const fs::path& filename)
|
|||
}
|
||||
else
|
||||
{
|
||||
cerr << "Unknown FourCC in DDS file: " << ddsd.format.fourCC;
|
||||
GetLogger()->error("Unknown FourCC in DDS file: {}\n", ddsd.format.fourCC);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clog << "DDS Format: " << ddsd.format.fourCC << '\n';
|
||||
GetLogger()->debug("DDS Format: {}\n", ddsd.format.fourCC);
|
||||
if (ddsd.format.bpp == 32)
|
||||
{
|
||||
if (ddsd.format.redMask == 0x00ff0000 &&
|
||||
|
@ -233,7 +234,7 @@ Image* LoadDDSImage(const fs::path& filename)
|
|||
|
||||
if (format == -1)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Unsupported format for DDS texture file %s.\n", filename);
|
||||
GetLogger()->error("Unsupported format for DDS texture file {}.\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -268,7 +269,7 @@ Image* LoadDDSImage(const fs::path& filename)
|
|||
|
||||
if (pixels == nullptr)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Failed to decompress DDS texture file %s.\n", filename);
|
||||
GetLogger()->error("Failed to decompress DDS texture file {}.\n", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -302,7 +303,7 @@ Image* LoadDDSImage(const fs::path& filename)
|
|||
in.read(reinterpret_cast<char*>(img->getPixels()), img->getSize());
|
||||
if (!in.eof() && !in.good())
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Failed reading data from DDS texture file %s.\n", filename);
|
||||
GetLogger()->error("Failed reading data from DDS texture file {}.\n", filename);
|
||||
delete img;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -15,9 +15,10 @@ extern "C" {
|
|||
#include <jpeglib.h>
|
||||
}
|
||||
#include <celengine/image.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
|
||||
using celestia::PixelFormat;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -190,7 +191,7 @@ bool SaveJPEGImage(const fs::path& filename,
|
|||
#endif
|
||||
if (out == nullptr)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Can't open screen capture file '%s'\n", filename);
|
||||
GetLogger()->error("Can't open screen capture file '{}'\n", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,15 +11,12 @@
|
|||
#include <iostream>
|
||||
#include <png.h>
|
||||
#include <zlib.h>
|
||||
#include <fmt/ostream.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <celengine/image.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/gettext.h>
|
||||
|
||||
using std::cerr;
|
||||
using std::clog;
|
||||
using celestia::PixelFormat;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -27,7 +24,7 @@ void PNGReadData(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||
{
|
||||
auto* fp = (FILE*) png_get_io_ptr(png_ptr);
|
||||
if (fread((void*) data, 1, length, fp) != length)
|
||||
cerr << "Error reading PNG data";
|
||||
GetLogger()->error("Error reading PNG data");
|
||||
}
|
||||
|
||||
void PNGWriteData(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
|
@ -54,7 +51,7 @@ Image* LoadPNGImage(const fs::path& filename)
|
|||
#endif
|
||||
if (fp == nullptr)
|
||||
{
|
||||
clog << fmt::sprintf(_("Error opening image file %s\n"), filename);
|
||||
GetLogger()->error(_("Error opening image file {}.\n"), filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -62,7 +59,7 @@ Image* LoadPNGImage(const fs::path& filename)
|
|||
elements_read = fread(header, 1, sizeof(header), fp);
|
||||
if (elements_read == 0 || png_sig_cmp((unsigned char*) header, 0, sizeof(header)))
|
||||
{
|
||||
clog << fmt::sprintf(_("Error: %s is not a PNG file.\n"), filename);
|
||||
GetLogger()->error(_("Error: {} is not a PNG file.\n"), filename);
|
||||
fclose(fp);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -88,7 +85,7 @@ Image* LoadPNGImage(const fs::path& filename)
|
|||
fclose(fp);
|
||||
delete img;
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) nullptr);
|
||||
clog << fmt::sprintf(_("Error reading PNG image file %s\n"), filename);
|
||||
GetLogger()->error(_("Error reading PNG image file {}\n"), filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -178,7 +175,7 @@ bool SavePNGImage(const fs::path& filename,
|
|||
#endif
|
||||
if (out == nullptr)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Can't open screen capture file '%s'\n", filename);
|
||||
GetLogger()->error(_("Can't open screen capture file '{}'\n"), filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -209,7 +206,7 @@ bool SavePNGImage(const fs::path& filename,
|
|||
|
||||
if (png_ptr == nullptr)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Screen capture: error allocating png_ptr\n");
|
||||
GetLogger()->error("Error allocating png_ptr\n");
|
||||
fclose(out);
|
||||
delete[] row_pointers;
|
||||
return false;
|
||||
|
@ -218,7 +215,7 @@ bool SavePNGImage(const fs::path& filename,
|
|||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == nullptr)
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Screen capture: error allocating info_ptr\n");
|
||||
GetLogger()->error("Error allocating info_ptr\n");
|
||||
fclose(out);
|
||||
delete[] row_pointers;
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp) nullptr);
|
||||
|
@ -227,7 +224,7 @@ bool SavePNGImage(const fs::path& filename,
|
|||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Error writing PNG file '%s'\n", filename);
|
||||
GetLogger()->error(_("Error writing PNG file '{}'\n"), filename);
|
||||
fclose(out);
|
||||
delete[] row_pointers;
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <celutil/binaryread.h>
|
||||
#include <celutil/binarywrite.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celutil/tokenizer.h>
|
||||
#include "mesh.h"
|
||||
#include "model.h"
|
||||
|
@ -1905,7 +1906,7 @@ OpenModel(std::istream& in, HandleGetter& getHandle)
|
|||
char header[CEL_MODEL_HEADER_LENGTH];
|
||||
if (!in.read(header, CEL_MODEL_HEADER_LENGTH).good())
|
||||
{
|
||||
std::cerr << "Could not read model header\n";
|
||||
celutil::GetLogger()->error("Could not read model header\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1919,7 +1920,7 @@ OpenModel(std::istream& in, HandleGetter& getHandle)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Model file has invalid header.\n";
|
||||
celutil::GetLogger()->error("Model file has invalid header.\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1938,7 +1939,7 @@ LoadModel(std::istream& in, HandleGetter handleGetter)
|
|||
std::unique_ptr<Model> model = loader->load();
|
||||
if (model == nullptr)
|
||||
{
|
||||
std::cerr << "Error in model file: " << loader->getErrorMessage() << '\n';
|
||||
celutil::GetLogger()->error("Error in model file: {}\n", loader->getErrorMessage());
|
||||
}
|
||||
|
||||
return model;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <Eigen/Geometry>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <celengine/astro.h>
|
||||
#include <celengine/parser.h>
|
||||
|
@ -26,6 +26,7 @@
|
|||
using namespace std;
|
||||
using namespace celmath;
|
||||
using namespace celestia::scripts;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
static uint64_t parseRenderFlags(const string&, const FlagMap64&);
|
||||
|
@ -872,7 +873,7 @@ uint64_t parseRenderFlags(const string &s, const FlagMap64& RenderFlagMap)
|
|||
string name = tokenizer.getNameValue();
|
||||
|
||||
if (RenderFlagMap.count(name) == 0)
|
||||
cerr << "Unknown render flag: " << name << "\n";
|
||||
GetLogger()->warn("Unknown render flag: {}\n", name);
|
||||
else
|
||||
flags |= RenderFlagMap.at(name);
|
||||
|
||||
|
@ -901,7 +902,7 @@ int parseLabelFlags(const string &s, const FlagMap &LabelFlagMap)
|
|||
string name = tokenizer.getNameValue();
|
||||
|
||||
if (LabelFlagMap.count(name) == 0)
|
||||
cerr << "Unknown label flag: " << name << "\n";
|
||||
GetLogger()->warn("Unknown label flag: {}\n", name);
|
||||
else
|
||||
flags |= LabelFlagMap.at(name);
|
||||
|
||||
|
@ -931,7 +932,7 @@ int parseOrbitFlags(const string &s, const FlagMap &BodyTypeMap)
|
|||
name[0] = toupper(name[0]);
|
||||
|
||||
if (BodyTypeMap.count(name) == 0)
|
||||
cerr << "Unknown orbit flag: " << name << "\n";
|
||||
GetLogger()->warn("Unknown orbit flag: {}\n", name);
|
||||
else
|
||||
flags |= BodyTypeMap.at(name);
|
||||
|
||||
|
@ -971,7 +972,7 @@ int parseConstellations(CommandConstellations* cmd, const string &s, int act)
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Command Parser: error parsing render flags\n");
|
||||
GetLogger()->error("Command Parser: error parsing render flags\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1011,7 +1012,7 @@ int parseConstellationColor(CommandConstellationColor* cmd, const string &s, Eig
|
|||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(LOG_LEVEL_ERROR, "Command Parser: error parsing render flags\n");
|
||||
GetLogger()->error("Command Parser: error parsing render flags\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <celestia/celestiacore.h>
|
||||
#include <celengine/multitexture.h>
|
||||
#include <celutil/filetype.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
@ -26,6 +27,7 @@
|
|||
using namespace std;
|
||||
using namespace Eigen;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
double InstantaneousCommand::getDuration() const
|
||||
|
@ -840,7 +842,7 @@ void CommandSetLineColor::process(ExecutionEnvironment& env)
|
|||
auto &LineColorMap = env.getCelestiaCore()->scriptMaps()->LineColorMap;
|
||||
if (LineColorMap.count(item) == 0)
|
||||
{
|
||||
cerr << "Unknown line style: " << item << "\n";
|
||||
GetLogger()->warn("Unknown line style: {}\n", item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -863,7 +865,7 @@ void CommandSetLabelColor::process(ExecutionEnvironment& env)
|
|||
auto &LabelColorMap = env.getCelestiaCore()->scriptMaps()->LabelColorMap;
|
||||
if (LabelColorMap.count(item) == 0)
|
||||
{
|
||||
cerr << "Unknown label style: " << item << "\n";
|
||||
GetLogger()->error("Unknown label style: {}\n", item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include <celscript/legacy/execution.h>
|
||||
#include <celengine/timeline.h>
|
||||
#include <celengine/timelinephase.h>
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <celestia/celestiacore.h>
|
||||
#include <celestia/url.h>
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
|||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
const char* CelxLua::ClassNames[] =
|
||||
{
|
||||
|
@ -255,7 +256,7 @@ static void checkTimeslice(lua_State* l, lua_Debug* /*ar*/)
|
|||
if (luastate->timesliceExpired())
|
||||
{
|
||||
const char* errormsg = "Timeout: script hasn't returned control to celestia (forgot to call wait()?)";
|
||||
cerr << errormsg << "\n";
|
||||
GetLogger()->error("{}\n", errormsg);
|
||||
lua_pushstring(l, errormsg);
|
||||
lua_error(l);
|
||||
}
|
||||
|
@ -291,7 +292,10 @@ void LuaState::cleanup()
|
|||
|
||||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 0, 0, 0) != 0)
|
||||
cerr << "Error while executing cleanup-callback: " << lua_tostring(costate, -1) << "\n";
|
||||
{
|
||||
GetLogger()->error("Error while executing cleanup-callback: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -429,7 +433,7 @@ bool LuaState::charEntered(const char* c_p)
|
|||
CelestiaCore* appCore = getAppCore(costate, NoErrors);
|
||||
if (appCore == nullptr)
|
||||
{
|
||||
cerr << "ERROR: appCore not found\n";
|
||||
GetLogger()->error("ERROR: appCore not found\n");
|
||||
return true;
|
||||
}
|
||||
appCore->setTextEnterMode(appCore->getTextEnterMode() & ~CelestiaCore::KbPassToScript);
|
||||
|
@ -448,7 +452,7 @@ bool LuaState::charEntered(const char* c_p)
|
|||
}
|
||||
else
|
||||
{
|
||||
cerr << "Oops, expected savedrenderflags to be userdata\n";
|
||||
GetLogger()->warn("Oops, expected savedrenderflags to be userdata\n");
|
||||
}
|
||||
lua_settop(costate,stackTop);
|
||||
return true;
|
||||
|
@ -459,7 +463,8 @@ bool LuaState::charEntered(const char* c_p)
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 1, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing keyboard-callback: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing keyboard-callback: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
|
@ -486,7 +491,7 @@ bool LuaState::handleKeyEvent(const char* key)
|
|||
lua_getfield(costate, LUA_REGISTRYINDEX, EventHandlers);
|
||||
if (!lua_istable(costate, -1))
|
||||
{
|
||||
cerr << "Missing event handler table";
|
||||
GetLogger()->error("Missing event handler table");
|
||||
lua_pop(costate, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -505,7 +510,8 @@ bool LuaState::handleKeyEvent(const char* key)
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 1, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing keyboard callback: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing keyboard callback: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -533,7 +539,7 @@ bool LuaState::handleMouseButtonEvent(float x, float y, int button, bool down)
|
|||
lua_getfield(costate, LUA_REGISTRYINDEX, EventHandlers);
|
||||
if (!lua_istable(costate, -1))
|
||||
{
|
||||
cerr << "Missing event handler table";
|
||||
GetLogger()->error("Missing event handler table");
|
||||
lua_pop(costate, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -558,7 +564,8 @@ bool LuaState::handleMouseButtonEvent(float x, float y, int button, bool down)
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 1, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing keyboard callback: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing keyboard callback: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -589,7 +596,7 @@ bool LuaState::handleTickEvent(double dt)
|
|||
lua_getfield(costate, LUA_REGISTRYINDEX, EventHandlers);
|
||||
if (!lua_istable(costate, -1))
|
||||
{
|
||||
cerr << "Missing event handler table";
|
||||
GetLogger()->error("Missing event handler table");
|
||||
lua_pop(costate, 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -608,7 +615,8 @@ bool LuaState::handleTickEvent(double dt)
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 1, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing tick callback: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing tick callback: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -742,7 +750,7 @@ bool LuaState::tick(double dt)
|
|||
CelestiaCore* appCore = getAppCore(costate, NoErrors);
|
||||
if (appCore == nullptr)
|
||||
{
|
||||
cerr << "ERROR: appCore not found\n";
|
||||
GetLogger()->error("ERROR: appCore not found\n");
|
||||
return true;
|
||||
}
|
||||
lua_pushstring(state, "celestia-savedrenderflags");
|
||||
|
@ -931,7 +939,7 @@ const char* Celx_SafeGetString(lua_State* l,
|
|||
{
|
||||
if (l == nullptr)
|
||||
{
|
||||
cerr << "Error: LuaState invalid in Celx_SafeGetString\n";
|
||||
GetLogger()->error("Error: LuaState invalid in Celx_SafeGetString\n");
|
||||
return nullptr;
|
||||
}
|
||||
int argc = lua_gettop(l);
|
||||
|
@ -958,7 +966,7 @@ lua_Number Celx_SafeGetNumber(lua_State* l, int index, FatalErrors fatalErrors,
|
|||
{
|
||||
if (l == nullptr)
|
||||
{
|
||||
cerr << "Error: LuaState invalid in Celx_SafeGetNumber\n";
|
||||
GetLogger()->error("Error: LuaState invalid in Celx_SafeGetNumber\n");
|
||||
return 0.0;
|
||||
}
|
||||
int argc = lua_gettop(l);
|
||||
|
@ -991,7 +999,7 @@ bool Celx_SafeGetBoolean(lua_State* l, int index, FatalErrors fatalErrors,
|
|||
{
|
||||
if (l == nullptr)
|
||||
{
|
||||
cerr << "Error: LuaState invalid in Celx_SafeGetBoolean\n";
|
||||
GetLogger()->error("Error: LuaState invalid in Celx_SafeGetBoolean\n");
|
||||
return false;
|
||||
}
|
||||
int argc = lua_gettop(l);
|
||||
|
@ -1187,7 +1195,8 @@ bool LuaState::callLuaHook(void* obj, const char* method)
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 1, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing Lua Hook: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing Lua Hook: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1230,7 +1239,8 @@ bool LuaState::callLuaHook(void* obj, const char* method, const char* keyName)
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 2, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing Lua Hook: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing Lua Hook: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1274,7 +1284,8 @@ bool LuaState::callLuaHook(void* obj, const char* method, float x, float y)
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 3, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing Lua Hook: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing Lua Hook: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1319,11 +1330,12 @@ bool LuaState::callLuaHook(void* obj, const char* method, float x, float y, int
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 4, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing Lua Hook: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing Lua Hook: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
handled = lua_toboolean(costate, -1) == 1 ? true : false;
|
||||
handled = lua_toboolean(costate, -1) == 1;
|
||||
}
|
||||
lua_pop(costate, 1); // pop the return value
|
||||
}
|
||||
|
@ -1361,11 +1373,12 @@ bool LuaState::callLuaHook(void* obj, const char* method, double dt)
|
|||
timeout = getTime() + 1.0;
|
||||
if (lua_pcall(costate, 2, 1, 0) != 0)
|
||||
{
|
||||
cerr << "Error while executing Lua Hook: " << lua_tostring(costate, -1) << "\n";
|
||||
GetLogger()->error("Error while executing Lua Hook: {}\n",
|
||||
lua_tostring(costate, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
handled = lua_toboolean(costate, -1) == 1 ? true : false;
|
||||
handled = lua_toboolean(costate, -1) == 1;
|
||||
}
|
||||
lua_pop(costate, 1); // pop the return value
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <fmt/printf.h>
|
||||
|
||||
#include <celutil/debug.h>
|
||||
#include "celx.h"
|
||||
#include "celx_internal.h"
|
||||
#include "celx_category.h"
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <celutil/debug.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "celttf/truetypefont.h"
|
||||
#include <fmt/printf.h>
|
||||
#include <celengine/category.h>
|
||||
|
@ -35,6 +35,7 @@
|
|||
using namespace std;
|
||||
using namespace Eigen;
|
||||
using namespace celestia::scripts;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
extern const char* KbdCallback;
|
||||
extern const char* CleanupCallback;
|
||||
|
@ -263,7 +264,7 @@ static int celestia_setrenderflags(lua_State* l)
|
|||
}
|
||||
else
|
||||
{
|
||||
cerr << "Unknown key: " << key << "\n";
|
||||
GetLogger()->warn("Unknown key: {}\n", key);
|
||||
}
|
||||
lua_pop(l,1);
|
||||
}
|
||||
|
@ -387,7 +388,7 @@ static int celestia_setlabelflags(lua_State* l)
|
|||
}
|
||||
if (LabelFlagMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown key: " << key << "\n";
|
||||
GetLogger()->warn("Unknown key: {}\n", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -458,7 +459,7 @@ static int celestia_setorbitflags(lua_State* l)
|
|||
}
|
||||
if (BodyTypeMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown key: " << key << "\n";
|
||||
GetLogger()->warn("Unknown key: {}\n", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -664,7 +665,7 @@ static int celestia_setoverlayelements(lua_State* l)
|
|||
}
|
||||
if (OverlayElementMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown key: " << key << "\n";
|
||||
GetLogger()->warn("Unknown key: {}\n", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -745,7 +746,7 @@ static int celestia_setlabelcolor(lua_State* l)
|
|||
auto &LabelColorMap = this_celestia(l)->scriptMaps()->LabelColorMap;
|
||||
if (LabelColorMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown label style: " << key << "\n";
|
||||
GetLogger()->warn("Unknown label style: {}\n", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -777,7 +778,7 @@ static int celestia_getlabelcolor(lua_State* l)
|
|||
auto &LabelColorMap = this_celestia(l)->scriptMaps()->LabelColorMap;
|
||||
if (LabelColorMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown label style: " << key << "\n";
|
||||
GetLogger()->error("Unknown label style: {}\n", key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -805,7 +806,7 @@ static int celestia_setlinecolor(lua_State* l)
|
|||
auto &LineColorMap = this_celestia(l)->scriptMaps()->LineColorMap;
|
||||
if (LineColorMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown line style: " << key << "\n";
|
||||
GetLogger()->warn("Unknown line style: {}\n", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -836,7 +837,7 @@ static int celestia_getlinecolor(lua_State* l)
|
|||
auto &LineColorMap = this_celestia(l)->scriptMaps()->LineColorMap;
|
||||
if (LineColorMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown line style: " << key << "\n";
|
||||
GetLogger()->error("Unknown line style: {}\n", key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <celutil/debug.h>
|
||||
#include "celx_misc.h"
|
||||
#include "celx_internal.h"
|
||||
#include <celscript/legacy/cmdparser.h>
|
||||
|
|
|
@ -22,9 +22,11 @@
|
|||
#include <celengine/multitexture.h>
|
||||
#include <celestia/celestiacore.h>
|
||||
#include <celscript/common/scriptmaps.h>
|
||||
#include <celutil/logger.h>
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
static const char* bodyTypeName(int cl)
|
||||
|
@ -264,7 +266,7 @@ static int object_setorbitvisibility(lua_State* l)
|
|||
auto &OrbitVisibilityMap = celx.appCore(AllErrors)->scriptMaps()->OrbitVisibilityMap;
|
||||
if (OrbitVisibilityMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown visibility policy: " << key << endl;
|
||||
GetLogger()->warn("Unknown visibility policy: {}\n", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -16,11 +16,13 @@
|
|||
//#include <celengine/body.h>
|
||||
//#include <celengine/timelinephase.h>
|
||||
#include <celestia/celestiacore.h>
|
||||
#include <celutil/logger.h>
|
||||
#include <Eigen/Geometry>
|
||||
|
||||
using namespace std;
|
||||
using namespace Eigen;
|
||||
using namespace celmath;
|
||||
using celestia::util::GetLogger;
|
||||
|
||||
|
||||
// ==================== Observer ====================
|
||||
|
@ -898,7 +900,7 @@ static int observer_setlocationflags(lua_State* l)
|
|||
auto &LocationFlagMap = celx.appCore(AllErrors)->scriptMaps()->LocationFlagMap;
|
||||
if (LocationFlagMap.count(key) == 0)
|
||||
{
|
||||
cerr << "Unknown key: " << key << "\n";
|
||||
GetLogger()->warn("Unknown key: {}\n", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <celestia/configfile.h>
|
||||
#include <celestia/celestiacore.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include <celutil/logger.h>
|
||||
#include "celx_internal.h"
|
||||
#include "luascript.h"
|
||||
|
||||
|
@ -23,6 +24,8 @@ using namespace std;
|
|||
|
||||
namespace celestia
|
||||
{
|
||||
using util::GetLogger;
|
||||
|
||||
namespace scripts
|
||||
{
|
||||
|
||||
|
@ -167,7 +170,7 @@ static string lua_path(const CelestiaConfig *config)
|
|||
std::error_code ec;
|
||||
if (!fs::is_directory(dir, ec))
|
||||
{
|
||||
cerr << fmt::sprintf(_("Path %s doesn't exist or isn't a directory\n"), dir);
|
||||
GetLogger()->warn(_("Path {} doesn't exist or isn't a directory\n"), dir);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -222,7 +225,7 @@ bool CreateLuaEnvironment(CelestiaCore *appCore, const CelestiaConfig *config, P
|
|||
|
||||
if (status != 0)
|
||||
{
|
||||
cerr << "lua hook load failed\n";
|
||||
GetLogger()->debug("lua hook load failed\n");
|
||||
string errMsg = luaHook->getErrorMessage();
|
||||
if (errMsg.empty())
|
||||
errMsg = _("Unknown error loading hook script");
|
||||
|
@ -235,7 +238,7 @@ bool CreateLuaEnvironment(CelestiaCore *appCore, const CelestiaConfig *config, P
|
|||
// script and Celestia's event loop
|
||||
if (!luaHook->createThread())
|
||||
{
|
||||
cerr << "hook thread failed\n";
|
||||
GetLogger()->debug("hook thread failed\n");
|
||||
appCore->fatalError(_("Script coroutine initialization failed"));
|
||||
luaHook = nullptr;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue