| 11 | namespace Star { |
| 12 | |
| 13 | TilePainter::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 | |
| 38 | void TilePainter::adjustLighting(WorldRenderData& renderData) const { |
| 39 | RectI lightRange = RectI::withSize(renderData.lightMinPosition, Vec2I(renderData.lightMap.size())); |
nothing calls this directly
no test coverage detected