SuperTuxKart
Loading...
Searching...
No Matches
kart_gfx.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2012-2015 Joerg Henrichs
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (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 General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_KART_GFX_HPP
20#define HEADER_KART_GFX_HPP
21
25#include <vector>
26#include <string>
27
28class AbstractKart;
29class ParticleEmitter;
30class ParticleKind;
31class Vec3;
32
33namespace irr {
34 namespace scene {
35 class ISceneNode;
36 }
37}
38
40{
41public:
48 enum KartGFXType { KGFX_NITRO1=0,
49 KGFX_NITRO2,
50 KGFX_NITROSMOKE1,
51 KGFX_NITROSMOKE2,
52 KGFX_ZIPPER,
53 KGFX_TERRAIN,
54 KGFX_SKIDL,
55 KGFX_SKIDR,
56 KGFX_SKID1L = KGFX_SKIDL,
57 KGFX_SKID1R = KGFX_SKIDR,
58 KGFX_SKID2L,
59 KGFX_SKID2R,
60 KGFX_SKID0L,
61 KGFX_SKID0R,
62 KGFX_EXHAUST1,
63 KGFX_EXHAUST2,
64 KGFX_COUNT};
65
66private:
69
72
75
77 std::vector<ParticleEmitter*> m_all_emitters;
78
81
84
87
89 irr::scene::ISceneNode* m_nitro_light;
90
92 irr::scene::ISceneNode* m_skidding_light_1;
93
95 irr::scene::ISceneNode* m_skidding_light_2;
96
97 void addEffect(KartGFXType type, const std::string &file_name,
98 const Vec3 &position, bool important);
99 void resizeBox(const KartGFXType type, float new_size);
100
101public:
102 KartGFX(const AbstractKart *kart, bool is_day);
103 ~KartGFX();
104 void reset();
105 void setSkidLevel(const unsigned int level);
106 void setParticleKind(const KartGFXType type, const ParticleKind *pk);
107 void setXYZ(const KartGFXType type, const Vec3 &xyz);
108 void setCreationRateAbsolute(const KartGFXType type, float f);
109 void setCreationRateRelative(const KartGFXType type, float f);
110 void updateTerrain(const ParticleKind *pk);
111 void update(float dt);
112 void updateNitroGraphics(float f);
113 void updateSkidLight(unsigned int level);
114 void getGFXStatus(int* nitro, bool* zipper,
115 int* skidding, bool* red_skidding) const;
116 void setGFXFromReplay(int nitro, bool zipper,
117 int skidding, bool red_skidding);
118 void setGFXInvisible();
119
120}; // KartWGFX
121#endif
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
Definition: kart_gfx.hpp:40
int m_wheel_toggle
Used to alternate particle effects from the rear wheels.
Definition: kart_gfx.hpp:83
void setSkidLevel(const unsigned int level)
Selects the correct skidding particle type depending on skid bonus level.
Definition: kart_gfx.cpp:254
irr::scene::ISceneNode * m_skidding_light_2
A light that's shown on the second skid-level with another color.
Definition: kart_gfx.hpp:95
const ParticleKind * m_skid_kind2
The particle kind for skidding bonus level 2.
Definition: kart_gfx.hpp:74
const ParticleKind * m_skid_kind1
The particle kind for skidding bonus level 1.
Definition: kart_gfx.hpp:71
void updateNitroGraphics(float f)
Updates nitro dependent particle effects.
Definition: kart_gfx.cpp:457
const AbstractKart * m_kart
Pointer to the owner of this kart.
Definition: kart_gfx.hpp:80
const ParticleKind * m_skid_kind0
The particle kind for skidding bonus level 0.
Definition: kart_gfx.hpp:68
void setCreationRateRelative(const KartGFXType type, float f)
Sets the creation rate for the specified particle type relative to the given minimum and maximum part...
Definition: kart_gfx.cpp:354
void updateSkidLight(unsigned int level)
Updates the skiddng light (including disabling it).
Definition: kart_gfx.cpp:498
void update(float dt)
Updates all gfx.
Definition: kart_gfx.cpp:441
void setCreationRateAbsolute(const KartGFXType type, float f)
Sets the absolute creation rate for the specified particle type.
Definition: kart_gfx.cpp:330
irr::scene::ISceneNode * m_skidding_light_1
Light that is shown when the kart is skidding.
Definition: kart_gfx.hpp:92
int m_skid_level
A skid level that is currently in use.
Definition: kart_gfx.hpp:86
void resizeBox(const KartGFXType type, float new_size)
Resize the area from which the particles are emitted: the emitter box should spread from last frame's...
Definition: kart_gfx.cpp:378
void setXYZ(const KartGFXType type, const Vec3 &xyz)
Defines the new position of the specified emitter.
Definition: kart_gfx.cpp:312
irr::scene::ISceneNode * m_nitro_light
A light that's shown when the kart uses nitro.
Definition: kart_gfx.hpp:89
void reset()
Resets all particle emitters.
Definition: kart_gfx.cpp:232
void addEffect(KartGFXType type, const std::string &file_name, const Vec3 &position, bool important)
Creates a new particle node with the specified particle kind read from the given file.
Definition: kart_gfx.cpp:166
std::vector< ParticleEmitter * > m_all_emitters
Vector of all particle emitters.
Definition: kart_gfx.hpp:77
KartGFXType
All particle effects supported by this object.
Definition: kart_gfx.hpp:48
~KartGFX()
Destructor.
Definition: kart_gfx.cpp:140
void setParticleKind(const KartGFXType type, const ParticleKind *pk)
Sets a new particle type to be used.
Definition: kart_gfx.cpp:294
void updateTerrain(const ParticleKind *pk)
If necessary defines a new particle type for the terrain emitter.
Definition: kart_gfx.cpp:396
manages smoke particle effects
Definition: particle_emitter.hpp:42
type of particles
Definition: particle_kind.hpp:42
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35