Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support <anti_aliasing> element when setting up camera render texture #3201

Merged
merged 2 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/gazebo-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ list(APPEND @PKG_NAME@_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${PROTOBUF_LIBRARIES})

# Find SDFormat
find_package(sdformat9 REQUIRED)
find_package(sdformat9 REQUIRED VERSION 9.8)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${SDFormat_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${SDFormat_LIBRARIES})

Expand Down
6 changes: 5 additions & 1 deletion gazebo/rendering/Camera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

//////////////////////////////////////////////////
Expand All @@ -143,6 +145,8 @@ void Camera::Load()
this->imageHeight = imgElem->Get<int>("height");
this->imageFormat = this->OgrePixelFormat(
imgElem->Get<std::string>("format"));

this->dataPtr->antiAliasingValue = imgElem->Get<int>("anti_aliasing");
}
else
gzthrow("Camera has no <image> tag.");
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions gazebo/rendering/CameraPrivate.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
}
}
Expand Down