diff --git a/data/shaders/pointemitter.vert b/data/shaders/pointemitter.vert index 3203d965b..68fb15c8b 100644 --- a/data/shaders/pointemitter.vert +++ b/data/shaders/pointemitter.vert @@ -35,7 +35,7 @@ void main(void) float updated_lifetime = lifetime + (float(dt)/lifetime_initial); if (updated_lifetime > 1.) { - if (gl_VertexID <= level) + if (gl_VertexID < level) { float dt_from_last_frame = fract(updated_lifetime) * lifetime_initial; vec4 updated_initialposition = sourcematrix * vec4(particle_position_initial, 1.0); diff --git a/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp b/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp index 67631e786..3aae5e42c 100644 --- a/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp +++ b/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp @@ -584,30 +584,30 @@ void CGUIContextMenu::draw() skin->getColor(c), false, true, clip); // draw submenu symbol - if (Items[i].SubMenu && sprites) - { - core::rect r = rect; - r.UpperLeftCorner.X = r.LowerRightCorner.X - 15; - - sprites->draw2DSprite(skin->getIcon(EGDI_CURSOR_RIGHT), - r.getCenter(), clip, skin->getColor(c), - (i == HighLighted) ? ChangeTime : 0, - (i == HighLighted) ? os::Timer::getTime() : 0, - (i == HighLighted), true); - } + //if (Items[i].SubMenu && sprites) + //{ + // core::rect r = rect; + // r.UpperLeftCorner.X = r.LowerRightCorner.X - 15; + // + // sprites->draw2DSprite(skin->getIcon(EGDI_CURSOR_RIGHT), + // r.getCenter(), clip, skin->getColor(c), + // (i == HighLighted) ? ChangeTime : 0, + // (i == HighLighted) ? os::Timer::getTime() : 0, + // (i == HighLighted), true); + //} // draw checked symbol - if (Items[i].Checked && sprites) - { - core::rect r = rect; - r.LowerRightCorner.X = r.UpperLeftCorner.X - 15; - r.UpperLeftCorner.X = r.LowerRightCorner.X + 15; - sprites->draw2DSprite(skin->getIcon(EGDI_CHECK_BOX_CHECKED), - r.getCenter(), clip, skin->getColor(c), - (i == HighLighted) ? ChangeTime : 0, - (i == HighLighted) ? os::Timer::getTime() : 0, - (i == HighLighted), true); - } + //if (Items[i].Checked && sprites) + //{ + // core::rect r = rect; + // r.LowerRightCorner.X = r.UpperLeftCorner.X - 15; + // r.UpperLeftCorner.X = r.LowerRightCorner.X + 15; + // sprites->draw2DSprite(skin->getIcon(EGDI_CHECK_BOX_CHECKED), + // r.getCenter(), clip, skin->getColor(c), + // (i == HighLighted) ? ChangeTime : 0, + // (i == HighLighted) ? os::Timer::getTime() : 0, + // (i == HighLighted), true); + //} } } diff --git a/src/graphics/glwrap.cpp b/src/graphics/glwrap.cpp index 3f68a50cf..86a84c5a5 100644 --- a/src/graphics/glwrap.cpp +++ b/src/graphics/glwrap.cpp @@ -820,7 +820,6 @@ void getGLLimits(HardwareStats::Json *json) STRING(VERSION); STRING(VENDOR); STRING(RENDERER); - STRING(EXTENSIONS); INTEGER(SUBPIXEL_BITS); INTEGER(MAX_TEXTURE_SIZE); INTEGER(MAX_CUBE_MAP_TEXTURE_SIZE); diff --git a/src/graphics/gpuparticles.cpp b/src/graphics/gpuparticles.cpp index e51f81736..89ccfdc72 100644 --- a/src/graphics/gpuparticles.cpp +++ b/src/graphics/gpuparticles.cpp @@ -449,21 +449,4 @@ void ParticleSystemProxy::render() { m_first_execution = false; simulate(); draw(); -} - -bool ParticleSystemProxy::update() -{ - doParticleSystem(os::Timer::getTime()); - return (IsVisible && (Particles.size() != 0)); -} - -void ParticleSystemProxy::OnRegisterSceneNode() -{ - doParticleSystem(os::Timer::getTime()); - - if (IsVisible && (Particles.size() != 0)) - { - SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT_EFFECT); - ISceneNode::OnRegisterSceneNode(); - } -} +} \ No newline at end of file diff --git a/src/graphics/gpuparticles.hpp b/src/graphics/gpuparticles.hpp index 138734bb9..22844044f 100644 --- a/src/graphics/gpuparticles.hpp +++ b/src/graphics/gpuparticles.hpp @@ -70,7 +70,6 @@ public: virtual void setEmitter(scene::IParticleEmitter* emitter); virtual void render(); - virtual void OnRegisterSceneNode(); void setAlphaAdditive(bool val) { m_alpha_additive = val; } void setIncreaseFactor(float val) { size_increase_factor = val; } void setColorFrom(float r, float g, float b) { m_color_from[0] = r; m_color_from[1] = g; m_color_from[2] = b; } @@ -79,7 +78,6 @@ public: const float* getColorTo() const { return m_color_to; } void setHeightmap(const std::vector >&, float, float, float, float); void setFlip(); - bool update(); }; #endif // GPUPARTICLES_H diff --git a/src/graphics/stkscenemanager.cpp b/src/graphics/stkscenemanager.cpp index fa2f5bf81..a5326473f 100644 --- a/src/graphics/stkscenemanager.cpp +++ b/src/graphics/stkscenemanager.cpp @@ -439,7 +439,7 @@ parseSceneManager(core::list List, std::vector(*I)) { - if (!isCulledPrecise(cam, *I, false) && node->update()) + if (!isCulledPrecise(cam, *I, false)) ParticlesList::getInstance()->push_back(node); continue; } diff --git a/src/guiengine/widgets/icon_button_widget.cpp b/src/guiengine/widgets/icon_button_widget.cpp index fa4c4f4f0..4255895a0 100644 --- a/src/guiengine/widgets/icon_button_widget.cpp +++ b/src/guiengine/widgets/icon_button_widget.cpp @@ -43,7 +43,6 @@ IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop, m_font = NULL; m_texture = NULL; m_highlight_texture = NULL; - m_deactivated_texture = NULL; m_custom_aspect_ratio = 1.0f; m_texture_w = 0; @@ -56,12 +55,6 @@ IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop, m_icon_path_type = pathType; } // ----------------------------------------------------------------------------- -IconButtonWidget::~IconButtonWidget() -{ - if (m_deactivated_texture != NULL) - m_deactivated_texture->drop(); -} -// ----------------------------------------------------------------------------- void IconButtonWidget::add() { // ---- Icon @@ -278,57 +271,22 @@ void IconButtonWidget::unfocused(const int playerID, Widget* new_focus) } } -// ----------------------------------------------------------------------------- -video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* texture) -{ - SColor c; - u32 g; - - video::IVideoDriver* driver = irr_driver->getVideoDriver(); - video::IImage* image = driver->createImageFromData (texture->getColorFormat(), - texture->getSize(), texture->lock(), false); - texture->unlock(); - - //Turn the image into grayscale - for (u32 x = 0; x < image->getDimension().Width; x++) - { - for (u32 y = 0; y < image->getDimension().Height; y++) - { - c = image->getPixel(x, y); - g = ((c.getRed() + c.getGreen() + c.getBlue()) / 3); - c.set(std::max (0, (int)c.getAlpha() - 120), g, g, g); - image->setPixel(x, y, c); - } - } - - texture = driver->addTexture(texture->getName().getPath() + "_disabled", image); - texture->grab(); - - return texture; -} - // ----------------------------------------------------------------------------- void IconButtonWidget::setTexture(video::ITexture* texture) { m_texture = texture; if (texture == NULL) { - if (m_deactivated_texture != NULL) - m_deactivated_texture->drop(); - - m_deactivated_texture = NULL; m_texture_w = 0; m_texture_h = 0; } else { - m_deactivated_texture = getDeactivatedTexture(texture); m_texture_w = texture->getSize().Width; m_texture_h = texture->getSize().Height; } } - // ----------------------------------------------------------------------------- void IconButtonWidget::setLabelFont() { diff --git a/src/guiengine/widgets/icon_button_widget.hpp b/src/guiengine/widgets/icon_button_widget.hpp index 03fb654cd..e4126ab91 100644 --- a/src/guiengine/widgets/icon_button_widget.hpp +++ b/src/guiengine/widgets/icon_button_widget.hpp @@ -44,10 +44,8 @@ namespace GUIEngine private: irr::video::ITexture* m_texture; irr::video::ITexture* m_highlight_texture; - irr::video::ITexture* m_deactivated_texture; int m_texture_w, m_texture_h; - video::ITexture* getDeactivatedTexture(video::ITexture* texture); void setLabelFont(); public: @@ -90,7 +88,7 @@ namespace GUIEngine IconButtonWidget(ScaleMode scale_mode=SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO, const bool tab_stop=true, const bool focusable=true, IconPathType pathType=ICON_PATH_TYPE_RELATIVE); - virtual ~IconButtonWidget(); + virtual ~IconButtonWidget() {}; /** \brief Implement callback from base class Widget */ virtual void add(); @@ -160,8 +158,7 @@ namespace GUIEngine virtual void unfocused(const int playerID, Widget* new_focus); // -------------------------------------------------------------------- /** Returns the texture of this button. */ - const video::ITexture* getTexture() const { - return (Widget::isActivated() ? m_texture : m_deactivated_texture); } + const video::ITexture* getTexture() const { return m_texture; } }; } diff --git a/src/physics/btKart.cpp b/src/physics/btKart.cpp index 2b807b322..3a992c689 100644 --- a/src/physics/btKart.cpp +++ b/src/physics/btKart.cpp @@ -390,6 +390,9 @@ void btKart::updateVehicle( btScalar step ) m_num_wheels_on_ground++; } + // Test if the kart is falling so fast + // that the chassis might hit the track + // ------------------------------------ bool needs_cushioning_test = false; for(int i=0; igetLinearVelocity(); btVector3 down(0, 1, 0); btVector3 v_down = (v * down) * down; - btScalar max_compensate_speed = m_wheelInfo[0].m_maxSuspensionForce * m_chassisBody->getInvMass() * step *4; + // Estimate what kind of downward speed can be compensated by the + // suspension. Atm the parameters are set that the suspension is + // actually capped at max suspension force, so the maximum + // speed that can be caught by the suspension without the chassis + // hitting the ground can be based on that. Note that there are + // 4 suspensions, all adding together. + btScalar max_compensate_speed = m_wheelInfo[0].m_maxSuspensionForce + * m_chassisBody->getInvMass() + * step * 4; + // If the downward speed is too fast to be caught by the suspension, + // slow down the falling speed by applying an appropriately impulse: if(-v_down.getY() > max_compensate_speed) { - btVector3 impulse = down * (-v_down.getY() - max_compensate_speed) / m_chassisBody->getInvMass(); - float v_old = m_chassisBody->getLinearVelocity().getY(); + btVector3 impulse = down * (-v_down.getY() - max_compensate_speed) + / m_chassisBody->getInvMass(); + //float v_old = m_chassisBody->getLinearVelocity().getY(); m_chassisBody->applyCentralImpulse(impulse); - Log::verbose("physics", "Cushioning %f from %f m/s to %f m/s", impulse.getY(), - v_old, m_chassisBody->getLinearVelocity().getY()); + //Log::verbose("physics", "Cushioning %f from %f m/s to %f m/s", impulse.getY(), + // v_old, m_chassisBody->getLinearVelocity().getY()); } } for(int i=0; igetSpeed() - * m_kart->getKartProperties()->getDownwardImpulseFactor(); - btVector3 downwards_impulse = m_chassisBody->getWorldTransform().getBasis() - * btVector3(0, f, 0); - m_chassisBody->applyCentralImpulse(downwards_impulse); + // If configured, add a force to keep karts on the track + // ----------------------------------------------------- + float dif = m_kart->getKartProperties()->getDownwardImpulseFactor(); + if(dif!=0) + { + float f = -m_kart->getSpeed() * dif; + btVector3 downwards_impulse = m_chassisBody->getWorldTransform().getBasis() + * btVector3(0, f, 0); + m_chassisBody->applyCentralImpulse(downwards_impulse); + } + // Apply additional impulse set by supertuxkart + // -------------------------------------------- if(m_time_additional_impulse>0) { float dt = step > m_time_additional_impulse @@ -528,6 +555,8 @@ void btKart::updateVehicle( btScalar step ) m_time_additional_impulse -= dt; } + // Apply additional rotation set by supertuxkart + // --------------------------------------------- if(m_time_additional_rotation>0) { btTransform &t = m_chassisBody->getWorldTransform();