SuperTuxKart
Loading...
Searching...
No Matches
track.hpp
1// SuperTuxKart - a fun racing game with go-kart
2//
3// Copyright (C) 2004-2015 Steve Baker <sjbaker1@airmail.net>
4// Copyright (C) 2009-2015 Joerg Henrichs, Steve Baker
5//
6// This program is free software; you can redistribute it and/or
7// modify it under the terms of the GNU General Public License
8// as published by the Free Software Foundation; either version 3
9// of the License, or (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20#ifndef HEADER_TRACK_HPP
21#define HEADER_TRACK_HPP
22
29#include <algorithm>
30#include <atomic>
31#include <memory>
32#include <string>
33#include <vector>
34
35#include <irrString.h>
36#include <rect.h>
37#include <SColor.h>
38
39namespace irr
40{
41 namespace scene
42 {
43 class IMesh; class ISceneNode;
44 }
45 namespace video
46 {
47 class IImage; class ITexture;
48 }
49}
50
51using namespace irr;
52
53#include "LinearMath/btTransform.h"
54
55#include "utils/aligned_array.hpp"
56#include "utils/log.hpp"
57#include "utils/vec3.hpp"
58#include "utils/stk_process.hpp"
59
60class AbstractKart;
61class AnimationManager;
62class BezierCurve;
63class CheckManager;
64class ItemManager;
66class MovingTexture;
68class ParticleEmitter;
69class ParticleKind;
70class PhysicalObject;
71class RenderTarget;
72class TrackObject;
74class TriangleMesh;
75class XMLNode;
76
77const int HEIGHT_MAP_RESOLUTION = 256;
78
79// TODO: eventually remove this and fully replace with scripting
81{
82public:
83 core::vector3df m_position;
84 std::string m_challenge_id;
85
86 OverworldChallenge(core::vector3df position, std::string challenge_id)
87 {
88 m_position = position;
89 m_challenge_id = challenge_id;
90 }
91};
92
93
95{
96 int m_from, m_to;
97 core::stringw m_text;
98
99 Subtitle(int from, int to, core::stringw text)
100 {
101 m_from = from;
102 m_to = to;
103 m_text = text;
104 }
105 int getFrom() const { return m_from; }
106 int getTo() const { return m_to; }
107 const core::stringw& getText() const { return m_text; }
108};
109
113class Track
114{
115private:
116
119 static std::atomic<Track*> m_current_track[PT_COUNT];
120
121#ifdef DEBUG
122 unsigned int m_magic_number;
123#endif
124
125 /* Gravity to be used for this track. */
126 float m_gravity;
127
130
131 std::string m_ident;
132 std::string m_screenshot;
133 bool m_is_day;
134 std::vector<MusicInformation*> m_music;
135 unsigned m_music_idx;
136
138 std::vector<OverworldChallenge> m_challenges;
139
140 std::vector<Subtitle> m_subtitles;
141
144 AlignedArray<btTransform> m_start_transforms;
145
146 std::string m_item_style;
147 std::string m_description;
148 core::stringw m_designer;
149
150 /* For running the startup script */
151 bool m_startup_run;
153 std::string m_filename;
154
156 std::string m_root;
157 std::vector<std::string> m_groups;
158
160 std::vector<scene::ISceneNode*> m_all_nodes;
161
164 std::vector<scene::ISceneNode*> m_static_physics_only_nodes;
165
169 std::vector<scene::ISceneNode*> m_object_physics_only_nodes;
170
173 std::vector<scene::IMesh*> m_all_cached_meshes;
174
179 std::vector<scene::IMesh*> m_detached_cached_meshes;
180
183 std::vector<video::ITexture*> m_all_cached_textures;
184
188
192
193
194#ifdef DEBUG
199 std::vector<video::ITexture*> m_old_textures;
200
205 std::vector<std::string> m_old_mesh_buffers;
206#endif
207
208 scene::ISceneNode *m_sun;
224 btTransform m_red_flag;
225 btTransform m_blue_flag;
228 bool m_is_ctf;
237
238 bool m_is_cutscene;
239
243
246
251
254
258
264
266 enum {SKY_NONE, SKY_BOX,
267 SKY_COLOR} m_sky_type;
268
270 float m_sky_dx, m_sky_dy;
271
274 std::vector<void*> m_sky_textures;
275
276 std::vector<void*> m_spherical_harmonics_textures;
277
279 irr::video::SColor m_sky_color;
280
282 std::vector<MovingTexture*> m_animated_textures;
283
286
290
294
297
300
303
306 std::string m_weather_sound;
307
310 {
311 public:
312 std::string m_name;
313 std::string m_quad_name;
314 std::string m_graph_name;
315 std::string m_scene;
317#ifdef DEBUG
318 unsigned int m_magic_number;
319#endif
320
322 TrackMode() : m_name("default"), m_quad_name("quads.xml"),
323 m_graph_name("graph.xml"), m_scene("scene.xml")
324 {
325#ifdef DEBUG
326 m_magic_number = 0x46825179;
327#endif
328 }
329
330 ~TrackMode()
331 {
332#ifdef DEBUG
333 assert(m_magic_number == 0x46825179);
334 m_magic_number = 0xDEADBEEF;
335#endif
336 }
337
338 }; // TrackMode
339
341 std::vector<TrackMode> m_all_modes;
342
344 std::string m_name;
345
347 core::stringw m_sort_name;
348
351
354
357
358 bool m_is_addon;
359
360 float m_fog_max;
361 float m_fog_start;
362 float m_fog_end;
363 float m_fog_height_start;
364 float m_fog_height_end;
365 core::vector3df m_sun_position;
367 video::SColor m_ambient_color;
368 video::SColor m_default_ambient_color;
369 video::SColor m_sun_specular_color;
370 video::SColor m_sun_diffuse_color;
371 video::SColor m_fog_color;
372
375 CheckManager* m_check_manager;
376 std::shared_ptr<ItemManager> m_item_manager;
377 float m_minimap_x_scale;
378 float m_minimap_y_scale;
379
380 bool m_bloom;
381 float m_bloom_threshold;
382
383 bool m_godrays;
384 core::vector3df m_godrays_position;
385 float m_godrays_opacity;
386 video::SColor m_godrays_color;
387
388 bool m_shadows;
389
390 float m_displacement_speed;
391 int m_physical_object_uid;
392
393 bool m_minimap_invert_x_z;
394
398 core::vector3df m_color_inlevel;
399 core::vector2df m_color_outlevel;
400
402 std::vector<BezierCurve*> m_all_curves;
403
404 std::vector<std::pair<TrackObject*, TrackObject*> > m_meta_library;
405
409
412
413 void loadTrackInfo();
414 void loadDriveGraph(unsigned int mode_id, const bool reverse);
415 void loadArenaGraph(const XMLNode &node);
416 btQuaternion getArenaStartRotation(const Vec3& xyz, float heading);
417 bool loadMainTrack(const XMLNode &node);
418 void loadMinimap();
419 void createWater(const XMLNode &node);
420 void getMusicInformation(std::vector<std::string>& filenames,
421 std::vector<MusicInformation*>& m_music );
422 void loadCurves(const XMLNode &node);
423 void handleSky(const XMLNode &root, const std::string &filename);
424 void freeCachedMeshVertexBuffer();
425 void copyFromMainProcess();
426 video::IImage* getSkyTexture(std::string path) const;
427public:
428
432 {
433 ProcessType type = STKProcess::getType();
434 return m_current_track[type];
435 }
436 // ------------------------------------------------------------------------
437 Track* clone()
438 {
439 Track* child_track = new Track(*this);
440 child_track->copyFromMainProcess();
441 return child_track;
442 }
443 // ------------------------------------------------------------------------
444 void initChildTrack();
445 // ------------------------------------------------------------------------
446 static void cleanChildTrack();
447 // ------------------------------------------------------------------------
448 void handleAnimatedTextures(scene::ISceneNode *node, const XMLNode &xml);
449
454
456 static void uploadNodeVertexBuffer(scene::ISceneNode *node);
457
458 static const float NOHIT;
459
460 Track (const std::string &filename);
461 ~Track ();
462 void cleanup ();
463 void removeCachedData ();
464 void startMusic () const;
465
466 void createPhysicsModel(unsigned int main_track_count,
467 bool for_height_map);
468 void updateGraphics(float dt);
469 void update(int ticks);
470 void reset();
471 void itemCommand(const XMLNode *node);
472 Vec3 flagCommand(const XMLNode *node);
473 //-----------------------------------------------------------------------------
474 core::stringw getName() const;
475 //-----------------------------------------------------------------------------
476 core::stringw getSortName() const;
477 bool isInGroup(const std::string &group_name);
478 const core::vector3df& getSunRotation();
480 void setAmbientColor(const video::SColor &color,
481 unsigned int k);
482 void handleExplosion(const Vec3 &pos,
483 const PhysicalObject *mp,
484 bool secondary_hits=true) const;
485 void loadTrackModel (bool reverse_track = false,
486 unsigned int mode_id=0);
487 bool findGround(AbstractKart *kart);
488
489 std::vector< std::vector<float> > buildHeightMap();
490 void drawMiniMap(const core::rect<s32>& dest_rect) const;
491 void updateMiniMapScale();
492 // ------------------------------------------------------------------------
494 bool isArena() const { return m_is_arena; }
495 // ------------------------------------------------------------------------
496 bool isCTF() const { return m_is_ctf; }
497 // ------------------------------------------------------------------------
500 bool isRaceTrack() const
501 {
502 return !m_internal && !m_is_arena && !m_is_soccer;
503 } // isRaceTrack
504 // ------------------------------------------------------------------------
506 bool hasEasterEggs() const { return m_has_easter_eggs; }
507 // ------------------------------------------------------------------------
509 bool reverseAvailable() const { return m_reverse_available; }
510 // ------------------------------------------------------------------------
512 bool hasNavMesh() const { return m_has_navmesh; }
513 // ------------------------------------------------------------------------
514 void loadObjects(const XMLNode* root, const std::string& path,
515 ModelDefinitionLoader& lod_loader, bool create_lod_definitions,
516 scene::ISceneNode* parent, TrackObject* parent_library);
517 // ------------------------------------------------------------------------
518 bool isSoccer () const { return m_is_soccer; }
519 // ------------------------------------------------------------------------
520 void addMusic (MusicInformation* mi)
521 {m_music.push_back(mi); }
522 // ------------------------------------------------------------------------
523 float getGravity () const {return m_gravity; }
524 // ------------------------------------------------------------------------
526 int getVersion () const {return m_version; }
527 // ------------------------------------------------------------------------
529 float getTrackLength () const;
530 // ------------------------------------------------------------------------
532 const std::string& getIdent () const {return m_ident; }
533 // ------------------------------------------------------------------------
535 const std::vector<std::string>&
536 getGroups () const {return m_groups; }
537 // ------------------------------------------------------------------------
539 const std::string& getFilename () const {return m_filename; }
540 // ------------------------------------------------------------------------
542 const core::stringw& getDesigner () const {return m_designer; }
543 // ------------------------------------------------------------------------
545 const std::string& getScreenshotFile () const {return m_screenshot; }
546 // ------------------------------------------------------------------------
548 const bool getIsDuringDay () const {return m_is_day; }
549 // ------------------------------------------------------------------------
551 const bool getMinimapInvert () const {return m_minimap_invert_x_z; }
552 // ------------------------------------------------------------------------
555 const btTransform& getStartTransform (unsigned int index) const
556 {
557 if (index >= m_start_transforms.size())
558 Log::fatal("Track", "No start position for kart %i.", index);
559 return m_start_transforms[index];
560 }
561 // ------------------------------------------------------------------------
565 {
566 std::random_shuffle(m_start_transforms.begin(), m_start_transforms.end());
567 }
568 // ------------------------------------------------------------------------
570 void getAABB(const Vec3 **min, const Vec3 **max) const
571 { *min = &m_aabb_min; *max = &m_aabb_max; }
572 // ------------------------------------------------------------------------
579 float getAngle(int n) const;
580 // ------------------------------------------------------------------------
587 void mapPoint2MiniMap(const Vec3 &xyz, Vec3 *draw_at) const;
588 // ------------------------------------------------------------------------
590 std::string getTrackFile(const std::string &s) const
591 { return m_root+"/"+s; }
592 // ------------------------------------------------------------------------
594 unsigned int getNumberOfModes() const { return (unsigned int) m_all_modes.size(); }
595 // ------------------------------------------------------------------------
597 unsigned int getNumOfCompletedChallenges();
598 // ------------------------------------------------------------------------
600 const std::string &getModeName(unsigned int i) const
601 { return m_all_modes[i].m_name; }
602 // ------------------------------------------------------------------------
604 const video::SColor &getDefaultAmbientColor() const
605 { return m_default_ambient_color; }
606 // ------------------------------------------------------------------------
608 float getCameraFar() const { return m_camera_far; }
609 // ------------------------------------------------------------------------
611 const TriangleMesh *getPtrTriangleMesh() const { return m_track_mesh; }
612 const TriangleMesh& getTriangleMesh() const {return *m_track_mesh; }
613 // ------------------------------------------------------------------------
615 const TriangleMesh& getGFXEffectMesh() const {return *m_gfx_effect_mesh;}
616 // ------------------------------------------------------------------------
618 unsigned int getMaxArenaPlayers() const
619 { return m_max_arena_players; }
620 // ------------------------------------------------------------------------
622 unsigned int getNumberOfStartPositions() const
623 { return (unsigned int)m_start_transforms.size(); }
624 // ------------------------------------------------------------------------
625 bool getWeatherLightning() {return m_weather_lightning;}
626 // ------------------------------------------------------------------------
627 const std::string& getWeatherSound() {return m_weather_sound;}
628 // ------------------------------------------------------------------------
629 ParticleKind* getSkyParticles () { return m_sky_particles; }
630 // ------------------------------------------------------------------------
632 void forceFogDisabled(bool v) { m_force_disable_fog = v; }
633 //-------------------------------------------------------------------------
636 bool isFogEnabled() const
637 {
638 return !m_force_disable_fog && m_use_fog;
639 } // isFogEnabled
640
641 // ------------------------------------------------------------------------
642 float getFogStart() const { return m_fog_start; }
643 // ------------------------------------------------------------------------
644 void setFogStart(float start) { m_fog_start = start; }
645 // ------------------------------------------------------------------------
646 float getFogEnd() const { return m_fog_end; }
647 // ------------------------------------------------------------------------
648 void setFogEnd(float end) { m_fog_end = end; }
649 // ------------------------------------------------------------------------
650 float getFogStartHeight() const { return m_fog_height_start; }
651 // ------------------------------------------------------------------------
652 float getFogEndHeight() const { return m_fog_height_end; }
653 // ------------------------------------------------------------------------
654 float getFogMax() const { return m_fog_max; }
655 // ------------------------------------------------------------------------
656 void setFogMax(float max) { m_fog_max = max; }
657 // ------------------------------------------------------------------------
658 video::SColor getFogColor() const { return m_fog_color; }
659 // ------------------------------------------------------------------------
660 void setFogColor(video::SColor& color) { m_fog_color = color; }
661 // ------------------------------------------------------------------------
662 video::SColor getSunColor() const { return m_sun_diffuse_color; }
663 // ------------------------------------------------------------------------
666 bool isInternal() const { return m_internal; }
667 // ------------------------------------------------------------------------
669 bool isAutoRescueEnabled() const { return m_enable_auto_rescue; }
670 // ------------------------------------------------------------------------
672 bool isPushBackEnabled() const { return m_enable_push_back; }
673 // ------------------------------------------------------------------------
675 bool smoothNormals() const { return m_smooth_normals; }
676 // ------------------------------------------------------------------------
679 {
680 return m_track_object_manager;
681 } // getTrackObjectManager
682
683 // ------------------------------------------------------------------------
685 const std::vector<OverworldChallenge>& getChallengeList() const
686 { return m_challenges; }
687
688 // ------------------------------------------------------------------------
689 const std::vector<Subtitle>& getSubtitles() const { return m_subtitles; }
690
691 // ------------------------------------------------------------------------
692 bool hasBloom() const { return m_bloom; }
693
694 // ------------------------------------------------------------------------
695 float getBloomThreshold() const { return m_bloom_threshold; }
696
697 // ------------------------------------------------------------------------
699 core::vector3df getColorLevelIn() const { return m_color_inlevel; }
700 // ------------------------------------------------------------------------
701 core::vector2df getColorLevelOut() const { return m_color_outlevel; }
702 // ------------------------------------------------------------------------
703 bool hasGodRays() const { return m_godrays; }
704 // ------------------------------------------------------------------------
705 core::vector3df getGodRaysPosition() const { return m_godrays_position; }
706 // ------------------------------------------------------------------------
707 float getGodRaysOpacity() const { return m_godrays_opacity; }
708 // ------------------------------------------------------------------------
709 video::SColor getGodRaysColor() const { return m_godrays_color; }
710 // ------------------------------------------------------------------------
711 bool hasShadows() const { return m_shadows; }
712 // ------------------------------------------------------------------------
713 void addNode(scene::ISceneNode* node) { m_all_nodes.push_back(node); }
714 // ------------------------------------------------------------------------
715 void addPhysicsOnlyNode(scene::ISceneNode* node)
716 {
717 m_object_physics_only_nodes.push_back(node);
718 }
719 // ------------------------------------------------------------------------
720 float getDisplacementSpeed() const { return m_displacement_speed; }
721 // ------------------------------------------------------------------------
722 int getPhysicalObjectUID() { return m_physical_object_uid++; }
723 // ------------------------------------------------------------------------
724 const int getDefaultNumberOfLaps() const { return m_default_number_of_laps;}
725 // ------------------------------------------------------------------------
726 const int getActualNumberOfLap() const { return m_actual_number_of_laps; }
727 // ------------------------------------------------------------------------
728 void setActualNumberOfLaps(unsigned int laps)
729 { m_actual_number_of_laps = laps; }
730 // ------------------------------------------------------------------------
731 bool operator<(const Track &other) const;
732 // ------------------------------------------------------------------------
734 void addCachedMesh(scene::IMesh* mesh) { m_all_cached_meshes.push_back(mesh); }
735 // ------------------------------------------------------------------------
737 void addMetaLibrary(TrackObject* parent, TrackObject* meta_library)
738 { m_meta_library.emplace_back(parent, meta_library); }
739 // ------------------------------------------------------------------------
740 const btTransform& getRedFlag() const { return m_red_flag; }
741 // ------------------------------------------------------------------------
742 const btTransform& getBlueFlag() const { return m_blue_flag; }
743 // ------------------------------------------------------------------------
744 bool isAddon() const { return m_is_addon; }
745 // ------------------------------------------------------------------------
746 void convertTrackToBullet(scene::ISceneNode *node);
747 // ------------------------------------------------------------------------
748 CheckManager* getCheckManager() const { return m_check_manager; }
749 // ------------------------------------------------------------------------
750 ItemManager* getItemManager() const { return m_item_manager.get(); }
751 // ------------------------------------------------------------------------
752 bool isOnGround(const Vec3& xyz, const Vec3& down, Vec3* hit_point,
753 Vec3* normal, bool print_warning = true);
754 // ------------------------------------------------------------------------
755 MusicInformation* getTrackMusic() const
756 {
757 if (m_music_idx < m_music.size())
758 return m_music[m_music_idx];
759 return NULL;
760 }
761}; // class Track
762
763#endif
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
A class to manage bezier curves and interpolation.
Definition: bezier_curve.hpp:34
Controls all checks structures of a track.
Definition: check_manager.hpp:40
Definition: item_manager.hpp:47
Utility class to load level-of-detail nodes and library nodes.
Definition: model_definition_loader.hpp:81
Handles animated textures (textures that move)
Definition: moving_texture.hpp:34
Wrapper around an instance of the Music interface Adds information like composer, song title,...
Definition: music_information.hpp:43
manages smoke particle effects
Definition: particle_emitter.hpp:42
type of particles
Definition: particle_kind.hpp:42
Definition: physical_object.hpp:40
Definition: render_target.hpp:42
Definition: track_object_manager.hpp:39
This is a base object for any separate object on the track, which might also have a skeletal animatio...
Definition: track_object.hpp:56
A simple class to keep information about a track mode.
Definition: track.hpp:310
std::string m_quad_name
Name of the quad file to use.
Definition: track.hpp:313
std::string m_graph_name
Name of the graph file to use.
Definition: track.hpp:314
TrackMode()
Default constructor, sets default names for all fields.
Definition: track.hpp:322
std::string m_scene
Name of the scene file to use.
Definition: track.hpp:315
std::string m_name
Name / description of this mode.
Definition: track.hpp:312
Definition: track.hpp:114
int getVersion() const
Returns the version of the .track file.
Definition: track.hpp:526
std::vector< scene::IMesh * > m_all_cached_meshes
The list of all meshes that are loaded from disk, which means that those meshes are being cached by i...
Definition: track.hpp:173
std::vector< BezierCurve * > m_all_curves
List of all bezier curves in the track - for e.g.
Definition: track.hpp:402
irr::video::SColor m_sky_color
Used if m_sky_type is SKY_COLOR only.
Definition: track.hpp:279
const std::string & getModeName(unsigned int i) const
Returns the name of the i-th.
Definition: track.hpp:600
void setAmbientColor(const video::SColor &color, unsigned int k)
Sets the current ambient color for a kart with index k.
RenderTarget * m_render_target
The render target for the mini map, which is displayed in the race gui.
Definition: track.hpp:374
void update(int ticks)
Update, called once per physics time step.
Definition: track.cpp:1669
TriangleMesh * m_gfx_effect_mesh
Used to collect the triangles which do not have a physical representation, but are needed for some ra...
Definition: track.hpp:219
void cleanup()
Removes the physical body from the world.
Definition: track.cpp:315
void loadTrackModel(bool reverse_track=false, unsigned int mode_id=0)
This function load the actual scene, i.e.
Definition: track.cpp:1835
void loadDriveGraph(unsigned int mode_id, const bool reverse)
Loads the drive graph, i.e.
Definition: track.cpp:800
void getAABB(const Vec3 **min, const Vec3 **max) const
Sets pointer to the aabb of this track.
Definition: track.hpp:570
void loadCurves(const XMLNode &node)
Loads all curves from the XML node.
Definition: track.cpp:665
void shuffleStartTransforms()
Shuffles the start transformations.
Definition: track.hpp:564
TrackObjectManager * m_track_object_manager
Manager for all track objects.
Definition: track.hpp:285
const std::string & getIdent() const
Returns a unique identifier for this track (the directory name).
Definition: track.hpp:532
int m_actual_number_of_laps
The number of laps that is predefined in a track info dialog.
Definition: track.hpp:411
unsigned int m_max_arena_players
Max players supported by an arena.
Definition: track.hpp:230
core::stringw getSortName() const
Returns the name of the track used to sort the tracks alphabetically.
Definition: track.cpp:243
float m_sky_sphere_percent
If a sky dome is used, percentage of the sphere to be used.
Definition: track.hpp:296
bool reverseAvailable() const
Returns true if this race can be driven in reverse.
Definition: track.hpp:509
static bool m_dont_load_navmesh
Flag to avoid loading navmeshes (useful to speedup debugging: e.g.
Definition: track.hpp:453
TrackObjectManager * getTrackObjectManager() const
Returns the track object manager.
Definition: track.hpp:678
std::vector< scene::ISceneNode * > m_static_physics_only_nodes
The list of all nodes that are to be converted into physics, but not to be drawn (e....
Definition: track.hpp:164
std::string getTrackFile(const std::string &s) const
Returns the full path of a given file inside this track directory.
Definition: track.hpp:590
void addMetaLibrary(TrackObject *parent, TrackObject *meta_library)
Adds the parent of the meta library for correction later.
Definition: track.hpp:737
bool m_force_disable_fog
Can be set to force fog off (e.g.
Definition: track.hpp:353
const core::vector3df & getSunRotation()
Returns the rotation of the sun.
Definition: track.cpp:2805
unsigned int getNumberOfStartPositions() const
Get the number of start positions defined in the scene file.
Definition: track.hpp:622
unsigned int getNumberOfModes() const
Returns the number of modes available for this track.
Definition: track.hpp:594
void updateGraphics(float dt)
This updates all only graphical elements.
Definition: track.cpp:1653
bool m_smooth_normals
True if this track supports using smoothed normals.
Definition: track.hpp:356
bool isPushBackEnabled() const
True if push back of karts towards the track should be enabled.
Definition: track.hpp:672
core::vector3df m_color_inlevel
The levels for color correction m_color_inlevel(black, gamma, white) m_color_outlevel(black,...
Definition: track.hpp:398
void itemCommand(const XMLNode *node)
Handle creation and placement of an item.
Definition: track.cpp:2665
void forceFogDisabled(bool v)
Override track fog value to force disabled.
Definition: track.hpp:632
void startMusic() const
Select and set the music for this track (doesn't actually start it yet).
Definition: track.cpp:726
std::vector< MovingTexture * > m_animated_textures
The list of all animated textures.
Definition: track.hpp:282
bool smoothNormals() const
Returns true if the normals of this track can be smoothed.
Definition: track.hpp:675
bool m_cache_track
True if this track (textures and track data) should be cached.
Definition: track.hpp:191
Vec3 m_aabb_min
Minimum coordinates of this track.
Definition: track.hpp:221
bool isInternal() const
Whether this is an "internal" track.
Definition: track.hpp:666
void convertTrackToBullet(scene::ISceneNode *node)
Convert the graohics track into its physics equivalents.
Definition: track.cpp:943
int m_sky_vert_segments
If a sky dome is used, the number of vertical segments the sphere should be divided in.
Definition: track.hpp:293
bool m_enable_push_back
If true any collision of a kart with the track will push the kart towards the nearest driveline.
Definition: track.hpp:263
std::vector< TrackMode > m_all_modes
List of all modes for a track.
Definition: track.hpp:341
const bool getIsDuringDay() const
Returns if the track is during day time.
Definition: track.hpp:548
std::vector< scene::ISceneNode * > m_object_physics_only_nodes
Same concept but for track objects.
Definition: track.hpp:169
AlignedArray< btTransform > m_start_transforms
Start transforms of karts (either the default, or the ones taken from the scene file).
Definition: track.hpp:144
bool operator<(const Track &other) const
A < comparison of tracks.
Definition: track.cpp:210
TriangleMesh * m_track_mesh
Used to collect the triangles for the bullet mesh.
Definition: track.hpp:210
void getMusicInformation(std::vector< std::string > &filenames, std::vector< MusicInformation * > &m_music)
Loads all music information for the specified files (which is taken from the track....
Definition: track.cpp:681
std::vector< void * > m_sky_textures
A list of the textures for the sky to use.
Definition: track.hpp:274
bool m_reverse_available
Whether this track should be available in reverse version.
Definition: track.hpp:253
float m_sky_dx
sky rotation speed
Definition: track.hpp:270
const video::SColor & getDefaultAmbientColor() const
Returns the default ambient color.
Definition: track.hpp:604
bool m_enable_auto_rescue
If true a player kart will automatically be rescued if it is e.g.
Definition: track.hpp:257
void handleAnimatedTextures(scene::ISceneNode *node, const XMLNode &xml)
Handles animated textures.
Definition: track.cpp:1566
bool m_has_easter_eggs
True if this track has easter eggs.
Definition: track.hpp:232
core::stringw m_sort_name
The name used in sorting the track.
Definition: track.hpp:347
void removeCachedData()
Removes all cached data structures.
Definition: track.cpp:292
const std::string & getFilename() const
Returns the filename of this track.
Definition: track.hpp:539
bool isRaceTrack() const
Returns true if this track is a racing track.
Definition: track.hpp:500
bool m_materials_loaded
True if the materials.xml file is already loaded.
Definition: track.hpp:187
ParticleKind * m_sky_particles
Particles emitted from the sky (wheather)
Definition: track.hpp:302
const core::stringw & getDesigner() const
Returns the name of the designer.
Definition: track.hpp:542
bool m_use_fog
True if the track uses fog.
Definition: track.hpp:350
bool m_internal
Whether this is an "internal" track.
Definition: track.hpp:250
std::vector< video::ITexture * > m_all_cached_textures
A list of all textures loaded by the track, so that they can be removed from the cache at cleanup tim...
Definition: track.hpp:183
void createWater(const XMLNode &node)
Creates a water node.
Definition: track.cpp:1711
std::vector< scene::ISceneNode * > m_all_nodes
The list of all nodes.
Definition: track.hpp:160
bool isInGroup(const std::string &group_name)
Returns true if this track belongs to the specified track group.
Definition: track.cpp:259
int m_default_number_of_laps
The number of laps the track will be raced in a random GP.
Definition: track.hpp:408
bool isArena() const
Returns true if this track has an arena mode.
Definition: track.hpp:494
bool isFogEnabled() const
Returns if fog is currently enabled.
Definition: track.hpp:636
bool m_weather_lightning
Use a special built-in wheather.
Definition: track.hpp:305
const bool getMinimapInvert() const
Returns if invert minimap.
Definition: track.hpp:551
bool m_is_soccer
True if this track is a soccer arena.
Definition: track.hpp:236
std::string m_name
Name of the track to display.
Definition: track.hpp:344
static std::atomic< Track * > m_current_track[PT_COUNT]
If a race is in progress, this stores the active track object.
Definition: track.hpp:119
void reset()
Prepates the track for a new race.
Definition: track.cpp:302
const TriangleMesh & getGFXEffectMesh() const
Returns the graphical effect mesh for this track.
Definition: track.hpp:615
void createPhysicsModel(unsigned int main_track_count, bool for_height_map)
Convert the track tree into its physics equivalents.
Definition: track.cpp:855
void handleExplosion(const Vec3 &pos, const PhysicalObject *mp, bool secondary_hits=true) const
Handles an explosion, i.e.
Definition: track.cpp:1701
const btTransform & getStartTransform(unsigned int index) const
Returns the start coordinates for a kart with a given index.
Definition: track.hpp:555
float m_sky_texture_percent
If a sky dome is used, percentage of the texture to be used.
Definition: track.hpp:299
static Track * getCurrentTrack()
Static function to get the current track.
Definition: track.hpp:431
const std::vector< OverworldChallenge > & getChallengeList() const
Get list of challenges placed on that world.
Definition: track.hpp:685
core::vector3df getColorLevelIn() const
Return the color levels for color correction shader.
Definition: track.hpp:699
unsigned int getMaxArenaPlayers() const
Get the max players supported for this track, for arena only.
Definition: track.hpp:618
bool isAutoRescueEnabled() const
Returns true if auto rescue is enabled.
Definition: track.hpp:669
bool findGround(AbstractKart *kart)
Determines if the kart is over ground.
Definition: track.cpp:2872
float getCameraFar() const
Returns the far value for cameras.
Definition: track.hpp:608
float m_friction
Friction to be used for the track.
Definition: track.hpp:129
int m_sky_hori_segments
If a sky dome is used, the number of horizontal segments the sphere should be divided in.
Definition: track.hpp:289
std::vector< OverworldChallenge > m_challenges
Will only be used on overworld.
Definition: track.hpp:138
const std::vector< std::string > & getGroups() const
Returns all groups this track belongs to.
Definition: track.hpp:536
void addCachedMesh(scene::IMesh *mesh)
Adds mesh to cleanup list.
Definition: track.hpp:734
float m_camera_far
Far value for cameras for this track.
Definition: track.hpp:245
std::string m_root
The base dir of all files of this track.
Definition: track.hpp:156
TriangleMesh * m_height_map_mesh
Used to collect the triangles for the height map mesh used for particle rendering.
Definition: track.hpp:213
bool hasNavMesh() const
Returns true if this track navmesh.
Definition: track.hpp:512
core::stringw getName() const
Returns the name of the track, which is e.g.
Definition: track.cpp:225
bool m_is_arena
True if this track is an arena.
Definition: track.hpp:227
int m_version
The version of this track.
Definition: track.hpp:242
bool m_has_navmesh
True if this track has navmesh.
Definition: track.hpp:234
void handleSky(const XMLNode &root, const std::string &filename)
Handles a sky-dome or sky-box.
Definition: track.cpp:2490
Vec3 m_aabb_max
Maximum coordinates of this track.
Definition: track.hpp:223
video::SColor m_ambient_color
The current ambient color for each kart.
Definition: track.hpp:367
const TriangleMesh * getPtrTriangleMesh() const
Returns the triangle mesh for this track.
Definition: track.hpp:611
const std::string & getScreenshotFile() const
Returns an absolute path to the screenshot file of this track.
Definition: track.hpp:545
std::vector< scene::IMesh * > m_detached_cached_meshes
m_all_cached_meshes assumes meshes are attached to a scene node.
Definition: track.hpp:179
void loadArenaGraph(const XMLNode &node)
Loads the quad graph for arena, i.e.
Definition: track.cpp:739
bool hasEasterEggs() const
Returns true if this track has easter eggs.
Definition: track.hpp:506
std::string m_filename
The full filename of the config (xml) file.
Definition: track.hpp:153
static void uploadNodeVertexBuffer(scene::ISceneNode *node)
Static helper function to pre-upload vertex buffer in spm.
Definition: track.cpp:2908
bool loadMainTrack(const XMLNode &node)
Loads the main track model (i.e.
Definition: track.cpp:1242
A special class to store a triangle mesh with a separate material per triangle.
Definition: triangle_mesh.hpp:35
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35
utility class used to parse XML files
Definition: xml_node.hpp:48
Definition: track.hpp:81
Definition: track.hpp:95