Skip to content

Commit

Permalink
Deprecate SceneManager::setFog
Browse files Browse the repository at this point in the history
Update documentation.
  • Loading branch information
darksylinc committed Nov 23, 2023
1 parent 879a86f commit e1de9b4
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 19 deletions.
35 changes: 34 additions & 1 deletion Docs/src/manual/Ogre3.0.Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,37 @@ Make sure to upgrade to latest CMake scripts if you're using them; to be ready f

Default material BRDF settings have changed in 3.0; thus materials will look different.

See [PBR / PBS Changes in 3.0](@ref PBSChangesIn30) to how make them look like they did in 2.3 and what these changes mean.
See [PBR / PBS Changes in 3.0](@ref PBSChangesIn30) to how make them look like they did in 2.3 and what these changes mean.

## Move to C++11 and general cleanup

Lots of dead \& long-deprecated code was removed.
See [Resolving Merge Conflicts in Ogre-Next 3.0](@ref ResolvingMergeConflicts30) for more help with C++11 changes.

- Remove D3D9
- Remove Terrain
- Remove RTShaderSystem
- Remove NaCL
- Remove dead SceneManagers
- Remove `( void )` from empty functions
- Remove StaticGeometry
- Remove files under `Deprecated/` folders
- Move to C++11
- Remove code under `__cplusplus` that uses `< 201103L` `>= 201103L` or numbers below 201103L
- Math::Log2 should use log2
- All virtuals must have `overload` keyword
- Remove `HardwareUniformBuffer`, `HardwareCounterBuffer`
- Fix many warnings.
- Clean up Media folder and remove unused stuff from Ogre samples.
- Add ASAN CMake option.
- Use OGRE_DEPRECATED.
- Add cmake option to embed debug level into OgreBuildSettings.
- Bakes OGRE_DEBUG_MODE into OgreBuildSettings.h; which is on by default on Ninja/GNU Make generators and disabled for the rest.
- Pass cookie to Ogre Root initialization to catch obvious ABI errors. Each library could call checkAbiCookie on initialization to avoid problems
- Default to clang's ld linker on Linux, i.e. `set( CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" )`
- Remove `OgreShadowVolumeExtrudeProgram.cpp`
- Deprecate `SceneManager::setFog`
- Remove `getShadowCasterVertex`
- Remove memory allocator stuff (see Ogre 1.x)
- Remove nedmalloc
- Typedef SharedPtr to std::shared_ptr (see Ogre 1.x)
14 changes: 8 additions & 6 deletions Docs/src/manual/ResolvingMergeConflictsIn3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ In Ogre-Next 3.0 we performed multiple changes that affected nearly the entire c
- Lots of warnings were fixed
- Clang format 13 was applied to the entire codebase

Users who run a customized version of Ogre-Next may found rebasing to the latest version a near impossible job due to the sheer amount of minor merge conflicts.
Users who run a forked/customized version of Ogre-Next may found rebasing to the latest version a near impossible job due to the sheer amount of *minor* merge conflicts.

To perform this task with more easily, we recommend the following:
To perform this task more easily, we recommend the following:

1. Merge your changes with `master` branch (or 3.0 when it appears)
2. Resolve all conflicts with `your code`
Expand Down Expand Up @@ -69,7 +69,7 @@ void moreFunctions()
}
```

After applying Clang format, everything that follows will indent (and likely the code will not compile):
After applying Clang format, everything that follows will indent (and likely the code will not compile) which make much easier to spot where the problem went wrong:

```cpp
void myFuntion( int a )
Expand All @@ -90,12 +90,12 @@ void myFuntion( int a )
}
```
If you find after merging and applying clang format that there is massive added or removed indentation; start from the top and find the first occurrence of this change and start looking for the missing brace.
If you find after merging and applying clang format that there is massive indentation being added (or removed); start from the top and find the first occurrence of this change and start looking for the missing brace.
# Batch Script
The following bash script will run clang-format on all files with the right extensions in the current folder and recursively in its subdirectories
The following bash script will run clang-format on all files with the right extensions in the current folder and recursively in its sub-directories.
```bash
FILES=$(find . -name "*.mm" -o -name "*.h" -o -name "*.cpp")
Expand All @@ -105,4 +105,6 @@ do
echo "Formatting \"$file\""
clang-format-13 -i "$file"
done
```
```

You can also look at our python script in [.github/workflows/run_clang_format.py](https://github.com/OGRECave/ogre-next/blob/879a86fd4d1e7274af67b37628f29d6ad06a7d79/.github/workflows/run_clang_format.py) if you prefer Python instead.
1 change: 1 addition & 0 deletions OgreMain/include/OgreMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ namespace Ogre
property there.
@see Pass::setFog
*/
OGRE_DEPRECATED_VER( 3 )
void setFog( bool overrideScene, FogMode mode = FOG_NONE,
const ColourValue &colour = ColourValue::White, Real expDensity = Real( 0.001 ),
Real linearStart = 0.0, Real linearEnd = 1.0 );
Expand Down
13 changes: 7 additions & 6 deletions OgreMain/include/OgrePass.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,41 +608,42 @@ namespace Ogre
linearEnd Distance in world units at which linear fog becomes completely opaque.
Only applicable if mode is FOG_LINEAR.
*/
OGRE_DEPRECATED_VER( 3 )
void setFog( bool overrideScene, FogMode mode = FOG_NONE,
const ColourValue &colour = ColourValue::White, Real expDensity = Real( 0.001 ),
Real linearStart = 0.0, Real linearEnd = 1.0 );

/** Returns true if this pass is to override the scene fog settings.
*/
bool getFogOverride() const;
OGRE_DEPRECATED_VER( 3 ) bool getFogOverride() const;

/** Returns the fog mode for this pass.
@note
Only valid if getFogOverride is true.
*/
FogMode getFogMode() const;
OGRE_DEPRECATED_VER( 3 ) FogMode getFogMode() const;

/** Returns the fog colour for the scene.
*/
const ColourValue &getFogColour() const;
OGRE_DEPRECATED_VER( 3 ) const ColourValue &getFogColour() const;

/** Returns the fog start distance for this pass.
@note
Only valid if getFogOverride is true.
*/
Real getFogStart() const;
OGRE_DEPRECATED_VER( 3 ) Real getFogStart() const;

/** Returns the fog end distance for this pass.
@note
Only valid if getFogOverride is true.
*/
Real getFogEnd() const;
OGRE_DEPRECATED_VER( 3 ) Real getFogEnd() const;

/** Returns the fog density for this pass.
@note
Only valid if getFogOverride is true.
*/
Real getFogDensity() const;
OGRE_DEPRECATED_VER( 3 ) Real getFogDensity() const;

/// Gets the internal datablock that acts as proxy for us
HlmsDatablock *_getDatablock() const;
Expand Down
13 changes: 8 additions & 5 deletions OgreMain/include/OgreSceneManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,8 @@ namespace Ogre
virtual void _restoreManualHardwareResources();

/** Sets the fogging mode applied to the scene.
Deprecated in favour of Atmosphere component. See AtmosphereNpr::setSky.
@remarks
This method sets up the scene-wide fogging effect. These settings
apply to all geometry rendered, UNLESS the material with which it
Expand All @@ -1966,29 +1968,30 @@ namespace Ogre
opaque. Only applicable if mode is
FOG_LINEAR.
*/
OGRE_DEPRECATED_VER( 3 )
void setFog( FogMode mode = FOG_NONE, const ColourValue &colour = ColourValue::White,
Real expDensity = Real( 0.001 ), Real linearStart = Real( 0.0 ),
Real linearEnd = Real( 1.0 ) );

/** Returns the fog mode for the scene.
*/
virtual FogMode getFogMode() const;
OGRE_DEPRECATED_VER( 3 ) virtual FogMode getFogMode() const;

/** Returns the fog colour for the scene.
*/
virtual const ColourValue &getFogColour() const;
OGRE_DEPRECATED_VER( 3 ) virtual const ColourValue &getFogColour() const;

/** Returns the fog start distance for the scene.
*/
virtual Real getFogStart() const;
OGRE_DEPRECATED_VER( 3 ) virtual Real getFogStart() const;

/** Returns the fog end distance for the scene.
*/
virtual Real getFogEnd() const;
OGRE_DEPRECATED_VER( 3 ) virtual Real getFogEnd() const;

/** Returns the fog density for the scene.
*/
virtual Real getFogDensity() const;
OGRE_DEPRECATED_VER( 3 ) virtual Real getFogDensity() const;

/** Creates a new BillboardSet for use with this scene manager.
@remarks
Expand Down
1 change: 1 addition & 0 deletions OgreMain/include/OgreTechnique.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ namespace Ogre
property there.
@see Pass::setFog
*/
OGRE_DEPRECATED_VER( 3 )
void setFog( bool overrideScene, FogMode mode = FOG_NONE,
const ColourValue &colour = ColourValue::White, Real expDensity = Real( 0.001 ),
Real linearStart = 0.0, Real linearEnd = 1.0 );
Expand Down
11 changes: 11 additions & 0 deletions OgreMain/src/OgreHlmsLowLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ namespace Ogre
mAutoParamDataSource->setCurrentPass( pass );
mAutoParamDataSource->setCurrentLightList( &renderable->getLights() );

#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning( push, 0 )
#else
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
if( pass->getFogOverride() )
{
mAutoParamDataSource->setFog( pass->getFogMode(), pass->getFogColour(),
Expand All @@ -296,6 +302,11 @@ namespace Ogre
mCurrentSceneManager->getFogDensity(), mCurrentSceneManager->getFogStart(),
mCurrentSceneManager->getFogEnd() );
}
#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning( pop )
#else
# pragma GCC diagnostic pop
#endif

Pass::ConstTextureUnitStateIterator texIter = pass->getTextureUnitStateIterator();
size_t unit = 0;
Expand Down
11 changes: 11 additions & 0 deletions OgreMain/src/OgreMaterialSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,12 @@ namespace Ogre
writeValue( pPass->getPolygonModeOverrideable() ? "on" : "off" );
}

#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning( push, 0 )
#else
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
// fog override
if( mDefaults || pPass->getFogOverride() != false )
{
Expand Down Expand Up @@ -659,6 +665,11 @@ namespace Ogre
}
}
}
#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning( pop )
#else
# pragma GCC diagnostic pop
#endif

// GPU Vertex and Fragment program references and parameters
if( pPass->hasVertexProgram() )
Expand Down
12 changes: 12 additions & 0 deletions OgreMain/src/OgreSceneManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,20 @@ namespace Ogre
mShadowCasterPlainBlackPass->setDiffuse( ColourValue::Black );
mShadowCasterPlainBlackPass->setSelfIllumination( ColourValue::Black );
mShadowCasterPlainBlackPass->setSpecular( ColourValue::Black );

#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning( push, 0 )
#else
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
// Override fog
mShadowCasterPlainBlackPass->setFog( true, FOG_NONE );
#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning( pop )
#else
# pragma GCC diagnostic pop
#endif
// no textures or anything else, we will bind vertex programs
// every so often though
}
Expand Down
13 changes: 12 additions & 1 deletion OgreMain/src/OgreScriptTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,18 @@ namespace Ogre{
++i2;
}

mPass->setFog(val, mode, clr, dens, start, end);
#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning( push, 0 )
#else
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
mPass->setFog( val, mode, clr, dens, start, end );
#if OGRE_COMPILER == OGRE_COMPILER_MSVC
# pragma warning( pop )
#else
# pragma GCC diagnostic pop
#endif
}
else
compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
Expand Down

0 comments on commit e1de9b4

Please sign in to comment.