From ae0b1136f533ce63cdb2835da2bc0d16768a95ed Mon Sep 17 00:00:00 2001 From: samuncle Date: Fri, 9 Dec 2016 11:38:56 -0500 Subject: [PATCH 1/6] better shader for underwater vegetation --- data/shaders/grass_pass2.frag | 3 ++- data/shaders/instanced_grass_pass2.frag | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data/shaders/grass_pass2.frag b/data/shaders/grass_pass2.frag index 76776c200..b5ebadbd9 100644 --- a/data/shaders/grass_pass2.frag +++ b/data/shaders/grass_pass2.frag @@ -54,6 +54,7 @@ void main(void) float scattering = mix(fPowEdotL, fLdotNBack, .5); float specmap = texture(SpecMap, uv).g; - vec3 LightFactor = color.xyz * (scattering * 0.1) + getLightFactor(color.xyz, vec3(1.), specmap, 0.); + float emitmap = texture(SpecMap, uv).b; + vec3 LightFactor = color.xyz * (scattering * 0.1) + getLightFactor(color.xyz, vec3(1.), specmap, emitmap); FragColor = vec4(LightFactor, 1.); } diff --git a/data/shaders/instanced_grass_pass2.frag b/data/shaders/instanced_grass_pass2.frag index bcce07ad3..4d69593f0 100644 --- a/data/shaders/instanced_grass_pass2.frag +++ b/data/shaders/instanced_grass_pass2.frag @@ -25,6 +25,7 @@ void main(void) #ifdef Use_Bindless_Texture vec4 color = texture(handle, uv); float specmap = texture(secondhandle, uv).g; + float emitmap = texture(secondhandle, uv).b; float mask = texture(thirdhandle, uv).a; #ifdef SRGBBindlessFix color.xyz = pow(color.xyz, vec3(2.2)); @@ -32,6 +33,7 @@ void main(void) #else vec4 color = texture(Albedo, uv); float specmap = texture(SpecMap, uv).g; + float emitmap = texture(SpecMap, uv).b; float mask = texture(colorization_mask, uv).a; #endif if (color.a < 0.5) discard; @@ -59,7 +61,8 @@ void main(void) float fLdotNBack = max(0., - dot(nor, L) * 0.6 + 0.4); float scattering = mix(fPowEdotL, fLdotNBack, .5); + + vec3 LightFactor = color.xyz * (scattering * 0.1) + getLightFactor(color.xyz, vec3(1.), specmap, emitmap); - vec3 LightFactor = color.xyz * (scattering * 0.1) + getLightFactor(color.xyz, vec3(1.), specmap, 0.); FragColor = vec4(LightFactor, 1.); } From 244c812cf3b2d2b133a48cb6e8eaf45aedcc896e Mon Sep 17 00:00:00 2001 From: Daniel Butum Date: Mon, 12 Dec 2016 02:15:37 +0200 Subject: [PATCH 2/6] Add travis server only matrix configuration (#2682) Also increase number of threads for the gcc builds --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2b52e85b3..e5a58839d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -# Travis-CI configuration file for SuperTuxKart +# Travis-CI configuration file for SuperTuxKart # # Configuration manual: # http://docs.travis-ci.com/user/build-configuration/ @@ -14,8 +14,10 @@ matrix: env: matrix: - - BUILD_TYPE="Debug" - - BUILD_TYPE="Release" + - BUILD_TYPE="Debug" SERVER_ONLY="OFF" + - BUILD_TYPE="Debug" SERVER_ONLY="ON" + - BUILD_TYPE="Release" SERVER_ONLY="OFF" + - BUILD_TYPE="Release" SERVER_ONLY="ON" addons: apt: @@ -39,8 +41,9 @@ addons: before_script: # Unfortunately using all threads crashes g++: "g++: internal compiler error: Killed (program cc1plus)" + # Use half of the available threads, gcc is memory hungry - 'if [ ${CC} = "gcc" ]; then - export THREADS=4; + export THREADS=$((`nproc` / 2)); else export THREADS=$((`nproc` + 1)); fi' @@ -50,7 +53,7 @@ before_script: script: - mkdir "build" - cd "build" - - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCHECK_ASSETS=off + - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSERVER_ONLY=$SERVER_ONLY -DCHECK_ASSETS=off - make VERBOSE=1 -j $THREADS notifications: From 62e1a2ddccd8ab3201dfe849018084e639cbdb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20=C3=96lschlegel?= Date: Mon, 12 Dec 2016 01:16:47 +0100 Subject: [PATCH 3/6] Add a little more BSD detection (#2685) Tested for NetBSD, the same signature has DragonFly(http://fxr.watson.org/fxr/source/sys/endian.h?v=DFBSD#L42) --- lib/irrlicht/source/Irrlicht/os.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/irrlicht/source/Irrlicht/os.cpp b/lib/irrlicht/source/Irrlicht/os.cpp index 5096bf9d0..fd14dda61 100644 --- a/lib/irrlicht/source/Irrlicht/os.cpp +++ b/lib/irrlicht/source/Irrlicht/os.cpp @@ -22,7 +22,7 @@ #include #define bswap_16(X) OSReadSwapInt16(&X,0) #define bswap_32(X) OSReadSwapInt32(&X,0) -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) #include #define bswap_16(X) bswap16(X) #define bswap_32(X) bswap32(X) From aaecd58fc0d1c4c9fb6f241aa342f9adb14025b8 Mon Sep 17 00:00:00 2001 From: Corentin Pazdera Date: Mon, 12 Dec 2016 01:52:15 +0100 Subject: [PATCH 4/6] Adding appveyor config file (#2652) I am unfamiliar with appveyor myself but I can merge the file. Next step would be for someone to take a look at settuping an account --- .appveyor.yml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..ac3e4f287 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,57 @@ +environment: + DEPS_DIR: c:\\projects\dependencies + ASSETS_DIR: c:\\projects\stk-assets + APPVEYOR_CACHE_ENTRY_ZIP_ARGS: -t7z -m0=lzma2 -mx=9 + +os: Visual Studio 2015 +clone_depth: 1 +shallow_clone: true + +platform: + - x86 + #- x64 + +configuration: + - Debug + - Release + +matrix: + fast_finish: true + +cache: + - '%DEPS_DIR%' + #- '%ASSETS_DIR%' + +install: + - ps: >- + If(!(Test-Path "$env:DEPS_DIR")) { + Write-Host "Downloading dependencies"; + Start-Process -FilePath "git" -ArgumentList "clone --branch master --single-branch --depth 1 https://github.com/supertuxkart/dependencies.git $env:DEPS_DIR" -Wait; + } + Else { + Write-Host "Updating dependencies"; + Start-Process -FilePath "git" -ArgumentList "fetch --depth 1" -WorkingDirectory "$env:DEPS_DIR" -Wait; + } + Get-ChildItem $env:DEPS_DIR | Measure-Object -property length -sum + #- ps: >- + #If(!(Test-Path "$env:ASSETS_DIR")) { + # Write-Host "Downloading assets"; + # Start-Process -FilePath "svn" -ArgumentList "checkout https://svn.code.sf.net/p/supertuxkart/code/stk-assets $env:ASSETS_DIR" -Wait; + #} + #Else { + # Write-Host "Updating assets"; + # Start-Process -FilePath "svn" -ArgumentList "update" -WorkingDirectory "$env:ASSETS_DIR" -Wait; + #} + #Get-ChildItem $env:ASSETS_DIR | Measure-Object -property length -sum + +before_build: + - ps: Copy-Item "${env:DEPS_DIR}\windows\dependencies" c:\projects\stk-code\dependencies –Recurse + - cmd: | + md build + cd build + if "%platform%"=="x86" set CMAKE_GENERATOR_NAME="Visual Studio 14 2015" + cmake -G %CMAKE_GENERATOR_NAME% -DCMAKE_BUILD_TYPE="%configuration%" .. -DCHECK_ASSETS=OFF + +build: + parallel: true + project: build\ALL_BUILD.vcxproj From ab7ded308a84be73e538271ebed1d6b273e4b9b7 Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Sun, 11 Dec 2016 20:16:44 -0500 Subject: [PATCH 5/6] Make presentation of kart characteristics uniform and indepdendent of difficulty. Fixes #2684, fixes #2539 --- src/guiengine/widgets/kart_stats_widget.cpp | 54 ++++++++++++++------- src/guiengine/widgets/kart_stats_widget.hpp | 3 ++ src/karts/kart_properties.hpp | 4 +- src/states_screens/kart_selection.cpp | 9 +--- 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/src/guiengine/widgets/kart_stats_widget.cpp b/src/guiengine/widgets/kart_stats_widget.cpp index de33d5a21..84f347ef8 100644 --- a/src/guiengine/widgets/kart_stats_widget.cpp +++ b/src/guiengine/widgets/kart_stats_widget.cpp @@ -80,23 +80,7 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id, m_children.push_back(skill_bar); } - // Scale the values so they look better - // The scaling factor and offset were found by trial and error. - // It should look nice and you should be able to see the difference between - // different masses or velocities. - m_skills[SKILL_MASS]->setValue((int) - ((props->getCombinedCharacteristic()->getMass() - 20) / 4)); - m_skills[SKILL_MASS]->setLabel(_("WEIGHT")); - m_skills[SKILL_MASS]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_mass", m_player_id); - - m_skills[SKILL_SPEED]->setValue((int) - ((props->getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6)); - m_skills[SKILL_SPEED]->setLabel(_("SPEED")); - m_skills[SKILL_SPEED]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_speed", m_player_id); - - m_skills[SKILL_POWER]->setValue((int) ((props->getAvgPower() - 30) / 20)); - m_skills[SKILL_POWER]->setLabel(_("POWER")); - m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id); + setValues(props); move(area.UpperLeftCorner.X, area.UpperLeftCorner.Y, area.getWidth(), area.getHeight()); @@ -104,6 +88,42 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id, // ----------------------------------------------------------------------------- +void KartStatsWidget::setValues(const KartProperties* props) +{ + // Use kart properties computed for "hard" difficulty to show the user, so + // that properties don't change according to the the last used difficulty + // (And because this code uses arbitrary scaling factors to make them look + // nice and the arbitrary factors were optimised for hard difficulty) + RaceManager::Difficulty previous_difficulty = race_manager->getDifficulty(); + race_manager->setDifficulty(RaceManager::DIFFICULTY_HARD); + //KartProperties* kp_computed = new KartProperties(); + KartProperties kp_computed; + kp_computed.copyForPlayer(props); + + // Scale the values so they look better + // The scaling factor and offset were found by trial and error. + // It should look nice and you should be able to see the difference between + // different masses or velocities. + m_skills[SKILL_MASS]->setValue((int) + ((kp_computed.getCombinedCharacteristic()->getMass() - 20) / 4)); + m_skills[SKILL_MASS]->setLabel(_("WEIGHT")); + m_skills[SKILL_MASS]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_mass", m_player_id); + + m_skills[SKILL_SPEED]->setValue((int) + ((kp_computed.getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6)); + m_skills[SKILL_SPEED]->setLabel(_("SPEED")); + m_skills[SKILL_SPEED]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_speed", m_player_id); + + m_skills[SKILL_POWER]->setValue((int)((kp_computed.getAvgPower() - 30) / 20)); + m_skills[SKILL_POWER]->setLabel(_("POWER")); + m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id); + + race_manager->setDifficulty(previous_difficulty); + +} + +// ----------------------------------------------------------------------------- + void KartStatsWidget::add() { for (int i = 0; i < SKILL_COUNT; ++i) { diff --git a/src/guiengine/widgets/kart_stats_widget.hpp b/src/guiengine/widgets/kart_stats_widget.hpp index e78aa4555..ccdc13e57 100644 --- a/src/guiengine/widgets/kart_stats_widget.hpp +++ b/src/guiengine/widgets/kart_stats_widget.hpp @@ -30,6 +30,7 @@ #include "guiengine/widgets/progress_bar_widget.hpp" #include "guiengine/widgets/skill_level_widget.hpp" +class KartProperties; namespace GUIEngine { @@ -91,6 +92,8 @@ namespace GUIEngine * inside itself */ void setSize(const int x, const int y, const int w, const int h); + void setValues(const KartProperties* props); + /** Change the value of the widget, it must be a percent. */ void setValue(Stats type, int value); diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp index 89f916433..c5ca77816 100644 --- a/src/karts/kart_properties.hpp +++ b/src/karts/kart_properties.hpp @@ -544,7 +544,9 @@ public: float getSkidReduceTurnMax() const; bool getSkidEnabled() const; - /* */ + /* */ + + LEAK_CHECK() }; // KartProperties #endif diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index cf53a07be..66e07d977 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -809,15 +809,10 @@ void KartSelectionScreen::updateKartStats(uint8_t widget_id, const KartProperties *kp = kart_properties_manager->getKart(selection); + if (kp != NULL) { - // Scale the values so they look better - w->setValue(KartStatsWidget::SKILL_MASS, (int) - ((kp->getCombinedCharacteristic()->getMass() - 20) / 4)); - w->setValue(KartStatsWidget::SKILL_SPEED, (int) - ((kp->getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6)); - w->setValue(KartStatsWidget::SKILL_POWER, (int) - ((kp->getAvgPower() - 30) / 20)); + w->setValues(kp); w->update(0); } } From 044e8c52e142a351456d63667c785f43734d5504 Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Sun, 11 Dec 2016 20:19:58 -0500 Subject: [PATCH 6/6] Fix tabs added in previous commit, used spaces instead... --- src/guiengine/widgets/kart_stats_widget.cpp | 58 ++++++++++----------- src/guiengine/widgets/kart_stats_widget.hpp | 2 +- src/karts/kart_properties.hpp | 6 +-- src/states_screens/kart_selection.cpp | 2 +- 4 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/guiengine/widgets/kart_stats_widget.cpp b/src/guiengine/widgets/kart_stats_widget.cpp index 84f347ef8..9860b1fce 100644 --- a/src/guiengine/widgets/kart_stats_widget.cpp +++ b/src/guiengine/widgets/kart_stats_widget.cpp @@ -90,36 +90,34 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id, void KartStatsWidget::setValues(const KartProperties* props) { - // Use kart properties computed for "hard" difficulty to show the user, so - // that properties don't change according to the the last used difficulty - // (And because this code uses arbitrary scaling factors to make them look - // nice and the arbitrary factors were optimised for hard difficulty) - RaceManager::Difficulty previous_difficulty = race_manager->getDifficulty(); - race_manager->setDifficulty(RaceManager::DIFFICULTY_HARD); - //KartProperties* kp_computed = new KartProperties(); - KartProperties kp_computed; - kp_computed.copyForPlayer(props); - - // Scale the values so they look better - // The scaling factor and offset were found by trial and error. - // It should look nice and you should be able to see the difference between - // different masses or velocities. - m_skills[SKILL_MASS]->setValue((int) - ((kp_computed.getCombinedCharacteristic()->getMass() - 20) / 4)); - m_skills[SKILL_MASS]->setLabel(_("WEIGHT")); - m_skills[SKILL_MASS]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_mass", m_player_id); - - m_skills[SKILL_SPEED]->setValue((int) - ((kp_computed.getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6)); - m_skills[SKILL_SPEED]->setLabel(_("SPEED")); - m_skills[SKILL_SPEED]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_speed", m_player_id); - - m_skills[SKILL_POWER]->setValue((int)((kp_computed.getAvgPower() - 30) / 20)); - m_skills[SKILL_POWER]->setLabel(_("POWER")); - m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id); - - race_manager->setDifficulty(previous_difficulty); - + // Use kart properties computed for "hard" difficulty to show the user, so + // that properties don't change according to the the last used difficulty + // (And because this code uses arbitrary scaling factors to make them look + // nice and the arbitrary factors were optimised for hard difficulty) + RaceManager::Difficulty previous_difficulty = race_manager->getDifficulty(); + race_manager->setDifficulty(RaceManager::DIFFICULTY_HARD); + KartProperties kp_computed; + kp_computed.copyForPlayer(props); + + // Scale the values so they look better + // The scaling factor and offset were found by trial and error. + // It should look nice and you should be able to see the difference between + // different masses or velocities. + m_skills[SKILL_MASS]->setValue((int) + ((kp_computed.getCombinedCharacteristic()->getMass() - 20) / 4)); + m_skills[SKILL_MASS]->setLabel(_("WEIGHT")); + m_skills[SKILL_MASS]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_mass", m_player_id); + + m_skills[SKILL_SPEED]->setValue((int) + ((kp_computed.getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6)); + m_skills[SKILL_SPEED]->setLabel(_("SPEED")); + m_skills[SKILL_SPEED]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_speed", m_player_id); + + m_skills[SKILL_POWER]->setValue((int)((kp_computed.getAvgPower() - 30) / 20)); + m_skills[SKILL_POWER]->setLabel(_("POWER")); + m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id); + + race_manager->setDifficulty(previous_difficulty); } // ----------------------------------------------------------------------------- diff --git a/src/guiengine/widgets/kart_stats_widget.hpp b/src/guiengine/widgets/kart_stats_widget.hpp index ccdc13e57..d24ec1134 100644 --- a/src/guiengine/widgets/kart_stats_widget.hpp +++ b/src/guiengine/widgets/kart_stats_widget.hpp @@ -92,7 +92,7 @@ namespace GUIEngine * inside itself */ void setSize(const int x, const int y, const int w, const int h); - void setValues(const KartProperties* props); + void setValues(const KartProperties* props); /** Change the value of the widget, it must be a percent. */ void setValue(Stats type, int value); diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp index c5ca77816..8a6ef3e8a 100644 --- a/src/karts/kart_properties.hpp +++ b/src/karts/kart_properties.hpp @@ -544,9 +544,9 @@ public: float getSkidReduceTurnMax() const; bool getSkidEnabled() const; - /* */ - - LEAK_CHECK() + /* */ + + LEAK_CHECK() }; // KartProperties #endif diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index 66e07d977..510022e23 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -812,7 +812,7 @@ void KartSelectionScreen::updateKartStats(uint8_t widget_id, if (kp != NULL) { - w->setValues(kp); + w->setValues(kp); w->update(0); } }