33 #include <OgreSceneManager.h> 34 #include <OgreSceneNode.h> 35 #include <OgreVector3.h> 36 #include <OgreQuaternion.h> 37 #include <OgreManualObject.h> 38 #include <OgreMaterialManager.h> 39 #include <OgreTechnique.h> 46 Ogre::SceneNode* parent_node,
51 const Ogre::ColourValue& color)
52 : scene_manager_(scene_manager)
54 , cell_count_(cell_count)
55 , cell_length_(cell_length)
56 , line_width_(line_width)
60 static uint32_t gridCount = 0;
62 ss <<
"Grid" << gridCount++;
77 material_ = Ogre::MaterialManager::getSingleton().create(
78 ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
80 material_->getTechnique(0)->setLightingEnabled(
false);
122 material_->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
127 material_->setSceneBlending(Ogre::SBT_REPLACE);
170 for (uint32_t h = 0; h <=
height_; ++h)
177 Ogre::Vector3 p1(inc, h_real, -extent);
178 Ogre::Vector3 p2(inc, h_real, extent);
179 Ogre::Vector3 p3(-extent, h_real, inc);
180 Ogre::Vector3 p4(extent, h_real, inc);
184 if (h != 0 || i != 0)
221 float y_top = (
height_ / 2.0f) * cell_length_;
222 float y_bottom = -y_top;
void addPoint(const Ogre::Vector3 &point)
void setUserData(const Ogre::Any &data)
Sets user data on all ogre objects we own.
An object that displays a multi-segment line strip rendered as billboards.
Ogre::MaterialPtr material_
void setHeight(uint32_t count)
void setStyle(Style style)
void setCellCount(uint32_t count)
void setCellLength(float len)
Grid(Ogre::SceneManager *manager, Ogre::SceneNode *parent_node, Style style, uint32_t cell_count, float cell_length, float line_width, const Ogre::ColourValue &color)
Constructor.
BillboardLine * billboard_line_
void setColor(float r, float g, float b, float a) override
Set the color of the object. Values are in the range [0, 1].
void setNumLines(uint32_t num)
Ogre::SceneNode * scene_node_
The scene node that this grid is attached to.
void setMaxPointsPerLine(uint32_t max)
void setLineWidth(float width)
Ogre::ManualObject * manual_object_
The manual object used to draw the grid.
void setColor(const Ogre::ColourValue &color)
void setLineWidth(float width)
Ogre::SceneManager * scene_manager_