Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gwaldron/osgearth
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbeverage committed Feb 16, 2024
2 parents 52e4e20 + 116a18b commit 9b798e5
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 88 deletions.
18 changes: 10 additions & 8 deletions src/applications/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,25 @@ IF(NOT OSGEARTH_BUILD_PLATFORM_IPHONE)
ADD_SUBDIRECTORY(osgearth_heatmap)
ADD_SUBDIRECTORY(osgearth_collecttriangles)

IF(SILVERLINING_FOUND)
ADD_SUBDIRECTORY(osgearth_silverlining)
ENDIF(SILVERLINING_FOUND)

IF(TRITON_FOUND)
ADD_SUBDIRECTORY(osgearth_triton)
ENDIF(TRITON_FOUND)

ENDIF(OSGEARTH_BUILD_EXAMPLES)

IF(OSGEARTH_BUILD_TESTS)
SET(TARGET_DEFAULT_LABEL_PREFIX "Test")
SET(TARGET_DEFAULT_APPLICATION_FOLDER "Tests")
add_subdirectory(osgearth_bindless)
ADD_SUBDIRECTORY(osgearth_drawables)
ADD_SUBDIRECTORY(osgearth_horizon)
ADD_SUBDIRECTORY(osgearth_overlayviewer)
ADD_SUBDIRECTORY(osgearth_shadercomp)
ADD_SUBDIRECTORY(osgearth_windows)

IF(SILVERLINING_FOUND)
ADD_SUBDIRECTORY(osgearth_silverlining)
ENDIF(SILVERLINING_FOUND)

IF(TRITON_FOUND)
ADD_SUBDIRECTORY(osgearth_triton)
ENDIF(TRITON_FOUND)
ENDIF(OSGEARTH_BUILD_TESTS)

ELSE()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class TileListVisitor : public osgEarth::MultithreadedTileVisitor
{
}

virtual void run(const Profile* mapProfile)
void run(const Profile* mapProfile) override
{
// Start up the task service
OE_INFO << "Starting " << _numThreads << " threads " << std::endl;
Expand All @@ -419,7 +419,7 @@ class TileListVisitor : public osgEarth::MultithreadedTileVisitor
this->handleTile(key);
}

_group.join();
_group->join();
}

std::vector< TileKey > _keys;
Expand Down
2 changes: 2 additions & 0 deletions src/applications/osgearth_bindless/osgearth_bindless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ int main_NV(int argc, char** argv)
osg::ArgumentParser arguments(&argc, argv);

osgViewer::Viewer viewer(arguments);
viewer.setRealizeOperation(new GL3RealizeOperation());

MapNodeHelper().configureView(&viewer);

if (arguments.read("--pause"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void computeIntersectionsThreaded(osg::Node* node, std::vector< IntersectionQuer
pool->set_concurrency(num_threads);

// Poor man's parallel for
jobs::jobgroup intersections;
auto intersections = jobs::jobgroup::create();

//unsigned int workSize = 500;
// Try to split the jobs evenly among the threads
Expand All @@ -508,7 +508,7 @@ void computeIntersectionsThreaded(osg::Node* node, std::vector< IntersectionQuer
{
jobs::context context;
context.pool = pool;
context.group = &intersections;
context.group = intersections;

jobs::dispatch([node, curStart, curSize, &queries](Cancelable&) {
computeIntersections(node, queries, curStart, curSize);
Expand All @@ -525,7 +525,7 @@ void computeIntersectionsThreaded(osg::Node* node, std::vector< IntersectionQuer
}
}
//std::cout << "Dispatched " << numJobs << " jobs" << std::endl;
intersections.join();
intersections->join();
}


Expand Down
55 changes: 29 additions & 26 deletions src/osgEarth/TerrainOptions
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ namespace osgEarth
OE_OPTION(float, tilePixelSize, 512.0f);
OE_OPTION(float, heightFieldSkirtRatio, 0.0f);
OE_OPTION(Color, color, Color::White);
OE_OPTION(bool, progressive, false);
OE_OPTION(bool, progressive, true);
OE_OPTION(bool, useNormalMaps, true);
OE_OPTION(bool, normalizeEdges, false);
OE_OPTION(bool, morphTerrain, true);
OE_OPTION(bool, morphImagery, true);
OE_OPTION(unsigned, mergesPerFrame, 20u);
OE_OPTION(unsigned, mergesPerFrame, ~0u);
OE_OPTION(float, priorityScale, 1.0f);
OE_OPTION(std::string, textureCompression, {});
OE_OPTION(unsigned, concurrency, 4u);
Expand Down Expand Up @@ -114,15 +114,6 @@ namespace osgEarth
void setMaxLOD(const unsigned& value);
const unsigned& getMaxLOD() const;

//! (Legacy property)
//! The minimum level of detail to which the terrain should subdivide (no matter what).
//! If you leave this unset, the terrain will subdivide until the map layers
//! stop providing data (default behavior). If you set a value, the terrain will subdivide
//! to the specified LOD no matter what (and may continue farther if higher-resolution
//! data is available).
void setMinLOD(const unsigned& value);
const unsigned& getMinLOD() const;

//! (Legacy property)
//! The lowest LOD to display. By default, the terrain begins at LOD 0.
//! Set this to start the terrain tile mesh at a higher LOD.
Expand All @@ -140,11 +131,7 @@ namespace osgEarth
void setEnableBlending(const bool& value);
const bool& getEnableBlending() const;

//! @deprecated
//! Whether to compress the normal maps before sending to the GPU
void setCompressNormalMaps(const bool& value);
const bool& getCompressNormalMaps() const;

//! (Currently not used)
//! Minimum level of detail at which to generate elevation-based normal maps,
//! assuming normal maps have been activated. This mitigates the overhead of
//! calculating normal maps for very high altitude scenes where they are no
Expand All @@ -164,10 +151,6 @@ namespace osgEarth
void setTessellationRange(const float& value);
const float& getTessellationRange() const;

//! Whether to activate debugging mode
void setDebug(const bool& value);
const bool& getDebug() const;

//! Render bin number for the terrain
void setRenderBinNumber(const int& value);
const int& getRenderBinNumber() const;
Expand Down Expand Up @@ -248,12 +231,6 @@ namespace osgEarth
void setMergesPerFrame(const unsigned& value);
const unsigned& getMergesPerFrame() const;

//! Scale factor for background loading priority of terrain tiles.
//! Default = 1.0. Make it higher to prioritize terrain loading over
//! other modules.
void setPriorityScale(const float& value);
const float& getPriorityScale() const;

//! Texture compression to use by default on terrain image textures
void setTextureCompressionMethod(const std::string& method);
const std::string& getTextureCompressionMethod() const;
Expand Down Expand Up @@ -282,6 +259,32 @@ namespace osgEarth
void setCreateTilesGrouped(const bool& value);
const bool& getCreateTilesGrouped() const;

//! @deprecated
//! Scale factor for background loading priority of terrain tiles.
//! Default = 1.0. Make it higher to prioritize terrain loading over
//! other modules.
void setPriorityScale(const float& value);
const float& getPriorityScale() const;

//! @deprecated
//! Whether to activate debugging mode
void setDebug(const bool& value);
const bool& getDebug() const;

//! @deprecated
//! Whether to compress the normal maps before sending to the GPU
void setCompressNormalMaps(const bool& value);
const bool& getCompressNormalMaps() const;

//! @deprecated
//! The minimum level of detail to which the terrain should subdivide (no matter what).
//! If you leave this unset, the terrain will subdivide until the map layers
//! stop providing data (default behavior). If you set a value, the terrain will subdivide
//! to the specified LOD no matter what (and may continue farther if higher-resolution
//! data is available).
void setMinLOD(const unsigned& value);
const unsigned& getMinLOD() const;

TerrainOptionsAPI();
TerrainOptionsAPI(TerrainOptions*);
TerrainOptionsAPI(const TerrainOptionsAPI&);
Expand Down
1 change: 1 addition & 0 deletions src/osgEarth/Threading
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
#pragma once
#include <osgEarth/Export>
#include <unordered_map>

// bring in weejobs in the jobs namespace
#define WEEJOBS_EXPORT OSGEARTH_EXPORT
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarth/TileVisitor
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ namespace osgEarth { namespace Util

unsigned int _numThreads;

jobs::jobgroup _group;
std::shared_ptr<jobs::jobgroup> _group;
};


Expand Down
6 changes: 4 additions & 2 deletions src/osgEarth/TileVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ MultithreadedTileVisitor::MultithreadedTileVisitor() :
// We must do this to avoid an error message in OpenSceneGraph b/c the findWrapper method doesn't appear to be threadsafe.
// This really isn't a big deal b/c this only effects data that is already cached.
osgDB::ObjectWrapper* wrapper = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper("osg::Image");

_group = jobs::jobgroup::create();
}

MultithreadedTileVisitor::MultithreadedTileVisitor(TileHandler* handler) :
Expand Down Expand Up @@ -269,7 +271,7 @@ void MultithreadedTileVisitor::run(const Profile* mapProfile)
// Produce the tiles
TileVisitor::run( mapProfile );

_group.join();
_group->join();
}

bool MultithreadedTileVisitor::handleTile(const TileKey& key)
Expand Down Expand Up @@ -297,7 +299,7 @@ bool MultithreadedTileVisitor::handleTile(const TileKey& key)
jobs::context job;
job.name = "handleTile";
job.pool = jobs::get_pool(MTTV);
job.group = &_group;
job.group = _group;

jobs::dispatch(task, job);

Expand Down

0 comments on commit 9b798e5

Please sign in to comment.