diff --git a/examples/camera_tracking/GlutWindow.cc b/examples/camera_tracking/GlutWindow.cc index 8e29e02c2..be22d731a 100644 --- a/examples/camera_tracking/GlutWindow.cc +++ b/examples/camera_tracking/GlutWindow.cc @@ -364,7 +364,7 @@ void keyboardCB(unsigned char _key, int, int) g_followOffset.Z() -= 0.1; } - for (unsigned int i = 0; i < g_cameras.size(); ++i) + for (size_t i = 0; i < g_cameras.size(); ++i) { auto cam = g_cameras[i]; auto node = g_nodes[i]; diff --git a/examples/lidar_visual/GlutWindow.cc b/examples/lidar_visual/GlutWindow.cc index 0cbbc2503..1dd989bdc 100644 --- a/examples/lidar_visual/GlutWindow.cc +++ b/examples/lidar_visual/GlutWindow.cc @@ -460,7 +460,7 @@ void run(std::vector _cameras, initContext(); printUsage(); g_lidarData.clear(); - for (int pt =0; pt < _pts.size(); pt++) + for (size_t pt =0; pt < _pts.size(); pt++) { g_lidarData.push_back(_pts[pt]); } diff --git a/include/gz/rendering/OrbitViewController.hh b/include/gz/rendering/OrbitViewController.hh index 6be4629cf..d43cf9522 100644 --- a/include/gz/rendering/OrbitViewController.hh +++ b/include/gz/rendering/OrbitViewController.hh @@ -49,35 +49,35 @@ namespace gz public: explicit OrbitViewController(const CameraPtr &_camera); /// \brief Destructor - public: virtual ~OrbitViewController(); + public: ~OrbitViewController() override; /// \brief Set the camera that will be controlled by this view controller. /// \param[in] _camera Camera to control - public: virtual void SetCamera(const CameraPtr &_camera); + public: void SetCamera(const CameraPtr &_camera) override; /// \brief Get the camera that is controlled by this view controller. /// \return Camera being controlled public: virtual CameraPtr Camera() const; - /// \brief Set target point for pan, zoom, oribit + /// \brief Set target point for pan, zoom, orbit /// \param[in] _target Target point in world coordinates - public: virtual void SetTarget(const math::Vector3d &_target); + public: void SetTarget(const math::Vector3d &_target) override; - /// \brief Get target point for pan, zoom, oribit + /// \brief Get target point for pan, zoom, orbit /// \return target point in world coordinates public: virtual const math::Vector3d &Target() const; /// \brief Set zoom amount /// \param[in] _value Camera zoom value, e.g. mouse scroll delta - public: virtual void Zoom(const double _value); + public: void Zoom(const double _value) override; /// \brief Set camera pan (translational movement) around target point. /// \param[in] _value Pan amount in image plane, e.g. mouse drag delta. - public: virtual void Pan(const math::Vector2d &_value); + public: void Pan(const math::Vector2d &_value) override; /// \brief Set camera orbit (rotational movement) around target point. - /// \param[in] _value robit amount in image plane, e.g. mouse drag delta - public: virtual void Orbit(const math::Vector2d &_value); + /// \param[in] _value orbit amount in image plane, e.g. mouse drag delta + public: void Orbit(const math::Vector2d &_value) override; GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING /// \brief Private data pointer diff --git a/include/gz/rendering/OrthoViewController.hh b/include/gz/rendering/OrthoViewController.hh index ce53b2ef5..5d5dfea20 100644 --- a/include/gz/rendering/OrthoViewController.hh +++ b/include/gz/rendering/OrthoViewController.hh @@ -45,11 +45,11 @@ namespace gz public: explicit OrthoViewController(const CameraPtr &_camera); /// \brief Destructor. - public: virtual ~OrthoViewController(); + public: ~OrthoViewController() override; /// \brief Set the camera that will be controlled by this view controller. /// \param[in] _camera Camera to control - public: virtual void SetCamera(const CameraPtr &_camera); + public: void SetCamera(const CameraPtr &_camera) override; /// \brief Get the camera that is controlled by this view controller. /// \return Camera being controlled @@ -57,7 +57,7 @@ namespace gz /// \brief Set target point for pan, zoom, oribit /// \param[in] _target Target point in world coordinates - public: virtual void SetTarget(const math::Vector3d &_target); + public: void SetTarget(const math::Vector3d &_target) override; /// \brief Get target point for pan, zoom, oribit /// \return target point in world coordinates @@ -65,15 +65,15 @@ namespace gz /// \brief Set zoom amount /// \param[in] _value Camera zoom value, e.g. mouse scroll delta - public: virtual void Zoom(const double _value); + public: void Zoom(const double _value) override; /// \brief Set camera pan (translational movement) around target point. /// \param[in] _value Pan amount in image plane, e.g. mouse drag delta. - public: virtual void Pan(const math::Vector2d &_value); + public: void Pan(const math::Vector2d &_value) override; /// \brief Set camera orbit (rotational movement) around target point. - /// \param[in] _value robit amount in image plane, e.g. mouse drag delta - public: virtual void Orbit(const math::Vector2d &_value); + /// \param[in] _value orbit amount in image plane, e.g. mouse drag delta + public: void Orbit(const math::Vector2d &_value) override; /// \brief Resize and update the camera projection matrix /// \param[in] _width Image width diff --git a/include/gz/rendering/base/BaseBoundingBoxCamera.hh b/include/gz/rendering/base/BaseBoundingBoxCamera.hh index 215f1cb54..5a132899d 100644 --- a/include/gz/rendering/base/BaseBoundingBoxCamera.hh +++ b/include/gz/rendering/base/BaseBoundingBoxCamera.hh @@ -41,24 +41,25 @@ namespace gz protected: BaseBoundingBoxCamera(); /// \brief Destructor - public: virtual ~BaseBoundingBoxCamera(); + public: ~BaseBoundingBoxCamera() override; // Documentation inherited - public: virtual const std::vector &BoundingBoxData() const; + public: const std::vector &BoundingBoxData() const override; // Documentation inherited - public: virtual gz::common::ConnectionPtr ConnectNewBoundingBoxes( - std::function &)> _subscriber) = 0; + public: gz::common::ConnectionPtr ConnectNewBoundingBoxes( + std::function &)> _subscriber) + override = 0; // Documentation inherited - public: virtual void SetBoundingBoxType(BoundingBoxType _type); + public: void SetBoundingBoxType(BoundingBoxType _type) override; // Documentation inherited - public: virtual BoundingBoxType Type() const; + public: BoundingBoxType Type() const override; // Documentation inherited - public: virtual void DrawBoundingBox(unsigned char *_data, - const math::Color &_color, const BoundingBox &_box) const = 0; + public: void DrawBoundingBox(unsigned char *_data, + const math::Color &_color, const BoundingBox &_box) const override = 0; /// \brief The bounding box type protected: BoundingBoxType type = BoundingBoxType::BBT_FULLBOX2D; diff --git a/include/gz/rendering/base/BaseCamera.hh b/include/gz/rendering/base/BaseCamera.hh index 5201a5e88..61d339df5 100644 --- a/include/gz/rendering/base/BaseCamera.hh +++ b/include/gz/rendering/base/BaseCamera.hh @@ -160,7 +160,7 @@ namespace gz // Documentation inherited. public: virtual void SetFollowTarget(const NodePtr &_target, - const math::Vector3d &_Offset, const bool _worldFrame) + const math::Vector3d &_offset, const bool _worldFrame) override; // Documentation inherited. @@ -680,9 +680,9 @@ namespace gz ////////////////////////////////////////////////// template - void BaseCamera::SetAspectRatio(const double _aspect) + void BaseCamera::SetAspectRatio(const double _ratio) { - this->aspect = _aspect; + this->aspect = _ratio; } ////////////////////////////////////////////////// diff --git a/include/gz/rendering/base/BaseDepthCamera.hh b/include/gz/rendering/base/BaseDepthCamera.hh index 5df4f5475..676cd3c3c 100644 --- a/include/gz/rendering/base/BaseDepthCamera.hh +++ b/include/gz/rendering/base/BaseDepthCamera.hh @@ -37,15 +37,15 @@ namespace gz { protected: BaseDepthCamera(); - public: virtual ~BaseDepthCamera(); + public: ~BaseDepthCamera() override; - public: virtual void CreateDepthTexture(); + public: void CreateDepthTexture() override; - public: virtual const float *DepthData() const; + public: const float *DepthData() const override; - public: virtual gz::common::ConnectionPtr ConnectNewDepthFrame( + public: gz::common::ConnectionPtr ConnectNewDepthFrame( std::function _subscriber); + unsigned int, const std::string &)> _subscriber) override; public: virtual gz::common::ConnectionPtr ConnectNewRGBPointCloud( std::function @@ -100,23 +100,23 @@ namespace gz { protected: BaseSpotLight(); - public: virtual ~BaseSpotLight(); + public: ~BaseSpotLight() override; - public: virtual void SetDirection(double _x, double _y, double _z); + public: void SetDirection(double _x, double _y, double _z) override; - public: virtual void SetDirection(const math::Vector3d &_dir) = 0; + public: void SetDirection(const math::Vector3d &_dir) override = 0; - public: virtual void SetInnerAngle(double _radians); + public: void SetInnerAngle(double _radians) override; - public: virtual void SetInnerAngle(const math::Angle &_angle) = 0; + public: void SetInnerAngle(const math::Angle &_angle) override = 0; - public: virtual void SetOuterAngle(double _radians); + public: void SetOuterAngle(double _radians) override; - public: virtual void SetOuterAngle(const math::Angle &_angle) = 0; + public: void SetOuterAngle(const math::Angle &_angle) override = 0; - public: virtual void SetFalloff(double _falloff) = 0; + public: void SetFalloff(double _falloff) override = 0; - protected: virtual void Reset(); + protected: void Reset() override; }; ////////////////////////////////////////////////// diff --git a/include/gz/rendering/base/BaseLightVisual.hh b/include/gz/rendering/base/BaseLightVisual.hh index 4023584a1..5b43b901b 100644 --- a/include/gz/rendering/base/BaseLightVisual.hh +++ b/include/gz/rendering/base/BaseLightVisual.hh @@ -58,7 +58,7 @@ namespace gz public: virtual double InnerAngle() override; // Documentation inherited - public: virtual void SetOuterAngle(double _innerAngle) override; + public: virtual void SetOuterAngle(double _outerAngle) override; // Documentation inherited public: virtual double OuterAngle() override; diff --git a/include/gz/rendering/base/BaseMaterial.hh b/include/gz/rendering/base/BaseMaterial.hh index ef483ec0b..dd68886e3 100644 --- a/include/gz/rendering/base/BaseMaterial.hh +++ b/include/gz/rendering/base/BaseMaterial.hh @@ -565,16 +565,16 @@ namespace gz ////////////////////////////////////////////////// template - void BaseMaterial::SetReceiveShadows(const bool _receive) + void BaseMaterial::SetReceiveShadows(const bool _receiveShadows) { - this->receiveShadows = _receive; + this->receiveShadows = _receiveShadows; } ////////////////////////////////////////////////// template - void BaseMaterial::SetRenderOrder(const float _renderorder) + void BaseMaterial::SetRenderOrder(const float _renderOrder) { - this->renderOrder = _renderorder; + this->renderOrder = _renderOrder; } ////////////////////////////////////////////////// diff --git a/include/gz/rendering/base/BaseRenderTarget.hh b/include/gz/rendering/base/BaseRenderTarget.hh index 882c337bd..a7711ba79 100644 --- a/include/gz/rendering/base/BaseRenderTarget.hh +++ b/include/gz/rendering/base/BaseRenderTarget.hh @@ -40,7 +40,7 @@ namespace gz { public: BaseRenderTarget(); - public: virtual ~BaseRenderTarget(); + public: ~BaseRenderTarget() override; // Documentation inherited. public: virtual void PreRender(const CameraPtr &_camera) override; @@ -115,7 +115,7 @@ namespace gz { public: BaseRenderTexture(); - public: virtual ~BaseRenderTexture(); + public: ~BaseRenderTexture() override; // Documentation inherited. public: virtual unsigned int GLId() const override; @@ -131,20 +131,20 @@ namespace gz { public: BaseRenderWindow(); - public: virtual ~BaseRenderWindow(); + public: ~BaseRenderWindow() override; - public: virtual std::string Handle() const; + public: std::string Handle() const override; - public: virtual void SetHandle(const std::string &_handle); + public: void SetHandle(const std::string &_handle) override; - public: virtual double DevicePixelRatio() const; + public: double DevicePixelRatio() const override; - public: virtual void SetDevicePixelRatio(const double _ratio); + public: void SetDevicePixelRatio(const double _ratio) override; - public: virtual void OnResize(const unsigned int _width, - const unsigned int _height); + public: void OnResize(const unsigned int _width, + const unsigned int _height) override; - public: virtual void OnMove(); + public: void OnMove() override; protected: std::string handle; diff --git a/include/gz/rendering/base/BaseText.hh b/include/gz/rendering/base/BaseText.hh index e8a973443..4e1aa228a 100644 --- a/include/gz/rendering/base/BaseText.hh +++ b/include/gz/rendering/base/BaseText.hh @@ -37,13 +37,13 @@ namespace gz protected: BaseText(); /// \brief Destructor - public: virtual ~BaseText(); + public: ~BaseText() override; // Documentation inherited. - public: virtual void PreRender() override; + public: void PreRender() override; // Documentation inherited. - public: virtual void Destroy() override; + public: void Destroy() override; // Documentation inherited. public: void SetFontName(const std::string &_font) override; @@ -52,53 +52,54 @@ namespace gz public: std::string FontName() const override; // Documentation inherited. - public: virtual void SetTextString(const std::string &_text) override; + public: void SetTextString(const std::string &_text) override; // Documentation inherited. - public: virtual std::string TextString() const override; + public: std::string TextString() const override; // Documentation inherited. - public: virtual void SetColor(const gz::math::Color &_color) - override; + public: void SetColor(const gz::math::Color &_color) override; // Documentation inherited. - public: virtual gz::math::Color Color() const override; + public: gz::math::Color Color() const override; // Documentation inherited. - public: virtual void SetCharHeight(const float _height) override; + public: void SetCharHeight(const float _height) override; // Documentation inherited. - public: virtual float CharHeight() const override; + public: float CharHeight() const override; // Documentation inherited. - public: virtual void SetSpaceWidth(const float _width) override; + public: void SetSpaceWidth(const float _width) override; // Documentation inherited. - public: virtual float SpaceWidth() const override; + public: float SpaceWidth() const override; // Documentation inherited. - public: virtual void SetTextAlignment(const TextHorizontalAlign &_hAlign, + public: void SetTextAlignment( + const TextHorizontalAlign &_hAlign, const TextVerticalAlign &_vAlign) override; + // Documentation inherited. - public: virtual TextHorizontalAlign HorizontalAlignment() const override; + public: TextHorizontalAlign HorizontalAlignment() const override; // Documentation inherited. - public: virtual TextVerticalAlign VerticalAlignment() const override; + public: TextVerticalAlign VerticalAlignment() const override; // Documentation inherited. - public: virtual void SetBaseline(const float _baseline) override; + public: void SetBaseline(const float _baseline) override; // Documentation inherited. - public: virtual float Baseline() const override; + public: float Baseline() const override; // Documentation inherited. public: void SetShowOnTop(const bool _onTop) override; // Documentation inherited. - public: virtual bool ShowOnTop() const override; + public: bool ShowOnTop() const override; // Documentation inherited. - public: virtual gz::math::AxisAlignedBox AABB() const override; + public: gz::math::AxisAlignedBox AABB() const override; /// \brief Font name, such as "Liberation Sans" protected: std::string fontName = "Liberation Sans"; @@ -238,11 +239,11 @@ namespace gz ////////////////////////////////////////////////// template - void BaseText::SetTextAlignment(const TextHorizontalAlign &_horzAlign, - const TextVerticalAlign &_vertAlign) + void BaseText::SetTextAlignment(const TextHorizontalAlign &_hAlign, + const TextVerticalAlign &_vAlign) { - this->horizontalAlign = _horzAlign; - this->verticalAlign = _vertAlign; + this->horizontalAlign = _hAlign; + this->verticalAlign = _vAlign; this->textDirty = true; } diff --git a/include/gz/rendering/base/BaseThermalCamera.hh b/include/gz/rendering/base/BaseThermalCamera.hh index a7bf4f8bb..68b919947 100644 --- a/include/gz/rendering/base/BaseThermalCamera.hh +++ b/include/gz/rendering/base/BaseThermalCamera.hh @@ -66,7 +66,7 @@ namespace gz public: virtual float MaxTemperature() const override; // Documentation inherited. - public: virtual void SetLinearResolution(float _max) override; + public: virtual void SetLinearResolution(float _resolution) override; // Documentation inherited. public: virtual float LinearResolution() const override; diff --git a/include/gz/rendering/base/BaseWireBox.hh b/include/gz/rendering/base/BaseWireBox.hh index 8d42100af..7ccefb3c0 100644 --- a/include/gz/rendering/base/BaseWireBox.hh +++ b/include/gz/rendering/base/BaseWireBox.hh @@ -36,19 +36,19 @@ namespace gz protected: BaseWireBox(); /// \brief Destructor - public: virtual ~BaseWireBox(); + public: ~BaseWireBox() override; // Documentation inherited. - public: virtual void PreRender(); + public: void PreRender() override; // Documentation inherited. - public: virtual void Destroy(); + public: void Destroy() override; // Documentation inherited. - public: virtual void SetBox(const gz::math::AxisAlignedBox &_box); + public: void SetBox(const gz::math::AxisAlignedBox &_box) override; // Documentation inherited. - public: virtual gz::math::AxisAlignedBox Box() const; + public: gz::math::AxisAlignedBox Box() const override; // \brief Underlying axis aligned box that the wire box reflects. protected: gz::math::AxisAlignedBox box; diff --git a/ogre/include/gz/rendering/ogre/OgreDynamicLines.hh b/ogre/include/gz/rendering/ogre/OgreDynamicLines.hh index c0bd4d963..c76f3d7d2 100644 --- a/ogre/include/gz/rendering/ogre/OgreDynamicLines.hh +++ b/ogre/include/gz/rendering/ogre/OgreDynamicLines.hh @@ -47,7 +47,7 @@ namespace gz MarkerType _opType = MT_LINE_STRIP); /// \brief Destructor - public: virtual ~OgreDynamicLines(); + public: ~OgreDynamicLines() override; /// \brief Add a point to the point list /// \param[in] _pt gz::math::Vector3d point @@ -96,11 +96,11 @@ namespace gz /// \brief Implementation DynamicRenderable, /// creates a simple vertex-only decl - private: virtual void CreateVertexDeclaration(); + private: void CreateVertexDeclaration() override; /// \brief Implementation DynamicRenderable, pushes point /// list out to hardware memory - private: virtual void FillHardwareBuffers(); + private: void FillHardwareBuffers() override; /// \brief private implementation private: std::unique_ptr dataPtr; diff --git a/ogre/include/gz/rendering/ogre/OgreGeometry.hh b/ogre/include/gz/rendering/ogre/OgreGeometry.hh index 0adecbf3b..ee454c8bf 100644 --- a/ogre/include/gz/rendering/ogre/OgreGeometry.hh +++ b/ogre/include/gz/rendering/ogre/OgreGeometry.hh @@ -38,11 +38,11 @@ namespace gz { protected: OgreGeometry(); - public: virtual ~OgreGeometry(); + public: ~OgreGeometry() override; - public: virtual bool HasParent() const; + public: bool HasParent() const override; - public: virtual VisualPtr Parent() const; + public: VisualPtr Parent() const override; public: virtual Ogre::MovableObject *OgreObject() const = 0; diff --git a/ogre/include/gz/rendering/ogre/OgreGrid.hh b/ogre/include/gz/rendering/ogre/OgreGrid.hh index e79c56731..b869f0928 100644 --- a/ogre/include/gz/rendering/ogre/OgreGrid.hh +++ b/ogre/include/gz/rendering/ogre/OgreGrid.hh @@ -45,22 +45,22 @@ namespace gz protected: OgreGrid(); /// \brief Destructor - public: virtual ~OgreGrid(); + public: ~OgreGrid() override; // Documentation inherited. - public: virtual void Init(); + public: void Init() override; // Documentation inherited. - public: virtual Ogre::MovableObject *OgreObject() const; + public: Ogre::MovableObject *OgreObject() const override; // Documentation inherited. - public: virtual void PreRender(); + public: void PreRender() override; // Documentation inherited. - public: virtual MaterialPtr Material() const; + public: MaterialPtr Material() const override; // Documentation inherited. - public: virtual void SetMaterial(MaterialPtr _material, bool _unique); + public: void SetMaterial(MaterialPtr _material, bool _unique) override; /// \brief Set material to grid geometry. /// \param[in] _material Ogre material. diff --git a/ogre/include/gz/rendering/ogre/OgreLight.hh b/ogre/include/gz/rendering/ogre/OgreLight.hh index 51ee3df38..219859fc9 100644 --- a/ogre/include/gz/rendering/ogre/OgreLight.hh +++ b/ogre/include/gz/rendering/ogre/OgreLight.hh @@ -37,36 +37,36 @@ namespace gz { protected: OgreLight(); - public: virtual ~OgreLight(); + public: ~OgreLight() override; public: virtual math::Color DiffuseColor() const override; - public: virtual void SetDiffuseColor(const math::Color &_color) override; + public: void SetDiffuseColor(const math::Color &_color) override; public: virtual math::Color SpecularColor() const override; - public: virtual void SetSpecularColor( + public: void SetSpecularColor( const math::Color &_color) override; public: virtual double AttenuationConstant() const override; - public: virtual void SetAttenuationConstant(double _value) override; + public: void SetAttenuationConstant(double _value) override; public: virtual double AttenuationLinear() const override; - public: virtual void SetAttenuationLinear(double _value) override; + public: void SetAttenuationLinear(double _value) override; public: virtual double AttenuationQuadratic() const override; - public: virtual void SetAttenuationQuadratic(double _value) override; + public: void SetAttenuationQuadratic(double _value) override; public: virtual double AttenuationRange() const override; - public: virtual void SetAttenuationRange(double _range) override; + public: void SetAttenuationRange(double _range) override; public: virtual bool CastShadows() const override; - public: virtual void SetCastShadows(bool _castShadows) override; + public: void SetCastShadows(bool _castShadows) override; // Documentation Inherited public: virtual double Intensity() const override; @@ -102,11 +102,11 @@ namespace gz { protected: OgreDirectionalLight(); - public: virtual ~OgreDirectionalLight(); + public: ~OgreDirectionalLight() override; - public: virtual math::Vector3d Direction() const; + public: math::Vector3d Direction() const override; - public: virtual void SetDirection(const math::Vector3d &_dir); + public: void SetDirection(const math::Vector3d &_dir) override; private: friend class OgreScene; }; @@ -126,23 +126,23 @@ namespace gz { protected: OgreSpotLight(); - public: virtual ~OgreSpotLight(); + public: ~OgreSpotLight() override; - public: virtual math::Vector3d Direction() const; + public: math::Vector3d Direction() const override; - public: virtual void SetDirection(const math::Vector3d &_dir); + public: void SetDirection(const math::Vector3d &_dir) override; - public: virtual math::Angle InnerAngle() const; + public: math::Angle InnerAngle() const override; - public: virtual void SetInnerAngle(const math::Angle &_angle); + public: void SetInnerAngle(const math::Angle &_angle) override; - public: virtual math::Angle OuterAngle() const; + public: math::Angle OuterAngle() const override; - public: virtual void SetOuterAngle(const math::Angle &_angle); + public: void SetOuterAngle(const math::Angle &_angle) override; - public: virtual double Falloff() const; + public: double Falloff() const override; - public: virtual void SetFalloff(double _falloff); + public: void SetFalloff(double _falloff) override; private: friend class OgreScene; }; diff --git a/ogre/include/gz/rendering/ogre/OgreProjector.hh b/ogre/include/gz/rendering/ogre/OgreProjector.hh index b91938ce1..cdec9b02f 100644 --- a/ogre/include/gz/rendering/ogre/OgreProjector.hh +++ b/ogre/include/gz/rendering/ogre/OgreProjector.hh @@ -53,7 +53,7 @@ namespace gz /// we handle the decal's visibility in each of these cameras' view private: void UpdateCameraListener(); - /// \brief Only the ogre scene can instanstiate this class + /// \brief Only the ogre scene can instantiate this class private: friend class OgreScene; /// \cond warning diff --git a/ogre/include/gz/rendering/ogre/OgreRenderEngine.hh b/ogre/include/gz/rendering/ogre/OgreRenderEngine.hh index 457c448ba..5dad3b0d3 100644 --- a/ogre/include/gz/rendering/ogre/OgreRenderEngine.hh +++ b/ogre/include/gz/rendering/ogre/OgreRenderEngine.hh @@ -58,11 +58,11 @@ namespace gz /// \brief Get the name of the render engine loaded by this plugin. /// \return Name of render engine - public: std::string Name() const; + public: std::string Name() const override; /// \brief Get a pointer to the render engine loaded by this plugin. /// \return Render engine instance - public: RenderEngine *Engine() const; + public: RenderEngine *Engine() const override; }; class GZ_RENDERING_OGRE_VISIBLE OgreRenderEngine : diff --git a/ogre/src/OgreConversions.cc b/ogre/src/OgreConversions.cc index 1362cfe38..58200d246 100644 --- a/ogre/src/OgreConversions.cc +++ b/ogre/src/OgreConversions.cc @@ -22,7 +22,7 @@ using namespace rendering; ////////////////////////////////////////////////// const Ogre::PixelFormat OgreConversions::ogrePixelFormats[PF_COUNT] = { - // UKNOWN + // UNKNOWN Ogre::PF_UNKNOWN, // L8 Ogre::PF_L8, diff --git a/ogre/src/OgreDistortionPass.cc b/ogre/src/OgreDistortionPass.cc index e6fa6fa87..ed53ce0f6 100644 --- a/ogre/src/OgreDistortionPass.cc +++ b/ogre/src/OgreDistortionPass.cc @@ -181,7 +181,7 @@ void OgreDistortionPass::CreateRenderPass() // initialize distortion map this->dataPtr->distortionMap.resize(imageSize); - for (unsigned int i = 0; i < this->dataPtr->distortionMap.size(); ++i) + for (size_t i = 0; i < this->dataPtr->distortionMap.size(); ++i) { this->dataPtr->distortionMap[i] = -1; } diff --git a/ogre/src/OgreFrustumVisual.cc b/ogre/src/OgreFrustumVisual.cc index 0e3594842..6bb96c63e 100644 --- a/ogre/src/OgreFrustumVisual.cc +++ b/ogre/src/OgreFrustumVisual.cc @@ -33,13 +33,6 @@ class gz::rendering::OgreFrustumVisualPrivate /// \brief The visibility of the visual public: bool visible = true; - - /// \brief Each corner of the frustum. - public: std::array points; - - /// \brief each edge of the frustum. - public: std::array, 12> edges; }; using namespace gz; diff --git a/ogre/src/OgreHeightmap.cc b/ogre/src/OgreHeightmap.cc index 6a959f7dc..f90c2005c 100644 --- a/ogre/src/OgreHeightmap.cc +++ b/ogre/src/OgreHeightmap.cc @@ -1098,9 +1098,8 @@ bool OgreHeightmap::InitBlendMaps(Ogre::Terrain *_terrain) // Create the blend maps std::vector blendMaps; std::vector pBlend; - unsigned int i{0u}; - for (i = 0; i < this->descriptor.BlendCount(); ++i) + for (uint64_t i = 0; i < this->descriptor.BlendCount(); ++i) { blendMaps.push_back(_terrain->getLayerBlendMap(i+1)); pBlend.push_back(blendMaps[i]->getBlendPointer()); @@ -1117,7 +1116,7 @@ bool OgreHeightmap::InitBlendMaps(Ogre::Terrain *_terrain) blendMaps[0]->convertImageToTerrainSpace(x, y, &tx, &ty); height = _terrain->getHeightAtTerrainPosition(tx, ty); - for (i = 0; i < this->descriptor.BlendCount(); ++i) + for (uint64_t i = 0; i < this->descriptor.BlendCount(); ++i) { auto blend = this->descriptor.BlendByIndex(i); val = (height - blend->MinHeight()) / blend->FadeDistance(); diff --git a/ogre/src/OgreLidarVisual.cc b/ogre/src/OgreLidarVisual.cc index 80c2706b7..4fcdbd146 100644 --- a/ogre/src/OgreLidarVisual.cc +++ b/ogre/src/OgreLidarVisual.cc @@ -156,7 +156,7 @@ void OgreLidarVisual::SetPoints(const std::vector &_points) { this->dataPtr->lidarPoints = _points; this->dataPtr->pointColors.clear(); - for (unsigned int i = 0u; i < this->dataPtr->lidarPoints.size(); ++i) + for (size_t i = 0u; i < this->dataPtr->lidarPoints.size(); ++i) { this->dataPtr->pointColors.push_back(gz::math::Color::Blue); } diff --git a/ogre/src/OgreMaterial.cc b/ogre/src/OgreMaterial.cc index 1b442f294..bbbf6e9d5 100644 --- a/ogre/src/OgreMaterial.cc +++ b/ogre/src/OgreMaterial.cc @@ -68,8 +68,8 @@ void OgreMaterial::Destroy() } #endif auto &textureManager = Ogre::TextureManager::getSingleton(); - auto iend = textureManager.getResourceIterator().end(); - for (auto i = textureManager.getResourceIterator().begin(); i != iend;) + const auto iend = textureManager.getResourceIterator().end(); + for (auto i = textureManager.getResourceIterator().begin(); i != iend; ++i) { // A use count of 4 means that only RGM, RM and MeshManager have // references RGM has one (this one) and RM has 2 (by name and by handle) @@ -91,7 +91,6 @@ void OgreMaterial::Destroy() break; } } - ++i; } } diff --git a/ogre/src/OgreMesh.cc b/ogre/src/OgreMesh.cc index 9ac89f89a..fa5e62f53 100644 --- a/ogre/src/OgreMesh.cc +++ b/ogre/src/OgreMesh.cc @@ -64,8 +64,8 @@ void OgreMesh::Destroy() this->ogreEntity = nullptr; auto &meshManager = Ogre::MeshManager::getSingleton(); - auto iend = meshManager.getResourceIterator().end(); - for (auto i = meshManager.getResourceIterator().begin(); i != iend;) + const auto iend = meshManager.getResourceIterator().end(); + for (auto i = meshManager.getResourceIterator().begin(); i != iend; ++i) { // A use count of 3 means that only RGM and RM have references // RGM has one (this one) and RM has 2 (by name and by handle) @@ -78,7 +78,6 @@ void OgreMesh::Destroy() break; } } - i++; } } diff --git a/ogre/src/OgreMeshFactory.cc b/ogre/src/OgreMeshFactory.cc index ee610cc7f..db6a8a86b 100644 --- a/ogre/src/OgreMeshFactory.cc +++ b/ogre/src/OgreMeshFactory.cc @@ -128,15 +128,13 @@ void OgreMeshFactory::ClearMaterialsCache(const std::string &_name) bool OgreMeshFactory::LoadImpl(const MeshDescriptor &_desc) { Ogre::MeshPtr ogreMesh; - std::string name; - std::string group; OgreRenderEngine::Instance()->AddResourcePath(_desc.mesh->Path()); try { - name = this->MeshName(_desc); - group = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME; + const auto &name = this->MeshName(_desc); + const auto &group = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME; ogreMesh = Ogre::MeshManager::getSingleton().createManual(name, group); // load skeleton @@ -557,9 +555,9 @@ OgreSubMeshStoreFactory::~OgreSubMeshStoreFactory() OgreSubMeshStorePtr OgreSubMeshStoreFactory::Create() { OgreSubMeshStorePtr subMeshes(new OgreSubMeshStore); - unsigned int count = this->ogreEntity->getNumSubEntities(); + const auto count = this->ogreEntity->getNumSubEntities(); - for (unsigned int i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { OgreSubMeshPtr subMesh = this->CreateSubMesh(i); subMeshes->Add(subMesh); @@ -602,10 +600,10 @@ void OgreSubMeshStoreFactory::CreateNameList() ////////////////////////////////////////////////// void OgreSubMeshStoreFactory::PopulateDefaultNames() { - unsigned int count = this->ogreEntity->getNumSubEntities(); + const auto count = this->ogreEntity->getNumSubEntities(); this->names.reserve(count); - for (unsigned int i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { this->names.push_back("SubMesh(" + std::to_string(i) + ")"); } diff --git a/ogre/src/OgreProjector.cc b/ogre/src/OgreProjector.cc index 77420633b..57aa7395d 100644 --- a/ogre/src/OgreProjector.cc +++ b/ogre/src/OgreProjector.cc @@ -194,7 +194,7 @@ namespace gz private: std::unordered_map matClones; /// \brief A set of visible materials in the frustum. Used when decal - /// has custom visiblility flags + /// has custom visibility flags private: std::unordered_set visibleMaterials; }; } @@ -207,7 +207,7 @@ class gz::rendering::OgreProjector::Implementation /// \brief The projection frame listener. public: OgreProjectorListener projector; - /// \brief Indicate whether the projector is intialized or not + /// \brief Indicate whether the projector is initialized or not public: bool initialized{false}; /// \brief A map of cameras () that the listener has been @@ -430,7 +430,7 @@ std::unordered_set OgreProjectorListener::FindVisibleMaterials() entity->getUserObjectBindings().getUserAny().getType() == typeid(unsigned int)) { - for (unsigned int i = 0; i < entity->getNumSubEntities(); i++) + for (size_t i = 0; i < entity->getNumSubEntities(); i++) { newVisibleMaterials.insert( entity->getSubEntity(i)->getMaterialName()); @@ -575,15 +575,15 @@ void OgreProjector::UpdateCameraListener() // to all cameras if (this->VisibilityFlags() == GZ_VISIBILITY_ALL) { - for (auto &ogreCamIt : this->dataPtr->camerasWithListener) + for (const auto &ogreCamIt : this->dataPtr->camerasWithListener) { - Ogre::String camName = ogreCamIt.second; + const Ogre::String &camName = ogreCamIt.second; // instead of getting the camera pointer through ogreCamIt.first, // find camera pointer again to make sure the camera still exists // because there is a chance that we are holding onto a dangling pointer // if that camera was deleted already auto ogreCam = this->scene->OgreSceneManager()->getCamera(camName); - ogreCam->getViewport()->getTarget()->removeListener( + ogreCam->getViewport()->getTarget()->removeListener( &this->dataPtr->projector); } this->dataPtr->camerasWithListener.clear(); @@ -701,7 +701,7 @@ Ogre::Technique *OgreProjectorListener::handleSchemeNotFound( std::string projectedMaterialName = _originalMaterial->getName() + "_" + this->nodeName; - // check if the material for the current entity is visble in the frustum + // check if the material for the current entity is visible in the frustum if (this->visibleMaterials.find(_originalMaterial->getName()) == this->visibleMaterials.end()) { @@ -721,7 +721,7 @@ Ogre::Technique *OgreProjectorListener::handleSchemeNotFound( if (it != this->matClones.end()) { clone = it->second; - // if the clnoe material is in the view, that means it has the projected + // if the clone material is in the view, that means it has the projected // texture already if (this->projectorTargets.find(projectedMaterialName) != this->projectorTargets.end()) diff --git a/ogre/src/OgreRTShaderSystem.cc b/ogre/src/OgreRTShaderSystem.cc index cb7c0cbb2..932f2fede 100644 --- a/ogre/src/OgreRTShaderSystem.cc +++ b/ogre/src/OgreRTShaderSystem.cc @@ -43,7 +43,7 @@ class gz::rendering::OgreRTShaderSystemPrivate /// \brief Used to generate shadows. public: Ogre::RTShader::SubRenderState *shadowRenderState = nullptr; - /// \brief All the entites being used. + /// \brief All the entities being used. public: std::set entities; /// \brief True if initialized. @@ -331,7 +331,7 @@ void OgreRTShaderSystem::RemoveShaders(OgreSubMesh *_subMesh) if (curTechnique->getSchemeName() == srcTechniqueSchemeName) { bool hasFixedFunctionPass = false; - for (unsigned int i = 0; i < curTechnique->getNumPasses(); ++i) + for (size_t i = 0; i < curTechnique->getNumPasses(); ++i) { if (!curTechnique->getPass(i)->isProgrammable()) { @@ -351,7 +351,7 @@ void OgreRTShaderSystem::RemoveShaders(OgreSubMesh *_subMesh) s->Name() + Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME); #endif } - catch(Ogre::Exception &e) + catch(const Ogre::Exception &e) { gzerr << "Unable to remove shader technique for material[" << curMaterialName << "]\n"; @@ -383,7 +383,7 @@ void OgreRTShaderSystem::GenerateShaders(OgreSubMesh *subMesh) const Ogre::String& curMaterialName = curSubEntity->getMaterialName(); bool success = false; - for (unsigned int s = 0; s < this->dataPtr->scenes.size(); s++) + for (size_t s = 0; s < this->dataPtr->scenes.size(); s++) { try { @@ -397,7 +397,7 @@ void OgreRTShaderSystem::GenerateShaders(OgreSubMesh *subMesh) this->dataPtr->scenes[s]->Name() + Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME); } - catch(Ogre::Exception &e) + catch(const Ogre::Exception &e) { gzerr << "Unable to create shader technique for material[" << curMaterialName << "]\n"; @@ -660,7 +660,7 @@ void OgreRTShaderSystem::ApplyShadows(OgreScenePtr _scene) Ogre::RTShader::IntegratedPSSM3::SplitPointList dstSplitPoints; - for (unsigned int i = 0; i < srcSplitPoints.size(); ++i) + for (size_t i = 0; i < srcSplitPoints.size(); ++i) { dstSplitPoints.push_back(srcSplitPoints[i]); } diff --git a/ogre/src/OgreRayQuery.cc b/ogre/src/OgreRayQuery.cc index a54e6ebd6..0818026bf 100644 --- a/ogre/src/OgreRayQuery.cc +++ b/ogre/src/OgreRayQuery.cc @@ -167,7 +167,7 @@ RayQueryResult OgreRayQuery::ClosestPoint(bool /*_forceSceneUpdate*/) // NOLINT OgreConversions::Convert( ogreEntity->getParentNode()->_getDerivedScale())); - for (unsigned int i = 0; i < indexCount; i += 3) + for (size_t i = 0; i < indexCount; i += 3) { // when indices size is not divisible by 3 if (i+2 >= indexCount) @@ -221,7 +221,7 @@ void OgreRayQuery::MeshInformation(const Ogre::Mesh *_mesh, _vertex_count = _index_count = 0; // Calculate how many vertices and indices we're going to need - for (uint16_t i = 0; i < _mesh->getNumSubMeshes(); ++i) + for (size_t i = 0; i < _mesh->getNumSubMeshes(); ++i) { Ogre::SubMesh* submesh = _mesh->getSubMesh(i); @@ -250,7 +250,7 @@ void OgreRayQuery::MeshInformation(const Ogre::Mesh *_mesh, added_shared = false; // Run through the submeshes again, adding the data into the arrays - for (uint16_t i = 0; i < _mesh->getNumSubMeshes(); ++i) + for (size_t i = 0; i < _mesh->getNumSubMeshes(); ++i) { Ogre::SubMesh* submesh = _mesh->getSubMesh(i); diff --git a/ogre/src/OgreRenderPass.cc b/ogre/src/OgreRenderPass.cc index dd0e2d97c..f1bc6d4fb 100644 --- a/ogre/src/OgreRenderPass.cc +++ b/ogre/src/OgreRenderPass.cc @@ -52,5 +52,5 @@ void OgreRenderPass::Destroy() ////////////////////////////////////////////////// void OgreRenderPass::CreateRenderPass() { - // To be overriden by derived render pass classes + // To be overridden by derived render pass classes } diff --git a/ogre/src/OgreText.cc b/ogre/src/OgreText.cc index ee21125ec..0be8624e3 100644 --- a/ogre/src/OgreText.cc +++ b/ogre/src/OgreText.cc @@ -70,7 +70,7 @@ class gz::rendering::OgreMovableText /// \param[in] _height Baseline height public: void SetBaseline(const float _baseline); - /// \brief True = text always is displayed ontop. + /// \brief True = text always is displayed on top. /// \param[in] _show Set to true to render the text on top of /// all other drawables. public: void SetShowOnTop(const bool _onTop); @@ -95,8 +95,8 @@ class gz::rendering::OgreMovableText public: void Update(); /// \brief Set font name implementation. - /// \param-in] _font Name of font - public: void SetFontNameImpl(const std::string &_font); + /// \param-in] _newFontName Name of font + public: void SetFontNameImpl(const std::string &_newFontName); /// \internal /// \brief Method to allow a caller to abstractly iterate over the @@ -111,7 +111,7 @@ class gz::rendering::OgreMovableText protected: void getWorldTransforms(Ogre::Matrix4 *_xform) const override; /// \internal - /// \brief Get the bounding radiu (from MovableObject) + /// \brief Get the bounding radius (from MovableObject) protected: float getBoundingRadius() const override; /// \internal @@ -212,7 +212,7 @@ class gz::rendering::OgreMovableText /// \brief Private data for the OgreText class. class gz::rendering::OgreTextPrivate { - /// \brief Text materal + /// \brief Text material public: OgreMaterialPtr material; /// Pointer to ogre movable text object @@ -420,7 +420,6 @@ void OgreMovableText::SetupGeometry() size_t offset = 0; float maxSquaredRadius = 0.0f; bool first = true; - std::string::iterator i; bool newLine = true; float len = 0.0f; @@ -499,19 +498,19 @@ void OgreMovableText::SetupGeometry() { // Raise the first line of the caption top += this->charHeight; - for (i = this->text.begin(); i != this->text.end(); ++i) + for (auto it = this->text.begin(); it != this->text.end(); ++it) { - if (*i == '\n') + if (*it == '\n') top += this->charHeight * 2.0; } } - for (i = this->text.begin(); i != this->text.end(); ++i) + for (auto it = this->text.begin(); it != this->text.end(); ++it) { if (newLine) { len = 0.0; - for (std::string::iterator j = i; j != this->text.end(); ++j) + for (std::string::iterator j = it; j != this->text.end(); ++j) { Ogre::Font::CodePoint character = *j; if (character == '\n') @@ -534,7 +533,7 @@ void OgreMovableText::SetupGeometry() newLine = false; } - Ogre::Font::CodePoint character = (*i); + Ogre::Font::CodePoint character = (*it); if (character == '\n') { left = 0.0; @@ -559,7 +558,7 @@ void OgreMovableText::SetupGeometry() float horizHeight = this->font->getGlyphAspectRatio(character) * this->viewportAspectCoef; - auto &uvRect = this->font->getGlyphTexCoords(character); + const auto &uvRect = this->font->getGlyphTexCoords(character); // each vert is (x, y, z, u, v) //------------------------------------------------------------------------ @@ -737,7 +736,6 @@ void OgreMovableText::UpdateColors() Ogre::RGBA clr; Ogre::HardwareVertexBufferSharedPtr vbuf; Ogre::RGBA *pDest{nullptr}; - unsigned int i; GZ_ASSERT(this->font, "font class member is null"); #if OGRE_VERSION_LT_1_11_0 @@ -757,7 +755,7 @@ void OgreMovableText::UpdateColors() pDest = static_cast( vbuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); - for (i = 0; i < this->renderOp.vertexData->vertexCount; ++i) + for (Ogre::uint32 i = 0; i < this->renderOp.vertexData->vertexCount; ++i) { *pDest++ = clr; } diff --git a/ogre/src/OgreVisual.cc b/ogre/src/OgreVisual.cc index b50795c0a..9fc5fb287 100644 --- a/ogre/src/OgreVisual.cc +++ b/ogre/src/OgreVisual.cc @@ -55,8 +55,7 @@ void OgreVisual::SetWireframe(bool _show) return; this->dataPtr->wireframe = _show; - for (unsigned int i = 0; i < this->ogreNode->numAttachedObjects(); - i++) + for (size_t i = 0; i < this->ogreNode->numAttachedObjects(); ++i) { Ogre::MovableObject *obj = this->ogreNode->getAttachedObject(i); Ogre::Entity *entity = dynamic_cast(obj); @@ -64,26 +63,24 @@ void OgreVisual::SetWireframe(bool _show) if (!entity) continue; - for (unsigned int j = 0; j < entity->getNumSubEntities(); j++) + for (size_t j = 0; j < entity->getNumSubEntities(); ++j) { Ogre::SubEntity *subEntity = entity->getSubEntity(j); Ogre::MaterialPtr entityMaterial = subEntity->getMaterial(); if (entityMaterial.isNull()) continue; - unsigned int techniqueCount, passCount; - Ogre::Technique *technique; - Ogre::Pass *pass; - - for (techniqueCount = 0; + for (size_t techniqueCount = 0; techniqueCount < entityMaterial->getNumTechniques(); ++techniqueCount) { - technique = entityMaterial->getTechnique(techniqueCount); + Ogre::Technique *technique = + entityMaterial->getTechnique(techniqueCount); - for (passCount = 0; passCount < technique->getNumPasses(); passCount++) + for (size_t passCount = 0; + passCount < technique->getNumPasses(); ++passCount) { - pass = technique->getPass(passCount); + Ogre::Pass *pass = technique->getPass(passCount); if (_show) pass->setPolygonMode(Ogre::PM_WIREFRAME); else @@ -117,7 +114,7 @@ void OgreVisual::SetVisibilityFlags(uint32_t _flags) if (!this->ogreNode) return; - for (unsigned int i = 0; i < this->ogreNode->numAttachedObjects(); ++i) + for (size_t i = 0; i < this->ogreNode->numAttachedObjects(); ++i) this->ogreNode->getAttachedObject(i)->setVisibilityFlags(_flags); } @@ -230,7 +227,7 @@ void OgreVisual::BoundsHelper(gz::math::AxisAlignedBox &_box, gz::math::Vector3d scale = this->WorldScale(); - for (int i = 0; i < this->ogreNode->numAttachedObjects(); i++) + for (size_t i = 0; i < this->ogreNode->numAttachedObjects(); i++) { Ogre::MovableObject *obj = this->ogreNode->getAttachedObject(i); diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2GpuRays.hh b/ogre2/include/gz/rendering/ogre2/Ogre2GpuRays.hh index aeffb6cad..782f6944f 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2GpuRays.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2GpuRays.hh @@ -18,6 +18,7 @@ #ifndef GZ_RENDERING_OGRE2_OGRE2GPURAYS_HH_ #define GZ_RENDERING_OGRE2_OGRE2GPURAYS_HH_ +#include #include #include diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2Grid.hh b/ogre2/include/gz/rendering/ogre2/Ogre2Grid.hh index 6f7a44906..f0c392fd6 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2Grid.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2Grid.hh @@ -44,22 +44,22 @@ namespace gz protected: Ogre2Grid(); /// \brief Destructor - public: virtual ~Ogre2Grid(); + public: ~Ogre2Grid() override; // Documentation inherited. - public: virtual void Init(); + public: void Init() override; // Documentation inherited. - public: virtual Ogre::MovableObject *OgreObject() const; + public: Ogre::MovableObject *OgreObject() const override; // Documentation inherited. - public: virtual void PreRender(); + public: void PreRender() override; // Documentation inherited. - public: virtual MaterialPtr Material() const; + public: MaterialPtr Material() const override; // Documentation inherited. - public: virtual void SetMaterial(MaterialPtr _material, bool _unique); + public: void SetMaterial(MaterialPtr _material, bool _unique) override; /// \brief Set material to grid geometry. /// \param[in] _material Ogre material. diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh b/ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh index 7ff5d0068..fae245050 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh @@ -99,7 +99,7 @@ namespace gz /// \brief Create the particle system private: void CreateParticleSystem(); - /// \brief Only the ogre scene can instanstiate this class + /// \brief Only the ogre scene can instantiate this class private: friend class Ogre2Scene; /// \brief Private data class diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2RenderEngine.hh b/ogre2/include/gz/rendering/ogre2/Ogre2RenderEngine.hh index 821419ab2..e2262d39d 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2RenderEngine.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2RenderEngine.hh @@ -71,11 +71,11 @@ namespace gz /// \brief Get the name of the render engine loaded by this plugin. /// \return Name of render engine - public: std::string Name() const; + public: std::string Name() const override; /// \brief Get a pointer to the render engine loaded by this plugin. /// \return Render engine instance - public: RenderEngine *Engine() const; + public: RenderEngine *Engine() const override; }; /// \brief Ogre2 render engine class. A singleton class that manages the @@ -181,7 +181,7 @@ namespace gz /// \brief Create the resources needed by ogre private: void CreateResources(); - /// \brief Attempt to initialize engine and catch exeption if they occur + /// \brief Attempt to initialize engine and catch exception if they occur private: void InitAttempt(); /// \brief Get a list of all supported FSAA levels for this render system diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2RenderPass.hh b/ogre2/include/gz/rendering/ogre2/Ogre2RenderPass.hh index 581b561a9..029991b73 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2RenderPass.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2RenderPass.hh @@ -46,7 +46,7 @@ namespace gz /// The ogre2 compositor chain in gz-rendering is set up as follows: /// * Base scene pass -> [0..N] RenderPass'es -> Final compositor pass. /// This is set up by Ogre2RenderTarget which loads the compositor workspace - /// definiton from script. The base scene pass node is responsible for + /// definition from script. The base scene pass node is responsible for /// rendering the initial scene and passes its output to any RenderPass'es /// that are added to the RenderTarget. Each RenderPass has its own ogre /// compositor node that receives the output from the previous RenderPass diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2RenderTargetMaterial.hh b/ogre2/include/gz/rendering/ogre2/Ogre2RenderTargetMaterial.hh index 34303f033..f5e9b5c0e 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2RenderTargetMaterial.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2RenderTargetMaterial.hh @@ -83,11 +83,11 @@ namespace gz /// when the requested scheme is not found /// \param[in] _schemeIndex Index of scheme requested /// \param[in] _schemeName Name of scheme requested - /// \param[in] _originalMaterial Orignal material that does not contain + /// \param[in] _originalMaterial Original material that does not contain /// the requested scheme /// \param[in] _lodIndex The material level-of-detail /// \param[in] _rend Pointer to the Ogre::Renderable object requesting - /// the use of the techinique + /// the use of the technique /// \return The Ogre material technique to use when scheme is not found. public: virtual Ogre::Technique *handleSchemeNotFound( uint16_t _schemeIndex, const Ogre::String &_schemeName, diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2Scene.hh b/ogre2/include/gz/rendering/ogre2/Ogre2Scene.hh index 61a58cd05..96b3b9236 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2Scene.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2Scene.hh @@ -104,7 +104,7 @@ namespace gz // Documentation inherited public: bool SetShadowTextureSize(LightType _lightType, - unsigned int _textureSize); + unsigned int _textureSize) override; // Documentation inherited public: unsigned int ShadowTextureSize(LightType _lightType) const @@ -422,7 +422,7 @@ namespace gz /// \param[in] _compositorManager ogre compositor manager /// \param[in] _shadowNodeName Name of the shadow node definition /// \param[in] _shadowParams Parameters containing the shadow type, - /// texure resolution and position on the texture atlas. + /// texture resolution and position on the texture atlas. private: void CreateShadowNodeWithSettings( Ogre::CompositorManager2 *_compositorManager, const std::string &_shadowNodeName, diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2Sensor.hh b/ogre2/include/gz/rendering/ogre2/Ogre2Sensor.hh index cb1a2c62b..9cc202f22 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2Sensor.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2Sensor.hh @@ -26,7 +26,7 @@ namespace gz { inline namespace GZ_RENDERING_VERSION_NAMESPACE { // - /// \brief Ogre2.x implementation of the sensor classs + /// \brief Ogre2.x implementation of the sensor class class GZ_RENDERING_OGRE2_VISIBLE Ogre2Sensor : public BaseSensor { diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2WideAngleCamera.hh b/ogre2/include/gz/rendering/ogre2/Ogre2WideAngleCamera.hh index 2979ddec7..c026ee03e 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2WideAngleCamera.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2WideAngleCamera.hh @@ -81,7 +81,7 @@ namespace gz public: void SetEnvTextureSize(uint32_t _size); /// \brief Project 3D world coordinates to screen coordinates - /// \param[in] _pt 3D world coodinates + /// \param[in] _pt 3D world coordinates /// \return Screen coordinates. Z is the distance of point from camera /// optical center. public: math::Vector3d Project3d(const math::Vector3d &_pt) const diff --git a/ogre2/src/Ogre2BoundingBoxCamera.cc b/ogre2/src/Ogre2BoundingBoxCamera.cc index 913b3714b..109ac9e60 100644 --- a/ogre2/src/Ogre2BoundingBoxCamera.cc +++ b/ogre2/src/Ogre2BoundingBoxCamera.cc @@ -151,7 +151,7 @@ class gz::rendering::Ogre2BoundingBoxCameraPrivate parentNameToBoxes; /// \brief Keep track of the visible bounding boxes (used in filtering) - /// Key: parent name, value: vector of ogre ids of it's childern + /// Key: parent name, value: vector of ogre ids of it's children public: std::map> parentNameToOgreIds; /// \brief The ogre item's 3d vertices from the vao(used in multi-link models) @@ -506,7 +506,7 @@ void Ogre2BoundingBoxCamera::CreateBoundingBoxTexture() Ogre::GpuResidency::Resident); // Switch material to OGRE Ids map to use it to get the visible bboxes - // or to check visiblity in full bboxes + // or to check visibility in full bboxes this->dataPtr->ogreCamera->addListener(this->dataPtr->materialSwitcher.get()); // workspace @@ -738,7 +738,7 @@ void Ogre2BoundingBoxCameraPrivate::MeshVertices( // Convert to world coordinates vec = (oreintation * (vec * scale)) + position; - // Convert to camera view coordiantes + // Convert to camera view coordinates Ogre::Vector4 vec4(vec.x, vec.y, vec.z, 1); vec4 = viewMatrix * vec4; @@ -1201,7 +1201,7 @@ void Ogre2BoundingBoxCamera::MeshMinimalBox( Ogre::Vector4 vec4(vec.x, vec.y, vec.z, 1); vec4 = _projMatrix * _viewMatrix * vec4; - // homogenous + // homogeneous vec.x = vec4.x / vec4.w; vec.y = vec4.y / vec4.w; vec.z = vec4.z; @@ -1403,6 +1403,7 @@ void Ogre2BoundingBoxCamera::DrawBoundingBox(unsigned char *_data, uint32_t height = this->ImageHeight(); std::vector projVertices; + projVertices.reserve(clippedVertices.size()); for (auto &vertex : clippedVertices) { // convert from [-1, 1] range to [0, 1] range & to the screen range @@ -1418,7 +1419,7 @@ void Ogre2BoundingBoxCamera::DrawBoundingBox(unsigned char *_data, static_cast(vertex.Y()))); } - for (unsigned int endPt = 0; endPt < projVertices.size(); endPt += 2) + for (size_t endPt = 0; endPt < projVertices.size(); endPt += 2) { this->DrawLine(_data, projVertices[endPt], projVertices[endPt + 1], _color); @@ -1486,7 +1487,7 @@ void Ogre2BoundingBoxCamera::ConvertToScreenCoord( _maxVertex.x = (_maxVertex.x + 1.0) / 2 * width; _maxVertex.y = (1.0 - _maxVertex.y) / 2 * height; - // clip outside screen boundries + // clip outside screen boundaries _minVertex.x = std::max(0.0, _minVertex.x); _minVertex.y = std::max(0.0, _minVertex.y); _maxVertex.x = std::min(_maxVertex.x, width - 1.0); diff --git a/ogre2/src/Ogre2BoundingBoxMaterialSwitcher.cc b/ogre2/src/Ogre2BoundingBoxMaterialSwitcher.cc index d3f745b10..da02a8bac 100644 --- a/ogre2/src/Ogre2BoundingBoxMaterialSwitcher.cc +++ b/ogre2/src/Ogre2BoundingBoxMaterialSwitcher.cc @@ -137,7 +137,7 @@ void Ogre2BoundingBoxMaterialSwitcher::cameraPreRenderScene( // Material color auto customParameter = Ogre::Vector4(ogreId2, ogreId1, labelColor, 1.0); - // Multi-links models handeling + // Multi-links models handling auto itemName = visual->Name(); std::string parentName = this->TopLevelModelVisual(visual)->Name(); diff --git a/ogre2/src/Ogre2Conversions.cc b/ogre2/src/Ogre2Conversions.cc index f2f9f325e..0ee1d9e9e 100644 --- a/ogre2/src/Ogre2Conversions.cc +++ b/ogre2/src/Ogre2Conversions.cc @@ -30,7 +30,7 @@ using namespace rendering; ////////////////////////////////////////////////// const Ogre::PixelFormatGpu Ogre2Conversions::ogrePixelFormats[PF_COUNT] = { - // UKNOWN + // UNKNOWN Ogre::PFG_UNKNOWN, // L8 Ogre::PFG_R8_UNORM, diff --git a/ogre2/src/Ogre2DepthCamera.cc b/ogre2/src/Ogre2DepthCamera.cc index 04a7e7e3d..f40a41ec9 100644 --- a/ogre2/src/Ogre2DepthCamera.cc +++ b/ogre2/src/Ogre2DepthCamera.cc @@ -1076,7 +1076,7 @@ void Ogre2DepthCamera::PreRender() colorPasses[0]->mExecutionMask = (this->dataPtr->newRgbPointCloud.ConnectionCount() > 0u) ? ~this->dataPtr->kDepthExecutionMask :this->dataPtr->kDepthExecutionMask; - for (unsigned int i = 1; i < colorPasses.size(); ++i) + for (size_t i = 1; i < colorPasses.size(); ++i) { colorPasses[i]->mExecutionMask = (this->dataPtr->newRgbPointCloud.ConnectionCount() > 0u) ? diff --git a/ogre2/src/Ogre2GpuRays.cc b/ogre2/src/Ogre2GpuRays.cc index 0d174bbea..7365a9a62 100644 --- a/ogre2/src/Ogre2GpuRays.cc +++ b/ogre2/src/Ogre2GpuRays.cc @@ -877,13 +877,13 @@ void Ogre2GpuRays::CreateSampleTexture() int index = 0; for (unsigned int i = 0; i < this->dataPtr->h2nd; ++i) { + const math::Quaterniond pitch(math::Vector3d(1, 0, 0), -v); double h = min; for (unsigned int j = 0; j < this->dataPtr->w2nd; ++j) { // set up dir vector to sample from a standard Y up cubemap math::Vector3d ray(0, 0, 1); - ray.Normalize(); - math::Quaterniond pitch(math::Vector3d(1, 0, 0), -v); + math::Quaterniond yaw(math::Vector3d(0, 1, 0), -h); math::Vector3d dir = yaw * pitch * ray; unsigned int faceIdx; diff --git a/ogre2/src/Ogre2LensFlarePass.cc b/ogre2/src/Ogre2LensFlarePass.cc index 8f913dc92..a997d362a 100644 --- a/ogre2/src/Ogre2LensFlarePass.cc +++ b/ogre2/src/Ogre2LensFlarePass.cc @@ -178,7 +178,7 @@ void Ogre2LensFlarePass::PostRender() Ogre2WideAngleCameraPtr wideAngleCamera = std::dynamic_pointer_cast( this->dataPtr->currentCamera); - // WideAngleCamera is supposed to rendered 6 times. Nothin more, nothing less. + // WideAngleCamera is supposed to rendered 6 times. // Normal cameras are supposed to be rendered 1 time. GZ_ASSERT((!wideAngleCamera && this->dataPtr->currentFaceIdx == 1u) || (wideAngleCamera && this->WideAngleCameraAfterStitching() && diff --git a/ogre2/src/Ogre2Marker.cc b/ogre2/src/Ogre2Marker.cc index 6c379205b..6aff17f8d 100644 --- a/ogre2/src/Ogre2Marker.cc +++ b/ogre2/src/Ogre2Marker.cc @@ -225,8 +225,6 @@ void Ogre2Marker::SetMaterial(MaterialPtr _material, bool _unique) return; } - std::string materialName = derived->Name(); - derived->SetReceiveShadows(false); derived->SetCastShadows(false); derived->SetLightingEnabled(false); diff --git a/ogre2/src/Ogre2Material.cc b/ogre2/src/Ogre2Material.cc index 945d07c52..b806107ae 100644 --- a/ogre2/src/Ogre2Material.cc +++ b/ogre2/src/Ogre2Material.cc @@ -803,7 +803,7 @@ void Ogre2Material::ClearLightMap() this->dataPtr->lightMapData = nullptr; this->lightMapUvSet = 0u; - // in ogre 2.2, we swtiched to use the emissive map slot for light map + // in ogre 2.2, we switched to use the emissive map slot for light map if (this->ogreDatablock->getUseEmissiveAsLightmap()) this->ogreDatablock->setTexture(Ogre::PBSM_EMISSIVE, this->lightMapName); this->ogreDatablock->setUseEmissiveAsLightmap(false); @@ -1127,7 +1127,6 @@ void Ogre2Material::SetTextureMapImpl(const std::string &_texture, // check for 8 bit pixel if (img.BPP() == 8u) { - std::string parentPath = common::parentPath(_texture); // set a custom name for the rgb texture by appending gz_ prefix std::string rgbTexName = "gz_" + baseName; baseName = rgbTexName; @@ -1329,7 +1328,7 @@ void Ogre2Material::Init() if (!this->ogreHlmsPbs) { - gzerr << "Ogre HLMS PBS not ready. Is Ogre2 Render Engine initiallized?" + gzerr << "Ogre HLMS PBS not ready. Is Ogre2 Render Engine initialized?" << std::endl; return; } @@ -1396,7 +1395,7 @@ Ogre::HlmsUnlitDatablock *Ogre2Material::UnlitDatablock() if (!ogreHlmsUnlit) { gzerr << "Ogre HLMS UNLIT not ready. Is Ogre2 Render Engine " - << "initiallized?" << std::endl; + << "initialized?" << std::endl; return nullptr; } @@ -1607,7 +1606,7 @@ ShaderParamsPtr Ogre2Material::FragmentShaderParams() void Ogre2MaterialPrivate::PrepareForNormalMapping(Ogre::TextureGpu *_texture, Ogre::Image2 &_image) { - // code adpated from PrepareForNormalMapping::_executeStreaming function in + // code adapted from PrepareForNormalMapping::_executeStreaming function in // OgreMain/src/OgreTextureFilters.cpp (v2-3) const Ogre::uint8 numMipmaps = _image.getNumMipmaps(); const Ogre::PixelFormatGpu dstFormat = Ogre::PFG_RG8_SNORM; @@ -1651,7 +1650,7 @@ void Ogre2MaterialPrivate::PrepareForNormalMapping(Ogre::TextureGpu *_texture, ////////////////////////////////////////////////// void Ogre2MaterialPrivate::AllocateMipmaps(Ogre::TextureGpu *_texture) { - // code adpated from GenerateHwMipmaps::_executeStreaming function in + // code adapted from GenerateHwMipmaps::_executeStreaming function in // OgreMain/src/OgreTextureFilters.cpp (v2-3) Ogre::uint8 maxMipmaps = Ogre::PixelFormatGpuUtils::getMaxMipmapCount( _texture->getWidth(), @@ -1663,7 +1662,7 @@ void Ogre2MaterialPrivate::AllocateMipmaps(Ogre::TextureGpu *_texture) ////////////////////////////////////////////////// void Ogre2MaterialPrivate::GenerateMipmaps(Ogre::TextureGpu *_texture) { - // code adpated from GenerateHwMipmaps::_executeSerial function in + // code adapted from GenerateHwMipmaps::_executeSerial function in // OgreMain/src/OgreTextureFilters.cpp (v2-3) Ogre::TextureGpuManager *textureManager = _texture->getTextureManager(); Ogre::TextureGpu *tempTexture = textureManager->createTexture( diff --git a/ogre2/src/Ogre2MeshFactory.cc b/ogre2/src/Ogre2MeshFactory.cc index d26810313..2296565a3 100644 --- a/ogre2/src/Ogre2MeshFactory.cc +++ b/ogre2/src/Ogre2MeshFactory.cc @@ -182,15 +182,13 @@ bool Ogre2MeshFactory::IsLoaded(const MeshDescriptor &_desc) bool Ogre2MeshFactory::LoadImpl(const MeshDescriptor &_desc) { Ogre::v1::MeshPtr ogreMesh; - std::string name; - std::string group; Ogre2RenderEngine::Instance()->AddResourcePath(_desc.mesh->Path()); try { - name = this->MeshName(_desc); - group = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME; + const auto &name = this->MeshName(_desc); + const auto &group = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME; ogreMesh = Ogre::v1::MeshManager::getSingleton().createManual(name, group); // load skeleton diff --git a/ogre2/src/Ogre2ParticleEmitter.cc b/ogre2/src/Ogre2ParticleEmitter.cc index 2e87d96d9..b5ec6d76b 100644 --- a/ogre2/src/Ogre2ParticleEmitter.cc +++ b/ogre2/src/Ogre2ParticleEmitter.cc @@ -487,6 +487,8 @@ void Ogre2ParticleEmitter::CreateParticleSystem() "The number of supported emitters does not match the number of " "Ogre emitter types."); + GZ_ASSERT(this->type < kOgreEmitterTypes.size(), "Unknown emitter type"); + // Instantiate particle emitter and their default parameters. // Emitter type is point unless otherwise specified. this->dataPtr->emitter = diff --git a/ogre2/src/Ogre2Projector.cc b/ogre2/src/Ogre2Projector.cc index 56b99d7ce..ca2fec956 100644 --- a/ogre2/src/Ogre2Projector.cc +++ b/ogre2/src/Ogre2Projector.cc @@ -87,7 +87,7 @@ class gz::rendering::Ogre2Projector::Implementation /// \brief Decal - Texture projected onto a surface public: Ogre::Decal *decal{nullptr}; - /// \brief Indicate whether the projector is intialized or not + /// \brief Indicate whether the projector is initialized or not public: bool initialized{false}; /// \brief A map of cameras () that the listener has been diff --git a/ogre2/src/Ogre2RayQuery.cc b/ogre2/src/Ogre2RayQuery.cc index 6f7b25c14..943dfa656 100644 --- a/ogre2/src/Ogre2RayQuery.cc +++ b/ogre2/src/Ogre2RayQuery.cc @@ -107,7 +107,7 @@ Ogre2RayQuery::~Ogre2RayQuery() void Ogre2RayQuery::SetFromCamera(const CameraPtr &_camera, const math::Vector2d &_coord) { - // convert to nomalized screen pos for ogre + // convert to normalized screen pos for ogre math::Vector2d screenPos((_coord.X() + 1.0) / 2.0, (_coord.Y() - 1.0) / -2.0); Ogre2CameraPtr camera = std::dynamic_pointer_cast(_camera); @@ -160,7 +160,7 @@ void Ogre2RayQuery::SetFromCamera(const WideAngleCameraPtr &_camera, uint32_t _faceIdx, const math::Vector2d &_coord) { - // convert to nomalized screen pos for ogre + // convert to normalized screen pos for ogre math::Vector2d screenPos((_coord.X() + 1.0) / 2.0, (_coord.Y() - 1.0) / -2.0); Ogre2WideAngleCameraPtr camera = @@ -322,7 +322,7 @@ class GZ_RENDERING_OGRE2_HIDDEN ThreadedTriRay final } // Documentation inherited - public: void execute(size_t threadId, size_t numThreads) override; + public: void execute(size_t _threadId, size_t _numThreads) override; /// \brief To be run after parallel execution is done. It will iterate /// through the results of every thread and return the closest match @@ -362,7 +362,7 @@ void ThreadedTriRay::execute(size_t _threadId, size_t _numThreads) std::string meshName = ogreItem->getMesh()->getName(); size_t idx = meshName.find("::"); if (idx != std::string::npos) - meshName = meshName.substr(0, idx); + meshName.resize(idx); const common::Mesh *mesh = common::MeshManager::Instance()->MeshByName(meshName); diff --git a/ogre2/src/Ogre2RenderEngine.cc b/ogre2/src/Ogre2RenderEngine.cc index 24fbb1cf8..6fdaedd58 100644 --- a/ogre2/src/Ogre2RenderEngine.cc +++ b/ogre2/src/Ogre2RenderEngine.cc @@ -959,7 +959,7 @@ void Ogre2RenderEngine::RegisterHlms() &this->dataPtr->sphericalClipMinDistance); Ogre::Root::getSingleton().getHlmsManager()->registerHlms(hlmsUnlit); - // disable writting debug output to disk + // disable writing debug output to disk hlmsUnlit->setDebugOutputPath(false, false); hlmsUnlit->setListener(hlmsUnlit); @@ -1004,7 +1004,7 @@ void Ogre2RenderEngine::RegisterHlms() this->dataPtr->hlmsPbsTerraShadows.get()); Ogre::Root::getSingleton().getHlmsManager()->registerHlms(hlmsPbs); - // disable writting debug output to disk + // disable writing debug output to disk hlmsPbs->setDebugOutputPath(false, false); hlmsPbs->setListener(hlmsPbs); @@ -1039,7 +1039,7 @@ void Ogre2RenderEngine::RegisterHlms() &this->dataPtr->sphericalClipMinDistance); Ogre::Root::getSingleton().getHlmsManager()->registerHlms(hlmsTerra); - // disable writting debug output to disk + // disable writing debug output to disk hlmsTerra->setDebugOutputPath(false, false); hlmsTerra->setListener(hlmsTerra); diff --git a/ogre2/src/Ogre2RenderPass.cc b/ogre2/src/Ogre2RenderPass.cc index c85f6afe9..ea244c175 100644 --- a/ogre2/src/Ogre2RenderPass.cc +++ b/ogre2/src/Ogre2RenderPass.cc @@ -43,19 +43,19 @@ void Ogre2RenderPass::Destroy() ////////////////////////////////////////////////// void Ogre2RenderPass::WorkspaceAdded(Ogre::CompositorWorkspace *) { - // To be overriden by derived render pass classes + // To be overridden by derived render pass classes } ////////////////////////////////////////////////// void Ogre2RenderPass::WorkspaceRemoved(Ogre::CompositorWorkspace *) { - // To be overriden by derived render pass classes + // To be overridden by derived render pass classes } ////////////////////////////////////////////////// void Ogre2RenderPass::CreateRenderPass() { - // To be overriden by derived render pass classes + // To be overridden by derived render pass classes } ////////////////////////////////////////////////// diff --git a/ogre2/src/Ogre2Scene.cc b/ogre2/src/Ogre2Scene.cc index 204303385..fe764d1b3 100644 --- a/ogre2/src/Ogre2Scene.cc +++ b/ogre2/src/Ogre2Scene.cc @@ -1453,7 +1453,7 @@ GlobalIlluminationCiVctPtr Ogre2Scene::CreateGlobalIlluminationCiVctImpl( bool Ogre2Scene::InitObject(Ogre2ObjectPtr _object, unsigned int _id, const std::string &_name) { - // assign needed varibles + // assign needed variables _object->id = _id; _object->name = _name; _object->scene = this->SharedThis(); diff --git a/ogre2/src/Ogre2SegmentationMaterialSwitcher.cc b/ogre2/src/Ogre2SegmentationMaterialSwitcher.cc index 1c397e51e..6c8cb9b36 100644 --- a/ogre2/src/Ogre2SegmentationMaterialSwitcher.cc +++ b/ogre2/src/Ogre2SegmentationMaterialSwitcher.cc @@ -202,7 +202,7 @@ math::Color Ogre2SegmentationMaterialSwitcher::LabelToColor(int64_t _label, if (_isMultiLink) return color; - // loop recursivly till finding a unique color + // loop recursively till finding a unique color if (this->IsTakenColor(color)) return this->LabelToColor(_label); diff --git a/ogre2/src/Ogre2WideAngleCamera.cc b/ogre2/src/Ogre2WideAngleCamera.cc index fe16f9b5b..efbea2b80 100644 --- a/ogre2/src/Ogre2WideAngleCamera.cc +++ b/ogre2/src/Ogre2WideAngleCamera.cc @@ -109,7 +109,7 @@ class gz::rendering::Ogre2WideAngleCamera::Implementation public: Ogre::TextureGpu *ogreTmpTextures[2]{}; /// \brief Output texture with the the toutput for stitches - /// [kStichTmpTexture] = Temp 2D texture for ping poing effects + /// [kStichTmpTexture] = Temp 2D texture for ping point effects /// [kStichFinalTexture] = Output texture with the final output public: Ogre::TextureGpu *ogreStitchTexture[kNumStichTextures] = { nullptr, nullptr }; @@ -168,6 +168,10 @@ class gz::rendering::Ogre2WideAngleCamera::Implementation explicit Implementation(gz::rendering::Ogre2WideAngleCamera &_owner) : workspaceListener(_owner) { + for (unsigned int i = 0; i < 6; ++i) + { + this->ogreCompositorWorkspace[i] = nullptr; + } } // clang-format on }; @@ -183,10 +187,6 @@ static constexpr uint32_t kWideAngleCameraQuadPassId = 1276661u; Ogre2WideAngleCamera::Ogre2WideAngleCamera() : dataPtr(utils::MakeUniqueImpl(*this)) { - for (unsigned int i = 0; i < 6; ++i) - { - this->dataPtr->ogreCompositorWorkspace[i] = nullptr; - } } ////////////////////////////////////////////////// diff --git a/src/CameraLens.cc b/src/CameraLens.cc index b388e3ad8..8d8d6a2a1 100644 --- a/src/CameraLens.cc +++ b/src/CameraLens.cc @@ -114,11 +114,16 @@ class gz::rendering::CameraLens::Implementation return std::get<2>(value)(_f); } + /// \brief Copy constructor + public: MapFunctionEnum(const MapFunctionEnum &) = delete; + /// \brief Assignment operator /// \param[in] _fun Rvalue /// \return Reference to (*this) public: MapFunctionEnum &operator=(const MapFunctionEnum &_fun) { + // from https://github.com/gazebosim/gz-rendering/pull/1227 + // "`variants` is tmp variable and shouldn't be copied" this->value = _fun.value; return *this; } diff --git a/src/OrbitViewController.cc b/src/OrbitViewController.cc index 3712bdacd..a604baeea 100644 --- a/src/OrbitViewController.cc +++ b/src/OrbitViewController.cc @@ -15,6 +15,7 @@ * */ +#include #include #include @@ -43,8 +44,8 @@ class gz::rendering::OrbitViewControllerPrivate using namespace gz; using namespace rendering; -static const float PITCH_LIMIT_LOW = -static_cast(GZ_PI)*0.5f + 0.001f; -static const float PITCH_LIMIT_HIGH = static_cast(GZ_PI)*0.5f - 0.001f; +static constexpr double PITCH_LIMIT_LOW = -GZ_PI*0.5 + 0.001; +static constexpr double PITCH_LIMIT_HIGH = GZ_PI*0.5 - 0.001; ////////////////////////////////////////////////// OrbitViewController::OrbitViewController() @@ -225,10 +226,5 @@ double OrbitViewControllerPrivate::NormalizeYaw(double _yaw) ////////////////////////////////////////////////// double OrbitViewControllerPrivate::NormalizePitch(double _pitch) { - if (_pitch < PITCH_LIMIT_LOW) - _pitch = PITCH_LIMIT_LOW; - else if (_pitch > PITCH_LIMIT_HIGH) - _pitch = PITCH_LIMIT_HIGH; - - return _pitch; + return std::clamp(_pitch, PITCH_LIMIT_LOW, PITCH_LIMIT_HIGH); } diff --git a/src/RenderEngineManager.cc b/src/RenderEngineManager.cc index 00b7909a3..168bd9752 100644 --- a/src/RenderEngineManager.cc +++ b/src/RenderEngineManager.cc @@ -188,12 +188,11 @@ std::vector RenderEngineManager::LoadedEngines() const { std::lock_guard lock(this->dataPtr->enginesMutex); std::vector engines; - for (const auto &[name, engine] : // NOLINT(whitespace/braces) - this->dataPtr->engines) + for (const auto &[name, engine] : this->dataPtr->engines) { - std::string n = name; if (nullptr != engine) { + std::string n = name; // gz-rendering3 changed loaded engine names to the actual lib name. // For backward compatibility, return engine name if it is one of the // default engines diff --git a/src/TransformController.cc b/src/TransformController.cc index 8cd43e4c0..f5ab8d93d 100644 --- a/src/TransformController.cc +++ b/src/TransformController.cc @@ -28,7 +28,7 @@ class gz::rendering::TransformControllerPrivate { /// \brief Gizmo visual that provides translation, rotation, and scale - /// tandles for transformation + /// handles for transformation public: GizmoVisualPtr gizmoVisual; /// \brief Node to be transformed @@ -50,7 +50,7 @@ class gz::rendering::TransformControllerPrivate /// \brief Current active axis of transformation public: gz::math::Vector3d axis; - /// \brief Flag to indicate that transfomation is in progress. + /// \brief Flag to indicate that transformation is in progress. public: bool active = false; /// \brief Initial pose of the node being transformed. diff --git a/src/Utils.cc b/src/Utils.cc index 4a0e85146..456c3109c 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -76,7 +76,7 @@ math::Vector3d screenToPlane( const math::Vector2i &_screenPos, const CameraPtr &_camera, const RayQueryPtr &_rayQuery, - const float offset) + const float _offset) { // Normalize point on the image double width = _camera->ImageWidth(); @@ -89,7 +89,7 @@ math::Vector3d screenToPlane( _rayQuery->SetFromCamera( _camera, math::Vector2d(nx, ny)); - gz::math::Planed plane(gz::math::Vector3d(0, 0, 1), offset); + gz::math::Planed plane(gz::math::Vector3d(0, 0, 1), _offset); math::Vector3d origin = _rayQuery->Origin(); math::Vector3d direction = _rayQuery->Direction(); @@ -128,42 +128,43 @@ gz::math::Matrix3d projectionToCameraIntrinsic( ///////////////////////////////////////////////// gz::math::AxisAlignedBox transformAxisAlignedBox( - const gz::math::AxisAlignedBox &_bbox, + const gz::math::AxisAlignedBox &_box, const gz::math::Pose3d &_pose) { - auto center = _bbox.Center(); + auto center = _box.Center(); // Get the 8 corners of the bounding box. std::vector vertices; - vertices.push_back(center + gz::math::Vector3d(-_bbox.XLength()/2.0, - _bbox.YLength()/2.0, - _bbox.ZLength()/2.0)); - vertices.push_back(center + gz::math::Vector3d(_bbox.XLength()/2.0, - _bbox.YLength()/2.0, - _bbox.ZLength()/2.0)); - vertices.push_back(center + gz::math::Vector3d(-_bbox.XLength()/2.0, - -_bbox.YLength()/2.0, - _bbox.ZLength()/2.0)); - vertices.push_back(center + gz::math::Vector3d(_bbox.XLength()/2.0, - -_bbox.YLength()/2.0, - _bbox.ZLength()/2.0)); - - vertices.push_back(center + gz::math::Vector3d(-_bbox.XLength()/2.0, - _bbox.YLength()/2.0, - -_bbox.ZLength()/2.0)); - vertices.push_back(center + gz::math::Vector3d(_bbox.XLength()/2.0, - _bbox.YLength()/2.0, - -_bbox.ZLength()/2.0)); - vertices.push_back(center + gz::math::Vector3d(-_bbox.XLength()/2.0, - -_bbox.YLength()/2.0, - -_bbox.ZLength()/2.0)); - vertices.push_back(center + gz::math::Vector3d(_bbox.XLength()/2.0, - -_bbox.YLength()/2.0, - -_bbox.ZLength()/2.0)); + vertices.reserve(8); + vertices.push_back(center + gz::math::Vector3d(-_box.XLength()/2.0, + _box.YLength()/2.0, + _box.ZLength()/2.0)); + vertices.push_back(center + gz::math::Vector3d(_box.XLength()/2.0, + _box.YLength()/2.0, + _box.ZLength()/2.0)); + vertices.push_back(center + gz::math::Vector3d(-_box.XLength()/2.0, + -_box.YLength()/2.0, + _box.ZLength()/2.0)); + vertices.push_back(center + gz::math::Vector3d(_box.XLength()/2.0, + -_box.YLength()/2.0, + _box.ZLength()/2.0)); + + vertices.push_back(center + gz::math::Vector3d(-_box.XLength()/2.0, + _box.YLength()/2.0, + -_box.ZLength()/2.0)); + vertices.push_back(center + gz::math::Vector3d(_box.XLength()/2.0, + _box.YLength()/2.0, + -_box.ZLength()/2.0)); + vertices.push_back(center + gz::math::Vector3d(-_box.XLength()/2.0, + -_box.YLength()/2.0, + -_box.ZLength()/2.0)); + vertices.push_back(center + gz::math::Vector3d(_box.XLength()/2.0, + -_box.YLength()/2.0, + -_box.ZLength()/2.0)); // Transform corners. - for (unsigned int i = 0; i < vertices.size(); ++i) + for (size_t i = 0; i < vertices.size(); ++i) { auto &v = vertices[i]; v = _pose.Rot() * v + _pose.Pos(); @@ -173,7 +174,7 @@ gz::math::AxisAlignedBox transformAxisAlignedBox( gz::math::Vector3d max = vertices[0]; // find min / max of vertices - for (unsigned int i = 1; i < vertices.size(); ++i) + for (size_t i = 1; i < vertices.size(); ++i) { auto &v = vertices[i];