SuperTuxKart
|
Public Types | |
enum | ParticleConditions { EMIT_ON_DRIVE = 0, EMIT_ON_SKID, EMIT_KINDS_COUNT } |
enum | CollisionReaction { NORMAL, RESCUE, PUSH_BACK, PUSH_SOCCER_BALL } |
Public Member Functions | |
Material (const XMLNode *node, bool deprecated) | |
Create a new material using the parameters specified in the xml file. More... | |
Material (const std::string &fname, bool is_full_path=false, bool complain_if_not_found=true, bool load_texture=true, const std::string &shader_name="solid") | |
Create a standard material using the default settings for materials. More... | |
void | unloadTexture () |
void | setSFXSpeed (SFXBase *sfx, float speed, bool should_be_paused) const |
Adjusts the pitch of the given sfx depending on the given speed. More... | |
void | setMaterialProperties (video::SMaterial *m, scene::IMeshBuffer *mb) |
Sets the appropriate flags in an irrlicht SMaterial. More... | |
video::ITexture * | getTexture (bool srgb=true, bool premul_alpha=false) |
Returns the ITexture associated with this material. More... | |
bool | isIgnore () const |
bool | isZipper () const |
Returns true if this material is a zipper. More... | |
bool | isDriveReset () const |
Returns if this material should trigger a rescue if a kart is driving on it. More... | |
bool | isColorizable () const |
Returns if this material can be colorized. | |
float | getColorizationFactor () const |
Returns the minimum resulting saturation when colorized. | |
bool | hasRandomHue () const |
float | getRandomHue () |
Returns a random hue when colorized. | |
CollisionReaction | getCollisionReaction () const |
Returns if this material should trigger a rescue if a kart crashes against it. More... | |
std::string | getCrashResetParticles () const |
bool | highTireAdhesion () const |
const std::string & | getTexFname () const |
const std::string & | getTexFullPath () const |
bool | isTransparent () const |
float | getMaxSpeedFraction () const |
Returns the fraction of maximum speed on this material. More... | |
int | getSlowDownTicks () const |
Returns how long it will take for a slowdown to take effect. More... | |
bool | isBelowSurface () const |
Returns true if this material is under some other mesh and therefore requires another raycast to find the surface it is under (used for gfx, e.g. More... | |
bool | isSurface () const |
Returns true if this material is a surface, i.e. More... | |
const std::string & | getSFXName () const |
Returns the name of a special sfx to play while a kart is on this terrain. More... | |
const ParticleKind * | getParticlesWhen (ParticleConditions cond) const |
Get the kind of particles that are to be used on this material, in the given conditions. More... | |
bool | hasFallingEffect () const |
Returns true if a kart falling over this kind of material triggers the special falling camera. More... | |
bool | isJumpTexture () const |
Returns if being in the air after this texture should start the jump animation. More... | |
bool | hasGravity () const |
Returns true if this texture adjusts the gravity vector of the kart to be parallel to the normal of the triangle - which allows karts to e.g. More... | |
void | getZipperParameter (float *zipper_max_speed_increase, float *zipper_duration, float *zipper_speed_gain, float *zipper_fade_out_time, float *zipper_engine_force) const |
Returns the zipper parametersfor the current material. More... | |
float | getZipperMinSpeed () const |
Returns the minimum speed of a kart on this material. More... | |
char | getMirrorAxisInReverse () const |
True if this texture should have the U coordinates mirrored. More... | |
const std::string & | getAlphaMask () const |
const std::string & | getColorizationMask () const |
void | setShaderName (const std::string &name) |
const std::string & | getShaderName () const |
const std::string & | getUVTwoTexture () const |
bool | use2UV () const |
const std::string & | getSamplerPath (unsigned layer) const |
const std::string & | getContainerId () const |
Private Member Functions | |
void | init () |
Inits all material data with the default settings. | |
void | install (std::function< void(video::IImage *)> image_mani=nullptr) |
void | initCustomSFX (const XMLNode *sfx) |
Initialise the data structures for a custom sfx to be played when a kart is driving on that particular material. More... | |
void | initParticlesEffect (const XMLNode *node) |
void | loadContainerId () |
Private Attributes | |
video::ITexture * | m_texture |
Pointer to the texture. More... | |
std::string | m_texname |
Name of the texture. More... | |
std::string | m_full_path |
std::string | m_sfx_name |
Name of a special sfx to play when a kart is on this terrain, or "" if no special sfx exists. More... | |
char | m_mirror_axis_when_reverse |
Either ' ' (no mirroring), 'U' or 'V' if a texture needs to be mirrored when driving in reverse. More... | |
bool | m_below_surface |
Set if being on this surface means being under some other mesh. More... | |
bool | m_falling_effect |
If a kart is falling over a material with this flag set, it will trigger the special camera fall effect. More... | |
bool | m_surface |
A material that is a surface only, i.e. More... | |
bool | m_zipper |
If the material is a zipper, i.e. More... | |
bool | m_drive_reset |
If a kart is rescued when driving on this surface. More... | |
bool | m_is_jump_texture |
True if this is a texture that will start the jump animation when leaving it and being in the air. More... | |
bool | m_has_gravity |
True if driving on this texture should adjust the gravity of the kart to be along the normal of the triangle. More... | |
bool | m_ignore |
If the property should be ignored in the physics. More... | |
bool | m_high_tire_adhesion |
True if the material shouldn't be "slippy" at an angle. | |
bool | m_complain_if_not_found |
bool | m_deprecated |
bool | m_installed |
bool | m_colorizable |
True if this material can be colorized (like red/blue in team game). More... | |
bool | m_tex_compression |
True if this material should use texture compression. More... | |
float | m_colorization_factor |
Minimum resulting saturation when colorized (from 0 to 1) | |
CollisionReaction | m_collision_reaction |
If a kart is rescued when crashing into this surface. More... | |
std::string | m_collision_particles |
Particles to show on touch. | |
std::map< void *, bool > | m_mirrorred_mesh_buffers |
Associated with m_mirror_axis_when_reverse, to avoid mirroring the same material twice (setAllMaterialFlags can be called multiple times on the same mesh buffer) | |
ParticleKind * | m_particles_effects [EMIT_KINDS_COUNT] |
unsigned int | m_clamp_tex |
Texture clamp bitmask. | |
std::vector< float > | m_hue_settings |
List of hue pre-defined for colorization (from 0 to 1) | |
RandomGenerator | m_random_hue |
Random generator for getting pre-defined hue. | |
int | m_slowdown_ticks |
How much the top speed is reduced per second. More... | |
float | m_max_speed_fraction |
Maximum speed at which no more slow down occurs. More... | |
float | m_zipper_min_speed |
Minimum speed on this terrain. More... | |
float | m_sfx_min_speed |
The minimum speed at which a special sfx is started to be played. More... | |
float | m_sfx_max_speed |
The speed at which the maximum pitch is used. More... | |
float | m_sfx_min_pitch |
The minimum pitch to be used (at minimum speed). More... | |
float | m_sfx_max_pitch |
The maximum pitch to be used (at maximum speed). More... | |
float | m_sfx_pitch_per_speed |
(max_pitch-min_pitch) / (max_speed - min_speed). More... | |
float | m_zipper_max_speed_increase |
Additional speed allowed on top of the kart-specific maximum kart speed if a zipper is used. More... | |
float | m_zipper_duration |
Time a zipper stays activated. More... | |
float | m_zipper_speed_gain |
A one time additional speed gain - the kart will instantly add this amount of speed to its current speed. More... | |
float | m_zipper_fade_out_time |
Time it takes for the zipper advantage to fade out. More... | |
float | m_zipper_engine_force |
Additional engine force. More... | |
std::string | m_mask |
std::string | m_colorization_mask |
std::string | m_shader_name |
std::string | m_uv_two_tex |
std::string | m_sampler_path [6] |
std::string | m_container_id |
Material::Material | ( | const XMLNode * | node, |
bool | deprecated | ||
) |
Create a new material using the parameters specified in the xml file.
node | Node containing the parameters for this material. |
Material::Material | ( | const std::string & | fname, |
bool | is_full_path = false , |
||
bool | complain_if_not_found = true , |
||
bool | load_texture = true , |
||
const std::string & | shader_name = "solid" |
||
) |
Create a standard material using the default settings for materials.
fname | Name of the texture file. |
is_full_path | If the fname contains the full path. |
|
inline |
Returns if this material should trigger a rescue if a kart crashes against it.
|
inline |
Returns the fraction of maximum speed on this material.
|
inline |
True if this texture should have the U coordinates mirrored.
|
inline |
Get the kind of particles that are to be used on this material, in the given conditions.
|
inline |
Returns the name of a special sfx to play while a kart is on this terrain.
The string will be "" if no special sfx exists.
|
inline |
Returns how long it will take for a slowdown to take effect.
It is the time it takes till the full slowdown applies to karts. So a short time will slowdown a kart much faster.
video::ITexture * Material::getTexture | ( | bool | srgb = true , |
bool | premul_alpha = false |
||
) |
Returns the ITexture associated with this material.
|
inline |
Returns the minimum speed of a kart on this material.
This is used for zippers on a ramp to guarantee the right jump distance even on lower speeds. A negative value indicates no minimum speed.
|
inline |
Returns the zipper parametersfor the current material.
|
inline |
Returns true if a kart falling over this kind of material triggers the special falling camera.
|
inline |
Returns true if this texture adjusts the gravity vector of the kart to be parallel to the normal of the triangle - which allows karts to e.g.
drive upside down.
|
private |
Initialise the data structures for a custom sfx to be played when a kart is driving on that particular material.
sfx | The xml node containing the information for this sfx. |
|
inline |
Returns true if this material is under some other mesh and therefore requires another raycast to find the surface it is under (used for gfx, e.g.
driving under water to find where the water splash should be shown at.
|
inline |
Returns if this material should trigger a rescue if a kart is driving on it.
|
inline |
Returns if being in the air after this texture should start the jump animation.
|
inline |
Returns true if this material is a surface, i.e.
it is going to be ignored for the physics, but the information is needed e.g. for gfx. See m_below_surface for more details.
|
inline |
Returns true if this material is a zipper.
void Material::setMaterialProperties | ( | video::SMaterial * | m, |
scene::IMeshBuffer * | mb | ||
) |
Sets the appropriate flags in an irrlicht SMaterial.
material | The irrlicht SMaterial which gets the flags set. |
! Texture is clamped to the last pixel ETC_CLAMP, ! Texture is clamped to the edge pixel ETC_CLAMP_TO_EDGE, ! Texture is clamped to the border pixel (if exists) ETC_CLAMP_TO_BORDER,
void Material::setSFXSpeed | ( | SFXBase * | sfx, |
float | speed, | ||
bool | should_be_paused | ||
) | const |
Adjusts the pitch of the given sfx depending on the given speed.
sfx | The sound effect to adjust. |
speed | The speed of the kart. |
should_be_paused | Pause for other reasons, i.e. kart is rescued. |
|
private |
Set if being on this surface means being under some other mesh.
This is used to simulate that a kart is in water: the ground under the water is marked as 'm_below_surface', which will then trigger a raycast up to find the position of the actual water surface.
|
private |
If a kart is rescued when crashing into this surface.
|
private |
True if this material can be colorized (like red/blue in team game).
|
private |
If a kart is rescued when driving on this surface.
|
private |
If a kart is falling over a material with this flag set, it will trigger the special camera fall effect.
|
private |
True if driving on this texture should adjust the gravity of the kart to be along the normal of the triangle.
This allows karts to drive e.g upside down.
|
private |
If the property should be ignored in the physics.
Example would be plants that a kart can just drive through.
|
private |
True if this is a texture that will start the jump animation when leaving it and being in the air.
|
private |
Maximum speed at which no more slow down occurs.
|
private |
Either ' ' (no mirroring), 'U' or 'V' if a texture needs to be mirrored when driving in reverse.
Typically used for arrows indicating the direction.
|
private |
The maximum pitch to be used (at maximum speed).
|
private |
The speed at which the maximum pitch is used.
|
private |
The minimum pitch to be used (at minimum speed).
|
private |
The minimum speed at which a special sfx is started to be played.
|
private |
Name of a special sfx to play when a kart is on this terrain, or "" if no special sfx exists.
|
private |
(max_pitch-min_pitch) / (max_speed - min_speed).
Used to adjust the pitch of a sfx depending on speed of the kart.
|
private |
How much the top speed is reduced per second.
|
private |
A material that is a surface only, i.e.
the karts can fall through but the information is still needed (for GFX mostly). An example is a water surface: karts can drive while partly in water (so the water surface is not a physical object), but the location of the water effect is on the surface.
|
private |
True if this material should use texture compression.
|
private |
Name of the texture.
|
private |
Pointer to the texture.
|
private |
If the material is a zipper, i.e.
gives a speed boost.
|
private |
Time a zipper stays activated.
If this value is <0 the kart specific value will be used.
|
private |
Additional engine force.
|
private |
Time it takes for the zipper advantage to fade out.
If this value is <0 the kart specific value will be used.
|
private |
Additional speed allowed on top of the kart-specific maximum kart speed if a zipper is used.
If this value is <0 the kart specific value will be used.
|
private |
Minimum speed on this terrain.
This is used for zippers on a ramp to guarantee the right jump distance. A negative value indicates no minimum speed.
|
private |
A one time additional speed gain - the kart will instantly add this amount of speed to its current speed.
If this value is <0 the kart specific value will be used.