|
SuperTuxKart
|
class that creates the irrLicht device and offers higher-level ways to manage the 3D scene More...
#include <irr_driver.hpp>

Classes | |
| struct | BloomData |
| class | VideoMode |
| A simple class to store video resolutions. More... | |
Public Member Functions | |
| video::SColorf | getAmbientLight () const |
| void | doScreenShot () |
| Requess a screenshot from irrlicht, and save it in a file. | |
| IrrDriver () | |
| The constructor creates the irrlicht device. More... | |
| ~IrrDriver () | |
| Destructor - removes the irrlicht device. | |
| void | initDevice () |
| This creates the actualy OpenGL device. More... | |
| void | reset () |
| Called before a race is started, after all cameras are set up. | |
| void | setMaxTextureSize () |
| void | unsetMaxTextureSize () |
| void | getOpenGLData (std::string *vendor, std::string *renderer, std::string *version) |
| void | increaseObjectCount () |
| core::array< video::IRenderTarget > & | getMainSetup () |
| void | updateConfigIfRelevant () |
| If the position of the window should be remembered, store it in the config file. More... | |
| core::recti | getSplitscreenWindow (int window_num) |
| void | setAllMaterialFlags (scene::IMesh *mesh) const |
| Sets the material flags in this mesh depending on the settings in material_manager. More... | |
| scene::IAnimatedMesh * | getAnimatedMesh (const std::string &name) |
| Loads an animated mesh and returns a pointer to it. More... | |
| scene::IMesh * | getMesh (const std::string &name) |
| Loads a non-animated mesh and returns a pointer to it. More... | |
| void | displayFPS () |
| Displays the FPS on the screen. | |
| void | displayStoryModeTimer () |
| Displays the timer for Story Mode on the screen. More... | |
| bool | OnEvent (const irr::SEvent &event) |
| This is not really used to process events, it's only used to shut down irrLicht's chatty logging until the event handler is ready to take the task. | |
| void | setAmbientLight (const video::SColorf &light, bool force_SH_computation=true) |
| Sets the ambient light. More... | |
| video::ITexture * | getTexture (FileManager::AssetType type, const std::string &filename) |
| Loads a texture from a file and returns the texture object. More... | |
| video::ITexture * | getTexture (const std::string &filename) |
| Loads a texture from a file and returns the texture object. More... | |
| void | grabAllTextures (const scene::IMesh *mesh) |
| Appends a pointer to each texture used in this mesh to the vector. More... | |
| void | dropAllTextures (const scene::IMesh *mesh) |
| Appends a pointer to each texture used in this mesh to the vector. More... | |
| scene::IMesh * | createQuadMesh (const video::SMaterial *material=NULL, bool create_one_quad=false) |
| Creates a quad mesh with a given material. More... | |
| scene::IMesh * | createTexturedQuadMesh (const video::SMaterial *material, const double w, const double h) |
| Creates a quad mesh buffer with a given width and height (z coordinate is 0). More... | |
| scene::ISceneNode * | addWaterNode (scene::IMesh *mesh, scene::IMesh **welded, float wave_height, float wave_speed, float wave_length) |
| Converts the mesh into a water scene node. More... | |
| scene::IMeshSceneNode * | addOctTree (scene::IMesh *mesh) |
| Adds a mesh that will be optimised using an oct tree. More... | |
| scene::ISceneNode * | addSphere (float radius, const video::SColor &color=video::SColor(128, 255, 255, 255)) |
| Adds a sphere with a given radius and color. More... | |
| scene::ISceneNode * | addMesh (scene::IMesh *mesh, const std::string &debug_name, scene::ISceneNode *parent=NULL, std::shared_ptr< GE::GERenderInfo > render_info=nullptr) |
| Adds a static mesh to scene. More... | |
| PerCameraNode * | addPerCameraNode (scene::ISceneNode *node, scene::ICameraSceneNode *cam, scene::ISceneNode *parent=NULL) |
| scene::ISceneNode * | addBillboard (const core::dimension2d< f32 > size, const std::string &tex_name, scene::ISceneNode *parent=NULL) |
| Adds a billboard node to scene. | |
| scene::IParticleSystemSceneNode * | addParticleNode (bool default_emitter=true) |
| Adds a particle scene node. | |
| scene::ISceneNode * | addSkyBox (const std::vector< video::ITexture * > &texture_names, const std::vector< video::ITexture * > &spherical_harmonics_textures) |
| Adds a skybox using. More... | |
| void | suppressSkyBox () |
| void | removeNode (scene::ISceneNode *node) |
| Removes a scene node from the scene. More... | |
| void | removeMeshFromCache (scene::IMesh *mesh) |
| Removes a mesh from the mesh cache, freeing the memory. More... | |
| void | removeTexture (video::ITexture *t) |
| Removes a texture from irrlicht's texture cache. More... | |
| scene::IAnimatedMeshSceneNode * | addAnimatedMesh (scene::IAnimatedMesh *mesh, const std::string &debug_name, scene::ISceneNode *parent=NULL, std::shared_ptr< GE::GERenderInfo > render_info=nullptr) |
| Adds an animated mesh to the scene. More... | |
| scene::ICameraSceneNode * | addCameraSceneNode () |
| Adds a camera to the scene. | |
| Camera * | addCamera (unsigned int index, AbstractKart *kart) |
| void | removeCameraSceneNode (scene::ICameraSceneNode *camera) |
| Removes a camera. More... | |
| void | removeCamera (Camera *camera) |
| void | update (float dt, bool loading=false) |
| Update, called once per frame. More... | |
| void | changeResolution (const int w, const int h, const bool fullscreen) |
| Call to change resolution. | |
| void | cancelResChange () |
| Call this to roll back to the previous resolution if a resolution switch attempt goes bad. | |
| bool | moveWindow (int x, int y) |
| Moves the STK main window to coordinates (x,y) More... | |
| void | showPointer () |
| void | hidePointer () |
| void | setLastLightBucketDistance (unsigned d) |
| void | setSkinningJoint (unsigned d) |
| bool | isPointerShown () const |
| core::position2di | getMouseLocation () |
| void | printRenderStats () |
| Prints statistics about rendering, e.g. More... | |
| void | requestScreenshot () |
| class GPUTimer & | getGPUTimer (unsigned) |
| const char * | getGPUQueryPhaseName (unsigned) |
| std::unique_ptr< RenderTarget > | createRenderTarget (const irr::core::dimension2du &dimension, const std::string &name) |
| const irr::video::SColor & | getClearColor () const |
| Returns the color to clear the back buffer. | |
| void | setClearbackBufferColor (irr::video::SColor color) |
| Sets the color to use when clearing the back buffer. | |
| const std::vector< VideoMode > & | getVideoModes () const |
| Returns a list of all video modes supports by the graphics card. | |
| const core::dimension2d< u32 > & | getFrameSize () const |
| Returns the frame size. | |
| IrrlichtDevice * | getDevice () const |
| Returns the irrlicht device. | |
| video::IVideoDriver * | getVideoDriver () const |
| Returns the irrlicht video driver. | |
| scene::ISceneManager * | getSceneManager () const |
| Returns the irrlicht scene manager. | |
| gui::IGUIEnvironment * | getGUI () const |
| Returns the gui environment, used to add widgets to a screen. | |
| unsigned int | getRealTime () |
| Returns the current real time, which might not be 0 at start of the application. More... | |
| void | giveBoost (unsigned int cam_index) |
| Use motion blur for a short time. | |
| core::vector3df | getWind () |
| const SHCoefficients * | getSHCoefficients () |
| Returns a pointer to the spherical harmonics coefficients. | |
| const core::vector3df & | getSunDirection () const |
| void | setSunDirection (const core::vector3df &SunPos) |
| video::SColorf | getSunColor () const |
| void | setSunColor (const video::SColorf &col) |
| GLuint | getRenderTargetTexture (TypeRTT which) |
| GLuint | getDepthStencilTexture () |
| void | resetDebugModes () |
| void | toggleSSAOViz () |
| bool | getSSAOViz () |
| void | toggleShadowViz () |
| bool | getShadowViz () |
| void | toggleBoundingBoxesViz () |
| void | toggleRenderNetworkDebug () |
| bool | getRenderNetworkDebug () const |
| void | renderNetworkDebug () |
| bool | getBoundingBoxesViz () |
| int | getSceneComplexity () |
| void | resetSceneComplexity () |
| void | addSceneComplexity (int complexity) |
| float | getLODMultiplier () |
| void | setLODMultiplier (float multiplier) |
| bool | isRecording () const |
| void | setRecording (bool val) |
| std::vector< LightNode * > | getLights () |
| void | addGlowingNode (scene::ISceneNode *n, float r=1.0f, float g=1.0f, float b=1.0f) |
| void | clearGlowingNodes () |
| void | addForcedBloomNode (scene::ISceneNode *n, float power=1) |
| void | clearForcedBloom () |
| const std::vector< BloomData > & | getForcedBloom () const |
| void | clearBackgroundNodes () |
| void | addBackgroundNode (scene::ISceneNode *const n) |
| scene::ISceneNode * | addLight (const core::vector3df &pos, float energy, float radius, float r, float g, float b, bool sun_=false, scene::ISceneNode *parent=NULL) |
| void | clearLights () |
| SP::SPDynamicDrawCall * | getSunInterposer () |
| void | cleanSunInterposer () |
| void | createSunInterposer () |
| void | setViewMatrix (core::matrix4 matrix) |
| const core::matrix4 & | getViewMatrix () const |
| const core::matrix4 & | getInvViewMatrix () const |
| void | setProjMatrix (core::matrix4 matrix) |
| const core::matrix4 & | getProjMatrix () const |
| const core::matrix4 & | getInvProjMatrix () const |
| void | genProjViewMatrix () |
| const core::matrix4 & | getProjViewMatrix () const |
| const core::matrix4 & | getInvProjViewMatrix () const |
| const core::vector2df & | getCurrentScreenSize () const |
| const core::dimension2du | getActualScreenSize () const |
| float | getSSAORadius () const |
| void | setSSAORadius (float v) |
| float | getSSAOK () const |
| void | setSSAOK (float v) |
| float | getSSAOSigma () const |
| void | setSSAOSigma (float v) |
| void | onLoadWorld () |
| void | onUnloadWorld () |
| void | updateSplitAndLightcoordRangeFromComputeShaders (size_t width, size_t height) |
| void | uploadLightingData () |
| void | sameRestart () |
| void | fullRestart () |
| Used when we don't want a changed resolution prompt but need to reinit things that sameRestart doesn't affect. | |
| u32 | getDefaultFramebuffer () const |
| void | handleWindowResize () |
Private Types | |
| enum | { RES_CHANGE_NONE , RES_CHANGE_YES , RES_CHANGE_CANCEL , RES_CHANGE_SAME , RES_CHANGE_YES_WARN , RES_CHANGE_SAME_FULL } |
| Flag to indicate if a resolution change is pending (which will be acted upon in the next update). More... | |
Private Member Functions | |
| void | setupViewports () |
| void | applyResolutionSettings (bool recreate_device) |
| Internal method that applies the resolution in user settings. | |
| void | createListOfVideoModes () |
| Gets a list of supported video modes from the irrlicht device. More... | |
| void | updateDisplace (float dt) |
| void | resizeWindow () |
Private Attributes | |
| IrrlichtDevice * | m_device |
| The irrlicht device. | |
| scene::ISceneManager * | m_scene_manager |
| Irrlicht scene manager. | |
| gui::IGUIEnvironment * | m_gui_env |
| Irrlicht gui environment. | |
| video::IVideoDriver * | m_video_driver |
| Irrlicht video driver. | |
| gui::IGUIFont * | m_race_font |
| Irrlicht race font. | |
| AbstractRenderer * | m_renderer |
| Renderer. | |
| Wind * | m_wind |
| Wind. | |
| core::dimension2du | m_actual_screen_size |
| core::array< video::IRenderTarget > | m_mrt |
| The main MRT setup. | |
| core::matrix4 | m_ViewMatrix |
| Matrixes used in several places stored here to avoid recomputation. | |
| core::matrix4 | m_InvViewMatrix |
| core::matrix4 | m_ProjMatrix |
| core::matrix4 | m_InvProjMatrix |
| core::matrix4 | m_ProjViewMatrix |
| core::matrix4 | m_InvProjViewMatrix |
| enum IrrDriver:: { ... } | m_resolution_changing |
| Flag to indicate if a resolution change is pending (which will be acted upon in the next update). More... | |
| int | m_screen_orientation |
| std::vector< VideoMode > | m_modes |
| bool | m_pointer_shown |
| Whether the mouse cursor is currently shown. | |
| int | m_scene_complexity |
| Store if the scene is complex (based on polycount, etc) | |
| float | m_lod_multiplier |
| Used for auto-LoD adjustment in low-complexity scenes. | |
| bool | m_request_screenshot |
| bool | m_ssaoviz |
| bool | m_shadowviz |
| bool | m_lightviz |
| bool | m_boundingboxesviz |
| bool | m_recording |
| bool | m_render_nw_debug |
| irr::video::SColor | m_clear_color |
| Background colour to reset a buffer. More... | |
| unsigned | m_last_light_bucket_distance |
| unsigned | m_skinning_joint |
| SP::SPDynamicDrawCall * | m_sun_interposer |
| core::vector3df | m_sun_direction |
| video::SColorf | m_suncolor |
| std::vector< LightNode * > | m_lights |
| std::vector< BloomData > | m_forcedbloom |
| std::vector< scene::ISceneNode * > | m_background |
| float | m_ssao_radius |
| float | m_ssao_k |
| float | m_ssao_sigma |
| irr::ELOG_LEVEL | m_logger_level |
class that creates the irrLicht device and offers higher-level ways to manage the 3D scene
|
private |
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. Yes_warn means that the new resolution is unsupported and that the confirmation dialog needs an additional warning message. Same indicates a change of the resolution (back to the original one), but no confirmation dialog.
| IrrDriver::IrrDriver | ( | ) |
The constructor creates the irrlicht device.
It first creates a NULL device. This is necessary to handle the Chicken/egg problem with irrlicht: access to the file system is given from the device, but we can't create the device before reading the user_config file (for resolution, fullscreen). So we create a dummy device here to begin with, which is then later (once the real device exists) changed in initDevice().
| scene::IAnimatedMeshSceneNode * IrrDriver::addAnimatedMesh | ( | scene::IAnimatedMesh * | mesh, |
| const std::string & | debug_name, | ||
| scene::ISceneNode * | parent = NULL, |
||
| std::shared_ptr< GE::GERenderInfo > | render_info = nullptr |
||
| ) |
Adds an animated mesh to the scene.
| mesh | The animated mesh to add. |
| scene::ISceneNode * IrrDriver::addMesh | ( | scene::IMesh * | mesh, |
| const std::string & | debug_name, | ||
| scene::ISceneNode * | parent = NULL, |
||
| std::shared_ptr< GE::GERenderInfo > | render_info = nullptr |
||
| ) |
Adds a static mesh to scene.
This should be used for smaller objects, since the node is not optimised.
| mesh | The mesh to add. |
| scene::IMeshSceneNode * IrrDriver::addOctTree | ( | scene::IMesh * | mesh | ) |
Adds a mesh that will be optimised using an oct tree.
| mesh | Mesh to add. |
| scene::ISceneNode * IrrDriver::addSkyBox | ( | const std::vector< video::ITexture * > & | texture, |
| const std::vector< video::ITexture * > & | spherical_harmonics_textures | ||
| ) |
Adds a skybox using.
Irrlicht documentation: A skybox is a big cube with 6 textures on it and is drawn around the camera position.
| top | Texture for the top plane of the box. |
| bottom | Texture for the bottom plane of the box. |
| left | Texture for the left plane of the box. |
| right | Texture for the right plane of the box. |
| front | Texture for the front plane of the box. |
| back | Texture for the back plane of the box. |
| scene::ISceneNode * IrrDriver::addSphere | ( | float | radius, |
| const video::SColor & | color = video::SColor(128, 255, 255, 255) |
||
| ) |
Adds a sphere with a given radius and color.
| radius | The radius of the sphere. |
| color | The color to use (default (0,0,0,0) |
| scene::ISceneNode * IrrDriver::addWaterNode | ( | scene::IMesh * | mesh, |
| scene::IMesh ** | welded, | ||
| float | wave_height, | ||
| float | wave_speed, | ||
| float | wave_length | ||
| ) |
Converts the mesh into a water scene node.
| mesh | The mesh which is converted into a water scene node. |
| wave_height | Height of the water waves. |
| wave_speed | Speed of the water waves. |
| wave_length | Lenght of a water wave. |
|
private |
Gets a list of supported video modes from the irrlicht device.
This data is stored in m_modes.
| scene::IMesh * IrrDriver::createQuadMesh | ( | const video::SMaterial * | material = NULL, |
| bool | create_one_quad = false |
||
| ) |
Creates a quad mesh with a given material.
| material | The material to use (NULL if no material). |
| create_one_quad | If true creates one quad in the mesh. |
| scene::IMesh * IrrDriver::createTexturedQuadMesh | ( | const video::SMaterial * | material, |
| const double | w, | ||
| const double | h | ||
| ) |
Creates a quad mesh buffer with a given width and height (z coordinate is 0).
| material | The material to use for this quad. |
| w | Width of the quad. |
| h | Height of the quad. |
| void IrrDriver::displayStoryModeTimer | ( | ) |
Displays the timer for Story Mode on the screen.
This can't be done in race or overworld GUIs as the speedrun timer has to be displayed on all screens.
| void IrrDriver::dropAllTextures | ( | const scene::IMesh * | mesh | ) |
Appends a pointer to each texture used in this mesh to the vector.
| mesh | The mesh from which the textures are being determined. |
| texture_list | The list to which to attach the pointer to. |
| scene::IAnimatedMesh * IrrDriver::getAnimatedMesh | ( | const std::string & | filename | ) |
Loads an animated mesh and returns a pointer to it.
| filename | File to load. |
| scene::IMesh * IrrDriver::getMesh | ( | const std::string & | filename | ) |
Loads a non-animated mesh and returns a pointer to it.
| filename | File to load. |
| unsigned int IrrDriver::getRealTime | ( | ) |
Returns the current real time, which might not be 0 at start of the application.
Value in msec.
| video::ITexture * IrrDriver::getTexture | ( | const std::string & | filename | ) |
Loads a texture from a file and returns the texture object.
| filename | File name of the texture to load. |
| video::ITexture * IrrDriver::getTexture | ( | FileManager::AssetType | type, |
| const std::string & | filename | ||
| ) |
Loads a texture from a file and returns the texture object.
This is just a convenient wrapper which loads the texture from a STK asset directory. It calls the file manager to get the full path, then calls the normal getTexture() function.s
| type | The FileManager::AssetType of the texture. |
| filename | File name of the texture to load. |
| void IrrDriver::grabAllTextures | ( | const scene::IMesh * | mesh | ) |
Appends a pointer to each texture used in this mesh to the vector.
| mesh | The mesh from which the textures are being determined. |
| texture_list | The list to which to attach the pointer to. |
| void IrrDriver::initDevice | ( | ) |
This creates the actualy OpenGL device.
This is called
| bool IrrDriver::moveWindow | ( | int | x, |
| int | y | ||
| ) |
Moves the STK main window to coordinates (x,y)
| void IrrDriver::printRenderStats | ( | ) |
Prints statistics about rendering, e.g.
number of drawn and culled triangles etc. Note that printing this information will also slow down STK.
| void IrrDriver::removeCameraSceneNode | ( | scene::ICameraSceneNode * | camera | ) |
Removes a camera.
This can't be done with removeNode() since the camera can be marked as active, meaning a drop will not delete it. While this doesn't really cause a memory leak (the camera is removed the next time a camera is added), it's a bit cleaner and easier to check for memory leaks, since the scene root should now always be empty.
| void IrrDriver::removeMeshFromCache | ( | scene::IMesh * | mesh | ) |
Removes a mesh from the mesh cache, freeing the memory.
| mesh | The mesh to remove. |
| void IrrDriver::removeNode | ( | scene::ISceneNode * | node | ) |
Removes a scene node from the scene.
| node | The scene node to remove. |
| void IrrDriver::removeTexture | ( | video::ITexture * | t | ) |
Removes a texture from irrlicht's texture cache.
| t | The texture to remove. |
| void IrrDriver::setAllMaterialFlags | ( | scene::IMesh * | mesh | ) | const |
Sets the material flags in this mesh depending on the settings in material_manager.
| mesh | The mesh to change the settings in. |
| void IrrDriver::setAmbientLight | ( | const video::SColorf & | light, |
| bool | force_SH_computation = true |
||
| ) |
Sets the ambient light.
| light | The colour of the light to set. |
| force_SH_computation | If false, do not recompute spherical harmonics coefficient when spherical harmonics textures have been defined |
| void IrrDriver::update | ( | float | dt, |
| bool | is_loading = false |
||
| ) |
Update, called once per frame.
| dt | Time since last update |
| is_loading | True if the rendering is called during loading of world, in which case world, physics etc must not be accessed/ |
| void IrrDriver::updateConfigIfRelevant | ( | ) |
If the position of the window should be remembered, store it in the config file.
|
private |
Background colour to reset a buffer.
Can be changed by each track.
| enum { ... } IrrDriver::m_resolution_changing |
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. Yes_warn means that the new resolution is unsupported and that the confirmation dialog needs an additional warning message. Same indicates a change of the resolution (back to the original one), but no confirmation dialog.