Replacing a few std::cout with spdlog::info/error

This commit is contained in:
Nigel Barink 2023-05-09 19:36:34 +02:00
parent 52747202d3
commit 43fc721413
9 changed files with 24 additions and 24 deletions

View File

@ -47,7 +47,7 @@ protected:
return ASSET_TYPE::File; return ASSET_TYPE::File;
} }
else { else {
std::cout << "unknown file!" << std::endl; spdlog::warn("unknown file!");
return ASSET_TYPE::Unknown; return ASSET_TYPE::Unknown;
} }
} }

View File

@ -94,11 +94,11 @@ Asset ModelLoader::LoadAsset(std::filesystem::path& path) {
aiNode* currentNode = scene->mRootNode; aiNode* currentNode = scene->mRootNode;
std::cout << "Loading meshes!" << std::endl; spdlog::info("Loading meshes!" );
auto meshes = processNode(currentNode, scene); auto meshes = processNode(currentNode, scene);
std::cout << "Model file contained " << meshes.size() << " meshes" << std::endl; spdlog::info("Model file contained {0} meshes", meshes.size() );

View File

@ -45,10 +45,10 @@ YoggieEngine::Mesh* AssetRegistry::LoadFromAssetFile(const std::filesystem::path
AssetFile.read((char*)&Enum, sizeof(uint32_t)); AssetFile.read((char*)&Enum, sizeof(uint32_t));
// print Header info // print Header info
std::cout << "File has header: " << Header << std::endl; spdlog::info("File has header: {0}", Header);
std::cout << "Vertex size: " << Vsize << std::endl; spdlog::info ( "Vertex size: {0}", Vsize );
std::cout << "Number of Vertices: " << Vnum << std::endl; spdlog::info("Number of Vertices: {0}" ,Vnum );
std::cout << "Number of Elements: " << Enum << std::endl; spdlog::info ("Number of Elements: " , Enum );
free(Header); free(Header);
@ -77,7 +77,7 @@ YoggieEngine::Mesh* AssetRegistry::LoadFromAssetFile(const std::filesystem::path
} }
else { else {
std::cout << "Failed ot open mesh " << std::endl; spdlog::error( "Failed ot open mesh " );
} }
return imported; return imported;
@ -92,7 +92,7 @@ YoggieEngine::Renderable* AssetRegistry::LoadFromSource(const std::filesystem::p
* auto model = (YoggieEngine::ModelImporter()).Import(srcPath.string()); * auto model = (YoggieEngine::ModelImporter()).Import(srcPath.string());
YoggieEngine::Mesh* exportMesh = model->renderable->mesh; YoggieEngine::Mesh* exportMesh = model->renderable->mesh;
std::filesystem::path MeshFileName = assetFolder / srcPath.filename().replace_extension(".mesh"); std::filesystem::path MeshFileName = assetFolder / srcPath.filename().replace_extension(".mesh");
std::cout << "Save path: " << MeshFileName << std::endl; spdlog::info( "Save path: {0}" , MeshFileName );
std::ofstream meshAsset; std::ofstream meshAsset;
meshAsset.open(MeshFileName, std::ios::binary); meshAsset.open(MeshFileName, std::ios::binary);
@ -102,8 +102,8 @@ YoggieEngine::Renderable* AssetRegistry::LoadFromSource(const std::filesystem::p
static const char* HEADER = "MESH"; static const char* HEADER = "MESH";
meshAsset.write(HEADER, sizeof(HEADER)); meshAsset.write(HEADER, sizeof(HEADER));
auto Vsize = sizeof(YoggieEngine::Vertex); auto Vsize = sizeof(YoggieEngine::Vertex);
std::cout << "size of vertex: " << Vsize << std::endl; spdlog::info( "size of vertex: {0}" ,Vsize );
std::cout << "Addr of vSize: " << &Vsize << std::endl; spdlog::info("Addr of vSize: {0}" , &Vsize );
auto Vnum = exportMesh->vertices.size(); auto Vnum = exportMesh->vertices.size();
auto Enum = exportMesh->elements.size(); auto Enum = exportMesh->elements.size();

View File

@ -6,7 +6,7 @@
void WriteFile(std::string& emitter, std::filesystem::path path) void WriteFile(std::string& emitter, std::filesystem::path path)
{ {
std::cout << "Writing Scene file to: " << path.u8string() << std::endl; spdlog::info( "Writing Scene file to: {0}" , path.u8string());
std::ofstream sceneFile; std::ofstream sceneFile;
sceneFile.open(path.u8string()); sceneFile.open(path.u8string());

View File

@ -31,9 +31,9 @@ public:
location = std::string(path); location = std::string(path);
break; break;
case(NFD_CANCEL): case(NFD_CANCEL):
std::cout << "NFD_CANCEL" << std::endl; spdlog::info("NFD_CANCEL" );
case (NFD_ERROR): case (NFD_ERROR):
std::cout << "NFD_Error: " << NFD_GetError() << std::endl; spdlog::error("NFD_Error: {0}" , NFD_GetError() );
break; break;
}; };

View File

@ -40,10 +40,10 @@ public:
AssetRegistry assetManager = AssetRegistry(); AssetRegistry assetManager = AssetRegistry();
ModelLoader modelLoader = ModelLoader(); ModelLoader modelLoader = ModelLoader();
std::cout << project.GetProjectDirectory() << std::endl; spdlog::info( "{0}", project.GetProjectDirectory().string());
auto latern = modelLoader.LoadAsset(std::filesystem::path("build/debug/Models/Latern.gltf")); auto latern = modelLoader.LoadAsset(std::filesystem::path("build/debug/Models/Latern.gltf"));
std::cout << "Loaded mesh: " << latern.GetName() << std::endl; spdlog::info( "Loaded mesh: {0}" , latern.GetName() );
//ProjectInfo projectInfo(project); //ProjectInfo projectInfo(project);
//Settings settings = Settings(); //Settings settings = Settings();
@ -61,7 +61,7 @@ public:
if (sceneview.isFocused) { if (sceneview.isFocused) {
UpdateSceneCamera(sceneview); UpdateSceneCamera(sceneview);
std::cout << "Scene view in Focus!\r"; spdlog::info( "Scene view in Focus!\r");
} }
} }
@ -95,12 +95,12 @@ public:
void OnCreate() override { void OnCreate() override {
std::cout << " Layer Create!" << std::endl; spdlog::info(" Layer Create!" );
} }
void OnDestroy() override { void OnDestroy() override {
std::cout << " Layer Destroy!" << std::endl; spdlog::info( " Layer Destroy!" );
} }

View File

@ -25,7 +25,7 @@ void MainMenuBar::ApplicationMenu(Project& project) {
case(NFD_CANCEL): case(NFD_CANCEL):
break; break;
case(NFD_ERROR): case(NFD_ERROR):
std::cout << "NFD_Error: " << NFD_GetError() << std::endl; spdlog::error( "NFD_Error: {0}" , NFD_GetError() );
break; break;
} }
@ -35,13 +35,13 @@ void MainMenuBar::ApplicationMenu(Project& project) {
nfdresult_t result = NFD_SaveDialog({ "yproj" }, NULL, &path); nfdresult_t result = NFD_SaveDialog({ "yproj" }, NULL, &path);
switch (result) { switch (result) {
case(NFD_OKAY): case(NFD_OKAY):
std::cout << "Save as: " << path << std::endl; spdlog::info( "Save as: {0}" , path );
Project::SaveProject(path, project); Project::SaveProject(path, project);
break; break;
case(NFD_CANCEL): case(NFD_CANCEL):
break; break;
case(NFD_ERROR): case(NFD_ERROR):
std::cout << "NFD_Error: " << NFD_GetError() << std::endl; spdlog::error( "NFD_Error: {0}" , NFD_GetError() );
break; break;
} }
} }

View File

@ -9,7 +9,7 @@ class Project {
public: public:
Project() = default; Project() = default;
Project(const std::string& name): Name(name){} Project(const std::string& name): Name(name){}
~Project() { std::cout << "Unloading project..." << Name << std::endl; } ~Project() { spdlog::info("Unloading project {0}...", Name);}
void setName(std::string& name) { Name = name; } void setName(std::string& name) { Name = name; }
const std::string& GetName()const { return Name; } const std::string& GetName()const { return Name; }

View File

@ -9,7 +9,7 @@ namespace YoggieEngine {
void EngineInstrumentation::PerfomanceSamplerInit() { void EngineInstrumentation::PerfomanceSamplerInit() {
std::cout << "Initialize perf sampler" << std::endl; spdlog::info( "Initialize perf sampler" );
/*EngineInstrumentation::frames = 0; /*EngineInstrumentation::frames = 0;
EngineInstrumentation::lastSampleTime = GetPrecisionTime();*/ EngineInstrumentation::lastSampleTime = GetPrecisionTime();*/
} }