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

Method TilePainter

source/rendering/StarTilePainter.cpp:13–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace Star {
12
13TilePainter::TilePainter(RendererPtr renderer) : TileDrawer() {
14 m_renderer = std::move(renderer);
15 m_textureGroup = m_renderer->createTextureGroup(TextureGroupSize::Large);
16
17 auto& root = Root::singleton();
18 auto assets = root.assets();
19
20 m_terrainChunkCache.setTimeToLive(assets->json("/rendering.config:chunkCacheTimeout").toInt());
21 m_terrainChunkCache.setTimeSmear(m_terrainChunkCache.timeToLive() / 4);
22
23 m_liquidChunkCache.setTimeToLive(assets->json("/rendering.config:chunkCacheTimeout").toInt());
24 m_liquidChunkCache.setTimeSmear(m_liquidChunkCache.timeToLive() / 4);
25
26 m_textureCache.setTimeToLive(assets->json("/rendering.config:textureTimeout").toInt());
27
28 for (auto const& liquid : root.liquidsDatabase()->allLiquidSettings()) {
29 m_liquids.set(liquid->id, LiquidInfo{
30 m_renderer->createTexture(*assets->image(liquid->config.getString("texture")), TextureAddressing::Wrap),
31 jsonToColor(liquid->config.get("color")).toRgba(),
32 jsonToColor(liquid->config.get("bottomLightMix")).toRgbF(),
33 liquid->config.getFloat("textureMovementFactor")
34 });
35 }
36}
37
38void TilePainter::adjustLighting(WorldRenderData& renderData) const {
39 RectI lightRange = RectI::withSize(renderData.lightMinPosition, Vec2I(renderData.lightMap.size()));

Callers

nothing calls this directly

Calls 15

singletonClass · 0.85
jsonToColorFunction · 0.85
createTextureGroupMethod · 0.80
assetsMethod · 0.80
toIntMethod · 0.80
jsonMethod · 0.80
setTimeSmearMethod · 0.80
allLiquidSettingsMethod · 0.80
liquidsDatabaseMethod · 0.80
createTextureMethod · 0.80
getStringMethod · 0.80
toRgbaMethod · 0.80

Tested by

no test coverage detected