Compare commits
	
		
			2 Commits
		
	
	
		
			52747202d3
			...
			c82398205a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c82398205a | |||
| 43fc721413 | 
| @ -47,7 +47,7 @@ protected: | ||||
| 			return ASSET_TYPE::File; | ||||
| 		} | ||||
| 		else { | ||||
| 			std::cout << "unknown file!" << std::endl; | ||||
| 			spdlog::warn("unknown file!"); | ||||
| 			return ASSET_TYPE::Unknown; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @ -94,11 +94,11 @@ Asset ModelLoader::LoadAsset(std::filesystem::path& path) { | ||||
| 	aiNode* currentNode = scene->mRootNode; | ||||
|  | ||||
| 	 | ||||
| 	std::cout << "Loading meshes!" << std::endl; | ||||
| 	spdlog::info("Loading meshes!" ); | ||||
|  | ||||
| 	auto meshes = processNode(currentNode, scene); | ||||
|  | ||||
| 	std::cout << "Model file contained " << meshes.size() << " meshes" << std::endl; | ||||
| 	spdlog::info("Model file contained {0} meshes", meshes.size() ); | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -45,10 +45,10 @@ YoggieEngine::Mesh* AssetRegistry::LoadFromAssetFile(const std::filesystem::path | ||||
| 		AssetFile.read((char*)&Enum, sizeof(uint32_t)); | ||||
|  | ||||
| 		// print Header info  | ||||
| 		std::cout << "File has header: " << Header << std::endl; | ||||
| 		std::cout << "Vertex size: " << Vsize << std::endl; | ||||
| 		std::cout << "Number of Vertices: " << Vnum << std::endl; | ||||
| 		std::cout << "Number of Elements: " << Enum << std::endl; | ||||
| 		spdlog::info("File has header: {0}", Header); | ||||
| 		spdlog::info ( "Vertex size: {0}", Vsize ); | ||||
| 		spdlog::info("Number of Vertices: {0}" ,Vnum ); | ||||
| 		spdlog::info ("Number of Elements: " , Enum ); | ||||
| 		free(Header); | ||||
|  | ||||
|  | ||||
| @ -77,7 +77,7 @@ YoggieEngine::Mesh* AssetRegistry::LoadFromAssetFile(const std::filesystem::path | ||||
|  | ||||
| 	} | ||||
| 	else { | ||||
| 		std::cout << "Failed ot open mesh " << std::endl; | ||||
| 		spdlog::error( "Failed ot open mesh " ); | ||||
| 	} | ||||
|  | ||||
| 	return imported; | ||||
| @ -92,7 +92,7 @@ YoggieEngine::Renderable* AssetRegistry::LoadFromSource(const std::filesystem::p | ||||
| 	* 	auto model = (YoggieEngine::ModelImporter()).Import(srcPath.string()); | ||||
| 	YoggieEngine::Mesh* exportMesh = model->renderable->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; | ||||
| 	meshAsset.open(MeshFileName, std::ios::binary); | ||||
| @ -102,8 +102,8 @@ YoggieEngine::Renderable* AssetRegistry::LoadFromSource(const std::filesystem::p | ||||
| 		static const char* HEADER = "MESH"; | ||||
| 		meshAsset.write(HEADER, sizeof(HEADER)); | ||||
| 		auto Vsize = sizeof(YoggieEngine::Vertex); | ||||
| 		std::cout << "size of vertex: " << Vsize << std::endl; | ||||
| 		std::cout << "Addr of vSize: " << &Vsize << std::endl; | ||||
| 		spdlog::info( "size of vertex: {0}" ,Vsize ); | ||||
| 		spdlog::info("Addr of vSize: {0}" , &Vsize ); | ||||
| 		auto Vnum = exportMesh->vertices.size(); | ||||
| 		auto Enum = exportMesh->elements.size(); | ||||
|  | ||||
|  | ||||
| @ -6,7 +6,7 @@ | ||||
|  | ||||
| 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; | ||||
| 	sceneFile.open(path.u8string()); | ||||
|  | ||||
|  | ||||
| @ -31,9 +31,9 @@ public: | ||||
|                     location = std::string(path); | ||||
|                     break; | ||||
|                 case(NFD_CANCEL): | ||||
|                     std::cout << "NFD_CANCEL" << std::endl; | ||||
|                     spdlog::info("NFD_CANCEL" ); | ||||
|                 case (NFD_ERROR): | ||||
|                     std::cout << "NFD_Error: " << NFD_GetError() << std::endl; | ||||
|                     spdlog::error("NFD_Error: {0}" , NFD_GetError() ); | ||||
|                     break; | ||||
|  | ||||
|                 }; | ||||
|  | ||||
| @ -40,10 +40,10 @@ public: | ||||
|         AssetRegistry assetManager = AssetRegistry(); | ||||
|         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")); | ||||
|         std::cout << "Loaded mesh: " << latern.GetName() << std::endl; | ||||
|         spdlog::info( "Loaded mesh: {0}" , latern.GetName() ); | ||||
|  | ||||
|         //ProjectInfo projectInfo(project); | ||||
|         //Settings settings = Settings(); | ||||
| @ -61,7 +61,7 @@ public: | ||||
| 		if (sceneview.isFocused) { | ||||
| 			UpdateSceneCamera(sceneview); | ||||
|  | ||||
| 			std::cout << "Scene view in Focus!\r"; | ||||
| 			spdlog::info( "Scene view in Focus!\r"); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
| @ -95,12 +95,12 @@ public: | ||||
|  | ||||
| 	 | ||||
| 	void OnCreate() override { | ||||
| 		std::cout << " Layer Create!" << std::endl; | ||||
| 		spdlog::info(" Layer Create!" ); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	void OnDestroy() override { | ||||
| 		std::cout << " Layer Destroy!" << std::endl; | ||||
| 		spdlog::info( " Layer Destroy!" ); | ||||
|  | ||||
| 	} | ||||
|  | ||||
|  | ||||
| @ -25,7 +25,7 @@ void MainMenuBar::ApplicationMenu(Project& project) { | ||||
|             case(NFD_CANCEL): | ||||
|                 break; | ||||
|             case(NFD_ERROR): | ||||
|                 std::cout << "NFD_Error: " << NFD_GetError() << std::endl; | ||||
|                 spdlog::error( "NFD_Error: {0}" , NFD_GetError() ); | ||||
|                 break; | ||||
|             } | ||||
|  | ||||
| @ -35,13 +35,13 @@ void MainMenuBar::ApplicationMenu(Project& project) { | ||||
|             nfdresult_t result = NFD_SaveDialog({ "yproj" }, NULL, &path); | ||||
|             switch (result) { | ||||
|             case(NFD_OKAY): | ||||
|                 std::cout << "Save as: " << path << std::endl; | ||||
|                 spdlog::info( "Save as: {0}" , path ); | ||||
|                 Project::SaveProject(path, project); | ||||
|                 break; | ||||
|             case(NFD_CANCEL): | ||||
|                 break; | ||||
|             case(NFD_ERROR): | ||||
|                 std::cout << "NFD_Error: " << NFD_GetError() << std::endl; | ||||
|                 spdlog::error( "NFD_Error: {0}" , NFD_GetError() ); | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -9,7 +9,7 @@ class Project { | ||||
| public: | ||||
| 	Project() = default; | ||||
| 	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; } | ||||
| 	const std::string& GetName()const { return Name; } | ||||
|  | ||||
| @ -134,9 +134,29 @@ void Inspector::ShowComponents() | ||||
|     } | ||||
|  | ||||
|     if (selected.HasComponent<YoggieEngine::ScriptComponent>()) { | ||||
|         ComponentView("Scripting", [] { | ||||
|             ImGui::LabelText("##--", "Hello scripting"); | ||||
|             }); | ||||
|         const char* AssetNames[]{ "Script 1" , "Script 2" }; | ||||
|         if (ImGui::CollapsingHeader("Script", ImGuiTreeNodeFlags_Leaf)) { | ||||
|              | ||||
|             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); | ||||
|              | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -23,14 +23,26 @@ namespace YoggieEngine { | ||||
| 		io.ConfigFlags |= ImGuiConfigFlags_::ImGuiConfigFlags_ViewportsEnable; | ||||
| 		io.ConfigFlags |= ImGuiConfigFlags_::ImGuiConfigFlags_DockingEnable; | ||||
| 		io.Fonts->AddFontFromFileTTF("build/Debug/Fonts/Roboto-Regular.ttf", 18); | ||||
|  | ||||
| 		 | ||||
| 		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_ImplOpenGL3_Init("#version 450"); | ||||
|  | ||||
| 		ImGuizmo::SetImGuiContext(ImGui::GetCurrentContext()); | ||||
| 		ImGuizmo::SetOrthographic(true); | ||||
| 		//ImGuizmo::SetOrthographic(true); | ||||
|  | ||||
|  | ||||
| 		init_inputSystem(appWindow); | ||||
|  | ||||
| @ -9,7 +9,7 @@ namespace YoggieEngine { | ||||
|  | ||||
| 	void EngineInstrumentation::PerfomanceSamplerInit() { | ||||
|  | ||||
| 		std::cout << "Initialize perf sampler" << std::endl; | ||||
| 		spdlog::info( "Initialize perf sampler" ); | ||||
| 		/*EngineInstrumentation::frames = 0; | ||||
| 		EngineInstrumentation::lastSampleTime = GetPrecisionTime();*/ | ||||
| 	} | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| #include "YoggieEngine.h" | ||||
| #include "glfwWindow.h" | ||||
|  | ||||
| #include <chrono> | ||||
| #include<GLFW/glfw3.h> | ||||
| namespace YoggieEngine { | ||||
|  | ||||
| 	void LoadGLExtensions() { | ||||
| @ -10,6 +11,11 @@ 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) | ||||
| 	: NativeWindow() | ||||
| 	{ | ||||
| @ -19,15 +25,20 @@ namespace YoggieEngine { | ||||
| 		m_fullscreen = false; | ||||
|  | ||||
|  | ||||
| 		glfwSetErrorCallback(error_callback); | ||||
|  | ||||
| 		auto start = std::chrono::high_resolution_clock::now(); | ||||
| 		if (!glfwInit()) { | ||||
|  | ||||
| 			spdlog::error("Failed to initialise GLFW!"); | ||||
| 			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_FOCUS_ON_SHOW, GLFW_TRUE); | ||||
|  | ||||
| 		if (m_fullscreen) { | ||||
| 			glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); | ||||
| 		} | ||||
| @ -35,10 +46,7 @@ namespace YoggieEngine { | ||||
| 		if (!m_resizable) { | ||||
| 			glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); | ||||
| 		} | ||||
|  | ||||
| 		if (!m_vsync) { | ||||
| 			glfwSwapInterval(0); | ||||
| 		} | ||||
| 	 | ||||
|  | ||||
| 		window = glfwCreateWindow(m_width, m_height, title, NULL, NULL); | ||||
|  | ||||
| @ -49,6 +57,12 @@ namespace YoggieEngine { | ||||
| 		} | ||||
|  | ||||
| 		SetContext(); | ||||
| 	 | ||||
|  | ||||
| 		if (!m_vsync) { | ||||
| 			glfwSwapInterval(0); | ||||
| 		} | ||||
|  | ||||
| 		glfwGetFramebufferSize(window, &m_width, &m_height); | ||||
| 		LoadGLExtensions(); | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user