Skip to content

Refactor LightingBuffer storage #145

@olls

Description

@olls

ATM the lighting buffer is used both for rendering, and for mob spawning. When spawning mobs, a new lighting buffer is created covering the spawn radius for each player. Because there is only one lighting buffer stored in a global in the c-render, and it is reallocated if the newly created buffer is not the same size as the existing one, the lighting buffer is reallocated several times each frame. Once for the mob spawning, and once for the renderer.

Ideally we could have a more intelligent LightingBuffer storage which allows us to persist separate buffers of different sizes.

Another related issue is the duplicated work the mob lighting buffer creation and the renderer lighting buffer creation are doing when the regions overlap. (Also when multiple player's overlap.) Maybe we could store lighting buffers per chunk? Allowing us to generate lighting for all the chunks we need for mob spawning, then reusing those already generated chunks for rendering... Using a hash-table, this could be a lot more efficient.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions