diff --git a/Docs/src/manual/Ogre3.0.Changes.md b/Docs/src/manual/Ogre3.0.Changes.md index d764cfacad8..34175240d21 100644 --- a/Docs/src/manual/Ogre3.0.Changes.md +++ b/Docs/src/manual/Ogre3.0.Changes.md @@ -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. \ No newline at end of file +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) diff --git a/Docs/src/manual/ResolvingMergeConflictsIn3.0.md b/Docs/src/manual/ResolvingMergeConflictsIn3.0.md index a4ddc032e04..047f2e6d0f2 100644 --- a/Docs/src/manual/ResolvingMergeConflictsIn3.0.md +++ b/Docs/src/manual/ResolvingMergeConflictsIn3.0.md @@ -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` @@ -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 ) @@ -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") @@ -105,4 +105,6 @@ do echo "Formatting \"$file\"" clang-format-13 -i "$file" done -``` \ No newline at end of file +``` + +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. \ No newline at end of file diff --git a/OgreMain/include/OgreMaterial.h b/OgreMain/include/OgreMaterial.h index 8f9ae048ae8..55e62bb1de7 100644 --- a/OgreMain/include/OgreMaterial.h +++ b/OgreMain/include/OgreMaterial.h @@ -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 ); diff --git a/OgreMain/include/OgrePass.h b/OgreMain/include/OgrePass.h index f95141b93fe..a1e533845ff 100644 --- a/OgreMain/include/OgrePass.h +++ b/OgreMain/include/OgrePass.h @@ -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; diff --git a/OgreMain/include/OgreSceneManager.h b/OgreMain/include/OgreSceneManager.h index 68127c42e89..b9e5b5a7c97 100644 --- a/OgreMain/include/OgreSceneManager.h +++ b/OgreMain/include/OgreSceneManager.h @@ -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 @@ -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 diff --git a/OgreMain/include/OgreTechnique.h b/OgreMain/include/OgreTechnique.h index cd71fe4ae58..ea1b70c45a1 100644 --- a/OgreMain/include/OgreTechnique.h +++ b/OgreMain/include/OgreTechnique.h @@ -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 ); diff --git a/OgreMain/src/OgreHlmsLowLevel.cpp b/OgreMain/src/OgreHlmsLowLevel.cpp index 463f8ea894f..739d8b97a9b 100644 --- a/OgreMain/src/OgreHlmsLowLevel.cpp +++ b/OgreMain/src/OgreHlmsLowLevel.cpp @@ -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(), @@ -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; diff --git a/OgreMain/src/OgreMaterialSerializer.cpp b/OgreMain/src/OgreMaterialSerializer.cpp index e0f04f6d32d..dcc42ec0ecc 100644 --- a/OgreMain/src/OgreMaterialSerializer.cpp +++ b/OgreMain/src/OgreMaterialSerializer.cpp @@ -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 ) { @@ -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() ) diff --git a/OgreMain/src/OgreSceneManager.cpp b/OgreMain/src/OgreSceneManager.cpp index 48626395b71..db54259429c 100644 --- a/OgreMain/src/OgreSceneManager.cpp +++ b/OgreMain/src/OgreSceneManager.cpp @@ -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 } diff --git a/OgreMain/src/OgreScriptTranslator.cpp b/OgreMain/src/OgreScriptTranslator.cpp index fa756f954e4..62a51371cec 100644 --- a/OgreMain/src/OgreScriptTranslator.cpp +++ b/OgreMain/src/OgreScriptTranslator.cpp @@ -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,