Botcraft 26.3
Loading...
Searching...
No Matches
WorldRenderer.cpp
Go to the documentation of this file.
6
11
12#include <glm/gtc/type_ptr.hpp>
13
14#include <algorithm>
15#include <iterator>
16#include <unordered_set>
17
18namespace Botcraft
19{
20 namespace Renderer
21 {
22 namespace
23 {
24 std::array<unsigned int, 2> ToMultipliers(const std::vector<unsigned int>& v);
25
26 Position SectionOf(const Position& block_pos);
27
28 template<class ChunkPtr>
29 void ReplaceColumn(
30 std::unordered_map<Position, std::shared_ptr<ChunkPtr>>& renderables,
31 std::mutex& mutex,
32 std::atomic<bool>& dirty,
33 const int x, const int z,
34 std::unordered_map<Position, std::vector<Face>>&& new_faces
35 );
36 }
37
39 {
41 atlas_texture = 0;
42
43 chunks = std::unordered_map<Position, std::shared_ptr<Chunk> >();
44 transparent_chunks = std::unordered_map<Position, std::shared_ptr<TransparentChunk> >();
45
46 chunks_dirty = true;
48
49 entities = std::unordered_map<int, std::shared_ptr<Entity> >();
51
52 camera = std::make_shared<Camera>();
53 }
54
56 {
57 camera.reset();
58 }
59
60 std::shared_ptr<Camera> WorldRenderer::GetCamera()
61 {
62 return camera;
63 }
64
66 {
67 glGenBuffers(1, &view_uniform_buffer);
68 glBindBuffer(GL_UNIFORM_BUFFER, view_uniform_buffer);
69 glBufferData(GL_UNIFORM_BUFFER, sizeof(glm::mat4), NULL, GL_STATIC_DRAW);
70 glBindBuffer(GL_UNIFORM_BUFFER, 0);
71
72 glBindBufferRange(GL_UNIFORM_BUFFER, 0, view_uniform_buffer, 0, sizeof(glm::mat4));
73
74 //Create a texture
75 glGenTextures(1, &atlas_texture);
76 glBindTexture(GL_TEXTURE_2D, atlas_texture);
77
78 //Options
79 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
80 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
81 float borderColor[] = { 1.0f, 1.0f, 1.0f, 1.0f };
82 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
83 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
84 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
85
86 const Atlas* atlas = AssetsManager::getInstance().GetAtlas();
87
88 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, atlas->GetWidth(), atlas->GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, atlas->Get());
89 glGenerateMipmap(GL_TEXTURE_2D);
90
91 glBindTexture(GL_TEXTURE_2D, 0);
92 }
93
95 {
96 {
97 std::lock_guard<std::mutex> lock(chunks_mutex);
98 chunks.clear();
99 }
100 {
101 std::lock_guard<std::mutex> lock(transparent_chunks_mutex);
102 transparent_chunks.clear();
103 }
104 {
105 std::lock_guard<std::mutex> lock(entities_mutex);
106 entities.clear();
107 }
108
109 if (view_uniform_buffer != 0)
110 {
111 glDeleteBuffers(1, &view_uniform_buffer);
113 }
114 if (atlas_texture != 0)
115 {
116 glDeleteTextures(1, &atlas_texture);
117 atlas_texture = 0;
118 }
119 }
120
122 {
123 if (camera->GetHasChangedOrientation() || camera->GetHasChangedPosition())
124 {
125 glm::mat4 view_matrix = camera->GetViewMatrix();
126 if (camera->GetHasChangedPosition())
127 {
129 for (auto it = transparent_chunks.begin(); it != transparent_chunks.end(); ++it)
130 {
131 it->second->MarkForSort();
132 }
134 }
135 camera->ResetHasChangedPosition();
136 camera->ResetHasChangedOrientation();
137 glBindBuffer(GL_UNIFORM_BUFFER, view_uniform_buffer);
138 glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(glm::mat4), glm::value_ptr(view_matrix));
139 glBindBuffer(GL_UNIFORM_BUFFER, 0);
140 }
141 }
142
143 void WorldRenderer::SetCameraProjection(const glm::mat4& proj)
144 {
145 camera->SetProjection(proj);
146 }
147
149 {
150 if (chunks_dirty.load(std::memory_order_relaxed))
151 {
152 std::lock_guard<std::mutex> lock(chunks_mutex);
153 if (chunks_dirty.exchange(false))
154 {
155 for (auto it = chunks.begin(); it != chunks.end();)
156 {
157 it->second->Update();
158 it = it->second->GetNumFace() == 0 ? chunks.erase(it) : std::next(it);
159 }
160 }
161 }
162
163 if (transparent_chunks_dirty.load(std::memory_order_relaxed))
164 {
165 std::lock_guard<std::mutex> lock(transparent_chunks_mutex);
166 if (transparent_chunks_dirty.exchange(false))
167 {
168 for (auto it = transparent_chunks.begin(); it != transparent_chunks.end();)
169 {
170 it->second->Update();
171 it = it->second->GetNumFace() == 0 ? transparent_chunks.erase(it) : std::next(it);
172 }
173 }
174 }
175
176 if (entities_faces_should_be_updated.load(std::memory_order_relaxed))
177 {
178 std::lock_guard<std::mutex> lock(entities_mutex);
179 if (entities_faces_should_be_updated.exchange(false))
180 {
181 for (auto it = entities.begin(); it != entities.end();)
182 {
183 it->second->Update();
184 it = it->second->GetNumFace() == 0 ? entities.erase(it) : std::next(it);
185 }
186 }
187 }
188 }
189
190 void WorldRenderer::UpdateChunk(const int x_, const int z_, const std::optional<Botcraft::Chunk>& chunk)
191 {
192 if (!chunk.has_value())
193 {
194 ReplaceColumn(chunks, chunks_mutex, chunks_dirty, x_, z_, {});
196 return;
197 }
198
199 std::unordered_map<Position, std::vector<Face>> opaque_faces;
200 std::unordered_map<Position, std::vector<Face>> transparent_faces;
201 // For each block in the chunk, check its neighbours
202 // to see which face to draw
203 const std::vector<Position> neighbour_positions({ Position(0, -1, 0), Position(0, 0, -1),
204 Position(-1, 0, 0), Position(1, 0, 0), Position(0, 0, 1), Position(0, 1, 0) });
205
206 std::vector<const Blockstate*> neighbour_blockstates(6);
207
208 Position pos;
209 for (int y = chunk->GetMinY(); y < chunk->GetHeight() + chunk->GetMinY(); ++y)
210 {
211 pos.y = y;
212 for (int z = 0; z < CHUNK_WIDTH; ++z)
213 {
214 pos.z = z;
215 for (int x = 0; x < CHUNK_WIDTH; ++x)
216 {
217 pos.x = x;
218
219 // If this block is air, just skip it
220 const Blockstate* this_block = chunk->GetBlock(pos);
221 if (this_block == nullptr || this_block->IsAir())
222 {
223 continue;
224 }
225
226 // Else check its neighbours to find which face to draw
227 for (int i = 0; i < 6; ++i)
228 {
229 neighbour_blockstates[i] = chunk->GetBlock(pos + neighbour_positions[i]);
230 }
231
232 bool is_surrounded_by_opaque = false;
233 //Check if this block is sourrounded by non transparent blocks
234 for (int i = 0; i < neighbour_positions.size(); ++i)
235 {
236 if (neighbour_blockstates[i] == nullptr ||
237 neighbour_blockstates[i]->IsTransparent())
238 {
239 break;
240 }
241
242 //If we are here, all the neigbhours are non transparent blocks, so
243 //there is no face to add to the renderer
244 if (i == neighbour_positions.size() - 1)
245 {
246 is_surrounded_by_opaque = true;
247 }
248 }
249
250 if (is_surrounded_by_opaque)
251 {
252 continue;
253 }
254
255 //Add all faces of the current state
256 const Position block_pos(
257 pos.x + CHUNK_WIDTH * x_,
258 pos.y,
259 pos.z + CHUNK_WIDTH * z_
260 );
261 const std::vector<FaceDescriptor>& current_faces = this_block->GetModel(this_block->GetModelId(block_pos)).GetFaces();
262 const Vector3<double> offset = this_block->GetHorizontalOffsetAtPos(block_pos);
263#if PROTOCOL_VERSION < 552 /* < 1.15 */
264 const Biome* current_biome = chunk->GetBiome(x, z);
265#else
266 const Biome* current_biome = chunk->GetBiome(x, y, z);
267#endif
268
269 for (int i = 0; i < current_faces.size(); ++i)
270 {
271 //Check if the neighbour in this direction is hidding this face
272 // We also remove the faces between two transparent blocks with the same names
273 // (example: faces between two water blocks)
274 if (current_faces[i].cullface_direction == Orientation::None ||
275 !neighbour_blockstates[static_cast<int>(current_faces[i].cullface_direction)] ||
276 (neighbour_blockstates[static_cast<int>(current_faces[i].cullface_direction)]->IsTransparent() &&
277 neighbour_blockstates[static_cast<int>(current_faces[i].cullface_direction)]->GetName() != this_block->GetName())
278 )
279 {
280 Face f = current_faces[i].face;
281 // Add 0.5 because the origin of the block is at the center
282 // but the coordinates start from the block corner
283 f.GetMatrix()[12] += static_cast<float>(offset.x) + 0.5f;
284 f.GetMatrix()[13] += static_cast<float>(offset.y) + 0.5f;
285 f.GetMatrix()[14] += static_cast<float>(offset.z) + 0.5f;
286 f.SetTextureMultipliers(ToMultipliers(GetColorModifier(pos.y, current_biome, this_block, current_faces[i].use_tintindexes)));
287
288 std::unordered_map<Position, std::vector<Face>>& target = f.GetTransparencyData() == Transparency::Partial ? transparent_faces : opaque_faces;
289 target[SectionOf(block_pos)].push_back(std::move(f));
290 }
291 }
292 }
293 }
294 }
295 ReplaceColumn(chunks, chunks_mutex, chunks_dirty, x_, z_, std::move(opaque_faces));
296 ReplaceColumn(transparent_chunks, transparent_chunks_mutex, transparent_chunks_dirty, x_, z_, std::move(transparent_faces));
297 }
298
299 void WorldRenderer::UpdateEntity(const int id, const std::vector<Face>& faces)
300 {
301 std::lock_guard<std::mutex> lock(entities_mutex);
302
303 auto it = entities.find(id);
304
305 if (it == entities.end() && faces.size() != 0)
306 {
307 entities[id] = std::make_shared<Entity>(faces);
309 }
310 else if (it != entities.end() && faces.size() == 0)
311 {
312 it->second->ClearFaces();
314 }
315 else if (it != entities.end())
316 {
317 it->second->SetFaces(std::vector<Face>(faces.begin(), faces.end()));
319 }
320 }
321
323 {
324 glBindTexture(GL_TEXTURE_2D, atlas_texture);
325 }
326
328 {
329 // We simply remove all the faces from all the chunks
330 // The chunks will be deleted on the next frame
331 {
332 std::lock_guard<std::mutex> lock(chunks_mutex);
333 for (auto it = chunks.begin(); it != chunks.end(); it++)
334 {
335 it->second->ClearFaces();
336 }
337 }
338 {
339 std::lock_guard<std::mutex> lock(transparent_chunks_mutex);
340 for (auto it = transparent_chunks.begin(); it != transparent_chunks.end(); it++)
341 {
342 it->second->ClearFaces();
343 }
344 }
345 {
346 std::lock_guard<std::mutex> lock(entities_mutex);
347 for (auto it = entities.begin(); it != entities.end(); it++)
348 {
349 it->second->ClearFaces();
350 }
351 }
352 chunks_dirty = true;
355 }
356
357 void WorldRenderer::SetPosOrientation(const double x_, const double y_, const double z_, const float yaw_, const float pitch_)
358 {
359 if (camera)
360 {
361 camera->SetPosition(
362 static_cast<float>(x_),
363 static_cast<float>(y_),
364 static_cast<float>(z_)
365 );
366 camera->SetRotation(pitch_, yaw_);
367 }
368 }
369
370 void WorldRenderer::RenderFaces(int* num_chunks_, int* num_rendered_chunks_,
371 int* num_entities_, int* num_rendered_entities_,
372 int* num_faces_, int* num_rendered_faces_)
373 {
374 const std::array<glm::vec4, 6>& frustum_planes = camera->GetFrustumPlanes();
375
376 // Get a list of all loaded chunks
377 std::unordered_set<Position> all_loaded_chunks;
378 all_loaded_chunks.reserve(chunks.size() + transparent_chunks.size());
379 int num_faces = 0;
380
381 chunks_mutex.lock();
382 for (auto it = chunks.begin(); it != chunks.end(); ++it)
383 {
384 all_loaded_chunks.insert(it->first);
385 num_faces += it->second->GetNumFace();
386 }
387 chunks_mutex.unlock();
389 for (auto it = transparent_chunks.begin(); it != transparent_chunks.end(); ++it)
390 {
391 all_loaded_chunks.insert(it->first);
392 num_faces += it->second->GetNumFace();
393 }
395 const int num_chunks = static_cast<int>(all_loaded_chunks.size());
396
397 // Apply frustum culling to render only the visible ones
398 std::vector<Position> chunks_to_render;
399 chunks_to_render.reserve(all_loaded_chunks.size());
400 std::unordered_map<Position, bool> inside_frustum;
401 // Frustum culling algorithm from http://old.cescg.org/CESCG-2002/DSykoraJJelinek/
402 for (auto it = all_loaded_chunks.begin(); it != all_loaded_chunks.end(); ++it)
403 {
405
406 const float min_x = static_cast<float>(CHUNK_WIDTH * (*it).x);
407 const float max_x = static_cast<float>(CHUNK_WIDTH * ((*it).x + 1));
408 const float min_y = static_cast<float>(static_cast<int>(RENDERING_SECTION_HEIGHT) * (*it).y);
409 const float max_y = static_cast<float>(static_cast<int>(RENDERING_SECTION_HEIGHT) * ((*it).y + 1));
410 const float min_z = static_cast<float>(CHUNK_WIDTH * (*it).z);
411 const float max_z = static_cast<float>(CHUNK_WIDTH * ((*it).z + 1));
412
413 for (int i = 0; i < 6; ++i)
414 {
415 const bool sign_x = frustum_planes[i].x > 0.0f;
416 const bool sign_y = frustum_planes[i].y > 0.0f;
417 const bool sign_z = frustum_planes[i].z > 0.0f;
418
419 const glm::vec4 p_vertex = glm::vec4(sign_x ? max_x : min_x, sign_y ? max_y : min_y, sign_z ? max_z : min_z, 1.0f);
420
421 if (glm::dot(frustum_planes[i], p_vertex) < 0.0f)
422 {
423 result = FrustumResult::Outside;
424 break;
425 }
426
427 const glm::vec4 n_vertex = glm::vec4(sign_x ? min_x : max_x, sign_y ? min_y : max_y, sign_z ? min_z : max_z, 1.0f);
428
429 if (glm::dot(frustum_planes[i], n_vertex) < 0.0f)
430 {
432 }
433 }
434
435 inside_frustum[*it] = result != FrustumResult::Outside;
436 if (result != FrustumResult::Outside)
437 {
438 chunks_to_render.push_back(*it);
439 }
440 }
441
442 // Sort the chunks from far to near the camera (necessary for transparent chunks to render in the right order)
443 std::sort(chunks_to_render.begin(), chunks_to_render.end(), [this](const Position& p1, const Position& p2) {return this->DistanceToCamera(p1) > this->DistanceToCamera(p2); });
444
445 // Render all non partially transparent faces
446 const int num_rendered_chunks = static_cast<int>(chunks_to_render.size());
447 int num_rendered_faces = 0;
448 chunks_mutex.lock();
449 for (int i = 0; i < num_rendered_chunks; ++i)
450 {
451 auto found_it = chunks.find(chunks_to_render[i]);
452 if (found_it != chunks.end())
453 {
454 found_it->second->Render();
455 num_rendered_faces += found_it->second->GetNumFace();
456 }
457 }
458 chunks_mutex.unlock();
459
460 // Render entities, with approximate frustum culling
461 const std::vector<Position> neighbouring_positions({ Position(0, 0, 0), Position(0, -1, 0), Position(0, 0, -1),
462 Position(-1, 0, 0), Position(1, 0, 0), Position(0, 0, 1), Position(0, 1, 0) });
463 entities_mutex.lock();
464 const int num_entities = static_cast<int>(entities.size());
465 int num_rendered_entities = 0;
466 for (auto& e : entities)
467 {
468 num_faces += e.second->GetNumFace();
469
470 const Vector3<float> approx_pos = e.second->GetApproxPos();
471 const Position chunk_position(
472 static_cast<int>(floor(approx_pos.x / static_cast<double>(CHUNK_WIDTH))),
473 static_cast<int>(floor(approx_pos.y / static_cast<double>(RENDERING_SECTION_HEIGHT))),
474 static_cast<int>(floor(approx_pos.z / static_cast<double>(CHUNK_WIDTH)))
475 );
476
477 for (int i = 0; i < neighbouring_positions.size(); ++i)
478 {
479 if (inside_frustum[chunk_position + neighbouring_positions[i]])
480 {
481 e.second->Render();
482 num_rendered_entities += 1;
483 num_rendered_faces += e.second->GetNumFace();
484 break;
485 }
486 }
487 }
488 entities_mutex.unlock();
489
490 const glm::vec3 cam_pos = camera->GetPosition();
491
492 // Render all partially transparent faces
494 for (int i = 0; i < num_rendered_chunks; ++i)
495 {
496 auto found_it = transparent_chunks.find(chunks_to_render[i]);
497 if (found_it != transparent_chunks.end())
498 {
499 found_it->second->Sort(cam_pos);
500 found_it->second->Render();
501 num_rendered_faces += found_it->second->GetNumFace();
502 }
503 }
505
506 if (num_chunks_)
507 {
508 *num_chunks_ = num_chunks;
509 }
510 if (num_rendered_chunks_)
511 {
512 *num_rendered_chunks_ = num_rendered_chunks;
513 }
514 if (num_faces_)
515 {
516 *num_faces_ = num_faces;
517 }
518 if (num_rendered_faces_)
519 {
520 *num_rendered_faces_ = num_rendered_faces;
521 }
522 if (num_entities_)
523 {
524 *num_entities_ = num_entities;
525 }
526 if (num_rendered_entities_)
527 {
528 *num_rendered_entities_ = num_rendered_entities;
529 }
530 }
531
532 const std::vector<unsigned int> WorldRenderer::GetColorModifier(const int y, const Biome* biome, const Blockstate* blockstate, const std::vector<bool>& use_tintindex) const
533 {
534 std::vector<unsigned int> texture_modifier(use_tintindex.size(), 0xFFFFFFFF);
535 for (int i = 0; i < use_tintindex.size(); ++i)
536 {
537 switch (blockstate->GetTintType())
538 {
539 case TintType::None:
540 break;
541 case TintType::Grass:
542 if (use_tintindex[i])
543 {
544 if (biome)
545 {
546 texture_modifier[i] = biome->GetColorMultiplier(y, true);
547 }
548 }
549 break;
550 case TintType::Leaves:
551 if (use_tintindex[i])
552 {
553 if (biome)
554 {
555 texture_modifier[i] = biome->GetColorMultiplier(y, false);
556 }
557 }
558 break;
559 // Black when signal strength is 0 and red when it's 15
561#if PROTOCOL_VERSION == 340 /* 1.12.2 */
562 texture_modifier[i] = 0xFF000000 | (25 + 15 * blockstate->GetId().second);
563#else
564 texture_modifier[i] = 0xFF000000 | (25 + 15 * std::stoi(blockstate->GetVariableValue("power")));
565#endif
566 break;
567 case TintType::Water:
568 if (biome)
569 {
570 texture_modifier[i] = biome->GetWaterColorMultiplier();
571 }
572 break;
573 default:
574 break;
575 }
576 }
577 return texture_modifier;
578 }
579
580 const float WorldRenderer::DistanceToCamera(const Position& chunk) const
581 {
582 return camera->GetDistance(CHUNK_WIDTH * (chunk.x + 0.5f), RENDERING_SECTION_HEIGHT * (chunk.y + 0.5f), CHUNK_WIDTH * (chunk.z + 0.5f));
583 }
584
585 namespace
586 {
587 std::array<unsigned int, 2> ToMultipliers(const std::vector<unsigned int>& v)
588 {
589 std::array<unsigned int, 2> out = { 0xFFFFFFFF, 0xFFFFFFFF };
590 for (int i = 0; i < std::min(2, static_cast<int>(v.size())); ++i)
591 {
592 out[i] = v[i];
593 }
594 return out;
595 }
596
597 Position SectionOf(const Position& block_pos)
598 {
599 return Position(
600 static_cast<int>(std::floor(block_pos.x / static_cast<double>(CHUNK_WIDTH))),
601 static_cast<int>(std::floor(block_pos.y / static_cast<double>(RENDERING_SECTION_HEIGHT))),
602 static_cast<int>(std::floor(block_pos.z / static_cast<double>(CHUNK_WIDTH)))
603 );
604 }
605
606 template<class ChunkPtr>
607 void ReplaceColumn(
608 std::unordered_map<Position, std::shared_ptr<ChunkPtr>>& renderables,
609 std::mutex& mutex,
610 std::atomic<bool>& dirty,
611 const int x, const int z,
612 std::unordered_map<Position, std::vector<Face>>&& new_faces
613 )
614 {
615 bool changed = false;
616 std::lock_guard<std::mutex> lock(mutex);
617
618 for (auto& [pos, renderable] : renderables)
619 {
620 if (pos.x == x && pos.z == z && new_faces.find(pos) == new_faces.end())
621 {
622 renderable->SetFaces({});
623 changed = true;
624 }
625 }
626
627 for (auto& [pos, faces] : new_faces)
628 {
629 std::shared_ptr<ChunkPtr>& r = renderables[pos];
630 if (r == nullptr)
631 {
632 r = std::make_shared<ChunkPtr>();
633 }
634 r->SetFaces(std::move(faces));
635 changed = true;
636 }
637
638 if (changed)
639 {
640 dirty = true;
641 }
642 }
643 }
644 } // Renderer
645} // Botcraft
const Renderer::Atlas * GetAtlas() const
static AssetsManager & getInstance()
unsigned int GetWaterColorMultiplier() const
Definition Biome.cpp:91
unsigned int GetColorMultiplier(const int height, const bool is_grass) const
Definition Biome.cpp:40
const std::string & GetName() const
BlockstateId GetId() const
unsigned char GetModelId(const Position &pos) const
TintType GetTintType() const
Vector3< double > GetHorizontalOffsetAtPos(const Position &pos) const
const std::string & GetVariableValue(const std::string &variable) const
Access the value of the variable.
const Model & GetModel(const unsigned short index) const
const std::vector< FaceDescriptor > & GetFaces() const
Definition Model.cpp:618
const unsigned char * Get(const int row=0, const int col=0, const int depth=0) const
Definition Atlas.cpp:248
const std::array< float, 16 > & GetMatrix() const
Definition Face.cpp:125
void SetTextureMultipliers(const std::array< unsigned int, 2 > &mult)
Definition Face.cpp:135
Transparency GetTransparencyData() const
Definition Face.cpp:98
std::shared_ptr< Camera > camera
void UpdateChunk(const int x_, const int z_, const std::optional< Botcraft::Chunk > &chunk)
const float DistanceToCamera(const Position &chunk) const
std::atomic< bool > transparent_chunks_dirty
void SetPosOrientation(const double x_, const double y_, const double z_, const float yaw_, const float pitch_)
std::shared_ptr< Camera > GetCamera()
std::unordered_map< int, std::shared_ptr< Entity > > entities
std::atomic< bool > entities_faces_should_be_updated
std::unordered_map< Position, std::shared_ptr< TransparentChunk > > transparent_chunks
const std::vector< unsigned int > GetColorModifier(const int y, const Biome *biome, const Blockstate *blockstate, const std::vector< bool > &use_tintindex) const
std::unordered_map< Position, std::shared_ptr< Chunk > > chunks
void UpdateEntity(const int id, const std::vector< Face > &faces)
void SetCameraProjection(const glm::mat4 &proj)
void RenderFaces(int *num_chunks_=nullptr, int *num_rendered_chunks_=nullptr, int *num_entities_=nullptr, int *num_rendered_entities_=nullptr, int *num_faces_=nullptr, int *num_rendered_faces_=nullptr)
static constexpr unsigned int RENDERING_SECTION_HEIGHT
static constexpr int CHUNK_WIDTH
Definition Chunk.hpp:21
Vector3< int > Position
Definition Vector3.hpp:314