nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
chunks.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_CHUNKS_H_
2#define NANOMMO_CLIENT_CHUNKS_H_
3
4#include <raylib.h>
5
6#include <vector>
7
8#include "client/atmosphere.h"
9#include "client/trees.h"
10#include "terrain/terrain.h"
11
12namespace nanommo {
13
14/// In cells along each side: 32 metres.
15constexpr int kChunkCells = 16;
16
17/// A square of the terrain, its ground and its trees in one mesh, so that
18/// one draw draws all of it.
19struct Chunk {
20 Model model;
21 BoundingBox box;
22};
23
24std::vector<Chunk> LoadChunks(const Terrain& terrain, const Look& look,
25 const std::vector<Face>& tree, Shader shader);
26
27void UnloadChunks(std::vector<Chunk>& chunks);
28
29/// Whether any of the box is closer to the eye than the farthest we see, and
30/// inside the view: past none of its six sides.
31bool InSight(const BoundingBox& box, Vector3 eye, const Matrix& view_projection,
32 float farthest);
33
34} // namespace nanommo
35
36#endif // NANOMMO_CLIENT_CHUNKS_H_
Definition chat.cc:9
bool InSight(const BoundingBox &box, Vector3 eye, const Matrix &view_projection, float farthest)
Definition chunks.cc:55
std::vector< Chunk > LoadChunks(const Terrain &terrain, const Look &look, const std::vector< Face > &tree, Shader shader)
Definition chunks.cc:14
constexpr int kChunkCells
In cells along each side: 32 metres.
Definition chunks.h:15
void UnloadChunks(std::vector< Chunk > &chunks)
Definition chunks.cc:48
BoundingBox box
Definition chunks.h:21
Model model
Definition chunks.h:20
A land's colours: its atmosphere, and the colours that go into its meshes.
Definition atmosphere.h:69