return light[index];
}
-float Chunk::GetVertexLight(const Pos &pos, const BlockModel::Position &vtx, const Model::Normal &norm) const noexcept {
+float Chunk::GetVertexLight(const Pos &pos, const BlockModel::Position &vtx, const EntityModel::Normal &norm) const noexcept {
int index = ToIndex(pos);
float light = GetLight(index);
// check if a chunk generation is scheduled for this frame
// and if there's a chunk waiting to be generated
gen_timer.Update(dt);
- if (!gen_timer.Hit() || to_generate.empty()) {
- return;
+ if (gen_timer.Hit()) {
+ LoadOne();
+ }
+}
+
+void ChunkLoader::LoadN(std::size_t n) {
+ std::size_t end = std::min(n, ToLoad());
+ for (std::size_t i = 0; i < end; ++i) {
+ LoadOne();
}
+}
+
+void ChunkLoader::LoadOne() {
+ if (to_generate.empty()) return;
// take position of next chunk in queue
Chunk::Pos pos(to_generate.front());