From 3c482467eaf1d11eb7980538b22051eccf974b2d Mon Sep 17 00:00:00 2001 From: Hartwig Date: Thu, 29 Dec 2016 21:43:20 +0100 Subject: [PATCH 1/2] BUG FIX - Wrong calculation of terrain normals The partial derivative for the x-coordinate has been wrongly calculated: only a single sided derivative was calculated. --- src/osgTerrain/GeometryTechnique.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osgTerrain/GeometryTechnique.cpp b/src/osgTerrain/GeometryTechnique.cpp index b363f4a52..b2a15e4c1 100644 --- a/src/osgTerrain/GeometryTechnique.cpp +++ b/src/osgTerrain/GeometryTechnique.cpp @@ -329,11 +329,11 @@ class VertexNormalGenerator osg::Vec3 zero(0.0f,0.0f,0.0f); if (left_valid) { - dx = center-left; + dx += center-left; } if (right_valid) { - dx = right-center; + dx += right-center; } if (bottom_valid) { From 192dcec5f9195145552eaf40af3901e986f1e55b Mon Sep 17 00:00:00 2001 From: Hartwig Date: Sun, 1 Jan 2017 16:33:37 +0100 Subject: [PATCH 2/2] Blending out of local functions Some local functions are only needed for OS X compatibility. Define these functions only for OS X versions older than 10.6. --- src/osgViewer/DarwinUtils.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/osgViewer/DarwinUtils.mm b/src/osgViewer/DarwinUtils.mm index 83afcd493..1e39e61f8 100644 --- a/src/osgViewer/DarwinUtils.mm +++ b/src/osgViewer/DarwinUtils.mm @@ -366,7 +366,8 @@ void MenubarController::update() /** Helper method to get a double value out of a CFDictionary */ -static double getDictDouble (CFDictionaryRef refDict, CFStringRef key) +#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) + static double getDictDouble (CFDictionaryRef refDict, CFStringRef key) { double value; CFNumberRef number_value = (CFNumberRef) CFDictionaryGetValue(refDict, key); @@ -376,7 +377,7 @@ static double getDictDouble (CFDictionaryRef refDict, CFStringRef key) return -1; // fail return value; // otherwise return the long value } - + /** Helper method to get a long value out of a CFDictionary */ static long getDictLong(CFDictionaryRef refDict, CFStringRef key) // const void* key? { @@ -388,7 +389,7 @@ static long getDictLong(CFDictionaryRef refDict, CFStringRef key) // cons return -1; // fail return value; } - +#endif /** ctor, get a list of all attached displays */