Skip to content

Commit

Permalink
update box2d + general fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmorton06 committed Aug 20, 2024
1 parent 3850466 commit 70dc1ef
Show file tree
Hide file tree
Showing 484 changed files with 71,344 additions and 124,264 deletions.
1 change: 1 addition & 0 deletions Editor/Source/ApplicationInfoPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ namespace Lumos
ImGui::Text("Frame Time : %5.2f ms", Engine::Get().Statistics().FrameTime);
ImGui::Text("Arena Count : %i", GetArenaCount());
ImGui::Text("Num Draw Calls %u", Engine::Get().Statistics().NumDrawCalls);
ImGui::Text("Total Triangles %u", Engine::Get().Statistics().TriangleCount);
ImGui::Text("Num Rendered Objects %u", Engine::Get().Statistics().NumRenderedObjects);
ImGui::Text("Num Shadow Objects %u", Engine::Get().Statistics().NumShadowObjects);
ImGui::Text("Bound Pipelines %u", Engine::Get().Statistics().BoundPipelines);
Expand Down
13 changes: 11 additions & 2 deletions Editor/Source/AssetManagerPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <Lumos/Utilities/StringUtilities.h>
#include <imgui/imgui.h>
#include <imgui/Plugins/implot/implot.h>
#include <inttypes.h>

namespace Lumos
{
Expand All @@ -36,14 +37,16 @@ namespace Lumos
MyItemColumnID_ID,
MyItemColumnID_Name,
MyItemColumnID_Type,
MyItemColumnID_Info,
MyItemColumnID_Accessed
};

if(ImGui::BeginTable("Asset Registry", 4, ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg))
if(ImGui::BeginTable("Asset Registry", 5, ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg))
{
ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_NoSort | ImGuiTableColumnFlags_WidthFixed, 0.0f, MyItemColumnID_ID);
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_NoSort | ImGuiTableColumnFlags_WidthFixed, 0.0f, MyItemColumnID_Name);
ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_NoSort, 0.0f, MyItemColumnID_Type);
ImGui::TableSetupColumn("Info", ImGuiTableColumnFlags_NoSort, 0.0f, MyItemColumnID_Accessed);
ImGui::TableSetupColumn("Last Accessed", ImGuiTableColumnFlags_NoSort, 0.0f, MyItemColumnID_Accessed);

ImGui::TableSetupScrollFreeze(0, 1);
Expand All @@ -56,7 +59,7 @@ namespace Lumos
{
{
ImGui::TableNextColumn();
// ImGui::TextUnformatted(fmt::format("{0}", ID).c_str()); //"%lld", ID);
ImGui::Text("%" PRIu64, ID);

ImGui::TableNextColumn();
std::string name = "Unnamed";
Expand All @@ -67,6 +70,12 @@ namespace Lumos

ImGui::TableNextColumn();
ImGui::TextUnformatted(AssetTypeToString(metaData.Type));
ImGui::TableNextColumn();

if(!metaData.data)
ImGui::TextUnformatted("Data Null");
else if(metaData.Type == AssetType::Shader && metaData.data.As<Graphics::Shader>())
ImGui::TextUnformatted(metaData.data.As<Graphics::Shader>()->IsCompiled() ? "Compiled" : "Failed to compile");

ImGui::TableNextColumn();
ImGui::Text("%.2f", metaData.lastAccessed);
Expand Down
20 changes: 5 additions & 15 deletions Editor/Source/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,8 @@ namespace Lumos
Lumos::OS::Instance()->OpenURL("https://github.com/skypjack/entt");
if(ImGui::MenuItem((const char*)PushStr8F(scratch.arena, "Cereal - Version : %i.%i.%i", CEREAL_VERSION_MAJOR, CEREAL_VERSION_MINOR, CEREAL_VERSION_PATCH).str))
Lumos::OS::Instance()->OpenURL("https://github.com/USCiLab/cereal");

if (ImGui::MenuItem((const char*)PushStr8F(scratch.arena, "Box2D - Version : %i.%i", 3, 0).str))
Lumos::OS::Instance()->OpenURL("https://github.com/erincatto/box2d");
ScratchEnd(scratch);

if(ImGui::BeginMenu("Contributers"))
Expand Down Expand Up @@ -2239,11 +2240,8 @@ namespace Lumos

for(auto mesh : meshes)
{
if(mesh->GetActive())
{
auto bbCopy = mesh->GetBoundingBox()->Transformed(worldTransform);
DebugRenderer::DebugDraw(bbCopy, selectedColour, true);
}
auto bbCopy = mesh->GetBoundingBox()->Transformed(worldTransform);
DebugRenderer::DebugDraw(bbCopy, selectedColour, true);
}
}
}
Expand Down Expand Up @@ -2335,12 +2333,9 @@ namespace Lumos
auto& meshes = model->ModelRef->GetMeshes();
for(auto mesh : meshes)
{
if(mesh->GetActive())
{
auto& worldTransform = transform->GetWorldMatrix();
auto bbCopy = mesh->GetBoundingBox()->Transformed(worldTransform);
DebugRenderer::DebugDraw(bbCopy, colour, true);
}
}
}
auto sprite = m_HoveredEntity.TryGetComponent<Graphics::Sprite>();
Expand Down Expand Up @@ -2395,12 +2390,9 @@ namespace Lumos
auto& meshes = model->ModelRef->GetMeshes();
for(auto mesh : meshes)
{
if(mesh->GetActive())
{
auto& worldTransform = transform->GetWorldMatrix();
auto bbCopy = mesh->GetBoundingBox()->Transformed(worldTransform);
DebugRenderer::DebugDraw(bbCopy, selectedColour, true);
}
}
}

Expand Down Expand Up @@ -2477,8 +2469,6 @@ namespace Lumos

for(auto mesh : meshes)
{
if(mesh->GetActive())
{
auto& worldTransform = trans.GetWorldMatrix();

auto bbCopy = mesh->GetBoundingBox()->Transformed(worldTransform);
Expand All @@ -2493,7 +2483,7 @@ namespace Lumos
currentClosestEntity = { entity, scene };
}
}
}

}
}
if(!hoveredOnly)
Expand Down
83 changes: 37 additions & 46 deletions Editor/Source/SceneViewPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,52 +388,43 @@ namespace Lumos

if(physics2D)
{
uint32_t flags = physics2D->GetDebugDrawFlags();

bool show2DShapes = flags & b2Draw::e_shapeBit;
if(ImGui::Checkbox("Shapes (2D)", &show2DShapes))
{
if(show2DShapes)
flags += b2Draw::e_shapeBit;
else
flags -= b2Draw::e_shapeBit;
}

bool showCOG = flags & b2Draw::e_centerOfMassBit;
if(ImGui::Checkbox("Centre of Mass (2D)", &showCOG))
{
if(showCOG)
flags += b2Draw::e_centerOfMassBit;
else
flags -= b2Draw::e_centerOfMassBit;
}

bool showJoint = flags & b2Draw::e_jointBit;
if(ImGui::Checkbox("Joint Connection (2D)", &showJoint))
{
if(showJoint)
flags += b2Draw::e_jointBit;
else
flags -= b2Draw::e_jointBit;
}

bool showAABB = flags & b2Draw::e_aabbBit;
if(ImGui::Checkbox("AABB (2D)", &showAABB))
{
if(showAABB)
flags += b2Draw::e_aabbBit;
else
flags -= b2Draw::e_aabbBit;
}

bool showPairs = static_cast<bool>(flags & b2Draw::e_pairBit);
if(ImGui::Checkbox("Broadphase Pairs (2D)", &showPairs))
{
if(showPairs)
flags += b2Draw::e_pairBit;
else
flags -= b2Draw::e_pairBit;
}
uint32_t flags = physics2D->GetDebugDrawFlags();

bool show2DShapes = flags & PhysicsDebugFlags2D::LINEARFORCE2D;
if(ImGui::Checkbox("Shapes (2D)", &show2DShapes))
{
if(show2DShapes)
flags += PhysicsDebugFlags2D::LINEARFORCE2D;
else
flags -= PhysicsDebugFlags2D::LINEARFORCE2D;
}

bool showCOG = flags & PhysicsDebugFlags2D::COLLISIONVOLUMES2D;
if(ImGui::Checkbox("Centre of Mass (2D)", &showCOG))
{
if(showCOG)
flags += PhysicsDebugFlags2D::COLLISIONVOLUMES2D;
else
flags -= PhysicsDebugFlags2D::COLLISIONVOLUMES2D;
}

bool showJoint = flags & PhysicsDebugFlags2D::CONSTRAINT2D;
if(ImGui::Checkbox("Joint Connection (2D)", &showJoint))
{
if(showJoint)
flags += PhysicsDebugFlags2D::CONSTRAINT2D;
else
flags -= PhysicsDebugFlags2D::CONSTRAINT2D;
}

bool showAABB = flags & PhysicsDebugFlags2D::AABB2D;
if(ImGui::Checkbox("AABB (2D)", &showAABB))
{
if(showAABB)
flags += PhysicsDebugFlags2D::AABB2D;
else
flags -= PhysicsDebugFlags2D::AABB2D;
}

physics2D->SetDebugDrawFlags(flags);
}
Expand Down
67 changes: 65 additions & 2 deletions ExampleProject/AssetRegistry.lmar
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"value0": {
"Version": 2,
"Count": 57,
"Count": 78,
"Name": "DepthPrePassAnim",
"UUID": 220796699938349989,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Meshes/cube.obj",
"UUID": 440855775973498468,
"AssetType": 0,
"Name": "CreateEnvironmentMap",
"UUID": 498697334553651981,
"AssetType": 6,
Expand All @@ -23,12 +26,18 @@
"Name": "SSAO",
"UUID": 1095354547157039442,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Cache/Meshes/capsule.glb_thumbnail.png",
"UUID": 1117909052832930046,
"AssetType": 1,
"Name": "//Assets/Textures/particle_dust.png",
"UUID": 1123372390369367885,
"AssetType": 1,
"Name": "//Assets/Textures/icon32.png",
"UUID": 1169913861966067682,
"AssetType": 1,
"Name": "/Users/jmorton/Dev/Hoops/Hoops/Assets/Cache/Meshes/gym.obj_thumbnail.png",
"UUID": 1229536781878886413,
"AssetType": 1,
"Name": "//Assets/Meshes/stormtrooper/Stormtrooper_D.png",
"UUID": 1376303252240195298,
"AssetType": 1,
Expand Down Expand Up @@ -65,6 +74,9 @@
"Name": "ForwardPBRAnim",
"UUID": 3175668397740860526,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Meshes/pyramid.obj",
"UUID": 3779345068608410737,
"AssetType": 0,
"Name": "//Assets/Meshes/Scene/scene.gltf",
"UUID": 3853544921239423074,
"AssetType": 9,
Expand All @@ -74,6 +86,15 @@
"Name": "DepthPrePass",
"UUID": 4415649574143950547,
"AssetType": 6,
"Name": "//Assets/Meshes/basket.glb",
"UUID": 4500161985950185631,
"AssetType": 0,
"Name": "//Assets/Meshes/gym.obj",
"UUID": 4951225963790835797,
"AssetType": 0,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Meshes/AnimatedMorphCube.glb",
"UUID": 5543534150634670453,
"AssetType": 0,
"Name": "//Assets/Textures/splash.png",
"UUID": 6567856788857401421,
"AssetType": 1,
Expand All @@ -86,9 +107,15 @@
"Name": "ChromaticAberation",
"UUID": 7375714513771862660,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Cache/Meshes/Fox.glb_thumbnail.png",
"UUID": 7534757747219067118,
"AssetType": 1,
"Name": "//Assets/Textures/panda.png",
"UUID": 7920548566536714046,
"AssetType": 1,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Cache/Meshes/sphere.obj_thumbnail.png",
"UUID": 8071842674810667482,
"AssetType": 1,
"Name": "Shadow",
"UUID": 8301062219737337799,
"AssetType": 6,
Expand All @@ -104,9 +131,15 @@
"Name": "DepthPrePassAlphaAnim",
"UUID": 9747255277593312948,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Hoops/Hoops/Assets/Cache/Meshes/basketball/scene.gltf_thumbnail.png",
"UUID": 9908067908599896959,
"AssetType": 1,
"Name": "Particle",
"UUID": 10078180836416861066,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Hoops/Hoops/Assets/Meshes/gym.obj",
"UUID": 10294968336206188729,
"AssetType": 0,
"Name": "//Assets/Textures/icon.png",
"UUID": 10374144327092108136,
"AssetType": 1,
Expand All @@ -116,6 +149,9 @@
"Name": "//Assets/Textures/round_outline.png",
"UUID": 11126978127519170907,
"AssetType": 1,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Meshes/Fox.glb",
"UUID": 11266819569144398386,
"AssetType": 0,
"Name": "Skybox",
"UUID": 12471848509347416176,
"AssetType": 6,
Expand All @@ -128,6 +164,12 @@
"Name": "Text",
"UUID": 12642754105454942372,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Meshes/sphere.obj",
"UUID": 12997697803924494101,
"AssetType": 0,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Cache/Meshes/cube.obj_thumbnail.png",
"UUID": 13196367447802436546,
"AssetType": 1,
"Name": "//Assets/Meshes/DamagedHelmet/glTF/DamagedHelmet.gltf",
"UUID": 13579337366301463653,
"AssetType": 9,
Expand All @@ -146,18 +188,33 @@
"Name": "Batch2DPoint",
"UUID": 14671482827884459882,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Cache/Meshes/AnimatedMorphCube.glb_thumbnail.png",
"UUID": 14692638057968195791,
"AssetType": 1,
"Name": "//Assets/Scenes/Cache/2DTest.png",
"UUID": 14706732569522392733,
"AssetType": 1,
"Name": "ToneMapping",
"UUID": 15576366496581061081,
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Meshes/capsule.glb",
"UUID": 15670576618122647680,
"AssetType": 0,
"Name": "/Users/jmorton/Dev/Hoops/Hoops/Assets/Cache/Meshes/basket.glb_thumbnail.png",
"UUID": 15927922363884047700,
"AssetType": 1,
"Name": "FilmicGrain",
"UUID": 15993984468914870617,
"AssetType": 6,
"Name": "ShadowAnim",
"UUID": 16067132574532594367,
"AssetType": 6,
"Name": "//Assets/Meshes/basketball/scene.gltf",
"UUID": 16301651375097263174,
"AssetType": 0,
"Name": "/Users/jmorton/Dev/Lumos/ExampleProject/Assets/Cache/Meshes/pyramid.obj_thumbnail.png",
"UUID": 16463431812382909674,
"AssetType": 1,
"Name": "//Assets/Textures/backgroundColorGrass.png",
"UUID": 16838368057738779843,
"AssetType": 1,
Expand All @@ -167,11 +224,17 @@
"Name": "//Assets/Scenes/Cache/Physics.png",
"UUID": 17456551984026861291,
"AssetType": 1,
"Name": "//Assets/Meshes/Sponza/Sponza.gltf",
"UUID": 17477631631750750130,
"AssetType": 9,
"Name": "//Assets/Textures/Charactervector.png",
"UUID": 17504220957207961491,
"AssetType": 1,
"Name": "ShadowAlpha",
"UUID": 18088774006192505129,
"AssetType": 6
"AssetType": 6,
"Name": "/Users/jmorton/Dev/Hoops/Hoops/Assets/Meshes/basket.glb",
"UUID": 18126305487375488304,
"AssetType": 0
}
}
Loading

0 comments on commit 70dc1ef

Please sign in to comment.