1er commit
This commit is contained in:
67
include/render/loader/GLLoader.h
Normal file
67
include/render/loader/GLLoader.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* GLLoader.h
|
||||
*
|
||||
* Created on: 4 nov. 2020
|
||||
* Author: simon
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define REMOVE_COPY(className) \
|
||||
className(const className &) = delete;\
|
||||
className& operator=(const className &) = delete
|
||||
|
||||
|
||||
namespace GL{
|
||||
|
||||
struct VertexAttribPointer{
|
||||
unsigned int m_Index, m_Size;
|
||||
int m_Offset;
|
||||
};
|
||||
|
||||
class VBO{
|
||||
private:
|
||||
unsigned int m_ID, m_DataStride;
|
||||
std::vector<VertexAttribPointer> m_VertexAttribs;
|
||||
public:
|
||||
REMOVE_COPY(VBO);
|
||||
VBO(VBO&& other){
|
||||
m_VertexAttribs = std::move(other.m_VertexAttribs);
|
||||
m_ID = other.m_ID;
|
||||
m_DataStride = other.m_DataStride;
|
||||
other.m_ID = 0;
|
||||
other.m_DataStride = 0;
|
||||
}
|
||||
VBO(const std::vector<float>& data, unsigned int stride);
|
||||
~VBO();
|
||||
void bind() const;
|
||||
void unbind() const;
|
||||
void addVertexAttribPointer(unsigned int index, unsigned int coordinateSize, unsigned int offset);
|
||||
void bindVertexAttribs() const;
|
||||
};
|
||||
|
||||
class VAO{
|
||||
private:
|
||||
unsigned int m_ID, m_VertexCount;
|
||||
std::vector<VBO> m_Vbos; //use to destroy vbos when become unused
|
||||
public:
|
||||
REMOVE_COPY(VAO);
|
||||
VAO(VAO&& other){
|
||||
m_ID = other.m_ID;
|
||||
m_VertexCount = other.m_VertexCount;
|
||||
m_Vbos = std::move(other.m_Vbos);
|
||||
other.m_VertexCount = 0;
|
||||
other.m_ID = 0;
|
||||
}
|
||||
VAO(unsigned int vertexCount);
|
||||
~VAO();
|
||||
unsigned int getVertexCount() const {return m_VertexCount;}
|
||||
void bindVBO(VBO& vbo);
|
||||
void bind() const;
|
||||
void unbind() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
16
include/render/loader/TextureLoader.h
Normal file
16
include/render/loader/TextureLoader.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* TextureLoader.h
|
||||
*
|
||||
* Created on: 15 nov. 2020
|
||||
* Author: simon
|
||||
*/
|
||||
|
||||
#ifndef RENDER_LOADER_TEXTURELOADER_H_
|
||||
#define RENDER_LOADER_TEXTURELOADER_H_
|
||||
|
||||
namespace TextureLoader{
|
||||
const unsigned int loadGLTexture(const char* fileName);
|
||||
}
|
||||
|
||||
|
||||
#endif /* RENDER_LOADER_TEXTURELOADER_H_ */
|
||||
18
include/render/loader/WorldLoader.h
Normal file
18
include/render/loader/WorldLoader.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/World.h"
|
||||
#include "GLLoader.h"
|
||||
|
||||
namespace td {
|
||||
namespace render {
|
||||
|
||||
namespace WorldLoader {
|
||||
|
||||
GL::VAO loadMobModel();
|
||||
GL::VAO loadWorldModel(const td::game::World* world);
|
||||
|
||||
} // namespace WorldLoader
|
||||
|
||||
|
||||
} // namespace render
|
||||
} // namespace td
|
||||
7559
include/render/loader/stb_image.h
Executable file
7559
include/render/loader/stb_image.h
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user