Optimization

This commit is contained in:
@clasher113
2023-11-19 15:37:18 +02:00
parent 6c70bb531b
commit 45d90cc693
2 changed files with 67 additions and 66 deletions
+20 -20
View File
@@ -24,41 +24,41 @@ class BlocksRenderer {
const Chunk* chunk = nullptr;
VoxelsVolume* voxelsBuffer;
void vertex(glm::vec3 coord, float u, float v, glm::vec4 light);
void vertex(const glm::vec3& coord, float u, float v, const glm::vec4& light);
void face(glm::vec3 coord, float w, float h,
const glm::vec3 axisX,
const glm::vec3 axisY,
void face(const glm::vec3& coord, float w, float h,
const glm::vec3& axisX,
const glm::vec3& axisY,
const UVRegion& region,
const glm::vec4 lights[4],
const glm::vec4 tint);
const glm::vec4 (&lights)[4],
const glm::vec4& tint);
void face(glm::vec3 coord, float w, float h,
const glm::vec3 axisX,
const glm::vec3 axisY,
void face(const glm::vec3& coord, float w, float h,
const glm::vec3& axisX,
const glm::vec3& axisY,
const UVRegion& region,
const glm::vec4 lights[4],
const glm::vec4 tint,
const glm::vec4 (&lights)[4],
const glm::vec4& tint,
bool rotated);
void face(glm::vec3 coord, float w, float h,
const glm::vec3 axisX,
const glm::vec3 axisY,
void face(const glm::vec3& coord, float w, float h,
const glm::vec3& axisX,
const glm::vec3& axisY,
const UVRegion& region,
const glm::vec4 lights[4]) {
const glm::vec4 (&lights)[4]) {
face(coord, w, h, axisX, axisY, region, lights, glm::vec4(1.0f));
}
void cube(glm::vec3 coord, glm::vec3 size, const UVRegion faces[6]);
void blockCube(int x, int y, int z, glm::vec3 size, const UVRegion faces[6], ubyte group);
void blockCubeShaded(int x, int y, int z, glm::vec3 size, const UVRegion faces[6], const Block* block, ubyte states);
void blockXSprite(int x, int y, int z, glm::vec3 size, const UVRegion face1, const UVRegion face2, float spread);
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);
void blockXSprite(int x, int y, int z, const glm::vec3& size, const UVRegion& face1, const UVRegion& face2, float spread);
bool isOpenForLight(int x, int y, int z) const;
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, glm::ivec3 right, glm::ivec3 up) const;
glm::vec4 pickSoftLight(int x, int y, int z, const glm::ivec3& right, const glm::ivec3& up) const;
void render(const voxel* voxels, int atlas_size);
public:
BlocksRenderer(size_t capacity);