42 Ogre::SceneNode& parent_scene_node,
45 : scene_manager_(scene_manager), manual_object_(
NULL), bounds_(bounds)
48 static int material_count = 0;
49 std::stringstream material_name;
50 material_name <<
"NavGridMaterial" << material_count++;
51 material_ = Ogre::MaterialManager::getSingleton().getByName(
"rviz/Indexed8BitImage");
55 material_->getTechnique(0)->setLightingEnabled(
false);
57 material_->setCullingMode(Ogre::CULL_NONE);
60 static int map_count = 0;
61 std::stringstream object_name;
62 object_name <<
"NavGridObject" << map_count++;
65 static int node_count = 0;
66 std::stringstream node_name;
67 node_name <<
"NGNodeObject" << node_count++;
69 scene_node_ = parent_scene_node.createChildSceneNode(node_name.str());
120 std::vector<unsigned char> pixels;
136 Ogre::DataStreamPtr pixel_stream;
137 pixel_stream.bind(
new Ogre::MemoryDataStream(&pixels[0], pixels.size()));
141 Ogre::TextureManager::getSingleton().remove(
texture_->getName());
145 static int tex_count = 0;
146 std::stringstream texture_name;
147 texture_name <<
"MapTexture" << tex_count++;
148 texture_ = Ogre::TextureManager::getSingleton().loadRawData(texture_name.str(),
149 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
164 Ogre::TextureManager::getSingleton().remove(
texture_->getName());
171 Ogre::Pass* pass =
material_->getTechnique(0)->getPass(0);
172 Ogre::TextureUnitState* tex_unit =
NULL;
173 if (pass->getNumTextureUnitStates() > index)
175 tex_unit = pass->getTextureUnitState(index);
179 tex_unit = pass->createTextureUnitState();
181 tex_unit->setTextureName(texture_name);
182 tex_unit->setTextureFiltering(Ogre::TFO_NONE);
186 Ogre::Renderable::Visitor* alpha_setter)
188 material_->setSceneBlending(scene_blending);
189 material_->setDepthWriteEnabled(depth_write);
Ogre::SceneManager & scene_manager_
Ogre::ManualObject * manual_object_
unsigned int getMinX() const
unsigned int getMinY() const
Ogre::SceneNode * scene_node_
void updateAlphaRendering(Ogre::SceneBlendType scene_blending, bool depth_write, int group, Ogre::Renderable::Visitor *alpha_setter)
Ogre::MaterialPtr material_
PartialOgrePanel(Ogre::SceneManager &scene_manager, Ogre::SceneNode &parent_scene_node, const nav_core2::UIntBounds &bounds, float resolution)
void setTexture(const std::string &texture_name, int index)
void updateData(std::vector< unsigned char > &pixels)
Update the data for this Partial Panel.
Several reusable pieces for displaying polygons.
Ogre::TexturePtr texture_
nav_core2::UIntBounds bounds_
unsigned int getHeight() const
unsigned int getWidth() const