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 Grid::Grid( Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node,
Style style, uint32_t cell_count,
float cell_length,
float line_width,
const Ogre::ColourValue& color )
47 : scene_manager_( scene_manager )
49 , cell_count_(cell_count)
50 , cell_length_(cell_length)
51 , line_width_(line_width)
55 static uint32_t gridCount = 0;
57 ss <<
"Grid" << gridCount++;
72 material_ = Ogre::MaterialManager::getSingleton().create( ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
74 material_->getTechnique(0)->setLightingEnabled(
false);
116 material_->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
117 material_->setDepthWriteEnabled(
false );
121 material_->setSceneBlending( Ogre::SBT_REPLACE );
163 for (uint32_t h = 0; h <=
height_; ++h)
170 Ogre::Vector3 p1(inc, h_real, -extent);
171 Ogre::Vector3 p2(inc, h_real, extent);
172 Ogre::Vector3 p3(-extent, h_real, inc);
173 Ogre::Vector3 p4(extent, h_real, inc);
177 if (h != 0 || i != 0)
214 float y_top = (
height_ / 2.0f) * cell_length_;
215 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)
virtual void setColor(float r, float g, float b, float a)
Set the color of the object. Values are in the range [0, 1].
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_
TFSIMD_FORCE_INLINE const tfScalar & x() const
void setNumLines(uint32_t num)
Ogre::SceneNode * scene_node_
The scene node that this grid is attached to.
void setMaxPointsPerLine(uint32_t max)
TFSIMD_FORCE_INLINE const tfScalar & z() const
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_