Dicewars-Siedler/src/engine/renderer/loader/Loader.h

45 lines
1.3 KiB
C++

//
// Created by sebastian on 24.12.25.
//
#ifndef DICEWARS_SIEDLER_LOADER_H
#define DICEWARS_SIEDLER_LOADER_H
#include <string>
#include <vector>
#include "../model/RawModel.h"
#include "../model/TextQuadModel.h"
#include "../textures/ModelTexture.h"
#include "glad/glad.h"
class Loader
{
public:
static Loader& instance();
RawModel loadToVAO(const std::vector<float> &vertices, const std::vector<float> &normals, const std::vector<float> &textureCoords, const
std::vector<int> &indices);
RawModel loadToVAO(const std::vector<float>& vertices);
RawModel loadToVAO(const std::vector<float> &vertices, const std::vector<float> &textureCoords,
const std::vector<int> &indices);
~Loader();
void cleanUp();
ModelTexture loadTextureFromFile(const std::string& path, bool flipVertically = true);
TextQuadModel loadTextModel();
private:
GLuint createVAO();
GLuint loadTexture(const std::string &path, bool flipVertically);
void storeDataInAttributeList(int attributeNumber, int coordinateSize, const std::vector<float> &data);
void bindIndicesBuffer(const std::vector<int> &indices);
void unbindVAO();
std::vector<GLuint> vaoIDs;
std::vector<GLuint> vboIDs;
std::vector<GLuint> textureIDs;
};
#endif //DICEWARS_SIEDLER_LOADER_H