From 62d64847c4ebb1cff5a84748d4205ee088484b16 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Thu, 9 Mar 2017 18:41:35 -0500 Subject: [PATCH 1/5] Fix texture paths on case-sensitive file systems, fixes #2807 --- src/graphics/material.cpp | 8 ++++---- src/graphics/material.hpp | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/graphics/material.cpp b/src/graphics/material.cpp index dddb076f8..ce40bad83 100644 --- a/src/graphics/material.cpp +++ b/src/graphics/material.cpp @@ -72,7 +72,7 @@ Material::Material(const XMLNode *node, bool deprecated) if (relativePath.size() == 0) Log::warn("Material", "Cannot determine texture full path : <%s>", m_texname.c_str()); else - m_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str(); + m_full_path = m_original_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str(); core::stringc texfname(m_texname.c_str()); texfname.make_lower(); @@ -435,12 +435,12 @@ Material::Material(const std::string& fname, bool is_full_path, if (is_full_path) { m_texname = StringUtils::getBasename(fname); - m_full_path = fname; + m_full_path = m_original_full_path = fname; } else { m_texname = fname; - m_full_path = file_manager->getFileSystem()->getAbsolutePath( + m_full_path = m_original_full_path = file_manager->getFileSystem()->getAbsolutePath( file_manager->searchTexture(m_texname).c_str()).c_str(); } @@ -527,7 +527,7 @@ void Material::install(bool srgb, bool premul_alpha) else { m_texture = STKTexManager::getInstance()->getTexture - (m_full_path, srgb, premul_alpha, false/*set_material*/, + (m_original_full_path, srgb, premul_alpha, false/*set_material*/, srgb/*mesh_tex*/); } diff --git a/src/graphics/material.hpp b/src/graphics/material.hpp index c8df14cff..c8f52aa5b 100644 --- a/src/graphics/material.hpp +++ b/src/graphics/material.hpp @@ -91,6 +91,8 @@ private: std::string m_texname; std::string m_full_path; + + std::string m_original_full_path; /** Name of a special sfx to play when a kart is on this terrain, or * "" if no special sfx exists. */ From d33d72dfb83fc8b5dda813c14cef3b40bc825190 Mon Sep 17 00:00:00 2001 From: rogue-spectre Date: Sat, 11 Mar 2017 15:04:38 +0100 Subject: [PATCH 2/5] fix feedback offroad #2761 (#2806) * Fix updateenginesfx smooth engine sound and fix https://github.com/supertuxkart/stk-code/issues/2761 * update enginesfx * remove m_last_max_speed useless * forgot : float max_speed * Add missing space around = * add space around = m_last_factor_engine_sound --- src/karts/kart.cpp | 38 +++++++++++++++++++++++++------------- src/karts/kart.hpp | 5 ++++- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index dc5ae15c7..66fbf1980 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -153,6 +153,7 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id, m_reset_transform = init_transform; m_speed = 0.0f; m_smoothed_speed = 0.0f; + m_last_factor_engine_sound = 0.0f; m_kart_model->setKart(this); @@ -1375,6 +1376,7 @@ void Kart::update(float dt) fabs(getSpeed()) < 3.0f) { new RescueAnimation(this, /*is_auto_rescue*/true); + m_last_factor_engine_sound = 0.0f; } } @@ -1439,7 +1441,10 @@ void Kart::update(float dt) if((min->getY() - getXYZ().getY() > 17 || dist_to_sector > 25) && !m_flying && !getKartAnimation()) + { new RescueAnimation(this); + m_last_factor_engine_sound = 0.0f; + } } else { @@ -1458,7 +1463,10 @@ void Kart::update(float dt) } // if !flying handleMaterialSFX(material); if (material->isDriveReset() && isOnGround()) + { new RescueAnimation(this); + m_last_factor_engine_sound = 0.0f; + } else if(material->isZipper() && isOnGround()) { handleZipper(material); @@ -2094,6 +2102,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal) if (m->getCollisionReaction() == Material::RESCUE) { new RescueAnimation(this); + m_last_factor_engine_sound = 0.0f; } else if (m->getCollisionReaction() == Material::PUSH_BACK) { @@ -2285,7 +2294,7 @@ void Kart::updatePhysics(float dt) m_max_speed->update(dt); - updateEngineSFX(); + updateEngineSFX(dt); #ifdef XX Log::info("Kart","angVel %f %f %f heading %f suspension %f %f %f %f" ,m_body->getAngularVelocity().getX() @@ -2304,7 +2313,7 @@ void Kart::updatePhysics(float dt) //----------------------------------------------------------------------------- /** Adjust the engine sound effect depending on the speed of the kart. */ -void Kart::updateEngineSFX() +void Kart::updateEngineSFX(float dt) { // when going faster, use higher pitch for engine if(!m_engine_sound || !SFXManager::get()->sfxAllowed()) @@ -2312,7 +2321,7 @@ void Kart::updateEngineSFX() if(isOnGround()) { - float max_speed = m_max_speed->getCurrentMaxSpeed(); + float max_speed = m_kart_properties->getEngineMaxSpeed(); // Engine noise is based half in total speed, half in fake gears: // With a sawtooth graph like /|/|/| we get 3 even spaced gears, @@ -2320,20 +2329,23 @@ void Kart::updateEngineSFX() // good enough brrrBRRRbrrrBRRR sound effect. Speed factor makes // it a "staired sawtooth", so more acoustically rich. float f = max_speed > 0 ? m_speed/max_speed : 1.0f; - // Speed at this stage is not yet capped, so it can be > 1, which - // results in odd engine sfx. - if (f>1.0f) f=1.0f; + // Speed at this stage is not yet capped, reduce the amount beyond 1 + if (f> 1.0f) f = 1.0f + (1.0f-1.0f/f); - float gears = 3.0f * fmod(f, 0.333334f); + float fc = f; + if (fc>1.0f) fc = 1.0f; + float gears = 3.0f * fmod(fc, 0.333334f); assert(!std::isnan(f)); - m_engine_sound->setSpeedPosition(0.6f + (f + gears) * 0.35f, getXYZ()); + m_last_factor_engine_sound = (0.9*f + gears) * 0.35f; + m_engine_sound->setSpeedPosition(0.6f + m_last_factor_engine_sound, getXYZ()); } else - { - // When flying, fixed value but not too high pitch - // This gives some variation (vs previous "on wheels" one) - m_engine_sound->setSpeedPosition(0.9f, getXYZ()); - } + { + // When flying, reduce progressively the sound engine (since we can't accelerate) + m_last_factor_engine_sound *= (1.0f-0.1*dt); + m_engine_sound->setSpeedPosition(0.6f + m_last_factor_engine_sound, getXYZ()); + if (m_speed < 0.1f) m_last_factor_engine_sound = 0.0f; + } } // updateEngineSFX //----------------------------------------------------------------------------- diff --git a/src/karts/kart.hpp b/src/karts/kart.hpp index aa3a7a87f..63c1bf6ed 100644 --- a/src/karts/kart.hpp +++ b/src/karts/kart.hpp @@ -201,6 +201,9 @@ protected: /** For camera handling an exponentially smoothened value is used, which * reduces stuttering of the camera. */ float m_smoothed_speed; + + /** For smoothing engine sound**/ + float m_last_factor_engine_sound; std::vector m_custom_sounds; SFXBase *m_beep_sound; @@ -226,7 +229,7 @@ protected: void updateFlying(); void updateSliding(); void updateEnginePowerAndBrakes(float dt); - void updateEngineSFX(); + void updateEngineSFX(float dt); void updateSpeed(); void updateNitro(float dt); float getActualWheelForce(); From b8e3de0161de0c370a95bf2b75bec97a7a13e930 Mon Sep 17 00:00:00 2001 From: Deve Date: Sun, 12 Mar 2017 11:34:43 +0100 Subject: [PATCH 3/5] Allow to use debug menu on android --- src/utils/debug.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp index 714a21892..2f39ccf5d 100644 --- a/src/utils/debug.cpp +++ b/src/utils/debug.cpp @@ -723,11 +723,15 @@ bool onEvent(const SEvent &event) if(!UserConfigParams::m_artist_debug_mode) return true; // keep handling the events - if(event.EventType == EET_MOUSE_INPUT_EVENT) + if (event.EventType == EET_MOUSE_INPUT_EVENT) { // Create the menu (only one menu at a time) - if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN && - !g_debug_menu_visible) + #ifdef ANDROID + if (event.MouseInput.X < 30 && event.MouseInput.Y < 30 && + #else + if (event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN && + #endif + !g_debug_menu_visible) { irr_driver->getDevice()->getCursorControl()->setVisible(true); From 97670ed23cdf097cfd955f63927f033caef5d444 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 12 Mar 2017 21:35:48 +0100 Subject: [PATCH 4/5] Improved wind effect for vegetation --- data/shaders/grass_pass.vert | 7 +++++-- data/shaders/instanced_grass.vert | 6 ++++-- data/shaders/instanced_grassshadow.vert | 7 +++++-- data/shaders/shadow_grass.vert | 8 ++++++-- src/graphics/stk_mesh.cpp | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/data/shaders/grass_pass.vert b/data/shaders/grass_pass.vert index 23daa553c..e6903c19e 100644 --- a/data/shaders/grass_pass.vert +++ b/data/shaders/grass_pass.vert @@ -20,13 +20,16 @@ out vec2 uv; void main() { + vec3 test = sin(windDir * (Position.y* 0.5)) * 0.5; + test += cos(windDir) * 0.7; + mat4 new_model_matrix = ModelMatrix; mat4 new_inverse_model_matrix = InverseModelMatrix; - new_model_matrix[3].xyz += windDir * Color.r; + new_model_matrix[3].xyz += test * Color.r; // FIXME doesn't seem to make too much difference in pass 2, because this // affects "nor" which is later only * 0.1 by scattering - new_inverse_model_matrix[3].xyz -= windDir * Color.r; + new_inverse_model_matrix[3].xyz -= test * Color.r; mat4 ModelViewProjectionMatrix = ProjectionViewMatrix * new_model_matrix; mat4 TransposeInverseModelView = transpose(InverseViewMatrix * new_inverse_model_matrix); diff --git a/data/shaders/instanced_grass.vert b/data/shaders/instanced_grass.vert index 57adee847..0127a8346 100644 --- a/data/shaders/instanced_grass.vert +++ b/data/shaders/instanced_grass.vert @@ -41,8 +41,10 @@ flat out sampler2D thirdhandle; void main() { - mat4 ModelMatrix = getWorldMatrix(Origin + windDir * Color.r, Orientation, Scale); - mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin + windDir * Color.r, Orientation, Scale) * InverseViewMatrix); + vec3 test = sin(windDir * (Position.y* 0.5)) * 0.5; + test += cos(windDir) * 0.7; + mat4 ModelMatrix = getWorldMatrix(Origin + test * Color.r, Orientation, Scale); + mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin + test * Color.r, Orientation, Scale) * InverseViewMatrix); gl_Position = ProjectionViewMatrix * ModelMatrix * vec4(Position, 1.); nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz; uv = Texcoord; diff --git a/data/shaders/instanced_grassshadow.vert b/data/shaders/instanced_grassshadow.vert index 5d5e8e6e2..a31d49d92 100644 --- a/data/shaders/instanced_grassshadow.vert +++ b/data/shaders/instanced_grassshadow.vert @@ -40,17 +40,20 @@ flat out uvec2 hdle; void main(void) { + + vec3 test = sin(windDir * (Position.y* 0.5)) * 0.5; + test += cos(windDir) * 0.7; mat4 ModelMatrix = getWorldMatrix(Origin, Orientation, Scale); #ifdef VSLayer gl_Layer = layer; - gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + windDir * Color.r, 1.); + gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + test * Color.r, 1.); uv = Texcoord; #ifdef Use_Bindless_Texture handle = Handle; #endif #else layerId = layer; - gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + windDir * Color.r, 1.); + gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + test * Color.r, 1.); tc = Texcoord; #ifdef Use_Bindless_Texture hdle = Handle; diff --git a/data/shaders/shadow_grass.vert b/data/shaders/shadow_grass.vert index 95827b872..bb978f921 100644 --- a/data/shaders/shadow_grass.vert +++ b/data/shaders/shadow_grass.vert @@ -21,13 +21,17 @@ out int layerId; void main(void) { + + vec3 test = sin(windDir * (Position.y* 0.5)) * 0.5; + test += cos(windDir) * 0.7; + #ifdef VSLayer gl_Layer = layer; uv = Texcoord; - gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + windDir * Color.r, 1.); + gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + test * Color.r, 1.); #else layerId = layer; tc = Texcoord; - gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + windDir * Color.r, 1.); + gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + test * Color.r, 1.); #endif } diff --git a/src/graphics/stk_mesh.cpp b/src/graphics/stk_mesh.cpp index 397dd8b77..87e2e2b29 100644 --- a/src/graphics/stk_mesh.cpp +++ b/src/graphics/stk_mesh.cpp @@ -337,7 +337,7 @@ core::vector3df getWindDir() const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f; GrassShaderProvider *gsp = (GrassShaderProvider *)Shaders::getCallback(ES_GRASS); - return (gsp->getSpeed() * cos(time)) * vector3df(1., 0., 0.); + return (gsp->getSpeed() * time * vector3df(1., 0., 0.)); } // getWindDir // ---------------------------------------------------------------------------- From 6ea06e05de4a562b618856a6463d5ae1da79533f Mon Sep 17 00:00:00 2001 From: Deve Date: Mon, 13 Mar 2017 01:17:31 +0100 Subject: [PATCH 5/5] Use kart lights only in shader-based pipeline. It causes a huge slowdown in legacy pipeline, even if the radius is set to 0. --- src/graphics/particle_emitter.hpp | 1 + src/karts/kart_gfx.cpp | 197 +++++++++++++++--------------- src/karts/kart_gfx.hpp | 3 + 3 files changed, 105 insertions(+), 96 deletions(-) diff --git a/src/graphics/particle_emitter.hpp b/src/graphics/particle_emitter.hpp index 576d4a3d2..a5395467d 100644 --- a/src/graphics/particle_emitter.hpp +++ b/src/graphics/particle_emitter.hpp @@ -92,6 +92,7 @@ public: void setCreationRateAbsolute(float fraction); void setCreationRateRelative(float f); int getCreationRate(); + float getCreationRateFloat() {return m_min_rate;} void setPosition(const Vec3 &pos); void setRotation(const Vec3 &rot); diff --git a/src/karts/kart_gfx.cpp b/src/karts/kart_gfx.cpp index 8ab878025..5d44de431 100644 --- a/src/karts/kart_gfx.cpp +++ b/src/karts/kart_gfx.cpp @@ -38,6 +38,14 @@ KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type, bool is_day) { + m_nitro_light = NULL; + m_skidding_light_1 = NULL; + m_skidding_light_2 = NULL; + m_head_light = NULL; + m_kart = kart; + m_wheel_toggle = 0; + m_skid_level = 0; + //if(!UserConfigParams::m_graphical_effects) //{ // for(unsigned int i=0; igetKartModel(); const float length = km->getLength(); scene::ISceneNode *node = m_kart->getNode(); // Create nitro light core::vector3df location(0.0f, 0.5f, -0.5f*length - 0.05f); -#ifndef SERVER_ONLY - m_nitro_light = irr_driver->addLight(location, /*force*/ 0.4f, - /*radius*/CVS->isGLSL() ? 5.0f : 1.0f, - 0.0f, 0.4f, 1.0f, - false, node); - m_nitro_light->setVisible(false); -#ifdef DEBUG - m_nitro_light->setName( ("nitro emitter (" + m_kart->getIdent() - + ")").c_str() ); -#endif - - // Create skidding lights - // For the first skidding level - m_skidding_light_1 = - irr_driver->addLight(core::vector3df(0.0f, 0.1f, -0.5f*length - 0.05f), - /* force */ 0.3f, - /*radius*/CVS->isGLSL() ? 3.0f : 1.0f, - 1.0f, 0.6f, 0.0f, false, node); - m_skidding_light_1->setVisible(false); - m_skidding_light_1->setName( ("skidding emitter 1 (" + m_kart->getIdent() - + ")").c_str() ); - - // For the second skidding level - m_skidding_light_2 = - irr_driver->addLight(core::vector3df(0.0f, 0.1f, -0.5f*length - 0.05f), - /* force */0.4f, - /*radius*/CVS->isGLSL() ? 4.0f : 1.0f, - 1.0f, 0.0f, 0.0f, false, node); - m_skidding_light_2->setVisible(false); - m_skidding_light_2->setName( ("skidding emitter 2 (" + m_kart->getIdent() - + ")").c_str() ); - - m_head_light = - irr_driver->addLight(core::vector3df(0.0f, 0.2f, 1.5f*length), - /* force */ 0.5f, - /*radius*/CVS->isGLSL() ? 5.0f : 1.0f, - 1.0f, 1.0f, 1.0f, false, node); - m_head_light->setName( ("head light " + m_kart->getIdent() - + ")").c_str() ); - - if (type == RaceManager::KT_PLAYER && !is_day) - { - m_head_light->setVisible(true); - } - else - { - m_head_light->setVisible(false); - } - - -#endif - #ifndef SERVER_ONLY if (CVS->isGLSL()) { + m_nitro_light = irr_driver->addLight(location, /*force*/ 0.4f, + /*radius*/ 5.0f, 0.0f, 0.4f, 1.0f, + false, node); + m_nitro_light->setVisible(false); + #ifdef DEBUG + m_nitro_light->setName( ("nitro emitter (" + m_kart->getIdent() + + ")").c_str() ); + #endif + + // Create skidding lights + // For the first skidding level + m_skidding_light_1 = + irr_driver->addLight(core::vector3df(0.0f, 0.1f, -0.5f * length - + 0.05f), /* force */ 0.3f, /*radius*/ 3.0f, + 1.0f, 0.6f, 0.0f, false, node); + m_skidding_light_1->setVisible(false); + m_skidding_light_1->setName(("skidding emitter 1 (" + m_kart->getIdent() + + ")").c_str() ); + + // For the second skidding level + m_skidding_light_2 = + irr_driver->addLight(core::vector3df(0.0f, 0.1f, -0.5f * length - + 0.05f), /* force */0.4f, /*radius*/4.0f, + 1.0f, 0.0f, 0.0f, false, node); + m_skidding_light_2->setVisible(false); + m_skidding_light_2->setName(("skidding emitter 2 (" + m_kart->getIdent() + + ")").c_str() ); + + m_head_light = + irr_driver->addLight(core::vector3df(0.0f, 0.2f, 1.5f * length), + /* force */ 0.5f, /*radius*/5.0f, 1.0f, 1.0f, + 1.0f, false, node); + m_head_light->setName( ("head light " + m_kart->getIdent() + + ")").c_str() ); + + m_head_light->setVisible(type == RaceManager::KT_PLAYER && !is_day); + m_nitro_light->grab(); m_skidding_light_1->grab(); m_skidding_light_2->grab(); @@ -182,7 +173,7 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name, const Vec3 &position, bool important) { #ifndef SERVER_ONLY - if (!UserConfigParams::m_graphical_effects && + if ((!UserConfigParams::m_graphical_effects || !CVS->isGLSL()) && (!important || m_kart->getType() == RaceManager::KT_AI || m_kart->getType() == RaceManager::KT_SPARE_TIRE)) { @@ -257,6 +248,7 @@ void KartGFX::setSkidLevel(const unsigned int level) { assert(level >= 1); assert(level <= 2); + m_skid_level = level; const ParticleKind *pk = level==1 ? m_skid_kind1 : m_skid_kind2; #ifndef SERVER_ONLY if(m_all_emitters[KGFX_SKID1L]) @@ -309,8 +301,13 @@ void KartGFX::setXYZ(const KartGFXType type, const Vec3 &xyz) void KartGFX::setCreationRateAbsolute(KartGFXType type, float f) { #ifndef SERVER_ONLY - if(m_all_emitters[type]) - m_all_emitters[type]->setCreationRateAbsolute(f); + if (!m_all_emitters[type]) + return; + + if (m_all_emitters[type]->getCreationRateFloat() == f) + return; + + m_all_emitters[type]->setCreationRateAbsolute(f); #endif } // setCreationRateAbsolute @@ -428,7 +425,9 @@ void KartGFX::updateNitroGraphics(float nitro_frac) setCreationRateRelative(KartGFX::KGFX_NITRO2, nitro_frac); setCreationRateRelative(KartGFX::KGFX_NITROSMOKE1, nitro_frac); setCreationRateRelative(KartGFX::KGFX_NITROSMOKE2, nitro_frac); - m_nitro_light->setVisible(true); + + if (CVS->isGLSL()) + m_nitro_light->setVisible(true); } else { @@ -436,15 +435,14 @@ void KartGFX::updateNitroGraphics(float nitro_frac) setCreationRateAbsolute(KartGFX::KGFX_NITRO2, 0); setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE1, 0); setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE2, 0); - m_nitro_light->setVisible(false); + + if (CVS->isGLSL()) + m_nitro_light->setVisible(false); } - if (CVS->isGLSL()) - { - // Exhaust is always emitting - setCreationRateRelative(KartGFX::KGFX_EXHAUST1, 1.0); - setCreationRateRelative(KartGFX::KGFX_EXHAUST2, 1.0); - } + // Exhaust is always emitting + setCreationRateRelative(KartGFX::KGFX_EXHAUST1, 1.0); + setCreationRateRelative(KartGFX::KGFX_EXHAUST2, 1.0); #endif } // updateGraphics @@ -456,8 +454,11 @@ void KartGFX::updateNitroGraphics(float nitro_frac) void KartGFX::updateSkidLight(unsigned int level) { #ifndef SERVER_ONLY - m_skidding_light_1->setVisible(level == 1); - m_skidding_light_2->setVisible(level > 1); + if (CVS->isGLSL()) + { + m_skidding_light_1->setVisible(level == 1); + m_skidding_light_2->setVisible(level > 1); + } #endif } // updateSkidLight @@ -484,7 +485,7 @@ void KartGFX::getGFXStatus(int* nitro, bool* zipper, if (m_all_emitters[KGFX_SKIDL]) { s = m_all_emitters[KGFX_SKIDL]->getCreationRate(); - r = m_skidding_light_2->isVisible(); + r = m_skid_level == 2; } *nitro = n; @@ -505,15 +506,19 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper, setCreationRateAbsolute(KartGFX::KGFX_NITRO2, (float)nitro); setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE1, (float)nitro); setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE2, (float)nitro); - m_nitro_light->setVisible(true); + + if (CVS->isGLSL()) + m_nitro_light->setVisible(true); } - else if (m_nitro_light->isVisible() && nitro == 0) + else { setCreationRateAbsolute(KartGFX::KGFX_NITRO1, 0.0f); setCreationRateAbsolute(KartGFX::KGFX_NITRO2, 0.0f); setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE1, 0.0f); setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE2, 0.0f); - m_nitro_light->setVisible(false); + + if (CVS->isGLSL()) + m_nitro_light->setVisible(false); } if (zipper) @@ -521,36 +526,33 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper, if (skidding > 0) { - if (!m_skidding_light_1->isVisible() && !red_skidding) - { - if (m_all_emitters[KGFX_SKID1L]) - m_all_emitters[KGFX_SKID1L]->setParticleType(m_skid_kind1); - if (m_all_emitters[KGFX_SKID1R]) - m_all_emitters[KGFX_SKID1R]->setParticleType(m_skid_kind1); + const ParticleKind* skid_kind = red_skidding ? m_skid_kind2 + : m_skid_kind1; - m_skidding_light_1->setVisible(true); - m_skidding_light_2->setVisible(false); - } - if (!m_skidding_light_2->isVisible() && red_skidding) - { - if (m_all_emitters[KGFX_SKID1L]) - m_all_emitters[KGFX_SKID1L]->setParticleType(m_skid_kind2); - if (m_all_emitters[KGFX_SKID1R]) - m_all_emitters[KGFX_SKID1R]->setParticleType(m_skid_kind2); + if (m_all_emitters[KGFX_SKID1L]) + m_all_emitters[KGFX_SKID1L]->setParticleType(skid_kind); + if (m_all_emitters[KGFX_SKID1R]) + m_all_emitters[KGFX_SKID1R]->setParticleType(skid_kind); - m_skidding_light_1->setVisible(false); - m_skidding_light_2->setVisible(true); + if (CVS->isGLSL()) + { + m_skidding_light_1->setVisible(!red_skidding); + m_skidding_light_2->setVisible(red_skidding); } + setCreationRateAbsolute(KartGFX::KGFX_SKIDL, (float)skidding); setCreationRateAbsolute(KartGFX::KGFX_SKIDR, (float)skidding); } - else if ((m_skidding_light_1->isVisible() || - m_skidding_light_2->isVisible()) && skidding == 0) + else { setCreationRateAbsolute(KartGFX::KGFX_SKIDL, 0.0f); setCreationRateAbsolute(KartGFX::KGFX_SKIDR, 0.0f); - m_skidding_light_1->setVisible(false); - m_skidding_light_2->setVisible(false); + + if (CVS->isGLSL()) + { + m_skidding_light_1->setVisible(false); + m_skidding_light_2->setVisible(false); + } } #endif } // setGFXFromReplay @@ -559,9 +561,12 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper, void KartGFX::setGFXInvisible() { #ifndef SERVER_ONLY - m_nitro_light->setVisible(false); - m_skidding_light_1->setVisible(false); - m_skidding_light_2->setVisible(false); - m_head_light->setVisible(false); + if (CVS->isGLSL()) + { + m_nitro_light->setVisible(false); + m_skidding_light_1->setVisible(false); + m_skidding_light_2->setVisible(false); + m_head_light->setVisible(false); + } #endif } // setGFXInvisible diff --git a/src/karts/kart_gfx.hpp b/src/karts/kart_gfx.hpp index 68f92d336..d7c2929a6 100644 --- a/src/karts/kart_gfx.hpp +++ b/src/karts/kart_gfx.hpp @@ -77,6 +77,9 @@ private: /** Used to alternate particle effects from the rear wheels. */ int m_wheel_toggle; + + /** A skid level that is currently in use */ + int m_skid_level; /** A light that's shown when the kart uses nitro. */ irr::scene::ISceneNode* m_nitro_light;