Import / Export Meshes

This commit is contained in:
2022-11-10 21:51:11 +01:00
parent f7a85d53ab
commit b5db500d48
7 changed files with 204 additions and 9 deletions

View File

@ -10,10 +10,11 @@
#include <glm/gtc/matrix_transform.hpp>
#include "UI/Widgets.h"
#include "Project.h"
#include "Project/Project.h"
#include "SceneSerializer.h"
#include "EditorContext.h"
#include "SceneRuntime.h"
#include "AssetManagement/AssetManager.h"
const unsigned int MS_PER_UPDATE = 2;
@ -23,7 +24,6 @@ public:
void Run() override
{
BarinkWindow mainWindow = BarinkWindow(1200, 700);
InputSystem = new InputManager();
renderer = new Renderer();
@ -46,6 +46,7 @@ public:
previous = current;
lag += elapsed;
InputSystem->PollEvents();
while (lag >= MS_PER_UPDATE)
@ -213,10 +214,44 @@ public:
}
if (ImGui::MenuItem("Add Entity")) {
if (ImGui::MenuItem("Add Entity"))
{
activeRuntime.MainScene.AddEntity("New Entity");
}
if (ImGui::MenuItem("Import Model"))
{
auto result = NFD_OpenDialog( "obj,fbx,gltf" , NULL, &modelImportPath);
switch (result) {
case(NFD_OKAY):
// Import Model
AssetManager::LoadFromSource(modelImportPath, ".");
break;
case(NFD_CANCEL):
break;
case(NFD_ERROR):
std::cout << "NFD_Error: " << NFD_GetError() << std::endl;
break;
}
}
if (ImGui::MenuItem("Import MeshAsset (temp)"))
{
auto result = NFD_OpenDialog("mesh", NULL, &modelImportPath);
switch (result) {
case(NFD_OKAY):
AssetManager::LoadFromAssetFile(modelImportPath);
break;
case(NFD_CANCEL):
break;
case(NFD_ERROR):
break;
}
}
ImGui::EndMenu();
}
@ -252,6 +287,7 @@ private:
char* savePath = nullptr;
char* scenePath = nullptr;
char* openScenePath = nullptr;
char* modelImportPath = nullptr;
};