diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..fe3362e7 --- /dev/null +++ b/.clang-format @@ -0,0 +1,14 @@ +Language: Cpp +BasedOnStyle: LLVM +IndentWidth: 4 + +BreakBeforeBraces: Stroustrup +FixNamespaceComments: true +IndentCaseLabels: true +NamespaceIndentation: None + +BreakConstructorInitializersBeforeComma: true + +AllowShortFunctionsOnASingleLine: None + +ColumnLimit: 80 \ No newline at end of file diff --git a/Source/Application.cpp b/Source/Application.cpp index d06d9ca4..609cb967 100644 --- a/Source/Application.cpp +++ b/Source/Application.cpp @@ -1,12 +1,12 @@ #include "Application.h" -#include #include "States/PlayingState.h" #include "World/Block/BlockDatabase.h" +#include -Application::Application(const Config& config) -: m_context (config) -, m_camera (config) -, m_config (config) +Application::Application(const Config &config) + : m_context(config) + , m_camera(config) + , m_config(config) { BlockDatabase::get(); pushState(*this, config); @@ -14,7 +14,6 @@ Application::Application(const Config& config) float g_timeElapsed = 0; - void Application::runLoop() { sf::Clock dtTimer; @@ -22,10 +21,9 @@ void Application::runLoop() sf::Time m; - while (m_context.window.isOpen() && !m_states.empty()) - { + while (m_context.window.isOpen() && !m_states.empty()) { auto deltaTime = dtTimer.restart(); - auto& state = *m_states.back(); + auto &state = *m_states.back(); state.handleInput(); state.update(deltaTime.asSeconds()); @@ -35,8 +33,7 @@ void Application::runLoop() m_masterRenderer.finishRender(m_context.window, m_camera); handleEvents(); - if (m_isPopState) - { + if (m_isPopState) { m_isPopState = false; m_states.pop_back(); } @@ -50,18 +47,15 @@ void Application::runLoop() void Application::handleEvents() { sf::Event e; - while (m_context.window.pollEvent(e)) - { - m_states.back()->handleEvent(e); - switch(e.type) - { + while (m_context.window.pollEvent(e)) { + m_states.back()->handleEvent(e); + switch (e.type) { case sf::Event::Closed: m_context.window.close(); break; case sf::Event::KeyPressed: - switch(e.key.code) - { + switch (e.key.code) { case sf::Keyboard::Escape: m_context.window.close(); break; @@ -77,7 +71,6 @@ void Application::handleEvents() } } - void Application::popState() { m_isPopState = true; @@ -92,4 +85,3 @@ void Application::turnOnMouse() { m_context.window.setMouseCursorVisible(true); } - diff --git a/Source/Application.h b/Source/Application.h index 61fdca11..40d9a8d1 100644 --- a/Source/Application.h +++ b/Source/Application.h @@ -1,54 +1,58 @@ #ifndef APPLICATION_H_INCLUDED #define APPLICATION_H_INCLUDED -#include #include +#include -#include "States/StateBase.h" #include "Renderer/RenderMaster.h" +#include "States/StateBase.h" -#include "Context.h" #include "Camera.h" +#include "Context.h" float extern g_timeElapsed; -class Application -{ - - public: - Application(const Config& config); +class Application { + + public: + Application(const Config &config); - void runLoop(); + void runLoop(); - template - void pushState(Args&&... args) - { - m_states.push_back(std::make_unique(std::forward(args)...)); - auto& s = m_states.back(); - s->onOpen(); - } + template void pushState(Args &&... args) + { + m_states.push_back(std::make_unique(std::forward(args)...)); + auto &s = m_states.back(); + s->onOpen(); + } - void popState(); + void popState(); - Camera& getCamera() { return m_camera; } + Camera &getCamera() + { + return m_camera; + } - const sf::Window& getWindow() const { return m_context.window; } + const sf::Window &getWindow() const + { + return m_context.window; + } - void turnOffMouse(); - void turnOnMouse (); + void turnOffMouse(); + void turnOnMouse(); - private: - void handleEvents(); + private: + void handleEvents(); - std::vector> m_states; + std::vector> m_states; - Context m_context; - RenderMaster m_masterRenderer; - Camera m_camera; + Context m_context; + RenderMaster m_masterRenderer; + Camera m_camera; - const Config& m_config; + const Config &m_config; - bool m_isPopState = false; + bool m_isPopState = false; }; #endif // APPLICATION_H_INCLUDED diff --git a/Source/Camera.cpp b/Source/Camera.cpp index 0521cba6..36b714b0 100644 --- a/Source/Camera.cpp +++ b/Source/Camera.cpp @@ -2,8 +2,8 @@ #include "Maths/Matrix.h" -Camera::Camera(const Config& config) noexcept -: m_config (config) +Camera::Camera(const Config &config) noexcept + : m_config(config) { m_projectionMatrix = makeProjectionMatrix(config); @@ -12,36 +12,36 @@ Camera::Camera(const Config& config) noexcept void Camera::update() noexcept { - position = {m_pEntity->position.x, m_pEntity->position.y + 0.6f, m_pEntity->position.z}; + position = {m_pEntity->position.x, m_pEntity->position.y + 0.6f, + m_pEntity->position.z}; rotation = m_pEntity->rotation; - m_viewMatrix = makeViewMatrix(*this); + m_viewMatrix = makeViewMatrix(*this); m_projViewMatrx = m_projectionMatrix * m_viewMatrix; m_frustum.update(m_projViewMatrx); } -void Camera::hookEntity(const Entity& entity) noexcept +void Camera::hookEntity(const Entity &entity) noexcept { m_pEntity = &entity; } -const glm::mat4& Camera::getViewMatrix() const noexcept +const glm::mat4 &Camera::getViewMatrix() const noexcept { return m_viewMatrix; } -const glm::mat4& Camera::getProjMatrix() const noexcept +const glm::mat4 &Camera::getProjMatrix() const noexcept { return m_projectionMatrix; } -const glm::mat4& Camera::getProjectionViewMatrix() const noexcept +const glm::mat4 &Camera::getProjectionViewMatrix() const noexcept { return m_projViewMatrx; } -const ViewFrustum& Camera::getFrustum() const noexcept +const ViewFrustum &Camera::getFrustum() const noexcept { return m_frustum; } - diff --git a/Source/Camera.h b/Source/Camera.h index cd4a9fd1..f1adb4ea 100644 --- a/Source/Camera.h +++ b/Source/Camera.h @@ -1,37 +1,34 @@ #ifndef CAMERA_H_INCLUDED #define CAMERA_H_INCLUDED -#include "Maths/glm.h" -#include "Maths/Frustum.h" -#include "Entity.h" #include "Config.h" +#include "Entity.h" +#include "Maths/Frustum.h" +#include "Maths/glm.h" -class Camera : public Entity -{ - public: - Camera(const Config& config) noexcept; - - void update() noexcept; - void hookEntity(const Entity& entity) noexcept; - - const glm::mat4& getViewMatrix () const noexcept; - const glm::mat4& getProjMatrix () const noexcept; - const glm::mat4& getProjectionViewMatrix () const noexcept; +class Camera : public Entity { + public: + Camera(const Config &config) noexcept; - const ViewFrustum& getFrustum() const noexcept; + void update() noexcept; + void hookEntity(const Entity &entity) noexcept; - private: - const Entity* m_pEntity; + const glm::mat4 &getViewMatrix() const noexcept; + const glm::mat4 &getProjMatrix() const noexcept; + const glm::mat4 &getProjectionViewMatrix() const noexcept; - ViewFrustum m_frustum; + const ViewFrustum &getFrustum() const noexcept; - glm::mat4 m_projectionMatrix; - glm::mat4 m_viewMatrix; - glm::mat4 m_projViewMatrx; + private: + const Entity *m_pEntity; - Config m_config; + ViewFrustum m_frustum; + glm::mat4 m_projectionMatrix; + glm::mat4 m_viewMatrix; + glm::mat4 m_projViewMatrx; + Config m_config; }; #endif // CAMERA_H_INCLUDED diff --git a/Source/Config.h b/Source/Config.h index d30a1d62..6cfaf9f5 100644 --- a/Source/Config.h +++ b/Source/Config.h @@ -1,13 +1,12 @@ #ifndef CONFIG_H_INCLUDED #define CONFIG_H_INCLUDED -struct Config -{ - int windowX = 1280; - int windowY = 720; - bool isFullscreen = false; - int renderDistance = 16; - int fov = 90; +struct Config { + int windowX = 1280; + int windowY = 720; + bool isFullscreen = false; + int renderDistance = 16; + int fov = 90; }; #endif // CONFIG_H_INCLUDED diff --git a/Source/Context.cpp b/Source/Context.cpp index 73596a1f..912b66bc 100644 --- a/Source/Context.cpp +++ b/Source/Context.cpp @@ -5,7 +5,7 @@ unsigned int g_X; unsigned int g_Y; -Context::Context(const Config& config) +Context::Context(const Config &config) { sf::ContextSettings settings; settings.antialiasingLevel = 0; @@ -13,21 +13,20 @@ Context::Context(const Config& config) settings.minorVersion = 3; settings.depthBits = 24; settings.stencilBits = 8; - //settings.attributeFlags = sf::ContextSettings::Core; - //This is no longer necessary due to the Mac Support update. - - if(config.isFullscreen) - { - window.create(sf::VideoMode::getDesktopMode(), "MineCraft Week", sf::Style::Fullscreen, settings); + // settings.attributeFlags = sf::ContextSettings::Core; + // This is no longer necessary due to the Mac Support update. + + if (config.isFullscreen) { + window.create(sf::VideoMode::getDesktopMode(), "MineCraft Week", + sf::Style::Fullscreen, settings); } - else - { + else { sf::VideoMode winMode(config.windowX, config.windowY); window.create(winMode, "MineCraft Week", sf::Style::Close, settings); } if (!gladLoadGL()) { - + exit(-1); } diff --git a/Source/Context.h b/Source/Context.h index dcfe47f6..ff01047e 100644 --- a/Source/Context.h +++ b/Source/Context.h @@ -4,9 +4,8 @@ #include "Config.h" -struct Context -{ - Context(const Config& config); +struct Context { + Context(const Config &config); sf::Window window; }; diff --git a/Source/Controller.cpp b/Source/Controller.cpp index 81004b3d..f3198897 100644 --- a/Source/Controller.cpp +++ b/Source/Controller.cpp @@ -1,6 +1,6 @@ #include "Controller.h" -//WIP +// WIP /* glm::vec3 Controller::translateInput() { diff --git a/Source/Controller.h b/Source/Controller.h index 371b1f1a..9ebe9b82 100644 --- a/Source/Controller.h +++ b/Source/Controller.h @@ -4,11 +4,10 @@ #include "Maths/glm.h" #include -//WIP -class Controller -{ - glm::vec3 translateInput(); - sf::Vector2i mouseInput(); +// WIP +class Controller { + glm::vec3 translateInput(); + sf::Vector2i mouseInput(); }; #endif // CONTROLLER_H_INCLUDED diff --git a/Source/Entity.h b/Source/Entity.h index 20353593..43de280d 100644 --- a/Source/Entity.h +++ b/Source/Entity.h @@ -4,30 +4,28 @@ #include "Maths/Matrix.h" #include "Physics/AABB.h" -struct Entity -{ +struct Entity { Entity() - : box ({0.f, 0.f, 0.f}) - , position (glm::vec3(0.f)) - , rotation (glm::vec3(0.f)) - , velocity (glm::vec3(0.f)) - { } - - Entity(const glm::vec3& pos, const glm::vec3& rot) - : position (pos) - , rotation (rot) - , box ({0, 0, 0}) - , velocity (glm::vec3(0.f)) + : box({0.f, 0.f, 0.f}) + , position(glm::vec3(0.f)) + , rotation(glm::vec3(0.f)) + , velocity(glm::vec3(0.f)) { + } + Entity(const glm::vec3 &pos, const glm::vec3 &rot) + : position(pos) + , rotation(rot) + , box({0, 0, 0}) + , velocity(glm::vec3(0.f)) + { } - Entity(const glm::vec3& pos, const glm::vec3& rot, const glm::vec3& box) - : position (pos) - , rotation (rot) - , box (box) - , velocity (glm::vec3(0.f)) + Entity(const glm::vec3 &pos, const glm::vec3 &rot, const glm::vec3 &box) + : position(pos) + , rotation(rot) + , box(box) + , velocity(glm::vec3(0.f)) { - } glm::vec3 position; diff --git a/Source/GL/GLFunctions.h b/Source/GL/GLFunctions.h index 7d351fca..6e242bd4 100644 --- a/Source/GL/GLFunctions.h +++ b/Source/GL/GLFunctions.h @@ -3,19 +3,13 @@ #include "../glad/glad.h" -namespace GL -{ - void drawElements (GLuint indicesCount) noexcept; - void bindVAO (GLuint vao) noexcept; +namespace GL { +void drawElements(GLuint indicesCount) noexcept; +void bindVAO(GLuint vao) noexcept; - namespace Enum - { - enum Texture - { - Tex2D = GL_TEXTURE_2D, - TexCubeMap = GL_TEXTURE_CUBE_MAP - }; - } +namespace Enum { +enum Texture { Tex2D = GL_TEXTURE_2D, TexCubeMap = GL_TEXTURE_CUBE_MAP }; } +} // namespace GL #endif // GLFUNCTIONS_H_INCLUDED diff --git a/Source/Input/Keyboard.cpp b/Source/Input/Keyboard.cpp index d805adb4..1a8ea5e3 100644 --- a/Source/Input/Keyboard.cpp +++ b/Source/Input/Keyboard.cpp @@ -1,31 +1,34 @@ #include "Keyboard.h" - -Keyboard::Keyboard() { - std::fill(m_keys.begin(), m_keys.end(), false); +Keyboard::Keyboard() +{ + std::fill(m_keys.begin(), m_keys.end(), false); } -void Keyboard::update(sf::Event e) { - m_recentlyReleased = sf::Keyboard::KeyCount; - switch (e.type) { - case sf::Event::KeyReleased: - m_keys[e.key.code] = false; - break; +void Keyboard::update(sf::Event e) +{ + m_recentlyReleased = sf::Keyboard::KeyCount; + switch (e.type) { + case sf::Event::KeyReleased: + m_keys[e.key.code] = false; + break; - case sf::Event::KeyPressed: - m_recentlyReleased = e.key.code; - m_keys[e.key.code] = true; - break; + case sf::Event::KeyPressed: + m_recentlyReleased = e.key.code; + m_keys[e.key.code] = true; + break; - default: - break; - } + default: + break; + } } -bool Keyboard::isKeyDown(sf::Keyboard::Key key) const { - return m_keys[key]; +bool Keyboard::isKeyDown(sf::Keyboard::Key key) const +{ + return m_keys[key]; } -bool Keyboard::keyReleased(sf::Keyboard::Key key) const { - return m_recentlyReleased == key; +bool Keyboard::keyReleased(sf::Keyboard::Key key) const +{ + return m_recentlyReleased == key; } \ No newline at end of file diff --git a/Source/Input/Keyboard.h b/Source/Input/Keyboard.h index 8c0aaebe..003eb1ae 100644 --- a/Source/Input/Keyboard.h +++ b/Source/Input/Keyboard.h @@ -6,15 +6,15 @@ #include class Keyboard { -public: - Keyboard(); + public: + Keyboard(); - void update(sf::Event e); + void update(sf::Event e); - bool isKeyDown(sf::Keyboard::Key key) const; - bool keyReleased(sf::Keyboard::Key key) const; + bool isKeyDown(sf::Keyboard::Key key) const; + bool keyReleased(sf::Keyboard::Key key) const; -private: - std::array m_keys; - sf::Keyboard::Key m_recentlyReleased; + private: + std::array m_keys; + sf::Keyboard::Key m_recentlyReleased; }; \ No newline at end of file diff --git a/Source/Input/ToggleKey.cpp b/Source/Input/ToggleKey.cpp index 7291ec1b..c87fae40 100644 --- a/Source/Input/ToggleKey.cpp +++ b/Source/Input/ToggleKey.cpp @@ -1,15 +1,14 @@ #include "ToggleKey.h" ToggleKey::ToggleKey(sf::Keyboard::Key key) -: m_key (key) -{ } + : m_key(key) +{ +} bool ToggleKey::isKeyPressed() { - if (m_delayTimer.getElapsedTime().asSeconds() > 0.2) - { - if (sf::Keyboard::isKeyPressed(m_key)) - { + if (m_delayTimer.getElapsedTime().asSeconds() > 0.2) { + if (sf::Keyboard::isKeyPressed(m_key)) { m_delayTimer.restart(); return true; } diff --git a/Source/Input/ToggleKey.h b/Source/Input/ToggleKey.h index bbb8d20e..3ccb303c 100644 --- a/Source/Input/ToggleKey.h +++ b/Source/Input/ToggleKey.h @@ -3,17 +3,15 @@ #include -class ToggleKey -{ - public: - ToggleKey(sf::Keyboard::Key); +class ToggleKey { + public: + ToggleKey(sf::Keyboard::Key); - bool isKeyPressed(); - - private: - sf::Keyboard::Key m_key; - sf::Clock m_delayTimer; + bool isKeyPressed(); + private: + sf::Keyboard::Key m_key; + sf::Clock m_delayTimer; }; #endif // TOGGLEKEY_H_INCLUDED diff --git a/Source/Item/ItemStack.cpp b/Source/Item/ItemStack.cpp index d5530fc3..59520c35 100644 --- a/Source/Item/ItemStack.cpp +++ b/Source/Item/ItemStack.cpp @@ -2,23 +2,22 @@ #include -ItemStack::ItemStack(const Material& material, int amount) -: m_pMaterial (&material) -, m_numInStack (amount) -{ } +ItemStack::ItemStack(const Material &material, int amount) + : m_pMaterial(&material) + , m_numInStack(amount) +{ +} int ItemStack::add(int amount) { m_numInStack += amount; - if (m_numInStack > m_pMaterial->maxStackSize) - { + if (m_numInStack > m_pMaterial->maxStackSize) { int leftOver = m_numInStack - m_pMaterial->maxStackSize; m_numInStack = m_pMaterial->maxStackSize; return leftOver; } - else - { + else { return 0; } } @@ -26,8 +25,7 @@ int ItemStack::add(int amount) void ItemStack::remove() { m_numInStack--; - if (m_numInStack == 0) - { + if (m_numInStack == 0) { m_pMaterial = &Material::NOTHING; } } @@ -37,7 +35,7 @@ int ItemStack::getNumInStack() const return m_numInStack; } -const Material& ItemStack::getMaterial() const +const Material &ItemStack::getMaterial() const { return *m_pMaterial; } diff --git a/Source/Item/ItemStack.h b/Source/Item/ItemStack.h index 75a521d2..16883992 100644 --- a/Source/Item/ItemStack.h +++ b/Source/Item/ItemStack.h @@ -3,22 +3,20 @@ #include "Material.h" -class ItemStack -{ - public: - ItemStack(const Material& material, int amount); +class ItemStack { + public: + ItemStack(const Material &material, int amount); - int add(int amount); - void remove(); + int add(int amount); + void remove(); - int getNumInStack() const; + int getNumInStack() const; - const Material& getMaterial() const; - - private: - const Material* m_pMaterial = &Material::NOTHING; - int m_numInStack = 0; + const Material &getMaterial() const; + private: + const Material *m_pMaterial = &Material::NOTHING; + int m_numInStack = 0; }; #endif // ITEMSTACK_H_INCLUDED diff --git a/Source/Item/ItemType.h b/Source/Item/ItemType.h index 13287d78..9f33446c 100644 --- a/Source/Item/ItemType.h +++ b/Source/Item/ItemType.h @@ -1,6 +1,4 @@ #ifndef ITEMTYPE_H_INCLUDED #define ITEMTYPE_H_INCLUDED - - #endif // ITEMTYPE_H_INCLUDED diff --git a/Source/Item/Material.cpp b/Source/Item/Material.cpp index e07242b2..5c36d948 100644 --- a/Source/Item/Material.cpp +++ b/Source/Item/Material.cpp @@ -1,32 +1,32 @@ #include "Material.h" -const Material Material::NOTHING (ID::Nothing, 0, false, "None" ); -const Material Material::GRASS_BLOCK (ID::Grass, 99, true, "Grass Block"); -const Material Material::DIRT_BLOCK (ID::Dirt, 99, true, "Dirt Block"); -const Material Material::STONE_BLOCK (ID::Stone, 99, true, "Stone Block"); -const Material Material::OAK_BARK_BLOCK (ID::OakBark, 99, true, "Oak Bark Block"); -const Material Material::OAK_LEAF_BLOCK (ID::OakLeaf, 99, true, "Oak Leaf Block"); -const Material Material::SAND_BLOCK (ID::Sand, 99, true, "Sand Block"); -const Material Material::CACTUS_BLOCK (ID::Cactus, 99, true, "Cactus Block"); - -const Material Material::ROSE (ID::Rose, 99, true, "Rose"); -const Material Material::TALL_GRASS (ID::TallGrass, 99, true, "Tall Grass"); -const Material Material::DEAD_SHRUB (ID::DeadShrub, 99, true, "Dead Shrub"); - - -Material::Material(Material::ID id, int maxStack, bool isBlock, std::string&& name) -: id (id) -, maxStackSize (maxStack) -, isBlock (isBlock) -, name (std::move(name)) +const Material Material::NOTHING(ID::Nothing, 0, false, "None"); +const Material Material::GRASS_BLOCK(ID::Grass, 99, true, "Grass Block"); +const Material Material::DIRT_BLOCK(ID::Dirt, 99, true, "Dirt Block"); +const Material Material::STONE_BLOCK(ID::Stone, 99, true, "Stone Block"); +const Material Material::OAK_BARK_BLOCK(ID::OakBark, 99, true, + "Oak Bark Block"); +const Material Material::OAK_LEAF_BLOCK(ID::OakLeaf, 99, true, + "Oak Leaf Block"); +const Material Material::SAND_BLOCK(ID::Sand, 99, true, "Sand Block"); +const Material Material::CACTUS_BLOCK(ID::Cactus, 99, true, "Cactus Block"); + +const Material Material::ROSE(ID::Rose, 99, true, "Rose"); +const Material Material::TALL_GRASS(ID::TallGrass, 99, true, "Tall Grass"); +const Material Material::DEAD_SHRUB(ID::DeadShrub, 99, true, "Dead Shrub"); + +Material::Material(Material::ID id, int maxStack, bool isBlock, + std::string &&name) + : id(id) + , maxStackSize(maxStack) + , isBlock(isBlock) + , name(std::move(name)) { - } BlockId Material::toBlockID() const { - switch (id) - { + switch (id) { case Nothing: return BlockId::Air; @@ -65,10 +65,9 @@ BlockId Material::toBlockID() const } } -const Material& Material::toMaterial(BlockId id) +const Material &Material::toMaterial(BlockId id) { - switch (id) - { + switch (id) { case BlockId::Grass: return GRASS_BLOCK; @@ -99,10 +98,7 @@ const Material& Material::toMaterial(BlockId id) case BlockId::DeadShrub: return DEAD_SHRUB; - default: return NOTHING; } } - - diff --git a/Source/Item/Material.h b/Source/Item/Material.h index 5e9a126e..d885798e 100644 --- a/Source/Item/Material.h +++ b/Source/Item/Material.h @@ -1,15 +1,13 @@ #ifndef MATERIAL_H_INCLUDED #define MATERIAL_H_INCLUDED -#include #include "../World/Block/BlockId.h" +#include #include "../Util/NonCopyable.h" -struct Material : public NonCopyable -{ - enum ID - { +struct Material : public NonCopyable { + enum ID { Nothing, Grass, Dirt, @@ -23,44 +21,31 @@ struct Material : public NonCopyable DeadShrub }; - const static Material NOTHING, - GRASS_BLOCK, - DIRT_BLOCK, - STONE_BLOCK, - OAK_BARK_BLOCK, - OAK_LEAF_BLOCK, - SAND_BLOCK, - CACTUS_BLOCK, - ROSE, - TALL_GRASS, - DEAD_SHRUB; - + const static Material NOTHING, GRASS_BLOCK, DIRT_BLOCK, STONE_BLOCK, + OAK_BARK_BLOCK, OAK_LEAF_BLOCK, SAND_BLOCK, CACTUS_BLOCK, ROSE, + TALL_GRASS, DEAD_SHRUB; - Material(Material::ID id, int maxStack, bool isBlock, std::string&& name); + Material(Material::ID id, int maxStack, bool isBlock, std::string &&name); BlockId toBlockID() const; - static const Material& toMaterial(BlockId id); + static const Material &toMaterial(BlockId id); - const Material::ID id; - const int maxStackSize; - const bool isBlock; - const std::string name; + const Material::ID id; + const int maxStackSize; + const bool isBlock; + const std::string name; }; -namespace std -{ - template<> - struct hash +namespace std { +template <> struct hash { + size_t operator()(const Material::ID &id) const { - size_t operator()(const Material::ID& id) const - { - std::hash hasher; - - return hasher(id); - } - }; -} + std::hash hasher; + return hasher(id); + } +}; +} // namespace std #endif // MATERIAL_H_INCLUDED diff --git a/Source/Main.cpp b/Source/Main.cpp index 798bb050..e206a04a 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -6,19 +6,17 @@ #include "Config.h" #ifdef __WIN32 - extern "C" - { - //Enable dedicated graphics - __declspec(dllexport) bool NvOptimusEnablement = true; - __declspec(dllexport) bool AmdPowerXpressRequestHighPerformance = true; - } +extern "C" { +// Enable dedicated graphics +__declspec(dllexport) bool NvOptimusEnablement = true; +__declspec(dllexport) bool AmdPowerXpressRequestHighPerformance = true; +} #endif // __WIN32 -namespace -{ - void loadConfig(Config& config); - void displayInfo(); -} +namespace { +void loadConfig(Config &config); +void displayInfo(); +} // namespace int main() { @@ -33,76 +31,47 @@ int main() app.runLoop(); } -namespace +namespace { +void loadConfig(Config &config) { - void loadConfig(Config& config) - { - std::ifstream configFile("config.txt"); - std::string key; - - if (configFile.is_open()) - { - while (configFile >> key) - { - if (key == "renderdistance") - { - configFile >> config.renderDistance; - std::cout << "Config: Render Distance: " - << config.renderDistance << '\n'; - } - else if (key == "fullscreen") - { - configFile >> config.isFullscreen; - std::cout << "Config: Full screen mode: " - << std::boolalpha << config.isFullscreen << '\n'; - } - else if (key == "windowsize") - { - configFile >> config.windowX >> config.windowY; - std::cout << "Config: Window Size: " - << config.windowX << " x " << config.windowY << '\n'; - } - else if (key == "fov") - { - configFile >> config.fov; - std::cout << "Config: Field of Vision: " - << config.fov << '\n'; - } + std::ifstream configFile("config.txt"); + std::string key; + + if (configFile.is_open()) { + while (configFile >> key) { + if (key == "renderdistance") { + configFile >> config.renderDistance; + std::cout << "Config: Render Distance: " + << config.renderDistance << '\n'; + } + else if (key == "fullscreen") { + configFile >> config.isFullscreen; + std::cout << "Config: Full screen mode: " << std::boolalpha + << config.isFullscreen << '\n'; + } + else if (key == "windowsize") { + configFile >> config.windowX >> config.windowY; + std::cout << "Config: Window Size: " << config.windowX << " x " + << config.windowY << '\n'; + } + else if (key == "fov") { + configFile >> config.fov; + std::cout << "Config: Field of Vision: " << config.fov << '\n'; } - } - else - { - std::cerr << "Error: Could not find config.txt file! Using defaults.\n"; } } - - void displayInfo() - { - std::ifstream inFile; - inFile.open("Res/info.txt"); - std::string line; - while (std::getline(inFile, line)) - { - std::cout << line << "\n"; - } + else { + std::cerr << "Error: Could not find config.txt file! Using defaults.\n"; } } - - - - - - - - - - - - - - - - - - +void displayInfo() +{ + std::ifstream inFile; + inFile.open("Res/info.txt"); + std::string line; + while (std::getline(inFile, line)) { + std::cout << line << "\n"; + } +} +} // namespace diff --git a/Source/Maths/Frustum.cpp b/Source/Maths/Frustum.cpp index dda6191f..8d29c815 100644 --- a/Source/Maths/Frustum.cpp +++ b/Source/Maths/Frustum.cpp @@ -2,8 +2,7 @@ #include "../Physics/AABB.h" -enum Planes -{ +enum Planes { Near, Far, Left, @@ -12,69 +11,64 @@ enum Planes Bottom, }; -float Plane::distanceToPoint(const glm::vec3& point) const +float Plane::distanceToPoint(const glm::vec3 &point) const { return glm::dot(point, normal) + distanceToOrigin; } -void ViewFrustum::update(const glm::mat4& mat) noexcept +void ViewFrustum::update(const glm::mat4 &mat) noexcept { // left - m_planes[Planes::Left].normal.x = mat[0][3] + mat[0][0]; - m_planes[Planes::Left].normal.y = mat[1][3] + mat[1][0]; - m_planes[Planes::Left].normal.z = mat[2][3] + mat[2][0]; - m_planes[Planes::Left].distanceToOrigin = mat[3][3] + mat[3][0]; + m_planes[Planes::Left].normal.x = mat[0][3] + mat[0][0]; + m_planes[Planes::Left].normal.y = mat[1][3] + mat[1][0]; + m_planes[Planes::Left].normal.z = mat[2][3] + mat[2][0]; + m_planes[Planes::Left].distanceToOrigin = mat[3][3] + mat[3][0]; // right - m_planes[Planes::Right].normal.x = mat[0][3] - mat[0][0]; - m_planes[Planes::Right].normal.y = mat[1][3] - mat[1][0]; - m_planes[Planes::Right].normal.z = mat[2][3] - mat[2][0]; - m_planes[Planes::Right].distanceToOrigin = mat[3][3] - mat[3][0]; + m_planes[Planes::Right].normal.x = mat[0][3] - mat[0][0]; + m_planes[Planes::Right].normal.y = mat[1][3] - mat[1][0]; + m_planes[Planes::Right].normal.z = mat[2][3] - mat[2][0]; + m_planes[Planes::Right].distanceToOrigin = mat[3][3] - mat[3][0]; // bottom - m_planes[Planes::Bottom].normal.x = mat[0][3] + mat[0][1]; - m_planes[Planes::Bottom].normal.y = mat[1][3] + mat[1][1]; - m_planes[Planes::Bottom].normal.z = mat[2][3] + mat[2][1]; - m_planes[Planes::Bottom].distanceToOrigin = mat[3][3] + mat[3][1]; + m_planes[Planes::Bottom].normal.x = mat[0][3] + mat[0][1]; + m_planes[Planes::Bottom].normal.y = mat[1][3] + mat[1][1]; + m_planes[Planes::Bottom].normal.z = mat[2][3] + mat[2][1]; + m_planes[Planes::Bottom].distanceToOrigin = mat[3][3] + mat[3][1]; // top - m_planes[Planes::Top].normal.x = mat[0][3] - mat[0][1]; - m_planes[Planes::Top].normal.y = mat[1][3] - mat[1][1]; - m_planes[Planes::Top].normal.z = mat[2][3] - mat[2][1]; - m_planes[Planes::Top].distanceToOrigin = mat[3][3] - mat[3][1]; + m_planes[Planes::Top].normal.x = mat[0][3] - mat[0][1]; + m_planes[Planes::Top].normal.y = mat[1][3] - mat[1][1]; + m_planes[Planes::Top].normal.z = mat[2][3] - mat[2][1]; + m_planes[Planes::Top].distanceToOrigin = mat[3][3] - mat[3][1]; // near - m_planes[Planes::Near].normal.x = mat[0][3] + mat[0][2]; - m_planes[Planes::Near].normal.y = mat[1][3] + mat[1][2]; - m_planes[Planes::Near].normal.z = mat[2][3] + mat[2][2]; - m_planes[Planes::Near].distanceToOrigin = mat[3][3] + mat[3][2]; + m_planes[Planes::Near].normal.x = mat[0][3] + mat[0][2]; + m_planes[Planes::Near].normal.y = mat[1][3] + mat[1][2]; + m_planes[Planes::Near].normal.z = mat[2][3] + mat[2][2]; + m_planes[Planes::Near].distanceToOrigin = mat[3][3] + mat[3][2]; // far - m_planes[Planes::Far].normal.x = mat[0][3] - mat[0][2]; - m_planes[Planes::Far].normal.y = mat[1][3] - mat[1][2]; - m_planes[Planes::Far].normal.z = mat[2][3] - mat[2][2]; - m_planes[Planes::Far].distanceToOrigin = mat[3][3] - mat[3][2]; + m_planes[Planes::Far].normal.x = mat[0][3] - mat[0][2]; + m_planes[Planes::Far].normal.y = mat[1][3] - mat[1][2]; + m_planes[Planes::Far].normal.z = mat[2][3] - mat[2][2]; + m_planes[Planes::Far].distanceToOrigin = mat[3][3] - mat[3][2]; - for (auto& plane : m_planes) - { - float length = glm::length(plane.normal); - plane.normal /= length; - plane.distanceToOrigin /= length; + for (auto &plane : m_planes) { + float length = glm::length(plane.normal); + plane.normal /= length; + plane.distanceToOrigin /= length; } - } -bool ViewFrustum::isBoxInFrustum(const AABB& box) const noexcept +bool ViewFrustum::isBoxInFrustum(const AABB &box) const noexcept { bool result = true; - for (auto& plane : m_planes) - { - if (plane.distanceToPoint(box.getVP(plane.normal)) < 0) - { + for (auto &plane : m_planes) { + if (plane.distanceToPoint(box.getVP(plane.normal)) < 0) { return false; } - else if (plane.distanceToPoint(box.getVN(plane.normal)) < 0) - { + else if (plane.distanceToPoint(box.getVN(plane.normal)) < 0) { result = true; } } diff --git a/Source/Maths/Frustum.h b/Source/Maths/Frustum.h index 114a7703..3ac1c8ab 100644 --- a/Source/Maths/Frustum.h +++ b/Source/Maths/Frustum.h @@ -7,23 +7,21 @@ struct AABB; -struct Plane -{ - float distanceToPoint(const glm::vec3& point) const ; +struct Plane { + float distanceToPoint(const glm::vec3 &point) const; float distanceToOrigin; glm::vec3 normal; }; -class ViewFrustum -{ - public: - void update(const glm::mat4& projViewMatrix) noexcept; +class ViewFrustum { + public: + void update(const glm::mat4 &projViewMatrix) noexcept; - bool isBoxInFrustum(const AABB& box) const noexcept; + bool isBoxInFrustum(const AABB &box) const noexcept; - private: - std::array m_planes; + private: + std::array m_planes; }; #endif // FRUSTUM_H_INCLUDED diff --git a/Source/Maths/GeneralMaths.cpp b/Source/Maths/GeneralMaths.cpp index ac79d156..ef202b0c 100644 --- a/Source/Maths/GeneralMaths.cpp +++ b/Source/Maths/GeneralMaths.cpp @@ -7,54 +7,48 @@ float clamp(float x, float lowerlimit, float upperlimit); float smoothstep(float edge0, float edge1, float x) { // Scale, bias and saturate x to 0..1 range - x = x*x*(3 - 2*x); + x = x * x * (3 - 2 * x); // Evaluate polynomial - return (edge0 * x) + (edge1 * (1-x)); + return (edge0 * x) + (edge1 * (1 - x)); } -float clamp(float x, float lowerlimit, float upperlimit) { - if (x < lowerlimit) x = lowerlimit; - if (x > upperlimit) x = upperlimit; +float clamp(float x, float lowerlimit, float upperlimit) +{ + if (x < lowerlimit) + x = lowerlimit; + if (x > upperlimit) + x = upperlimit; return x; } -float smoothInterpolation(float bottomLeft, float topLeft, float bottomRight, float topRight, - float xMin, float xMax, - float zMin, float zMax, - float x, float z) +float smoothInterpolation(float bottomLeft, float topLeft, float bottomRight, + float topRight, float xMin, float xMax, float zMin, + float zMax, float x, float z) { - float width = xMax - xMin, - height = zMax - zMin; - float xValue = 1 - (x-xMin)/width; - float zValue = 1 - (z-zMin)/height; + float width = xMax - xMin, height = zMax - zMin; + float xValue = 1 - (x - xMin) / width; + float zValue = 1 - (z - zMin) / height; - //std::cout << xValue << std::endl; + // std::cout << xValue << std::endl; - float a = smoothstep(bottomLeft,bottomRight,xValue); - float b = smoothstep(topLeft,topRight,xValue); - return smoothstep(a,b,zValue); + float a = smoothstep(bottomLeft, bottomRight, xValue); + float b = smoothstep(topLeft, topRight, xValue); + return smoothstep(a, b, zValue); } -float bilinearInterpolation(float bottomLeft, float topLeft, float bottomRight, float topRight, - float xMin, float xMax, - float zMin, float zMax, - float x, float z) +float bilinearInterpolation(float bottomLeft, float topLeft, float bottomRight, + float topRight, float xMin, float xMax, float zMin, + float zMax, float x, float z) { - float width = xMax - xMin, - height = zMax - zMin, + float width = xMax - xMin, height = zMax - zMin, - xDistanceToMaxValue = xMax - x, - zDistanceToMaxValue = zMax - z, + xDistanceToMaxValue = xMax - x, zDistanceToMaxValue = zMax - z, - xDistanceToMinValue = x - xMin, - zDistanceToMinValue = z - zMin; + xDistanceToMinValue = x - xMin, zDistanceToMinValue = z - zMin; return 1.0f / (width * height) * - ( - bottomLeft * xDistanceToMaxValue * zDistanceToMaxValue + - bottomRight * xDistanceToMinValue * zDistanceToMaxValue + - topLeft * xDistanceToMaxValue * zDistanceToMinValue + - topRight * xDistanceToMinValue * zDistanceToMinValue - ); + (bottomLeft * xDistanceToMaxValue * zDistanceToMaxValue + + bottomRight * xDistanceToMinValue * zDistanceToMaxValue + + topLeft * xDistanceToMaxValue * zDistanceToMinValue + + topRight * xDistanceToMinValue * zDistanceToMinValue); } - diff --git a/Source/Maths/GeneralMaths.h b/Source/Maths/GeneralMaths.h index 80292aaf..017af242 100644 --- a/Source/Maths/GeneralMaths.h +++ b/Source/Maths/GeneralMaths.h @@ -1,14 +1,12 @@ #ifndef GENERALMATHS_H_INCLUDED #define GENERALMATHS_H_INCLUDED -float bilinearInterpolation(float bottomLeft, float topLeft, float bottomRight, float topRight, - float xMin, float xMax, - float zMin, float zMax, - float xToCalc, float yToCalc); +float bilinearInterpolation(float bottomLeft, float topLeft, float bottomRight, + float topRight, float xMin, float xMax, float zMin, + float zMax, float xToCalc, float yToCalc); -float smoothInterpolation(float bottomLeft, float topLeft, float bottomRight, float topRight, - float xMin, float xMax, - float zMin, float zMax, - float x, float z); +float smoothInterpolation(float bottomLeft, float topLeft, float bottomRight, + float topRight, float xMin, float xMax, float zMin, + float zMax, float x, float z); #endif // GENERALMATHS_H_INCLUDED diff --git a/Source/Maths/Matrix.cpp b/Source/Maths/Matrix.cpp index a8bbe03e..6a4af95e 100644 --- a/Source/Maths/Matrix.cpp +++ b/Source/Maths/Matrix.cpp @@ -5,7 +5,7 @@ #include "../Config.h" -glm::mat4 makeModelMatrix(const Entity& entity) +glm::mat4 makeModelMatrix(const Entity &entity) { glm::mat4 matrix; @@ -18,7 +18,7 @@ glm::mat4 makeModelMatrix(const Entity& entity) return matrix; } -glm::mat4 makeViewMatrix(const Camera& camera) +glm::mat4 makeViewMatrix(const Camera &camera) { glm::mat4 matrix(1.f); @@ -31,7 +31,7 @@ glm::mat4 makeViewMatrix(const Camera& camera) return matrix; } -glm::mat4 makeProjectionMatrix(const Config& config) +glm::mat4 makeProjectionMatrix(const Config &config) { float x = (float)config.windowX; float y = (float)config.windowY; diff --git a/Source/Maths/Matrix.h b/Source/Maths/Matrix.h index b27edcbd..e345acc8 100644 --- a/Source/Maths/Matrix.h +++ b/Source/Maths/Matrix.h @@ -8,8 +8,8 @@ class Camera; struct Entity; struct Config; -glm::mat4 makeModelMatrix (const Entity& entity) ; -glm::mat4 makeViewMatrix (const Camera& camera) ; -glm::mat4 makeProjectionMatrix (const Config& config); +glm::mat4 makeModelMatrix(const Entity &entity); +glm::mat4 makeViewMatrix(const Camera &camera); +glm::mat4 makeProjectionMatrix(const Config &config); #endif // MATRIX_H_INCLUDED diff --git a/Source/Maths/NoiseGenerator.cpp b/Source/Maths/NoiseGenerator.cpp index 80ba0a54..b1bc424d 100644 --- a/Source/Maths/NoiseGenerator.cpp +++ b/Source/Maths/NoiseGenerator.cpp @@ -5,21 +5,21 @@ #include NoiseGenerator::NoiseGenerator(int seed) -: m_seed (seed) + : m_seed(seed) { - m_noiseParameters.octaves = 7; - m_noiseParameters.amplitude = 70; - m_noiseParameters.smoothness = 235; - m_noiseParameters.heightOffset = -5; - m_noiseParameters.roughness = 0.53; + m_noiseParameters.octaves = 7; + m_noiseParameters.amplitude = 70; + m_noiseParameters.smoothness = 235; + m_noiseParameters.heightOffset = -5; + m_noiseParameters.roughness = 0.53; } -void NoiseGenerator::setParameters(const NoiseParameters& params) noexcept +void NoiseGenerator::setParameters(const NoiseParameters ¶ms) noexcept { m_noiseParameters = params; } -double NoiseGenerator::getNoise(int n) const noexcept +double NoiseGenerator::getNoise(int n) const noexcept { n += m_seed; n = (n << 13) ^ n; @@ -28,7 +28,7 @@ double NoiseGenerator::getNoise(int n) const noexcept return 1.0 - ((double)newN / 1073741824.0); } -double NoiseGenerator::getNoise(double x, double z) const noexcept +double NoiseGenerator::getNoise(double x, double z) const noexcept { return getNoise(x + z * 57.0); } @@ -39,52 +39,62 @@ double NoiseGenerator::lerp(double a, double b, double z) const noexcept return (a * (1 - mu2) + b * mu2); } -double NoiseGenerator::noise(double x, double z) const noexcept +double NoiseGenerator::noise(double x, double z) const noexcept { - auto floorX = (double)((int)x); //This is kinda a cheap way to floor a double integer. + auto floorX = (double)(( + int)x); // This is kinda a cheap way to floor a double integer. auto floorZ = (double)((int)z); - auto s = 0.0, - t = 0.0, - u = 0.0, - v = 0.0;//Integer declaration - - s = getNoise(floorX, floorZ); - t = getNoise(floorX + 1, floorZ); - u = getNoise(floorX, floorZ + 1);//Get the surrounding values to calculate the transition. - v = getNoise(floorX + 1, floorZ + 1); - - auto rec1 = lerp(s, t, x - floorX);//Interpolate between the values. - auto rec2 = lerp(u, v, x - floorX);//Here we use x-floorX, to get 1st dimension. Don't mind the x-floorX thingie, it's part of the cosine formula. - auto rec3 = lerp(rec1, rec2, z - floorZ);//Here we use y-floorZ, to get the 2nd dimension. + auto s = 0.0, t = 0.0, u = 0.0, + v = 0.0; // Integer declaration + + s = getNoise(floorX, floorZ); + t = getNoise(floorX + 1, floorZ); + u = getNoise( + floorX, + floorZ + 1); // Get the surrounding values to calculate the transition. + v = getNoise(floorX + 1, floorZ + 1); + + auto rec1 = lerp(s, t, x - floorX); // Interpolate between the values. + auto rec2 = lerp( + u, v, + x - floorX); // Here we use x-floorX, to get 1st dimension. Don't mind + // the x-floorX thingie, it's part of the cosine formula. + auto rec3 = + lerp(rec1, rec2, + z - floorZ); // Here we use y-floorZ, to get the 2nd dimension. return rec3; } -double NoiseGenerator::getHeight(int x, int z, int chunkX, int chunkZ) const noexcept +double NoiseGenerator::getHeight(int x, int z, int chunkX, int chunkZ) const + noexcept { - auto newX = (x + (chunkX * CHUNK_SIZE)); - auto newZ = (z + (chunkZ * CHUNK_SIZE)); - - if (newX < 0 || newZ < 0) - { - return WATER_LEVEL - 1; - } - - auto totalValue = 0.0; - - for (auto a = 0; a < m_noiseParameters.octaves - 1; a++) //This loops through the octaves. - { - auto frequency = pow(2.0, a); //This increases the frequency with every loop of the octave. - auto amplitude = pow(m_noiseParameters.roughness, a); //This decreases the amplitude with every loop of the octave. - totalValue += noise(((double)newX) * frequency / m_noiseParameters.smoothness, - ((double)newZ) * frequency / m_noiseParameters.smoothness) - * amplitude; - } - - auto val = - (((totalValue / 2.1) + 1.2) * m_noiseParameters.amplitude) + m_noiseParameters.heightOffset; - - return val > 0 ? val : 1; + auto newX = (x + (chunkX * CHUNK_SIZE)); + auto newZ = (z + (chunkZ * CHUNK_SIZE)); + + if (newX < 0 || newZ < 0) { + return WATER_LEVEL - 1; + } + + auto totalValue = 0.0; + + for (auto a = 0; a < m_noiseParameters.octaves - 1; + a++) // This loops through the octaves. + { + auto frequency = pow( + 2.0, + a); // This increases the frequency with every loop of the octave. + auto amplitude = pow( + m_noiseParameters.roughness, + a); // This decreases the amplitude with every loop of the octave. + totalValue += + noise(((double)newX) * frequency / m_noiseParameters.smoothness, + ((double)newZ) * frequency / m_noiseParameters.smoothness) * + amplitude; + } + + auto val = (((totalValue / 2.1) + 1.2) * m_noiseParameters.amplitude) + + m_noiseParameters.heightOffset; + + return val > 0 ? val : 1; } - - diff --git a/Source/Maths/NoiseGenerator.h b/Source/Maths/NoiseGenerator.h index 1235f028..f609575a 100644 --- a/Source/Maths/NoiseGenerator.h +++ b/Source/Maths/NoiseGenerator.h @@ -1,8 +1,7 @@ #ifndef NOISEGENERATOR_H_INCLUDED #define NOISEGENERATOR_H_INCLUDED -struct NoiseParameters -{ +struct NoiseParameters { int octaves; int amplitude; int smoothness; @@ -11,26 +10,25 @@ struct NoiseParameters double roughness; }; -class NoiseGenerator -{ - public: - NoiseGenerator(int seed); +class NoiseGenerator { + public: + NoiseGenerator(int seed); - double getHeight(int x, int z, int chunkX, int chunkZ) const noexcept; + double getHeight(int x, int z, int chunkX, int chunkZ) const noexcept; - void setParameters(const NoiseParameters& params) noexcept; + void setParameters(const NoiseParameters ¶ms) noexcept; - private: - double getNoise(int n) const noexcept; - double getNoise(double x, double z) const noexcept; + private: + double getNoise(int n) const noexcept; + double getNoise(double x, double z) const noexcept; - double lerp(double a, double b, double z) const noexcept; + double lerp(double a, double b, double z) const noexcept; - double noise(double x, double z) const noexcept; + double noise(double x, double z) const noexcept; - NoiseParameters m_noiseParameters; + NoiseParameters m_noiseParameters; - int m_seed; + int m_seed; }; #endif // NOISEGENERATOR_H_INCLUDED diff --git a/Source/Maths/Ray.cpp b/Source/Maths/Ray.cpp index 80871b6f..2d6077fd 100644 --- a/Source/Maths/Ray.cpp +++ b/Source/Maths/Ray.cpp @@ -1,26 +1,25 @@ #include "Ray.h" -Ray::Ray(const glm::vec3& position, const glm::vec3& direction) -: m_rayStart (position) -, m_rayEnd (position) -, m_direction (direction) +Ray::Ray(const glm::vec3 &position, const glm::vec3 &direction) + : m_rayStart(position) + , m_rayEnd(position) + , m_direction(direction) { - } void Ray::step(float scale) { - float yaw = glm::radians (m_direction.y + 90); - float pitch = glm::radians (m_direction.x); + float yaw = glm::radians(m_direction.y + 90); + float pitch = glm::radians(m_direction.x); - auto& p = m_rayEnd; + auto &p = m_rayEnd; - p.x -= glm::cos(yaw) * scale; - p.z -= glm::sin(yaw) * scale; - p.y -= glm::tan(pitch) * scale; + p.x -= glm::cos(yaw) * scale; + p.z -= glm::sin(yaw) * scale; + p.y -= glm::tan(pitch) * scale; } -const glm::vec3& Ray::getEnd() const +const glm::vec3 &Ray::getEnd() const { return m_rayEnd; } diff --git a/Source/Maths/Ray.h b/Source/Maths/Ray.h index 80ab8f02..628594d5 100644 --- a/Source/Maths/Ray.h +++ b/Source/Maths/Ray.h @@ -3,21 +3,20 @@ #include "glm.h" -class Ray -{ - public: - Ray(const glm::vec3& position, const glm::vec3& direction) ; +class Ray { + public: + Ray(const glm::vec3 &position, const glm::vec3 &direction); - void step(float scale) ; + void step(float scale); - const glm::vec3& getEnd() const ; + const glm::vec3 &getEnd() const; - float getLength() const ; + float getLength() const; - private: - glm::vec3 m_rayStart; - glm::vec3 m_rayEnd; - glm::vec3 m_direction; + private: + glm::vec3 m_rayStart; + glm::vec3 m_rayEnd; + glm::vec3 m_direction; }; #endif // RAY_H_INCLUDED diff --git a/Source/Maths/Vector2XZ.cpp b/Source/Maths/Vector2XZ.cpp index 1bc69b44..d34691e7 100644 --- a/Source/Maths/Vector2XZ.cpp +++ b/Source/Maths/Vector2XZ.cpp @@ -1,7 +1,6 @@ #include "Vector2XZ.h" -bool operator==(const VectorXZ& left, const VectorXZ& right) noexcept +bool operator==(const VectorXZ &left, const VectorXZ &right) noexcept { - return (left.x == right.x) && - (left.z == right.z); + return (left.x == right.x) && (left.z == right.z); } diff --git a/Source/Maths/Vector2XZ.h b/Source/Maths/Vector2XZ.h index 0e04baa2..2dcec521 100644 --- a/Source/Maths/Vector2XZ.h +++ b/Source/Maths/Vector2XZ.h @@ -1,51 +1,43 @@ #ifndef VECTOR2XZ_H_INCLUDED #define VECTOR2XZ_H_INCLUDED -#include #include +#include -struct VectorXZ -{ +struct VectorXZ { int x, z; }; -bool operator ==(const VectorXZ& left, const VectorXZ& right) noexcept; +bool operator==(const VectorXZ &left, const VectorXZ &right) noexcept; -namespace std -{ - template<> - struct hash +namespace std { +template <> struct hash { + size_t operator()(const VectorXZ &vect) const noexcept { - size_t operator()(const VectorXZ& vect) const noexcept - { - std::hash hasher; - - auto hash1 = hasher(vect.x); - auto hash2 = hasher(vect.z); - - return std::hash{}((hash1 ^ hash2) >> 2); - } - }; -} - -namespace std -{ - template<> - struct hash - { - size_t operator()(const sf::Vector3i& vect) const noexcept - { - std::hash hasher; + std::hash hasher; - auto hash1 = hasher(vect.x); - auto hash2 = hasher(vect.y); - auto hash3 = hasher(vect.z); + auto hash1 = hasher(vect.x); + auto hash2 = hasher(vect.z); - return std::hash{}((hash1 ^ (hash2 << hash3) ^ hash3)); - } - }; -} + return std::hash{}((hash1 ^ hash2) >> 2); + } +}; +} // namespace std +namespace std { +template <> struct hash { + size_t operator()(const sf::Vector3i &vect) const noexcept + { + std::hash hasher; + + auto hash1 = hasher(vect.x); + auto hash2 = hasher(vect.y); + auto hash3 = hasher(vect.z); + return std::hash{}( + (hash1 ^ (hash2 << hash3) ^ hash3)); + } +}; +} // namespace std #endif // VECTOR2XZ_H_INCLUDED diff --git a/Source/Mesh.h b/Source/Mesh.h index 59552dc5..df0794d4 100644 --- a/Source/Mesh.h +++ b/Source/Mesh.h @@ -1,15 +1,13 @@ #ifndef MESH_H_INCLUDED #define MESH_H_INCLUDED - #include "glad/glad.h" #include -struct Mesh -{ +struct Mesh { std::vector vertexPositions; std::vector textureCoords; - std::vector indices; + std::vector indices; }; #endif // MESH_H_INCLUDED diff --git a/Source/Model.cpp b/Source/Model.cpp index d3b13120..04e3a90e 100644 --- a/Source/Model.cpp +++ b/Source/Model.cpp @@ -1,6 +1,6 @@ #include "Model.h" -Model::Model(const Mesh& mesh) +Model::Model(const Mesh &mesh) { addData(mesh); } @@ -10,23 +10,23 @@ Model::~Model() deleteData(); } -Model::Model(Model&& other) -: m_renderInfo (other.m_renderInfo) -, m_vboCount (other.m_vboCount) -, m_buffers (std::move(other.m_buffers)) +Model::Model(Model &&other) + : m_renderInfo(other.m_renderInfo) + , m_vboCount(other.m_vboCount) + , m_buffers(std::move(other.m_buffers)) { other.m_renderInfo.reset(); - other.m_vboCount = 0; + other.m_vboCount = 0; } -Model& Model::operator=(Model&& other) +Model &Model::operator=(Model &&other) { m_renderInfo = other.m_renderInfo; m_vboCount = other.m_vboCount; m_buffers = std::move(other.m_buffers); other.m_renderInfo.reset(); - other.m_vboCount = 0; + other.m_vboCount = 0; return *this; } @@ -45,7 +45,7 @@ void Model::bindVAO() const glBindVertexArray(m_renderInfo.vao); } -void Model::addData(const Mesh& mesh) +void Model::addData(const Mesh &mesh) { genVAO(); @@ -54,38 +54,30 @@ void Model::addData(const Mesh& mesh) addEBO(mesh.indices); } -void Model::addVBO(int dimensions, const std::vector& data) +void Model::addVBO(int dimensions, const std::vector &data) { GLuint vbo; glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); - glBufferData(GL_ARRAY_BUFFER, - data.size() * sizeof(GLfloat), - data.data(), + glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(GLfloat), data.data(), GL_STATIC_DRAW); - glVertexAttribPointer(static_cast(m_vboCount), - dimensions, - GL_FLOAT, - GL_FALSE, - 0, - (GLvoid*) 0); + glVertexAttribPointer(static_cast(m_vboCount), dimensions, GL_FLOAT, + GL_FALSE, 0, (GLvoid *)0); glEnableVertexAttribArray(static_cast(m_vboCount++)); m_buffers.push_back(vbo); } -void Model::addEBO(const std::vector& indices) +void Model::addEBO(const std::vector &indices) { m_renderInfo.indicesCount = static_cast(indices.size()); GLuint ebo; glGenBuffers(1, &ebo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, - indices.size() * sizeof(GLuint), - indices.data(), - GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(GLuint), + indices.data(), GL_STATIC_DRAW); } void Model::deleteData() @@ -98,7 +90,7 @@ void Model::deleteData() m_buffers.clear(); - m_vboCount = 0; + m_vboCount = 0; m_renderInfo.reset(); } @@ -107,7 +99,7 @@ int Model::getIndicesCount() const return m_renderInfo.indicesCount; } -const RenderInfo& Model::getRenderInfo() const +const RenderInfo &Model::getRenderInfo() const { return m_renderInfo; } diff --git a/Source/Model.h b/Source/Model.h index 680a8196..a6fbcbd9 100644 --- a/Source/Model.h +++ b/Source/Model.h @@ -7,34 +7,33 @@ #include "Renderer/RenderInfo.h" -class Model : public NonCopyable -{ - public: - Model() = default; - Model(const Mesh& mesh); - ~Model(); +class Model : public NonCopyable { + public: + Model() = default; + Model(const Mesh &mesh); + ~Model(); - Model(Model&& other); - Model& operator= (Model&& other); + Model(Model &&other); + Model &operator=(Model &&other); - void addData(const Mesh& mesh); + void addData(const Mesh &mesh); - void deleteData(); + void deleteData(); - void genVAO(); - void addEBO(const std::vector& indices); - void addVBO(int dimensions, const std::vector& data); - void bindVAO() const; + void genVAO(); + void addEBO(const std::vector &indices); + void addVBO(int dimensions, const std::vector &data); + void bindVAO() const; - int getIndicesCount() const; + int getIndicesCount() const; - const RenderInfo& getRenderInfo() const; + const RenderInfo &getRenderInfo() const; - private: - RenderInfo m_renderInfo; + private: + RenderInfo m_renderInfo; - int m_vboCount = 0; - std::vector m_buffers; + int m_vboCount = 0; + std::vector m_buffers; }; #endif // MODEL_H_INCLUDED diff --git a/Source/Physics/AABB.h b/Source/Physics/AABB.h index cba66dfc..1c9b40db 100644 --- a/Source/Physics/AABB.h +++ b/Source/Physics/AABB.h @@ -3,53 +3,45 @@ #include "../Maths/glm.h" -struct AABB -{ - AABB(const glm::vec3& dim) - : dimensions (dim) +struct AABB { + AABB(const glm::vec3 &dim) + : dimensions(dim) { - } - void update(const glm::vec3& location) + void update(const glm::vec3 &location) { position = location; } - glm::vec3 getVN(const glm::vec3& normal) const + glm::vec3 getVN(const glm::vec3 &normal) const { glm::vec3 res = position; - if (normal.x < 0) - { + if (normal.x < 0) { res.x += dimensions.x; } - if (normal.y < 0) - { + if (normal.y < 0) { res.y += dimensions.y; } - if (normal.z < 0) - { + if (normal.z < 0) { res.z += dimensions.z; } return res; } - glm::vec3 getVP(const glm::vec3& normal) const + glm::vec3 getVP(const glm::vec3 &normal) const { glm::vec3 res = position; - if (normal.x > 0) - { + if (normal.x > 0) { res.x += dimensions.x; } - if (normal.y > 0) - { + if (normal.y > 0) { res.y += dimensions.y; } - if (normal.z > 0) - { + if (normal.z > 0) { res.z += dimensions.z; } diff --git a/Source/Player/Player.cpp b/Source/Player/Player.cpp index 5ab44af7..88ca2f5e 100644 --- a/Source/Player/Player.cpp +++ b/Source/Player/Player.cpp @@ -2,40 +2,36 @@ #include +#include #include #include -#include - #include "../Input/Keyboard.h" -#include "../World/World.h" #include "../Renderer/RenderMaster.h" +#include "../World/World.h" sf::Font f; Player::Player() -: Entity ({2500, 125, 2500}, {0.f, 0.f, 0.f}, {0.3f, 1.f, 0.3f}) -, m_itemDown (sf::Keyboard::Down) -, m_itemUp (sf::Keyboard::Up) -, m_flyKey (sf::Keyboard::F) -, m_num1 (sf::Keyboard::Num1) -, m_num2 (sf::Keyboard::Num2) -, m_num3 (sf::Keyboard::Num3) -, m_num4 (sf::Keyboard::Num4) -, m_num5 (sf::Keyboard::Num5) -, m_acceleration (glm::vec3(0.f)) + : Entity({2500, 125, 2500}, {0.f, 0.f, 0.f}, {0.3f, 1.f, 0.3f}) + , m_itemDown(sf::Keyboard::Down) + , m_itemUp(sf::Keyboard::Up) + , m_flyKey(sf::Keyboard::F) + , m_num1(sf::Keyboard::Num1) + , m_num2(sf::Keyboard::Num2) + , m_num3(sf::Keyboard::Num3) + , m_num4(sf::Keyboard::Num4) + , m_num5(sf::Keyboard::Num5) + , m_acceleration(glm::vec3(0.f)) { f.loadFromFile("Res/Fonts/rs.ttf"); - - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { m_items.emplace_back(Material::NOTHING, 0); } - for (float i = 0; i < 5; i++) - { + for (float i = 0; i < 5; i++) { sf::Text t; t.setFont(f); t.setOutlineColor(sf::Color::Black); @@ -49,86 +45,74 @@ Player::Player() m_posPrint.setPosition(20.0f, 20.0f * 6.0f + 100.0f); } -void Player::addItem(const Material& material) +void Player::addItem(const Material &material) { Material::ID id = material.id; - for (unsigned i = 0; i < m_items.size(); i++) - { - if (m_items[i].getMaterial().id == id) - { - /*int leftOver =*/ m_items[i].add(1); + for (unsigned i = 0; i < m_items.size(); i++) { + if (m_items[i].getMaterial().id == id) { + /*int leftOver =*/m_items[i].add(1); return; } - else if (m_items[i].getMaterial().id == Material::ID::Nothing) - { + else if (m_items[i].getMaterial().id == Material::ID::Nothing) { m_items[i] = {material, 1}; return; } } } -ItemStack& Player::getHeldItems() +ItemStack &Player::getHeldItems() { return m_items[m_heldItem]; } - -void Player::handleInput(const sf::Window& window, Keyboard& keyboard) +void Player::handleInput(const sf::Window &window, Keyboard &keyboard) { keyboardInput(keyboard); mouseInput(window); - if(m_itemDown.isKeyPressed()) - { + if (m_itemDown.isKeyPressed()) { m_heldItem++; - if (m_heldItem == (int)m_items.size()) - { + if (m_heldItem == (int)m_items.size()) { m_heldItem = 0; } } - else if (m_itemUp.isKeyPressed()) - { + else if (m_itemUp.isKeyPressed()) { m_heldItem--; - if (m_heldItem == -1) - { + if (m_heldItem == -1) { m_heldItem = m_items.size() - 1; } } - if (m_flyKey.isKeyPressed()) - { + if (m_flyKey.isKeyPressed()) { m_isFlying = !m_isFlying; } - if(m_num1.isKeyPressed()){ + if (m_num1.isKeyPressed()) { m_heldItem = 0; } - if(m_num2.isKeyPressed()){ + if (m_num2.isKeyPressed()) { m_heldItem = 1; } - if(m_num3.isKeyPressed()){ + if (m_num3.isKeyPressed()) { m_heldItem = 2; } - if(m_num4.isKeyPressed()){ + if (m_num4.isKeyPressed()) { m_heldItem = 3; } - if(m_num5.isKeyPressed()){ + if (m_num5.isKeyPressed()) { m_heldItem = 4; } - } -void Player::update(float dt, World& world) +void Player::update(float dt, World &world) { velocity += m_acceleration; m_acceleration = {0, 0, 0}; - if (!m_isFlying) - { - if (!m_isOnGround) - { + if (!m_isFlying) { + if (!m_isOnGround) { velocity.y -= 40 * dt; } m_isOnGround = false; @@ -138,121 +122,103 @@ void Player::update(float dt, World& world) position.y = 300; } - position.x += velocity.x * dt; - collide (world, {velocity.x, 0, 0}, dt); + collide(world, {velocity.x, 0, 0}, dt); position.y += velocity.y * dt; - collide (world, {0, velocity.y, 0}, dt); + collide(world, {0, velocity.y, 0}, dt); position.z += velocity.z * dt; - collide (world, {0, 0, velocity.z}, dt); - + collide(world, {0, 0, velocity.z}, dt); box.update(position); velocity.x *= 0.95f; velocity.z *= 0.95f; - if (m_isFlying) - { + if (m_isFlying) { velocity.y *= 0.95f; } } - -void Player::collide(World& world, const glm::vec3& vel, float dt) +void Player::collide(World &world, const glm::vec3 &vel, float dt) { - for (int x = position.x - box.dimensions.x; x < position.x + box.dimensions.x; x++) - for (int y = position.y - box.dimensions.y; y < position.y + 0.7 ; y++) - for (int z = position.z - box.dimensions.z; z < position.z + box.dimensions.z; z++) - { - auto block = world.getBlock(x, y, z); - - if (block != 0 && block.getData().isCollidable) - { - if (vel.y > 0) - { - position.y = y - box.dimensions.y; - velocity.y = 0; - } - else if (vel.y < 0) - { - m_isOnGround = true; - position.y = y + box.dimensions.y + 1; - velocity.y = 0; - } - - if (vel.x > 0) - { - position.x = x - box.dimensions.x; + for (int x = position.x - box.dimensions.x; + x < position.x + box.dimensions.x; x++) + for (int y = position.y - box.dimensions.y; y < position.y + 0.7; y++) + for (int z = position.z - box.dimensions.z; + z < position.z + box.dimensions.z; z++) { + auto block = world.getBlock(x, y, z); + + if (block != 0 && block.getData().isCollidable) { + if (vel.y > 0) { + position.y = y - box.dimensions.y; + velocity.y = 0; + } + else if (vel.y < 0) { + m_isOnGround = true; + position.y = y + box.dimensions.y + 1; + velocity.y = 0; + } + + if (vel.x > 0) { + position.x = x - box.dimensions.x; + } + else if (vel.x < 0) { + position.x = x + box.dimensions.x + 1; + } + + if (vel.z > 0) { + position.z = z - box.dimensions.z; + } + else if (vel.z < 0) { + position.z = z + box.dimensions.z + 1; + } + } } - else if (vel.x < 0) - { - position.x = x + box.dimensions.x + 1; - } - - if (vel.z > 0) - { - position.z = z - box.dimensions.z; - } - else if (vel.z < 0) - { - position.z = z + box.dimensions.z + 1; - } - } - } } ///@TODO Move this float speed = 0.2f; - -void Player::keyboardInput(Keyboard& keyboard) +void Player::keyboardInput(Keyboard &keyboard) { - if (keyboard.isKeyDown(sf::Keyboard::W)) - { + if (keyboard.isKeyDown(sf::Keyboard::W)) { float s = speed; - if (sf::Keyboard::isKeyPressed(sf::Keyboard::LControl)) s *= 5; + if (sf::Keyboard::isKeyPressed(sf::Keyboard::LControl)) + s *= 5; m_acceleration.x += -glm::cos(glm::radians(rotation.y + 90)) * s; m_acceleration.z += -glm::sin(glm::radians(rotation.y + 90)) * s; } - if (keyboard.isKeyDown(sf::Keyboard::S)) - { + if (keyboard.isKeyDown(sf::Keyboard::S)) { m_acceleration.x += glm::cos(glm::radians(rotation.y + 90)) * speed; m_acceleration.z += glm::sin(glm::radians(rotation.y + 90)) * speed; } - if (keyboard.isKeyDown(sf::Keyboard::A)) - { + if (keyboard.isKeyDown(sf::Keyboard::A)) { m_acceleration.x += -glm::cos(glm::radians(rotation.y)) * speed; m_acceleration.z += -glm::sin(glm::radians(rotation.y)) * speed; } - if (keyboard.isKeyDown(sf::Keyboard::D)) - { + if (keyboard.isKeyDown(sf::Keyboard::D)) { m_acceleration.x += glm::cos(glm::radians(rotation.y)) * speed; m_acceleration.z += glm::sin(glm::radians(rotation.y)) * speed; } - if (keyboard.isKeyDown(sf::Keyboard::Space)) - { + if (keyboard.isKeyDown(sf::Keyboard::Space)) { jump(); } - else if (keyboard.isKeyDown(sf::Keyboard::LShift) && m_isFlying) - { + else if (keyboard.isKeyDown(sf::Keyboard::LShift) && m_isFlying) { m_acceleration.y -= speed * 3; } } -void Player::mouseInput(const sf::Window& window) +void Player::mouseInput(const sf::Window &window) { static bool useMouse = true; - static ToggleKey useMouseKey (sf::Keyboard::L); + static ToggleKey useMouseKey(sf::Keyboard::L); - if (useMouseKey.isKeyPressed()) - { + if (useMouseKey.isKeyPressed()) { useMouse = !useMouse; } - if (!useMouse) - { + if (!useMouse) { return; } @@ -263,11 +229,15 @@ void Player::mouseInput(const sf::Window& window) rotation.y += change.x * 0.05f; rotation.x += change.y * 0.05f; - if (rotation.x > BOUND) rotation.x = BOUND; - else if (rotation.x < -BOUND) rotation.x = -BOUND; + if (rotation.x > BOUND) + rotation.x = BOUND; + else if (rotation.x < -BOUND) + rotation.x = -BOUND; - if (rotation.y > 360) rotation.y = 0; - else if (rotation.y < 0) rotation.y = 360; + if (rotation.y > 360) + rotation.y = 0; + else if (rotation.y < 0) + rotation.y = 360; auto cx = static_cast(window.getSize().x / 2); auto cy = static_cast(window.getSize().y / 2); @@ -277,27 +247,24 @@ void Player::mouseInput(const sf::Window& window) lastMousePosition = sf::Mouse::getPosition(); } -void Player::draw(RenderMaster& master) +void Player::draw(RenderMaster &master) { - for (unsigned i = 0; i < m_items.size(); i++) - { - sf::Text& t = m_itemText[i]; - if (i == (unsigned)m_heldItem) - { + for (unsigned i = 0; i < m_items.size(); i++) { + sf::Text &t = m_itemText[i]; + if (i == (unsigned)m_heldItem) { t.setFillColor(sf::Color::Red); } - else - { + else { t.setFillColor(sf::Color::White); } - t.setString((m_items[i].getMaterial().name) + " " + std::to_string(m_items[i].getNumInStack()) + " "); + t.setString((m_items[i].getMaterial().name) + " " + + std::to_string(m_items[i].getNumInStack()) + " "); master.drawSFML(t); } std::ostringstream stream; - stream << " X: " << position.x - << " Y: " << position.y - << " Z: " << position.z - << " Grounded " << std::boolalpha << m_isOnGround; + stream << " X: " << position.x << " Y: " << position.y + << " Z: " << position.z << " Grounded " << std::boolalpha + << m_isOnGround; m_posPrint.setString(stream.str()); @@ -306,22 +273,13 @@ void Player::draw(RenderMaster& master) void Player::jump() { - if (!m_isFlying) - { - if (m_isOnGround) - { + if (!m_isFlying) { + if (m_isOnGround) { m_isOnGround = false; m_acceleration.y += speed * 50; } } - else - { + else { m_acceleration.y += speed * 3; } } - - - - - - diff --git a/Source/Player/Player.h b/Source/Player/Player.h index 40ae191a..90e799d7 100644 --- a/Source/Player/Player.h +++ b/Source/Player/Player.h @@ -5,55 +5,52 @@ #include #include "../Entity.h" -#include "../Item/ItemStack.h" #include "../Input/ToggleKey.h" +#include "../Item/ItemStack.h" class Keyboard; class World; class RenderMaster; -class Player : public Entity -{ - public: - Player(); +class Player : public Entity { + public: + Player(); - void handleInput(const sf::Window& window, Keyboard& keyboard); + void handleInput(const sf::Window &window, Keyboard &keyboard); - void update(float dt, World& wolrd); - void collide(World& world, const glm::vec3& vel, float dt); + void update(float dt, World &wolrd); + void collide(World &world, const glm::vec3 &vel, float dt); - void addItem(const Material& material); + void addItem(const Material &material); - void draw(RenderMaster& master); + void draw(RenderMaster &master); - ItemStack& getHeldItems(); + ItemStack &getHeldItems(); - private: - void jump(); + private: + void jump(); - void keyboardInput(Keyboard& keyboard); - void mouseInput(const sf::Window& window); - bool m_isOnGround = false; - bool m_isFlying = false; + void keyboardInput(Keyboard &keyboard); + void mouseInput(const sf::Window &window); + bool m_isOnGround = false; + bool m_isFlying = false; - std::vector m_items; - std::vector m_itemText; - sf::Text m_posPrint; - int m_heldItem = 0; + std::vector m_items; + std::vector m_itemText; + sf::Text m_posPrint; + int m_heldItem = 0; - ToggleKey m_itemDown; - ToggleKey m_itemUp; - ToggleKey m_flyKey; + ToggleKey m_itemDown; + ToggleKey m_itemUp; + ToggleKey m_flyKey; - ToggleKey m_num1; - ToggleKey m_num2; - ToggleKey m_num3; - ToggleKey m_num4; - ToggleKey m_num5; + ToggleKey m_num1; + ToggleKey m_num2; + ToggleKey m_num3; + ToggleKey m_num4; + ToggleKey m_num5; - glm::vec3 m_acceleration; + glm::vec3 m_acceleration; }; - - #endif // PLAYER_H_INCLUDED diff --git a/Source/Renderer/ChunkRenderer.cpp b/Source/Renderer/ChunkRenderer.cpp index 9645400b..1977cbc8 100644 --- a/Source/Renderer/ChunkRenderer.cpp +++ b/Source/Renderer/ChunkRenderer.cpp @@ -1,21 +1,20 @@ #include "ChunkRenderer.h" -#include "../World/Chunk/ChunkMesh.h" #include "../World/Block/BlockDatabase.h" +#include "../World/Chunk/ChunkMesh.h" #include "../Camera.h" #include -void ChunkRenderer::add(const ChunkMesh& mesh) +void ChunkRenderer::add(const ChunkMesh &mesh) { m_chunks.push_back(&mesh.getModel().getRenderInfo()); } -void ChunkRenderer::render(const Camera& camera) +void ChunkRenderer::render(const Camera &camera) { - if (m_chunks.empty()) - { + if (m_chunks.empty()) { return; } @@ -27,8 +26,7 @@ void ChunkRenderer::render(const Camera& camera) m_shader.loadProjectionViewMatrix(camera.getProjectionViewMatrix()); - for (auto mesh : m_chunks) - { + for (auto mesh : m_chunks) { GL::bindVAO(mesh->vao); GL::drawElements(mesh->indicesCount); } diff --git a/Source/Renderer/ChunkRenderer.h b/Source/Renderer/ChunkRenderer.h index faf8c563..00283c79 100644 --- a/Source/Renderer/ChunkRenderer.h +++ b/Source/Renderer/ChunkRenderer.h @@ -5,22 +5,19 @@ #include "../Shaders/ChunkShader.h" - struct RenderInfo; class ChunkMesh; class Camera; -class ChunkRenderer -{ - public: - void add(const ChunkMesh& mesh); - void render(const Camera& camera); - - private: - std::vector m_chunks; +class ChunkRenderer { + public: + void add(const ChunkMesh &mesh); + void render(const Camera &camera); - ChunkShader m_shader; + private: + std::vector m_chunks; + ChunkShader m_shader; }; #endif // CHUNKRENDERER_H_INCLUDED diff --git a/Source/Renderer/FloraRenderer.cpp b/Source/Renderer/FloraRenderer.cpp index f83428cf..f0a15202 100644 --- a/Source/Renderer/FloraRenderer.cpp +++ b/Source/Renderer/FloraRenderer.cpp @@ -1,21 +1,20 @@ #include "FloraRenderer.h" -#include "../World/Chunk/ChunkMesh.h" -#include "../World/Block/BlockDatabase.h" #include "../Application.h" #include "../Camera.h" +#include "../World/Block/BlockDatabase.h" +#include "../World/Chunk/ChunkMesh.h" #include -void FloraRenderer::add(const ChunkMesh& mesh) +void FloraRenderer::add(const ChunkMesh &mesh) { m_chunks.push_back(&mesh.getModel().getRenderInfo()); } -void FloraRenderer::render(const Camera& camera) +void FloraRenderer::render(const Camera &camera) { - if (m_chunks.empty()) - { + if (m_chunks.empty()) { return; } @@ -26,8 +25,7 @@ void FloraRenderer::render(const Camera& camera) m_shader.loadProjectionViewMatrix(camera.getProjectionViewMatrix()); m_shader.loadTime(g_timeElapsed); - for (auto mesh : m_chunks) - { + for (auto mesh : m_chunks) { GL::bindVAO(mesh->vao); GL::drawElements(mesh->indicesCount); } diff --git a/Source/Renderer/FloraRenderer.h b/Source/Renderer/FloraRenderer.h index 96e5cb97..16565644 100644 --- a/Source/Renderer/FloraRenderer.h +++ b/Source/Renderer/FloraRenderer.h @@ -1,8 +1,8 @@ #ifndef FLORARENDERER_H_INCLUDED #define FLORARENDERER_H_INCLUDED -#include #include +#include #include "../Shaders/FloraShader.h" @@ -10,17 +10,15 @@ struct RenderInfo; class ChunkMesh; class Camera; -class FloraRenderer -{ - public: - void add(const ChunkMesh& mesh); - void render(const Camera& camera); +class FloraRenderer { + public: + void add(const ChunkMesh &mesh); + void render(const Camera &camera); - private: - std::vector m_chunks; + private: + std::vector m_chunks; - FloraShader m_shader; + FloraShader m_shader; }; - #endif // FLORARENDERER_H_INCLUDED diff --git a/Source/Renderer/RenderInfo.h b/Source/Renderer/RenderInfo.h index 89f368a7..7d9e74af 100644 --- a/Source/Renderer/RenderInfo.h +++ b/Source/Renderer/RenderInfo.h @@ -1,8 +1,7 @@ #ifndef RENDERINFO_H_INCLUDED #define RENDERINFO_H_INCLUDED -struct RenderInfo -{ +struct RenderInfo { GLuint vao = 0; GLuint indicesCount = 0; diff --git a/Source/Renderer/RenderMaster.cpp b/Source/Renderer/RenderMaster.cpp index 17373aab..58822a3b 100644 --- a/Source/Renderer/RenderMaster.cpp +++ b/Source/Renderer/RenderMaster.cpp @@ -3,21 +3,21 @@ #include #include -#include "../World/Chunk/ChunkMesh.h" -#include "../World/Chunk/ChunkSection.h" #include "../Application.h" #include "../Context.h" +#include "../World/Chunk/ChunkMesh.h" +#include "../World/Chunk/ChunkSection.h" -void RenderMaster::drawSFML(const sf::Drawable& drawable) +void RenderMaster::drawSFML(const sf::Drawable &drawable) { - //m_sfmlRenderer.add(drawable); + // m_sfmlRenderer.add(drawable); } -void RenderMaster::drawChunk(const ChunkSection& chunk) +void RenderMaster::drawChunk(const ChunkSection &chunk) { - const auto& solidMesh = chunk.getMeshes().solidMesh; - const auto& waterMesh = chunk.getMeshes().waterMesh; - const auto& floraMesh = chunk.getMeshes().floraMesh; + const auto &solidMesh = chunk.getMeshes().solidMesh; + const auto &waterMesh = chunk.getMeshes().waterMesh; + const auto &floraMesh = chunk.getMeshes().floraMesh; if (solidMesh.faces > 0) m_chunkRenderer.add(solidMesh); @@ -34,7 +34,7 @@ void RenderMaster::drawSky() m_drawBox = true; } -void RenderMaster::finishRender(sf::Window& window, const Camera& camera) +void RenderMaster::finishRender(sf::Window &window, const Camera &camera) { glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); @@ -42,19 +42,17 @@ void RenderMaster::finishRender(sf::Window& window, const Camera& camera) glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); - m_chunkRenderer.render (camera); - m_waterRenderer.render (camera); - m_floraRenderer.render (camera); + m_chunkRenderer.render(camera); + m_waterRenderer.render(camera); + m_floraRenderer.render(camera); - if (m_drawBox) - { + if (m_drawBox) { glDisable(GL_CULL_FACE); - m_skyboxRenderer.render (camera); + m_skyboxRenderer.render(camera); m_drawBox = false; } - //m_sfmlRenderer .render (window); + // m_sfmlRenderer .render (window); window.display(); } - diff --git a/Source/Renderer/RenderMaster.h b/Source/Renderer/RenderMaster.h index c96eacbc..b7afe88b 100644 --- a/Source/Renderer/RenderMaster.h +++ b/Source/Renderer/RenderMaster.h @@ -3,38 +3,35 @@ #include +#include "../Config.h" #include "ChunkRenderer.h" -#include "SkyboxRenderer.h" +#include "FloraRenderer.h" #include "SFMLRenderer.h" +#include "SkyboxRenderer.h" #include "WaterRenderer.h" -#include "FloraRenderer.h" -#include "../Config.h" class Camera; class ChunkSection; -class RenderMaster -{ - public: - void drawSFML(const sf::Drawable& drawable); - void drawChunk(const ChunkSection& chunk); - void drawSky(); +class RenderMaster { + public: + void drawSFML(const sf::Drawable &drawable); + void drawChunk(const ChunkSection &chunk); + void drawSky(); - void finishRender(sf::Window& window, const Camera& camera); + void finishRender(sf::Window &window, const Camera &camera); - private: - //Chunks - ChunkRenderer m_chunkRenderer; - WaterRenderer m_waterRenderer; - FloraRenderer m_floraRenderer; + private: + // Chunks + ChunkRenderer m_chunkRenderer; + WaterRenderer m_waterRenderer; + FloraRenderer m_floraRenderer; - //Detail - SkyboxRenderer m_skyboxRenderer; - //SFMLRenderer m_sfmlRenderer; + // Detail + SkyboxRenderer m_skyboxRenderer; + // SFMLRenderer m_sfmlRenderer; - bool m_drawBox = false; + bool m_drawBox = false; }; - - #endif // RENDERMASTER_H_INCLUDED diff --git a/Source/Renderer/SFMLRenderer.cpp b/Source/Renderer/SFMLRenderer.cpp index a3a8ecb2..0d1fbc18 100644 --- a/Source/Renderer/SFMLRenderer.cpp +++ b/Source/Renderer/SFMLRenderer.cpp @@ -2,13 +2,12 @@ #include "../glad/glad.h" - -void SFMLRenderer::add(const sf::Drawable& drawable) +void SFMLRenderer::add(const sf::Drawable &drawable) { m_draws.push_back(&drawable); } -void SFMLRenderer::render(sf::Window& window) +void SFMLRenderer::render(sf::Window &window) { /* if (m_draws.empty()) diff --git a/Source/Renderer/SFMLRenderer.h b/Source/Renderer/SFMLRenderer.h index f2f74ca5..6bda8e03 100644 --- a/Source/Renderer/SFMLRenderer.h +++ b/Source/Renderer/SFMLRenderer.h @@ -4,15 +4,14 @@ #include #include -class SFMLRenderer -{ - public: - void add(const sf::Drawable& drawable); +class SFMLRenderer { + public: + void add(const sf::Drawable &drawable); - void render(sf::Window& window); + void render(sf::Window &window); - private: - std::vector m_draws; + private: + std::vector m_draws; }; #endif // SFMLRENDERER_H_INCLUDED diff --git a/Source/Renderer/SkyboxRenderer.cpp b/Source/Renderer/SkyboxRenderer.cpp index cf40829c..38d70fd0 100644 --- a/Source/Renderer/SkyboxRenderer.cpp +++ b/Source/Renderer/SkyboxRenderer.cpp @@ -7,72 +7,109 @@ SkyboxRenderer::SkyboxRenderer() { constexpr GLfloat SIZE = 500; - std::vector vertexCoords - { - //Back - SIZE, -SIZE, -SIZE, - -SIZE, -SIZE, -SIZE, - -SIZE, SIZE, -SIZE, - SIZE, SIZE, -SIZE, - - //Front - -SIZE, -SIZE, SIZE, - SIZE, -SIZE, SIZE, - SIZE, SIZE, SIZE, - -SIZE, SIZE, SIZE, - - //Right - SIZE, -SIZE, SIZE, - SIZE, -SIZE, -SIZE, - SIZE, SIZE, -SIZE, - SIZE, SIZE, SIZE, - - //Left - -SIZE, -SIZE, -SIZE, - -SIZE, -SIZE, SIZE, - -SIZE, SIZE, SIZE, - -SIZE, SIZE, -SIZE, - - //Top - -SIZE, SIZE, SIZE, - SIZE, SIZE, SIZE, - SIZE, SIZE, -SIZE, - -SIZE, SIZE, -SIZE, - - //Bottom - -SIZE, -SIZE, -SIZE, - SIZE, -SIZE, -SIZE, - SIZE, -SIZE, SIZE, - -SIZE, -SIZE, SIZE, + std::vector vertexCoords{ + // Back + SIZE, + -SIZE, + -SIZE, + -SIZE, + -SIZE, + -SIZE, + -SIZE, + SIZE, + -SIZE, + SIZE, + SIZE, + -SIZE, + + // Front + -SIZE, + -SIZE, + SIZE, + SIZE, + -SIZE, + SIZE, + SIZE, + SIZE, + SIZE, + -SIZE, + SIZE, + SIZE, + + // Right + SIZE, + -SIZE, + SIZE, + SIZE, + -SIZE, + -SIZE, + SIZE, + SIZE, + -SIZE, + SIZE, + SIZE, + SIZE, + + // Left + -SIZE, + -SIZE, + -SIZE, + -SIZE, + -SIZE, + SIZE, + -SIZE, + SIZE, + SIZE, + -SIZE, + SIZE, + -SIZE, + + // Top + -SIZE, + SIZE, + SIZE, + SIZE, + SIZE, + SIZE, + SIZE, + SIZE, + -SIZE, + -SIZE, + SIZE, + -SIZE, + + // Bottom + -SIZE, + -SIZE, + -SIZE, + SIZE, + -SIZE, + -SIZE, + SIZE, + -SIZE, + SIZE, + -SIZE, + -SIZE, + SIZE, }; - std::vector indices - { - 0, 1, 2, - 2, 3, 0, + std::vector indices{0, 1, 2, 2, 3, 0, - 4, 5, 6, - 6, 7, 4, + 4, 5, 6, 6, 7, 4, - 8, 9, 10, - 10, 11, 8, + 8, 9, 10, 10, 11, 8, - 12, 13, 14, - 14, 15, 12, + 12, 13, 14, 14, 15, 12, - 16, 17, 18, - 18, 19, 16, + 16, 17, 18, 18, 19, 16, - 20, 21, 22, - 22, 23, 20 - }; + 20, 21, 22, 22, 23, 20}; m_skyCube.genVAO(); m_skyCube.addVBO(3, vertexCoords); m_skyCube.addEBO(indices); - m_cubeTexture.loadFromFiles( - { + m_cubeTexture.loadFromFiles({ "dm", "dm", "dt", @@ -82,15 +119,14 @@ SkyboxRenderer::SkyboxRenderer() }); } - -void SkyboxRenderer::render(const Camera& camera) +void SkyboxRenderer::render(const Camera &camera) { m_shader.useProgram(); m_skyCube.bindVAO(); m_cubeTexture.bindTexture(); - m_shader.loadViewMatrix (camera.getViewMatrix()); - m_shader.loadProjectionMatrix (camera.getProjMatrix()); + m_shader.loadViewMatrix(camera.getViewMatrix()); + m_shader.loadProjectionMatrix(camera.getProjMatrix()); GL::drawElements(m_skyCube.getIndicesCount()); } diff --git a/Source/Renderer/SkyboxRenderer.h b/Source/Renderer/SkyboxRenderer.h index 236fa71e..bef781c8 100644 --- a/Source/Renderer/SkyboxRenderer.h +++ b/Source/Renderer/SkyboxRenderer.h @@ -1,23 +1,22 @@ #ifndef SKYBOXRENDERER_H_INCLUDED #define SKYBOXRENDERER_H_INCLUDED +#include "../Model.h" #include "../Shaders/SkyboxShader.h" #include "../Texture/CubeTexture.h" -#include "../Model.h" class Camera; -class SkyboxRenderer -{ - public: - SkyboxRenderer(); +class SkyboxRenderer { + public: + SkyboxRenderer(); - void render(const Camera& camera); + void render(const Camera &camera); - private: - Model m_skyCube; - SkyboxShader m_shader; - CubeTexture m_cubeTexture; + private: + Model m_skyCube; + SkyboxShader m_shader; + CubeTexture m_cubeTexture; }; #endif // SKYBOXRENDERER_H_INCLUDED diff --git a/Source/Renderer/WaterRenderer.cpp b/Source/Renderer/WaterRenderer.cpp index b5b429d0..5d9c9ecd 100644 --- a/Source/Renderer/WaterRenderer.cpp +++ b/Source/Renderer/WaterRenderer.cpp @@ -1,21 +1,20 @@ #include "WaterRenderer.h" -#include "../World/Chunk/ChunkMesh.h" -#include "../World/Block/BlockDatabase.h" #include "../Application.h" #include "../Camera.h" +#include "../World/Block/BlockDatabase.h" +#include "../World/Chunk/ChunkMesh.h" #include -void WaterRenderer::add(const ChunkMesh& mesh) +void WaterRenderer::add(const ChunkMesh &mesh) { m_chunks.push_back(&mesh.getModel().getRenderInfo()); } -void WaterRenderer::render(const Camera& camera) +void WaterRenderer::render(const Camera &camera) { - if (m_chunks.empty()) - { + if (m_chunks.empty()) { return; } @@ -26,8 +25,7 @@ void WaterRenderer::render(const Camera& camera) m_shader.loadProjectionViewMatrix(camera.getProjectionViewMatrix()); m_shader.loadTime(g_timeElapsed); - for (auto mesh : m_chunks) - { + for (auto mesh : m_chunks) { GL::bindVAO(mesh->vao); GL::drawElements(mesh->indicesCount); } diff --git a/Source/Renderer/WaterRenderer.h b/Source/Renderer/WaterRenderer.h index 9ab0575f..c0c372ac 100644 --- a/Source/Renderer/WaterRenderer.h +++ b/Source/Renderer/WaterRenderer.h @@ -1,8 +1,8 @@ #ifndef WATERRENDERER_H_INCLUDED #define WATERRENDERER_H_INCLUDED -#include #include +#include #include "../Shaders/WaterShader.h" @@ -10,16 +10,15 @@ struct RenderInfo; class ChunkMesh; class Camera; -class WaterRenderer -{ - public: - void add(const ChunkMesh& mesh); - void render(const Camera& camera); +class WaterRenderer { + public: + void add(const ChunkMesh &mesh); + void render(const Camera &camera); - private: - std::vector m_chunks; + private: + std::vector m_chunks; - WaterShader m_shader; + WaterShader m_shader; }; #endif // WATERRENDERER_H_INCLUDED diff --git a/Source/Shaders/BasicShader.cpp b/Source/Shaders/BasicShader.cpp index 2bf9d15e..9b8aa2b7 100644 --- a/Source/Shaders/BasicShader.cpp +++ b/Source/Shaders/BasicShader.cpp @@ -1,18 +1,18 @@ #include "BasicShader.h" -BasicShader::BasicShader(const std::string& vertexFile, const std::string& fragmentFile) -: Shader(vertexFile, fragmentFile) +BasicShader::BasicShader(const std::string &vertexFile, + const std::string &fragmentFile) + : Shader(vertexFile, fragmentFile) { getUniforms(); } -void BasicShader::loadProjectionViewMatrix(const glm::mat4& pvMatrix) +void BasicShader::loadProjectionViewMatrix(const glm::mat4 &pvMatrix) { - loadMatrix4(m_locationProjectionViewMatrix, - pvMatrix); + loadMatrix4(m_locationProjectionViewMatrix, pvMatrix); } -void BasicShader::loadModelMatrix(const glm::mat4& matrix) +void BasicShader::loadModelMatrix(const glm::mat4 &matrix) { loadMatrix4(m_locationModelMatrix, matrix); } @@ -20,6 +20,7 @@ void BasicShader::loadModelMatrix(const glm::mat4& matrix) void BasicShader::getUniforms() { useProgram(); - m_locationProjectionViewMatrix = glGetUniformLocation(m_id, "projViewMatrix"); - m_locationModelMatrix = glGetUniformLocation(m_id, "modelMatrix"); + m_locationProjectionViewMatrix = + glGetUniformLocation(m_id, "projViewMatrix"); + m_locationModelMatrix = glGetUniformLocation(m_id, "modelMatrix"); } diff --git a/Source/Shaders/BasicShader.h b/Source/Shaders/BasicShader.h index 4cbb0470..7ad89b37 100644 --- a/Source/Shaders/BasicShader.h +++ b/Source/Shaders/BasicShader.h @@ -3,21 +3,20 @@ #include "Shader.h" -class BasicShader : public Shader -{ - public: - BasicShader(const std::string& vertexFile = "Basic", - const std::string& fragmentFile = "Basic"); +class BasicShader : public Shader { + public: + BasicShader(const std::string &vertexFile = "Basic", + const std::string &fragmentFile = "Basic"); - void loadProjectionViewMatrix (const glm::mat4& pvMatrix); - void loadModelMatrix (const glm::mat4& matrix); + void loadProjectionViewMatrix(const glm::mat4 &pvMatrix); + void loadModelMatrix(const glm::mat4 &matrix); - protected: - virtual void getUniforms() override; + protected: + virtual void getUniforms() override; - private: - GLuint m_locationProjectionViewMatrix; - GLuint m_locationModelMatrix; + private: + GLuint m_locationProjectionViewMatrix; + GLuint m_locationModelMatrix; }; #endif // BASICSHADER_H_INCLUDED diff --git a/Source/Shaders/ChunkShader.cpp b/Source/Shaders/ChunkShader.cpp index d222f0ec..d1b466d3 100644 --- a/Source/Shaders/ChunkShader.cpp +++ b/Source/Shaders/ChunkShader.cpp @@ -1,7 +1,7 @@ #include "ChunkShader.h" ChunkShader::ChunkShader() -: BasicShader ("Chunk", "Chunk") + : BasicShader("Chunk", "Chunk") { getUniforms(); } diff --git a/Source/Shaders/ChunkShader.h b/Source/Shaders/ChunkShader.h index 5a9caf6f..16787263 100644 --- a/Source/Shaders/ChunkShader.h +++ b/Source/Shaders/ChunkShader.h @@ -3,12 +3,12 @@ #include "BasicShader.h" -class ChunkShader : public BasicShader -{ - public: - ChunkShader(); - private: - void getUniforms() override; +class ChunkShader : public BasicShader { + public: + ChunkShader(); + + private: + void getUniforms() override; }; #endif // CHUNKSHADER_H_INCLUDED diff --git a/Source/Shaders/FloraShader.cpp b/Source/Shaders/FloraShader.cpp index ca06f378..e7252f20 100644 --- a/Source/Shaders/FloraShader.cpp +++ b/Source/Shaders/FloraShader.cpp @@ -1,13 +1,13 @@ #include "FloraShader.h" FloraShader::FloraShader() -: BasicShader ("Flora", "Chunk") + : BasicShader("Flora", "Chunk") { getUniforms(); } - -void FloraShader::loadTime (const float& time){ +void FloraShader::loadTime(const float &time) +{ loadFloat(m_time, time); } @@ -16,4 +16,3 @@ void FloraShader::getUniforms() BasicShader::getUniforms(); m_time = glGetUniformLocation(m_id, "globalTime"); } - diff --git a/Source/Shaders/FloraShader.h b/Source/Shaders/FloraShader.h index 7222ffde..a6ca81a7 100644 --- a/Source/Shaders/FloraShader.h +++ b/Source/Shaders/FloraShader.h @@ -3,15 +3,14 @@ #include "BasicShader.h" -class FloraShader : public BasicShader -{ - public: - FloraShader(); - void loadTime (const float& time); - private: - void getUniforms() override; - GLuint m_time; -}; +class FloraShader : public BasicShader { + public: + FloraShader(); + void loadTime(const float &time); + private: + void getUniforms() override; + GLuint m_time; +}; #endif // FLORASHADER_H_INCLUDED diff --git a/Source/Shaders/Shader.cpp b/Source/Shaders/Shader.cpp index c7f937ed..1fef70c5 100644 --- a/Source/Shaders/Shader.cpp +++ b/Source/Shaders/Shader.cpp @@ -2,13 +2,12 @@ #include "ShaderLoader.h" -Shader::Shader(const std::string& vertexFile, const std::string& fragmentFile) -: m_id (loadShaders(vertexFile, fragmentFile)) +Shader::Shader(const std::string &vertexFile, const std::string &fragmentFile) + : m_id(loadShaders(vertexFile, fragmentFile)) { useProgram(); } - void Shader::loadInt(GLuint location, int value) { glUniform1i(location, value); @@ -19,22 +18,22 @@ void Shader::loadFloat(GLuint location, float value) glUniform1f(location, value); } -void Shader::loadVector2(GLuint location, const glm::vec2& vect) +void Shader::loadVector2(GLuint location, const glm::vec2 &vect) { glUniform2f(location, vect.x, vect.y); } -void Shader::loadVector3(GLuint location, const glm::vec3& vect) +void Shader::loadVector3(GLuint location, const glm::vec3 &vect) { glUniform3f(location, vect.x, vect.y, vect.z); } -void Shader::loadVector4(GLuint location, const glm::vec4& vect) +void Shader::loadVector4(GLuint location, const glm::vec4 &vect) { glUniform4f(location, vect.x, vect.y, vect.z, vect.w); } -void Shader::loadMatrix4(GLuint location, const glm::mat4& matrix) +void Shader::loadMatrix4(GLuint location, const glm::mat4 &matrix) { glUniformMatrix4fv(location, 1, GL_FALSE, glm::value_ptr(matrix)); } diff --git a/Source/Shaders/Shader.h b/Source/Shaders/Shader.h index ee3f6542..d4900e81 100644 --- a/Source/Shaders/Shader.h +++ b/Source/Shaders/Shader.h @@ -7,26 +7,25 @@ #include "../Maths/glm.h" #include "../Util/NonCopyable.h" -class Shader : NonCopyable -{ - public: - Shader(const std::string& vertexFile, const std::string& fragmentFile); - virtual ~Shader(); +class Shader : NonCopyable { + public: + Shader(const std::string &vertexFile, const std::string &fragmentFile); + virtual ~Shader(); - void useProgram() const; + void useProgram() const; - void loadInt(GLuint location, int value); - void loadFloat(GLuint location, float value); + void loadInt(GLuint location, int value); + void loadFloat(GLuint location, float value); - void loadVector2(GLuint location, const glm::vec2& vect); - void loadVector3(GLuint location, const glm::vec3& vect); - void loadVector4(GLuint location, const glm::vec4& vect); + void loadVector2(GLuint location, const glm::vec2 &vect); + void loadVector3(GLuint location, const glm::vec3 &vect); + void loadVector4(GLuint location, const glm::vec4 &vect); - void loadMatrix4(GLuint location, const glm::mat4& matrix); + void loadMatrix4(GLuint location, const glm::mat4 &matrix); - protected: - virtual void getUniforms() = 0; - GLuint m_id; + protected: + virtual void getUniforms() = 0; + GLuint m_id; }; #endif // SHADER_H_INCLUDED diff --git a/Source/Shaders/ShaderLoader.cpp b/Source/Shaders/ShaderLoader.cpp index 97d6a411..5b6b7df2 100644 --- a/Source/Shaders/ShaderLoader.cpp +++ b/Source/Shaders/ShaderLoader.cpp @@ -5,49 +5,50 @@ #include "../glad/glad.h" #include -namespace +namespace { +GLuint compileShader(const GLchar *source, GLenum shaderType) { - GLuint compileShader(const GLchar* source, GLenum shaderType) - { - auto shaderID = glCreateShader(shaderType); + auto shaderID = glCreateShader(shaderType); - glShaderSource(shaderID, 1, &source, nullptr); - glCompileShader(shaderID); + glShaderSource(shaderID, 1, &source, nullptr); + glCompileShader(shaderID); - GLint isSuccess = 0; - GLchar infoLog[512]; + GLint isSuccess = 0; + GLchar infoLog[512]; - glGetShaderiv(shaderID, GL_COMPILE_STATUS, &isSuccess); - if(!isSuccess) - { - glGetShaderInfoLog(shaderID, 512, nullptr, infoLog); - throw std::runtime_error ("Unable to load a shader: " + std::string(infoLog)); - } - - return shaderID; + glGetShaderiv(shaderID, GL_COMPILE_STATUS, &isSuccess); + if (!isSuccess) { + glGetShaderInfoLog(shaderID, 512, nullptr, infoLog); + throw std::runtime_error("Unable to load a shader: " + + std::string(infoLog)); } - GLuint linkProgram(GLuint vertexShaderID, GLuint fragmentShaderID) - { - auto id = glCreateProgram(); + return shaderID; +} + +GLuint linkProgram(GLuint vertexShaderID, GLuint fragmentShaderID) +{ + auto id = glCreateProgram(); - glAttachShader(id, vertexShaderID); - glAttachShader(id, fragmentShaderID); + glAttachShader(id, vertexShaderID); + glAttachShader(id, fragmentShaderID); - glLinkProgram(id); + glLinkProgram(id); - return id; - } + return id; } +} // namespace -GLuint loadShaders(const std::string& vertexShader, - const std::string& fragmentShader) +GLuint loadShaders(const std::string &vertexShader, + const std::string &fragmentShader) { - auto vertexSource = getFileContents("Shaders/" + vertexShader + ".vert"); - auto fragmentSource = getFileContents("Shaders/" + fragmentShader + ".frag"); + auto vertexSource = getFileContents("Shaders/" + vertexShader + ".vert"); + auto fragmentSource = + getFileContents("Shaders/" + fragmentShader + ".frag"); - auto vertexShaderID = compileShader(vertexSource.c_str(), GL_VERTEX_SHADER); - auto fragmentShaderID = compileShader(fragmentSource.c_str(), GL_FRAGMENT_SHADER); + auto vertexShaderID = compileShader(vertexSource.c_str(), GL_VERTEX_SHADER); + auto fragmentShaderID = + compileShader(fragmentSource.c_str(), GL_FRAGMENT_SHADER); auto shaderID = linkProgram(vertexShaderID, fragmentShaderID); diff --git a/Source/Shaders/ShaderLoader.h b/Source/Shaders/ShaderLoader.h index 9c0e60cd..eb8dfd42 100644 --- a/Source/Shaders/ShaderLoader.h +++ b/Source/Shaders/ShaderLoader.h @@ -1,10 +1,10 @@ #ifndef SHADERLOADER_H_INCLUDED #define SHADERLOADER_H_INCLUDED -#include #include "../glad/glad.h" +#include -GLuint loadShaders( const std::string& vertexShader, - const std::string& fragmentShader); +GLuint loadShaders(const std::string &vertexShader, + const std::string &fragmentShader); #endif // SHADERLOADER_H_INCLUDED diff --git a/Source/Shaders/SkyboxShader.cpp b/Source/Shaders/SkyboxShader.cpp index 49e22467..8e7f46e0 100644 --- a/Source/Shaders/SkyboxShader.cpp +++ b/Source/Shaders/SkyboxShader.cpp @@ -1,7 +1,7 @@ #include "SkyboxShader.h" SkyboxShader::SkyboxShader() -: Shader ("Skybox", "Skybox") + : Shader("Skybox", "Skybox") { getUniforms(); } @@ -14,15 +14,13 @@ void SkyboxShader::loadViewMatrix(glm::mat4 viewMatrix) Shader::loadMatrix4(m_locationView, viewMatrix); } - -void SkyboxShader::loadProjectionMatrix(const glm::mat4& proj) +void SkyboxShader::loadProjectionMatrix(const glm::mat4 &proj) { Shader::loadMatrix4(m_locationProjection, proj); } - void SkyboxShader::getUniforms() { - m_locationProjection = glGetUniformLocation(m_id, "projectionMatrix"); - m_locationView = glGetUniformLocation(m_id, "viewMatrix"); + m_locationProjection = glGetUniformLocation(m_id, "projectionMatrix"); + m_locationView = glGetUniformLocation(m_id, "viewMatrix"); } diff --git a/Source/Shaders/SkyboxShader.h b/Source/Shaders/SkyboxShader.h index e9faba77..489338d0 100644 --- a/Source/Shaders/SkyboxShader.h +++ b/Source/Shaders/SkyboxShader.h @@ -3,19 +3,18 @@ #include "Shader.h" -class SkyboxShader : public Shader -{ - public: - SkyboxShader(); +class SkyboxShader : public Shader { + public: + SkyboxShader(); - void loadViewMatrix (glm::mat4 viewMatrix); - void loadProjectionMatrix (const glm::mat4& proj); + void loadViewMatrix(glm::mat4 viewMatrix); + void loadProjectionMatrix(const glm::mat4 &proj); - private: - void getUniforms() override; + private: + void getUniforms() override; - GLuint m_locationProjection; - GLuint m_locationView; + GLuint m_locationProjection; + GLuint m_locationView; }; #endif // SKYBOXSHADER_H_INCLUDED diff --git a/Source/Shaders/WaterShader.cpp b/Source/Shaders/WaterShader.cpp index 880456bc..c6047bdd 100644 --- a/Source/Shaders/WaterShader.cpp +++ b/Source/Shaders/WaterShader.cpp @@ -1,13 +1,13 @@ #include "WaterShader.h" WaterShader::WaterShader() -: BasicShader ("Water", "Chunk") + : BasicShader("Water", "Chunk") { getUniforms(); } - -void WaterShader::loadTime (const float& time){ +void WaterShader::loadTime(const float &time) +{ loadFloat(m_time, time); } @@ -16,4 +16,3 @@ void WaterShader::getUniforms() BasicShader::getUniforms(); m_time = glGetUniformLocation(m_id, "globalTime"); } - diff --git a/Source/Shaders/WaterShader.h b/Source/Shaders/WaterShader.h index 6b264fc4..cc992cd3 100644 --- a/Source/Shaders/WaterShader.h +++ b/Source/Shaders/WaterShader.h @@ -3,14 +3,14 @@ #include "BasicShader.h" -class WaterShader : public BasicShader -{ - public: - WaterShader(); - void loadTime (const float& time); - private: - void getUniforms() override; - GLuint m_time; +class WaterShader : public BasicShader { + public: + WaterShader(); + void loadTime(const float &time); + + private: + void getUniforms() override; + GLuint m_time; }; #endif // WATERSHADER_H_INCLUDED diff --git a/Source/States/PlayingState.cpp b/Source/States/PlayingState.cpp index c3c384da..76e8206f 100644 --- a/Source/States/PlayingState.cpp +++ b/Source/States/PlayingState.cpp @@ -1,6 +1,5 @@ #include "PlayingState.h" - #include "../Application.h" #include "../Maths/Ray.h" #include "../Renderer/RenderMaster.h" @@ -8,17 +7,16 @@ #include - -StatePlaying::StatePlaying(Application& app, const Config& config) -: StateBase (app) -, m_world (app.getCamera(), config, m_player) +StatePlaying::StatePlaying(Application &app, const Config &config) + : StateBase(app) + , m_world(app.getCamera(), config, m_player) { app.getCamera().hookEntity(m_player); } void StatePlaying::handleEvent(sf::Event e) -{ - m_keyboard.update(e); +{ + m_keyboard.update(e); } void StatePlaying::handleInput() @@ -28,70 +26,65 @@ void StatePlaying::handleInput() static sf::Clock timer; glm::vec3 lastPosition; - for (Ray ray({m_player.position.x, m_player.position.y + 0.6f, m_player.position.z}, m_player.rotation); //Corrected for camera offset - ray.getLength() < 6; - ray.step(0.05f)) - { + for (Ray ray({m_player.position.x, m_player.position.y + 0.6f, + m_player.position.z}, + m_player.rotation); // Corrected for camera offset + ray.getLength() < 6; ray.step(0.05f)) { int x = static_cast(ray.getEnd().x); int y = static_cast(ray.getEnd().y); int z = static_cast(ray.getEnd().z); - auto block = m_world.getBlock(x, y, z); - auto id = (BlockId)block.id; + auto block = m_world.getBlock(x, y, z); + auto id = (BlockId)block.id; - if(id != BlockId::Air && id != BlockId::Water) - { - if (timer.getElapsedTime().asSeconds() > 0.2) - { - if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) - { + if (id != BlockId::Air && id != BlockId::Water) { + if (timer.getElapsedTime().asSeconds() > 0.2) { + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { timer.restart(); - m_world.addEvent(sf::Mouse::Left, ray.getEnd(), m_player); + m_world.addEvent(sf::Mouse::Left, + ray.getEnd(), m_player); break; } - else if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) - { + else if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) { timer.restart(); - m_world.addEvent(sf::Mouse::Right, lastPosition, m_player); + m_world.addEvent(sf::Mouse::Right, + lastPosition, m_player); break; } } } lastPosition = ray.getEnd(); } - - } void StatePlaying::update(float deltaTime) { - if (m_player.position.x < 0) m_player.position.x = 0; - if (m_player.position.z < 0) m_player.position.z = 0; + if (m_player.position.x < 0) + m_player.position.x = 0; + if (m_player.position.z < 0) + m_player.position.z = 0; m_fpsCounter.update(); m_player.update(deltaTime, m_world); m_world.update(m_pApplication->getCamera()); } -void StatePlaying::render(RenderMaster& renderer) +void StatePlaying::render(RenderMaster &renderer) { static sf::Clock dt; static bool drawGUI = false; static ToggleKey drawKey(sf::Keyboard::F3); - if (drawKey.isKeyPressed()) - { + if (drawKey.isKeyPressed()) { drawGUI = !drawGUI; } - if (drawGUI) - { + if (drawGUI) { m_fpsCounter.draw(renderer); m_player.draw(renderer); } - m_world.renderWorld(renderer, m_pApplication->getCamera()); } diff --git a/Source/States/PlayingState.h b/Source/States/PlayingState.h index 2bac2a31..64ce41e3 100644 --- a/Source/States/PlayingState.h +++ b/Source/States/PlayingState.h @@ -1,35 +1,33 @@ #ifndef PLAYINGSTATE_H_INCLUDED #define PLAYINGSTATE_H_INCLUDED -#include "StateBase.h" #include "../Player/Player.h" +#include "StateBase.h" +#include "../Input/Keyboard.h" +#include "../Util/FPSCounter.h" #include "../World/Chunk/Chunk.h" #include "../World/World.h" -#include "../Util/FPSCounter.h" -#include "../Input/Keyboard.h" - -class StatePlaying : public StateBase -{ - public: - StatePlaying(Application& app, const Config& config); +class StatePlaying : public StateBase { + public: + StatePlaying(Application &app, const Config &config); - void handleEvent(sf::Event e) override; - void handleInput() override; + void handleEvent(sf::Event e) override; + void handleInput() override; - void update(float deltaTime) override; + void update(float deltaTime) override; - void render(RenderMaster& renderer) override; + void render(RenderMaster &renderer) override; - void onOpen() override; + void onOpen() override; - private: - Keyboard m_keyboard; - Player m_player; - World m_world; + private: + Keyboard m_keyboard; + Player m_player; + World m_world; - FPSCounter m_fpsCounter; + FPSCounter m_fpsCounter; }; #endif // PLAYINGSTATE_H_INCLUDED diff --git a/Source/States/StateBase.h b/Source/States/StateBase.h index 2cfb09e4..bd382926 100644 --- a/Source/States/StateBase.h +++ b/Source/States/StateBase.h @@ -6,29 +6,26 @@ class RenderMaster; class Application; -class StateBase -{ - public: - StateBase(Application& app) - : m_pApplication (&app) - { } +class StateBase { + public: + StateBase(Application &app) + : m_pApplication(&app) + { + } - virtual ~StateBase() = default; + virtual ~StateBase() = default; - virtual void handleEvent(sf::Event e) = 0; - virtual void handleInput() = 0; + virtual void handleEvent(sf::Event e) = 0; + virtual void handleInput() = 0; - virtual void update(float deltaTime) = 0; - - virtual void render(RenderMaster& renderer) = 0; - - virtual void onOpen() = 0; - - protected: - Application* m_pApplication; + virtual void update(float deltaTime) = 0; + virtual void render(RenderMaster &renderer) = 0; + virtual void onOpen() = 0; + protected: + Application *m_pApplication; }; #endif // STATEBASE_H_INCLUDED diff --git a/Source/Texture/BasicTexture.cpp b/Source/Texture/BasicTexture.cpp index 43c5156c..de2cb4fb 100644 --- a/Source/Texture/BasicTexture.cpp +++ b/Source/Texture/BasicTexture.cpp @@ -1,33 +1,31 @@ #include "BasicTexture.h" - -BasicTexture::BasicTexture(const std::string& file) +BasicTexture::BasicTexture(const std::string &file) { loadFromFile(file); } -void BasicTexture::loadFromImage(const sf::Image& i) +void BasicTexture::loadFromImage(const sf::Image &i) { glGenTextures(1, &m_id); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, m_id); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, i.getSize().x, i.getSize().y, - 0, GL_RGBA, GL_UNSIGNED_BYTE, i.getPixelsPtr()); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, i.getSize().x, i.getSize().y, 0, + GL_RGBA, GL_UNSIGNED_BYTE, i.getPixelsPtr()); glGenerateMipmap(GL_TEXTURE_2D); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_NEAREST_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1); - + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1); } -void BasicTexture::loadFromFile(const std::string& file) +void BasicTexture::loadFromFile(const std::string &file) { sf::Image i; - if(!i.loadFromFile("Res/Textures/" + file + ".png")) - { + if (!i.loadFromFile("Res/Textures/" + file + ".png")) { throw std::runtime_error("Unable to load BasicTexture: " + file); } @@ -43,5 +41,3 @@ void BasicTexture::bindTexture() const { glBindTexture(GL_TEXTURE_2D, m_id); } - - diff --git a/Source/Texture/BasicTexture.h b/Source/Texture/BasicTexture.h index 8967eba0..665123df 100644 --- a/Source/Texture/BasicTexture.h +++ b/Source/Texture/BasicTexture.h @@ -2,28 +2,25 @@ #define TEXTURE_H_INCLUDED #include "../glad/glad.h" -#include #include - +#include #include "../Util/NonCopyable.h" -class BasicTexture : public NonCopyable -{ - public: - BasicTexture() = default; - BasicTexture(const std::string& file); - - ~BasicTexture(); +class BasicTexture : public NonCopyable { + public: + BasicTexture() = default; + BasicTexture(const std::string &file); - void loadFromImage(const sf::Image& image); - void loadFromFile (const std::string& file); + ~BasicTexture(); - void bindTexture() const; + void loadFromImage(const sf::Image &image); + void loadFromFile(const std::string &file); + void bindTexture() const; - private: - GLuint m_id; + private: + GLuint m_id; }; #endif // TEXTURE_H_INCLUDED diff --git a/Source/Texture/CubeTexture.cpp b/Source/Texture/CubeTexture.cpp index 6df8d1df..2e45a0d0 100644 --- a/Source/Texture/CubeTexture.cpp +++ b/Source/Texture/CubeTexture.cpp @@ -1,7 +1,6 @@ #include "CubeTexture.h" - -CubeTexture::CubeTexture(const std::array& files) +CubeTexture::CubeTexture(const std::array &files) { loadFromFiles(files); } @@ -11,27 +10,25 @@ CubeTexture::~CubeTexture() glDeleteTextures(1, &m_texId); } -void CubeTexture::loadFromFiles(const std::array& files) +void CubeTexture::loadFromFiles(const std::array &files) { glGenTextures(1, &m_texId); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_CUBE_MAP, m_texId); - for (int i = 0; i < 6; i++) - { - auto& str = files[i]; + for (int i = 0; i < 6; i++) { + auto &str = files[i]; sf::Image image; - if (!image.loadFromFile("Res/Textures/" + str + ".png")) - { + if (!image.loadFromFile("Res/Textures/" + str + ".png")) { throw std::runtime_error("Unable to load CubeTexture Part: " + str); } - auto param = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i; - auto width = image.getSize().x; - auto height = image.getSize().y; + auto param = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i; + auto width = image.getSize().x; + auto height = image.getSize().y; - glTexImage2D(param, 0, GL_RGBA, width, height, - 0, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr()); + glTexImage2D(param, 0, GL_RGBA, width, height, 0, GL_RGBA, + GL_UNSIGNED_BYTE, image.getPixelsPtr()); } glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); diff --git a/Source/Texture/CubeTexture.h b/Source/Texture/CubeTexture.h index f8542844..2278affc 100644 --- a/Source/Texture/CubeTexture.h +++ b/Source/Texture/CubeTexture.h @@ -2,38 +2,34 @@ #define CUBETEXTURE_H_INCLUDED #include "../glad/glad.h" +#include #include #include -#include - #include "../Util/NonCopyable.h" -class CubeTexture : public NonCopyable -{ - public: - CubeTexture () = default; - CubeTexture (const std::array& files); - - ~CubeTexture (); - - /** - MUST BE IN THIS ORDER: - -right - -left - -top - -bottom - -back - -front - */ - void loadFromFiles(const std::array& files); +class CubeTexture : public NonCopyable { + public: + CubeTexture() = default; + CubeTexture(const std::array &files); + ~CubeTexture(); - void bindTexture() const; + /** + MUST BE IN THIS ORDER: + -right + -left + -top + -bottom + -back + -front + */ + void loadFromFiles(const std::array &files); - private: - GLuint m_texId; + void bindTexture() const; + private: + GLuint m_texId; }; #endif // CUBETEXTURE_H_INCLUDED diff --git a/Source/Texture/TextureAtlas.cpp b/Source/Texture/TextureAtlas.cpp index 1f257cf5..b57a76f8 100644 --- a/Source/Texture/TextureAtlas.cpp +++ b/Source/Texture/TextureAtlas.cpp @@ -1,25 +1,24 @@ #include "TextureAtlas.h" #include -TextureAtlas::TextureAtlas(const std::string& textureFileName) +TextureAtlas::TextureAtlas(const std::string &textureFileName) { sf::Image i; - if (!i.loadFromFile("Res/Textures/" + textureFileName + ".png")) - { + if (!i.loadFromFile("Res/Textures/" + textureFileName + ".png")) { throw std::runtime_error("Unable to open image: " + textureFileName); } loadFromImage(i); - - m_imageSize = 256; + m_imageSize = 256; m_individualTextureSize = 16; } -std::array TextureAtlas::getTexture(const sf::Vector2i& coords) +std::array TextureAtlas::getTexture(const sf::Vector2i &coords) { - static const GLfloat TEX_PER_ROW = (GLfloat)m_imageSize / (GLfloat)m_individualTextureSize; - static const GLfloat INDV_TEX_SIZE = 1.0f / TEX_PER_ROW; - static const GLfloat PIXEL_SIZE = 1.0f / (float)m_imageSize; + static const GLfloat TEX_PER_ROW = + (GLfloat)m_imageSize / (GLfloat)m_individualTextureSize; + static const GLfloat INDV_TEX_SIZE = 1.0f / TEX_PER_ROW; + static const GLfloat PIXEL_SIZE = 1.0f / (float)m_imageSize; GLfloat xMin = (coords.x * INDV_TEX_SIZE) + 0.5f * PIXEL_SIZE; GLfloat yMin = (coords.y * INDV_TEX_SIZE) + 0.5f * PIXEL_SIZE; @@ -27,11 +26,5 @@ std::array TextureAtlas::getTexture(const sf::Vector2i& coords) GLfloat xMax = (xMin + INDV_TEX_SIZE) - PIXEL_SIZE; GLfloat yMax = (yMin + INDV_TEX_SIZE) - PIXEL_SIZE; - return - { - xMax, yMax, - xMin, yMax, - xMin, yMin, - xMax, yMin - }; + return {xMax, yMax, xMin, yMax, xMin, yMin, xMax, yMin}; } diff --git a/Source/Texture/TextureAtlas.h b/Source/Texture/TextureAtlas.h index 21ec9d8c..54214327 100644 --- a/Source/Texture/TextureAtlas.h +++ b/Source/Texture/TextureAtlas.h @@ -3,16 +3,15 @@ #include "BasicTexture.h" -class TextureAtlas : public BasicTexture -{ - public: - TextureAtlas(const std::string& textureFileName); +class TextureAtlas : public BasicTexture { + public: + TextureAtlas(const std::string &textureFileName); - std::array getTexture(const sf::Vector2i& coords); + std::array getTexture(const sf::Vector2i &coords); - private: - int m_imageSize; - int m_individualTextureSize; + private: + int m_imageSize; + int m_individualTextureSize; }; #endif // TEXTUREATLAS_H_INCLUDED diff --git a/Source/Util/Array2D.h b/Source/Util/Array2D.h index 76df84b9..1ba4cf63 100644 --- a/Source/Util/Array2D.h +++ b/Source/Util/Array2D.h @@ -1,38 +1,35 @@ #ifndef ARRAY2D_H_INCLUDED #define ARRAY2D_H_INCLUDED -#include #include +#include -template -class Array2D -{ +template class Array2D { using Array = std::array; - public: - T& get(int x, int z) - { - return m_array[x * WIDTH + z]; - } - - const T& get(int x, int z) const - { - return m_array[x * WIDTH + z]; - } - - T& getMaxValue() - { - return *std::max_element(m_array.begin(), m_array.end()); - } - - void setAll(T val) - { - m_array.fill(val); - } - - private: - Array m_array; + public: + T &get(int x, int z) + { + return m_array[x * WIDTH + z]; + } + + const T &get(int x, int z) const + { + return m_array[x * WIDTH + z]; + } + + T &getMaxValue() + { + return *std::max_element(m_array.begin(), m_array.end()); + } + + void setAll(T val) + { + m_array.fill(val); + } + + private: + Array m_array; }; - #endif // ARRAY2D_H_INCLUDED diff --git a/Source/Util/FPSCounter.cpp b/Source/Util/FPSCounter.cpp index 0cbf9c2b..275e8e20 100644 --- a/Source/Util/FPSCounter.cpp +++ b/Source/Util/FPSCounter.cpp @@ -7,21 +7,19 @@ FPSCounter::FPSCounter() { m_text.move(10, 10); - m_text.setOutlineColor (sf::Color::Black); - m_text.setOutlineThickness (2); + m_text.setOutlineColor(sf::Color::Black); + m_text.setOutlineThickness(2); m_font.loadFromFile("Res/Fonts/rs.ttf"); m_text.setFont(m_font); m_text.setCharacterSize(25); } - void FPSCounter::update() { m_frameCount++; - if (m_delayTimer.getElapsedTime().asSeconds() > 0.5) - { + if (m_delayTimer.getElapsedTime().asSeconds() > 0.5) { m_fps = m_frameCount / m_fpsTimer.restart().asSeconds(); m_frameCount = 0; m_delayTimer.restart(); @@ -29,9 +27,8 @@ void FPSCounter::update() } } -void FPSCounter::draw(RenderMaster& renderer) +void FPSCounter::draw(RenderMaster &renderer) { m_text.setString("FPS: " + std::to_string(m_fps)); renderer.drawSFML(m_text); } - diff --git a/Source/Util/FPSCounter.h b/Source/Util/FPSCounter.h index a68fd098..fe375997 100644 --- a/Source/Util/FPSCounter.h +++ b/Source/Util/FPSCounter.h @@ -5,25 +5,24 @@ class RenderMaster; -class FPSCounter -{ - public: - FPSCounter(); +class FPSCounter { + public: + FPSCounter(); - void update(); + void update(); - void draw(RenderMaster& renderer); + void draw(RenderMaster &renderer); - private: - sf::Text m_text; - sf::Font m_font; + private: + sf::Text m_text; + sf::Font m_font; - sf::Clock m_delayTimer; - sf::Clock m_fpsTimer; + sf::Clock m_delayTimer; + sf::Clock m_fpsTimer; - float m_fps = 0; + float m_fps = 0; - int m_frameCount = 0; + int m_frameCount = 0; }; #endif // FPSCOUNTER_H_INCLUDED diff --git a/Source/Util/FileUtil.cpp b/Source/Util/FileUtil.cpp index 66a88ba9..6208aa94 100644 --- a/Source/Util/FileUtil.cpp +++ b/Source/Util/FileUtil.cpp @@ -4,11 +4,10 @@ #include #include -std::string getFileContents(const std::string& filePath) +std::string getFileContents(const std::string &filePath) { std::ifstream inFile(filePath); - if(!inFile.is_open()) - { + if (!inFile.is_open()) { throw std::runtime_error("Unable to open file: " + filePath); } diff --git a/Source/Util/FileUtil.h b/Source/Util/FileUtil.h index 9daccf3e..8191c1e1 100644 --- a/Source/Util/FileUtil.h +++ b/Source/Util/FileUtil.h @@ -3,6 +3,6 @@ #include -std::string getFileContents(const std::string& filePath); +std::string getFileContents(const std::string &filePath); #endif // FILEUTIL_H_INCLUDED diff --git a/Source/Util/NonCopyable.h b/Source/Util/NonCopyable.h index 30f11255..bfcbedae 100644 --- a/Source/Util/NonCopyable.h +++ b/Source/Util/NonCopyable.h @@ -1,11 +1,10 @@ #ifndef NONCOPYABLE_H_INCLUDED #define NONCOPYABLE_H_INCLUDED -struct NonCopyable -{ +struct NonCopyable { NonCopyable() = default; - NonCopyable(const NonCopyable&) = delete; - NonCopyable& operator=(const NonCopyable&) = delete; + NonCopyable(const NonCopyable &) = delete; + NonCopyable &operator=(const NonCopyable &) = delete; }; #endif // NONCOPYABLE_H_INCLUDED diff --git a/Source/Util/NonMovable.h b/Source/Util/NonMovable.h index 3173e374..8a737234 100644 --- a/Source/Util/NonMovable.h +++ b/Source/Util/NonMovable.h @@ -1,15 +1,14 @@ #ifndef NON_MOVE #define NON_MOVE -class NonMovable -{ - public: - NonMovable(NonMovable&&) = delete; +class NonMovable { + public: + NonMovable(NonMovable &&) = delete; - NonMovable& operator=(NonMovable&&) = delete; + NonMovable &operator=(NonMovable &&) = delete; - protected: - NonMovable() = default; + protected: + NonMovable() = default; }; #endif // NON_MOVE diff --git a/Source/Util/Random.cpp b/Source/Util/Random.cpp index f471150b..622dc09d 100644 --- a/Source/Util/Random.cpp +++ b/Source/Util/Random.cpp @@ -1,6 +1,6 @@ #include "Random.h" -RandomSingleton& RandomSingleton::get() +RandomSingleton &RandomSingleton::get() { static RandomSingleton r; return r; @@ -8,10 +8,8 @@ RandomSingleton& RandomSingleton::get() RandomSingleton::RandomSingleton() { - m_randomEngine.seed( - static_cast(std::time(nullptr)) - ); - for (int i = 0; i < 5; i++) { - intInRange(i, i * 5); - } + m_randomEngine.seed(static_cast(std::time(nullptr))); + for (int i = 0; i < 5; i++) { + intInRange(i, i * 5); + } } diff --git a/Source/Util/Random.h b/Source/Util/Random.h index 9273196e..8393c805 100644 --- a/Source/Util/Random.h +++ b/Source/Util/Random.h @@ -1,58 +1,51 @@ #ifndef RANDOM_H_INCLUDED #define RANDOM_H_INCLUDED -#include #include +#include #include "Singleton.h" -class RandomSingleton : public Singleton -{ - public: - static RandomSingleton& get(); - - +class RandomSingleton : public Singleton { + public: + static RandomSingleton &get(); - template - T intInRange(T low, T high) - { - static_assert(std::is_integral::value, "Not integral type!"); - std::uniform_int_distribution dist(low, high); - return dist(m_randomEngine); - } + template T intInRange(T low, T high) + { + static_assert(std::is_integral::value, "Not integral type!"); + std::uniform_int_distribution dist(low, high); + return dist(m_randomEngine); + } - private: - RandomSingleton(); + private: + RandomSingleton(); - std::mt19937 m_randomEngine; + std::mt19937 m_randomEngine; }; -template -class Random -{ - public: - Random(int n = std::time(nullptr)) - { - m_randomEngine.seed(n); - for (int i = 0; i < 5; i++) - intInRange(i, i * 5); - } - - template - T intInRange(T low, T high) - { - static_assert(std::is_integral::value, "Not integral type!"); - std::uniform_int_distribution dist(low, high); - return dist(m_randomEngine); - } - - void setSeed(int seed) - { - m_randomEngine.seed(seed); - } - - private: - REngine m_randomEngine; +template class Random { + public: + Random(int n = std::time(nullptr)) + { + m_randomEngine.seed(n); + for (int i = 0; i < 5; i++) + intInRange(i, i * 5); + } + + template T intInRange(T low, T high) + { + static_assert(std::is_integral::value, "Not integral type!"); + std::uniform_int_distribution dist(low, high); + return dist(m_randomEngine); + } + + void setSeed(int seed) + { + m_randomEngine.seed(seed); + } + + private: + REngine m_randomEngine; }; #endif // RANDOM_H_INCLUDED diff --git a/Source/Util/Singleton.h b/Source/Util/Singleton.h index 42a814ed..77647318 100644 --- a/Source/Util/Singleton.h +++ b/Source/Util/Singleton.h @@ -4,9 +4,7 @@ #include "NonCopyable.h" #include "NonMovable.h" -class Singleton : public NonMovable, public NonCopyable -{ - +class Singleton : public NonMovable, public NonCopyable { }; #endif // SINGLETON_H_INCLUDED diff --git a/Source/World/Block/BlockData.cpp b/Source/World/Block/BlockData.cpp index 50233035..33a80c97 100644 --- a/Source/World/Block/BlockData.cpp +++ b/Source/World/Block/BlockData.cpp @@ -2,66 +2,56 @@ #include -BlockData::BlockData(const std::string& fileName) +BlockData::BlockData(const std::string &fileName) { std::ifstream inFile("Res/Blocks/" + fileName + ".block"); - if (!inFile.is_open()) - { - throw std::runtime_error ("Unable to open block file: " + fileName + "!"); + if (!inFile.is_open()) { + throw std::runtime_error("Unable to open block file: " + fileName + + "!"); } std::string line; - while (std::getline(inFile, line)) - { - if (line == "TexTop") - { + while (std::getline(inFile, line)) { + if (line == "TexTop") { int x, y; inFile >> x >> y; m_data.texTopCoord = {x, y}; } - else if (line == "TexSide") - { + else if (line == "TexSide") { int x, y; inFile >> x >> y; m_data.texSideCoord = {x, y}; } - else if (line == "TexBottom") - { + else if (line == "TexBottom") { int x, y; inFile >> x >> y; m_data.texBottomCoord = {x, y}; } - else if (line == "TexAll") - { + else if (line == "TexAll") { int x, y; inFile >> x >> y; - m_data.texTopCoord = {x, y}; - m_data.texSideCoord = {x, y}; - m_data.texBottomCoord = {x, y}; + m_data.texTopCoord = {x, y}; + m_data.texSideCoord = {x, y}; + m_data.texBottomCoord = {x, y}; } - else if (line == "Id") - { + else if (line == "Id") { int id; inFile >> id; m_data.id = static_cast(id); } - else if (line == "Opaque") - { + else if (line == "Opaque") { inFile >> m_data.isOpaque; } - else if (line == "Collidable") - { + else if (line == "Collidable") { inFile >> m_data.isCollidable; } - else if (line == "MeshType") - { + else if (line == "MeshType") { int id; inFile >> id; m_data.meshType = static_cast(id); } - else if (line == "ShaderType") - { + else if (line == "ShaderType") { int id; inFile >> id; m_data.shaderType = static_cast(id); @@ -69,7 +59,7 @@ BlockData::BlockData(const std::string& fileName) } } -const BlockDataHolder& BlockData::getBlockData() const +const BlockDataHolder &BlockData::getBlockData() const { return m_data; } diff --git a/Source/World/Block/BlockData.h b/Source/World/Block/BlockData.h index 90b651ef..f38e1a50 100644 --- a/Source/World/Block/BlockData.h +++ b/Source/World/Block/BlockData.h @@ -5,43 +5,38 @@ #include "BlockId.h" #include -enum class BlockMeshType -{ - Cube = 0, - X = 1, +enum class BlockMeshType { + Cube = 0, + X = 1, }; -enum class BlockShaderType -{ - Chunk = 0, - Liquid = 1, - Flora = 2, +enum class BlockShaderType { + Chunk = 0, + Liquid = 1, + Flora = 2, }; -struct BlockDataHolder : public NonCopyable -{ - BlockId id; +struct BlockDataHolder : public NonCopyable { + BlockId id; sf::Vector2i texTopCoord; sf::Vector2i texSideCoord; sf::Vector2i texBottomCoord; - BlockMeshType meshType; + BlockMeshType meshType; BlockShaderType shaderType; bool isOpaque; bool isCollidable; }; -class BlockData : public NonCopyable -{ - public: - BlockData(const std::string& fileName); +class BlockData : public NonCopyable { + public: + BlockData(const std::string &fileName); - const BlockDataHolder& getBlockData() const; - - private: - BlockDataHolder m_data; + const BlockDataHolder &getBlockData() const; + private: + BlockDataHolder m_data; }; #endif // BLOCKDATA_H_INCLUDED diff --git a/Source/World/Block/BlockDatabase.cpp b/Source/World/Block/BlockDatabase.cpp index e6d8dc21..8d2b3a92 100644 --- a/Source/World/Block/BlockDatabase.cpp +++ b/Source/World/Block/BlockDatabase.cpp @@ -1,37 +1,36 @@ #include "BlockDatabase.h" - BlockDatabase::BlockDatabase() -: textureAtlas ("DefaultPack") + : textureAtlas("DefaultPack") { - m_blocks[(int)BlockId::Air] = std::make_unique("Air"); - m_blocks[(int)BlockId::Grass] = std::make_unique("Grass"); - m_blocks[(int)BlockId::Dirt] = std::make_unique("Dirt"); - m_blocks[(int)BlockId::Stone] = std::make_unique("Stone"); + m_blocks[(int)BlockId::Air] = std::make_unique("Air"); + m_blocks[(int)BlockId::Grass] = std::make_unique("Grass"); + m_blocks[(int)BlockId::Dirt] = std::make_unique("Dirt"); + m_blocks[(int)BlockId::Stone] = std::make_unique("Stone"); m_blocks[(int)BlockId::OakBark] = std::make_unique("OakBark"); m_blocks[(int)BlockId::OakLeaf] = std::make_unique("OakLeaf"); - m_blocks[(int)BlockId::Sand] = std::make_unique("Sand"); - m_blocks[(int)BlockId::Water] = std::make_unique("Water"); - m_blocks[(int)BlockId::Cactus] = std::make_unique("Cactus"); - m_blocks[(int)BlockId::TallGrass] = std::make_unique("TallGrass"); - m_blocks[(int)BlockId::Rose] = std::make_unique("Rose"); - m_blocks[(int)BlockId::DeadShrub] = std::make_unique("DeadShrub"); + m_blocks[(int)BlockId::Sand] = std::make_unique("Sand"); + m_blocks[(int)BlockId::Water] = std::make_unique("Water"); + m_blocks[(int)BlockId::Cactus] = std::make_unique("Cactus"); + m_blocks[(int)BlockId::TallGrass] = + std::make_unique("TallGrass"); + m_blocks[(int)BlockId::Rose] = std::make_unique("Rose"); + m_blocks[(int)BlockId::DeadShrub] = + std::make_unique("DeadShrub"); } -BlockDatabase& BlockDatabase::get() +BlockDatabase &BlockDatabase::get() { static BlockDatabase d; return d; } -const BlockType& BlockDatabase::getBlock(BlockId id) const +const BlockType &BlockDatabase::getBlock(BlockId id) const { return *m_blocks[(int)id]; } -const BlockData& BlockDatabase::getData(BlockId id) const +const BlockData &BlockDatabase::getData(BlockId id) const { return m_blocks[(int)id]->getData(); } - - diff --git a/Source/World/Block/BlockDatabase.h b/Source/World/Block/BlockDatabase.h index 3fe572c3..e3d2a574 100644 --- a/Source/World/Block/BlockDatabase.h +++ b/Source/World/Block/BlockDatabase.h @@ -1,31 +1,30 @@ #ifndef BLOCKDATABASE_H_INCLUDED #define BLOCKDATABASE_H_INCLUDED -#include #include +#include #include "../../Util/Singleton.h" -#include "BlockTypes/BlockType.h" #include "BlockId.h" +#include "BlockTypes/BlockType.h" #include "../../Texture/TextureAtlas.h" -class BlockDatabase : public Singleton -{ - public: - static BlockDatabase& get() ; +class BlockDatabase : public Singleton { + public: + static BlockDatabase &get(); - const BlockType& getBlock(BlockId id) const; - const BlockData& getData (BlockId id) const; + const BlockType &getBlock(BlockId id) const; + const BlockData &getData(BlockId id) const; - TextureAtlas textureAtlas; + TextureAtlas textureAtlas; - private: - BlockDatabase(); + private: + BlockDatabase(); - std::array, - (unsigned)BlockId::NUM_TYPES> m_blocks; + std::array, (unsigned)BlockId::NUM_TYPES> + m_blocks; }; #endif // BLOCKDATABASE_H_INCLUDED diff --git a/Source/World/Block/BlockId.h b/Source/World/Block/BlockId.h index 85423ded..b25f9176 100644 --- a/Source/World/Block/BlockId.h +++ b/Source/World/Block/BlockId.h @@ -5,24 +5,21 @@ using Block_t = uint8_t; -enum class BlockId : Block_t -{ - Air = 0, - Grass = 1, - Dirt = 2, - Stone = 3, +enum class BlockId : Block_t { + Air = 0, + Grass = 1, + Dirt = 2, + Stone = 3, OakBark = 4, OakLeaf = 5, - Sand = 6, - Water = 7, - Cactus = 8, - Rose = 9, + Sand = 6, + Water = 7, + Cactus = 8, + Rose = 9, TallGrass = 10, DeadShrub = 11, NUM_TYPES }; - - #endif // BLOCKID_H_INCLUDED diff --git a/Source/World/Block/BlockTypes/BlockType.cpp b/Source/World/Block/BlockTypes/BlockType.cpp index 2308e6d4..cf93859b 100644 --- a/Source/World/Block/BlockTypes/BlockType.cpp +++ b/Source/World/Block/BlockTypes/BlockType.cpp @@ -1,12 +1,11 @@ #include "BlockType.h" -BlockType::BlockType(const std::string& fileName) -: m_data (fileName) +BlockType::BlockType(const std::string &fileName) + : m_data(fileName) { - } -const BlockData& BlockType::getData() const +const BlockData &BlockType::getData() const { return m_data; } diff --git a/Source/World/Block/BlockTypes/BlockType.h b/Source/World/Block/BlockTypes/BlockType.h index fc74ea5b..113360ae 100644 --- a/Source/World/Block/BlockTypes/BlockType.h +++ b/Source/World/Block/BlockTypes/BlockType.h @@ -3,24 +3,23 @@ #include "../BlockData.h" -class BlockType : public NonCopyable -{ - public: - BlockType(const std::string& fileName); - virtual ~BlockType() = default; +class BlockType : public NonCopyable { + public: + BlockType(const std::string &fileName); + virtual ~BlockType() = default; - const BlockData& getData() const ; + const BlockData &getData() const; - private: - BlockData m_data; + private: + BlockData m_data; }; -class DefaultBlock : public BlockType -{ - public: - DefaultBlock(const std::string& fileName) - : BlockType (fileName) - { } +class DefaultBlock : public BlockType { + public: + DefaultBlock(const std::string &fileName) + : BlockType(fileName) + { + } }; #endif // BLOCKTYPE_H_INCLUDED diff --git a/Source/World/Block/ChunkBlock.cpp b/Source/World/Block/ChunkBlock.cpp index 046e8f60..944cb96f 100644 --- a/Source/World/Block/ChunkBlock.cpp +++ b/Source/World/Block/ChunkBlock.cpp @@ -3,24 +3,21 @@ #include "BlockDatabase.h" ChunkBlock::ChunkBlock(Block_t id) -: id (id) + : id(id) { - } ChunkBlock::ChunkBlock(BlockId id) -: id (static_cast(id)) + : id(static_cast(id)) { - } - -const BlockDataHolder& ChunkBlock::getData() const +const BlockDataHolder &ChunkBlock::getData() const { return BlockDatabase::get().getData((BlockId)id).getBlockData(); } -const BlockType& ChunkBlock::getType() const +const BlockType &ChunkBlock::getType() const { return BlockDatabase::get().getBlock((BlockId)id); } diff --git a/Source/World/Block/ChunkBlock.h b/Source/World/Block/ChunkBlock.h index 6fe99add..18950cfb 100644 --- a/Source/World/Block/ChunkBlock.h +++ b/Source/World/Block/ChunkBlock.h @@ -6,22 +6,21 @@ struct BlockDataHolder; class BlockType; -struct ChunkBlock -{ +struct ChunkBlock { ChunkBlock() = default; ChunkBlock(Block_t id); ChunkBlock(BlockId id); - const BlockDataHolder& getData() const; - const BlockType& getType() const; + const BlockDataHolder &getData() const; + const BlockType &getType() const; - bool operator ==(ChunkBlock other) const + bool operator==(ChunkBlock other) const { return id == other.id; } - bool operator !=(ChunkBlock other) const + bool operator!=(ChunkBlock other) const { return id != other.id; } diff --git a/Source/World/Chunk/Chunk.cpp b/Source/World/Chunk/Chunk.cpp index 297d3d72..2f88669b 100644 --- a/Source/World/Chunk/Chunk.cpp +++ b/Source/World/Chunk/Chunk.cpp @@ -1,25 +1,24 @@ #include "Chunk.h" +#include "../../Camera.h" +#include "../../Maths/NoiseGenerator.h" #include "../../Renderer/RenderMaster.h" #include "../../Util/Random.h" -#include "../../Maths/NoiseGenerator.h" -#include "../../Camera.h" -#include "../World.h" #include "../Generation/Terrain/TerrainGenerator.h" +#include "../World.h" -Chunk::Chunk(World& world, const sf::Vector2i& location) -: m_location (location) -, m_pWorld (&world) +Chunk::Chunk(World &world, const sf::Vector2i &location) + : m_location(location) + , m_pWorld(&world) { m_highestBlocks.setAll(0); } -bool Chunk::makeMesh(const Camera& camera) +bool Chunk::makeMesh(const Camera &camera) { - for (auto& chunk : m_chunks) - { - if (!chunk.hasMesh() && camera.getFrustum().isBoxInFrustum(chunk.m_aabb)) - { + for (auto &chunk : m_chunks) { + if (!chunk.hasMesh() && + camera.getFrustum().isBoxInFrustum(chunk.m_aabb)) { chunk.makeMesh(); return true; } @@ -27,7 +26,6 @@ bool Chunk::makeMesh(const Camera& camera) return false; } - void Chunk::setBlock(int x, int y, int z, ChunkBlock block) { addSectionsBlockTarget(y); @@ -37,30 +35,25 @@ void Chunk::setBlock(int x, int y, int z, ChunkBlock block) int bY = y % CHUNK_SIZE; m_chunks[y / CHUNK_SIZE].setBlock(x, bY, z, block); - if (y == m_highestBlocks.get(x, z)) - { + if (y == m_highestBlocks.get(x, z)) { auto highBlock = getBlock(x, y--, z); - while (!highBlock.getData().isOpaque) - { + while (!highBlock.getData().isOpaque) { highBlock = getBlock(x, y--, z); } } - else if (y > m_highestBlocks.get(x, z)) - { + else if (y > m_highestBlocks.get(x, z)) { m_highestBlocks.get(x, z) = y; } - if (m_isLoaded) - { - //m_pWorld->updateChunk(x, y, z); + if (m_isLoaded) { + // m_pWorld->updateChunk(x, y, z); } } -//Chunk block to SECTION BLOCK positions +// Chunk block to SECTION BLOCK positions ChunkBlock Chunk::getBlock(int x, int y, int z) const noexcept { - if (outOfBound(x, y, z)) - { + if (outOfBound(x, y, z)) { return BlockId::Air; } @@ -74,32 +67,32 @@ int Chunk::getHeightAt(int x, int z) return m_highestBlocks.get(x, z); } - bool Chunk::outOfBound(int x, int y, int z) const noexcept { - if (x >= CHUNK_SIZE) return true; - if (z >= CHUNK_SIZE) return true; + if (x >= CHUNK_SIZE) + return true; + if (z >= CHUNK_SIZE) + return true; - if (x < 0) return true; - if (y < 0) return true; - if (z < 0) return true; + if (x < 0) + return true; + if (y < 0) + return true; + if (z < 0) + return true; - if (y >= (int)m_chunks.size() * CHUNK_SIZE) - { + if (y >= (int)m_chunks.size() * CHUNK_SIZE) { return true; } return false; } -void Chunk::drawChunks(RenderMaster& renderer, const Camera& camera) +void Chunk::drawChunks(RenderMaster &renderer, const Camera &camera) { - for (auto& chunk : m_chunks) - { - if (chunk.hasMesh()) - { - if (!chunk.hasBuffered()) - { + for (auto &chunk : m_chunks) { + if (chunk.hasMesh()) { + if (!chunk.hasBuffered()) { chunk.bufferMesh(); } @@ -114,7 +107,7 @@ bool Chunk::hasLoaded() const noexcept return m_isLoaded; } -void Chunk::load(TerrainGenerator& generator) +void Chunk::load(TerrainGenerator &generator) { if (hasLoaded()) return; @@ -123,9 +116,9 @@ void Chunk::load(TerrainGenerator& generator) m_isLoaded = true; } -ChunkSection& Chunk::getSection(int index) +ChunkSection &Chunk::getSection(int index) { - static ChunkSection errorSection({444,444,444}, *m_pWorld); + static ChunkSection errorSection({444, 444, 444}, *m_pWorld); if (index >= (int)m_chunks.size() || index < 0) return errorSection; @@ -135,8 +128,7 @@ ChunkSection& Chunk::getSection(int index) void Chunk::deleteMeshes() { - for (unsigned i = 0; i < m_chunks.size(); i++) - { + for (unsigned i = 0; i < m_chunks.size(); i++) { m_chunks[i].deleteMeshes(); } } @@ -144,7 +136,8 @@ void Chunk::deleteMeshes() void Chunk::addSection() { int y = m_chunks.size(); - m_chunks.emplace_back(sf::Vector3i(m_location.x, y, m_location.y), *m_pWorld); + m_chunks.emplace_back(sf::Vector3i(m_location.x, y, m_location.y), + *m_pWorld); } void Chunk::addSectionsBlockTarget(int blockY) @@ -155,10 +148,7 @@ void Chunk::addSectionsBlockTarget(int blockY) void Chunk::addSectionsIndexTarget(int index) { - while ((int)m_chunks.size() < index + 1) - { + while ((int)m_chunks.size() < index + 1) { addSection(); } } - - diff --git a/Source/World/Chunk/Chunk.h b/Source/World/Chunk/Chunk.h index f6cb17e1..7a4f1e69 100644 --- a/Source/World/Chunk/Chunk.h +++ b/Source/World/Chunk/Chunk.h @@ -1,55 +1,54 @@ #ifndef CHUNK_H_INCLUDED #define CHUNK_H_INCLUDED -#include -#include "ChunkSection.h" #include "../../Util/Array2D.h" #include "../../Util/NonCopyable.h" +#include "ChunkSection.h" +#include class RenderMaster; class Camera; class TerrainGenerator; -class Chunk : public IChunk -{ - public: - Chunk() = default; - Chunk(World& world, const sf::Vector2i& location); - - bool makeMesh(const Camera& camera); - - void setBlock (int x, int y, int z, ChunkBlock block) override; - ChunkBlock getBlock (int x, int y, int z) const noexcept override ; - int getHeightAt (int x, int z); - - void drawChunks (RenderMaster& renderer, const Camera& camera); +class Chunk : public IChunk { + public: + Chunk() = default; + Chunk(World &world, const sf::Vector2i &location); - bool hasLoaded() const noexcept; - void load(TerrainGenerator& generator); + bool makeMesh(const Camera &camera); - ChunkSection& getSection(int index); + void setBlock(int x, int y, int z, ChunkBlock block) override; + ChunkBlock getBlock(int x, int y, int z) const noexcept override; + int getHeightAt(int x, int z); + void drawChunks(RenderMaster &renderer, const Camera &camera); - const sf::Vector2i& getLocation() const { return m_location; } + bool hasLoaded() const noexcept; + void load(TerrainGenerator &generator); - void deleteMeshes(); + ChunkSection &getSection(int index); - private: - void addSection(); - void addSectionsBlockTarget(int blockY); - void addSectionsIndexTarget(int index); + const sf::Vector2i &getLocation() const + { + return m_location; + } - bool outOfBound(int x, int y, int z) const noexcept; + void deleteMeshes(); - std::vector m_chunks; - Array2D m_highestBlocks; - sf::Vector2i m_location; + private: + void addSection(); + void addSectionsBlockTarget(int blockY); + void addSectionsIndexTarget(int index); - World* m_pWorld; + bool outOfBound(int x, int y, int z) const noexcept; - bool m_isLoaded = false; + std::vector m_chunks; + Array2D m_highestBlocks; + sf::Vector2i m_location; + World *m_pWorld; + bool m_isLoaded = false; }; #endif // CHUNK_H_INCLUDED diff --git a/Source/World/Chunk/ChunkManager.cpp b/Source/World/Chunk/ChunkManager.cpp index 06e68ae3..6fae3be7 100644 --- a/Source/World/Chunk/ChunkManager.cpp +++ b/Source/World/Chunk/ChunkManager.cpp @@ -5,37 +5,36 @@ #include "../Generation/Terrain/ClassicOverWorldGenerator.h" #include "../Generation/Terrain/SuperFlatGenerator.h" -ChunkManager::ChunkManager(World& world) -: m_world (&world) +ChunkManager::ChunkManager(World &world) + : m_world(&world) { m_terrainGenerator = std::make_unique(); } - -Chunk& ChunkManager::getChunk(int x, int z) +Chunk &ChunkManager::getChunk(int x, int z) { - VectorXZ key {x, z}; - if (!chunkExistsAt(x, z)) - { - Chunk chunk {*m_world, {x, z}}; + VectorXZ key{x, z}; + if (!chunkExistsAt(x, z)) { + Chunk chunk{*m_world, {x, z}}; m_chunks.emplace(key, std::move(chunk)); } return m_chunks[key]; } -ChunkMap& ChunkManager::getChunks() +ChunkMap &ChunkManager::getChunks() { return m_chunks; } -bool ChunkManager::makeMesh(int x, int z, const Camera& camera) +bool ChunkManager::makeMesh(int x, int z, const Camera &camera) { for (int nx = -1; nx <= 1; nx++) - for (int nz = -1; nz <= 1; nz++) - { - loadChunk(x + nx, z + nz);//getChunk(x + nx, z + nz).load(*m_terrainGenerator); - } + for (int nz = -1; nz <= 1; nz++) { + loadChunk( + x + nx, + z + nz); // getChunk(x + nx, z + nz).load(*m_terrainGenerator); + } return getChunk(x, z).makeMesh(camera); } @@ -48,7 +47,6 @@ bool ChunkManager::chunkLoadedAt(int x, int z) const return m_chunks.at({x, z}).hasLoaded(); } - bool ChunkManager::chunkExistsAt(int x, int z) const { return m_chunks.find({x, z}) != m_chunks.end(); @@ -61,13 +59,12 @@ void ChunkManager::loadChunk(int x, int z) void ChunkManager::deleteMeshes() { - for (auto& chunk : m_chunks) - { + for (auto &chunk : m_chunks) { chunk.second.deleteMeshes(); } } -const TerrainGenerator& ChunkManager::getTerrainGenerator() const noexcept +const TerrainGenerator &ChunkManager::getTerrainGenerator() const noexcept { return *m_terrainGenerator; } @@ -78,4 +75,3 @@ void ChunkManager::unloadChunk(int x, int z) if (chunkExistsAt(x, z)) m_chunks.erase({x, z}); } - diff --git a/Source/World/Chunk/ChunkManager.h b/Source/World/Chunk/ChunkManager.h index 2bcef05a..7fd1959f 100644 --- a/Source/World/Chunk/ChunkManager.h +++ b/Source/World/Chunk/ChunkManager.h @@ -5,39 +5,38 @@ #include #include -#include "Chunk.h" #include "../../Maths/Vector2XZ.h" #include "../Generation/Terrain/TerrainGenerator.h" +#include "Chunk.h" class World; using ChunkMap = std::unordered_map; -class ChunkManager -{ - public: - ChunkManager(World& world); +class ChunkManager { + public: + ChunkManager(World &world); - Chunk& getChunk (int x, int z); - ChunkMap& getChunks (); + Chunk &getChunk(int x, int z); + ChunkMap &getChunks(); - bool makeMesh(int x, int z, const Camera& camera); + bool makeMesh(int x, int z, const Camera &camera); - bool chunkLoadedAt(int x, int z) const; - bool chunkExistsAt(int x, int z) const; + bool chunkLoadedAt(int x, int z) const; + bool chunkExistsAt(int x, int z) const; - void loadChunk(int x, int z); - void unloadChunk(int x, int z); + void loadChunk(int x, int z); + void unloadChunk(int x, int z); - void deleteMeshes(); + void deleteMeshes(); - const TerrainGenerator& getTerrainGenerator() const noexcept; + const TerrainGenerator &getTerrainGenerator() const noexcept; - private: - ChunkMap m_chunks; - std::unique_ptr m_terrainGenerator; + private: + ChunkMap m_chunks; + std::unique_ptr m_terrainGenerator; - World* m_world; + World *m_world; }; #endif // CHUNKMANAGER_H_INCLUDED diff --git a/Source/World/Chunk/ChunkMesh.cpp b/Source/World/Chunk/ChunkMesh.cpp index 5200fe5d..b3c617a7 100644 --- a/Source/World/Chunk/ChunkMesh.cpp +++ b/Source/World/Chunk/ChunkMesh.cpp @@ -4,39 +4,36 @@ #include -void ChunkMesh::addFace(const std::array& blockFace, - const std::array& textureCoords, - const sf::Vector3i& chunkPosition, - const sf::Vector3i& blockPosition, +void ChunkMesh::addFace(const std::array &blockFace, + const std::array &textureCoords, + const sf::Vector3i &chunkPosition, + const sf::Vector3i &blockPosition, GLfloat cardinalLight) { faces++; - auto& verticies = m_mesh.vertexPositions; - auto& texCoords = m_mesh.textureCoords; - auto& indices = m_mesh.indices; + auto &verticies = m_mesh.vertexPositions; + auto &texCoords = m_mesh.textureCoords; + auto &indices = m_mesh.indices; - texCoords.insert(texCoords.end(), textureCoords.begin(), textureCoords.end()); + texCoords.insert(texCoords.end(), textureCoords.begin(), + textureCoords.end()); - ///Vertex: The current vertex in the "blockFace" vector, 4 vertex in total hence "< 4" - ///Index: X, Y, Z - for (int i = 0, index = 0; i < 4; ++i) - { - verticies.push_back(blockFace[index++] + chunkPosition.x * CHUNK_SIZE + blockPosition.x); - verticies.push_back(blockFace[index++] + chunkPosition.y * CHUNK_SIZE + blockPosition.y); - verticies.push_back(blockFace[index++] + chunkPosition.z * CHUNK_SIZE + blockPosition.z); - m_light .push_back(cardinalLight); + /// Vertex: The current vertex in the "blockFace" vector, 4 vertex in total + /// hence "< 4" Index: X, Y, Z + for (int i = 0, index = 0; i < 4; ++i) { + verticies.push_back(blockFace[index++] + chunkPosition.x * CHUNK_SIZE + + blockPosition.x); + verticies.push_back(blockFace[index++] + chunkPosition.y * CHUNK_SIZE + + blockPosition.y); + verticies.push_back(blockFace[index++] + chunkPosition.z * CHUNK_SIZE + + blockPosition.z); + m_light.push_back(cardinalLight); } indices.insert(indices.end(), - { - m_indexIndex, - m_indexIndex + 1, - m_indexIndex + 2, + {m_indexIndex, m_indexIndex + 1, m_indexIndex + 2, - m_indexIndex + 2, - m_indexIndex + 3, - m_indexIndex - }); + m_indexIndex + 2, m_indexIndex + 3, m_indexIndex}); m_indexIndex += 4; } @@ -63,7 +60,7 @@ void ChunkMesh::deleteData() m_model.deleteData(); } -const Model& ChunkMesh::getModel() const +const Model &ChunkMesh::getModel() const { return m_model; } diff --git a/Source/World/Chunk/ChunkMesh.h b/Source/World/Chunk/ChunkMesh.h index 8094eea3..7a1b53f4 100644 --- a/Source/World/Chunk/ChunkMesh.h +++ b/Source/World/Chunk/ChunkMesh.h @@ -3,42 +3,35 @@ #include "../../Model.h" +#include #include #include -#include - -class ChunkMesh -{ - public: - ChunkMesh() = default; - - void addFace(const std::array& blockFace, - const std::array& textureCoords, - const sf::Vector3i& chunkPosition, - const sf::Vector3i& blockPosition, - GLfloat cardinalLight); - - - void bufferMesh(); - const Model& getModel() const; +class ChunkMesh { + public: + ChunkMesh() = default; - void deleteData(); + void addFace(const std::array &blockFace, + const std::array &textureCoords, + const sf::Vector3i &chunkPosition, + const sf::Vector3i &blockPosition, GLfloat cardinalLight); - int faces = 0; + void bufferMesh(); + const Model &getModel() const; - private: - Mesh m_mesh; - Model m_model; - std::vector m_light; - GLuint m_indexIndex = 0; + void deleteData(); + int faces = 0; + private: + Mesh m_mesh; + Model m_model; + std::vector m_light; + GLuint m_indexIndex = 0; }; -struct ChunkMeshCollection -{ +struct ChunkMeshCollection { ChunkMesh solidMesh; ChunkMesh waterMesh; ChunkMesh floraMesh; diff --git a/Source/World/Chunk/ChunkMeshBuilder.cpp b/Source/World/Chunk/ChunkMeshBuilder.cpp index a119c7b9..41379451 100644 --- a/Source/World/Chunk/ChunkMeshBuilder.cpp +++ b/Source/World/Chunk/ChunkMeshBuilder.cpp @@ -1,104 +1,70 @@ #include "ChunkMeshBuilder.h" -#include "ChunkSection.h" #include "ChunkMesh.h" +#include "ChunkSection.h" #include "../Block/BlockData.h" #include "../Block/BlockDatabase.h" -#include -#include -#include #include +#include +#include +#include -namespace -{ - const std::array frontFace - { - 0, 0, 1, - 1, 0, 1, - 1, 1, 1, - 0, 1, 1, - }; - - const std::array backFace - { - 1, 0, 0, - 0, 0, 0, - 0, 1, 0, - 1, 1, 0, - }; +namespace { +const std::array frontFace{ + 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, +}; - const std::array leftFace - { - 0, 0, 0, - 0, 0, 1, - 0, 1, 1, - 0, 1, 0, - }; +const std::array backFace{ + 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, +}; - const std::array rightFace - { - 1, 0, 1, - 1, 0, 0, - 1, 1, 0, - 1, 1, 1, - }; +const std::array leftFace{ + 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, +}; - const std::array topFace - { - 0, 1, 1, - 1, 1, 1, - 1, 1, 0, - 0, 1, 0, - }; +const std::array rightFace{ + 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, +}; - const std::array bottomFace - { - 0, 0, 0, - 1, 0, 0, - 1, 0, 1, - 0, 0, 1 - }; +const std::array topFace{ + 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, +}; - const std::array xFace1 - { - 0, 0, 0, - 1, 0, 1, - 1, 1, 1, - 0, 1, 0, - }; +const std::array bottomFace{0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1}; - const std::array xFace2 - { - 0, 0, 1, - 1, 0, 0, - 1, 1, 0, - 0, 1, 1, - }; +const std::array xFace1{ + 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, +}; - constexpr GLfloat LIGHT_TOP = 1.0f; - constexpr GLfloat LIGHT_X = 0.8f; - constexpr GLfloat LIGHT_Z = 0.6f; - constexpr GLfloat LIGHT_BOT = 0.4f; +const std::array xFace2{ + 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, +}; -} +constexpr GLfloat LIGHT_TOP = 1.0f; +constexpr GLfloat LIGHT_X = 0.8f; +constexpr GLfloat LIGHT_Z = 0.6f; +constexpr GLfloat LIGHT_BOT = 0.4f; -ChunkMeshBuilder::ChunkMeshBuilder(ChunkSection& chunk, ChunkMeshCollection& mesh) -: m_pChunk (&chunk) -, m_pMeshes (&mesh) -{ } +} // namespace -struct AdjacentBlockPositions +ChunkMeshBuilder::ChunkMeshBuilder(ChunkSection &chunk, + ChunkMeshCollection &mesh) + : m_pChunk(&chunk) + , m_pMeshes(&mesh) { +} + +struct AdjacentBlockPositions { void update(int x, int y, int z) { - up = {x, y + 1, z}; - down = {x, y - 1, z}; - left = {x - 1, y, z}; - right = {x + 1, y, z}; - front = {x, y, z + 1}; - back = {x, y, z - 1}; + up = {x, y + 1, z}; + down = {x, y - 1, z}; + left = {x - 1, y, z}; + right = {x + 1, y, z}; + front = {x, y, z + 1}; + back = {x, y, z - 1}; } sf::Vector3i up; @@ -119,7 +85,7 @@ void ChunkMeshBuilder::buildMesh() for (int16_t i = 0; i < CHUNK_VOLUME; i++) { uint8_t x = i % CHUNK_SIZE; uint8_t y = i / (CHUNK_SIZE * CHUNK_SIZE); - uint8_t z = (i / CHUNK_SIZE) % CHUNK_SIZE; + uint8_t z = (i / CHUNK_SIZE) % CHUNK_SIZE; if (!shouldMakeLayer(y)) { continue; @@ -131,42 +97,44 @@ void ChunkMeshBuilder::buildMesh() sf::Vector3i position(x, y, z); setActiveMesh(block); - if (block == BlockId::Air) - { + if (block == BlockId::Air) { continue; } m_pBlockData = &block.getData(); - auto& data = *m_pBlockData; + auto &data = *m_pBlockData; - if (data.meshType == BlockMeshType::X) - { + if (data.meshType == BlockMeshType::X) { addXBlockToMesh(data.texTopCoord, position); continue; } - directions.update(x, y, z); - //Up/ Down + // Up/ Down if ((m_pChunk->getLocation().y != 0) || y != 0) - tryAddFaceToMesh(bottomFace, data.texBottomCoord, position, directions.down, LIGHT_BOT); - tryAddFaceToMesh(topFace, data.texTopCoord, position, directions.up, LIGHT_TOP); - - //Left/ Right - tryAddFaceToMesh(leftFace, data.texSideCoord, position, directions.left, LIGHT_X); - tryAddFaceToMesh(rightFace, data.texSideCoord, position, directions.right, LIGHT_X); - - //Front/ Back - tryAddFaceToMesh(frontFace, data.texSideCoord, position, directions.front, LIGHT_Z); - tryAddFaceToMesh(backFace, data.texSideCoord, position, directions.back, LIGHT_Z); + tryAddFaceToMesh(bottomFace, data.texBottomCoord, position, + directions.down, LIGHT_BOT); + tryAddFaceToMesh(topFace, data.texTopCoord, position, directions.up, + LIGHT_TOP); + + // Left/ Right + tryAddFaceToMesh(leftFace, data.texSideCoord, position, directions.left, + LIGHT_X); + tryAddFaceToMesh(rightFace, data.texSideCoord, position, + directions.right, LIGHT_X); + + // Front/ Back + tryAddFaceToMesh(frontFace, data.texSideCoord, position, + directions.front, LIGHT_Z); + tryAddFaceToMesh(backFace, data.texSideCoord, position, directions.back, + LIGHT_Z); } } void ChunkMeshBuilder::setActiveMesh(ChunkBlock block) { - switch (block.getData().shaderType) - { + switch (block.getData().shaderType) { case BlockShaderType::Chunk: m_pActiveMesh = &m_pMeshes->solidMesh; break; @@ -181,58 +149,45 @@ void ChunkMeshBuilder::setActiveMesh(ChunkBlock block) } } -void ChunkMeshBuilder::addXBlockToMesh(const sf::Vector2i& textureCoords, - const sf::Vector3i& blockPosition) +void ChunkMeshBuilder::addXBlockToMesh(const sf::Vector2i &textureCoords, + const sf::Vector3i &blockPosition) { faces++; - auto texCoords = BlockDatabase::get().textureAtlas.getTexture(textureCoords); - - m_pActiveMesh->addFace( xFace1, - texCoords, - m_pChunk->getLocation(), - blockPosition, - LIGHT_X); - - m_pActiveMesh->addFace( xFace2, - texCoords, - m_pChunk->getLocation(), - blockPosition, - LIGHT_X); -} + auto texCoords = + BlockDatabase::get().textureAtlas.getTexture(textureCoords); + m_pActiveMesh->addFace(xFace1, texCoords, m_pChunk->getLocation(), + blockPosition, LIGHT_X); + + m_pActiveMesh->addFace(xFace2, texCoords, m_pChunk->getLocation(), + blockPosition, LIGHT_X); +} -void ChunkMeshBuilder::tryAddFaceToMesh(const std::array& blockFace, - const sf::Vector2i& textureCoords, - const sf::Vector3i& blockPosition, - const sf::Vector3i& blockFacing, - GLfloat cardinalLight) +void ChunkMeshBuilder::tryAddFaceToMesh( + const std::array &blockFace, const sf::Vector2i &textureCoords, + const sf::Vector3i &blockPosition, const sf::Vector3i &blockFacing, + GLfloat cardinalLight) { - if (shouldMakeFace(blockFacing, *m_pBlockData)) - { + if (shouldMakeFace(blockFacing, *m_pBlockData)) { faces++; - auto texCoords = BlockDatabase::get().textureAtlas.getTexture(textureCoords); + auto texCoords = + BlockDatabase::get().textureAtlas.getTexture(textureCoords); - m_pActiveMesh->addFace( blockFace, - texCoords, - m_pChunk->getLocation(), - blockPosition, - cardinalLight); + m_pActiveMesh->addFace(blockFace, texCoords, m_pChunk->getLocation(), + blockPosition, cardinalLight); } } - -bool ChunkMeshBuilder::shouldMakeFace(const sf::Vector3i& adjBlock, - const BlockDataHolder& blockData) +bool ChunkMeshBuilder::shouldMakeFace(const sf::Vector3i &adjBlock, + const BlockDataHolder &blockData) { auto block = m_pChunk->getBlock(adjBlock.x, adjBlock.y, adjBlock.z); - auto& data = block.getData(); + auto &data = block.getData(); - if (block == BlockId::Air) - { + if (block == BlockId::Air) { return true; } - else if ((!data.isOpaque) && (data.id != m_pBlockData->id)) - { + else if ((!data.isOpaque) && (data.id != m_pBlockData->id)) { return true; } return false; @@ -240,22 +195,15 @@ bool ChunkMeshBuilder::shouldMakeFace(const sf::Vector3i& adjBlock, bool ChunkMeshBuilder::shouldMakeLayer(int y) { - auto adjIsSolid = [&](int dx, int dz) - { - const ChunkSection& sect = m_pChunk->getAdjacent(dx, dz); + auto adjIsSolid = [&](int dx, int dz) { + const ChunkSection § = m_pChunk->getAdjacent(dx, dz); return sect.getLayer(y).isAllSolid(); }; - return (!m_pChunk->getLayer(y ).isAllSolid()) || - (!m_pChunk->getLayer(y + 1).isAllSolid()) || - (!m_pChunk->getLayer(y - 1).isAllSolid()) || - - (!adjIsSolid( 1, 0)) || - (!adjIsSolid( 0, 1)) || - (!adjIsSolid(-1, 0)) || - (!adjIsSolid( 0, -1)); + return (!m_pChunk->getLayer(y).isAllSolid()) || + (!m_pChunk->getLayer(y + 1).isAllSolid()) || + (!m_pChunk->getLayer(y - 1).isAllSolid()) || + (!adjIsSolid(1, 0)) || (!adjIsSolid(0, 1)) || (!adjIsSolid(-1, 0)) || + (!adjIsSolid(0, -1)); } - - - diff --git a/Source/World/Chunk/ChunkMeshBuilder.h b/Source/World/Chunk/ChunkMeshBuilder.h index 951ef342..f6d247a3 100644 --- a/Source/World/Chunk/ChunkMeshBuilder.h +++ b/Source/World/Chunk/ChunkMeshBuilder.h @@ -1,9 +1,9 @@ #ifndef CHUNKMESHBUILDER_H_INCLUDED #define CHUNKMESHBUILDER_H_INCLUDED -#include -#include #include "../../glad/glad.h" +#include +#include #include "../Block/ChunkBlock.h" @@ -14,36 +14,34 @@ class BlockData; struct ChunkMeshCollection; struct BlockDataHolder; -class ChunkMeshBuilder -{ - public: - ChunkMeshBuilder(ChunkSection& chunk, ChunkMeshCollection& meshes); - - void buildMesh(); +class ChunkMeshBuilder { + public: + ChunkMeshBuilder(ChunkSection &chunk, ChunkMeshCollection &meshes); - private: - void setActiveMesh(ChunkBlock block); + void buildMesh(); - void addXBlockToMesh(const sf::Vector2i& textureCoords, - const sf::Vector3i& blockPosition); + private: + void setActiveMesh(ChunkBlock block); - void tryAddFaceToMesh(const std::array& blockFace, - const sf::Vector2i& textureCoords, - const sf::Vector3i& blockPosition, - const sf::Vector3i& blockFacing, - GLfloat cardinalLight); + void addXBlockToMesh(const sf::Vector2i &textureCoords, + const sf::Vector3i &blockPosition); - bool shouldMakeFace (const sf::Vector3i& blockPosition, - const BlockDataHolder& blockData); + void tryAddFaceToMesh(const std::array &blockFace, + const sf::Vector2i &textureCoords, + const sf::Vector3i &blockPosition, + const sf::Vector3i &blockFacing, + GLfloat cardinalLight); - bool shouldMakeLayer(int y); + bool shouldMakeFace(const sf::Vector3i &blockPosition, + const BlockDataHolder &blockData); - const ChunkBlock* m_pBlockPtr = nullptr; - ChunkSection* m_pChunk = nullptr; - ChunkMeshCollection* m_pMeshes = nullptr; - ChunkMesh* m_pActiveMesh = nullptr; - const BlockDataHolder* m_pBlockData = nullptr; + bool shouldMakeLayer(int y); + const ChunkBlock *m_pBlockPtr = nullptr; + ChunkSection *m_pChunk = nullptr; + ChunkMeshCollection *m_pMeshes = nullptr; + ChunkMesh *m_pActiveMesh = nullptr; + const BlockDataHolder *m_pBlockData = nullptr; }; #endif // CHUNKMESHBUILDER_H_INCLUDED diff --git a/Source/World/Chunk/ChunkSection.cpp b/Source/World/Chunk/ChunkSection.cpp index 227d1e60..a54af169 100644 --- a/Source/World/Chunk/ChunkSection.cpp +++ b/Source/World/Chunk/ChunkSection.cpp @@ -5,24 +5,22 @@ #include "../World.h" #include "ChunkMeshBuilder.h" +#include #include #include -#include -ChunkSection::ChunkSection(const sf::Vector3i& location, World& world) -: m_aabb ({CHUNK_SIZE, CHUNK_SIZE, CHUNK_SIZE}) -, m_location (location) -, m_pWorld (&world) +ChunkSection::ChunkSection(const sf::Vector3i &location, World &world) + : m_aabb({CHUNK_SIZE, CHUNK_SIZE, CHUNK_SIZE}) + , m_location(location) + , m_pWorld(&world) { - m_aabb.update({location.x * CHUNK_SIZE, location.y * CHUNK_SIZE, location.z * CHUNK_SIZE}); + m_aabb.update({location.x * CHUNK_SIZE, location.y * CHUNK_SIZE, + location.z * CHUNK_SIZE}); } void ChunkSection::setBlock(int x, int y, int z, ChunkBlock block) { - if (outOfBounds(x) || - outOfBounds(y) || - outOfBounds(z)) - { + if (outOfBounds(x) || outOfBounds(y) || outOfBounds(z)) { auto location = toWorldPosition(x, y, z); m_pWorld->setBlock(location.x, location.y, location.z, block); return; @@ -35,10 +33,7 @@ void ChunkSection::setBlock(int x, int y, int z, ChunkBlock block) ChunkBlock ChunkSection::getBlock(int x, int y, int z) const { - if (outOfBounds(x) || - outOfBounds(y) || - outOfBounds(z)) - { + if (outOfBounds(x) || outOfBounds(y) || outOfBounds(z)) { auto location = toWorldPosition(x, y, z); return m_pWorld->getBlock(location.x, location.y, location.z); } @@ -61,15 +56,10 @@ bool ChunkSection::hasBuffered() const return m_hasBufferedMesh; } - sf::Vector3i ChunkSection::toWorldPosition(int x, int y, int z) const { - return - { - m_location.x * CHUNK_SIZE + x, - m_location.y * CHUNK_SIZE + y, - m_location.z * CHUNK_SIZE + z - }; + return {m_location.x * CHUNK_SIZE + x, m_location.y * CHUNK_SIZE + y, + m_location.z * CHUNK_SIZE + z}; } void ChunkSection::makeMesh() @@ -87,34 +77,28 @@ void ChunkSection::bufferMesh() m_hasBufferedMesh = true; } -const ChunkSection::Layer& ChunkSection::getLayer(int y) const +const ChunkSection::Layer &ChunkSection::getLayer(int y) const { - if (y == -1) - { - return - m_pWorld->getChunkManager () - .getChunk (m_location.x, m_location.z) - .getSection (m_location.y - 1) - .getLayer (CHUNK_SIZE - 1); + if (y == -1) { + return m_pWorld->getChunkManager() + .getChunk(m_location.x, m_location.z) + .getSection(m_location.y - 1) + .getLayer(CHUNK_SIZE - 1); } - else if (y == CHUNK_SIZE) - { - return - m_pWorld->getChunkManager () - .getChunk (m_location.x, m_location.z) - .getSection (m_location.y + 1) - .getLayer (0); + else if (y == CHUNK_SIZE) { + return m_pWorld->getChunkManager() + .getChunk(m_location.x, m_location.z) + .getSection(m_location.y + 1) + .getLayer(0); } - else - { + else { return m_layers[y]; } } void ChunkSection::deleteMeshes() { - if (m_hasMesh) - { + if (m_hasMesh) { m_hasBufferedMesh = false; m_hasMesh = false; m_meshes.solidMesh.deleteData(); @@ -123,25 +107,22 @@ void ChunkSection::deleteMeshes() } } - -ChunkSection& ChunkSection::getAdjacent(int dx, int dz) +ChunkSection &ChunkSection::getAdjacent(int dx, int dz) { int newX = m_location.x + dx; int newZ = m_location.z + dz; - return m_pWorld->getChunkManager().getChunk(newX, newZ).getSection(m_location.y); + return m_pWorld->getChunkManager() + .getChunk(newX, newZ) + .getSection(m_location.y); } bool ChunkSection::outOfBounds(int value) { - return value >= CHUNK_SIZE || - value < 0; + return value >= CHUNK_SIZE || value < 0; } int ChunkSection::getIndex(int x, int y, int z) { - return y * - CHUNK_AREA + z * - CHUNK_SIZE + x; + return y * CHUNK_AREA + z * CHUNK_SIZE + x; } - diff --git a/Source/World/Chunk/ChunkSection.h b/Source/World/Chunk/ChunkSection.h index 868b6638..3de9f470 100644 --- a/Source/World/Chunk/ChunkSection.h +++ b/Source/World/Chunk/ChunkSection.h @@ -1,11 +1,11 @@ #ifndef CHUNKSECTION_H_INCLUDED #define CHUNKSECTION_H_INCLUDED -#include #include +#include -#include "../WorldConstants.h" #include "../Block/ChunkBlock.h" +#include "../WorldConstants.h" #include "ChunkMesh.h" #include "IChunk.h" @@ -14,74 +14,76 @@ class World; -class ChunkSection : public IChunk -{ +class ChunkSection : public IChunk { friend class Chunk; - class Layer - { - public: - void update(ChunkBlock c) - { - if (c.getData().isOpaque) - { - m_solidBlockCount--; - } - else - { - m_solidBlockCount++; - } + class Layer { + public: + void update(ChunkBlock c) + { + if (c.getData().isOpaque) { + m_solidBlockCount--; } - - bool isAllSolid() const - { - return m_solidBlockCount == CHUNK_AREA; + else { + m_solidBlockCount++; } + } + + bool isAllSolid() const + { + return m_solidBlockCount == CHUNK_AREA; + } - private: - int m_solidBlockCount = 0; + private: + int m_solidBlockCount = 0; }; - public: - ChunkSection(const sf::Vector3i& position, World& world); + public: + ChunkSection(const sf::Vector3i &position, World &world); - void setBlock (int x, int y, int z, ChunkBlock block) override; - ChunkBlock getBlock (int x, int y, int z) const override; + void setBlock(int x, int y, int z, ChunkBlock block) override; + ChunkBlock getBlock(int x, int y, int z) const override; - const sf::Vector3i getLocation() const ; + const sf::Vector3i getLocation() const; - bool hasMesh () const ; - bool hasBuffered() const ; + bool hasMesh() const; + bool hasBuffered() const; - void makeMesh(); - void bufferMesh(); + void makeMesh(); + void bufferMesh(); - const Layer& getLayer (int y) const; - ChunkSection& getAdjacent(int dx, int dz); + const Layer &getLayer(int y) const; + ChunkSection &getAdjacent(int dx, int dz); - const ChunkMeshCollection& getMeshes() const { return m_meshes; } + const ChunkMeshCollection &getMeshes() const + { + return m_meshes; + } - void deleteMeshes(); + void deleteMeshes(); - const ChunkBlock* begin() { return &m_blocks[0]; } + const ChunkBlock *begin() + { + return &m_blocks[0]; + } - private: - sf::Vector3i toWorldPosition (int x, int y, int z) const; + private: + sf::Vector3i toWorldPosition(int x, int y, int z) const; - static bool outOfBounds (int value); - static int getIndex (int x, int y, int z); + static bool outOfBounds(int value); + static int getIndex(int x, int y, int z); - std::array m_blocks; - std::array m_layers; + std::array m_blocks; + std::array m_layers; - ChunkMeshCollection m_meshes; - AABB m_aabb; - sf::Vector3i m_location; + ChunkMeshCollection m_meshes; + AABB m_aabb; + sf::Vector3i m_location; - World* m_pWorld; + World *m_pWorld; - bool m_hasMesh = false; - bool m_hasBufferedMesh = false; + bool m_hasMesh = false; + bool m_hasBufferedMesh = false; }; #endif // CHUNKSECTION_H_INCLUDED diff --git a/Source/World/Chunk/IChunk.h b/Source/World/Chunk/IChunk.h index d5093281..d1431638 100644 --- a/Source/World/Chunk/IChunk.h +++ b/Source/World/Chunk/IChunk.h @@ -1,12 +1,11 @@ #ifndef ICHUNK_H_INCLUDED #define ICHUNK_H_INCLUDED -struct IChunk -{ +struct IChunk { virtual ~IChunk() = default; - virtual ChunkBlock getBlock (int x, int y, int z) const = 0; - virtual void setBlock (int x, int y, int z, ChunkBlock block) = 0; + virtual ChunkBlock getBlock(int x, int y, int z) const = 0; + virtual void setBlock(int x, int y, int z, ChunkBlock block) = 0; }; #endif // ICHUNK_H_INCLUDED diff --git a/Source/World/Event/IWorldEvent.h b/Source/World/Event/IWorldEvent.h index f618e0da..62e159cb 100644 --- a/Source/World/Event/IWorldEvent.h +++ b/Source/World/Event/IWorldEvent.h @@ -3,10 +3,9 @@ class World; -struct IWorldEvent -{ - virtual ~IWorldEvent() = default; - virtual void handle(World& world) = 0; +struct IWorldEvent { + virtual ~IWorldEvent() = default; + virtual void handle(World &world) = 0; }; #endif // IWORLDEVENT_H_INCLUDED diff --git a/Source/World/Event/PlayerDigEvent.cpp b/Source/World/Event/PlayerDigEvent.cpp index 1bad2e61..83cbd061 100644 --- a/Source/World/Event/PlayerDigEvent.cpp +++ b/Source/World/Event/PlayerDigEvent.cpp @@ -1,70 +1,67 @@ #include "PlayerDigEvent.h" -#include "../World.h" #include "../../Item/Material.h" #include "../../Player/Player.h" +#include "../World.h" -PlayerDigEvent::PlayerDigEvent(sf::Mouse::Button button, const glm::vec3& location, Player& player) -: m_buttonPress (button) -, m_digSpot (location) -, m_pPlayer (&player) -{ } +PlayerDigEvent::PlayerDigEvent(sf::Mouse::Button button, + const glm::vec3 &location, Player &player) + : m_buttonPress(button) + , m_digSpot(location) + , m_pPlayer(&player) +{ +} -void PlayerDigEvent::handle(World& world) +void PlayerDigEvent::handle(World &world) { - auto chunkLocation = World::getChunkXZ( - static_cast(m_digSpot.x), - static_cast(m_digSpot.z) - ); + auto chunkLocation = World::getChunkXZ(static_cast(m_digSpot.x), + static_cast(m_digSpot.z)); - if (world.getChunkManager().chunkLoadedAt(chunkLocation.x, chunkLocation.z)) - { + if (world.getChunkManager().chunkLoadedAt(chunkLocation.x, + chunkLocation.z)) { dig(world); } } -void PlayerDigEvent::dig(World& world) +void PlayerDigEvent::dig(World &world) { - int x = static_cast(m_digSpot.x); - int y = static_cast(m_digSpot.y); - int z = static_cast(m_digSpot.z); - switch (m_buttonPress) - { - case sf::Mouse::Button::Left:{ + int x = static_cast(m_digSpot.x); + int y = static_cast(m_digSpot.y); + int z = static_cast(m_digSpot.z); + switch (m_buttonPress) { + case sf::Mouse::Button::Left: { auto block = world.getBlock(x, y, z); - const auto& material = Material::toMaterial((BlockId)block.id); + const auto &material = Material::toMaterial((BlockId)block.id); m_pPlayer->addItem(material); -/* - auto r = 1; - for (int y = -r; y < r; y++) - for (int x = -r; x < r;x++) - for (int z = -r; z < r; z++) - { - int newX = m_digSpot.x + x; - int newY = m_digSpot.y + y; - int newZ = m_digSpot.z + z; - world.updateChunk (newX, newY, newZ); - world.setBlock (newX, newY, newZ, 0); -*/ - world.updateChunk (x, y, z); - world.setBlock (x, y, z, 0); + /* + auto r = 1; + for (int y = -r; y < r; y++) + for (int x = -r; x < r;x++) + for (int z = -r; z < r; z++) + { + int newX = m_digSpot.x + x; + int newY = m_digSpot.y + y; + int newZ = m_digSpot.z + z; + world.updateChunk (newX, newY, newZ); + world.setBlock (newX, newY, newZ, 0); + */ + world.updateChunk(x, y, z); + world.setBlock(x, y, z, 0); //} break; } - case sf::Mouse::Button::Right:{ - auto& stack = m_pPlayer->getHeldItems(); - auto& material = stack.getMaterial(); + case sf::Mouse::Button::Right: { + auto &stack = m_pPlayer->getHeldItems(); + auto &material = stack.getMaterial(); - if (material.id == Material::ID::Nothing) - { + if (material.id == Material::ID::Nothing) { return; } - else - { + else { stack.remove(); - world.updateChunk (x, y, z); - world.setBlock (x, y, z, material.toBlockID()); + world.updateChunk(x, y, z); + world.setBlock(x, y, z, material.toBlockID()); break; } } diff --git a/Source/World/Event/PlayerDigEvent.h b/Source/World/Event/PlayerDigEvent.h index 1ee12cc1..d49b03b0 100644 --- a/Source/World/Event/PlayerDigEvent.h +++ b/Source/World/Event/PlayerDigEvent.h @@ -3,25 +3,24 @@ #include -#include "IWorldEvent.h" #include "../../Maths/glm.h" +#include "IWorldEvent.h" class Player; -class PlayerDigEvent : public IWorldEvent -{ - public: - PlayerDigEvent(sf::Mouse::Button button, const glm::vec3& location, Player& player); - - void handle(World& world); +class PlayerDigEvent : public IWorldEvent { + public: + PlayerDigEvent(sf::Mouse::Button button, const glm::vec3 &location, + Player &player); - private: - void dig(World& world); + void handle(World &world); - sf::Mouse::Button m_buttonPress; - glm::vec3 m_digSpot; - Player* m_pPlayer; + private: + void dig(World &world); + sf::Mouse::Button m_buttonPress; + glm::vec3 m_digSpot; + Player *m_pPlayer; }; #endif // PLAYERDIGEVENT_H_INCLUDED diff --git a/Source/World/Generation/Biome/Biome.cpp b/Source/World/Generation/Biome/Biome.cpp index 3a13eb30..b57a2302 100644 --- a/Source/World/Generation/Biome/Biome.cpp +++ b/Source/World/Generation/Biome/Biome.cpp @@ -1,19 +1,19 @@ #include "Biome.h" -Biome::Biome(const NoiseParameters& parameters, int treeFreq, int plantFreq, int seed) -: m_heightGenerator (seed) -, m_treeFreq (treeFreq) -, m_plantFreq (plantFreq) +Biome::Biome(const NoiseParameters ¶meters, int treeFreq, int plantFreq, + int seed) + : m_heightGenerator(seed) + , m_treeFreq(treeFreq) + , m_plantFreq(plantFreq) { m_heightGenerator.setParameters(parameters); } -ChunkBlock Biome::getBeachBlock(Rand& rand) const +ChunkBlock Biome::getBeachBlock(Rand &rand) const { return BlockId::Sand; } - int Biome::getHeight(int x, int z, int chunkX, int chunkZ) const { return m_heightGenerator.getHeight(x, z, chunkX, chunkZ); @@ -24,8 +24,7 @@ int Biome::getTreeFrequency() const noexcept return m_treeFreq; } -int Biome::getPlantFrequency () const noexcept +int Biome::getPlantFrequency() const noexcept { return m_plantFreq; } - diff --git a/Source/World/Generation/Biome/Biome.h b/Source/World/Generation/Biome/Biome.h index fb2f1001..0e6b489f 100644 --- a/Source/World/Generation/Biome/Biome.h +++ b/Source/World/Generation/Biome/Biome.h @@ -9,30 +9,30 @@ using Rand = Random; class Chunk; -struct Biome -{ - public: - Biome(const NoiseParameters& parameters, int treeFreq, int plantFreq, int seed); - virtual ~Biome() = default; - - virtual ChunkBlock getPlant (Rand& rand) const = 0; - virtual ChunkBlock getTopBlock (Rand& rand) const = 0; - virtual ChunkBlock getUnderWaterBlock (Rand& rand) const = 0; - virtual ChunkBlock getBeachBlock (Rand& rand) const; - virtual void makeTree (Rand& rand, Chunk& chunk, int x, int y, int z) const = 0; - - - int getHeight(int x, int z, int chunkX, int chunkZ) const; - int getTreeFrequency () const noexcept; - int getPlantFrequency () const noexcept; - - protected: - virtual NoiseParameters getNoiseParameters() = 0; - - private: - NoiseGenerator m_heightGenerator; - int m_treeFreq; - int m_plantFreq; +struct Biome { + public: + Biome(const NoiseParameters ¶meters, int treeFreq, int plantFreq, + int seed); + virtual ~Biome() = default; + + virtual ChunkBlock getPlant(Rand &rand) const = 0; + virtual ChunkBlock getTopBlock(Rand &rand) const = 0; + virtual ChunkBlock getUnderWaterBlock(Rand &rand) const = 0; + virtual ChunkBlock getBeachBlock(Rand &rand) const; + virtual void makeTree(Rand &rand, Chunk &chunk, int x, int y, + int z) const = 0; + + int getHeight(int x, int z, int chunkX, int chunkZ) const; + int getTreeFrequency() const noexcept; + int getPlantFrequency() const noexcept; + + protected: + virtual NoiseParameters getNoiseParameters() = 0; + + private: + NoiseGenerator m_heightGenerator; + int m_treeFreq; + int m_plantFreq; }; #endif // BIOME_H_INCLUDED diff --git a/Source/World/Generation/Biome/DesertBiome.cpp b/Source/World/Generation/Biome/DesertBiome.cpp index 389e792f..12feb3ee 100644 --- a/Source/World/Generation/Biome/DesertBiome.cpp +++ b/Source/World/Generation/Biome/DesertBiome.cpp @@ -1,40 +1,34 @@ #include "DesertBiome.h" -#include "../Structures/TreeGenerator.h" #include "../../WorldConstants.h" +#include "../Structures/TreeGenerator.h" DesertBiome::DesertBiome(int seed) -: Biome (getNoiseParameters(), 1350, 500, seed) + : Biome(getNoiseParameters(), 1350, 500, seed) { - } -ChunkBlock DesertBiome::getTopBlock(Rand& rand) const +ChunkBlock DesertBiome::getTopBlock(Rand &rand) const { return BlockId::Sand; } -ChunkBlock DesertBiome::getUnderWaterBlock(Rand& rand) const +ChunkBlock DesertBiome::getUnderWaterBlock(Rand &rand) const { return BlockId::Sand; } - -void DesertBiome::makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const +void DesertBiome::makeTree(Rand &rand, Chunk &chunk, int x, int y, int z) const { - if (y < WATER_LEVEL + 15) - { - if (rand.intInRange(0, 100) > 75) - { + if (y < WATER_LEVEL + 15) { + if (rand.intInRange(0, 100) > 75) { makePalmTree(chunk, rand, x, y, z); } - else - { + else { makeCactus(chunk, rand, x, y, z); } } - else - { + else { makeCactus(chunk, rand, x, y, z); } } @@ -42,17 +36,16 @@ void DesertBiome::makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const NoiseParameters DesertBiome::getNoiseParameters() { NoiseParameters heightParams; - heightParams.octaves = 9; - heightParams.amplitude = 80; - heightParams.smoothness = 335; - heightParams.heightOffset = -7; + heightParams.octaves = 9; + heightParams.amplitude = 80; + heightParams.smoothness = 335; + heightParams.heightOffset = -7; heightParams.roughness = 0.56; - return heightParams; } -ChunkBlock DesertBiome::getPlant(Rand& rand) const +ChunkBlock DesertBiome::getPlant(Rand &rand) const { return BlockId::DeadShrub; } diff --git a/Source/World/Generation/Biome/DesertBiome.h b/Source/World/Generation/Biome/DesertBiome.h index d40958fe..d29ede7a 100644 --- a/Source/World/Generation/Biome/DesertBiome.h +++ b/Source/World/Generation/Biome/DesertBiome.h @@ -3,19 +3,17 @@ #include "Biome.h" -class DesertBiome : public Biome -{ - public: - DesertBiome(int seed) ; +class DesertBiome : public Biome { + public: + DesertBiome(int seed); - ChunkBlock getPlant (Rand& rand) const override; - ChunkBlock getTopBlock (Rand& rand) const override; - ChunkBlock getUnderWaterBlock (Rand& rand) const override; - void makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const override; + ChunkBlock getPlant(Rand &rand) const override; + ChunkBlock getTopBlock(Rand &rand) const override; + ChunkBlock getUnderWaterBlock(Rand &rand) const override; + void makeTree(Rand &rand, Chunk &chunk, int x, int y, int z) const override; - - private: - NoiseParameters getNoiseParameters() override; + private: + NoiseParameters getNoiseParameters() override; }; #endif // DESERTBIOME_H_INCLUDED diff --git a/Source/World/Generation/Biome/GrasslandBiome.cpp b/Source/World/Generation/Biome/GrasslandBiome.cpp index 97b24b9d..53c3ef1e 100644 --- a/Source/World/Generation/Biome/GrasslandBiome.cpp +++ b/Source/World/Generation/Biome/GrasslandBiome.cpp @@ -3,31 +3,27 @@ #include "../Structures/TreeGenerator.h" GrasslandBiome::GrasslandBiome(int seed) -: Biome (getNoiseParameters(), 1000, 20, seed) + : Biome(getNoiseParameters(), 1000, 20, seed) { - } -ChunkBlock GrasslandBiome::getTopBlock(Rand& rand) const +ChunkBlock GrasslandBiome::getTopBlock(Rand &rand) const { return BlockId::Grass; } -ChunkBlock GrasslandBiome::getUnderWaterBlock(Rand& rand) const +ChunkBlock GrasslandBiome::getUnderWaterBlock(Rand &rand) const { - return rand.intInRange(0, 10) > 8 ? - BlockId::Dirt : - BlockId::Sand; + return rand.intInRange(0, 10) > 8 ? BlockId::Dirt : BlockId::Sand; } -ChunkBlock GrasslandBiome::getBeachBlock (Rand& rand) const +ChunkBlock GrasslandBiome::getBeachBlock(Rand &rand) const { - return rand.intInRange(0, 10) > 2 ? - BlockId::Grass : - BlockId::Dirt; + return rand.intInRange(0, 10) > 2 ? BlockId::Grass : BlockId::Dirt; } -void GrasslandBiome::makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const +void GrasslandBiome::makeTree(Rand &rand, Chunk &chunk, int x, int y, + int z) const { makeOakTree(chunk, rand, x, y, z); } @@ -35,18 +31,16 @@ void GrasslandBiome::makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) con NoiseParameters GrasslandBiome::getNoiseParameters() { NoiseParameters heightParams; - heightParams.octaves = 9; - heightParams.amplitude = 85; - heightParams.smoothness = 235; - heightParams.heightOffset = -20; - heightParams.roughness = 0.51; + heightParams.octaves = 9; + heightParams.amplitude = 85; + heightParams.smoothness = 235; + heightParams.heightOffset = -20; + heightParams.roughness = 0.51; return heightParams; } -ChunkBlock GrasslandBiome::getPlant(Rand& rand) const +ChunkBlock GrasslandBiome::getPlant(Rand &rand) const { - return rand.intInRange(0, 10) > 6 ? - BlockId::Rose : - BlockId::TallGrass; + return rand.intInRange(0, 10) > 6 ? BlockId::Rose : BlockId::TallGrass; } diff --git a/Source/World/Generation/Biome/GrasslandBiome.h b/Source/World/Generation/Biome/GrasslandBiome.h index 87267c39..c9aacfac 100644 --- a/Source/World/Generation/Biome/GrasslandBiome.h +++ b/Source/World/Generation/Biome/GrasslandBiome.h @@ -3,20 +3,18 @@ #include "Biome.h" -class GrasslandBiome : public Biome -{ - public: - GrasslandBiome(int seed); +class GrasslandBiome : public Biome { + public: + GrasslandBiome(int seed); - ChunkBlock getBeachBlock (Rand& rand) const override; - ChunkBlock getPlant (Rand& rand) const override; - ChunkBlock getTopBlock (Rand& rand) const override; - ChunkBlock getUnderWaterBlock (Rand& rand) const override; - void makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const override; + ChunkBlock getBeachBlock(Rand &rand) const override; + ChunkBlock getPlant(Rand &rand) const override; + ChunkBlock getTopBlock(Rand &rand) const override; + ChunkBlock getUnderWaterBlock(Rand &rand) const override; + void makeTree(Rand &rand, Chunk &chunk, int x, int y, int z) const override; - - private: - NoiseParameters getNoiseParameters() override; + private: + NoiseParameters getNoiseParameters() override; }; #endif // GRASSLANDBIOME_H_INCLUDED diff --git a/Source/World/Generation/Biome/LightForest.cpp b/Source/World/Generation/Biome/LightForest.cpp index 6c03c4a0..17e4906a 100644 --- a/Source/World/Generation/Biome/LightForest.cpp +++ b/Source/World/Generation/Biome/LightForest.cpp @@ -3,24 +3,21 @@ #include "../Structures/TreeGenerator.h" LightForest::LightForest(int seed) -: Biome (getNoiseParameters(), 60, 80, seed) + : Biome(getNoiseParameters(), 60, 80, seed) { - } -ChunkBlock LightForest::getTopBlock(Rand& rand) const +ChunkBlock LightForest::getTopBlock(Rand &rand) const { return BlockId::Grass; } -ChunkBlock LightForest::getUnderWaterBlock(Rand& rand) const +ChunkBlock LightForest::getUnderWaterBlock(Rand &rand) const { - return rand.intInRange(0, 10) > 9 ? - BlockId::Sand : - BlockId::Dirt; + return rand.intInRange(0, 10) > 9 ? BlockId::Sand : BlockId::Dirt; } -void LightForest::makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const +void LightForest::makeTree(Rand &rand, Chunk &chunk, int x, int y, int z) const { makeOakTree(chunk, rand, x, y, z); } @@ -28,18 +25,16 @@ void LightForest::makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const NoiseParameters LightForest::getNoiseParameters() { NoiseParameters heightParams; - heightParams.octaves = 5; - heightParams.amplitude = 100; - heightParams.smoothness = 195;//195 - heightParams.heightOffset = -32; - heightParams.roughness = 0.52; + heightParams.octaves = 5; + heightParams.amplitude = 100; + heightParams.smoothness = 195; // 195 + heightParams.heightOffset = -32; + heightParams.roughness = 0.52; return heightParams; } -ChunkBlock LightForest::getPlant(Rand& rand) const +ChunkBlock LightForest::getPlant(Rand &rand) const { - return rand.intInRange(0, 10) > 8 ? - BlockId::Rose : - BlockId::TallGrass; + return rand.intInRange(0, 10) > 8 ? BlockId::Rose : BlockId::TallGrass; } diff --git a/Source/World/Generation/Biome/LightForest.h b/Source/World/Generation/Biome/LightForest.h index 53b28cd5..ab2227a1 100644 --- a/Source/World/Generation/Biome/LightForest.h +++ b/Source/World/Generation/Biome/LightForest.h @@ -3,19 +3,17 @@ #include "Biome.h" -class LightForest : public Biome -{ - public: - LightForest(int seed); +class LightForest : public Biome { + public: + LightForest(int seed); - ChunkBlock getPlant (Rand& rand) const override; - ChunkBlock getTopBlock (Rand& rand) const override; - ChunkBlock getUnderWaterBlock (Rand& rand) const override; - void makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const override; + ChunkBlock getPlant(Rand &rand) const override; + ChunkBlock getTopBlock(Rand &rand) const override; + ChunkBlock getUnderWaterBlock(Rand &rand) const override; + void makeTree(Rand &rand, Chunk &chunk, int x, int y, int z) const override; - - private: - NoiseParameters getNoiseParameters() override; + private: + NoiseParameters getNoiseParameters() override; }; #endif // LIGHTFOREST_H_INCLUDED diff --git a/Source/World/Generation/Biome/OceanBiome.cpp b/Source/World/Generation/Biome/OceanBiome.cpp index fe78a70b..5cb9725b 100644 --- a/Source/World/Generation/Biome/OceanBiome.cpp +++ b/Source/World/Generation/Biome/OceanBiome.cpp @@ -3,43 +3,39 @@ #include "../Structures/TreeGenerator.h" OceanBiome::OceanBiome(int seed) -: Biome (getNoiseParameters(), 50, 100, seed) + : Biome(getNoiseParameters(), 50, 100, seed) { - } -ChunkBlock OceanBiome::getTopBlock(Rand& rand) const +ChunkBlock OceanBiome::getTopBlock(Rand &rand) const { return BlockId::Grass; } -ChunkBlock OceanBiome::getUnderWaterBlock(Rand& rand) const +ChunkBlock OceanBiome::getUnderWaterBlock(Rand &rand) const { return BlockId::Sand; } -void OceanBiome::makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const +void OceanBiome::makeTree(Rand &rand, Chunk &chunk, int x, int y, int z) const { - rand.intInRange(0, 5) < 3 ? - makePalmTree(chunk, rand, x, y, z) : - makeOakTree (chunk, rand, x, y, z); + rand.intInRange(0, 5) < 3 ? makePalmTree(chunk, rand, x, y, z) + : makeOakTree(chunk, rand, x, y, z); } NoiseParameters OceanBiome::getNoiseParameters() { NoiseParameters heightParams; - heightParams.octaves = 7; - heightParams.amplitude = 43; - heightParams.smoothness = 55; - heightParams.heightOffset = 0; - heightParams.roughness = 0.50; + heightParams.octaves = 7; + heightParams.amplitude = 43; + heightParams.smoothness = 55; + heightParams.heightOffset = 0; + heightParams.roughness = 0.50; return heightParams; } -ChunkBlock OceanBiome::getPlant(Rand& rand) const +ChunkBlock OceanBiome::getPlant(Rand &rand) const { - return rand.intInRange(0, 10) > 6 ? - BlockId::Rose : - BlockId::TallGrass; + return rand.intInRange(0, 10) > 6 ? BlockId::Rose : BlockId::TallGrass; } diff --git a/Source/World/Generation/Biome/OceanBiome.h b/Source/World/Generation/Biome/OceanBiome.h index 7686de61..7e330714 100644 --- a/Source/World/Generation/Biome/OceanBiome.h +++ b/Source/World/Generation/Biome/OceanBiome.h @@ -3,19 +3,17 @@ #include "Biome.h" -class OceanBiome : public Biome -{ - public: - OceanBiome(int seed); +class OceanBiome : public Biome { + public: + OceanBiome(int seed); - ChunkBlock getPlant (Rand& rand) const override; - ChunkBlock getTopBlock (Rand& rand) const override; - ChunkBlock getUnderWaterBlock (Rand& rand) const override; - void makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const override; + ChunkBlock getPlant(Rand &rand) const override; + ChunkBlock getTopBlock(Rand &rand) const override; + ChunkBlock getUnderWaterBlock(Rand &rand) const override; + void makeTree(Rand &rand, Chunk &chunk, int x, int y, int z) const override; - - private: - NoiseParameters getNoiseParameters() override; + private: + NoiseParameters getNoiseParameters() override; }; #endif // OCEANBIOME_H_INCLUDED diff --git a/Source/World/Generation/Biome/TemperateForestBiome.cpp b/Source/World/Generation/Biome/TemperateForestBiome.cpp index d76da214..25bd2bd8 100644 --- a/Source/World/Generation/Biome/TemperateForestBiome.cpp +++ b/Source/World/Generation/Biome/TemperateForestBiome.cpp @@ -3,26 +3,22 @@ #include "../Structures/TreeGenerator.h" TemperateForestBiome::TemperateForestBiome(int seed) -: Biome (getNoiseParameters(), 55, 75, seed) + : Biome(getNoiseParameters(), 55, 75, seed) { - } -ChunkBlock TemperateForestBiome::getTopBlock(Rand& rand) const +ChunkBlock TemperateForestBiome::getTopBlock(Rand &rand) const { - return rand.intInRange(0, 10) < 8 ? - BlockId::Grass : - BlockId::Dirt; + return rand.intInRange(0, 10) < 8 ? BlockId::Grass : BlockId::Dirt; } -ChunkBlock TemperateForestBiome::getUnderWaterBlock(Rand& rand) const +ChunkBlock TemperateForestBiome::getUnderWaterBlock(Rand &rand) const { - return rand.intInRange(0, 10) > 8 ? - BlockId::Dirt : - BlockId::Sand; + return rand.intInRange(0, 10) > 8 ? BlockId::Dirt : BlockId::Sand; } -void TemperateForestBiome::makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const +void TemperateForestBiome::makeTree(Rand &rand, Chunk &chunk, int x, int y, + int z) const { makeOakTree(chunk, rand, x, y, z); } @@ -30,16 +26,16 @@ void TemperateForestBiome::makeTree(Rand& rand, Chunk& chunk, int x, int y, int NoiseParameters TemperateForestBiome::getNoiseParameters() { NoiseParameters heightParams; - heightParams.octaves = 5; - heightParams.amplitude = 100; - heightParams.smoothness = 195; - heightParams.heightOffset = -30; - heightParams.roughness = 0.52; + heightParams.octaves = 5; + heightParams.amplitude = 100; + heightParams.smoothness = 195; + heightParams.heightOffset = -30; + heightParams.roughness = 0.52; return heightParams; } -ChunkBlock TemperateForestBiome::getPlant(Rand& rand) const +ChunkBlock TemperateForestBiome::getPlant(Rand &rand) const { return BlockId::TallGrass; } diff --git a/Source/World/Generation/Biome/TemperateForestBiome.h b/Source/World/Generation/Biome/TemperateForestBiome.h index 668701fe..04acd1e8 100644 --- a/Source/World/Generation/Biome/TemperateForestBiome.h +++ b/Source/World/Generation/Biome/TemperateForestBiome.h @@ -3,19 +3,17 @@ #include "Biome.h" -class TemperateForestBiome : public Biome -{ - public: - TemperateForestBiome(int seed); +class TemperateForestBiome : public Biome { + public: + TemperateForestBiome(int seed); - ChunkBlock getPlant (Rand& rand) const override; - ChunkBlock getTopBlock (Rand& rand) const override; - ChunkBlock getUnderWaterBlock (Rand& rand) const override; - void makeTree(Rand& rand, Chunk& chunk, int x, int y, int z) const override; + ChunkBlock getPlant(Rand &rand) const override; + ChunkBlock getTopBlock(Rand &rand) const override; + ChunkBlock getUnderWaterBlock(Rand &rand) const override; + void makeTree(Rand &rand, Chunk &chunk, int x, int y, int z) const override; - - private: - NoiseParameters getNoiseParameters() ; + private: + NoiseParameters getNoiseParameters(); }; #endif // TEMPERATEFORESTBIOME_H_INCLUDED diff --git a/Source/World/Generation/Structures/StructureBuilder.cpp b/Source/World/Generation/Structures/StructureBuilder.cpp index 0d004b92..99561b10 100644 --- a/Source/World/Generation/Structures/StructureBuilder.cpp +++ b/Source/World/Generation/Structures/StructureBuilder.cpp @@ -4,51 +4,47 @@ #include -void StructureBuilder::build(Chunk& chunk) +void StructureBuilder::build(Chunk &chunk) { - for (auto& block : m_blocks) - { + for (auto &block : m_blocks) { chunk.setBlock(block.x, block.y, block.z, block.id); } } -void StructureBuilder::makeColumn(int x, int z, int yStart, int height, BlockId block) +void StructureBuilder::makeColumn(int x, int z, int yStart, int height, + BlockId block) { - for (int y = yStart; y < yStart + height; y++) - { + for (int y = yStart; y < yStart + height; y++) { addBlock(x, y, z, block); } } -void StructureBuilder::makeRowX(int xStart, int xEnd, int y, int z, BlockId block) +void StructureBuilder::makeRowX(int xStart, int xEnd, int y, int z, + BlockId block) { - for (int x = xStart; x <= xEnd; ++x) - { + for (int x = xStart; x <= xEnd; ++x) { addBlock(x, y, z, block); } } -void StructureBuilder::makeRowZ(int zStart, int zEnd, int x, int y, BlockId block) +void StructureBuilder::makeRowZ(int zStart, int zEnd, int x, int y, + BlockId block) { - for (int z = zStart; z <= zEnd; ++z) - { + for (int z = zStart; z <= zEnd; ++z) { addBlock(x, y, z, block); } } - - -void StructureBuilder::fill(int y, int xStart, int xEnd, int zStart, int zEnd, BlockId block) +void StructureBuilder::fill(int y, int xStart, int xEnd, int zStart, int zEnd, + BlockId block) { for (int x = xStart; x < xEnd; ++x) - for (int z = zStart; z < zEnd; ++z) - { - addBlock(x, y, z, block); - } + for (int z = zStart; z < zEnd; ++z) { + addBlock(x, y, z, block); + } } void StructureBuilder::addBlock(int x, int y, int z, BlockId block) { m_blocks.emplace_back(block, x, y, z); } - diff --git a/Source/World/Generation/Structures/StructureBuilder.h b/Source/World/Generation/Structures/StructureBuilder.h index 0de74402..bb416a83 100644 --- a/Source/World/Generation/Structures/StructureBuilder.h +++ b/Source/World/Generation/Structures/StructureBuilder.h @@ -1,41 +1,38 @@ #ifndef STRUCTUREBUILDER_H_INCLUDED #define STRUCTUREBUILDER_H_INCLUDED -#include #include "../../Block/BlockId.h" +#include class Chunk; -class StructureBuilder -{ - struct Block - { +class StructureBuilder { + struct Block { Block(BlockId id, int x, int y, int z) - : id (id) - , x (x) - , y (y) - , z (z) - { } + : id(id) + , x(x) + , y(y) + , z(z) + { + } BlockId id; int x, y, z; }; - public: - void build(Chunk& chunk); - - void makeColumn(int x, int z, int yStart, int height, BlockId block); - void makeRowX (int xStart, int xEnd, int y, int z, BlockId block); - void makeRowZ (int zStart, int zEnd, int x, int y, BlockId block); - - void fill (int y, int xStart, int xEnd, int zStart, int zEnd, BlockId block); + public: + void build(Chunk &chunk); - void addBlock(int x, int y, int z, BlockId block); + void makeColumn(int x, int z, int yStart, int height, BlockId block); + void makeRowX(int xStart, int xEnd, int y, int z, BlockId block); + void makeRowZ(int zStart, int zEnd, int x, int y, BlockId block); + void fill(int y, int xStart, int xEnd, int zStart, int zEnd, BlockId block); - private: - std::vector m_blocks; + void addBlock(int x, int y, int z, BlockId block); + private: + std::vector m_blocks; }; #endif // STRUCTUREBUILDER_H_INCLUDED diff --git a/Source/World/Generation/Structures/TreeGenerator.cpp b/Source/World/Generation/Structures/TreeGenerator.cpp index 1a86a2f3..aa160f98 100644 --- a/Source/World/Generation/Structures/TreeGenerator.cpp +++ b/Source/World/Generation/Structures/TreeGenerator.cpp @@ -5,50 +5,52 @@ constexpr BlockId CACTUS = BlockId::Cactus; -namespace +namespace { +void makeCactus1(Chunk &chunk, Random &rand, int x, int y, + int z) { - void makeCactus1 (Chunk& chunk, Random& rand, int x, int y, int z) - { - StructureBuilder builder; - builder.makeColumn(x, z, y, rand.intInRange(4, 7), CACTUS); - builder.build(chunk); - } - - void makeCactus2 (Chunk& chunk, Random& rand, int x, int y, int z) - { - StructureBuilder builder; - int height = rand.intInRange(6, 8); - builder.makeColumn(x, z, y, height, CACTUS); + StructureBuilder builder; + builder.makeColumn(x, z, y, rand.intInRange(4, 7), CACTUS); + builder.build(chunk); +} - int stem = height / 2; +void makeCactus2(Chunk &chunk, Random &rand, int x, int y, + int z) +{ + StructureBuilder builder; + int height = rand.intInRange(6, 8); + builder.makeColumn(x, z, y, height, CACTUS); - builder.makeRowX(x - 2, x + 2, stem + y, z, CACTUS); - builder.addBlock(x - 2, stem + y + 1, z, CACTUS); - builder.addBlock(x - 2, stem + y + 2, z, CACTUS); - builder.addBlock(x + 2, stem + y + 1, z, CACTUS); + int stem = height / 2; - builder.build(chunk); - } + builder.makeRowX(x - 2, x + 2, stem + y, z, CACTUS); + builder.addBlock(x - 2, stem + y + 1, z, CACTUS); + builder.addBlock(x - 2, stem + y + 2, z, CACTUS); + builder.addBlock(x + 2, stem + y + 1, z, CACTUS); + builder.build(chunk); +} - void makeCactus3 (Chunk& chunk, Random& rand, int x, int y, int z) - { - StructureBuilder builder; - int height = rand.intInRange(6, 8); - builder.makeColumn(x, z, y, height, CACTUS); +void makeCactus3(Chunk &chunk, Random &rand, int x, int y, + int z) +{ + StructureBuilder builder; + int height = rand.intInRange(6, 8); + builder.makeColumn(x, z, y, height, CACTUS); - int stem = height / 2; + int stem = height / 2; - builder.makeRowZ(z - 2, z + 2, x, stem + y, CACTUS); - builder.addBlock(x, stem + y + 1, z - 2, CACTUS); - builder.addBlock(x, stem + y + 2, z - 2, CACTUS); - builder.addBlock(x, stem + y + 1, z + 2, CACTUS); + builder.makeRowZ(z - 2, z + 2, x, stem + y, CACTUS); + builder.addBlock(x, stem + y + 1, z - 2, CACTUS); + builder.addBlock(x, stem + y + 2, z - 2, CACTUS); + builder.addBlock(x, stem + y + 1, z + 2, CACTUS); - builder.build(chunk); - } + builder.build(chunk); } +} // namespace -void makeOakTree(Chunk& chunk, Random& rand, int x, int y, int z) +void makeOakTree(Chunk &chunk, Random &rand, int x, int y, + int z) { StructureBuilder builder; @@ -56,16 +58,16 @@ void makeOakTree(Chunk& chunk, Random& rand, int x, int y, int int leafSize = 2; int newY = h + y; - builder.fill(newY, x - leafSize, x + leafSize, z - leafSize, z + leafSize, BlockId::OakLeaf); - builder.fill(newY - 1, x - leafSize, x + leafSize, z - leafSize, z + leafSize, BlockId::OakLeaf); + builder.fill(newY, x - leafSize, x + leafSize, z - leafSize, z + leafSize, + BlockId::OakLeaf); + builder.fill(newY - 1, x - leafSize, x + leafSize, z - leafSize, + z + leafSize, BlockId::OakLeaf); - for (int32_t zLeaf = -leafSize + 1; zLeaf <= leafSize - 1; zLeaf++) - { + for (int32_t zLeaf = -leafSize + 1; zLeaf <= leafSize - 1; zLeaf++) { builder.addBlock(x, newY + 1, z + zLeaf, BlockId::OakLeaf); } - for (int32_t xLeaf = -leafSize + 1; xLeaf <= leafSize - 1; xLeaf++) - { + for (int32_t xLeaf = -leafSize + 1; xLeaf <= leafSize - 1; xLeaf++) { builder.addBlock(x + xLeaf, newY + 1, z, BlockId::OakLeaf); } @@ -73,38 +75,37 @@ void makeOakTree(Chunk& chunk, Random& rand, int x, int y, int builder.build(chunk); } -void makePalmTree(Chunk& chunk, Random& rand, int x, int y, int z) +void makePalmTree(Chunk &chunk, Random &rand, int x, int y, + int z) { StructureBuilder builder; int height = rand.intInRange(7, 9); int diameter = rand.intInRange(4, 6); - for (int xLeaf = -diameter; xLeaf < diameter; xLeaf++) - { + for (int xLeaf = -diameter; xLeaf < diameter; xLeaf++) { builder.addBlock(xLeaf + x, y + height, z, BlockId::OakLeaf); } - for (int zLeaf = -diameter; zLeaf < diameter; zLeaf++) - { + for (int zLeaf = -diameter; zLeaf < diameter; zLeaf++) { builder.addBlock(x, y + height, zLeaf + z, BlockId::OakLeaf); } - builder.addBlock(x, y + height - 1, z + diameter, BlockId::OakLeaf); - builder.addBlock(x, y + height - 1, z - diameter, BlockId::OakLeaf); - builder.addBlock(x + diameter, y + height - 1, z, BlockId::OakLeaf); - builder.addBlock(x - diameter, y + height - 1, z, BlockId::OakLeaf); - builder.addBlock(x, y + height + 1, z, BlockId::OakLeaf); + builder.addBlock(x, y + height - 1, z + diameter, BlockId::OakLeaf); + builder.addBlock(x, y + height - 1, z - diameter, BlockId::OakLeaf); + builder.addBlock(x + diameter, y + height - 1, z, BlockId::OakLeaf); + builder.addBlock(x - diameter, y + height - 1, z, BlockId::OakLeaf); + builder.addBlock(x, y + height + 1, z, BlockId::OakLeaf); builder.makeColumn(x, z, y, height, BlockId::OakBark); builder.build(chunk); } -void makeCactus(Chunk& chunk, Random& rand, int x, int y, int z) +void makeCactus(Chunk &chunk, Random &rand, int x, int y, + int z) { int cac = rand.intInRange(0, 2); - switch (cac) - { + switch (cac) { case 0: makeCactus1(chunk, rand, x, y, z); break; diff --git a/Source/World/Generation/Structures/TreeGenerator.h b/Source/World/Generation/Structures/TreeGenerator.h index d6379bf7..08c38f7b 100644 --- a/Source/World/Generation/Structures/TreeGenerator.h +++ b/Source/World/Generation/Structures/TreeGenerator.h @@ -5,9 +5,12 @@ class Chunk; -void makeOakTree (Chunk& chunk, Random& rand, int x, int y, int z); -void makePalmTree (Chunk& chunk, Random& rand, int x, int y, int z); +void makeOakTree(Chunk &chunk, Random &rand, int x, int y, + int z); +void makePalmTree(Chunk &chunk, Random &rand, int x, int y, + int z); -void makeCactus (Chunk& chunk, Random& rand, int x, int y, int z); +void makeCactus(Chunk &chunk, Random &rand, int x, int y, + int z); #endif // TREEGENERATOR_H_INCLUDED diff --git a/Source/World/Generation/Terrain/ClassicOverWorldGenerator.cpp b/Source/World/Generation/Terrain/ClassicOverWorldGenerator.cpp index 5fe82a8d..57542316 100644 --- a/Source/World/Generation/Terrain/ClassicOverWorldGenerator.cpp +++ b/Source/World/Generation/Terrain/ClassicOverWorldGenerator.cpp @@ -3,25 +3,24 @@ #include #include -#include "../../Chunk/Chunk.h" -#include "../../../Util/Random.h" #include "../../../Maths/GeneralMaths.h" +#include "../../../Util/Random.h" +#include "../../Chunk/Chunk.h" #include "../Structures/TreeGenerator.h" -namespace -{ - const int seed = RandomSingleton::get().intInRange(424, 325322); +namespace { +const int seed = RandomSingleton::get().intInRange(424, 325322); } -NoiseGenerator ClassicOverWorldGenerator::m_biomeNoiseGen (seed * 2); +NoiseGenerator ClassicOverWorldGenerator::m_biomeNoiseGen(seed * 2); ClassicOverWorldGenerator::ClassicOverWorldGenerator() -: m_grassBiome (seed) -, m_temperateForest (seed) -, m_desertBiome (seed) -, m_oceanBiome (seed) -, m_lightForest (seed) + : m_grassBiome(seed) + , m_temperateForest(seed) + , m_desertBiome(seed) + , m_oceanBiome(seed) + , m_lightForest(seed) { setUpNoise(); } @@ -30,29 +29,27 @@ void ClassicOverWorldGenerator::setUpNoise() { std::cout << "Seed: " << seed << '\n'; static bool noiseGen = false; - if (!noiseGen) - { + if (!noiseGen) { std::cout << "making noise\n"; noiseGen = true; NoiseParameters biomeParmams; - biomeParmams.octaves = 5; - biomeParmams.amplitude = 120; - biomeParmams.smoothness = 1035; - biomeParmams.heightOffset = 0; - biomeParmams.roughness = 0.75; + biomeParmams.octaves = 5; + biomeParmams.amplitude = 120; + biomeParmams.smoothness = 1035; + biomeParmams.heightOffset = 0; + biomeParmams.roughness = 0.75; m_biomeNoiseGen.setParameters(biomeParmams); } } -void ClassicOverWorldGenerator::generateTerrainFor(Chunk& chunk) +void ClassicOverWorldGenerator::generateTerrainFor(Chunk &chunk) { m_pChunk = &chunk; - auto location = chunk.getLocation(); - m_random.setSeed((location.x ^ location.y) << 2 ); + m_random.setSeed((location.x ^ location.y) << 2); getBiomeMap(); getHeightMap(); @@ -68,52 +65,48 @@ int ClassicOverWorldGenerator::getMinimumSpawnHeight() const noexcept return WATER_LEVEL; } -void ClassicOverWorldGenerator::getHeightIn (int xMin, int zMin, int xMax, int zMax) +void ClassicOverWorldGenerator::getHeightIn(int xMin, int zMin, int xMax, + int zMax) { - auto getHeightAt = [&](int x, int z) - { - const Biome& biome = getBiome(x, z); + auto getHeightAt = [&](int x, int z) { + const Biome &biome = getBiome(x, z); - return biome.getHeight(x, z, - m_pChunk->getLocation().x, + return biome.getHeight(x, z, m_pChunk->getLocation().x, m_pChunk->getLocation().y); }; - float bottomLeft = static_cast(getHeightAt(xMin, zMin)); - float bottomRight = static_cast(getHeightAt(xMax, zMin)); - float topLeft = static_cast(getHeightAt(xMin, zMax)); - float topRight = static_cast(getHeightAt(xMax, zMax)); + float bottomLeft = static_cast(getHeightAt(xMin, zMin)); + float bottomRight = static_cast(getHeightAt(xMax, zMin)); + float topLeft = static_cast(getHeightAt(xMin, zMax)); + float topRight = static_cast(getHeightAt(xMax, zMax)); for (int x = xMin; x < xMax; ++x) - for (int z = zMin; z < zMax; ++z) - { - if (x == CHUNK_SIZE) - continue; - if (z == CHUNK_SIZE) - continue; - - float h = smoothInterpolation( - bottomLeft, topLeft, bottomRight, topRight, - static_cast(xMin), static_cast(xMax), - static_cast(zMin), static_cast(zMax), - static_cast(x), static_cast(z)); - - m_heightMap.get(x, z) = static_cast(h); - } + for (int z = zMin; z < zMax; ++z) { + if (x == CHUNK_SIZE) + continue; + if (z == CHUNK_SIZE) + continue; + + float h = smoothInterpolation( + bottomLeft, topLeft, bottomRight, topRight, + static_cast(xMin), static_cast(xMax), + static_cast(zMin), static_cast(zMax), + static_cast(x), static_cast(z)); + + m_heightMap.get(x, z) = static_cast(h); + } } - - void ClassicOverWorldGenerator::getHeightMap() { - constexpr static auto HALF_CHUNK = CHUNK_SIZE / 2; - constexpr static auto CHUNK = CHUNK_SIZE; + constexpr static auto HALF_CHUNK = CHUNK_SIZE / 2; + constexpr static auto CHUNK = CHUNK_SIZE; - getHeightIn(0, 0, HALF_CHUNK, HALF_CHUNK); - getHeightIn(HALF_CHUNK, 0, CHUNK, HALF_CHUNK); - getHeightIn(0, HALF_CHUNK, HALF_CHUNK, CHUNK); - getHeightIn(HALF_CHUNK, HALF_CHUNK, CHUNK, CHUNK); + getHeightIn(0, 0, HALF_CHUNK, HALF_CHUNK); + getHeightIn(HALF_CHUNK, 0, CHUNK, HALF_CHUNK); + getHeightIn(0, HALF_CHUNK, HALF_CHUNK, CHUNK); + getHeightIn(HALF_CHUNK, HALF_CHUNK, CHUNK, CHUNK); } void ClassicOverWorldGenerator::getBiomeMap() @@ -121,11 +114,11 @@ void ClassicOverWorldGenerator::getBiomeMap() auto location = m_pChunk->getLocation(); for (int x = 0; x < CHUNK_SIZE + 1; x++) - for (int z = 0; z < CHUNK_SIZE + 1; z++) - { - double h = m_biomeNoiseGen.getHeight(x, z, location.x + 10, location.y + 10); - m_biomeMap.get(x, z) = static_cast(h); - } + for (int z = 0; z < CHUNK_SIZE + 1; z++) { + double h = m_biomeNoiseGen.getHeight(x, z, location.x + 10, + location.y + 10); + m_biomeMap.get(x, z) = static_cast(h); + } } void ClassicOverWorldGenerator::setBlocks(int maxHeight) @@ -134,57 +127,50 @@ void ClassicOverWorldGenerator::setBlocks(int maxHeight) std::vector plants; for (int y = 0; y < maxHeight + 1; y++) - for (int x = 0; x < CHUNK_SIZE; x++) - for (int z = 0; z < CHUNK_SIZE; z++) - { - int height = m_heightMap.get(x, z); - auto& biome = getBiome(x, z); - - if (y > height) - { - if (y <= WATER_LEVEL) - { - m_pChunk->setBlock(x, y, z, BlockId::Water); - } - continue; - } - else if (y == height) - { - if (y >= WATER_LEVEL) - { - if (y < WATER_LEVEL + 4) - { - m_pChunk->setBlock(x, y, z, biome.getBeachBlock(m_random)); + for (int x = 0; x < CHUNK_SIZE; x++) + for (int z = 0; z < CHUNK_SIZE; z++) { + int height = m_heightMap.get(x, z); + auto &biome = getBiome(x, z); + + if (y > height) { + if (y <= WATER_LEVEL) { + m_pChunk->setBlock(x, y, z, BlockId::Water); + } continue; } - - if (m_random.intInRange(0, biome.getTreeFrequency()) == 5 ) - { - trees.emplace_back(x, y + 1, z); + else if (y == height) { + if (y >= WATER_LEVEL) { + if (y < WATER_LEVEL + 4) { + m_pChunk->setBlock(x, y, z, + biome.getBeachBlock(m_random)); + continue; + } + + if (m_random.intInRange(0, biome.getTreeFrequency()) == + 5) { + trees.emplace_back(x, y + 1, z); + } + if (m_random.intInRange(0, biome.getPlantFrequency()) == + 5) { + plants.emplace_back(x, y + 1, z); + } + m_pChunk->setBlock( + x, y, z, getBiome(x, z).getTopBlock(m_random)); + } + else { + m_pChunk->setBlock(x, y, z, + biome.getUnderWaterBlock(m_random)); + } } - if (m_random.intInRange(0, biome.getPlantFrequency()) == 5 ) - { - plants.emplace_back(x, y + 1, z); + else if (y > height - 3) { + m_pChunk->setBlock(x, y, z, BlockId::Dirt); + } + else { + m_pChunk->setBlock(x, y, z, BlockId::Stone); } - m_pChunk->setBlock(x, y, z, getBiome(x, z).getTopBlock(m_random)); - } - else - { - m_pChunk->setBlock(x, y, z, biome.getUnderWaterBlock(m_random)); } - } - else if (y > height - 3) - { - m_pChunk->setBlock(x, y, z, BlockId::Dirt); - } - else - { - m_pChunk->setBlock(x, y, z, BlockId::Stone); - } - } - for (auto& plant : plants) - { + for (auto &plant : plants) { int x = plant.x; int z = plant.z; @@ -192,8 +178,7 @@ void ClassicOverWorldGenerator::setBlocks(int maxHeight) m_pChunk->setBlock(x, plant.y, z, block); } - for (auto& tree : trees) - { + for (auto &tree : trees) { int x = tree.x; int z = tree.z; @@ -201,36 +186,29 @@ void ClassicOverWorldGenerator::setBlocks(int maxHeight) } } -const Biome& ClassicOverWorldGenerator::getBiome(int x, int z) const +const Biome &ClassicOverWorldGenerator::getBiome(int x, int z) const { int biomeValue = m_biomeMap.get(x, z); - if (biomeValue > 160) - { + if (biomeValue > 160) { return m_oceanBiome; } - else if (biomeValue > 150) - { + else if (biomeValue > 150) { return m_grassBiome; } - else if (biomeValue > 130) - { + else if (biomeValue > 130) { return m_lightForest; } - else if (biomeValue > 120) - { + else if (biomeValue > 120) { return m_temperateForest; } - else if (biomeValue > 110) - { + else if (biomeValue > 110) { return m_lightForest; } - else if (biomeValue > 100) - { + else if (biomeValue > 100) { return m_grassBiome; } - else - { + else { return m_desertBiome; } } diff --git a/Source/World/Generation/Terrain/ClassicOverWorldGenerator.h b/Source/World/Generation/Terrain/ClassicOverWorldGenerator.h index 0b68d232..60e02b4a 100644 --- a/Source/World/Generation/Terrain/ClassicOverWorldGenerator.h +++ b/Source/World/Generation/Terrain/ClassicOverWorldGenerator.h @@ -9,48 +9,46 @@ #include "../../../Maths/NoiseGenerator.h" #include "../../WorldConstants.h" - -#include "../Biome/GrasslandBiome.h" -#include "../Biome/TemperateForestBiome.h" #include "../Biome/DesertBiome.h" -#include "../Biome/OceanBiome.h" +#include "../Biome/GrasslandBiome.h" #include "../Biome/LightForest.h" +#include "../Biome/OceanBiome.h" +#include "../Biome/TemperateForestBiome.h" class Chunk; -class ClassicOverWorldGenerator : public TerrainGenerator -{ - public: - ClassicOverWorldGenerator(); +class ClassicOverWorldGenerator : public TerrainGenerator { + public: + ClassicOverWorldGenerator(); - void generateTerrainFor (Chunk& chunk) override; - int getMinimumSpawnHeight () const noexcept override; + void generateTerrainFor(Chunk &chunk) override; + int getMinimumSpawnHeight() const noexcept override; - private: - static void setUpNoise(); + private: + static void setUpNoise(); - void setBlocks(int maxHeight); + void setBlocks(int maxHeight); - void getHeightIn (int xMin, int zMin, int xMax, int zMax); - void getHeightMap(); - void getBiomeMap (); + void getHeightIn(int xMin, int zMin, int xMax, int zMax); + void getHeightMap(); + void getBiomeMap(); - const Biome& getBiome(int x, int z) const; + const Biome &getBiome(int x, int z) const; - Array2D m_heightMap; - Array2D m_biomeMap; + Array2D m_heightMap; + Array2D m_biomeMap; - Random m_random; + Random m_random; - static NoiseGenerator m_biomeNoiseGen; + static NoiseGenerator m_biomeNoiseGen; - GrasslandBiome m_grassBiome; - TemperateForestBiome m_temperateForest; - DesertBiome m_desertBiome; - OceanBiome m_oceanBiome; - LightForest m_lightForest; + GrasslandBiome m_grassBiome; + TemperateForestBiome m_temperateForest; + DesertBiome m_desertBiome; + OceanBiome m_oceanBiome; + LightForest m_lightForest; - Chunk* m_pChunk = nullptr; + Chunk *m_pChunk = nullptr; }; #endif // CLASSICOVERWORLDGENERATOR_H_INCLUDED diff --git a/Source/World/Generation/Terrain/SuperFlatGenerator.cpp b/Source/World/Generation/Terrain/SuperFlatGenerator.cpp index 1baabe6c..b093c77f 100644 --- a/Source/World/Generation/Terrain/SuperFlatGenerator.cpp +++ b/Source/World/Generation/Terrain/SuperFlatGenerator.cpp @@ -5,17 +5,16 @@ #include "../../Chunk/Chunk.h" #include "../../WorldConstants.h" -void SuperFlatGenerator::generateTerrainFor(Chunk& chunk) +void SuperFlatGenerator::generateTerrainFor(Chunk &chunk) { for (int x = 0; x < CHUNK_SIZE; ++x) - for (int z = 0; z < CHUNK_SIZE; ++z) - { - chunk.setBlock(x, 0, z, BlockId::Stone); - chunk.setBlock(x, 1, z, BlockId::Dirt); - chunk.setBlock(x, 2, z, BlockId::Dirt); - chunk.setBlock(x, 3, z, BlockId::Dirt); - chunk.setBlock(x, 4, z, BlockId::Grass); - } + for (int z = 0; z < CHUNK_SIZE; ++z) { + chunk.setBlock(x, 0, z, BlockId::Stone); + chunk.setBlock(x, 1, z, BlockId::Dirt); + chunk.setBlock(x, 2, z, BlockId::Dirt); + chunk.setBlock(x, 3, z, BlockId::Dirt); + chunk.setBlock(x, 4, z, BlockId::Grass); + } } int SuperFlatGenerator::getMinimumSpawnHeight() const noexcept diff --git a/Source/World/Generation/Terrain/SuperFlatGenerator.h b/Source/World/Generation/Terrain/SuperFlatGenerator.h index 0300da5c..f21d6867 100644 --- a/Source/World/Generation/Terrain/SuperFlatGenerator.h +++ b/Source/World/Generation/Terrain/SuperFlatGenerator.h @@ -3,11 +3,10 @@ #include "TerrainGenerator.h" -class SuperFlatGenerator : public TerrainGenerator -{ - public: - void generateTerrainFor (Chunk& chunk) override; - int getMinimumSpawnHeight () const noexcept override; +class SuperFlatGenerator : public TerrainGenerator { + public: + void generateTerrainFor(Chunk &chunk) override; + int getMinimumSpawnHeight() const noexcept override; }; #endif // SUPERFLATGENERATOR_H_INCLUDED diff --git a/Source/World/Generation/Terrain/TerrainGenerator.h b/Source/World/Generation/Terrain/TerrainGenerator.h index f1cd9ce6..0d10dd7e 100644 --- a/Source/World/Generation/Terrain/TerrainGenerator.h +++ b/Source/World/Generation/Terrain/TerrainGenerator.h @@ -3,13 +3,12 @@ class Chunk; -class TerrainGenerator -{ - public: - virtual void generateTerrainFor (Chunk& chunk) = 0; - virtual int getMinimumSpawnHeight () const noexcept = 0; +class TerrainGenerator { + public: + virtual void generateTerrainFor(Chunk &chunk) = 0; + virtual int getMinimumSpawnHeight() const noexcept = 0; - virtual ~TerrainGenerator() = default; + virtual ~TerrainGenerator() = default; }; #endif // TERRAINGENERATOR_H_INCLUDED diff --git a/Source/World/World.cpp b/Source/World/World.cpp index 38e0f00b..0c493538 100644 --- a/Source/World/World.cpp +++ b/Source/World/World.cpp @@ -1,50 +1,44 @@ #include "World.h" -#include #include +#include -#include "../Maths/Vector2XZ.h" #include "../Camera.h" #include "../Input/ToggleKey.h" -#include "../Renderer/RenderMaster.h" +#include "../Maths/Vector2XZ.h" #include "../Player/Player.h" +#include "../Renderer/RenderMaster.h" #include "../Util/Random.h" - -World::World(const Camera& camera, const Config& config, Player& player) -: m_chunkManager (*this) -, m_renderDistance (config.renderDistance) +World::World(const Camera &camera, const Config &config, Player &player) + : m_chunkManager(*this) + , m_renderDistance(config.renderDistance) { setSpawnPoint(); player.position = m_playerSpawnPoint; - for (int i = 0; i < 1; i++) - { + for (int i = 0; i < 1; i++) { std::this_thread::sleep_for(std::chrono::milliseconds(50)); - m_chunkLoadThreads.emplace_back([&]() - { - loadChunks(camera); - }); + m_chunkLoadThreads.emplace_back([&]() { loadChunks(camera); }); } - } World::~World() { m_isRunning = false; - for (auto& thread : m_chunkLoadThreads) - { + for (auto &thread : m_chunkLoadThreads) { thread.join(); } } -//world coords into chunk column coords +// world coords into chunk column coords ChunkBlock World::getBlock(int x, int y, int z) { auto bp = getBlockXZ(x, z); auto chunkPosition = getChunkXZ(x, z); - return m_chunkManager.getChunk(chunkPosition.x, chunkPosition.z).getBlock(bp.x, y, bp.z); + return m_chunkManager.getChunk(chunkPosition.x, chunkPosition.z) + .getBlock(bp.x, y, bp.z); } void World::setBlock(int x, int y, int z, ChunkBlock block) @@ -55,25 +49,23 @@ void World::setBlock(int x, int y, int z, ChunkBlock block) auto bp = getBlockXZ(x, z); auto chunkPosition = getChunkXZ(x, z); - m_chunkManager.getChunk(chunkPosition.x, chunkPosition.z).setBlock(bp.x, y, bp.z, block); + m_chunkManager.getChunk(chunkPosition.x, chunkPosition.z) + .setBlock(bp.x, y, bp.z, block); } -//loads chunks -//make chunk meshes -void World::update(const Camera& camera) +// loads chunks +// make chunk meshes +void World::update(const Camera &camera) { static ToggleKey key(sf::Keyboard::C); - if (key.isKeyPressed()) - { + if (key.isKeyPressed()) { std::unique_lock lock(m_mainMutex); m_chunkManager.deleteMeshes(); m_loadDistance = 2; } - - for (auto& event : m_events) - { + for (auto &event : m_events) { event->handle(*this); } m_events.clear(); @@ -82,56 +74,49 @@ void World::update(const Camera& camera) } ///@TODO -///Optimize for chunkPositionU usage :thinking: -void World::loadChunks(const Camera& camera) +/// Optimize for chunkPositionU usage :thinking: +void World::loadChunks(const Camera &camera) { - while(m_isRunning) - { + while (m_isRunning) { bool isMeshMade = false; int cameraX = camera.position.x / CHUNK_SIZE; int cameraZ = camera.position.z / CHUNK_SIZE; - for (int i = 0; i < m_loadDistance; i++) - { + for (int i = 0; i < m_loadDistance; i++) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); - int minX = std::max(cameraX - i, 0); - int minZ = std::max(cameraZ - i, 0); + int minX = std::max(cameraX - i, 0); + int minZ = std::max(cameraZ - i, 0); int maxX = cameraX + i; int maxZ = cameraZ + i; - for (int x = minX; x < maxX; ++x) - { - for (int z = minZ; z < maxZ; ++z) - { + for (int x = minX; x < maxX; ++x) { + for (int z = minZ; z < maxZ; ++z) { std::unique_lock lock(m_mainMutex); isMeshMade = m_chunkManager.makeMesh(x, z, camera); } - //if (isMeshMade) - // break; + // if (isMeshMade) + // break; } if (isMeshMade) break; } - if (!isMeshMade) - { + if (!isMeshMade) { m_loadDistance++; } - if (m_loadDistance >= m_renderDistance) - { + if (m_loadDistance >= m_renderDistance) { m_loadDistance = 2; } } } - void World::updateChunk(int blockX, int blockY, int blockZ) { std::unique_lock lock(m_mainMutex); - auto addChunkToUpdateBatch = [&](const sf::Vector3i& key, ChunkSection& section) - { + auto addChunkToUpdateBatch = [&](const sf::Vector3i &key, + ChunkSection §ion) { m_chunkUpdates.emplace(key, §ion); }; @@ -139,54 +124,67 @@ void World::updateChunk(int blockX, int blockY, int blockZ) auto chunkSectionY = blockY / CHUNK_SIZE; sf::Vector3i key(chunkPosition.x, chunkSectionY, chunkPosition.z); - addChunkToUpdateBatch(key, m_chunkManager.getChunk(chunkPosition.x, chunkPosition.z).getSection(chunkSectionY)); + addChunkToUpdateBatch( + key, m_chunkManager.getChunk(chunkPosition.x, chunkPosition.z) + .getSection(chunkSectionY)); auto sectionBlockXZ = getBlockXZ(blockX, blockZ); - auto sectionBlockY = blockY % CHUNK_SIZE; - - if (sectionBlockXZ.x == 0) - { - sf::Vector3i newKey(chunkPosition.x - 1, chunkSectionY, chunkPosition.z); - addChunkToUpdateBatch(newKey, m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); + auto sectionBlockY = blockY % CHUNK_SIZE; + + if (sectionBlockXZ.x == 0) { + sf::Vector3i newKey(chunkPosition.x - 1, chunkSectionY, + chunkPosition.z); + addChunkToUpdateBatch( + newKey, + m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); } - else if (sectionBlockXZ.x == CHUNK_SIZE - 1) - { - sf::Vector3i newKey(chunkPosition.x + 1, chunkSectionY, chunkPosition.z); - addChunkToUpdateBatch(newKey, m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); + else if (sectionBlockXZ.x == CHUNK_SIZE - 1) { + sf::Vector3i newKey(chunkPosition.x + 1, chunkSectionY, + chunkPosition.z); + addChunkToUpdateBatch( + newKey, + m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); } - if (sectionBlockY == 0) - { - sf::Vector3i newKey(chunkPosition.x, chunkSectionY - 1, chunkPosition.z); - addChunkToUpdateBatch(newKey, m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); + if (sectionBlockY == 0) { + sf::Vector3i newKey(chunkPosition.x, chunkSectionY - 1, + chunkPosition.z); + addChunkToUpdateBatch( + newKey, + m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); } - else if (sectionBlockY == CHUNK_SIZE - 1) - { - sf::Vector3i newKey(chunkPosition.x, chunkSectionY + 1, chunkPosition.z); - addChunkToUpdateBatch(newKey, m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); + else if (sectionBlockY == CHUNK_SIZE - 1) { + sf::Vector3i newKey(chunkPosition.x, chunkSectionY + 1, + chunkPosition.z); + addChunkToUpdateBatch( + newKey, + m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); } - if (sectionBlockXZ.z == 0) - { - sf::Vector3i newKey(chunkPosition.x, chunkSectionY, chunkPosition.z - 1); - addChunkToUpdateBatch(newKey, m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); + if (sectionBlockXZ.z == 0) { + sf::Vector3i newKey(chunkPosition.x, chunkSectionY, + chunkPosition.z - 1); + addChunkToUpdateBatch( + newKey, + m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); } - else if (sectionBlockXZ.z == CHUNK_SIZE - 1) - { - sf::Vector3i newKey(chunkPosition.x, chunkSectionY, chunkPosition.z + 1); - addChunkToUpdateBatch(newKey, m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); + else if (sectionBlockXZ.z == CHUNK_SIZE - 1) { + sf::Vector3i newKey(chunkPosition.x, chunkSectionY, + chunkPosition.z + 1); + addChunkToUpdateBatch( + newKey, + m_chunkManager.getChunk(newKey.x, newKey.z).getSection(newKey.y)); } } -void World::renderWorld(RenderMaster& renderer, const Camera& camera) +void World::renderWorld(RenderMaster &renderer, const Camera &camera) { std::unique_lock lock(m_mainMutex); renderer.drawSky(); - auto& chunkMap = m_chunkManager.getChunks(); - for (auto itr = chunkMap.begin(); itr != chunkMap.end();) - { - Chunk& chunk = itr->second; + auto &chunkMap = m_chunkManager.getChunks(); + for (auto itr = chunkMap.begin(); itr != chunkMap.end();) { + Chunk &chunk = itr->second; int cameraX = camera.position.x; int cameraZ = camera.position.z; @@ -198,57 +196,43 @@ void World::renderWorld(RenderMaster& renderer, const Camera& camera) auto location = chunk.getLocation(); - if (minX > location.x || - minZ > location.y || - maxZ < location.y || - maxX < location.x) - { + if (minX > location.x || minZ > location.y || maxZ < location.y || + maxX < location.x) { itr = chunkMap.erase(itr); continue; } - else - { + else { chunk.drawChunks(renderer, camera); itr++; } } } -ChunkManager& World::getChunkManager() +ChunkManager &World::getChunkManager() { return m_chunkManager; } VectorXZ World::getBlockXZ(int x, int z) { - return - { - x % CHUNK_SIZE, - z % CHUNK_SIZE - }; + return {x % CHUNK_SIZE, z % CHUNK_SIZE}; } VectorXZ World::getChunkXZ(int x, int z) { - return - { - x / CHUNK_SIZE, - z / CHUNK_SIZE - }; + return {x / CHUNK_SIZE, z / CHUNK_SIZE}; } void World::updateChunks() { std::unique_lock lock(m_mainMutex); - for (auto& c : m_chunkUpdates) - { - ChunkSection& s = *c.second; + for (auto &c : m_chunkUpdates) { + ChunkSection &s = *c.second; s.makeMesh(); } m_chunkUpdates.clear(); } - void World::setSpawnPoint() { sf::Clock timer; @@ -262,8 +246,7 @@ void World::setSpawnPoint() auto h = m_chunkManager.getTerrainGenerator().getMinimumSpawnHeight(); - while(blockY <= h) - { + while (blockY <= h) { m_chunkManager.unloadChunk(chunkX, chunkZ); chunkX = RandomSingleton::get().intInRange(100, 200); @@ -272,7 +255,8 @@ void World::setSpawnPoint() blockZ = RandomSingleton::get().intInRange(0, 15); m_chunkManager.loadChunk(chunkX, chunkZ); - blockY = m_chunkManager.getChunk(chunkX, chunkZ).getHeightAt(blockX, blockZ); + blockY = + m_chunkManager.getChunk(chunkX, chunkZ).getHeightAt(blockX, blockZ); attempts++; } @@ -281,18 +265,16 @@ void World::setSpawnPoint() m_playerSpawnPoint = {worldX, blockY, worldZ}; - for (int x = worldX - 1; x <= worldX + 1; ++x) - { - for (int z = worldZ - 1; z < worldZ + 1; ++z) - { + for (int x = worldX - 1; x <= worldX + 1; ++x) { + for (int z = worldZ - 1; z < worldZ + 1; ++z) { std::unique_lock lock(m_mainMutex); m_chunkManager.loadChunk(x, z); } - //if (isMeshMade) + // if (isMeshMade) // break; } - std::cout << "Spawn found! Attempts: " << attempts - << " Time Taken: " << timer.getElapsedTime().asSeconds() << " seconds\n"; + std::cout << "Spawn found! Attempts: " << attempts + << " Time Taken: " << timer.getElapsedTime().asSeconds() + << " seconds\n"; } - diff --git a/Source/World/World.h b/Source/World/World.h index be2e25b5..472487de 100644 --- a/Source/World/World.h +++ b/Source/World/World.h @@ -1,15 +1,15 @@ #ifndef WORLD_H_INCLUDED #define WORLD_H_INCLUDED -#include +#include #include -#include #include -#include +#include +#include +#include "../Util/NonCopyable.h" #include "Chunk/Chunk.h" #include "Chunk/ChunkManager.h" -#include "../Util/NonCopyable.h" #include "Event/IWorldEvent.h" @@ -21,52 +21,50 @@ class Player; struct Entity; -class World : public NonCopyable -{ - public: - World(const Camera& camera, const Config& config, Player& player); - ~World(); +class World : public NonCopyable { + public: + World(const Camera &camera, const Config &config, Player &player); + ~World(); - ChunkBlock getBlock (int x, int y, int z); - void setBlock (int x, int y, int z, ChunkBlock block); + ChunkBlock getBlock(int x, int y, int z); + void setBlock(int x, int y, int z, ChunkBlock block); - void update(const Camera& camera); - void updateChunk(int blockX, int blockY, int blockZ); + void update(const Camera &camera); + void updateChunk(int blockX, int blockY, int blockZ); - void renderWorld(RenderMaster& master, const Camera& camera); + void renderWorld(RenderMaster &master, const Camera &camera); - ChunkManager& getChunkManager(); + ChunkManager &getChunkManager(); - static VectorXZ getBlockXZ(int x, int z); - static VectorXZ getChunkXZ(int x, int z); + static VectorXZ getBlockXZ(int x, int z); + static VectorXZ getChunkXZ(int x, int z); - void collisionTest(Entity& entity); + void collisionTest(Entity &entity); - template - void addEvent(Args&&... args) - { - m_events.push_back(std::make_unique(std::forward(args)...)); - } + template void addEvent(Args &&... args) + { + m_events.push_back(std::make_unique(std::forward(args)...)); + } - private: - void loadChunks (const Camera& camera); - void updateChunks (); - void setSpawnPoint (); + private: + void loadChunks(const Camera &camera); + void updateChunks(); + void setSpawnPoint(); - ChunkManager m_chunkManager; + ChunkManager m_chunkManager; - std::vector> m_events; - std::unordered_map m_chunkUpdates; + std::vector> m_events; + std::unordered_map m_chunkUpdates; - std::atomic m_isRunning {true}; - std::vector m_chunkLoadThreads; - std::mutex m_mainMutex; - std::mutex m_genMutex; + std::atomic m_isRunning{true}; + std::vector m_chunkLoadThreads; + std::mutex m_mainMutex; + std::mutex m_genMutex; - int m_loadDistance = 2; - const int m_renderDistance; + int m_loadDistance = 2; + const int m_renderDistance; - glm::vec3 m_playerSpawnPoint; + glm::vec3 m_playerSpawnPoint; }; #endif // WORLD_H_INCLUDED diff --git a/Source/World/WorldConstants.h b/Source/World/WorldConstants.h index b07e9317..e8812168 100644 --- a/Source/World/WorldConstants.h +++ b/Source/World/WorldConstants.h @@ -1,10 +1,9 @@ #ifndef WORLDCONSTANTS_H_INCLUDED #define WORLDCONSTANTS_H_INCLUDED -constexpr int CHUNK_SIZE = 16, - CHUNK_AREA = CHUNK_SIZE * CHUNK_SIZE, - CHUNK_VOLUME = CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE, +constexpr int CHUNK_SIZE = 16, CHUNK_AREA = CHUNK_SIZE * CHUNK_SIZE, + CHUNK_VOLUME = CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE, - WATER_LEVEL = 64; + WATER_LEVEL = 64; #endif // WORLDCONSTANTS_H_INCLUDED diff --git a/Source/glad/glad.h b/Source/glad/glad.h index 775ada72..75ad5646 100644 --- a/Source/glad/glad.h +++ b/Source/glad/glad.h @@ -7,18 +7,17 @@ APIs: gl=3.3 Profile: core Extensions: - + Loader: True Local files: True Omit khrplatform: True Commandline: - --profile="core" --api="gl=3.3" --generator="c" --spec="gl" --local-files --omit-khrplatform --extensions="" - Online: + --profile="core" --api="gl=3.3" --generator="c" --spec="gl" + --local-files --omit-khrplatform --extensions="" Online: http://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3 */ - #ifndef __glad_h_ #define __glad_h_ @@ -27,7 +26,8 @@ #endif #define __gl_h_ -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && \ + !defined(__SCITECH_SNAP__) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif @@ -57,32 +57,32 @@ struct gladGLversionStruct { int minor; }; -typedef void* (* GLADloadproc)(const char *name); +typedef void *(*GLADloadproc)(const char *name); #ifndef GLAPI -# if defined(GLAD_GLAPI_EXPORT) -# if defined(_WIN32) || defined(__CYGWIN__) -# if defined(GLAD_GLAPI_EXPORT_BUILD) -# if defined(__GNUC__) -# define GLAPI __attribute__ ((dllexport)) extern -# else -# define GLAPI __declspec(dllexport) extern -# endif -# else -# if defined(__GNUC__) -# define GLAPI __attribute__ ((dllimport)) extern -# else -# define GLAPI __declspec(dllimport) extern -# endif -# endif -# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD) -# define GLAPI __attribute__ ((visibility ("default"))) extern -# else -# define GLAPI extern -# endif -# else -# define GLAPI extern -# endif +#if defined(GLAD_GLAPI_EXPORT) +#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(GLAD_GLAPI_EXPORT_BUILD) +#if defined(__GNUC__) +#define GLAPI __attribute__((dllexport)) extern +#else +#define GLAPI __declspec(dllexport) extern +#endif +#else +#if defined(__GNUC__) +#define GLAPI __attribute__((dllimport)) extern +#else +#define GLAPI __declspec(dllimport) extern +#endif +#endif +#elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD) +#define GLAPI __attribute__((visibility("default"))) extern +#else +#define GLAPI extern +#endif +#else +#define GLAPI extern +#endif #endif GLAPI struct gladGLversionStruct GLVersion; @@ -110,7 +110,7 @@ typedef long long int int64_t; typedef unsigned long long int uint64_t; #endif /* __arch64__ */ #endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) +#elif defined(__VMS) || defined(__sgi) #include #elif defined(__SCO__) || defined(__USLC__) #include @@ -157,7 +157,8 @@ typedef unsigned int GLhandleARB; typedef unsigned short GLhalfARB; typedef unsigned short GLhalf; typedef GLint GLfixed; -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) #if defined(__khrplatform_h_) typedef khronos_intptr_t GLintptr; #else @@ -170,7 +171,8 @@ typedef khronos_intptr_t GLintptr; typedef ptrdiff_t GLintptr; #endif #endif -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) #if defined(__khrplatform_h_) typedef khronos_ssize_t GLsizeiptr; #else @@ -185,12 +187,14 @@ typedef ptrdiff_t GLsizeiptr; #endif typedef int64_t GLint64; typedef uint64_t GLuint64; -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef long GLintptrARB; #else typedef ptrdiff_t GLintptrARB; #endif -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef long GLsizeiptrARB; #else typedef ptrdiff_t GLsizeiptrARB; @@ -200,13 +204,24 @@ typedef uint64_t GLuint64EXT; typedef struct __GLsync *GLsync; struct _cl_context; struct _cl_event; -typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); +typedef void(APIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, + GLenum severity, GLsizei length, + const GLchar *message, + const void *userParam); +typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, + GLenum severity, GLsizei length, + const GLchar *message, + const void *userParam); +typedef void(APIENTRY *GLDEBUGPROCKHR)(GLenum source, GLenum type, GLuint id, + GLenum severity, GLsizei length, + const GLchar *message, + const void *userParam); +typedef void(APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, + GLenum severity, GLsizei length, + const GLchar *message, void *userParam); typedef unsigned short GLhalfNV; typedef GLintptr GLvdpauSurfaceNV; -typedef void (APIENTRY *GLVULKANPROCNV)(void); +typedef void(APIENTRY *GLVULKANPROCNV)(void); #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_COLOR_BUFFER_BIT 0x00004000 @@ -1028,1170 +1043,1583 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #ifndef GL_VERSION_1_0 #define GL_VERSION_1_0 1 GLAPI int GLAD_GL_VERSION_1_0; -typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); +typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); GLAPI PFNGLCULLFACEPROC glad_glCullFace; #define glCullFace glad_glCullFace -typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); +typedef void(APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; #define glFrontFace glad_glFrontFace -typedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); +typedef void(APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); GLAPI PFNGLHINTPROC glad_glHint; #define glHint glad_glHint -typedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width); +typedef void(APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width); GLAPI PFNGLLINEWIDTHPROC glad_glLineWidth; #define glLineWidth glad_glLineWidth -typedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size); +typedef void(APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size); GLAPI PFNGLPOINTSIZEPROC glad_glPointSize; #define glPointSize glad_glPointSize -typedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); +typedef void(APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); GLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode; #define glPolygonMode glad_glPolygonMode -typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +typedef void(APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, + GLsizei height); GLAPI PFNGLSCISSORPROC glad_glScissor; #define glScissor glad_glScissor -typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); +typedef void(APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, + GLfloat param); GLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf; #define glTexParameterf glad_glTexParameterf -typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); +typedef void(APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, + const GLfloat *params); GLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; #define glTexParameterfv glad_glTexParameterfv -typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); +typedef void(APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, + GLint param); GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; #define glTexParameteri glad_glTexParameteri -typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); +typedef void(APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, + const GLint *params); GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; #define glTexParameteriv glad_glTexParameteriv -typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void(APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, + GLint internalformat, GLsizei width, + GLint border, GLenum format, + GLenum type, const void *pixels); GLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D; #define glTexImage1D glad_glTexImage1D -typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void(APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, + GLint internalformat, GLsizei width, + GLsizei height, GLint border, + GLenum format, GLenum type, + const void *pixels); GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; #define glTexImage2D glad_glTexImage2D -typedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf); +typedef void(APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf); GLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer; #define glDrawBuffer glad_glDrawBuffer -typedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); +typedef void(APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); GLAPI PFNGLCLEARPROC glad_glClear; #define glClear glad_glClear -typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void(APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha); GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; #define glClearColor glad_glClearColor -typedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s); +typedef void(APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s); GLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil; #define glClearStencil glad_glClearStencil -typedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth); +typedef void(APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth); GLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth; #define glClearDepth glad_glClearDepth -typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); +typedef void(APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; #define glStencilMask glad_glStencilMask -typedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void(APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha); GLAPI PFNGLCOLORMASKPROC glad_glColorMask; #define glColorMask glad_glColorMask -typedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag); +typedef void(APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag); GLAPI PFNGLDEPTHMASKPROC glad_glDepthMask; #define glDepthMask glad_glDepthMask -typedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap); +typedef void(APIENTRYP PFNGLDISABLEPROC)(GLenum cap); GLAPI PFNGLDISABLEPROC glad_glDisable; #define glDisable glad_glDisable -typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap); +typedef void(APIENTRYP PFNGLENABLEPROC)(GLenum cap); GLAPI PFNGLENABLEPROC glad_glEnable; #define glEnable glad_glEnable -typedef void (APIENTRYP PFNGLFINISHPROC)(void); +typedef void(APIENTRYP PFNGLFINISHPROC)(void); GLAPI PFNGLFINISHPROC glad_glFinish; #define glFinish glad_glFinish -typedef void (APIENTRYP PFNGLFLUSHPROC)(void); +typedef void(APIENTRYP PFNGLFLUSHPROC)(void); GLAPI PFNGLFLUSHPROC glad_glFlush; #define glFlush glad_glFlush -typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); +typedef void(APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; #define glBlendFunc glad_glBlendFunc -typedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode); +typedef void(APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode); GLAPI PFNGLLOGICOPPROC glad_glLogicOp; #define glLogicOp glad_glLogicOp -typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); +typedef void(APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, + GLuint mask); GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; #define glStencilFunc glad_glStencilFunc -typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); +typedef void(APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, + GLenum zpass); GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; #define glStencilOp glad_glStencilOp -typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); +typedef void(APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; #define glDepthFunc glad_glDepthFunc -typedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); +typedef void(APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); GLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref; #define glPixelStoref glad_glPixelStoref -typedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); +typedef void(APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); GLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei; #define glPixelStorei glad_glPixelStorei -typedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src); +typedef void(APIENTRYP PFNGLREADBUFFERPROC)(GLenum src); GLAPI PFNGLREADBUFFERPROC glad_glReadBuffer; #define glReadBuffer glad_glReadBuffer -typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +typedef void(APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, + GLsizei height, GLenum format, + GLenum type, void *pixels); GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; #define glReadPixels glad_glReadPixels -typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); +typedef void(APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; #define glGetBooleanv glad_glGetBooleanv -typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); +typedef void(APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; #define glGetDoublev glad_glGetDoublev -typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void); +typedef GLenum(APIENTRYP PFNGLGETERRORPROC)(void); GLAPI PFNGLGETERRORPROC glad_glGetError; #define glGetError glad_glGetError -typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); +typedef void(APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; #define glGetFloatv glad_glGetFloatv -typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); +typedef void(APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; #define glGetIntegerv glad_glGetIntegerv -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); +typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); GLAPI PFNGLGETSTRINGPROC glad_glGetString; #define glGetString glad_glGetString -typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +typedef void(APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, + GLenum format, GLenum type, + void *pixels); GLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage; #define glGetTexImage glad_glGetTexImage -typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); +typedef void(APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, + GLfloat *params); GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; #define glGetTexParameterfv glad_glGetTexParameterfv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, + GLint *params); GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; #define glGetTexParameteriv glad_glGetTexParameteriv -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void(APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, + GLint level, + GLenum pname, + GLfloat *params); GLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; #define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, + GLint level, + GLenum pname, + GLint *params); GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; #define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv -typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); +typedef GLboolean(APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; #define glIsEnabled glad_glIsEnabled -typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); +typedef void(APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; #define glDepthRange glad_glDepthRange -typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +typedef void(APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, + GLsizei height); GLAPI PFNGLVIEWPORTPROC glad_glViewport; #define glViewport glad_glViewport #endif #ifndef GL_VERSION_1_1 #define GL_VERSION_1_1 1 GLAPI int GLAD_GL_VERSION_1_1; -typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); +typedef void(APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, + GLsizei count); GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; #define glDrawArrays glad_glDrawArrays -typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices); +typedef void(APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, + GLenum type, const void *indices); GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; #define glDrawElements glad_glDrawElements -typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); +typedef void(APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; #define glPolygonOffset glad_glPolygonOffset -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void(APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, + GLenum internalformat, GLint x, + GLint y, GLsizei width, + GLint border); GLAPI PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; #define glCopyTexImage1D glad_glCopyTexImage1D -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void(APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, + GLenum internalformat, GLint x, + GLint y, GLsizei width, + GLsizei height, GLint border); GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; #define glCopyTexImage2D glad_glCopyTexImage2D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void(APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, + GLint xoffset, GLint x, + GLint y, GLsizei width); GLAPI PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; #define glCopyTexSubImage1D glad_glCopyTexSubImage1D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void(APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, + GLsizei height); GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; #define glCopyTexSubImage2D glad_glCopyTexSubImage2D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void(APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const void *pixels); GLAPI PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; #define glTexSubImage1D glad_glTexSubImage1D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void(APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const void *pixels); GLAPI PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; #define glTexSubImage2D glad_glTexSubImage2D -typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); +typedef void(APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; #define glBindTexture glad_glBindTexture -typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); +typedef void(APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, + const GLuint *textures); GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; #define glDeleteTextures glad_glDeleteTextures -typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); +typedef void(APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; #define glGenTextures glad_glGenTextures -typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); +typedef GLboolean(APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; #define glIsTexture glad_glIsTexture #endif #ifndef GL_VERSION_1_2 #define GL_VERSION_1_2 1 GLAPI int GLAD_GL_VERSION_1_2; -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +typedef void(APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, + GLuint end, GLsizei count, + GLenum type, + const void *indices); GLAPI PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; #define glDrawRangeElements glad_glDrawRangeElements -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void(APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, + GLint internalformat, GLsizei width, + GLsizei height, GLsizei depth, + GLint border, GLenum format, + GLenum type, const void *pixels); GLAPI PFNGLTEXIMAGE3DPROC glad_glTexImage3D; #define glTexImage3D glad_glTexImage3D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void(APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, GLenum type, + const void *pixels); GLAPI PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; #define glTexSubImage3D glad_glTexSubImage3D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void(APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height); GLAPI PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; #define glCopyTexSubImage3D glad_glCopyTexSubImage3D #endif #ifndef GL_VERSION_1_3 #define GL_VERSION_1_3 1 GLAPI int GLAD_GL_VERSION_1_3; -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); +typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; #define glActiveTexture glad_glActiveTexture -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); +typedef void(APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, + GLboolean invert); GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; #define glSampleCoverage glad_glSampleCoverage -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void(APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)( + GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, + const void *data); GLAPI PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; #define glCompressedTexImage3D glad_glCompressedTexImage3D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void(APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)( + GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; #define glCompressedTexImage2D glad_glCompressedTexImage2D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void(APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)( + GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLint border, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; #define glCompressedTexImage1D glad_glCompressedTexImage1D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void(APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; #define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void(APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; #define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void(APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)( + GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, + GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; #define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void *img); +typedef void(APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, + GLint level, void *img); GLAPI PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; #define glGetCompressedTexImage glad_glGetCompressedTexImage #endif #ifndef GL_VERSION_1_4 #define GL_VERSION_1_4 1 GLAPI int GLAD_GL_VERSION_1_4; -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void(APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, + GLenum dfactorRGB, + GLenum sfactorAlpha, + GLenum dfactorAlpha); GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; #define glBlendFuncSeparate glad_glBlendFuncSeparate -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void(APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, + const GLint *first, + const GLsizei *count, + GLsizei drawcount); GLAPI PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; #define glMultiDrawArrays glad_glMultiDrawArrays -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +typedef void(APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, + const GLsizei *count, + GLenum type, + const void *const *indices, + GLsizei drawcount); GLAPI PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; #define glMultiDrawElements glad_glMultiDrawElements -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); +typedef void(APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; #define glPointParameterf glad_glPointParameterf -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat *params); +typedef void(APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, + const GLfloat *params); GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; #define glPointParameterfv glad_glPointParameterfv -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); +typedef void(APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); GLAPI PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; #define glPointParameteri glad_glPointParameteri -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint *params); +typedef void(APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum pname, + const GLint *params); GLAPI PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; #define glPointParameteriv glad_glPointParameteriv -typedef void (APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha); GLAPI PFNGLBLENDCOLORPROC glad_glBlendColor; #define glBlendColor glad_glBlendColor -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode); +typedef void(APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode); GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation; #define glBlendEquation glad_glBlendEquation #endif #ifndef GL_VERSION_1_5 #define GL_VERSION_1_5 1 GLAPI int GLAD_GL_VERSION_1_5; -typedef void (APIENTRYP PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); +typedef void(APIENTRYP PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); GLAPI PFNGLGENQUERIESPROC glad_glGenQueries; #define glGenQueries glad_glGenQueries -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); +typedef void(APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); GLAPI PFNGLDELETEQUERIESPROC glad_glDeleteQueries; #define glDeleteQueries glad_glDeleteQueries -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC)(GLuint id); +typedef GLboolean(APIENTRYP PFNGLISQUERYPROC)(GLuint id); GLAPI PFNGLISQUERYPROC glad_glIsQuery; #define glIsQuery glad_glIsQuery -typedef void (APIENTRYP PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); +typedef void(APIENTRYP PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); GLAPI PFNGLBEGINQUERYPROC glad_glBeginQuery; #define glBeginQuery glad_glBeginQuery -typedef void (APIENTRYP PFNGLENDQUERYPROC)(GLenum target); +typedef void(APIENTRYP PFNGLENDQUERYPROC)(GLenum target); GLAPI PFNGLENDQUERYPROC glad_glEndQuery; #define glEndQuery glad_glEndQuery -typedef void (APIENTRYP PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, + GLint *params); GLAPI PFNGLGETQUERYIVPROC glad_glGetQueryiv; #define glGetQueryiv glad_glGetQueryiv -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, + GLint *params); GLAPI PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; #define glGetQueryObjectiv glad_glGetQueryObjectiv -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint *params); +typedef void(APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, + GLuint *params); GLAPI PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; #define glGetQueryObjectuiv glad_glGetQueryObjectuiv -typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); +typedef void(APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; #define glBindBuffer glad_glBindBuffer -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); +typedef void(APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, + const GLuint *buffers); GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; #define glDeleteBuffers glad_glDeleteBuffers -typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); +typedef void(APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; #define glGenBuffers glad_glGenBuffers -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); +typedef GLboolean(APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; #define glIsBuffer glad_glIsBuffer -typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void(APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, + const void *data, GLenum usage); GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; #define glBufferData glad_glBufferData -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef void(APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, + GLsizeiptr size, + const void *data); GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; #define glBufferSubData glad_glBufferSubData -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void *data); +typedef void(APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum target, + GLintptr offset, + GLsizeiptr size, void *data); GLAPI PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; #define glGetBufferSubData glad_glGetBufferSubData -typedef void * (APIENTRYP PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); +typedef void *(APIENTRYP PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); GLAPI PFNGLMAPBUFFERPROC glad_glMapBuffer; #define glMapBuffer glad_glMapBuffer -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum target); +typedef GLboolean(APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum target); GLAPI PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; #define glUnmapBuffer glad_glUnmapBuffer -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, + GLenum pname, + GLint *params); GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; #define glGetBufferParameteriv glad_glGetBufferParameteriv -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void **params); +typedef void(APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, + void **params); GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; #define glGetBufferPointerv glad_glGetBufferPointerv #endif #ifndef GL_VERSION_2_0 #define GL_VERSION_2_0 1 GLAPI int GLAD_GL_VERSION_2_0; -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); +typedef void(APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, + GLenum modeAlpha); GLAPI PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; #define glBlendEquationSeparate glad_glBlendEquationSeparate -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); +typedef void(APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); GLAPI PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; #define glDrawBuffers glad_glDrawBuffers -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void(APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, + GLenum dpfail, + GLenum dppass); GLAPI PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; #define glStencilOpSeparate glad_glStencilOpSeparate -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void(APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, + GLint ref, GLuint mask); GLAPI PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; #define glStencilFuncSeparate glad_glStencilFuncSeparate -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); +typedef void(APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); GLAPI PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; #define glStencilMaskSeparate glad_glStencilMaskSeparate -typedef void (APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); +typedef void(APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); GLAPI PFNGLATTACHSHADERPROC glad_glAttachShader; #define glAttachShader glad_glAttachShader -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); +typedef void(APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, + GLuint index, + const GLchar *name); GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; #define glBindAttribLocation glad_glBindAttribLocation -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); +typedef void(APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; #define glCompileShader glad_glCompileShader -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(void); +typedef GLuint(APIENTRYP PFNGLCREATEPROGRAMPROC)(void); GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; #define glCreateProgram glad_glCreateProgram -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); +typedef GLuint(APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); GLAPI PFNGLCREATESHADERPROC glad_glCreateShader; #define glCreateShader glad_glCreateShader -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program); +typedef void(APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program); GLAPI PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; #define glDeleteProgram glad_glDeleteProgram -typedef void (APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader); +typedef void(APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader); GLAPI PFNGLDELETESHADERPROC glad_glDeleteShader; #define glDeleteShader glad_glDeleteShader -typedef void (APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); +typedef void(APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); GLAPI PFNGLDETACHSHADERPROC glad_glDetachShader; #define glDetachShader glad_glDetachShader -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); +typedef void(APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); GLAPI PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; #define glDisableVertexAttribArray glad_glDisableVertexAttribArray -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); +typedef void(APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); GLAPI PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; #define glEnableVertexAttribArray glad_glEnableVertexAttribArray -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void(APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, + GLsizei bufSize, + GLsizei *length, GLint *size, + GLenum *type, GLchar *name); GLAPI PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; #define glGetActiveAttrib glad_glGetActiveAttrib -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void(APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, + GLsizei bufSize, + GLsizei *length, GLint *size, + GLenum *type, GLchar *name); GLAPI PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; #define glGetActiveUniform glad_glGetActiveUniform -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef void(APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, + GLsizei maxCount, + GLsizei *count, + GLuint *shaders); GLAPI PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; #define glGetAttachedShaders glad_glGetAttachedShaders -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); +typedef GLint(APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, + const GLchar *name); GLAPI PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; #define glGetAttribLocation glad_glGetAttribLocation -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, + GLint *params); GLAPI PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; #define glGetProgramiv glad_glGetProgramiv -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void(APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, + GLsizei bufSize, + GLsizei *length, + GLchar *infoLog); GLAPI PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; #define glGetProgramInfoLog glad_glGetProgramInfoLog -typedef void (APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, + GLint *params); GLAPI PFNGLGETSHADERIVPROC glad_glGetShaderiv; #define glGetShaderiv glad_glGetShaderiv -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void(APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, + GLsizei bufSize, + GLsizei *length, + GLchar *infoLog); GLAPI PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; #define glGetShaderInfoLog glad_glGetShaderInfoLog -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef void(APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, + GLsizei *length, + GLchar *source); GLAPI PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; #define glGetShaderSource glad_glGetShaderSource -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); +typedef GLint(APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, + const GLchar *name); GLAPI PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; #define glGetUniformLocation glad_glGetUniformLocation -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); +typedef void(APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, + GLfloat *params); GLAPI PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; #define glGetUniformfv glad_glGetUniformfv -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); +typedef void(APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, + GLint *params); GLAPI PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; #define glGetUniformiv glad_glGetUniformiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble *params); +typedef void(APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, + GLdouble *params); GLAPI PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; #define glGetVertexAttribdv glad_glGetVertexAttribdv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); +typedef void(APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, + GLfloat *params); GLAPI PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; #define glGetVertexAttribfv glad_glGetVertexAttribfv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, + GLint *params); GLAPI PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; #define glGetVertexAttribiv glad_glGetVertexAttribiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void **pointer); +typedef void(APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, + GLenum pname, + void **pointer); GLAPI PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; #define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC)(GLuint program); +typedef GLboolean(APIENTRYP PFNGLISPROGRAMPROC)(GLuint program); GLAPI PFNGLISPROGRAMPROC glad_glIsProgram; #define glIsProgram glad_glIsProgram -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC)(GLuint shader); +typedef GLboolean(APIENTRYP PFNGLISSHADERPROC)(GLuint shader); GLAPI PFNGLISSHADERPROC glad_glIsShader; #define glIsShader glad_glIsShader -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program); +typedef void(APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program); GLAPI PFNGLLINKPROGRAMPROC glad_glLinkProgram; #define glLinkProgram glad_glLinkProgram -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void(APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, + const GLchar *const *string, + const GLint *length); GLAPI PFNGLSHADERSOURCEPROC glad_glShaderSource; #define glShaderSource glad_glShaderSource -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program); +typedef void(APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program); GLAPI PFNGLUSEPROGRAMPROC glad_glUseProgram; #define glUseProgram glad_glUseProgram -typedef void (APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); +typedef void(APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); GLAPI PFNGLUNIFORM1FPROC glad_glUniform1f; #define glUniform1f glad_glUniform1f -typedef void (APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); +typedef void(APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, + GLfloat v1); GLAPI PFNGLUNIFORM2FPROC glad_glUniform2f; #define glUniform2f glad_glUniform2f -typedef void (APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void(APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, + GLfloat v1, GLfloat v2); GLAPI PFNGLUNIFORM3FPROC glad_glUniform3f; #define glUniform3f glad_glUniform3f -typedef void (APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void(APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, + GLfloat v1, GLfloat v2, GLfloat v3); GLAPI PFNGLUNIFORM4FPROC glad_glUniform4f; #define glUniform4f glad_glUniform4f -typedef void (APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0); +typedef void(APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0); GLAPI PFNGLUNIFORM1IPROC glad_glUniform1i; #define glUniform1i glad_glUniform1i -typedef void (APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); +typedef void(APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); GLAPI PFNGLUNIFORM2IPROC glad_glUniform2i; #define glUniform2i glad_glUniform2i -typedef void (APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); +typedef void(APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, + GLint v2); GLAPI PFNGLUNIFORM3IPROC glad_glUniform3i; #define glUniform3i glad_glUniform3i -typedef void (APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void(APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, + GLint v2, GLint v3); GLAPI PFNGLUNIFORM4IPROC glad_glUniform4i; #define glUniform4i glad_glUniform4i -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, + const GLfloat *value); GLAPI PFNGLUNIFORM1FVPROC glad_glUniform1fv; #define glUniform1fv glad_glUniform1fv -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, + const GLfloat *value); GLAPI PFNGLUNIFORM2FVPROC glad_glUniform2fv; #define glUniform2fv glad_glUniform2fv -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, + const GLfloat *value); GLAPI PFNGLUNIFORM3FVPROC glad_glUniform3fv; #define glUniform3fv glad_glUniform3fv -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, + const GLfloat *value); GLAPI PFNGLUNIFORM4FVPROC glad_glUniform4fv; #define glUniform4fv glad_glUniform4fv -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value); +typedef void(APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, + const GLint *value); GLAPI PFNGLUNIFORM1IVPROC glad_glUniform1iv; #define glUniform1iv glad_glUniform1iv -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value); +typedef void(APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, + const GLint *value); GLAPI PFNGLUNIFORM2IVPROC glad_glUniform2iv; #define glUniform2iv glad_glUniform2iv -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *value); +typedef void(APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, + const GLint *value); GLAPI PFNGLUNIFORM3IVPROC glad_glUniform3iv; #define glUniform3iv glad_glUniform3iv -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *value); +typedef void(APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, + const GLint *value); GLAPI PFNGLUNIFORM4IVPROC glad_glUniform4iv; #define glUniform4iv glad_glUniform4iv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; #define glUniformMatrix2fv glad_glUniformMatrix2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; #define glUniformMatrix3fv glad_glUniformMatrix3fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; #define glUniformMatrix4fv glad_glUniformMatrix4fv -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program); +typedef void(APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program); GLAPI PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; #define glValidateProgram glad_glValidateProgram -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); +typedef void(APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); GLAPI PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; #define glVertexAttrib1d glad_glVertexAttrib1d -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint index, + const GLdouble *v); GLAPI PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; #define glVertexAttrib1dv glad_glVertexAttrib1dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); +typedef void(APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); GLAPI PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; #define glVertexAttrib1f glad_glVertexAttrib1f -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, + const GLfloat *v); GLAPI PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; #define glVertexAttrib1fv glad_glVertexAttrib1fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); +typedef void(APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); GLAPI PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; #define glVertexAttrib1s glad_glVertexAttrib1s -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint index, + const GLshort *v); GLAPI PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; #define glVertexAttrib1sv glad_glVertexAttrib1sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); +typedef void(APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, + GLdouble y); GLAPI PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; #define glVertexAttrib2d glad_glVertexAttrib2d -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint index, + const GLdouble *v); GLAPI PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; #define glVertexAttrib2dv glad_glVertexAttrib2dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); +typedef void(APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, + GLfloat y); GLAPI PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; #define glVertexAttrib2f glad_glVertexAttrib2f -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, + const GLfloat *v); GLAPI PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; #define glVertexAttrib2fv glad_glVertexAttrib2fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); +typedef void(APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, + GLshort y); GLAPI PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; #define glVertexAttrib2s glad_glVertexAttrib2s -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint index, + const GLshort *v); GLAPI PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; #define glVertexAttrib2sv glad_glVertexAttrib2sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void(APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, + GLdouble y, GLdouble z); GLAPI PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; #define glVertexAttrib3d glad_glVertexAttrib3d -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint index, + const GLdouble *v); GLAPI PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; #define glVertexAttrib3dv glad_glVertexAttrib3dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void(APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, + GLfloat y, GLfloat z); GLAPI PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; #define glVertexAttrib3f glad_glVertexAttrib3f -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, + const GLfloat *v); GLAPI PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; #define glVertexAttrib3fv glad_glVertexAttrib3fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); +typedef void(APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, + GLshort y, GLshort z); GLAPI PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; #define glVertexAttrib3s glad_glVertexAttrib3s -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint index, + const GLshort *v); GLAPI PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; #define glVertexAttrib3sv glad_glVertexAttrib3sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, + const GLbyte *v); GLAPI PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; #define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; #define glVertexAttrib4Niv glad_glVertexAttrib4Niv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, + const GLshort *v); GLAPI PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; #define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, + GLubyte y, GLubyte z, + GLubyte w); GLAPI PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; #define glVertexAttrib4Nub glad_glVertexAttrib4Nub -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, + const GLubyte *v); GLAPI PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; #define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, + const GLuint *v); GLAPI PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; #define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, + const GLushort *v); GLAPI PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; #define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte *v); GLAPI PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; #define glVertexAttrib4bv glad_glVertexAttrib4bv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, + GLdouble y, GLdouble z, + GLdouble w); GLAPI PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; #define glVertexAttrib4d glad_glVertexAttrib4d -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint index, + const GLdouble *v); GLAPI PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; #define glVertexAttrib4dv glad_glVertexAttrib4dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, + GLfloat y, GLfloat z, + GLfloat w); GLAPI PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; #define glVertexAttrib4f glad_glVertexAttrib4f -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, + const GLfloat *v); GLAPI PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; #define glVertexAttrib4fv glad_glVertexAttrib4fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; #define glVertexAttrib4iv glad_glVertexAttrib4iv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, + GLshort y, GLshort z, + GLshort w); GLAPI PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; #define glVertexAttrib4s glad_glVertexAttrib4s -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint index, + const GLshort *v); GLAPI PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; #define glVertexAttrib4sv glad_glVertexAttrib4sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, + const GLubyte *v); GLAPI PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; #define glVertexAttrib4ubv glad_glVertexAttrib4ubv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, + const GLuint *v); GLAPI PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; #define glVertexAttrib4uiv glad_glVertexAttrib4uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint index, + const GLushort *v); GLAPI PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; #define glVertexAttrib4usv glad_glVertexAttrib4usv -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void(APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void *pointer); GLAPI PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; #define glVertexAttribPointer glad_glVertexAttribPointer #endif #ifndef GL_VERSION_2_1 #define GL_VERSION_2_1 1 GLAPI int GLAD_GL_VERSION_2_1; -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; #define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; #define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; #define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; #define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; #define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void(APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; #define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv #endif #ifndef GL_VERSION_3_0 #define GL_VERSION_3_0 1 GLAPI int GLAD_GL_VERSION_3_0; -typedef void (APIENTRYP PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void(APIENTRYP PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, + GLboolean g, GLboolean b, + GLboolean a); GLAPI PFNGLCOLORMASKIPROC glad_glColorMaski; #define glColorMaski glad_glColorMaski -typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean *data); +typedef void(APIENTRYP PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, + GLboolean *data); GLAPI PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; #define glGetBooleani_v glad_glGetBooleani_v -typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint *data); +typedef void(APIENTRYP PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, + GLint *data); GLAPI PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; #define glGetIntegeri_v glad_glGetIntegeri_v -typedef void (APIENTRYP PFNGLENABLEIPROC)(GLenum target, GLuint index); +typedef void(APIENTRYP PFNGLENABLEIPROC)(GLenum target, GLuint index); GLAPI PFNGLENABLEIPROC glad_glEnablei; #define glEnablei glad_glEnablei -typedef void (APIENTRYP PFNGLDISABLEIPROC)(GLenum target, GLuint index); +typedef void(APIENTRYP PFNGLDISABLEIPROC)(GLenum target, GLuint index); GLAPI PFNGLDISABLEIPROC glad_glDisablei; #define glDisablei glad_glDisablei -typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC)(GLenum target, GLuint index); +typedef GLboolean(APIENTRYP PFNGLISENABLEDIPROC)(GLenum target, GLuint index); GLAPI PFNGLISENABLEDIPROC glad_glIsEnabledi; #define glIsEnabledi glad_glIsEnabledi -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); +typedef void(APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); GLAPI PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; #define glBeginTransformFeedback glad_glBeginTransformFeedback -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(void); +typedef void(APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(void); GLAPI PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; #define glEndTransformFeedback glad_glEndTransformFeedback -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void(APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, + GLuint buffer, GLintptr offset, + GLsizeiptr size); GLAPI PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; #define glBindBufferRange glad_glBindBufferRange -typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); +typedef void(APIENTRYP PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, + GLuint buffer); GLAPI PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; #define glBindBufferBase glad_glBindBufferBase -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +typedef void(APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC)( + GLuint program, GLsizei count, const GLchar *const *varyings, + GLenum bufferMode); GLAPI PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; #define glTransformFeedbackVaryings glad_glTransformFeedbackVaryings -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void(APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)( + GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, + GLsizei *size, GLenum *type, GLchar *name); GLAPI PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; #define glGetTransformFeedbackVarying glad_glGetTransformFeedbackVarying -typedef void (APIENTRYP PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); +typedef void(APIENTRYP PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); GLAPI PFNGLCLAMPCOLORPROC glad_glClampColor; #define glClampColor glad_glClampColor -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); +typedef void(APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); GLAPI PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; #define glBeginConditionalRender glad_glBeginConditionalRender -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(void); +typedef void(APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(void); GLAPI PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; #define glEndConditionalRender glad_glEndConditionalRender -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void(APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, + GLenum type, + GLsizei stride, + const void *pointer); GLAPI PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; #define glVertexAttribIPointer glad_glVertexAttribIPointer -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, + GLint *params); GLAPI PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; #define glGetVertexAttribIiv glad_glGetVertexAttribIiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint *params); +typedef void(APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, + GLuint *params); GLAPI PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; #define glGetVertexAttribIuiv glad_glGetVertexAttribIuiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); GLAPI PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; #define glVertexAttribI1i glad_glVertexAttribI1i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, + GLint y); GLAPI PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; #define glVertexAttribI2i glad_glVertexAttribI2i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, + GLint z); GLAPI PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; #define glVertexAttribI3i glad_glVertexAttribI3i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, + GLint z, GLint w); GLAPI PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; #define glVertexAttribI4i glad_glVertexAttribI4i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); GLAPI PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; #define glVertexAttribI1ui glad_glVertexAttribI1ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, + GLuint y); GLAPI PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; #define glVertexAttribI2ui glad_glVertexAttribI2ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, + GLuint y, GLuint z); GLAPI PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; #define glVertexAttribI3ui glad_glVertexAttribI3ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, + GLuint y, GLuint z, GLuint w); GLAPI PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; #define glVertexAttribI4ui glad_glVertexAttribI4ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; #define glVertexAttribI1iv glad_glVertexAttribI1iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; #define glVertexAttribI2iv glad_glVertexAttribI2iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; #define glVertexAttribI3iv glad_glVertexAttribI3iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; #define glVertexAttribI4iv glad_glVertexAttribI4iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, + const GLuint *v); GLAPI PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; #define glVertexAttribI1uiv glad_glVertexAttribI1uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, + const GLuint *v); GLAPI PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; #define glVertexAttribI2uiv glad_glVertexAttribI2uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, + const GLuint *v); GLAPI PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; #define glVertexAttribI3uiv glad_glVertexAttribI3uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, + const GLuint *v); GLAPI PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; #define glVertexAttribI4uiv glad_glVertexAttribI4uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, + const GLbyte *v); GLAPI PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; #define glVertexAttribI4bv glad_glVertexAttribI4bv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, + const GLshort *v); GLAPI PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; #define glVertexAttribI4sv glad_glVertexAttribI4sv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, + const GLubyte *v); GLAPI PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; #define glVertexAttribI4ubv glad_glVertexAttribI4ubv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort *v); +typedef void(APIENTRYP PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, + const GLushort *v); GLAPI PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; #define glVertexAttribI4usv glad_glVertexAttribI4usv -typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint *params); +typedef void(APIENTRYP PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, + GLuint *params); GLAPI PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; #define glGetUniformuiv glad_glGetUniformuiv -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar *name); +typedef void(APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, + GLuint color, + const GLchar *name); GLAPI PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; #define glBindFragDataLocation glad_glBindFragDataLocation -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar *name); +typedef GLint(APIENTRYP PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, + const GLchar *name); GLAPI PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; #define glGetFragDataLocation glad_glGetFragDataLocation -typedef void (APIENTRYP PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); +typedef void(APIENTRYP PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); GLAPI PFNGLUNIFORM1UIPROC glad_glUniform1ui; #define glUniform1ui glad_glUniform1ui -typedef void (APIENTRYP PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); +typedef void(APIENTRYP PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, + GLuint v1); GLAPI PFNGLUNIFORM2UIPROC glad_glUniform2ui; #define glUniform2ui glad_glUniform2ui -typedef void (APIENTRYP PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void(APIENTRYP PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, + GLuint v1, GLuint v2); GLAPI PFNGLUNIFORM3UIPROC glad_glUniform3ui; #define glUniform3ui glad_glUniform3ui -typedef void (APIENTRYP PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void(APIENTRYP PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, + GLuint v1, GLuint v2, GLuint v3); GLAPI PFNGLUNIFORM4UIPROC glad_glUniform4ui; #define glUniform4ui glad_glUniform4ui -typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint *value); +typedef void(APIENTRYP PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, + const GLuint *value); GLAPI PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; #define glUniform1uiv glad_glUniform1uiv -typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint *value); +typedef void(APIENTRYP PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, + const GLuint *value); GLAPI PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; #define glUniform2uiv glad_glUniform2uiv -typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint *value); +typedef void(APIENTRYP PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, + const GLuint *value); GLAPI PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; #define glUniform3uiv glad_glUniform3uiv -typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint *value); +typedef void(APIENTRYP PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, + const GLuint *value); GLAPI PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; #define glUniform4uiv glad_glUniform4uiv -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint *params); +typedef void(APIENTRYP PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, + const GLint *params); GLAPI PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; #define glTexParameterIiv glad_glTexParameterIiv -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint *params); +typedef void(APIENTRYP PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, + const GLuint *params); GLAPI PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; #define glTexParameterIuiv glad_glTexParameterIuiv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, + GLint *params); GLAPI PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; #define glGetTexParameterIiv glad_glGetTexParameterIiv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint *params); +typedef void(APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, + GLenum pname, + GLuint *params); GLAPI PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; #define glGetTexParameterIuiv glad_glGetTexParameterIuiv -typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void(APIENTRYP PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, + const GLint *value); GLAPI PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; #define glClearBufferiv glad_glClearBufferiv -typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void(APIENTRYP PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, + const GLuint *value); GLAPI PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; #define glClearBufferuiv glad_glClearBufferuiv -typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void(APIENTRYP PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, + const GLfloat *value); GLAPI PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; #define glClearBufferfv glad_glClearBufferfv -typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef void(APIENTRYP PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, + GLfloat depth, GLint stencil); GLAPI PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; #define glClearBufferfi glad_glClearBufferfi -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); +typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC)(GLenum name, + GLuint index); GLAPI PFNGLGETSTRINGIPROC glad_glGetStringi; #define glGetStringi glad_glGetStringi -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); +typedef GLboolean(APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); GLAPI PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; #define glIsRenderbuffer glad_glIsRenderbuffer -typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); +typedef void(APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum target, + GLuint renderbuffer); GLAPI PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; #define glBindRenderbuffer glad_glBindRenderbuffer -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers); +typedef void(APIENTRYP PFNGLDELETERENDERBUFFERSPROC)( + GLsizei n, const GLuint *renderbuffers); GLAPI PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; #define glDeleteRenderbuffers glad_glDeleteRenderbuffers -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); +typedef void(APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei n, + GLuint *renderbuffers); GLAPI PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; #define glGenRenderbuffers glad_glGenRenderbuffers -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void(APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height); GLAPI PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; #define glRenderbufferStorage glad_glRenderbufferStorage -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, + GLenum pname, + GLint *params); GLAPI PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; #define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); +typedef GLboolean(APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); GLAPI PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; #define glIsFramebuffer glad_glIsFramebuffer -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); +typedef void(APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum target, + GLuint framebuffer); GLAPI PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; #define glBindFramebuffer glad_glBindFramebuffer -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers); +typedef void(APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, + const GLuint *framebuffers); GLAPI PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; #define glDeleteFramebuffers glad_glDeleteFramebuffers -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); +typedef void(APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, + GLuint *framebuffers); GLAPI PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; #define glGenFramebuffers glad_glGenFramebuffers -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); +typedef GLenum(APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); GLAPI PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; #define glCheckFramebufferStatus glad_glCheckFramebufferStatus -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void(APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level); GLAPI PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; #define glFramebufferTexture1D glad_glFramebufferTexture1D -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void(APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level); GLAPI PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; #define glFramebufferTexture2D glad_glFramebufferTexture2D -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void(APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC)( + GLenum target, GLenum attachment, GLenum textarget, GLuint texture, + GLint level, GLint zoffset); GLAPI PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; #define glFramebufferTexture3D glad_glFramebufferTexture3D -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void(APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)( + GLenum target, GLenum attachment, GLenum renderbuffertarget, + GLuint renderbuffer); GLAPI PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; #define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; -#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv -typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum target); +typedef void(APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)( + GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC + glad_glGetFramebufferAttachmentParameteriv; +#define glGetFramebufferAttachmentParameteriv \ + glad_glGetFramebufferAttachmentParameteriv +typedef void(APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum target); GLAPI PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; #define glGenerateMipmap glad_glGenerateMipmap -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void(APIENTRYP PFNGLBLITFRAMEBUFFERPROC)( + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, + GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); GLAPI PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; #define glBlitFramebuffer glad_glBlitFramebuffer -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; +typedef void(APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)( + GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, + GLsizei height); +GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC + glad_glRenderbufferStorageMultisample; #define glRenderbufferStorageMultisample glad_glRenderbufferStorageMultisample -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void(APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)( + GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); GLAPI PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; #define glFramebufferTextureLayer glad_glFramebufferTextureLayer -typedef void * (APIENTRYP PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC)(GLenum target, + GLintptr offset, + GLsizeiptr length, + GLbitfield access); GLAPI PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; #define glMapBufferRange glad_glMapBufferRange -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); +typedef void(APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, + GLintptr offset, + GLsizeiptr length); GLAPI PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; #define glFlushMappedBufferRange glad_glFlushMappedBufferRange -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC)(GLuint array); +typedef void(APIENTRYP PFNGLBINDVERTEXARRAYPROC)(GLuint array); GLAPI PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; #define glBindVertexArray glad_glBindVertexArray -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint *arrays); +typedef void(APIENTRYP PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, + const GLuint *arrays); GLAPI PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; #define glDeleteVertexArrays glad_glDeleteVertexArrays -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); +typedef void(APIENTRYP PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); GLAPI PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; #define glGenVertexArrays glad_glGenVertexArrays -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC)(GLuint array); +typedef GLboolean(APIENTRYP PFNGLISVERTEXARRAYPROC)(GLuint array); GLAPI PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; #define glIsVertexArray glad_glIsVertexArray #endif #ifndef GL_VERSION_3_1 #define GL_VERSION_3_1 1 GLAPI int GLAD_GL_VERSION_3_1; -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void(APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, + GLsizei count, + GLsizei instancecount); GLAPI PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; #define glDrawArraysInstanced glad_glDrawArraysInstanced -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +typedef void(APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, + GLsizei count, + GLenum type, + const void *indices, + GLsizei instancecount); GLAPI PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; #define glDrawElementsInstanced glad_glDrawElementsInstanced -typedef void (APIENTRYP PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer); +typedef void(APIENTRYP PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, + GLuint buffer); GLAPI PFNGLTEXBUFFERPROC glad_glTexBuffer; #define glTexBuffer glad_glTexBuffer -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); +typedef void(APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); GLAPI PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; #define glPrimitiveRestartIndex glad_glPrimitiveRestartIndex -typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void(APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, + GLenum writeTarget, + GLintptr readOffset, + GLintptr writeOffset, + GLsizeiptr size); GLAPI PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; #define glCopyBufferSubData glad_glCopyBufferSubData -typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +typedef void(APIENTRYP PFNGLGETUNIFORMINDICESPROC)( + GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, + GLuint *uniformIndices); GLAPI PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; #define glGetUniformIndices glad_glGetUniformIndices -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC)( + GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, + GLenum pname, GLint *params); GLAPI PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; #define glGetActiveUniformsiv glad_glGetActiveUniformsiv -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef void(APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, + GLuint uniformIndex, + GLsizei bufSize, + GLsizei *length, + GLchar *uniformName); GLAPI PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; #define glGetActiveUniformName glad_glGetActiveUniformName -typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar *uniformBlockName); +typedef GLuint(APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC)( + GLuint program, const GLchar *uniformBlockName); GLAPI PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; #define glGetUniformBlockIndex glad_glGetUniformBlockIndex -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC)( + GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); GLAPI PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; #define glGetActiveUniformBlockiv glad_glGetActiveUniformBlockiv -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void(APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)( + GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, + GLchar *uniformBlockName); GLAPI PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; #define glGetActiveUniformBlockName glad_glGetActiveUniformBlockName -typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +typedef void(APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC)( + GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); GLAPI PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; #define glUniformBlockBinding glad_glUniformBlockBinding #endif #ifndef GL_VERSION_3_2 #define GL_VERSION_3_2 1 GLAPI int GLAD_GL_VERSION_3_2; -typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void(APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, + GLsizei count, + GLenum type, + const void *indices, + GLint basevertex); GLAPI PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; #define glDrawElementsBaseVertex glad_glDrawElementsBaseVertex -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void(APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)( + GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, + const void *indices, GLint basevertex); GLAPI PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; #define glDrawRangeElementsBaseVertex glad_glDrawRangeElementsBaseVertex -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); -GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; +typedef void(APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)( + GLenum mode, GLsizei count, GLenum type, const void *indices, + GLsizei instancecount, GLint basevertex); +GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC + glad_glDrawElementsInstancedBaseVertex; #define glDrawElementsInstancedBaseVertex glad_glDrawElementsInstancedBaseVertex -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +typedef void(APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)( + GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, + GLsizei drawcount, const GLint *basevertex); GLAPI PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; #define glMultiDrawElementsBaseVertex glad_glMultiDrawElementsBaseVertex -typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC)(GLenum mode); +typedef void(APIENTRYP PFNGLPROVOKINGVERTEXPROC)(GLenum mode); GLAPI PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; #define glProvokingVertex glad_glProvokingVertex -typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags); +typedef GLsync(APIENTRYP PFNGLFENCESYNCPROC)(GLenum condition, + GLbitfield flags); GLAPI PFNGLFENCESYNCPROC glad_glFenceSync; #define glFenceSync glad_glFenceSync -typedef GLboolean (APIENTRYP PFNGLISSYNCPROC)(GLsync sync); +typedef GLboolean(APIENTRYP PFNGLISSYNCPROC)(GLsync sync); GLAPI PFNGLISSYNCPROC glad_glIsSync; #define glIsSync glad_glIsSync -typedef void (APIENTRYP PFNGLDELETESYNCPROC)(GLsync sync); +typedef void(APIENTRYP PFNGLDELETESYNCPROC)(GLsync sync); GLAPI PFNGLDELETESYNCPROC glad_glDeleteSync; #define glDeleteSync glad_glDeleteSync -typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef GLenum(APIENTRYP PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, + GLuint64 timeout); GLAPI PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; #define glClientWaitSync glad_glClientWaitSync -typedef void (APIENTRYP PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void(APIENTRYP PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, + GLuint64 timeout); GLAPI PFNGLWAITSYNCPROC glad_glWaitSync; #define glWaitSync glad_glWaitSync -typedef void (APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *data); +typedef void(APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *data); GLAPI PFNGLGETINTEGER64VPROC glad_glGetInteger64v; #define glGetInteger64v glad_glGetInteger64v -typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void(APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, + GLsizei bufSize, GLsizei *length, + GLint *values); GLAPI PFNGLGETSYNCIVPROC glad_glGetSynciv; #define glGetSynciv glad_glGetSynciv -typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 *data); +typedef void(APIENTRYP PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, + GLint64 *data); GLAPI PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; #define glGetInteger64i_v glad_glGetInteger64i_v -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 *params); +typedef void(APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, + GLenum pname, + GLint64 *params); GLAPI PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; #define glGetBufferParameteri64v glad_glGetBufferParameteri64v -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void(APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, + GLenum attachment, + GLuint texture, + GLint level); GLAPI PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; #define glFramebufferTexture glad_glFramebufferTexture -typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void(APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC)( + GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, + GLsizei height, GLboolean fixedsamplelocations); GLAPI PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; #define glTexImage2DMultisample glad_glTexImage2DMultisample -typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void(APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC)( + GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); GLAPI PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; #define glTexImage3DMultisample glad_glTexImage3DMultisample -typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat *val); +typedef void(APIENTRYP PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, + GLfloat *val); GLAPI PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; #define glGetMultisamplefv glad_glGetMultisamplefv -typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask); +typedef void(APIENTRYP PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, + GLbitfield mask); GLAPI PFNGLSAMPLEMASKIPROC glad_glSampleMaski; #define glSampleMaski glad_glSampleMaski #endif #ifndef GL_VERSION_3_3 #define GL_VERSION_3_3 1 GLAPI int GLAD_GL_VERSION_3_3; -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef void(APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)( + GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); GLAPI PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; #define glBindFragDataLocationIndexed glad_glBindFragDataLocationIndexed -typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar *name); +typedef GLint(APIENTRYP PFNGLGETFRAGDATAINDEXPROC)(GLuint program, + const GLchar *name); GLAPI PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; #define glGetFragDataIndex glad_glGetFragDataIndex -typedef void (APIENTRYP PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint *samplers); +typedef void(APIENTRYP PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint *samplers); GLAPI PFNGLGENSAMPLERSPROC glad_glGenSamplers; #define glGenSamplers glad_glGenSamplers -typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint *samplers); +typedef void(APIENTRYP PFNGLDELETESAMPLERSPROC)(GLsizei count, + const GLuint *samplers); GLAPI PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; #define glDeleteSamplers glad_glDeleteSamplers -typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC)(GLuint sampler); +typedef GLboolean(APIENTRYP PFNGLISSAMPLERPROC)(GLuint sampler); GLAPI PFNGLISSAMPLERPROC glad_glIsSampler; #define glIsSampler glad_glIsSampler -typedef void (APIENTRYP PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); +typedef void(APIENTRYP PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); GLAPI PFNGLBINDSAMPLERPROC glad_glBindSampler; #define glBindSampler glad_glBindSampler -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param); +typedef void(APIENTRYP PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, + GLint param); GLAPI PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; #define glSamplerParameteri glad_glSamplerParameteri -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint *param); +typedef void(APIENTRYP PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, + GLenum pname, + const GLint *param); GLAPI PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; #define glSamplerParameteriv glad_glSamplerParameteriv -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param); +typedef void(APIENTRYP PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, + GLfloat param); GLAPI PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; #define glSamplerParameterf glad_glSamplerParameterf -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat *param); +typedef void(APIENTRYP PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, + GLenum pname, + const GLfloat *param); GLAPI PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; #define glSamplerParameterfv glad_glSamplerParameterfv -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint *param); +typedef void(APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, + GLenum pname, + const GLint *param); GLAPI PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; #define glSamplerParameterIiv glad_glSamplerParameterIiv -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint *param); +typedef void(APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, + GLenum pname, + const GLuint *param); GLAPI PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; #define glSamplerParameterIuiv glad_glSamplerParameterIuiv -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, + GLenum pname, + GLint *params); GLAPI PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; #define glGetSamplerParameteriv glad_glGetSamplerParameteriv -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint *params); +typedef void(APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, + GLenum pname, + GLint *params); GLAPI PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; #define glGetSamplerParameterIiv glad_glGetSamplerParameterIiv -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat *params); +typedef void(APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, + GLenum pname, + GLfloat *params); GLAPI PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; #define glGetSamplerParameterfv glad_glGetSamplerParameterfv -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint *params); +typedef void(APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, + GLenum pname, + GLuint *params); GLAPI PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; #define glGetSamplerParameterIuiv glad_glGetSamplerParameterIuiv -typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target); +typedef void(APIENTRYP PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target); GLAPI PFNGLQUERYCOUNTERPROC glad_glQueryCounter; #define glQueryCounter glad_glQueryCounter -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 *params); +typedef void(APIENTRYP PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, + GLint64 *params); GLAPI PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; #define glGetQueryObjecti64v glad_glGetQueryObjecti64v -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 *params); +typedef void(APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, + GLuint64 *params); GLAPI PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; #define glGetQueryObjectui64v glad_glGetQueryObjectui64v -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor); +typedef void(APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, + GLuint divisor); GLAPI PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; #define glVertexAttribDivisor glad_glVertexAttribDivisor -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void(APIENTRYP PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, + GLboolean normalized, + GLuint value); GLAPI PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; #define glVertexAttribP1ui glad_glVertexAttribP1ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void(APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, + GLboolean normalized, + const GLuint *value); GLAPI PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; #define glVertexAttribP1uiv glad_glVertexAttribP1uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void(APIENTRYP PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, + GLboolean normalized, + GLuint value); GLAPI PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; #define glVertexAttribP2ui glad_glVertexAttribP2ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void(APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, + GLboolean normalized, + const GLuint *value); GLAPI PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; #define glVertexAttribP2uiv glad_glVertexAttribP2uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void(APIENTRYP PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, + GLboolean normalized, + GLuint value); GLAPI PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; #define glVertexAttribP3ui glad_glVertexAttribP3ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void(APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, + GLboolean normalized, + const GLuint *value); GLAPI PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; #define glVertexAttribP3uiv glad_glVertexAttribP3uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void(APIENTRYP PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, + GLboolean normalized, + GLuint value); GLAPI PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; #define glVertexAttribP4ui glad_glVertexAttribP4ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void(APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, + GLboolean normalized, + const GLuint *value); GLAPI PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; #define glVertexAttribP4uiv glad_glVertexAttribP4uiv -typedef void (APIENTRYP PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value); +typedef void(APIENTRYP PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value); GLAPI PFNGLVERTEXP2UIPROC glad_glVertexP2ui; #define glVertexP2ui glad_glVertexP2ui -typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint *value); +typedef void(APIENTRYP PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint *value); GLAPI PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; #define glVertexP2uiv glad_glVertexP2uiv -typedef void (APIENTRYP PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value); +typedef void(APIENTRYP PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value); GLAPI PFNGLVERTEXP3UIPROC glad_glVertexP3ui; #define glVertexP3ui glad_glVertexP3ui -typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint *value); +typedef void(APIENTRYP PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint *value); GLAPI PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; #define glVertexP3uiv glad_glVertexP3uiv -typedef void (APIENTRYP PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value); +typedef void(APIENTRYP PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value); GLAPI PFNGLVERTEXP4UIPROC glad_glVertexP4ui; #define glVertexP4ui glad_glVertexP4ui -typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint *value); +typedef void(APIENTRYP PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint *value); GLAPI PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; #define glVertexP4uiv glad_glVertexP4uiv -typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; #define glTexCoordP1ui glad_glTexCoordP1ui -typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC)(GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLTEXCOORDP1UIVPROC)(GLenum type, + const GLuint *coords); GLAPI PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; #define glTexCoordP1uiv glad_glTexCoordP1uiv -typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; #define glTexCoordP2ui glad_glTexCoordP2ui -typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC)(GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLTEXCOORDP2UIVPROC)(GLenum type, + const GLuint *coords); GLAPI PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; #define glTexCoordP2uiv glad_glTexCoordP2uiv -typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; #define glTexCoordP3ui glad_glTexCoordP3ui -typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC)(GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLTEXCOORDP3UIVPROC)(GLenum type, + const GLuint *coords); GLAPI PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; #define glTexCoordP3uiv glad_glTexCoordP3uiv -typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; #define glTexCoordP4ui glad_glTexCoordP4ui -typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC)(GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLTEXCOORDP4UIVPROC)(GLenum type, + const GLuint *coords); GLAPI PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; #define glTexCoordP4uiv glad_glTexCoordP4uiv -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, + GLuint coords); GLAPI PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; #define glMultiTexCoordP1ui glad_glMultiTexCoordP1ui -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, + const GLuint *coords); GLAPI PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; #define glMultiTexCoordP1uiv glad_glMultiTexCoordP1uiv -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, + GLuint coords); GLAPI PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; #define glMultiTexCoordP2ui glad_glMultiTexCoordP2ui -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, + const GLuint *coords); GLAPI PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; #define glMultiTexCoordP2uiv glad_glMultiTexCoordP2uiv -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, + GLuint coords); GLAPI PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; #define glMultiTexCoordP3ui glad_glMultiTexCoordP3ui -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, + const GLuint *coords); GLAPI PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; #define glMultiTexCoordP3uiv glad_glMultiTexCoordP3uiv -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, + GLuint coords); GLAPI PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; #define glMultiTexCoordP4ui glad_glMultiTexCoordP4ui -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, + const GLuint *coords); GLAPI PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; #define glMultiTexCoordP4uiv glad_glMultiTexCoordP4uiv -typedef void (APIENTRYP PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords); +typedef void(APIENTRYP PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLNORMALP3UIPROC glad_glNormalP3ui; #define glNormalP3ui glad_glNormalP3ui -typedef void (APIENTRYP PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint *coords); +typedef void(APIENTRYP PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint *coords); GLAPI PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; #define glNormalP3uiv glad_glNormalP3uiv -typedef void (APIENTRYP PFNGLCOLORP3UIPROC)(GLenum type, GLuint color); +typedef void(APIENTRYP PFNGLCOLORP3UIPROC)(GLenum type, GLuint color); GLAPI PFNGLCOLORP3UIPROC glad_glColorP3ui; #define glColorP3ui glad_glColorP3ui -typedef void (APIENTRYP PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint *color); +typedef void(APIENTRYP PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint *color); GLAPI PFNGLCOLORP3UIVPROC glad_glColorP3uiv; #define glColorP3uiv glad_glColorP3uiv -typedef void (APIENTRYP PFNGLCOLORP4UIPROC)(GLenum type, GLuint color); +typedef void(APIENTRYP PFNGLCOLORP4UIPROC)(GLenum type, GLuint color); GLAPI PFNGLCOLORP4UIPROC glad_glColorP4ui; #define glColorP4ui glad_glColorP4ui -typedef void (APIENTRYP PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint *color); +typedef void(APIENTRYP PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint *color); GLAPI PFNGLCOLORP4UIVPROC glad_glColorP4uiv; #define glColorP4uiv glad_glColorP4uiv -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color); +typedef void(APIENTRYP PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color); GLAPI PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; #define glSecondaryColorP3ui glad_glSecondaryColorP3ui -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint *color); +typedef void(APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, + const GLuint *color); GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; #define glSecondaryColorP3uiv glad_glSecondaryColorP3uiv #endif