From 4153e32f57d1c8eacda05f738202d608ca99dd32 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 19 Dec 2014 18:31:49 -0800 Subject: [PATCH] Normal fix. --- interface/src/MetavoxelSystem.cpp | 2 +- libraries/metavoxels/src/Spanner.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/interface/src/MetavoxelSystem.cpp b/interface/src/MetavoxelSystem.cpp index d1124c7767..f91dac7d0f 100644 --- a/interface/src/MetavoxelSystem.cpp +++ b/interface/src/MetavoxelSystem.cpp @@ -2312,7 +2312,7 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g baseBatch.heightScale = glm::vec4(1.0f / width, 1.0f / height, (innerWidth - 1) / -2.0f, (innerHeight - 1) / -2.0f); baseBatch.colorTextureID = _colorTextureID; baseBatch.colorScale = glm::vec2((float)width / innerWidth, (float)height / innerHeight); - Application::getInstance()->getMetavoxels()->addHeightfieldBaseBatch(baseBatch); + Application::getInstance()->getMetavoxels()->addHeightfieldBaseBatch(baseBatch); if (!_networkTextures.isEmpty()) { HeightfieldSplatBatch splatBatch; diff --git a/libraries/metavoxels/src/Spanner.cpp b/libraries/metavoxels/src/Spanner.cpp index ecd1a41fd1..fc57c29edc 100644 --- a/libraries/metavoxels/src/Spanner.cpp +++ b/libraries/metavoxels/src/Spanner.cpp @@ -2249,8 +2249,14 @@ HeightfieldNode* HeightfieldNode::setMaterial(const glm::vec3& translation, cons entryDest->material = index; } - entryDest->hermiteY[0] = glm::fract(voxelHeight) * numeric_limits::max(); + quint16 left = heightLineDest[-1]; + quint16 right = heightLineDest[1]; + quint16 up = heightLineDest[heightWidth]; + quint16 down = heightLineDest[-heightWidth]; + entryDest->setHermiteY(glm::normalize(glm::vec3((left == 0 || right == 0) ? 0.0f : + (left - right), 2.0f / voxelScale, (up == 0 || down == 0) ? 0.0f : + (down - up))), glm::fract(voxelHeight)); } if (!stackDest->isEmpty()) { int oldBottom = stackDest->getPosition();