Merge pull request #3072 from akortunov/warnfix

Fix node masks signed/unsigned mismatch
pull/593/head
Andrei Kortunov 4 years ago committed by GitHub
commit faad18b7f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -126,7 +126,7 @@ namespace CSVRender
{ {
// Try again without any mask // Try again without any mask
boundsVisitor.reset(); boundsVisitor.reset();
boundsVisitor.setTraversalMask(~0); boundsVisitor.setTraversalMask(~0u);
root->accept(boundsVisitor); root->accept(boundsVisitor);
// Last resort, set a default // Last resort, set a default
@ -458,7 +458,7 @@ namespace CSVRender
, mDown(false) , mDown(false)
, mRollLeft(false) , mRollLeft(false)
, mRollRight(false) , mRollRight(false)
, mPickingMask(~0) , mPickingMask(~0u)
, mCenter(0,0,0) , mCenter(0,0,0)
, mDistance(0) , mDistance(0)
, mOrbitSpeed(osg::PI / 4) , mOrbitSpeed(osg::PI / 4)

@ -8,7 +8,7 @@ namespace CSVRender
/// @note See the respective file in OpenMW (apps/openmw/mwrender/vismask.hpp) /// @note See the respective file in OpenMW (apps/openmw/mwrender/vismask.hpp)
/// for general usage hints about node masks. /// for general usage hints about node masks.
/// @copydoc MWRender::VisMask /// @copydoc MWRender::VisMask
enum Mask enum Mask : unsigned int
{ {
// elements that are part of the actual scene // elements that are part of the actual scene
Mask_Reference = 0x2, Mask_Reference = 0x2,

@ -120,7 +120,7 @@ void RenderWidget::flagAsModified()
mView->requestRedraw(); mView->requestRedraw();
} }
void RenderWidget::setVisibilityMask(int mask) void RenderWidget::setVisibilityMask(unsigned int mask)
{ {
mView->getCamera()->setCullMask(mask | Mask_ParticleSystem | Mask_Lighting); mView->getCamera()->setCullMask(mask | Mask_ParticleSystem | Mask_Lighting);
} }

@ -55,7 +55,7 @@ namespace CSVRender
/// Initiates a request to redraw the view /// Initiates a request to redraw the view
void flagAsModified(); void flagAsModified();
void setVisibilityMask(int mask); void setVisibilityMask(unsigned int mask);
osg::Camera *getCamera(); osg::Camera *getCamera();

@ -163,7 +163,7 @@ void CSVRender::WorldspaceWidget::selectDefaultNavigationMode()
void CSVRender::WorldspaceWidget::centerOrbitCameraOnSelection() void CSVRender::WorldspaceWidget::centerOrbitCameraOnSelection()
{ {
std::vector<osg::ref_ptr<TagBase> > selection = getSelection(~0); std::vector<osg::ref_ptr<TagBase> > selection = getSelection(~0u);
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it!=selection.end(); ++it) for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it!=selection.end(); ++it)
{ {

@ -426,7 +426,7 @@ namespace MWRender
visitor.setTraversalNumber(mDrawOnceCallback->getLastRenderedFrame()); visitor.setTraversalNumber(mDrawOnceCallback->getLastRenderedFrame());
osg::Node::NodeMask nodeMask = mCamera->getNodeMask(); osg::Node::NodeMask nodeMask = mCamera->getNodeMask();
mCamera->setNodeMask(~0); mCamera->setNodeMask(~0u);
mCamera->accept(visitor); mCamera->accept(visitor);
mCamera->setNodeMask(nodeMask); mCamera->setNodeMask(nodeMask);

@ -660,7 +660,7 @@ namespace MWRender
} }
else if (mode == Render_Scene) else if (mode == Render_Scene)
{ {
int mask = mViewer->getCamera()->getCullMask(); unsigned int mask = mViewer->getCamera()->getCullMask();
bool enabled = mask&Mask_Scene; bool enabled = mask&Mask_Scene;
enabled = !enabled; enabled = !enabled;
if (enabled) if (enabled)
@ -815,7 +815,7 @@ namespace MWRender
return false; return false;
} }
int maskBackup = mPlayerAnimation->getObjectRoot()->getNodeMask(); unsigned int maskBackup = mPlayerAnimation->getObjectRoot()->getNodeMask();
if (mCamera->isFirstPerson()) if (mCamera->isFirstPerson())
mPlayerAnimation->getObjectRoot()->setNodeMask(0); mPlayerAnimation->getObjectRoot()->setNodeMask(0);
@ -916,7 +916,7 @@ namespace MWRender
mIntersectionVisitor->setFrameStamp(mViewer->getFrameStamp()); mIntersectionVisitor->setFrameStamp(mViewer->getFrameStamp());
mIntersectionVisitor->setIntersector(intersector); mIntersectionVisitor->setIntersector(intersector);
int mask = ~0; unsigned int mask = ~0u;
mask &= ~(Mask_RenderToTexture|Mask_Sky|Mask_Debug|Mask_Effect|Mask_Water|Mask_SimpleWater|Mask_Groundcover); mask &= ~(Mask_RenderToTexture|Mask_Sky|Mask_Debug|Mask_Effect|Mask_Water|Mask_SimpleWater|Mask_Groundcover);
if (ignorePlayer) if (ignorePlayer)
mask &= ~(Mask_Player); mask &= ~(Mask_Player);

@ -317,8 +317,8 @@ public:
if (cv->getCullingMode() & osg::CullSettings::FAR_PLANE_CULLING) if (cv->getCullingMode() & osg::CullSettings::FAR_PLANE_CULLING)
++numPlanes; ++numPlanes;
int mask = 0x1; unsigned int mask = 0x1;
int resultMask = cv->getProjectionCullingStack().back().getFrustum().getResultMask(); unsigned int resultMask = cv->getProjectionCullingStack().back().getFrustum().getResultMask();
for (unsigned int i=0; i<cv->getProjectionCullingStack().back().getFrustum().getPlaneList().size(); ++i) for (unsigned int i=0; i<cv->getProjectionCullingStack().back().getFrustum().getPlaneList().size(); ++i)
{ {
if (i >= numPlanes) if (i >= numPlanes)
@ -441,7 +441,7 @@ private:
class CelestialBody class CelestialBody
{ {
public: public:
CelestialBody(osg::Group* parentNode, float scaleFactor, int numUvSets, unsigned int visibleMask=~0) CelestialBody(osg::Group* parentNode, float scaleFactor, int numUvSets, unsigned int visibleMask=~0u)
: mVisibleMask(visibleMask) : mVisibleMask(visibleMask)
{ {
mGeom = createTexturedQuad(numUvSets); mGeom = createTexturedQuad(numUvSets);
@ -1624,7 +1624,7 @@ void SkyManager::setEnabled(bool enabled)
if (enabled && !mCreated) if (enabled && !mCreated)
create(); create();
mRootNode->setNodeMask(enabled ? Mask_Sky : 0); mRootNode->setNodeMask(enabled ? Mask_Sky : 0u);
mEnabled = enabled; mEnabled = enabled;
} }
@ -1785,7 +1785,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
mCloudUpdater->setOpacity((1.f-mCloudBlendFactor)); mCloudUpdater->setOpacity((1.f-mCloudBlendFactor));
mCloudUpdater2->setOpacity(mCloudBlendFactor); mCloudUpdater2->setOpacity(mCloudBlendFactor);
mCloudMesh2->setNodeMask(mCloudBlendFactor > 0.f ? ~0 : 0); mCloudMesh2->setNodeMask(mCloudBlendFactor > 0.f ? ~0u : 0);
} }
if (mCloudColour != weather.mFogColor) if (mCloudColour != weather.mFogColor)
@ -1830,7 +1830,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
mAtmosphereNightUpdater->setFade(mStarsOpacity); mAtmosphereNightUpdater->setFade(mStarsOpacity);
} }
mAtmosphereNightNode->setNodeMask(weather.mNight ? ~0 : 0); mAtmosphereNightNode->setNodeMask(weather.mNight ? ~0u : 0);
mPrecipitationAlpha = weather.mPrecipitationAlpha; mPrecipitationAlpha = weather.mPrecipitationAlpha;
} }

@ -19,7 +19,7 @@ namespace MWRender
/// another mask, or what type of node this mask is usually set on. /// another mask, or what type of node this mask is usually set on.
/// @note The mask values are not serialized within models, nor used in any other way that would break backwards /// @note The mask values are not serialized within models, nor used in any other way that would break backwards
/// compatibility if the enumeration values were to be changed. Feel free to change them when it makes sense. /// compatibility if the enumeration values were to be changed. Feel free to change them when it makes sense.
enum VisMask enum VisMask : unsigned int
{ {
Mask_UpdateVisitor = 0x1, // reserved for separating UpdateVisitors from CullVisitors Mask_UpdateVisitor = 0x1, // reserved for separating UpdateVisitors from CullVisitors

@ -776,11 +776,11 @@ void Water::update(float dt)
void Water::updateVisible() void Water::updateVisible()
{ {
bool visible = mEnabled && mToggled; bool visible = mEnabled && mToggled;
mWaterNode->setNodeMask(visible ? ~0 : 0); mWaterNode->setNodeMask(visible ? ~0u : 0u);
if (mRefraction) if (mRefraction)
mRefraction->setNodeMask(visible ? Mask_RenderToTexture : 0); mRefraction->setNodeMask(visible ? Mask_RenderToTexture : 0u);
if (mReflection) if (mReflection)
mReflection->setNodeMask(visible ? Mask_RenderToTexture : 0); mReflection->setNodeMask(visible ? Mask_RenderToTexture : 0u);
} }
bool Water::toggle() bool Water::toggle()

@ -214,7 +214,7 @@ namespace NifOsg
return sHiddenNodeMask; return sHiddenNodeMask;
} }
unsigned int Loader::sIntersectionDisabledNodeMask = ~0; unsigned int Loader::sIntersectionDisabledNodeMask = ~0u;
void Loader::setIntersectionDisabledNodeMask(unsigned int mask) void Loader::setIntersectionDisabledNodeMask(unsigned int mask)
{ {

@ -241,7 +241,7 @@ private:
osg::ref_ptr<RootNode> mRootNode; osg::ref_ptr<RootNode> mRootNode;
}; };
QuadTreeWorld::QuadTreeWorld(osg::Group *parent, osg::Group *compileRoot, Resource::ResourceSystem *resourceSystem, Storage *storage, int nodeMask, int preCompileMask, int borderMask, int compMapResolution, float compMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize) QuadTreeWorld::QuadTreeWorld(osg::Group *parent, osg::Group *compileRoot, Resource::ResourceSystem *resourceSystem, Storage *storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask, int compMapResolution, float compMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize)
: TerrainGrid(parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask) : TerrainGrid(parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask)
, mViewDataMap(new ViewDataMap) , mViewDataMap(new ViewDataMap)
, mQuadTreeBuilt(false) , mQuadTreeBuilt(false)
@ -256,7 +256,7 @@ QuadTreeWorld::QuadTreeWorld(osg::Group *parent, osg::Group *compileRoot, Resour
mChunkManagers.push_back(mChunkManager.get()); mChunkManagers.push_back(mChunkManager.get());
} }
QuadTreeWorld::QuadTreeWorld(osg::Group *parent, Storage *storage, int nodeMask, float lodFactor, float chunkSize) QuadTreeWorld::QuadTreeWorld(osg::Group *parent, Storage *storage, unsigned int nodeMask, float lodFactor, float chunkSize)
: TerrainGrid(parent, storage, nodeMask) : TerrainGrid(parent, storage, nodeMask)
, mViewDataMap(new ViewDataMap) , mViewDataMap(new ViewDataMap)
, mQuadTreeBuilt(false) , mQuadTreeBuilt(false)

@ -20,9 +20,9 @@ namespace Terrain
class QuadTreeWorld : public TerrainGrid // note: derived from TerrainGrid is only to render default cells (see loadCell) class QuadTreeWorld : public TerrainGrid // note: derived from TerrainGrid is only to render default cells (see loadCell)
{ {
public: public:
QuadTreeWorld(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask, int borderMask, int compMapResolution, float comMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize); QuadTreeWorld(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask, int compMapResolution, float comMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize);
QuadTreeWorld(osg::Group *parent, Storage *storage, int nodeMask, float lodFactor, float chunkSize); QuadTreeWorld(osg::Group *parent, Storage *storage, unsigned int nodeMask, float lodFactor, float chunkSize);
~QuadTreeWorld(); ~QuadTreeWorld();

@ -20,13 +20,13 @@ public:
void reset() override {} void reset() override {}
}; };
TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask, int borderMask) TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask)
: Terrain::World(parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask) : Terrain::World(parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask)
, mNumSplits(4) , mNumSplits(4)
{ {
} }
TerrainGrid::TerrainGrid(osg::Group* parent, Storage* storage, int nodeMask) TerrainGrid::TerrainGrid(osg::Group* parent, Storage* storage, unsigned int nodeMask)
: Terrain::World(parent, storage, nodeMask) : Terrain::World(parent, storage, nodeMask)
, mNumSplits(4) , mNumSplits(4)
{ {

@ -14,8 +14,8 @@ namespace Terrain
class TerrainGrid : public Terrain::World class TerrainGrid : public Terrain::World
{ {
public: public:
TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask=~0, int borderMask=0); TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, unsigned int nodeMask, unsigned int preCompileMask=~0u, unsigned int borderMask=0);
TerrainGrid(osg::Group* parent, Storage* storage, int nodeMask=~0); TerrainGrid(osg::Group* parent, Storage* storage, unsigned int nodeMask=~0u);
~TerrainGrid(); ~TerrainGrid();
void cacheCell(View* view, int x, int y) override; void cacheCell(View* view, int x, int y) override;

@ -13,7 +13,7 @@
namespace Terrain namespace Terrain
{ {
World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask, int borderMask) World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask)
: mStorage(storage) : mStorage(storage)
, mParent(parent) , mParent(parent)
, mResourceSystem(resourceSystem) , mResourceSystem(resourceSystem)
@ -49,7 +49,7 @@ World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSyst
mResourceSystem->addResourceManager(mTextureManager.get()); mResourceSystem->addResourceManager(mTextureManager.get());
} }
World::World(osg::Group* parent, Storage* storage, int nodeMask) World::World(osg::Group* parent, Storage* storage, unsigned int nodeMask)
: mStorage(storage) : mStorage(storage)
, mParent(parent) , mParent(parent)
, mCompositeMapCamera(nullptr) , mCompositeMapCamera(nullptr)

@ -105,8 +105,8 @@ namespace Terrain
/// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..) /// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..)
/// @param nodeMask mask for the terrain root /// @param nodeMask mask for the terrain root
/// @param preCompileMask mask for pre compiling textures /// @param preCompileMask mask for pre compiling textures
World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask, int borderMask); World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask);
World(osg::Group* parent, Storage* storage, int nodeMask); World(osg::Group* parent, Storage* storage, unsigned int nodeMask);
virtual ~World(); virtual ~World();
/// Set a WorkQueue to delete objects in the background thread. /// Set a WorkQueue to delete objects in the background thread.

Loading…
Cancel
Save