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

This commit is contained in:
hiker 2015-01-13 16:51:02 +11:00
commit 21d27f99e8
5 changed files with 28 additions and 13 deletions

View File

@ -50,9 +50,11 @@ void main(void)
mat4 ModelMatrix = getWorldMatrix(Origin, Orientation, Scale);
mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin, Orientation, Scale) * InverseViewMatrix);
gl_Position = ProjectionViewMatrix * ModelMatrix * vec4(Position, 1.);
// Keep orthogonality
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 0.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 0.)).xyz;
// Keep direction
tangent = (ViewMatrix * ModelMatrix * vec4(Tangent, 0.)).xyz;
bitangent = (ViewMatrix * ModelMatrix * vec4(Bitangent, 0.)).xyz;
uv = Texcoord;
uv_bis = SecondTexcoord;
color = Color.zyxw;

View File

@ -47,9 +47,11 @@ void main(void)
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * ModelMatrix;
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
// Keep orthogonality
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 0.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 0.)).xyz;
// Keep direction
tangent = (ViewMatrix * ModelMatrix * vec4(Tangent, 0.)).xyz;
bitangent = (ViewMatrix * ModelMatrix * vec4(Bitangent, 0.)).xyz;
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
uv_bis = SecondTexcoord;
}

View File

@ -2,7 +2,7 @@
// and improvements here http://graphics.cs.williams.edu/papers/SAOHPG12/
uniform sampler2D dtex;
uniform float radius = 1.;
uniform float radius;
uniform float k = 1.5;
uniform float sigma = 1.;
out float AO;
@ -38,7 +38,7 @@ void main(void)
float r = radius / FragPos.z;
float phi = 3. * (x ^ y) + x * y;
float bl = 0.0;
float m = max(log2(r) + 6 + log2(invSamples), 0.);
float m = log2(r) + 6 + log2(invSamples);
float theta = 2. * 3.14 * tau * .5 * invSamples + phi;
vec2 rotations = vec2(cos(theta), sin(theta)) * screen;
@ -48,14 +48,14 @@ void main(void)
float alpha = (i + .5) * invSamples;
rotations = vec2(rotations.x * offset.x - rotations.y * offset.y, rotations.x * offset.y + rotations.y * offset.x);
float h = r * alpha;
vec2 offset = h * rotations;
vec2 localoffset = h * rotations;
m = m + .5;
ivec2 ioccluder_uv = ivec2(x, y) + ivec2(offset);
ivec2 ioccluder_uv = ivec2(x, y) + ivec2(localoffset);
if (ioccluder_uv.x < 0 || ioccluder_uv.x > screen.x || ioccluder_uv.y < 0 || ioccluder_uv.y > screen.y) continue;
float LinearoccluderFragmentDepth = textureLod(dtex, vec2(ioccluder_uv) / screen, m).x;
float LinearoccluderFragmentDepth = textureLod(dtex, vec2(ioccluder_uv) / screen, max(m, 0.)).x;
vec3 OccluderPos = getXcYcZc(ioccluder_uv.x, ioccluder_uv.y, LinearoccluderFragmentDepth);
vec3 vi = OccluderPos - FragPos;

View File

@ -481,6 +481,15 @@ void IrrDriver::initDevice()
CVS->init();
if (UserConfigParams::m_shadows_resolution != 0 &&
(UserConfigParams::m_shadows_resolution < 512 ||
UserConfigParams::m_shadows_resolution > 2048))
{
Log::warn("IrrDriver", "Invalid value for UserConfigParams::m_shadows_resolution : %i",
(int)UserConfigParams::m_shadows_resolution);
UserConfigParams::m_shadows_resolution = 0;
}
// This remaps the window, so it has to be done before the clear to avoid flicker
m_device->setResizable(false);

View File

@ -95,7 +95,7 @@ static GFXPreset GFX_PRESETS[] =
},
{
true /* light */, 2 /* shadow */, true /* bloom */, true /* motionblur */,
true /* light */, 1024 /* shadow */, true /* bloom */, true /* motionblur */,
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
true /* animatedScenery */, 2 /* animatedCharacters */, 16 /* anisotropy */,
true /* depth of field */, true /* global illumination */
@ -442,9 +442,11 @@ void OptionsScreenVideo::updateTooltip()
tooltip = tooltip + L"\n" + _("Ambient occlusion : %s",
UserConfigParams::m_ssao ? enabled : disabled);
//I18N: in graphical options
tooltip = tooltip + L"\n" + _("Shadows: %s",
UserConfigParams::m_shadows_resolution == 1 ? "low" : UserConfigParams::m_shadows_resolution == 2 ?
"high" : disabled);
if (UserConfigParams::m_shadows_resolution == 0)
tooltip = tooltip + L"\n" + _("Shadows: %s", disabled);
else
tooltip = tooltip + L"\n" + _("Shadows: %i", UserConfigParams::m_shadows_resolution);
//I18N: in graphical options
tooltip = tooltip + L"\n" + _("Bloom : %s",
UserConfigParams::m_bloom ? enabled : disabled);