Files
fall-fever/src/Texture.h

72 lines
1.2 KiB
C++

#pragma once
#include "ShaderProgram.h"
#include "definitions/models.h"
#include <cstdint>
#include <glad/glad.h>
#include <string>
#include <vector>
// Order is important!
enum cubeMapFaces
{
cm_right,
cm_left,
cm_top,
cm_bottom,
cm_back,
cm_front,
CUBEMAP_FACES_NUM_ITEMS
};
class Texture
{
public:
Texture(const std::string &texturePath, TextureType textureType);
~Texture();
void bind(uint8_t textureUnit, ShaderProgram *shaderProgram, uint8_t textureTypeNum);
void unbind();
TextureType getTextureType();
std::string getPath();
GLuint getTextureId();
private:
std::string m_texturePath;
int32_t m_textureWidth;
int32_t m_textureHeight;
int32_t m_numComponents;
GLuint m_textureId;
TextureType m_textureType;
};
class CubeMap
{
public:
CubeMap(const char *texturePseudoPath);
CubeMap(int RESOLUTION);
~CubeMap();
void bind(ShaderProgram *shaderProgram);
void unbind();
GLuint getTextureId();
private:
void fillTexturePathVector(const char *texturePseudoPath);
std::vector<std::string> m_texturePaths;
GLuint m_textureId;
int32_t m_textureWidth;
int32_t m_textureHeight;
};