/* * Copyright (C) 2012 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef SELECTIONBUFFER_HH_ #define SELECTIONBUFFER_HH_ #include #include #include namespace Ogre { class Entity; class RenderTarget; class SceneManager; } // Ogre namespace gazebo { namespace rendering { struct SelectionBufferPrivate; class GZ_RENDERING_VISIBLE SelectionBuffer { /// \brief Constructor /// \param[in] _camera Name of the camera to generate a selection /// buffer for. /// \param[in] _mgr Pointer to the scene manager. /// \param[in] _renderTarget Pointer to the render target. public: SelectionBuffer(const std::string &_cameraName, Ogre::SceneManager *_mgr, Ogre::RenderTarget *_renderTarget); /// \brief Destructor public: ~SelectionBuffer(); /// \brief Handle on mouse click /// \param[in] _x X coordinate in pixels. /// \param[in] _y Y coordinate in pixels. /// \return Returns the Ogre entity at the coordinate. public: Ogre::Entity *OnSelectionClick(int _x, int _y); /// \brief Debug show overlay /// \param[in] _show True to show the selection buffer in an overlay. public: void ShowOverlay(bool _show); /// \brief Call this to update the selection buffer contents public: void Update(); /// \brief Delete the render texture private: void DeleteRTTBuffer(); /// \brief Create the render texture private: void CreateRTTBuffer(); /// \brief Create the selection buffer offscreen render texture. private: void CreateRTTOverlays(); /// \internal /// \brief Pointer to private data. private: std::unique_ptr dataPtr; }; } // namespace rendering } // namespace gazebo #endif // SELECTIONBUFFER_HH_