]> git.localhorst.tv Git - blank.git/blobdiff - src/chunk.cpp
don't push block normals to GPU
[blank.git] / src / chunk.cpp
index 2a764f31c1c637435feb7738161a42f576f997b9..74ca1bcf96933274f9560cbb151e8629177eeb0c 100644 (file)
@@ -322,7 +322,7 @@ int Chunk::GetLight(int index) const {
        return light[index];
 }
 
-float Chunk::GetVertexLight(int index, const BlockModel::Position &vtx, const BlockModel::Normal &norm) const {
+float Chunk::GetVertexLight(int index, const BlockModel::Position &vtx, const Model::Normal &norm) const {
        float light = GetLight(index);
        Chunk::Pos pos(ToPos(index));
 
@@ -452,7 +452,11 @@ void Chunk::Update() {
                vtx_counter += type.shape->VertexCount();
 
                for (size_t vtx = vtx_begin; vtx < vtx_counter; ++vtx) {
-                       buf.lights.emplace_back(GetVertexLight(i, buf.vertices[vtx], buf.normals[vtx]));
+                       buf.lights.emplace_back(GetVertexLight(
+                               i,
+                               buf.vertices[vtx],
+                               type.shape->VertexNormal(vtx - vtx_begin, blocks[i].Transform())
+                       ));
                }
        }