Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Marc Coll Carrillo 2014-10-10 22:39:55 +02:00
commit c159f1fca2
102 changed files with 846 additions and 490 deletions

View File

@ -87,11 +87,7 @@ if(WIN32)
set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/dependencies/include")
set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib)
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies)
if(MSVC)
add_definitions(/D_IRR_STATIC_LIB_)
elseif(MINGW)
add_definitions(-D_IRR_STATIC_LIB_)
endif()
add_definitions(-D_IRR_STATIC_LIB_)
endif()
@ -149,7 +145,7 @@ endif()
if(UNIX OR MINGW)
# if(USE_CPP2011)
add_definitions("-std=gnu++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
# endif()
endif()
@ -172,7 +168,7 @@ endif()
# Set some compiler options
if(UNIX OR MINGW)
add_definitions(-Wall)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
if(WIN32)
@ -200,7 +196,7 @@ endif()
# TODO: remove this switch
add_definitions(-DHAVE_OGGVORBIS)
if(WIN32 AND NOT MINGW)
if(WIN32)
configure_file("${STK_SOURCE_DIR}/windows_installer/icon_rc.template" "${PROJECT_BINARY_DIR}/tmp/icon.rc")
endif()
@ -291,8 +287,7 @@ if(UNIX AND NOT APPLE)
target_link_libraries(supertuxkart ${IRRLICHT_XF86VM_LIBRARY})
endif()
if(USE_ASAN)
add_definitions("-fsanitize=address")
add_definitions("-fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
target_link_libraries(supertuxkart "-fsanitize=address")
endif()
endif()
@ -318,11 +313,7 @@ if(USE_WIIUSE)
find_library(BLUETOOTH_LIBRARY NAMES IOBluetooth PATHS /Developer/Library/Frameworks/IOBluetooth.framework)
target_link_libraries(supertuxkart wiiuse ${BLUETOOTH_LIBRARY})
elseif(WIN32)
if(MSVC)
add_definitions("/DWIIUSE_STATIC")
else()
add_definitions("-DWIIUSE_STATIC")
endif()
add_definitions(-DWIIUSE_STATIC)
if(WIIUSE_BUILD)
target_link_libraries(supertuxkart wiiuse)
else()

View File

@ -48,4 +48,8 @@
title="Banana Lover" description="Collect at least 5 bananas in one race.">
<banana goal="5"/>
</achievement>
<achievement id="10" secret="yes" check-type="all-at-least" reset-type="race"
title="It's secret" description="Really ... a secret.">
</achievement>
</achievements>

22
data/fonts/materials.xml Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<materials>
<!-- Fonts -->
<material name="title_font.png" shader="unlit" lazy-load="Y"/>
<material name="title_font_2.png" shader="unlit" lazy-load="Y"/>
<material name="sigmar0.png" shader="unlit" lazy-load="Y"/>
<material name="comix.png" shader="unlit" lazy-load="Y"/>
<material name="LayneHansom0.png" shader="unlit" lazy-load="Y"/>
<material name="Mplus2p_JP0.png" shader="unlit" lazy-load="Y"/>
<material name="rasheeq0.png" shader="unlit" lazy-load="Y"/>
<material name="rasheeq3.png" shader="unlit" lazy-load="Y"/>
<material name="rasheeq4.png" shader="unlit" lazy-load="Y"/>
<material name="wqyMicroHei0.png" shader="unlit" lazy-load="Y"/>
<material name="wqyMicroHei1.png" shader="unlit" lazy-load="Y"/>
<material name="wqyMicroHei2.png" shader="unlit" lazy-load="Y"/>
<material name="wqyMicroHei3.png" shader="unlit" lazy-load="Y"/>
<material name="wqyMicroHei4.png" shader="unlit" lazy-load="Y"/>
<material name="wqyMicroHei5.png" shader="unlit" lazy-load="Y"/>
<material name="AR_PL_SungtiL_GB0.png" shader="unlit" lazy-load="Y"/>
<material name="LayneHansomBigDigits.png" shader="unlit" lazy-load="Y"/>
</materials>

View File

@ -8,6 +8,8 @@
<button id="assignEsc" I18N="When configuring input" text="Assign to ESC key" align="center"/>
<spacer height="10" width="10" />
<button id="assignNone" I18N="When configuring input" text="Assign nothing" align="center"/>
<spacer height="10" width="10" />
<button id="cancel" I18N="When configuring input" text="Press ESC to cancel" align="center"/>
</div>

View File

@ -13,32 +13,32 @@
square_items="true" child_width="128" child_height="128" />
<spacer height="15" width="10"/>
<div width="80%" align="center" layout="vertical-row" height="fit">
<div width="90%" align="center" layout="vertical-row" height="fit">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the login screen" text="Online"/>
<checkbox id="online" I18N="In the login screen" text_align="left"/>
<label width="40%" height="100%" text_align="left" I18N="In the login screen" text="Online"/>
<checkbox width="fit" id="online" I18N="In the login screen" text_align="left"/>
</div>
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_remember" proportion="1" height="100%" text_align="left"
<label width="40%" id="label_remember" height="100%" text_align="left"
I18N="In the login screen" text="Remember password"/>
<checkbox id="remember-user" I18N="In the login screen" text_align="left"/>
<checkbox width="fit" id="remember-user" I18N="In the login screen" text_align="left"/>
</div>
<!-- Disable guest accounts for now
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_guest" proportion="1" height="100%" text_align="left"
<label width="40%" id="label_guest" height="100%" text_align="left"
I18N="In the login screen" text="Guest login"/>
<checkbox id="guest" I18N="In the login screen" text_align="left"/>
</div>
-->
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_username" proportion="1" height="100%" text_align="left"
<label width="40%" id="label_username" height="100%" text_align="left"
I18N="In the login screen" text="Username"/>
<textbox id="username" proportion="2" height="fit" I18N="In the registration dialog"/>
</div>
<spacer height="20" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_password" proportion="1" height="100%" text_align="left"
<label id="label_password" width="40%" height="100%" text_align="left"
I18N="In the registration dialog" text="Password"/>
<textbox id="password" proportion="2" height="fit" I18N="In the registration dialog"/>
</div>
@ -54,8 +54,6 @@
I18N="Login dialog" text="Add user" label_location="bottom"/>
<icon-button id="delete" width="64" height="64" icon="gui/gp_remove_track.png"
I18N="Login dialog" text="Delete" label_location="bottom"/>
<icon-button id="recover" width="64" height="64" icon="gui/main_options.png"
I18N="Login dialog" text="Recovery" label_location="bottom"/>
<icon-button id="rename" width="64" height="64" icon="gui/gp_rename.png"
I18N="Login dialog" text="Rename" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"

View File

@ -22,15 +22,15 @@
square_items="true" child_width="128" child_height="128" />
<spacer height="15" width="10"/>
<div width="80%" align="center" layout="vertical-row" height="fit">
<div width="90%" align="center" layout="vertical-row" height="fit">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the login screen" text="Online"/>
<checkbox id="online" I18N="In the login screen" text_align="left"/>
<label width="40%" height="100%" text_align="left" I18N="In the login screen" text="Online"/>
<checkbox width="fit" id="online" I18N="In the login screen" text_align="left"/>
</div>
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_remember" proportion="1" height="100%" text_align="left"
<label id="label_remember" width="40%" height="100%" text_align="left"
I18N="In the login screen" text="Remember password"/>
<checkbox id="remember-user" I18N="In the login screen" text_align="left"/>
<checkbox width="fit" id="remember-user" I18N="In the login screen" text_align="left"/>
</div>
<!-- Disable guest accounts for now
<div width="100%" height="fit" layout="horizontal-row" >
@ -40,14 +40,14 @@
</div>
-->
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_username" proportion="1" height="100%" text_align="left"
<label id="label_username" width="40%" height="100%" text_align="left"
I18N="In the login screen" text="Username"/>
<textbox id="username" proportion="2" height="fit" I18N="In the registration dialog"/>
</div>
<spacer height="20" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_password" proportion="1" height="100%" text_align="left"
<label id="label_password" width="40%" height="100%" text_align="left"
I18N="In the registration dialog" text="Password"/>
<textbox id="password" proportion="2" height="fit" I18N="In the registration dialog"/>
</div>

View File

@ -14,5 +14,5 @@ void main()
Yxy.x = smoothstep(WhiteYxy.x, WhiteYxy.x * 4, Yxy.x);
FragColor = vec4(getRGBFromCIEXxy(Yxy), 1.0);
FragColor = vec4(max(vec3(0.), getRGBFromCIEXxy(Yxy)), 1.0);
}

View File

@ -1,9 +1,11 @@
#ifdef GL_ARB_bindless_texture
layout(bindless_sampler) uniform sampler2D Albedo;
layout(bindless_sampler) uniform sampler2D Detail;
layout(bindless_sampler) uniform sampler2D SpecMap;
#else
uniform sampler2D Albedo;
uniform sampler2D Detail;
uniform sampler2D SpecMap;
#endif
#if __VERSION__ >= 130
@ -16,7 +18,7 @@ varying vec2 uv_bis;
#define FragColor gl_FragColor
#endif
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main(void)
{
@ -28,6 +30,6 @@ void main(void)
#endif
vec4 detail = texture(Detail, uv_bis);
color *= detail;
vec3 LightFactor = getLightFactor(1. - color.a);
FragColor = vec4(color.xyz * LightFactor, 1.);
float specmap = texture(SpecMap, uv).g;
FragColor = vec4(getLightFactor(color.xyz, vec3(1.), specmap), 1.);
}

View File

@ -2,11 +2,15 @@ uniform float blueLmn[9];
uniform float greenLmn[9];
uniform float redLmn[9];
uniform sampler2D ntex;
uniform sampler2D dtex;
uniform samplerCube tex;
uniform mat4 TransposeViewMatrix;
out vec4 Diff;
out vec4 Spec;
vec3 DecodeNormal(vec2 n);
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
mat4 getMatrix(float L[9])
{
@ -24,8 +28,9 @@ void main(void)
{
vec2 uv = gl_FragCoord.xy / screen;
vec3 normal = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
// Convert normal in world space (where SH coordinates were computed)
vec4 extendednormal = TransposeViewMatrix * vec4(normal, 1.);
vec4 extendednormal = TransposeViewMatrix * vec4(normal, 0.);
extendednormal.w = 1.;
mat4 rmat = getMatrix(redLmn);
mat4 gmat = getMatrix(greenLmn);
@ -36,4 +41,16 @@ void main(void)
float b = dot(extendednormal, bmat * extendednormal);
Diff = max(0.25 * vec4(r, g, b, .1), vec4(0.));
float z = texture(dtex, uv).x;
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
vec3 eyedir = -normalize(xpos.xyz);
vec3 sampleDirection = reflect(-eyedir, normal);
sampleDirection = (InverseViewMatrix * vec4(sampleDirection, 0.)).xyz;
float specval = texture(ntex, uv).z;
float lodval = 16 * (1. - ((log2(specval) - 1.) / 10.));
vec4 specular = textureLod(tex, sampleDirection, lodval);
Spec = max(specular, vec4(0.));
}

View File

@ -1,9 +1,11 @@
#ifdef GL_ARB_bindless_texture
layout(bindless_sampler) uniform sampler2D Albedo;
layout(bindless_sampler) uniform sampler2D dtex;
layout(bindless_sampler) uniform sampler2D SpecMap;
#else
uniform sampler2D Albedo;
uniform sampler2D dtex;
uniform sampler2D SpecMap;
#endif
uniform vec3 SunDir;
@ -12,10 +14,18 @@ in vec3 nor;
in vec2 uv;
out vec4 FragColor;
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main(void)
{
vec4 color = texture(Albedo, uv);
#ifdef GL_ARB_bindless_texture
#ifdef SRGBBindlessFix
color.xyz = pow(color.xyz, vec3(2.2));
#endif
#endif
if (color.a < 0.5) discard;
vec2 texc = gl_FragCoord.xy / screen;
float z = texture(dtex, texc).x;
@ -30,14 +40,8 @@ void main(void)
float fLdotNBack = max(0., - dot(nor, SunDir) * 0.6 + 0.4);
float scattering = mix(fPowEdotL, fLdotNBack, .5);
float specmap = texture(SpecMap, uv).g;
vec4 color = texture(Albedo, uv);
#ifdef GL_ARB_bindless_texture
#ifdef SRGBBindlessFix
color.xyz = pow(color.xyz, vec3(2.2));
#endif
#endif
if (color.a < 0.5) discard;
vec3 LightFactor = (scattering * 0.3) + getLightFactor(1.);
vec3 LightFactor = color.xyz * (scattering * 0.3) + getLightFactor(color.xyz, vec3(1.), specmap);
FragColor = vec4(color.xyz * LightFactor, 1.);
}

View File

@ -1,22 +1,25 @@
#ifndef GL_ARB_bindless_texture
uniform sampler2D Albedo;
uniform sampler2D Detail;
uniform sampler2D SpecMap;
#endif
#ifdef GL_ARB_bindless_texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
flat in sampler2D thirdhandle;
#endif
in vec2 uv;
in vec2 uv_bis;
out vec4 FragColor;
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main(void)
{
#ifdef GL_ARB_bindless_texture
vec4 color = texture(handle, uv);
float specmap = texture(secondhandle, uv).g;
#ifdef SRGBBindlessFix
color.xyz = pow(color.xyz, vec3(2.2));
#endif
@ -24,8 +27,8 @@ void main(void)
#else
vec4 color = texture(Albedo, uv);
vec4 detail = texture(Detail, uv_bis);
float specmap = texture(SpecMap, uv).g;
#endif
color *= detail;
vec3 LightFactor = getLightFactor(1. - color.a);
FragColor = vec4(color.xyz * LightFactor, 1.);
FragColor = vec4(getLightFactor(color.xyz, vec3(1.), specmap), 1.);
}

View File

@ -11,6 +11,7 @@ layout(location = 8) in vec3 Orientation;
layout(location = 9) in vec3 Scale;
#ifdef GL_ARB_bindless_texture
layout(location = 10) in sampler2D Handle;
layout(location = 11) in sampler2D SecondHandle;
#endif
#else
@ -28,6 +29,7 @@ out vec3 nor;
out vec2 uv;
#ifdef GL_ARB_bindless_texture
flat out sampler2D handle;
flat out sampler2D secondhandle;
#endif
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
@ -42,5 +44,6 @@ void main()
uv = Texcoord;
#ifdef GL_ARB_bindless_texture
handle = Handle;
secondhandle = SecondHandle;
#endif
}

View File

@ -2,6 +2,7 @@
layout(bindless_sampler) uniform sampler2D dtex;
#else
uniform sampler2D Albedo;
uniform sampler2D SpecMap;
uniform sampler2D dtex;
#endif
@ -9,15 +10,28 @@ uniform vec3 SunDir;
#ifdef GL_ARB_bindless_texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
#endif
in vec3 nor;
in vec2 uv;
out vec4 FragColor;
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main(void)
{
#ifdef GL_ARB_bindless_texture
vec4 color = texture(handle, uv);
float specmap = texture(secondhandle, uv).g;
#ifdef SRGBBindlessFix
color.xyz = pow(color.xyz, vec3(2.2));
#endif
#else
vec4 color = texture(Albedo, uv);
float specmap = texture(SpecMap, uv).g;
#endif
if (color.a < 0.5) discard;
vec2 texc = gl_FragCoord.xy / screen;
float z = texture(dtex, texc).x;
@ -33,15 +47,7 @@ void main(void)
float fLdotNBack = max(0., - dot(nor, SunDir) * 0.6 + 0.4);
float scattering = mix(fPowEdotL, fLdotNBack, .5);
#ifdef GL_ARB_bindless_texture
vec4 color = texture(handle, uv);
#ifdef SRGBBindlessFix
color.xyz = pow(color.xyz, vec3(2.2));
#endif
#else
vec4 color = texture(Albedo, uv);
#endif
if (color.a < 0.5) discard;
vec3 LightFactor = (scattering * 0.3) + getLightFactor(1.);
FragColor = vec4(color.xyz * LightFactor, 1.);
vec3 LightFactor = color.xyz * (scattering * 0.3) + getLightFactor(color.xyz, vec3(1.), specmap);
FragColor = vec4(LightFactor, 1.);
}

View File

@ -1,27 +1,30 @@
#ifndef GL_ARB_bindless_texture
uniform sampler2D Albedo;
uniform sampler2D SpecMap;
#endif
#ifdef GL_ARB_bindless_texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
#endif
in vec2 uv;
in vec4 color;
out vec4 FragColor;
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main(void)
{
#ifdef GL_ARB_bindless_texture
vec4 col = texture(handle, uv);
float specmap = texture(secondhandle, uv).g;
#ifdef SRGBBindlessFix
col.xyz = pow(col.xyz, vec3(2.2));
#endif
#else
vec4 col = texture(Albedo, uv);
float specmap = texture(SpecMap, uv).g;
#endif
col.xyz *= pow(color.xyz, vec3(2.2));
vec3 LightFactor = getLightFactor(1.);
FragColor = vec4(col.xyz * LightFactor, 1.);
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap), 1.);
}

View File

@ -12,7 +12,7 @@ out vec4 FragColor;
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main() {
vec3 texc = gl_FragCoord.xyz / vec3(screen, 1.);
@ -29,7 +29,6 @@ void main() {
#else
vec4 detail0 = texture(tex, r.xy / m + .5);
#endif
vec3 LightFactor = getLightFactor(1.);
FragColor = vec4(detail0.xyz * LightFactor, 1.);
FragColor = vec4(getLightFactor(detail0.xyz, vec3(1.), 0.), 1.);
}

View File

@ -1,28 +1,31 @@
#ifndef GL_ARB_bindless_texture
uniform sampler2D Albedo;
uniform sampler2D SpecMap;
#endif
#ifdef GL_ARB_bindless_texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
#endif
in vec2 uv;
in vec4 color;
out vec4 FragColor;
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main(void)
{
#ifdef GL_ARB_bindless_texture
vec4 col = texture(handle, uv);
float specmap = texture(secondhandle, uv).g;
#ifdef SRGBBindlessFix
col.xyz = pow(col.xyz, vec3(2.2));
#endif
#else
vec4 col = texture(Albedo, uv);
float specmap = texture(SpecMap, uv).g;
#endif
col.xyz *= pow(color.xyz, vec3(2.2));
if (col.a * color.a < 0.5) discard;
vec3 LightFactor = getLightFactor(1.);
FragColor = vec4(col.xyz * LightFactor, 1.);
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap), 1.);
}

View File

@ -1,14 +1,16 @@
#ifdef GL_ARB_bindless_texture
layout(bindless_sampler) uniform sampler2D Albedo;
layout(bindless_sampler) uniform sampler2D SpecMap;
#else
uniform sampler2D Albedo;
uniform sampler2D SpecMap;
#endif
in vec2 uv;
in vec4 color;
out vec4 FragColor;
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main(void)
{
@ -21,6 +23,6 @@ void main(void)
vec4 col = texture(Albedo, uv);
#endif
col.xyz *= pow(color.xyz, vec3(2.2));
vec3 LightFactor = getLightFactor(1.);
FragColor = vec4(col.xyz * LightFactor, 1.);
float specmap = texture(SpecMap, uv).g;
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap), 1.);
}

View File

@ -15,7 +15,7 @@ varying vec3 nor;
#endif
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main() {
vec3 texc = gl_FragCoord.xyz / vec3(screen, 1.);
@ -30,7 +30,6 @@ void main() {
detail0.xyz = pow(detail0.xyz, vec3(2.2));
#endif
#endif
vec3 LightFactor = getLightFactor(1.);
FragColor = vec4(detail0.xyz * LightFactor, 1.);
FragColor = vec4(getLightFactor(detail0.xyz, vec3(1.), 0.), 1.);
}

View File

@ -1,14 +1,16 @@
#ifdef GL_ARB_bindless_texture
layout(bindless_sampler) uniform sampler2D Albedo;
layout(bindless_sampler) uniform sampler2D SpecMap;
#else
uniform sampler2D Albedo;
uniform sampler2D SpecMap;
#endif
in vec2 uv;
in vec4 color;
out vec4 FragColor;
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main(void)
{
@ -20,6 +22,6 @@ void main(void)
#endif
col.xyz *= pow(color.xyz, vec3(2.2));
if (col.a * color.a < 0.5) discard;
vec3 LightFactor = getLightFactor(1.);
FragColor = vec4(col.xyz * LightFactor, 1.);
float specmap = texture(SpecMap, uv).g;
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap), 1.);
}

View File

@ -9,6 +9,7 @@ uniform mat4 RSMMatrix;
uniform sampler2D dtex;
uniform sampler2D ctex;
uniform sampler2D ntex;
uniform vec3 suncol;
flat in int slice;
layout (location = 0) out vec4 SHRed;
@ -63,7 +64,7 @@ void loop(in int i,
float dotprod = max(dot(RSM_to_RH_dir, normal.xyz), 0.);
float factor = dotprod / (0.1 + dist * dist);
vec3 color = RSMAlbedo.rgb * factor;
vec3 color = RSMAlbedo.rgb * factor * suncol.rgb;
SHr += DirToSh(RSM_to_RH_dir, color.r);
SHg += DirToSh(RSM_to_RH_dir, color.g);

View File

@ -22,7 +22,7 @@ varying vec2 uv_bis;
#define FragColor gl_FragColor
#endif
vec3 getLightFactor(float specMapValue);
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue);
void main() {
// Splatting part
@ -46,6 +46,5 @@ void main() {
splatting.b * detail2 +
max(0., (1.0 - splatting.r - splatting.g - splatting.b)) * detail3;
vec3 LightFactor = getLightFactor(1.);
FragColor = vec4(splatted.xyz * LightFactor, 1.);
FragColor = vec4(getLightFactor(splatted.xyz, vec3(1.), 0.), 1.);
}

View File

@ -8,12 +8,12 @@ uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
#endif
vec3 getLightFactor(float specMapValue)
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue)
{
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 = DiffuseComponent + SpecularComponent * specMapValue;
vec3 tmp = diffuseMatColor * DiffuseComponent * (1. - specMapValue) + specularMatColor * SpecularComponent * specMapValue;
return tmp * ao;
}

View File

@ -277,7 +277,7 @@ void CGUIButton::draw()
pos.X += skin->getSize(EGDS_BUTTON_PRESSED_IMAGE_OFFSET_X);
pos.Y += skin->getSize(EGDS_BUTTON_PRESSED_IMAGE_OFFSET_Y);
}
driver->draw2DImage(PressedImage,
skin->draw2DImage(PressedImage,
ScaleImage? AbsoluteRect :
core::recti(pos, PressedImageRect.getSize()),
PressedImageRect, &AbsoluteClippingRect,

View File

@ -78,20 +78,20 @@ void CGUIImage::draw()
if (Texture)
{
if (ScaleImage)
{
//if (ScaleImage)
//{
const video::SColor Colors[] = {Color,Color,Color,Color};
driver->draw2DImage(Texture, AbsoluteRect,
skin->draw2DImage(Texture, AbsoluteRect,
core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
&AbsoluteClippingRect, Colors, UseAlphaChannel);
}
else
{
driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
&AbsoluteClippingRect, Color, UseAlphaChannel);
}
//}
//else
//{
// driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
// core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
// &AbsoluteClippingRect, Color, UseAlphaChannel);
//}
}
else
{

View File

@ -35,6 +35,7 @@ AchievementInfo::AchievementInfo(const XMLNode * input)
m_id = 0;
m_title = "";
m_description = "";
m_is_secret = false;
bool all;
all = input->get("id", &m_id ) &&
input->get("title", &m_title ) &&
@ -69,6 +70,7 @@ AchievementInfo::AchievementInfo(const XMLNode * input)
else
Log::warn("AchievementInfo", "Achievement check type '%s' unknown.",
s.c_str());
input->get("secret", &m_is_secret);
// Now load the goal nodes
for (unsigned int n = 0; n < input->getNumNodes(); n++)

View File

@ -94,6 +94,9 @@ private:
/** Determines when the achievement needs to be reset */
ResetType m_reset_type;
/** A secret achievement has its progress not shown. */
bool m_is_secret;
public:
AchievementInfo(const XMLNode * input);
virtual ~AchievementInfo() {};
@ -119,6 +122,9 @@ public:
/** Returns the check type for this achievement. */
AchievementCheckType getCheckType() const { return m_check_type; }
// ------------------------------------------------------------------------
/** Returns if this achievement is a secret achievement. */
bool isSecret() const { return m_is_secret; }
// ------------------------------------------------------------------------
}; // class AchievementInfo

View File

@ -48,7 +48,7 @@ public:
virtual SFXManager::SFXStatus getStatus() { return SFXManager::SFX_STOPPED; }
virtual void onSoundEnabledBack() {}
virtual void setRolloff(float rolloff) {}
virtual bool isPlaying() { return false; }
virtual const SFXBuffer* getBuffer() const { return NULL; }
}; // DummySFX

View File

@ -48,6 +48,7 @@ public:
virtual bool init() = 0;
virtual void position(const Vec3 &position) = 0;
virtual void setLoop(bool status) = 0;
virtual bool isPlaying() = 0;
virtual void play() = 0;
virtual void reallyPlayNow() = 0;
virtual void stop() = 0;

View File

@ -43,6 +43,7 @@ SFXOpenAL::SFXOpenAL(SFXBuffer* buffer, bool positional, float gain, bool ownsBu
m_soundBuffer = buffer;
m_soundSource = 0;
m_ok = false;
m_is_playing = false;
m_positional = positional;
m_defaultGain = gain;
m_loop = false;
@ -85,10 +86,8 @@ bool SFXOpenAL::init()
assert( alIsBuffer(m_soundBuffer->getBufferID()) );
assert( alIsSource(m_soundSource) );
//std::cout << "Setting a source with buffer " << m_soundBuffer
// << ", rolloff " << rolloff
// << ", gain=" << m_defaultGain << ", positional="
// << (positional ? "true" : "false") << std::endl;
//Log::info("SFXOpenAL", "Setting a source with buffer, %p, rolloff %f, gain = %f, position = %s",
// m_soundBuffer, rolloff, m_defaultGain, positional ? "true" : "false");
alSourcei (m_soundSource, AL_BUFFER, m_soundBuffer->getBufferID());
@ -189,7 +188,8 @@ void SFXOpenAL::stop()
{
if(!m_ok) return;
m_loop = false;
m_is_playing = false;
m_loop = false;
alSourcei(m_soundSource, AL_LOOPING, AL_FALSE);
alSourceStop(m_soundSource);
SFXManager::checkError("stoping");
@ -230,6 +230,10 @@ void SFXOpenAL::resume()
*/
void SFXOpenAL::play()
{
// Technically the sfx is only playing after the sfx thread starts it,
// but for STK this is correct since we don't want to start the same
// sfx twice.
m_is_playing = true;
SFXManager::get()->queue(this);
} // play
@ -252,6 +256,14 @@ void SFXOpenAL::reallyPlayNow()
SFXManager::checkError("playing");
} // reallyPlayNow
//-----------------------------------------------------------------------------
/** Returns true if the sound effect is currently playing.
*/
bool SFXOpenAL::isPlaying()
{
return m_is_playing;
} // isPlaying
//-----------------------------------------------------------------------------
/** Sets the position where this sound effects is played.
* \param position Position of the sound effect.

View File

@ -55,6 +55,9 @@ private:
the sound source won't be created and we'll be left with no clue when enabling
sounds later. */
float m_gain;
/** True when the sfx is currently playing. */
bool m_is_playing;
/** The master gain set in user preferences */
float m_master_gain;
@ -72,6 +75,7 @@ public:
virtual void play();
virtual void reallyPlayNow();
virtual void setLoop(bool status);
virtual bool isPlaying();
virtual void stop();
virtual void pause();
virtual void resume();

View File

@ -83,6 +83,10 @@ irr::core::stringw DeviceConfig::getMappingIdString (const PlayerAction action)
returnString += id;
break;
case Input::IT_NONE:
returnString += "none";
break;
default:
assert(false);
returnString += type;

View File

@ -23,15 +23,31 @@
#include "graphics/irr_driver.hpp"
#include "online/http_request.hpp"
#include "utils/random_generator.hpp"
#include "utils/string_utils.hpp"
#ifdef __APPLE__
# include <sys/sysctl.h>
#endif
#include <fstream>
#include <set>
#include <sstream>
#include <string>
#ifndef WIN32
# include <sys/param.h> // To get BSD macro
# include <sys/utsname.h>
#endif
#include <vector>
namespace HardwareStats
{
namespace Private
{
/** Stores the OS version, e.g. "Windows 7", or "Fedora 21". */
static std::string m_os_version;
} // namespace Private
using namespace Private;
// ----------------------------------------------------------------------------
/** Returns the amount of RAM in MB.
@ -40,7 +56,7 @@ namespace HardwareStats
int getRAM()
{
#ifdef __linux__
const uint64_t memory_size = (uint64_t)sysconf(_SC_PHYS_PAGES)
const uint64_t memory_size = (uint64_t)sysconf(_SC_PHYS_PAGES)
* sysconf(_SC_PAGESIZE);
return int(memory_size / (1024*1024));
#endif
@ -102,6 +118,138 @@ int getNumProcessors()
return 0;
} // getNumProcessors
// ----------------------------------------------------------------------------
/** Tries opening and parsing the specified release file in /etc to find
* information about the distro used.
* \param filename Full path of the file to open.
* \return True if file could be read and valid information was paresed,
* false otherwise.
*/
bool readEtcReleaseFile(const std::string &filename)
{
std::ifstream in(filename);
std::string s, distro, version;
while( (distro.empty() || version.empty()) &&
std::getline(in, s) )
{
std::vector<std::string> l = StringUtils::split(s, '=');
if(l.size()==0) continue;
if (l[0]=="NAME" ) distro = l[1];
else if(l[0]=="VERSION_ID") version = l[1];
}
if(!distro.empty() && !version.empty())
{
distro = StringUtils::replace(distro, "\"", "");
version = StringUtils::replace(version, "\"", "");
m_os_version = distro + " " + version;
return true;
}
return false;
} // readEtcReleaseFile
// ----------------------------------------------------------------------------
/** Identify more details about the OS, e.g. on linux which distro
* and which verison; on windows the version number.
* \param json Json data structure to store the os info in.
*/
void determineOSVersion()
{
std::string version, distro;
#ifdef __linux__
// First try the standard /etc/os-release. Then check for older versions
// e.g. /etc/fedora-release, /etc/SuSE-release, /etc/redhat-release
if(readEtcReleaseFile("/etc/os-release")) return;
std::set<std::string> file_list;
file_manager->listFiles(file_list, "./", true);
for(std::set<std::string>::iterator i = file_list.begin();
i != file_list.end(); i++)
{
// Only try reading /etc/*-release files
if(StringUtils::hasSuffix(*i, "-release"))
if (readEtcReleaseFile(*i)) return;
}
// Fallback in case that we can't find any valid information in /etc/*release
struct utsname u;
if (uname(&u))
{
m_os_version = "Linux unknown";
return;
}
// Ignore data after "-", since it could identify a system (self compiled
// kernels).
std::vector<std::string> l = StringUtils::split(std::string(u.release),'-');
m_os_version = std::string(u.sysname) + " " + l[0];
#endif
#ifdef BSD
struct utsname u;
if (uname(&u))
{
m_os_version = "BSD unknown";
return;
}
// Ignore data after "-", since it could identify a system (self compiled
// kernels).
std::vector<std::string> l = StringUtils::split(std::string(u.release),'-');
m_os_version = std::string(u.sysname) + " " + l[0];
#endif
#ifdef WIN32
// (C) 2014 by Wildfire Games (0 A.D.), ported by Joerg Henrichs.
HKEY hKey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0,
KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
{
m_os_version = "windows-unknown";
return;
}
char windows_version_string[20];
DWORD size = sizeof(windows_version_string);
RegQueryValueEx(hKey, "CurrentVersion", 0, 0, (LPBYTE)windows_version_string, &size);
unsigned major = 0, minor = 0;
std::stringstream sstr(windows_version_string);
sstr >> major;
if (sstr.peek() == '.')
sstr.ignore();
sstr >> minor;
int windows_version = (major << 8) | minor;
RegCloseKey(hKey);
switch(windows_version)
{
case 0x0500: m_os_version="Windows 2000"; break;
case 0x0501: m_os_version="Windows XP"; break;
case 0x0502: m_os_version="Windows XP64"; break;
case 0x0600: m_os_version="Windows Vista"; break;
case 0x0601: m_os_version="Windows 7"; break;
case 0x0602: m_os_version="Windows 8"; break;
default: {
m_os_version = StringUtils::insertValues("Windows %d",
windows_version);
break;
}
} // switch
#endif
} // determineOSVersion
// ----------------------------------------------------------------------------
/** Returns the OS version, e.g.: "Windows 7", or "Fedora 21".
*/
const std::string& getOSVersion()
{
if(m_os_version.empty())
determineOSVersion();
return m_os_version;
} // getOSVersion
// ----------------------------------------------------------------------------
/** If the configuration of this installation has not been reported for the
* current version, collect the hardware statistics and send it to STK's
@ -144,10 +292,12 @@ void reportHardwareStats()
json.add("build_debug", 1);
#endif
json.add("os_version", getOSVersion());
unsigned int ogl_version = irr_driver->getGLSLVersion();
unsigned int major = ogl_version/100;
unsigned int minor = ogl_version - 100*major;
std::string version =
std::string version =
StringUtils::insertValues("%d.%d", major, minor);
json.add("GL_SHADING_LANGUAGE_VERSION", version);
@ -166,7 +316,7 @@ void reportHardwareStats()
else if(StringUtils::startsWith(card_name, "S3 Graphics"))
card_name="S3";
json.add("gfx_card", card_name+" "+renderer);
json.add("video_xres", UserConfigParams::m_width );
json.add("video_yres", UserConfigParams::m_height);
@ -195,14 +345,14 @@ void reportHardwareStats()
int m_version;
public:
HWReportRequest(int version) : Online::HTTPRequest(/*manage memory*/true, 1)
,m_version(version)
, m_version(version)
{}
// --------------------------------------------------------------------
/** Callback after the request has been executed.
/** Callback after the request has been executed.
*/
virtual void callback()
{
// If the request contains incorrect data, it will not have a
// If the request contains incorrect data, it will not have a
// download error, but return an error string as return value:
if(hadDownloadError() || getData()=="<h1>Bad Request (400)</h1>")
{

View File

@ -25,11 +25,14 @@
#include "utils/no_copy.hpp"
#include "utils/string_utils.hpp"
namespace HardwareStats
{
/** A class to manage json data. */
class Json : public NoCopy
{
private:
/** The accumulated json data. */
std::string m_data;
public:
/** Constructor. */
@ -78,6 +81,7 @@ namespace HardwareStats
// ========================================================================
void reportHardwareStats();
const std::string& getOSVersion();
}; // HardwareStats
#endif

View File

@ -170,7 +170,11 @@ PlayerManager::~PlayerManager()
for_var_in(PlayerProfile*, player, m_all_players)
{
if(!player->rememberPassword())
player->clearSession();
{
// Don't let the player trigger a save, since it
// will be done below anyway.
player->clearSession(/*save*/false);
}
}
save();

View File

@ -235,12 +235,13 @@ void PlayerProfile::saveSession(int user_id, const std::string &token)
// ------------------------------------------------------------------------
/** Unsets any saved session data. */
void PlayerProfile::clearSession()
void PlayerProfile::clearSession(bool save)
{
m_saved_session = false;
m_saved_user_id = 0;
m_saved_token = "";
PlayerManager::get()->save();
if(save)
PlayerManager::get()->save();
} // clearSession
//------------------------------------------------------------------------------

View File

@ -121,7 +121,7 @@ public:
bool operator<(const PlayerProfile &other);
void raceFinished();
void saveSession(int user_id, const std::string &token);
void clearSession();
void clearSession(bool save=true);
void addIcon();
/** Abstract virtual classes, to be implemented by the OnlinePlayer. */

View File

@ -71,7 +71,7 @@ SavedGrandPrix::SavedGrandPrix(unsigned int player_id,
const std::vector<RaceManager::KartStatus> &kart_list)
: m_savedgp_group("SavedGP",
"Represents the saved state of a GP"),
m_player_id(player_id),
m_player_id(player_id, "player_id", &m_savedgp_group),
m_gp_id(gp_id.c_str(), "gp_id", &m_savedgp_group),
m_difficulty((int)difficulty,"difficulty", &m_savedgp_group),
m_player_karts(player_karts,"player_karts", &m_savedgp_group),
@ -94,13 +94,14 @@ SavedGrandPrix::SavedGrandPrix(unsigned int player_id,
SavedGrandPrix::SavedGrandPrix(const XMLNode* node)
: m_savedgp_group("SavedGP",
"Represents the saved state of a GP"),
m_player_id(0),
m_player_id(0, "player_id", &m_savedgp_group),
m_gp_id("-", "gp_id", &m_savedgp_group),
m_difficulty(0,"difficulty", &m_savedgp_group),
m_player_karts(0,"player_karts", &m_savedgp_group),
m_next_track(0,"last_track", &m_savedgp_group)
{
//m_player_group.findYourDataInAChildOf(node);
m_player_id.findYourDataInAnAttributeOf(node);
m_gp_id.findYourDataInAnAttributeOf(node);
m_difficulty.findYourDataInAnAttributeOf(node);
m_player_karts.findYourDataInAnAttributeOf(node);

View File

@ -60,7 +60,7 @@ protected:
* WARNING : m_savedgp_group has to be declared before the other userconfigparams!
*/
GroupUserConfigParam m_savedgp_group;
unsigned int m_player_id;
IntUserConfigParam m_player_id;
/** Identifier of this GP. */
StringUserConfigParam m_gp_id;
@ -145,6 +145,7 @@ public:
for (unsigned int n=0; n<UserConfigParams::m_saved_grand_prix_list.size(); n++)
{
SavedGrandPrix* gp = &UserConfigParams::m_saved_grand_prix_list[n];
if ((gp->getGPID() == gpid) &&
(gp->getPlayerID() == player) &&
(gp->getDifficulty() == difficulty) &&

View File

@ -140,8 +140,7 @@ void GroupUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
const XMLNode* child = node->getNode( m_param_name );
if (child == NULL)
{
//std::cerr << "/!\\ User Config : Couldn't find parameter group "
// << paramName << std::endl;
//Log::error("User Config", "Couldn't find parameter group %s", m_param_name.c_str());
return;
}
@ -271,8 +270,7 @@ void ListUserConfigParam<T, U>::findYourDataInAChildOf(const XMLNode* node)
const XMLNode* child = node->getNode( m_param_name );
if (child == NULL)
{
//std::cerr << "/!\\ User Config : Couldn't find parameter group "
// << paramName << std::endl;
//Log::error("User Config", "Couldn't find parameter group %s", m_param_name.c_str());
return;
}
@ -374,12 +372,12 @@ void IntUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
const XMLNode* child = node->getNode( m_param_name );
if(child == NULL)
{
//std::cout << "Couldn't find int parameter " << paramName << std::endl;
//Log::error("UserConfigParam", "Couldn't find int parameter %s", m_param_name.c_str());
return;
}
child->get( "value", &m_value );
//std::cout << "read int " << paramName << ", value=" << value << std::endl;
//Log::info("UserConfigParam", "Read int %s ,value = %d", m_param_name.c_str(), value);
} // findYourDataInAChildOf
// ----------------------------------------------------------------------------
@ -442,7 +440,7 @@ void TimeUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
const XMLNode* child = node->getNode( m_param_name );
if(child == NULL)
{
//std::cout << "Couldn't find int parameter " << paramName <<std::endl;
//Log::error("UserConfigParam", "Couldn't find int parameter %s", m_param_name.c_str());
return;
}
@ -564,8 +562,7 @@ void BoolUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
}
else
{
std::cerr << "Unknown value for " << m_param_name
<< "; expected true or false\n";
Log::error("User Config", "Unknown value for %s; expected true or false", m_param_name.c_str());
}
} // findYourDataInAChildOf
@ -585,8 +582,7 @@ void BoolUserConfigParam::findYourDataInAnAttributeOf(const XMLNode* node)
}
else
{
std::cerr << "Unknown value for " << m_param_name
<< "; expected true or false\n";
Log::error("User Config", "Unknown value for %s; expected true or false", m_param_name.c_str());
}
} // findYourDataInAnAttributeOf
@ -760,7 +756,7 @@ void UserConfig::saveConfig()
const int paramAmount = all_params.size();
for(int i=0; i<paramAmount; i++)
{
//std::cout << "saving parameter " << i << " to file\n";
//Log::info("UserConfig", "Saving parameter %d to file", i);
all_params[i].write(configfile);
}
@ -769,8 +765,8 @@ void UserConfig::saveConfig()
}
catch (std::runtime_error& e)
{
std::cerr << "[UserConfig::saveConfig] ERROR: Failed to write config to " << filename.c_str()
<< "; cause : " << e.what() << "\n";
Log::error("UserConfig::saveConfig", "Failed to write config to %s, because %s",
filename.c_str(), e.what());
}
} // saveConfig

View File

@ -2279,7 +2279,7 @@ void IrrDriver::RTTProvider::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
node->setAnimationSpeed(0);
node->updateAbsolutePosition();
node->setScale( mesh_scale[n].toIrrVector() );
//std::cout << "(((( set frame " << model_frames[n] << " ))))\n";
//Log::info("RTTProvider::setupRTTScene", "Set frame %d", model_frames[n]);
}
}

View File

@ -80,7 +80,11 @@ int LODNode::getLevel()
if (camera == NULL)
return (int)m_detail.size() - 1;
AbstractKart* kart = camera->getKart();
const Vec3 &pos = kart->getFrontXYZ();
// use kart position and not camera position when a kart is available,
// because for some effects the camera will be moved to various locations
// (for instance shadows), so using camera position for LOD may result
// in objects being culled when they shouldn't
const Vec3 &pos = (kart != NULL ? kart->getFrontXYZ() : camera->getCameraSceneNode()->getAbsolutePosition());
const int dist =
(int)((m_nodes[0]->getAbsolutePosition()).getDistanceFromSQ(pos.toIrrVector() ));

View File

@ -57,8 +57,7 @@ Material::Material(const XMLNode *node, bool deprecated)
m_shader_type = SHADERTYPE_SOLID;
m_deprecated = deprecated;
node->get("name", &m_texname);
node->get("name", &m_texname);
if (m_texname=="")
{
throw std::runtime_error("[Material] No texture name specified "
@ -66,6 +65,7 @@ Material::Material(const XMLNode *node, bool deprecated)
}
init();
node->get("lazy-load", &m_lazy_load);
bool b = false;
node->get("clampu", &b); if (b) m_clamp_tex |= UCLAMP; //blender 2.4 style
@ -412,10 +412,10 @@ Material::Material(const std::string& fname, bool is_full_path,
*/
void Material::init()
{
m_lazy_load = false;
m_texture = NULL;
m_clamp_tex = 0;
m_shader_type = SHADERTYPE_SOLID;
//m_lightmap = false;
//m_adjust_image = ADJ_NONE;
m_backface_culling = true;
m_high_tire_adhesion = false;
m_below_surface = false;
@ -455,6 +455,9 @@ void Material::init()
//-----------------------------------------------------------------------------
void Material::install(bool is_full_path, bool complain_if_not_found)
{
// Don't load a texture that is lazily loaded.
if(m_lazy_load) return;
const std::string &full_path = is_full_path
? m_texname
: file_manager->searchTexture(m_texname);

View File

@ -22,13 +22,11 @@
#include "utils/no_copy.hpp"
#include <assert.h>
#include <map>
#include <string>
#include <vector>
#include <IShaderConstantSetCallBack.h>
namespace irr
{
namespace video { class ITexture; class SMaterial; }
@ -81,9 +79,18 @@ public:
private:
/** Pointer to the texture. */
video::ITexture *m_texture;
//unsigned int m_index;
/** Name of the texture. */
std::string m_texname;
/** If true, the texture will not automatically be loaded and bound
* at load time, it must be loaded elsewhere. This is used to store
* material settings for font textures, without loading fonts for
* languages that might not be needed at all. */
bool m_lazy_load;
/** Name of a special sfx to play when a kart is on this terrain, or
* "" if no special sfx exists. */
std::string m_sfx_name;
@ -114,7 +121,7 @@ private:
/** If a kart is rescued when driving on this surface. */
bool m_drive_reset;
/** True if this is a texture that will start the jump animatoin when
/** True if this is a texture that will start the jump animation when
* leaving it and being in the air. */
bool m_is_jump_texture;
@ -244,27 +251,45 @@ public:
void setSFXSpeed(SFXBase *sfx, float speed, bool should_be_paused) const;
void setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* mb);
void adjustForFog(scene::ISceneNode* parent, video::SMaterial *m, bool use_fog) const;
void adjustForFog(scene::ISceneNode* parent, video::SMaterial *m,
bool use_fog) const;
void onMadeVisible(scene::IMeshBuffer* who);
void onHidden(scene::IMeshBuffer* who);
void isInitiallyHidden(scene::IMeshBuffer* who);
/** Returns the ITexture associated with this material. */
video::ITexture *getTexture() const { return m_texture; }
video::ITexture *getTexture() const
{
// Note that atm lazy load means that the textures are not loaded
// via the material. So getTexture should only get called for non
// lazily loaded textures (used atm for font textures.
assert(!m_lazy_load);
return m_texture;
} // getTexture
// ------------------------------------------------------------------------
bool isIgnore () const { return m_ignore; }
// ------------------------------------------------------------------------
/** Returns true if this material is a zipper. */
bool isZipper () const { return m_zipper; }
// ------------------------------------------------------------------------
/** Returns if this material should trigger a rescue if a kart
* is driving on it. */
bool isDriveReset () const { return m_drive_reset; }
// ------------------------------------------------------------------------
/** Returns if this material should trigger a rescue if a kart
* crashes against it. */
CollisionReaction getCollisionReaction() const { return m_collision_reaction; }
// ------------------------------------------------------------------------
std::string getCrashResetParticles() const { return m_collision_particles; }
// ------------------------------------------------------------------------
bool highTireAdhesion () const { return m_high_tire_adhesion; }
// ------------------------------------------------------------------------
const std::string&
getTexFname () const { return m_texname; }
//int getIndex () const { return m_index; }
// ------------------------------------------------------------------------
bool isTransparent () const
{
return m_shader_type == SHADERTYPE_ADDITIVE ||
@ -272,12 +297,6 @@ public:
m_shader_type == SHADERTYPE_ALPHA_TEST;
}
// ------------------------------------------------------------------------
/** Returns true if this materials need pre-multiply of alpha. */
//bool isPreMul() const {return m_adjust_image==ADJ_PREMUL; }
// ------------------------------------------------------------------------
/** Returns true if this materials need pre-division of alpha. */
//bool isPreDiv() const {return m_adjust_image==ADJ_DIV; }
// ------------------------------------------------------------------------
/** Returns the fraction of maximum speed on this material. */
float getMaxSpeedFraction() const { return m_max_speed_fraction; }
@ -300,17 +319,20 @@ public:
// ------------------------------------------------------------------------
/** Returns the name of a special sfx to play while a kart is on this
* terrain. The string will be "" if no special sfx exists. */
const std::string &
getSFXName () const { return m_sfx_name; }
const std::string &getSFXName() const { return m_sfx_name; }
// ------------------------------------------------------------------------
/** Returns if fog is enabled. */
bool isFogEnabled() const { return m_fog; }
/**
* \brief Get the kind of particles that are to be used on this material, in the given conditions
* \return The particles to use, or NULL if none
*/
const ParticleKind* getParticlesWhen(ParticleConditions cond) const { return m_particles_effects[cond]; }
// ------------------------------------------------------------------------
/** \brief Get the kind of particles that are to be used on this material,
* in the given conditions.
* \return The particles to use, or NULL if none. */
const ParticleKind* getParticlesWhen(ParticleConditions cond) const
{
return m_particles_effects[cond];
} // getParticlesWhen
// ------------------------------------------------------------------------
/** Returns true if a kart falling over this kind of material triggers
* the special falling camera. */
@ -346,9 +368,6 @@ public:
// ------------------------------------------------------------------------
ShaderType getShaderType() const { return m_shader_type; }
// ------------------------------------------------------------------------
void onMadeVisible(scene::IMeshBuffer* who);
void onHidden(scene::IMeshBuffer* who);
void isInitiallyHidden(scene::IMeshBuffer* who);
} ;

View File

@ -221,19 +221,19 @@ void renderBloom(GLuint in)
DrawFullScreenEffect<FullScreenShader::BloomShader>();
}
void PostProcessing::renderDiffuseEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff)
void PostProcessing::renderEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff, GLuint skybox)
{
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE);
glUseProgram(FullScreenShader::DiffuseEnvMapShader::getInstance()->Program);
glUseProgram(FullScreenShader::EnvMapShader::getInstance()->Program);
glBindVertexArray(SharedObject::FullScreenQuadVAO);
FullScreenShader::DiffuseEnvMapShader::getInstance()->SetTextureUnits(createVector<GLuint>(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH)));
FullScreenShader::EnvMapShader::getInstance()->SetTextureUnits(createVector<GLuint>(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture(), skybox));
core::matrix4 TVM = irr_driver->getViewMatrix().getTransposed();
FullScreenShader::DiffuseEnvMapShader::getInstance()->setUniforms(TVM, std::vector<float>(bSHCoeff, bSHCoeff + 9), std::vector<float>(gSHCoeff, gSHCoeff + 9), std::vector<float>(rSHCoeff, rSHCoeff + 9));
FullScreenShader::EnvMapShader::getInstance()->setUniforms(TVM, std::vector<float>(bSHCoeff, bSHCoeff + 9), std::vector<float>(gSHCoeff, gSHCoeff + 9), std::vector<float>(rSHCoeff, rSHCoeff + 9));
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);
@ -662,7 +662,8 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
// Blend
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glBlendColor(0., 0., 0., track->getGodRaysOpacity());
glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE);
glBlendEquation(GL_FUNC_ADD);
in_fbo->Bind();

View File

@ -81,7 +81,7 @@ public:
void renderFog();
void renderSSAO();
void renderDiffuseEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff);
void renderEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff, unsigned skycubemap);
void renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB, const core::matrix4 &rh_matrix, const core::vector3df &rh_extend);
void renderGI(const core::matrix4 &RHMatrix, const core::vector3df &rh_extend, unsigned shr, unsigned shg, unsigned shb);

View File

@ -75,7 +75,7 @@ struct DefaultMaterial
};
const std::vector<size_t> DefaultMaterial::FirstPassTextures = { 1 };
const std::vector<size_t> DefaultMaterial::SecondPassTextures = { 0 };
const std::vector<size_t> DefaultMaterial::SecondPassTextures = { 0, 1 };
struct AlphaRef
{
@ -93,7 +93,7 @@ struct AlphaRef
};
const std::vector<size_t> AlphaRef::FirstPassTextures = { 0, 1 };
const std::vector<size_t> AlphaRef::SecondPassTextures = { 0 };
const std::vector<size_t> AlphaRef::SecondPassTextures = { 0, 1 };
struct SphereMap
{
@ -146,8 +146,8 @@ struct GrassMat
static const std::vector<size_t> SecondPassTextures;
};
const std::vector<size_t> GrassMat::FirstPassTextures = { 0 };
const std::vector<size_t> GrassMat::SecondPassTextures = { 0 };
const std::vector<size_t> GrassMat::FirstPassTextures = { 0, 1 };
const std::vector<size_t> GrassMat::SecondPassTextures = { 0, 1 };
struct NormalMat
{
@ -165,7 +165,7 @@ struct NormalMat
};
const std::vector<size_t> NormalMat::FirstPassTextures = { 2, 1 };
const std::vector<size_t> NormalMat::SecondPassTextures = { 0 };
const std::vector<size_t> NormalMat::SecondPassTextures = { 0, 1 };
struct DetailMat
{
@ -183,7 +183,7 @@ struct DetailMat
};
const std::vector<size_t> DetailMat::FirstPassTextures = { 1 };
const std::vector<size_t> DetailMat::SecondPassTextures = { 0, 2 };
const std::vector<size_t> DetailMat::SecondPassTextures = { 0, 2, 1 };
struct SplattingMat
{
@ -531,15 +531,15 @@ void IrrDriver::renderSolidSecondPass()
if (UserConfigParams::m_azdo)
{
multidraw2ndPass<DefaultMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
multidraw2ndPass<AlphaRef>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
multidraw2ndPass<DefaultMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
multidraw2ndPass<AlphaRef>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
multidraw2ndPass<SphereMap>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
multidraw2ndPass<UnlitMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
multidraw2ndPass<GrassMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, DepthHandle, 0), windDir, cb->getPosition());
multidraw2ndPass<GrassMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, DepthHandle, 0, 0), windDir, cb->getPosition());
multidraw2ndPass<NormalMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
multidraw2ndPass<DetailMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
multidraw2ndPass<NormalMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
multidraw2ndPass<DetailMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0, 0));
}
else if (irr_driver->hasARB_draw_indirect())
{

View File

@ -9,6 +9,7 @@
#include "modes/world.hpp"
#include "tracks/track.hpp"
#include "utils/profiler.hpp"
#include "callbacks.hpp"
#define MAX2(a, b) ((a) > (b) ? (a) : (b))
#define MIN2(a, b) ((a) > (b) ? (b) : (a))
@ -114,6 +115,7 @@ 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);
@ -121,7 +123,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
createVector<GLuint>(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);
FullScreenShader::NVWorkaroundRadianceHintsConstructionShader::getInstance()->setUniforms(rsm_matrix, rh_matrix, rh_extend, i, video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
@ -135,7 +137,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
m_rtts->getRSM().getDepthTexture()
)
);
FullScreenShader::RadianceHintsConstructionShader::getInstance()->setUniforms(rsm_matrix, rh_matrix, rh_extend);
FullScreenShader::RadianceHintsConstructionShader::getInstance()->setUniforms(rsm_matrix, rh_matrix, rh_extend, video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, 32);
}
}
@ -152,13 +154,13 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2]);
}
m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).Bind();
{
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_ENVMAP));
m_post_processing->renderDiffuseEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff);
m_post_processing->renderEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff, SkyboxCubeMap);
}
m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).Bind();
// Render sunlight if and only if track supports shadow
if (!World::getWorld() || World::getWorld()->getTrack()->hasShadows())
{

View File

@ -787,7 +787,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass1.frag").c_str());
AssignUniforms("ModelMatrix", "InverseModelMatrix", "windDir");
AssignSamplerNames(Program, 0, "tex");
AssignSamplerNames(Program, 0, "tex", 1, "glosstex");
}
NormalMapShader::NormalMapShader()
@ -832,7 +832,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_objectref_pass1.frag").c_str());
AssignUniforms("windDir");
AssignSamplerNames(Program, 0, "tex");
AssignSamplerNames(Program, 0, "tex", 1, "glosstex");
}
InstancedNormalMapShader::InstancedNormalMapShader()
@ -854,7 +854,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_pass2.frag").c_str());
AssignUniforms("ModelMatrix", "TextureMatrix");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "SpecMap");
}
InstancedObjectPass2Shader::InstancedObjectPass2Shader()
@ -865,7 +865,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_object_pass2.frag").c_str());
AssignUniforms();
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "SpecMap");
}
InstancedObjectRefPass2Shader::InstancedObjectRefPass2Shader()
@ -876,7 +876,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_objectref_pass2.frag").c_str());
AssignUniforms();
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "SpecMap");
}
DetailledObjectPass2Shader::DetailledObjectPass2Shader()
@ -886,7 +886,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/detailledobject_pass2.frag").c_str());
AssignUniforms("ModelMatrix");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "Detail");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "Detail", 5, "SpecMap");
}
InstancedDetailledObjectPass2Shader::InstancedDetailledObjectPass2Shader()
@ -897,7 +897,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_detailledobject_pass2.frag").c_str());
AssignUniforms();
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "Detail");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "Detail", 5, "SpecMap");
}
ObjectUnlitShader::ObjectUnlitShader()
@ -926,7 +926,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass2.frag").c_str());
AssignUniforms("ModelMatrix", "TextureMatrix");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "SpecMap");
}
GrassPass2Shader::GrassPass2Shader()
@ -936,7 +936,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/grass_pass2.frag").c_str());
AssignUniforms("ModelMatrix", "windDir");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "SpecMap");
}
InstancedGrassPass2Shader::InstancedGrassPass2Shader()
@ -947,7 +947,7 @@ namespace MeshShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_grass_pass2.frag").c_str());
AssignUniforms("windDir", "SunDir");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "dtex", 4, "Albedo");
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "dtex", 4, "Albedo", 5, "SpecMap");
}
SphereMapShader::SphereMapShader()
@ -1455,14 +1455,15 @@ namespace FullScreenShader
AssignUniforms("direction", "col");
}
DiffuseEnvMapShader::DiffuseEnvMapShader()
EnvMapShader::EnvMapShader()
{
Program = LoadProgram(OBJECT,
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/decodeNormal.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/diffuseenvmap.frag").c_str());
AssignUniforms("TransposeViewMatrix", "blueLmn[0]", "greenLmn[0]", "redLmn[0]");
AssignSamplerNames(Program, 0, "ntex");
AssignSamplerNames(Program, 0, "ntex", 1, "dtex", 2, "tex");
}
ShadowedSunLightShader::ShadowedSunLightShader()
@ -1495,7 +1496,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/rh.frag").c_str());
}
AssignUniforms("RSMMatrix", "RHMatrix", "extents");
AssignUniforms("RSMMatrix", "RHMatrix", "extents", "suncol");
AssignSamplerNames(Program, 0, "ctex", 1, "ntex", 2, "dtex");
}
@ -1506,7 +1507,7 @@ namespace FullScreenShader
GL_GEOMETRY_SHADER, file_manager->getAsset("shaders/rhpassthrough.geom").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/rh.frag").c_str());
AssignUniforms("RSMMatrix", "RHMatrix", "extents", "slice");
AssignUniforms("RSMMatrix", "RHMatrix", "extents", "slice", "suncol");
AssignSamplerNames(Program, 0, "ctex", 1, "ntex", 2, "dtex");
}

View File

@ -65,7 +65,7 @@ public:
ObjectRefPass1Shader();
};
class GrassPass1Shader : public ShaderHelperSingleton<GrassPass1Shader, core::matrix4, core::matrix4, core::vector3df>, public TextureRead<Trilinear_Anisotropic_Filtered>
class GrassPass1Shader : public ShaderHelperSingleton<GrassPass1Shader, core::matrix4, core::matrix4, core::vector3df>, public TextureRead<Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
GrassPass1Shader();
@ -89,7 +89,7 @@ public:
InstancedObjectRefPass1Shader();
};
class InstancedGrassPass1Shader : public ShaderHelperSingleton<InstancedGrassPass1Shader, core::vector3df>, public TextureRead<Trilinear_Anisotropic_Filtered>
class InstancedGrassPass1Shader : public ShaderHelperSingleton<InstancedGrassPass1Shader, core::vector3df>, public TextureRead<Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
InstancedGrassPass1Shader();
@ -101,31 +101,31 @@ public:
InstancedNormalMapShader();
};
class ObjectPass2Shader : public ShaderHelperSingleton<ObjectPass2Shader, core::matrix4, core::matrix4>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered>
class ObjectPass2Shader : public ShaderHelperSingleton<ObjectPass2Shader, core::matrix4, core::matrix4>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
ObjectPass2Shader();
};
class InstancedObjectPass2Shader : public ShaderHelperSingleton<InstancedObjectPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered>
class InstancedObjectPass2Shader : public ShaderHelperSingleton<InstancedObjectPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
InstancedObjectPass2Shader();
};
class InstancedObjectRefPass2Shader : public ShaderHelperSingleton<InstancedObjectRefPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered>
class InstancedObjectRefPass2Shader : public ShaderHelperSingleton<InstancedObjectRefPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
InstancedObjectRefPass2Shader();
};
class DetailledObjectPass2Shader : public ShaderHelperSingleton<DetailledObjectPass2Shader, core::matrix4>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
class DetailledObjectPass2Shader : public ShaderHelperSingleton<DetailledObjectPass2Shader, core::matrix4>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
DetailledObjectPass2Shader();
};
class InstancedDetailledObjectPass2Shader : public ShaderHelperSingleton<InstancedDetailledObjectPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
class InstancedDetailledObjectPass2Shader : public ShaderHelperSingleton<InstancedDetailledObjectPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
InstancedDetailledObjectPass2Shader();
@ -143,19 +143,19 @@ public:
InstancedObjectUnlitShader();
};
class ObjectRefPass2Shader : public ShaderHelperSingleton<ObjectRefPass2Shader, core::matrix4, core::matrix4>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered>
class ObjectRefPass2Shader : public ShaderHelperSingleton<ObjectRefPass2Shader, core::matrix4, core::matrix4>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
ObjectRefPass2Shader();
};
class GrassPass2Shader : public ShaderHelperSingleton<GrassPass2Shader, core::matrix4, core::vector3df>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered>
class GrassPass2Shader : public ShaderHelperSingleton<GrassPass2Shader, core::matrix4, core::vector3df>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
GrassPass2Shader();
};
class InstancedGrassPass2Shader : public ShaderHelperSingleton<InstancedGrassPass2Shader, core::vector3df, core::vector3df>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Nearest_Filtered, Trilinear_Anisotropic_Filtered>
class InstancedGrassPass2Shader : public ShaderHelperSingleton<InstancedGrassPass2Shader, core::vector3df, core::vector3df>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Nearest_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
{
public:
InstancedGrassPass2Shader();
@ -395,10 +395,10 @@ public:
SunLightShader();
};
class DiffuseEnvMapShader : public ShaderHelperSingleton<DiffuseEnvMapShader, core::matrix4, std::vector<float>, std::vector<float>, std::vector<float> >, public TextureRead<Nearest_Filtered>
class EnvMapShader : public ShaderHelperSingleton<EnvMapShader, core::matrix4, std::vector<float>, std::vector<float>, std::vector<float> >, public TextureRead<Nearest_Filtered, Nearest_Filtered, Trilinear_cubemap>
{
public:
DiffuseEnvMapShader();
EnvMapShader();
};
class ShadowedSunLightShader : public ShaderHelperSingleton<ShadowedSunLightShader, core::vector3df, video::SColorf>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Shadow_Sampler>
@ -407,14 +407,14 @@ public:
ShadowedSunLightShader();
};
class RadianceHintsConstructionShader : public ShaderHelperSingleton<RadianceHintsConstructionShader, core::matrix4, core::matrix4, core::vector3df>, public TextureRead<Bilinear_Filtered, Bilinear_Filtered, Bilinear_Filtered>
class RadianceHintsConstructionShader : public ShaderHelperSingleton<RadianceHintsConstructionShader, core::matrix4, core::matrix4, core::vector3df, video::SColorf>, public TextureRead<Bilinear_Filtered, Bilinear_Filtered, Bilinear_Filtered>
{
public:
RadianceHintsConstructionShader();
};
// Workaround for a bug found in kepler nvidia linux and fermi nvidia windows
class NVWorkaroundRadianceHintsConstructionShader : public ShaderHelperSingleton<NVWorkaroundRadianceHintsConstructionShader, core::matrix4, core::matrix4, core::vector3df, int>, public TextureRead<Bilinear_Filtered, Bilinear_Filtered, Bilinear_Filtered>
class NVWorkaroundRadianceHintsConstructionShader : public ShaderHelperSingleton<NVWorkaroundRadianceHintsConstructionShader, core::matrix4, core::matrix4, core::vector3df, int, video::SColorf>, public TextureRead<Bilinear_Filtered, Bilinear_Filtered, Bilinear_Filtered>
{
public:
NVWorkaroundRadianceHintsConstructionShader();

View File

@ -325,7 +325,8 @@ void STKMeshSceneNode::render()
irr_driver->getRenderTargetTexture(RTT_DIFFUSE),
irr_driver->getRenderTargetTexture(RTT_SPECULAR),
irr_driver->getRenderTargetTexture(RTT_HALF1_R),
getTextureGLuint(mesh.textures[0])));
getTextureGLuint(mesh.textures[0]),
getTextureGLuint(mesh.textures[1])));
MeshShader::ObjectPass2Shader::getInstance()->setUniforms(AbsoluteTransformation, mesh.TextureMatrix);
assert(mesh.vao);
glBindVertexArray(mesh.vao);

View File

@ -167,7 +167,7 @@ bool isBoxInFrontOfPlane(const core::plane3df &plane, const core::vector3df edge
}
static
bool isCulledPrecise(const scene::ICameraSceneNode *cam, const scene::ISceneNode *node, bool aera_check)
bool isCulledPrecise(const scene::ICameraSceneNode *cam, const scene::ISceneNode *node)
{
if (!node->getAutomaticCulling())
return false;
@ -183,10 +183,6 @@ bool isCulledPrecise(const scene::ICameraSceneNode *cam, const scene::ISceneNode
for (s32 i = 0; i < scene::SViewFrustum::VF_PLANE_COUNT; ++i)
if (isBoxInFrontOfPlane(frust.planes[i], edges))
return true;
float ratio = cam->getProjectionMatrix().pointer()[0] * cam->getProjectionMatrix().pointer()[5];
if (aera_check && node->getBoundingBox().getArea() * ratio < 1.)
return true;
return false;
}
@ -439,14 +435,14 @@ parseSceneManager(core::list<scene::ISceneNode*> List, std::vector<scene::IScene
if (ParticleSystemProxy *node = dynamic_cast<ParticleSystemProxy *>(*I))
{
if (!isCulledPrecise(cam, *I, false))
if (!isCulledPrecise(cam, *I))
ParticlesList::getInstance()->push_back(node);
continue;
}
if (STKBillboard *node = dynamic_cast<STKBillboard *>(*I))
{
if (!isCulledPrecise(cam, *I, false))
if (!isCulledPrecise(cam, *I))
BillBoardList::getInstance()->push_back(node);
continue;
}
@ -506,12 +502,12 @@ void IrrDriver::PrepareDrawCalls(scene::ICameraSceneNode *camnode)
for (int i = 0; i < (int)DeferredUpdate.size(); i++)
{
scene::ISceneNode *node = dynamic_cast<scene::ISceneNode *>(DeferredUpdate[i]);
DeferredUpdate[i]->setCulledForPlayerCam(isCulledPrecise(camnode, node, false));
DeferredUpdate[i]->setCulledForRSMCam(isCulledPrecise(m_suncam, node, true));
DeferredUpdate[i]->setCulledForShadowCam(0, isCulledPrecise(m_shadow_camnodes[0], node, true));
DeferredUpdate[i]->setCulledForShadowCam(1, isCulledPrecise(m_shadow_camnodes[1], node, true));
DeferredUpdate[i]->setCulledForShadowCam(2, isCulledPrecise(m_shadow_camnodes[2], node, true));
DeferredUpdate[i]->setCulledForShadowCam(3, isCulledPrecise(m_shadow_camnodes[3], node, true));
DeferredUpdate[i]->setCulledForPlayerCam(isCulledPrecise(camnode, node));
DeferredUpdate[i]->setCulledForRSMCam(isCulledPrecise(m_suncam, node));
DeferredUpdate[i]->setCulledForShadowCam(0, isCulledPrecise(m_shadow_camnodes[0], node));
DeferredUpdate[i]->setCulledForShadowCam(1, isCulledPrecise(m_shadow_camnodes[1], node));
DeferredUpdate[i]->setCulledForShadowCam(2, isCulledPrecise(m_shadow_camnodes[2], node));
DeferredUpdate[i]->setCulledForShadowCam(3, isCulledPrecise(m_shadow_camnodes[3], node));
}
// Add a 1 s timeout

View File

@ -93,8 +93,8 @@ void AbstractStateManager::pushMenu(std::string name)
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::pushMenu] switching to screen "
<< name.c_str() << std::endl;
Log::info("AbstractStateManager::pushMenu", "Switching to screen %s",
name.c_str());
}
// Send tear-down event to previous menu
@ -125,8 +125,8 @@ void AbstractStateManager::pushScreen(Screen* screen)
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::pushScreen] switching to screen "
<< screen->getName().c_str() << std::endl;
Log::info("AbstractStateManager::pushScreen", "Switching to screen %s",
screen->getName().c_str());
}
if (!screen->isLoaded()) screen->loadFromFile();
@ -152,8 +152,8 @@ void AbstractStateManager::replaceTopMostScreen(Screen* screen, GUIEngine::GameS
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::replaceTopmostScreen] "
"switching to screen " << name.c_str() << std::endl;
Log::info("AbstractStateManager::replaceTopMostScreen", "Switching to screen %s",
name.c_str());
}
assert(m_menu_stack.size() > 0);
@ -215,8 +215,8 @@ void AbstractStateManager::popMenu()
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::popMenu] switching to screen "
<< m_menu_stack[m_menu_stack.size()-1].c_str() << std::endl;
Log::info("AbstractStateManager::popMenu", "Switching to screen %s",
m_menu_stack[m_menu_stack.size()-1].c_str());
}
if (m_menu_stack[m_menu_stack.size()-1] == RACE_STATE_NAME)
@ -247,10 +247,8 @@ void AbstractStateManager::resetAndGoToScreen(Screen* screen)
std::string name = screen->getName();
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::resetAndGoToScreen] "
"switching to screen " << name.c_str() << std::endl;
}
Log::info("AbstractStateManager::resetAndGoToScreen", "Switching to screen %s",
name.c_str());
if (m_game_mode != GAME) getCurrentScreen()->tearDown();
m_menu_stack.clear();

View File

@ -167,6 +167,10 @@ namespace GUIEngine
virtual void onTopMostScreenChanged() = 0;
// --------------------------------------------------------------------
/** Returns the number of screens on the stack. Is used to decide
* if exiting a screen would cause STK to end or not. */
unsigned int getMenuStackSize() const { return m_menu_stack.size(); }
}; // Class AbstractStateManager
} // GUIEngine

View File

@ -72,18 +72,16 @@ void AbstractTopLevelContainer::addWidgetsRecursively(
widgets[n].getType() != WTYPE_ICON_BUTTON &&
widgets[n].getType() != WTYPE_SPACER)
{
std::cerr << "/!\\ Warning /!\\ : widget "
<< widgets[n].m_properties[PROP_ID].c_str()
<< " of type " << widgets[n].getType()
<< " has no dimensions" << std::endl;
Log::warn("AbstractTopLevelContainer::addWidgetsRecursively",
"Widget %s of type %d has no dimensions",
widgets[n].m_properties[PROP_ID].c_str(), widgets[n].getType());
}
if (widgets[n].m_x == -1 || widgets[n].m_y == -1)
{
std::cerr << "/!\\ Warning /!\\ : widget "
<< widgets[n].m_properties[PROP_ID].c_str()
<< " of type " << widgets[n].getType()
<< " has no position" << std::endl;
Log::warn("AbstractTopLevelContainer::addWidgetsRecursively",
"Widget %s of type %d has no position",
widgets[n].m_properties[PROP_ID].c_str(), widgets[n].getType());
}
widgets[n].add();
@ -197,10 +195,8 @@ Widget* AbstractTopLevelContainer::getWidget(const int id,
if (widget.searchInsideMe() && widget.getChildren().size() > 0)
{
// std::cout << "widget = <"
// << widget.m_properties[PROP_ID].c_str()
// << "> widget.m_children.size()="
// << widget.m_children.size() << std::endl;
//Log::info("AbstractTopLevelContainer", "widget = <%s> widget.m_children.size() = ",
// widget.m_properties[PROP_ID].c_str(), widget.m_children.size());
Widget* el = getWidget(id, &(widget.m_children));
if(el != NULL) return el;
}

View File

@ -1019,12 +1019,10 @@ namespace GUIEngine
g_skin->drop(); // GUI env grabbed it
assert(g_skin->getReferenceCount() == 1);
}
catch (std::runtime_error& err)
catch (std::runtime_error& /*err*/)
{
(void)err; // avoid warning about unused variable
std::cerr <<
"ERROR, cannot load skin specified in user config. Falling "
"back to defaults.\n";
Log::error("Engine::init", "Cannot load skin specified in user config. "
"Falling back to defaults.");
UserConfigParams::m_skin_file.revertToDefaults();
try
@ -1036,8 +1034,7 @@ namespace GUIEngine
}
catch (std::runtime_error& err)
{
std::cerr << "FATAL, cannot load default GUI skin\n";
throw err;
Log::fatal("Engine::init", "Canot load default GUI skin");
}
}
@ -1135,10 +1132,9 @@ namespace GUIEngine
// one so that the fallback skin is not dropped
newSkin = new Skin(fallbackSkin);
}
catch (std::runtime_error& err)
catch (std::runtime_error& /*err*/)
{
(void)err; // avoid warning about unused variable
std::cerr << "ERROR, cannot load newly specified skin!\n";
Log::error("Engine::reloadSkin", "Canot load newly specified skin");
return;
}
@ -1369,8 +1365,8 @@ namespace GUIEngine
}
else
{
std::cerr << "WARNING: GUIEngine::addLoadingIcon given "
"NULL icon\n";
Log::warn("Engine::addLoadingIcon", "Given "
"NULL icon");
}
} // addLoadingIcon

View File

@ -199,7 +199,7 @@ bool EventHandler::OnEvent (const SEvent &event)
// mode ignore this error message, but leave it in for debugging.
if(std::string(event.LogEvent.Text)=="Unsupported texture format")
#ifdef DEBUG
printf("The following message will not be printed in release mode:\n");
Log::info("EventHandler", "The following message will not be printed in release mode");
#else
return true; // EVENT_BLOCK
#endif
@ -414,7 +414,7 @@ void EventHandler::navigate(const int playerID, Input::InputType type, const boo
if (el == NULL)
{
std::cerr << "WARNING : m_tab_down/up_root is set to an ID for which I can't find the widget\n";
Log::warn("EventHandler::navigate", "m_tab_down/up_root is set to an ID for which I can't find the widget");
return;
}
}
@ -448,7 +448,7 @@ void EventHandler::navigate(const int playerID, Input::InputType type, const boo
if (NAVIGATION_DEBUG)
{
std::cout << "Navigating " << (reverse ? "up" : "down") << " to " << closest->getID() << std::endl;
Log::info("EventHandler", "Navigating %s to %d", (reverse ? "up" : "down"), closest->getID());
}
assert(closestWidget != NULL);
@ -474,7 +474,7 @@ void EventHandler::navigate(const int playerID, Input::InputType type, const boo
if (!found)
{
if (NAVIGATION_DEBUG)
std::cout << "EventHandler::navigat : wrap around\n";
Log::info( "EventHandler::navigate", "Wrap around");
// select the last/first widget
Widget* wrapWidget = NULL;
@ -529,7 +529,7 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int
if (w->m_event_handler == NULL) return EVENT_LET;
}
//std::cout << "**** widget activated : " << w->m_properties[PROP_ID].c_str() << " ****" << std::endl;
//Log::info("EventHandler", "Widget activated: %s", w->m_properties[PROP_ID].c_str());
if (w->m_event_handler != NULL)
{

View File

@ -21,9 +21,6 @@
#include <IGUIFont.h>
#include <ITexture.h>
using namespace irr;
using namespace gui;
using namespace video;
#include "graphics/irr_driver.hpp"
#include "guiengine/abstract_top_level_container.hpp"
@ -35,6 +32,9 @@ using namespace video;
#include "utils/string_utils.hpp"
#include "utils/vs.hpp"
using namespace irr;
using namespace gui;
using namespace video;
using namespace GUIEngine;
/** Like atoi, but on error prints an error message to stderr */
@ -420,7 +420,7 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
horizontal = false;
else
{
std::cerr << "Unknown layout name : " << layout_name.c_str() << std::endl;
Log::error("LayoutManager::doCalculateLayout", "Unknown layout name: %s", layout_name.c_str());
break;
}
@ -475,11 +475,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
int proportion = 1;
std::istringstream myStream(prop);
if (!(myStream >> proportion))
{
std::cerr << "/!\\ Warning /!\\ : proportion '" << prop.c_str()
<< "' is not a number for widget " << widgets[n].m_properties[PROP_ID].c_str()
<< std::endl;
}
Log::warn("LayoutManager::doCalculateLayout",
"Proportion '%s' is not a number for widget %s", prop.c_str(),
widgets[n].m_properties[PROP_ID].c_str());
const float fraction = (float)proportion/(float)total_proportion;
@ -522,9 +520,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
else
{
std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
<< "' is unknown (widget '" << widgets[n].m_properties[PROP_ID].c_str()
<< "', in a horiozntal-row layout)\n";
Log::warn("LayoutManager::doCalculateLayout",
"Alignment '%s' is unknown (widget '%s', in a horiozntal-row layout)",
align.c_str(), widgets[n].m_properties[PROP_ID].c_str());
}
widgets[n].m_w = (int)(left_space*fraction);
@ -597,9 +595,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
else
{
std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
<< "' is unknown (widget '" << widgets[n].m_properties[PROP_ID].c_str()
<< "', in a vertical-row layout)\n";
Log::warn("LayoutManager::doCalculateLayout",
"Alignment '%s' is unknown (widget '%s', in a vertical-row layout)",
align.c_str(), widgets[n].m_properties[PROP_ID].c_str());
}
widgets[n].m_y = y;
@ -651,9 +649,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
else
{
std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
<< "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str()
<< std::endl;
Log::warn("LayoutManager::doCalculateLayout",
"Alignment '%s' is unknown in widget '%s'",
align.c_str(), widgets[n].m_properties[PROP_ID].c_str());
}
x += widgets[n].m_w;
@ -697,8 +695,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
else
{
std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
<< "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
Log::warn("LayoutManager::doCalculateLayout",
"Alignment '%s' is unknown in widget '%s'",
align.c_str(), widgets[n].m_properties[PROP_ID].c_str());
}
widgets[n].m_y = y;

View File

@ -95,7 +95,7 @@ std::priority_queue<Message*, std::vector<Message*>,
float g_current_display_time = -1.0f;
/** How long the current message should be displaed. */
float g_max_display_time = -1.0f;
float g_max_display_time = 5.0f;
/** The label widget used to show the current message. */
SkinWidgetContainer *g_container = NULL;

View File

@ -101,7 +101,7 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
/*
const wchar_t* iflangis = xml->getAttributeValue(L"iflanguage");
printf("langcode = %s\n", translations->getCurrentLanguageCode().c_str());
Log::info("ScalableFont", "langcode = %s", translations->getCurrentLanguageCode().c_str());
if (iflangis != NULL &&
core::stringc(iflangis) != translations->getCurrentLanguageCode().c_str())
@ -128,8 +128,10 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
float scale=1.0f;
if(xml->getAttributeValue(L"scale"))
{
scale = xml->getAttributeValueAsFloat(L"scale");
//std::cout << "scale = " << scale << std::endl;
//Log::info("ScalableFont", "scale = %f", scale);
}
bool excludeFromMaxHeightCalculation = false;
if (xml->getAttributeValue(L"excludeFromMaxHeightCalculation"))
@ -137,7 +139,7 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
core::stringw alpha = xml->getAttributeValue(L"hasAlpha");
//std::cout << "---- Adding font texture " << fn.c_str() << "; alpha=" << alpha.c_str() << std::endl;
//Log::info("ScalableFont", "Adding font texture %s; alpha = %s", fn.c_str(), alpha.c_str());
// make sure the sprite bank has enough textures in it
@ -227,7 +229,7 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
CharacterMap[ch] = Areas.size();
//std::cout << "Inserting character '" << (int)ch << "' with area " << Areas.size() << std::endl;
//Log::info("ScalableFont", "Inserting character '%d' with area %d", (int)ch, Areas.size());
// make frame
f.rectNumber = SpriteBank->getPositions().size();
@ -366,18 +368,18 @@ s32 ScalableFont::getAreaIDFromCharacter(const wchar_t c, bool* fallback_font) c
if (n != CharacterMap.end())
{
if (fallback_font != NULL) *fallback_font = false;
// std::cout << "Character " << (int)c << " found in font\n";
//Log::info("ScalableFont", "Character %d found in font", (int)c);
return (*n).second;
}
else if (m_fallback_font != NULL && fallback_font != NULL)
{
// std::cout << "Font does not have this character : <" << (int)c << ">, trying fallback font" << std::endl;
//Log::warn("ScalableFont", "Font does not have this character: <%d>, try fallback font", (int)c);
*fallback_font = true;
return m_fallback_font->getAreaIDFromCharacter(c, NULL);
}
else
{
// std::cout << "The font does not have this character : <" << (int)c << ">" << std::endl;
//Log::warn("ScalableFont", "The font does not have this character: <%d>", (int)c);
if (fallback_font != NULL) *fallback_font = false;
return WrongCharacter;
}
@ -453,12 +455,12 @@ core::dimension2d<u32> ScalableFont::getDimension(const wchar_t* text) const
dim.Height += thisLine.Height;
if (dim.Width < thisLine.Width) dim.Width = thisLine.Width;
// std::cout << "ScalableFont::getDimension returns : " << dim.Width << ", " << dim.Height << " --> ";
//Log::info("ScalableFont", "ScalableFont::getDimension returns: %d, %d", dim.Width, dim.Height);
dim.Width = (int)(dim.Width + 0.9f); // round up
dim.Height = (int)(dim.Height + 0.9f);
//std::cout << dim.Width << ", " << dim.Height << std::endl;
//Log::info("ScalableFont", "After: %d, %d", dim.Width, dim.Height);
return dim;
}
@ -616,10 +618,9 @@ void ScalableFont::doDraw(const core::stringw& text,
/*
if (fallback[n])
{
std::cout << "USING fallback font " << core::stringc(texture->getName()).c_str()
<< "; source area is " << source.UpperLeftCorner.X << ", " << source.UpperLeftCorner.Y
<< ", size " << source.getWidth() << ", " << source.getHeight() << "; dest = "
<< offsets[n].X << ", " << offsets[n].Y << std::endl;
Log::info("ScalableFont", "Using fallback font %s; source area is %d, %d; size %d, %d; dest = %d, %d",
core::stringc(texture->getName()).c_str(), source.UpperLeftCorner.X, source.UpperLeftCorner.Y,
source.getWidth(), source.getHeight(), offsets[n].X, offsets[n].Y);
}
*/
@ -773,7 +774,7 @@ int ScalableFont::getCharWidth(const SFontArea& area, const bool fallback) const
assert(info.m_file_name.size() > 0);
const float char_scale = info.m_scale;
//std::cout << "area.spriteno=" << area.spriteno << ", char_scale=" << char_scale << std::endl;
//Log::info("ScalableFont", "area.spriteno = %d, char_scale = %f", area.spriteno, char_scale);
if (fallback) return (int)(((area.width + area.overhang)*m_fallback_font_scale + m_fallback_kerning_width) * m_scale * char_scale);
else return (int)((area.width + area.overhang + GlobalKerningWidth) * m_scale * char_scale);

View File

@ -187,11 +187,11 @@ void Screen::addWidgets()
addWidgetsRecursively( m_widgets );
//std::cout << "*****ScreenAddWidgets " << m_filename.c_str() << " : focusing the first widget*****\n";
//Log::info("Screen::AddWidgets", "%s: focusing the first widget", m_filename.c_str());
// select the first widget (for first players only; if other players need some focus the Screen must provide it).
Widget* w = getFirstWidget();
//std::cout << "First widget is " << (w == NULL ? "null" : w->m_properties[PROP_ID].c_str()) << std::endl;
//Log::info("Screen::AddWidgets", "First widget is %s", (w == NULL ? "null" : w->m_properties[PROP_ID].c_str()));
if (w != NULL) w->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
else Log::warn("Screen::AddWidgets", "Couldn't select first widget, NULL was returned");
} // addWidgets

View File

@ -181,8 +181,7 @@ void Screen::parseScreenFileDiv(irr::io::IXMLReader* xml, PtrVector<Widget>& app
}
else
{
std::cerr << "/!\\ Warning /!\\ : unknown tag found in STK GUI file : '"
<< xml->getNodeName() << "'" << std::endl;
Log::warn("Screen::parseScreenFileDiv", "unknown tag found in STK GUI file '%s'", xml->getNodeName());
continue;
}

View File

@ -36,6 +36,7 @@ DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row)
m_needed_cols = 0;
m_col_amount = 0;
m_previous_item_count = 0;
m_max_label_length = 0;
m_multi_row = multi_row;
m_combo = combo;
m_has_label = false;
@ -257,9 +258,9 @@ void DynamicRibbonWidget::add()
const float score = log(2.0f*visible_items) *
std::min(ratio, 1.0f) * std::min(taken_area/total_area, 1.0f);
//std::cout << " " << row_count << " rows : " << visible_items << " visible items; area = "
// << taken_area << "; size penalty = " << std::min((float)item_height / (float)m_child_height, 1.0f)
// << "; score = " << score << "\n";
//Log::info("DynamicRibbonWidget", "%d rown: %d visible items; area = %f; "
// "size penalty = %f; score = %f", row_count, visible_items, taken_area,
// std::min((float)item_height / (float)m_child_height, 1.0f), score);
if (score > max_score_so_far)
{
@ -275,8 +276,8 @@ void DynamicRibbonWidget::add()
const int max_rows = atoi(m_properties[PROP_MAX_ROWS].c_str());
if (max_rows < 1)
{
std::cout << "/!\\ WARNING : the 'max_rows' property must be an integer greater than zero."
<< " Ingoring current value '" << m_properties[PROP_MAX_ROWS] << "'\n";
Log::warn("DynamicRibbonWidget", "The 'max_rows' property must be an integer greater than zero; "
"Ignoring current value '%s'", m_properties[PROP_MAX_ROWS].c_str());
}
else
{
@ -299,7 +300,7 @@ void DynamicRibbonWidget::add()
for (int i=0; i<m_row_amount; i++)
{
m_ids[i] = getNewID();
//std::cout << "ribbon : getNewID returns " << m_ids[i] << std::endl;
//Log::info("DynamicRibbonWidget", "getNewID returns %d", m_ids[i]);
}
buildInternalStructure();
@ -333,11 +334,11 @@ void DynamicRibbonWidget::buildInternalStructure()
// ajust column amount to not add more item slots than we actually need
const int item_count = (int) m_items.size();
//std::cout << "item_count=" << item_count << ", row_amount*m_col_amount=" << m_row_amount*m_col_amount << std::endl;
//Log::info("DynamicRibbonWidget", "%d items; %d cells", item_count, row_amount * m_col_amount);
if (m_row_amount*m_col_amount > item_count)
{
m_col_amount = (int)ceil((float)item_count/(float)m_row_amount);
//std::cout << "Adjusting m_col_amount to be " << m_col_amount << std::endl;
//Log::info("DynamicRibbonWidget", "Adjusting m_col_amount to be %d", m_col_amount);
}
assert( m_left_widget->ok() );
@ -410,7 +411,7 @@ void DynamicRibbonWidget::buildInternalStructure()
// it will assume there is no label and none will be created (FIXME: that's ugly)
if (m_properties[PROP_LABELS_LOCATION] == "each") icon->m_text = " ";
// std::cout << "ribbon text = " << m_properties[PROP_TEXT].c_str() << std::endl;
//Log::info("DynamicRibbonWidget", "Ribbon text = %s", m_properties[PROP_TEXT].c_str());
ribbon->m_children.push_back( icon );
added_item_count++;
@ -611,12 +612,12 @@ EventPropagation DynamicRibbonWidget::rightPressed(const int playerID)
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
}
}
//std::cout << "rightpressed (dynamic ribbon) " << m_properties[PROP_ID] << "\n";
//Log::info("DynamicRibbonWidget", "Rightpressed %s", m_properties[PROP_ID].c_str());
assert(m_rows.size() >= 1);
if (m_rows[0].m_ribbon_type == RIBBON_TOOLBAR) return EVENT_BLOCK;
//std::cout << " rightpressed returning EVENT_LET\n";
//Log::info("DynamicRibbonWidget", "Rightpressed returning EVENT_LET");
return EVENT_LET;
}
@ -681,7 +682,7 @@ EventPropagation DynamicRibbonWidget::transmitEvent(Widget* w,
EventPropagation DynamicRibbonWidget::mouseHovered(Widget* child, const int playerID)
{
if (m_deactivated) return EVENT_LET;
//std::cout << "DynamicRibbonWidget::mouseHovered " << playerID << std::endl;
//Log::info("DynamicRibbonWidget", "mouseHovered %d", playerID);
updateLabel();
propagateSelection();
@ -1084,15 +1085,14 @@ bool DynamicRibbonWidget::setSelection(int item_id, const int playerID,
if (iterations > 50)
{
assert(false);
std::cerr << "DynamicRibbonWidget::setSelection cannot find item " << item_id << " (" << name.c_str() << ")\n";
Log::fatal("DynamicRibbonWidget::setSelection", "Cannot find item %d (%s)", item_id, name.c_str());
return false;
}
iterations++;
}
//std::cout << "Player " << playerID << " has item " << item_id << " (" << name.c_str() << ") in row " << row << std::endl;
//Log::info("DynamicRibbonWidget", "Player %d has item %d (%s) in row %d", playerID, item_id, name.c_str(), row);
m_rows[row].setSelection(id, playerID);
if (focusIt)
{
@ -1158,8 +1158,8 @@ float DynamicRibbonWidget::getFontScale(int icon_width) const
irr::core::stringw DynamicRibbonWidget::getUserName(const irr::core::stringw& user_name) const
{
if (user_name.size() < MAX_LABEL_LENGTH)
if (m_max_label_length == 0 || user_name.size() < m_max_label_length)
return user_name;
else
return (user_name.subString(0, MAX_LABEL_LENGTH - 3) + L"...");
return (user_name.subString(0, m_max_label_length - 3) + L"...");
}

View File

@ -187,7 +187,7 @@ namespace GUIEngine
int m_max_label_width;
/** Max length of a label, in characters */
static const int MAX_LABEL_LENGTH = 30;
unsigned int m_max_label_length;
public:
@ -298,6 +298,9 @@ namespace GUIEngine
/** Set approximately how many items are expected to be in this ribbon; will help the layout
* algorithm next time add() is called */
void setItemCountHint(int hint) { m_item_count_hint = hint; }
/** Set max length of displayed text. */
void setMaxLabelLength(int length) { m_max_label_length = length; }
};
}

View File

@ -190,6 +190,9 @@ void IconButtonWidget::add()
m_id = m_element->getID();
if (m_tab_stop) m_element->setTabOrder(m_id);
m_element->setTabGroup(false);
if (!m_is_visible)
m_element->setVisible(false);
}
// -----------------------------------------------------------------------------

View File

@ -136,8 +136,9 @@ void ModelViewWidget::update(float delta)
distance_with_negative_rotation = (int)(angle - m_rotation_target);
}
//std::cout << "distance_with_positive_rotation=" << distance_with_positive_rotation <<
//" distance_with_negative_rotation=" << distance_with_negative_rotation << " angle="<< angle <<std::endl;
//Log::info("ModelViewWidget", "distance_with_positive_rotation = %d; "
// "distance_with_negative_rotation = %d; angle = %f", distance_with_positive_rotation,
// distance_with_negative_rotation, angle);
if (distance_with_positive_rotation < distance_with_negative_rotation)
{
@ -242,7 +243,7 @@ void ModelViewWidget::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
node->setAnimationSpeed(0);
node->updateAbsolutePosition();
node->setScale(mesh_scale[n].toIrrVector());
//std::cout << "(((( set frame " << model_frames[n] << " ))))\n";
//Log::info("ModelViewWidget", "Set frame %d", model_frames[n]);
}
}

View File

@ -141,14 +141,8 @@ void RibbonWidget::add()
total_needed_space += m_active_children[i].m_w;
}
int free_w_space = m_w - total_needed_space;
//int biggest_y = 0;
const int button_y = 10;
float global_zoom = 1;
const int min_free_space = 50;
global_zoom = (float)m_w / (float)( m_w - free_w_space + min_free_space );
const int one_button_space =
int(roundf((float)m_w / (float)subbuttons_amount));
@ -320,22 +314,10 @@ void RibbonWidget::add()
float image_h = (float)image->getSize().Height;
float image_w = image_h*imageRatio;
// scale to fit (FIXME: calculate the right value directly...)
float zoom = global_zoom;
if (button_y + image_h*zoom + needed_space_under_button > m_h)
{
// scale down
while (button_y + image_h*zoom +
needed_space_under_button > m_h) zoom -= 0.01f;
}
else
{
// scale up
while (button_y + image_h*zoom +
needed_space_under_button < m_h) zoom += 0.01f;
}
float zoom = (float) (m_h - button_y - needed_space_under_button) / image_h;
float zoom_x = (float) one_button_space / image_w;
if(zoom_x < zoom)
zoom = zoom_x;
// ---- add bitmap button part
// backup and restore position in case the same object is added
@ -612,7 +594,7 @@ EventPropagation RibbonWidget::mouseHovered(Widget* child,
if (m_ribbon_type == RIBBON_COMBO || m_ribbon_type == RIBBON_TABS)
{
//std::cout << "SETTING m_mouse_focus\n";
//Log::info("RibbonWidget", "Setting m_mouse_focus");
m_mouse_focus = child;
}
@ -660,7 +642,6 @@ void RibbonWidget::updateSelection()
// FIXME: m_selection, m_selected, m_mouse_focus... what a mess...
//std::cout << "----\n";
// Update selection flags for mouse player
for (unsigned int p=0; p<MAX_PLAYER_COUNT; p++)
{

View File

@ -231,7 +231,7 @@ EventPropagation SpinnerWidget::rightPressed(const int playerID)
// if widget is deactivated, do nothing
if (m_deactivated) return EVENT_BLOCK;
//std::cout << "Right pressed\n";
//Log::info("SpinnerWidget", "Right pressed");
if (m_value+1 <= m_max)
{
setValue(m_value+1);
@ -253,7 +253,7 @@ EventPropagation SpinnerWidget::leftPressed(const int playerID)
// if widget is deactivated, do nothing
if (m_deactivated) return EVENT_BLOCK;
//std::cout << "Left pressed\n";
//Log::info("SpinnerWidget", "Left pressed");
if (m_value-1 >= m_min)
{
setValue(m_value-1);
@ -386,9 +386,7 @@ void SpinnerWidget::setValue(irr::core::stringw new_value)
}
}
std::cerr << "ERROR [SpinnerWidget::setValue] : cannot find element named '"
<< irr::core::stringc(new_value.c_str()).c_str() << "'\n";
assert(false);
Log::fatal("SpinnerWidget::setValue", "Cannot find element named '%s'", irr::core::stringc(new_value.c_str()).c_str());
}
// -----------------------------------------------------------------------------

View File

@ -145,9 +145,9 @@ void DeviceManager::setAssignMode(const PlayerAssignMode assignMode)
m_assign_mode = assignMode;
#if INPUT_MODE_DEBUG
if (assignMode == NO_ASSIGN) std::cout << "====== DeviceManager::setAssignMode(NO_ASSIGN) ======\n";
if (assignMode == ASSIGN) std::cout << "====== DeviceManager::setAssignMode(ASSIGN) ======\n";
if (assignMode == DETECT_NEW) std::cout << "====== DeviceManager::setAssignMode(DETECT_NEW) ======\n";
if (assignMode == NO_ASSIGN) Log::info("DeviceManager::setAssignMode(NO_ASSIGN)");
if (assignMode == ASSIGN) Log::info("DeviceManager::setAssignMode(ASSIGN)");
if (assignMode == DETECT_NEW) Log::info("DeviceManager::setAssignMode(DETECT_NEW)");
#endif
// when going back to no-assign mode, do some cleanup
@ -289,7 +289,7 @@ InputDevice* DeviceManager::mapKeyboardInput( int btnID, InputManager::InputDriv
{
const int keyboard_amount = m_keyboards.size();
//std::cout << "mapKeyboardInput " << btnID << " to " << keyboard_amount << " keyboards\n";
//Log::info("DeviceManager::mapKeyboardInput", "Map %d to %d", btnID, keyboard_amount);
for (int n=0; n<keyboard_amount; n++)
{
@ -297,10 +297,10 @@ InputDevice* DeviceManager::mapKeyboardInput( int btnID, InputManager::InputDriv
if (keyboard->processAndMapInput(btnID, mode, action))
{
//std::cout << " binding found in keyboard #" << (n+1) << "; action is " << KartActionStrings[*action] << "\n";
//Log::info("DeviceManager::mapKeyboardInput", "Binding found in keyboard #%d; action is %s", n + 1, KartActionStrings[*action]);
if (m_single_player != NULL)
{
//printf("Single player\n");
//Log::info("DeviceManager", "Single player");
*player = m_single_player;
}
else if (m_assign_mode == NO_ASSIGN) // Don't set the player in NO_ASSIGN mode
@ -423,7 +423,7 @@ InputDevice* DeviceManager::getLatestUsedDevice()
if (m_latest_used_device == NULL)
{
//std::cout<< "========== No latest device, returning keyboard ==========\n";
//Log::info("DeviceManager", "No latest device, returning keyboard);
return m_keyboards.get(0); // FIXME: is this right?
}

View File

@ -298,7 +298,7 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
int value)
{
#if INPUT_MODE_DEBUG
std::cout << "INPUT SENSING... ";
Log::info("InputManager::inputSensing", "Start sensing input");
#endif
// don't store if we're trying to do something like bindings keyboard
@ -310,7 +310,7 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
return;
#if INPUT_MODE_DEBUG
std::cout << (store_new ? "storing it" : "ignoring it") << "\n";
Log::info("InputManager::inputSensing", store_new ? "storing it" : "ignoring it");
#endif
@ -350,10 +350,9 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
break;
case Input::IT_STICKMOTION:
{
std::cout << "%% storing new axis binding, value=" << value <<
" deviceID=" << deviceID << " button=" << button <<
" axisDirection=" <<
(axisDirection == Input::AD_NEGATIVE ? "-" : "+") << "\n";
Log::info("InputManager::inputSensing", "Storing new axis binding, value = %d; "
"deviceID = %d; button = %d; axisDirection = %s", value, deviceID, button,
axisDirection == Input::AD_NEGATIVE ? "-" : "+");
// We have to save the direction in which the axis was moved.
// This is done by storing it as a sign (and since button can
// be zero, we add one before changing the sign).
@ -573,8 +572,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
InputDevice *device = NULL;
if (type == Input::IT_KEYBOARD)
{
//std::cout << "==== New Player Joining with Key " <<
// button << " ====" << std::endl;
//Log::info("InputManager", "New Player Joining with Key %d", button);
device = m_device_manager->getKeyboardFromBtnID(button);
}
else if (type == Input::IT_STICKBUTTON ||
@ -609,8 +607,8 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
if (pk == NULL)
{
std::cerr <<
"Error, trying to process action for an unknown player\n";
Log::error("InputManager::dispatchInput", "Trying to process "
"action for an unknown player");
return;
}
@ -700,8 +698,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
void InputManager::setMasterPlayerOnly(bool enabled)
{
#if INPUT_MODE_DEBUG
std::cout <<
"====== InputManager::setMasterPlayerOnly(" << enabled << ") ======\n";
Log::info("InputManager::setMasterPlayerOnly", enabled ? "enabled" : "disabled");
#endif
m_master_player_only = enabled;
}
@ -955,7 +952,7 @@ void InputManager::setMode(InputDriverMode new_mode)
{
case MENU:
#if INPUT_MODE_DEBUG
std::cout << "====== InputManager::setMode(MENU) ======\n";
Log::info("InputManager::setMode", "MENU");
#endif
switch (m_mode)
{
@ -1017,7 +1014,7 @@ void InputManager::setMode(InputDriverMode new_mode)
break;
case INGAME:
#if INPUT_MODE_DEBUG
std::cout << "====== InputManager::setMode(INGAME) ======\n";
Log::info("InputManager::setMode", "INGAME");
#endif
// We must be in menu mode now in order to switch.
assert (m_mode == MENU);
@ -1036,7 +1033,7 @@ void InputManager::setMode(InputDriverMode new_mode)
case INPUT_SENSE_KEYBOARD:
case INPUT_SENSE_GAMEPAD:
#if INPUT_MODE_DEBUG
std::cout << "====== InputManager::setMode(INPUT_SENSE_*) ======\n";
Log::info("InputManager::setMode", "INPUT_SENSE_*");
#endif
// We must be in menu mode now in order to switch.
assert (m_mode == MENU);
@ -1050,7 +1047,7 @@ void InputManager::setMode(InputDriverMode new_mode)
/*
case LOWLEVEL:
#if INPUT_MODE_DEBUG
std::cout << "====== InputManager::setMode(LOWLEVEL) ======\n";
Log::info("InputManager::setMode", "LOWLEVEL");
#endif
// We must be in menu mode now in order to switch.
assert (m_mode == MENU);

View File

@ -2018,10 +2018,10 @@ void Kart::updatePhysics(float dt)
m_skidding->getSkidState() == Skidding::SKID_ACCUMULATE_RIGHT ) &&
m_skidding->getGraphicalJumpOffset()==0)
{
if(m_skid_sound->getStatus() != SFXManager::SFX_PLAYING &&!isWheeless())
if(!m_skid_sound->isPlaying() && !isWheeless())
m_skid_sound->play();
}
else if(m_skid_sound->getStatus() == SFXManager::SFX_PLAYING)
else if(m_skid_sound->isPlaying())
{
m_skid_sound->stop();
}

View File

@ -441,7 +441,6 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_anim
obj.m_node = irr_driver->addAnimatedMesh(obj.m_model, node);
obj.m_node->grab();
obj.m_node->setAnimationStrength(0.0f);
obj.m_node->setFrameLoop(m_animation_frame[AF_SPEED_WEIGHTED_START], m_animation_frame[AF_SPEED_WEIGHTED_END]);
#ifdef DEBUG
@ -826,7 +825,6 @@ void KartModel::update(float dt, float rotation_dt, float steer, float speed)
strength = speed * strength_factor;
btClamp<float>(strength, 0.0f, 1.0f);
}
obj.m_node->setAnimationStrength(strength);
// Animation speed
const float speed_factor = GET_VALUE(obj, m_speed_factor);

View File

@ -1206,7 +1206,14 @@ int main(int argc, char *argv[] )
// Get into menu mode initially.
input_manager->setMode(InputManager::MENU);
main_loop = new MainLoop();
material_manager -> loadMaterial ();
material_manager->loadMaterial();
// Load the font textures - they are all lazily loaded
// so no need to push a texture search path. They will actually
// be loaded from ScalableFont.
material_manager->addSharedMaterial(
file_manager->getAsset(FileManager::FONT,"materials.xml"));
GUIEngine::addLoadingIcon( irr_driver->getTexture(FileManager::GUI,
"options_video.png"));
kart_properties_manager -> loadAllKarts ();

View File

@ -1229,7 +1229,7 @@ void World::escapePressed()
bool World::isFogEnabled() const
{
return m_track != NULL && m_track->isFogEnabled();
return !m_force_disable_fog && (m_track != NULL && m_track->isFogEnabled());
}
/* EOF */

View File

@ -92,6 +92,7 @@ protected:
RandomGenerator m_random;
Physics* m_physics;
bool m_force_disable_fog;
AbstractKart* m_fastest_kart;
/** Number of eliminated karts. */
int m_eliminated_karts;
@ -332,6 +333,8 @@ public:
{
m_clear_color = color;
}
/** Override track fog value to force disabled */
void forceFogDisabled(bool v) { m_force_disable_fog = v; }
// ------------------------------------------------------------------------
/** Override if you want to know when a kart presses fire */
virtual void onFirePressed(Controller* who) {}

View File

@ -94,6 +94,7 @@ void* waitInput(void* data)
std::cin >> cnt;
clrp->voteRaceCount(cnt);
}
std::cout << "\n";
}
// If STK shuts down, but should receive an input after the network
// manager was deleted, the getInstance call will return NULL.

View File

@ -218,7 +218,7 @@ void ConnectToServer::asynchronousUpdate()
} // while insufficient buffer
for(unsigned int i=0; i<table->dwNumEntries; i++)
{
int ip = ntohl(table->table[i].dwAddr);
unsigned int ip = ntohl(table->table[i].dwAddr);
if(sender.ip == ip) // this interface is ours
{
sender.ip = 0x7f000001; // 127.0.0.1

View File

@ -30,6 +30,7 @@
#include <assert.h>
#ifdef __MINGW32__
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x501
#endif

View File

@ -60,7 +60,7 @@ OnlineProfile::OnlineProfile(const uint32_t & userid,
const irr::core::stringw & username,
bool is_current_user)
{
m_state = S_READY;
m_state = (State)0;
m_cache_bit = true;
m_id = userid;
m_is_current_user = is_current_user;
@ -112,7 +112,7 @@ OnlineProfile::OnlineProfile(const XMLNode * xml, ConstructorType type)
xml->get("id", &m_id );
xml->get("user_name", &m_username);
m_is_current_user = (m_id == PlayerManager::getCurrentOnlineId());
m_state = S_READY;
m_state = (State)0;
} // OnlineProfile(XMLNode)
// ----------------------------------------------------------------------------
@ -132,7 +132,7 @@ void OnlineProfile::fetchAchievements()
if (m_has_fetched_achievements || m_is_current_user)
return;
m_state = S_FETCHING;
m_state = State(m_state | S_FETCHING_ACHIEVEMENTS);
// ------------------------------------------------------------------------
/** A simple class that receives the achievements, and calls the right
@ -173,7 +173,7 @@ void OnlineProfile::storeAchievements(const XMLNode * input)
m_achievements = StringUtils::splitToUInt(achieved_string, ' ');
}
m_has_fetched_achievements = true;
m_state = S_READY;
m_state = State(m_state & ~S_FETCHING_ACHIEVEMENTS);
} // storeAchievements
// ----------------------------------------------------------------------------
@ -187,7 +187,7 @@ void OnlineProfile::fetchFriends()
if (m_has_fetched_friends)
return;
m_state = S_FETCHING;
m_state = State(m_state | S_FETCHING_FRIENDS);
// ------------------------------------------------------------------------
class FriendsListRequest : public XMLRequest
@ -239,7 +239,7 @@ void OnlineProfile::storeFriends(const XMLNode * input)
}
} // for i in nodes
m_has_fetched_friends = true;
m_state = S_READY;
m_state = State(m_state & ~S_FETCHING_FRIENDS);
} // storeFriends
// ----------------------------------------------------------------------------
@ -296,7 +296,8 @@ void OnlineProfile::deleteRelationalInfo()
*/
const OnlineProfile::IDList& OnlineProfile::getFriends()
{
assert(m_has_fetched_friends && m_state == S_READY);
assert(m_has_fetched_friends &&
(m_state & S_FETCHING_FRIENDS) == 0);
return m_friends;
} // getFriends
@ -305,7 +306,9 @@ const OnlineProfile::IDList& OnlineProfile::getFriends()
*/
const OnlineProfile::IDList& OnlineProfile::getAchievements()
{
assert(m_has_fetched_achievements && m_state == S_READY && !m_is_current_user);
assert(m_has_fetched_achievements &&
(m_state & S_FETCHING_ACHIEVEMENTS) == 0 &&
!m_is_current_user);
return m_achievements;
} // getAchievements

View File

@ -78,8 +78,8 @@ private:
/** The profile can either be fetching data, or be ready. */
enum State
{
S_FETCHING = 1,
S_READY
S_FETCHING_ACHIEVEMENTS = 0x01,
S_FETCHING_FRIENDS = 0x02,
};
State m_state;
@ -125,13 +125,27 @@ public:
/** Returns true if the achievements for this profile have been fetched. */
bool hasFetchedAchievements() const { return m_has_fetched_achievements; }
// ------------------------------------------------------------------------
/** Unsets the flag that all friends of this profile are in cache. Used
* when a profile is pushed out of cache. */
void unsetHasFetchedFriends() { m_has_fetched_friends = false; }
// ------------------------------------------------------------------------
/** Returns true if the friend list for this profile has been fetched. */
bool hasFetchedFriends() const { return m_has_fetched_friends; }
// ------------------------------------------------------------------------
/** True if the profile is not fetching data atm. */
bool isReady() const { return m_state == S_READY; }
/** True if the profile has fetched friends. */
bool finishedFetchingFriends() const
{
return (m_state & S_FETCHING_FRIENDS) == 0;
} // finishedFetchingFriends
// ------------------------------------------------------------------------
/** True if the profile has fetched friends. */
bool finishedFetchingAchievements() const
{
return (m_state & S_FETCHING_ACHIEVEMENTS) == 0;
} // hasFetchedAchievements
// ------------------------------------------------------------------------
/** Returns true if this item is the current user. */

View File

@ -22,9 +22,10 @@
#include "utils/log.hpp"
#include "utils/translation.hpp"
#include <algorithm>
#include <assert.h>
#include <sstream>
#include <stdlib.h>
#include <assert.h>
using namespace Online;
@ -38,7 +39,7 @@ ProfileManager* ProfileManager::m_profile_manager = NULL;
*/
ProfileManager::ProfileManager()
{
m_max_cache_size = 2;
m_max_cache_size = 100;
m_currently_visiting = NULL;
} // ProfileManager
@ -131,6 +132,7 @@ void ProfileManager::addDirectToCache(OnlineProfile* profile)
{
if (!iter->second->getCacheBit())
{
updateAllFriendFlags(iter->second);
delete iter->second;
iter = m_profiles_cache.erase(iter);
// Keep on deleting till enough space is available.
@ -163,6 +165,44 @@ bool ProfileManager::isInCache(const uint32_t id)
return false;
} // isInCache
// ------------------------------------------------------------------------
/** This function is called when the specified profile id is removed from
* cache. It will search all currently cached profiles that have the
* 'friends fetched' flag set, and reset that flag if the profile id is
* one of their friends. This fixes the problem that friend lists can
* get shortened if some of their friends are being pushed out of
* cache.
*/
void ProfileManager::updateFriendFlagsInCache(const ProfilesMap &cache,
uint32_t profile_id)
{
ProfilesMap::const_iterator i;
for(i=cache.begin(); i!=cache.end(); i++)
{
// Profile has no friends fetched, no need to test
if(!(*i).second->hasFetchedFriends()) continue;
const OnlineProfile::IDList &friend_list = (*i).second->getFriends();
OnlineProfile::IDList::const_iterator frnd;
frnd = std::find(friend_list.begin(), friend_list.end(), profile_id);
if(frnd!=friend_list.end())
(*i).second->unsetHasFetchedFriends();
}
} // updateFriendFlagsInCache
// ------------------------------------------------------------------------
/** This function is called when the specified profile is removed from
* cache. It searches through all caches for profiles X, that have the
* given profile as friend, and then reset the 'friends fetched' flag
* in profile X. Otherwise if a profile is pushed out of the cache,
* all friends of this profile in cache will have an incomplete list
* of friends.
*/
void ProfileManager::updateAllFriendFlags(const OnlineProfile *profile)
{
updateFriendFlagsInCache(m_profiles_persistent, profile->getID());
updateFriendFlagsInCache(m_profiles_cache, profile->getID());
} // updateAllFriendFlags
// ------------------------------------------------------------------------
/** This function updates the cache bits of all cached entries. It will
* set the cache bit of the given profile. Then, if the cachen is full

View File

@ -70,9 +70,11 @@ private:
* loaded, to make sure they can be all stored). */
unsigned int m_max_cache_size;
void updateCacheBits(OnlineProfile * profile);
void addDirectToCache(OnlineProfile * profile);
void updateCacheBits(OnlineProfile *profile);
void addDirectToCache(OnlineProfile *profile);
void updateFriendFlagsInCache(const ProfilesMap &cache,
uint32_t profile_id);
void updateAllFriendFlags(const OnlineProfile *profile);
public:
/** Create the singleton instance. */
static void create()

View File

@ -126,7 +126,7 @@ void RaceManager::setDefaultAIKartList(const std::vector<std::string>& ai_list)
// player (and therefore the current slot) is not defined yet.
//if(unlock_manager->getCurrentSlot()->isLocked(name))
//{
// printf("Kart '%s' is locked and therefore ignored.\n",
// Log::info("RaceManager", "Kart '%s' is locked and therefore ignored.",
// name.c_str());
// continue;
//}
@ -240,9 +240,8 @@ void RaceManager::computeRandomKartList()
{
int n = m_num_karts - (int)m_player_karts.size();
if(UserConfigParams::logMisc())
std::cout << "AI karts count = " << n << " for m_num_karts="
<< m_num_karts << " and m_player_karts.size()="
<< m_player_karts.size() << std::endl;
Log::info("RaceManager", "AI karts count = %d for m_num_karts = %d and "
"m_player_karts.size() = %d", n, m_num_karts, m_player_karts.size());
// If less kart selected than there are player karts, adjust the number of
// karts to the minimum
@ -655,8 +654,8 @@ void RaceManager::exitRace(bool delete_world)
{
if(UserConfigParams::logMisc())
{
std::cout << m_kart_status[i].m_ident << " has GP final rank "
<< m_kart_status[i].m_gp_rank << std::endl;
Log::info("RaceManager", "%s has GP final rank %d",
m_kart_status[i].m_ident.c_str(), m_kart_status[i].m_gp_rank);
}
const int rank = m_kart_status[i].m_gp_rank;

View File

@ -146,8 +146,7 @@ void AddonsScreen::init()
getWidget<GUIEngine::RibbonWidget>("category")->setDeactivated();
if(UserConfigParams::logAddons())
std::cout << "[addons] Using directory <" + file_manager->getAddonsDir()
<< ">\n";
Log::info("addons", "Using directory <%s>", file_manager->getAddonsDir().c_str());
GUIEngine::ListWidget* w_list =
getWidget<GUIEngine::ListWidget>("list_addons");

View File

@ -133,7 +133,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const
const std::string selection = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (UserConfigParams::logGUI())
std::cout << "Clicked on arena " << selection.c_str() << std::endl;
Log::info("ArenasScreen", "Clicked on arena %s", selection.c_str());
if (selection == "random_track")

View File

@ -79,7 +79,7 @@ void ConfirmResolutionDialog::updateMessage()
{
//I18N: In the 'confirm resolution' dialog, that's shown when switching resoluton
stringw msg = _("Confirm resolution within %i seconds", (int)m_remaining_time);
//std::cout << stringc(msg.c_str()).c_str() << std::endl;
//Log::info("ConfirmResolutionDialog", "stringc(msg.c_str()).c_str());
LabelWidget* countdown_message = getWidget<LabelWidget>("title");
countdown_message->setText( msg.c_str(), false );

View File

@ -80,29 +80,31 @@ void EnterGPNameDialog::onEnterPressedInternal()
//Otherwise, see if we can accept the new name
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
assert(textCtrl != NULL);
LabelWidget* label = getWidget<LabelWidget>("title");
assert(label != NULL);
stringw name = textCtrl->getText().trim();
if (name.size() > 0 && name != "Random Grand Prix")
if (name.size() == 0)
{
label->setText(_("Name is empty."), false);
SFXManager::get()->quickSound("anvil");
}
else if (grand_prix_manager->existsName(name) || name == "Random Grand Prix")
{
// check for duplicate names
if (grand_prix_manager->existsName(name))
{
LabelWidget* label = getWidget<LabelWidget>("title");
assert(label != NULL);
label->setText(_("Another grand prix with this name already exists."), false);
SFXManager::get()->quickSound("anvil");
return;
}
// It's unsafe to delete from inside the event handler so we do it
// in onUpdate (which checks for m_self_destroy)
m_self_destroy = true;
label->setText(_("Another grand prix with this name already exists."), false);
SFXManager::get()->quickSound("anvil");
}
else if (name.size() > 30)
{
label->setText(_("Name is too long."), false);
SFXManager::get()->quickSound("anvil");
}
else
{
LabelWidget* label = getWidget<LabelWidget>("title");
assert(label != NULL);
label->setText(_("Cannot add a grand prix with this name"), false);
SFXManager::get()->quickSound("anvil");
// It's unsafe to delete from inside the event handler so we do it
// in onUpdate (which checks for m_self_destroy)
m_self_destroy = true;
}
}

View File

@ -44,6 +44,12 @@ GUIEngine::EventPropagation PressAKeyDialog::processEvent(const std::string& eve
dismiss();
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "assignNone")
{
Input simulatedInput;
OptionsScreenInput2::getInstance()->gotSensedInput(simulatedInput);
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "assignEsc")
{
Input simulatedInput(Input::IT_KEYBOARD, 0 /* deviceID */, KEY_ESCAPE);

View File

@ -65,8 +65,7 @@ void EasterEggScreen::eventCallback(Widget* widget, const std::string& name, con
{
const std::string selection = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if(UserConfigParams::logGUI())
std::cout << "Clicked on track " << selection.c_str()
<< std::endl;
Log::info("EasterEggScreen", "Clicked on track %s", selection.c_str());
UserConfigParams::m_last_track = selection;

View File

@ -250,8 +250,8 @@ void FeatureUnlockedCutScene::addUnlockedPicture(irr::video::ITexture* picture,
{
if (picture == NULL)
{
std::cerr << "[FeatureUnlockedCutScene::addUnlockedPicture] WARNING: unlockable has no picture : "
<< core::stringc(msg.c_str()).c_str() << "\n";
Log::warn("FeatureUnlockedCutScene::addUnlockedPicture", "Unlockable has no picture: %s",
core::stringc(msg.c_str()).c_str());
picture = irr_driver->getTexture(file_manager->getAsset(FileManager::GUI,"main_help.png"));
}
@ -278,7 +278,8 @@ void FeatureUnlockedCutScene::init()
const int unlockedStuffCount = m_unlocked_stuff.size();
if (unlockedStuffCount == 0) std::cerr << "There is nothing in the unlock chest!!!\n";
if (unlockedStuffCount == 0)
Log::error("FeatureUnlockedCutScene::init", "There is nothing in the unlock chest");
m_all_kart_models.clearAndDeleteAll();
for (int n=0; n<unlockedStuffCount; n++)
@ -350,7 +351,7 @@ void FeatureUnlockedCutScene::init()
}
else
{
std::cerr << "Malformed unlocked goody!!!\n";
Log::error("FeatureUnlockedCutScene::init", "Malformed unlocked goody");
}
}
@ -402,8 +403,8 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
else if (n > 1) pos.X += 1.0f*dt*(n - 0.3f);
//else pos.X += 6.2f*dt*float( int((n + 1)/2) );
//std::cout << "Object " << n << " moving by " <<
// (n % 2 == 0 ? -4.0f : 4.0f)*float( n/2 + 1 ) << std::endl;
//Log::info("FeatureUnlockedCutScene", "Object %d moving by %f", n,
// (n % 2 == 0 ? -4.0f : 4.0f)*float( n/2 + 1 ));
}
else
{
@ -514,7 +515,7 @@ void FeatureUnlockedCutScene::addUnlockedTrack(const Track* track)
{
if (track == NULL)
{
std::cerr << "ERROR: Unlocked track does not exist???\n";
Log::error("FeatureUnlockedCutScene::addUnlockedTrack", "Unlocked track does not exist");
return;
}
@ -531,7 +532,7 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
std::vector<ITexture*> images;
if (gp == NULL)
{
std::cerr << "ERROR: Unlocked GP does not exist???\n";
Log::error("FeatureUnlockedCutScene::addUnlockedGP", "Unlocked GP does not exist");
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getAsset(FileManager::GUI,"main_help.png"));
images.push_back(WTF_image);
}
@ -542,7 +543,7 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
if (track_amount == 0)
{
std::cerr << "ERROR: Unlocked GP is empty???\n";
Log::error("FeatureUnlockedCutScene::addUnlockedGP", "Unlocked GP is empty");
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getAsset(FileManager::GUI,"main_help.png"));
images.push_back(WTF_image);
}

View File

@ -103,6 +103,8 @@ void OnlineProfileAchievements::init()
{
std::vector<ListWidget::ListCell> row;
const Achievement *a = it->second;
if(a->getInfo()->isSecret() && !a->isAchieved())
continue;
ListWidget::ListCell title(a->getInfo()->getTitle(), -1, 2);
ListWidget::ListCell progress(a->getProgressAsString(), -1, 1);
row.push_back(title);
@ -157,7 +159,7 @@ void OnlineProfileAchievements::onUpdate(float delta)
{
if (!m_waiting_for_achievements) return;
if (!m_visiting_profile->isReady())
if (!m_visiting_profile->hasFetchedAchievements())
{
// This will display an increasing number of dots while waiting.
m_achievements_list_widget->renameItem("loading",

View File

@ -164,7 +164,7 @@ void OnlineProfileFriends::onUpdate(float delta)
{
if(m_waiting_for_friends)
{
if(m_visiting_profile->isReady())
if(m_visiting_profile->hasFetchedFriends())
{
displayResults();
}

View File

@ -151,7 +151,7 @@ void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name,
CheckBoxWidget* w = dynamic_cast<CheckBoxWidget*>(widget);
UserConfigParams::m_music = w->getState();
std::cout << "music state is now " << (bool)UserConfigParams::m_music << std::endl;
Log::info("OptionsScreenAudio", "Music is now %s", ((bool) UserConfigParams::m_music) ? "on" : "off");
if(w->getState() == false)
music_manager->stopMusic();

View File

@ -235,7 +235,8 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
}
else
{
std::cerr << "Cannot read internal gamepad input device ID : " << selection.c_str() << std::endl;
Log::error("OptionsScreenInput", "Cannot read internal gamepad input device ID: %s",
selection.c_str());
}
}
else if (selection.find("keyboard") != std::string::npos)
@ -250,12 +251,13 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
}
else
{
std::cerr << "Cannot read internal keyboard input device ID : " << selection.c_str() << std::endl;
Log::error("OptionsScreenInput", "Cannot read internal keyboard input device ID: %s",
selection.c_str());
}
}
else
{
std::cerr << "Cannot read internal input device ID : " << selection.c_str() << std::endl;
Log::error("OptionsScreenInput", "Cannot read internal input device ID: %s", selection.c_str());
}
}

View File

@ -394,9 +394,8 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
{
if (UserConfigParams::logMisc())
{
std::cout << "% Binding " << KartActionStrings[binding_to_set]
<< " : setting to keyboard key " << sensed_input.m_button_id
<< " \n\n";
Log::info("OptionsScreenInput2", "Binding %s: setting to keyboard key %d",
KartActionStrings[binding_to_set].c_str(), sensed_input.m_button_id);
}
KeyboardConfig* keyboard = (KeyboardConfig*)m_config;
@ -412,24 +411,21 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
{
if (UserConfigParams::logMisc())
{
std::cout << "% Binding " << KartActionStrings[binding_to_set]
<< " : setting to gamepad #"
<< sensed_input.m_device_id<< " : ";
Log::info("OptionsScreenInput2", "Binding %s: setting to gamepad #%d",
KartActionStrings[binding_to_set].c_str(), sensed_input.m_device_id);
if (sensed_input.m_type == Input::IT_STICKMOTION)
{
std::cout << "axis " <<sensed_input.m_button_id<< " direction "
<< (sensed_input.m_axis_direction==Input::AD_NEGATIVE
? "-" : "+")
<< "\n\n";
Log::info("OptionsScreenInput2", "Axis %d; direction %s", sensed_input.m_button_id,
sensed_input.m_axis_direction == Input::AD_NEGATIVE ? "-" : "+");
}
else if (sensed_input.m_type == Input::IT_STICKBUTTON)
{
std::cout << "button " << sensed_input.m_button_id<< "\n\n";
Log::info("OptionsScreenInput2", "Button %d", sensed_input.m_button_id);
}
else
{
std::cout << "Sensed unknown gamepad event type??\n";
Log::info("OptionsScreenInput2", "Sensed unknown gamepad event type??");
}
}
@ -447,6 +443,23 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
updateInputButtons();
}
}
else if (sensed_input.m_type == Input::IT_NONE)
{
if (UserConfigParams::logMisc())
{
Log::info("OptionsScreenInput2", "Binding %s: setting to keyboard key NONE",
KartActionStrings[binding_to_set].c_str());
}
KeyboardConfig* keyboard = (KeyboardConfig*)m_config;
keyboard->setBinding(binding_to_set, Input::IT_NONE,
sensed_input.m_button_id, Input::AD_NEUTRAL,
Input::AR_HALF,
sensed_input.m_character);
// refresh display
updateInputButtons();
}
else
{
return;
@ -524,9 +537,8 @@ void OptionsScreenInput2::eventCallback(Widget* widget,
// we found which one. show the "press a key" dialog.
if (UserConfigParams::logMisc())
{
std::cout << "\n% Entering sensing mode for "
<< m_config->getName().c_str()
<< std::endl;
Log::info("OptionsScreenInput2", "Entering sensing mode for %s",
m_config->getName().c_str());
}
binding_to_set = (PlayerAction)n;
@ -543,8 +555,8 @@ void OptionsScreenInput2::eventCallback(Widget* widget,
}
else
{
std::cerr << "unknown selection device in options : "
<< m_config->getName().c_str() << std::endl;
Log::error("OptionsScreenInput2", "Unknown selection device in options: %s",
m_config->getName().c_str());
}
break;
}

View File

@ -318,15 +318,10 @@ void OptionsScreenVideo::init()
(int)UserConfigParams::m_height);
if (res->setSelection(searching_for, PLAYER_ID_GAME_MASTER,
if (!res->setSelection(searching_for, PLAYER_ID_GAME_MASTER,
false /* focus it */, true /* even if deactivated*/))
{
// ok found
}
else
{
std::cerr << "[OptionsScreenVideo] Cannot find resolution '"
<< searching_for << "'\n";
Log::error("OptionsScreenVideo", "Cannot find resolution %s", searching_for);
}
@ -517,8 +512,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
int w = -1, h = -1;
if (sscanf(res.c_str(), "%ix%i", &w, &h) != 2 || w == -1 || h == -1)
{
std::cerr << "Failed to decode resolution : " << res.c_str()
<< std::endl;
Log::error("OptionsScreenVideo", "Failed to decode resolution %s", res.c_str());
return;
}

View File

@ -187,11 +187,11 @@ void RaceGUIOverworld::renderPlayerView(const Camera *camera, float dt)
const core::recti &viewport = camera->getViewport();
core::vector2df scaling = camera->getScaling();
//std::cout << "Applied ratio : " << viewport.getWidth()/800.0f << std::endl;
//Log::info("RaceGUIOverworld", "Applied ratio: %f", viewport.getWidth()/800.0f);
scaling *= viewport.getWidth()/800.0f; // scale race GUI along screen size
//std::cout << "Scale : " << scaling.X << ", " << scaling.Y << std::endl;
//Log::info("RaceGUIOverworld", "Scale: %f, %f", scaling.X, scaling.Y);
drawAllMessages (kart, viewport, scaling);

View File

@ -171,6 +171,7 @@ void TracksScreen::init()
// Reset GP list everytime (accounts for locking changes, etc.)
gps_widget->clearItems();
gps_widget->setMaxLabelLength(30);
// Ensure that no GP and no track is NULL
grand_prix_manager->checkConsistency();

View File

@ -73,6 +73,15 @@ void BaseUserScreen::init()
m_info_widget = getWidget<LabelWidget>("message");
assert(m_info_widget);
// The behaviour of the screen is slightly different at startup, i.e.
// when it is the first screen: cancel will exit the game, and in
// this case no 'back' error should be shown.
bool is_first_screen = StateManager::get()->getMenuStackSize()==1;
getWidget<IconButtonWidget>("back")->setVisible(!is_first_screen);
getWidget<IconButtonWidget>("cancel")->setLabel(is_first_screen
? _("Exit game")
: _("Cancel") );
m_sign_out_name = "";
m_sign_in_name = "";
@ -203,7 +212,11 @@ void BaseUserScreen::makeEntryFieldsVisible()
getWidget<LabelWidget>("label_remember")->setVisible(online);
getWidget<CheckBoxWidget>("remember-user")->setVisible(online);
PlayerProfile *player = getSelectedPlayer();
if(player && player->hasSavedSession() && online)
// Don't show the password fields if the player wants to be online
// and either is the current player (no need to enter a password then)
// or has a saved session.
if(player && online &&
(player->hasSavedSession() || player==PlayerManager::getCurrentPlayer()))
{
// If we show the online login fields, but the player has a
// saved session, don't show the password field.
@ -214,6 +227,14 @@ void BaseUserScreen::makeEntryFieldsVisible()
{
getWidget<LabelWidget>("label_password")->setVisible(online);
m_password_tb->setVisible(online);
if(player && player->hasSavedSession())
{
// Even though this field is invisible we need to set
// the name, otherwise in update a change of user name
// will be detected, causing a clearing of this player
// (which then removes the associated online user name).
m_username_tb->setText(player->getLastOnlineName());
}
}
} // makeEntryFieldsVisible
@ -281,8 +302,8 @@ void BaseUserScreen::eventCallback(Widget* widget,
}
else if (button == "cancel")
{
StateManager::get()->popMenu();
onEscapePressed();
// EscapePressed will pop this screen.
StateManager::get()->escapePressed();
}
else if (button == "recover")
{

View File

@ -983,6 +983,7 @@ void QuadGraph::makeMiniMap(const core::dimension2du &dimension,
{
const SColor oldClearColor = World::getWorld()->getClearColor();
World::getWorld()->setClearbackBufferColor(SColor(0, 255, 255, 255));
World::getWorld()->forceFogDisabled(true);
*oldRttMinimap = NULL;
*newRttMinimap = NULL;
@ -1102,6 +1103,7 @@ void QuadGraph::makeMiniMap(const core::dimension2du &dimension,
*oldRttMinimap = texture;
*newRttMinimap = frame_buffer;
World::getWorld()->setClearbackBufferColor(oldClearColor);
World::getWorld()->forceFogDisabled(false);
} // makeMiniMap
//-----------------------------------------------------------------------------

View File

@ -436,7 +436,7 @@ bool onEvent(const SEvent &event)
else if (cmdID == DEBUG_HIDE_KARTS)
{
if (!world) return false;
for (int n = 0; n<world->getNumKarts(); n++)
for (unsigned int n = 0; n<world->getNumKarts(); n++)
{
AbstractKart* kart = world->getKart(n);
if (kart->getController()->isPlayerController())

Some files were not shown because too many files have changed in this diff Show More