Normal fix.

This commit is contained in:
Andrzej Kapolka 2014-12-19 18:31:49 -08:00
parent a563c66ab8
commit 4153e32f57
2 changed files with 8 additions and 2 deletions

View file

@ -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;

View file

@ -2249,8 +2249,14 @@ HeightfieldNode* HeightfieldNode::setMaterial(const glm::vec3& translation, cons
entryDest->material = index;
}
entryDest->hermiteY[0] = glm::fract(voxelHeight) * numeric_limits<quint8>::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();