diff options
| author | untodesu <kirill@untode.su> | 2025-12-26 23:17:56 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-12-26 23:17:56 +0500 |
| commit | 0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e (patch) | |
| tree | 90ddefa28b40b6384dd9618bb7573704de2733a9 /src/core/resource | |
| parent | 6bb4233d5b2a1688e63c947542e92ec5d5a857a6 (diff) | |
| download | voxelius-0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e.tar.bz2 voxelius-0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e.zip | |
Add include guards and header comments to sources
Diffstat (limited to 'src/core/resource')
| -rw-r--r-- | src/core/resource/image.cc | 11 | ||||
| -rw-r--r-- | src/core/resource/image.hh | 13 | ||||
| -rw-r--r-- | src/core/resource/resource.cc | 5 | ||||
| -rw-r--r-- | src/core/resource/resource.hh | 9 |
4 files changed, 33 insertions, 5 deletions
diff --git a/src/core/resource/image.cc b/src/core/resource/image.cc index 6a2109e..aded098 100644 --- a/src/core/resource/image.cc +++ b/src/core/resource/image.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: image.cc +// Description: Image resource + #include "core/pch.hh" #include "core/resource/image.hh" @@ -31,18 +36,18 @@ static const void* image_load_func(const char* name, std::uint32_t flags) callbacks.skip = &stbi_physfs_skip; callbacks.eof = &stbi_physfs_eof; - stbi_set_flip_vertically_on_load(bool(flags & IMAGE_LOAD_FLIP)); + stbi_set_flip_vertically_on_load(bool(flags & IMGFLAG_FLIP)); auto file = PHYSFS_openRead(name); if(file == nullptr) { - spdlog::error("image: {}: {}", name, physfs_error()); + spdlog::error("image: {}: {}", name, physfs::last_error()); return nullptr; } int desired_channels; - if(flags & IMAGE_LOAD_GRAY) { + if(flags & IMGFLAG_GRAY) { desired_channels = STBI_grey; } else { diff --git a/src/core/resource/image.hh b/src/core/resource/image.hh index 575591f..4f93da6 100644 --- a/src/core/resource/image.hh +++ b/src/core/resource/image.hh @@ -1,7 +1,14 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: image.hh +// Description: Image resource + +#ifndef CORE_RESOURCE_IMAGE_HH +#define CORE_RESOURCE_IMAGE_HH #pragma once -constexpr static unsigned int IMAGE_LOAD_GRAY = 0x0001U; -constexpr static unsigned int IMAGE_LOAD_FLIP = 0x0002U; +constexpr static unsigned int IMGFLAG_GRAY = 0x0001U; +constexpr static unsigned int IMGFLAG_FLIP = 0x0002U; struct Image final { static void register_resource(void); @@ -9,3 +16,5 @@ struct Image final { stbi_uc* pixels; glm::ivec2 size; }; + +#endif diff --git a/src/core/resource/resource.cc b/src/core/resource/resource.cc index 926dfc5..6a9539f 100644 --- a/src/core/resource/resource.cc +++ b/src/core/resource/resource.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: resource.cc +// Description: Resource management + #include "core/pch.hh" #include "core/resource/resource.hh" diff --git a/src/core/resource/resource.hh b/src/core/resource/resource.hh index 105c7ff..e2a5659 100644 --- a/src/core/resource/resource.hh +++ b/src/core/resource/resource.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: resource.hh +// Description: Resource management + +#ifndef CORE_RESOURCE_RESOURCE_HH +#define CORE_RESOURCE_RESOURCE_HH #pragma once template<typename T> @@ -51,3 +58,5 @@ resource_ptr<T> resource::find(std::string_view name) auto result = resource::detail::find_resource(typeid(T), name); return std::reinterpret_pointer_cast<const T>(result); } + +#endif |
