This commit is contained in:
MarcEricMartel
2021-12-07 18:59:50 -05:00
parent 078cb33c27
commit 8e2169420e
16 changed files with 204 additions and 36 deletions

View File

@@ -8,6 +8,7 @@
#include "transformation.h"
#include "perlin.h"
#include "shader.h"
#include "bullet.h"
#include "textureatlas.h"
#include <fstream>
#include <string>
@@ -15,6 +16,7 @@
class Chunk;
class Player;
class Bullet;
class World {
public:
@@ -29,11 +31,12 @@ public:
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, int& badhitcount, Player& player, Transformation& world, Shader& shader, TextureAtlas& atlas, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]);
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<Chunk*> m_chunks = Array2d<Chunk*>(WORLD_SIZE_X, WORLD_SIZE_Y);
@@ -43,9 +46,9 @@ private:
bool GenerateChunk(int x, int y, Perlin& perlin);
void UpdateChunk(int& generates, int& updates, int chx, int chy, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]);
void RenderWorld(int& rendercount, int& badhitcount, Player& player, Transformation& world, Shader& shader);
void RenderWorld(int& rendercount, Player& player, Transformation& world, Shader& shader);
void UpdateWorld(Player& player, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]);
void TransposeWorld(Player& player);
void TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]);
};
#endif // WORLD_H__