MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / drawDrawable

Method drawDrawable

source/rendering/StarWorldPainter.cpp:301–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301void 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
317void WorldPainter::drawDrawableSet(List<Drawable>& drawables) {
318 for (Drawable& drawable : drawables)

Callers

nothing calls this directly

Calls 10

randfFunction · 0.85
worldToScreenMethod · 0.80
pixelRatioMethod · 0.80
isLineMethod · 0.80
isImageMethod · 0.80
tryImageMethod · 0.80
scaleMethod · 0.45
intersectsMethod · 0.45
screenSizeMethod · 0.45
boundBoxMethod · 0.45

Tested by

no test coverage detected