-
Notifications
You must be signed in to change notification settings - Fork 1k
/
irr_driver.hpp
642 lines (572 loc) · 27.3 KB
/
irr_driver.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2009-2013 Joerg Henrichs
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_IRR_DRIVER_HPP
#define HEADER_IRR_DRIVER_HPP
/**
* \defgroup graphics
* This module contains the core graphics engine, that is mostly a thin layer
* on top of irrlicht providing some additional features we need for STK
* (like particles, more scene node types, mesh manipulation tools, material
* management, etc...)
*/
#include <string>
#include <vector>
#include <IVideoDriver.h>
#include <vector2d.h>
#include <dimension2d.h>
#include <SColor.h>
#include "IrrlichtDevice.h"
#include "ISkinnedMesh.h"
namespace irr
{
namespace scene { class ISceneManager; class IMesh; class IAnimatedMeshSceneNode; class IAnimatedMesh;
class IMeshSceneNode; class IParticleSystemSceneNode; class ICameraSceneNode; class ILightSceneNode;
class CLensFlareSceneNode; }
namespace gui { class IGUIEnvironment; class IGUIFont; }
}
using namespace irr;
class ShadowImportanceProvider;
#include "graphics/rtts.hpp"
#include "graphics/shaders.hpp"
#include "graphics/wind.hpp"
#include "io/file_manager.hpp"
#include "utils/aligned_array.hpp"
#include "utils/no_copy.hpp"
#include "utils/ptr_vector.hpp"
#include "utils/vec3.hpp"
class AbstractKart;
class Camera;
class PerCameraNode;
class PostProcessing;
class LightNode;
class ShadowImportance;
enum STKRenderingPass
{
SOLID_NORMAL_AND_DEPTH_PASS,
SOLID_LIT_PASS,
TRANSPARENT_PASS,
GLOW_PASS,
DISPLACEMENT_PASS,
SHADOW_PASS,
PASS_COUNT,
};
/**
* \brief class that creates the irrLicht device and offers higher-level
* ways to manage the 3D scene
* \ingroup graphics
*/
class IrrDriver : public IEventReceiver, public NoCopy
{
private:
int GLMajorVersion, GLMinorVersion;
/** The irrlicht device. */
IrrlichtDevice *m_device;
/** Irrlicht scene manager. */
scene::ISceneManager *m_scene_manager;
/** Irrlicht gui environment. */
gui::IGUIEnvironment *m_gui_env;
/** Irrlicht video driver. */
video::IVideoDriver *m_video_driver;
/** Irrlicht race font. */
gui::IGUIFont *m_race_font;
/** Post-processing. */
PostProcessing *m_post_processing;
/** Shaders. */
Shaders *m_shaders;
/** Wind. */
Wind *m_wind;
float m_exposure;
float m_lwhite;
/** RTTs. */
RTT *m_rtts;
/** Shadow importance. */
ShadowImportance *m_shadow_importance;
std::vector<core::matrix4> sun_ortho_matrix;
/** Additional details to be shown in case that a texture is not found.
* This is used to specify details like: "while loading kart '...'" */
std::string m_texture_error_message;
/** The main MRT setup. */
core::array<video::IRenderTarget> m_mrt;
/** Matrixes used in several places stored here to avoid recomputation. */
core::matrix4 m_ViewMatrix, m_InvViewMatrix, m_ProjMatrix, m_InvProjMatrix, m_ProjViewMatrix, m_InvProjViewMatrix;
std::vector<video::ITexture *> SkyboxTextures;
std::vector<video::ITexture *> SphericalHarmonicsTextures;
float blueSHCoeff[9];
float greenSHCoeff[9];
float redSHCoeff[9];
/** Flag to indicate if a resolution change is pending (which will be
* acted upon in the next update). None means no change, yes means
* change to new resolution and trigger confirmation dialog.
* Cancel indicates a change of the resolution (back to the original
* one), but no confirmation dialog. */
enum {RES_CHANGE_NONE, RES_CHANGE_YES,
RES_CHANGE_CANCEL} m_resolution_changing;
public:
GLuint SkyboxCubeMap;
/** A simple class to store video resolutions. */
class VideoMode
{
private:
int m_width;
int m_height;
public:
VideoMode(int w, int h) {m_width=w; m_height=h; }
int getWidth() const {return m_width; }
int getHeight() const {return m_height; }
}; // VideoMode
struct BloomData {
scene::ISceneNode * node;
float power;
};
unsigned getGLSLVersion() const
{
if (GLMajorVersion > 3 || (GLMajorVersion == 3 && GLMinorVersion == 3))
return GLMajorVersion * 100 + GLMinorVersion * 10;
else if (GLMajorVersion == 3)
return 100 + (GLMinorVersion + 3) * 10;
else
return 120;
}
float getExposure() const
{
return m_exposure;
}
void setExposure(float v)
{
m_exposure = v;
}
float getLwhite() const
{
return m_lwhite;
}
void setLwhite(float v)
{
m_lwhite = v;
}
private:
std::vector<VideoMode> m_modes;
void setupViewports();
/** Whether the mouse cursor is currently shown */
bool m_pointer_shown;
/** Supports GLSL */
bool m_glsl;
/** Internal method that applies the resolution in user settings. */
void applyResolutionSettings();
void createListOfVideoModes();
bool m_request_screenshot;
bool m_wireframe;
bool m_mipviz;
bool m_normals;
bool m_ssaoviz;
bool m_shadowviz;
bool m_lightviz;
bool m_distortviz;
/** Performance stats */
unsigned m_last_light_bucket_distance;
unsigned object_count[PASS_COUNT];
u32 m_renderpass;
u32 m_lensflare_query;
bool m_query_issued;
class STKMeshSceneNode *m_sun_interposer;
scene::CLensFlareSceneNode *m_lensflare;
scene::ICameraSceneNode *m_suncam;
struct GlowData {
scene::ISceneNode * node;
float r, g, b;
};
std::vector<GlowData> m_glowing;
std::vector<LightNode *> m_lights;
std::vector<BloomData> m_forcedbloom;
std::vector<scene::ISceneNode *> m_displacing;
std::vector<scene::ISceneNode *> m_background;
STKRenderingPass m_phase;
#ifdef DEBUG
/** Used to visualise skeletons. */
std::vector<irr::scene::IAnimatedMeshSceneNode*> m_debug_meshes;
void drawDebugMeshes();
void drawJoint(bool drawline, bool drawname,
irr::scene::ISkinnedMesh::SJoint* joint,
irr::scene::ISkinnedMesh* mesh, int id);
#endif
void renderFixed(float dt);
void renderGLSL(float dt);
void renderSolidFirstPass();
void renderSolidSecondPass();
void renderTransparent();
void renderParticles();
void computeCameraMatrix(scene::ICameraSceneNode * const camnode,
Camera * const camera);
void renderShadows(//ShadowImportanceProvider * const sicb,
scene::ICameraSceneNode * const camnode,
//video::SOverrideMaterial &overridemat,
Camera * const camera);
void renderGlow(video::SOverrideMaterial &overridemat,
std::vector<GlowData>& glows,
const core::aabbox3df& cambox,
int cam);
void renderLights(const core::aabbox3df& cambox,
scene::ICameraSceneNode * const camnode,
video::SOverrideMaterial &overridemat,
int cam, float dt);
void renderDisplacement(video::SOverrideMaterial &overridemat,
int cam);
void doScreenShot();
public:
IrrDriver();
~IrrDriver();
void initDevice();
void reset();
void generateSkyboxCubemap();
void renderSkybox();
void setPhase(STKRenderingPass);
STKRenderingPass getPhase() const;
const std::vector<core::matrix4> &getShadowViewProj() const
{
return sun_ortho_matrix;
}
void IncreaseObjectCount();
core::array<video::IRenderTarget> &getMainSetup();
void updateConfigIfRelevant();
void setAllMaterialFlags(scene::IMesh *mesh) const;
scene::IAnimatedMesh *getAnimatedMesh(const std::string &name);
scene::IMesh *getMesh(const std::string &name);
video::ITexture *applyMask(video::ITexture* texture,
const std::string& mask_path);
void displayFPS();
bool OnEvent(const irr::SEvent &event);
void setAmbientLight(const video::SColor &light);
video::ITexture *getTexture(FileManager::AssetType type,
const std::string &filename,
bool is_premul=false,
bool is_prediv=false,
bool complain_if_not_found=true);
video::ITexture *getTexture(const std::string &filename,
bool is_premul=false,
bool is_prediv=false,
bool complain_if_not_found=true);
void grabAllTextures(const scene::IMesh *mesh);
void dropAllTextures(const scene::IMesh *mesh);
scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL,
bool create_one_quad=false);
scene::IMesh *createTexturedQuadMesh(const video::SMaterial *material,
const double w, const double h);
scene::ISceneNode *addWaterNode(scene::IMesh *mesh, scene::IMesh **welded,
float wave_height,
float wave_speed, float wave_length);
scene::IMeshSceneNode*addOctTree(scene::IMesh *mesh);
scene::IMeshSceneNode*addSphere(float radius,
const video::SColor &color=video::SColor(128, 255, 255, 255));
scene::IMeshSceneNode*addMesh(scene::IMesh *mesh,
scene::ISceneNode *parent=NULL);
PerCameraNode *addPerCameraNode(scene::ISceneNode* node,
scene::ICameraSceneNode* cam,
scene::ISceneNode *parent = NULL);
scene::ISceneNode *addBillboard(const core::dimension2d< f32 > size,
video::ITexture *texture,
scene::ISceneNode* parent=NULL, bool alphaTesting = false);
scene::IParticleSystemSceneNode
*addParticleNode(bool default_emitter=true);
scene::ISceneNode *addSkyDome(video::ITexture *texture, int hori_res,
int vert_res, float texture_percent,
float sphere_percent);
scene::ISceneNode *addSkyBox(const std::vector<video::ITexture*> &texture_names,
const std::vector<video::ITexture*> &sphericalHarmonics);
void suppressSkyBox();
void removeNode(scene::ISceneNode *node);
void removeMeshFromCache(scene::IMesh *mesh);
void removeTexture(video::ITexture *t);
scene::IAnimatedMeshSceneNode
*addAnimatedMesh(scene::IAnimatedMesh *mesh, scene::ISceneNode* parent=NULL);
scene::ICameraSceneNode
*addCameraSceneNode();
Camera *addCamera(unsigned int index, AbstractKart *kart);
void removeCameraSceneNode(scene::ICameraSceneNode *camera);
void removeCamera(Camera *camera);
void update(float dt);
/** Call to change resolution */
void changeResolution(const int w, const int h, const bool fullscreen);
/** Call this to roll back to the previous resolution if a resolution switch attempt goes bad */
void cancelResChange();
bool moveWindow(const int x, const int y);
void showPointer();
void hidePointer();
void setLastLightBucketDistance(unsigned d) { m_last_light_bucket_distance = d; }
bool isPointerShown() const { return m_pointer_shown; }
core::position2di getMouseLocation();
void printRenderStats();
bool supportsSplatting();
void requestScreenshot();
void setTextureErrorMessage(const std::string &error,
const std::string &detail="");
void unsetTextureErrorMessage();
void draw2dTriangle(const core::vector2df &a, const core::vector2df &b,
const core::vector2df &c,
const video::ITexture *texture = NULL,
const video::SColor *ca=NULL,
const video::SColor *cb=NULL,
const video::SColor *cc=NULL);
// ------------------------------------------------------------------------
/** Convenience function that loads a texture with default parameters
* but includes an error message.
* \param filename File name of the texture to load.
* \param error Error message, potentially with a '%' which will be replaced
* with detail.
* \param detail String to replace a '%' in the error message.
*/
video::ITexture* getTexture(const std::string &filename,
const std::string &error_message,
const std::string &detail="")
{
setTextureErrorMessage(error_message, detail);
video::ITexture *tex = getTexture(filename);
unsetTextureErrorMessage();
return tex;
} // getTexture
// ------------------------------------------------------------------------
/** Convenience function that loads a texture with default parameters
* but includes an error message.
* \param filename File name of the texture to load.
* \param error Error message, potentially with a '%' which will be replaced
* with detail.
* \param detail String to replace a '%' in the error message.
*/
video::ITexture* getTexture(const std::string &filename,
char *error_message,
char *detail=NULL)
{
if(!detail)
return getTexture(filename, std::string(error_message),
std::string(""));
return getTexture(filename, std::string(error_message),
std::string(detail));
} // getTexture
// ------------------------------------------------------------------------
/** Returns the currently defined texture error message, which is used
* by event_handler.cpp to print additional info about irrlicht
* internal errors or warnings. If no error message is currently
* defined, the error message is "".
*/
const std::string &getTextureErrorMessage()
{
return m_texture_error_message;
} // getTextureErrorMessage
// ------------------------------------------------------------------------
/** Returns a list of all video modes supports by the graphics card. */
const std::vector<VideoMode>& getVideoModes() const { return m_modes; }
// ------------------------------------------------------------------------
/** Returns the frame size. */
const core::dimension2d<u32>& getFrameSize() const
{ return m_video_driver->getCurrentRenderTargetSize(); }
// ------------------------------------------------------------------------
/** Returns the irrlicht device. */
IrrlichtDevice *getDevice() const { return m_device; }
// ------------------------------------------------------------------------
/** Returns the irrlicht video driver. */
video::IVideoDriver *getVideoDriver() const { return m_video_driver; }
// ------------------------------------------------------------------------
/** Returns the irrlicht scene manager. */
scene::ISceneManager *getSceneManager() const { return m_scene_manager; }
// ------------------------------------------------------------------------
/** Returns the gui environment, used to add widgets to a screen. */
gui::IGUIEnvironment *getGUI() const { return m_gui_env; }
// ------------------------------------------------------------------------
/** Returns the current real time, which might not be 0 at start of the
* application. Value in msec. */
unsigned int getRealTime() {return m_device->getTimer()->getRealTime(); }
// ------------------------------------------------------------------------
/** Returns a pointer to the post processing object. */
inline PostProcessing* getPostProcessing() {return m_post_processing;}
// ------------------------------------------------------------------------
inline core::vector3df getWind() {return m_wind->getWind();}
// -----------------------------------------------------------------------
inline video::E_MATERIAL_TYPE getShader(const ShaderType num) {return m_shaders->getShader(num);}
// -----------------------------------------------------------------------
inline void updateShaders() {m_shaders->loadShaders();}
// ------------------------------------------------------------------------
inline video::IShaderConstantSetCallBack* getCallback(const ShaderType num)
{
return (m_shaders == NULL ? NULL : m_shaders->m_callbacks[num]);
}
// ------------------------------------------------------------------------
inline GLuint getRenderTargetTexture(TypeRTT which) { return m_rtts->getRenderTarget(which); }
inline GLuint getFBO(TypeFBO which) { return m_rtts->getFBO(which); }
inline GLuint getDepthStencilTexture() { return m_rtts->getDepthStencilTexture(); }
// ------------------------------------------------------------------------
inline bool isGLSL() const { return m_glsl; }
// ------------------------------------------------------------------------
/** Called when the driver pretends to support it, but fails at some
* operations. */
void disableGLSL() { m_glsl = false; }
// ------------------------------------------------------------------------
void resetDebugModes()
{
m_wireframe = false;
m_mipviz = false;
m_normals = false;
m_ssaoviz = false;
m_shadowviz = false;
m_lightviz = false;
m_distortviz = false;
}
// ------------------------------------------------------------------------
void toggleWireframe() { m_wireframe = !m_wireframe; }
// ------------------------------------------------------------------------
void toggleMipVisualization() { m_mipviz = !m_mipviz; }
// ------------------------------------------------------------------------
void toggleNormals() { m_normals = !m_normals; }
// ------------------------------------------------------------------------
bool getNormals() { return m_normals; }
// ------------------------------------------------------------------------
void toggleSSAOViz() { m_ssaoviz = !m_ssaoviz; }
// ------------------------------------------------------------------------
void toggleLightViz() { m_lightviz = !m_lightviz; }
// ------------------------------------------------------------------------
bool getLightViz() { return m_lightviz; }
// ------------------------------------------------------------------------
bool getSSAOViz() { return m_ssaoviz; }
// ------------------------------------------------------------------------
void toggleShadowViz() { m_shadowviz = !m_shadowviz; }
// ------------------------------------------------------------------------
bool getShadowViz() { return m_shadowviz; }
// ------------------------------------------------------------------------
void toggleDistortViz() { m_distortviz = !m_distortviz; }
// ------------------------------------------------------------------------
bool getDistortViz() { return m_distortviz; }
// ------------------------------------------------------------------------
u32 getRenderPass() { return m_renderpass; }
// ------------------------------------------------------------------------
void addGlowingNode(scene::ISceneNode *n, float r = 1.0f, float g = 1.0f, float b = 1.0f)
{
GlowData dat;
dat.node = n;
dat.r = r;
dat.g = g;
dat.b = b;
m_glowing.push_back(dat);
}
// ------------------------------------------------------------------------
void clearGlowingNodes() { m_glowing.clear(); }
// ------------------------------------------------------------------------
void addForcedBloomNode(scene::ISceneNode *n, float power = 1)
{
BloomData dat;
dat.node = n;
dat.power = power;
m_forcedbloom.push_back(dat);
}
// ------------------------------------------------------------------------
void clearForcedBloom() { m_forcedbloom.clear(); }
// ------------------------------------------------------------------------
const std::vector<BloomData> &getForcedBloom() const { return m_forcedbloom; }
// ------------------------------------------------------------------------
void clearDisplacingNodes() { m_displacing.clear(); }
// ------------------------------------------------------------------------
const std::vector<scene::ISceneNode *> &getDisplacingNodes() const { return m_displacing; }
// ------------------------------------------------------------------------
void addDisplacingNode(scene::ISceneNode * const n) { m_displacing.push_back(n); }
// ------------------------------------------------------------------------
void clearBackgroundNodes() { m_background.clear(); }
// ------------------------------------------------------------------------
void addBackgroundNode(scene::ISceneNode * const n) { m_background.push_back(n); }
// ------------------------------------------------------------------------
void applyObjectPassShader();
void applyObjectPassShader(scene::ISceneNode * const node, bool rimlit = false);
// ------------------------------------------------------------------------
scene::ISceneNode *addLight(const core::vector3df &pos, float energy = 1., float r = 1.0f,
float g = 1.0f, float b = 1.0f, bool sun = false, scene::ISceneNode* parent = NULL);
// ------------------------------------------------------------------------
void clearLights();
// ------------------------------------------------------------------------
class STKMeshSceneNode *getSunInterposer() { return m_sun_interposer; }
// ------------------------------------------------------------------------
void setViewMatrix(core::matrix4 matrix) { m_ViewMatrix = matrix; matrix.getInverse(m_InvViewMatrix); }
const core::matrix4 &getViewMatrix() const { return m_ViewMatrix; }
const core::matrix4 &getInvViewMatrix() const { return m_InvViewMatrix; }
void setProjMatrix(core::matrix4 matrix) { m_ProjMatrix = matrix; matrix.getInverse(m_InvProjMatrix); }
const core::matrix4 &getProjMatrix() const { return m_ProjMatrix; }
const core::matrix4 &getInvProjMatrix() const { return m_InvProjMatrix; }
void genProjViewMatrix() { m_ProjViewMatrix = m_ProjMatrix * m_ViewMatrix; m_InvProjViewMatrix = m_ProjViewMatrix; m_InvProjViewMatrix.makeInverse(); }
const core::matrix4 &getProjViewMatrix() const { return m_ProjViewMatrix; }
const core::matrix4 &getInvProjViewMatrix() const { return m_InvProjViewMatrix; }
#ifdef DEBUG
/** Removes debug meshes. */
void clearDebugMesh() { m_debug_meshes.clear(); }
// ------------------------------------------------------------------------
/** Adds a debug mesh to be displaed. */
void addDebugMesh(scene::IAnimatedMeshSceneNode *node)
{
m_debug_meshes.push_back(node);
} // addDebugMesh
#endif
// --------------------- RTT --------------------
/**
* Class that provides RTT (currently, only when no other 3D rendering
* in the main scene is required)
* Provides an optional 'setupRTTScene' method to make it quick and easy
* to prepare rendering of 3D objects but you can also manually set the
* scene/camera. If you use the factory 'setupRTTScene', cleanup can be
* done through 'tearDownRTTScene' (destructor will also do this). If
* you set it up manually, you need to clean it up manually.
*/
class RTTProvider
{
/** A pointer to texture on which a scene is rendered. Only used
* in between beginRenderToTexture() and endRenderToTexture calls. */
video::ITexture *m_render_target_texture;
bool m_persistent_texture;
/** Main node of the RTT scene */
scene::ISceneNode *m_rtt_main_node;
scene::ICameraSceneNode *m_camera;
scene::ILightSceneNode *m_light;
/** Irrlicht video driver. */
video::IVideoDriver *m_video_driver;
public:
RTTProvider(const core::dimension2du &dimension,
const std::string &name, bool persistent_texture);
~RTTProvider();
/**
* \brief Quick utility method to setup a scene from a plain list
* of models
*
* Sets up a given vector of meshes for render-to-texture. Ideal to
* embed a 3D object inside the GUI. If there are multiple meshes,
* the first mesh is considered to be the root, and all following
* meshes will have their locations relative to the location of the
* first mesh.
*
* \param mesh The list of meshes to add to the scene
* \param mesh_location Location of each fo these meshes
* \param model_frames For animated meshes, which frame to use
* (value can be -1 to set none)
* When frame is not -1, the corresponding
* IMesh must be an IAnimatedMesh.
* \pre The 3 vectors have the same size.
*/
void setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
AlignedArray<Vec3>& mesh_location,
AlignedArray<Vec3>& mesh_scale,
const std::vector<int>& model_frames);
/** Optional 'angle' parameter will rotate the object added
* *through setupRTTScene* */
video::ITexture* renderToTexture(float angle=-1,
bool is_2d_render=false);
void tearDownRTTScene();
};
}; // IrrDriver
extern IrrDriver *irr_driver;
#endif // HEADER_IRR_DRIVER_HPP