Fixed Loading Overwriting Invalid Values
This commit is contained in:
parent
1a9f9eda39
commit
acae54d70d
20
imgui.ini
20
imgui.ini
@ -1,6 +1,6 @@
|
|||||||
[Window][DockSpace]
|
[Window][DockSpace]
|
||||||
Pos=0,0
|
Pos=0,0
|
||||||
Size=1920,1177
|
Size=1280,720
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][Debug##Default]
|
[Window][Debug##Default]
|
||||||
@ -9,8 +9,8 @@ Size=400,400
|
|||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][Inspector]
|
[Window][Inspector]
|
||||||
Pos=1543,27
|
Pos=903,27
|
||||||
Size=369,1142
|
Size=369,685
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000002,0
|
DockId=0x00000002,0
|
||||||
|
|
||||||
@ -21,14 +21,14 @@ Collapsed=0
|
|||||||
DockId=0x00000003,0
|
DockId=0x00000003,0
|
||||||
|
|
||||||
[Window][Performance]
|
[Window][Performance]
|
||||||
Pos=8,777
|
Pos=8,477
|
||||||
Size=364,392
|
Size=364,235
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000006,0
|
DockId=0x00000006,0
|
||||||
|
|
||||||
[Window][Logger]
|
[Window][Logger]
|
||||||
Pos=374,799
|
Pos=374,342
|
||||||
Size=1167,370
|
Size=527,370
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,0
|
DockId=0x00000004,0
|
||||||
|
|
||||||
@ -40,18 +40,18 @@ DockId=0x00000007,0
|
|||||||
|
|
||||||
[Window][Scene Window]
|
[Window][Scene Window]
|
||||||
Pos=8,27
|
Pos=8,27
|
||||||
Size=364,748
|
Size=364,448
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000005,0
|
DockId=0x00000005,0
|
||||||
|
|
||||||
[Window][Editor]
|
[Window][Editor]
|
||||||
Pos=374,27
|
Pos=374,27
|
||||||
Size=1167,770
|
Size=527,313
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000003,0
|
DockId=0x00000003,0
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,27 Size=1904,1142 Split=X Selected=0xF7365A5A
|
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,27 Size=1264,685 Split=X Selected=0xF7365A5A
|
||||||
DockNode ID=0x00000009 Parent=0x14621557 SizeRef=364,1142 Split=Y Selected=0x3DC5AC3F
|
DockNode ID=0x00000009 Parent=0x14621557 SizeRef=364,1142 Split=Y Selected=0x3DC5AC3F
|
||||||
DockNode ID=0x00000005 Parent=0x00000009 SizeRef=364,748 HiddenTabBar=1 Selected=0x3DC5AC3F
|
DockNode ID=0x00000005 Parent=0x00000009 SizeRef=364,748 HiddenTabBar=1 Selected=0x3DC5AC3F
|
||||||
DockNode ID=0x00000006 Parent=0x00000009 SizeRef=364,392 HiddenTabBar=1 Selected=0x726D8899
|
DockNode ID=0x00000006 Parent=0x00000009 SizeRef=364,392 HiddenTabBar=1 Selected=0x726D8899
|
||||||
|
@ -1,37 +1,13 @@
|
|||||||
Entities:
|
Entities:
|
||||||
- ID: 0
|
- ID: 0
|
||||||
Name: Car
|
Name: Default
|
||||||
Components:
|
Components:
|
||||||
Transform:
|
|
||||||
Position: [1, 1.10000002, -4.30000019]
|
|
||||||
Rotation: [-21.5, -65.3000031, -180]
|
|
||||||
Scale: [1, 1, 1]
|
|
||||||
Mesh:
|
Mesh:
|
||||||
vao: 2
|
vao: 1
|
||||||
indexCount: 15810
|
indexCount: 36
|
||||||
textureID: 1
|
textureID: 1
|
||||||
MeshPath: assets/models/DefaultMesh.obj
|
MeshPath: assets/models/DefaultMesh.obj
|
||||||
- ID: 1
|
|
||||||
Name: Shopping Cart
|
|
||||||
Components:
|
|
||||||
Transform:
|
Transform:
|
||||||
Position: [-1.39999998, 1, 1.20000005]
|
Position: [0, 0, 0]
|
||||||
Rotation: [-180, -136, 0]
|
Rotation: [0, 0.5, 0]
|
||||||
Scale: [2, 2, 2]
|
Scale: [1, 1, 1]
|
||||||
Mesh:
|
|
||||||
vao: 3
|
|
||||||
indexCount: 2304
|
|
||||||
textureID: 5
|
|
||||||
MeshPath: assets/models/DefaultMesh.obj
|
|
||||||
- ID: 2
|
|
||||||
Name: Skybox
|
|
||||||
Components:
|
|
||||||
Mesh:
|
|
||||||
vao: 5
|
|
||||||
indexCount: 36
|
|
||||||
textureID: 6
|
|
||||||
MeshPath: assets/models/DefaultMesh.obj
|
|
||||||
Transform:
|
|
||||||
Position: [0, 0, -190.5]
|
|
||||||
Rotation: [0, -56.5999985, 0]
|
|
||||||
Scale: [200, 200, 200]
|
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "../Engine/AssetManager.h"
|
#include "../Engine/AssetManager.h"
|
||||||
|
|
||||||
|
|
||||||
extern AssetManager g_AssetManager;
|
extern AssetManager g_AssetManager;
|
||||||
|
|
||||||
// TODO: Make this have a OBJ path, make indexCount derive from AssetManager
|
// TODO: Make this have a OBJ path, make indexCount derive from AssetManager
|
||||||
@ -39,12 +38,6 @@ YAML::Node MeshComponent::Serialize()
|
|||||||
|
|
||||||
node["MeshPath"] = static_cast<std::string>(MeshPath);
|
node["MeshPath"] = static_cast<std::string>(MeshPath);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,19 +56,31 @@ void MeshComponent::Deserialize(const YAML::Node& node)
|
|||||||
textureID = static_cast<int>(node["textureID"].as<int>());
|
textureID = static_cast<int>(node["textureID"].as<int>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (node["MeshPath"])
|
if (node["MeshPath"])
|
||||||
{
|
{
|
||||||
MeshPath = static_cast<std::string>(node["MeshPath"].as<std::string>());
|
MeshPath = static_cast<std::string>(node["MeshPath"].as<std::string>());
|
||||||
g_AssetManager.DebugAssetMap();
|
// g_AssetManager.DebugAssetMap();
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
DEBUG_PRINT("Loading Mesh: >%s<", MeshPath.c_str());
|
DEBUG_PRINT("Loading Mesh: %s", MeshPath.c_str());
|
||||||
|
|
||||||
Model *model = g_AssetManager.loadAsset<Model *>(AssetType::MODEL, MeshPath.c_str());
|
Model *model = g_AssetManager.loadAsset<Model *>(AssetType::MODEL, MeshPath.c_str());
|
||||||
DEBUG_PRINT("Model loaded successfully with %lld vertices and %lld indices.", model->vertices.size(), model->indices.size());
|
DEBUG_PRINT("Model loaded successfully with %lld vertices and %lld indices.", model->vertices.size(), model->indices.size());
|
||||||
|
|
||||||
|
if (model->vao != 0)
|
||||||
|
{
|
||||||
|
vao = model->vao;
|
||||||
|
}
|
||||||
|
if (model->indices.size() != 0)
|
||||||
|
{
|
||||||
|
indexCount = model->indices.size();
|
||||||
|
}
|
||||||
|
if (textureID != 0)
|
||||||
|
{
|
||||||
|
textureID = model->textureID;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
DEBUG_PRINT("Automatic Mesh Loading Disabled.");
|
DEBUG_PRINT("Automatic Mesh Loading Disabled.");
|
||||||
|
@ -52,7 +52,7 @@ void AssetManager::DebugAssetMap()
|
|||||||
// Implementation of AssetManager::loadAssetFromDisk
|
// Implementation of AssetManager::loadAssetFromDisk
|
||||||
AssetManager::AssetVariant AssetManager::loadAssetFromDisk(AssetType type, const std::string &path)
|
AssetManager::AssetVariant AssetManager::loadAssetFromDisk(AssetType type, const std::string &path)
|
||||||
{
|
{
|
||||||
DebugAssetMap();
|
//DebugAssetMap();
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case AssetType::TEXTURE:
|
case AssetType::TEXTURE:
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
if (it != m_AssetMap.end())
|
if (it != m_AssetMap.end())
|
||||||
{
|
{
|
||||||
// Debug: Log the variant type
|
// Debug: Log the variant type
|
||||||
std::cout << "[AssetManager] Found asset in map." << std::endl;
|
DEBUG_PRINT("[AssetManager] Found asset in map.");
|
||||||
if (std::holds_alternative<T>(it->second))
|
if (std::holds_alternative<T>(it->second))
|
||||||
{
|
{
|
||||||
return std::get<T>(it->second);
|
return std::get<T>(it->second);
|
||||||
|
@ -332,11 +332,10 @@ void InspectorWindow::Show()
|
|||||||
// Update the string if user made changes
|
// Update the string if user made changes
|
||||||
mesh->MeshPath = buffer;
|
mesh->MeshPath = buffer;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
float availableWidth = ImGui::GetContentRegionAvail().x;
|
float availableWidth = ImGui::GetContentRegionAvail().x;
|
||||||
|
|
||||||
ImGui::Image(mesh->textureID, ImVec2(availableWidth, availableWidth), ImVec2(0, 0), ImVec2(1, 1));
|
ImGui::Image(mesh->textureID, ImVec2(availableWidth, availableWidth), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user