From 72ff908bd3fb125e2c16ee63325e953ee3e22aba Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Mon, 29 Sep 2014 14:37:11 -0700 Subject: [PATCH 1/2] Fix for metavoxel crashes on Windows. I was expecting the scope of a temporary object to last until the next line; turns out VC++ can destroy it in the middle of evaluating the line. --- interface/src/MetavoxelSystem.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/interface/src/MetavoxelSystem.cpp b/interface/src/MetavoxelSystem.cpp index b993d5243e..e8a70a2419 100644 --- a/interface/src/MetavoxelSystem.cpp +++ b/interface/src/MetavoxelSystem.cpp @@ -1204,7 +1204,8 @@ int PointAugmentVisitor::visit(MetavoxelInfo& info) { _points.swap(swapPoints); buffer = new PointBuffer(swapPoints); } - info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer))); + BufferDataPointer pointer(buffer); + info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer)); } return STOP_RECURSION; } @@ -1219,7 +1220,8 @@ bool PointAugmentVisitor::postVisit(MetavoxelInfo& info) { _points.swap(swapPoints); buffer = new PointBuffer(swapPoints); } - info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer))); + BufferDataPointer pointer(buffer); + info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer)); return true; } @@ -1446,7 +1448,8 @@ int HeightfieldRegionVisitor::visit(MetavoxelInfo& info) { _data->guide(_fetchVisitor); } } - info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer))); + BufferDataPointer pointer(buffer); + info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer)); return STOP_RECURSION; } @@ -1505,7 +1508,8 @@ int HeightfieldUpdateVisitor::visit(MetavoxelInfo& info) { buffer->getHeight(), buffer->getColor(), buffer->getMaterial(), buffer->getMaterials()); _fetchVisitor.init(newBuffer); _data->guide(_fetchVisitor); - info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(newBuffer))); + BufferDataPointer pointer(newBuffer); + info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer)); return STOP_RECURSION; } @@ -2078,7 +2082,8 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { buffer = new VoxelBuffer(vertices, indices, material->getMaterials()); } - info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer))); + BufferDataPointer pointer(buffer); + info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer)); return STOP_RECURSION; } From 4c617c6d5562ff709815463c9e0eefcece06da2c Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Mon, 29 Sep 2014 14:51:45 -0700 Subject: [PATCH 2/2] Stop using the emissive color for glow. --- interface/src/renderer/Model.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index 858d8c9239..55eefb0bde 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -1335,11 +1335,7 @@ void Model::renderMeshes(RenderMode mode, bool translucent, float alphaThreshold } else { glm::vec4 diffuse = glm::vec4(part.diffuseColor, part.opacity); if (!(translucent && alphaThreshold == 0.0f)) { - float emissive = (part.emissiveColor.r + part.emissiveColor.g + part.emissiveColor.b) / 3.0f; - diffuse.a = qMax(Application::getInstance()->getGlowEffect()->getIntensity(), emissive); - glAlphaFunc(GL_EQUAL, diffuse.a); - diffuse = glm::vec4(qMax(diffuse.r, part.emissiveColor.r), qMax(diffuse.g, part.emissiveColor.g), - qMax(diffuse.b, part.emissiveColor.b), diffuse.a); + glAlphaFunc(GL_EQUAL, diffuse.a = Application::getInstance()->getGlowEffect()->getIntensity()); } glm::vec4 specular = glm::vec4(part.specularColor, 1.0f); glMaterialfv(GL_FRONT, GL_AMBIENT, (const float*)&diffuse);