Bientôt un monde infini?

This commit is contained in:
MarcEricMartel
2021-11-26 11:59:02 -05:00
parent 6446be1ceb
commit fe624fdafc
14 changed files with 815 additions and 146 deletions

View File

@@ -34,13 +34,21 @@ private:
void DrawHud(float elapsedTime);
void PrintText(unsigned int x, unsigned int y, const std::string& t);
int GetFps(float elapsedTime) const;
bool GenerateChunk(int chx, int chy);
void UpdateWorld(int& generates, int& updates, int chx, int chy);
void GetBlockAtCursor(BlockType blocktype);
bool m_wireframe = false;
bool m_renderer = false;
int m_renderCount = 0;
BlockInfo* m_blockinfo[BTYPE_LAST];
TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST);
World m_world = World();
Texture m_textureFloor;
Texture m_textureSkybox;
Texture m_textureFont;
@@ -51,7 +59,7 @@ private:
Shader m_shader01;
Audio m_audio = Audio(AUDIO_PATH "music01.wav");
Player m_player = Player(Vector3f(VIEW_DISTANCE * CHUNK_SIZE_X / 2, CHUNK_SIZE_Y / 2, VIEW_DISTANCE * CHUNK_SIZE_Z / 2));
Player m_player = Player(Vector3f(CHUNK_SIZE_X * WORLD_SIZE_X / 2, CHUNK_SIZE_Y, CHUNK_SIZE_Z * WORLD_SIZE_X / 2));
bool m_keyW = false;
bool m_keyA = false;
@@ -59,7 +67,23 @@ private:
bool m_keyD = false;
bool m_keylshift = false;
bool m_keySpace = false;
bool m_mouseL = false;
bool m_mouseR = false;
bool m_mouseC = false;
bool m_mouseWU = false;
bool m_mouseWD = false;
};
template <class T>
static bool EqualWithEpsilon(const T& v1, const T& v2, T epsilon = T(0.0001))
{
return (fabs(v2 - v1) < epsilon);
}
template <class T>
static bool InRangeWithEpsilon(const T& v, const T& vinf, const T& vsup, T epsilon = T(0.0001))
{
return (v >= vinf - epsilon && v <= vsup + epsilon);
}
#endif // ENGINE_H__