NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches
fog.hpp
Go to the documentation of this file.
1
12#pragma once
13
15#include "NNL/common/io.hpp"
16#include "NNL/utility/data.hpp"
17namespace nnl {
28namespace fog {
40struct Fog {
41 f32 near_ = 0.0f;
42 f32 far_ = 0.0f;
43 u32 color = 0xFF'00'00'00;
45};
46
58bool IsOfType(BufferView buffer);
59
60bool IsOfType(const std::filesystem::path& path);
61
62bool IsOfType(Reader& f);
63
78
79Fog Import(const std::filesystem::path& path);
80
81Fog Import(Reader& f);
82
92[[nodiscard]] Buffer Export(const Fog& fog);
93
94void Export(const Fog& fog, const std::filesystem::path& path);
95
96void Export(const Fog& fog, Writer& f);
98namespace raw {
104constexpr u32 kMagicBytes = utl::data::FourCC("F0G!");
105
106NNL_PACK(struct RFog {
107 u32 magic_bytes = kMagicBytes;
108 f32 near_ = 0.0f;
109 f32 far_ = 0.0f;
110 u32 color = 0;
111});
112
113static_assert(sizeof(RFog) == 0x10);
114
115Fog Convert(const RFog& rfog);
116
117RFog Parse(Reader& f);
119} // namespace raw
120
121} // namespace fog
122
123} // namespace nnl
Provides functions and classes for handling binary data.
Contains macros and definitions for fixed-width types.
constexpr u32 FourCC(const char(&str)[5]) noexcept
Generates a numeric four character code from a given string.
Definition data.hpp:36
float f32
32-bit floating point
Definition fixed_type.hpp:59
std::uint32_t u32
32-bit unsigned integer
Definition fixed_type.hpp:60
#define NNL_PACK(...)
A structure packing directive.
Definition fixed_type.hpp:41
f32 near_
Distance where the fog starts to cover objects.
Definition fog.hpp:41
f32 far_
Distance where the fog fully covers objects.
Definition fog.hpp:42
u32 color
Definition fog.hpp:43
Defines settings for depth-based environmental fog.
Definition fog.hpp:40
Fog Import(BufferView buffer)
Parses a binary file and converts it to a Fog struct.
bool IsOfType(BufferView buffer)
Tests if the provided file is a fog config.
Buffer Export(const Fog &fog)
Converts a fog config to a binary file representation.
constexpr u32 kMagicBytes
F0G! in ASCII.
Definition fog.hpp:104
Reader implementation for read-only memory buffers.
Definition io.hpp:598
Abstract class for writing data.
Definition io.hpp:136
Abstract class for reading data.
Definition io.hpp:78
std::vector< u8 > Buffer
A type alias for std::vector<u8> that denotes a raw, contiguous memory region that may be interpreted...
Definition io.hpp:40
Provides classes for reading and writing binary data to and from various sources.
Contains functions and structures for working with fog configs used by NSLAR.
Definition fog.hpp:28
Definition exception.hpp:56