Merge remote-tracking branch 'origin/master' into simplify-world

This commit is contained in:
hiker 2016-12-13 09:19:24 +11:00
commit ed7574ca85
9 changed files with 106 additions and 24 deletions

57
.appveyor.yml Normal file
View File

@ -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

View File

@ -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:

View File

@ -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.);
}

View File

@ -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.);
}

View File

@ -22,7 +22,7 @@
#include <libkern/OSByteOrder.h>
#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 <sys/endian.h>
#define bswap_16(X) bswap16(X)
#define bswap_32(X) bswap32(X)

View File

@ -80,27 +80,45 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id,
m_children.push_back(skill_bar);
}
setValues(props);
move(area.UpperLeftCorner.X, area.UpperLeftCorner.Y,
area.getWidth(), area.getHeight());
} // KartStatsWidget
// -----------------------------------------------------------------------------
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;
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)
((props->getCombinedCharacteristic()->getMass() - 20) / 4));
((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)
((props->getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6));
((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) ((props->getAvgPower() - 30) / 20));
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);
move(area.UpperLeftCorner.X, area.UpperLeftCorner.Y,
area.getWidth(), area.getHeight());
} // KartStatsWidget
race_manager->setDifficulty(previous_difficulty);
}
// -----------------------------------------------------------------------------

View File

@ -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);

View File

@ -545,6 +545,8 @@ public:
bool getSkidEnabled() const;
/* <characteristics-end kpdefs> */
LEAK_CHECK()
}; // KartProperties
#endif

View File

@ -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);
}
}