fix minor culling issues
also multiply liquid light by liquid level to fix pop-in problems
This commit is contained in:
parent
a330802d37
commit
9b75bd8eb2
@ -412,8 +412,10 @@ void WorldClient::render(WorldRenderData& renderData, unsigned bufferTiles) {
|
|||||||
return a->entityId() < b->entityId();
|
return a->entityId() < b->entityId();
|
||||||
});
|
});
|
||||||
|
|
||||||
RectI lightRange = m_clientState.window();
|
RectI window = m_clientState.window();
|
||||||
RectI tileRange = lightRange.padded(bufferTiles);
|
RectI tileRange = window.padded(bufferTiles);
|
||||||
|
RectI lightRange = window.padded(1);
|
||||||
|
//Kae: Padded by one to fix light spread issues at the edges of the frame.
|
||||||
|
|
||||||
renderData.tileMinPosition = tileRange.min();
|
renderData.tileMinPosition = tileRange.min();
|
||||||
renderData.lightMinPosition = lightRange.min();
|
renderData.lightMinPosition = lightRange.min();
|
||||||
@ -461,7 +463,7 @@ void WorldClient::render(WorldRenderData& renderData, unsigned bufferTiles) {
|
|||||||
auto& tile = column[y];
|
auto& tile = column[y];
|
||||||
|
|
||||||
Vec3F light = materialDatabase->radiantLight(tile.foreground, tile.foregroundMod);
|
Vec3F light = materialDatabase->radiantLight(tile.foreground, tile.foregroundMod);
|
||||||
light += liquidsDatabase->radiantLight(tile.liquid);
|
light += liquidsDatabase->radiantLight(tile.liquid) * tile.liquid.level;
|
||||||
if (tile.foregroundLightTransparent) {
|
if (tile.foregroundLightTransparent) {
|
||||||
light += materialDatabase->radiantLight(tile.background, tile.backgroundMod);
|
light += materialDatabase->radiantLight(tile.background, tile.backgroundMod);
|
||||||
if (tile.backgroundLightTransparent && pos[1] + y > undergroundLevel)
|
if (tile.backgroundLightTransparent && pos[1] + y > undergroundLevel)
|
||||||
|
@ -62,7 +62,8 @@ void TilePainter::setup(WorldCamera const& camera, WorldRenderData& renderData)
|
|||||||
m_cameraPan = renderData.geometry.diff(cameraCenter, *m_lastCameraCenter);
|
m_cameraPan = renderData.geometry.diff(cameraCenter, *m_lastCameraCenter);
|
||||||
m_lastCameraCenter = cameraCenter;
|
m_lastCameraCenter = cameraCenter;
|
||||||
|
|
||||||
RectI chunkRange = RectI::integral(RectF(camera.worldTileRect()).scaled(1.0f / RenderChunkSize));
|
//Kae: Padded by one to fix culling issues with certain tile pieces at chunk borders, such as grass.
|
||||||
|
RectI chunkRange = RectI::integral(RectF(camera.worldTileRect().padded(1)).scaled(1.0f / RenderChunkSize));
|
||||||
|
|
||||||
for (int x = chunkRange.xMin(); x < chunkRange.xMax(); ++x) {
|
for (int x = chunkRange.xMin(); x < chunkRange.xMax(); ++x) {
|
||||||
for (int y = chunkRange.yMin(); y < chunkRange.yMax(); ++y) {
|
for (int y = chunkRange.yMin(); y < chunkRange.yMax(); ++y) {
|
||||||
|
Loading…
Reference in New Issue
Block a user