From 6c2abde5c99a236453b795abaa6d7d70105e31f7 Mon Sep 17 00:00:00 2001 From: untodesu Date: Fri, 26 Dec 2025 14:50:33 +0500 Subject: Just a big Ctrl+H refactoring --- src/game/shared/world/voxel.hh | 57 ++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 36 deletions(-) (limited to 'src/game/shared/world/voxel.hh') diff --git a/src/game/shared/world/voxel.hh b/src/game/shared/world/voxel.hh index 6013962..0a8c4a3 100644 --- a/src/game/shared/world/voxel.hh +++ b/src/game/shared/world/voxel.hh @@ -4,13 +4,8 @@ #include "shared/types.hh" -namespace world -{ class Dimension; -} // namespace world -namespace world -{ enum VoxelRender : unsigned int { VRENDER_NONE = 0U, ///< The voxel is not rendered at all VRENDER_OPAQUE, ///< The voxel is fully opaque @@ -65,17 +60,11 @@ enum VoxelVisBits : unsigned int { VVIS_UP = 1U << VFACE_TOP, ///< Positive Y VVIS_DOWN = 1U << VFACE_BOTTOM, ///< Negative Y }; -} // namespace world -namespace world -{ using VoxelOnPlaceFunc = std::function; using VoxelOnRemoveFunc = std::function; using VoxelOnTickFunc = std::function; -} // namespace world -namespace world -{ class Voxel { public: Voxel(void) = default; @@ -154,10 +143,7 @@ protected: VoxelOnRemoveFunc m_on_remove; VoxelOnTickFunc m_on_tick; }; -} // namespace world -namespace world -{ class VoxelBuilder final : public Voxel { public: VoxelBuilder(void) = default; @@ -184,59 +170,58 @@ public: std::unique_ptr build(voxel_id id) const; }; -} // namespace world -constexpr std::string_view world::Voxel::get_name(void) const noexcept +constexpr std::string_view Voxel::get_name(void) const noexcept { return m_name; } -constexpr voxel_id world::Voxel::get_id(void) const noexcept +constexpr voxel_id Voxel::get_id(void) const noexcept { return m_id; } -constexpr world::VoxelRender world::Voxel::get_render_mode(void) const noexcept +constexpr VoxelRender Voxel::get_render_mode(void) const noexcept { return m_render_mode; } -constexpr world::VoxelShape world::Voxel::get_shape(void) const noexcept +constexpr VoxelShape Voxel::get_shape(void) const noexcept { return m_shape; } -constexpr bool world::Voxel::is_animated(void) const noexcept +constexpr bool Voxel::is_animated(void) const noexcept { return m_animated; } -constexpr world::VoxelTouch world::Voxel::get_touch_type(void) const noexcept +constexpr VoxelTouch Voxel::get_touch_type(void) const noexcept { return m_touch_type; } -constexpr const glm::fvec3& world::Voxel::get_touch_values(void) const noexcept +constexpr const glm::fvec3& Voxel::get_touch_values(void) const noexcept { return m_touch_values; } -constexpr world::VoxelMaterial world::Voxel::get_surface_material(void) const noexcept +constexpr VoxelMaterial Voxel::get_surface_material(void) const noexcept { return m_surface_material; } -constexpr const math::AABBf& world::Voxel::get_collision(void) const noexcept +constexpr const math::AABBf& Voxel::get_collision(void) const noexcept { return m_collision; } -constexpr const std::vector& world::Voxel::get_default_textures(void) const noexcept +constexpr const std::vector& Voxel::get_default_textures(void) const noexcept { return m_default_textures; } -constexpr const std::vector& world::Voxel::get_face_textures(VoxelFace face) const noexcept +constexpr const std::vector& Voxel::get_face_textures(VoxelFace face) const noexcept { assert(face <= m_face_textures.size()); @@ -247,40 +232,40 @@ constexpr const std::vector& world::Voxel::get_face_textures(VoxelF return m_face_textures[face]; } -constexpr std::size_t world::Voxel::get_cached_face_offset(VoxelFace face) const noexcept +constexpr std::size_t Voxel::get_cached_face_offset(VoxelFace face) const noexcept { assert(face <= m_cached_face_offsets.size()); return m_cached_face_offsets[face]; } -constexpr std::size_t world::Voxel::get_cached_face_plane(VoxelFace face) const noexcept +constexpr std::size_t Voxel::get_cached_face_plane(VoxelFace face) const noexcept { assert(face <= m_cached_face_planes.size()); return m_cached_face_planes[face]; } -template -constexpr bool world::Voxel::is_render_mode(void) const noexcept +template +constexpr bool Voxel::is_render_mode(void) const noexcept { return m_render_mode == RenderMode; } -template -constexpr bool world::Voxel::is_shape(void) const noexcept +template +constexpr bool Voxel::is_shape(void) const noexcept { return m_shape == Shape; } -template -constexpr bool world::Voxel::is_touch_type(void) const noexcept +template +constexpr bool Voxel::is_touch_type(void) const noexcept { return m_touch_type == TouchType; } -template -constexpr bool world::Voxel::is_surface_material(void) const noexcept +template +constexpr bool Voxel::is_surface_material(void) const noexcept { return m_surface_material == Material; } -- cgit