mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
fix hand items lighting
This commit is contained in:
parent
19f037a9fd
commit
e306624260
2 changed files with 4 additions and 3 deletions
|
|
@ -72,7 +72,7 @@ void ModelBatch::draw(
|
|||
glm::vec4 lights(1, 1, 1, 0);
|
||||
if (mesh.shading) {
|
||||
glm::vec3 gpos = matrix * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gpos += lightsOffset;
|
||||
gpos += lightsOffset + localLightsOffset;
|
||||
lights = MainBatch::sampleLight(gpos, chunks, backlight);
|
||||
}
|
||||
for (size_t i = 0; i < vcount / 3; i++) {
|
||||
|
|
@ -123,7 +123,7 @@ void ModelBatch::render() {
|
|||
);
|
||||
bool backlight = settings.graphics.backlight.get();
|
||||
for (auto& entry : entries) {
|
||||
setLightsOffset(entry.lightSampleOffset);
|
||||
localLightsOffset = entry.lightSampleOffset;
|
||||
draw(
|
||||
*entry.mesh,
|
||||
entry.matrix,
|
||||
|
|
@ -132,7 +132,7 @@ void ModelBatch::render() {
|
|||
entry.varTextures,
|
||||
backlight
|
||||
);
|
||||
setLightsOffset(glm::vec3());
|
||||
localLightsOffset = {};
|
||||
}
|
||||
batch->flush();
|
||||
entries.clear();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ private:
|
|||
|
||||
const EngineSettings& settings;
|
||||
glm::vec3 lightsOffset {};
|
||||
glm::vec3 localLightsOffset {};
|
||||
|
||||
static inline glm::vec3 SUN_VECTOR {0.411934f, 0.863868f, -0.279161f};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue