Merge branch 'master' of github.com:supertuxkart/stk-code

This commit is contained in:
hiker 2014-12-16 09:31:51 +11:00
commit 62f8e3be2d
10 changed files with 42 additions and 36 deletions

View File

@ -12,12 +12,9 @@
<spacer height="20" width="20" />
<div width="100%" height="60" layout="horizontal-row">
<button id="accept" I18N="In the 'add new grand prix' dialog" text="Create" align="center" proportion="1"/>
<spacer height="15" width="20" />
<button id="cancel" I18N="In the 'add new grand prix' dialog" text="Cancel" align="center" proportion="1"/>
<spacer height="15" width="20" />
</div>
</div>
</stkgui>

View File

@ -56,7 +56,7 @@
I18N="In the user screen" text="Add user" label_location="bottom"/>
<icon-button id="delete" width="64" height="64" icon="gui/remove.png"
I18N="In the user screen" text="Delete" label_location="bottom"/>
<icon-button id="rename" width="64" height="64" icon="gui/gp_rename.png"
<icon-button id="rename" width="64" height="64" icon="gui/rename.png"
I18N="In the user screen" text="Rename" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="In the user screen" text="Cancel" label_location="bottom"/>

View File

@ -6,9 +6,13 @@ uniform mat4 InverseProjectionMatrix;
uniform mat4 ProjectionViewMatrix;
uniform vec2 screen;
uniform vec3 sun_direction;
uniform vec3 sun_col;
uniform float sun_angle;
uniform float blueLmn[9];
uniform float greenLmn[9];
uniform float redLmn[9];
#else
layout (std140) uniform MatrixesData
{
@ -24,6 +28,9 @@ layout (std140) uniform MatrixesData
// Expand because of catalyst (14.12) not correctly associating array in UBO
layout (std140) uniform LightingData
{
vec3 sun_direction;
vec3 sun_col;
float sun_angle;
float bL00;
float bL1m1;
float bL10;

View File

@ -1,10 +1,6 @@
uniform sampler2D ntex;
uniform sampler2D dtex;
uniform vec3 direction;
uniform vec3 col;
uniform float sunangle = .54;
out vec4 Diff;
out vec4 Spec;
@ -32,19 +28,18 @@ void main() {
float roughness = texture(ntex, uv).z;
vec3 eyedir = -normalize(xpos.xyz);
// Normalized on the cpu
vec3 L = direction;
vec3 L = normalize((transpose(InverseViewMatrix) * vec4(sun_direction, 0.)).xyz);
float NdotL = clamp(dot(norm, L), 0., 1.);
float angle = 3.14 * sunangle / 180.;
float angle = 3.14 * sun_angle / 180.;
vec3 R = reflect(-eyedir, norm);
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
vec3 Lightdir = getMostRepresentativePoint(L, R, angle);
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
vec3 Diffuse = DiffuseBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
Diff = vec4(NdotL * Diffuse * col, 1.);
Spec = vec4(NdotL * Specular * col, 1.);
Diff = vec4(NdotL * Diffuse * sun_col, 1.);
Spec = vec4(NdotL * Specular * sun_col, 1.);
/* if (hasclouds == 1)
{

View File

@ -7,10 +7,6 @@ uniform float split1;
uniform float split2;
uniform float splitmax;
uniform vec3 direction;
uniform vec3 col;
uniform float sunangle = .54;
in vec2 uv;
out vec4 Diff;
out vec4 Spec;
@ -50,13 +46,12 @@ void main() {
float roughness =texture(ntex, uv).z;
vec3 eyedir = -normalize(xpos.xyz);
// Normalized on the cpu
vec3 L = direction;
vec3 L = normalize((transpose(InverseViewMatrix) * vec4(sun_direction, 0.)).xyz);
float NdotL = clamp(dot(norm, L), 0., 1.);
float angle = 3.14 * sunangle / 180.;
float angle = 3.14 * sun_angle / 180.;
vec3 R = reflect(-eyedir, norm);
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
vec3 Lightdir = getMostRepresentativePoint(L, R, angle);
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
vec3 Diffuse = DiffuseBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
@ -74,6 +69,6 @@ void main() {
else
factor = 1.;
Diff = vec4(factor * NdotL * Diffuse * col, 1.);
Spec = vec4(factor * NdotL * Specular * col, 1.);
Diff = vec4(factor * NdotL * Diffuse * sun_col, 1.);
Spec = vec4(factor * NdotL * Specular * sun_col, 1.);
}

View File

@ -152,7 +152,9 @@ void PlayerProfile::addIcon()
if (m_icon_filename.size() > 0 || isGuestAccount())
return;
int n = m_unique_id % kart_properties_manager->getNumberOfKarts();
int n = (m_unique_id + kart_properties_manager->getKartId("tux") - 1)
% kart_properties_manager->getNumberOfKarts();
std::string source = kart_properties_manager->getKartById(n)
->getAbsoluteIconFile();
// Create the filename for the icon of this player: the unique id

View File

@ -663,12 +663,7 @@ public:
// -----------------------------------------------------------------------
void setSunDirection(const core::vector3df &SunPos)
{
core::matrix4 m_view = getViewMatrix();
m_view.makeInverse();
m_view = m_view.getTransposed();
m_sundirection = SunPos;
m_view.transformVect(m_sundirection);
m_sundirection.normalize();
}
// -----------------------------------------------------------------------
video::SColorf getSunColor() const { return m_suncolor; }

View File

@ -963,13 +963,21 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::ViewProjectionMatrixesUBO);
glBufferSubData(GL_UNIFORM_BUFFER, 0, (16 * 9 + 2) * sizeof(float), tmp);
float Lighting[27];
memcpy(Lighting, blueSHCoeff, 9 * sizeof(float));
memcpy(&Lighting[9], greenSHCoeff, 9 * sizeof(float));
memcpy(&Lighting[18], redSHCoeff, 9 * sizeof(float));
float Lighting[36];
Lighting[0] = m_sundirection.X;
Lighting[1] = m_sundirection.Y;
Lighting[2] = m_sundirection.Z;
Lighting[4] = m_suncolor.getRed();
Lighting[5] = m_suncolor.getGreen();
Lighting[6] = m_suncolor.getBlue();
Lighting[7] = 0.54f;
memcpy(&Lighting[8], blueSHCoeff, 9 * sizeof(float));
memcpy(&Lighting[17], greenSHCoeff, 9 * sizeof(float));
memcpy(&Lighting[26], redSHCoeff, 9 * sizeof(float));
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::LightingDataUBO);
glBufferSubData(GL_UNIFORM_BUFFER, 0, 27 * sizeof(float), Lighting);
glBufferSubData(GL_UNIFORM_BUFFER, 0, 36 * sizeof(float), Lighting);
}

View File

@ -433,7 +433,7 @@ static void initLightingDataUBO()
{
glGenBuffers(1, &SharedObject::LightingDataUBO);
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::LightingDataUBO);
glBufferData(GL_UNIFORM_BUFFER, 27 * sizeof(float), 0, GL_STREAM_DRAW);
glBufferData(GL_UNIFORM_BUFFER, 36 * sizeof(float), 0, GL_STREAM_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
@ -591,6 +591,12 @@ void bypassUBO(GLuint Program)
glUniform1fv(gLmn, 9, irr_driver->greenSHCoeff);
GLint rLmn = glGetUniformLocation(Program, "redLmn[0]");
glUniform1fv(rLmn, 9, irr_driver->redSHCoeff);
GLint sundir = glGetUniformLocation(Program, "sun_direction");
glUniform3f(sundir, irr_driver->getSunDirection().X, irr_driver->getSunDirection().Y, irr_driver->getSunDirection().Z);
GLint suncol = glGetUniformLocation(Program, "sun_col");
glUniform3f(suncol, irr_driver->getSunColor().getRed(), irr_driver->getSunColor().getGreen(), irr_driver->getSunColor().getBlue());
GLint sunangle = glGetUniformLocation(Program, "sun_angle");
glUniform1f(sunangle, 0.54f);
}
namespace UtilShader

View File

@ -1022,6 +1022,7 @@ void initUserConfig()
file_manager = new FileManager();
user_config = new UserConfig(); // needs file_manager
user_config->loadConfig();
file_manager->discoverPaths();
if (UserConfigParams::m_language.toString() != "system")
{
#ifdef WIN32