VenomEngine
Cross-Platform Modern Graphics Engine
Loading...
Searching...
No Matches
Skybox.h
Go to the documentation of this file.
1
8#pragma once
12
13#include <venom/common/ECS.h>
14
15namespace venom
16{
17namespace common
18{
19
20// Panoramic Skyboxes are always 2/1 ratio
21#define SKYBOX_IRRADIANCE_HEIGHT 128
22#define SKYBOX_IRRADIANCE_WIDTH (SKYBOX_IRRADIANCE_HEIGHT * 2)
23
24#define SKYBOX_RADIANCE_HEIGHT 1024
25#define SKYBOX_RADIANCE_WIDTH SKYBOX_RADIANCE_HEIGHT
26#define SKYBOX_RADIANCE_MIP_LEVELS 10
27
29{
30 float peakLuminance;
31 float averageLuminance;
32 float blurFactor;
33};
34
35class VENOM_COMMON_API SkyboxImpl : public PluginObjectImpl, public GraphicsPluginObject
36{
37public:
38 SkyboxImpl();
39 virtual ~SkyboxImpl();
40
41 vc::Error LoadSkybox(const char * texturePath);
42 vc::Error LoadSkybox(const SPtr<GraphicsCachedResource> res);
43 inline const vc::Texture & GetPanorama() const { return __panorama; }
44 inline vc::Texture & GetPanoramaMut() { return __panorama; }
45 vc::Error ChangeBlurFactor(const float factor);
46protected:
47 virtual vc::Error _LoadSkybox(const Texture & texture) = 0;
48 virtual vc::Error _LoadIrradianceMap(const Texture & texture, vc::Texture & irradianceMap) = 0;
49 virtual vc::Error _LoadRadianceMap(const Texture & texture, Texture & radianceMap) = 0;
50 virtual vc::Error _LoadBlurMap(const Texture & texture, Texture & blurMap) = 0;
51 virtual vc::Error _ChangeBlurFactor(const float factor) = 0;
52protected:
53 SkyboxShaderData _shaderData;
54private:
55 Texture __panorama;
56 Texture __radianceMap;
57 Texture __irradianceMap;
58 Texture __blurMap;
59
60 friend class Skybox;
61};
62
63class VENOM_COMMON_API Skybox : public Component, public PluginObjectImplWrapper
64{
65public:
66 Skybox();
67 Skybox(const char * path);
68 ~Skybox();
69
70 void Init(Entity entity) override;
71 void Update(Entity entity) override;
72 void _GUI(const Entity entity) override;
73 vc::String _GetComponentTitle() override;
74 bool CanRemove(Entity entity) override;
75
76 inline vc::Error LoadSkybox(const char * path) { return _impl->As<SkyboxImpl>()->LoadSkybox(path); }
77 inline vc::Error LoadSkybox(const SPtr<GraphicsCachedResource> res) { return _impl->As<SkyboxImpl>()->LoadSkybox(res); }
78 inline vc::Texture & GetPanoramaMut() { return _impl->As<SkyboxImpl>()->GetPanoramaMut(); }
79 inline vc::Error ChangeBlurFactor(const float factor) { return _impl->As<SkyboxImpl>()->ChangeBlurFactor(factor); }
80};
81}
82}
Definition Skybox.h:36
Definition Texture.h:179
High-Level Frontend of the VenomEngine project. It also contains all the code shared between every AP...
Definition Callback.h:15
Contains the entirety of the code of the VenomEngine project.
Definition Callback.h:13
Definition Skybox.h:29