Go to the documentation of this file.
33 bool showing_help, hiding_help;
58 if (showing_help || hiding_help)
60 static const double TRANSP_ANIMATION_TIME_SEC = 0.5;
62 const double show_tim = tim_show_start.
Tac();
63 const double hide_tim = tim_show_end.
Tac();
65 const double tranparency =
68 1.0, hide_tim / TRANSP_ANIMATION_TIME_SEC)
69 : std::
min(1.0, show_tim / TRANSP_ANIMATION_TIME_SEC);
74 "These are the supported commands:\n"
75 " - 'h': Toogle help view\n"
76 " - '<-' and '->': Rotate camera\n"
77 " - 'Alt+Enter': Toogle fullscreen\n"
81 190, 190, 190, 200 * tranparency),
89 if (hide_tim > TRANSP_ANIMATION_TIME_SEC && hiding_help)
116 mrpt::make_aligned_shared<opengl::CGridPlaneXY>(
117 -20, 20, -20, 20, 0, 1);
118 obj->setColor(0.8, 0.8, 0.8);
119 theScene->insert(
obj);
127 obj->setFrequency(5);
128 obj->enableTickMarks();
129 obj->setAxisLimits(-10, -10, -10, 10, 10, 10);
130 theScene->insert(
obj);
135 obj->setColor(0, 0, 1);
136 obj->setRadius(0.3f);
137 obj->setLocation(0, 0, 1);
138 obj->setName(
"ball_1");
139 theScene->insert(
obj);
146 win.unlockAccess3DScene();
153 win.setCameraElevationDeg(25.0f);
157 cout <<
"Control with mouse or keyboard. Valid keys:" << endl;
158 cout <<
" ESC -> Exit" << endl;
159 cout <<
" Left/right cursor arrow -> Camera azimuth" << endl;
167 while (!
end &&
win.isOpen())
173 const double t = timer.
Tac();
175 const double W = 5.0, Q = 3.3;
177 R * cos(W *
t) * sin(Q *
t),
R * sin(W *
t),
178 R * cos(W *
t) * cos(Q *
t));
186 win.unlockAccess3DScene();
190 std::this_thread::sleep_for(1ms);
196 int key =
win.getPushedKey(&kmods);
202 if (key ==
'h' || key ==
'H')
218 win.setCameraAzimuthDeg(
win.getCameraAzimuthDeg() + 5);
220 win.setCameraAzimuthDeg(
win.getCameraAzimuthDeg() - 5);
234 std::this_thread::sleep_for(
238 catch (std::exception& e)
240 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
245 printf(
"Untyped exception!!");
bool kbhit() noexcept
An OS-independent version of kbhit, which returns true if a key has been pushed.
std::shared_ptr< CGridPlaneXY > Ptr
The basic event type for the observer-observable pattern in MRPT.
A high-performance stopwatch, with typical resolution of nanoseconds.
std::shared_ptr< CSphere > Ptr
@ NICE
renders glyphs filled with antialiased outlines
void renderMessageBox(const float msg_x, const float msg_y, const float msg_w, const float msg_h, const std::string &text, float text_scale, const mrpt::img::TColor &back_col=mrpt::img::TColor(0, 0, 50, 150), const mrpt::img::TColor &border_col=mrpt::img::TColor(0, 0, 0, 140), const mrpt::img::TColor &text_col=mrpt::img::TColor(255, 255, 255, 220), const float border_width=4.0f, const std::string &text_font=std::string("sans"), mrpt::opengl::TOpenGLFontStyle text_style=mrpt::opengl::FILL, const double text_spacing=1.5, const double text_kerning=0.1)
Draws a message box with a centered (possibly multi-lined) text.
An event sent by an mrpt::opengl::COpenGLViewport after calling the scene OpenGL drawing primitives a...
GLsizei GLsizei GLuint * obj
void observeBegin(CObservable &obj)
Starts the subscription of this observer to the given object.
std::shared_ptr< CRenderizable > Ptr
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
@ MRPT_GLUT_BITMAP_HELVETICA_18
double Tac() noexcept
Stops the stopwatch.
An event sent by an mrpt::opengl::COpenGLViewport just after clearing the viewport and setting the GL...
mrpt::gui::CDisplayWindow3D::Ptr win
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
A RGB color - floats in the range [0,1].
void Tic() noexcept
Starts the stopwatch.
std::shared_ptr< CAxis > Ptr
Classes for creating GUI windows for 2D and 3D visualization.
@ MRPT_GLUT_BITMAP_TIMES_ROMAN_10
CSetOfObjects::Ptr CornerXYZ(float scale=1.0)
Returns three arrows representing a X,Y,Z 3D corner.
Inherit from this class to get notified about events from any CObservable object after subscribing to...
std::shared_ptr< COpenGLScene > Ptr
The namespace for 3D scene representation and rendering.
std::shared_ptr< COpenGLViewport > Ptr
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |