This commit is contained in:
Arthur-D 2014-10-06 22:39:48 +02:00
commit 8e38f4ca30
44 changed files with 396 additions and 195 deletions

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

@ -13,25 +13,25 @@
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>
@ -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

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

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

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

@ -23,15 +23,26 @@
#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 <string>
#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.
@ -102,6 +113,105 @@ 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;
int bits = 0;
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())
{
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;
}
#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;
const int ret = sscanf_s(windows_version_string, "%u.%u", &major, &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,6 +254,8 @@ 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;
@ -195,7 +307,7 @@ 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.

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

@ -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
{
@ -147,7 +147,7 @@ struct GrassMat
};
const std::vector<size_t> GrassMat::FirstPassTextures = { 0 };
const std::vector<size_t> GrassMat::SecondPassTextures = { 0 };
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

@ -152,13 +152,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

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

View File

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

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

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

@ -37,6 +37,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;
@ -1158,8 +1159,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;
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

@ -189,6 +189,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

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

View File

@ -2546,8 +2546,9 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
float lean_height = tan(fabsf(m_current_lean)) * getKartWidth()*0.5f;
float heading = m_skidding->getVisualSkidRotation();
float xx = fabsf(m_speed)* getKartProperties()->getDownwardImpulseFactor()*0.0006f;
Vec3 center_shift = Vec3(0, m_skidding->getGraphicalJumpOffset()
+ lean_height +m_graphical_y_offset, 0);
+ lean_height +m_graphical_y_offset+xx, 0);
center_shift = getTrans().getBasis() * center_shift;
Moveable::updateGraphics(dt, center_shift,

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

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

@ -282,7 +282,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
else if (button == "cancel")
{
StateManager::get()->popMenu();
onEscapePressed();
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
//-----------------------------------------------------------------------------