32 #include <QMouseEvent> 33 #include <QWheelEvent> 34 #include <QApplication> 35 #include <QVBoxLayout> 37 #include <OgreCamera.h> 38 #include <OgreSceneNode.h> 44 , left_mouse_down_( false )
45 , middle_mouse_down_( false )
46 , right_mouse_down_( false )
61 QVBoxLayout* layout =
new QVBoxLayout;
62 layout->setContentsMargins( 0, 0, 0, 0 );
73 Ogre::Light* directional_light =
scene_manager_->createLight(
"MainDirectional" );
74 directional_light->setType( Ogre::Light::LT_DIRECTIONAL );
75 directional_light->setDirection( Ogre::Vector3( 0, -1, 1 ) );
76 directional_light->setDiffuseColour( Ogre::ColourValue( 1.0
f, 1.0
f, 1.0
f ) );
85 for (
int i = -50; i < 50; ++i )
87 line->
addPoint( Ogre::Vector3( i*2, 0.0
f, -1.0
f ) );
90 for (
int i = 0; i < 5; ++i )
92 line->
addPoint( Ogre::Vector3( 4.0
f, 0.0
f, i ) );
126 Ogre::SceneNode* scene_node =
scene_manager_->getRootSceneNode()->createChildSceneNode();
134 std::vector<PointCloud::Point> points;
135 int32_t xcount = 200;
136 int32_t ycount = 100;
137 int32_t zcount = 100;
140 for (int32_t
x = 0;
x < xcount; ++
x)
142 for (int32_t
y = 0;
y < ycount; ++
y)
144 for (int32_t
z = 0;
z < zcount; ++
z)
153 points.push_back(point);
158 printf(
"size: %d\n", (
int)points.size());
159 pointCloud->
addPoints( &points.front(), points.size() );
160 scene_node->attachObject(pointCloud);
163 catch ( Ogre::Exception& e )
165 printf(
"Fatal error: %s\n", e.what() );
180 root_->renderOneFrame();
182 printf(
"Render took [%f] msec\n", (end - start).toSec() * 1000.0
f);
191 switch( event->button() )
199 case Qt::RightButton:
209 switch( event->button() )
217 case Qt::RightButton:
227 int32_t diff_x =
event->x() -
mouse_x_;
228 int32_t diff_y =
event->y() -
mouse_y_;
233 bool cmd =
event->modifiers() & Qt::ControlModifier;
234 bool shift =
event->modifiers() & Qt::ShiftModifier;
235 bool alt =
event->modifiers() & Qt::AltModifier;
253 if( event->delta() != 0 )
255 bool cmd =
event->modifiers() & Qt::ControlModifier;
256 bool shift =
event->modifiers() & Qt::ShiftModifier;
257 bool alt =
event->modifiers() & Qt::AltModifier;
263 int main(
int argc,
char** argv )
265 QApplication
app( argc, argv );
268 frame.resize( 800, 600 );
269 frame.setWindowTitle(
"I hope this is not all black." );
virtual void mouseLeftDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift)=0
Handle a left mouse button drag.
void addPoints(Point *points, uint32_t num_points)
Add points to this point cloud.
Ogre::SceneManager * scene_manager_
void addPoint(const Ogre::Vector3 &point)
void setRenderMode(RenderMode mode)
Set what type of rendering primitives should be used, currently points, billboards and boxes are supp...
An object that displays a multi-segment line strip rendered as billboards.
virtual void mouseMoveEvent(QMouseEvent *event)
Ogre::Camera * getOgreCamera()
Get the Ogre camera associated with this camera object.
virtual void wheelEvent(QWheelEvent *event)
void setAutoRender(bool auto_render)
virtual void mousePressEvent(QMouseEvent *event)
RenderSystem * render_system_
void setHeight(uint32_t count)
TFSIMD_FORCE_INLINE const tfScalar & y() const
virtual void setColor(float r, float g, float b, float a)
Set the color of the object. Values are in the range [0, 1].
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 setCommonUpVector(const Ogre::Vector3 &vec)
See Ogre::BillboardSet::setCommonUpVector.
int main(int argc, char **argv)
QtOgreRenderWindow * render_panel_
virtual void mouseMiddleDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift)=0
Handle a middle mouse button drag.
virtual void mouseRightDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift)=0
Handle a right mouse button drag.
virtual void setPosition(const Ogre::Vector3 &position)
Set the position of this object.
Representation of a point, with x/y/z position and r/g/b color.
void setDimensions(float width, float height, float depth)
Set the dimensions of the billboards used to render each point.
virtual void setOrientation(const Ogre::Quaternion &orientation)
Set the orientation.
TFSIMD_FORCE_INLINE const tfScalar & x() const
void setAlpha(float alpha, bool per_point_alpha=false)
void setBackgroundColor(Ogre::ColourValue color)
void setShaftColor(float r, float g, float b, float a=1.0f)
Set the color of the arrow's shaft. Values are in the range [0, 1].
An object that displays a set of X/Y/Z axes, with X=Red, Y=Green, Z=Blue.
virtual void scrollWheel(int diff, bool ctrl, bool alt, bool shift)=0
Handle a scrollwheel change.
void setMaxPointsPerLine(uint32_t max)
Displays a grid of cells, drawn with lines.
MyFrame(QWidget *parent=0)
TFSIMD_FORCE_INLINE const tfScalar & z() const
virtual void mouseReleaseEvent(QMouseEvent *event)
A visual representation of a set of points.
An arrow consisting of a cylinder and a cone.
void setCommonDirection(const Ogre::Vector3 &vec)
See Ogre::BillboardSet::setCommonDirection.
An orbital camera, controlled by yaw, pitch, distance, and focal point.
virtual void setPosition(const Ogre::Vector3 &position)
Set the position of the camera.
void setCamera(Ogre::Camera *camera)
void setHeadColor(float r, float g, float b, float a=1.0f)
Set the color of the arrow's head. Values are in the range [0, 1].
void setColor(float r, float g, float b, float a=1.0)
void setLineWidth(float width)