diff options
| author | Mel <einebeere@gmail.com> | 2022-10-21 01:03:18 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-10-21 01:03:18 +0200 |
| commit | 6ed978051668c08f5a957c97570f364dd580c807 (patch) | |
| tree | e3db93c52fcd86e26bc859d46e755290d2a7f40c /src | |
| parent | 0464a83dfaebaa75d6e2d3b7431e84ebd83fccfd (diff) | |
| download | meowcraft-6ed978051668c08f5a957c97570f364dd580c807.tar.zst meowcraft-6ed978051668c08f5a957c97570f364dd580c807.zip | |
Namespace and Folder refactor
Diffstat (limited to 'src')
| -rw-r--r-- | src/GFX/Binder.cpp (renamed from src/Binder.cpp) | 4 | ||||
| -rw-r--r-- | src/GFX/Binder.hpp (renamed from src/Binder.hpp) | 4 | ||||
| -rw-r--r-- | src/GFX/Camera.cpp (renamed from src/Camera.cpp) | 2 | ||||
| -rw-r--r-- | src/GFX/Camera.hpp (renamed from src/Camera.hpp) | 6 | ||||
| -rw-r--r-- | src/GFX/Image/PPMParser.cpp (renamed from src/Image/PPMParser.cpp) | 3 | ||||
| -rw-r--r-- | src/GFX/Image/PPMParser.hpp (renamed from src/Image/PPMParser.hpp) | 2 | ||||
| -rw-r--r-- | src/GFX/Image/RawImage.cpp (renamed from src/Image/RawImage.cpp) | 2 | ||||
| -rw-r--r-- | src/GFX/Image/RawImage.hpp (renamed from src/Image/RawImage.hpp) | 2 | ||||
| -rw-r--r-- | src/GFX/Mesh.cpp | 29 | ||||
| -rw-r--r-- | src/GFX/Mesh.hpp (renamed from src/Mesh.hpp) | 4 | ||||
| -rw-r--r-- | src/GFX/Mouse.cpp (renamed from src/Mouse.cpp) | 7 | ||||
| -rw-r--r-- | src/GFX/Mouse.hpp | 21 | ||||
| -rw-r--r-- | src/GFX/Shading/Program.cpp (renamed from src/Shader/ShaderProgram.cpp) | 12 | ||||
| -rw-r--r-- | src/GFX/Shading/Program.hpp (renamed from src/Shader/ShaderProgram.hpp) | 8 | ||||
| -rw-r--r-- | src/GFX/Shading/Shader.cpp (renamed from src/Shader/Shader.cpp) | 2 | ||||
| -rw-r--r-- | src/GFX/Shading/Shader.hpp (renamed from src/Shader/Shader.hpp) | 4 | ||||
| -rw-r--r-- | src/GFX/Shading/Uniform.cpp (renamed from src/Shader/Uniform.cpp) | 2 | ||||
| -rw-r--r-- | src/GFX/Shading/Uniform.hpp (renamed from src/Shader/Uniform.hpp) | 4 | ||||
| -rw-r--r-- | src/GFX/Texture.cpp (renamed from src/Texture.cpp) | 2 | ||||
| -rw-r--r-- | src/GFX/Texture.hpp (renamed from src/Texture.hpp) | 4 | ||||
| -rw-r--r-- | src/GFX/Window.cpp (renamed from src/Window.cpp) | 6 | ||||
| -rw-r--r-- | src/GFX/Window.hpp (renamed from src/Window.hpp) | 7 | ||||
| -rw-r--r-- | src/Mesh.cpp | 25 | ||||
| -rw-r--r-- | src/Mouse.hpp | 19 | ||||
| -rw-r--r-- | src/World/BlockSide.hpp | 2 | ||||
| -rw-r--r-- | src/World/BlockType.hpp | 2 | ||||
| -rw-r--r-- | src/World/Chunk.cpp | 4 | ||||
| -rw-r--r-- | src/World/Chunk.hpp | 9 | ||||
| -rw-r--r-- | src/World/Generator.cpp | 2 | ||||
| -rw-r--r-- | src/World/Generator.hpp | 2 | ||||
| -rw-r--r-- | src/main.cpp | 51 |
31 files changed, 132 insertions, 121 deletions
diff --git a/src/Binder.cpp b/src/GFX/Binder.cpp index d013f08..e7b7e4c 100644 --- a/src/Binder.cpp +++ b/src/GFX/Binder.cpp @@ -2,7 +2,7 @@ #include "Binder.hpp" #include "Mesh.hpp" -namespace MC { +namespace MC::GFX { BindableMesh Binder::load(Mesh& mesh) { auto vao = create_vao(); @@ -24,7 +24,7 @@ uint32_t Binder::create_vao() { return static_cast<uint32_t>(vao); } -uint32_t Binder::unbind_vao() { +void Binder::unbind_vao() { glBindVertexArray(0); } diff --git a/src/Binder.hpp b/src/GFX/Binder.hpp index 9108a65..99f9791 100644 --- a/src/Binder.hpp +++ b/src/GFX/Binder.hpp @@ -3,7 +3,7 @@ #include <cstdint> #include "Mesh.hpp" -namespace MC { +namespace MC::GFX { class BindableMesh { public: @@ -29,7 +29,7 @@ public: private: static uint32_t create_vao(); - static uint32_t unbind_vao(); + static void unbind_vao(); static void store_in_attribute_list(uint32_t attribute, size_t size, float* data, size_t data_size); static void store_indices(uint32_t* indices, size_t indices_size); diff --git a/src/Camera.cpp b/src/GFX/Camera.cpp index 3a9d7cd..6b25347 100644 --- a/src/Camera.cpp +++ b/src/GFX/Camera.cpp @@ -1,6 +1,6 @@ #include "Camera.hpp" -namespace MC { +namespace MC::GFX { Vector<3> Camera::position() { return m_position; diff --git a/src/Camera.hpp b/src/GFX/Camera.hpp index 705f8b9..f03f009 100644 --- a/src/Camera.hpp +++ b/src/GFX/Camera.hpp @@ -1,9 +1,9 @@ #pragma once -#include "Math/Math.hpp" -#include "Math/Rotation.hpp" +#include "../Math/Math.hpp" +#include "../Math/Rotation.hpp" -namespace MC { +namespace MC::GFX { class Camera { public: diff --git a/src/Image/PPMParser.cpp b/src/GFX/Image/PPMParser.cpp index d7d8c6a..7fc2359 100644 --- a/src/Image/PPMParser.cpp +++ b/src/GFX/Image/PPMParser.cpp @@ -1,9 +1,8 @@ #include <cctype> #include <string> -#include <iostream> #include "PPMParser.hpp" -namespace MC::Image { +namespace MC::GFX::Image { RawImage PPMParser::parse() { auto header = parse_header(); diff --git a/src/Image/PPMParser.hpp b/src/GFX/Image/PPMParser.hpp index 7d81cb8..3909cee 100644 --- a/src/Image/PPMParser.hpp +++ b/src/GFX/Image/PPMParser.hpp @@ -4,7 +4,7 @@ #include <string_view> #include "RawImage.hpp" -namespace MC::Image { +namespace MC::GFX::Image { class PPMParser { public: diff --git a/src/Image/RawImage.cpp b/src/GFX/Image/RawImage.cpp index 00bfb0c..aca8fbc 100644 --- a/src/Image/RawImage.cpp +++ b/src/GFX/Image/RawImage.cpp @@ -1,6 +1,6 @@ #include "RawImage.hpp" -namespace MC::Image { +namespace MC::GFX::Image { void RawImage::add(RawImage::Pixel pixel) { m_pixels.push_back(pixel); diff --git a/src/Image/RawImage.hpp b/src/GFX/Image/RawImage.hpp index 6c4b122..916671b 100644 --- a/src/Image/RawImage.hpp +++ b/src/GFX/Image/RawImage.hpp @@ -4,7 +4,7 @@ #include <cstddef> #include <vector> -namespace MC::Image { +namespace MC::GFX::Image { class RawImage { public: diff --git a/src/GFX/Mesh.cpp b/src/GFX/Mesh.cpp new file mode 100644 index 0000000..12f8aaa --- /dev/null +++ b/src/GFX/Mesh.cpp @@ -0,0 +1,29 @@ +#include "Mesh.hpp" + +namespace MC::GFX { + +float* Mesh::raw() { + return (float*) m_positions.data(); +} + +size_t Mesh::size() { + return m_positions.size(); +} + +uint32_t* Mesh::raw_indices() { + return m_indices.data(); +} + +size_t Mesh::indices_size() { + return m_indices.size(); +} + +float* Mesh::raw_tex_coords() { + return (float*) m_tex_coords.data(); +} + +size_t Mesh::tex_coords_size() { + return m_tex_coords.size(); +} + +} \ No newline at end of file diff --git a/src/Mesh.hpp b/src/GFX/Mesh.hpp index b601228..f027c8c 100644 --- a/src/Mesh.hpp +++ b/src/GFX/Mesh.hpp @@ -3,9 +3,9 @@ #include <utility> #include <vector> #include <cstdint> -#include "Math/Math.hpp" +#include "../Math/Math.hpp" -namespace MC { +namespace MC::GFX { class Mesh { public: diff --git a/src/Mouse.cpp b/src/GFX/Mouse.cpp index 4715362..5cd2698 100644 --- a/src/Mouse.cpp +++ b/src/GFX/Mouse.cpp @@ -1,11 +1,10 @@ #include "Mouse.hpp" -#include "Window.hpp" -namespace MC { +namespace MC::GFX { -Vector<2> Mouse::update(Window& window) { +Vector<2> Mouse::update(GLFWwindow* window) { double x, y; - glfwGetCursorPos(window.get(), &x, &y); + glfwGetCursorPos(window, &x, &y); if (m_first_event) { m_last_x = x; diff --git a/src/GFX/Mouse.hpp b/src/GFX/Mouse.hpp new file mode 100644 index 0000000..3ed57a2 --- /dev/null +++ b/src/GFX/Mouse.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include <cstdint> +#include <GLFW/glfw3.h> +#include "../Math/Vector.hpp" + +namespace MC::GFX { + +class Mouse { +public: + Mouse() = default; + + Vector<2> update(GLFWwindow* window); +private: + bool m_first_event = true; + + float m_last_x = 0.0f; + float m_last_y = 0.0f; +}; + +} \ No newline at end of file diff --git a/src/Shader/ShaderProgram.cpp b/src/GFX/Shading/Program.cpp index 4d0b684..39393f8 100644 --- a/src/Shader/ShaderProgram.cpp +++ b/src/GFX/Shading/Program.cpp @@ -1,10 +1,10 @@ #include <GL/glew.h> #include <stdexcept> -#include "ShaderProgram.hpp" +#include "Program.hpp" -namespace MC { +namespace MC::GFX::Shading { -ShaderProgram::ShaderProgram(Shader fragment, Shader vertex) { +Program::Program(Shader fragment, Shader vertex) { m_program = glCreateProgram(); glAttachShader(m_program, fragment.get()); @@ -25,17 +25,17 @@ ShaderProgram::ShaderProgram(Shader fragment, Shader vertex) { } } -void ShaderProgram::bind() const { +void Program::bind() const { glUseProgram(m_program); } -Uniform ShaderProgram::uniform(const std::string& name) const { +Uniform Program::uniform(const std::string& name) const { auto index = glGetUniformLocation(m_program, name.c_str()); return {name, static_cast<uint32_t>(index)}; } -uint32_t ShaderProgram::get() const { +uint32_t Program::get() const { return m_program; } diff --git a/src/Shader/ShaderProgram.hpp b/src/GFX/Shading/Program.hpp index 857dc2f..15c9899 100644 --- a/src/Shader/ShaderProgram.hpp +++ b/src/GFX/Shading/Program.hpp @@ -3,14 +3,14 @@ #include <string> #include <vector> #include "Shader.hpp" -#include "../Math/Math.hpp" +#include "../../Math/Math.hpp" #include "Uniform.hpp" -namespace MC { +namespace MC::GFX::Shading { -class ShaderProgram { +class Program { public: - ShaderProgram(Shader fragment, Shader vertex); + Program(Shader fragment, Shader vertex); uint32_t get() const; diff --git a/src/Shader/Shader.cpp b/src/GFX/Shading/Shader.cpp index 0cd6ab3..ff954a5 100644 --- a/src/Shader/Shader.cpp +++ b/src/GFX/Shading/Shader.cpp @@ -2,7 +2,7 @@ #include <stdexcept> #include "Shader.hpp" -namespace MC { +namespace MC::GFX::Shading { Shader::Shader(uint32_t type, const char* source) { m_shader = glCreateShader(type); diff --git a/src/Shader/Shader.hpp b/src/GFX/Shading/Shader.hpp index 76a1197..4a3d9cf 100644 --- a/src/Shader/Shader.hpp +++ b/src/GFX/Shading/Shader.hpp @@ -1,9 +1,9 @@ #pragma once #include <cstdint> -#include "../Assets.hpp" +#include "../../Assets.hpp" -namespace MC { +namespace MC::GFX::Shading { class Shader { diff --git a/src/Shader/Uniform.cpp b/src/GFX/Shading/Uniform.cpp index 71b7633..9448574 100644 --- a/src/Shader/Uniform.cpp +++ b/src/GFX/Shading/Uniform.cpp @@ -1,7 +1,7 @@ #include <GL/glew.h> #include "Uniform.hpp" -namespace MC { +namespace MC::GFX::Shading { void Uniform::set(Matrix<4, 4> value) const { glUniformMatrix4fv(m_index, 1, GL_TRUE, value.elements); diff --git a/src/Shader/Uniform.hpp b/src/GFX/Shading/Uniform.hpp index 58cdc28..8035dfe 100644 --- a/src/Shader/Uniform.hpp +++ b/src/GFX/Shading/Uniform.hpp @@ -3,9 +3,9 @@ #include <cstdint> #include <string> #include <utility> -#include "../Math/Math.hpp" +#include "../../Math/Math.hpp" -namespace MC { +namespace MC::GFX::Shading { class Uniform { public: diff --git a/src/Texture.cpp b/src/GFX/Texture.cpp index d2e1465..1942128 100644 --- a/src/Texture.cpp +++ b/src/GFX/Texture.cpp @@ -1,7 +1,7 @@ #include <GL/glew.h> #include "Texture.hpp" -namespace MC { +namespace MC::GFX { Texture::Texture(const Image::RawImage& image) { glGenTextures(1, &m_texture); diff --git a/src/Texture.hpp b/src/GFX/Texture.hpp index 91b5e54..ff86634 100644 --- a/src/Texture.hpp +++ b/src/GFX/Texture.hpp @@ -2,11 +2,11 @@ #include "Image/RawImage.hpp" -namespace MC { +namespace MC::GFX { class Texture { public: - Texture(const Image::RawImage& image); + explicit Texture(const Image::RawImage& image); void bind(); void unbind(); diff --git a/src/Window.cpp b/src/GFX/Window.cpp index 2f1c2c0..0a1828c 100644 --- a/src/Window.cpp +++ b/src/GFX/Window.cpp @@ -1,7 +1,7 @@ #include <stdexcept> #include "Window.hpp" -namespace MC { +namespace MC::GFX { Window::Window(const char *title, uint32_t width, uint32_t height) { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); @@ -35,6 +35,10 @@ void Window::close() { glfwSetWindowShouldClose(m_window, true); } +Vector<2> Window::mouse_delta() { + return m_mouse.update(m_window); +} + bool Window::key(int key, int type) { return (glfwGetKey(m_window, key) == type); } diff --git a/src/Window.hpp b/src/GFX/Window.hpp index 5a2b640..63e8446 100644 --- a/src/Window.hpp +++ b/src/GFX/Window.hpp @@ -2,8 +2,10 @@ #include <cstdint> #include <GLFW/glfw3.h> +#include "../Math/Vector.hpp" +#include "Mouse.hpp" -namespace MC { +namespace MC::GFX { class Window { public: @@ -16,12 +18,13 @@ public: void close(); void start_frame(); + Vector<2> mouse_delta(); bool key(int key, int type); bool should_close(); private: GLFWwindow* m_window; - + Mouse m_mouse; }; } \ No newline at end of file diff --git a/src/Mesh.cpp b/src/Mesh.cpp deleted file mode 100644 index 56ce9dc..0000000 --- a/src/Mesh.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "Mesh.hpp" - -float* MC::Mesh::raw() { - return (float*)m_positions.data(); -} - -size_t MC::Mesh::size() { - return m_positions.size(); -} - -uint32_t* MC::Mesh::raw_indices() { - return m_indices.data(); -} - -size_t MC::Mesh::indices_size() { - return m_indices.size(); -} - -float* MC::Mesh::raw_tex_coords() { - return (float*)m_tex_coords.data(); -} - -size_t MC::Mesh::tex_coords_size() { - return m_tex_coords.size(); -} diff --git a/src/Mouse.hpp b/src/Mouse.hpp deleted file mode 100644 index c546a7e..0000000 --- a/src/Mouse.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include <cstdint> -#include "Math/Vector.hpp" -#include "Window.hpp" - -namespace MC { - -class Mouse { -public: - Mouse() = default; - - Vector<2> update(Window &window); -private: - bool m_first_event = true; - float m_last_x, m_last_y = 0.0f; -}; - -} \ No newline at end of file diff --git a/src/World/BlockSide.hpp b/src/World/BlockSide.hpp index 45efb11..57d3c68 100644 --- a/src/World/BlockSide.hpp +++ b/src/World/BlockSide.hpp @@ -5,7 +5,7 @@ #include <array> #include "../Math/Vector.hpp" -namespace MC { +namespace MC::World { class BlockSide { public: diff --git a/src/World/BlockType.hpp b/src/World/BlockType.hpp index e35daf8..8d83be0 100644 --- a/src/World/BlockType.hpp +++ b/src/World/BlockType.hpp @@ -1,6 +1,6 @@ #pragma -namespace MC { +namespace MC::World { enum class BlockType : uint8_t { Air, diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp index 1d541f7..0d86ddb 100644 --- a/src/World/Chunk.cpp +++ b/src/World/Chunk.cpp @@ -1,13 +1,13 @@ #include "Chunk.hpp" #include "BlockSide.hpp" -namespace MC { +namespace MC::World { void Chunk::set(uint32_t x, uint32_t y, uint32_t z, BlockType type) { m_blocks[x][y][z].type = type; } -Mesh Chunk::mesh() { +GFX::Mesh Chunk::mesh() { std::vector<Vector<3>> positions{}; std::vector<Vector<2>> tex_coords{}; std::vector<uint32_t> indices{}; diff --git a/src/World/Chunk.hpp b/src/World/Chunk.hpp index 0a5f269..7a93f5a 100644 --- a/src/World/Chunk.hpp +++ b/src/World/Chunk.hpp @@ -1,22 +1,23 @@ #pragma once #include <cstdint> +#include <optional> #include "BlockType.hpp" -#include "../Mesh.hpp" +#include "../GFX/Mesh.hpp" #include "BlockSide.hpp" +#include "../GFX/Binder.hpp" #define CHUNK_WIDTH 16 #define CHUNK_HEIGHT 32 -namespace MC { +namespace MC::World { class Chunk { public: Chunk() : m_blocks{} {}; void set(uint32_t x, uint32_t y, uint32_t z, BlockType type); - - Mesh mesh(); + GFX::Mesh mesh(); private: bool is_face_visible(uint32_t x, uint32_t y, uint32_t z, BlockSide side); diff --git a/src/World/Generator.cpp b/src/World/Generator.cpp index 5b8b9b5..d7bb038 100644 --- a/src/World/Generator.cpp +++ b/src/World/Generator.cpp @@ -1,6 +1,6 @@ #include "Generator.hpp" -namespace MC { +namespace MC::World { Chunk Generator::generate(uint32_t _x, uint32_t _y) { Chunk chunk; diff --git a/src/World/Generator.hpp b/src/World/Generator.hpp index 8e67ee1..9ddac66 100644 --- a/src/World/Generator.hpp +++ b/src/World/Generator.hpp @@ -3,7 +3,7 @@ #include <cstdint> #include "Chunk.hpp" -namespace MC { +namespace MC::World { class Generator { public: diff --git a/src/main.cpp b/src/main.cpp index d69dccd..3a8b55d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,18 +1,15 @@ #include <iostream> #include <GL/glew.h> #include <GLFW/glfw3.h> -#include <cmath> #include <cstdint> -#include "Window.hpp" -#include "Mesh.hpp" -#include "Camera.hpp" -#include "Binder.hpp" +#include "GFX/Window.hpp" +#include "GFX/Camera.hpp" +#include "GFX/Binder.hpp" #include "Math/MVP.hpp" -#include "Shader/ShaderProgram.hpp" -#include "Mouse.hpp" -#include "Texture.hpp" -#include "Image/PPMParser.hpp" +#include "GFX/Shading/Program.hpp" +#include "GFX/Texture.hpp" +#include "GFX/Image/PPMParser.hpp" #include "World/Generator.hpp" #define APP_NAME "Meowcraft" @@ -24,10 +21,10 @@ #define FOV 45 void run(); -void render(MC::BindableMesh&, MC::Texture&); -void process_input(MC::Window&, MC::Mouse&, MC::Camera&); +void render(MC::GFX::BindableMesh&, MC::GFX::Texture&); +void process_input(MC::GFX::Window&, MC::GFX::Camera&); void setup_gl(); -void fix_macos_render(MC::Window&); +void fix_macos_render(MC::GFX::Window&); int main() { glfwInit(); @@ -45,8 +42,7 @@ int main() { } void run() { - MC::Window window(APP_NAME, WINDOW_WIDTH, WINDOW_HEIGHT); - MC::Mouse mouse{}; + MC::GFX::Window window(APP_NAME, WINDOW_WIDTH, WINDOW_HEIGHT); setup_gl(); glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); @@ -54,19 +50,22 @@ void run() { glViewport(0, 0, w, h); }); - auto image = MC::Image::PPMParser(MC::Assets::Images::atlas).parse(); - auto texture = MC::Texture(image); + auto image = MC::GFX::Image::PPMParser(MC::Assets::Images::atlas).parse(); + auto texture = MC::GFX::Texture(image); - MC::Generator generator; + MC::World::Generator generator; auto chunk = generator.generate(0, 0); auto chunk_mesh = chunk.mesh(); - auto mesh = MC::Binder::load(chunk_mesh); + auto mesh = MC::GFX::Binder::load(chunk_mesh); - MC::Camera camera{}; + MC::GFX::Camera camera{}; camera.set_position({0.0f, 0.0f, 3.0f}); - MC::ShaderProgram program(MC::Shader::create_fragment(), MC::Shader::create_vertex()); + MC::GFX::Shading::Program program( + MC::GFX::Shading::Shader::create_fragment(), + MC::GFX::Shading::Shader::create_vertex() + ); auto model_uniform = program.uniform("model_matrix"); auto view_uniform = program.uniform("view_matrix"); @@ -91,7 +90,7 @@ void run() { fix_macos_render(window); #endif - process_input(window, mouse, camera); + process_input(window, camera); program.bind(); @@ -106,23 +105,23 @@ void run() { } } -void render(MC::BindableMesh& mesh, MC::Texture& texture) { +void render(MC::GFX::BindableMesh& mesh, MC::GFX::Texture& texture) { glClearColor(0.85f, 0.85f, 0.85f, 1.0f); // #DBDBDB glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); texture.bind(); mesh.bind(); - glDrawElements(GL_TRIANGLES, mesh.size(), GL_UNSIGNED_INT, 0); + glDrawElements(GL_TRIANGLES, mesh.size(), GL_UNSIGNED_INT, nullptr); mesh.unbind(); texture.unbind(); } -void process_input(MC::Window& window, MC::Mouse& mouse, MC::Camera& camera) { +void process_input(MC::GFX::Window& window, MC::GFX::Camera& camera) { if (window.key(GLFW_KEY_ESCAPE, GLFW_PRESS)) { window.close(); } - auto r = mouse.update(window); + auto r = window.mouse_delta(); auto key = [&](int key) -> float { return window.key(key, GLFW_PRESS); }; @@ -145,7 +144,7 @@ void setup_gl() { } } -void fix_macos_render(MC::Window& window) { +void fix_macos_render(MC::GFX::Window& window) { static bool moved = false; if(!moved) { |
