Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
cubemap.h
1#ifndef OE_RENDER_CUBEMAP_H
2#define OE_RENDER_CUBEMAP_H
3
4#include "texture.h"
5#include <glm/vec4.hpp>
6
7namespace oe::render {
8 class Cubemap : public Texture
9 {
10 public:
11 Cubemap(const unsigned int& size, const int& internal_format = 0, const int& format = 0, const int& type = 0, const int& max_mip = 5);
12
13 Cubemap(const std::string& equirectangular_filename, const float& brightness_multiplier = 1.0f, const int& max_mips = 5);
14
15 Cubemap(const std::string& folder, const std::string& extension, const bool is_hdr = false, const std::vector<std::string>& faces = {"posx", "negx", "posy", "negy", "posz", "negz"});
16
17 Cubemap(const std::vector<std::string>& filenames, const bool is_hdr = false);
18
23 const uint32_t size,
24 const std::function<glm::vec4(const uint8_t face, const uint32_t i, const uint32_t j)> generator,
25 const int& max_mips = 5
26 );
27
28 /*
29 * Get texture data from OpenGL memory
30 */
31 std::vector<std::byte> fetchTextureData(const unsigned int& face, const unsigned int& mip_level);
32
33 void fillTextureData(const std::vector<std::byte>& data, const unsigned int& face, const unsigned int& mip_level);
34
35
36 // Generate cubemap from equirectangular file
37 //Cubemap(const Texture* equirectangular_file, const bool& is_hdr = true);
38
39 unsigned int getSize() const { return _size; }
40 virtual void enableBilinearFiltering(bool enabled = true) override;
41 void generateMipMaps() override;
42 void useMipMaps();
43
44 virtual void use(const uint8_t& layer) override;
45 protected:
46 Cubemap() {}
47
48 bool _load_from_file(const std::vector<std::string>& filenames, const int& internal_format = 0, const int& format = 0, const int& type = 0);
49
50 void _construct_cubemap(const std::vector<std::string>& filenames, const int& internal_format = 0, const int& format = 0, const int& type = 0, const int& max_mips = 5);
51
52
53 template <typename T>
54 void _generate_cubemap(const unsigned int& size, oe::render::Shader* shader, T* texture, const int& max_mips);
55
56 unsigned int _size;
57 };
58}
59
60#endif
Definition cubemap.h:9
Cubemap(const uint32_t size, const std::function< glm::vec4(const uint8_t face, const uint32_t i, const uint32_t j)> generator, const int &max_mips=5)
Standard shader class.
Definition shader.h:26
Definition texture.h:27
Render related abstractions (Shader, Framebuffer, Cubemaps, Textures)
Definition opengl.h:10