| 2347 | } |
| 2348 | |
| 2349 | void WorldClient::renderCollisionDebug() { |
| 2350 | RectI clientWindow = m_clientState.window(); |
| 2351 | if (clientWindow.isEmpty()) |
| 2352 | return; |
| 2353 | |
| 2354 | auto logPoly = [](PolyF poly, Vec2F position, float r, float g, float b) { |
| 2355 | poly.translate(position); |
| 2356 | SpatialLogger::logPoly("world", poly, {floatToByte(r, true), floatToByte(g, true), floatToByte(b, true), 255}); |
| 2357 | }; |
| 2358 | |
| 2359 | forEachCollisionBlock(clientWindow, [&](auto const& block) { |
| 2360 | logPoly(block.poly, Vec2F{}, 1.0f, 0.0f, 0.0f); |
| 2361 | }); |
| 2362 | |
| 2363 | for (auto const& object : query<TileEntity>(RectF(clientWindow))) { |
| 2364 | for (auto const& space : object->spaces()) |
| 2365 | logPoly(PolyF(RectF(Vec2F(space), Vec2F(space) + Vec2F(1, 1))), Vec2F(object->tilePosition()), 0., 1., 0.); |
| 2366 | } |
| 2367 | |
| 2368 | for (auto const& physics : query<PhysicsEntity>(RectF(clientWindow))) { |
| 2369 | for (auto const& forceRegion : physics->forceRegions()) { |
| 2370 | if (auto dfr = forceRegion.ptr<DirectionalForceRegion>()) |
| 2371 | logPoly(dfr->region, {}, 1.0f, 1.0f, 0.0f); |
| 2372 | else if (auto rfr = forceRegion.ptr<RadialForceRegion>()) |
| 2373 | logPoly(PolyF(rfr->boundBox()), {}, 0.0f, 1.0f, 1.0f); |
| 2374 | } |
| 2375 | |
| 2376 | for (size_t i = 0; i < physics->movingCollisionCount(); ++i) { |
| 2377 | if (auto pmc = physics->movingCollision(i)) { |
| 2378 | logPoly(pmc->collision, pmc->position, 1.0f, 1.0f, 1.0f); |
| 2379 | } |
| 2380 | } |
| 2381 | } |
| 2382 | } |
| 2383 | |
| 2384 | void WorldClient::informTilePrediction(Vec2I const& pos, TileModification const& modification) { |
| 2385 | auto now = Time::monotonicMilliseconds(); |
nothing calls this directly
no test coverage detected