Merge branch 'main' into headless-mode

This commit is contained in:
MihailRis
2024-12-21 09:03:30 +03:00
22 changed files with 191 additions and 63 deletions
+12 -15
View File
@@ -8,9 +8,6 @@
#include "voxels/Chunks.hpp"
#include "lighting/Lightmap.hpp"
#include "frontend/ContentGfxCache.hpp"
#include "settings.hpp"
#include <glm/glm.hpp>
const glm::vec3 BlocksRenderer::SUN_VECTOR (0.411934f, 0.863868f, -0.279161f);
@@ -342,41 +339,41 @@ void BlocksRenderer::blockCube(
}
if (ao) {
if (isOpen(coord + Z, group)) {
if (isOpen(coord + Z, block)) {
faceAO(coord, X, Y, Z, texfaces[5], lights);
}
if (isOpen(coord - Z, group)) {
if (isOpen(coord - Z, block)) {
faceAO(coord, -X, Y, -Z, texfaces[4], lights);
}
if (isOpen(coord + Y, group)) {
if (isOpen(coord + Y, block)) {
faceAO(coord, X, -Z, Y, texfaces[3], lights);
}
if (isOpen(coord - Y, group)) {
if (isOpen(coord - Y, block)) {
faceAO(coord, X, Z, -Y, texfaces[2], lights);
}
if (isOpen(coord + X, group)) {
if (isOpen(coord + X, block)) {
faceAO(coord, -Z, Y, X, texfaces[1], lights);
}
if (isOpen(coord - X, group)) {
if (isOpen(coord - X, block)) {
faceAO(coord, Z, Y, -X, texfaces[0], lights);
}
} else {
if (isOpen(coord + Z, group)) {
if (isOpen(coord + Z, block)) {
face(coord, X, Y, Z, texfaces[5], pickLight(coord + Z), lights);
}
if (isOpen(coord - Z, group)) {
if (isOpen(coord - Z, block)) {
face(coord, -X, Y, -Z, texfaces[4], pickLight(coord - Z), lights);
}
if (isOpen(coord + Y, group)) {
if (isOpen(coord + Y, block)) {
face(coord, X, -Z, Y, texfaces[3], pickLight(coord + Y), lights);
}
if (isOpen(coord - Y, group)) {
if (isOpen(coord - Y, block)) {
face(coord, X, Z, -Y, texfaces[2], pickLight(coord - Y), lights);
}
if (isOpen(coord + X, group)) {
if (isOpen(coord + X, block)) {
face(coord, -Z, Y, X, texfaces[1], pickLight(coord + X), lights);
}
if (isOpen(coord - X, group)) {
if (isOpen(coord - X, block)) {
face(coord, Z, Y, -X, texfaces[0], pickLight(coord - X), lights);
}
}
+9 -3
View File
@@ -13,6 +13,7 @@
#include "graphics/core/MeshData.hpp"
#include "maths/util.hpp"
#include "commons.hpp"
#include "settings.hpp"
class Content;
class Mesh;
@@ -22,7 +23,6 @@ class Chunks;
class VoxelsVolume;
class Chunks;
class ContentGfxCache;
struct EngineSettings;
struct UVRegion;
class BlocksRenderer {
@@ -118,7 +118,7 @@ class BlocksRenderer {
bool isOpenForLight(int x, int y, int z) const;
// Does block allow to see other blocks sides (is it transparent)
inline bool isOpen(const glm::ivec3& pos, ubyte group) const {
inline bool isOpen(const glm::ivec3& pos, const Block& def) const {
auto id = voxelsBuffer->pickBlockId(
chunk->x * CHUNK_W + pos.x, pos.y, chunk->z * CHUNK_D + pos.z
);
@@ -126,7 +126,13 @@ class BlocksRenderer {
return false;
}
const auto& block = *blockDefsCache[id];
if ((block.drawGroup != group && block.lightPassing) || !block.rt.solid) {
if (((block.drawGroup != def.drawGroup) && block.drawGroup) || !block.rt.solid) {
return true;
}
if ((def.culling == CullingMode::DISABLED ||
(def.culling == CullingMode::OPTIONAL &&
settings.graphics.denseRender.get())) &&
id == def.rt.id) {
return true;
}
return !id;
+1 -1
View File
@@ -14,7 +14,7 @@ class Chunks;
class Camera;
class Assets;
class Player;
struct Block;
class Block;
class Engine;
class LevelController;
class WorldRenderer;
+1 -1
View File
@@ -7,7 +7,7 @@
struct ItemDef;
class Assets;
class Content;
struct Block;
class Block;
class ModelsGenerator {
public: