Fixed prints and the default mesh

This commit is contained in:
OusmBlueNinja 2024-12-27 13:17:33 -06:00
parent 740716cc39
commit 24bf93cd30
4 changed files with 228 additions and 68 deletions

View File

@ -1,46 +1,89 @@
# Blender v2.76 (sub 0) OBJ File: '' # Cube OBJ File
# www.blender.org # Converted from provided vertex and index data
mtllib cube.mtl
o Cube # Vertex Positions
v 1.000000 -1.000000 -1.000000 v -1.000000 -1.000000 1.000000
v 1.000000 -1.000000 1.000000 v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000 v 1.000000 1.000000 1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 -1.000000 v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999 v 1.000000 -1.000000 -1.000000
v 0.999999 1.000000 1.000001 v 1.000000 1.000000 -1.000000
v -1.000000 1.000000 1.000000 v -1.000000 1.000000 -1.000000
v -1.000000 1.000000 -1.000000
vt 1.000000 0.333333 v -1.000000 -1.000000 -1.000000
vt 1.000000 0.666667 v -1.000000 -1.000000 1.000000
vt 0.666667 0.666667 v -1.000000 1.000000 1.000000
vt 0.666667 0.333333 v -1.000000 1.000000 -1.000000
vt 0.666667 0.000000
vt 0.000000 0.333333 v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v 1.000000 1.000000 1.000000
v 1.000000 1.000000 -1.000000
v -1.000000 1.000000 -1.000000
v 1.000000 1.000000 -1.000000
v 1.000000 1.000000 1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
# Texture Coordinates
vt 0.000000 0.000000 vt 0.000000 0.000000
vt 0.333333 0.000000
vt 0.333333 1.000000
vt 0.000000 1.000000
vt 0.000000 0.666667
vt 0.333333 0.333333
vt 0.333333 0.666667
vt 1.000000 0.000000 vt 1.000000 0.000000
vn 0.000000 -1.000000 0.000000 vt 1.000000 1.000000
vn 0.000000 1.000000 0.000000 vt 0.000000 1.000000
vn 1.000000 0.000000 0.000000
vn -0.000000 0.000000 1.000000 vt 1.000000 0.000000
vn -1.000000 -0.000000 -0.000000 vt 0.000000 0.000000
vn 0.000000 0.000000 -1.000000 vt 0.000000 1.000000
usemtl Material vt 1.000000 1.000000
s off
f 2/1/1 3/2/1 4/3/1 vt 0.000000 0.000000
f 8/1/2 7/4/2 6/5/2 vt 1.000000 0.000000
f 5/6/3 6/7/3 2/8/3 vt 1.000000 1.000000
f 6/8/4 7/5/4 3/4/4 vt 0.000000 1.000000
f 3/9/5 7/10/5 8/11/5
f 1/12/6 4/13/6 8/11/6 vt 1.000000 0.000000
f 1/4/1 2/1/1 4/3/1 vt 0.000000 0.000000
f 5/14/2 8/1/2 6/5/2 vt 0.000000 1.000000
f 1/12/3 5/6/3 2/8/3 vt 1.000000 1.000000
f 2/12/4 6/8/4 3/4/4
f 4/13/5 3/9/5 8/11/5 vt 0.000000 0.000000
f 5/6/6 1/12/6 8/11/6 vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
# Faces
# Front Face
f 1/1 2/2 3/3
f 3/3 4/4 1/1
# Back Face
f 5/5 6/6 7/7
f 7/7 8/8 5/5
# Left Face
f 9/9 10/10 11/11
f 11/11 12/12 9/9
# Right Face
f 13/13 14/14 15/15
f 15/15 16/16 13/13
# Top Face
f 17/17 18/18 19/19
f 19/19 20/20 17/17
# Bottom Face
f 21/21 22/22 23/23
f 23/23 24/24 21/21

View File

@ -1,13 +1,121 @@
Entities: Entities:
- ID: 0 - ID: 0
Name: Default Name: Carrrrr Yeaaa
Components:
Transform:
Position: [0, 2.79999995, -12.6000004]
Rotation: [149.699997, -137.899994, -39.2999992]
Scale: [1, 1, 1]
Mesh:
vao: 2
indexCount: 15810
textureID: 1
MeshPath: assets/models/LowPolyFiatUNO.obj
- ID: 1
Name: Cube Yay
Components:
Transform:
Position: [-11.8999996, -2, -21.7999992]
Rotation: [-9, -18.6000004, -28.1000004]
Scale: [1, 1, 1]
Mesh:
vao: 5
indexCount: 36
textureID: 2
MeshPath: assets/models/DefaultMesh.obj
- ID: 2
Name: Cube Yay 2
Components:
Transform:
Position: [7.80000019, -8.10000038, -20.6000004]
Rotation: [-86.3000031, 0, -66]
Scale: [1, 1, 1]
Mesh:
vao: 5
indexCount: 36
textureID: 3
MeshPath: assets/models/DefaultMesh.obj
- ID: 3
Name: Cube Yay 3
Components:
Transform:
Position: [-1.20000005, -3.4000001, -17.7000008]
Rotation: [-23.5, 15.8999996, -59.9000015]
Scale: [1, 1, 1]
Mesh:
vao: 5
indexCount: 36
textureID: 4
MeshPath: assets/models/DefaultMesh.obj
- ID: 4
Name: Cube Yay 4
Components:
Transform:
Position: [8.10000038, 0.800000012, -12]
Rotation: [-17.2999992, -16.1000004, -19.2999992]
Scale: [1, 1, 1]
Mesh:
vao: 5
indexCount: 36
textureID: 5
MeshPath: assets/models/DefaultMesh.obj
- ID: 5
Name: Colormap
Components: Components:
Mesh: Mesh:
vao: 1 vao: 5
indexCount: 36 indexCount: 36
textureID: 1 textureID: 6
MeshPath: assets/models/DefaultMesh.obj MeshPath: assets/models/DefaultMesh.obj
Transform: Transform:
Position: [0, 0, 0] Position: [0, 0, 0]
Rotation: [0, 0.5, 0] Rotation: [0, 0, -90]
Scale: [1, 1, 1] Scale: [100, 100, 100]
- ID: 6
Name: Cube Yay 6
Components:
Transform:
Position: [-6.5, -6, -18]
Rotation: [15.8000002, -18.2000008, -11.1000004]
Scale: [1, 1, 1]
Mesh:
vao: 5
indexCount: 36
textureID: 3
MeshPath: assets/models/DefaultMesh.obj
- ID: 7
Name: Cube Yay 7
Components:
Transform:
Position: [6.5, 1.79999995, -23.8999996]
Rotation: [-16.1000004, -15.8999996, -35]
Scale: [1, 1, 1]
Mesh:
vao: 5
indexCount: 36
textureID: 4
MeshPath: assets/models/DefaultMesh.obj
- ID: 8
Name: Cube Yay 8
Components:
Transform:
Position: [-7.80000019, 0.200000003, -29.7999992]
Rotation: [22.2999992, -32.7999992, 0]
Scale: [1, 1, 1]
Mesh:
vao: 5
indexCount: 36
textureID: 1
MeshPath: assets/models/DefaultMesh.obj
- ID: 9
Name: Cube Yay 9
Components:
Transform:
Position: [5.5, -2.9000001, -19.5]
Rotation: [-41.4000015, -22.6000004, -52.2999992]
Scale: [1, 1, 1]
Mesh:
vao: 5
indexCount: 36
textureID: 2
MeshPath: assets/models/DefaultMesh.obj

View File

@ -43,25 +43,12 @@ YAML::Node MeshComponent::Serialize()
void MeshComponent::Deserialize(const YAML::Node &node) void MeshComponent::Deserialize(const YAML::Node &node)
{ {
if (node["vao"])
{
vao = static_cast<int>(node["vao"].as<int>());
}
if (node["indexCount"])
{
indexCount = static_cast<int>(node["indexCount"].as<int>());
}
if (node["textureID"])
{
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();
#if 1 // g_AssetManager.DebugAssetMap();
DEBUG_PRINT("Loading Mesh: %s", MeshPath.c_str()); DEBUG_PRINT("Loading Mesh: %s", MeshPath.c_str());
@ -72,19 +59,42 @@ void MeshComponent::Deserialize(const YAML::Node &node)
{ {
vao = model->vao; vao = model->vao;
} }
else if (node["vao"])
{
vao = static_cast<int>(node["vao"].as<int>());
}
if (model->indices.size() != 0) if (model->indices.size() != 0)
{ {
indexCount = model->indices.size(); indexCount = model->indices.size();
} }
else if (node["indexCount"])
{
indexCount = static_cast<int>(node["indexCount"].as<int>());
}
if (textureID != 0) if (textureID != 0)
{ {
textureID = model->textureID; textureID = model->textureID;
} }
else if (node["textureID"])
{
textureID = static_cast<int>(node["textureID"].as<int>());
}
}
else
{
#else if (node["vao"])
{
DEBUG_PRINT("Automatic Mesh Loading Disabled."); vao = static_cast<int>(node["vao"].as<int>());
}
#endif if (node["indexCount"])
{
indexCount = static_cast<int>(node["indexCount"].as<int>());
}
if (node["textureID"])
{
textureID = static_cast<int>(node["textureID"].as<int>());
}
} }
} }

View File

@ -106,7 +106,6 @@ public:
// 4) Store in cache // 4) Store in cache
m_AssetMap[key] = assetData; m_AssetMap[key] = assetData;
DEBUG_PRINT("[AssetManager] Loaded Asset: %s", path.c_str());
// 5) Return the loaded asset // 5) Return the loaded asset
return std::get<T>(assetData); return std::get<T>(assetData);