Compare commits

..

No commits in common. "c82398205a84ecdf7bf39afa38aa8c30a2ca482c" and "52747202d394dd3b3e9727ca675d5e34b21a78cd" have entirely different histories.

12 changed files with 35 additions and 81 deletions

View File

@ -47,7 +47,7 @@ protected:
return ASSET_TYPE::File; return ASSET_TYPE::File;
} }
else { else {
spdlog::warn("unknown file!"); std::cout << "unknown file!" << std::endl;
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;
spdlog::info("Loading meshes!" ); std::cout << "Loading meshes!" << std::endl;
auto meshes = processNode(currentNode, scene); auto meshes = processNode(currentNode, scene);
spdlog::info("Model file contained {0} meshes", meshes.size() ); std::cout << "Model file contained " << meshes.size() << " meshes" << std::endl;

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
spdlog::info("File has header: {0}", Header); std::cout << "File has header: " << Header << std::endl;
spdlog::info ( "Vertex size: {0}", Vsize ); std::cout << "Vertex size: " << Vsize << std::endl;
spdlog::info("Number of Vertices: {0}" ,Vnum ); std::cout << "Number of Vertices: " << Vnum << std::endl;
spdlog::info ("Number of Elements: " , Enum ); std::cout << "Number of Elements: " << Enum << std::endl;
free(Header); free(Header);
@ -77,7 +77,7 @@ YoggieEngine::Mesh* AssetRegistry::LoadFromAssetFile(const std::filesystem::path
} }
else { else {
spdlog::error( "Failed ot open mesh " ); std::cout << "Failed ot open mesh " << std::endl;
} }
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");
spdlog::info( "Save path: {0}" , MeshFileName ); std::cout << "Save path: " << MeshFileName << std::endl;
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);
spdlog::info( "size of vertex: {0}" ,Vsize ); std::cout << "size of vertex: " << Vsize << std::endl;
spdlog::info("Addr of vSize: {0}" , &Vsize ); std::cout << "Addr of vSize: " << &Vsize << std::endl;
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)
{ {
spdlog::info( "Writing Scene file to: {0}" , path.u8string()); std::cout << "Writing Scene file to: " << path.u8string() << std::endl;
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):
spdlog::info("NFD_CANCEL" ); std::cout << "NFD_CANCEL" << std::endl;
case (NFD_ERROR): case (NFD_ERROR):
spdlog::error("NFD_Error: {0}" , NFD_GetError() ); std::cout << "NFD_Error: " << NFD_GetError() << std::endl;
break; break;
}; };

View File

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

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):
spdlog::error( "NFD_Error: {0}" , NFD_GetError() ); std::cout << "NFD_Error: " << NFD_GetError() << std::endl;
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):
spdlog::info( "Save as: {0}" , path ); std::cout << "Save as: " << path << std::endl;
Project::SaveProject(path, project); Project::SaveProject(path, project);
break; break;
case(NFD_CANCEL): case(NFD_CANCEL):
break; break;
case(NFD_ERROR): case(NFD_ERROR):
spdlog::error( "NFD_Error: {0}" , NFD_GetError() ); std::cout << "NFD_Error: " << NFD_GetError() << std::endl;
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() { spdlog::info("Unloading project {0}...", Name);} ~Project() { std::cout << "Unloading project..." << Name << std::endl; }
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

@ -134,29 +134,9 @@ void Inspector::ShowComponents()
} }
if (selected.HasComponent<YoggieEngine::ScriptComponent>()) { if (selected.HasComponent<YoggieEngine::ScriptComponent>()) {
const char* AssetNames[]{ "Script 1" , "Script 2" }; ComponentView("Scripting", [] {
if (ImGui::CollapsingHeader("Script", ImGuiTreeNodeFlags_Leaf)) { ImGui::LabelText("##--", "Hello scripting");
});
if (ImGui::Button("Select Renderable Asset"))
ImGui::OpenPopup("Scripts_list_popup");
if (ImGui::BeginPopup("Scripts_list_popup")) {
ImGui::Text("None");
ImGui::Separator();
for (int i = 0; i < IM_ARRAYSIZE(AssetNames); i++) {
if (ImGui::Selectable(AssetNames[i]))
{
}
}
ImGui::EndPopup();
}
ImGui::SameLine();
std::string scriptAssetId = "<Random_GUID>";
ImGui::InputText("asset", scriptAssetId.data(), scriptAssetId.length(), ImGuiInputTextFlags_ReadOnly | ImGuiInputTextFlags_AutoSelectAll);
}
} }
} }

View File

@ -23,26 +23,14 @@ namespace YoggieEngine {
io.ConfigFlags |= ImGuiConfigFlags_::ImGuiConfigFlags_ViewportsEnable; io.ConfigFlags |= ImGuiConfigFlags_::ImGuiConfigFlags_ViewportsEnable;
io.ConfigFlags |= ImGuiConfigFlags_::ImGuiConfigFlags_DockingEnable; io.ConfigFlags |= ImGuiConfigFlags_::ImGuiConfigFlags_DockingEnable;
io.Fonts->AddFontFromFileTTF("build/Debug/Fonts/Roboto-Regular.ttf", 18); io.Fonts->AddFontFromFileTTF("build/Debug/Fonts/Roboto-Regular.ttf", 18);
ImGui::StyleColorsDark(); ImGui::StyleColorsDark();
/*
ImGuiStyle* style = &ImGui::GetStyle();
ImVec4* colors = style->Colors;
colors[ImGuiCol_TitleBg] = ImVec4(0.72f, 0.24f, 0.87f, 1.00f);
colors[ImGuiCol_MenuBarBg] = ImVec4(0.72f, 0.24f, 0.87f, 1.00f);
colors[ImGuiCol_Tab] = ImVec4(0.53f, 0.09f, 0.67f, 1.00f);
*/
ImGui_ImplGlfw_InitForOpenGL((GLFWwindow*)appWindow->GetHandle(), true); ImGui_ImplGlfw_InitForOpenGL((GLFWwindow*)appWindow->GetHandle(), true);
ImGui_ImplOpenGL3_Init("#version 450"); ImGui_ImplOpenGL3_Init("#version 450");
ImGuizmo::SetImGuiContext(ImGui::GetCurrentContext()); ImGuizmo::SetImGuiContext(ImGui::GetCurrentContext());
//ImGuizmo::SetOrthographic(true); ImGuizmo::SetOrthographic(true);
init_inputSystem(appWindow); init_inputSystem(appWindow);

View File

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

View File

@ -1,7 +1,6 @@
#include "YoggieEngine.h" #include "YoggieEngine.h"
#include "glfwWindow.h" #include "glfwWindow.h"
#include <chrono>
#include<GLFW/glfw3.h>
namespace YoggieEngine { namespace YoggieEngine {
void LoadGLExtensions() { void LoadGLExtensions() {
@ -11,11 +10,6 @@ namespace YoggieEngine {
} }
} }
static void error_callback(int error, const char* description) {
spdlog::error("{0}", description);
}
glfwWindow::glfwWindow(const int width, const int height, const char* title) glfwWindow::glfwWindow(const int width, const int height, const char* title)
: NativeWindow() : NativeWindow()
{ {
@ -25,20 +19,15 @@ namespace YoggieEngine {
m_fullscreen = false; m_fullscreen = false;
glfwSetErrorCallback(error_callback);
auto start = std::chrono::high_resolution_clock::now();
if (!glfwInit()) { if (!glfwInit()) {
spdlog::error("Failed to initialise GLFW!"); spdlog::error("Failed to initialise GLFW!");
exit(-1); exit(-1);
} }
auto end = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds> (end - start);
spdlog::info("GLFWInit() call took {0} milliseconds.", duration.count());
glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE);
glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_TRUE); glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_TRUE);
if (m_fullscreen) { if (m_fullscreen) {
glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
} }
@ -46,7 +35,10 @@ namespace YoggieEngine {
if (!m_resizable) { if (!m_resizable) {
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
} }
if (!m_vsync) {
glfwSwapInterval(0);
}
window = glfwCreateWindow(m_width, m_height, title, NULL, NULL); window = glfwCreateWindow(m_width, m_height, title, NULL, NULL);
@ -57,12 +49,6 @@ namespace YoggieEngine {
} }
SetContext(); SetContext();
if (!m_vsync) {
glfwSwapInterval(0);
}
glfwGetFramebufferSize(window, &m_width, &m_height); glfwGetFramebufferSize(window, &m_width, &m_height);
LoadGLExtensions(); LoadGLExtensions();