Skip to content

Commit

Permalink
Merge pull request #5 from supertuxkart/master
Browse files Browse the repository at this point in the history
Update fork
  • Loading branch information
Alayan-stk-2 authored Apr 16, 2018
2 parents 607ee6e + 292243d commit e397359
Show file tree
Hide file tree
Showing 31 changed files with 696 additions and 113 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ mesa-common-dev pkg-config zlib1g-dev
```
### In-game recorder

In order to build the in-game recorder for STK, you have to install
To build the in-game recorder for STK, you have to install
libopenglrecorder from your distribution, or compile it yourself from [here](https://github.com/Benau/libopenglrecorder).
Compilation instruction is explained there. If you don't need this feature, pass `-DBUILD_RECORDER=off` to cmake.

### Compiling

Run the following commands inside `stk-code` directory to compile SuperTuxKart:
To compile SuperTuxKart, run the following commands inside `stk-code` directory:

```bash
mkdir cmake_build
Expand All @@ -80,6 +80,21 @@ make -j4
```
STK can then be run from the build directory with `bin/supertuxkart`

#### Keeping your build up to date

To recompile the latest code without redownloading the entire source, first run the ```svn up``` command inside the 'stk-assets' directory, then run the following commands inside the 'stk-code' directory:

```bash
git pull
cd cmake_build
cmake ..
make -j4
```

##### Build Speed Optimization

"-j4" is an example, for a faster build, use "-jx" instead, where "x" is the amount of CPU threads you have, minus one.

### Further options

To create a debug version of STK, run:
Expand Down
2 changes: 1 addition & 1 deletion data/challenges/startrack.challenge
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<challenge version="2">
<track id="stk_enterprise" laps="3"/>
<mode major="single" minor="followtheleader"/>
<mode major="single" minor="quickrace"/>
<requirements trophies="110"/>

<hard>
Expand Down
Binary file modified data/gui/gauge_empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/gui/gauge_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/gui/gauge_full_bright.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/gui/gauge_goal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 8 additions & 5 deletions data/gui/init_android.stkgui
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
<stkgui>
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >

<spacer height="2%" width="25"/>
<box width="100%" height="75%" padding="10" layout="vertical-row">
<bright width="100%" text="Select a type of control that you prefer" align="center" text_align="left" />
<box width="100%" height="80%" padding="10" layout="vertical-row">
<bright width="100%" text="Select a type of control that you prefer" align="center" text_align="left" word_wrap="true"/>

<spacer height="15%" width="10"/>
<spacer height="7%" width="10"/>

<ribbon id="control_type" height="60%" width="100%" align="center">
<ribbon id="control_type" proportion="1" width="100%" align="center">
<icon-button id="accelerometer" width="fit" height="fit" icon="gui/difficulty_medium.png"
I18N="Control type" text="Accelerometer"/>
<icon-button id="steering_wheel" width="fit" height="fit" icon="gui/difficulty_hard.png"
I18N="Control type" text="Steering wheel"/>
</ribbon>

<spacer height="12%" width="10"/>

<label width="100%" text="You can change it later in touch device settings." text_align="left" word_wrap="true"/>
</box>

<spacer height="7%" width="10"/>
Expand Down
Binary file modified data/gui/speed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/gui/speedback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/gui/speedfore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 17 additions & 13 deletions data/kart_characteristics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -312,21 +312,27 @@
max-speed-increase="5" duration="1" fade-out-time="2" max="20" />

<!-- Slipstream
base-speed: the speed for which length and width are valid.
They are upscaled when faster and downscaled when slower.
length: How far behind a kart slipstream works
(note : this helps OTHER karts)
width: how wide slipstream works furthest away from the kart.
inner-factor: The proportion of the slipstreaming area with
twice faster slipstream "credits" collection.
collect-time: How many seconds of sstream give maximum benefit
use-time: How long the benefit will last.
add-power: Additional power due to sstreaming. 1 = +100%
use-time: How long the benefit will last (obsolete, unused).
add-power: Additional power due to sstreaming.
min-speed: Minimum speed necessary for slipstream to take effect.
max-speed-increase: How much the speed of the kart might exceed
its normal maximum speed.
duration: How long the higher speed lasts after slipstream stopped
working.
working (it works for at least collect-time more if the kart
don't go behind another kart to get further sstreaming time)
fade-out-time: How long the slip stream speed increase will
gradually be reduced. -->
<slipstream length="10" width="2" collect-time="2" use-time="5"
add-power="3" min-speed="10" max-speed-increase="5"
duration="1" fade-out-time="2" />
<slipstream base-speed="20" length="8" width="4" inner-factor="0.5"
collect-time="2" use-time="5" add-power="200" min-speed="8"
max-speed-increase="5" duration="1" fade-out-time="2" />
</characteristic>

<!-- The different difficulties (like easy, medium, hard) -->
Expand Down Expand Up @@ -360,9 +366,8 @@
invulnerability-time="7" />
<nitro engine-force="350" max-speed-increase="4.5" duration="1.5"
fade-out-time="2.5" />
<slipstream length="11" collect-time="1.5" use-time="2.5" add-power="3.2"
min-speed="9" max-speed-increase="4" duration="1.2"
fade-out-time="2.3" />
<slipstream length="*0.9" collect-time="*0.9" add-power="*1.1"
duration="*1.2" fade-out-time="*1.1" />
</characteristic>
<characteristic name="medium">
<engine power="*0.63" max-speed="*1" brake-factor="*0.73"
Expand All @@ -374,8 +379,7 @@
<explosion time="1.8" radius="5"
invulnerability-time="6" />
<nitro engine-force="425" consumption="1.4" duration="1" />
<slipstream use-time="3.3" add-power="2.8" duration="0.9"
fade-out-time="1.6" />
<slipstream add-power="*0.9" duration="*0.9" fade-out-time="*0.9" />
</characteristic>
<characteristic name="heavy">
<engine power="*1" max-speed="*1" brake-factor="*0.66"
Expand All @@ -390,8 +394,8 @@
invulnerability-time="6" />
<nitro engine-force="600" consumption="2" max-speed-increase="8"
duration="0.7" fade-out-time="1.3" />
<slipstream length="8.5" use-time="4" add-power="2.7" min-speed="10.5"
max-speed-increase="8" duration="0.7" fade-out-time="1" />
<slipstream length="*1.1" collect-time="*1.1" add-power="*0.8"
duration="*0.7" fade-out-time="*0.7" />
</characteristic>
</kart-types>

Expand Down
90 changes: 90 additions & 0 deletions data/shaders/sp_road_blending.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
in vec3 bitangent;
in vec4 color;
in float hue_change;
in vec3 normal;
in vec3 tangent;
in vec2 uv;
in vec4 world_position;
in float camdist;

layout(location = 0) out vec4 o_diffuse_color;
layout(location = 1) out vec4 o_normal_color;

#stk_include "utils/encode_normal.frag"
#stk_include "utils/rgb_conversion.frag"
#stk_include "utils/sp_texture_sampling.frag"

void main()
{
vec2 uuv = vec2(world_position.x, world_position.z);
uuv *= 0.2;
vec4 col = multi_sampleTextureLayer0(uv, camdist);

float mask = sampleTextureLayer4(uuv * 2.0).r;

//* (1.0 - color.g)
mask = mix(1.0, mask, color.r);
mask = mix(0.0, mask, 1.0 - color.g);
if(mask < 0.5)
{
discard;
}

// Adding some skidding marks to the road
float mask_2 = sampleTextureLayer4(uuv * 0.1).r;
float mask_3 = sampleTextureLayer4(uuv * 3.5).r;
mask_2 = pow(mask_2, 1.5);
mask_2 *= pow(mask_3, 0.5);

float skidding_marks = sampleTextureLayer5(uv * 10).g;
skidding_marks *= mask_2;
col = mix(col, vec4(0.0, 0.0, 0.0, 1.0), skidding_marks);

float skidding_marks_2 = sampleTextureLayer5(uv * 15).g;
skidding_marks_2 *= mask_2;
col = mix(col, vec4(0.0, 0.0, 0.0, 1.0), skidding_marks_2);

// Add some cracks
float cracks_marks = sampleTextureLayer5(uv * 11).b;
float crack_mask = sampleTextureLayer4(uuv * 0.5).r;
cracks_marks *= crack_mask;
col = mix(col, vec4(0.0, 0.0, 0.0, 1.0), cracks_marks);

if (hue_change > 0.0)
{
float mask = col.a;
vec3 old_hsv = rgbToHsv(col.rgb);
float mask_step = step(mask, 0.5);
#if !defined(Advanced_Lighting_Enabled)
// For similar color
float saturation = mask * 1.825; // 2.5 * 0.5 ^ (1. / 2.2)
#else
float saturation = mask * 2.5;
#endif
vec2 new_xy = mix(vec2(old_hsv.x, old_hsv.y), vec2(hue_change,
max(old_hsv.y, saturation)), vec2(mask_step, mask_step));
vec3 new_color = hsvToRgb(vec3(new_xy.x, new_xy.y, old_hsv.z));
col = vec4(new_color.r, new_color.g, new_color.b, 1.0);
}

vec3 final_color = col.xyz; // * color.xyz;

#if defined(Advanced_Lighting_Enabled)
vec4 layer_2 = multi_sampleTextureLayer2(uv, camdist);
vec4 layer_3 = multi_sampleTextureLayer3(uv, camdist);
o_diffuse_color = vec4(final_color, layer_2.z);

vec3 tangent_space_normal = 2.0 * layer_3.xyz - 1.0;
vec3 frag_tangent = normalize(tangent);
vec3 frag_bitangent = normalize(bitangent);
vec3 frag_normal = normalize(normal);
mat3 t_b_n = mat3(frag_tangent, frag_bitangent, frag_normal);

vec3 world_normal = t_b_n * tangent_space_normal;

o_normal_color.xy = 0.5 * EncodeNormal(normalize(world_normal)) + 0.5;
o_normal_color.zw = layer_2.xy;
#else
o_diffuse_color = vec4(final_color, 1.0);
#endif
}
17 changes: 17 additions & 0 deletions data/shaders/sps_12_roadBlending.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<spshader>
<shader-info name="roadBlending" fallback-shader="solid" use-tangents="Y"/>
<first-pass vertex-shader="sp_pass.vert"
fragment-shader="sp_road_blending.frag"
skinned-mesh-shader="sp_skinning.vert">
</first-pass>
<!--
<shadow-pass vertex-shader="sp_shadow.vert"
fragment-shader="white.frag"
skinned-mesh-shader="sp_skinning_shadow.vert">
</shadow-pass>
<uniform-assigners>
<uniform-assigner name="layer"
function="shadowCascadeUniformAssigner"/>
</uniform-assigners>
-->
</spshader>
Loading

0 comments on commit e397359

Please sign in to comment.