PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
environment_asset.h
1#pragma once
2
3#include "pixelbullet/filesystem/virtual_path.h"
4#include "pixelbullet/filesystem/virtual_path_serialization.h"
5#include "pixelbullet/serialization/node.h"
6
7namespace pixelbullet
8{
10{
11 VirtualPath source_hdri;
12 VirtualPath skybox_cubemap_root;
13 VirtualPath diffuse_irradiance_cubemap_root;
14 VirtualPath specular_prefilter_cubemap_root;
15
16 [[nodiscard]] bool operator==(const EnvironmentAsset& other) const noexcept
17 {
18 return source_hdri.LogicalPath() == other.source_hdri.LogicalPath() &&
19 skybox_cubemap_root.LogicalPath() == other.skybox_cubemap_root.LogicalPath() &&
20 diffuse_irradiance_cubemap_root.LogicalPath() == other.diffuse_irradiance_cubemap_root.LogicalPath() &&
21 specular_prefilter_cubemap_root.LogicalPath() == other.specular_prefilter_cubemap_root.LogicalPath();
22 }
23
24 [[nodiscard]] bool operator!=(const EnvironmentAsset& other) const noexcept
25 {
26 return !(*this == other);
27 }
28};
29
30inline Node& operator<<(Node& node, const EnvironmentAsset& asset)
31{
32 node["source_hdri"] << asset.source_hdri;
33 node["skybox_cubemap_root"] << asset.skybox_cubemap_root;
34 node["diffuse_irradiance_cubemap_root"] << asset.diffuse_irradiance_cubemap_root;
35 node["specular_prefilter_cubemap_root"] << asset.specular_prefilter_cubemap_root;
36 return node;
37}
38
39inline const Node& operator>>(const Node& node, EnvironmentAsset& asset)
40{
41 if (node.HasProperty("source_hdri"))
42 {
43 node["source_hdri"] >> asset.source_hdri;
44 }
45 if (node.HasProperty("skybox_cubemap_root"))
46 {
47 node["skybox_cubemap_root"] >> asset.skybox_cubemap_root;
48 }
49 if (node.HasProperty("diffuse_irradiance_cubemap_root"))
50 {
51 node["diffuse_irradiance_cubemap_root"] >> asset.diffuse_irradiance_cubemap_root;
52 }
53 if (node.HasProperty("specular_prefilter_cubemap_root"))
54 {
55 node["specular_prefilter_cubemap_root"] >> asset.specular_prefilter_cubemap_root;
56 }
57 return node;
58}
59} // namespace pixelbullet
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:45
Definition virtual_path.h:10
Definition environment_asset.h:10