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

Method drawEntityLayer

source/rendering/StarWorldPainter.cpp:266–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void WorldPainter::drawEntityLayer(List<Drawable> drawables, EntityHighlightEffect highlightEffect) {
267 highlightEffect.level *= m_highlightConfig.getFloat("maxHighlightLevel", 1.0);
268 if (m_highlightDirectives.contains(highlightEffect.type) && highlightEffect.level > 0) {
269 // first pass, draw underlay
270 auto underlayDirectives = m_highlightDirectives[highlightEffect.type].first;
271 if (!underlayDirectives.empty()) {
272 for (auto& d : drawables) {
273 if (d.isImage()) {
274 auto underlayDrawable = Drawable(d);
275 underlayDrawable.fullbright = true;
276 underlayDrawable.color = Color::rgbaf(1, 1, 1, highlightEffect.level * d.color.alphaF());
277 underlayDrawable.imagePart().addDirectives(underlayDirectives, true);
278 drawDrawable(std::move(underlayDrawable));
279 }
280 }
281 }
282
283 // second pass, draw main drawables and overlays
284 auto overlayDirectives = m_highlightDirectives[highlightEffect.type].second;
285 for (auto& d : drawables) {
286 drawDrawable(d);
287 if (!overlayDirectives.empty() && d.isImage()) {
288 auto overlayDrawable = Drawable(d);
289 overlayDrawable.fullbright = true;
290 overlayDrawable.color = Color::rgbaf(1, 1, 1, highlightEffect.level * d.color.alphaF());
291 overlayDrawable.imagePart().addDirectives(overlayDirectives, true);
292 drawDrawable(std::move(overlayDrawable));
293 }
294 }
295 } else {
296 for (auto& d : drawables)
297 drawDrawable(std::move(d));
298 }
299}
300
301void WorldPainter::drawDrawable(Drawable drawable) {
302 drawable.position = m_camera.worldToScreen(drawable.position);

Callers

nothing calls this directly

Calls 7

DrawableClass · 0.85
getFloatMethod · 0.80
isImageMethod · 0.80
alphaFMethod · 0.80
addDirectivesMethod · 0.80
containsMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected