MCPcopy Create free account
hub / github.com/crownengine/crown / debug_draw

Method debug_draw

src/world/render_world.cpp:1840–1882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1838}
1839
1840void RenderWorld::debug_draw(DebugLine &dl)
1841{
1842 if (!_debug_drawing)
1843 return;
1844
1845 const MeshManager::MeshInstanceData &mid = _mesh_manager._data;
1846
1847 for (u32 i = 0; i < mid.size; ++i) {
1848 const OBB &obb = mid.obb[i];
1849 const Sphere &sphere = mid.sphere[i];
1850 const Matrix4x4 &world = mid.world[i];
1851 dl.add_obb(obb.tm * world, obb.half_extents, COLOR4_RED);
1852
1853 Sphere out;
1854 sphere::transform(out, sphere, world);
1855 dl.add_sphere(out.c, out.r, COLOR4_YELLOW);
1856 }
1857
1858 const SpriteManager::SpriteInstanceData &sid = _sprite_manager._data;
1859
1860 for (u32 i = 0; i < sid.size; ++i) {
1861 const AABB &aabb = sid.aabb[i];
1862 const Sphere &sphere = sid.sphere[i];
1863 const Matrix4x4 &world = sid.world[i];
1864 dl.add_aabb(aabb::transform(aabb, world), COLOR4_RED);
1865
1866 Sphere out;
1867 sphere::transform(out, sphere, world);
1868 dl.add_sphere(out.c, out.r, COLOR4_YELLOW);
1869 }
1870
1871 const LodGroupManager::LodGroupInstanceData &lgd = _lod_group_manager._data;
1872
1873 for (u32 i = 0; i < lgd.size; ++i) {
1874 dl.add_obb(lgd.obb[i].tm * lgd.world[i], lgd.obb[i].half_extents, COLOR4_GREEN);
1875
1876 Sphere out;
1877 sphere::transform(out, lgd.sphere[i], lgd.world[i]);
1878 dl.add_sphere(out.c, out.r, COLOR4_ORANGE);
1879 }
1880
1881 _light_manager.debug_draw(0, _light_manager._data.size, dl);
1882}
1883
1884void RenderWorld::enable_debug_drawing(bool enable)
1885{

Callers 1

light_debug_drawMethod · 0.45

Calls 7

local_sphereFunction · 0.85
from_translationFunction · 0.85
add_obbMethod · 0.80
add_sphereMethod · 0.80
add_aabbMethod · 0.80
add_lineMethod · 0.80
add_coneMethod · 0.80

Tested by

no test coverage detected