| 299 | } |
| 300 | |
| 301 | void WorldPainter::drawDrawable(Drawable drawable) { |
| 302 | drawable.position = m_camera.worldToScreen(drawable.position); |
| 303 | drawable.scale(m_camera.pixelRatio() * TilePixels, drawable.position); |
| 304 | |
| 305 | if (drawable.isLine()) |
| 306 | drawable.linePart().width *= m_camera.pixelRatio(); |
| 307 | |
| 308 | // draw the drawable if it's on screen |
| 309 | // if it's not on screen, there's a random chance to pre-load |
| 310 | // pre-load is not done on every tick because it's expensive to look up images with long paths |
| 311 | if (RectF::withSize(Vec2F(), Vec2F(m_camera.screenSize())).intersects(drawable.boundBox(false))) |
| 312 | m_drawablePainter->drawDrawable(drawable); |
| 313 | else if (drawable.isImage() && Random::randf() < m_preloadTextureChance) |
| 314 | m_assets->tryImage(drawable.imagePart().image); |
| 315 | } |
| 316 | |
| 317 | void WorldPainter::drawDrawableSet(List<Drawable>& drawables) { |
| 318 | for (Drawable& drawable : drawables) |
nothing calls this directly
no test coverage detected