34 #include <OgreCamera.h> 35 #include <OgreEntity.h> 36 #include <OgreHardwarePixelBuffer.h> 37 #include <OgreManualObject.h> 38 #include <OgreMaterialManager.h> 39 #include <OgreRenderSystem.h> 40 #include <OgreRenderTexture.h> 42 #include <OgreSceneManager.h> 43 #include <OgreSceneNode.h> 44 #include <OgreSubEntity.h> 45 #include <OgreTextureManager.h> 46 #include <OgreViewport.h> 47 #include <OgreWireBoundingBox.h> 48 #include <OgreSharedPtr.h> 49 #include <OgreTechnique.h> 50 #include <OgreRectangle2D.h> 53 #include <sensor_msgs/Image.h> 78 : vis_manager_(manager)
79 , highlight_enabled_(false)
81 , interaction_enabled_(false)
91 QTimer* timer =
new QTimer(
this);
128 highlight_node_ = scene_manager->getRootSceneNode()->createChildSceneNode();
130 std::stringstream ss;
131 static int count = 0;
132 ss <<
"SelectionRect" << count++;
135 const static uint32_t texture_data[1] = {0xffff0080};
136 Ogre::DataStreamPtr pixel_stream;
137 pixel_stream.bind(
new Ogre::MemoryDataStream((
void*)&texture_data[0], 4));
139 Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().loadRawData(
140 ss.str() +
"Texture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, pixel_stream, 1, 1,
141 Ogre::PF_R8G8B8A8, Ogre::TEX_TYPE_2D, 0);
143 Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(
144 ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
145 material->setLightingEnabled(
false);
148 Ogre::AxisAlignedBox aabInf;
149 aabInf.setInfinite();
152 material->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
153 material->setCullingMode(Ogre::CULL_NONE);
155 Ogre::TextureUnitState* tex_unit = material->getTechnique(0)->getPass(0)->createTextureUnitState();
156 tex_unit->setTextureName(tex->getName());
157 tex_unit->setTextureFiltering(Ogre::TFO_NONE);
162 camera_ = scene_manager->createCamera(ss.str() +
"_camera");
180 ROS_DEBUG(
"SelectionManager.get3DPoint()");
182 std::vector<Ogre::Vector3> result_points_temp;
183 bool success =
get3DPatch(viewport, x, y, 1, 1,
true, result_points_temp);
184 if (result_points_temp.empty())
189 result_point = result_points_temp[0];
200 std::vector<float>& depth_vector)
202 unsigned int num_pixels = width * height;
203 depth_vector.reserve(num_pixels);
208 M_CollisionObjectToSelectionHandler::iterator handler_it =
objects_.begin();
209 M_CollisionObjectToSelectionHandler::iterator handler_end =
objects_.end();
211 for (; handler_it != handler_end; ++handler_it)
213 handler_it->second->preRenderPass(0);
221 for (uint32_t pixel = 0; pixel < num_pixels; ++pixel)
223 uint8_t a = data_ptr[4 * pixel];
224 uint8_t b = data_ptr[4 * pixel + 1];
225 uint8_t c = data_ptr[4 * pixel + 2];
227 int int_depth = (c << 16) | (b << 8) | a;
228 float normalized_depth = ((float)int_depth) / (float)0xffffff;
229 depth_vector.push_back(normalized_depth *
camera_->getFarClipDistance());
234 ROS_WARN(
"Failed to render depth patch\n");
240 for (; handler_it != handler_end; ++handler_it)
242 handler_it->second->postRenderPass(0);
255 std::vector<Ogre::Vector3>& result_points)
258 ROS_DEBUG(
"SelectionManager.get3DPatch()");
260 std::vector<float> depth_vector;
267 unsigned int pixel_counter = 0;
268 Ogre::Matrix4 projection =
camera_->getProjectionMatrix();
271 for (
unsigned y_iter = 0; y_iter < height; ++y_iter)
272 for (
unsigned x_iter = 0; x_iter < width; ++x_iter)
274 depth = depth_vector[pixel_counter];
277 if ((depth >
camera_->getFarClipDistance()) || (depth == 0))
282 result_points.push_back(Ogre::Vector3(NAN, NAN, NAN));
288 Ogre::Vector3 result_point;
292 Ogre::Real screenx = float(x_iter + .5) / float(width);
293 Ogre::Real screeny = float(y_iter + .5) / float(height);
294 if (projection[3][3] == 0.0)
297 Ogre::Ray vp_ray =
camera_->getCameraToViewportRay(screenx, screeny);
300 Ogre::Vector3 dir_cam =
camera_->getDerivedOrientation().Inverse() * vp_ray.getDirection();
303 dir_cam = dir_cam / dir_cam.z * depth * -1;
306 result_point =
camera_->getDerivedPosition() +
camera_->getDerivedOrientation() * dir_cam;
313 camera_->getCameraToViewportRay(screenx, screeny, &ray);
315 result_point = ray.getPoint(depth);
318 result_points.push_back(result_point);
322 return !result_points.empty();
333 ROS_ERROR_STREAM(
"SelectionManager::setDepthTextureSize invalid width requested. Max Width: 1024 -- " 335 << width <<
". Capping Width at 1024.");
344 ROS_ERROR_STREAM(
"SelectionManager::setDepthTextureSize invalid height requested. Max Height: 1024 " 345 "-- Height requested: " 346 << width <<
". Capping Height at 1024.");
355 std::string tex_name =
"DepthTexture";
361 Ogre::TextureManager::getSingleton().remove(tex_name);
365 tex_name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
369 render_texture->setAutoUpdated(
false);
388 std::string tex_name;
394 Ogre::TextureManager::getSingleton().remove(tex_name);
398 std::stringstream ss;
399 static int count = 0;
400 ss <<
"SelectionTexture" << count++;
406 tex_name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, size,
407 size, 0, Ogre::PF_R8G8B8, Ogre::TU_STATIC | Ogre::TU_RENDERTARGET);
409 Ogre::RenderTexture* render_texture =
render_textures_[pass]->getBuffer()->getRenderTarget();
410 render_texture->setAutoUpdated(
false);
425 M_CollisionObjectToSelectionHandler::iterator handler_it =
objects_.begin();
426 M_CollisionObjectToSelectionHandler::iterator handler_end =
objects_.end();
427 for (; handler_it != handler_end; ++handler_it)
431 object->enableInteraction(enable);
448 for (
unsigned int i = 0; i < 24; i++)
450 uint32_t shift = (((23 - i) % 3) * 8) + (23 - i) / 3;
451 uint32_t bit = ((uint32_t)(
uid_counter_ >> i) & (uint32_t)1) << shift;
474 bool inserted =
objects_.insert(std::make_pair(obj, handler)).second;
492 objs.insert(std::make_pair(it->first, it->second));
547 pick(viewport, x1, y1, x2, y2, results);
565 float nx1 = ((float)x1 / viewport->getActualWidth()) * 2 - 1;
566 float nx2 = ((float)x2 / viewport->getActualWidth()) * 2 - 1;
567 float ny1 = -(((float)y1 / viewport->getActualHeight()) * 2 - 1);
568 float ny2 = -(((float)y2 / viewport->getActualHeight()) * 2 - 1);
570 nx1 = nx1 < -1 ? -1 : (nx1 > 1 ? 1 : nx1);
571 ny1 = ny1 < -1 ? -1 : (ny1 > 1 ? 1 : ny1);
572 nx2 = nx2 < -1 ? -1 : (nx2 > 1 ? 1 : nx2);
573 ny2 = ny2 < -1 ? -1 : (ny2 > 1 ? 1 : ny2);
580 int w = box.getWidth();
581 int h = box.getHeight();
584 pixels.reserve(w * h);
585 size_t size = Ogre::PixelUtil::getMemorySize(1, 1, 1, box.format);
587 for (
int y = 0; y < h; y++)
589 for (
int x = 0; x < w; x++)
591 uint32_t pos = (x + y * w) * size;
592 uint32_t pix_val = 0;
593 memcpy((uint8_t*)&pix_val, (uint8_t*)box.data + pos, size);
609 std::stringstream scheme;
625 Ogre::TexturePtr tex,
630 Ogre::PixelBox& dst_box,
631 std::string material_scheme,
632 unsigned texture_width,
633 unsigned texture_height)
646 if (x1 > viewport->getActualWidth() - 2)
647 x1 = viewport->getActualWidth() - 2;
648 if (y1 > viewport->getActualHeight() - 2)
649 y1 = viewport->getActualHeight() - 2;
654 if (x2 > viewport->getActualWidth() - 2)
655 x2 = viewport->getActualWidth() - 2;
656 if (y2 > viewport->getActualHeight() - 2)
657 y2 = viewport->getActualHeight() - 2;
664 if (x2 == x1 || y2 == y1)
666 ROS_WARN(
"SelectionManager::render(): not rendering 0 size area.");
671 unsigned w = x2 - x1;
672 unsigned h = y2 - y1;
674 Ogre::HardwarePixelBufferSharedPtr pixel_buffer = tex->getBuffer();
675 Ogre::RenderTexture* render_texture = pixel_buffer->getRenderTarget();
677 Ogre::Matrix4 proj_matrix = viewport->getCamera()->getProjectionMatrix();
678 Ogre::Matrix4 scale_matrix = Ogre::Matrix4::IDENTITY;
679 Ogre::Matrix4 trans_matrix = Ogre::Matrix4::IDENTITY;
681 float x1_rel =
static_cast<float>(x1) / static_cast<float>(viewport->getActualWidth() - 1) - 0.5
f;
682 float y1_rel =
static_cast<float>(y1) / static_cast<float>(viewport->getActualHeight() - 1) - 0.5
f;
683 float x2_rel =
static_cast<float>(x2) / static_cast<float>(viewport->getActualWidth() - 1) - 0.5
f;
684 float y2_rel =
static_cast<float>(y2) / static_cast<float>(viewport->getActualHeight() - 1) - 0.5
f;
686 scale_matrix[0][0] = 1.0 / (x2_rel - x1_rel);
687 scale_matrix[1][1] = 1.0 / (y2_rel - y1_rel);
689 trans_matrix[0][3] -= x1_rel + x2_rel;
690 trans_matrix[1][3] += y1_rel + y2_rel;
692 camera_->setCustomProjectionMatrix(
true, scale_matrix * trans_matrix * proj_matrix);
694 camera_->setPosition(viewport->getCamera()->getDerivedPosition());
695 camera_->setOrientation(viewport->getCamera()->getDerivedOrientation());
698 if (render_texture->getNumViewports() == 0)
700 render_texture->removeAllViewports();
701 render_texture->addViewport(
camera_);
702 Ogre::Viewport* render_viewport = render_texture->getViewport(0);
703 render_viewport->setClearEveryFrame(
true);
704 render_viewport->setBackgroundColour(Ogre::ColourValue::Black);
705 render_viewport->setOverlaysEnabled(
false);
706 render_viewport->setMaterialScheme(material_scheme);
709 unsigned render_w = w;
710 unsigned render_h = h;
714 if (render_w > texture_width)
716 render_w = texture_width;
717 render_h = round(
float(h) * (
float)texture_width / (
float)w);
722 if (render_h > texture_height)
724 render_h = texture_height;
725 render_w = round(
float(w) * (
float)texture_height / (
float)h);
730 if (render_w > texture_width)
731 render_w = texture_width;
732 if (render_h > texture_height)
733 render_h = texture_height;
736 Ogre::Viewport* render_viewport = render_texture->getViewport(0);
737 render_viewport->setDimensions(0, 0, (
float)render_w / (
float)texture_width,
738 (
float)render_h / (
float)texture_height);
741 render_viewport->setVisibilityMask(viewport->getVisibilityMask());
746 Ogre::MaterialManager::getSingleton().addListener(
this);
748 render_texture->update();
767 Ogre::MaterialManager::getSingleton().removeListener(
this);
769 render_w = render_viewport->getActualWidth();
770 render_h = render_viewport->getActualHeight();
772 Ogre::PixelFormat format = pixel_buffer->getFormat();
774 int size = Ogre::PixelUtil::getMemorySize(render_w, render_h, 1, format);
775 uint8_t* data =
new uint8_t[size];
777 delete[](uint8_t*) dst_box.data;
778 dst_box = Ogre::PixelBox(render_w, render_h, 1, format, data);
780 pixel_buffer->blitToMemory(dst_box, dst_box);
799 pub = nh.
advertise<sensor_msgs::Image>(
"/rviz_debug/" + label, 2);
807 sensor_msgs::Image msg;
809 msg.width = pixel_box.getWidth();
810 msg.height = pixel_box.getHeight();
812 msg.is_bigendian =
false;
813 msg.step = msg.width * 3;
814 int dest_byte_count = msg.width * msg.height * 3;
815 msg.data.resize(dest_byte_count);
817 uint8_t* source_ptr = (uint8_t*)pixel_box.data;
818 int pre_pixel_padding = 0;
819 int post_pixel_padding = 0;
820 switch (pixel_box.format)
822 case Ogre::PF_R8G8B8:
824 case Ogre::PF_A8R8G8B8:
825 case Ogre::PF_X8R8G8B8:
826 post_pixel_padding = 1;
828 case Ogre::PF_R8G8B8A8:
829 pre_pixel_padding = 1;
832 ROS_ERROR(
"SelectionManager::publishDebugImage(): Incompatible pixel format [%d]", pixel_box.format);
836 while (dest_index < dest_byte_count)
838 source_ptr += pre_pixel_padding;
842 source_ptr += post_pixel_padding;
843 msg.data[dest_index++] = r;
844 msg.data[dest_index++] = g;
845 msg.data[dest_index++] = b;
853 bool& skipThisInvocation)
860 skipThisInvocation =
true;
869 bool single_render_pass)
873 bool need_additional_render =
false;
885 M_CollisionObjectToSelectionHandler::iterator handler_it =
objects_.begin();
886 M_CollisionObjectToSelectionHandler::iterator handler_end =
objects_.end();
887 for (; handler_it != handler_end; ++handler_it)
889 handler_it->second->preRenderPass(0);
896 for (; handler_it != handler_end; ++handler_it)
898 handler_it->second->postRenderPass(0);
901 handles_by_pixel.reserve(pixels.size());
902 V_CollObject::iterator it = pixels.begin();
903 V_CollObject::iterator end = pixels.end();
904 for (; it != end; ++it)
910 handles_by_pixel.push_back(handle);
921 std::pair<M_Picked::iterator, bool> insert_result =
922 results.insert(std::make_pair(handle,
Picked(handle)));
923 if (insert_result.second)
927 need_additional.insert(handle);
928 need_additional_render =
true;
933 insert_result.first->second.pixel_count++;
942 extra_by_pixel.resize(handles_by_pixel.size());
946 S_CollObject::iterator need_it = need_additional.begin();
947 S_CollObject::iterator need_end = need_additional.end();
948 for (; need_it != need_end; ++need_it)
960 S_CollObject::iterator need_it = need_additional.begin();
961 S_CollObject::iterator need_end = need_additional.end();
962 for (; need_it != need_end; ++need_it)
972 V_CollObject::iterator pix_it = pixels.begin();
973 V_CollObject::iterator pix_end = pixels.end();
974 for (; pix_it != pix_end; ++pix_it, ++i)
982 extra_by_pixel[i] = 0;
985 if (need_additional.find(handle) != need_additional.end())
988 extra_by_pixel[i] |= extra_handle << (32 * (pass - 1));
992 extra_by_pixel[i] = 0;
996 need_additional_render =
false;
997 need_additional.clear();
998 M_Picked::iterator handle_it = results.begin();
999 M_Picked::iterator handle_end = results.end();
1000 for (; handle_it != handle_end; ++handle_it)
1004 if (
getHandler(handle)->needsAdditionalRenderPass(pass + 1))
1006 need_additional_render =
true;
1007 need_additional.insert(handle);
1013 V_uint64::iterator pix_2_it = extra_by_pixel.begin();
1014 V_uint64::iterator pix_2_end = extra_by_pixel.end();
1015 for (; pix_2_it != pix_2_end; ++pix_2_it, ++i)
1024 M_Picked::iterator picked_it = results.find(handle);
1025 if (picked_it == results.end())
1030 Picked& picked = picked_it->second;
1040 const Ogre::String& scheme_name,
1041 Ogre::Material* original_material,
1043 const Ogre::Renderable* rend)
1046 Ogre::CullingMode culling_mode = Ogre::CULL_CLOCKWISE;
1047 Ogre::Technique* orig_tech = original_material->getTechnique(0);
1048 if (orig_tech && orig_tech->getNumPasses() > 0)
1050 culling_mode = orig_tech->getPass(0)->getCullingMode();
1054 bool has_pick_param = !rend->getUserObjectBindings().getUserAny(
"pick_handle").isEmpty();
1064 if (culling_mode == Ogre::CULL_CLOCKWISE)
1066 if (scheme_name ==
"Pick")
1070 else if (scheme_name ==
"Depth")
1074 if (scheme_name ==
"Pick1")
1085 if (scheme_name ==
"Pick")
1089 else if (scheme_name ==
"Depth")
1093 if (scheme_name ==
"Pick1")
1106 float r = ((handle >> 16) & 0xff) / 255.0f;
1107 float g = ((handle >> 8) & 0xff) / 255.0f;
1108 float b = (handle & 0xff) / 255.0
f;
1109 return Ogre::ColourValue(r, g, b, 1.0
f);
1113 const Ogre::ColourValue& color,
1114 Ogre::SceneNode* node)
1121 Ogre::SceneNode::ObjectIterator obj_it = node->getAttachedObjectIterator();
1122 while (obj_it.hasMoreElements())
1124 Ogre::MovableObject* obj = obj_it.getNext();
1128 Ogre::SceneNode::ChildNodeIterator child_it = node->getChildIterator();
1129 while (child_it.hasMoreElements())
1131 Ogre::SceneNode* child =
dynamic_cast<Ogre::SceneNode*
>(child_it.getNext());
1140 : color_vector_(color.
r, color.g, color.b, 1.0), handle_(handle)
1147 Ogre::Any* =
nullptr)
override 1150 rend->getUserObjectBindings().setUserAny(
"pick_handle", Ogre::Any(handle_));
1158 const Ogre::ColourValue& color,
1159 Ogre::MovableObject*
object)
1162 object->visitRenderables(&visitor);
1163 object->getUserObjectBindings().setUserAny(
"pick_handle", Ogre::Any(handle));
1170 M_CollisionObjectToSelectionHandler::iterator it =
objects_.find(obj);
1183 M_Picked::const_iterator it = objs.begin();
1184 M_Picked::const_iterator end = objs.end();
1185 for (; it != end; ++it)
1198 M_Picked::const_iterator it = objs.begin();
1199 M_Picked::const_iterator end = objs.end();
1200 for (; it != end; ++it)
1205 added.insert(std::make_pair(it->first, ppb.first));
1226 std::pair<M_Picked::iterator, bool> pib =
selection_.insert(std::make_pair(obj.
handle, obj));
1233 return std::make_pair(obj,
true);
1237 Picked& cur = pib.first->second;
1242 for (; it != end; ++it)
1254 return std::make_pair(added,
true);
1258 return std::make_pair(
Picked(0),
false);
1270 for (; extra_it != extra_end; ++extra_it)
1272 sel_it->second.extra_handles.erase(*extra_it);
1275 if (sel_it->second.extra_handles.empty())
1294 Ogre::AxisAlignedBox combined;
1298 for (; it != end; ++it)
1300 const Picked& p = it->second;
1307 V_AABB::iterator aabb_it = aabbs.begin();
1308 V_AABB::iterator aabb_end = aabbs.end();
1309 for (; aabb_it != aabb_end; ++aabb_it)
1311 combined.merge(*aabb_it);
1315 if (!combined.isInfinite() && !combined.isNull())
1317 Ogre::Vector3 center = combined.getCenter();
1321 controller->
lookAt(center);
1328 M_Picked::const_iterator it = removed.begin();
1329 M_Picked::const_iterator end = removed.end();
1330 for (; it != end; ++it)
1332 const Picked& picked = it->second;
1342 M_Picked::const_iterator it = added.begin();
1343 M_Picked::const_iterator end = added.end();
1344 for (; it != end; ++it)
1346 const Picked& picked = it->second;
1357 M_Picked::const_iterator it =
selection_.begin();
1358 M_Picked::const_iterator end =
selection_.end();
1359 for (; it != end; ++it)
std::vector< uint64_t > V_uint64
ViewController * getCurrent() const
Return the current ViewController in use for the main RenderWindow.
void publishDebugImage(const Ogre::PixelBox &pixel_box, const std::string &label)
CollObjectHandle createHandle()
void removeSelectedObject(const Picked &obj)
void selectionAdded(const M_Picked &added)
virtual void updateProperties()
Override to update property values.
boost::unordered_map< CollObjectHandle, Picked > M_Picked
SelectionManager(VisualizationManager *manager)
Ogre::TexturePtr render_textures_[s_num_render_textures_]
void setSelection(const M_Picked &objs)
A single element of a property tree, with a name, value, description, and possibly children...
void lookAt(float x, float y, float z)
Convenience function which calls lookAt(Ogre::Vector3).
void removeObject(CollObjectHandle obj)
virtual InteractiveObjectWPtr getInteractiveObject()
Get the object to listen to mouse events and other interaction calls during use of the 'interact' too...
virtual void preRenderPass(uint32_t pass)
void unlockRender()
Unlock a mutex, allowing calls to Ogre::Root::renderOneFrame().
void addObject(CollObjectHandle obj, SelectionHandler *handler)
virtual bool needsAdditionalRenderPass(uint32_t)
static Ogre::ColourValue handleToColor(CollObjectHandle handle)
~SelectionManager() override
void lockRender()
Lock a mutex to delay calls to Ogre::Root::renderOneFrame().
Ogre::SceneManager * getSceneManager() const override
Returns the Ogre::SceneManager used for the main RenderPanel.
Ogre::Technique * fallback_black_cull_technique_
void setDebugMode(bool debug)
Enables or disables publishing of picking and depth rendering images.
Ogre::PixelBox pixel_boxes_[s_num_render_textures_]
void setDepthTextureSize(unsigned width, unsigned height)
void highlight(Ogre::Viewport *viewport, int x1, int y1, int x2, int y2)
Ogre::Technique * fallback_pick_cull_technique_
uint32_t depth_texture_width_
void enableInteraction(bool enable)
void setHighlightRect(Ogre::Viewport *viewport, int x1, int y1, int x2, int y2)
void publish(const boost::shared_ptr< M > &message) const
std::vector< Ogre::AxisAlignedBox > V_AABB
PropertyTreeModel * property_model_
bool get3DPatch(Ogre::Viewport *viewport, const int x, const int y, const unsigned width, const unsigned height, const bool skip_missing, std::vector< Ogre::Vector3 > &result_points)
Gets the 3D points in a box around a point in a view port.
void updateProperties()
Call updateProperties() on all SelectionHandlers in the current selection.
Ogre::Vector4 color_vector_
Ogre::Technique * fallback_pick_technique_
RenderPanel * getRenderPanel() const
Return the main RenderPanel.
Property * getRoot() const
V_CollObject pixel_buffer_
virtual void getAABBs(const Picked &obj, V_AABB &aabbs)
void visit(Ogre::Renderable *rend, ushort, bool, Ogre::Any *=nullptr) override
static const uint32_t s_num_render_textures_
Ogre::Viewport * getViewport() const
Ogre::Technique * fallback_depth_cull_technique_
void select(Ogre::Viewport *viewport, int x1, int y1, int x2, int y2, SelectType type)
void removeSelection(const M_Picked &objs)
The VisualizationManager class is the central manager class of rviz, holding all the Displays...
SelectionHandler * getHandler(CollObjectHandle obj)
std::vector< CollObjectHandle > V_CollObject
PublisherMap debug_publishers_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
Ogre::TexturePtr depth_render_texture_
bool render(Ogre::Viewport *viewport, Ogre::TexturePtr tex, int x1, int y1, int x2, int y2, Ogre::PixelBox &dst_box, std::string material_scheme, unsigned texture_width, unsigned textured_height)
std::pair< Picked, bool > addSelectedObject(const Picked &obj)
virtual void createProperties(const Picked &, Property *)
Override to create properties of the given picked object(s).
#define PICK_COLOR_PARAMETER
void pick(Ogre::Viewport *viewport, int x1, int y1, int x2, int y2, M_Picked &results, bool single_render_pass=false)
Ogre::Technique * fallback_depth_technique_
virtual void onSelect(const Picked &obj)
Ogre::Technique * handleSchemeNotFound(unsigned short scheme_index, const Ogre::String &scheme_name, Ogre::Material *original_material, unsigned short lod_index, const Ogre::Renderable *rend) override
uint32_t colorToHandle(Ogre::PixelFormat fmt, uint32_t col)
Ogre::SceneNode * highlight_node_
Ogre::Viewport * viewport
virtual void destroyProperties(const Picked &obj, Property *parent_property)
Destroy all properties for the given picked object(s).
void unpackColors(Ogre::PixelBox &box, V_CollObject &pixels)
static void setPickData(CollObjectHandle handle, const Ogre::ColourValue &color, Ogre::SceneNode *node)
virtual void postRenderPass(uint32_t pass)
void addSelection(const M_Picked &objs)
void setTextureSize(unsigned size)
VisualizationManager * vis_manager_
virtual void onDeselect(const Picked &obj)
Ogre::Rectangle2D * highlight_rectangle_
void selectionRemoved(const M_Picked &removed)
void renderAndUnpack(Ogre::Viewport *viewport, uint32_t pass, int x1, int y1, int x2, int y2, V_CollObject &pixels)
void renderQueueStarted(uint8_t queueGroupId, const std::string &invocation, bool &skipThisInvocation) override
#define ROS_ERROR_STREAM(args)
Ogre::MaterialPtr fallback_pick_material_
PickColorSetter(CollObjectHandle handle, const Ogre::ColourValue &color)
bool get3DPoint(Ogre::Viewport *viewport, const int x, const int y, Ogre::Vector3 &result_point)
Ogre::Technique * fallback_black_technique_
ViewManager * getViewManager() const override
Return a pointer to the ViewManager.
Ogre::PixelBox depth_pixel_box_
boost::recursive_mutex global_mutex_
bool interaction_enabled_
uint32_t depth_texture_height_
std::set< CollObjectHandle > S_CollObject
M_CollisionObjectToSelectionHandler objects_
bool getPatchDepthImage(Ogre::Viewport *viewport, const int x, const int y, const unsigned width, const unsigned height, std::vector< float > &depth_vector)
Renders a depth image in a box around a point in a view port.
uint32_t CollObjectHandle