From 7741aa78794939ea0b2e77765969f87efdcd6d47 Mon Sep 17 00:00:00 2001 From: William Lew Date: Thu, 24 Mar 2022 14:51:21 -0700 Subject: [PATCH] Use Anti-aliasing SDF element when setting up camera Signed-off-by: William Lew --- gazebo/rendering/Camera.cc | 6 +++++- gazebo/rendering/CameraPrivate.hh | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gazebo/rendering/Camera.cc b/gazebo/rendering/Camera.cc index 502f122a13..a97e425234 100644 --- a/gazebo/rendering/Camera.cc +++ b/gazebo/rendering/Camera.cc @@ -118,6 +118,8 @@ Camera::Camera(const std::string &_name, ScenePtr _scene, this->dataPtr->node = transport::NodePtr(new transport::Node()); this->dataPtr->node->Init(); + + this->dataPtr->antiAliasingValue = 4; } ////////////////////////////////////////////////// @@ -143,6 +145,8 @@ void Camera::Load() this->imageHeight = imgElem->Get("height"); this->imageFormat = this->OgrePixelFormat( imgElem->Get("format")); + + this->dataPtr->antiAliasingValue = imgElem->Get("anti_aliasing"); } else gzthrow("Camera has no tag."); @@ -1480,7 +1484,7 @@ void Camera::CreateRenderTexture(const std::string &_textureName) RenderEngine::Instance()->FSAALevels(); // check if target fsaa is supported - unsigned int targetFSAA = 4; + unsigned int targetFSAA = this->dataPtr->antiAliasingValue; auto const it = std::find(fsaaLevels.begin(), fsaaLevels.end(), targetFSAA); if (it != fsaaLevels.end()) fsaa = targetFSAA; diff --git a/gazebo/rendering/CameraPrivate.hh b/gazebo/rendering/CameraPrivate.hh index 686333c742..ac8b24e20f 100644 --- a/gazebo/rendering/CameraPrivate.hh +++ b/gazebo/rendering/CameraPrivate.hh @@ -117,6 +117,9 @@ namespace gazebo /// \brief Fixed axis to yaw around. public: ignition::math::Vector3d yawFixedAxis; + + /// \brief Anti-aliasing value + public: uint32_t antiAliasingValue; }; } }