Merge branch 'master' into OSXFullscreen
This commit is contained in:
@@ -16,12 +16,12 @@
|
||||
max="1000" />
|
||||
|
||||
<!-- Minimal and maximal lifetime of a particle, in milliseconds. -->
|
||||
<lifetime min="10000"
|
||||
max="10000" />
|
||||
<lifetime min="8500"
|
||||
max="9500" />
|
||||
|
||||
<!-- Size of the particles -->
|
||||
<size min="0.40"
|
||||
max="0.60" />
|
||||
<size min="0.10"
|
||||
max="0.30" />
|
||||
|
||||
<color min="40 40 255"
|
||||
max="255 255 255" />
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
<box width="95%" height="40%" padding="10" layout="horizontal-row">
|
||||
<spacer width="10" height="100%"/>
|
||||
<!-- Left pane -->
|
||||
<div width="45%" height="95%" align="center" layout="vertical-row">
|
||||
<placeholder proportion="1" width="100%" height="100%" id="screenshot_div">
|
||||
</placeholder>
|
||||
<div width="45%" height="100%" align="center" layout="vertical-row">
|
||||
<icon-button proportion="1" width="100%" height="100%" id="screenshot" custom_ratio="1.33333"/>
|
||||
</div>
|
||||
|
||||
<spacer width="5%" height="100%"/>
|
||||
|
||||
@@ -45,14 +45,20 @@
|
||||
text="TEST: GPLose" label_location="hover"/>
|
||||
<icon-button id="test_unlocked" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
text="TEST: Unlocked" label_location="hover"/>
|
||||
<icon-button id="test_unlocked2" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
text="TEST: Unlocked 2" label_location="hover"/>
|
||||
<icon-button id="test_unlocked2" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
text="TEST: Unlocked 2" label_location="hover"/>
|
||||
<icon-button id="test_intro" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
text="TEST: Intro" label_location="hover"/>
|
||||
<icon-button id="test_outro" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
text="TEST: Outro" label_location="hover"/>
|
||||
<icon-button id="options" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
I18N="In the main screen" text="Options" label_location="hover"/>
|
||||
<icon-button id="help" width="64" height="64" icon="gui/main_help.png" extend_label="50"
|
||||
I18N="In the main screen" text="Help" label_location="hover"/>
|
||||
<icon-button id="startTutorial" width="64" height="64" icon="gui/tutorial.png" extend_label="150"
|
||||
I18N="In the main screen" text="Tutorial" label_location="hover"/>
|
||||
<icon-button id="achievements" width="64" height="64" icon="gui/gp_copy.png" extend_label="150"
|
||||
I18N="In the main screen" text="Achievements" label_location="hover"/>
|
||||
<icon-button id="gpEditor" width="64" height="64" icon="gui/gpeditor.png" extend_label="150"
|
||||
I18N="In the main screen" text="Grand Prix Editor" label_location="hover"/>
|
||||
<icon-button id="about" width="64" height="64" icon="gui/main_about.png" extend_label="50"
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"
|
||||
I18N="Section in the profile screen" text="Achievements"/>
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row" padding="6">
|
||||
<list id="achievements_list" x="0" y="0" width="100%" height="100%"/>
|
||||
</box>
|
||||
|
||||
22
data/gui/online/profile_achievements_tab.stkgui
Normal file
22
data/gui/online/profile_achievements_tab.stkgui
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<stkgui>
|
||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||
|
||||
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
|
||||
|
||||
<header id="title" text_align="center" width="80%" align="center" text="..."/>
|
||||
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"
|
||||
I18N="Section in the profile screen" text="Achievements"/>
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row" padding="6">
|
||||
<list id="achievements_list" x="0" y="0" width="100%" height="100%"/>
|
||||
</box>
|
||||
</div>
|
||||
</stkgui>
|
||||
@@ -10,8 +10,7 @@
|
||||
<box width="95%" height="40%" padding="10" layout="horizontal-row">
|
||||
<!-- Left pane -->
|
||||
<div proportion="1" height="100%" layout="vertical-row">
|
||||
<placeholder proportion="1" width="100%" height="100%" id="screenshot_div">
|
||||
</placeholder>
|
||||
<icon-button proportion="1" width="100%" height="100%" id="screenshot" custom_ratio="1.33333"/>
|
||||
</div>
|
||||
<!-- Right pane -->
|
||||
<div proportion="1" height="100%" layout="vertical-row">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 the SuperTuxKart team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform float transparency;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 Color = texture(tex, uv);
|
||||
Color.a *= transparency;
|
||||
FragColor = vec4(Color.rgb * Color.a, Color.a);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 the SuperTuxKart team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
// Creates a bubble (wave) effect by distorting the texture depending on time
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform float time;
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
#else
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
#endif
|
||||
out vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
|
||||
float delta_x = cos(time*3.0) * sin( 4.0 * Texcoord.x * 6.28318531 );
|
||||
float delta_y = cos(time*2.0) * sin( 3.0 * Texcoord.y * 6.28318531 );
|
||||
|
||||
uv = Texcoord + vec2(0.02*delta_x, 0.02*delta_y);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ varying vec2 uv_bis;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -31,5 +31,5 @@ void main(void)
|
||||
vec4 detail = texture(Detail, uv_bis);
|
||||
color *= detail;
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
FragColor = vec4(getLightFactor(color.xyz, vec3(1.), specmap), 1.);
|
||||
FragColor = vec4(getLightFactor(color.xyz, vec3(1.), specmap, 0.), 1.);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void main(void)
|
||||
vec3 sampleDirection = reflect(-eyedir, normal);
|
||||
sampleDirection = (InverseViewMatrix * vec4(sampleDirection, 0.)).xyz;
|
||||
|
||||
float specval = pow(texture(ntex, uv).z, 2.);
|
||||
float specval = texture(ntex, uv).z;
|
||||
// From http://graphics.cs.williams.edu/papers/EnvMipReport2013/
|
||||
int texSize = textureSize(tex, 0).x;
|
||||
float lodval = clamp(log2(texSize * sqrt(3.)) - .5 * log2(specval + 1.), 0., 10.);
|
||||
|
||||
@@ -15,7 +15,9 @@ void main()
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
float dist = length(xpos.xyz);
|
||||
vec3 fog = col * (1. - exp(- density * dist));
|
||||
float factor = (1. - exp(- density * dist));
|
||||
vec3 fog = col * factor;
|
||||
|
||||
FragColor = vec4(fog, 1.);
|
||||
// fog is scattering component, factor is the beer lambert absorption
|
||||
FragColor = vec4(fog, factor);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ uniform float sigma;
|
||||
|
||||
layout (local_size_x = 8, local_size_y = 8) in;
|
||||
|
||||
shared vec3 local_src[8 + 2 * 6][8];
|
||||
shared vec4 local_src[8 + 2 * 6][8];
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -17,9 +17,9 @@ void main()
|
||||
vec2 uv = iuv * pixel;
|
||||
vec2 uv_p = (iuv + ivec2(6, 0)) * pixel;
|
||||
|
||||
local_src[x][y] = texture(source, uv_m).rgb;
|
||||
local_src[x + 6][y] = texture(source, uv).rgb;
|
||||
local_src[x + 12][y] = texture(source, uv_p).rgb;
|
||||
local_src[x][y] = texture(source, uv_m);
|
||||
local_src[x + 6][y] = texture(source, uv);
|
||||
local_src[x + 12][y] = texture(source, uv_p);
|
||||
|
||||
barrier();
|
||||
|
||||
@@ -27,7 +27,7 @@ void main()
|
||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||
g1 = exp(-0.5 / (sigma * sigma));
|
||||
g2 = g1 * g1;
|
||||
vec3 sum = local_src[x + 6][y] * g0;
|
||||
vec4 sum = local_src[x + 6][y] * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
for (int i = 1; i < 6; i++) {
|
||||
@@ -37,5 +37,5 @@ void main()
|
||||
g1 *= g2;
|
||||
}
|
||||
|
||||
imageStore(dest, iuv, vec4(sum, 0.));
|
||||
imageStore(dest, iuv, sum);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ uniform float sigma;
|
||||
|
||||
layout (local_size_x = 8, local_size_y = 8) in;
|
||||
|
||||
shared vec3 local_src[8][8 + 2 * 6];
|
||||
shared vec4 local_src[8][8 + 2 * 6];
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -17,9 +17,9 @@ void main()
|
||||
vec2 uv = iuv * pixel;
|
||||
vec2 uv_p = (iuv + ivec2(0, 6)) * pixel;
|
||||
|
||||
local_src[x][y] = texture(source, uv_m).rgb;
|
||||
local_src[x][y + 6] = texture(source, uv).rgb;
|
||||
local_src[x][y + 12] = texture(source, uv_p).rgb;
|
||||
local_src[x][y] = texture(source, uv_m);
|
||||
local_src[x][y + 6] = texture(source, uv);
|
||||
local_src[x][y + 12] = texture(source, uv_p);
|
||||
|
||||
barrier();
|
||||
|
||||
@@ -27,7 +27,7 @@ void main()
|
||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||
g1 = exp(-0.5 / (sigma * sigma));
|
||||
g2 = g1 * g1;
|
||||
vec3 sum = local_src[x][y + 6] * g0;
|
||||
vec4 sum = local_src[x][y + 6] * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
for (int i = 1; i < 6; i++) {
|
||||
@@ -37,5 +37,5 @@ void main()
|
||||
g1 *= g2;
|
||||
}
|
||||
|
||||
imageStore(dest, iuv, vec4(sum, 0.));
|
||||
imageStore(dest, iuv, sum);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -42,6 +42,6 @@ void main(void)
|
||||
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
|
||||
vec3 LightFactor = color.xyz * (scattering * 0.3) + getLightFactor(color.xyz, vec3(1.), specmap);
|
||||
vec3 LightFactor = color.xyz * (scattering * 0.3) + getLightFactor(color.xyz, vec3(1.), specmap, 0.);
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ in vec2 uv;
|
||||
in vec2 uv_bis;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -30,5 +30,5 @@ void main(void)
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
#endif
|
||||
color *= detail;
|
||||
FragColor = vec4(getLightFactor(color.xyz, vec3(1.), specmap), 1.);
|
||||
FragColor = vec4(getLightFactor(color.xyz, vec3(1.), specmap, 0.), 1.);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -48,6 +48,6 @@ void main(void)
|
||||
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
||||
|
||||
|
||||
vec3 LightFactor = color.xyz * (scattering * 0.1) + getLightFactor(color.xyz, vec3(1.), specmap);
|
||||
vec3 LightFactor = color.xyz * (scattering * 0.1) + getLightFactor(color.xyz, vec3(1.), specmap, 0.);
|
||||
FragColor = vec4(LightFactor, 1.);
|
||||
}
|
||||
|
||||
@@ -11,20 +11,23 @@ in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
vec4 col = texture(handle, uv);
|
||||
float specmap = texture(secondhandle, uv).g;
|
||||
float emitmap = texture(secondhandle, uv).b;
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
#else
|
||||
vec4 col = texture(Albedo, uv);
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
float emitmap = texture(SpecMap, uv).b;
|
||||
#endif
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap), 1.);
|
||||
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, emitmap) , 1.);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ out vec4 FragColor;
|
||||
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main() {
|
||||
vec3 texc = gl_FragCoord.xyz / vec3(screen, 1.);
|
||||
@@ -30,5 +30,5 @@ void main() {
|
||||
vec4 detail0 = texture(tex, r.xy / m + .5);
|
||||
#endif
|
||||
|
||||
FragColor = vec4(getLightFactor(detail0.xyz, vec3(1.), 0.), 1.);
|
||||
FragColor = vec4(getLightFactor(detail0.xyz, vec3(1.), 0., 0.), 1.);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -27,5 +27,5 @@ void main(void)
|
||||
#endif
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
if (col.a * color.a < 0.5) discard;
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap), 1.);
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, 0.), 1.);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -24,5 +24,5 @@ void main(void)
|
||||
#endif
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap), 1.);
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, 0.), 1.);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ varying vec3 nor;
|
||||
#endif
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main() {
|
||||
vec3 texc = gl_FragCoord.xyz / vec3(screen, 1.);
|
||||
@@ -31,5 +31,5 @@ void main() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
FragColor = vec4(getLightFactor(detail0.xyz, vec3(1.), 0.), 1.);
|
||||
FragColor = vec4(getLightFactor(detail0.xyz, vec3(1.), 0., 0.), 1.);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -23,5 +23,5 @@ void main(void)
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
if (col.a * color.a < 0.5) discard;
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap), 1.);
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, 0.), 1.);
|
||||
}
|
||||
|
||||
@@ -42,5 +42,5 @@ void main()
|
||||
xpos += stepsize * eyedir;
|
||||
}
|
||||
|
||||
Fog = vec4(fogcol * fog, 1.);
|
||||
Fog = vec4(fogcol * fog, 0.);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ varying vec2 uv_bis;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
|
||||
void main() {
|
||||
// Splatting part
|
||||
@@ -46,5 +46,5 @@ void main() {
|
||||
splatting.b * detail2 +
|
||||
max(0., (1.0 - splatting.r - splatting.g - splatting.b)) * detail3;
|
||||
|
||||
FragColor = vec4(getLightFactor(splatted.xyz, vec3(1.), 0.), 1.);
|
||||
FragColor = vec4(getLightFactor(splatted.xyz, vec3(1.), 0., 0.), 1.);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ uniform sampler2D dtex;
|
||||
|
||||
uniform vec3 direction;
|
||||
uniform vec3 col;
|
||||
uniform mat4 invproj;
|
||||
uniform float sunangle = .54;
|
||||
|
||||
//uniform int hasclouds;
|
||||
//uniform vec2 wind;
|
||||
|
||||
@@ -15,6 +16,16 @@ vec3 DecodeNormal(vec2 n);
|
||||
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
||||
{
|
||||
vec3 D = direction;
|
||||
float d = cos(angularRadius);
|
||||
float r = sin(angularRadius);
|
||||
float DdotR = dot(D, R);
|
||||
vec3 S = R - DdotR * D;
|
||||
return (DdotR < d) ? normalize(d * D + normalize (S) * r) : R;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float z = texture(dtex, uv).x;
|
||||
@@ -37,7 +48,11 @@ void main() {
|
||||
|
||||
float NdotL = max(0., dot(norm, L));
|
||||
|
||||
vec3 Specular = getSpecular(norm, eyedir, L, col, roughness) * NdotL;
|
||||
float angle = 3.14 * sunangle / 180.;
|
||||
vec3 R = reflect(-eyedir, norm);
|
||||
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
|
||||
|
||||
vec3 Specular = getSpecular(norm, eyedir, Lightdir, col, roughness) * NdotL;
|
||||
|
||||
vec3 outcol = NdotL * col;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ uniform float splitmax;
|
||||
|
||||
uniform vec3 direction;
|
||||
uniform vec3 col;
|
||||
uniform float sunangle = .54;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 Diff;
|
||||
@@ -18,6 +19,16 @@ vec3 DecodeNormal(vec2 n);
|
||||
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
||||
{
|
||||
vec3 D = direction;
|
||||
float d = cos(angularRadius);
|
||||
float r = sin(angularRadius);
|
||||
float DdotR = dot(D, R);
|
||||
vec3 S = R - DdotR * D;
|
||||
return (DdotR < d) ? normalize(d * D + normalize (S) * r) : R;
|
||||
}
|
||||
|
||||
float getShadowFactor(vec3 pos, float bias, int index)
|
||||
{
|
||||
|
||||
@@ -51,7 +62,11 @@ void main() {
|
||||
|
||||
float NdotL = max(0., dot(norm, L));
|
||||
|
||||
vec3 Specular = getSpecular(norm, eyedir, L, col, roughness) * NdotL;
|
||||
float angle = 3.14 * sunangle / 180.;
|
||||
vec3 R = reflect(-eyedir, norm);
|
||||
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
|
||||
|
||||
vec3 Specular = getSpecular(norm, eyedir, Lightdir, col, roughness) * NdotL;
|
||||
|
||||
|
||||
vec3 outcol = NdotL * col;
|
||||
|
||||
@@ -8,12 +8,13 @@ uniform sampler2D SpecularMap;
|
||||
uniform sampler2D SSAO;
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue)
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue)
|
||||
{
|
||||
vec2 tc = gl_FragCoord.xy / screen;
|
||||
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
||||
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
||||
float ao = texture(SSAO, tc).x;
|
||||
vec3 tmp = diffuseMatColor * DiffuseComponent * (1. - specMapValue) + specularMatColor * SpecularComponent * specMapValue;
|
||||
return tmp * ao;
|
||||
}
|
||||
vec3 emitCol = diffuseMatColor.xyz * diffuseMatColor.xyz * diffuseMatColor.xyz * 15.;
|
||||
return tmp * ao + (emitMapValue * emitCol);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,8 @@ void SFXManager::queue(SFXCommands command, SFXBase *sfx, const Vec3 &p)
|
||||
void SFXManager::queueCommand(SFXCommand *command)
|
||||
{
|
||||
m_sfx_commands.lock();
|
||||
if(m_sfx_commands.getData().size() > 20*race_manager->getNumberOfKarts()+20)
|
||||
if(m_sfx_commands.getData().size() > 20*race_manager->getNumberOfKarts()+20 &&
|
||||
race_manager->getMinorMode() != RaceManager::MINOR_MODE_CUTSCENE)
|
||||
{
|
||||
if(command->m_command==SFX_POSITION || command->m_command==SFX_LOOP ||
|
||||
command->m_command==SFX_PLAY || command->m_command==SFX_SPEED )
|
||||
|
||||
@@ -652,11 +652,38 @@ namespace UserConfigParams
|
||||
PARAM_DEFAULT( BoolUserConfigParam(
|
||||
CONSOLE_DEFAULT, "log_errors", "Enable logging to console.") );
|
||||
|
||||
// ---- Camera
|
||||
PARAM_PREFIX GroupUserConfigParam m_camera
|
||||
PARAM_DEFAULT( GroupUserConfigParam("camera",
|
||||
"(Debug) camera settings.") );
|
||||
|
||||
PARAM_PREFIX IntUserConfigParam m_reverse_look_threshold
|
||||
PARAM_DEFAULT( IntUserConfigParam(0, "reverse_look_threshold",
|
||||
&m_camera,
|
||||
"If the kart is driving backwards faster than this value,\n"
|
||||
"switch automatically to reverse camera (set to 0 to disable).") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_fspcam_direction_speed
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.003f, "fspcam_rotation_speed",
|
||||
&m_camera,
|
||||
"How fast the first person camera's direction speed changes when\n"
|
||||
"moving the mouse (means acceleration).") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_fspcam_smooth_direction_max_speed
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.04f, "fspcam_smooth_rotation_max_speed",
|
||||
&m_camera,
|
||||
"How fast the first person camera's direction can change.") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_fspcam_angular_velocity
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.02f, "fspcam_angular_velocity",
|
||||
&m_camera,
|
||||
"How fast the first person camera's rotation speed changes.") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_fspcam_max_angular_velocity
|
||||
PARAM_DEFAULT( FloatUserConfigParam(1.0f, "fspcam_max_angular_velocity",
|
||||
&m_camera,
|
||||
"How fast the first person camera can rotate.") );
|
||||
|
||||
PARAM_PREFIX StringUserConfigParam m_item_style
|
||||
PARAM_DEFAULT( StringUserConfigParam("items", "item_style",
|
||||
"Name of the .items file to use.") );
|
||||
@@ -672,6 +699,7 @@ namespace UserConfigParams
|
||||
PARAM_DEFAULT( StringUserConfigParam("Peach.stkskin", "skin_file",
|
||||
"Name of the skin to use") );
|
||||
|
||||
// ---- Handicap
|
||||
PARAM_PREFIX GroupUserConfigParam m_handicap
|
||||
PARAM_DEFAULT( GroupUserConfigParam("Handicap",
|
||||
"Everything related to handicaps.") );
|
||||
|
||||
@@ -150,62 +150,6 @@ void MipVizProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
void SunLightProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
{
|
||||
const int hasclouds = World::getWorld()->getTrack()->hasClouds() &&
|
||||
UserConfigParams::m_weather_effects;
|
||||
|
||||
srv->setVertexShaderConstant("screen", m_screen, 2);
|
||||
srv->setVertexShaderConstant("col", m_color, 3);
|
||||
srv->setVertexShaderConstant("center", m_pos, 3);
|
||||
srv->setVertexShaderConstant("invproj", irr_driver->getInvProjMatrix().pointer(), 16);
|
||||
srv->setVertexShaderConstant("hasclouds", &hasclouds, 1);
|
||||
|
||||
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
|
||||
|
||||
float strength = time;
|
||||
strength = fabsf(noise2d(strength / 10.0f)) * 0.003f;
|
||||
|
||||
const vector3df winddir = irr_driver->getWind() * strength;
|
||||
m_wind[0] += winddir.X;
|
||||
m_wind[1] += winddir.Z;
|
||||
srv->setVertexShaderConstant("wind", m_wind, 2);
|
||||
|
||||
if (UserConfigParams::m_shadows)
|
||||
{
|
||||
srv->setVertexShaderConstant("shadowmat", m_shadowmat.pointer(), 16);
|
||||
}
|
||||
|
||||
// Can't use the firstdone optimization, as this callback is used for multiple shaders
|
||||
//if (!firstdone)
|
||||
{
|
||||
int tex = 0;
|
||||
srv->setVertexShaderConstant("ntex", &tex, 1);
|
||||
|
||||
tex = 1;
|
||||
srv->setVertexShaderConstant("dtex", &tex, 1);
|
||||
|
||||
tex = 2;
|
||||
srv->setVertexShaderConstant("cloudtex", &tex, 1);
|
||||
|
||||
tex = 3;
|
||||
srv->setVertexShaderConstant("shadowtex", &tex, 1);
|
||||
|
||||
tex = 4;
|
||||
srv->setVertexShaderConstant("warpx", &tex, 1);
|
||||
|
||||
tex = 5;
|
||||
srv->setVertexShaderConstant("warpy", &tex, 1);
|
||||
|
||||
// const float shadowoffset = 1.0f / irr_driver->getRTT(RTT_SHADOW)->getSize().Width;
|
||||
// srv->setVertexShaderConstant("shadowoffset", &shadowoffset, 1);
|
||||
|
||||
firstdone = true;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
void DisplaceProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
{
|
||||
|
||||
|
||||
@@ -211,75 +211,6 @@ public:
|
||||
|
||||
//
|
||||
|
||||
class SunLightProvider: public CallBase
|
||||
{
|
||||
public:
|
||||
SunLightProvider()
|
||||
{
|
||||
m_screen[0] = (float)UserConfigParams::m_width;
|
||||
m_screen[1] = (float)UserConfigParams::m_height;
|
||||
|
||||
m_wind[0] = m_wind[1] = 0;
|
||||
}
|
||||
|
||||
virtual void OnSetConstants(video::IMaterialRendererServices *srv, int);
|
||||
|
||||
void setColor(float r, float g, float b)
|
||||
{
|
||||
m_color[0] = r;
|
||||
m_color[1] = g;
|
||||
m_color[2] = b;
|
||||
}
|
||||
|
||||
float getRed() const
|
||||
{
|
||||
return m_color[0];
|
||||
}
|
||||
|
||||
float getGreen() const
|
||||
{
|
||||
return m_color[1];
|
||||
}
|
||||
|
||||
float getBlue() const
|
||||
{
|
||||
return m_color[2];
|
||||
}
|
||||
|
||||
void setPosition(float x, float y, float z)
|
||||
{
|
||||
// Sun "position" is actually a direction and not a position
|
||||
core::matrix4 m_view = irr_driver->getViewMatrix();
|
||||
m_view.makeInverse();
|
||||
m_view = m_view.getTransposed();
|
||||
core::vector3df pos(x, y, z);
|
||||
m_view.transformVect(pos);
|
||||
pos.normalize();
|
||||
m_pos[0] = pos.X;
|
||||
m_pos[1] = pos.Y;
|
||||
m_pos[2] = pos.Z;
|
||||
}
|
||||
|
||||
core::vector3df getPosition() const
|
||||
{
|
||||
return core::vector3df(m_pos[0], m_pos[1], m_pos[2]);
|
||||
}
|
||||
|
||||
void setShadowMatrix(const core::matrix4 &mat)
|
||||
{
|
||||
m_shadowmat = mat;
|
||||
}
|
||||
|
||||
private:
|
||||
core::matrix4 m_shadowmat;
|
||||
float m_color[3];
|
||||
float m_pos[3];
|
||||
float m_screen[2];
|
||||
float m_wind[2];
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
class DisplaceProvider: public CallBase
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -90,6 +90,7 @@ Camera::Camera(int camera_index, AbstractKart* kart) : m_kart(NULL)
|
||||
m_target_velocity = core::vector3df(0, 0, 0);
|
||||
m_target_direction = core::vector3df(0, 0, 1);
|
||||
m_target_up_vector = core::vector3df(0, 1, 0);
|
||||
m_direction_velocity = core::vector3df(0, 0, 0);
|
||||
m_angular_velocity = 0;
|
||||
m_target_angular_velocity = 0;
|
||||
m_max_velocity = 15;
|
||||
@@ -500,13 +501,13 @@ void Camera::update(float dt)
|
||||
// Angular velocity
|
||||
if (m_angular_velocity < m_target_angular_velocity)
|
||||
{
|
||||
m_angular_velocity += 0.02f;
|
||||
m_angular_velocity += UserConfigParams::m_fspcam_angular_velocity;
|
||||
if (m_angular_velocity > m_target_angular_velocity)
|
||||
m_angular_velocity = m_target_angular_velocity;
|
||||
}
|
||||
else if (m_angular_velocity > m_target_angular_velocity)
|
||||
{
|
||||
m_angular_velocity -= 0.02f;
|
||||
m_angular_velocity -= UserConfigParams::m_fspcam_angular_velocity;
|
||||
if (m_angular_velocity < m_target_angular_velocity)
|
||||
m_angular_velocity = m_target_angular_velocity;
|
||||
}
|
||||
@@ -524,17 +525,25 @@ void Camera::update(float dt)
|
||||
diff = m_target_direction - direction;
|
||||
if (diff.X != 0 || diff.Y != 0 || diff.Z != 0)
|
||||
{
|
||||
if (diff.getLengthSQ() > 0.02f * 0.02f)
|
||||
diff.setLength(0.02f);
|
||||
direction += diff;
|
||||
diff.setLength(UserConfigParams::m_fspcam_direction_speed);
|
||||
m_direction_velocity += diff;
|
||||
if (m_direction_velocity.getLengthSQ() >
|
||||
UserConfigParams::m_fspcam_smooth_direction_max_speed *
|
||||
UserConfigParams::m_fspcam_smooth_direction_max_speed)
|
||||
m_direction_velocity.setLength(
|
||||
UserConfigParams::m_fspcam_smooth_direction_max_speed);
|
||||
direction += m_direction_velocity;
|
||||
m_target_direction = direction;
|
||||
}
|
||||
|
||||
// Camera rotation
|
||||
diff = m_target_up_vector - up;
|
||||
if (diff.X != 0 || diff.Y != 0 || diff.Z != 0)
|
||||
{
|
||||
if (diff.getLengthSQ() > 0.02f * 0.02f)
|
||||
diff.setLength(0.02f);
|
||||
if (diff.getLengthSQ() >
|
||||
UserConfigParams::m_fspcam_angular_velocity *
|
||||
UserConfigParams::m_fspcam_angular_velocity)
|
||||
diff.setLength(UserConfigParams::m_fspcam_angular_velocity);
|
||||
up += diff;
|
||||
}
|
||||
}
|
||||
@@ -727,13 +736,15 @@ void Camera::handleEndCamera(float dt)
|
||||
/** Sets viewport etc. for this camera. Called from irr_driver just before
|
||||
* rendering the view for this kart.
|
||||
*/
|
||||
void Camera::activate()
|
||||
void Camera::activate(bool alsoActivateInIrrlicht)
|
||||
{
|
||||
s_active_camera = this;
|
||||
irr::scene::ISceneManager *sm = irr_driver->getSceneManager();
|
||||
sm->setActiveCamera(m_camera);
|
||||
irr_driver->getVideoDriver()->setViewPort(m_viewport);
|
||||
|
||||
if (alsoActivateInIrrlicht)
|
||||
{
|
||||
irr::scene::ISceneManager *sm = irr_driver->getSceneManager();
|
||||
sm->setActiveCamera(m_camera);
|
||||
irr_driver->getVideoDriver()->setViewPort(m_viewport);
|
||||
}
|
||||
} // activate
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -132,6 +132,9 @@ private:
|
||||
/** The target direction for the camera, only used for the first person camera. */
|
||||
core::vector3df m_target_direction;
|
||||
|
||||
/** The speed at which the direction changes, only used for the first person camera. */
|
||||
core::vector3df m_direction_velocity;
|
||||
|
||||
/** The up vector the camera should have, only used for the first person camera. */
|
||||
core::vector3df m_target_up_vector;
|
||||
|
||||
@@ -254,7 +257,7 @@ public:
|
||||
int getIndex() const {return m_index;}
|
||||
void reset ();
|
||||
void setInitialTransform();
|
||||
void activate();
|
||||
void activate(bool alsoActivateInIrrlicht=true);
|
||||
void update (float dt);
|
||||
void setKart (AbstractKart *new_kart);
|
||||
|
||||
|
||||
@@ -39,6 +39,24 @@ debugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei le
|
||||
return;
|
||||
#endif
|
||||
|
||||
// suppress minor performance warnings (emitted mostly by nvidia drivers)
|
||||
if ((severity == GL_DEBUG_SEVERITY_MEDIUM_ARB || severity == GL_DEBUG_SEVERITY_LOW_ARB) &&
|
||||
type == GL_DEBUG_TYPE_PERFORMANCE_ARB)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Suppress warnings about GL_ARB_bindless_texture not being supported
|
||||
// when we're not even using it
|
||||
if (UserConfigParams::m_azdo == false &&
|
||||
source == GL_DEBUG_SOURCE_SHADER_COMPILER_ARB && msg != NULL &&
|
||||
std::string(msg).find("GL_ARB_bindless_texture") != std::string::npos)
|
||||
{
|
||||
Log::debug("GLWrap", "Suppressed warning: %s", msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch(source)
|
||||
{
|
||||
case GL_DEBUG_SOURCE_API_ARB:
|
||||
@@ -95,7 +113,7 @@ debugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei le
|
||||
Log::warn("GLWrap", " Severity : LOW");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (msg)
|
||||
Log::warn("GLWrap", " Message : %s", msg);
|
||||
}
|
||||
|
||||
@@ -128,10 +128,29 @@ void generateLifetimeSizeDirection(scene::IParticleEmitter *emitter, float &life
|
||||
|
||||
void ParticleSystemProxy::generateParticlesFromPointEmitter(scene::IParticlePointEmitter *emitter)
|
||||
{
|
||||
ParticleParams = (ParticleData *) realloc(ParticleParams, sizeof(ParticleData) * count);
|
||||
InitialValues = (ParticleData *)realloc(InitialValues, sizeof(ParticleData)* count);
|
||||
ParticleData* ParticleParamsTmp = (ParticleData *) realloc(ParticleParams, sizeof(ParticleData) * m_count);
|
||||
ParticleData* InitialValuesTmp = (ParticleData *)realloc(InitialValues, sizeof(ParticleData)* m_count);
|
||||
|
||||
for (unsigned i = 0; i < count; i++)
|
||||
if (ParticleParamsTmp != NULL) // In case memory allocation succeeded
|
||||
{
|
||||
ParticleParams = ParticleParamsTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::error("GPUParticles", "Not enough memory for %d from point particles.", m_count);
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
if (InitialValuesTmp != NULL)
|
||||
{
|
||||
InitialValues = InitialValuesTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::fatal("GPUParticles", "Not enough memory for %d from point particles.", m_count);
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < m_count; i++)
|
||||
{
|
||||
ParticleParams[i].PositionX = 0;
|
||||
ParticleParams[i].PositionY = 0;
|
||||
@@ -150,12 +169,31 @@ void ParticleSystemProxy::generateParticlesFromPointEmitter(scene::IParticlePoin
|
||||
|
||||
void ParticleSystemProxy::generateParticlesFromBoxEmitter(scene::IParticleBoxEmitter *emitter)
|
||||
{
|
||||
ParticleParams = (ParticleData *)realloc(ParticleParams, sizeof(ParticleData)* count);
|
||||
InitialValues = (ParticleData *)realloc(InitialValues, sizeof(ParticleData)* count);
|
||||
ParticleData* ParticleParamsTmp = (ParticleData *) realloc(ParticleParams, sizeof(ParticleData) * m_count);
|
||||
ParticleData* InitialValuesTmp = (ParticleData *)realloc(InitialValues, sizeof(ParticleData)* m_count);
|
||||
|
||||
if (ParticleParamsTmp != NULL) // In case memory allocation succeeded
|
||||
{
|
||||
ParticleParams = ParticleParamsTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::error("GPUParticles", "Not enough memory for %d from box particles.", m_count);
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
if (InitialValuesTmp != NULL)
|
||||
{
|
||||
InitialValues = InitialValuesTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::error("GPUParticles", "Not enough memory for %d from box particles.", m_count);
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
|
||||
const core::vector3df& extent = emitter->getBox().getExtent();
|
||||
|
||||
for (unsigned i = 0; i < count; i++)
|
||||
for (unsigned i = 0; i < m_count; i++)
|
||||
{
|
||||
ParticleParams[i].PositionX = emitter->getBox().MinEdge.X + os::Randomizer::frand() * extent.X;
|
||||
ParticleParams[i].PositionY = emitter->getBox().MinEdge.Y + os::Randomizer::frand() * extent.Y;
|
||||
@@ -177,10 +215,15 @@ void ParticleSystemProxy::generateParticlesFromBoxEmitter(scene::IParticleBoxEmi
|
||||
|
||||
void ParticleSystemProxy::generateParticlesFromSphereEmitter(scene::IParticleSphereEmitter *emitter)
|
||||
{
|
||||
ParticleParams = (ParticleData *)realloc(ParticleParams, sizeof(ParticleData)* count);
|
||||
InitialValues = (ParticleData *)realloc(InitialValues, sizeof(ParticleData)* count);
|
||||
ParticleData* ParticleParamsTmp = (ParticleData *) realloc(ParticleParams, sizeof(ParticleData) * m_count);
|
||||
ParticleData* InitialValuesTmp = (ParticleData *)realloc(InitialValues, sizeof(ParticleData)* m_count);
|
||||
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
if(ParticleParamsTmp != NULL) // In case memory allocation succeeded
|
||||
ParticleParams = ParticleParamsTmp;
|
||||
if(InitialValuesTmp != NULL)
|
||||
InitialValues = InitialValuesTmp;
|
||||
|
||||
for (unsigned i = 0; i < m_count; i++) {
|
||||
// Random distance from center
|
||||
const f32 distance = os::Randomizer::frand() * emitter->getRadius();
|
||||
|
||||
@@ -227,7 +270,8 @@ void ParticleSystemProxy::setEmitter(scene::IParticleEmitter* emitter)
|
||||
flip = false;
|
||||
m_first_execution = true;
|
||||
|
||||
count = emitter->getMaxParticlesPerSecond() * emitter->getMaxLifeTime() / 1000;
|
||||
m_previous_count = m_count; // save to handle out of memory errors
|
||||
m_count = emitter->getMaxParticlesPerSecond() * emitter->getMaxLifeTime() / 1000;
|
||||
switch (emitter->getType())
|
||||
{
|
||||
case scene::EPET_POINT:
|
||||
@@ -340,7 +384,7 @@ void ParticleSystemProxy::simulate()
|
||||
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfb_buffers[1]);
|
||||
|
||||
glBeginTransformFeedback(GL_POINTS);
|
||||
glDrawArrays(GL_POINTS, 0, count);
|
||||
glDrawArrays(GL_POINTS, 0, m_count);
|
||||
glEndTransformFeedback();
|
||||
glBindVertexArray(0);
|
||||
|
||||
@@ -359,7 +403,7 @@ void ParticleSystemProxy::drawFlip()
|
||||
ParticleShader::FlipParticleRender::getInstance()->setUniforms();
|
||||
|
||||
glBindVertexArray(current_rendering_vao);
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, count);
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, m_count);
|
||||
}
|
||||
|
||||
void ParticleSystemProxy::drawNotFlip()
|
||||
@@ -377,7 +421,7 @@ void ParticleSystemProxy::drawNotFlip()
|
||||
ParticleShader::SimpleParticleRender::getInstance()->setUniforms(ColorFrom, ColorTo);
|
||||
|
||||
glBindVertexArray(current_rendering_vao);
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, count);
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, m_count);
|
||||
}
|
||||
|
||||
void ParticleSystemProxy::draw()
|
||||
@@ -393,12 +437,12 @@ void ParticleSystemProxy::generateVAOs()
|
||||
glBindVertexArray(0);
|
||||
glGenBuffers(1, &initial_values_buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, initial_values_buffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, count * sizeof(ParticleData), ParticleParams, GL_STREAM_COPY);
|
||||
glBufferData(GL_ARRAY_BUFFER, m_count * sizeof(ParticleData), ParticleParams, GL_STREAM_COPY);
|
||||
glGenBuffers(2, tfb_buffers);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tfb_buffers[0]);
|
||||
glBufferData(GL_ARRAY_BUFFER, count * sizeof(ParticleData), InitialValues, GL_STREAM_COPY);
|
||||
glBufferData(GL_ARRAY_BUFFER, m_count * sizeof(ParticleData), InitialValues, GL_STREAM_COPY);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tfb_buffers[1]);
|
||||
glBufferData(GL_ARRAY_BUFFER, count * sizeof(ParticleData), 0, GL_STREAM_COPY);
|
||||
glBufferData(GL_ARRAY_BUFFER, m_count * sizeof(ParticleData), 0, GL_STREAM_COPY);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGenVertexArrays(1, ¤t_rendering_vao);
|
||||
@@ -415,8 +459,8 @@ void ParticleSystemProxy::generateVAOs()
|
||||
glBindVertexArray(0);
|
||||
if (flip)
|
||||
{
|
||||
float *quaternions = new float[4 * count];
|
||||
for (unsigned i = 0; i < count; i++)
|
||||
float *quaternions = new float[4 * m_count];
|
||||
for (unsigned i = 0; i < m_count; i++)
|
||||
{
|
||||
core::vector3df rotationdir(0., 1., 0.);
|
||||
|
||||
@@ -427,7 +471,7 @@ void ParticleSystemProxy::generateVAOs()
|
||||
}
|
||||
glGenBuffers(1, &quaternionsbuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, quaternionsbuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, 4 * count * sizeof(float), quaternions, GL_STREAM_COPY);
|
||||
glBufferData(GL_ARRAY_BUFFER, 4 * m_count * sizeof(float), quaternions, GL_STREAM_COPY);
|
||||
delete[] quaternions;
|
||||
}
|
||||
|
||||
@@ -454,4 +498,4 @@ void ParticleSystemProxy::render() {
|
||||
m_first_execution = false;
|
||||
simulate();
|
||||
draw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,12 @@ protected:
|
||||
bool m_randomize_initial_y;
|
||||
|
||||
GLuint texture;
|
||||
unsigned count;
|
||||
|
||||
/** Current count of particles. */
|
||||
unsigned m_count;
|
||||
/** Previous count - for error handling only. */
|
||||
unsigned m_previous_count;
|
||||
|
||||
static void CommonRenderingVAO(GLuint PositionBuffer);
|
||||
static void AppendQuaternionRenderingVAO(GLuint QuaternionBuffer);
|
||||
static void CommonSimulationVAO(GLuint position_vbo, GLuint initialValues_vbo);
|
||||
|
||||
@@ -380,6 +380,8 @@ private:
|
||||
class STKMeshSceneNode *m_sun_interposer;
|
||||
scene::CLensFlareSceneNode *m_lensflare;
|
||||
scene::ICameraSceneNode *m_suncam;
|
||||
core::vector3df m_sundirection;
|
||||
video::SColorf m_suncolor;
|
||||
std::pair<float, float> m_shadow_scales[4];
|
||||
scene::ICameraSceneNode *m_shadow_camnodes[4];
|
||||
float m_shadows_cam[4][24];
|
||||
@@ -619,6 +621,25 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
inline core::vector3df getWind() {return m_wind->getWind();}
|
||||
// -----------------------------------------------------------------------
|
||||
core::vector3df getSunDirection() const { return m_sundirection; };
|
||||
// -----------------------------------------------------------------------
|
||||
void setSunDirection(const core::vector3df &SunPos)
|
||||
{
|
||||
core::matrix4 m_view = getViewMatrix();
|
||||
m_view.makeInverse();
|
||||
m_view = m_view.getTransposed();
|
||||
m_sundirection = SunPos;
|
||||
m_view.transformVect(m_sundirection);
|
||||
m_sundirection.normalize();
|
||||
}
|
||||
// -----------------------------------------------------------------------
|
||||
video::SColorf getSunColor() const { return m_suncolor; }
|
||||
// -----------------------------------------------------------------------
|
||||
void setSunColor(const video::SColorf &col)
|
||||
{
|
||||
m_suncolor = col;
|
||||
}
|
||||
// -----------------------------------------------------------------------
|
||||
inline video::E_MATERIAL_TYPE getShader(const ShaderType num) {return m_shaders->getShader(num);}
|
||||
// -----------------------------------------------------------------------
|
||||
inline void updateShaders() {m_shaders->killShaders();}
|
||||
|
||||
@@ -75,7 +75,6 @@ int LODNode::getLevel()
|
||||
if(m_forced_lod>-1)
|
||||
return m_forced_lod;
|
||||
|
||||
scene::ICameraSceneNode* curr_cam = irr_driver->getSceneManager()->getActiveCamera();
|
||||
Camera* camera = Camera::getActiveCamera();
|
||||
if (camera == NULL)
|
||||
return (int)m_detail.size() - 1;
|
||||
|
||||
@@ -269,32 +269,28 @@ void PostProcessing::renderGI(const core::matrix4 &RHMatrix, const core::vector3
|
||||
DrawFullScreenEffect<FullScreenShader::GlobalIlluminationReconstructionShader>(RHMatrix, InvRHMatrix, rh_extend);
|
||||
}
|
||||
|
||||
void PostProcessing::renderSunlight()
|
||||
void PostProcessing::renderSunlight(const core::vector3df &direction, const video::SColorf &col)
|
||||
{
|
||||
SunLightProvider * const cb = (SunLightProvider *) irr_driver->getCallback(ES_SUNLIGHT);
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
||||
FullScreenShader::SunLightShader::getInstance()->SetTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture());
|
||||
DrawFullScreenEffect<FullScreenShader::SunLightShader>(cb->getPosition(), video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
||||
FullScreenShader::SunLightShader::getInstance()->SetTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture());
|
||||
DrawFullScreenEffect<FullScreenShader::SunLightShader>(direction, col);
|
||||
}
|
||||
|
||||
extern float shadowSplit[5];
|
||||
|
||||
void PostProcessing::renderShadowedSunlight(const std::vector<core::matrix4> &sun_ortho_matrix, GLuint depthtex)
|
||||
void PostProcessing::renderShadowedSunlight(const core::vector3df &direction, const video::SColorf &col, const std::vector<core::matrix4> &sun_ortho_matrix, GLuint depthtex)
|
||||
{
|
||||
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
||||
FullScreenShader::ShadowedSunLightShader::getInstance()->SetTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture(), depthtex);
|
||||
DrawFullScreenEffect<FullScreenShader::ShadowedSunLightShader>(shadowSplit[1], shadowSplit[2], shadowSplit[3], shadowSplit[4], cb->getPosition(), video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
||||
DrawFullScreenEffect<FullScreenShader::ShadowedSunLightShader>(shadowSplit[1], shadowSplit[2], shadowSplit[3], shadowSplit[4], direction, col);
|
||||
}
|
||||
|
||||
|
||||
@@ -412,7 +408,7 @@ void PostProcessing::renderHorizontalBlur(FrameBuffer &in_fbo, FrameBuffer &auxi
|
||||
in_fbo.Bind();
|
||||
|
||||
FullScreenShader::Gaussian6HBlurShader::getInstance()->SetTextureUnits(auxiliary.getRTT()[0]);
|
||||
DrawFullScreenEffect<FullScreenShader::Gaussian6HBlurShader>(core::vector2df(inv_width, inv_height), 2.0);
|
||||
DrawFullScreenEffect<FullScreenShader::Gaussian6HBlurShader>(core::vector2df(inv_width, inv_height), 2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,11 +519,7 @@ void PostProcessing::renderFog()
|
||||
const Track * const track = World::getWorld()->getTrack();
|
||||
|
||||
// This function is only called once per frame - thus no need for setters.
|
||||
const float fogmax = track->getFogMax();
|
||||
const float startH = track->getFogStartHeight();
|
||||
const float endH = track->getFogEndHeight();
|
||||
const float start = track->getFogStart();
|
||||
const float end = track->getFogEnd();
|
||||
const SColor tmpcol = track->getFogColor();
|
||||
|
||||
core::vector3df col( tmpcol.getRed() / 255.0f,
|
||||
|
||||
@@ -76,8 +76,8 @@ public:
|
||||
void update(float dt);
|
||||
|
||||
/** Generate diffuse and specular map */
|
||||
void renderSunlight();
|
||||
void renderShadowedSunlight(const std::vector<core::matrix4> &sun_ortho_matrix, unsigned depthtex);
|
||||
void renderSunlight(const core::vector3df &direction, const video::SColorf &col);
|
||||
void renderShadowedSunlight(const core::vector3df &direction, const video::SColorf &col, const std::vector<core::matrix4> &sun_ortho_matrix, unsigned depthtex);
|
||||
|
||||
void renderFog();
|
||||
void renderSSAO();
|
||||
|
||||
@@ -166,8 +166,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
oss << "drawAll() for kart " << cam;
|
||||
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (cam+1)*60,
|
||||
0x00, 0x00);
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
camera->activate();
|
||||
camera->activate(!UserConfigParams::m_dynamic_lights);
|
||||
rg->preRenderCallback(camera); // adjusts start referee
|
||||
m_scene_manager->setActiveCamera(camnode);
|
||||
|
||||
@@ -420,13 +419,17 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
World::getWorld()->isFogEnabled())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Fog", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_FOG));
|
||||
renderLightsScatter(pointlightcount);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("- Skybox", 0xFF, 0x00, 0xFF);
|
||||
renderSkybox(camnode);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Skybox", 0xFF, 0x00, 0xFF);
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_SKYBOX));
|
||||
renderSkybox(camnode);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
if (getRH())
|
||||
{
|
||||
@@ -444,6 +447,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
// Render anything glowing.
|
||||
if (!m_mipviz && !m_wireframe && UserConfigParams::m_glow)
|
||||
{
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_GLOW));
|
||||
irr_driver->setPhase(GLOW_PASS);
|
||||
renderGlow(glows);
|
||||
} // end glow
|
||||
|
||||
@@ -644,14 +644,13 @@ void IrrDriver::renderSolidSecondPass()
|
||||
|
||||
// template does not work with template due to extra depth texture
|
||||
{
|
||||
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
|
||||
glUseProgram(GrassMat::InstancedSecondPassShader::getInstance()->Program);
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(GrassMat::VertexType, GrassMat::Instance));
|
||||
uint64_t nulltex[10] = {};
|
||||
if (SolidPassCmd::getInstance()->Size[GrassMat::MaterialType])
|
||||
{
|
||||
HandleExpander<GrassMat::InstancedSecondPassShader>::Expand(nulltex, GrassMat::SecondPassTextures, DiffuseHandle, SpecularHandle, SSAOHandle, DepthHandle);
|
||||
GrassMat::InstancedSecondPassShader::getInstance()->setUniforms(windDir, cb->getPosition());
|
||||
GrassMat::InstancedSecondPassShader::getInstance()->setUniforms(windDir, irr_driver->getSunDirection());
|
||||
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
|
||||
(const void*)(SolidPassCmd::getInstance()->Offset[GrassMat::MaterialType] * sizeof(DrawElementsIndirectCommand)),
|
||||
(int)SolidPassCmd::getInstance()->Size[GrassMat::MaterialType],
|
||||
@@ -670,7 +669,6 @@ void IrrDriver::renderSolidSecondPass()
|
||||
|
||||
// template does not work with template due to extra depth texture
|
||||
{
|
||||
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
|
||||
std::vector<GLMesh *> &meshes = GrassMat::InstancedList::getInstance()->SolidPass;
|
||||
glUseProgram(GrassMat::InstancedSecondPassShader::getInstance()->Program);
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(GrassMat::VertexType, GrassMat::Instance));
|
||||
@@ -678,7 +676,7 @@ void IrrDriver::renderSolidSecondPass()
|
||||
{
|
||||
GLMesh *mesh = meshes[i];
|
||||
TexExpander<GrassMat::InstancedSecondPassShader>::ExpandTex(*mesh, GrassMat::SecondPassTextures, DiffSpecSSAOTex[0], DiffSpecSSAOTex[1], DiffSpecSSAOTex[2], irr_driver->getDepthStencilTexture());
|
||||
GrassMat::InstancedSecondPassShader::getInstance()->setUniforms(windDir, cb->getPosition());
|
||||
GrassMat::InstancedSecondPassShader::getInstance()->setUniforms(windDir, irr_driver->getSunDirection());
|
||||
glDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, (const void*)((SolidPassCmd::getInstance()->Offset[GrassMat::MaterialType] + i) * sizeof(DrawElementsIndirectCommand)));
|
||||
}
|
||||
}
|
||||
@@ -694,7 +692,6 @@ static void renderInstancedMeshNormals()
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance));
|
||||
for (unsigned i = 0; i < meshes.size(); i++)
|
||||
{
|
||||
GLMesh *mesh = meshes[i];
|
||||
MeshShader::NormalVisualizer::getInstance()->setUniforms(video::SColor(255, 0, 255, 0));
|
||||
glDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, (const void*)((SolidPassCmd::getInstance()->Offset[T::MaterialType] + i) * sizeof(DrawElementsIndirectCommand)));
|
||||
}
|
||||
|
||||
@@ -115,7 +115,6 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
|
||||
glDisable(GL_BLEND);
|
||||
m_rtts->getRH().Bind();
|
||||
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
|
||||
if (irr_driver->needRHWorkaround())
|
||||
{
|
||||
glUseProgram(FullScreenShader::NVWorkaroundRadianceHintsConstructionShader::getInstance()->Program);
|
||||
@@ -123,7 +122,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
|
||||
m_rtts->getRSM().getRTT()[0], m_rtts->getRSM().getRTT()[1], m_rtts->getRSM().getDepthTexture());
|
||||
for (unsigned i = 0; i < 32; i++)
|
||||
{
|
||||
FullScreenShader::NVWorkaroundRadianceHintsConstructionShader::getInstance()->setUniforms(rsm_matrix, rh_matrix, rh_extend, i, video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
||||
FullScreenShader::NVWorkaroundRadianceHintsConstructionShader::getInstance()->setUniforms(rsm_matrix, rh_matrix, rh_extend, i, irr_driver->getSunColor());
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +134,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
|
||||
m_rtts->getRSM().getRTT()[1],
|
||||
m_rtts->getRSM().getDepthTexture()
|
||||
);
|
||||
FullScreenShader::RadianceHintsConstructionShader::getInstance()->setUniforms(rsm_matrix, rh_matrix, rh_extend, video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
||||
FullScreenShader::RadianceHintsConstructionShader::getInstance()->setUniforms(rsm_matrix, rh_matrix, rh_extend, irr_driver->getSunColor());
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, 32);
|
||||
}
|
||||
}
|
||||
@@ -164,9 +163,9 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_SUN));
|
||||
if (World::getWorld() && UserConfigParams::m_shadows && !irr_driver->needUBOWorkaround() && hasShadow)
|
||||
m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowFBO().getRTT()[0]);
|
||||
m_post_processing->renderShadowedSunlight(irr_driver->getSunDirection(), irr_driver->getSunColor(), sun_ortho_matrix, m_rtts->getShadowFBO().getRTT()[0]);
|
||||
else
|
||||
m_post_processing->renderSunlight();
|
||||
m_post_processing->renderSunlight(irr_driver->getSunDirection(), irr_driver->getSunColor());
|
||||
}
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_POINTLIGHTS));
|
||||
@@ -202,7 +201,6 @@ void IrrDriver::renderLightsScatter(unsigned pointlightcount)
|
||||
const Track * const track = World::getWorld()->getTrack();
|
||||
|
||||
const float start = track->getFogStart();
|
||||
const video::SColor tmpcol = track->getFogColor();
|
||||
core::vector3df col(1., 1., 1.);
|
||||
|
||||
glUseProgram(LightShader::PointLightScatterShader::getInstance()->Program);
|
||||
@@ -221,6 +219,7 @@ void IrrDriver::renderLightsScatter(unsigned pointlightcount)
|
||||
glEnable(GL_BLEND);
|
||||
// ***
|
||||
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
getFBO(FBO_COLORS).Bind();
|
||||
m_post_processing->renderPassThrough(getRenderTargetTexture(RTT_HALF1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,6 @@ Shaders::Shaders()
|
||||
m_callbacks[ES_GRASS] = new GrassShaderProvider();
|
||||
m_callbacks[ES_MOTIONBLUR] = new MotionBlurProvider();
|
||||
m_callbacks[ES_MIPVIZ] = new MipVizProvider();
|
||||
m_callbacks[ES_SUNLIGHT] = new SunLightProvider();
|
||||
m_callbacks[ES_DISPLACE] = new DisplaceProvider();
|
||||
|
||||
for (s32 i = 0; i < ES_COUNT; i++)
|
||||
@@ -492,22 +491,14 @@ void Shaders::loadShaders()
|
||||
m_shaders[ES_MIPVIZ] = glslmat(dir + "pass.vert", dir + "pass.frag",
|
||||
m_callbacks[ES_MIPVIZ], EMT_SOLID);
|
||||
|
||||
m_shaders[ES_COLORIZE] = glslmat(dir + "pass.vert", dir + "pass.frag",
|
||||
m_callbacks[ES_COLORIZE], EMT_SOLID);
|
||||
|
||||
m_shaders[ES_OBJECTPASS] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
|
||||
m_shaders[ES_OBJECT_UNLIT] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
|
||||
m_shaders[ES_OBJECTPASS_REF] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
|
||||
m_shaders[ES_OBJECTPASS_RIMLIT] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
|
||||
|
||||
m_shaders[ES_SUNLIGHT] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
|
||||
|
||||
m_shaders[ES_DISPLACE] = glslmat(dir + "pass.vert", dir + "pass.frag",
|
||||
m_callbacks[ES_DISPLACE], EMT_TRANSPARENT_ALPHA_CHANNEL);
|
||||
|
||||
m_shaders[ES_PASSFAR] = glsl(dir + "pass.vert", dir + "pass.frag",
|
||||
m_callbacks[ES_COLORIZE]);
|
||||
|
||||
// Check that all successfully loaded
|
||||
for (s32 i = 0; i < ES_COUNT; i++) {
|
||||
|
||||
|
||||
@@ -690,14 +690,11 @@ public:
|
||||
ACT(ES_GAUSSIAN3H) \
|
||||
ACT(ES_GAUSSIAN3V) \
|
||||
ACT(ES_MIPVIZ) \
|
||||
ACT(ES_COLORIZE) \
|
||||
ACT(ES_OBJECT_UNLIT) \
|
||||
ACT(ES_OBJECTPASS) \
|
||||
ACT(ES_OBJECTPASS_REF) \
|
||||
ACT(ES_SUNLIGHT) \
|
||||
ACT(ES_OBJECTPASS_RIMLIT) \
|
||||
ACT(ES_DISPLACE) \
|
||||
ACT(ES_PASSFAR) \
|
||||
|
||||
#define ENUM(a) a,
|
||||
#define STR(a) #a,
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
#include "graphics/slip_stream.hpp"
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/material.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
@@ -100,7 +101,13 @@ SlipStream::SlipStream(AbstractKart* kart) : MovingTexture(0, 0), m_kart(kart)
|
||||
{
|
||||
vertices[i].Pos = p[i].toIrrVector();
|
||||
vertices[i].Color = red;
|
||||
vertices[i].TCoords = core::vector2df(0, 0);
|
||||
}
|
||||
video::SMaterial &mat = buffer->getMaterial();
|
||||
// Meshes need a texture, otherwise stk crashes.
|
||||
video::ITexture *red_texture = getUnicolorTexture(red);
|
||||
mat.setTexture(0, red_texture);
|
||||
|
||||
buffer->recalculateBoundingBox();
|
||||
m_mesh->setBoundingBox(buffer->getBoundingBox());
|
||||
m_debug_node = irr_driver->addMesh(m_debug_mesh, "splistream_debug", m_kart->getNode());
|
||||
@@ -340,6 +347,8 @@ void SlipStream::updateSlipstreamPower()
|
||||
void SlipStream::setDebugColor(const video::SColor &color)
|
||||
{
|
||||
if(!UserConfigParams::m_slipstream_debug) return;
|
||||
// FIXME: Does not work anymore - the colour is changed, but
|
||||
// visually there is no change.
|
||||
scene::IMeshBuffer *buffer = m_debug_mesh->getMeshBuffer(0);
|
||||
irr::video::S3DVertex* vertices =
|
||||
(video::S3DVertex*)buffer->getVertices();
|
||||
|
||||
@@ -208,9 +208,6 @@ void STKAnimatedMesh::updateGL()
|
||||
|
||||
void STKAnimatedMesh::render()
|
||||
{
|
||||
bool isTransparentPass =
|
||||
SceneManager->getSceneNodeRenderPass() == scene::ESNRP_TRANSPARENT;
|
||||
|
||||
++PassCount;
|
||||
|
||||
updateNoGL();
|
||||
|
||||
@@ -49,11 +49,10 @@ SunNode::~SunNode()
|
||||
|
||||
void SunNode::render()
|
||||
{
|
||||
SunLightProvider * const cb = (SunLightProvider *) irr_driver->getCallback(ES_SUNLIGHT);
|
||||
cb->setColor(m_color[0], m_color[1], m_color[2]);
|
||||
irr_driver->setSunColor(video::SColorf(m_color[0], m_color[1], m_color[2]));
|
||||
|
||||
vector3df pos = getPosition();
|
||||
cb->setPosition(pos.X, pos.Y, pos.Z);
|
||||
irr_driver->setSunDirection(pos);
|
||||
return;
|
||||
|
||||
/* array<IRenderTarget> mrt;
|
||||
|
||||
@@ -205,6 +205,7 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = core::stringc(prop_name).
|
||||
READ_PROPERTY(y, PROP_Y);
|
||||
READ_PROPERTY(layout, PROP_LAYOUT);
|
||||
READ_PROPERTY(align, PROP_ALIGN);
|
||||
READ_PROPERTY(custom_ratio, PROP_CUSTOM_RATIO);
|
||||
|
||||
READ_PROPERTY(icon, PROP_ICON);
|
||||
READ_PROPERTY(focus_icon, PROP_FOCUS_ICON);
|
||||
|
||||
@@ -109,6 +109,7 @@ namespace GUIEngine
|
||||
PROP_WRAP_AROUND,
|
||||
PROP_DIV_PADDING,
|
||||
PROP_KEEP_SELECTION,
|
||||
PROP_CUSTOM_RATIO,
|
||||
};
|
||||
|
||||
bool isWithinATextBox();
|
||||
|
||||
@@ -44,6 +44,7 @@ IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop,
|
||||
m_texture = NULL;
|
||||
m_deactivated_texture = NULL;
|
||||
m_highlight_texture = NULL;
|
||||
|
||||
m_custom_aspect_ratio = 1.0f;
|
||||
|
||||
m_texture_w = 0;
|
||||
@@ -103,6 +104,12 @@ void IconButtonWidget::add()
|
||||
// irrlicht widgets don't support scaling while keeping aspect ratio
|
||||
// so, happily, let's implement it ourselves
|
||||
float useAspectRatio = -1.0f;
|
||||
|
||||
if (m_properties[PROP_CUSTOM_RATIO] != "")
|
||||
{
|
||||
m_custom_aspect_ratio = atof(m_properties[PROP_CUSTOM_RATIO].c_str());
|
||||
m_scale_mode = SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO;
|
||||
}
|
||||
|
||||
if (m_scale_mode == SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO)
|
||||
{
|
||||
|
||||
@@ -214,7 +214,8 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
UserConfigParams::m_camera_debug != 3) break;
|
||||
|
||||
Camera *active_cam = Camera::getActiveCamera();
|
||||
active_cam->setAngularVelocity(value ? 1 : 0);
|
||||
active_cam->setAngularVelocity(value ?
|
||||
UserConfigParams::m_fspcam_max_angular_velocity : 0.0f);
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_E:
|
||||
@@ -223,7 +224,8 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
UserConfigParams::m_camera_debug != 3) break;
|
||||
|
||||
Camera *active_cam = Camera::getActiveCamera();
|
||||
active_cam->setAngularVelocity(value ? -1 : 0);
|
||||
active_cam->setAngularVelocity(value ?
|
||||
-UserConfigParams::m_fspcam_max_angular_velocity : 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -965,12 +967,13 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
core::vector2df screen_size = irr_driver->getCurrentScreenSize();
|
||||
int mid_x = (int) screen_size.X / 2;
|
||||
int mid_y = (int) screen_size.Y / 2;
|
||||
//const int wheel = event.MouseInput.Wheel;
|
||||
// Relative mouse movement
|
||||
int diff_x = event.MouseInput.X - m_mouse_val_x;
|
||||
int diff_y = event.MouseInput.Y - m_mouse_val_y;
|
||||
float mouse_x = ((float) diff_x) / 150;
|
||||
float mouse_y = ((float) diff_y) / -150;
|
||||
float mouse_x = ((float) diff_x) *
|
||||
UserConfigParams::m_fspcam_direction_speed;
|
||||
float mouse_y = ((float) diff_y) *
|
||||
-UserConfigParams::m_fspcam_direction_speed;
|
||||
// No movement the first time it's used
|
||||
// At the moment there's also a hard limit because the mouse
|
||||
// gets reset to the middle of the screen and sometimes there
|
||||
|
||||
@@ -164,7 +164,7 @@ void WiimoteManager::launchDetection(int timeout)
|
||||
|
||||
device_manager->getConfigForGamepad(WIIMOTE_START_IRR_ID, "Wiimote",
|
||||
&gamepad_config);
|
||||
int num_buttons = (int)( log((float)WIIMOTE_BUTTON_ALL) / log(2.0f))+1;
|
||||
int num_buttons = (int)( log((float)WIIMOTE_BUTTON_ALL) / log((float)2.0f))+1;
|
||||
gamepad_config->setNumberOfButtons(num_buttons);
|
||||
gamepad_config->setNumberOfAxis(1);
|
||||
|
||||
@@ -213,7 +213,7 @@ void WiimoteManager::launchDetection(int timeout)
|
||||
*/
|
||||
int getButton(int n)
|
||||
{
|
||||
return (int)(log((float)n)/log(2.0f));
|
||||
return (int)(log((float)n)/log((float)2.0f));
|
||||
} // getButton
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -1284,7 +1284,12 @@ bool FileManager::copyFile(const std::string &source, const std::string &dest)
|
||||
|
||||
const int BUFFER_SIZE=32768;
|
||||
char *buffer = new char[BUFFER_SIZE];
|
||||
if(!buffer) return false;
|
||||
if(!buffer)
|
||||
{
|
||||
fclose(f_source);
|
||||
fclose(f_dest);
|
||||
return false;
|
||||
}
|
||||
size_t n;
|
||||
while((n=fread(buffer, 1, BUFFER_SIZE, f_source))>0)
|
||||
{
|
||||
|
||||
@@ -253,7 +253,7 @@ void History::Load()
|
||||
Log::fatal("History", "Could not read history.dat.");
|
||||
|
||||
unsigned int num_karts;
|
||||
if(sscanf(s, "numkarts: %d",&num_karts)!=1)
|
||||
if(sscanf(s, "numkarts: %u", &num_karts)!=1)
|
||||
Log::fatal("History", "No number of karts found in history file.");
|
||||
race_manager->setNumKarts(num_karts);
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ void ReplayPlay::Load()
|
||||
Log::fatal("Replay", "Could not read '%s'.", getReplayFilename().c_str());
|
||||
|
||||
unsigned int version;
|
||||
if (sscanf(s,"Version: %d", &version) != 1)
|
||||
if (sscanf(s,"Version: %u", &version) != 1)
|
||||
Log::fatal("Replay", "No Version information found in replay file (bogus replay file).");
|
||||
|
||||
if (version != getReplayVersion())
|
||||
@@ -130,7 +130,7 @@ void ReplayPlay::Load()
|
||||
|
||||
unsigned int num_laps;
|
||||
fgets(s, 1023, fd);
|
||||
if(sscanf(s, "Laps: %d", &num_laps) != 1)
|
||||
if(sscanf(s, "Laps: %u", &num_laps) != 1)
|
||||
Log::fatal("Replay", "No number of laps found in replay file.");
|
||||
|
||||
race_manager->setNumLaps(num_laps);
|
||||
@@ -164,7 +164,7 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line)
|
||||
|
||||
fgets(s, 1023, fd);
|
||||
unsigned int size;
|
||||
if(sscanf(s,"size: %d",&size)!=1)
|
||||
if(sscanf(s,"size: %u",&size)!=1)
|
||||
Log::fatal("Replay", "Number of records not found in replay file "
|
||||
"for kart %d.",
|
||||
m_ghost_karts.size()-1);
|
||||
@@ -198,7 +198,7 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line)
|
||||
} // for i
|
||||
fgets(s, 1023, fd);
|
||||
unsigned int num_events;
|
||||
if(sscanf(s,"events: %d",&num_events)!=1)
|
||||
if(sscanf(s,"events: %u",&num_events)!=1)
|
||||
Log::warn("Replay", "Number of events not found in replay file "
|
||||
"for kart %d.", m_ghost_karts.size()-1);
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ GPInfoScreen::GPInfoScreen() : Screen("gp_info.stkgui")
|
||||
m_curr_time = 0.0f;
|
||||
// Necessary to test if loadedFroMFile() was executed (in setGP)
|
||||
m_reverse_spinner = NULL;
|
||||
m_screenshot_widget = NULL;
|
||||
m_max_num_tracks = 0;
|
||||
} // GPInfoScreen
|
||||
|
||||
@@ -84,6 +83,10 @@ void GPInfoScreen::loadedFromFile()
|
||||
m_num_tracks_spinner->setValue(1);
|
||||
|
||||
m_ai_kart_spinner = getWidget<SpinnerWidget>("ai-spinner");
|
||||
|
||||
GUIEngine::IconButtonWidget* screenshot = getWidget<IconButtonWidget>("screenshot");
|
||||
screenshot->setFocusable(false);
|
||||
screenshot->m_tab_stop = false;
|
||||
} // loadedFromFile
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -266,34 +269,18 @@ void GPInfoScreen::addTracks()
|
||||
*/
|
||||
void GPInfoScreen::addScreenshot()
|
||||
{
|
||||
Widget* screenshot_div = getWidget("screenshot_div");
|
||||
|
||||
if(!m_screenshot_widget || !m_widgets.contains(m_screenshot_widget))
|
||||
{
|
||||
m_screenshot_widget = new IconButtonWidget(
|
||||
IconButtonWidget::SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO,
|
||||
false, false, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
m_widgets.push_back(m_screenshot_widget);
|
||||
}
|
||||
// images are saved squared, but must be stretched to 4:3
|
||||
m_screenshot_widget->setCustomAspectRatio(4.0f / 3.0f);
|
||||
m_screenshot_widget->m_x = screenshot_div->m_x;
|
||||
m_screenshot_widget->m_y = screenshot_div->m_y;
|
||||
m_screenshot_widget->m_w = screenshot_div->m_w;
|
||||
m_screenshot_widget->m_h = screenshot_div->m_h;
|
||||
|
||||
GUIEngine::IconButtonWidget* screenshot = getWidget<IconButtonWidget>("screenshot");
|
||||
|
||||
// Temporary icon, will replace it just after
|
||||
// (but it will be shown if the given icon is not found)
|
||||
m_screenshot_widget->m_properties[PROP_ICON] = "gui/main_help.png";
|
||||
m_screenshot_widget->add();
|
||||
screenshot->m_properties[PROP_ICON] = "gui/main_help.png";
|
||||
|
||||
const Track *track = track_manager->getTrack(m_gp.getTrackId(0));
|
||||
video::ITexture* screenshot = irr_driver->getTexture(track->getScreenshotFile(),
|
||||
video::ITexture* image = irr_driver->getTexture(track->getScreenshotFile(),
|
||||
"While loading screenshot for track '%s':",
|
||||
track->getFilename() );
|
||||
if (screenshot != NULL)
|
||||
m_screenshot_widget->setImage(screenshot);
|
||||
if (image != NULL)
|
||||
screenshot->setImage(image);
|
||||
} // addScreenShot
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -378,8 +365,9 @@ void GPInfoScreen::onUpdate(float dt)
|
||||
|
||||
Track* track = track_manager->getTrack(tracks[frame_after]);
|
||||
std::string file = track->getScreenshotFile();
|
||||
m_screenshot_widget->setImage(file, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
m_screenshot_widget->m_properties[PROP_ICON] = file;
|
||||
GUIEngine::IconButtonWidget* screenshot = getWidget<IconButtonWidget>("screenshot");
|
||||
screenshot->setImage(file, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
screenshot->m_properties[PROP_ICON] = file;
|
||||
} // onUpdate
|
||||
|
||||
/** Get number of available tracks for random GPs
|
||||
|
||||
@@ -61,7 +61,6 @@ private:
|
||||
int getMaxNumTracks(std::string group);
|
||||
|
||||
protected: // Necessary for RandomGPInfoScreen
|
||||
GUIEngine::IconButtonWidget* m_screenshot_widget;
|
||||
float m_curr_time;
|
||||
|
||||
/** The grand prix data. */
|
||||
|
||||
@@ -108,25 +108,25 @@ void FocusDispatcher::add()
|
||||
m_element->setTabOrder(m_id);
|
||||
}
|
||||
|
||||
EventPropagation FocusDispatcher::focused(const int playerID)
|
||||
EventPropagation FocusDispatcher::focused(const int player_id)
|
||||
{
|
||||
if (!m_is_initialised) return EVENT_LET;
|
||||
|
||||
if(UserConfigParams::logGUI())
|
||||
Log::info("[KartSelectionScreen]", "FocusDispatcher focused by player %u",
|
||||
playerID);
|
||||
player_id);
|
||||
|
||||
// since this screen is multiplayer, redirect focus to the right widget
|
||||
const int amount = m_parent->m_kart_widgets.size();
|
||||
for (int n=0; n<amount; n++)
|
||||
{
|
||||
if (m_parent->m_kart_widgets[n].getPlayerID() == playerID)
|
||||
if (m_parent->m_kart_widgets[n].getPlayerID() == player_id)
|
||||
{
|
||||
// If player is done, don't do anything with focus
|
||||
if (m_parent->m_kart_widgets[n].isReady())
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
|
||||
//std::cout << "--> Redirecting focus for player " << playerID
|
||||
//std::cout << "--> Redirecting focus for player " << player_id
|
||||
// << " from FocusDispatcher " <<
|
||||
// " (ID " << m_element->getID() <<
|
||||
// ") to spinner " << n << " (ID " <<
|
||||
@@ -135,7 +135,7 @@ EventPropagation FocusDispatcher::focused(const int playerID)
|
||||
// ")" << std::endl;
|
||||
|
||||
m_parent->m_kart_widgets[n].m_player_ident_spinner
|
||||
->setFocusForPlayer(playerID);
|
||||
->setFocusForPlayer(player_id);
|
||||
|
||||
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
@@ -143,7 +143,7 @@ EventPropagation FocusDispatcher::focused(const int playerID)
|
||||
}
|
||||
|
||||
//Log::fatal("KartSelectionScreen", "The focus dispatcher can't"
|
||||
// "find the widget for player %d!", playerID);
|
||||
// "find the widget for player %d!", player_id);
|
||||
return GUIEngine::EVENT_LET;
|
||||
} // focused
|
||||
|
||||
@@ -172,39 +172,39 @@ KartHoverListener::~KartHoverListener()
|
||||
void KartHoverListener::onSelectionChanged(DynamicRibbonWidget* theWidget,
|
||||
const std::string& selectionID,
|
||||
const irr::core::stringw& selectionText,
|
||||
const int playerID)
|
||||
const int player_id)
|
||||
{
|
||||
assert(m_magic_number == 0xCAFEC001);
|
||||
|
||||
// Check if this player has a kart
|
||||
if (m_parent->m_kart_widgets.size() <= playerID)
|
||||
if (m_parent->m_kart_widgets.size() <= unsigned(player_id))
|
||||
{
|
||||
GUIEngine::focusNothingForPlayer(playerID);
|
||||
GUIEngine::focusNothingForPlayer(player_id);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow changing the selection after confirming it
|
||||
if (m_parent->m_kart_widgets[playerID].isReady())
|
||||
if (m_parent->m_kart_widgets[player_id].isReady())
|
||||
{
|
||||
// discard events sent when putting back to the right kart
|
||||
if (selectionID ==
|
||||
m_parent->m_kart_widgets[playerID].m_kartInternalName) return;
|
||||
m_parent->m_kart_widgets[player_id].m_kartInternalName) return;
|
||||
|
||||
DynamicRibbonWidget* w =
|
||||
m_parent->getWidget<DynamicRibbonWidget>("karts");
|
||||
assert(w != NULL);
|
||||
|
||||
w->setSelection(m_parent->m_kart_widgets[playerID]
|
||||
.m_kartInternalName, playerID, true);
|
||||
w->setSelection(m_parent->m_kart_widgets[player_id]
|
||||
.m_kartInternalName, player_id, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_parent->m_kart_widgets[playerID].getKartInternalName() == selectionID)
|
||||
if (m_parent->m_kart_widgets[player_id].getKartInternalName() == selectionID)
|
||||
return; // already selected
|
||||
|
||||
m_parent->updateKartWidgetModel(playerID, selectionID, selectionText);
|
||||
m_parent->m_kart_widgets[playerID].setKartInternalName(selectionID);
|
||||
m_parent->updateKartStats(playerID, selectionID);
|
||||
m_parent->updateKartWidgetModel(player_id, selectionID, selectionText);
|
||||
m_parent->m_kart_widgets[player_id].setKartInternalName(selectionID);
|
||||
m_parent->updateKartStats(player_id, selectionID);
|
||||
m_parent->validateKartChoices();
|
||||
} // onSelectionChanged
|
||||
|
||||
@@ -558,7 +558,7 @@ bool KartSelectionScreen::joinPlayer(InputDevice* device)
|
||||
|
||||
bool KartSelectionScreen::playerQuit(StateManager::ActivePlayer* player)
|
||||
{
|
||||
int playerID = -1;
|
||||
int player_id = -1;
|
||||
|
||||
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
|
||||
if (w == NULL)
|
||||
@@ -592,7 +592,7 @@ bool KartSelectionScreen::playerQuit(StateManager::ActivePlayer* player)
|
||||
return true;
|
||||
}
|
||||
|
||||
playerID = n;
|
||||
player_id = n;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -600,21 +600,21 @@ bool KartSelectionScreen::playerQuit(StateManager::ActivePlayer* player)
|
||||
m_kart_widgets[n].getKartInternalName();
|
||||
}
|
||||
}
|
||||
if (playerID == -1)
|
||||
if (player_id == -1)
|
||||
{
|
||||
Log::warn("KartSelectionScreen", "playerQuit cannot find "
|
||||
"passed player");
|
||||
return false;
|
||||
}
|
||||
if(UserConfigParams::logGUI())
|
||||
Log::info("KartSelectionScreen", "playerQuit(%d)", playerID);
|
||||
Log::info("KartSelectionScreen", "playerQuit(%d)", player_id);
|
||||
|
||||
// Just a cheap way to check if there is any discrepancy
|
||||
// between m_kart_widgets and the active player array
|
||||
assert( m_kart_widgets.size() == StateManager::get()->activePlayerCount());
|
||||
|
||||
// unset selection of this player
|
||||
GUIEngine::focusNothingForPlayer(playerID);
|
||||
GUIEngine::focusNothingForPlayer(player_id);
|
||||
|
||||
// delete a previous removed widget that didn't have time to fully shrink
|
||||
// yet.
|
||||
@@ -628,10 +628,10 @@ bool KartSelectionScreen::playerQuit(StateManager::ActivePlayer* player)
|
||||
|
||||
// keep the removed kart a while, for the 'disappear' animation
|
||||
// to take place
|
||||
m_removed_widget = m_kart_widgets.remove(playerID);
|
||||
m_removed_widget = m_kart_widgets.remove(player_id);
|
||||
|
||||
// Tell the StateManager to remove this player
|
||||
StateManager::get()->removeActivePlayer(playerID);
|
||||
StateManager::get()->removeActivePlayer(player_id);
|
||||
|
||||
addMultiplayerMessage();
|
||||
|
||||
@@ -710,23 +710,23 @@ void KartSelectionScreen::onUpdate(float delta)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void KartSelectionScreen::playerConfirm(const int playerID)
|
||||
void KartSelectionScreen::playerConfirm(const int player_id)
|
||||
{
|
||||
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
|
||||
assert(w != NULL);
|
||||
const std::string selection = w->getSelectionIDString(playerID);
|
||||
const std::string selection = w->getSelectionIDString(player_id);
|
||||
if (StringUtils::startsWith(selection, ID_LOCKED))
|
||||
{
|
||||
unlock_manager->playLockSound();
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerID == PLAYER_ID_GAME_MASTER)
|
||||
if (player_id == PLAYER_ID_GAME_MASTER)
|
||||
{
|
||||
UserConfigParams::m_default_kart = selection;
|
||||
}
|
||||
|
||||
if (m_kart_widgets[playerID].getKartInternalName().size() == 0)
|
||||
if (m_kart_widgets[player_id].getKartInternalName().size() == 0)
|
||||
{
|
||||
SFXManager::get()->quickSound( "anvil" );
|
||||
return;
|
||||
@@ -742,16 +742,16 @@ void KartSelectionScreen::playerConfirm(const int playerID)
|
||||
// make sure no other player selected the same identity or kart
|
||||
for (int n=0; n<amount; n++)
|
||||
{
|
||||
if (n == playerID) continue; // don't check a kart against itself
|
||||
if (n == player_id) continue; // don't check a kart against itself
|
||||
|
||||
const bool player_ready = m_kart_widgets[n].isReady();
|
||||
const bool ident_conflict =
|
||||
!m_kart_widgets[n].getAssociatedPlayer()->getProfile()
|
||||
->isGuestAccount() &&
|
||||
m_kart_widgets[n].getAssociatedPlayer()->getProfile() ==
|
||||
m_kart_widgets[playerID].getAssociatedPlayer()->getProfile();
|
||||
m_kart_widgets[player_id].getAssociatedPlayer()->getProfile();
|
||||
const bool kart_conflict = sameKart(m_kart_widgets[n],
|
||||
m_kart_widgets[playerID]);
|
||||
m_kart_widgets[player_id]);
|
||||
|
||||
if (player_ready && (ident_conflict || kart_conflict) &&
|
||||
!will_need_duplicates)
|
||||
@@ -767,13 +767,13 @@ void KartSelectionScreen::playerConfirm(const int playerID)
|
||||
// If two PlayerKart entries are associated to the same ActivePlayer,
|
||||
// something went wrong
|
||||
assert(m_kart_widgets[n].getAssociatedPlayer() !=
|
||||
m_kart_widgets[playerID].getAssociatedPlayer());
|
||||
m_kart_widgets[player_id].getAssociatedPlayer());
|
||||
}
|
||||
|
||||
// Mark this player as ready to start
|
||||
m_kart_widgets[playerID].markAsReady();
|
||||
m_kart_widgets[player_id].markAsReady();
|
||||
|
||||
if (playerID == PLAYER_ID_GAME_MASTER)
|
||||
if (player_id == PLAYER_ID_GAME_MASTER)
|
||||
{
|
||||
m_game_master_confirmed = true;
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups");
|
||||
@@ -963,7 +963,7 @@ void KartSelectionScreen::removeMultiplayerMessage()
|
||||
*/
|
||||
void KartSelectionScreen::eventCallback(Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID)
|
||||
const int player_id)
|
||||
{
|
||||
// don't allow changing group after someone confirmed
|
||||
if (name == "kartgroups" && !m_game_master_confirmed)
|
||||
@@ -1036,8 +1036,8 @@ void KartSelectionScreen::eventCallback(Widget* widget,
|
||||
}
|
||||
else if (name == "karts")
|
||||
{
|
||||
if (m_kart_widgets.size() > playerID)
|
||||
playerConfirm(playerID);
|
||||
if (m_kart_widgets.size() > unsigned(player_id))
|
||||
playerConfirm(player_id);
|
||||
}
|
||||
else if (name == "back")
|
||||
{
|
||||
@@ -1049,7 +1049,7 @@ void KartSelectionScreen::eventCallback(Widget* widget,
|
||||
const int amount = m_kart_widgets.size();
|
||||
for (int n=0; n<amount; n++)
|
||||
{
|
||||
m_kart_widgets[n].transmitEvent(widget, name, playerID);
|
||||
m_kart_widgets[n].transmitEvent(widget, name, player_id);
|
||||
}
|
||||
|
||||
// those events may mean that a player selection changed, so
|
||||
|
||||
@@ -89,6 +89,8 @@ void MainMenuScreen::loadedFromFile()
|
||||
rw->removeChildNamed("test_gplose");
|
||||
rw->removeChildNamed("test_unlocked");
|
||||
rw->removeChildNamed("test_unlocked2");
|
||||
rw->removeChildNamed("test_intro");
|
||||
rw->removeChildNamed("test_outro");
|
||||
#endif
|
||||
} // loadedFromFile
|
||||
|
||||
@@ -346,6 +348,37 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
scene->push();
|
||||
}
|
||||
}
|
||||
else if (selection == "test_intro")
|
||||
{
|
||||
CutsceneWorld::setUseDuration(true);
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("introcutscene", 999, false);
|
||||
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("introcutscene");
|
||||
parts.push_back("introcutscene2");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
//race_manager->startSingleRace("introcutscene2", 999, false);
|
||||
return;
|
||||
}
|
||||
else if (selection == "test_outro")
|
||||
{
|
||||
CutsceneWorld::setUseDuration(true);
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("endcutscene", 999, false);
|
||||
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("endcutscene");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (selection == "new")
|
||||
@@ -463,7 +496,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
// For 0.8.2 disable the server menu, instead go to online profile
|
||||
//OnlineScreen::getInstance()->push();
|
||||
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
||||
OnlineProfileAchievements::getInstance()->push();
|
||||
TabOnlineProfileAchievements::getInstance()->push();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -489,6 +522,10 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
{
|
||||
GrandPrixEditorScreen::getInstance()->push();
|
||||
}
|
||||
else if (selection == "achievements")
|
||||
{
|
||||
OnlineProfileAchievements::getInstance()->push();
|
||||
}
|
||||
} // eventCallback
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -40,21 +40,22 @@ using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace Online;
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( OnlineProfileAchievements );
|
||||
DEFINE_SCREEN_SINGLETON( OnlineProfileAchievements );
|
||||
DEFINE_SCREEN_SINGLETON( TabOnlineProfileAchievements );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Constructor.
|
||||
*/
|
||||
OnlineProfileAchievements::OnlineProfileAchievements()
|
||||
: OnlineProfileBase("online/profile_achievements.stkgui")
|
||||
BaseOnlineProfileAchievements::BaseOnlineProfileAchievements(const std::string &name)
|
||||
: OnlineProfileBase(name)
|
||||
{
|
||||
m_selected_achievement_index = -1;
|
||||
} // OnlineProfileAchievements
|
||||
} // BaseOnlineProfileAchievements
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Callback when the xml file was loaded.
|
||||
*/
|
||||
void OnlineProfileAchievements::loadedFromFile()
|
||||
void BaseOnlineProfileAchievements::loadedFromFile()
|
||||
{
|
||||
OnlineProfileBase::loadedFromFile();
|
||||
m_achievements_list_widget = getWidget<ListWidget>("achievements_list");
|
||||
@@ -65,7 +66,7 @@ void OnlineProfileAchievements::loadedFromFile()
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Callback before widgets are added. Clears all widgets.
|
||||
*/
|
||||
void OnlineProfileAchievements::beforeAddingWidget()
|
||||
void BaseOnlineProfileAchievements::beforeAddingWidget()
|
||||
{
|
||||
OnlineProfileBase::beforeAddingWidget();
|
||||
m_achievements_list_widget->clearColumns();
|
||||
@@ -82,11 +83,12 @@ void OnlineProfileAchievements::beforeAddingWidget()
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Called when entering this menu (after widgets have been added).
|
||||
*/
|
||||
void OnlineProfileAchievements::init()
|
||||
void BaseOnlineProfileAchievements::init()
|
||||
{
|
||||
OnlineProfileBase::init();
|
||||
m_profile_tabs->select( m_achievements_tab->m_properties[PROP_ID],
|
||||
PLAYER_ID_GAME_MASTER );
|
||||
if (m_profile_tabs)
|
||||
m_profile_tabs->select(m_achievements_tab->m_properties[PROP_ID],
|
||||
PLAYER_ID_GAME_MASTER);
|
||||
|
||||
// For current user add the progrss information.
|
||||
// m_visiting_profile is NULL if the user is not logged in.
|
||||
@@ -129,7 +131,7 @@ void OnlineProfileAchievements::init()
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OnlineProfileAchievements::eventCallback(Widget* widget,
|
||||
void BaseOnlineProfileAchievements::eventCallback(Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID)
|
||||
{
|
||||
@@ -155,7 +157,7 @@ void OnlineProfileAchievements::eventCallback(Widget* widget,
|
||||
/** Called every frame. It will check if results from an achievement request
|
||||
* have been received, and if so, display them.
|
||||
*/
|
||||
void OnlineProfileAchievements::onUpdate(float delta)
|
||||
void BaseOnlineProfileAchievements::onUpdate(float delta)
|
||||
{
|
||||
if (!m_waiting_for_achievements) return;
|
||||
|
||||
|
||||
@@ -35,18 +35,20 @@ namespace GUIEngine { class Widget; }
|
||||
* \brief Online profiel overview screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class OnlineProfileAchievements : public OnlineProfileBase, public GUIEngine::ScreenSingleton<OnlineProfileAchievements>
|
||||
class BaseOnlineProfileAchievements : public OnlineProfileBase
|
||||
{
|
||||
private:
|
||||
OnlineProfileAchievements();
|
||||
|
||||
GUIEngine::ListWidget * m_achievements_list_widget;
|
||||
|
||||
int m_selected_achievement_index;
|
||||
bool m_waiting_for_achievements;
|
||||
|
||||
protected:
|
||||
BaseOnlineProfileAchievements(const std::string &filename);
|
||||
|
||||
public:
|
||||
friend class GUIEngine::ScreenSingleton<OnlineProfileAchievements>;
|
||||
friend class GUIEngine::ScreenSingleton<BaseOnlineProfileAchievements>;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
@@ -61,7 +63,46 @@ public:
|
||||
|
||||
virtual void beforeAddingWidget() OVERRIDE;
|
||||
|
||||
virtual void refreshAchievementsList() { m_waiting_for_achievements = true; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void refreshAchievementsList()
|
||||
{
|
||||
m_waiting_for_achievements = true;
|
||||
} // refreshAchievementsList
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
/**
|
||||
* \brief Online profiel overview screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class TabOnlineProfileAchievements : public BaseOnlineProfileAchievements,
|
||||
public GUIEngine::ScreenSingleton<TabOnlineProfileAchievements>
|
||||
{
|
||||
protected:
|
||||
friend class GUIEngine::ScreenSingleton<TabOnlineProfileAchievements>;
|
||||
|
||||
TabOnlineProfileAchievements()
|
||||
: BaseOnlineProfileAchievements("online/profile_achievements_tab.stkgui")
|
||||
{}
|
||||
|
||||
}; // TabOnlineProfileAchievements
|
||||
|
||||
// ============================================================================
|
||||
/**
|
||||
* \brief Online profiel overview screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class OnlineProfileAchievements : public BaseOnlineProfileAchievements,
|
||||
public GUIEngine::ScreenSingleton < OnlineProfileAchievements >
|
||||
{
|
||||
protected:
|
||||
friend class GUIEngine::ScreenSingleton<OnlineProfileAchievements>;
|
||||
|
||||
OnlineProfileAchievements()
|
||||
: BaseOnlineProfileAchievements("online/profile_achievements.stkgui")
|
||||
{}
|
||||
|
||||
}; // class
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,8 @@ using namespace irr::gui;
|
||||
using namespace Online;
|
||||
|
||||
|
||||
OnlineProfileBase::OnlineProfileBase(const char* filename) : Screen(filename)
|
||||
OnlineProfileBase::OnlineProfileBase(const std::string &filename)
|
||||
: Screen(filename.c_str())
|
||||
{
|
||||
} // OnlineProfileBase
|
||||
|
||||
@@ -48,19 +49,19 @@ OnlineProfileBase::OnlineProfileBase(const char* filename) : Screen(filename)
|
||||
void OnlineProfileBase::loadedFromFile()
|
||||
{
|
||||
m_profile_tabs = getWidget<RibbonWidget>("profile_tabs");
|
||||
assert(m_profile_tabs != NULL);
|
||||
|
||||
m_header = getWidget<LabelWidget>("title");
|
||||
assert(m_header != NULL);
|
||||
|
||||
m_friends_tab =
|
||||
m_friends_tab = !m_profile_tabs ? NULL :
|
||||
(IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_friends");
|
||||
assert(m_friends_tab != NULL);
|
||||
m_achievements_tab =
|
||||
assert(m_profile_tabs == NULL || m_friends_tab != NULL);
|
||||
m_achievements_tab = !m_profile_tabs ? NULL :
|
||||
(IconButtonWidget*)m_profile_tabs->findWidgetNamed("tab_achievements");
|
||||
assert(m_achievements_tab != NULL);
|
||||
m_settings_tab =
|
||||
assert(m_profile_tabs == NULL || m_achievements_tab != NULL);
|
||||
m_settings_tab = !m_profile_tabs ? NULL :
|
||||
(IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_settings");
|
||||
assert(m_settings_tab != NULL);
|
||||
assert(m_profile_tabs == NULL || m_settings_tab != NULL);
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -70,17 +71,20 @@ void OnlineProfileBase::loadedFromFile()
|
||||
void OnlineProfileBase::beforeAddingWidget()
|
||||
{
|
||||
m_visiting_profile = ProfileManager::get()->getVisitingProfile();
|
||||
if (!m_visiting_profile || !m_visiting_profile->isCurrentUser())
|
||||
m_settings_tab->setVisible(false);
|
||||
else
|
||||
m_settings_tab->setVisible(true);
|
||||
|
||||
// If not logged in, don't show profile or friends
|
||||
if (!m_visiting_profile)
|
||||
if (m_profile_tabs)
|
||||
{
|
||||
m_friends_tab->setVisible(false);
|
||||
m_profile_tabs->setVisible(false);
|
||||
}
|
||||
if (!m_visiting_profile || !m_visiting_profile->isCurrentUser())
|
||||
m_settings_tab->setVisible(false);
|
||||
else
|
||||
m_settings_tab->setVisible(true);
|
||||
|
||||
// If not logged in, don't show profile or friends
|
||||
if (!m_visiting_profile)
|
||||
{
|
||||
m_friends_tab->setVisible(false);
|
||||
m_profile_tabs->setVisible(false);
|
||||
}
|
||||
} // if m_profile_tabhs
|
||||
} // beforeAddingWidget
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -90,20 +94,26 @@ void OnlineProfileBase::init()
|
||||
{
|
||||
Screen::init();
|
||||
|
||||
m_friends_tab->setTooltip( _("Friends") );
|
||||
m_achievements_tab->setTooltip( _("Achievements") );
|
||||
m_settings_tab->setTooltip( _("Account Settings") );
|
||||
|
||||
// If no visiting_profile is defined, use the data of the current player.
|
||||
if (!m_visiting_profile || m_visiting_profile->isCurrentUser())
|
||||
m_header->setText(_("Your profile"), false);
|
||||
else if (m_visiting_profile)
|
||||
if (m_profile_tabs)
|
||||
{
|
||||
m_header->setText(m_visiting_profile->getUserName() + _("'s profile"), false);
|
||||
}
|
||||
else
|
||||
Log::error("OnlineProfileBase", "No visting profile");
|
||||
m_friends_tab->setTooltip(_("Friends"));
|
||||
m_achievements_tab->setTooltip(_("Achievements"));
|
||||
m_settings_tab->setTooltip(_("Account Settings"));
|
||||
|
||||
// If no visiting_profile is defined, use the data of the current player.
|
||||
if (!m_visiting_profile || m_visiting_profile->isCurrentUser())
|
||||
m_header->setText(_("Your profile"), false);
|
||||
else if (m_visiting_profile)
|
||||
{
|
||||
m_header->setText(m_visiting_profile->getUserName() + _("'s profile"), false);
|
||||
}
|
||||
else
|
||||
Log::error("OnlineProfileBase", "No visting profile");
|
||||
}
|
||||
else // no tabs, so must be local player achievements:
|
||||
{
|
||||
m_header->setText(_("Your profile"), false);
|
||||
}
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -115,7 +125,8 @@ bool OnlineProfileBase::onEscapePressed()
|
||||
|
||||
//return to your profile if it's another profile
|
||||
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
||||
StateManager::get()->replaceTopMostScreen(OnlineProfileAchievements::getInstance());
|
||||
StateManager::get()->replaceTopMostScreen(
|
||||
TabOnlineProfileAchievements::getInstance());
|
||||
return false;
|
||||
} // onEscapePressed
|
||||
|
||||
@@ -125,7 +136,7 @@ bool OnlineProfileBase::onEscapePressed()
|
||||
void OnlineProfileBase::eventCallback(Widget* widget, const std::string& name,
|
||||
const int playerID)
|
||||
{
|
||||
if (name == m_profile_tabs->m_properties[PROP_ID])
|
||||
if (m_profile_tabs && name == m_profile_tabs->m_properties[PROP_ID])
|
||||
{
|
||||
std::string selection =
|
||||
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace GUIEngine { class Widget; }
|
||||
class OnlineProfileBase : public GUIEngine::Screen
|
||||
{
|
||||
protected:
|
||||
OnlineProfileBase(const char* filename);
|
||||
OnlineProfileBase(const std::string &filename);
|
||||
|
||||
/** Pointer to the various widgets on the screen. */
|
||||
GUIEngine::LabelWidget * m_header;
|
||||
|
||||
@@ -59,7 +59,6 @@ DEFINE_SCREEN_SINGLETON( TrackInfoScreen );
|
||||
TrackInfoScreen::TrackInfoScreen()
|
||||
: Screen("track_info.stkgui")
|
||||
{
|
||||
m_screenshot = NULL;
|
||||
} // TrackInfoScreen
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -80,6 +79,10 @@ void TrackInfoScreen::loadedFromFile()
|
||||
m_highscore_entries[0] = getWidget<LabelWidget>("highscore1");
|
||||
m_highscore_entries[1] = getWidget<LabelWidget>("highscore2");
|
||||
m_highscore_entries[2] = getWidget<LabelWidget>("highscore3");
|
||||
|
||||
GUIEngine::IconButtonWidget* screenshot = getWidget<IconButtonWidget>("screenshot");
|
||||
screenshot->setFocusable(false);
|
||||
screenshot->m_tab_stop = false;
|
||||
} // loadedFromFile
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -105,37 +108,24 @@ void TrackInfoScreen::init()
|
||||
false );
|
||||
|
||||
// ---- Track screenshot
|
||||
Widget* screenshot_div = getWidget("screenshot_div");
|
||||
if(!m_screenshot || !m_widgets.contains(m_screenshot))
|
||||
{
|
||||
m_screenshot =
|
||||
new IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO,
|
||||
false /* tab stop */, false /* focusable */);
|
||||
m_screenshot->setCustomAspectRatio(4.0f / 3.0f);
|
||||
GUIEngine::IconButtonWidget* screenshot = getWidget<IconButtonWidget>("screenshot");
|
||||
|
||||
m_screenshot->m_x = screenshot_div->m_x;
|
||||
m_screenshot->m_y = screenshot_div->m_y;
|
||||
m_screenshot->m_w = screenshot_div->m_w;
|
||||
m_screenshot->m_h = screenshot_div->m_h;
|
||||
m_screenshot->add();
|
||||
m_widgets.push_back(m_screenshot);
|
||||
}
|
||||
// images are saved squared, but must be stretched to 4:
|
||||
|
||||
// temporary icon, will replace it just after (but it will be shown if the given icon is not found)
|
||||
m_screenshot->m_properties[PROP_ICON] = "gui/main_help.png";
|
||||
screenshot->m_properties[PROP_ICON] = "gui/main_help.png";
|
||||
|
||||
ITexture* screenshot = irr_driver->getTexture(m_track->getScreenshotFile(),
|
||||
ITexture* image = irr_driver->getTexture(m_track->getScreenshotFile(),
|
||||
"While loading screenshot for track '%s':",
|
||||
m_track->getFilename() );
|
||||
if(!screenshot)
|
||||
if(!image)
|
||||
{
|
||||
screenshot = irr_driver->getTexture("main_help.png",
|
||||
image = irr_driver->getTexture("main_help.png",
|
||||
"While loading screenshot for track '%s':",
|
||||
m_track->getFilename());
|
||||
}
|
||||
if (screenshot != NULL)
|
||||
m_screenshot->setImage(screenshot);
|
||||
if (image != NULL)
|
||||
screenshot->setImage(image);
|
||||
|
||||
// Lap count m_lap_spinner
|
||||
// -----------------------
|
||||
|
||||
@@ -52,9 +52,6 @@ class TrackInfoScreen : public GUIEngine::Screen,
|
||||
/** Spinner for number of AI karts. */
|
||||
GUIEngine::SpinnerWidget* m_ai_kart_spinner;
|
||||
|
||||
/** Screenshot widget. */
|
||||
GUIEngine::IconButtonWidget *m_screenshot;
|
||||
|
||||
/** Check box for reverse mode. */
|
||||
GUIEngine::CheckBoxWidget* m_reverse;
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ static const char* GPU_Phase[Q_LAST] =
|
||||
"PointLights",
|
||||
"SSAO",
|
||||
"Solid Pass 2",
|
||||
"Fog",
|
||||
"Skybox",
|
||||
"Glow",
|
||||
"Transparent",
|
||||
"Particles",
|
||||
"Displacement",
|
||||
|
||||
@@ -44,6 +44,9 @@ enum QueryPerf
|
||||
Q_POINTLIGHTS,
|
||||
Q_SSAO,
|
||||
Q_SOLID_PASS2,
|
||||
Q_FOG,
|
||||
Q_SKYBOX,
|
||||
Q_GLOW,
|
||||
Q_TRANSPARENT,
|
||||
Q_PARTICLES,
|
||||
Q_DISPLACEMENT,
|
||||
|
||||
Reference in New Issue
Block a user