Merge branch 'master' of github.com:supertuxkart/stk-code
This commit is contained in:
commit
e4e0dbd5b7
21
data/addons.supertuxkart.net.pem
Normal file
21
data/addons.supertuxkart.net.pem
Normal file
@ -0,0 +1,21 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDezCCAmOgAwIBAgIJAO+A8uXtEMRsMA0GCSqGSIb3DQEBCwUAMFQxCzAJBgNV
|
||||
BAYTAlVTMQwwCgYDVQQIDANTVEsxFTATBgNVBAoMDFN1cGVyVHV4S2FydDEgMB4G
|
||||
A1UEAwwXYWRkb25zLnN1cGVydHV4a2FydC5uZXQwHhcNMTQxMjEwMTEzMTAwWhcN
|
||||
MjQxMjA3MTEzMTAwWjBUMQswCQYDVQQGEwJVUzEMMAoGA1UECAwDU1RLMRUwEwYD
|
||||
VQQKDAxTdXBlclR1eEthcnQxIDAeBgNVBAMMF2FkZG9ucy5zdXBlcnR1eGthcnQu
|
||||
bmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2ysZE9rb4y0tHOhk
|
||||
wxYpqsvDv5LCRFTAeyfAfyBVDcOn+4A3sX8MkQdoH/QDi823z4bn9ZsGV8T444FN
|
||||
S4yK/aSRv3eAKkkJm5TUxbs3crATVt3JYusMr5W4wHvRVyDe0DlulSdW4EUEklMP
|
||||
iPat/jwlDZRvZueio3wJoOhZXnl8E8EfnuYtlNONIB1nYGdUHD9xeNyKSPr4zTEp
|
||||
brjvSw0l5G88LmQOROQBDbTDknAcIQwsFT1mf9Bt+N9LK14r95GWRmL3ZtfbrJn4
|
||||
ZEfkOjl0Abv6gET4sQOXv0KioUdEJwzFCwKFLZVcuOrscmcHBOhgD3EruVvprIJ0
|
||||
wZ3z1wIDAQABo1AwTjAdBgNVHQ4EFgQUmQwaPsD+ylVUUsUXMAYpUlnVbNwwHwYD
|
||||
VR0jBBgwFoAUmQwaPsD+ylVUUsUXMAYpUlnVbNwwDAYDVR0TBAUwAwEB/zANBgkq
|
||||
hkiG9w0BAQsFAAOCAQEASyl6BMpnZhJlirDL84/RkVeVjBkr7x68UFAblmKjgfGg
|
||||
pRbYPNSld0IrfZ4pcrDAUkg9WJb0Zxuh0oYiV+RjdW/6s5mF/qiSv8V60xb2myRd
|
||||
z90ZGfhB5SAECI5zfIZSmsMjOEjKjuz8S26aEtJe8Vq7GF2P7/889lfNXrbvIkZX
|
||||
HQpx2P+T07zy++6Ca/K2vmWcf1a+GrN+o0nZTYbz/2r/JJwXdWqT1ZmtEA9GNwvZ
|
||||
J8HhgvspgjgVP/EURUUhOaQ8zfhriU5CJAIuhMhzW7oOBPHxxtxme3auAfxi5zpK
|
||||
wRNluCayrrjhy2I8mABRnBqgMwAQUIrgk9IU6SyQxw==
|
||||
-----END CERTIFICATE-----
|
@ -1,7 +1,7 @@
|
||||
|
||||
<supertuxkart_grand_prix name="Off the beaten track">
|
||||
|
||||
<track id="jungle" laps="3" reverse="false" />
|
||||
<track id="30_chocolate" laps="3" reverse="false" />
|
||||
<track id="snowmountain" laps="3" reverse="false" />
|
||||
<track id="hacienda" laps="3" reverse="false" />
|
||||
<track id="zengarden" laps="4" reverse="false" />
|
||||
|
@ -11,10 +11,13 @@
|
||||
<textbox id="textfield" width="75%" I18N="In the 'add new grand prix' dialog" align="center"/>
|
||||
|
||||
<spacer height="20" width="20" />
|
||||
|
||||
<button id="cancel" I18N="In the 'add new grand prix' dialog" text="Press ESC to cancel" align="center"/>
|
||||
|
||||
|
||||
<div width="100%" height="60" layout="horizontal-row">
|
||||
<button id="accept" I18N="In the 'add new grand prix' dialog" text="Create" align="center" proportion="1"/>
|
||||
<spacer height="15" width="20" />
|
||||
|
||||
<button id="cancel" I18N="In the 'add new grand prix' dialog" text="Cancel" align="center" proportion="1"/>
|
||||
<spacer height="15" width="20" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</stkgui>
|
||||
|
@ -22,10 +22,10 @@
|
||||
<div id="search_div" height="fit" width="100%" layout="vertical-row">
|
||||
<spacer width="10" height="10"/>
|
||||
<box height="fit" width="100%" layout="vertical-row">
|
||||
<label height="fit" text_align="left" I18N="In the profile screen" text="Look for more friends:"/>
|
||||
<label text_align="left" I18N="In the profile screen" text="Look for more friends:"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<div height="fit" width="100%" layout="horizontal-row" align="center">
|
||||
<textbox id="search_box" proportion="1" height="fit"/>
|
||||
<textbox id="search_box" proportion="1"/>
|
||||
<spacer width="10" height="100%"/>
|
||||
<button id="search_button" height="100%" width="fit" text="Search" />
|
||||
</div>
|
||||
|
@ -53,8 +53,7 @@
|
||||
-->
|
||||
<label id="info" height="20%" width="100%" align="center" text_align="center" word_wrap="true"
|
||||
I18N="In the registration dialog"
|
||||
text="You can play without creating an online account by unchecking the online checkbox, though then you can not connect to friends, vote for addons etc. You can also use an existing SuperTuxKart Addons account in the next screen if you already have one. Please read our privacy statement at http://privacy.supertuxkart.net"/>
|
||||
|
||||
text="You can play without creating an online account by unchecking the online checkbox, though then you can not connect to friends, vote for addons etc. Please read our privacy statement at http://privacy.supertuxkart.net"/>
|
||||
</div>
|
||||
|
||||
<buttonbar id="options" width="40%" height="15%" align="center">
|
||||
|
@ -3,7 +3,7 @@
|
||||
uniform sampler2D source;
|
||||
uniform sampler2D depth;
|
||||
uniform vec2 pixel;
|
||||
uniform layout(size1x16) volatile restrict writeonly image2D dest;
|
||||
uniform layout(r16f) volatile restrict writeonly image2D dest;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
layout (local_size_x = 8, local_size_y = 8) in;
|
||||
|
@ -3,7 +3,7 @@
|
||||
uniform sampler2D source;
|
||||
uniform sampler2D depth;
|
||||
uniform vec2 pixel;
|
||||
uniform layout(size1x16) volatile restrict writeonly image2D dest;
|
||||
uniform layout(r16f) volatile restrict writeonly image2D dest;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
layout (local_size_x = 8, local_size_y = 8) in;
|
||||
|
@ -1,6 +1,6 @@
|
||||
uniform int idx;
|
||||
|
||||
in vec3 Position;
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -5,6 +5,10 @@ uniform mat4 InverseViewMatrix;
|
||||
uniform mat4 InverseProjectionMatrix;
|
||||
uniform mat4 ProjectionViewMatrix;
|
||||
uniform vec2 screen;
|
||||
|
||||
uniform float blueLmn[9];
|
||||
uniform float greenLmn[9];
|
||||
uniform float redLmn[9];
|
||||
#else
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
@ -16,4 +20,38 @@ layout (std140) uniform MatrixesData
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
|
||||
// Expand because of catalyst (14.12) not correctly associating array in UBO
|
||||
layout (std140) uniform LightingData
|
||||
{
|
||||
float bL00;
|
||||
float bL1m1;
|
||||
float bL10;
|
||||
float bL11;
|
||||
float bL2m2;
|
||||
float bL2m1;
|
||||
float bL20;
|
||||
float bL21;
|
||||
float bL22;
|
||||
|
||||
float gL00;
|
||||
float gL1m1;
|
||||
float gL10;
|
||||
float gL11;
|
||||
float gL2m2;
|
||||
float gL2m1;
|
||||
float gL20;
|
||||
float gL21;
|
||||
float gL22;
|
||||
|
||||
float rL00;
|
||||
float rL1m1;
|
||||
float rL10;
|
||||
float rL11;
|
||||
float rL2m2;
|
||||
float rL2m1;
|
||||
float rL20;
|
||||
float rL21;
|
||||
float rL22;
|
||||
};
|
||||
#endif
|
@ -1,5 +1,13 @@
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 InverseModelMatrix;
|
||||
uniform mat4 ModelMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
0., 1., 0., 0.,
|
||||
0., 0., 1., 0.,
|
||||
0., 0., 0., 1.);
|
||||
uniform mat4 InverseModelMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
0., 1., 0., 0.,
|
||||
0., 0., 1., 0.,
|
||||
0., 0., 0., 1.);
|
||||
|
||||
uniform mat4 TextureMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
|
@ -6,11 +6,12 @@ flat in float energy;
|
||||
flat in vec3 col;
|
||||
flat in float radius;
|
||||
|
||||
out vec4 Diffuse;
|
||||
out vec4 Specular;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
void main()
|
||||
@ -36,7 +37,9 @@ void main()
|
||||
vec3 L = -normalize(xpos.xyz - light_pos);
|
||||
|
||||
float NdotL = clamp(dot(norm, L), 0., 1.);
|
||||
vec3 Specular = SpecularBRDF(norm, eyedir, L, vec3(1.), roughness);
|
||||
vec3 Diffuse = DiffuseBRDF(norm, eyedir, L, vec3(1.), roughness);
|
||||
|
||||
Diffuse = vec4(NdotL * light_col * att, 1.);
|
||||
Specular = vec4(SpecularBRDF(norm, eyedir, L, light_col, roughness) * NdotL * att, 1.);
|
||||
Diff = vec4(Diffuse * NdotL * light_col * att, 1.);
|
||||
Spec = vec4(Specular * NdotL * light_col * att, 1.);
|
||||
}
|
||||
|
@ -1,19 +1,16 @@
|
||||
uniform sampler2D ntex;
|
||||
uniform sampler2D dtex;
|
||||
//uniform sampler2D cloudtex;
|
||||
|
||||
uniform vec3 direction;
|
||||
uniform vec3 col;
|
||||
uniform float sunangle = .54;
|
||||
|
||||
//uniform int hasclouds;
|
||||
//uniform vec2 wind;
|
||||
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
||||
@ -28,33 +25,26 @@ vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float z = texture(dtex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
float z = texture(dtex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
if (z < 0.03)
|
||||
{
|
||||
// Skyboxes are fully lit
|
||||
Diff = vec4(1.0);
|
||||
Spec = vec4(1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
|
||||
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
|
||||
float roughness = texture(ntex, uv).z;
|
||||
vec3 eyedir = -normalize(xpos.xyz);
|
||||
|
||||
// Normalized on the cpu
|
||||
// Normalized on the cpu
|
||||
vec3 L = direction;
|
||||
|
||||
float NdotL = clamp(dot(norm, L), 0., 1.);
|
||||
|
||||
float angle = 3.14 * sunangle / 180.;
|
||||
vec3 R = reflect(-eyedir, norm);
|
||||
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
|
||||
|
||||
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, col, roughness) * NdotL;
|
||||
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
|
||||
vec3 Diffuse = DiffuseBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
|
||||
|
||||
vec3 outcol = NdotL * col;
|
||||
Diff = vec4(NdotL * Diffuse * col, 1.);
|
||||
Spec = vec4(NdotL * Specular * col, 1.);
|
||||
|
||||
/* if (hasclouds == 1)
|
||||
{
|
||||
@ -64,7 +54,4 @@ void main() {
|
||||
|
||||
outcol *= cloud;
|
||||
}*/
|
||||
|
||||
Diff = vec4(NdotL * col, 1.);
|
||||
Spec = vec4(Specular, 1.);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
||||
@ -29,83 +30,50 @@ vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
||||
return (DdotR < d) ? normalize(d * D + normalize (S) * r) : R;
|
||||
}
|
||||
|
||||
float getShadowFactor(vec3 pos, float bias, int index)
|
||||
float getShadowFactor(vec3 pos, int index)
|
||||
{
|
||||
vec4 shadowcoord = (ShadowViewProjMatrixes[index] * InverseViewMatrix * vec4(pos, 1.0));
|
||||
shadowcoord.xy /= shadowcoord.w;
|
||||
vec2 shadowtexcoord = shadowcoord.xy * 0.5 + 0.5;
|
||||
|
||||
vec2 shadowoffset[4] = vec2[](
|
||||
vec2(-1., -1.),
|
||||
vec2(-1., 1.),
|
||||
vec2(1., -1.),
|
||||
vec2(1., 1.)
|
||||
);
|
||||
|
||||
vec4 shadowcoord = (ShadowViewProjMatrixes[index] * InverseViewMatrix * vec4(pos, 1.0));
|
||||
shadowcoord.xy /= shadowcoord.w;
|
||||
vec2 shadowtexcoord = shadowcoord.xy * 0.5 + 0.5;
|
||||
|
||||
float z = texture(shadowtex, vec3(shadowtexcoord, float(index))).x;
|
||||
float d = shadowcoord.z;
|
||||
return min(pow(exp(-32. * d) * z, 8.), 1.);
|
||||
float z = texture(shadowtex, vec3(shadowtexcoord, float(index))).x;
|
||||
float d = shadowcoord.z;
|
||||
return min(pow(exp(-32. * d) * z, 8.), 1.);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float z = texture(dtex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
float z = texture(dtex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
|
||||
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
|
||||
float roughness =texture(ntex, uv).z;
|
||||
vec3 eyedir = -normalize(xpos.xyz);
|
||||
|
||||
// Normalized on the cpu
|
||||
// Normalized on the cpu
|
||||
vec3 L = direction;
|
||||
|
||||
float NdotL = clamp(dot(norm, L), 0., 1.);
|
||||
|
||||
float angle = 3.14 * sunangle / 180.;
|
||||
vec3 R = reflect(-eyedir, norm);
|
||||
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
|
||||
|
||||
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, col, roughness) * NdotL;
|
||||
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
|
||||
vec3 Diffuse = DiffuseBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
|
||||
|
||||
// Shadows
|
||||
float factor;
|
||||
if (xpos.z < split0)
|
||||
factor = getShadowFactor(xpos.xyz, 0);
|
||||
else if (xpos.z < split1)
|
||||
factor = getShadowFactor(xpos.xyz, 1);
|
||||
else if (xpos.z < split2)
|
||||
factor = getShadowFactor(xpos.xyz, 2);
|
||||
else if (xpos.z < splitmax)
|
||||
factor = getShadowFactor(xpos.xyz, 3);
|
||||
else
|
||||
factor = 1.;
|
||||
|
||||
vec3 outcol = NdotL * col;
|
||||
|
||||
|
||||
// Shadows
|
||||
float bias = 0.005 * tan(acos(NdotL)); // According to the slope
|
||||
bias = clamp(bias, 0., 0.01);
|
||||
float factor;
|
||||
if (xpos.z < split0)
|
||||
factor = getShadowFactor(xpos.xyz, bias, 0);
|
||||
/* else if (xpos.z < 6.)
|
||||
{
|
||||
float a = getShadowFactor(xpos.xyz, bias, 0), b = getShadowFactor(xpos.xyz, bias, 1);
|
||||
factor = mix(a, b, (xpos.z - 5.));
|
||||
}*/
|
||||
else if (xpos.z < split1)
|
||||
factor = getShadowFactor(xpos.xyz, bias, 1);
|
||||
/* else if (xpos.z < 21.)
|
||||
{
|
||||
float a = getShadowFactor(xpos.xyz, bias, 1), b = getShadowFactor(xpos.xyz, bias, 2);
|
||||
factor = mix(a, b, (xpos.z - 20.));
|
||||
}*/
|
||||
else if (xpos.z < split2)
|
||||
factor = getShadowFactor(xpos.xyz, bias, 2);
|
||||
/* else if (xpos.z < 55.)
|
||||
{
|
||||
float a = getShadowFactor(xpos.xyz, bias, 2), b = getShadowFactor(xpos.xyz, bias, 3);
|
||||
factor = mix(a, b, (xpos.z - 50.) / 5.);
|
||||
}*/
|
||||
else if (xpos.z < splitmax)
|
||||
factor = getShadowFactor(xpos.xyz, bias, 3);
|
||||
/* else if (xpos.z < 150.)
|
||||
{
|
||||
factor = mix(getShadowFactor(xpos.xyz, bias, 3), 1., (xpos.z - 145.) / 5.);
|
||||
}*/
|
||||
else
|
||||
factor = 1.;
|
||||
Diff = vec4(factor * NdotL * col, 1.);
|
||||
Spec = vec4(factor * Specular, 1.);
|
||||
return;
|
||||
Diff = vec4(factor * NdotL * Diffuse * col, 1.);
|
||||
Spec = vec4(factor * NdotL * Specular * col, 1.);
|
||||
}
|
||||
|
5
data/shaders/utils/DiffuseBRDF.frag
Normal file
5
data/shaders/utils/DiffuseBRDF.frag
Normal file
@ -0,0 +1,5 @@
|
||||
// Lambert model
|
||||
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness)
|
||||
{
|
||||
return color;
|
||||
}
|
@ -1,32 +1,34 @@
|
||||
// From "An Efficient Representation for Irradiance Environment Maps" article
|
||||
// See http://graphics.stanford.edu/papers/envmap/
|
||||
|
||||
// Coefficients are calculated in IBL.cpp
|
||||
uniform float blueLmn[9];
|
||||
uniform float greenLmn[9];
|
||||
uniform float redLmn[9];
|
||||
uniform mat4 TransposeViewMatrix;
|
||||
|
||||
mat4 getMatrix(float L[9])
|
||||
mat4 getMatrix(float L00, float L1m1, float L10, float L11, float L2m2, float L2m1, float L20, float L21, float L22)
|
||||
{
|
||||
float c1 = 0.429043, c2 = 0.511664, c3 = 0.743125, c4 = 0.886227, c5 = 0.247708;
|
||||
|
||||
return mat4(
|
||||
c1 * L[8] /*L22*/, c1 * L[4] /*L2-2*/, c1 * L[7] /*L21*/, c2 * L[3] /*L11*/,
|
||||
c1 * L[4], - c1 * L[8], c1 * L[5] /*L2-1*/, c2 * L[1] /*L1-1*/,
|
||||
c1 * L[7], c1 * L[5], c3 * L[6] /*L20*/, c2 * L[2] /*L10*/,
|
||||
c2 * L[3], c2 * L[1], c2 * L[2], c4 * L[0] /*L00*/ - c5 * L[6]
|
||||
c1 * L22, c1 * L2m2, c1 * L21, c2 * L11,
|
||||
c1 * L2m2, - c1 * L22, c1 * L2m1, c2 * L1m1,
|
||||
c1 * L21, c1 * L2m1, c3 * L20, c2 * L10,
|
||||
c2 * L11, c2 * L1m1, c2 * L10, c4 * L00 - c5 * L20
|
||||
);
|
||||
}
|
||||
|
||||
vec3 DiffuseIBL(vec3 normal)
|
||||
{
|
||||
// Convert normal in world space (where SH coordinates were computed)
|
||||
vec4 extendednormal = TransposeViewMatrix * vec4(normal, 0.);
|
||||
// Convert normal in wobLd space (where SH coordinates were computed)
|
||||
vec4 extendednormal = transpose(ViewMatrix) * vec4(normal, 0.);
|
||||
extendednormal.w = 1.;
|
||||
mat4 rmat = getMatrix(redLmn);
|
||||
mat4 gmat = getMatrix(greenLmn);
|
||||
mat4 bmat = getMatrix(blueLmn);
|
||||
|
||||
#ifdef UBO_DISABLED
|
||||
mat4 rmat = getMatrix(redLmn[0], redLmn[1], redLmn[2], redLmn[3], redLmn[4], redLmn[5], redLmn[6], redLmn[7], redLmn[8]);
|
||||
mat4 gmat = getMatrix(greenLmn[0], greenLmn[1], greenLmn[2], greenLmn[3], greenLmn[4], greenLmn[5], greenLmn[6], greenLmn[7], greenLmn[8]);
|
||||
mat4 bmat = getMatrix(blueLmn[0], blueLmn[1], blueLmn[2], blueLmn[3], blueLmn[4], blueLmn[5], blueLmn[6], blueLmn[7], blueLmn[8]);
|
||||
#else
|
||||
mat4 rmat = getMatrix(rL00, rL1m1, rL10, rL11, rL2m2, rL2m1, rL20, rL21, rL22);
|
||||
mat4 gmat = getMatrix(gL00, gL1m1, gL10, gL11, gL2m2, gL2m1, gL20, gL21, gL22);
|
||||
mat4 bmat = getMatrix(bL00, bL1m1, bL10, bL11, bL2m2, bL2m1, bL20, bL21, bL22);
|
||||
#endif
|
||||
|
||||
float r = dot(extendednormal, rmat * extendednormal);
|
||||
float g = dot(extendednormal, gmat * extendednormal);
|
||||
|
@ -7,5 +7,5 @@ vec3 SpecularIBL(vec3 normal, vec3 V, float roughness)
|
||||
|
||||
// Assume 8 level of lod (ie 256x256 texture)
|
||||
float lodval = 8. * (1. - roughness);
|
||||
return max(textureLod(probe, sampleDirection, lodval).rgb, vec3(0.));
|
||||
}
|
||||
return clamp( textureLod(probe, sampleDirection, lodval).rgb, 0., 1.);
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDYDCCAsmgAwIBAgIJAKYVnmvPe6cJMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNV
|
||||
BAYTAkZSMQ8wDQYDVQQIEwZGcmFuY2UxEjAQBgNVBAcTCU1hcnNlaWxsZTEuMCwG
|
||||
A1UEChMlVHV4RmFtaWx5Lm9yZyBub24tcHJvZml0IG9yZ2FuaXphdGlvbjEaMBgG
|
||||
A1UEAxMRd2ViLnR1eGZhbWlseS5uZXQwHhcNMDgwNTE0MjMzMDI3WhcNMTgwNTEy
|
||||
MjMzMDI3WjB+MQswCQYDVQQGEwJGUjEPMA0GA1UECBMGRnJhbmNlMRIwEAYDVQQH
|
||||
EwlNYXJzZWlsbGUxLjAsBgNVBAoTJVR1eEZhbWlseS5vcmcgbm9uLXByb2ZpdCBv
|
||||
cmdhbml6YXRpb24xGjAYBgNVBAMTEXdlYi50dXhmYW1pbHkubmV0MIGfMA0GCSqG
|
||||
SIb3DQEBAQUAA4GNADCBiQKBgQCqCWPTYrW59LfzUtMgUFIse9ErIytmnNyVbzk6
|
||||
11Zj0OTMuCp9ijHW47jqSp7OaOR7X5XmNyhltnidS7elXtVb/jZOINRzdejmLRWs
|
||||
qBsnvWlab6kx+/u0kLAFH0w6s4Kg2K2s1eHtyid2IZLb+Xl29NGf+C6bRnUq9Bh2
|
||||
6DF93QIDAQABo4HlMIHiMB0GA1UdDgQWBBSHuse3FoUQ1asK7+4YJ7FxH3tztzCB
|
||||
sgYDVR0jBIGqMIGngBSHuse3FoUQ1asK7+4YJ7FxH3tzt6GBg6SBgDB+MQswCQYD
|
||||
VQQGEwJGUjEPMA0GA1UECBMGRnJhbmNlMRIwEAYDVQQHEwlNYXJzZWlsbGUxLjAs
|
||||
BgNVBAoTJVR1eEZhbWlseS5vcmcgbm9uLXByb2ZpdCBvcmdhbml6YXRpb24xGjAY
|
||||
BgNVBAMTEXdlYi50dXhmYW1pbHkubmV0ggkAphWea897pwkwDAYDVR0TBAUwAwEB
|
||||
/zANBgkqhkiG9w0BAQUFAAOBgQBYHLb4pjL7+xTk066JffNe1uCi2xXL93tsuphZ
|
||||
6LVZkd3y4uIp9yayhUocOws8jptJHtr4TEV5AxS34B89AJgVERcj86K/RVSSwApO
|
||||
g+ONYIyJ+Xdipdby6TIER+EgQxQJw1cxrMS3zzn7SNuo04CexqOTd5LUrtQJ/dOI
|
||||
LPEqhw==
|
||||
-----END CERTIFICATE-----
|
@ -1,5 +1,5 @@
|
||||
# Modify this file to change the last-modified date when you add/remove a file.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
||||
|
@ -49,7 +49,7 @@ NewsManager::~NewsManager()
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** This function initialises the data for the news manager. It starts a
|
||||
* separate thread to execute downloadNews() - which (if necessary) downaloads
|
||||
* separate thread to execute downloadNews() - which (if necessary) downloads
|
||||
* the news.xml file and updates the list of news messages. It also
|
||||
* initialises the addons manager (which can trigger another download of
|
||||
* news.xml).
|
||||
@ -458,7 +458,7 @@ bool NewsManager::conditionFulfilled(const std::string &cond)
|
||||
// ==============================
|
||||
else if(cond[1]=="not" && cond[2]=="installed")
|
||||
{
|
||||
// The addons_manager can not be access, since it's
|
||||
// The addons_manager cannot be accessed, since it's
|
||||
// being initialised after the news manager. So a simple
|
||||
// test is made to see if the directory exists. It is
|
||||
// necessary to check for karts and tracks separately,
|
||||
|
@ -274,7 +274,10 @@ void* SFXManager::mainLoop(void *obj)
|
||||
me->m_sfx_commands.getData().erase(me->m_sfx_commands.getData().begin());
|
||||
|
||||
if (current->m_command == SFX_EXIT)
|
||||
{
|
||||
delete current;
|
||||
break;
|
||||
}
|
||||
me->m_sfx_commands.unlock();
|
||||
switch(current->m_command)
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ void PlayerManager::enforceCurrentPlayer()
|
||||
{
|
||||
if (!player->isGuestAccount())
|
||||
{
|
||||
Log::info("PlayerManager", "Enfocring current player '%ls'.",
|
||||
Log::info("PlayerManager", "Enforcing current player '%ls'.",
|
||||
player->getName().c_str() );
|
||||
m_current_player = player;
|
||||
return;
|
||||
@ -340,7 +340,7 @@ void PlayerManager::enforceCurrentPlayer()
|
||||
{
|
||||
if (!player->isGuestAccount())
|
||||
{
|
||||
Log::info("PlayerManager", "Enfocring current player '%s'.",
|
||||
Log::info("PlayerManager", "Enforcing current player '%s'.",
|
||||
player->getName().c_str());
|
||||
m_current_player = player;
|
||||
return;
|
||||
@ -353,8 +353,8 @@ void PlayerManager::enforceCurrentPlayer()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Called when no player profiles exists. It creates two players: one
|
||||
* guest player, and one non-guest player for whic hit tries to guess a
|
||||
* mame based on environment variables.
|
||||
* guest player, and one non-guest player for which it tries to guess a
|
||||
* name based on environment variables.
|
||||
*/
|
||||
void PlayerManager::addDefaultPlayer()
|
||||
{
|
||||
|
@ -733,7 +733,7 @@ namespace UserConfigParams
|
||||
"A random number to avoid duplicated reports.") );
|
||||
|
||||
PARAM_PREFIX StringUserConfigParam m_server_hw_report
|
||||
PARAM_DEFAULT( StringUserConfigParam( "http://104.131.193.44:8080",
|
||||
PARAM_DEFAULT( StringUserConfigParam( "http://addons.supertuxkart.net:8080",
|
||||
"hw-report-server",
|
||||
&m_hw_report_group,
|
||||
"The server used for reporting statistics to."));
|
||||
@ -753,34 +753,29 @@ namespace UserConfigParams
|
||||
|
||||
// ---- Online gameplay related
|
||||
PARAM_PREFIX GroupUserConfigParam m_online_group
|
||||
PARAM_DEFAULT( GroupUserConfigParam("OnlinePlay",
|
||||
PARAM_DEFAULT( GroupUserConfigParam("OnlineServer",
|
||||
"Everything related to online play.") );
|
||||
|
||||
PARAM_PREFIX StringUserConfigParam m_server_multiplayer
|
||||
PARAM_DEFAULT( StringUserConfigParam( "https://api.stkaddons.net/",
|
||||
PARAM_DEFAULT( StringUserConfigParam( "https://addons.supertuxkart.net/api/",
|
||||
"server_multiplayer",
|
||||
&m_online_group,
|
||||
"The server used for online multiplayer."));
|
||||
|
||||
PARAM_PREFIX IntUserConfigParam m_server_version
|
||||
PARAM_DEFAULT( IntUserConfigParam( 1,
|
||||
PARAM_DEFAULT( IntUserConfigParam( 2,
|
||||
"server-version",
|
||||
&m_online_group,
|
||||
"Version of the server API to use."));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_verify_peer
|
||||
PARAM_DEFAULT(BoolUserConfigParam(1, "verify-peer", &m_online_group,
|
||||
"If curl should check peer address. Should always be enabled,"
|
||||
"unless there are authentication problems."));
|
||||
|
||||
|
||||
// ---- Addon server related entries
|
||||
PARAM_PREFIX GroupUserConfigParam m_addon_group
|
||||
PARAM_DEFAULT( GroupUserConfigParam("AddonAndNews",
|
||||
PARAM_DEFAULT( GroupUserConfigParam("AddonServer",
|
||||
"Addon and news related settings") );
|
||||
|
||||
PARAM_PREFIX StringUserConfigParam m_server_addons
|
||||
PARAM_DEFAULT( StringUserConfigParam("http://stkaddons.net/dl/xml",
|
||||
PARAM_DEFAULT( StringUserConfigParam("http://addons.supertuxkart.net/dl/xml",
|
||||
"server_addons",
|
||||
&m_addon_group,
|
||||
"The server used for addon."));
|
||||
|
@ -260,6 +260,9 @@ GLuint generateSpecularCubemap(GLuint probe)
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA16F, cubemap_size, cubemap_size, 0, GL_BGRA, GL_FLOAT, 0);
|
||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
return cubemap_texture;
|
||||
|
||||
GLuint fbo;
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
|
@ -275,12 +275,12 @@ void draw3DLine(const core::vector3df& start,
|
||||
end.X, end.Y, end.Z
|
||||
};
|
||||
|
||||
glBindVertexArray(UtilShader::ColoredLine::vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo);
|
||||
glBindVertexArray(UtilShader::ColoredLine::getInstance()->vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::getInstance()->vbo);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, 6 * sizeof(float), vertex);
|
||||
|
||||
glUseProgram(UtilShader::ColoredLine::Program);
|
||||
UtilShader::ColoredLine::setUniforms(color);
|
||||
glUseProgram(UtilShader::ColoredLine::getInstance()->Program);
|
||||
UtilShader::ColoredLine::getInstance()->setUniforms(color);
|
||||
glDrawArrays(GL_LINES, 0, 2);
|
||||
|
||||
glGetError();
|
||||
|
@ -607,6 +607,14 @@ void IrrDriver::initDevice()
|
||||
{
|
||||
Log::info("irr_driver", "GLSL supported.");
|
||||
}
|
||||
|
||||
if (!supportGeometryShader())
|
||||
{
|
||||
// these options require geometry shaders
|
||||
UserConfigParams::m_shadows = 0;
|
||||
UserConfigParams::m_gi = false;
|
||||
}
|
||||
|
||||
// m_glsl might be reset in rtt if an error occurs.
|
||||
if(m_glsl)
|
||||
{
|
||||
@ -1392,7 +1400,7 @@ scene::ISceneNode *IrrDriver::addSkyBox(const std::vector<video::ITexture*> &tex
|
||||
SphericalHarmonicsTextures = sphericalHarmonics;
|
||||
SkyboxCubeMap = 0;
|
||||
SkyboxSpecularProbe = 0;
|
||||
m_SH_dirty = true;
|
||||
m_skybox_ready = false;
|
||||
return m_scene_manager->addSkyBoxSceneNode(texture[0], texture[1],
|
||||
texture[2], texture[3],
|
||||
texture[4], texture[5]);
|
||||
@ -1402,7 +1410,7 @@ void IrrDriver::suppressSkyBox()
|
||||
{
|
||||
SkyboxTextures.clear();
|
||||
SphericalHarmonicsTextures.clear();
|
||||
m_SH_dirty = true;
|
||||
m_skybox_ready = false;
|
||||
if ((SkyboxCubeMap) && (!ProfileWorld::isNoGraphics()))
|
||||
{
|
||||
glDeleteTextures(1, &SkyboxCubeMap);
|
||||
@ -1788,7 +1796,7 @@ void IrrDriver::onUnloadWorld()
|
||||
void IrrDriver::setAmbientLight(const video::SColorf &light)
|
||||
{
|
||||
m_scene_manager->setAmbientLight(light);
|
||||
m_SH_dirty = true;
|
||||
m_skybox_ready = false;
|
||||
} // setAmbientLight
|
||||
|
||||
video::SColorf IrrDriver::getAmbientLight() const
|
||||
|
@ -236,11 +236,13 @@ private:
|
||||
|
||||
std::vector<video::ITexture *> SkyboxTextures;
|
||||
std::vector<video::ITexture *> SphericalHarmonicsTextures;
|
||||
bool m_SH_dirty;
|
||||
bool m_skybox_ready;
|
||||
|
||||
public:
|
||||
float blueSHCoeff[9];
|
||||
float greenSHCoeff[9];
|
||||
float redSHCoeff[9];
|
||||
private:
|
||||
|
||||
/** Keep a trace of the origin file name of a texture. */
|
||||
std::map<video::ITexture*, std::string> m_texturesFileName;
|
||||
@ -293,6 +295,21 @@ public:
|
||||
return m_support_texture_compression;
|
||||
}
|
||||
|
||||
bool supportGeometryShader() const
|
||||
{
|
||||
return getGLSLVersion() >= 330;
|
||||
}
|
||||
|
||||
bool usesShadows() const
|
||||
{
|
||||
return supportGeometryShader() && UserConfigParams::m_shadows && !needUBOWorkaround();
|
||||
}
|
||||
|
||||
bool usesGI() const
|
||||
{
|
||||
return supportGeometryShader() && UserConfigParams::m_gi && !needUBOWorkaround();
|
||||
}
|
||||
|
||||
bool usesTextureCompression() const
|
||||
{
|
||||
return UserConfigParams::m_texture_compression && m_support_texture_compression;
|
||||
@ -455,7 +472,7 @@ public:
|
||||
void getOpenGLData(std::string *vendor, std::string *renderer,
|
||||
std::string *version);
|
||||
|
||||
void generateSkyboxCubemap();
|
||||
void prepareSkybox();
|
||||
void generateDiffuseCoefficients();
|
||||
void renderSkybox(const scene::ICameraSceneNode *camera);
|
||||
void setPhase(STKRenderingPass);
|
||||
|
@ -205,15 +205,6 @@ void PostProcessing::update(float dt)
|
||||
}
|
||||
} // update
|
||||
|
||||
template<typename T,typename... Args>
|
||||
static void DrawFullScreenEffect(Args...args)
|
||||
{
|
||||
glUseProgram(T::getInstance()->Program);
|
||||
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||
T::getInstance()->setUniforms(args...);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
}
|
||||
|
||||
static
|
||||
void renderBloom(GLuint in)
|
||||
{
|
||||
@ -232,8 +223,7 @@ void PostProcessing::renderEnvMap(const float *bSHCoeff, const float *gSHCoeff,
|
||||
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||
|
||||
FullScreenShader::IBLShader::getInstance()->SetTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture(), skybox);
|
||||
core::matrix4 TVM = irr_driver->getViewMatrix().getTransposed();
|
||||
FullScreenShader::IBLShader::getInstance()->setUniforms(TVM, std::vector<float>(bSHCoeff, bSHCoeff + 9), std::vector<float>(gSHCoeff, gSHCoeff + 9), std::vector<float>(rSHCoeff, rSHCoeff + 9));
|
||||
FullScreenShader::IBLShader::getInstance()->setUniforms();
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glBindVertexArray(0);
|
||||
@ -867,7 +857,10 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Motion blur", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_MOTIONBLUR));
|
||||
if (isRace && UserConfigParams::m_motionblur && World::getWorld() != NULL) // motion blur
|
||||
MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver->
|
||||
getCallback(ES_MOTIONBLUR);
|
||||
|
||||
if (isRace && UserConfigParams::m_motionblur && World::getWorld() != NULL && cb->getBoostTime(0) > 0.) // motion blur
|
||||
{
|
||||
renderMotionBlur(0, *in_fbo, *out_fbo);
|
||||
std::swap(in_fbo, out_fbo);
|
||||
|
@ -176,7 +176,11 @@ void IrrDriver::renderGLSL(float dt)
|
||||
irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0));
|
||||
|
||||
// TODO: put this outside of the rendering loop
|
||||
generateDiffuseCoefficients();
|
||||
if (!m_skybox_ready)
|
||||
{
|
||||
prepareSkybox();
|
||||
m_skybox_ready = true;
|
||||
}
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
|
||||
@ -191,10 +195,10 @@ void IrrDriver::renderGLSL(float dt)
|
||||
// Render bounding boxes
|
||||
if (irr_driver->getBoundingBoxesViz())
|
||||
{
|
||||
glUseProgram(UtilShader::ColoredLine::Program);
|
||||
glBindVertexArray(UtilShader::ColoredLine::vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo);
|
||||
UtilShader::ColoredLine::setUniforms(SColor(255, 255, 0, 0));
|
||||
glUseProgram(UtilShader::ColoredLine::getInstance()->Program);
|
||||
glBindVertexArray(UtilShader::ColoredLine::getInstance()->vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::getInstance()->vbo);
|
||||
UtilShader::ColoredLine::getInstance()->setUniforms(SColor(255, 255, 0, 0));
|
||||
const float *tmp = BoundingBoxes.data();
|
||||
for (unsigned int i = 0; i < BoundingBoxes.size(); i += 1024 * 6)
|
||||
{
|
||||
@ -220,13 +224,12 @@ void IrrDriver::renderGLSL(float dt)
|
||||
const std::map<video::SColor, std::vector<float> >& lines = debug_drawer->getLines();
|
||||
std::map<video::SColor, std::vector<float> >::const_iterator it;
|
||||
|
||||
|
||||
glUseProgram(UtilShader::ColoredLine::Program);
|
||||
glBindVertexArray(UtilShader::ColoredLine::vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo);
|
||||
glUseProgram(UtilShader::ColoredLine::getInstance()->Program);
|
||||
glBindVertexArray(UtilShader::ColoredLine::getInstance()->vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::getInstance()->vbo);
|
||||
for (it = lines.begin(); it != lines.end(); it++)
|
||||
{
|
||||
UtilShader::ColoredLine::setUniforms(it->first);
|
||||
UtilShader::ColoredLine::getInstance()->setUniforms(it->first);
|
||||
const std::vector<float> &vertex = it->second;
|
||||
const float *tmp = vertex.data();
|
||||
for (unsigned int i = 0; i < vertex.size(); i += 1024 * 6)
|
||||
@ -339,6 +342,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadow, bool forceRTT)
|
||||
{
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, 1, SharedObject::LightingDataUBO);
|
||||
m_scene_manager->setActiveCamera(camnode);
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("- Draw Call Generation", 0xFF, 0xFF, 0xFF);
|
||||
@ -349,12 +353,12 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
// To avoid wrong culling, use the largest view possible
|
||||
m_scene_manager->setActiveCamera(m_suncam);
|
||||
if (UserConfigParams::m_dynamic_lights &&
|
||||
UserConfigParams::m_shadows && !irr_driver->needUBOWorkaround() && hasShadow)
|
||||
UserConfigParams::m_shadows && irr_driver->usesShadows() && hasShadow)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Shadow", 0x30, 0x6F, 0x90);
|
||||
renderShadows();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
if (UserConfigParams::m_gi)
|
||||
if (irr_driver->usesGI())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- RSM", 0xFF, 0x0, 0xFF);
|
||||
renderRSM();
|
||||
@ -958,18 +962,26 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
tmp[145] = float(height);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::ViewProjectionMatrixesUBO);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, (16 * 9 + 2) * sizeof(float), tmp);
|
||||
|
||||
float Lighting[27];
|
||||
memcpy(Lighting, blueSHCoeff, 9 * sizeof(float));
|
||||
memcpy(&Lighting[9], greenSHCoeff, 9 * sizeof(float));
|
||||
memcpy(&Lighting[18], redSHCoeff, 9 * sizeof(float));
|
||||
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::LightingDataUBO);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, 27 * sizeof(float), Lighting);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void renderWireFrameFrustrum(float *tmp, unsigned i)
|
||||
{
|
||||
glUseProgram(MeshShader::ViewFrustrumShader::Program);
|
||||
glBindVertexArray(MeshShader::ViewFrustrumShader::frustrumvao);
|
||||
glUseProgram(MeshShader::ViewFrustrumShader::getInstance()->Program);
|
||||
glBindVertexArray(MeshShader::ViewFrustrumShader::getInstance()->frustrumvao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, SharedObject::frustrumvbo);
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, 8 * 3 * sizeof(float), (void *)tmp);
|
||||
MeshShader::ViewFrustrumShader::setUniforms(video::SColor(255, 0, 255, 0), i);
|
||||
MeshShader::ViewFrustrumShader::getInstance()->setUniforms(video::SColor(255, 0, 255, 0), i);
|
||||
glDrawElements(GL_LINES, 24, GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
m_rtts->getFBO(FBO_DIFFUSE).Bind();
|
||||
if (UserConfigParams::m_gi && UserConfigParams::m_shadows && hasShadow)
|
||||
if (irr_driver->usesGI() && hasShadow)
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_GI));
|
||||
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2]);
|
||||
@ -162,7 +162,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
|
||||
if (!World::getWorld() || World::getWorld()->getTrack()->hasShadows())
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_SUN));
|
||||
if (World::getWorld() && UserConfigParams::m_shadows && !irr_driver->needUBOWorkaround() && hasShadow)
|
||||
if (World::getWorld() && irr_driver->usesShadows() && hasShadow)
|
||||
m_post_processing->renderShadowedSunlight(irr_driver->getSunDirection(), irr_driver->getSunColor(), sun_ortho_matrix, m_rtts->getShadowFBO().getRTT()[0]);
|
||||
else
|
||||
m_post_processing->renderSunlight(irr_driver->getSunDirection(), irr_driver->getSunColor());
|
||||
|
@ -274,20 +274,20 @@ GLuint generateCubeMapFromTextures(const std::vector<video::ITexture *> &texture
|
||||
return result;
|
||||
}
|
||||
|
||||
void IrrDriver::generateSkyboxCubemap()
|
||||
void IrrDriver::prepareSkybox()
|
||||
{
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
|
||||
assert(SkyboxTextures.size() == 6);
|
||||
SkyboxCubeMap = generateCubeMapFromTextures(SkyboxTextures);
|
||||
SkyboxSpecularProbe = generateSpecularCubemap(SkyboxCubeMap);
|
||||
generateDiffuseCoefficients();
|
||||
if (!SkyboxTextures.empty())
|
||||
{
|
||||
SkyboxCubeMap = generateCubeMapFromTextures(SkyboxTextures);
|
||||
SkyboxSpecularProbe = generateSpecularCubemap(SkyboxCubeMap);
|
||||
}
|
||||
}
|
||||
|
||||
void IrrDriver::generateDiffuseCoefficients()
|
||||
{
|
||||
if (!m_SH_dirty)
|
||||
return;
|
||||
m_SH_dirty = false;
|
||||
const unsigned texture_permutation[] = { 2, 3, 0, 1, 5, 4 };
|
||||
|
||||
unsigned sh_w = 0, sh_h = 0;
|
||||
@ -379,8 +379,6 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
|
||||
{
|
||||
if (SkyboxTextures.empty())
|
||||
return;
|
||||
if (!SkyboxCubeMap)
|
||||
generateSkyboxCubemap();
|
||||
glBindVertexArray(MeshShader::SkyboxShader::getInstance()->cubevao);
|
||||
glDisable(GL_CULL_FACE);
|
||||
assert(SkyboxTextures.size() == 6);
|
||||
|
@ -427,6 +427,16 @@ static void initShadowVPMUBO()
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
}
|
||||
|
||||
GLuint SharedObject::LightingDataUBO;
|
||||
|
||||
static void initLightingDataUBO()
|
||||
{
|
||||
glGenBuffers(1, &SharedObject::LightingDataUBO);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::LightingDataUBO);
|
||||
glBufferData(GL_UNIFORM_BUFFER, 27 * sizeof(float), 0, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
}
|
||||
|
||||
GLuint SharedObject::ParticleQuadVBO = 0;
|
||||
|
||||
static void initParticleQuadVBO()
|
||||
@ -527,9 +537,8 @@ void Shaders::loadShaders()
|
||||
initCubeVBO();
|
||||
initFrustrumVBO();
|
||||
initShadowVPMUBO();
|
||||
initLightingDataUBO();
|
||||
initParticleQuadVBO();
|
||||
MeshShader::ViewFrustrumShader::init();
|
||||
UtilShader::ColoredLine::init();
|
||||
}
|
||||
|
||||
void Shaders::killShaders()
|
||||
@ -576,37 +585,33 @@ void bypassUBO(GLuint Program)
|
||||
glUniformMatrix4fv(IPM, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer());
|
||||
GLint Screen = glGetUniformLocation(Program, "screen");
|
||||
glUniform2f(Screen, irr_driver->getCurrentScreenSize().X, irr_driver->getCurrentScreenSize().Y);
|
||||
GLint bLmn = glGetUniformLocation(Program, "blueLmn[0]");
|
||||
glUniform1fv(bLmn, 9, irr_driver->blueSHCoeff);
|
||||
GLint gLmn = glGetUniformLocation(Program, "greenLmn[0]");
|
||||
glUniform1fv(gLmn, 9, irr_driver->greenSHCoeff);
|
||||
GLint rLmn = glGetUniformLocation(Program, "redLmn[0]");
|
||||
glUniform1fv(rLmn, 9, irr_driver->redSHCoeff);
|
||||
}
|
||||
|
||||
namespace UtilShader
|
||||
{
|
||||
GLuint ColoredLine::Program;
|
||||
GLuint ColoredLine::uniform_color;
|
||||
GLuint ColoredLine::vao;
|
||||
GLuint ColoredLine::vbo;
|
||||
|
||||
void ColoredLine::init()
|
||||
ColoredLine::ColoredLine()
|
||||
{
|
||||
Program = LoadProgram(OBJECT,
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/coloredquad.frag").c_str());
|
||||
|
||||
AssignUniforms("color");
|
||||
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glGenBuffers(1, &vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, 6 * 1024 * sizeof(float), 0, GL_DYNAMIC_DRAW);
|
||||
GLuint attrib_position = glGetAttribLocation(Program, "Position");
|
||||
glEnableVertexAttribArray(attrib_position);
|
||||
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||
uniform_color = glGetUniformLocation(Program, "color");
|
||||
}
|
||||
|
||||
void ColoredLine::setUniforms(const irr::video::SColor &col)
|
||||
{
|
||||
if (irr_driver->needUBOWorkaround())
|
||||
bypassUBO(Program);
|
||||
glUniform4i(uniform_color, col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha());
|
||||
glUniformMatrix4fv(glGetUniformLocation(Program, "ModelMatrix"), 1, GL_FALSE, core::IdentityMatrix.pointer());
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
struct TexUnit
|
||||
@ -1399,36 +1404,22 @@ namespace MeshShader
|
||||
AssignUniforms("color");
|
||||
}
|
||||
|
||||
GLuint ViewFrustrumShader::Program;
|
||||
GLuint ViewFrustrumShader::attrib_position;
|
||||
GLuint ViewFrustrumShader::uniform_color;
|
||||
GLuint ViewFrustrumShader::uniform_idx;
|
||||
GLuint ViewFrustrumShader::frustrumvao;
|
||||
|
||||
void ViewFrustrumShader::init()
|
||||
ViewFrustrumShader::ViewFrustrumShader()
|
||||
{
|
||||
Program = LoadProgram(OBJECT,
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/frustrum.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/coloredquad.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
|
||||
uniform_color = glGetUniformLocation(Program, "color");
|
||||
uniform_idx = glGetUniformLocation(Program, "idx");
|
||||
AssignUniforms("color", "idx");
|
||||
|
||||
glGenVertexArrays(1, &frustrumvao);
|
||||
glBindVertexArray(frustrumvao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, SharedObject::frustrumvbo);
|
||||
glEnableVertexAttribArray(attrib_position);
|
||||
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, SharedObject::frustrumindexes);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void ViewFrustrumShader::setUniforms(const video::SColor &color, unsigned idx)
|
||||
{
|
||||
glUniform4i(uniform_color, color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
|
||||
glUniform1i(uniform_idx, idx);
|
||||
}
|
||||
}
|
||||
|
||||
namespace LightShader
|
||||
@ -1439,6 +1430,7 @@ namespace LightShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/pointlight.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/decodeNormal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/SpecularBRDF.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/DiffuseBRDF.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/pointlight.frag").c_str());
|
||||
|
||||
@ -1638,6 +1630,7 @@ namespace FullScreenShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/decodeNormal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/SpecularBRDF.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/DiffuseBRDF.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/sunlight.frag").c_str());
|
||||
|
||||
@ -1654,7 +1647,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/DiffuseIBL.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/SpecularIBL.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/IBL.frag").c_str());
|
||||
AssignUniforms("TransposeViewMatrix", "blueLmn[0]", "greenLmn[0]", "redLmn[0]");
|
||||
AssignUniforms();
|
||||
AssignSamplerNames(Program, 0, "ntex", 1, "dtex", 2, "probe");
|
||||
}
|
||||
|
||||
@ -1664,6 +1657,7 @@ namespace FullScreenShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/decodeNormal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/SpecularBRDF.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/DiffuseBRDF.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/sunlightshadow.frag").c_str());
|
||||
|
||||
|
@ -31,22 +31,19 @@ class SharedObject
|
||||
public:
|
||||
static GLuint billboardvbo;
|
||||
static GLuint cubevbo, cubeindexes, frustrumvbo, frustrumindexes, ParticleQuadVBO;
|
||||
static GLuint ViewProjectionMatrixesUBO;
|
||||
static GLuint ViewProjectionMatrixesUBO, LightingDataUBO;
|
||||
static GLuint FullScreenQuadVAO;
|
||||
static GLuint UIVAO;
|
||||
};
|
||||
|
||||
namespace UtilShader
|
||||
{
|
||||
class ColoredLine
|
||||
class ColoredLine : public ShaderHelperSingleton<ColoredLine, video::SColor>
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_color;
|
||||
static GLuint vao, vbo;
|
||||
GLuint vao, vbo;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const irr::video::SColor &);
|
||||
ColoredLine();
|
||||
};
|
||||
|
||||
class SpecularIBLGenerator : public ShaderHelperSingleton<SpecularIBLGenerator, core::matrix4, float >, public TextureRead<Trilinear_cubemap>
|
||||
@ -297,16 +294,12 @@ public:
|
||||
NormalVisualizer();
|
||||
};
|
||||
|
||||
class ViewFrustrumShader
|
||||
class ViewFrustrumShader : public ShaderHelperSingleton<ViewFrustrumShader, video::SColor, int>
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position;
|
||||
static GLuint uniform_color, uniform_idx;
|
||||
static GLuint frustrumvao;
|
||||
GLuint frustrumvao;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const video::SColor &color, unsigned idx);
|
||||
ViewFrustrumShader();
|
||||
};
|
||||
|
||||
}
|
||||
@ -377,6 +370,15 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T, typename... Args>
|
||||
static void DrawFullScreenEffect(Args...args)
|
||||
{
|
||||
glUseProgram(T::getInstance()->Program);
|
||||
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||
T::getInstance()->setUniforms(args...);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
}
|
||||
|
||||
namespace FullScreenShader
|
||||
{
|
||||
|
||||
@ -418,7 +420,7 @@ public:
|
||||
SunLightShader();
|
||||
};
|
||||
|
||||
class IBLShader : public ShaderHelperSingleton<IBLShader, core::matrix4, std::vector<float>, std::vector<float>, std::vector<float> >, public TextureRead<Nearest_Filtered, Nearest_Filtered, Trilinear_cubemap>
|
||||
class IBLShader : public ShaderHelperSingleton<IBLShader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Trilinear_cubemap>
|
||||
{
|
||||
public:
|
||||
IBLShader();
|
||||
|
@ -171,6 +171,9 @@ protected:
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
if (uniform_ViewProjectionMatrixesUBO != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
GLuint uniform_LightingUBO = glGetUniformBlockIndex(Program, "LightingData");
|
||||
if (uniform_LightingUBO != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(Program, uniform_LightingUBO, 1);
|
||||
}
|
||||
|
||||
template<typename... U>
|
||||
|
@ -239,6 +239,18 @@ void LayoutManager::readCoords(Widget* self)
|
||||
}
|
||||
}
|
||||
|
||||
//Add padding to <box> elements
|
||||
if (self->getType() == WTYPE_DIV && self->m_show_bounding_box)
|
||||
{
|
||||
int padding = 15;
|
||||
if (self->m_properties[PROP_DIV_PADDING].length() > 0)
|
||||
padding = atoi(self->m_properties[PROP_DIV_PADDING].c_str());
|
||||
child_max_height += padding * 2;
|
||||
total_height += padding * 2;
|
||||
total_width += padding * 2;
|
||||
child_max_width += padding * 2;
|
||||
}
|
||||
|
||||
if (self->m_properties[PROP_WIDTH] == "fit")
|
||||
{
|
||||
self->m_absolute_w = (is_horizontal_row ? total_width : child_max_width);
|
||||
|
@ -985,6 +985,8 @@ void DynamicRibbonWidget::updateItemDisplay()
|
||||
icon->setImage( "textures/transparence.png", IconButtonWidget::ICON_PATH_TYPE_RELATIVE );
|
||||
icon->resetAllBadges();
|
||||
icon->m_properties[PROP_ID] = RibbonWidget::NO_ITEM_ID;
|
||||
icon->setLabel(L"");
|
||||
icon->m_text = L"";
|
||||
//std::cout << " item " << i << " is a FILLER\n";
|
||||
}
|
||||
}
|
||||
@ -1006,14 +1008,10 @@ void DynamicRibbonWidget::update(float dt)
|
||||
{
|
||||
int col_scroll = i + m_scroll_offset;
|
||||
int item_id = (col_scroll)*row_amount + n;
|
||||
if (item_id >= (int)m_items.size()) item_id -= (int)m_items.size();
|
||||
|
||||
assert(item_id >= 0);
|
||||
assert(item_id < (int)m_items.size());
|
||||
|
||||
//m_items[icon_id].
|
||||
|
||||
if (m_items[item_id].m_animated)
|
||||
if (item_id < (int)m_items.size() && m_items[item_id].m_animated)
|
||||
{
|
||||
const int frameBefore = (int)(m_items[item_id].m_curr_time / m_items[item_id].m_time_per_frame);
|
||||
|
||||
|
@ -200,7 +200,13 @@ FileManager::FileManager()
|
||||
checkAndCreateGPDir();
|
||||
|
||||
redirectOutput();
|
||||
} // FileManager
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Detects where the assets are stored.
|
||||
*/
|
||||
void FileManager::discoverPaths()
|
||||
{
|
||||
// We can't use _() here, since translations will only be initalised
|
||||
// after the filemanager (to get the path to the tranlsations from it)
|
||||
for(unsigned int i=0; i<m_root_dirs.size(); i++)
|
||||
@ -226,6 +232,16 @@ FileManager::FileManager()
|
||||
TrackManager::addTrackSearchDir(m_root_dirs[i]+"tracks/");
|
||||
if(fileExists(m_root_dirs[i]+"karts/"))
|
||||
KartPropertiesManager::addKartSearchDir(m_root_dirs[i]+"karts/");
|
||||
|
||||
// If artist debug mode is enabled, add
|
||||
// work-in-progress tracks and karts
|
||||
if (UserConfigParams::m_artist_debug_mode)
|
||||
{
|
||||
if(fileExists(m_root_dirs[i] + "wip-tracks/"))
|
||||
TrackManager::addTrackSearchDir(m_root_dirs[i] + "wip-tracks/");
|
||||
if(fileExists(m_root_dirs[i] + "wip-karts/"))
|
||||
KartPropertiesManager::addKartSearchDir(m_root_dirs[i] + "wip-karts/");
|
||||
}
|
||||
for(unsigned int j=ASSET_MIN; j<=ASSET_MAX; j++)
|
||||
{
|
||||
if(!dir_found[j] && fileExists(m_root_dirs[i]+m_subdir_name[j]))
|
||||
@ -253,7 +269,7 @@ FileManager::FileManager()
|
||||
Log::fatal("[FileManager]", "Not all assets found - aborting.");
|
||||
|
||||
|
||||
} // FileManager
|
||||
} // discoverPaths
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Remove the dummy file system (which is called from IrrDriver before
|
||||
@ -274,8 +290,8 @@ void FileManager::reInit()
|
||||
m_file_system->grab();
|
||||
|
||||
// Note that we can't push the texture search path in the constructor
|
||||
// since this also adds a file archive to te file system - and
|
||||
// m_file_system is deleted (in irr_driver) after
|
||||
// since this also adds a file archive to the file system - and
|
||||
// m_file_system is deleted (in irr_driver)
|
||||
pushTextureSearchPath(m_subdir_name[TEXTURE]);
|
||||
if(fileExists(m_subdir_name[TEXTURE]+"deprecated/"))
|
||||
pushTextureSearchPath(m_subdir_name[TEXTURE]+"deprecated/");
|
||||
|
@ -107,6 +107,7 @@ public:
|
||||
FileManager();
|
||||
~FileManager();
|
||||
void reInit();
|
||||
void discoverPaths();
|
||||
void dropFileSystem();
|
||||
static void addRootDirs(const std::string &roots);
|
||||
io::IXMLReader *createXMLReader(const std::string &filename);
|
||||
|
@ -1112,8 +1112,11 @@ void initRest()
|
||||
race_manager->setMinorMode (RaceManager::MINOR_MODE_NORMAL_RACE);
|
||||
race_manager->setDifficulty(
|
||||
(RaceManager::Difficulty)(int)UserConfigParams::m_difficulty);
|
||||
if(track_manager->getTrack(UserConfigParams::m_last_track))
|
||||
race_manager->setTrack(UserConfigParams::m_last_track);
|
||||
|
||||
if (!track_manager->getTrack(UserConfigParams::m_last_track))
|
||||
UserConfigParams::m_last_track.revertToDefaults();
|
||||
|
||||
race_manager->setTrack(UserConfigParams::m_last_track);
|
||||
|
||||
} // initRest
|
||||
|
||||
|
@ -740,14 +740,11 @@ void LinearWorld::updateRacePosition()
|
||||
#endif
|
||||
|
||||
// Switch on faster music if not already done so, if the
|
||||
// first kart is doing its last lap, and if the estimated
|
||||
// remaining time is less than 30 seconds.
|
||||
// first kart is doing its last lap.
|
||||
if(!m_faster_music_active &&
|
||||
kart_info.m_race_lap == race_manager->getNumLaps()-1 &&
|
||||
p==1 &&
|
||||
useFastMusicNearEnd() &&
|
||||
kart_info.m_estimated_finish > 0 &&
|
||||
kart_info.m_estimated_finish - getTime() < 30.0f )
|
||||
p == 1 &&
|
||||
kart_info.m_race_lap == race_manager->getNumLaps() - 1 &&
|
||||
useFastMusicNearEnd() )
|
||||
{
|
||||
music_manager->switchToFastMusic();
|
||||
m_faster_music_active=true;
|
||||
|
@ -175,27 +175,23 @@ namespace Online
|
||||
{
|
||||
// https, load certificate info
|
||||
struct curl_slist *chunk = NULL;
|
||||
chunk = curl_slist_append(chunk, "Host: api.stkaddons.net");
|
||||
chunk = curl_slist_append(chunk, "Host: addons.supertuxkart.net");
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_HTTPHEADER, chunk);
|
||||
CURLcode error = curl_easy_setopt(m_curl_session, CURLOPT_CAINFO,
|
||||
file_manager->getAsset("web.tuxfamily.org.pem").c_str());
|
||||
file_manager->getAsset("addons.supertuxkart.net.pem").c_str());
|
||||
if (error != CURLE_OK)
|
||||
{
|
||||
Log::error("HTTPRequest", "Error setting CAINFO to '%s'",
|
||||
file_manager->getAsset("web.tuxfamily.org.pem").c_str());
|
||||
file_manager->getAsset("addons.supertuxkart.net.pem").c_str());
|
||||
Log::error("HTTPRequest", "Error %d: '%s'.", error,
|
||||
curl_easy_strerror(error));
|
||||
}
|
||||
|
||||
// In case that there are authentication problems (e.g. on osx)
|
||||
// disable peer verification. Not ideal, but still better than
|
||||
// no encryption.
|
||||
if (UserConfigParams::m_verify_peer)
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYPEER, 1L);
|
||||
else
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYPEER, 1L);
|
||||
#ifdef __APPLE__
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
#else
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYHOST, 1L);
|
||||
#endif
|
||||
}
|
||||
} // prepareOperation
|
||||
|
||||
|
@ -140,7 +140,7 @@ void OnlineProfile::fetchAchievements()
|
||||
class AchievementsRequest : public XMLRequest
|
||||
{
|
||||
public:
|
||||
AchievementsRequest() : XMLRequest(0, true) {}
|
||||
AchievementsRequest() : XMLRequest(true, true) {}
|
||||
virtual void callback()
|
||||
{
|
||||
uint32_t user_id = 0;
|
||||
@ -193,7 +193,7 @@ void OnlineProfile::fetchFriends()
|
||||
class FriendsListRequest : public XMLRequest
|
||||
{
|
||||
public:
|
||||
FriendsListRequest() : XMLRequest(0, true) {}
|
||||
FriendsListRequest() : XMLRequest(true, true) {}
|
||||
virtual void callback()
|
||||
{
|
||||
uint32_t user_id = 0;
|
||||
|
@ -207,7 +207,10 @@ namespace Online
|
||||
me->m_request_queue.getData().pop();
|
||||
|
||||
if (me->m_current_request->getType() == Request::RT_QUIT)
|
||||
{
|
||||
delete me->m_current_request;
|
||||
break;
|
||||
}
|
||||
|
||||
me->m_request_queue.unlock();
|
||||
me->m_current_request->execute();
|
||||
|
@ -106,6 +106,12 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
|
||||
cb_tex_cmp->setState(false);
|
||||
cb_tex_cmp->setDeactivated();
|
||||
}
|
||||
|
||||
if (!irr_driver->supportGeometryShader())
|
||||
{
|
||||
shadows->setDeactivated();
|
||||
getWidget<CheckBoxWidget>("global_illumination")->setDeactivated();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -123,7 +129,7 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
|
||||
UserConfigParams::m_motionblur =
|
||||
advanced_pipeline && getWidget<CheckBoxWidget>("motionblur")->getState();
|
||||
|
||||
if (advanced_pipeline)
|
||||
if (advanced_pipeline && irr_driver->supportGeometryShader())
|
||||
{
|
||||
UserConfigParams::m_shadows =
|
||||
getWidget<SpinnerWidget>("shadows")->getValue();
|
||||
@ -143,7 +149,8 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
|
||||
advanced_pipeline && getWidget<CheckBoxWidget>("lightshaft")->getState();
|
||||
|
||||
UserConfigParams::m_gi =
|
||||
advanced_pipeline && getWidget<CheckBoxWidget>("global_illumination")->getState();
|
||||
advanced_pipeline && irr_driver->supportGeometryShader() &&
|
||||
getWidget<CheckBoxWidget>("global_illumination")->getState();
|
||||
|
||||
UserConfigParams::m_glow =
|
||||
advanced_pipeline && getWidget<CheckBoxWidget>("glow")->getState();
|
||||
@ -236,5 +243,11 @@ void CustomVideoSettingsDialog::updateActivation()
|
||||
getWidget<CheckBoxWidget>("glow")->setDeactivated();
|
||||
getWidget<CheckBoxWidget>("bloom")->setDeactivated();
|
||||
}
|
||||
|
||||
if (!irr_driver->supportGeometryShader())
|
||||
{
|
||||
getWidget<SpinnerWidget>("shadows")->setDeactivated();
|
||||
getWidget<CheckBoxWidget>("global_illumination")->setDeactivated();
|
||||
}
|
||||
} // updateActivation
|
||||
|
||||
|
@ -62,6 +62,10 @@ GUIEngine::EventPropagation EnterGPNameDialog::processEvent(const std::string& e
|
||||
dismiss();
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if (eventSource == "accept")
|
||||
{
|
||||
validateName();
|
||||
}
|
||||
return GUIEngine::EVENT_LET;
|
||||
}
|
||||
|
||||
@ -77,7 +81,39 @@ void EnterGPNameDialog::onEnterPressedInternal()
|
||||
return;
|
||||
}
|
||||
|
||||
//Otherwise, see if we can accept the new name
|
||||
//Otherwise, see if we can accept the new name and create the grand prix
|
||||
validateName();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void EnterGPNameDialog::onUpdate(float dt)
|
||||
{
|
||||
// It's unsafe to delete from inside the event handler so we do it here
|
||||
if (m_self_destroy)
|
||||
{
|
||||
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
|
||||
stringw name = textCtrl->getText().trim();
|
||||
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||
|
||||
// we will destroy the dialog before notifying the listener to be safer.
|
||||
// but in order not to crash we must make a local copy of the listern
|
||||
// otherwise we will crash
|
||||
INewGPListener* listener = m_listener;
|
||||
|
||||
ModalDialog::dismiss();
|
||||
|
||||
if (listener != NULL)
|
||||
listener->onNewGPWithName(name);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void EnterGPNameDialog::validateName()
|
||||
{
|
||||
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
|
||||
assert(textCtrl != NULL);
|
||||
LabelWidget* label = getWidget<LabelWidget>("title");
|
||||
@ -106,30 +142,5 @@ void EnterGPNameDialog::onEnterPressedInternal()
|
||||
// in onUpdate (which checks for m_self_destroy)
|
||||
m_self_destroy = true;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void EnterGPNameDialog::onUpdate(float dt)
|
||||
{
|
||||
// It's unsafe to delete from inside the event handler so we do it here
|
||||
if (m_self_destroy)
|
||||
{
|
||||
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
|
||||
stringw name = textCtrl->getText().trim();
|
||||
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||
|
||||
// we will destroy the dialog before notifying the listener to be safer.
|
||||
// but in order not to crash we must make a local copy of the listern
|
||||
// otherwise we will crash
|
||||
INewGPListener* listener = m_listener;
|
||||
|
||||
ModalDialog::dismiss();
|
||||
|
||||
if (listener != NULL)
|
||||
listener->onNewGPWithName(name);
|
||||
}
|
||||
}
|
||||
}
|
@ -62,8 +62,8 @@ public:
|
||||
~EnterGPNameDialog();
|
||||
|
||||
void onEnterPressedInternal();
|
||||
void validateName();
|
||||
GUIEngine::EventPropagation processEvent(const std::string& eventSource);
|
||||
|
||||
virtual void onUpdate(float dt);
|
||||
};
|
||||
|
||||
|
@ -722,7 +722,8 @@ void KartSelectionScreen::playerConfirm(const int player_id)
|
||||
UserConfigParams::m_default_kart = selection;
|
||||
}
|
||||
|
||||
if (m_kart_widgets[player_id].getKartInternalName().size() == 0)
|
||||
if (m_kart_widgets[player_id].getKartInternalName().size() == 0 ||
|
||||
m_kart_widgets[player_id].getKartInternalName() == RibbonWidget::NO_ITEM_ID)
|
||||
{
|
||||
SFXManager::get()->quickSound( "anvil" );
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user