btu::tex namespace

Namespaces

namespace detail

Classes

struct BestFormatFor
class CompressionDevice
Recommended way to use is to make it static.
class CrunchTexture
struct Dimension
class FailureSourceCategory
struct GuessBestFormatArgs
struct Settings
class Texture
struct TextureErrCategory

Enums

enum class FailureSource: std::uint8_t { BadUserInput = 1, SystemError = 2 }
enum class TextureErr: std::uint8_t { Success = 0, Unknown = 1, BadInput, MemoryAllocation, WriteFailure, ReadFailure }
enum class TextureType: std::uint8_t { Diffuse, Normal, Cube, Specular, Glow, Parallax, ModelSpaceNormal, Backlight, Skin, EnvironmentMask }

Typedefs

using Result = tl::expected<Texture, Error>
using ResultCrunch = tl::expected<CrunchTexture, Error>
using ResultError = tl::expected<void, Error>

Functions

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Dimension, w, h) namespace util
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(BestFormatFor, uncompressed, uncompressed_without_alpha, compressed, compressed_without_alpha)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GuessBestFormatArgs, opaque_alpha, allow_compressed, force_alpha)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Settings, game, compress, resize, mipmaps, use_format_whitelist, allowed_formats, output_format, landscape_textures) struct OptimizationSteps
NLOHMANN_JSON_SERIALIZE_ENUM(TextureType, {{TextureType::Diffuse, "diffuse"}, {TextureType::Normal, "normal"}, {TextureType::Cube, "cube"}, {TextureType::Specular, "specular"}, {TextureType::Glow, "glow"}, {TextureType::Parallax, "parallax"}, {TextureType::ModelSpaceNormal, "model_space_normal"}, {TextureType::Backlight, "backlight"}, {TextureType::Skin, "skin"}, {TextureType::EnvironmentMask, "environment_mask"}})
auto compute_optimization_steps(const Texture& file, const Settings& sets) →  OptimizationSteps noexcept
auto compute_optimization_steps(const CrunchTexture& file, const Settings& sets) →  OptimizationSteps noexcept
auto convert(CrunchTexture&& file, DXGI_FORMAT format) →  ResultCrunch
auto convert(Texture&& file, DXGI_FORMAT format, CompressionDevice& dev) →  Result
auto decompress(Texture&& file) →  Result
auto error_from_hresult(int64_t hr, std::error_code default_err = TextureErr::Unknown, std::source_location loc = std::source_location::current()) →  Error
auto from_string(std::u8string_view str) →  DXGI_FORMAT
auto generate_mipmaps(CrunchTexture&& file) →  ResultCrunch
auto generate_mipmaps(Texture&& file) →  Result
auto guess_best_format(DXGI_FORMAT current_format, BestFormatFor formats, const GuessBestFormatArgs& guess_params) →  DXGI_FORMAT noexcept
auto guess_texture_type(std::u8string_view path) →  std::optional<TextureType> noexcept
Based on https://forums.nexusmods.com/index.php?/topic/476227-skyrim-nif-files-with-underscores/.
auto load(Path path) →  tl::expected<Texture, Error> noexcept
auto load(Path relative_path, std::span<std::byte> data) →  tl::expected<Texture, Error> noexcept
auto load_crunch(Path path) →  tl::expected<CrunchTexture, Error> noexcept
auto load_crunch(Path relative_path, std::span<const std::byte> data) →  tl::expected<CrunchTexture, Error> noexcept
auto make_error_code(TextureErr e) →  std::error_code
auto make_error_condition(FailureSource e) →  std::error_condition
auto make_transparent_alpha(Texture&& file) →  Result
auto optimal_mip_count(Dimension dim) →  size_t constexpr noexcept
auto optimize(Texture&& file, OptimizationSteps sets, CompressionDevice& dev) →  Result noexcept
auto optimize(CrunchTexture&& file, OptimizationSteps sets, CompressionDevice& dev) →  ResultCrunch noexcept
auto resize(CrunchTexture&& file, Dimension dim) →  ResultCrunch
auto resize(Texture&& file, Dimension dim) →  Result
auto save(const CrunchTexture& tex, const Path& path) →  ResultError noexcept
auto save(const CrunchTexture& tex) →  tl::expected<std::vector<std::byte>, Error> noexcept
auto save(const Texture& tex, const Path& path) →  ResultError noexcept
auto save(const Texture& tex) →  tl::expected<std::vector<std::byte>, Error> noexcept
auto to_string(DXGI_FORMAT format) →  std::u8string_view

Variables

auto canonize_path constexpr
const FailureSourceCategory k_failure_source_category
const TextureErrCategory k_texture_err_category

Enum documentation

enum class btu::tex::FailureSource: std::uint8_t

enum class btu::tex::TextureErr: std::uint8_t

enum class btu::tex::TextureType: std::uint8_t

Typedef documentation

using btu::tex::Result = tl::expected<Texture, Error>

using btu::tex::ResultCrunch = tl::expected<CrunchTexture, Error>

using btu::tex::ResultError = tl::expected<void, Error>

Function documentation

btu::tex::NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Dimension, w, h) namespace util

btu::tex::NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(BestFormatFor, uncompressed, uncompressed_without_alpha, compressed, compressed_without_alpha)

btu::tex::NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GuessBestFormatArgs, opaque_alpha, allow_compressed, force_alpha)

btu::tex::NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Settings, game, compress, resize, mipmaps, use_format_whitelist, allowed_formats, output_format, landscape_textures) struct OptimizationSteps

btu::tex::NLOHMANN_JSON_SERIALIZE_ENUM(TextureType, {{TextureType::Diffuse, "diffuse"}, {TextureType::Normal, "normal"}, {TextureType::Cube, "cube"}, {TextureType::Specular, "specular"}, {TextureType::Glow, "glow"}, {TextureType::Parallax, "parallax"}, {TextureType::ModelSpaceNormal, "model_space_normal"}, {TextureType::Backlight, "backlight"}, {TextureType::Skin, "skin"}, {TextureType::EnvironmentMask, "environment_mask"}})

OptimizationSteps btu::tex::compute_optimization_steps(const Texture& file, const Settings& sets) noexcept

OptimizationSteps btu::tex::compute_optimization_steps(const CrunchTexture& file, const Settings& sets) noexcept

ResultCrunch btu::tex::convert(CrunchTexture&& file, DXGI_FORMAT format)

Result btu::tex::convert(Texture&& file, DXGI_FORMAT format, CompressionDevice& dev)

Result btu::tex::decompress(Texture&& file)

DXGI_FORMAT btu::tex::guess_best_format(DXGI_FORMAT current_format, BestFormatFor formats, const GuessBestFormatArgs& guess_params) noexcept

tl::expected<Texture, Error> btu::tex::load(Path path) noexcept

tl::expected<Texture, Error> btu::tex::load(Path relative_path, std::span<std::byte> data) noexcept

tl::expected<CrunchTexture, Error> btu::tex::load_crunch(Path path) noexcept

tl::expected<CrunchTexture, Error> btu::tex::load_crunch(Path relative_path, std::span<const std::byte> data) noexcept

size_t btu::tex::optimal_mip_count(Dimension dim) constexpr noexcept

Result btu::tex::optimize(Texture&& file, OptimizationSteps sets, CompressionDevice& dev) noexcept

ResultCrunch btu::tex::optimize(CrunchTexture&& file, OptimizationSteps sets, CompressionDevice& dev) noexcept

Result btu::tex::resize(Texture&& file, Dimension dim)

ResultError btu::tex::save(const CrunchTexture& tex, const Path& path) noexcept

tl::expected<std::vector<std::byte>, Error> btu::tex::save(const CrunchTexture& tex) noexcept

ResultError btu::tex::save(const Texture& tex, const Path& path) noexcept

tl::expected<std::vector<std::byte>, Error> btu::tex::save(const Texture& tex) noexcept

std::u8string_view btu::tex::to_string(DXGI_FORMAT format)

Variable documentation

auto btu::tex::canonize_path constexpr