diff --git a/data/shaders/tonemap.frag b/data/shaders/tonemap.frag index f7b2d54b7..d859bd492 100644 --- a/data/shaders/tonemap.frag +++ b/data/shaders/tonemap.frag @@ -33,6 +33,8 @@ void main() // Uncharted2 tonemap with Auria's custom coefficients vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.2 * col + 1.7) + 0.06); + // Protect us from negative coefficient just in case... + perChannel = max(perChannel, vec4(0.)); perChannel = pow(perChannel, vec4(2.2)); vec2 inside = uv - 0.5; diff --git a/data/shaders/utils/getLightFactor.frag b/data/shaders/utils/getLightFactor.frag index 9bf4cdf58..c17a3ca8b 100644 --- a/data/shaders/utils/getLightFactor.frag +++ b/data/shaders/utils/getLightFactor.frag @@ -14,6 +14,6 @@ vec3 getLightFactor(float specMapValue) vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz; vec3 SpecularComponent = texture(SpecularMap, tc).xyz; float ao = texture(SSAO, tc).x; - vec3 tmp = DiffuseComponent + SpecularComponent * specMapValue; + vec3 tmp = DiffuseComponent + SpecularComponent * max(specMapValue, 0.); return tmp * ao; } \ No newline at end of file diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index d22b43f0f..efa5cb36c 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -493,7 +493,11 @@ void IrrDriver::initDevice() if (strstr((const char *)glGetString(GL_VENDOR), "ATI") != NULL) m_need_srgb_workaround = true; } +#ifdef WIN32 m_glsl = (GLMajorVersion > 3 || (GLMajorVersion == 3 && GLMinorVersion >= 3)); +#else + m_glsl = (GLMajorVersion > 3 || (GLMajorVersion == 3 && GLMinorVersion >= 1)); +#endif initGL(); // Parse extensions diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 5b225a9f7..42559bfda 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -464,16 +464,21 @@ void PostProcessing::renderMotionBlur(unsigned cam, FrameBuffer &in_fbo, FrameBu scene::ICameraSceneNode * const camnode = Camera::getCamera(cam)->getCameraSceneNode(); - // Calculate the kart's Y position on screen - const core::vector3df pos = - Camera::getCamera(cam)->getKart()->getNode()->getPosition(); - float ndc[4]; - core::matrix4 trans = camnode->getProjectionMatrix(); - trans *= camnode->getViewMatrix(); - trans.transformVect(ndc, pos); - const float karty = (ndc[1] / ndc[3]) * 0.5f + 0.5f; - setMotionBlurCenterY(cam, karty); + // Calculate the kart's Y position on screen + if (Camera::getCamera(cam)->getKart()) + { + const core::vector3df pos = Camera::getCamera(cam)->getKart()->getNode()->getPosition(); + float ndc[4]; + core::matrix4 trans = camnode->getProjectionMatrix(); + trans *= camnode->getViewMatrix(); + + trans.transformVect(ndc, pos); + const float karty = (ndc[1] / ndc[3]) * 0.5f + 0.5f; + setMotionBlurCenterY(cam, karty); + } + else + setMotionBlurCenterY(cam, 0.5f); out_fbo.Bind(); glClear(GL_COLOR_BUFFER_BIT); diff --git a/src/graphics/stkanimatedmesh.cpp b/src/graphics/stkanimatedmesh.cpp index d7d0f883b..af7ba9adb 100644 --- a/src/graphics/stkanimatedmesh.cpp +++ b/src/graphics/stkanimatedmesh.cpp @@ -105,6 +105,15 @@ void STKAnimatedMesh::updateNoGL() } isMaterialInitialized = true; } + + for (u32 i = 0; i < m->getMeshBufferCount(); ++i) + { + scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i); + if (!mb) + continue; + if (mb) + GLmeshes[i].TextureMatrix = getMaterial(i).getTextureMatrix(0); + } } void STKAnimatedMesh::updateGL() @@ -177,8 +186,6 @@ void STKAnimatedMesh::updateGL() glBindBuffer(GL_ARRAY_BUFFER, 0); } } - if (mb) - GLmeshes[i].TextureMatrix = getMaterial(i).getTextureMatrix(0); } } diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index a998896e8..8ff6920ca 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -59,6 +59,7 @@ CutsceneWorld::CutsceneWorld() : World() WorldStatus::setClockMode(CLOCK_NONE); m_use_highscores = false; m_play_racestart_sounds = false; + m_fade_duration = 1.0f; } // CutsceneWorld //----------------------------------------------------------------------------- @@ -240,13 +241,13 @@ void CutsceneWorld::update(float dt) float fade = 0.0f; float fadeIn = -1.0f; float fadeOut = -1.0f; - if (m_time < 2.0f) + if (m_time < m_fade_duration) { - fadeIn = 1.0f - (float)m_time / 2.0f; + fadeIn = 1.0f - (float)m_time / m_fade_duration; } - if (m_time > m_duration - 2.0f) + if (m_time > m_duration - m_fade_duration) { - fadeOut = (float)(m_time - (m_duration - 2.0f)) / 2.0f; + fadeOut = (float)(m_time - (m_duration - m_fade_duration)) / m_fade_duration; } if (fadeIn >= 0.0f && fadeOut >= 0.0f) diff --git a/src/modes/cutscene_world.hpp b/src/modes/cutscene_world.hpp index 4b35b6b70..30b882287 100644 --- a/src/modes/cutscene_world.hpp +++ b/src/modes/cutscene_world.hpp @@ -45,6 +45,8 @@ class CutsceneWorld : public World double m_duration; bool m_aborted; + float m_fade_duration; + // TODO find a better way than static static bool s_use_duration; @@ -109,7 +111,7 @@ public: // ------------------------------------------------------------------------ void abortCutscene() { - if (m_time < m_duration - 2.0f) m_duration = m_time + 2.0f; + if (m_time < m_duration - m_fade_duration) m_duration = m_time + m_fade_duration; m_aborted = true; } diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index c32dc85ca..2202a568a 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -904,6 +904,9 @@ void KartHoverListener::onSelectionChanged(DynamicRibbonWidget* theWidget, return; } + if (m_parent->m_kart_widgets[playerID].getKartInternalName() == selectionID) + return; // already selected + m_parent->updateKartWidgetModel(playerID, selectionID, selectionText); m_parent->m_kart_widgets[playerID].setKartInternalName(selectionID); m_parent->updateKartStats(playerID, selectionID);