[osgearth] 01/09: Imported Upstream version 2.8~rc2+dfsg

Bas Couwenberg sebastic at debian.org
Fri Sep 9 20:41:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch experimental
in repository osgearth.

commit e3bde5b0d8b95e8875686d64132f6aa3839d25a8
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Sep 9 20:12:19 2016 +0200

    Imported Upstream version 2.8~rc2+dfsg
---
 CMakeLists.txt                                         |  2 +-
 docs/source/user/tools.rst                             |  4 ++--
 src/applications/osgearth_package/osgearth_package.cpp |  2 +-
 src/applications/osgearth_seed/osgearth_seed.cpp       |  2 +-
 src/osgEarth/GPUClamping.vert.lib.glsl                 |  2 +-
 src/osgEarth/ThreadingUtils.cpp                        | 13 +++++++++++--
 src/osgEarth/Version                                   |  2 +-
 src/osgEarthDrivers/engine_mp/MPGeometry.cpp           | 13 +++++++++++--
 src/osgEarthDrivers/engine_rex/TileNode.cpp            | 13 ++++++++++++-
 src/osgEarthDrivers/osg/OSGTileSource.cpp              |  2 +-
 src/osgEarthFeatures/ExtrudeGeometryFilter.cpp         |  2 +-
 src/osgEarthSplat/Splat.frag.glsl                      | 15 ++++++++++++---
 src/osgEarthSplat/Splat.util.glsl                      |  5 +++--
 src/osgEarthUtil/Graticule.vert.glsl                   |  5 ++++-
 14 files changed, 62 insertions(+), 20 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b0a89a..0f0b284 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@ SET_PROPERTY( GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets" )
 PROJECT(OSGEARTH)
 
 SET(OSGEARTH_MAJOR_VERSION 2)
-SET(OSGEARTH_MINOR_VERSION 9)
+SET(OSGEARTH_MINOR_VERSION 8)
 SET(OSGEARTH_PATCH_VERSION 0)
 SET(OSGEARTH_SOVERSION     0)
 
diff --git a/docs/source/user/tools.rst b/docs/source/user/tools.rst
index 071931c..e436b5e 100644
--- a/docs/source/user/tools.rst
+++ b/docs/source/user/tools.rst
@@ -95,7 +95,7 @@ The most common usage of osgearth_cache is to populate a cache in a non-interact
 +-------------------------------------+--------------------------------------------------------------------+
 | ``--mt``                            | Use multithreading to process the tiles.                           |
 +-------------------------------------+--------------------------------------------------------------------+
-| ``--concurrency``                   | The number of threads or proceses to use if --mp or --mt           |
+| ``--concurrency``                   | The number of threads or processes to use if --mp or --mt          |
 |                                     | are provided                                                       | 
 +-------------------------------------+--------------------------------------------------------------------+
 | ``--min-level level``               | Lowest LOD level to seed (default=0)                               |
@@ -160,7 +160,7 @@ osgearth_package creates a redistributable `TMS`_ based package from an earth fi
 +------------------------------------+--------------------------------------------------------------------+
 | ``--mt``                           | Use multithreading to process the tiles.                           |
 +------------------------------------+--------------------------------------------------------------------+
-| ``--concurrency``                  | The number of threads or proceses to use if --mp or --mt           |
+| ``--concurrency``                  | The number of threads or processes to use if --mp or --mt          |
 |                                    | are provided                                                       | 
 +------------------------------------+--------------------------------------------------------------------+
 | ``--alpha-mask``                   | Mask out imagery that isn't in the provided extents.               |
diff --git a/src/applications/osgearth_package/osgearth_package.cpp b/src/applications/osgearth_package/osgearth_package.cpp
index 9cebc51..eea47d4 100644
--- a/src/applications/osgearth_package/osgearth_package.cpp
+++ b/src/applications/osgearth_package/osgearth_package.cpp
@@ -71,7 +71,7 @@ usage( const std::string& msg = "" )
         << "            [--db-options]                : db options string to pass to the image writer in quotes (e.g., \"JPEG_QUALITY 60\")\n"
         << "            [--mp]                          ; Use multiprocessing to process the tiles.  Useful for GDAL sources as this avoids the global GDAL lock" << std::endl
         << "            [--mt]                          ; Use multithreading to process the tiles." << std::endl
-        << "            [--concurrency]                 ; The number of threads or proceses to use if --mp or --mt are provided." << std::endl
+        << "            [--concurrency]                 ; The number of threads or processes to use if --mp or --mt are provided." << std::endl
         << "            [--alpha-mask]                  ; Mask out imagery that isn't in the provided extents." << std::endl
         << std::endl
         << "            [--verbose]                     ; Displays progress of the operation" << std::endl;
diff --git a/src/applications/osgearth_seed/osgearth_seed.cpp b/src/applications/osgearth_seed/osgearth_seed.cpp
index 5957a6a..788ed56 100644
--- a/src/applications/osgearth_seed/osgearth_seed.cpp
+++ b/src/applications/osgearth_seed/osgearth_seed.cpp
@@ -89,7 +89,7 @@ int
         << "        [--index shapefile]             ; Use the feature extents in a shapefile to set the bounding boxes for seeding" << std::endl
         << "        [--mp]                          ; Use multiprocessing to process the tiles.  Useful for GDAL sources as this avoids the global GDAL lock" << std::endl
         << "        [--mt]                          ; Use multithreading to process the tiles." << std::endl
-        << "        [--concurrency]                 ; The number of threads or proceses to use if --mp or --mt are provided." << std::endl
+        << "        [--concurrency]                 ; The number of threads or processes to use if --mp or --mt are provided." << std::endl
         << "        [--verbose]                     ; Displays progress of the seed operation" << std::endl
         << std::endl
         << "    --purge file.earth                  ; Purges a layer cache in a .earth file (interactive)" << std::endl
diff --git a/src/osgEarth/GPUClamping.vert.lib.glsl b/src/osgEarth/GPUClamping.vert.lib.glsl
index 3c24583..a8ca86e 100644
--- a/src/osgEarth/GPUClamping.vert.lib.glsl
+++ b/src/osgEarth/GPUClamping.vert.lib.glsl
@@ -27,7 +27,7 @@ void oe_getClampedViewVertex(in vec4 vertView, out vec4 out_clampedVertView, out
     out_clampedVertView = oe_clamp_depthClip2cameraView * clampedVertDepthClip;
 }
 
-// Returns a vector indiciating the "down" direction.
+// Returns a vector indicating the "down" direction.
 void oe_getClampingUpVector(out vec3 up)
 {
     up = normalize(mat3(oe_clamp_depthClip2cameraView) * vec3(0,0,-1));
diff --git a/src/osgEarth/ThreadingUtils.cpp b/src/osgEarth/ThreadingUtils.cpp
index a38124e..9c22e1c 100644
--- a/src/osgEarth/ThreadingUtils.cpp
+++ b/src/osgEarth/ThreadingUtils.cpp
@@ -20,9 +20,11 @@
 
 #ifdef _WIN32
     extern "C" unsigned long __stdcall GetCurrentThreadId();
-#else
+#elif defined(__APPLE__) || defined(__LINUX__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #   include <unistd.h>
 #   include <sys/syscall.h>
+#else
+#   include <pthread.h>
 #endif
 
 using namespace osgEarth::Threading;
@@ -40,7 +42,14 @@ unsigned osgEarth::Threading::getCurrentThreadId()
   return ::syscall(SYS_thread_selfid);
 #elif __ANDROID__
   return gettid();
-#else
+#elif __LINUX__
   return (unsigned)::syscall(SYS_gettid);
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+  long  tid;
+  syscall(SYS_thr_self, &tid);
+  return (unsigned)tid;
+#else
+  /* :XXX: this truncates to 32 bits, but better than nothing */
+  return (unsigned)pthread_self();
 #endif
 }
diff --git a/src/osgEarth/Version b/src/osgEarth/Version
index f70e95c..51e55d5 100644
--- a/src/osgEarth/Version
+++ b/src/osgEarth/Version
@@ -31,7 +31,7 @@ extern "C" {
 #define OSGEARTH_MINOR_VERSION    8
 #define OSGEARTH_PATCH_VERSION    0
 #define OSGEARTH_SOVERSION        0
-#define OSGEARTH_RC_VERSION       1
+#define OSGEARTH_RC_VERSION       2
 #define OSGEARTH_DEVEL_VERSION    0     // 0 = release; >0 = interim devel version
 
 /* Convenience macro that can be used to decide whether a feature is present or not i.e.
diff --git a/src/osgEarthDrivers/engine_mp/MPGeometry.cpp b/src/osgEarthDrivers/engine_mp/MPGeometry.cpp
index d408441..141065c 100644
--- a/src/osgEarthDrivers/engine_mp/MPGeometry.cpp
+++ b/src/osgEarthDrivers/engine_mp/MPGeometry.cpp
@@ -91,10 +91,19 @@ _elevUnit(0),
 _supportsGLSL(false)
 {
     _supportsGLSL = Registry::capabilities().supportsGLSL();
-
+    
+    // Encode the tile key in a uniform. Note! The X and Y components are scaled
+    // to that we don't use precision on the GPU when the values get large.
+    // If you need the raw X and Y, you must scale them back up on the GPU.
     unsigned tw, th;
     key.getProfile()->getNumTiles(key.getLOD(), tw, th);
-    _tileKeyValue.set( key.getTileX(), th-key.getTileY()-1.0f, key.getLOD(), -1.0f );
+    
+    const float tileXYScale = 0.0625f; // 1/16
+    _tileKeyValue.set(
+        tileXYScale * (float)(key.getTileX()),
+        tileXYScale * (float)(th-key.getTileY()-1.0f),
+        (float)key.getLOD(),
+        -1.0f);
 
     _imageUnitParent = _imageUnit + 1; // temp
 
diff --git a/src/osgEarthDrivers/engine_rex/TileNode.cpp b/src/osgEarthDrivers/engine_rex/TileNode.cpp
index f38376b..40c5e39 100644
--- a/src/osgEarthDrivers/engine_rex/TileNode.cpp
+++ b/src/osgEarthDrivers/engine_rex/TileNode.cpp
@@ -210,10 +210,21 @@ TileNode::updateTileUniforms(const SelectionInfo& selectionInfo)
     const osg::BoundingBox& bbox = _surface->getAlignedBoundingBox();
     float width = std::max( (bbox.xMax()-bbox.xMin()), (bbox.yMax()-bbox.yMin()) );
 
+
+    // Encode the tile key in a uniform. Note! The X and Y components are scaled
+    // to that we don't use precision on the GPU when the values get large.
+    // If you need the raw X and Y, you must scale them back up on the GPU.
     unsigned tw, th;
     _key.getProfile()->getNumTiles(_key.getLOD(), tw, th);
 
-    _tileKeyUniform->set(osg::Vec4f(_key.getTileX(), th-_key.getTileY()-1.0f, _key.getLOD(), width));
+    const float tileXYScale = 0.0625f; // 1/16
+
+    _tileKeyUniform->set(osg::Vec4f(
+        tileXYScale * (float)(_key.getTileX()),
+        tileXYScale * (float)(th-_key.getTileY()-1.0f),
+        (float)_key.getLOD(),
+        width));
+
 
     // update the morph constants
 
diff --git a/src/osgEarthDrivers/osg/OSGTileSource.cpp b/src/osgEarthDrivers/osg/OSGTileSource.cpp
index ce6b88b..7fe5a7e 100644
--- a/src/osgEarthDrivers/osg/OSGTileSource.cpp
+++ b/src/osgEarthDrivers/osg/OSGTileSource.cpp
@@ -88,7 +88,7 @@ public:
 
         if ( !image.valid() )
         {
-            return Status::Error( Status::ResourceUnavailable, Stringify() <<  "Faild to load data from \"" << _options.url()->full() << "\"" );
+            return Status::Error( Status::ResourceUnavailable, Stringify() <<  "Failed to load data from \"" << _options.url()->full() << "\"" );
         }
 
         // calculate and store the maximum LOD for which to return data
diff --git a/src/osgEarthFeatures/ExtrudeGeometryFilter.cpp b/src/osgEarthFeatures/ExtrudeGeometryFilter.cpp
index 28f1e15..f45d1c6 100644
--- a/src/osgEarthFeatures/ExtrudeGeometryFilter.cpp
+++ b/src/osgEarthFeatures/ExtrudeGeometryFilter.cpp
@@ -1222,7 +1222,7 @@ ExtrudeGeometryFilter::push( FeatureList& input, FilterContext& context )
     AllocateAndMergeBufferObjectsVisitor allocAndMerge;
     group->accept( allocAndMerge );
 
-    // set a uniform indiciating that clamping attributes are available.
+    // set a uniform indicating that clamping attributes are available.
     Clamping::installHasAttrsUniform( group->getOrCreateStateSet() );
 
     // if we drew outlines, apply a poly offset too.
diff --git a/src/osgEarthSplat/Splat.frag.glsl b/src/osgEarthSplat/Splat.frag.glsl
index 78787a1..8af4f79 100644
--- a/src/osgEarthSplat/Splat.frag.glsl
+++ b/src/osgEarthSplat/Splat.frag.glsl
@@ -35,7 +35,8 @@ uniform float oe_splat_warp;
 uniform float oe_splat_blur;
 uniform sampler2D oe_splat_coverageTex;
 uniform sampler2DArray oe_splatTex;
-uniform float oe_splat_scaleOffset;
+//uniform float oe_splat_scaleOffset;
+uniform int oe_splat_scaleOffsetInt;
 
 uniform float oe_splat_detailRange;
 uniform float oe_splat_noiseScale;
@@ -260,8 +261,15 @@ void oe_splat_simple(inout vec4 color)
     env.slope = oe_splat_getSlope();
     env.noise = oe_splat_getNoise(noiseCoords);
     env.elevation = 0.0;
+    
+    float lod0;
+    float rangeOuter, rangeInner;
+    oe_splat_getLodBlend(oe_splat_range, lod0, rangeOuter, rangeInner, env.range);
+    vec2 tc = oe_splat_getSplatCoords(oe_layer_tilec.st, lod0 + float(oe_splat_scaleOffsetInt));
+
+    color = oe_splat_bilinear(tc, env);
 
-    color = oe_splat_bilinear(oe_layer_tilec.st, env);
+    //color = mix(color, vec4(tc.s, tc.t, 0.0, 1.0), 0.5);
 }
 
 // Main entry point for fragment shader.
@@ -278,7 +286,8 @@ void oe_splat_complex(inout vec4 color)
     env.elevation = 0.0;
 
     // quantize the scale offset so we take the hit in the FS
-    float scaleOffset = oe_splat_scaleOffset >= 0.0 ? ceil(oe_splat_scaleOffset) : floor(oe_splat_scaleOffset);
+    //float scaleOffset = oe_splat_scaleOffset >= 0.0 ? ceil(oe_splat_scaleOffset) : floor(oe_splat_scaleOffset);
+    float scaleOffset = float(oe_splat_scaleOffsetInt);
         
     // Calculate the 2 LODs we need to blend. We have to do this in the FS because 
     // it's quite possible for a single triangle to span more than 2 LODs.
diff --git a/src/osgEarthSplat/Splat.util.glsl b/src/osgEarthSplat/Splat.util.glsl
index 170a872..848dbd4 100644
--- a/src/osgEarthSplat/Splat.util.glsl
+++ b/src/osgEarthSplat/Splat.util.glsl
@@ -5,7 +5,7 @@ uniform vec4 oe_tile_key;  // osgEarth TileKey
 
 // Number of LOD range. Do not increase this past 25; doing so will result in precision errors
 // and rendering artifacts when the camera is very close to the ground.
-#define LOD_COUNT 25
+#define LOD_COUNT 26
 
 const float oe_SplatRanges[LOD_COUNT] = float[](
        100000000.0, // 0
@@ -32,7 +32,8 @@ const float oe_SplatRanges[LOD_COUNT] = float[](
               25.0, // 21
               12.0, // 22
                6.0, // 23
-               3.0  // 24
+               3.0, // 24
+               1.0  // 25
     );
 
 /**
diff --git a/src/osgEarthUtil/Graticule.vert.glsl b/src/osgEarthUtil/Graticule.vert.glsl
index 20c53f5..1e78ee8 100644
--- a/src/osgEarthUtil/Graticule.vert.glsl
+++ b/src/osgEarthUtil/Graticule.vert.glsl
@@ -8,9 +8,12 @@ uniform vec4 oe_tile_key;
 out vec4 oe_layer_tilec;
 out vec2 oe_graticule_coord;
 
+// oe_tile_key.xy are scaled by 1/16 for precision
+#define TILE_XY_SCALE_FACTOR 16
+
 void oe_graticule_vertex(inout vec4 vertex)
 {
     // calculate long and lat from [0..1] across the profile:
-    vec2 r = (oe_tile_key.xy + oe_layer_tilec.xy)/exp2(oe_tile_key.z);
+    vec2 r = (oe_tile_key.xy*TILE_XY_SCALE_FACTOR + oe_layer_tilec.xy)/exp2(oe_tile_key.z);
     oe_graticule_coord = vec2(0.5*r.x, r.y);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osgearth.git



More information about the Pkg-grass-devel mailing list