BlocksRenderer optimized for normal blocks

This commit is contained in:
MihailRis
2023-12-03 03:40:47 +03:00
parent 8588e582b6
commit b651c8aece
2 changed files with 98 additions and 72 deletions
+19 -2
View File
@@ -37,6 +37,12 @@ class BlocksRenderer {
void vertex(const glm::vec3& coord, float u, float v, const glm::vec4& light);
void index(int a, int b, int c, int d, int e, int f);
void vertex(const glm::ivec3& coord, float u, float v,
const glm::vec4& brightness,
const glm::ivec3& axisX,
const glm::ivec3& axisY,
const glm::ivec3& axisZ);
void face(const glm::vec3& coord, float w, float h,
const glm::vec3& axisX,
const glm::vec3& axisY,
@@ -51,6 +57,14 @@ class BlocksRenderer {
const glm::vec4(&lights)[4],
const glm::vec4& tint,
bool rotated);
void face(const glm::ivec3& coord,
const glm::ivec3& axisX,
const glm::ivec3& axisY,
const glm::ivec3& axisZ,
const UVRegion& region,
const glm::vec4& tint,
bool rotated);
void face(const glm::vec3& coord, float w, float h,
const glm::vec3& axisX,
@@ -62,7 +76,9 @@ class BlocksRenderer {
void cube(const glm::vec3& coord, const glm::vec3& size, const UVRegion(&faces)[6]);
void blockCube(int x, int y, int z, const glm::vec3& size, const UVRegion(&faces)[6], ubyte group);
void blockCubeShaded(int x, int y, int z, const glm::vec3& size, const UVRegion(&faces)[6], const Block* block, ubyte states);
/* Fastest solid shaded blocks render method */
void blockCubeShaded(int x, int y, int z, const UVRegion(&faces)[6], const Block* block, ubyte states);
/* AABB blocks render method (WIP)*/
void blockCubeShaded(const glm::vec3& pos, const glm::vec3& size, const UVRegion(&faces)[6], const Block* block, ubyte states);
void blockXSprite(int x, int y, int z, const glm::vec3& size, const UVRegion& face1, const UVRegion& face2, float spread);
@@ -70,7 +86,8 @@ class BlocksRenderer {
bool isOpen(int x, int y, int z, ubyte group) const;
glm::vec4 pickLight(int x, int y, int z) const;
glm::vec4 pickSoftLight(int x, int y, int z, const glm::ivec3& right, const glm::ivec3& up) const;
glm::vec4 pickLight(const glm::ivec3& coord) const;
glm::vec4 pickSoftLight(const glm::ivec3& coord, const glm::ivec3& right, const glm::ivec3& up) const;
glm::vec4 pickSoftLight(float x, float y, float z, const glm::ivec3& right, const glm::ivec3& up) const;
void render(const voxel* voxels, int atlas_size);
public: