Shkyera Engine
Easy to use, game engine for Python
Loading...
Searching...
No Matches
CubeMap.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <glad/glad.h>
4#include <string>
5#include <vector>
6
9
10namespace shkyera {
11
12class CubeMap {
13 public:
14 // Constructor with configurable filter and wrap modes for cube maps
15 CubeMap(GLenum minFilter = GL_LINEAR, GLenum magFilter = GL_LINEAR, GLenum wrapS = GL_CLAMP_TO_EDGE,
16 GLenum wrapT = GL_CLAMP_TO_EDGE, GLenum wrapR = GL_CLAMP_TO_EDGE);
17 ~CubeMap();
18
19 CubeMap(const CubeMap& other) = delete;
20 CubeMap& operator=(const CubeMap& other) = delete;
21
22 CubeMap(CubeMap&& other) noexcept;
23 CubeMap& operator=(CubeMap&& other) noexcept;
24
25 void initialize(GLenum minFilter = GL_LINEAR, GLenum magFilter = GL_LINEAR, GLenum wrapS = GL_CLAMP_TO_EDGE,
26 GLenum wrapT = GL_CLAMP_TO_EDGE, GLenum wrapR = GL_CLAMP_TO_EDGE);
27
28 // Bind and unbind the cube map
29 void bind() const;
30 void unbind() const;
31
32 // Load data for each face of the cube map from file paths
35 GLenum internalFormat = GL_RGBA, GLenum format = GL_RGBA, GLenum type = GL_UNSIGNED_BYTE);
36
37 // Set texture data for each cube face from memory
38 void setFaceData(GLenum face, GLenum internalFormat, uint32_t width, uint32_t height, GLenum format, GLenum type,
39 const void* data);
40
41 // Activate this cube map on a specified texture unit
42 void activate(GLenum textureUnit) const;
43
44 // Get OpenGL texture ID
45 GLuint getID() const { return _textureID; }
46
47 private:
48 GLuint _textureID;
49};
50
51} // namespace shkyera
Definition CubeMap.hpp:12
void activate(GLenum textureUnit) const
Definition CubeMap.cpp:98
bool loadFaces(Registry *registry, HandleAndAsset< Image > up, HandleAndAsset< Image > down, HandleAndAsset< Image > left, HandleAndAsset< Image > right, HandleAndAsset< Image > front, HandleAndAsset< Image > back, GLenum internalFormat=GL_RGBA, GLenum format=GL_RGBA, GLenum type=GL_UNSIGNED_BYTE)
Definition CubeMap.cpp:60
CubeMap(const CubeMap &other)=delete
void bind() const
Definition CubeMap.cpp:52
void unbind() const
Definition CubeMap.cpp:56
GLuint getID() const
Definition CubeMap.hpp:45
CubeMap & operator=(const CubeMap &other)=delete
GLuint _textureID
Definition CubeMap.hpp:48
void initialize(GLenum minFilter=GL_LINEAR, GLenum magFilter=GL_LINEAR, GLenum wrapS=GL_CLAMP_TO_EDGE, GLenum wrapT=GL_CLAMP_TO_EDGE, GLenum wrapR=GL_CLAMP_TO_EDGE)
Definition CubeMap.cpp:14
void setFaceData(GLenum face, GLenum internalFormat, uint32_t width, uint32_t height, GLenum format, GLenum type, const void *data)
Definition CubeMap.cpp:86
~CubeMap()
Definition CubeMap.cpp:46
Definition Registry.hpp:28
Definition Asset.hpp:6
std::pair< OptionalAssetHandle, AssetRef< AssetType > > HandleAndAsset
Definition Asset.hpp:15