Skip to content

Commit

Permalink
Improve DebugRenderer to add support for solid shaded rendering and u…
Browse files Browse the repository at this point in the history
…se the Color class
  • Loading branch information
Pursche committed Aug 20, 2023
1 parent f3b02fc commit fa401b7
Show file tree
Hide file tree
Showing 12 changed files with 525 additions and 146 deletions.
7 changes: 1 addition & 6 deletions Source/Game/Game/ECS/Systems/DrawDebugMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ namespace ECS::Systems
obb.rotation = transform.rotation;
obb.extents = transform.scale * 0.5f;

u32 color = static_cast<u32>(debugMesh.color.r * 255.0f); // Red
color |= static_cast<u32>(debugMesh.color.g * 255.0f) << 8; // Green
color |= static_cast<u32>(debugMesh.color.b * 255.0f) << 16; // Blue
color |= 1u << 24u; // Alpha

debugRenderer->DrawOBB3D(obb.center, obb.extents, obb.rotation, color);
debugRenderer->DrawOBB3D(obb.center, obb.extents, obb.rotation, debugMesh.color);
});
}
}
4 changes: 2 additions & 2 deletions Source/Game/Game/Editor/Inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ namespace Editor
glm::vec3 transformedCenter = transform->position + transform->rotation * (aabb->centerPos * transform->scale);
glm::vec3 transformedExtents = aabb->extents * transform->scale;

debugRenderer->DrawOBB3D(transformedCenter, transformedExtents, transform->rotation, 0xFFFF0000);
debugRenderer->DrawOBB3D(transformedCenter, transformedExtents, transform->rotation, Color::Red);
}
}
if (CVAR_InspectorWorldAABBShowFlag.Get() == ShowFlag::ENABLED)
Expand All @@ -345,7 +345,7 @@ namespace Editor
{
vec3 center = (worldAABB->min + worldAABB->max) / 2.0f;
vec3 extents = (worldAABB->max - worldAABB->min) / 2.0f;
debugRenderer->DrawAABB3D(center, extents, 0xFF00FF00);
debugRenderer->DrawAABB3D(center, extents, Color::Green);
}
}
}
Expand Down
Loading

0 comments on commit fa401b7

Please sign in to comment.