summaryrefslogtreecommitdiffstats
path: root/src/RendererSectionData.cpp
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-11-21 10:57:57 +0100
committerLaG1924 <lag1924@gmail.com>2021-11-21 10:57:57 +0100
commitf16c897522b6418c399b5699f8378a25c2e5de4f (patch)
tree9fd1490645de30330b6ae84eebd1fe961c3f1e52 /src/RendererSectionData.cpp
parentAdded Gbuffer (diff)
downloadAltCraft-f16c897522b6418c399b5699f8378a25c2e5de4f.tar
AltCraft-f16c897522b6418c399b5699f8378a25c2e5de4f.tar.gz
AltCraft-f16c897522b6418c399b5699f8378a25c2e5de4f.tar.bz2
AltCraft-f16c897522b6418c399b5699f8378a25c2e5de4f.tar.lz
AltCraft-f16c897522b6418c399b5699f8378a25c2e5de4f.tar.xz
AltCraft-f16c897522b6418c399b5699f8378a25c2e5de4f.tar.zst
AltCraft-f16c897522b6418c399b5699f8378a25c2e5de4f.zip
Diffstat (limited to '')
-rw-r--r--src/RendererSectionData.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/RendererSectionData.cpp b/src/RendererSectionData.cpp
index 2588fd6..0ac901e 100644
--- a/src/RendererSectionData.cpp
+++ b/src/RendererSectionData.cpp
@@ -26,11 +26,13 @@ glm::vec2 TransformTextureCoord(glm::vec4 TextureAtlasCoords, glm::vec2 UvCoords
void AddFacesByBlockModel(RendererSectionData &data, const BlockFaces &model, const glm::mat4 &transform, bool visibility[FaceDirection::none], BlockLightness light, BlockLightness skyLight) {
for (const auto &face : model.faces) {
+ glm::vec3 normal = {};
glm::vec2 lightness;
lightness.x = _max(light.face[0], light.face[1], light.face[2], light.face[3], light.face[4], light.face[5]);
lightness.y = _max(skyLight.face[0], skyLight.face[1], skyLight.face[2], skyLight.face[3], skyLight.face[4], skyLight.face[5]);
if (face.visibility != FaceDirection::none) {
FaceDirection direction = face.visibility;
+ normal = FaceDirectionVector[direction].glm();
Vector directionVec = model.faceDirectionVector[direction];
FaceDirection faceDirection = FaceDirection::none;
for (int i = 0; i < FaceDirection::none; i++) {
@@ -56,6 +58,8 @@ void AddFacesByBlockModel(RendererSectionData &data, const BlockFaces &model, co
vertexData.positions[2] = transformed * glm::vec4(1, 0, 1, 1);
vertexData.positions[3] = transformed * glm::vec4(1, 0, 0, 1);
+ vertexData.normal = normal;
+
vertexData.uvs[0] = TransformTextureCoord(face.texture, glm::vec2(0, 0), face.frames);
vertexData.uvs[1] = TransformTextureCoord(face.texture, glm::vec2(1, 0), face.frames);
vertexData.uvs[2] = TransformTextureCoord(face.texture, glm::vec2(1, 1), face.frames);