#ifndef WORLD_H__ #define WORLD_H__ #include "define.h" #include "chunk.h" #include "array2d.h" #include "vector3.h" #include "player.h" #include "transformation.h" #include "perlin.h" #include "shader.h" #include "bullet.h" #include "textureatlas.h" #include #include #include #include #include class Chunk; class Player; class Bullet; class World { public: World(); ~World(); Array2d& GetChunks(); Chunk* ChunkAt(float x, float y, float z) const; Chunk* ChunkAt(const Vector3f& pos) const; BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const; BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const; void Update(int& rendercount, Bullet* bullets[MAX_BULLETS], Player& player, Transformation& world, Shader& shader, TextureAtlas& atlas, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]); void GetScope(int& x, int& y); void ChangeBlockAtCursor(BlockType blockType, Player& player, bool& block); void ChangeBlockAtPosition(BlockType blockType, Vector3f pos); void CleanUpWorld(int& deleteframes, bool clear); private: Array2d m_chunks = Array2d(WORLD_SIZE_X, WORLD_SIZE_Y); std::vector m_tbDeleted; int m_center[2] = { INT16_MAX / 2 - WORLD_SIZE_X / 2, INT16_MAX / 2 - WORLD_SIZE_Y / 2 }; void UpdateChunk(int& updates, int chx, int chy, BlockInfo* blockinfo[BTYPE_LAST]); void RenderWorld(int& rendercount, Player& player, Transformation& world, Shader& shader); void UpdateWorld(Player& player, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]); void TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]); }; #endif // WORLD_H__