restructure project
This commit is contained in:
74
include/client/render/loader/GLLoader.h
Normal file
74
include/client/render/loader/GLLoader.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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;
|
||||
unsigned int m_Size;
|
||||
unsigned int m_Offset;
|
||||
};
|
||||
|
||||
class VertexBuffer {
|
||||
private:
|
||||
unsigned int m_ID, m_DataStride;
|
||||
std::vector<VertexAttribPointer> m_VertexAttribs;
|
||||
public:
|
||||
REMOVE_COPY(VertexBuffer);
|
||||
|
||||
VertexBuffer(VertexBuffer&& 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;
|
||||
}
|
||||
|
||||
VertexBuffer(const std::vector<float>& data, unsigned int stride);
|
||||
~VertexBuffer();
|
||||
|
||||
void Bind() const;
|
||||
void Unbind() const;
|
||||
void AddVertexAttribPointer(unsigned int index, unsigned int coordinateSize, unsigned int offset);
|
||||
void BindVertexAttribs() const;
|
||||
};
|
||||
|
||||
class VertexArray {
|
||||
private:
|
||||
unsigned int m_ID, m_VertexCount;
|
||||
std::vector<VertexBuffer> m_VertexBuffers; //use to destroy vbos when become unused
|
||||
public:
|
||||
REMOVE_COPY(VertexArray);
|
||||
|
||||
VertexArray(VertexArray&& other) {
|
||||
m_ID = other.m_ID;
|
||||
m_VertexCount = other.m_VertexCount;
|
||||
m_VertexBuffers = std::move(other.m_VertexBuffers);
|
||||
other.m_VertexCount = 0;
|
||||
other.m_ID = 0;
|
||||
}
|
||||
|
||||
VertexArray(unsigned int vertexCount);
|
||||
~VertexArray();
|
||||
|
||||
unsigned int GetVertexCount() const { return m_VertexCount; }
|
||||
void BindVertexBuffer(VertexBuffer& vbo);
|
||||
void Bind() const;
|
||||
void Unbind() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
18
include/client/render/loader/TextureLoader.h
Normal file
18
include/client/render/loader/TextureLoader.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* TextureLoader.h
|
||||
*
|
||||
* Created on: 15 nov. 2020
|
||||
* Author: simon
|
||||
*/
|
||||
|
||||
#ifndef RENDER_LOADER_TEXTURELOADER_H_
|
||||
#define RENDER_LOADER_TEXTURELOADER_H_
|
||||
|
||||
namespace TextureLoader {
|
||||
|
||||
unsigned int LoadGLTexture(const char* fileName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* RENDER_LOADER_TEXTURELOADER_H_ */
|
||||
25
include/client/render/loader/WorldLoader.h
Normal file
25
include/client/render/loader/WorldLoader.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/game/World.h"
|
||||
#include "GLLoader.h"
|
||||
|
||||
namespace td {
|
||||
namespace render {
|
||||
|
||||
namespace WorldLoader {
|
||||
|
||||
struct RenderData {
|
||||
std::vector<float> positions;
|
||||
std::vector<float> colors;
|
||||
};
|
||||
|
||||
GL::VertexArray LoadMobModel();
|
||||
GL::VertexArray LoadWorldModel(const td::game::World* world);
|
||||
GL::VertexArray LoadTileSelectModel();
|
||||
RenderData LoadTowerModel(game::TowerPtr tower);
|
||||
|
||||
} // namespace WorldLoader
|
||||
|
||||
|
||||
} // namespace render
|
||||
} // namespace td
|
||||
7559
include/client/render/loader/stb_image.h
Executable file
7559
include/client/render/loader/stb_image.h
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user