stuff
This commit is contained in:
@@ -2,20 +2,31 @@
|
||||
#ifndef TEXTURE_CLASS_H
|
||||
#define TEXTURE_CLASS_H
|
||||
|
||||
#include "stb_image.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
#include "shaderClass.h"
|
||||
|
||||
// A loaded image and nothing else. Game elements wear one through a SurfaceTexture,
|
||||
// get these from the ResourceManager.
|
||||
class Texture {
|
||||
public:
|
||||
GLuint ID;
|
||||
std::string path;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
std::vector<unsigned char> pixels; // RGBA, row 0 is the bottom of the image
|
||||
|
||||
Texture(const char* filename);
|
||||
void texUnit(Shader shader, const char* uniform, GLuint unit);
|
||||
void Bind();
|
||||
void Unbind();
|
||||
Texture(int newWidth, int newHeight); // blank white
|
||||
Texture(const Texture& source); // an independent copy with its own GL texture
|
||||
|
||||
// Sends pixels to the GPU after they've been edited
|
||||
void Upload();
|
||||
void Delete();
|
||||
|
||||
private:
|
||||
void CreateGLTexture();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user