]> git.lizzy.rs Git - minetest.git/blob - src/drawscene.cpp
Increase step smoothing to fit 1:1 stairs (works well on slabs too)
[minetest.git] / src / drawscene.cpp
1 /*
2 Minetest
3 Copyright (C) 2010-2014 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "drawscene.h"
21 #include "main.h" // for g_settings
22 #include "settings.h"
23 #include "clouds.h"
24 #include "clientmap.h"
25 #include "util/timetaker.h"
26
27 typedef enum {
28         LEFT = -1,
29         RIGHT = 1,
30         EYECOUNT = 2
31 } paralax_sign;
32
33
34 void draw_selectionbox(video::IVideoDriver* driver, Hud& hud,
35                 std::vector<aabb3f>& hilightboxes, bool show_hud)
36 {
37         static const s16 selectionbox_width = rangelim(g_settings->getS16("selectionbox_width"), 1, 5);
38
39         if (!show_hud)
40                 return;
41
42         video::SMaterial oldmaterial = driver->getMaterial2D();
43         video::SMaterial m;
44         m.Thickness = selectionbox_width;
45         m.Lighting = false;
46         driver->setMaterial(m);
47         hud.drawSelectionBoxes(hilightboxes);
48         driver->setMaterial(oldmaterial);
49 }
50
51 void draw_anaglyph_3d_mode(Camera& camera, bool show_hud, Hud& hud,
52                 std::vector<aabb3f> hilightboxes, video::IVideoDriver* driver,
53                 scene::ISceneManager* smgr, bool draw_wield_tool, Client& client,
54                 gui::IGUIEnvironment* guienv )
55 {
56
57         /* preserve old setup*/
58         irr::core::vector3df oldPosition = camera.getCameraNode()->getPosition();
59         irr::core::vector3df oldTarget   = camera.getCameraNode()->getTarget();
60
61         irr::core::matrix4 startMatrix =
62                         camera.getCameraNode()->getAbsoluteTransformation();
63         irr::core::vector3df focusPoint = (camera.getCameraNode()->getTarget()
64                         - camera.getCameraNode()->getAbsolutePosition()).setLength(1)
65                         + camera.getCameraNode()->getAbsolutePosition();
66
67
68         //Left eye...
69         irr::core::vector3df leftEye;
70         irr::core::matrix4 leftMove;
71         leftMove.setTranslation(
72                         irr::core::vector3df(-g_settings->getFloat("3d_paralax_strength"),
73                                         0.0f, 0.0f));
74         leftEye = (startMatrix * leftMove).getTranslation();
75
76         //clear the depth buffer, and color
77         driver->beginScene( true, true, irr::video::SColor(0, 200, 200, 255));
78         driver->getOverrideMaterial().Material.ColorMask = irr::video::ECP_RED;
79         driver->getOverrideMaterial().EnableFlags = irr::video::EMF_COLOR_MASK;
80         driver->getOverrideMaterial().EnablePasses = irr::scene::ESNRP_SKY_BOX
81                         + irr::scene::ESNRP_SOLID + irr::scene::ESNRP_TRANSPARENT
82                         + irr::scene::ESNRP_TRANSPARENT_EFFECT + irr::scene::ESNRP_SHADOW;
83         camera.getCameraNode()->setPosition(leftEye);
84         camera.getCameraNode()->setTarget(focusPoint);
85         smgr->drawAll();
86         driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
87         if (show_hud)
88         {
89                 draw_selectionbox(driver, hud, hilightboxes, show_hud);
90
91                 if (draw_wield_tool)
92                         camera.drawWieldedTool(&leftMove);
93         }
94
95         guienv->drawAll();
96
97         //Right eye...
98         irr::core::vector3df rightEye;
99         irr::core::matrix4 rightMove;
100         rightMove.setTranslation(
101                         irr::core::vector3df(g_settings->getFloat("3d_paralax_strength"),
102                                         0.0f, 0.0f));
103         rightEye = (startMatrix * rightMove).getTranslation();
104
105         //clear the depth buffer
106         driver->clearZBuffer();
107         driver->getOverrideMaterial().Material.ColorMask = irr::video::ECP_GREEN
108                         + irr::video::ECP_BLUE;
109         driver->getOverrideMaterial().EnableFlags = irr::video::EMF_COLOR_MASK;
110         driver->getOverrideMaterial().EnablePasses = irr::scene::ESNRP_SKY_BOX
111                         + irr::scene::ESNRP_SOLID + irr::scene::ESNRP_TRANSPARENT
112                         + irr::scene::ESNRP_TRANSPARENT_EFFECT + irr::scene::ESNRP_SHADOW;
113         camera.getCameraNode()->setPosition(rightEye);
114         camera.getCameraNode()->setTarget(focusPoint);
115         smgr->drawAll();
116         driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
117         if (show_hud)
118         {
119                 draw_selectionbox(driver, hud, hilightboxes, show_hud);
120
121                 if (draw_wield_tool)
122                         camera.drawWieldedTool(&rightMove);
123         }
124
125         guienv->drawAll();
126
127         driver->getOverrideMaterial().Material.ColorMask = irr::video::ECP_ALL;
128         driver->getOverrideMaterial().EnableFlags = 0;
129         driver->getOverrideMaterial().EnablePasses = 0;
130         camera.getCameraNode()->setPosition(oldPosition);
131         camera.getCameraNode()->setTarget(oldTarget);
132 }
133
134 void init_texture(video::IVideoDriver* driver, const v2u32& screensize,
135                 video::ITexture** texture, const char* name)
136 {
137         if (*texture != NULL)
138         {
139                 driver->removeTexture(*texture);
140         }
141         *texture = driver->addRenderTargetTexture(
142                         core::dimension2d<u32>(screensize.X, screensize.Y), name,
143                         irr::video::ECF_A8R8G8B8);
144 }
145
146 video::ITexture* draw_image(const v2u32& screensize,
147                 paralax_sign psign, const irr::core::matrix4& startMatrix,
148                 const irr::core::vector3df& focusPoint, bool show_hud,
149                 video::IVideoDriver* driver, Camera& camera, scene::ISceneManager* smgr,
150                 Hud& hud, std::vector<aabb3f>& hilightboxes,
151                 bool draw_wield_tool, Client& client, gui::IGUIEnvironment* guienv,
152                 video::SColor skycolor )
153 {
154         static video::ITexture* images[2] = { NULL, NULL };
155         static v2u32 last_screensize = v2u32(0,0);
156
157         video::ITexture* image = NULL;
158
159         if (screensize != last_screensize) {
160                 init_texture(driver, screensize, &images[1], "mt_drawimage_img1");
161                 init_texture(driver, screensize, &images[0], "mt_drawimage_img2");
162                 last_screensize = screensize;
163         }
164
165         if (psign == RIGHT)
166                 image = images[1];
167         else
168                 image = images[0];
169         
170         driver->setRenderTarget(image, true, true,
171                         irr::video::SColor(255,
172                                         skycolor.getRed(), skycolor.getGreen(), skycolor.getBlue()));
173
174         irr::core::vector3df eye_pos;
175         irr::core::matrix4 movement;
176         movement.setTranslation(
177                         irr::core::vector3df((int) psign *
178                                         g_settings->getFloat("3d_paralax_strength"), 0.0f, 0.0f));
179         eye_pos = (startMatrix * movement).getTranslation();
180
181         //clear the depth buffer
182         driver->clearZBuffer();
183         camera.getCameraNode()->setPosition(eye_pos);
184         camera.getCameraNode()->setTarget(focusPoint);
185         smgr->drawAll();
186
187         driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
188
189         if (show_hud)
190         {
191                 draw_selectionbox(driver, hud, hilightboxes, show_hud);
192
193                 if (draw_wield_tool)
194                         camera.drawWieldedTool(&movement);
195         }
196
197         guienv->drawAll();
198
199         /* switch back to real renderer */
200         driver->setRenderTarget(0, true, true,
201                         irr::video::SColor(0,
202                                         skycolor.getRed(), skycolor.getGreen(), skycolor.getBlue()));
203
204         return image;
205 }
206
207 video::ITexture*  draw_hud(video::IVideoDriver* driver, const v2u32& screensize,
208                 bool show_hud, Hud& hud, Client& client, bool draw_crosshair,
209                 video::SColor skycolor, gui::IGUIEnvironment* guienv, Camera& camera )
210 {
211         static video::ITexture* image = NULL;
212         init_texture(driver, screensize, &image, "mt_drawimage_hud");
213         driver->setRenderTarget(image, true, true,
214                         irr::video::SColor(255,0,0,0));
215
216         if (show_hud)
217         {
218                 if (draw_crosshair)
219                         hud.drawCrosshair();
220                 hud.drawHotbar(client.getPlayerItem());
221                 hud.drawLuaElements(camera.getOffset());
222
223                 guienv->drawAll();
224         }
225
226         driver->setRenderTarget(0, true, true,
227                         irr::video::SColor(0,
228                                         skycolor.getRed(), skycolor.getGreen(), skycolor.getBlue()));
229
230         return image;
231 }
232
233 void draw_interlaced_3d_mode(Camera& camera, bool show_hud,
234                 Hud& hud, std::vector<aabb3f> hilightboxes, video::IVideoDriver* driver,
235                 scene::ISceneManager* smgr, const v2u32& screensize,
236                 bool draw_wield_tool, Client& client, gui::IGUIEnvironment* guienv,
237                 video::SColor skycolor )
238 {
239         /* save current info */
240         irr::core::vector3df oldPosition = camera.getCameraNode()->getPosition();
241         irr::core::vector3df oldTarget = camera.getCameraNode()->getTarget();
242         irr::core::matrix4 startMatrix =
243                         camera.getCameraNode()->getAbsoluteTransformation();
244         irr::core::vector3df focusPoint = (camera.getCameraNode()->getTarget()
245                         - camera.getCameraNode()->getAbsolutePosition()).setLength(1)
246                         + camera.getCameraNode()->getAbsolutePosition();
247
248         /* create left view */
249         video::ITexture* left_image = draw_image(screensize, LEFT, startMatrix,
250                         focusPoint, show_hud, driver, camera, smgr, hud, hilightboxes,
251                         draw_wield_tool, client, guienv, skycolor);
252
253         //Right eye...
254         irr::core::vector3df rightEye;
255         irr::core::matrix4 rightMove;
256         rightMove.setTranslation(
257                         irr::core::vector3df(g_settings->getFloat("3d_paralax_strength"),
258                                         0.0f, 0.0f));
259         rightEye = (startMatrix * rightMove).getTranslation();
260
261         //clear the depth buffer
262         driver->clearZBuffer();
263         camera.getCameraNode()->setPosition(rightEye);
264         camera.getCameraNode()->setTarget(focusPoint);
265         smgr->drawAll();
266
267         driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
268
269         if (show_hud)
270         {
271                 draw_selectionbox(driver, hud, hilightboxes, show_hud);
272
273                 if(draw_wield_tool)
274                         camera.drawWieldedTool(&rightMove);
275         }
276         guienv->drawAll();
277
278         for (unsigned int i = 0; i < screensize.Y; i+=2 ) {
279 #if (IRRLICHT_VERSION_MAJOR >= 1) && (IRRLICHT_VERSION_MINOR >= 8)
280                 driver->draw2DImage(left_image, irr::core::position2d<s32>(0, i),
281 #else
282                 driver->draw2DImage(left_image, irr::core::position2d<s32>(0, screensize.Y-i),
283 #endif
284                                 irr::core::rect<s32>(0, i,screensize.X, i+1), 0,
285                                 irr::video::SColor(255, 255, 255, 255),
286                                 false);
287         }
288
289         /* cleanup */
290         camera.getCameraNode()->setPosition(oldPosition);
291         camera.getCameraNode()->setTarget(oldTarget);
292 }
293
294 void draw_sidebyside_3d_mode(Camera& camera, bool show_hud,
295                 Hud& hud, std::vector<aabb3f> hilightboxes, video::IVideoDriver* driver,
296                 scene::ISceneManager* smgr, const v2u32& screensize,
297                 bool draw_wield_tool, Client& client, gui::IGUIEnvironment* guienv,
298                 video::SColor skycolor )
299 {
300         /* save current info */
301         irr::core::vector3df oldPosition = camera.getCameraNode()->getPosition();
302         irr::core::vector3df oldTarget = camera.getCameraNode()->getTarget();
303         irr::core::matrix4 startMatrix =
304                         camera.getCameraNode()->getAbsoluteTransformation();
305         irr::core::vector3df focusPoint = (camera.getCameraNode()->getTarget()
306                         - camera.getCameraNode()->getAbsolutePosition()).setLength(1)
307                         + camera.getCameraNode()->getAbsolutePosition();
308
309         /* create left view */
310         video::ITexture* left_image = draw_image(screensize, LEFT, startMatrix,
311                         focusPoint, show_hud, driver, camera, smgr, hud, hilightboxes,
312                         draw_wield_tool, client, guienv, skycolor);
313
314         /* create right view */
315         video::ITexture* right_image = draw_image(screensize, RIGHT, startMatrix,
316                         focusPoint, show_hud, driver, camera, smgr, hud, hilightboxes,
317                         draw_wield_tool, client, guienv, skycolor);
318
319         /* create hud overlay */
320         video::ITexture* hudtexture = draw_hud(driver, screensize, show_hud, hud, client,
321                         false, skycolor, guienv, camera );
322         driver->makeColorKeyTexture(hudtexture, irr::video::SColor(255, 0, 0, 0));
323         //makeColorKeyTexture mirrors texture so we do it twice to get it right again
324         driver->makeColorKeyTexture(hudtexture, irr::video::SColor(255, 0, 0, 0));
325
326         driver->draw2DImage(left_image,
327                         irr::core::rect<s32>(0, 0, screensize.X/2, screensize.Y),
328                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, false);
329
330         driver->draw2DImage(hudtexture,
331                         irr::core::rect<s32>(0, 0, screensize.X/2, screensize.Y),
332                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, true);
333
334         driver->draw2DImage(right_image,
335                         irr::core::rect<s32>(screensize.X/2, 0, screensize.X, screensize.Y),
336                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, false);
337
338         driver->draw2DImage(hudtexture,
339                         irr::core::rect<s32>(screensize.X/2, 0, screensize.X, screensize.Y),
340                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, true);
341
342         left_image = NULL;
343         right_image = NULL;
344
345         /* cleanup */
346         camera.getCameraNode()->setPosition(oldPosition);
347         camera.getCameraNode()->setTarget(oldTarget);
348 }
349
350 void draw_top_bottom_3d_mode(Camera& camera, bool show_hud,
351                 Hud& hud, std::vector<aabb3f> hilightboxes, video::IVideoDriver* driver,
352                 scene::ISceneManager* smgr, const v2u32& screensize,
353                 bool draw_wield_tool, Client& client, gui::IGUIEnvironment* guienv,
354                 video::SColor skycolor )
355 {
356         /* save current info */
357         irr::core::vector3df oldPosition = camera.getCameraNode()->getPosition();
358         irr::core::vector3df oldTarget = camera.getCameraNode()->getTarget();
359         irr::core::matrix4 startMatrix =
360                         camera.getCameraNode()->getAbsoluteTransformation();
361         irr::core::vector3df focusPoint = (camera.getCameraNode()->getTarget()
362                         - camera.getCameraNode()->getAbsolutePosition()).setLength(1)
363                         + camera.getCameraNode()->getAbsolutePosition();
364
365         /* create left view */
366         video::ITexture* left_image = draw_image(screensize, LEFT, startMatrix,
367                         focusPoint, show_hud, driver, camera, smgr, hud, hilightboxes,
368                         draw_wield_tool, client, guienv, skycolor);
369
370         /* create right view */
371         video::ITexture* right_image = draw_image(screensize, RIGHT, startMatrix,
372                         focusPoint, show_hud, driver, camera, smgr, hud, hilightboxes,
373                         draw_wield_tool, client, guienv, skycolor);
374
375         /* create hud overlay */
376         video::ITexture* hudtexture = draw_hud(driver, screensize, show_hud, hud, client,
377                         false, skycolor, guienv, camera );
378         driver->makeColorKeyTexture(hudtexture, irr::video::SColor(255, 0, 0, 0));
379         //makeColorKeyTexture mirrors texture so we do it twice to get it right again
380         driver->makeColorKeyTexture(hudtexture, irr::video::SColor(255, 0, 0, 0));
381
382         driver->draw2DImage(left_image,
383                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y/2),
384                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, false);
385
386         driver->draw2DImage(hudtexture,
387                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y/2),
388                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, true);
389
390         driver->draw2DImage(right_image,
391                         irr::core::rect<s32>(0, screensize.Y/2, screensize.X, screensize.Y),
392                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, false);
393
394         driver->draw2DImage(hudtexture,
395                         irr::core::rect<s32>(0, screensize.Y/2, screensize.X, screensize.Y),
396                         irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, true);
397
398         left_image = NULL;
399         right_image = NULL;
400
401         /* cleanup */
402         camera.getCameraNode()->setPosition(oldPosition);
403         camera.getCameraNode()->setTarget(oldTarget);
404 }
405
406 void draw_plain(Camera& camera, bool show_hud, Hud& hud,
407                 std::vector<aabb3f> hilightboxes, video::IVideoDriver* driver,
408                 bool draw_wield_tool, Client& client, gui::IGUIEnvironment* guienv)
409 {
410         driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
411
412         draw_selectionbox(driver, hud, hilightboxes, show_hud);
413
414         if(draw_wield_tool)
415                 camera.drawWieldedTool();
416 }
417
418 void draw_scene(video::IVideoDriver* driver, scene::ISceneManager* smgr,
419                 Camera& camera, Client& client, LocalPlayer* player, Hud& hud,
420                 gui::IGUIEnvironment* guienv, std::vector<aabb3f> hilightboxes,
421                 const v2u32& screensize, video::SColor skycolor, bool show_hud)
422 {
423         //TODO check if usefull
424         u32 scenetime = 0;
425         {
426                 TimeTaker timer("smgr");
427
428                 bool draw_wield_tool = (show_hud &&
429                                 (player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
430                                 camera.getCameraMode() < CAMERA_MODE_THIRD );
431
432                 bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
433                                 (camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
434
435 #ifdef HAVE_TOUCHSCREENGUI
436                 try {
437                         draw_crosshair = !g_settings->getBool("touchtarget");
438                 }
439                 catch(SettingNotFoundException) {}
440 #endif
441
442                 std::string draw_mode = g_settings->get("3d_mode");
443
444                 smgr->drawAll();
445
446                 if (draw_mode == "anaglyph")
447                 {
448                         draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
449                                         smgr, draw_wield_tool, client, guienv);
450                         draw_crosshair = false;
451                 }
452                 else if (draw_mode == "interlaced")
453                 {
454                         draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
455                                         smgr, screensize, draw_wield_tool, client, guienv, skycolor);
456                         draw_crosshair = false;
457                 }
458                 else if (draw_mode == "sidebyside")
459                 {
460                         draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
461                                         smgr, screensize, draw_wield_tool, client, guienv, skycolor);
462                         show_hud = false;
463                 }
464                 else if (draw_mode == "topbottom")
465                 {
466                         draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
467                                         smgr, screensize, draw_wield_tool, client, guienv, skycolor);
468                         show_hud = false;
469                 }
470                 else {
471                         draw_plain(camera, show_hud, hud, hilightboxes, driver,
472                                         draw_wield_tool, client, guienv);
473                 }
474
475                 /*
476                         Post effects
477                 */
478                 {
479                         client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
480                 }
481
482                 //TODO how to make those 3d too
483                 if (show_hud)
484                 {
485                         if (draw_crosshair)
486                                 hud.drawCrosshair();
487                         hud.drawHotbar(client.getPlayerItem());
488                         hud.drawLuaElements(camera.getOffset());
489                 }
490
491                 guienv->drawAll();
492
493                 scenetime = timer.stop(true);
494         }
495
496 }
497
498 /*
499         Draws a screen with a single text on it.
500         Text will be removed when the screen is drawn the next time.
501         Additionally, a progressbar can be drawn when percent is set between 0 and 100.
502 */
503 /*gui::IGUIStaticText **/
504 void draw_load_screen(const std::wstring &text, IrrlichtDevice* device,
505                 gui::IGUIEnvironment* guienv, gui::IGUIFont* font, float dtime,
506                 int percent, bool clouds )
507 {
508         video::IVideoDriver* driver = device->getVideoDriver();
509         v2u32 screensize = driver->getScreenSize();
510         const wchar_t *loadingtext = text.c_str();
511         core::vector2d<u32> textsize_u = font->getDimension(loadingtext);
512         core::vector2d<s32> textsize(textsize_u.X,textsize_u.Y);
513         core::vector2d<s32> center(screensize.X/2, screensize.Y/2);
514         core::rect<s32> textrect(center - textsize/2, center + textsize/2);
515
516         gui::IGUIStaticText *guitext = guienv->addStaticText(
517                         loadingtext, textrect, false, false);
518         guitext->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
519
520         bool cloud_menu_background = clouds && g_settings->getBool("menu_clouds");
521         if (cloud_menu_background)
522         {
523                 g_menuclouds->step(dtime*3);
524                 g_menuclouds->render();
525                 driver->beginScene(true, true, video::SColor(255,140,186,250));
526                 g_menucloudsmgr->drawAll();
527         }
528         else
529                 driver->beginScene(true, true, video::SColor(255,0,0,0));
530
531         if (percent >= 0 && percent <= 100) // draw progress bar
532         {
533                 core::vector2d<s32> barsize(256,32);
534                 core::rect<s32> barrect(center-barsize/2, center+barsize/2);
535                 driver->draw2DRectangle(video::SColor(255,255,255,255),barrect, NULL); // border
536                 driver->draw2DRectangle(video::SColor(255,64,64,64), core::rect<s32> (
537                                 barrect.UpperLeftCorner+1,
538                                 barrect.LowerRightCorner-1), NULL); // black inside the bar
539                 driver->draw2DRectangle(video::SColor(255,128,128,128), core::rect<s32> (
540                                 barrect.UpperLeftCorner+1,
541                                 core::vector2d<s32>(
542                                         barrect.LowerRightCorner.X-(barsize.X-1)+percent*(barsize.X-2)/100,
543                                         barrect.LowerRightCorner.Y-1)), NULL); // the actual progress
544         }
545         guienv->drawAll();
546         driver->endScene();
547
548         guitext->remove();
549
550         //return guitext;
551 }