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 Nov 19, 2024
2 parents fe72a70 + 5ef69b9 commit be4b9b7
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 36 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on: [push, workflow_dispatch]

env:
VCPKG_BINARY_SOURCES : "clear;x-gha,readwrite"
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
VCPKG_VERSION: 'master'

jobs:
Expand Down Expand Up @@ -41,6 +39,7 @@ jobs:
cd ${{ matrix.VCPKG_WORKSPACE }}
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.bat -disableMetrics
echo "set(VCPKG_BUILD_TYPE release)" >> ./vcpkg/triplets/x64-windows.cmake
${{ matrix.VCPKG_WORKSPACE }}/vcpkg/vcpkg version
- name: Create Build Environment
Expand All @@ -51,18 +50,9 @@ jobs:
shell: bash
working-directory: ${{ runner.workspace }}/build
run: |
cmake $GITHUB_WORKSPACE/share/ExternalProject -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=${{ matrix.VCPKG_WORKSPACE }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_MANIFEST_DIR=$GITHUB_WORKSPACE/share/ExternalProject
- name: 'Upload cmake configure log artifact'
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: cmake-log
path: |
${{ runner.workspace }}/build/CMakeCache.txt
retention-days: 1
cmake $GITHUB_WORKSPACE/share/ExternalProject -DCMAKE_BUILD_TYPE=release -DCMAKE_TOOLCHAIN_FILE=${{ matrix.VCPKG_WORKSPACE }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_MANIFEST_DIR=$GITHUB_WORKSPACE/share/ExternalProject
- name: Build
working-directory: ${{ runner.workspace }}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE
run: cmake --build . --config release
4 changes: 4 additions & 0 deletions src/osgEarth/Elevation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ osgEarth::createEmptyElevationTexture()
*((GLfloat*)image->data()) = 0.0f;
osg::Texture2D* tex = new osg::Texture2D(image);
tex->setInternalFormat(GL_R32F);
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
tex->setUnRefImageDataAfterApply(Registry::instance()->unRefImageDataAfterApply().get());
tex->setName("empty:elevation");
return tex;
Expand All @@ -52,6 +54,8 @@ osgEarth::createEmptyNormalMapTexture()
write(packed, 0, 0);
osg::Texture2D* tex = new osg::Texture2D(image);
tex->setInternalFormat(GL_RG8);
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
tex->setUnRefImageDataAfterApply(Registry::instance()->unRefImageDataAfterApply().get());
tex->setName("empty:normalmap");
return tex;
Expand Down
5 changes: 5 additions & 0 deletions src/osgEarth/Registry
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ namespace osgEarth
void setShaderGenerator(ShaderGenerator* gen);
static ShaderGeneratorProxy shaderGenerator() { return instance()->getShaderGenerator(); }

//! Access the shader generator prototype, which is the base instance that
//! gets cloned for each new shader generator proxy. Use this to set up options
//! on the default shader generator. Be careful not to call this at runtime.
ShaderGenerator* shaderGeneratorPrototype() const { return instance()->_shaderGen.get(); }

/**
* Global object index.
*/
Expand Down
16 changes: 13 additions & 3 deletions src/osgEarth/ShaderGenerator
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ namespace osgEarth

public:

//! Whether to remove unsupported fixed-function pipeline attributes
//! when FFP is not available in OSG. Default is true.
//! @param value True to remove unsupported FFP attributes, false to leave them in place.
void setRemoveUnsupportedFFPAttributes(bool value) { _removeUnsupportedFFPAttributes = value; }

//! Whether to remove unsupported fixed-function pipeline attributes
//! when FFP is not available in OSG.
//! @return True to remove unsupported FFP attributes, false to leave them in place.
bool getRemoveUnsupportedFFPAttributes() const { return _removeUnsupportedFFPAttributes; }

/**
* Whether to automatically duplicate (by cloning) subgraphs with
* more than one parent during the traversal process. Since a
Expand Down Expand Up @@ -245,10 +255,10 @@ namespace osgEarth

osg::ref_ptr<osg::State> _state;

bool _active;

std::string _name;
bool _duplicateSharedSubgraphs;
bool _active = true;
bool _duplicateSharedSubgraphs = false;
bool _removeUnsupportedFFPAttributes = true;

typedef std::vector<osg::ref_ptr<AcceptCallback> > AcceptCallbackVector;
AcceptCallbackVector _acceptCallbacks;
Expand Down
26 changes: 14 additions & 12 deletions src/osgEarth/ShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ namespace
//...........................................................................

ShaderGenerator::GenBuffers::GenBuffers() :
_stateSet(0L)
_stateSet(0L)
{
//nop
}
Expand All @@ -329,14 +329,13 @@ ShaderGenerator::ShaderGenerator()
setTraversalMode( TRAVERSE_ALL_CHILDREN );
setNodeMaskOverride( ~0 );
_state = new StateEx();
_active = true;
_duplicateSharedSubgraphs = false;
}

ShaderGenerator::ShaderGenerator(const ShaderGenerator& rhs, const osg::CopyOp& copy) :
osg::NodeVisitor (rhs, copy),
_active (rhs._active),
_duplicateSharedSubgraphs(rhs._duplicateSharedSubgraphs)
osg::NodeVisitor(rhs, copy),
_active(rhs._active),
_duplicateSharedSubgraphs(rhs._duplicateSharedSubgraphs),
_removeUnsupportedFFPAttributes(rhs._removeUnsupportedFFPAttributes)
{
_state = new StateEx();
}
Expand Down Expand Up @@ -863,12 +862,15 @@ ShaderGenerator::processGeometry(
}

#ifndef OSG_GL_FIXED_FUNCTION_AVAILABLE
if (texgen)
newStateSet->removeTextureAttribute(unit, texgen);
if (texenv)
newStateSet->removeTextureAttribute(unit, texenv);
if (texmat)
newStateSet->removeTextureAttribute(unit, texmat);
if (_removeUnsupportedFFPAttributes)
{
if (texgen)
newStateSet->removeTextureAttribute(unit, texgen);
if (texenv)
newStateSet->removeTextureAttribute(unit, texenv);
if (texmat)
newStateSet->removeTextureAttribute(unit, texmat);
}
#endif
}
}
Expand Down
21 changes: 13 additions & 8 deletions src/osgEarth/TMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,21 @@ TileMap::getURL(const osgEarth::TileKey& tilekey, bool invertY)
{
if (itr->getOrder() == zoom)
{
std::stringstream ss;
std::string basePath = osgDB::getFilePath(_filename);
if (!basePath.empty())
if (!itr->getHref().empty())
{
ss << basePath << "/";
return itr->getHref() + "/" + std::to_string(x) + "/" + std::to_string(y) + "." + _format.getExtension();
}
else if (osgDB::containsServerAddress(_filename))
{
auto f = _filename;
if (!f.empty() && f.back() != '/') f += "/";
return f + std::to_string(zoom) + "/" + std::to_string(x) + "/" + std::to_string(y) + "." + _format.getExtension();
}
else
{
// trip the XML file name off the end of the filename
return osgDB::getFilePath(_filename) + "/" + std::to_string(zoom) + "/" + std::to_string(x) + "/" + std::to_string(y) + "." + _format.getExtension();
}
ss << zoom << "/" << x << "/" << y << "." << _format.getExtension();
std::string ssStr;
ssStr = ss.str();
return ssStr;
}
}
}
Expand Down

0 comments on commit be4b9b7

Please sign in to comment.