Revert "Merge sources.cmake change"
This reverts commit 03bff8819fcbf3e0f48752c2a79d80bfdb13fcb6, reversing changes made to 540c7818aaa554296f49813e68f0ce3f2307ce16.
This commit is contained in:
parent
03bff8819f
commit
0290564310
@ -9,7 +9,7 @@
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<scrollable_ribbon id="players" height="120" y="10" x="10" width="98%" align="center" label_location="each"
|
||||
square_items="true" child_width="128" child_height="128" />
|
||||
square_items="true" child_width="160" child_height="120" />
|
||||
|
||||
<spacer height="15" width="10"/>
|
||||
<div width="80%" align="center" layout="vertical-row" height="fit">
|
||||
|
@ -18,7 +18,7 @@
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<scrollable_ribbon id="players" height="120" y="10" x="10" width="98%" align="center" label_location="each"
|
||||
square_items="true" child_width="128" child_height="128" />
|
||||
square_items="true" child_width="160" child_height="120" />
|
||||
|
||||
<spacer height="15" width="10"/>
|
||||
<div width="80%" align="center" layout="vertical-row" height="fit">
|
||||
|
@ -1,16 +1,22 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float low;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getCIEYxy(vec3 rgbColor);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / 512;
|
||||
vec3 col = texture(tex, uv).xyz;
|
||||
float luma = getCIEYxy(col).x;
|
||||
vec3 col = texture(tex, uv).xyz;
|
||||
float luma = getCIEYxy(col).x;
|
||||
|
||||
col *= smoothstep(1., 10., luma);
|
||||
FragColor = vec4(col, 1.0);
|
||||
col *= smoothstep(1., 10., luma);
|
||||
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
|
@ -1,24 +1,19 @@
|
||||
uniform sampler2D tex_128;
|
||||
uniform sampler2D tex_256;
|
||||
uniform sampler2D tex_512;
|
||||
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
uniform sampler2D tex;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
vec4 col = .125 * texture(tex_128, uv);
|
||||
col += .25 * texture(tex_256, uv);
|
||||
col += .5 * texture(tex_512, uv);
|
||||
FragColor = vec4(col.xyz, 1.);
|
||||
vec4 col = texture(tex, uv);
|
||||
|
||||
col.xyz *= 10.0 * col.a;
|
||||
|
||||
FragColor = vec4(col.xyz, 1.);
|
||||
}
|
||||
|
@ -3,17 +3,16 @@ uniform float greenLmn[9];
|
||||
uniform float redLmn[9];
|
||||
uniform sampler2D ntex;
|
||||
uniform mat4 TransposeViewMatrix;
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define Diff gl_FragData[0]
|
||||
#define Spec gl_FragData[1]
|
||||
#endif
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
|
||||
@ -31,7 +30,6 @@ mat4 getMatrix(float L[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.);
|
||||
@ -45,4 +43,5 @@ void main(void)
|
||||
float b = dot(extendednormal, bmat * extendednormal);
|
||||
|
||||
Diff = max(0.25 * vec4(r, g, b, .1), vec4(0.));
|
||||
Spec = vec4(0.);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ layout (std140) uniform MatrixesData
|
||||
vec2 screen;
|
||||
};
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
float focalDepth = 10.;
|
||||
@ -19,7 +20,6 @@ float range = 100.;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float curdepth = texture(dtex, uv).x;
|
||||
vec4 FragPos = InverseProjectionMatrix * (2.0f * vec4(uv, curdepth, 1.0f) - 1.0f);
|
||||
FragPos /= FragPos.w;
|
||||
@ -82,5 +82,5 @@ void main()
|
||||
depth = (1 - depth);
|
||||
vec3 final = colOriginal.rgb * depth + col.rgb * (1 - depth);
|
||||
|
||||
FragColor = vec4(final, colOriginal.a);
|
||||
FragColor = vec4(final, 1.);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ layout (std140) uniform MatrixesData
|
||||
};
|
||||
#endif
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
@ -31,7 +32,6 @@ vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float z = texture(tex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
||||
|
||||
uniform layout(size1x16) restrict readonly image2D source;
|
||||
uniform layout(size1x16) volatile restrict writeonly image2D dest;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
layout (local_size_x = 8, local_size_y = 8) in;
|
||||
|
||||
shared float local_src[8 + 2 * 8][8];
|
||||
|
||||
void main()
|
||||
{
|
||||
int x = int(gl_LocalInvocationID.x), y = int(gl_LocalInvocationID.y);
|
||||
ivec2 uv = ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.y);
|
||||
local_src[x][y] = imageLoad(source, ivec2(uv) - ivec2(8, 0)).x;
|
||||
local_src[x + 8][y] = imageLoad(source, ivec2(uv)).x;
|
||||
local_src[x + 16][y] = imageLoad(source, ivec2(uv) + ivec2(8, 0)).x;
|
||||
|
||||
barrier();
|
||||
|
||||
float g0, g1, g2;
|
||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||
g1 = exp(-0.5 / (sigma * sigma));
|
||||
g2 = g1 * g1;
|
||||
float sum = local_src[x + 8][y] * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
for (int j = 1; j < 8; j++) {
|
||||
sum += local_src[8 + x - j][y] * g0;
|
||||
sum += local_src[8 + x + j][y] * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
}
|
||||
imageStore(dest, ivec2(uv), vec4(sum));
|
||||
}
|
||||
|
@ -4,14 +4,15 @@ uniform sampler2D tex;
|
||||
uniform vec2 pixel;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy * pixel;
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
|
||||
|
||||
float g0, g1, g2;
|
||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||
g1 = exp(-0.5 / (sigma * sigma));
|
||||
|
@ -4,14 +4,15 @@ uniform sampler2D tex;
|
||||
uniform vec2 pixel;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy * pixel;
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
|
||||
|
||||
float g0, g1, g2;
|
||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||
g1 = exp(-0.5 / (sigma * sigma));
|
||||
|
@ -3,20 +3,25 @@ uniform vec2 pixel;
|
||||
|
||||
// Gaussian separated blur with radius 3.
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy * pixel;
|
||||
vec4 sum = vec4(0.0);
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
vec4 sum = vec4(0.0);
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
|
||||
sum += texture(tex, vec2(X - 3.0 * pixel.x, Y)) * 0.03125;
|
||||
sum += texture(tex, vec2(X - 1.3333 * pixel.x, Y)) * 0.328125;
|
||||
sum += texture(tex, vec2(X, Y)) * 0.273438;
|
||||
sum += texture(tex, vec2(X + 1.3333 * pixel.x, Y)) * 0.328125;
|
||||
sum += texture(tex, vec2(X + 3.0 * pixel.x, Y)) * 0.03125;
|
||||
sum += texture(tex, vec2(X - 3.0 * pixel.x, Y)) * 0.03125;
|
||||
sum += texture(tex, vec2(X - 1.3333 * pixel.x, Y)) * 0.328125;
|
||||
sum += texture(tex, vec2(X, Y)) * 0.273438;
|
||||
sum += texture(tex, vec2(X + 1.3333 * pixel.x, Y)) * 0.328125;
|
||||
sum += texture(tex, vec2(X + 3.0 * pixel.x, Y)) * 0.03125;
|
||||
|
||||
FragColor = sum;
|
||||
FragColor = sum;
|
||||
}
|
||||
|
@ -3,20 +3,25 @@ uniform vec2 pixel;
|
||||
|
||||
// Gaussian separated blur with radius 3.
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy * pixel;
|
||||
vec4 sum = vec4(0.0);
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
vec4 sum = vec4(0.0);
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
|
||||
sum += texture(tex, vec2(X, Y - 3.0 * pixel.y)) * 0.03125;
|
||||
sum += texture(tex, vec2(X, Y - 1.3333 * pixel.y)) * 0.328125;
|
||||
sum += texture(tex, vec2(X, Y)) * 0.273438;
|
||||
sum += texture(tex, vec2(X, Y + 1.3333 * pixel.y)) * 0.328125;
|
||||
sum += texture(tex, vec2(X, Y + 3.0 * pixel.y)) * 0.03125;
|
||||
sum += texture(tex, vec2(X, Y - 3.0 * pixel.y)) * 0.03125;
|
||||
sum += texture(tex, vec2(X, Y - 1.3333 * pixel.y)) * 0.328125;
|
||||
sum += texture(tex, vec2(X, Y)) * 0.273438;
|
||||
sum += texture(tex, vec2(X, Y + 1.3333 * pixel.y)) * 0.328125;
|
||||
sum += texture(tex, vec2(X, Y + 3.0 * pixel.y)) * 0.03125;
|
||||
|
||||
FragColor = sum;
|
||||
FragColor = sum;
|
||||
}
|
||||
|
@ -3,22 +3,27 @@ uniform vec2 pixel;
|
||||
|
||||
// Gaussian separated blur with radius 6.
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy * pixel;
|
||||
vec4 sum = vec4(0.0);
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
vec4 sum = vec4(0.0);
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
|
||||
sum += texture(tex, vec2(X - 5.13333 * pixel.x, Y)) * 0.00640869;
|
||||
sum += texture(tex, vec2(X - 3.26667 * pixel.x, Y)) * 0.083313;
|
||||
sum += texture(tex, vec2(X - 1.4 * pixel.x, Y)) * 0.305481;
|
||||
sum += texture(tex, vec2(X, Y)) * 0.209473;
|
||||
sum += texture(tex, vec2(X + 1.4 * pixel.x, Y)) * 0.305481;
|
||||
sum += texture(tex, vec2(X + 3.26667 * pixel.x, Y)) * 0.083313;
|
||||
sum += texture(tex, vec2(X + 5.13333 * pixel.x, Y)) * 0.00640869;
|
||||
sum += texture(tex, vec2(X - 5.13333 * pixel.x, Y)) * 0.00640869;
|
||||
sum += texture(tex, vec2(X - 3.26667 * pixel.x, Y)) * 0.083313;
|
||||
sum += texture(tex, vec2(X - 1.4 * pixel.x, Y)) * 0.305481;
|
||||
sum += texture(tex, vec2(X, Y)) * 0.209473;
|
||||
sum += texture(tex, vec2(X + 1.4 * pixel.x, Y)) * 0.305481;
|
||||
sum += texture(tex, vec2(X + 3.26667 * pixel.x, Y)) * 0.083313;
|
||||
sum += texture(tex, vec2(X + 5.13333 * pixel.x, Y)) * 0.00640869;
|
||||
|
||||
FragColor = sum;
|
||||
FragColor = sum;
|
||||
}
|
||||
|
@ -3,22 +3,27 @@ uniform vec2 pixel;
|
||||
|
||||
// Gaussian separated blur with radius 6.
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy * pixel;
|
||||
vec4 sum = vec4(0.0);
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
vec4 sum = vec4(0.0);
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
|
||||
sum += texture(tex, vec2(X, Y - 5.13333 * pixel.y)) * 0.00640869;
|
||||
sum += texture(tex, vec2(X, Y - 3.26667 * pixel.y)) * 0.083313;
|
||||
sum += texture(tex, vec2(X, Y - 1.4 * pixel.y)) * 0.305481;
|
||||
sum += texture(tex, vec2(X, Y)) * 0.209473;
|
||||
sum += texture(tex, vec2(X, Y + 1.4 * pixel.y)) * 0.305481;
|
||||
sum += texture(tex, vec2(X, Y + 3.26667 * pixel.y)) * 0.083313;
|
||||
sum += texture(tex, vec2(X, Y + 5.13333 * pixel.y)) * 0.00640869;
|
||||
sum += texture(tex, vec2(X, Y - 5.13333 * pixel.y)) * 0.00640869;
|
||||
sum += texture(tex, vec2(X, Y - 3.26667 * pixel.y)) * 0.083313;
|
||||
sum += texture(tex, vec2(X, Y - 1.4 * pixel.y)) * 0.305481;
|
||||
sum += texture(tex, vec2(X, Y)) * 0.209473;
|
||||
sum += texture(tex, vec2(X, Y + 1.4 * pixel.y)) * 0.305481;
|
||||
sum += texture(tex, vec2(X, Y + 3.26667 * pixel.y)) * 0.083313;
|
||||
sum += texture(tex, vec2(X, Y + 5.13333 * pixel.y)) * 0.00640869;
|
||||
|
||||
FragColor = sum;
|
||||
FragColor = sum;
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
||||
|
||||
uniform layout(size1x16) restrict readonly image2D source;
|
||||
uniform layout(size1x16) volatile restrict writeonly image2D dest;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
layout (local_size_x = 8, local_size_y = 8) in;
|
||||
|
||||
shared float local_src[8][8 + 2 * 8];
|
||||
|
||||
void main()
|
||||
{
|
||||
int x = int(gl_LocalInvocationID.x), y = int(gl_LocalInvocationID.y);
|
||||
ivec2 uv = ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.y);
|
||||
local_src[x][y] = imageLoad(source, ivec2(uv) - ivec2(0, 8)).x;
|
||||
local_src[x][y + 8] = imageLoad(source, ivec2(uv)).x;
|
||||
local_src[x][y + 16] = imageLoad(source, ivec2(uv) + ivec2(0, 8)).x;
|
||||
|
||||
barrier();
|
||||
|
||||
float g0, g1, g2;
|
||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||
g1 = exp(-0.5 / (sigma * sigma));
|
||||
g2 = g1 * g1;
|
||||
float sum = local_src[x][y + 8] * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
for (int j = 1; j < 8; j++) {
|
||||
sum += local_src[x][y + 8 + j] * g0;
|
||||
sum += local_src[x][y + 8 - j] * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
}
|
||||
imageStore(dest, ivec2(uv), vec4(sum));
|
||||
}
|
||||
|
@ -38,7 +38,9 @@ vec3 SH2RGB (in vec4 sh_r, in vec4 sh_g, in vec4 sh_b, in vec3 dir)
|
||||
return vec3 (dot(Y,sh_r), dot(Y,sh_g), dot(Y,sh_b));
|
||||
}
|
||||
|
||||
out vec4 Diffuse;
|
||||
in vec2 uv;
|
||||
layout (location = 0) out vec4 Diffuse;
|
||||
layout (location = 1) out vec4 Specular;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
@ -47,7 +49,6 @@ vec3 resolution = vec3(32, 16, 32);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
vec3 GI = vec3(0.);
|
||||
|
||||
float depth = texture2D(dtex, uv).x;
|
||||
@ -96,4 +97,5 @@ void main()
|
||||
GI /= 4;
|
||||
|
||||
Diffuse = max(16. * vec4(GI, 1.), vec4(0.));
|
||||
Specular = vec4(0.);
|
||||
}
|
||||
|
@ -2,21 +2,11 @@ uniform sampler2D tex;
|
||||
uniform float zn;
|
||||
uniform float zf;
|
||||
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
|
||||
in vec2 uv;
|
||||
out float Depth;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float d = texture(tex, uv).x;
|
||||
float c0 = zn * zf, c1 = zn - zf, c2 = zf;
|
||||
Depth = c0 / (d * c1 + c2);
|
||||
|
@ -1,15 +1,7 @@
|
||||
uniform sampler2D edgesMap;
|
||||
uniform sampler2D areaMap;
|
||||
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
uniform vec2 PIXEL_SIZE;
|
||||
|
||||
#define MAX_SEARCH_STEPS 8.0
|
||||
#define MAX_DISTANCE 33.0
|
||||
@ -24,7 +16,7 @@ out vec4 FragColor;
|
||||
* bit.
|
||||
*/
|
||||
vec4 tex2Doffset(sampler2D map, vec2 texcoord, vec2 offset) {
|
||||
return textureLod(map, texcoord + offset / screen, 0.0);
|
||||
return textureLod(map, texcoord + PIXEL_SIZE * offset, 0.0);
|
||||
}
|
||||
|
||||
float SearchXLeft(vec2 texcoord) {
|
||||
@ -95,7 +87,7 @@ void main() {
|
||||
|
||||
// Now fetch the crossing edges. Instead of sampling between edgels, we
|
||||
// sample at 0.25, to be able to discern what value has each edgel:
|
||||
vec4 coords = vec4(d.x, 0.25, d.y + 1.0, 0.25) / screen.xyxy + uv.xyxy;
|
||||
vec4 coords = vec4(d.x, 0.25, d.y + 1.0, 0.25) * PIXEL_SIZE.xyxy + uv.xyxy;
|
||||
float e1 = textureLod(edgesMap, coords.xy, 0.0).r;
|
||||
float e2 = textureLod(edgesMap, coords.zw, 0.0).r;
|
||||
|
||||
@ -110,7 +102,7 @@ void main() {
|
||||
vec2 d = vec2(SearchYUp(uv), SearchYDown(uv));
|
||||
|
||||
// Now fetch the crossing edges (yet again):
|
||||
vec4 coords = vec4(-0.25, d.x, -0.25, d.y - 1.0) / screen.xyxy + uv.xyxy;
|
||||
vec4 coords = vec4(-0.25, d.x, -0.25, d.y - 1.0) * PIXEL_SIZE.xyxy + uv.xyxy;
|
||||
float e1 = textureLod(edgesMap, coords.xy, 0.0).g;
|
||||
float e2 = textureLod(edgesMap, coords.zw, 0.0).g;
|
||||
|
||||
|
@ -1,12 +1,4 @@
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
uniform vec2 PIXEL_SIZE;
|
||||
|
||||
in vec2 Position;
|
||||
in vec2 Texcoord;
|
||||
@ -20,6 +12,6 @@ void main() {
|
||||
// invy.y = 1.0 - invy.y;
|
||||
uv = invy.st;
|
||||
|
||||
offset[0] = invy.xyxy + vec4(-1.0, 0.0, 0.0, 1.0) / screen.xyxy;
|
||||
offset[1] = invy.xyxy + vec4( 1.0, 0.0, 0.0, -1.0) / screen.xyxy;
|
||||
offset[0] = invy.xyxy + PIXEL_SIZE.xyxy * vec4(-1.0, 0.0, 0.0, 1.0);
|
||||
offset[1] = invy.xyxy + PIXEL_SIZE.xyxy * vec4( 1.0, 0.0, 0.0, -1.0);
|
||||
}
|
||||
|
@ -40,24 +40,20 @@ uniform float mask_radius;
|
||||
// Maximum height of texture used
|
||||
uniform float max_tex_height;
|
||||
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
// Number of samples used for blurring
|
||||
#define NB_SAMPLES 8
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texcoords = gl_FragCoord.xy / screen;
|
||||
vec2 texcoords = uv;
|
||||
|
||||
// Sample the color buffer
|
||||
vec3 color = texture(color_buffer, texcoords).rgb;
|
||||
|
@ -34,6 +34,7 @@ vec4 DirToSh(vec3 dir, float flux)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
vec3 normalizedRHCenter = 2. * vec3(gl_FragCoord.xy, slice) / resolution - 1.;
|
||||
vec3 RHcenter = (RHMatrix * vec4(normalizedRHCenter * extents, 1.)).xyz;
|
||||
|
||||
|
@ -22,6 +22,7 @@ layout (std140) uniform MatrixesData
|
||||
};
|
||||
#endif
|
||||
|
||||
in vec2 uv;
|
||||
out float AO;
|
||||
|
||||
const float sigma = 1.;
|
||||
@ -45,7 +46,6 @@ vec3 getXcYcZc(int x, int y, float zC)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float lineardepth = textureLod(dtex, uv, 0.).x;
|
||||
int x = int(gl_FragCoord.x), y = int(gl_FragCoord.y);
|
||||
vec3 FragPos = getXcYcZc(x, y, lineardepth);
|
||||
|
@ -21,19 +21,25 @@ layout (std140) uniform MatrixesData
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define Diff gl_FragData[0]
|
||||
#define Spec gl_FragData[1]
|
||||
#endif
|
||||
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float z = texture(dtex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
|
@ -24,7 +24,6 @@ layout (std140) uniform MatrixesData
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -69,7 +68,6 @@ float getShadowFactor(vec3 pos, float bias, int index)
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float z = texture(dtex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
|
@ -5,16 +5,7 @@ uniform sampler2D logluminancetex;
|
||||
uniform float exposure = .09;
|
||||
uniform float Lwhite = 1.;
|
||||
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getCIEYxy(vec3 rgbColor);
|
||||
@ -26,7 +17,6 @@ float saturation = 1.;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
vec4 col = texture(tex, uv);
|
||||
float avgLw = textureLod(logluminancetex, uv, 10.).x;
|
||||
avgLw = max(exp(avgLw) - delta, delta);
|
||||
@ -43,5 +33,6 @@ void main()
|
||||
// Uncharted2 tonemap with Auria's custom coefficients
|
||||
vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.2 * col + 1.7) + 0.06);
|
||||
perChannel = pow(perChannel, vec4(2.2));
|
||||
FragColor = vec4(perChannel.xyz, col.a);
|
||||
FragColor = vec4(perChannel.xyz, 1.);
|
||||
|
||||
}
|
||||
|
@ -237,10 +237,8 @@ when the border that intersect at this corner are enabled.
|
||||
<!-- Text field color -->
|
||||
<color type="text_field" state="background" a="255" r="200" g="200" b="200" />
|
||||
<color type="text_field" state="background_focused" a="255" r="223" g="238" b="248" />
|
||||
<color type="text_field" state="background_deactivated" a="255" r="200" g="200" b="200" />
|
||||
<color type="text_field" state="neutral" a="255" r="138" g="138" b="138" />
|
||||
<color type="text_field" state="focused" a="255" r="42" g="169" b="211" />
|
||||
<color type="text_field" state="deactivated" a="255" r="138" g="138" b="138" />
|
||||
|
||||
<!-- Rating star image -->
|
||||
<element type="rating" state="neutral" image="ocean/rating_star.png" />
|
||||
|
@ -235,10 +235,8 @@ when the border that intersect at this corner are enabled.
|
||||
<!-- Text field color -->
|
||||
<color type="text_field" state="background" a="255" r="200" g="200" b="200" />
|
||||
<color type="text_field" state="background_focused" a="255" r="236" g="226" b="201" />
|
||||
<color type="text_field" state="background_deactivated" a="255" r="200" g="200" b="200" />
|
||||
<color type="text_field" state="neutral" a="255" r="138" g="138" b="138" />
|
||||
<color type="text_field" state="focused" a="255" r="243" g="164" b="80" />
|
||||
<color type="text_field" state="deactivated" a="255" r="138" g="138" b="138" />
|
||||
|
||||
<!-- Rating star image -->
|
||||
<element type="rating" state="neutral" image="peach/rating_star.png" />
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,3 @@
|
||||
# Modify this file to change the last-modified date when you add/remove a file.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
||||
|
@ -49,10 +49,9 @@ NewsManager::~NewsManager()
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** This function initialises the data for the news manager. It starts a
|
||||
* separate thread to execute downloadNews() - which (if necessary) downaloads
|
||||
* the news.xml file and updates the list of news messages. It also
|
||||
* initialises the addons manager (which can trigger another download of
|
||||
* news.xml).
|
||||
* separate thread to execute downloadNews() - which (if necessary) the
|
||||
* news.xml file and updating the list of news messages. It also initialises
|
||||
* the addons manager (which can trigger another download of news.xml).
|
||||
* \param force_refresh Re-download news.xml, even if
|
||||
*/
|
||||
void NewsManager::init(bool force_refresh)
|
||||
@ -184,7 +183,7 @@ void* NewsManager::downloadNews(void *obj)
|
||||
|
||||
if(xml) delete xml;
|
||||
xml = NULL;
|
||||
|
||||
|
||||
// Process new.xml now.
|
||||
if(file_manager->fileExists(xml_file))
|
||||
{
|
||||
@ -195,10 +194,6 @@ void* NewsManager::downloadNews(void *obj)
|
||||
delete xml;
|
||||
}
|
||||
|
||||
// We can't finish stk (esp. delete the file manager) before
|
||||
// this part of the code is reached (since otherwise the file
|
||||
// manager might be access after it was deleted).
|
||||
me->setCanBeDeleted();
|
||||
pthread_exit(NULL);
|
||||
return 0; // prevent warning
|
||||
} // downloadNews
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <irrString.h>
|
||||
using namespace irr;
|
||||
|
||||
#include "utils/can_be_deleted.hpp"
|
||||
#include "utils/synchronised.hpp"
|
||||
|
||||
class XMLNode;
|
||||
@ -33,7 +32,7 @@ class XMLNode;
|
||||
/**
|
||||
* \ingroup addonsgroup
|
||||
*/
|
||||
class NewsManager : public CanBeDeleted
|
||||
class NewsManager
|
||||
{
|
||||
private:
|
||||
static NewsManager *m_news_manager;
|
||||
|
@ -268,7 +268,7 @@ void PlayerManager::save()
|
||||
|
||||
if(m_current_player && UserConfigParams::m_remember_user)
|
||||
{
|
||||
players_file << L" <current player=\""
|
||||
players_file << L" <current player=\""
|
||||
<< m_current_player->getName() << L"\"/>\n";
|
||||
}
|
||||
|
||||
@ -468,7 +468,7 @@ PlayerProfile *PlayerManager::getPlayer(const irr::core::stringw &name)
|
||||
} // getPlayer
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Sets the current player. This is the player that is used for story mode
|
||||
* and achievements.
|
||||
* and achievements.
|
||||
* \param Player profile to be the current player.
|
||||
*/
|
||||
void PlayerManager::setCurrentPlayer(PlayerProfile *player)
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
class AchievementsStatus;
|
||||
|
||||
namespace Online
|
||||
namespace Online
|
||||
{
|
||||
class CurrentUser;
|
||||
class HTTPRequest;
|
||||
@ -42,10 +42,10 @@ class PlayerProfile;
|
||||
|
||||
/** A special class that manages all local player accounts. It reads all player
|
||||
* accounts from the players.xml file in the user config directory. For each
|
||||
* player an instance of PlayerProfile is created, which keeps track of
|
||||
* player an instance of PlayerProfile is created, which keeps track of
|
||||
* story mode progress, achievements and other data. It also keeps track of
|
||||
* the currently logged in player.
|
||||
* It includes several handy static functions which avoid long call
|
||||
* It includes several handy static functions which avoid long call
|
||||
* sequences, e.g.:
|
||||
* PlayerManager::getCurrentOnlineId()
|
||||
* which is just:
|
||||
@ -116,9 +116,9 @@ public:
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current player. */
|
||||
static PlayerProfile* getCurrentPlayer()
|
||||
static PlayerProfile* getCurrentPlayer()
|
||||
{
|
||||
return get()->m_current_player;
|
||||
return get()->m_current_player;
|
||||
} // getCurrentPlayer
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -61,7 +61,7 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest)
|
||||
* as soon as the network thread is started) to avoid the player having to
|
||||
* wait for the login to finish , which needs the main player data (i.e.
|
||||
* the default player, and saved session data). So the constructor only
|
||||
* reads this data, the rest of the player data is handled in
|
||||
* reads this data, the rest of the player data is handled in
|
||||
* loadRemainingData later in the initialisation process.
|
||||
* \param node The XML node representing this player.
|
||||
*/
|
||||
@ -156,7 +156,7 @@ void PlayerProfile::addIcon()
|
||||
// followed by .png or .jpg.
|
||||
std::ostringstream out;
|
||||
out << m_unique_id <<"."<<StringUtils::getExtension(source);
|
||||
if(file_manager->copyFile(source,
|
||||
if(file_manager->copyFile(source,
|
||||
file_manager->getUserConfigFile(out.str())) )
|
||||
{
|
||||
m_icon_filename = out.str();
|
||||
@ -172,7 +172,7 @@ void PlayerProfile::addIcon()
|
||||
* file is undefined, it returns a "?" mark texture. Note, getAsset does
|
||||
* not return a reference, but only a temporary string. So we must return a
|
||||
* copy of the string (not a reference to).
|
||||
*/
|
||||
*/
|
||||
const std::string PlayerProfile::getIconFilename() const
|
||||
{
|
||||
// If the icon file is undefined or does not exist, return the "?" icon
|
||||
@ -200,7 +200,7 @@ void PlayerProfile::save(UTFWriter &out)
|
||||
out << L" unique-id=\"" << m_unique_id
|
||||
<< L"\" saved-session=\"" << m_saved_session << L"\"\n";
|
||||
|
||||
out << L" saved-user=\"" << m_saved_user_id
|
||||
out << L" saved-user=\"" << m_saved_user_id
|
||||
<< L"\" saved-token=\"" << m_saved_token << L"\"\n";
|
||||
out << L" last-online-name=\"" << m_last_online_name
|
||||
<< L"\" last-was-online=\"" << m_last_was_online<< L"\">\n";
|
||||
|
@ -32,7 +32,7 @@ using namespace irr;
|
||||
class AchievementsStatus;
|
||||
namespace Online
|
||||
{
|
||||
class CurrentUser;
|
||||
class CurrentUser;
|
||||
class HTTPRequest;
|
||||
class OnlineProfile;
|
||||
class XMLRequest;
|
||||
@ -167,9 +167,9 @@ public:
|
||||
} // isGuestAccount
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the last used online name. */
|
||||
const core::stringw& getLastOnlineName() const
|
||||
const core::stringw& getLastOnlineName() const
|
||||
{
|
||||
return m_last_online_name;
|
||||
return m_last_online_name;
|
||||
} // getLastOnlineName
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the last used online name. */
|
||||
@ -250,7 +250,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** If a session was saved, return the id of the saved user. */
|
||||
int getSavedUserId() const
|
||||
{
|
||||
{
|
||||
assert(m_saved_session);
|
||||
return m_saved_user_id;
|
||||
} // getSavedUserId
|
||||
|
@ -262,8 +262,6 @@ void DisplaceProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
|
||||
void DisplaceProvider::update()
|
||||
{
|
||||
if (World::getWorld() == NULL) return;
|
||||
|
||||
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
|
||||
const float speed = World::getWorld()->getTrack()->getDisplacementSpeed();
|
||||
|
||||
|
@ -346,7 +346,7 @@ void Camera::smoothMoveCamera(float dt)
|
||||
|
||||
if ((m_kart->getSpeed() > 5 ) || (m_kart->getSpeed() < 0 ))
|
||||
{
|
||||
current_position += ((wanted_position - current_position) * dt
|
||||
current_position += ((wanted_position - current_position) * dt
|
||||
* (m_kart->getSpeed()>0 ? m_kart->getSpeed()/3 + 1.0f
|
||||
: -1.5f * m_kart->getSpeed() + 2.0f));
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,239 +1,232 @@
|
||||
#ifndef GLWRAP_HEADER_H
|
||||
#define GLWRAP_HEADER_H
|
||||
|
||||
#if defined(__APPLE__)
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/gl3.h>
|
||||
# define OGL32CTX
|
||||
# ifdef GL_ARB_instanced_arrays
|
||||
# define glVertexAttribDivisor glVertexAttribDivisorARB
|
||||
# endif
|
||||
# ifndef GL_TEXTURE_SWIZZLE_RGBA
|
||||
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
|
||||
# endif
|
||||
#elif defined(ANDROID)
|
||||
# include <GLES/gl.h>
|
||||
#elif defined(WIN32)
|
||||
# define _WINSOCKAPI_
|
||||
// has to be included before gl.h because of WINGDIAPI and APIENTRY definitions
|
||||
# include <windows.h>
|
||||
# include <GL/gl.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define DEBUG_OUTPUT_DECLARED
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include "utils/log.hpp"
|
||||
|
||||
// already includes glext.h, which defines useful GL constants.
|
||||
// COpenGLDriver has already loaded the extension GL functions we use (e.g glBeginQuery)
|
||||
#include "../../lib/irrlicht/source/Irrlicht/COpenGLDriver.h"
|
||||
#ifdef WIN32
|
||||
extern PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks;
|
||||
extern PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback;
|
||||
extern PFNGLDRAWTRANSFORMFEEDBACKPROC glDrawTransformFeedback;
|
||||
extern PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
|
||||
extern PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback;
|
||||
extern PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings;
|
||||
extern PFNGLBINDBUFFERBASEPROC glBindBufferBase;
|
||||
extern PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
extern PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
extern PFNGLBUFFERDATAPROC glBufferData;
|
||||
extern PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
extern PFNGLCREATESHADERPROC glCreateShader;
|
||||
extern PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
extern PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
extern PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
extern PFNGLATTACHSHADERPROC glAttachShader;
|
||||
extern PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
extern PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
extern PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
||||
extern PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
||||
extern PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
|
||||
extern PFNGLUNIFORM1FPROC glUniform1f;
|
||||
extern PFNGLUNIFORM3FPROC glUniform3f;
|
||||
extern PFNGLUNIFORM1FVPROC glUniform1fv;
|
||||
extern PFNGLUNIFORM4FVPROC glUniform4fv;
|
||||
extern PFNGLDELETESHADERPROC glDeleteShader;
|
||||
extern PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
extern PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
||||
extern PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
extern PFNGLUNIFORM2FPROC glUniform2f;
|
||||
extern PFNGLUNIFORM1IPROC glUniform1i;
|
||||
extern PFNGLUNIFORM3IPROC glUniform3i;
|
||||
extern PFNGLUNIFORM4IPROC glUniform4i;
|
||||
extern PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
extern PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
|
||||
extern PFNGLBLENDEQUATIONPROC glBlendEquation;
|
||||
extern PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
|
||||
extern PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
|
||||
extern PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
|
||||
extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
extern PFNGLTEXBUFFERPROC glTexBuffer;
|
||||
extern PFNGLBUFFERSUBDATAPROC glBufferSubData;
|
||||
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
|
||||
extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
||||
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||
extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
||||
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||
extern PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture;
|
||||
extern PFNGLTEXIMAGE3DPROC glTexImage3D;
|
||||
extern PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
|
||||
extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
|
||||
extern PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
|
||||
extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
||||
extern PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex;
|
||||
extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
|
||||
extern PFNGLBLENDCOLORPROC glBlendColor;
|
||||
extern PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
|
||||
extern PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
|
||||
extern PFNGLTEXSTORAGE1DPROC glTexStorage1D;
|
||||
extern PFNGLTEXSTORAGE2DPROC glTexStorage2D;
|
||||
extern PFNGLTEXSTORAGE3DPROC glTexStorage3D;
|
||||
extern PFNGLBINDIMAGETEXTUREPROC glBindImageTexture;
|
||||
extern PFNGLDISPATCHCOMPUTEPROC glDispatchCompute;
|
||||
#ifdef DEBUG
|
||||
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
void initGL();
|
||||
GLuint LoadTFBProgram(const char * vertex_file_path, const char **varyings, unsigned varyingscount);
|
||||
void setTexture(unsigned TextureUnit, GLuint TextureId, GLenum MagFilter, GLenum MinFilter, bool allowAF = false);
|
||||
GLuint LoadShader(const char * file, unsigned type);
|
||||
|
||||
template<typename ... Types>
|
||||
void loadAndAttach(GLint ProgramID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
template<typename ... Types>
|
||||
void loadAndAttach(GLint ProgramID, GLint ShaderType, const char *filepath, Types ... args)
|
||||
{
|
||||
GLint ShaderID = LoadShader(filepath, ShaderType);
|
||||
glAttachShader(ProgramID, ShaderID);
|
||||
glDeleteShader(ShaderID);
|
||||
loadAndAttach(ProgramID, args...);
|
||||
}
|
||||
|
||||
template<typename ...Types>
|
||||
void printFileList()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
template<typename ...Types>
|
||||
void printFileList(GLint ShaderType, const char *filepath, Types ... args)
|
||||
{
|
||||
Log::error("GLWrapp", filepath);
|
||||
printFileList(args...);
|
||||
}
|
||||
|
||||
template<typename ... Types>
|
||||
GLint LoadProgram(Types ... args)
|
||||
{
|
||||
GLint ProgramID = glCreateProgram();
|
||||
loadAndAttach(ProgramID, args...);
|
||||
glLinkProgram(ProgramID);
|
||||
|
||||
GLint Result = GL_FALSE;
|
||||
int InfoLogLength;
|
||||
glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
|
||||
if (Result == GL_FALSE) {
|
||||
Log::error("GLWrapp", "Error when linking these shaders :");
|
||||
printFileList(args...);
|
||||
glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
|
||||
char *ErrorMessage = new char[InfoLogLength];
|
||||
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, ErrorMessage);
|
||||
Log::error("GLWrapp", ErrorMessage);
|
||||
delete[] ErrorMessage;
|
||||
}
|
||||
|
||||
GLenum glErr = glGetError();
|
||||
if (glErr != GL_NO_ERROR)
|
||||
{
|
||||
Log::warn("IrrDriver", "GLWrap : OpenGL error %i\n", glErr);
|
||||
}
|
||||
|
||||
return ProgramID;
|
||||
}
|
||||
|
||||
class GPUTimer;
|
||||
|
||||
class ScopedGPUTimer
|
||||
{
|
||||
public:
|
||||
ScopedGPUTimer(GPUTimer &);
|
||||
~ScopedGPUTimer();
|
||||
};
|
||||
|
||||
class GPUTimer
|
||||
{
|
||||
friend class ScopedGPUTimer;
|
||||
GLuint query;
|
||||
bool initialised;
|
||||
public:
|
||||
GPUTimer();
|
||||
unsigned elapsedTimeus();
|
||||
};
|
||||
|
||||
class FrameBuffer
|
||||
{
|
||||
private:
|
||||
GLuint fbo;
|
||||
std::vector<GLuint> RenderTargets;
|
||||
GLuint DepthTexture;
|
||||
size_t width, height;
|
||||
public:
|
||||
FrameBuffer();
|
||||
FrameBuffer(const std::vector <GLuint> &RTTs, size_t w, size_t h, bool layered = false);
|
||||
FrameBuffer(const std::vector <GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered = false);
|
||||
~FrameBuffer();
|
||||
void Bind();
|
||||
std::vector<GLuint> &getRTT() { return RenderTargets; }
|
||||
GLuint &getDepthTexture() { assert(DepthTexture); return DepthTexture; }
|
||||
size_t getWidth() const { return width; }
|
||||
size_t getHeight() const { return height; }
|
||||
static void Blit(const FrameBuffer &Src, FrameBuffer &Dst, GLbitfield mask = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
|
||||
void BlitToDefault(size_t, size_t, size_t, size_t);
|
||||
};
|
||||
|
||||
// core::rect<s32> needs these includes
|
||||
#include <rect.h>
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
GLuint getTextureGLuint(irr::video::ITexture *tex);
|
||||
GLuint getDepthTexture(irr::video::ITexture *tex);
|
||||
void resetTextureTable();
|
||||
void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha = false);
|
||||
bool loadCompressedTexture(const std::string& compressed_tex);
|
||||
void saveCompressedTexture(const std::string& compressed_tex);
|
||||
|
||||
void draw3DLine(const core::vector3df& start,
|
||||
const core::vector3df& end, irr::video::SColor color);
|
||||
|
||||
void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
|
||||
const core::rect<s32>& destRect,
|
||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
|
||||
bool useAlphaChannelOfTexture);
|
||||
|
||||
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
|
||||
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
|
||||
const irr::video::SColor &color, bool useAlphaChannelOfTexture);
|
||||
|
||||
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
|
||||
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
|
||||
const irr::video::SColor* const colors, bool useAlphaChannelOfTexture);
|
||||
|
||||
void GL32_draw2DRectangle(irr::video::SColor color, const irr::core::rect<s32>& position,
|
||||
const irr::core::rect<s32>* clip = 0);
|
||||
#endif
|
||||
#ifndef GLWRAP_HEADER_H
|
||||
#define GLWRAP_HEADER_H
|
||||
|
||||
#if defined(__APPLE__)
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/gl3.h>
|
||||
# define OGL32CTX
|
||||
# ifdef GL_ARB_instanced_arrays
|
||||
# define glVertexAttribDivisor glVertexAttribDivisorARB
|
||||
# endif
|
||||
# ifndef GL_TEXTURE_SWIZZLE_RGBA
|
||||
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
|
||||
# endif
|
||||
#elif defined(ANDROID)
|
||||
# include <GLES/gl.h>
|
||||
#elif defined(WIN32)
|
||||
# define _WINSOCKAPI_
|
||||
// has to be included before gl.h because of WINGDIAPI and APIENTRY definitions
|
||||
# include <windows.h>
|
||||
# include <GL/gl.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define DEBUG_OUTPUT_DECLARED
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include "utils/log.hpp"
|
||||
|
||||
// already includes glext.h, which defines useful GL constants.
|
||||
// COpenGLDriver has already loaded the extension GL functions we use (e.g glBeginQuery)
|
||||
#include "../../lib/irrlicht/source/Irrlicht/COpenGLDriver.h"
|
||||
#ifdef WIN32
|
||||
extern PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks;
|
||||
extern PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback;
|
||||
extern PFNGLDRAWTRANSFORMFEEDBACKPROC glDrawTransformFeedback;
|
||||
extern PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
|
||||
extern PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback;
|
||||
extern PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings;
|
||||
extern PFNGLBINDBUFFERBASEPROC glBindBufferBase;
|
||||
extern PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
extern PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
extern PFNGLBUFFERDATAPROC glBufferData;
|
||||
extern PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
extern PFNGLCREATESHADERPROC glCreateShader;
|
||||
extern PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
extern PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
extern PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
extern PFNGLATTACHSHADERPROC glAttachShader;
|
||||
extern PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
extern PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
extern PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
||||
extern PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
||||
extern PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
|
||||
extern PFNGLUNIFORM1FPROC glUniform1f;
|
||||
extern PFNGLUNIFORM3FPROC glUniform3f;
|
||||
extern PFNGLUNIFORM1FVPROC glUniform1fv;
|
||||
extern PFNGLUNIFORM4FVPROC glUniform4fv;
|
||||
extern PFNGLDELETESHADERPROC glDeleteShader;
|
||||
extern PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
extern PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
||||
extern PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
extern PFNGLUNIFORM2FPROC glUniform2f;
|
||||
extern PFNGLUNIFORM1IPROC glUniform1i;
|
||||
extern PFNGLUNIFORM3IPROC glUniform3i;
|
||||
extern PFNGLUNIFORM4IPROC glUniform4i;
|
||||
extern PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
extern PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
|
||||
extern PFNGLBLENDEQUATIONPROC glBlendEquation;
|
||||
extern PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
|
||||
extern PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
|
||||
extern PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
|
||||
extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
extern PFNGLTEXBUFFERPROC glTexBuffer;
|
||||
extern PFNGLBUFFERSUBDATAPROC glBufferSubData;
|
||||
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
|
||||
extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
||||
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||
extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
||||
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||
extern PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture;
|
||||
extern PFNGLTEXIMAGE3DPROC glTexImage3D;
|
||||
extern PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
|
||||
extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
|
||||
extern PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
|
||||
extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
||||
extern PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex;
|
||||
extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
|
||||
extern PFNGLBLENDCOLORPROC glBlendColor;
|
||||
extern PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
|
||||
extern PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
|
||||
extern PFNGLTEXSTORAGE1DPROC glTexStorage1D;
|
||||
extern PFNGLTEXSTORAGE2DPROC glTexStorage2D;
|
||||
extern PFNGLTEXSTORAGE3DPROC glTexStorage3D;
|
||||
#ifdef DEBUG
|
||||
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
void initGL();
|
||||
GLuint LoadTFBProgram(const char * vertex_file_path, const char **varyings, unsigned varyingscount);
|
||||
void setTexture(unsigned TextureUnit, GLuint TextureId, GLenum MagFilter, GLenum MinFilter, bool allowAF = false);
|
||||
GLuint LoadShader(const char * file, unsigned type);
|
||||
|
||||
template<typename ... Types>
|
||||
void loadAndAttach(GLint ProgramID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
template<typename ... Types>
|
||||
void loadAndAttach(GLint ProgramID, GLint ShaderType, const char *filepath, Types ... args)
|
||||
{
|
||||
GLint ShaderID = LoadShader(filepath, ShaderType);
|
||||
glAttachShader(ProgramID, ShaderID);
|
||||
glDeleteShader(ShaderID);
|
||||
loadAndAttach(ProgramID, args...);
|
||||
}
|
||||
|
||||
template<typename ...Types>
|
||||
void printFileList()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
template<typename ...Types>
|
||||
void printFileList(GLint ShaderType, const char *filepath, Types ... args)
|
||||
{
|
||||
Log::error("GLWrapp", filepath);
|
||||
printFileList(args...);
|
||||
}
|
||||
|
||||
template<typename ... Types>
|
||||
GLint LoadProgram(Types ... args)
|
||||
{
|
||||
GLint ProgramID = glCreateProgram();
|
||||
loadAndAttach(ProgramID, args...);
|
||||
glLinkProgram(ProgramID);
|
||||
|
||||
GLint Result = GL_FALSE;
|
||||
int InfoLogLength;
|
||||
glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
|
||||
if (Result == GL_FALSE) {
|
||||
Log::error("GLWrapp", "Error when linking these shaders :");
|
||||
printFileList(args...);
|
||||
glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
|
||||
char *ErrorMessage = new char[InfoLogLength];
|
||||
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, ErrorMessage);
|
||||
Log::error("GLWrapp", ErrorMessage);
|
||||
delete[] ErrorMessage;
|
||||
}
|
||||
|
||||
GLenum glErr = glGetError();
|
||||
if (glErr != GL_NO_ERROR)
|
||||
{
|
||||
Log::warn("IrrDriver", "GLWrap : OpenGL error %i\n", glErr);
|
||||
}
|
||||
|
||||
return ProgramID;
|
||||
}
|
||||
|
||||
class GPUTimer;
|
||||
|
||||
class ScopedGPUTimer
|
||||
{
|
||||
public:
|
||||
ScopedGPUTimer(GPUTimer &);
|
||||
~ScopedGPUTimer();
|
||||
};
|
||||
|
||||
class GPUTimer
|
||||
{
|
||||
friend class ScopedGPUTimer;
|
||||
GLuint query;
|
||||
bool initialised;
|
||||
public:
|
||||
GPUTimer();
|
||||
unsigned elapsedTimeus();
|
||||
};
|
||||
|
||||
class FrameBuffer
|
||||
{
|
||||
private:
|
||||
GLuint fbo;
|
||||
std::vector<GLuint> RenderTargets;
|
||||
GLuint DepthTexture;
|
||||
size_t width, height;
|
||||
public:
|
||||
FrameBuffer();
|
||||
FrameBuffer(const std::vector <GLuint> &RTTs, size_t w, size_t h, bool layered = false);
|
||||
FrameBuffer(const std::vector <GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered = false);
|
||||
~FrameBuffer();
|
||||
void Bind();
|
||||
std::vector<GLuint> &getRTT() { return RenderTargets; }
|
||||
GLuint &getDepthTexture() { assert(DepthTexture); return DepthTexture; }
|
||||
size_t getWidth() const { return width; }
|
||||
size_t getHeight() const { return height; }
|
||||
static void Blit(const FrameBuffer &Src, FrameBuffer &Dst, GLbitfield mask = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
|
||||
void BlitToDefault(size_t, size_t, size_t, size_t);
|
||||
};
|
||||
|
||||
// core::rect<s32> needs these includes
|
||||
#include <rect.h>
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
GLuint getTextureGLuint(irr::video::ITexture *tex);
|
||||
GLuint getDepthTexture(irr::video::ITexture *tex);
|
||||
void resetTextureTable();
|
||||
void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha = false);
|
||||
bool loadCompressedTexture(const std::string& compressed_tex);
|
||||
void saveCompressedTexture(const std::string& compressed_tex);
|
||||
|
||||
void draw3DLine(const core::vector3df& start,
|
||||
const core::vector3df& end, irr::video::SColor color);
|
||||
|
||||
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
|
||||
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
|
||||
const irr::video::SColor &color, bool useAlphaChannelOfTexture);
|
||||
|
||||
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
|
||||
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
|
||||
const irr::video::SColor* const colors, bool useAlphaChannelOfTexture);
|
||||
|
||||
void GL32_draw2DRectangle(irr::video::SColor color, const irr::core::rect<s32>& position,
|
||||
const irr::core::rect<s32>* clip = 0);
|
||||
#endif
|
||||
|
@ -211,10 +211,7 @@ Window get_toplevel_parent(Display* display, Window window)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** If the position of the window should be remembered, store it in the config
|
||||
* file.
|
||||
* \post The user config file must still be saved!
|
||||
*/
|
||||
|
||||
void IrrDriver::updateConfigIfRelevant()
|
||||
{
|
||||
if (!UserConfigParams::m_fullscreen &&
|
||||
@ -244,6 +241,7 @@ void IrrDriver::updateConfigIfRelevant()
|
||||
{
|
||||
UserConfigParams::m_window_x = x;
|
||||
UserConfigParams::m_window_y = y;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -267,10 +265,11 @@ void IrrDriver::updateConfigIfRelevant()
|
||||
{
|
||||
UserConfigParams::m_window_x = wx;
|
||||
UserConfigParams::m_window_y = wy;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // updateConfigIfRelevant
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Gets a list of supported video modes from the irrlicht device. This data
|
||||
@ -1261,8 +1260,8 @@ void IrrDriver::unsetTextureErrorMessage()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Retrieve all textures in the specified directory, generate a smaller
|
||||
* version for each of them and save them in the cache. Smaller textures are
|
||||
* generated only if they do not already exist or if their original version
|
||||
* version for each of them and save them in the cache. Smaller textures are
|
||||
* generated only if they do not already exist or if their original version
|
||||
* is newer than the cached one.
|
||||
* \param dir Directory from where textures will be retrieved.
|
||||
* Must end with '/'.
|
||||
@ -1557,11 +1556,6 @@ video::ITexture* IrrDriver::applyMask(video::ITexture* texture,
|
||||
return t;
|
||||
} // applyMask
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::setRTT(RTT* rtt)
|
||||
{
|
||||
m_rtts = rtt;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::onLoadWorld()
|
||||
{
|
||||
if (m_glsl)
|
||||
@ -1576,8 +1570,6 @@ void IrrDriver::onUnloadWorld()
|
||||
{
|
||||
delete m_rtts;
|
||||
m_rtts = NULL;
|
||||
|
||||
suppressSkyBox();
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Sets the ambient light.
|
||||
@ -1921,8 +1913,6 @@ void IrrDriver::update(float dt)
|
||||
// =================================
|
||||
if (!m_device->run())
|
||||
{
|
||||
GUIEngine::cleanUp();
|
||||
GUIEngine::deallocate();
|
||||
main_loop->abort();
|
||||
return;
|
||||
}
|
||||
@ -2401,7 +2391,7 @@ GLuint IrrDriver::getRenderTargetTexture(TypeRTT which)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
FrameBuffer& IrrDriver::getFBO(TypeFBO which)
|
||||
FrameBuffer& IrrDriver::getFBO(TypeFBO which)
|
||||
{
|
||||
return m_rtts->getFBO(which);
|
||||
}
|
||||
@ -2411,5 +2401,4 @@ FrameBuffer& IrrDriver::getFBO(TypeFBO which)
|
||||
GLuint IrrDriver::getDepthStencilTexture()
|
||||
{
|
||||
return m_rtts->getDepthStencilTexture();
|
||||
}
|
||||
|
||||
}
|
@ -108,11 +108,7 @@ enum QueryPerf
|
||||
{
|
||||
Q_SOLID_PASS1,
|
||||
Q_SHADOWS,
|
||||
Q_RH,
|
||||
Q_GI,
|
||||
Q_ENVMAP,
|
||||
Q_SUN,
|
||||
Q_POINTLIGHTS,
|
||||
Q_LIGHT,
|
||||
Q_SSAO,
|
||||
Q_SOLID_PASS2,
|
||||
Q_TRANSPARENT,
|
||||
@ -294,11 +290,6 @@ public:
|
||||
m_lwhite = v;
|
||||
}
|
||||
|
||||
struct GlowData {
|
||||
scene::ISceneNode * node;
|
||||
float r, g, b;
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<VideoMode> m_modes;
|
||||
|
||||
@ -336,6 +327,11 @@ private:
|
||||
scene::CLensFlareSceneNode *m_lensflare;
|
||||
scene::ICameraSceneNode *m_suncam;
|
||||
|
||||
struct GlowData {
|
||||
scene::ISceneNode * node;
|
||||
float r, g, b;
|
||||
};
|
||||
|
||||
std::vector<GlowData> m_glowing;
|
||||
|
||||
std::vector<LightNode *> m_lights;
|
||||
@ -365,9 +361,12 @@ private:
|
||||
void renderTransparent();
|
||||
void renderParticles();
|
||||
void computeSunVisibility();
|
||||
void renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadows);
|
||||
void computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height);
|
||||
void renderShadows();
|
||||
void renderGlow(std::vector<GlowData>& glows);
|
||||
void renderSSAO();
|
||||
unsigned UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt);
|
||||
void renderLights(unsigned pointlightCount);
|
||||
void renderDisplacement();
|
||||
void doScreenShot();
|
||||
@ -526,10 +525,7 @@ public:
|
||||
{
|
||||
return m_texture_error_message;
|
||||
} // getTextureErrorMessage
|
||||
// ------------------------------------------------------------------------
|
||||
void setRTT(RTT* rtt);
|
||||
// ------------------------------------------------------------------------
|
||||
RTT* getRTT() { return m_rtts; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a list of all video modes supports by the graphics card. */
|
||||
const std::vector<VideoMode>& getVideoModes() const { return m_modes; }
|
||||
@ -700,10 +696,6 @@ public:
|
||||
void onLoadWorld();
|
||||
void onUnloadWorld();
|
||||
|
||||
void renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadows, bool forceRTT);
|
||||
unsigned UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt);
|
||||
void computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height);
|
||||
|
||||
// --------------------- RTT --------------------
|
||||
/**
|
||||
* Class that provides RTT (currently, only when no other 3D rendering
|
||||
|
@ -811,7 +811,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
// ITexture* tex = irr_driver->getTexture("cloud_mask.png");
|
||||
// m->setTexture(1, tex);
|
||||
//
|
||||
//
|
||||
//
|
||||
// m->MaterialType = irr_driver->getShader(ES_SKYBOX);
|
||||
//}
|
||||
|
||||
|
@ -207,17 +207,36 @@ void PostProcessing::update(float dt)
|
||||
static
|
||||
void renderBloom(GLuint in)
|
||||
{
|
||||
float threshold = 1.0f;
|
||||
if (World::getWorld() != NULL)
|
||||
threshold = World::getWorld()->getTrack()->getBloomThreshold();
|
||||
|
||||
const float threshold = World::getWorld()->getTrack()->getBloomThreshold();
|
||||
glUseProgram(FullScreenShader::BloomShader::Program);
|
||||
glBindVertexArray(FullScreenShader::BloomShader::vao);
|
||||
|
||||
setTexture(0, in, GL_NEAREST, GL_NEAREST);
|
||||
FullScreenShader::BloomShader::setUniforms(0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
static
|
||||
void renderColorLevel(GLuint in)
|
||||
{
|
||||
core::vector3df m_inlevel = World::getWorld()->getTrack()->getColorLevelIn();
|
||||
core::vector2df m_outlevel = World::getWorld()->getTrack()->getColorLevelOut();
|
||||
|
||||
|
||||
glUseProgram(FullScreenShader::ColorLevelShader::Program);
|
||||
glBindVertexArray(FullScreenShader::ColorLevelShader::vao);
|
||||
glUniform3f(FullScreenShader::ColorLevelShader::uniform_inlevel, m_inlevel.X, m_inlevel.Y, m_inlevel.Z);
|
||||
glUniform2f(FullScreenShader::ColorLevelShader::uniform_outlevel, m_outlevel.X, m_outlevel.Y);
|
||||
|
||||
setTexture(0, in, GL_NEAREST, GL_NEAREST);
|
||||
setTexture(1, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||
glUniform1i(FullScreenShader::ColorLevelShader::uniform_tex, 0);
|
||||
glUniform1i(FullScreenShader::ColorLevelShader::uniform_dtex, 1);
|
||||
setTexture(2, irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE), GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST);
|
||||
glUniformMatrix4fv(FullScreenShader::ColorLevelShader::uniform_invprojm, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer());
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
void PostProcessing::renderDiffuseEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff)
|
||||
@ -234,7 +253,7 @@ void PostProcessing::renderDiffuseEnvMap(const float *bSHCoeff, const float *gSH
|
||||
core::matrix4 TVM = irr_driver->getViewMatrix().getTransposed();
|
||||
FullScreenShader::DiffuseEnvMapShader::setUniforms(TVM, bSHCoeff, gSHCoeff, rSHCoeff, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
@ -268,7 +287,7 @@ void PostProcessing::renderGI(const core::matrix4 &RHMatrix, const core::vector3
|
||||
setTexture(3, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST);
|
||||
setTexture(4, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||
FullScreenShader::GlobalIlluminationReconstructionShader::setUniforms(RHMatrix, rh_extend, 3, 4, 0, 1, 2);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
void PostProcessing::renderSunlight()
|
||||
@ -285,7 +304,7 @@ void PostProcessing::renderSunlight()
|
||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST);
|
||||
setTexture(1, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||
FullScreenShader::SunLightShader::setUniforms(cb->getPosition(), cb->getRed(), cb->getGreen(), cb->getBlue(), 0, 1);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
@ -322,7 +341,7 @@ void PostProcessing::renderShadowedSunlight(const std::vector<core::matrix4> &su
|
||||
glBindVertexArray(FullScreenShader::ShadowedSunLightShader::vao);
|
||||
FullScreenShader::ShadowedSunLightShader::setUniforms(cb->getPosition(), cb->getRed(), cb->getGreen(), cb->getBlue(), 0, 1, 2);
|
||||
}
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
@ -343,7 +362,7 @@ void PostProcessing::renderGaussian3Blur(FrameBuffer &in_fbo, FrameBuffer &auxil
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glUniform1i(FullScreenShader::Gaussian3VBlurShader::uniform_tex, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
{
|
||||
in_fbo.Bind();
|
||||
@ -357,7 +376,7 @@ void PostProcessing::renderGaussian3Blur(FrameBuffer &in_fbo, FrameBuffer &auxil
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glUniform1i(FullScreenShader::Gaussian3HBlurShader::uniform_tex, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,7 +396,7 @@ void PostProcessing::renderGaussian6Blur(FrameBuffer &in_fbo, FrameBuffer &auxil
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glUniform1i(FullScreenShader::Gaussian6VBlurShader::uniform_tex, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
{
|
||||
in_fbo.Bind();
|
||||
@ -391,7 +410,7 @@ void PostProcessing::renderGaussian6Blur(FrameBuffer &in_fbo, FrameBuffer &auxil
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glUniform1i(FullScreenShader::Gaussian6HBlurShader::uniform_tex, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,56 +419,32 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
||||
assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight());
|
||||
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
|
||||
{
|
||||
if (irr_driver->getGLSLVersion() < 430)
|
||||
{
|
||||
auxiliary.Bind();
|
||||
glUseProgram(FullScreenShader::Gaussian17TapHShader::Program);
|
||||
glBindVertexArray(FullScreenShader::Gaussian17TapHShader::vao);
|
||||
auxiliary.Bind();
|
||||
glUseProgram(FullScreenShader::Gaussian17TapHShader::Program);
|
||||
glBindVertexArray(FullScreenShader::Gaussian17TapHShader::vao);
|
||||
|
||||
glUniform2f(FullScreenShader::Gaussian17TapHShader::uniform_pixel, inv_width, inv_height);
|
||||
glUniform2f(FullScreenShader::Gaussian17TapHShader::uniform_pixel, inv_width, inv_height);
|
||||
|
||||
setTexture(0, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glUniform1i(FullScreenShader::Gaussian17TapHShader::uniform_tex, 0);
|
||||
setTexture(0, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glUniform1i(FullScreenShader::Gaussian17TapHShader::uniform_tex, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program);
|
||||
glBindImageTexture(0, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
||||
glBindImageTexture(1, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_source, 0);
|
||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_dest, 1);
|
||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||
}
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
{
|
||||
if (irr_driver->getGLSLVersion() < 430)
|
||||
{
|
||||
in_fbo.Bind();
|
||||
glUseProgram(FullScreenShader::Gaussian17TapVShader::Program);
|
||||
glBindVertexArray(FullScreenShader::Gaussian17TapVShader::vao);
|
||||
in_fbo.Bind();
|
||||
glUseProgram(FullScreenShader::Gaussian17TapVShader::Program);
|
||||
glBindVertexArray(FullScreenShader::Gaussian17TapVShader::vao);
|
||||
|
||||
glUniform2f(FullScreenShader::Gaussian17TapVShader::uniform_pixel, inv_width, inv_height);
|
||||
glUniform2f(FullScreenShader::Gaussian17TapVShader::uniform_pixel, inv_width, inv_height);
|
||||
|
||||
setTexture(0, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glUniform1i(FullScreenShader::Gaussian17TapVShader::uniform_tex, 0);
|
||||
setTexture(0, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glUniform1i(FullScreenShader::Gaussian17TapVShader::uniform_tex, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::Program);
|
||||
glBindImageTexture(0, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
||||
glBindImageTexture(1, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_source, 0);
|
||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_dest, 1);
|
||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||
}
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,7 +489,7 @@ void PostProcessing::renderSSAO()
|
||||
glBindVertexArray(FullScreenShader::LinearizeDepthShader::vao);
|
||||
setTexture(0, irr_driver->getDepthStencilTexture(), GL_LINEAR, GL_LINEAR);
|
||||
FullScreenShader::LinearizeDepthShader::setUniforms(irr_driver->getSceneManager()->getActiveCamera()->getNearValue(), irr_driver->getSceneManager()->getActiveCamera()->getFarValue(), 0);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
irr_driver->getFBO(FBO_SSAO).Bind();
|
||||
|
||||
if (!noise_tex)
|
||||
@ -503,15 +498,15 @@ void PostProcessing::renderSSAO()
|
||||
glUseProgram(FullScreenShader::SSAOShader::Program);
|
||||
glBindVertexArray(FullScreenShader::SSAOShader::vao);
|
||||
|
||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_LINEAR_DEPTH), GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST);
|
||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_LINEAR_DEPTH), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
setTexture(1, getTextureGLuint(noise_tex), GL_LINEAR, GL_LINEAR);
|
||||
|
||||
FullScreenShader::SSAOShader::setUniforms(core::vector2df(float(UserConfigParams::m_width),
|
||||
FullScreenShader::SSAOShader::setUniforms(core::vector2df(float(UserConfigParams::m_width),
|
||||
float(UserConfigParams::m_height)),
|
||||
0, 1);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
void PostProcessing::renderFog()
|
||||
@ -541,7 +536,7 @@ void PostProcessing::renderFog()
|
||||
setTexture(0, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||
FullScreenShader::FogShader::setUniforms(fogmax, startH, endH, start, end, col, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
@ -581,7 +576,7 @@ void PostProcessing::renderMotionBlur(unsigned cam, FrameBuffer &in_fbo, FrameBu
|
||||
cb->getDirection(cam), 0.15f,
|
||||
cb->getMaxHeight(cam) * 0.7f, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
static void renderGodFade(GLuint tex, const SColor &col)
|
||||
@ -613,7 +608,7 @@ static void toneMap(FrameBuffer &fbo, GLuint rtt)
|
||||
setTexture(1, irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE), GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST);
|
||||
FullScreenShader::ToneMapShader::setUniforms(irr_driver->getExposure(), irr_driver->getLwhite(), 0, 1);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
static void renderDoF(FrameBuffer &fbo, GLuint rtt)
|
||||
@ -625,7 +620,7 @@ static void renderDoF(FrameBuffer &fbo, GLuint rtt)
|
||||
setTexture(1, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||
FullScreenShader::DepthOfFieldShader::setUniforms(0, 1);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
static void averageTexture(GLuint tex)
|
||||
@ -635,6 +630,19 @@ static void averageTexture(GLuint tex)
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static void computeLogLuminance(GLuint tex)
|
||||
{
|
||||
irr_driver->getFBO(FBO_LOG_LUMINANCE).Bind();
|
||||
glUseProgram(FullScreenShader::LogLuminanceShader::Program);
|
||||
glBindVertexArray(FullScreenShader::LogLuminanceShader::vao);
|
||||
setTexture(0, tex, GL_LINEAR, GL_LINEAR);
|
||||
FullScreenShader::LogLuminanceShader::setUniforms(0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
averageTexture(irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE));
|
||||
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
}
|
||||
|
||||
void PostProcessing::applyMLAA()
|
||||
{
|
||||
const core::vector2df &PIXEL_SIZE = core::vector2df(1.0f / UserConfigParams::m_width, 1.0f / UserConfigParams::m_height);
|
||||
@ -720,10 +728,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Godrays", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_GODRAYS));
|
||||
bool hasgodrays = false;
|
||||
if (World::getWorld() != NULL)
|
||||
hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
|
||||
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
if (UserConfigParams::m_light_shaft && m_sunpixels > 30 && hasgodrays)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@ -793,7 +798,6 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
if (UserConfigParams::m_bloom)
|
||||
{
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
|
||||
|
||||
FrameBuffer::Blit(*in_fbo, irr_driver->getFBO(FBO_BLOOM_1024), GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
@ -814,18 +818,15 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
// Additively blend on top of tmp1
|
||||
in_fbo->Bind();
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_BLOOM_128), GL_LINEAR, GL_LINEAR);
|
||||
setTexture(1, irr_driver->getRenderTargetTexture(RTT_BLOOM_256), GL_LINEAR, GL_LINEAR);
|
||||
setTexture(2, irr_driver->getRenderTargetTexture(RTT_BLOOM_512), GL_LINEAR, GL_LINEAR);
|
||||
glUseProgram(FullScreenShader::BloomBlendShader::Program);
|
||||
FullScreenShader::BloomBlendShader::setUniforms(0, 1, 2);
|
||||
glBindVertexArray(FullScreenShader::BloomBlendShader::vao);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
glBlendColor(.125, .125, .125, .125);
|
||||
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_128));
|
||||
glBlendColor(.25, .25, .25, .25);
|
||||
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_256));
|
||||
glBlendColor(.5, .5, .5, .5);
|
||||
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_512));
|
||||
glDisable(GL_BLEND);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
} // end if bloom
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
@ -842,7 +843,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Motion blur", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_MOTIONBLUR));
|
||||
if (UserConfigParams::m_motionblur && m_any_boost && World::getWorld() != NULL) // motion blur
|
||||
if (UserConfigParams::m_motionblur && m_any_boost) // motion blur
|
||||
{
|
||||
renderMotionBlur(0, *in_fbo, *out_fbo);
|
||||
std::swap(in_fbo, out_fbo);
|
||||
|
@ -124,17 +124,19 @@ void IrrDriver::renderGLSL(float dt)
|
||||
|
||||
RaceGUIBase *rg = world->getRaceGUI();
|
||||
if (rg) rg->update(dt);
|
||||
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
|
||||
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
|
||||
|
||||
for(unsigned int cam = 0; cam < Camera::getNumCameras(); cam++)
|
||||
{
|
||||
Camera * const camera = Camera::getCamera(cam);
|
||||
scene::ICameraSceneNode * const camnode = camera->getCameraSceneNode();
|
||||
|
||||
#ifdef ENABLE_PROFILER
|
||||
std::ostringstream oss;
|
||||
oss << "drawAll() for kart " << cam;
|
||||
oss << "drawAll() for kart " << cam << std::flush;
|
||||
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (cam+1)*60,
|
||||
0x00, 0x00);
|
||||
#endif
|
||||
camera->activate();
|
||||
rg->preRenderCallback(camera); // adjusts start referee
|
||||
m_scene_manager->setActiveCamera(camnode);
|
||||
@ -143,7 +145,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
|
||||
unsigned plc = UpdateLightsInfo(camnode, dt);
|
||||
computeCameraMatrix(camnode, viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
|
||||
renderScene(camnode, plc, glows, dt, track->hasShadows(), false);
|
||||
renderScene(camnode, plc, glows, dt, track->hasShadows());
|
||||
|
||||
// Debug physic
|
||||
// Note that drawAll must be called before rendering
|
||||
@ -226,10 +228,10 @@ void IrrDriver::renderGLSL(float dt)
|
||||
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
|
||||
{
|
||||
Camera *camera = Camera::getCamera(i);
|
||||
std::ostringstream oss;
|
||||
oss << "renderPlayerView() for kart " << i;
|
||||
char marker_name[100];
|
||||
sprintf(marker_name, "renderPlayerView() for kart %d", i);
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), 0x00, 0x00, (i+1)*60);
|
||||
PROFILER_PUSH_CPU_MARKER(marker_name, 0x00, 0x00, (i+1)*60);
|
||||
rg->renderPlayerView(camera, dt);
|
||||
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
@ -259,7 +261,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
getPostProcessing()->update(dt);
|
||||
}
|
||||
|
||||
void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadow, bool forceRTT)
|
||||
void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadow)
|
||||
{
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
||||
|
||||
@ -285,6 +287,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
// Lights
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Light", 0x00, 0xFF, 0x00);
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_LIGHT));
|
||||
renderLights(pointlightcount);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
@ -299,7 +302,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
}
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("- Solid Pass 2", 0x00, 0x00, 0xFF);
|
||||
if (!UserConfigParams::m_dynamic_lights && ! forceRTT)
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
{
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
@ -309,8 +312,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
renderSolidSecondPass();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
if (UserConfigParams::m_dynamic_lights && World::getWorld() != NULL &&
|
||||
World::getWorld()->isFogEnabled())
|
||||
if (UserConfigParams::m_dynamic_lights && World::getWorld()->isFogEnabled())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Fog", 0xFF, 0x00, 0x00);
|
||||
m_post_processing->renderFog();
|
||||
@ -372,7 +374,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
renderParticles();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
if (!UserConfigParams::m_dynamic_lights && !forceRTT)
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
return;
|
||||
|
||||
// Render displacement
|
||||
@ -405,10 +407,12 @@ void IrrDriver::renderFixed(float dt)
|
||||
{
|
||||
Camera *camera = Camera::getCamera(i);
|
||||
|
||||
#ifdef ENABLE_PROFILER
|
||||
std::ostringstream oss;
|
||||
oss << "drawAll() for kart " << i;
|
||||
oss << "drawAll() for kart " << i << std::flush;
|
||||
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (i+1)*60,
|
||||
0x00, 0x00);
|
||||
#endif
|
||||
camera->activate();
|
||||
rg->preRenderCallback(camera); // adjusts start referee
|
||||
|
||||
@ -433,10 +437,10 @@ void IrrDriver::renderFixed(float dt)
|
||||
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
|
||||
{
|
||||
Camera *camera = Camera::getCamera(i);
|
||||
std::ostringstream oss;
|
||||
oss << "renderPlayerView() for kart " << i;
|
||||
char marker_name[100];
|
||||
sprintf(marker_name, "renderPlayerView() for kart %d", i);
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), 0x00, 0x00, (i+1)*60);
|
||||
PROFILER_PUSH_CPU_MARKER(marker_name, 0x00, 0x00, (i+1)*60);
|
||||
rg->renderPlayerView(camera, dt);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
@ -463,16 +467,9 @@ void IrrDriver::renderFixed(float dt)
|
||||
void IrrDriver::computeSunVisibility()
|
||||
{
|
||||
// Is the lens flare enabled & visible? Check last frame's query.
|
||||
bool hasflare = false;
|
||||
bool hasgodrays = false;
|
||||
|
||||
if (World::getWorld() != NULL)
|
||||
{
|
||||
hasflare = World::getWorld()->getTrack()->hasLensFlare();
|
||||
hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
}
|
||||
|
||||
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
|
||||
const bool hasflare = World::getWorld()->getTrack()->hasLensFlare();
|
||||
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
|
||||
if (UserConfigParams::m_light_shaft && hasgodrays)//hasflare || hasgodrays)
|
||||
{
|
||||
GLuint res = 0;
|
||||
@ -570,10 +567,7 @@ void IrrDriver::renderSolidFirstPass()
|
||||
|
||||
void IrrDriver::renderSolidSecondPass()
|
||||
{
|
||||
SColor clearColor(0., 150, 150, 150);
|
||||
if (World::getWorld() != NULL)
|
||||
clearColor = World::getWorld()->getClearColor();
|
||||
|
||||
SColor clearColor = World::getWorld()->getClearColor();
|
||||
glClearColor(clearColor.getRed() / 255.f, clearColor.getGreen() / 255.f,
|
||||
clearColor.getBlue() / 255.f, clearColor.getAlpha() / 255.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
@ -672,6 +666,9 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
irr_driver->setViewMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||
irr_driver->genProjViewMatrix();
|
||||
|
||||
const Vec3 *vmin, *vmax;
|
||||
World::getWorld()->getTrack()->getAABB(&vmin, &vmax);
|
||||
|
||||
const float oldfar = camnode->getFarValue();
|
||||
const float oldnear = camnode->getNearValue();
|
||||
float FarValues[] =
|
||||
@ -689,89 +686,81 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
50.,
|
||||
};
|
||||
|
||||
const core::matrix4 &SunCamViewMatrix = m_suncam->getViewMatrix();
|
||||
sun_ortho_matrix.clear();
|
||||
|
||||
// Build the 3 ortho projection (for the 3 shadow resolution levels)
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
{
|
||||
camnode->setFarValue(FarValues[i]);
|
||||
camnode->setNearValue(NearValues[i]);
|
||||
camnode->render();
|
||||
const core::aabbox3df smallcambox = camnode->
|
||||
getViewFrustum()->getBoundingBox();
|
||||
core::aabbox3df trackbox(vmin->toIrrVector(), vmax->toIrrVector() -
|
||||
core::vector3df(0, 30, 0));
|
||||
|
||||
|
||||
// Set up a nice ortho projection that contains our camera frustum
|
||||
core::aabbox3df box = smallcambox;
|
||||
box = box.intersect(trackbox);
|
||||
|
||||
|
||||
SunCamViewMatrix.transformBoxEx(trackbox);
|
||||
SunCamViewMatrix.transformBoxEx(box);
|
||||
|
||||
core::vector3df extent = trackbox.getExtent();
|
||||
const float w = fabsf(extent.X);
|
||||
const float h = fabsf(extent.Y);
|
||||
float z = box.MaxEdge.Z;
|
||||
|
||||
// Snap to texels
|
||||
const float units_per_w = w / 1024;
|
||||
const float units_per_h = h / 1024;
|
||||
|
||||
float left = box.MinEdge.X;
|
||||
float right = box.MaxEdge.X;
|
||||
float up = box.MaxEdge.Y;
|
||||
float down = box.MinEdge.Y;
|
||||
|
||||
core::matrix4 tmp_matrix;
|
||||
|
||||
// Prevent Matrix without extend
|
||||
if (left == right || up == down)
|
||||
{
|
||||
Log::error("Shadows", "Shadows Near/Far plane have a 0 area");
|
||||
sun_ortho_matrix.push_back(tmp_matrix);
|
||||
continue;
|
||||
}
|
||||
|
||||
tmp_matrix.buildProjectionMatrixOrthoLH(left, right,
|
||||
up, down,
|
||||
30, z);
|
||||
m_suncam->setProjectionMatrix(tmp_matrix, true);
|
||||
m_suncam->render();
|
||||
|
||||
sun_ortho_matrix.push_back(getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||
}
|
||||
if ((tick % 100) == 2)
|
||||
rsm_matrix = sun_ortho_matrix[3];
|
||||
rh_extend = core::vector3df(128, 64, 128);
|
||||
core::vector3df campos = camnode->getAbsolutePosition();
|
||||
core::vector3df translation(8 * floor(campos.X / 8), 8 * floor(campos.Y / 8), 8 * floor(campos.Z / 8));
|
||||
rh_matrix.setTranslation(translation);
|
||||
|
||||
assert(sun_ortho_matrix.size() == 4);
|
||||
camnode->setNearValue(oldnear);
|
||||
camnode->setFarValue(oldfar);
|
||||
|
||||
float *tmp = new float[18 * 8];
|
||||
|
||||
memcpy(tmp, irr_driver->getViewMatrix().pointer(), 16 * sizeof(float));
|
||||
memcpy(&tmp[16], irr_driver->getProjMatrix().pointer(), 16 * sizeof(float));
|
||||
memcpy(&tmp[32], irr_driver->getInvViewMatrix().pointer(), 16 * sizeof(float));
|
||||
memcpy(&tmp[48], irr_driver->getInvProjMatrix().pointer(), 16 * sizeof(float));
|
||||
|
||||
const core::matrix4 &SunCamViewMatrix = m_suncam->getViewMatrix();
|
||||
sun_ortho_matrix.clear();
|
||||
|
||||
if (World::getWorld() && World::getWorld()->getTrack())
|
||||
{
|
||||
const Vec3 *vmin, *vmax;
|
||||
World::getWorld()->getTrack()->getAABB(&vmin, &vmax);
|
||||
|
||||
// Build the 3 ortho projection (for the 3 shadow resolution levels)
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
{
|
||||
camnode->setFarValue(FarValues[i]);
|
||||
camnode->setNearValue(NearValues[i]);
|
||||
camnode->render();
|
||||
const core::aabbox3df smallcambox = camnode->
|
||||
getViewFrustum()->getBoundingBox();
|
||||
core::aabbox3df trackbox(vmin->toIrrVector(), vmax->toIrrVector() -
|
||||
core::vector3df(0, 30, 0));
|
||||
|
||||
// Set up a nice ortho projection that contains our camera frustum
|
||||
core::aabbox3df box = smallcambox;
|
||||
box = box.intersect(trackbox);
|
||||
|
||||
|
||||
SunCamViewMatrix.transformBoxEx(trackbox);
|
||||
SunCamViewMatrix.transformBoxEx(box);
|
||||
|
||||
core::vector3df extent = box.getExtent();
|
||||
const float w = fabsf(extent.X);
|
||||
const float h = fabsf(extent.Y);
|
||||
float z = box.MaxEdge.Z;
|
||||
|
||||
// Snap to texels
|
||||
const float units_per_w = w / 1024;
|
||||
const float units_per_h = h / 1024;
|
||||
|
||||
float left = box.MinEdge.X;
|
||||
float right = box.MaxEdge.X;
|
||||
float up = box.MaxEdge.Y;
|
||||
float down = box.MinEdge.Y;
|
||||
|
||||
core::matrix4 tmp_matrix;
|
||||
|
||||
// Prevent Matrix without extend
|
||||
if (left == right || up == down)
|
||||
{
|
||||
Log::error("Shadows", "Shadows Near/Far plane have a 0 area");
|
||||
sun_ortho_matrix.push_back(tmp_matrix);
|
||||
continue;
|
||||
}
|
||||
|
||||
tmp_matrix.buildProjectionMatrixOrthoLH(left, right,
|
||||
up, down,
|
||||
30, z);
|
||||
m_suncam->setProjectionMatrix(tmp_matrix, true);
|
||||
m_suncam->render();
|
||||
|
||||
sun_ortho_matrix.push_back(getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||
}
|
||||
if ((tick % 100) == 2)
|
||||
rsm_matrix = sun_ortho_matrix[3];
|
||||
rh_extend = core::vector3df(128, 64, 128);
|
||||
core::vector3df campos = camnode->getAbsolutePosition();
|
||||
core::vector3df translation(8 * floor(campos.X / 8), 8 * floor(campos.Y / 8), 8 * floor(campos.Z / 8));
|
||||
rh_matrix.setTranslation(translation);
|
||||
|
||||
|
||||
assert(sun_ortho_matrix.size() == 4);
|
||||
camnode->setNearValue(oldnear);
|
||||
camnode->setFarValue(oldfar);
|
||||
|
||||
size_t size = irr_driver->getShadowViewProj().size();
|
||||
for (unsigned i = 0; i < size; i++)
|
||||
memcpy(&tmp[16 * i + 64], irr_driver->getShadowViewProj()[i].pointer(), 16 * sizeof(float));
|
||||
}
|
||||
|
||||
size_t size = irr_driver->getShadowViewProj().size();
|
||||
for (unsigned i = 0; i < size; i++)
|
||||
memcpy(&tmp[16 * i + 64], irr_driver->getShadowViewProj()[i].pointer(), 16 * sizeof(float));
|
||||
tmp[128] = float(width);
|
||||
tmp[129] = float(height);
|
||||
|
||||
@ -844,10 +833,10 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
|
||||
glStencilFunc(GL_ALWAYS, 1, ~0);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
for (u32 i = 0; i < glowcount; i++)
|
||||
{
|
||||
@ -875,11 +864,11 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
|
||||
FrameBuffer::Blit(irr_driver->getFBO(FBO_HALF1), irr_driver->getFBO(FBO_QUARTER1), GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glStencilFunc(GL_EQUAL, 0, ~0);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glStencilFunc(GL_EQUAL, 0, ~0);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
m_rtts->getFBO(FBO_COLORS).Bind();
|
||||
m_post_processing->renderGlow(m_rtts->getRenderTarget(RTT_QUARTER1));
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
@ -985,7 +974,6 @@ void IrrDriver::renderLights(unsigned pointlightcount)
|
||||
//RH
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_RH));
|
||||
glDisable(GL_BLEND);
|
||||
m_rtts->getRH().Bind();
|
||||
glUseProgram(FullScreenShader::RadianceHintsConstructionShader::Program);
|
||||
@ -1006,36 +994,25 @@ void IrrDriver::renderLights(unsigned pointlightcount)
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
return;
|
||||
|
||||
m_rtts->getFBO(FBO_TMP1_WITH_DS).Bind();
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_GI));
|
||||
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2]);
|
||||
}
|
||||
|
||||
if (SkyboxCubeMap)
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_ENVMAP));
|
||||
m_post_processing->renderDiffuseEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff);
|
||||
}
|
||||
m_rtts->getFBO(FBO_COMBINED_TMP1_TMP2).Bind();
|
||||
|
||||
if (World::getWorld() && World::getWorld()->getTrack()->hasShadows() && SkyboxCubeMap && UserConfigParams::m_gi)
|
||||
irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0));
|
||||
|
||||
// Render sunlight if and only if track supports shadow
|
||||
if (!World::getWorld() || World::getWorld()->getTrack()->hasShadows())
|
||||
if (World::getWorld()->getTrack()->hasShadows())
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_SUN));
|
||||
if (World::getWorld() && UserConfigParams::m_shadows)
|
||||
if (UserConfigParams::m_shadows)
|
||||
m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowDepthTex());
|
||||
else
|
||||
m_post_processing->renderSunlight();
|
||||
}
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_POINTLIGHTS));
|
||||
renderPointLights(MIN2(pointlightcount, MAXLIGHT));
|
||||
}
|
||||
|
||||
|
||||
renderPointLights(MIN2(pointlightcount, MAXLIGHT));
|
||||
if (SkyboxCubeMap)
|
||||
m_post_processing->renderDiffuseEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff);
|
||||
}
|
||||
|
||||
void IrrDriver::renderSSAO()
|
||||
@ -1504,16 +1481,16 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
|
||||
if (!SkyboxCubeMap)
|
||||
generateSkyboxCubemap();
|
||||
glBindVertexArray(MeshShader::SkyboxShader::cubevao);
|
||||
glDisable(GL_CULL_FACE);
|
||||
assert(SkyboxTextures.size() == 6);
|
||||
glDisable(GL_CULL_FACE);
|
||||
assert(SkyboxTextures.size() == 6);
|
||||
|
||||
core::matrix4 translate;
|
||||
translate.setTranslation(camera->getAbsolutePosition());
|
||||
core::matrix4 translate;
|
||||
translate.setTranslation(camera->getAbsolutePosition());
|
||||
|
||||
// Draw the sky box between the near and far clip plane
|
||||
const f32 viewDistance = (camera->getNearValue() + camera->getFarValue()) * 0.5f;
|
||||
core::matrix4 scale;
|
||||
scale.setScale(core::vector3df(viewDistance, viewDistance, viewDistance));
|
||||
// Draw the sky box between the near and far clip plane
|
||||
const f32 viewDistance = (camera->getNearValue() + camera->getFarValue()) * 0.5f;
|
||||
core::matrix4 scale;
|
||||
scale.setScale(core::vector3df(viewDistance, viewDistance, viewDistance));
|
||||
core::matrix4 transform = translate * scale;
|
||||
core::matrix4 invtransform;
|
||||
transform.getInverse(invtransform);
|
||||
@ -1523,7 +1500,7 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glUseProgram(MeshShader::SkyboxShader::Program);
|
||||
MeshShader::SkyboxShader::setUniforms(transform,
|
||||
MeshShader::SkyboxShader::setUniforms(transform,
|
||||
core::vector2df(float(UserConfigParams::m_width),
|
||||
float(UserConfigParams::m_height)),
|
||||
0);
|
||||
@ -1540,15 +1517,15 @@ void IrrDriver::renderDisplacement()
|
||||
irr_driver->getFBO(FBO_DISPLACE).Bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
DisplaceProvider * const cb = (DisplaceProvider *)irr_driver->getCallback(ES_DISPLACE);
|
||||
cb->update();
|
||||
DisplaceProvider * const cb = (DisplaceProvider *)irr_driver->getCallback(ES_DISPLACE);
|
||||
cb->update();
|
||||
|
||||
const int displacingcount = m_displacing.size();
|
||||
irr_driver->setPhase(DISPLACEMENT_PASS);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_BLEND);
|
||||
irr_driver->setPhase(DISPLACEMENT_PASS);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_BLEND);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
|
@ -22,18 +22,6 @@
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
static GLuint generateRTT3D(GLenum target, size_t w, size_t h, size_t d, GLint internalFormat, GLint format, GLint type)
|
||||
{
|
||||
GLuint result;
|
||||
glGenTextures(1, &result);
|
||||
glBindTexture(target, result);
|
||||
if (irr_driver->getGLSLVersion() < 420)
|
||||
glTexImage3D(target, 0, internalFormat, w, h, d, 0, format, type, 0);
|
||||
else
|
||||
glTexStorage3D(target, 1, internalFormat, w, h, d);
|
||||
return result;
|
||||
}
|
||||
|
||||
static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, GLint format, GLint type, unsigned mipmaplevel = 1)
|
||||
{
|
||||
GLuint result;
|
||||
@ -69,7 +57,6 @@ static GLuint generateFBO(GLuint ColorAttachement, GLuint DepthAttachement)
|
||||
RTT::RTT(size_t width, size_t height)
|
||||
{
|
||||
m_shadow_FBO = NULL;
|
||||
m_RH_FBO = NULL;
|
||||
m_RSM = NULL;
|
||||
m_RH_FBO = NULL;
|
||||
using namespace video;
|
||||
@ -92,7 +79,9 @@ RTT::RTT(size_t width, size_t height)
|
||||
|
||||
unsigned linear_depth_mip_levels = ceil(log2(max_(res.Width, res.Height)));
|
||||
|
||||
DepthStencilTexture = generateRTT(res, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
|
||||
glGenTextures(1, &DepthStencilTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, DepthStencilTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL, res.Width, res.Height, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0);
|
||||
|
||||
// All RTTs are currently RGBA16F mostly with stencil. The four tmp RTTs are the same size
|
||||
// as the screen, for use in post-processing.
|
||||
@ -104,7 +93,7 @@ RTT::RTT(size_t width, size_t height)
|
||||
RenderTargetTextures[RTT_LINEAR_DEPTH] = generateRTT(res, GL_R32F, GL_RED, GL_FLOAT, linear_depth_mip_levels);
|
||||
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGBA16F, GL_RGBA, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_COLOR] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB8_ALPHA8, GL_BGR, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB, GL_BGR, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_SSAO] = generateRTT(res, GL_R16F, GL_RED, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||
|
||||
@ -206,8 +195,12 @@ RTT::RTT(size_t width, size_t height)
|
||||
|
||||
if (UserConfigParams::m_shadows)
|
||||
{
|
||||
shadowColorTex = generateRTT3D(GL_TEXTURE_2D_ARRAY, 1024, 1024, 4, GL_R8, GL_RED, GL_UNSIGNED_BYTE);
|
||||
shadowDepthTex = generateRTT3D(GL_TEXTURE_2D_ARRAY, 1024, 1024, 4, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
|
||||
glGenTextures(1, &shadowColorTex);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, shadowColorTex);
|
||||
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_R8, 1024, 1024, 4, 0, GL_RED, GL_UNSIGNED_BYTE, 0);
|
||||
glGenTextures(1, &shadowDepthTex);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, shadowDepthTex);
|
||||
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_STENCIL, 1024, 1024, 4, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(shadowColorTex);
|
||||
@ -217,18 +210,30 @@ RTT::RTT(size_t width, size_t height)
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
//Todo : use "normal" shadowtex
|
||||
RSM_Color = generateRTT(shadowsize0, GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE);
|
||||
RSM_Normal = generateRTT(shadowsize0, GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
RSM_Depth = generateRTT(shadowsize0, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
|
||||
glGenTextures(1, &RSM_Color);
|
||||
glBindTexture(GL_TEXTURE_2D, RSM_Color);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
|
||||
glGenTextures(1, &RSM_Normal);
|
||||
glBindTexture(GL_TEXTURE_2D, RSM_Normal);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 1024, 1024, 0, GL_RGB, GL_FLOAT, 0);
|
||||
glGenTextures(1, &RSM_Depth);
|
||||
glBindTexture(GL_TEXTURE_2D, RSM_Depth);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL, 1024, 1024, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(RSM_Color);
|
||||
somevector.push_back(RSM_Normal);
|
||||
m_RSM = new FrameBuffer(somevector, RSM_Depth, 1024, 1024, true);
|
||||
|
||||
RH_Red = generateRTT3D(GL_TEXTURE_3D, 32, 16, 32, GL_RGBA16F, GL_RGBA, GL_FLOAT);
|
||||
RH_Green = generateRTT3D(GL_TEXTURE_3D, 32, 16, 32, GL_RGBA16F, GL_RGBA, GL_FLOAT);
|
||||
RH_Blue = generateRTT3D(GL_TEXTURE_3D, 32, 16, 32, GL_RGBA16F, GL_RGBA, GL_FLOAT);
|
||||
glGenTextures(1, &RH_Red);
|
||||
glBindTexture(GL_TEXTURE_3D, RH_Red);
|
||||
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA16F, 32, 16, 32, 0, GL_RGBA, GL_FLOAT, 0);
|
||||
glGenTextures(1, &RH_Green);
|
||||
glBindTexture(GL_TEXTURE_3D, RH_Green);
|
||||
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA16F, 32, 16, 32, 0, GL_RGBA, GL_FLOAT, 0);
|
||||
glGenTextures(1, &RH_Blue);
|
||||
glBindTexture(GL_TEXTURE_3D, RH_Blue);
|
||||
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA16F, 32, 16, 32, 0, GL_RGBA, GL_FLOAT, 0);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(RH_Red);
|
||||
|
@ -50,7 +50,7 @@ Shaders::Shaders()
|
||||
loadShaders();
|
||||
}
|
||||
|
||||
GLuint quad_vbo, tri_vbo;
|
||||
GLuint quad_vbo;
|
||||
|
||||
static void initQuadVBO()
|
||||
{
|
||||
@ -64,16 +64,6 @@ static void initQuadVBO()
|
||||
glBindBuffer(GL_ARRAY_BUFFER, quad_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), quad_vertex, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
const float tri_vertex[] = {
|
||||
-1., -1.,
|
||||
-1., 3.,
|
||||
3., -1.,
|
||||
};
|
||||
glGenBuffers(1, &tri_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tri_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), tri_vertex, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
// It should be possible to merge it with previous one...
|
||||
@ -275,13 +265,12 @@ void Shaders::loadShaders()
|
||||
FullScreenShader::BloomBlendShader::init();
|
||||
FullScreenShader::BloomShader::init();
|
||||
FullScreenShader::DepthOfFieldShader::init();
|
||||
FullScreenShader::ColorLevelShader::init();
|
||||
FullScreenShader::FogShader::init();
|
||||
FullScreenShader::Gaussian17TapHShader::init();
|
||||
FullScreenShader::ComputeGaussian17TapHShader::init();
|
||||
FullScreenShader::Gaussian3HBlurShader::init();
|
||||
FullScreenShader::Gaussian3VBlurShader::init();
|
||||
FullScreenShader::Gaussian17TapVShader::init();
|
||||
FullScreenShader::ComputeGaussian17TapVShader::init();
|
||||
FullScreenShader::Gaussian6HBlurShader::init();
|
||||
FullScreenShader::Gaussian6VBlurShader::init();
|
||||
FullScreenShader::GlowShader::init();
|
||||
@ -298,6 +287,7 @@ void Shaders::loadShaders()
|
||||
FullScreenShader::MotionBlurShader::init();
|
||||
FullScreenShader::GodFadeShader::init();
|
||||
FullScreenShader::GodRayShader::init();
|
||||
FullScreenShader::LogLuminanceShader::init();
|
||||
FullScreenShader::ToneMapShader::init();
|
||||
FullScreenShader::MLAAColorEdgeDetectionSHader::init();
|
||||
FullScreenShader::MLAABlendWeightSHader::init();
|
||||
@ -2041,19 +2031,6 @@ namespace ParticleShader
|
||||
}
|
||||
}
|
||||
|
||||
static GLuint createFullScreenVAO(GLuint Program)
|
||||
{
|
||||
GLuint vao;
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
GLuint attrib_position = glGetAttribLocation(Program, "Position");
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tri_vbo);
|
||||
glEnableVertexAttribArray(attrib_position);
|
||||
glVertexAttribPointer(attrib_position, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), 0);
|
||||
glBindVertexArray(0);
|
||||
return vao;
|
||||
}
|
||||
|
||||
static GLuint createVAO(GLuint Program)
|
||||
{
|
||||
GLuint vao;
|
||||
@ -2082,7 +2059,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bloom.frag").c_str());
|
||||
uniform_texture = glGetUniformLocation(Program, "tex");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void BloomShader::setUniforms(unsigned TU_tex)
|
||||
@ -2091,27 +2068,20 @@ namespace FullScreenShader
|
||||
}
|
||||
|
||||
GLuint BloomBlendShader::Program;
|
||||
GLuint BloomBlendShader::uniform_tex_128;
|
||||
GLuint BloomBlendShader::uniform_tex_256;
|
||||
GLuint BloomBlendShader::uniform_tex_512;
|
||||
GLuint BloomBlendShader::uniform_texture;
|
||||
GLuint BloomBlendShader::vao;
|
||||
|
||||
void BloomBlendShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bloomblend.frag").c_str());
|
||||
uniform_tex_128 = glGetUniformLocation(Program, "tex_128");
|
||||
uniform_tex_256 = glGetUniformLocation(Program, "tex_256");
|
||||
uniform_tex_512 = glGetUniformLocation(Program, "tex_512");
|
||||
vao = createFullScreenVAO(Program);
|
||||
uniform_texture = glGetUniformLocation(Program, "tex");
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void BloomBlendShader::setUniforms(unsigned TU_tex_128, unsigned TU_tex_256, unsigned TU_tex_512)
|
||||
void BloomBlendShader::setUniforms(unsigned TU_tex)
|
||||
{
|
||||
glUniform1i(uniform_tex_128, TU_tex_128);
|
||||
glUniform1i(uniform_tex_256, TU_tex_256);
|
||||
glUniform1i(uniform_tex_512, TU_tex_512);
|
||||
glUniform1i(FullScreenShader::BloomShader::uniform_texture, TU_tex);
|
||||
}
|
||||
|
||||
GLuint ToneMapShader::Program;
|
||||
@ -2132,7 +2102,7 @@ namespace FullScreenShader
|
||||
uniform_logluminancetex = glGetUniformLocation(Program, "logluminancetex");
|
||||
uniform_exposure = glGetUniformLocation(Program, "exposure");
|
||||
uniform_lwhite = glGetUniformLocation(Program, "Lwhite");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void ToneMapShader::setUniforms(float exposure, float Lwhite, unsigned TU_tex, unsigned TU_loglum)
|
||||
@ -2155,7 +2125,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/dof.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_depth = glGetUniformLocation(Program, "dtex");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
@ -2166,6 +2136,28 @@ namespace FullScreenShader
|
||||
glUniform1i(uniform_depth, TU_dtex);
|
||||
}
|
||||
|
||||
GLuint ColorLevelShader::Program;
|
||||
GLuint ColorLevelShader::uniform_tex;
|
||||
GLuint ColorLevelShader::uniform_inlevel;
|
||||
GLuint ColorLevelShader::uniform_outlevel;
|
||||
GLuint ColorLevelShader::vao;
|
||||
GLuint ColorLevelShader::uniform_invprojm;
|
||||
GLuint ColorLevelShader::uniform_dtex;
|
||||
void ColorLevelShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getRGBfromCIEXxy.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/color_levels.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_dtex = glGetUniformLocation(Program, "dtex");
|
||||
uniform_inlevel = glGetUniformLocation(Program, "inlevel");
|
||||
uniform_outlevel = glGetUniformLocation(Program, "outlevel");
|
||||
uniform_invprojm = glGetUniformLocation(Program, "invprojm");
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
GLuint SunLightShader::Program;
|
||||
GLuint SunLightShader::uniform_ntex;
|
||||
GLuint SunLightShader::uniform_dtex;
|
||||
@ -2185,7 +2177,7 @@ namespace FullScreenShader
|
||||
uniform_dtex = glGetUniformLocation(Program, "dtex");
|
||||
uniform_direction = glGetUniformLocation(Program, "direction");
|
||||
uniform_col = glGetUniformLocation(Program, "col");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
{
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
@ -2222,7 +2214,7 @@ namespace FullScreenShader
|
||||
uniform_greenLmn = glGetUniformLocation(Program, "greenLmn[0]");
|
||||
uniform_redLmn = glGetUniformLocation(Program, "redLmn[0]");
|
||||
uniform_TVM = glGetUniformLocation(Program, "TransposeViewMatrix");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void DiffuseEnvMapShader::setUniforms(const core::matrix4 &TransposeViewMatrix, const float *blueSHCoeff, const float *greenSHCoeff, const float *redSHCoeff, unsigned TU_ntex)
|
||||
@ -2255,7 +2247,7 @@ namespace FullScreenShader
|
||||
uniform_shadowtex = glGetUniformLocation(Program, "shadowtex");
|
||||
uniform_direction = glGetUniformLocation(Program, "direction");
|
||||
uniform_col = glGetUniformLocation(Program, "col");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
{
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
@ -2344,7 +2336,7 @@ namespace FullScreenShader
|
||||
uniform_extents = glGetUniformLocation(Program, "extents");
|
||||
uniform_RHMatrix = glGetUniformLocation(Program, "RHMatrix");
|
||||
uniform_RSMMatrix = glGetUniformLocation(Program, "RSMMatrix");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void RadianceHintsConstructionShader::setUniforms(const core::matrix4 &RSMMatrix, const core::matrix4 &RHMatrix, const core::vector3df &extents, unsigned TU_ctex, unsigned TU_ntex, unsigned TU_dtex)
|
||||
@ -2411,7 +2403,7 @@ namespace FullScreenShader
|
||||
uniform_SHB = glGetUniformLocation(Program, "SHB");
|
||||
uniform_RHMatrix = glGetUniformLocation(Program, "RHMatrix");
|
||||
uniform_extents = glGetUniformLocation(Program, "extents");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
@ -2438,18 +2430,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian17taph.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
||||
vao = createFullScreenVAO(Program);
|
||||
}
|
||||
|
||||
GLuint ComputeGaussian17TapHShader::Program;
|
||||
GLuint ComputeGaussian17TapHShader::uniform_source;
|
||||
GLuint ComputeGaussian17TapHShader::uniform_dest;
|
||||
void ComputeGaussian17TapHShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/gaussian.comp").c_str());
|
||||
uniform_source = glGetUniformLocation(Program, "source");
|
||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
GLuint Gaussian6HBlurShader::Program;
|
||||
@ -2463,7 +2444,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian6h.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
GLuint Gaussian3HBlurShader::Program;
|
||||
@ -2477,7 +2458,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian3h.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
GLuint Gaussian17TapVShader::Program;
|
||||
@ -2491,18 +2472,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian17tapv.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
||||
vao = createFullScreenVAO(Program);
|
||||
}
|
||||
|
||||
GLuint ComputeGaussian17TapVShader::Program;
|
||||
GLuint ComputeGaussian17TapVShader::uniform_source;
|
||||
GLuint ComputeGaussian17TapVShader::uniform_dest;
|
||||
void ComputeGaussian17TapVShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/gaussianv.comp").c_str());
|
||||
uniform_source = glGetUniformLocation(Program, "source");
|
||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
GLuint Gaussian6VBlurShader::Program;
|
||||
@ -2516,7 +2486,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian6v.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
GLuint Gaussian3VBlurShader::Program;
|
||||
@ -2530,7 +2500,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian3v.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
GLuint PassThroughShader::Program;
|
||||
@ -2558,7 +2528,7 @@ namespace FullScreenShader
|
||||
uniform_texture = glGetUniformLocation(Program, "texture");
|
||||
uniform_zf = glGetUniformLocation(Program, "zf");
|
||||
uniform_zn = glGetUniformLocation(Program, "zn");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void LinearizeDepthShader::setUniforms(float zn, float zf, unsigned TU_tex)
|
||||
@ -2599,7 +2569,7 @@ namespace FullScreenShader
|
||||
uniform_dtex = glGetUniformLocation(Program, "dtex");
|
||||
uniform_noise_texture = glGetUniformLocation(Program, "noise_texture");
|
||||
uniform_samplePoints = glGetUniformLocation(Program, "samplePoints[0]");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
{
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
@ -2753,7 +2723,7 @@ namespace FullScreenShader
|
||||
uniform_start = glGetUniformLocation(Program, "start");
|
||||
uniform_end = glGetUniformLocation(Program, "end");
|
||||
uniform_col = glGetUniformLocation(Program, "col");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
{
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
@ -2794,7 +2764,7 @@ namespace FullScreenShader
|
||||
uniform_direction = glGetUniformLocation(Program, "direction");
|
||||
uniform_mask_radius = glGetUniformLocation(Program, "mask_radius");
|
||||
uniform_max_tex_height = glGetUniformLocation(Program, "max_tex_height");
|
||||
vao = createFullScreenVAO(Program);
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void MotionBlurShader::setUniforms(float boost_amount, const core::vector2df ¢er, const core::vector2df &direction, float mask_radius, float max_tex_height, unsigned TU_cb)
|
||||
@ -2849,6 +2819,24 @@ namespace FullScreenShader
|
||||
glUniform1i(uniform_tex, TU_tex);
|
||||
}
|
||||
|
||||
GLuint LogLuminanceShader::Program;
|
||||
GLuint LogLuminanceShader::uniform_tex;
|
||||
GLuint LogLuminanceShader::vao;
|
||||
|
||||
void LogLuminanceShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/logluminance.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void LogLuminanceShader::setUniforms(unsigned TU_tex)
|
||||
{
|
||||
glUniform1i(uniform_tex, TU_tex);
|
||||
}
|
||||
|
||||
GLuint MLAAColorEdgeDetectionSHader::Program;
|
||||
GLuint MLAAColorEdgeDetectionSHader::uniform_colorMapG;
|
||||
GLuint MLAAColorEdgeDetectionSHader::uniform_PIXEL_SIZE;
|
||||
|
@ -526,11 +526,11 @@ class BloomBlendShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_tex_128, uniform_tex_256, uniform_tex_512;
|
||||
static GLuint uniform_texture;
|
||||
static GLuint vao;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(unsigned TU_tex_128, unsigned TU_tex_256, unsigned TU_tex_512);
|
||||
static void setUniforms(unsigned TU_tex);
|
||||
};
|
||||
|
||||
class ToneMapShader
|
||||
@ -555,6 +555,16 @@ public:
|
||||
static void setUniforms(unsigned TU_tex, unsigned TU_depth);
|
||||
};
|
||||
|
||||
class ColorLevelShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_tex, uniform_invprojm, uniform_dtex, uniform_inlevel, uniform_outlevel;
|
||||
static GLuint vao;
|
||||
|
||||
static void init();
|
||||
};
|
||||
|
||||
class SunLightShader
|
||||
{
|
||||
public:
|
||||
@ -641,15 +651,6 @@ public:
|
||||
static void init();
|
||||
};
|
||||
|
||||
class ComputeGaussian17TapHShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_source, uniform_dest;
|
||||
|
||||
static void init();
|
||||
};
|
||||
|
||||
class Gaussian6HBlurShader
|
||||
{
|
||||
public:
|
||||
@ -680,16 +681,6 @@ public:
|
||||
static void init();
|
||||
};
|
||||
|
||||
class ComputeGaussian17TapVShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_source, uniform_dest;
|
||||
|
||||
static void init();
|
||||
};
|
||||
|
||||
|
||||
class Gaussian6VBlurShader
|
||||
{
|
||||
public:
|
||||
@ -797,6 +788,17 @@ public:
|
||||
static void setUniforms(const core::vector2df &sunpos, unsigned TU_tex);
|
||||
};
|
||||
|
||||
class LogLuminanceShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_tex;
|
||||
static GLuint vao;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(unsigned TU_tex);
|
||||
};
|
||||
|
||||
class MLAAColorEdgeDetectionSHader
|
||||
{
|
||||
public:
|
||||
|
@ -230,7 +230,7 @@ void STKAnimatedMesh::render()
|
||||
for_in(mesh, TransparentMesh[TM_BUBBLE])
|
||||
drawBubble(*mesh, ModelViewProjectionMatrix);
|
||||
|
||||
if (World::getWorld() != NULL && World::getWorld()->isFogEnabled())
|
||||
if (World::getWorld()->isFogEnabled())
|
||||
{
|
||||
if (!TransparentMesh[TM_DEFAULT].empty() || !TransparentMesh[TM_ADDITIVE].empty())
|
||||
glUseProgram(MeshShader::TransparentFogShader::Program);
|
||||
|
@ -60,129 +60,129 @@ GLuint createVAO(GLuint vbo, GLuint idx, GLuint attrib_position, GLuint attrib_t
|
||||
{
|
||||
if (attrib_position == -1)
|
||||
return 0;
|
||||
GLuint vao;
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glEnableVertexAttribArray(attrib_position);
|
||||
if ((GLint)attrib_texcoord != -1)
|
||||
glEnableVertexAttribArray(attrib_texcoord);
|
||||
if ((GLint)attrib_second_texcoord != -1)
|
||||
glEnableVertexAttribArray(attrib_second_texcoord);
|
||||
if ((GLint)attrib_normal != -1)
|
||||
glEnableVertexAttribArray(attrib_normal);
|
||||
if ((GLint)attrib_tangent != -1)
|
||||
glEnableVertexAttribArray(attrib_tangent);
|
||||
if ((GLint)attrib_bitangent != -1)
|
||||
glEnableVertexAttribArray(attrib_bitangent);
|
||||
if ((GLint)attrib_color != -1)
|
||||
glEnableVertexAttribArray(attrib_color);
|
||||
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, stride, 0);
|
||||
if ((GLint)attrib_texcoord != -1)
|
||||
glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 28);
|
||||
if ((GLint)attrib_second_texcoord != -1)
|
||||
{
|
||||
if (stride < 44)
|
||||
Log::error("material", "Second texcoords not present in VBO");
|
||||
glVertexAttribPointer(attrib_second_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 36);
|
||||
}
|
||||
if ((GLint)attrib_normal != -1)
|
||||
glVertexAttribPointer(attrib_normal, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 12);
|
||||
if ((GLint)attrib_tangent != -1)
|
||||
{
|
||||
if (stride < 48)
|
||||
Log::error("material", "Tangents not present in VBO");
|
||||
glVertexAttribPointer(attrib_tangent, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)36);
|
||||
}
|
||||
|
||||
if ((GLint)attrib_bitangent != -1)
|
||||
{
|
||||
if (stride < 60)
|
||||
Log::error("material", "Bitangents not present in VBO");
|
||||
glVertexAttribPointer(attrib_bitangent, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)48);
|
||||
}
|
||||
if ((GLint)attrib_color != -1)
|
||||
glVertexAttribPointer(attrib_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, (GLvoid*)24);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idx);
|
||||
return vao;
|
||||
GLuint vao;
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glEnableVertexAttribArray(attrib_position);
|
||||
if ((GLint)attrib_texcoord != -1)
|
||||
glEnableVertexAttribArray(attrib_texcoord);
|
||||
if ((GLint)attrib_second_texcoord != -1)
|
||||
glEnableVertexAttribArray(attrib_second_texcoord);
|
||||
if ((GLint)attrib_normal != -1)
|
||||
glEnableVertexAttribArray(attrib_normal);
|
||||
if ((GLint)attrib_tangent != -1)
|
||||
glEnableVertexAttribArray(attrib_tangent);
|
||||
if ((GLint)attrib_bitangent != -1)
|
||||
glEnableVertexAttribArray(attrib_bitangent);
|
||||
if ((GLint)attrib_color != -1)
|
||||
glEnableVertexAttribArray(attrib_color);
|
||||
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, stride, 0);
|
||||
if ((GLint)attrib_texcoord != -1)
|
||||
glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 28);
|
||||
if ((GLint)attrib_second_texcoord != -1)
|
||||
{
|
||||
if (stride < 44)
|
||||
Log::error("material", "Second texcoords not present in VBO");
|
||||
glVertexAttribPointer(attrib_second_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 36);
|
||||
}
|
||||
if ((GLint)attrib_normal != -1)
|
||||
glVertexAttribPointer(attrib_normal, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 12);
|
||||
if ((GLint)attrib_tangent != -1)
|
||||
{
|
||||
if (stride < 48)
|
||||
Log::error("material", "Tangents not present in VBO");
|
||||
glVertexAttribPointer(attrib_tangent, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)36);
|
||||
}
|
||||
|
||||
if ((GLint)attrib_bitangent != -1)
|
||||
{
|
||||
if (stride < 60)
|
||||
Log::error("material", "Bitangents not present in VBO");
|
||||
glVertexAttribPointer(attrib_bitangent, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)48);
|
||||
}
|
||||
if ((GLint)attrib_color != -1)
|
||||
glVertexAttribPointer(attrib_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, (GLvoid*)24);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idx);
|
||||
return vao;
|
||||
}
|
||||
|
||||
GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb)
|
||||
{
|
||||
GLMesh result = {};
|
||||
if (!mb)
|
||||
return result;
|
||||
glBindVertexArray(0);
|
||||
glGenBuffers(1, &(result.vertex_buffer));
|
||||
glGenBuffers(1, &(result.index_buffer));
|
||||
GLMesh result = {};
|
||||
if (!mb)
|
||||
return result;
|
||||
glBindVertexArray(0);
|
||||
glGenBuffers(1, &(result.vertex_buffer));
|
||||
glGenBuffers(1, &(result.index_buffer));
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, result.vertex_buffer);
|
||||
const void* vertices = mb->getVertices();
|
||||
const u32 vertexCount = mb->getVertexCount();
|
||||
const irr::video::E_VERTEX_TYPE vType = mb->getVertexType();
|
||||
result.Stride = getVertexPitchFromType(vType);
|
||||
const c8* vbuf = static_cast<const c8*>(vertices);
|
||||
glBufferData(GL_ARRAY_BUFFER, vertexCount * result.Stride, vbuf, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, result.vertex_buffer);
|
||||
const void* vertices = mb->getVertices();
|
||||
const u32 vertexCount = mb->getVertexCount();
|
||||
const irr::video::E_VERTEX_TYPE vType = mb->getVertexType();
|
||||
result.Stride = getVertexPitchFromType(vType);
|
||||
const c8* vbuf = static_cast<const c8*>(vertices);
|
||||
glBufferData(GL_ARRAY_BUFFER, vertexCount * result.Stride, vbuf, GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, result.index_buffer);
|
||||
const void* indices = mb->getIndices();
|
||||
u32 indexCount = mb->getIndexCount();
|
||||
GLenum indexSize;
|
||||
switch (mb->getIndexType())
|
||||
{
|
||||
case irr::video::EIT_16BIT:
|
||||
{
|
||||
indexSize = sizeof(u16);
|
||||
result.IndexType = GL_UNSIGNED_SHORT;
|
||||
break;
|
||||
}
|
||||
case irr::video::EIT_32BIT:
|
||||
{
|
||||
indexSize = sizeof(u32);
|
||||
result.IndexType = GL_UNSIGNED_INT;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
assert(0 && "Wrong index size");
|
||||
}
|
||||
}
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, result.index_buffer);
|
||||
const void* indices = mb->getIndices();
|
||||
u32 indexCount = mb->getIndexCount();
|
||||
GLenum indexSize;
|
||||
switch (mb->getIndexType())
|
||||
{
|
||||
case irr::video::EIT_16BIT:
|
||||
{
|
||||
indexSize = sizeof(u16);
|
||||
result.IndexType = GL_UNSIGNED_SHORT;
|
||||
break;
|
||||
}
|
||||
case irr::video::EIT_32BIT:
|
||||
{
|
||||
indexSize = sizeof(u32);
|
||||
result.IndexType = GL_UNSIGNED_INT;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
assert(0 && "Wrong index size");
|
||||
}
|
||||
}
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
result.IndexCount = mb->getIndexCount();
|
||||
switch (mb->getPrimitiveType())
|
||||
{
|
||||
case scene::EPT_POINTS:
|
||||
result.PrimitiveType = GL_POINTS;
|
||||
result.IndexCount = mb->getIndexCount();
|
||||
switch (mb->getPrimitiveType())
|
||||
{
|
||||
case scene::EPT_POINTS:
|
||||
result.PrimitiveType = GL_POINTS;
|
||||
break;
|
||||
case scene::EPT_TRIANGLE_STRIP:
|
||||
result.PrimitiveType = GL_TRIANGLE_STRIP;
|
||||
break;
|
||||
case scene::EPT_TRIANGLE_FAN:
|
||||
result.PrimitiveType = GL_TRIANGLE_FAN;
|
||||
break;
|
||||
case scene::EPT_LINES:
|
||||
result.PrimitiveType = GL_LINES;
|
||||
break;
|
||||
case scene::EPT_TRIANGLE_STRIP:
|
||||
result.PrimitiveType = GL_TRIANGLE_STRIP;
|
||||
break;
|
||||
case scene::EPT_TRIANGLE_FAN:
|
||||
result.PrimitiveType = GL_TRIANGLE_FAN;
|
||||
break;
|
||||
case scene::EPT_LINES:
|
||||
result.PrimitiveType = GL_LINES;
|
||||
break;
|
||||
case scene::EPT_TRIANGLES:
|
||||
result.PrimitiveType = GL_TRIANGLES;
|
||||
break;
|
||||
case scene::EPT_POINT_SPRITES:
|
||||
case scene::EPT_LINE_LOOP:
|
||||
case scene::EPT_POLYGON:
|
||||
case scene::EPT_LINE_STRIP:
|
||||
case scene::EPT_QUAD_STRIP:
|
||||
case scene::EPT_QUADS:
|
||||
assert(0 && "Unsupported primitive type");
|
||||
}
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
case scene::EPT_TRIANGLES:
|
||||
result.PrimitiveType = GL_TRIANGLES;
|
||||
break;
|
||||
case scene::EPT_POINT_SPRITES:
|
||||
case scene::EPT_LINE_LOOP:
|
||||
case scene::EPT_POLYGON:
|
||||
case scene::EPT_LINE_STRIP:
|
||||
case scene::EPT_QUAD_STRIP:
|
||||
case scene::EPT_QUADS:
|
||||
assert(0 && "Unsupported primitive type");
|
||||
}
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
result.textures[i] = mb->getMaterial().getTexture(i);
|
||||
result.TextureMatrix = 0;
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -215,18 +215,18 @@ core::vector3df getWind()
|
||||
void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, core::vector3df windDir)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
|
||||
MeshShader::GrassPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, windDir, 0);
|
||||
MeshShader::GrassPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, windDir, 0);
|
||||
|
||||
assert(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix)
|
||||
@ -367,28 +367,28 @@ static video::ITexture *CausticTex = 0;
|
||||
void drawGrassPass2(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, core::vector3df windDir)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(MeshShader::GrassPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = {GL_ONE, GL_ONE, GL_ONE, GL_ALPHA};
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = {GL_ONE, GL_ONE, GL_ONE, GL_ALPHA};
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
|
||||
MeshShader::GrassPass2Shader::setUniforms(ModelViewProjectionMatrix, windDir);
|
||||
|
||||
assert(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
||||
@ -408,55 +408,55 @@ void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
||||
void drawObjectRimLimit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(MeshShader::ObjectRimLimitShader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
|
||||
MeshShader::ObjectRimLimitShader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix);
|
||||
|
||||
assert(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawObjectUnlit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(MeshShader::ObjectUnlitShader::TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
|
||||
MeshShader::ObjectUnlitShader::setUniforms(ModelViewProjectionMatrix);
|
||||
|
||||
assert(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
|
||||
@ -491,36 +491,36 @@ void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelView
|
||||
void drawObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(MeshShader::ObjectPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
|
||||
MeshShader::ObjectPass2Shader::setUniforms(ModelViewProjectionMatrix, TextureMatrix);
|
||||
|
||||
assert(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
@ -528,8 +528,8 @@ void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewPro
|
||||
MeshShader::TransparentShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, 0);
|
||||
|
||||
assert(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
|
||||
@ -567,21 +567,21 @@ void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelView
|
||||
void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
|
||||
float transparency = 1.;
|
||||
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
|
||||
float transparency = 1.;
|
||||
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
|
||||
MeshShader::BubbleShader::setUniforms(ModelViewProjectionMatrix, 0, time, transparency);
|
||||
MeshShader::BubbleShader::setUniforms(ModelViewProjectionMatrix, 0, time, transparency);
|
||||
|
||||
assert(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawShadowRef(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
||||
@ -616,39 +616,39 @@ void drawShadow(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
||||
|
||||
bool isObject(video::E_MATERIAL_TYPE type)
|
||||
{
|
||||
if (type == irr_driver->getShader(ES_OBJECTPASS))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_OBJECTPASS_RIMLIT))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_NORMAL_MAP))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_SPHERE_MAP))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_SPLATTING))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_GRASS))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_GRASS_REF))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_BUBBLES))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
|
||||
return true;
|
||||
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL)
|
||||
return true;
|
||||
if (type == video::EMT_ONETEXTURE_BLEND)
|
||||
return true;
|
||||
if (type == video::EMT_TRANSPARENT_ADD_COLOR)
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_OBJECTPASS))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_OBJECTPASS_RIMLIT))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_NORMAL_MAP))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_SPHERE_MAP))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_SPLATTING))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_GRASS))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_GRASS_REF))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_BUBBLES))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
|
||||
return true;
|
||||
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL)
|
||||
return true;
|
||||
if (type == video::EMT_ONETEXTURE_BLEND)
|
||||
return true;
|
||||
if (type == video::EMT_TRANSPARENT_ADD_COLOR)
|
||||
return true;
|
||||
if (type == video::EMT_SOLID)
|
||||
return true;
|
||||
if (type == video::EMT_LIGHTMAP_LIGHTING)
|
||||
return true;
|
||||
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
||||
return true;
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
void initvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat)
|
||||
@ -740,7 +740,7 @@ void initvaostate(GLMesh &mesh, TransparentMaterial TranspMat)
|
||||
break;
|
||||
case TM_DEFAULT:
|
||||
case TM_ADDITIVE:
|
||||
if (World::getWorld() != NULL && World::getWorld()->isFogEnabled())
|
||||
if (World::getWorld()->isFogEnabled())
|
||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
||||
MeshShader::TransparentFogShader::attrib_position, MeshShader::TransparentFogShader::attrib_texcoord, -1, -1, -1, -1, MeshShader::TransparentFogShader::attrib_color, mesh.Stride);
|
||||
else
|
||||
|
@ -168,7 +168,7 @@ void STKMeshSceneNode::drawDisplace(const GLMesh &mesh)
|
||||
core::vector2df(cb->getDirX(), cb->getDirY()),
|
||||
core::vector2df(cb->getDir2X(), cb->getDir2Y()),
|
||||
core::vector2df(float(UserConfigParams::m_width),
|
||||
float(UserConfigParams::m_height)),
|
||||
float(UserConfigParams::m_height)),
|
||||
0, 1, 2);
|
||||
|
||||
assert(mesh.vao_displace_pass);
|
||||
|
@ -691,6 +691,7 @@ X##_yflip.LowerRightCorner.Y = w->m_skin_dest_y + \
|
||||
void Skin::drawButton(Widget* w, const core::recti &rect,
|
||||
const bool pressed, const bool focused)
|
||||
{
|
||||
|
||||
// if within an appearing dialog, grow
|
||||
if (m_dialog && m_dialog_size < 1.0f && w->m_parent != NULL &&
|
||||
w->m_parent->getType() == gui::EGUIET_WINDOW)
|
||||
@ -1915,16 +1916,6 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
|
||||
if (!widget->m_event_handler->m_deactivated)
|
||||
drawSpinnerChild(rect, widget, pressed, focused);
|
||||
}
|
||||
else if (type == WTYPE_MODEL_VIEW)
|
||||
{
|
||||
ModelViewWidget* mvw = dynamic_cast<ModelViewWidget*>(widget);
|
||||
FrameBuffer* fb = mvw->getFrameBuffer();
|
||||
if (fb != NULL && fb->getRTT().size() > 0)
|
||||
{
|
||||
draw2DImageFromRTT(fb->getRTT()[0], 512, 512,
|
||||
rect, core::rect<s32>(0, 0, 512, 512), NULL, true);
|
||||
}
|
||||
}
|
||||
else if (type == WTYPE_ICON_BUTTON || type == WTYPE_MODEL_VIEW)
|
||||
{
|
||||
drawIconButton(rect, widget, pressed, focused);
|
||||
@ -2110,10 +2101,8 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor,
|
||||
{
|
||||
SColor& bg_color = SkinConfig::m_colors["text_field::background"];
|
||||
SColor& bg_color_focused = SkinConfig::m_colors["text_field::background_focused"];
|
||||
SColor& bg_color_deactivated = SkinConfig::m_colors["text_field::background_deactivated"];
|
||||
SColor& border_color = SkinConfig::m_colors["text_field::neutral"];
|
||||
SColor& border_color_focus = SkinConfig::m_colors["text_field::focused"];
|
||||
SColor& border_color_deactivated = SkinConfig::m_colors["text_field::deactivated"];
|
||||
|
||||
core::recti borderArea = rect;
|
||||
//borderArea.UpperLeftCorner -= position2d< s32 >( 2, 2 );
|
||||
@ -2139,22 +2128,12 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor,
|
||||
center.Y + (int)(((int)rect.LowerRightCorner.Y
|
||||
- (int)center.Y)*texture_size);
|
||||
}
|
||||
if(widget->m_deactivated)
|
||||
GL32_draw2DRectangle(border_color_deactivated, borderArea);
|
||||
else if(focused)
|
||||
GL32_draw2DRectangle(border_color_focus, borderArea);
|
||||
else
|
||||
GL32_draw2DRectangle(border_color, borderArea);
|
||||
GL32_draw2DRectangle(focused ? border_color_focus : border_color, borderArea);
|
||||
|
||||
core::recti innerArea = borderArea;
|
||||
innerArea.UpperLeftCorner += position2d< s32 >( 3, 3 );
|
||||
innerArea.LowerRightCorner -= position2d< s32 >( 3, 3 );
|
||||
if(widget->m_deactivated)
|
||||
GL32_draw2DRectangle(bg_color_deactivated, innerArea);
|
||||
else if(focused)
|
||||
GL32_draw2DRectangle(bg_color_focused, innerArea);
|
||||
else
|
||||
GL32_draw2DRectangle(bg_color, innerArea);
|
||||
GL32_draw2DRectangle(focused ? bg_color_focused : bg_color, innerArea);
|
||||
return;
|
||||
}
|
||||
else if (type == WTYPE_LIST)
|
||||
|
@ -15,19 +15,9 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/widgets/model_view_widget.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/post_processing.hpp"
|
||||
#include "graphics/rtts.hpp"
|
||||
#include <algorithm>
|
||||
#include <IAnimatedMesh.h>
|
||||
#include <IAnimatedMeshSceneNode.h>
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <ILightSceneNode.h>
|
||||
#include <ISceneManager.h>
|
||||
|
||||
using namespace GUIEngine;
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
@ -35,10 +25,7 @@ using namespace irr::gui;
|
||||
ModelViewWidget::ModelViewWidget() :
|
||||
IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO, false, false)
|
||||
{
|
||||
m_frame_buffer = NULL;
|
||||
m_rtt_main_node = NULL;
|
||||
m_camera = NULL;
|
||||
m_light = NULL;
|
||||
//FIXME: find nicer way than overriding what IconButtonWidget's constructor already set...
|
||||
m_type = WTYPE_MODEL_VIEW;
|
||||
m_rtt_provider = NULL;
|
||||
m_rotation_mode = ROTATE_OFF;
|
||||
@ -83,17 +70,10 @@ void ModelViewWidget::clearModels()
|
||||
m_model_scale.clear();
|
||||
m_model_frames.clear();
|
||||
|
||||
if (m_rtt_main_node != NULL) m_rtt_main_node->remove();
|
||||
if (m_light != NULL) m_light->remove();
|
||||
if (m_camera != NULL) m_camera->remove();
|
||||
|
||||
m_rtt_main_node = NULL;
|
||||
m_camera = NULL;
|
||||
m_light = NULL;
|
||||
delete m_rtt_provider;
|
||||
m_rtt_provider = NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location,
|
||||
const Vec3& scale, const int frame)
|
||||
{
|
||||
@ -103,8 +83,20 @@ void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location,
|
||||
m_model_location.push_back(location);
|
||||
m_model_scale.push_back(scale);
|
||||
m_model_frames.push_back(frame);
|
||||
}
|
||||
|
||||
/*
|
||||
((IGUIMeshViewer*)m_element)->setMesh( mesh );
|
||||
|
||||
video::SMaterial mat = mesh->getMeshBuffer(0)->getMaterial(); //mesh_view->getMaterial();
|
||||
mat.setFlag(EMF_LIGHTING , false);
|
||||
//mat.setFlag(EMF_GOURAUD_SHADING, false);
|
||||
//mat.setFlag(EMF_NORMALIZE_NORMALS, true);
|
||||
((IGUIMeshViewer*)m_element)->setMaterial(mat);
|
||||
*/
|
||||
|
||||
delete m_rtt_provider;
|
||||
m_rtt_provider = NULL;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void ModelViewWidget::update(float delta)
|
||||
{
|
||||
@ -154,145 +146,28 @@ void ModelViewWidget::update(float delta)
|
||||
if (fabsf(angle - m_rotation_target) < 2.0f) m_rotation_mode = ROTATE_OFF;
|
||||
}
|
||||
|
||||
if (!irr_driver->isGLSL())
|
||||
return;
|
||||
|
||||
if (m_rtt_provider == NULL)
|
||||
{
|
||||
std::string name = "model view ";
|
||||
name += m_properties[PROP_ID].c_str();
|
||||
|
||||
m_rtt_provider = new RTT(512, 512);
|
||||
m_rtt_provider = new IrrDriver::RTTProvider(core::dimension2d< u32 >(512, 512), name, false);
|
||||
m_rtt_provider->setupRTTScene(m_models, m_model_location, m_model_scale, m_model_frames);
|
||||
}
|
||||
|
||||
if (m_rtt_main_node == NULL)
|
||||
m_texture = m_rtt_provider->renderToTexture(angle);
|
||||
if (m_texture != NULL)
|
||||
{
|
||||
setupRTTScene(m_models, m_model_location, m_model_scale, m_model_frames);
|
||||
}
|
||||
|
||||
m_rtt_main_node->setRotation(core::vector3df(0.0f, angle, 0.0f));
|
||||
|
||||
m_rtt_main_node->setVisible(true);
|
||||
irr_driver->setRTT(m_rtt_provider);
|
||||
|
||||
irr_driver->getSceneManager()->setActiveCamera(m_camera);
|
||||
|
||||
std::vector<IrrDriver::GlowData> glows;
|
||||
irr_driver->computeCameraMatrix(m_camera, 512, 512);
|
||||
unsigned plc = irr_driver->UpdateLightsInfo(m_camera, GUIEngine::getLatestDt());
|
||||
irr_driver->renderScene(m_camera, plc, glows, GUIEngine::getLatestDt(), false, true);
|
||||
m_frame_buffer = irr_driver->getPostProcessing()->render(m_camera);
|
||||
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
|
||||
irr_driver->setRTT(NULL);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
irr_driver->getSceneManager()->setActiveCamera(NULL);
|
||||
m_rtt_main_node->setVisible(false);
|
||||
}
|
||||
|
||||
void ModelViewWidget::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
|
||||
AlignedArray<Vec3>& mesh_location,
|
||||
AlignedArray<Vec3>& mesh_scale,
|
||||
const std::vector<int>& model_frames)
|
||||
{
|
||||
irr_driver->suppressSkyBox();
|
||||
|
||||
if (m_rtt_main_node != NULL) m_rtt_main_node->remove();
|
||||
if (m_light != NULL) m_light->remove();
|
||||
if (m_camera != NULL) m_camera->remove();
|
||||
|
||||
m_rtt_main_node = NULL;
|
||||
m_camera = NULL;
|
||||
m_light = NULL;
|
||||
|
||||
irr_driver->clearLights();
|
||||
|
||||
if (model_frames[0] == -1)
|
||||
{
|
||||
scene::ISceneNode* node = irr_driver->addMesh(mesh.get(0), NULL);
|
||||
node->setPosition(mesh_location[0].toIrrVector());
|
||||
node->setScale(mesh_scale[0].toIrrVector());
|
||||
node->setMaterialFlag(video::EMF_FOG_ENABLE, false);
|
||||
m_rtt_main_node = node;
|
||||
setImage(m_texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
scene::IAnimatedMeshSceneNode* node =
|
||||
irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)mesh.get(0), NULL);
|
||||
node->setPosition(mesh_location[0].toIrrVector());
|
||||
node->setFrameLoop(model_frames[0], model_frames[0]);
|
||||
node->setAnimationSpeed(0);
|
||||
node->setScale(mesh_scale[0].toIrrVector());
|
||||
node->setMaterialFlag(video::EMF_FOG_ENABLE, false);
|
||||
|
||||
m_rtt_main_node = node;
|
||||
m_rtt_unsupported = true;
|
||||
}
|
||||
|
||||
assert(m_rtt_main_node != NULL);
|
||||
assert(mesh.size() == mesh_location.size());
|
||||
assert(mesh.size() == model_frames.size());
|
||||
|
||||
const int mesh_amount = mesh.size();
|
||||
for (int n = 1; n<mesh_amount; n++)
|
||||
{
|
||||
if (model_frames[n] == -1)
|
||||
{
|
||||
scene::ISceneNode* node =
|
||||
irr_driver->addMesh(mesh.get(n), m_rtt_main_node);
|
||||
node->setPosition(mesh_location[n].toIrrVector());
|
||||
node->updateAbsolutePosition();
|
||||
node->setScale(mesh_scale[n].toIrrVector());
|
||||
}
|
||||
else
|
||||
{
|
||||
scene::IAnimatedMeshSceneNode* node =
|
||||
irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)mesh.get(n),
|
||||
m_rtt_main_node);
|
||||
node->setPosition(mesh_location[n].toIrrVector());
|
||||
node->setFrameLoop(model_frames[n], model_frames[n]);
|
||||
node->setAnimationSpeed(0);
|
||||
node->updateAbsolutePosition();
|
||||
node->setScale(mesh_scale[n].toIrrVector());
|
||||
//std::cout << "(((( set frame " << model_frames[n] << " ))))\n";
|
||||
}
|
||||
}
|
||||
|
||||
irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 35, 35, 35));
|
||||
|
||||
const core::vector3df &spot_pos = core::vector3df(0, 30, 40);
|
||||
m_light = irr_driver->addLight(spot_pos, 0.3f /* energy */, 10 /* distance */, 1.0f /* r */, 1.0f /* g */, 1.0f /* g*/, true, NULL);
|
||||
|
||||
m_rtt_main_node->setMaterialFlag(video::EMF_GOURAUD_SHADING, true);
|
||||
m_rtt_main_node->setMaterialFlag(video::EMF_LIGHTING, true);
|
||||
|
||||
const int materials = m_rtt_main_node->getMaterialCount();
|
||||
for (int n = 0; n<materials; n++)
|
||||
{
|
||||
m_rtt_main_node->getMaterial(n).setFlag(video::EMF_LIGHTING, true);
|
||||
|
||||
// set size of specular highlights
|
||||
m_rtt_main_node->getMaterial(n).Shininess = 100.0f;
|
||||
m_rtt_main_node->getMaterial(n).SpecularColor.set(255, 50, 50, 50);
|
||||
m_rtt_main_node->getMaterial(n).DiffuseColor.set(255, 150, 150, 150);
|
||||
|
||||
m_rtt_main_node->getMaterial(n).setFlag(video::EMF_GOURAUD_SHADING,
|
||||
true);
|
||||
}
|
||||
|
||||
m_camera = irr_driver->getSceneManager()->addCameraSceneNode();
|
||||
m_camera->setAspectRatio(1.0f);
|
||||
|
||||
m_camera->setPosition(core::vector3df(0.0, 20.0f, 70.0f));
|
||||
if (irr_driver->isGLSL())
|
||||
m_camera->setUpVector(core::vector3df(0.0, 1.0, 0.0));
|
||||
else
|
||||
m_camera->setUpVector(core::vector3df(0.0, 1.0, 0.0));
|
||||
m_camera->setTarget(core::vector3df(0, 10, 0.0f));
|
||||
m_camera->setFOV(DEGREE_TO_RAD*50.0f);
|
||||
m_camera->updateAbsolutePosition();
|
||||
//getIrrlichtElement<IGUIButton>()->setImage(m_texture);
|
||||
//getIrrlichtElement<IGUIButton>()->setPressedImage(m_texture);
|
||||
}
|
||||
|
||||
|
||||
void ModelViewWidget::setRotateOff()
|
||||
{
|
||||
m_rotation_mode = ROTATE_OFF;
|
||||
|
@ -52,20 +52,12 @@ namespace GUIEngine
|
||||
|
||||
video::ITexture* m_texture;
|
||||
|
||||
RTT* m_rtt_provider;
|
||||
IrrDriver::RTTProvider* m_rtt_provider;
|
||||
|
||||
float angle;
|
||||
|
||||
bool m_rtt_unsupported;
|
||||
|
||||
scene::ISceneNode *m_rtt_main_node;
|
||||
|
||||
scene::ICameraSceneNode *m_camera;
|
||||
|
||||
scene::ISceneNode *m_light;
|
||||
|
||||
FrameBuffer *m_frame_buffer;
|
||||
|
||||
public:
|
||||
|
||||
LEAK_CHECK()
|
||||
@ -97,13 +89,6 @@ namespace GUIEngine
|
||||
bool isRotating();
|
||||
|
||||
void clearRttProvider();
|
||||
|
||||
void setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
|
||||
AlignedArray<Vec3>& mesh_location,
|
||||
AlignedArray<Vec3>& mesh_scale,
|
||||
const std::vector<int>& model_frames);
|
||||
|
||||
FrameBuffer* getFrameBuffer() { return m_frame_buffer; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -94,9 +94,6 @@ void TextBoxWidget::add()
|
||||
(m_parent ? m_parent : GUIEngine::getGUIEnv()->getRootGUIElement()),
|
||||
getNewID(), widget_size);
|
||||
|
||||
if (m_deactivated)
|
||||
m_element->setEnabled(false);
|
||||
|
||||
//m_element = GUIEngine::getGUIEnv()->addEditBox(text.c_str(), widget_size,
|
||||
// true /* border */, m_parent, getNewID());
|
||||
m_id = m_element->getID();
|
||||
@ -171,33 +168,3 @@ void TextBoxWidget::elementRemoved()
|
||||
m_element->drop();
|
||||
Widget::elementRemoved();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void TextBoxWidget::setActivated()
|
||||
{
|
||||
Widget::setActivated();
|
||||
|
||||
if (m_element != NULL)
|
||||
{
|
||||
IGUIEditBox* textCtrl = Widget::getIrrlichtElement<IGUIEditBox>();
|
||||
assert(textCtrl != NULL);
|
||||
textCtrl->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void TextBoxWidget::setDeactivated()
|
||||
{
|
||||
Widget::setDeactivated();
|
||||
|
||||
if (m_element != NULL)
|
||||
{
|
||||
IGUIEditBox* textCtrl = Widget::getIrrlichtElement<IGUIEditBox>();
|
||||
assert(textCtrl != NULL);
|
||||
textCtrl->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -71,12 +71,6 @@ namespace GUIEngine
|
||||
void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*');
|
||||
|
||||
virtual void elementRemoved();
|
||||
|
||||
/** Override method from base class Widget */
|
||||
virtual void setActivated();
|
||||
|
||||
/** Override method from base class Widget */
|
||||
virtual void setDeactivated();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -860,7 +860,7 @@ void FileManager::checkAndCreateScreenshotDir()
|
||||
} // checkAndCreateScreenshotDir
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Creates the directories for cached textures. This will set
|
||||
/** Creates the directories for cached textures. This will set
|
||||
* m_cached_textures_dir with the appropriate path.
|
||||
*/
|
||||
void FileManager::checkAndCreateCachedTexturesDir()
|
||||
@ -1033,12 +1033,12 @@ void FileManager::redirectOutput()
|
||||
} // redirectOutput
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns the theoretical location of the cached version of a texture
|
||||
/** Returns the theoretical location of the cached version of a texture
|
||||
* depending of the current config. (This function also works for directories:
|
||||
* in this case the returned directory will be the cache location for all
|
||||
* textures that you will find in the specified directory. The specified
|
||||
* directory must end with '/')
|
||||
* \note The returned location is where the cached data should be read or
|
||||
* \note The returned location is where the cached data should be read or
|
||||
* written but the file itseft does not necessarity exist. However, the
|
||||
* directory structure is automatically created if it does not exist.
|
||||
*/
|
||||
@ -1247,7 +1247,7 @@ bool FileManager::copyFile(const std::string &source, const std::string &dest)
|
||||
if(!f_source) return false;
|
||||
|
||||
FILE *f_dest = fopen(dest.c_str(), "wb");
|
||||
if(!f_dest)
|
||||
if(!f_dest)
|
||||
{
|
||||
fclose(f_source);
|
||||
return false;
|
||||
|
@ -78,7 +78,7 @@ void AbstractKart::reset()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Returns a name to be displayed for this kart. */
|
||||
core::stringw AbstractKart::getName() const
|
||||
const wchar_t* AbstractKart::getName() const
|
||||
{
|
||||
return m_kart_properties->getName();
|
||||
} // getName;
|
||||
|
@ -83,7 +83,6 @@ public:
|
||||
int world_kart_id,
|
||||
int position, const btTransform& init_transform);
|
||||
virtual ~AbstractKart();
|
||||
virtual core::stringw getName() const;
|
||||
virtual void reset();
|
||||
virtual void init(RaceManager::KartType type) = 0;
|
||||
// ========================================================================
|
||||
@ -110,7 +109,8 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the kart properties. */
|
||||
void setKartProperties(const KartProperties *kp) { m_kart_properties=kp; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
virtual const wchar_t* getName() const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a unique identifier for this kart (name of the directory the
|
||||
* kart was loaded from). */
|
||||
|
@ -1260,8 +1260,8 @@ void SkiddingAI::handleItems(const float dt)
|
||||
// slower. Also, if the kart behind is closer and not slower than
|
||||
// this kart.
|
||||
bool fire_backwards = !m_kart_ahead ||
|
||||
(m_kart_behind &&
|
||||
(m_distance_behind < m_distance_ahead ||
|
||||
(m_kart_behind &&
|
||||
(m_distance_behind < m_distance_ahead ||
|
||||
kart_ahead_is_slow ) &&
|
||||
!kart_behind_is_slow
|
||||
);
|
||||
@ -1271,7 +1271,7 @@ void SkiddingAI::handleItems(const float dt)
|
||||
// the kart anyway, or that this might force the kart ahead to
|
||||
// use its nitro/zipper (and then we will shoot since then the
|
||||
// kart is faster).
|
||||
if ((fire_backwards && kart_behind_is_slow) ||
|
||||
if ((fire_backwards && kart_behind_is_slow) ||
|
||||
(!fire_backwards && kart_ahead_is_slow) )
|
||||
break;
|
||||
|
||||
@ -1750,7 +1750,7 @@ void SkiddingAI::checkCrashes(const Vec3& pos )
|
||||
// Ignore karts ahead that are faster than this kart.
|
||||
if(m_kart->getVelocityLC().getZ() < other_kart->getVelocityLC().getZ())
|
||||
continue;
|
||||
Vec3 other_kart_xyz = other_kart->getXYZ()
|
||||
Vec3 other_kart_xyz = other_kart->getXYZ()
|
||||
+ other_kart->getVelocity()*(i*dt);
|
||||
float kart_distance = (step_coord - other_kart_xyz).length_2d();
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "addons/addon.hpp"
|
||||
#include "config/stk_config.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
@ -733,28 +732,6 @@ void KartProperties::checkAllSet(const std::string &filename)
|
||||
m_ai_properties[i]->checkAllSet(filename);
|
||||
} // checkAllSet
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool KartProperties::operator<(const KartProperties &other) const
|
||||
{
|
||||
PlayerProfile *p = PlayerManager::getCurrentPlayer();
|
||||
bool this_is_locked = p->isLocked(getIdent());
|
||||
bool other_is_locked = p->isLocked(other.getIdent());
|
||||
if (this_is_locked == other_is_locked)
|
||||
{
|
||||
return getName() < other.getName();
|
||||
}
|
||||
else
|
||||
return other_is_locked;
|
||||
|
||||
return true;
|
||||
} // operator<
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool KartProperties::isInGroup(const std::string &group) const
|
||||
{
|
||||
return std::find(m_groups.begin(), m_groups.end(), group) != m_groups.end();
|
||||
} // isInGroups
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Called the first time a kart accelerates after 'ready-set-go'. It searches
|
||||
* through m_startup_times to find the appropriate slot, and returns the
|
||||
|
@ -387,8 +387,6 @@ public:
|
||||
void getAllData (const XMLNode * root);
|
||||
void checkAllSet (const std::string &filename);
|
||||
float getStartupBoost () const;
|
||||
bool isInGroup (const std::string &group) const;
|
||||
bool operator<(const KartProperties &other) const;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the (maximum) speed for a given turn radius.
|
||||
@ -433,9 +431,9 @@ public:
|
||||
/** Returns the name of this kart.
|
||||
\note Pass it through fridibi as needed, this is the LTR name
|
||||
*/
|
||||
core::stringw getName() const
|
||||
const wchar_t* getName() const
|
||||
{
|
||||
return core::stringw(translations->w_gettext(m_name.c_str()));
|
||||
return translations->w_gettext(m_name.c_str());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
59
src/main.cpp
59
src/main.cpp
@ -361,7 +361,7 @@ void gamepadVisualisation()
|
||||
} // gamepadVisualisation
|
||||
|
||||
// ============================================================================
|
||||
/** Sets the hat mesh name depending on the current christmas mode
|
||||
/** Sets the hat mesh name depending on the current christmas mode
|
||||
* m_xmas_mode (0: use current date, 1: always on, 2: always off).
|
||||
*/
|
||||
void handleXmasMode()
|
||||
@ -1375,6 +1375,13 @@ int main(int argc, char *argv[] )
|
||||
|
||||
/* Program closing...*/
|
||||
|
||||
if(user_config)
|
||||
{
|
||||
// In case that abort is triggered before user_config exists
|
||||
if (UserConfigParams::m_crashed) UserConfigParams::m_crashed = false;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WIIUSE
|
||||
if(wiimote_manager)
|
||||
delete wiimote_manager;
|
||||
@ -1426,15 +1433,27 @@ static void cleanSuperTuxKart()
|
||||
|
||||
delete main_loop;
|
||||
|
||||
irr_driver->updateConfigIfRelevant();
|
||||
|
||||
if(Online::RequestManager::isRunning())
|
||||
Online::RequestManager::get()->stopNetworkThread();
|
||||
|
||||
irr_driver->updateConfigIfRelevant();
|
||||
//delete in reverse order of what they were created in.
|
||||
//see InitTuxkart()
|
||||
Online::RequestManager::deallocate();
|
||||
Online::ServersManager::deallocate();
|
||||
Online::ProfileManager::destroy();
|
||||
GUIEngine::DialogQueue::deallocate();
|
||||
|
||||
AchievementsManager::destroy();
|
||||
Referee::cleanup();
|
||||
|
||||
if(ReplayPlay::get()) ReplayPlay::destroy();
|
||||
if(race_manager) delete race_manager;
|
||||
NewsManager::deallocate();
|
||||
if(addons_manager) delete addons_manager;
|
||||
NetworkManager::kill();
|
||||
|
||||
if(grand_prix_manager) delete grand_prix_manager;
|
||||
if(highscore_manager) delete highscore_manager;
|
||||
if(attachment_manager) delete attachment_manager;
|
||||
@ -1451,33 +1470,6 @@ static void cleanSuperTuxKart()
|
||||
delete ParticleKindManager::get();
|
||||
PlayerManager::destroy();
|
||||
if(unlock_manager) delete unlock_manager;
|
||||
Online::ProfileManager::destroy();
|
||||
GUIEngine::DialogQueue::deallocate();
|
||||
|
||||
// Now finish shutting down objects which a separate thread. The
|
||||
// RequestManager has been signaled to shut down as early as possible,
|
||||
// the NewsManager thread should have finished quite early on anyway.
|
||||
// But still give them some additional time to finish. It avoids a
|
||||
// race condition where a thread might access the file manager after it
|
||||
// was deleted (in cleanUserConfig below), but before STK finishes and
|
||||
// the os takes all threads down.
|
||||
|
||||
if(!NewsManager::get()->waitForReadyToDeleted(2.0f))
|
||||
{
|
||||
Log::info("Thread", "News manager not stopping, exiting anyway.");
|
||||
}
|
||||
NewsManager::deallocate();
|
||||
|
||||
if(!Online::RequestManager::get()->waitForReadyToDeleted(5.0f))
|
||||
{
|
||||
Log::info("Thread", "Request Manager not aborting in time, aborting.");
|
||||
}
|
||||
Online::RequestManager::deallocate();
|
||||
|
||||
// FIXME: do we need to wait for threads there, can they be
|
||||
// moved further up?
|
||||
Online::ServersManager::deallocate();
|
||||
NetworkManager::kill();
|
||||
|
||||
cleanUserConfig();
|
||||
|
||||
@ -1493,14 +1485,7 @@ static void cleanUserConfig()
|
||||
{
|
||||
if(stk_config) delete stk_config;
|
||||
if(translations) delete translations;
|
||||
if (user_config)
|
||||
{
|
||||
// In case that abort is triggered before user_config exists
|
||||
if (UserConfigParams::m_crashed) UserConfigParams::m_crashed = false;
|
||||
user_config->saveConfig();
|
||||
delete user_config;
|
||||
}
|
||||
|
||||
if(user_config) delete user_config;
|
||||
if(file_manager) delete file_manager;
|
||||
if(irr_driver) delete irr_driver;
|
||||
}
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "karts/rescue_animation.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
#include "states_screens/dialogs/select_challenge.hpp"
|
||||
#include "states_screens/offline_kart_selection.hpp"
|
||||
@ -55,6 +54,7 @@ OverWorld::~OverWorld()
|
||||
/** Function to simplify the start process */
|
||||
void OverWorld::enterOverWorld()
|
||||
{
|
||||
|
||||
race_manager->setNumLocalPlayers(1);
|
||||
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
|
||||
race_manager->setMinorMode (RaceManager::MINOR_MODE_OVERWORLD);
|
||||
@ -231,7 +231,6 @@ void OverWorld::onMouseClick(int x, int y)
|
||||
// be the location of the challenge bubble.
|
||||
AbstractKart* kart = getKart(0);
|
||||
kart->setXYZ(challenge->m_position);
|
||||
kart->getVehicle()->capSpeed(0);
|
||||
|
||||
unsigned int index = getRescuePositionIndex(kart);
|
||||
btTransform s = getRescueTransform(index);
|
||||
|
@ -235,9 +235,9 @@ void ProfileWorld::enterRaceOverState()
|
||||
min_t = std::min(min_t, kart->getFinishTime());
|
||||
av_t += kart->getFinishTime();
|
||||
std::ostringstream ss;
|
||||
ss << kart->getIdent() << " "
|
||||
ss << kart->getIdent() << " "
|
||||
<< kart->getController()->getControllerName() << " ";
|
||||
ss << 1+(int)i << " " << kart->getPosition() << " "
|
||||
ss << 1+(int)i << " " << kart->getPosition() << " "
|
||||
<< kart->getFinishTime() << " ";
|
||||
|
||||
all_groups.insert(kart->getController()->getControllerName());
|
||||
@ -269,7 +269,7 @@ void ProfileWorld::enterRaceOverState()
|
||||
|
||||
std::ostringstream ss;
|
||||
Log::verbose("profile", "");
|
||||
ss << "name" << std::setw(max_len-4) << " "
|
||||
ss << "name" << std::setw(max_len-4) << " "
|
||||
<< "Strt End Time AvSp Top Skid Resc Rsc Brake Expl Exp Itm Ban SNitLNit Bub Off";
|
||||
Log::verbose("profile", ss.str().c_str());
|
||||
for(std::set<std::string>::iterator it = all_groups.begin();
|
||||
@ -301,7 +301,7 @@ void ProfileWorld::enterRaceOverState()
|
||||
? race_manager->getNumLaps() : 1);
|
||||
distance *= m_track->getTrackLength();
|
||||
|
||||
Log::verbose("profile",
|
||||
Log::verbose("profile",
|
||||
"%s %4.2f %3.2f %6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d",
|
||||
ss.str().c_str(), distance/kart->getFinishTime(),
|
||||
kart->getTopSpeed(),
|
||||
|
@ -468,10 +468,10 @@ void ThreeStrikesBattle::getKartsDisplayInfo(
|
||||
break;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << m_kart_info[i].m_lives;
|
||||
char lives[4];
|
||||
sprintf(lives, "%i", m_kart_info[i].m_lives);
|
||||
|
||||
rank_info.m_text = oss.str().c_str();
|
||||
rank_info.m_text = lives;
|
||||
}
|
||||
} // getKartsDisplayInfo
|
||||
|
||||
|
@ -28,7 +28,7 @@ using namespace Online;
|
||||
/** Constructor. Stores the server id.
|
||||
* \param server_id Id of the server.
|
||||
*/
|
||||
RequestConnection::RequestConnection(uint32_t server_id)
|
||||
RequestConnection::RequestConnection(uint32_t server_id)
|
||||
: Protocol(NULL, PROTOCOL_SILENT)
|
||||
{
|
||||
m_server_id = server_id;
|
||||
@ -72,7 +72,7 @@ void RequestConnection::asynchronousUpdate()
|
||||
case NONE:
|
||||
{
|
||||
m_request = new ServerJoinRequest();
|
||||
PlayerManager::setUserDetails(m_request, "request-connection",
|
||||
PlayerManager::setUserDetails(m_request, "request-connection",
|
||||
"address-management.php");
|
||||
m_request->addParameter("server_id",m_server_id);
|
||||
m_request->queue();
|
||||
@ -95,7 +95,7 @@ void RequestConnection::asynchronousUpdate()
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::error("RequestConnection",
|
||||
Log::error("RequestConnection",
|
||||
"Fail to make a request to connecto to server %d",
|
||||
m_server_id);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ void ShowPublicAddress::asynchronousUpdate()
|
||||
{
|
||||
TransportAddress addr = NetworkManager::getInstance()->getPublicAddress();
|
||||
m_request = new Online::XMLRequest();
|
||||
PlayerManager::setUserDetails(m_request, "set",
|
||||
PlayerManager::setUserDetails(m_request, "set",
|
||||
"address-management.php");
|
||||
m_request->addParameter("address",addr.ip);
|
||||
m_request->addParameter("port",addr.port);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
StartGameProtocol::StartGameProtocol(GameSetup* game_setup)
|
||||
StartGameProtocol::StartGameProtocol(GameSetup* game_setup)
|
||||
: Protocol(NULL, PROTOCOL_START_GAME)
|
||||
{
|
||||
m_game_setup = game_setup;
|
||||
@ -105,7 +105,7 @@ void StartGameProtocol::update()
|
||||
// have to add self first
|
||||
for (unsigned int i = 0; i < players.size(); i++)
|
||||
{
|
||||
bool is_me = (players[i]->user_profile ==
|
||||
bool is_me = (players[i]->user_profile ==
|
||||
PlayerManager::getCurrentOnlineProfile());
|
||||
if (is_me)
|
||||
{
|
||||
@ -134,7 +134,7 @@ void StartGameProtocol::update()
|
||||
}
|
||||
for (unsigned int i = 0; i < players.size(); i++)
|
||||
{
|
||||
bool is_me = (players[i]->user_profile ==
|
||||
bool is_me = (players[i]->user_profile ==
|
||||
PlayerManager::getCurrentOnlineProfile());
|
||||
NetworkPlayerProfile* profile = players[i];
|
||||
RemoteKartInfo rki(profile->race_id, profile->kart_name,
|
||||
|
@ -322,8 +322,7 @@ namespace Online
|
||||
|
||||
// Check if we are asked to abort the download. If so, signal this
|
||||
// back to libcurl by returning a non-zero status.
|
||||
if( (request_manager->getAbort() || request->isCancelled()) &&
|
||||
request->isAbortable() )
|
||||
if(request_manager->getAbort() || request->isCancelled() )
|
||||
{
|
||||
// Indicates to abort the current download, which means that this
|
||||
// thread will go back to the mainloop and handle the next request.
|
||||
|
@ -116,7 +116,7 @@ namespace Online
|
||||
{
|
||||
// If the player changes the online account, there can be a
|
||||
// logout stil happening.
|
||||
assert(m_online_state == OS_SIGNED_OUT ||
|
||||
assert(m_online_state == OS_SIGNED_OUT ||
|
||||
m_online_state == OS_SIGNING_OUT );
|
||||
SignInRequest * request = new SignInRequest(false);
|
||||
// We can't use setUserDetail here, since there is no token yet
|
||||
@ -125,7 +125,7 @@ namespace Online
|
||||
request->addParameter("username",username);
|
||||
request->addParameter("password",password);
|
||||
request->addParameter("save-session",
|
||||
UserConfigParams::m_remember_user ? "true"
|
||||
UserConfigParams::m_remember_user ? "true"
|
||||
: "false");
|
||||
request->queue();
|
||||
m_online_state = OS_SIGNING_IN;
|
||||
@ -150,7 +150,7 @@ namespace Online
|
||||
{
|
||||
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
|
||||
if(player!=current &&
|
||||
player->hasSavedSession() &&
|
||||
player->hasSavedSession() &&
|
||||
player->getLastOnlineName() == current->getLastOnlineName())
|
||||
{
|
||||
player->clearSession();
|
||||
@ -209,7 +209,7 @@ namespace Online
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Requests a sign out from the server. If the user should be remembered,
|
||||
* a 'client-quit' request is sent (which will log the user out, but
|
||||
* a 'client-quit' request is sent (which will log the user out, but
|
||||
* remember the token), otherwise a 'disconnect' is sent.
|
||||
*/
|
||||
void OnlinePlayerProfile::requestSignOut()
|
||||
@ -237,10 +237,9 @@ namespace Online
|
||||
: XMLRequest(true,/*priority*/RequestManager::HTTP_MAX_PRIORITY)
|
||||
{
|
||||
m_player = player;
|
||||
m_player->setUserDetails(this,
|
||||
UserConfigParams::m_remember_user ? "client-quit"
|
||||
m_player->setUserDetails(this,
|
||||
UserConfigParams::m_remember_user ? "client-quit"
|
||||
:"disconnect");
|
||||
setAbortable(false);
|
||||
} // SignOutRequest
|
||||
}; // SignOutRequest
|
||||
// ----------------------------------------------------------------
|
||||
@ -251,7 +250,7 @@ namespace Online
|
||||
} // requestSignOut
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Callback once the logout event has been processed.
|
||||
/** Callback once the logout event has been processed.
|
||||
* \param success If the request was successful.
|
||||
* \param input
|
||||
*/
|
||||
@ -437,7 +436,7 @@ namespace Online
|
||||
// ------------------------------------------------------------------------
|
||||
/** \return the online id, or 0 if the user is not signed in.
|
||||
*/
|
||||
uint32_t OnlinePlayerProfile::getOnlineId() const
|
||||
uint32_t OnlinePlayerProfile::getOnlineId() const
|
||||
{
|
||||
if((m_online_state == OS_SIGNED_IN ))
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ namespace Online
|
||||
PlayerProfile::OnlineState m_online_state;
|
||||
|
||||
virtual void signIn(bool success, const XMLNode * input);
|
||||
virtual void signOut(bool success, const XMLNode * input,
|
||||
virtual void signOut(bool success, const XMLNode * input,
|
||||
const irr::core::stringw &info);
|
||||
virtual uint32_t getOnlineId() const;
|
||||
virtual void setUserDetails(Online::HTTPRequest *request,
|
||||
@ -83,7 +83,7 @@ namespace Online
|
||||
virtual void requestPoll() const;
|
||||
// ----------------------------------------------------------------
|
||||
/** Returns if this user is logged in. */
|
||||
virtual bool isLoggedIn() const
|
||||
virtual bool isLoggedIn() const
|
||||
{
|
||||
return m_online_state == PlayerProfile::OS_SIGNED_IN;
|
||||
} // isLoggedIn
|
||||
|
@ -44,7 +44,6 @@ namespace Online
|
||||
{
|
||||
m_cancel.setAtomic(false);
|
||||
m_state.setAtomic(S_PREPARING);
|
||||
m_is_abortable.setAtomic(true);
|
||||
} // Request
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -105,12 +105,6 @@ namespace Online
|
||||
|
||||
/** Cancel this request if it is active. */
|
||||
Synchronised<bool> m_cancel;
|
||||
|
||||
/** If this request can be aborted (at the end of STK). Most requests
|
||||
* can, except the (final) logout and client-quit/signout-request,
|
||||
* which must be finished even when STK is quitting. */
|
||||
Synchronised<bool> m_is_abortable;
|
||||
|
||||
/** Set to though if the reply of the request is in and callbacks are
|
||||
* executed */
|
||||
Synchronised<State> m_state;
|
||||
@ -162,12 +156,6 @@ namespace Online
|
||||
/** Returns if this request is to be canceled. */
|
||||
bool isCancelled() const { return m_cancel.getAtomic(); }
|
||||
// --------------------------------------------------------------------
|
||||
/** Returns if this request can be aborted. */
|
||||
bool isAbortable() const { return m_is_abortable.getAtomic(); }
|
||||
// --------------------------------------------------------------------
|
||||
/** Sets if this request is abortable or not. */
|
||||
void setAbortable(bool b) { m_is_abortable.setAtomic(b); }
|
||||
// --------------------------------------------------------------------
|
||||
/** Sets the request state to busy. */
|
||||
void setBusy()
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2010-2014 Lucas Baudin
|
||||
// 2011-2014 Joerg Henrichs
|
||||
// 2011-201 Joerg Henrichs
|
||||
// 2013-2014 Glenn De Jonghe
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@ -83,7 +83,7 @@ namespace Online
|
||||
pthread_cond_init(&m_cond_request, NULL);
|
||||
m_abort.setAtomic(false);
|
||||
m_time_since_poll = MENU_POLLING_INTERVAL * 0.9;
|
||||
} // RequestManager
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
RequestManager::~RequestManager()
|
||||
@ -94,7 +94,8 @@ namespace Online
|
||||
m_thread_id.unlock();
|
||||
pthread_cond_destroy(&m_cond_request);
|
||||
curl_global_cleanup();
|
||||
} // ~RequestManager
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Start the actual network thread. This can not be done as part of
|
||||
@ -103,7 +104,7 @@ namespace Online
|
||||
* use network_http - a very subtle race condition. So the thread can
|
||||
* only be started after the assignment (in main) has been done.
|
||||
* \pre PlayerManager was created and has read the main data for each
|
||||
* player so that all data for automatic login is
|
||||
* player so that all data for automatic login is
|
||||
* availale.
|
||||
*/
|
||||
void RequestManager::startNetworkThread()
|
||||
@ -128,10 +129,10 @@ namespace Online
|
||||
errno);
|
||||
}
|
||||
pthread_attr_destroy(&attr);
|
||||
// In case that login id was not saved (or first start of stk),
|
||||
// In case that login id was not saved (or first start of stk),
|
||||
// current player would not be defined at this stage.
|
||||
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||
if(player && player->wasOnlineLastTime() &&
|
||||
if(player && player->wasOnlineLastTime() &&
|
||||
!UserConfigParams::m_always_show_login_screen)
|
||||
{
|
||||
PlayerManager::resumeSavedSession();
|
||||
@ -146,27 +147,29 @@ namespace Online
|
||||
*/
|
||||
void RequestManager::stopNetworkThread()
|
||||
{
|
||||
// This will queue a sign-out or client-quit request
|
||||
// If a download should be active (which means it was cancelled by the
|
||||
// user, in which case it will still be ongoing in the background)
|
||||
// we can't get the mutex, and would have to wait for a timeout,
|
||||
// and we couldn't finish STK. This way we request an abort of
|
||||
// a download, which mean we can get the mutex and ask the service
|
||||
// thread here to cancel properly.
|
||||
//cancelAllDownloads(); FIXME if used this way it also cancels the client-quit action
|
||||
PlayerManager::onSTKQuit();
|
||||
|
||||
// Put in a high priortity quit request in. It has the same priority
|
||||
// as a sign-out request (so the sign-out will be executed before the
|
||||
// quit request).
|
||||
Request *quit = new Request(true, HTTP_MAX_PRIORITY, Request::RT_QUIT);
|
||||
quit->setAbortable(false);
|
||||
addRequest(quit);
|
||||
|
||||
// It is possible that downloads are still ongoing (either an addon
|
||||
// download that the user aborted, or the addon icons etc are still
|
||||
// queued). In order to allow a quick exit of stk we set a flag that
|
||||
// will cause libcurl to abort downloading asap, and then allow the
|
||||
// other requests (sign-out and quit) to be executed asap. Note that
|
||||
// the sign-out request is set to be not abortable, so it still will
|
||||
// be executed (before the quit request is executed, which causes this
|
||||
// thread to exit).
|
||||
m_abort.setAtomic(true);
|
||||
addRequest(new Request(true, HTTP_MAX_PRIORITY, Request::RT_QUIT));
|
||||
} // stopNetworkThread
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Signals to the progress function to request any ongoing download to be
|
||||
* cancelled. This function can also be called if there is actually no
|
||||
* download atm. The function progressDownload checks m_abort and will
|
||||
* return a non-zero value which causes libcurl to abort. */
|
||||
void RequestManager::cancelAllDownloads()
|
||||
{
|
||||
m_abort.setAtomic(true);
|
||||
// FIXME doesn't get called at the moment. When using this again,
|
||||
// be sure that HTTP_MAX_PRIORITY requests still get executed.
|
||||
} // cancelAllDownloads
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Inserts a request into the queue of all requests. The request will be
|
||||
* sorted by priority.
|
||||
@ -219,11 +222,6 @@ namespace Online
|
||||
me->m_request_queue.lock();
|
||||
} // while
|
||||
|
||||
// Signal that the request manager can now be deleted.
|
||||
// We signal this even before cleaning up memory, since there's no
|
||||
// need to keep the user waiting for STK to exit.
|
||||
me->setCanBeDeleted();
|
||||
|
||||
// At this stage we have the lock for m_request_queue
|
||||
while(!me->m_request_queue.getData().empty())
|
||||
{
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "io/xml_node.hpp"
|
||||
#include "online/request.hpp"
|
||||
#include "utils/can_be_deleted.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/synchronised.hpp"
|
||||
|
||||
@ -43,41 +42,11 @@
|
||||
namespace Online
|
||||
{
|
||||
|
||||
/** A class to execute requests in a separate thread. Typically the
|
||||
* requests involve a http(s) requests to be sent to the stk server, and
|
||||
* receive an answer (e.g. to sign in; or to download an addon). The
|
||||
* requests are sorted by priority (e.g. sign in and out have higher
|
||||
* priority than downloading addon icons).
|
||||
* A request is created and initialised from the main thread. When it
|
||||
* is moved into the request queue, it must not be handled by the main
|
||||
* thread anymore, only the RequestManager thread can handle it.
|
||||
* Once the request is finished, it is put in a separate ready queue.
|
||||
* The main thread regularly checks the ready queue for any ready
|
||||
* request, and executes a callback. So there is no need to protect
|
||||
* any functions or data members in requests, since they will either
|
||||
* be handled by the main thread, or RequestManager thread, never by
|
||||
* both.
|
||||
* On exit, if necessary a high priority sign-out or client-quit request
|
||||
* is put into the queue, and a flag is set which causes libcurl to
|
||||
* abort any ongoing download. Then an additional 'quit' event with
|
||||
* same priority as the sign-out is added to the queue (since it will
|
||||
* be added later, the sign-out will be executed first, making sure that
|
||||
* a logged in user is logged out (or its session saved). Once this is
|
||||
* done, most of stk is deleted (except a few objects like the file
|
||||
* manager which might be accessed if a download just finished before the
|
||||
* abort). On executing the quit request, the request manager will set
|
||||
* a flag that it is ready to be deleted (using the CanBeDeleted class).
|
||||
* The main thread will wait for a certain amount of time for the
|
||||
* RequestManager to be ready to be deleted (i.e. the sign-out and quit
|
||||
* request have been processes), before deleting the RequestManager.
|
||||
* Typically the RequestManager will finish while the rest of stk is
|
||||
* shutting down, so the user will not experience any waiting time. Only
|
||||
* on first start of stk (which will trigger downloading of all addon
|
||||
* icons) is it possible that actually a download request is running,
|
||||
* which might take a bit before it can be deleted.
|
||||
* \ingroup online
|
||||
*/
|
||||
class RequestManager : public CanBeDeleted
|
||||
/**
|
||||
* \brief Class to connect with a server over HTTP(S)
|
||||
* \ingroup online
|
||||
*/
|
||||
class RequestManager
|
||||
{
|
||||
public:
|
||||
/** If stk has permission to access the internet (for news
|
||||
@ -133,6 +102,7 @@ namespace Online
|
||||
static bool isRunning();
|
||||
|
||||
void addRequest(Online::Request *request);
|
||||
void cancelAllDownloads();
|
||||
void startNetworkThread();
|
||||
void stopNetworkThread();
|
||||
|
||||
|
@ -975,11 +975,8 @@ void btKart::capSpeed(float max_speed)
|
||||
{
|
||||
const btVector3 &velocity = m_chassisBody->getLinearVelocity();
|
||||
float speed = velocity.length();
|
||||
if(speed!=0)
|
||||
{
|
||||
const float velocity_ratio = max_speed / speed;
|
||||
m_chassisBody->setLinearVelocity(velocity * velocity_ratio);
|
||||
}
|
||||
const float velocity_ratio = max_speed/speed;
|
||||
m_chassisBody->setLinearVelocity( velocity * velocity_ratio);
|
||||
} // capSpeed
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -365,7 +365,7 @@ void GrandPrixData::addTrack(Track* track, unsigned int laps, bool reverse,
|
||||
int n = getNumberOfTracks(true);
|
||||
assert (track != NULL);
|
||||
assert (laps > 0);
|
||||
assert (-1 <= position && position < n);
|
||||
assert (-1 < position && position < n);
|
||||
|
||||
if (position < 0 || position == (n - 1) || m_tracks.empty())
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ using namespace Online;
|
||||
|
||||
/** Creates a modal dialog with given percentage of screen width and height
|
||||
*/
|
||||
ChangePasswordDialog::ChangePasswordDialog()
|
||||
ChangePasswordDialog::ChangePasswordDialog()
|
||||
: ModalDialog(0.8f,0.7f)
|
||||
{
|
||||
m_self_destroy = false;
|
||||
@ -157,13 +157,13 @@ void ChangePasswordDialog::submit()
|
||||
} // submit
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
GUIEngine::EventPropagation
|
||||
GUIEngine::EventPropagation
|
||||
ChangePasswordDialog::processEvent(const std::string& eventSource)
|
||||
{
|
||||
|
||||
if (eventSource == m_options_widget->m_properties[PROP_ID])
|
||||
{
|
||||
const std::string& selection =
|
||||
const std::string& selection =
|
||||
m_options_widget->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
if (selection == m_cancel_widget->m_properties[PROP_ID])
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ void UserInfoDialog::removeExistingFriend()
|
||||
else
|
||||
info_text = getInfo();
|
||||
|
||||
UserInfoDialog *info = new UserInfoDialog(m_id, info_text,
|
||||
UserInfoDialog *info = new UserInfoDialog(m_id, info_text,
|
||||
!isSuccess(), true);
|
||||
GUIEngine::DialogQueue::get()->pushDialog(info, true);
|
||||
|
||||
|
@ -143,7 +143,7 @@ GUIEngine::EventPropagation VoteDialog::processEvent(const std::string& event)
|
||||
|
||||
if (event == m_options_widget->m_properties[PROP_ID])
|
||||
{
|
||||
const std::string& selection =
|
||||
const std::string& selection =
|
||||
m_options_widget->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
if (selection == m_cancel_widget->m_properties[PROP_ID])
|
||||
{
|
||||
@ -164,7 +164,7 @@ void VoteDialog::updateFetchVote()
|
||||
if (!m_fetch_vote_request->isDone())
|
||||
{
|
||||
// request still pending
|
||||
m_info_widget->setText(irr::core::stringw(_("Fetching last vote"))
|
||||
m_info_widget->setText(irr::core::stringw(_("Fetching last vote"))
|
||||
+ Messages::loadingDots(), false);
|
||||
return;
|
||||
} // !isDone
|
||||
@ -236,7 +236,7 @@ void VoteDialog::onUpdate(float dt)
|
||||
} // isDone
|
||||
else
|
||||
{
|
||||
m_info_widget->setText(irr::core::stringw(_("Performing vote"))
|
||||
m_info_widget->setText(irr::core::stringw(_("Performing vote"))
|
||||
+ Messages::loadingDots(), false);
|
||||
} // !isDone
|
||||
}
|
||||
|
@ -184,16 +184,12 @@ void EditTrackScreen::loadTrackList()
|
||||
{
|
||||
Track* t = track_manager->getTrack(i);
|
||||
const std::vector<std::string>& groups = t->getGroups();
|
||||
belongsToGroup = (m_track_group.empty() ||
|
||||
m_track_group == ALL_TRACKS_GROUP_ID ||
|
||||
t->isInGroup(m_track_group) );
|
||||
if (!t->isArena() && !t->isSoccer() &&
|
||||
!t->isInternal() && belongsToGroup )
|
||||
belongsToGroup = (m_track_group.empty() || m_track_group == ALL_TRACKS_GROUP_ID ||
|
||||
std::find(groups.begin(), groups.end(), m_track_group) != groups.end());
|
||||
if (!t->isArena() && !t->isSoccer() && !t->isInternal() && belongsToGroup)
|
||||
{
|
||||
tracks_widget->addItem(translations->fribidize(t->getName()),
|
||||
t->getIdent(),
|
||||
t->getScreenshotFile(), 0,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
tracks_widget->addItem(translations->fribidize(t->getName()), t->getIdent(),
|
||||
t->getScreenshotFile(), 0, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/cutscene_world.hpp"
|
||||
#include "modes/overworld.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/grand_prix_manager.hpp"
|
||||
@ -51,10 +50,6 @@ using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace irr::video;
|
||||
|
||||
const float ANIM_FROM = 3.0f;
|
||||
const float ANIM_TO = 7.0f;
|
||||
const int GIFT_EXIT_FROM = (int)ANIM_TO;
|
||||
const int GIFT_EXIT_TO = GIFT_EXIT_FROM + 7;
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( FeatureUnlockedCutScene );
|
||||
|
||||
@ -71,7 +66,6 @@ FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(std::string model,
|
||||
m_unlock_message = msg;
|
||||
m_unlock_model = model;
|
||||
m_curr_image = -1;
|
||||
m_scale = 1.0f;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
@ -83,7 +77,6 @@ FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(KartProperties* kart,
|
||||
m_unlocked_kart = kart;
|
||||
m_unlock_message = msg;
|
||||
m_curr_image = -1;
|
||||
m_scale = 1.0f;
|
||||
} // UnlockedThing::UnlockedThing
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
@ -98,7 +91,6 @@ FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(irr::video::ITexture* pict
|
||||
m_h = h;
|
||||
m_unlock_message = msg;
|
||||
m_curr_image = -1;
|
||||
m_scale = 1.0f;
|
||||
} // UnlockedThing::UnlockedThing
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -113,7 +105,6 @@ FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(std::vector<irr::video::IT
|
||||
m_h = h;
|
||||
m_unlock_message = msg;
|
||||
m_curr_image = 0;
|
||||
m_scale = 1.0f;
|
||||
} // UnlockedThing::UnlockedThing
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -132,10 +123,12 @@ FeatureUnlockedCutScene::UnlockedThing::~UnlockedThing()
|
||||
#endif
|
||||
|
||||
FeatureUnlockedCutScene::FeatureUnlockedCutScene()
|
||||
: CutsceneScreen("feature_unlocked.stkgui")
|
||||
: Screen("feature_unlocked.stkgui")
|
||||
{
|
||||
m_key_angle = 0;
|
||||
setNeeds3D(true);
|
||||
|
||||
m_throttle_FPS = false;
|
||||
#ifdef USE_IRRLICHT_BUG_WORKAROUND
|
||||
m_avoid_irrlicht_bug = NULL;
|
||||
#endif
|
||||
@ -147,23 +140,6 @@ void FeatureUnlockedCutScene::loadedFromFile()
|
||||
{
|
||||
} // loadedFromFile
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void FeatureUnlockedCutScene::onCutsceneEnd()
|
||||
{
|
||||
#ifdef USE_IRRLICHT_BUG_WORKAROUND
|
||||
if (m_avoid_irrlicht_bug)
|
||||
irr_driver->removeNode(m_avoid_irrlicht_bug);
|
||||
m_avoid_irrlicht_bug = NULL;
|
||||
#endif
|
||||
|
||||
m_unlocked_stuff.clearAndDeleteAll();
|
||||
m_all_kart_models.clearAndDeleteAll();
|
||||
|
||||
// update point count and the list of locked/unlocked stuff
|
||||
PlayerManager::getCurrentPlayer()->computeActive();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void FeatureUnlockedCutScene::findWhatWasUnlocked(RaceManager::Difficulty difficulty)
|
||||
@ -272,10 +248,71 @@ void FeatureUnlockedCutScene::addUnlockedPictures(std::vector<irr::video::ITextu
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const float CAMERA_INITIAL_X = 0.0f;
|
||||
const float CAMERA_INITIAL_Y = 30.0f;
|
||||
const float CAMERA_INITIAL_Z = 70.0f;
|
||||
|
||||
void FeatureUnlockedCutScene::init()
|
||||
{
|
||||
m_sky_angle = 0.0f;
|
||||
m_global_time = 0.0f;
|
||||
|
||||
std::vector<std::string> texture_names(6);
|
||||
texture_names[0] = file_manager->getAsset(FileManager::TEXTURE, "purplenebula.jpg");
|
||||
texture_names[1] = file_manager->getAsset(FileManager::TEXTURE, "purplenebula2.png");
|
||||
texture_names[2] = file_manager->getAsset(FileManager::TEXTURE, "purplenebula.jpg");
|
||||
texture_names[3] = file_manager->getAsset(FileManager::TEXTURE, "purplenebula2.png");
|
||||
texture_names[4] = file_manager->getAsset(FileManager::TEXTURE, "purplenebula.jpg");
|
||||
texture_names[5] = file_manager->getAsset(FileManager::TEXTURE, "purplenebula2.png");
|
||||
std::vector<video::ITexture*> textures;
|
||||
for(unsigned int i=0; i<texture_names.size(); i++)
|
||||
{
|
||||
video::ITexture *t = irr_driver->getTexture(texture_names[i]);
|
||||
textures.push_back(t);
|
||||
}
|
||||
std::vector<video::ITexture*> sh_textures;
|
||||
m_sky = irr_driver->addSkyBox(textures, sh_textures);
|
||||
#ifdef DEBUG
|
||||
m_sky->setName("skybox");
|
||||
#endif
|
||||
|
||||
m_camera = irr_driver->addCameraSceneNode();
|
||||
#ifdef DEBUG
|
||||
m_camera->setName("camera");
|
||||
#endif
|
||||
m_camera->setPosition( core::vector3df(CAMERA_INITIAL_X, CAMERA_INITIAL_Y, CAMERA_INITIAL_Z) );
|
||||
m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) );
|
||||
m_camera->setTarget( core::vector3df(0, 10, 0.0f) );
|
||||
m_camera->setFOV( DEGREE_TO_RAD*50.0f );
|
||||
m_camera->updateAbsolutePosition();
|
||||
irr_driver->getSceneManager()->setActiveCamera(m_camera);
|
||||
|
||||
scene::IAnimatedMesh* model_chest =
|
||||
irr_driver->getAnimatedMesh( file_manager->getAsset(FileManager::MODEL,"chest.b3d") );
|
||||
assert(model_chest != NULL);
|
||||
m_chest = irr_driver->addAnimatedMesh(model_chest);
|
||||
#ifdef DEBUG
|
||||
m_chest->setName("chest");
|
||||
#endif
|
||||
m_chest->setPosition( core::vector3df(2, -3, 0) );
|
||||
m_chest->setScale( core::vector3df(10.0f, 10.0f, 10.0f) );
|
||||
m_chest->setMaterialFlag(video::EMF_FOG_ENABLE, false);
|
||||
|
||||
irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 120,
|
||||
120, 120));
|
||||
|
||||
const core::vector3df &sun_pos = core::vector3df( 0, 200, 100.0f );
|
||||
m_light = irr_driver->addLight(sun_pos, 10000.0f, 1., 1, 1, 1, true);
|
||||
#ifdef DEBUG
|
||||
m_light->setName("light");
|
||||
#endif
|
||||
|
||||
if (!irr_driver->isGLSL())
|
||||
{
|
||||
((scene::ILightSceneNode *) m_light)->getLightData().DiffuseColor = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
((scene::ILightSceneNode *) m_light)->getLightData().SpecularColor = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
const int unlockedStuffCount = m_unlocked_stuff.size();
|
||||
|
||||
if (unlockedStuffCount == 0) std::cerr << "There is nothing in the unlock chest!!!\n";
|
||||
@ -286,8 +323,7 @@ void FeatureUnlockedCutScene::init()
|
||||
if (m_unlocked_stuff[n].m_unlock_model.size() > 0)
|
||||
{
|
||||
m_unlocked_stuff[n].m_root_gift_node = irr_driver->addMesh( irr_driver->getMesh(m_unlocked_stuff[n].m_unlock_model) );
|
||||
m_unlocked_stuff[n].m_scale = 0.7f;
|
||||
//m_unlocked_stuff[n].m_root_gift_node->setScale(core::vector3df(0.2f, 0.2f, 0.2f));
|
||||
m_unlocked_stuff[n].m_root_gift_node->setScale( core::vector3df(0.5f, 0.5f, 0.5f) );
|
||||
}
|
||||
else if (m_unlocked_stuff[n].m_unlocked_kart != NULL)
|
||||
{
|
||||
@ -295,7 +331,6 @@ void FeatureUnlockedCutScene::init()
|
||||
m_unlocked_stuff[n].m_unlocked_kart->getKartModelCopy();
|
||||
m_all_kart_models.push_back(kart_model);
|
||||
m_unlocked_stuff[n].m_root_gift_node = kart_model->attachModel(true, false);
|
||||
m_unlocked_stuff[n].m_scale = 5.0f;
|
||||
kart_model->setAnimation(KartModel::AF_DEFAULT);
|
||||
float susp[4]={0,0,0,0};
|
||||
kart_model->update(0.0f, 0.0f, 0.0f, susp, 0.0f);
|
||||
@ -328,6 +363,7 @@ void FeatureUnlockedCutScene::init()
|
||||
m.SpecularColor = video::SColor(255, 255, 255, 255);
|
||||
m.GouraudShading = false;
|
||||
m.Shininess = 0;
|
||||
//m.setFlag(video::EMF_TEXTURE_WRAP, false);
|
||||
|
||||
m.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
|
||||
m.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
|
||||
@ -353,7 +389,29 @@ void FeatureUnlockedCutScene::init()
|
||||
void FeatureUnlockedCutScene::tearDown()
|
||||
{
|
||||
Screen::tearDown();
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
irr_driver->removeNode(m_sky);
|
||||
m_sky = NULL;
|
||||
|
||||
irr_driver->removeCameraSceneNode(m_camera);
|
||||
m_camera = NULL;
|
||||
|
||||
irr_driver->removeNode(m_chest);
|
||||
m_chest = NULL;
|
||||
|
||||
irr_driver->removeNode(m_light);
|
||||
m_light = NULL;
|
||||
|
||||
#ifdef USE_IRRLICHT_BUG_WORKAROUND
|
||||
if(m_avoid_irrlicht_bug)
|
||||
irr_driver->removeNode(m_avoid_irrlicht_bug);
|
||||
m_avoid_irrlicht_bug = NULL;
|
||||
#endif
|
||||
|
||||
m_unlocked_stuff.clearAndDeleteAll();
|
||||
m_all_kart_models.clearAndDeleteAll();
|
||||
|
||||
// update point count and the list of locked/unlocked stuff
|
||||
PlayerManager::getCurrentPlayer()->computeActive();
|
||||
} // tearDown
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -369,31 +427,62 @@ T keepInRange(T from, T to, T value)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const float ANIM_FROM = 1.0f;
|
||||
const float ANIM_TO = 3.0f;
|
||||
const int GIFT_EXIT_FROM = (int)ANIM_TO;
|
||||
const int GIFT_EXIT_TO = GIFT_EXIT_FROM + 7;
|
||||
|
||||
void FeatureUnlockedCutScene::onUpdate(float dt)
|
||||
{
|
||||
m_global_time += dt;
|
||||
|
||||
m_sky_angle += dt*2;
|
||||
if (m_sky_angle > 360) m_sky_angle -= 360;
|
||||
m_sky->setRotation( core::vector3df(0, m_sky_angle, 0) );
|
||||
|
||||
const int last_image = m_chest->getEndFrame() - 1;
|
||||
|
||||
if (m_global_time < ANIM_FROM)
|
||||
{
|
||||
// progression of the chest rotation between 0 and 1
|
||||
const float rotationProgression =
|
||||
keepInRange( 0.0f, 1.0f, (float)sin(M_PI/2.0f*m_global_time/ANIM_FROM) );
|
||||
const float chest_rotation =
|
||||
keepInRange(80.0f, 160.0f, 80 + rotationProgression * 80);
|
||||
m_chest->setRotation( core::vector3df(0.0f, chest_rotation, 0.0f) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_chest->setRotation( core::vector3df(0.0f, 160.0f, 0.0f) );
|
||||
}
|
||||
|
||||
|
||||
// Make sure it doesn't continue on its own, WE animated it ourselves here
|
||||
m_chest->setAnimationSpeed(0);
|
||||
|
||||
const float current_frame = keepInRange(0.0f, (float)last_image,
|
||||
(float)(m_global_time - ANIM_FROM)
|
||||
/(ANIM_TO - ANIM_FROM) * last_image);
|
||||
m_chest->setCurrentFrame( current_frame );
|
||||
|
||||
const int unlockedStuffCount = m_unlocked_stuff.size();
|
||||
|
||||
if (m_global_time > GIFT_EXIT_FROM && m_global_time < GIFT_EXIT_TO)
|
||||
{
|
||||
float progress_factor = (m_global_time - GIFT_EXIT_FROM) / (GIFT_EXIT_TO - GIFT_EXIT_FROM);
|
||||
float smoothed_progress_factor = sin((progress_factor - 0.5f)*M_PI)/2.0f + 0.5f;
|
||||
|
||||
Log::info("smoothed_progress_factor", "%f", smoothed_progress_factor);
|
||||
|
||||
for (int n=0; n<unlockedStuffCount; n++)
|
||||
{
|
||||
if (m_unlocked_stuff[n].m_root_gift_node == NULL) continue;
|
||||
|
||||
core::vector3df pos = m_unlocked_stuff[n].m_root_gift_node->getPosition();
|
||||
pos.Y = sin(smoothed_progress_factor*2.5f)*10.0f;
|
||||
pos.Y = sin( (float)((m_global_time-GIFT_EXIT_FROM)*M_PI*1.2/GIFT_EXIT_TO) )*30.0f;
|
||||
|
||||
// when there are more than 1 unlocked items, make sure they each
|
||||
// have their own path when they move
|
||||
if (unlockedStuffCount > 1)
|
||||
{
|
||||
if (n == 1) pos.X -= 1.0f*dt*float( int((n + 1)/2) );
|
||||
else if (n > 1) pos.X += 1.0f*dt*(n - 0.3f);
|
||||
if (n == 1) pos.X -= 6.2f*dt*float( int((n + 1)/2) );
|
||||
else if (n > 1) pos.X += 6.2f*dt*(n - 1.0f);
|
||||
|
||||
//else pos.X += 6.2f*dt*float( int((n + 1)/2) );
|
||||
//std::cout << "Object " << n << " moving by " <<
|
||||
@ -404,15 +493,30 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
|
||||
//pos.X -= 2.0f*dt;
|
||||
}
|
||||
|
||||
//if (m_global_time > GIFT_EXIT_FROM + 2.0f) pos.Z -= 2.0f*dt;
|
||||
|
||||
pos.Z = smoothed_progress_factor * -4.0f;
|
||||
if (m_global_time > GIFT_EXIT_FROM + 2.0f) pos.Z += 6.0f*dt;
|
||||
|
||||
m_unlocked_stuff[n].m_root_gift_node->setPosition(pos);
|
||||
|
||||
core::vector3df scale =
|
||||
m_unlocked_stuff[n].m_root_gift_node->getScale();
|
||||
scale.X += 0.9f*dt;
|
||||
scale.Y += 0.9f*dt;
|
||||
scale.Z += 0.9f*dt;
|
||||
m_unlocked_stuff[n].m_root_gift_node->setScale(scale);
|
||||
}
|
||||
|
||||
core::vector3df campos = m_camera->getPosition();
|
||||
campos.X -= 8.0f*dt;
|
||||
campos.Y += 5.0f*dt;
|
||||
campos.Z += 5.0f*dt;
|
||||
|
||||
m_camera->setPosition(campos);
|
||||
}
|
||||
else if (m_global_time < GIFT_EXIT_FROM)
|
||||
{
|
||||
m_camera->setPosition( core::vector3df(cos((1.0f-m_key_angle)*M_PI/4 + M_PI/4)*70.0f,
|
||||
30.0f,
|
||||
sin((1.0f-m_key_angle)*M_PI/8 + M_PI/4)*70.0f) );
|
||||
}
|
||||
|
||||
for (int n=0; n<unlockedStuffCount; n++)
|
||||
@ -450,16 +554,20 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
|
||||
} // textureID != previousTextureID
|
||||
} // if pictureCount>1
|
||||
} // if !m_unlocked_stuff[n].m_pictures.empty()
|
||||
|
||||
float scale = m_unlocked_stuff[n].m_scale;
|
||||
if (m_global_time <= GIFT_EXIT_FROM)
|
||||
scale *= 0.1f;
|
||||
else if (m_global_time > GIFT_EXIT_FROM && m_global_time < GIFT_EXIT_TO)
|
||||
scale *= ((m_global_time - GIFT_EXIT_FROM) / (GIFT_EXIT_TO - GIFT_EXIT_FROM));
|
||||
m_unlocked_stuff[n].m_root_gift_node->setScale(core::vector3df(scale, scale, scale));
|
||||
} // for n<unlockedStuffCount
|
||||
|
||||
assert(m_unlocked_stuff.size() > 0);
|
||||
if (m_unlocked_stuff[0].m_root_gift_node != NULL)
|
||||
{
|
||||
m_camera->setTarget( m_unlocked_stuff[0].m_root_gift_node->getPosition() +
|
||||
core::vector3df(0.0f, 10.0f, 0.0f) );
|
||||
m_camera->updateAbsolutePosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_camera->setTarget( core::vector3df(0, 10, 0.0f) );
|
||||
m_camera->updateAbsolutePosition();
|
||||
}
|
||||
|
||||
static const int w = irr_driver->getFrameSize().Width;
|
||||
static const int h = irr_driver->getFrameSize().Height;
|
||||
@ -546,7 +654,6 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
|
||||
|
||||
bool FeatureUnlockedCutScene::onEscapePressed()
|
||||
{
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
continueButtonPressed();
|
||||
return false; // continueButtonPressed already pop'ed the menu
|
||||
} // onEscapePressed
|
||||
|
@ -36,7 +36,7 @@ class ChallengeData;
|
||||
* \brief Screen shown when a feature has been unlocked
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngine::ScreenSingleton<FeatureUnlockedCutScene>
|
||||
class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<FeatureUnlockedCutScene>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<FeatureUnlockedCutScene>;
|
||||
|
||||
@ -60,8 +60,6 @@ class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngi
|
||||
/** Contains whatever is in the chest */
|
||||
scene::ISceneNode* m_root_gift_node;
|
||||
|
||||
float m_scale;
|
||||
|
||||
irr::core::stringw m_unlock_message;
|
||||
|
||||
UnlockedThing(std::string model, irr::core::stringw msg);
|
||||
@ -93,6 +91,9 @@ class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngi
|
||||
/** To store the copy of the KartModel for each unlocked kart. */
|
||||
PtrVector<KartModel> m_all_kart_models;
|
||||
|
||||
/** sky angle, 0-360 */
|
||||
float m_sky_angle;
|
||||
|
||||
/** Global evolution of time */
|
||||
double m_global_time;
|
||||
|
||||
@ -102,6 +103,20 @@ class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngi
|
||||
/** Angle of the key (from 0 to 1, simply traces progression) */
|
||||
float m_key_angle;
|
||||
|
||||
/** The scene node for the sky box. */
|
||||
irr::scene::ISceneNode *m_sky;
|
||||
|
||||
/** The scene node for the camera. */
|
||||
irr::scene::ICameraSceneNode *m_camera;
|
||||
|
||||
/** The scene node for the animated mesh. */
|
||||
irr::scene::IAnimatedMeshSceneNode *m_chest;
|
||||
|
||||
/** The scene node for the light. */
|
||||
irr::scene::ISceneNode* m_light;
|
||||
|
||||
//#define USE_IRRLICHT_BUG_WORKAROUND
|
||||
|
||||
#ifdef USE_IRRLICHT_BUG_WORKAROUND
|
||||
scene::IMeshSceneNode *m_avoid_irrlicht_bug;
|
||||
#endif
|
||||
@ -110,8 +125,6 @@ class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngi
|
||||
|
||||
public:
|
||||
|
||||
virtual void onCutsceneEnd() OVERRIDE;
|
||||
|
||||
/** \brief implement optional callback from parent class GUIEngine::Screen */
|
||||
void onUpdate(float dt) OVERRIDE;
|
||||
|
||||
|
@ -320,16 +320,9 @@ PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
|
||||
m_kartInternalName = props->getIdent();
|
||||
|
||||
const KartModel &kart_model = props->getMasterKartModel();
|
||||
|
||||
float scale = 35.0f;
|
||||
if (kart_model.getLength() > 1.45f)
|
||||
{
|
||||
// if kart is too long, size it down a bit so that it fits
|
||||
scale = 30.0f;
|
||||
}
|
||||
|
||||
m_model_view->addModel( kart_model.getModel(), Vec3(0,0,0),
|
||||
Vec3(scale, scale, scale),
|
||||
Vec3(35.0f, 35.0f, 35.0f),
|
||||
kart_model.getBaseFrame() );
|
||||
m_model_view->addModel( kart_model.getWheelModel(0),
|
||||
kart_model.getWheelGraphicsPosition(0) );
|
||||
@ -682,9 +675,10 @@ void PlayerKartWidget::onUpdate(float delta)
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
/** Event callback */
|
||||
GUIEngine::EventPropagation PlayerKartWidget::transmitEvent(Widget* w,
|
||||
const std::string& originator,
|
||||
const int m_player_id )
|
||||
GUIEngine::EventPropagation PlayerKartWidget::transmitEvent(
|
||||
Widget* w,
|
||||
const std::string& originator,
|
||||
const int m_player_id)
|
||||
{
|
||||
assert(m_magic_number == 0x33445566);
|
||||
// if it's declared ready, there is really nothing to process
|
||||
@ -1056,7 +1050,7 @@ void KartSelectionScreen::tearDown()
|
||||
m_kart_widgets.clearAndDeleteAll();
|
||||
|
||||
if (m_must_delete_on_back)
|
||||
GUIEngine::removeScreen(getName().c_str());
|
||||
GUIEngine::removeScreen(this->getName().c_str());
|
||||
} // tearDown
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1468,7 +1462,6 @@ void KartSelectionScreen::updateKartWidgetModel(uint8_t widget_id,
|
||||
// Random kart
|
||||
scene::IMesh* model =
|
||||
ItemManager::getItemModel(Item::ITEM_BONUS_BOX);
|
||||
|
||||
w3->clearModels();
|
||||
w3->addModel( model, Vec3(0.0f, -12.0f, 0.0f),
|
||||
Vec3(35.0f, 35.0f, 35.0f) );
|
||||
@ -1505,16 +1498,9 @@ void KartSelectionScreen::updateKartWidgetModel(uint8_t widget_id,
|
||||
{
|
||||
const KartModel &kart_model = kp->getMasterKartModel();
|
||||
|
||||
float scale = 35.0f;
|
||||
if (kart_model.getLength() > 1.45f)
|
||||
{
|
||||
// if kart is too long, size it down a bit so that it fits
|
||||
scale = 30.0f;
|
||||
}
|
||||
|
||||
w3->clearModels();
|
||||
w3->addModel( kart_model.getModel(), Vec3(0,0,0),
|
||||
Vec3(scale, scale, scale),
|
||||
Vec3(35.0f, 35.0f, 35.0f),
|
||||
kart_model.getBaseFrame() );
|
||||
w3->addModel( kart_model.getWheelModel(0),
|
||||
kart_model.getWheelGraphicsPosition(0) );
|
||||
@ -1556,7 +1542,7 @@ void KartSelectionScreen::eventCallback(Widget* widget,
|
||||
|
||||
setKartsFromCurrentGroup();
|
||||
|
||||
const std::string &selected_kart_group =
|
||||
const std::string selected_kart_group =
|
||||
tabs->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
UserConfigParams::m_last_used_kart_group = selected_kart_group;
|
||||
@ -2006,7 +1992,7 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
|
||||
// selected kart group is removed. In this case, select the
|
||||
// 'standard' group
|
||||
if (selected_kart_group != ALL_KART_GROUPS_ID &&
|
||||
!kart_properties_manager->getKartsInGroup(selected_kart_group).size())
|
||||
!kart_properties_manager->getKartsInGroup(selected_kart_group).size())
|
||||
{
|
||||
selected_kart_group = DEFAULT_GROUP_NAME;
|
||||
}
|
||||
@ -2014,43 +2000,69 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
|
||||
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
|
||||
w->clearItems();
|
||||
|
||||
int usable_kart_count = 0;
|
||||
PtrVector<const KartProperties, REF> karts;
|
||||
int usableKartCount = 0;
|
||||
|
||||
for(unsigned int i=0; i<kart_properties_manager->getNumberOfKarts(); i++)
|
||||
if (selected_kart_group == ALL_KART_GROUPS_ID)
|
||||
{
|
||||
const KartProperties* prop = kart_properties_manager->getKartById(i);
|
||||
// Ignore karts that are not in the selected group
|
||||
if(selected_kart_group != ALL_KART_GROUPS_ID &&
|
||||
!prop->isInGroup(selected_kart_group))
|
||||
continue;
|
||||
karts.push_back(prop);
|
||||
}
|
||||
karts.insertionSort();
|
||||
const int kart_amount = kart_properties_manager->getNumberOfKarts();
|
||||
|
||||
for(unsigned int i=0; i<karts.size(); i++)
|
||||
{
|
||||
const KartProperties* prop = karts.get(i);
|
||||
if (PlayerManager::getCurrentPlayer()->isLocked(prop->getIdent()))
|
||||
for (int n=0; n<kart_amount; n++)
|
||||
{
|
||||
w->addItem(_("Locked : solve active challenges to gain access "
|
||||
"to more!"),
|
||||
ID_LOCKED + prop->getIdent(),
|
||||
prop->getAbsoluteIconFile(), LOCKED_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
const KartProperties* prop =
|
||||
kart_properties_manager->getKartById(n);
|
||||
if (PlayerManager::getCurrentPlayer()->isLocked(prop->getIdent()))
|
||||
{
|
||||
w->addItem(
|
||||
_("Locked : solve active challenges to gain access "
|
||||
"to more!"),
|
||||
ID_LOCKED+prop->getIdent(),
|
||||
prop->getAbsoluteIconFile(), LOCKED_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
}
|
||||
else
|
||||
{
|
||||
w->addItem(translations->fribidize(prop->getName()),
|
||||
prop->getIdent(),
|
||||
prop->getAbsoluteIconFile(), 0,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
usableKartCount++;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else if (selected_kart_group != RibbonWidget::NO_ITEM_ID)
|
||||
{
|
||||
std::vector<int> group =
|
||||
kart_properties_manager->getKartsInGroup(selected_kart_group);
|
||||
const int kart_amount = group.size();
|
||||
|
||||
|
||||
for (int n=0; n<kart_amount; n++)
|
||||
{
|
||||
w->addItem(translations->fribidize(prop->getName()),
|
||||
prop->getIdent(),
|
||||
prop->getAbsoluteIconFile(), 0,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
usable_kart_count++;
|
||||
const KartProperties* prop =
|
||||
kart_properties_manager->getKartById(group[n]);
|
||||
const std::string &icon_path = prop->getAbsoluteIconFile();
|
||||
|
||||
if (PlayerManager::getCurrentPlayer()->isLocked(prop->getIdent()))
|
||||
{
|
||||
w->addItem(
|
||||
_("Locked : solve active challenges to gain access "
|
||||
"to more!"),
|
||||
ID_LOCKED+prop->getIdent(), icon_path, LOCKED_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
}
|
||||
else
|
||||
{
|
||||
w->addItem(translations->fribidize(prop->getName()),
|
||||
prop->getIdent(),
|
||||
icon_path, 0,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
usableKartCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add random
|
||||
if (usable_kart_count > 1)
|
||||
if (usableKartCount > 1)
|
||||
{
|
||||
w->addItem(_("Random Kart"), RANDOM_KART_ID, "/gui/random_kart.png");
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ void OnlineScreen::init()
|
||||
Screen::init();
|
||||
setInitialFocus();
|
||||
DemoWorld::resetIdleTime();
|
||||
core::stringw m = _("Signed in as: %s.",
|
||||
core::stringw m = _("Signed in as: %s.",
|
||||
PlayerManager::getCurrentOnlineUserName());
|
||||
m_online_status_widget->setText(m, false);
|
||||
} // init
|
||||
@ -198,7 +198,7 @@ void OnlineScreen::doQuickPlay()
|
||||
{
|
||||
delete request2;
|
||||
StateManager::get()->pushScreen(NetworkingLobby::getInstance());
|
||||
ConnectToServer *cts = new ConnectToServer(server->getServerId(),
|
||||
ConnectToServer *cts = new ConnectToServer(server->getServerId(),
|
||||
server->getHostId());
|
||||
ProtocolManager::getInstance()->requestStart(cts);
|
||||
}
|
||||
@ -255,7 +255,7 @@ void OnlineScreen::tearDown()
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Sets which widget has to be focused. Depends on the user state.
|
||||
/** Sets which widget has to be focused. Depends on the user state.
|
||||
*/
|
||||
void OnlineScreen::setInitialFocus()
|
||||
{
|
||||
|
@ -717,10 +717,10 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
|
||||
font = GUIEngine::getSmallFont();
|
||||
|
||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||
std::ostringstream oss;
|
||||
oss << (int)(speed*10);
|
||||
char str[256];
|
||||
sprintf(str, "%d", (int)(speed*10));
|
||||
|
||||
font->draw(oss.str().c_str(), pos, color);
|
||||
font->draw(core::stringw(str).c_str(), pos, color);
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "states_screens/register_screen.hpp"
|
||||
|
||||
#include "config/player_manager.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "guiengine/widgets/check_box_widget.hpp"
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
@ -79,27 +78,12 @@ void RegisterScreen::init()
|
||||
|
||||
m_info_widget = getWidget<LabelWidget>("info");
|
||||
assert(m_info_widget);
|
||||
m_info_widget->setDefaultColor();
|
||||
m_info_widget->setText("", false);
|
||||
m_options_widget = getWidget<RibbonWidget>("options");
|
||||
assert(m_options_widget);
|
||||
|
||||
m_signup_request = NULL;
|
||||
m_info_message_shown = false;
|
||||
|
||||
getWidget<CheckBoxWidget>("online")->setVisible(true);
|
||||
getWidget<LabelWidget>("label_online")->setVisible(true);
|
||||
// Check if online is allowed
|
||||
if (UserConfigParams::m_internet_status != Online::RequestManager::IPERM_NOT_ALLOWED)
|
||||
{
|
||||
getWidget<CheckBoxWidget>("online")->setState(true);
|
||||
makeEntryFieldsVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
getWidget<CheckBoxWidget>("online")->setState(false);
|
||||
makeEntryFieldsVisible(false);
|
||||
}
|
||||
makeEntryFieldsVisible(true);
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -188,7 +172,7 @@ void RegisterScreen::doRegister()
|
||||
->getText().trim();
|
||||
|
||||
handleLocalName(local_name);
|
||||
|
||||
|
||||
// If no online account is requested, don't register
|
||||
if(!getWidget<CheckBoxWidget>("online")->getState() || m_existing_player)
|
||||
{
|
||||
@ -319,14 +303,7 @@ void RegisterScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
{
|
||||
if (name == "online")
|
||||
{
|
||||
if (UserConfigParams::m_internet_status == Online::RequestManager::IPERM_NOT_ALLOWED)
|
||||
{
|
||||
m_info_widget->setErrorColor();
|
||||
m_info_widget->setText(_("Internet access is disabled, please enable it in the options"), false);
|
||||
getWidget<CheckBoxWidget>("online")->setState(false);
|
||||
}
|
||||
else
|
||||
makeEntryFieldsVisible(getWidget<CheckBoxWidget>("online")->getState());
|
||||
makeEntryFieldsVisible(getWidget<CheckBoxWidget>("online")->getState());
|
||||
}
|
||||
else if (name=="options")
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ void BaseUserScreen::init()
|
||||
assert(m_info_widget);
|
||||
|
||||
getWidget<CheckBoxWidget>("remember-user")
|
||||
->setState(UserConfigParams::m_remember_user);
|
||||
->setState(UserConfigParams::m_always_show_login_screen);
|
||||
m_sign_out_name = "";
|
||||
m_sign_in_name = "";
|
||||
|
||||
@ -102,7 +102,7 @@ void BaseUserScreen::init()
|
||||
|
||||
m_players->updateItemDisplay();
|
||||
|
||||
// Select the current player. That can only be done after
|
||||
// Select the current player. That can only be done after
|
||||
// updateItemDisplay is called.
|
||||
if(current_player_index.size()>0)
|
||||
{
|
||||
@ -115,12 +115,6 @@ void BaseUserScreen::init()
|
||||
m_online_cb->setState(player->wasOnlineLastTime() ||
|
||||
player->isLoggedIn() );
|
||||
makeEntryFieldsVisible();
|
||||
// We have to deactivate after make visible (since make visible
|
||||
// automatically activates widgets).
|
||||
if(online_name.size()>0)
|
||||
m_username_tb->setDeactivated();
|
||||
else
|
||||
m_username_tb->setActivated();
|
||||
}
|
||||
else // no current player found
|
||||
{
|
||||
@ -242,7 +236,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
|
||||
}
|
||||
else if (name == "remember-user")
|
||||
{
|
||||
UserConfigParams::m_remember_user =
|
||||
UserConfigParams::m_remember_user =
|
||||
getWidget<CheckBoxWidget>("remember-user")->getState();
|
||||
}
|
||||
else if (name == "online")
|
||||
@ -253,7 +247,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
|
||||
Online::RequestManager::IPERM_NOT_ALLOWED)
|
||||
{
|
||||
m_info_widget->setText(
|
||||
_("Internet access is disabled, please enable it in the options"),
|
||||
"Internet access is disabled, please enable it in the options",
|
||||
true);
|
||||
sfx_manager->quickSound( "anvil" );
|
||||
m_online_cb->setState(false);
|
||||
@ -262,7 +256,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
|
||||
}
|
||||
else if (name == "options")
|
||||
{
|
||||
const std::string &button =
|
||||
const std::string &button =
|
||||
m_options_widget->getSelectionIDString(player_id);
|
||||
if (button == "ok")
|
||||
{
|
||||
@ -282,7 +276,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
|
||||
PlayerProfile *cp = getSelectedPlayer();
|
||||
RegisterScreen::getInstance()->setRename(cp);
|
||||
StateManager::get()->pushScreen(RegisterScreen::getInstance());
|
||||
// Init will automatically be called, which
|
||||
// Init will automatically be called, which
|
||||
// refreshes the player list
|
||||
}
|
||||
else if (button == "delete")
|
||||
@ -403,7 +397,7 @@ void BaseUserScreen::onUpdate(float dt)
|
||||
{
|
||||
if (!m_options_widget->isActivated())
|
||||
{
|
||||
core::stringw message = (m_state & STATE_LOGOUT)
|
||||
core::stringw message = (m_state & STATE_LOGOUT)
|
||||
? _(L"Signing out '%s'",m_sign_out_name.c_str())
|
||||
: _(L"Signing in '%s'", m_sign_in_name.c_str());
|
||||
m_info_widget->setText(Online::Messages::loadingDots(message.c_str()),
|
||||
@ -450,7 +444,6 @@ void BaseUserScreen::loginError(const irr::core::stringw & error_message)
|
||||
// which allows the player to enter a new password.
|
||||
if(player && player->hasSavedSession())
|
||||
player->clearSession();
|
||||
player->setLastOnlineName("");
|
||||
makeEntryFieldsVisible();
|
||||
sfx_manager->quickSound("anvil");
|
||||
m_info_widget->setErrorColor();
|
||||
@ -544,7 +537,7 @@ void BaseUserScreen::doDeletePlayer()
|
||||
for(unsigned int i=0; i<PlayerManager::get()->getNumPlayers(); i++)
|
||||
{
|
||||
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
|
||||
if(!player->isGuestAccount())
|
||||
if(!player->isGuestAccount())
|
||||
{
|
||||
PlayerManager::get()->setCurrentPlayer(player);
|
||||
break;
|
||||
@ -570,7 +563,7 @@ void BaseUserScreen::onDialogClose()
|
||||
{
|
||||
return;
|
||||
// To allow players to exit the game without creating a player, we count
|
||||
// how often this function was called. The first time is after the
|
||||
// how often this function was called. The first time is after the
|
||||
// internet allowed dialog, the 2nd time
|
||||
static int number_of_calls = 0;
|
||||
number_of_calls++;
|
||||
@ -607,12 +600,12 @@ void TabbedUserScreen::init()
|
||||
/** Switch to the correct tab.
|
||||
*/
|
||||
void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
|
||||
const std::string& name,
|
||||
const std::string& name,
|
||||
const int player_id)
|
||||
{
|
||||
if (name == "options_choice")
|
||||
{
|
||||
const std::string &selection =
|
||||
const std::string &selection =
|
||||
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
Screen *s;
|
||||
if (selection=="tab_audio" ) s = OptionsScreenAudio::getInstance();
|
||||
|
@ -23,13 +23,13 @@
|
||||
|
||||
#include "guiengine/screen.hpp"
|
||||
|
||||
namespace GUIEngine
|
||||
namespace GUIEngine
|
||||
{
|
||||
class CheckBoxWidget;
|
||||
class LabelWidget;
|
||||
class RibbonWidget;
|
||||
class TextBoxWidget;
|
||||
class Widget;
|
||||
class Widget;
|
||||
}
|
||||
|
||||
class PlayerProfile;
|
||||
@ -39,7 +39,7 @@ class PlayerProfile;
|
||||
* \brief The user management screen. The screen cames in two variations:
|
||||
* either as a stand-alone screen before the main menu (on first time STK
|
||||
* is started, or it the user is not remembered), but also as tab in the
|
||||
* options menu. To implement this, we use one common base class that
|
||||
* options menu. To implement this, we use one common base class that
|
||||
* implements nearly all functionality, and derive to classes - one for
|
||||
* the stand alone version, one for the version with tabs.
|
||||
* \ingroup states_screens.
|
||||
|
@ -152,4 +152,4 @@ void ModelDefinitionLoader::clear()
|
||||
scene::IMesh* ModelDefinitionLoader::getFirstMeshFor(const std::string& name)
|
||||
{
|
||||
return irr_driver->getMesh(m_lod_groups[name][0].m_model_file);
|
||||
}
|
||||
}
|
@ -209,8 +209,11 @@ core::stringw Track::getSortName() const
|
||||
*/
|
||||
bool Track::isInGroup(const std::string &group_name)
|
||||
{
|
||||
return std::find(m_groups.begin(), m_groups.end(), group_name)
|
||||
!= m_groups.end();
|
||||
for(unsigned int i=0; i<m_groups.size(); i++)
|
||||
{
|
||||
if(m_groups[i]==group_name) return true;
|
||||
}
|
||||
return false;
|
||||
} // isInGroup
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -433,7 +433,9 @@ public:
|
||||
void itemCommand(const XMLNode *node);
|
||||
core::stringw getName() const;
|
||||
core::stringw getSortName() const;
|
||||
// ------------------------------------------------------------------------
|
||||
bool isInGroup(const std::string &group_name);
|
||||
// ------------------------------------------------------------------------
|
||||
const core::vector3df& getSunRotation();
|
||||
/** Sets the current ambient color for a kart with index k. */
|
||||
void setAmbientColor(const video::SColor &color,
|
||||
|
@ -173,7 +173,7 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent,
|
||||
else if (lod_instance)
|
||||
{
|
||||
m_type = "lod";
|
||||
TrackObjectPresentationLOD* lod_node =
|
||||
TrackObjectPresentationLOD* lod_node =
|
||||
new TrackObjectPresentationLOD(xml_node, parent, model_def_loader);
|
||||
m_presentation = lod_node;
|
||||
|
||||
@ -191,7 +191,7 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent,
|
||||
std::string render_pass;
|
||||
xml_node.get("renderpass", &render_pass);
|
||||
|
||||
if (m_interaction != "ghost" && m_interaction != "none" &&
|
||||
if (m_interaction != "ghost" && m_interaction != "none" &&
|
||||
render_pass != "skybox" )
|
||||
{
|
||||
m_physical_object = PhysicalObject::fromXML(type == "movable",
|
||||
@ -286,7 +286,7 @@ void TrackObject::move(const core::vector3df& xyz, const core::vector3df& hpr,
|
||||
const core::vector3df& scale, bool update_rigid_body)
|
||||
{
|
||||
if (m_presentation != NULL) m_presentation->move(xyz, hpr, scale);
|
||||
if (update_rigid_body && m_physical_object != NULL)
|
||||
if (update_rigid_body && m_physical_object != NULL)
|
||||
{
|
||||
// If we set a bullet position from an irrlicht position, we need to
|
||||
// get the absolute transform from the presentation object (as set in
|
||||
|
@ -1,79 +0,0 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2010-2013 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_CAN_BE_DELETED
|
||||
#define HEADER_CAN_BE_DELETED
|
||||
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/synchronised.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
/** A simple class that a adds a function to wait with a timeout for a
|
||||
* class to be ready to be deleted. It is used for objects with their
|
||||
* own threads (e.g. RequestManager) to make sure they can be deleted.
|
||||
* For example, the RequestManager might be executing a download request.
|
||||
* So we have to signal libcurl to abort the download request, then
|
||||
* potentially handle a high priority sign-out request before the thread
|
||||
* can be deleted. With this object the main thread can wait for a given
|
||||
* amount of time (in case that of a bad internet hickup) before deleting
|
||||
* the RequestManager.
|
||||
*/
|
||||
class CanBeDeleted
|
||||
{
|
||||
private:
|
||||
Synchronised<bool> m_can_be_deleted;
|
||||
public:
|
||||
/** Set this instance to be not ready to be deleted. */
|
||||
CanBeDeleted() { m_can_be_deleted.setAtomic(false); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets this instance to be ready to be deleted. */
|
||||
void setCanBeDeleted() {m_can_be_deleted.setAtomic(true); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Waits at most t seconds for this class to be ready to be deleted.
|
||||
* \return true if the class is ready, false in case of a time out.
|
||||
*/
|
||||
bool waitForReadyToDeleted(float waiting_time)
|
||||
{
|
||||
if (m_can_be_deleted.getAtomic()) return true;
|
||||
double start = StkTime::getRealTime();
|
||||
Log::verbose("Thread", "Start waiting %lf", start);
|
||||
while(1)
|
||||
{
|
||||
if(m_can_be_deleted.getAtomic())
|
||||
{
|
||||
Log::verbose("Thread",
|
||||
"Waited %lf seconds for thread to become deleteable.",
|
||||
StkTime::getRealTime()-start);
|
||||
Log::verbose("Thread", "Stop waiting %lf", StkTime::getRealTime());
|
||||
return true;
|
||||
}
|
||||
StkTime::sleep(10);
|
||||
if(StkTime::getRealTime() - start > waiting_time)
|
||||
{
|
||||
Log::verbose("Thread", "Stop waiting %lf", StkTime::getRealTime());
|
||||
Log::verbose("Thread", "Waited for more than %f seconds for "
|
||||
"thread to become deleteable",
|
||||
waiting_time);
|
||||
return false;
|
||||
}
|
||||
} // while 1
|
||||
} // waitForReadyToDeleted
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
}; // CanBeDeleted
|
||||
#endif
|
@ -275,7 +275,7 @@ bool onEvent(const SEvent &event)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleRSM();
|
||||
}
|
||||
@ -283,7 +283,7 @@ bool onEvent(const SEvent &event)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleRH();
|
||||
}
|
||||
@ -291,7 +291,7 @@ bool onEvent(const SEvent &event)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleGI();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
Synchronised<int> m_lock_stacktrace;
|
||||
|
||||
|
||||
#ifdef GET_STACK_TRACE
|
||||
#ifdef GET_STACK_TRACE
|
||||
# ifdef __APPLE__
|
||||
# include <Availability.h>
|
||||
# include <execinfo.h>
|
||||
|
@ -393,11 +393,7 @@ void Profiler::draw()
|
||||
{
|
||||
"Solid Pass 1",
|
||||
"Shadows",
|
||||
"RH",
|
||||
"GI",
|
||||
"Env Map",
|
||||
"SunLight",
|
||||
"PointLights",
|
||||
"Lights",
|
||||
"SSAO",
|
||||
"Solid Pass 2",
|
||||
"Transparent",
|
||||
|
@ -6,7 +6,7 @@ cd data/gui
|
||||
l=""
|
||||
for i in $(find . -iname "*.stkgui"); do
|
||||
s=$(basename $i)
|
||||
x=$(find ../../src/states_screens -type f -exec grep -H $s \{} \; | wc -l)
|
||||
x=$(find ../../src/states_screens -exec grep -H $s \{} \; | wc -l)
|
||||
echo -n "."
|
||||
if [ $x == "0" ]; then
|
||||
l="$l $i"
|
||||
|
@ -39,9 +39,7 @@ def main():
|
||||
if statistics:
|
||||
lines_total += len(lines)
|
||||
|
||||
modified = False
|
||||
for i in range(len(lines)):
|
||||
oldLine = lines[i]
|
||||
# replacing tabs with four spaces
|
||||
lines[i] = lines[i].replace("\t", " ")
|
||||
|
||||
@ -50,15 +48,12 @@ def main():
|
||||
if statistics:
|
||||
if lines[i].lstrip().startswith("//"):
|
||||
lines_code += 1
|
||||
if not modified and oldLine != lines[i]:
|
||||
modified = True
|
||||
src_file.close()
|
||||
|
||||
# writing back
|
||||
if modified:
|
||||
src_file = open(dirpath + "/" + filename, "w")
|
||||
src_file.write("".join(lines))
|
||||
src_file.close()
|
||||
src_file = open(dirpath + "/" + filename, "w")
|
||||
src_file.write("".join(lines))
|
||||
src_file.close()
|
||||
|
||||
if statistics:
|
||||
print("Total number of files in " + directory + ": "
|
||||
|
Loading…
x
Reference in New Issue
Block a user