OpenMiner/include/world/World.hpp

54 lines
1.1 KiB
C++
Raw Normal View History

2014-12-18 07:02:48 +01:00
/*
* =====================================================================================
*
* Filename: World.hpp
*
2018-06-05 01:24:54 +02:00
* Description:
2014-12-18 07:02:48 +01:00
*
* Created: 16/12/2014 15:28:02
*
* Author: Quentin Bazin, <quent42340@gmail.com>
2014-12-18 07:02:48 +01:00
*
* =====================================================================================
*/
#ifndef WORLD_HPP_
#define WORLD_HPP_
#include <memory>
#include "Chunk.hpp"
#include "IDrawable.hpp"
#include "TerrainGenerator.hpp"
2014-12-18 07:02:48 +01:00
class Camera;
class World : public IDrawable {
2014-12-18 07:02:48 +01:00
public:
World();
2018-06-05 01:24:54 +02:00
void updateChunks();
Chunk *getChunk(int cx, int cy, int cz) const;
2018-06-05 01:24:54 +02:00
Block *getBlock(int x, int y, int z) const;
void setBlock(int x, int y, int z, u32 id);
2014-12-23 16:15:44 +01:00
// Render distance in chunks
2015-02-06 01:44:16 +01:00
static const u16 renderDistance = 8;
2018-06-05 01:24:54 +02:00
2014-12-18 07:02:48 +01:00
private:
void draw(RenderTarget &target, RenderStates states) const override;
const s32 m_width = 32;
const s32 m_height = 4;
const s32 m_depth = 32;
2018-06-05 01:24:54 +02:00
Texture &m_texture;
2018-06-05 01:24:54 +02:00
2014-12-18 07:02:48 +01:00
std::vector<std::unique_ptr<Chunk>> m_chunks;
TerrainGenerator m_terrainGenerator;
2014-12-18 07:02:48 +01:00
};
#endif // WORLD_HPP_