2023-10-03 12:43:54 -04:00
|
|
|
#ifndef RENDERER_H__
|
|
|
|
#define RENDERER_H__
|
|
|
|
#include <future>
|
|
|
|
#include <thread>
|
|
|
|
#include "../SQCSim-common/world.h"
|
|
|
|
#include "../SQCSim-common/transformation.h"
|
|
|
|
#include "define.h"
|
|
|
|
#include "mesh.h"
|
|
|
|
#include "textureatlas.h"
|
|
|
|
#include "shader.h"
|
|
|
|
#include "remoteplayer.h"
|
2023-11-20 15:40:43 -05:00
|
|
|
#include "openglcontext.h"
|
|
|
|
#include "vertexbuffer.h"
|
|
|
|
#include "../SQCSim-common/matrix4.h"
|
2023-10-03 12:43:54 -04:00
|
|
|
|
|
|
|
class Renderer {
|
|
|
|
private:
|
|
|
|
Array2d<Mesh*> m_meshes = Array2d<Mesh*>(WORLD_SIZE_X, WORLD_SIZE_Y);
|
|
|
|
|
|
|
|
TextureAtlas* m_playertext = nullptr;
|
|
|
|
Shader* m_playershader = nullptr;
|
2023-11-20 15:40:43 -05:00
|
|
|
bool test = true;
|
2023-10-03 12:43:54 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
Renderer();
|
|
|
|
~Renderer();
|
|
|
|
|
2023-11-15 08:27:51 -05:00
|
|
|
void RemoveChunk(int nbReduit);
|
|
|
|
|
2023-10-03 12:43:54 -04:00
|
|
|
void UpdateMesh(World* origin, const Vector3f& player, BlockInfo* blockinfo[BTYPE_LAST]);
|
|
|
|
|
2023-11-20 15:40:43 -05:00
|
|
|
void RenderBillboard(const Vector3f pos, TextureAtlas textureAtlas, TextureAtlas::TextureIndex idx, Shader& shader, Transformation tran);
|
|
|
|
|
2023-11-19 16:46:13 -05:00
|
|
|
void RenderWorld(World* origin, int& rendercount, const Vector3f& player_pos, const Vector3f& player_dir, Transformation world, Shader& shader, TextureAtlas& atlas) const;
|
2023-10-03 12:43:54 -04:00
|
|
|
void RenderPlayer(Player* player, Transformation tran) const;
|
|
|
|
void RenderPlayer(RemotePlayer* rplayer, const Vector3f& player_pos, const Vector3f& player_dir) const;
|
|
|
|
};
|
|
|
|
#endif
|