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 uint32_t& 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 uint32_t& face, const uint32_t& mip_level);
32
33 void fillTextureData(const std::vector<std::byte>& data, const uint32_t& face, const uint32_t& mip_level);
34
35
36 // Generate cubemap from equirectangular file
37 //Cubemap(const Texture* equirectangular_file, const bool& is_hdr = true);
38
39 uint32_t getSize() const
40 {
41 return getDimensions().x;
42 }
43
44 virtual void enableBilinearFiltering(bool enabled = true) override;
45 void generateMipMaps() override;
46 void useMipMaps();
47 protected:
48 Cubemap()
49 {}
50
51 bool _load_from_file(const std::vector<std::string>& filenames, const int& internal_format = 0, const int& format = 0, const int& type = 0);
52
53 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);
54
55 template <typename T>
56 void _generate_cubemap(const uint32_t& size, oe::render::Shader* shader, T* texture, const int& max_mips);
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:23
Texture(const uint32_t opengl_id)
Create a texture using an existing OpenGL handle.
glm::ivec2 getDimensions(const uint8_t mip_level=0) const
Get dimensions of the texture.
Render related abstractions (Shader, Framebuffer, Cubemaps, Textures).
Definition opengl.h:12