Merge branch 'master' into NewRTTMinimap
This commit is contained in:
commit
394fb9be9b
3
TODO.md
3
TODO.md
@ -1,5 +1,8 @@
|
|||||||
##TODO
|
##TODO
|
||||||
|
|
||||||
|
THIS IS A 2nd TEST.
|
||||||
|
THIS IS A TEST.
|
||||||
|
|
||||||
SuperTuxKart is looking for additional man power to make this
|
SuperTuxKart is looking for additional man power to make this
|
||||||
one of the best free linux games out there :) We need (in
|
one of the best free linux games out there :) We need (in
|
||||||
no particular order):
|
no particular order):
|
||||||
|
@ -1,20 +1,25 @@
|
|||||||
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
||||||
|
|
||||||
uniform layout(size1x16) restrict readonly image2D source;
|
uniform layout(size1x16) restrict readonly image2D source;
|
||||||
|
uniform layout(size1x32) restrict readonly image2D depth;
|
||||||
uniform layout(size1x16) volatile restrict writeonly image2D dest;
|
uniform layout(size1x16) volatile restrict writeonly image2D dest;
|
||||||
uniform float sigma = 5.;
|
uniform float sigma = 5.;
|
||||||
|
|
||||||
layout (local_size_x = 8, local_size_y = 8) in;
|
layout (local_size_x = 8, local_size_y = 8) in;
|
||||||
|
|
||||||
shared float local_src[8 + 2 * 8][8];
|
shared float local_src[8 + 2 * 8][8];
|
||||||
|
shared float local_depth[8 + 2 * 8][8];
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
int x = int(gl_LocalInvocationID.x), y = int(gl_LocalInvocationID.y);
|
int x = int(gl_LocalInvocationID.x), y = int(gl_LocalInvocationID.y);
|
||||||
ivec2 uv = ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.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][y] = imageLoad(source, ivec2(uv) - ivec2(8, 0)).x;
|
||||||
|
local_depth[x][y] = imageLoad(depth, ivec2(uv) - ivec2(8, 0)).x;
|
||||||
local_src[x + 8][y] = imageLoad(source, ivec2(uv)).x;
|
local_src[x + 8][y] = imageLoad(source, ivec2(uv)).x;
|
||||||
|
local_depth[x + 8][y] = imageLoad(depth, ivec2(uv)).x;
|
||||||
local_src[x + 16][y] = imageLoad(source, ivec2(uv) + ivec2(8, 0)).x;
|
local_src[x + 16][y] = imageLoad(source, ivec2(uv) + ivec2(8, 0)).x;
|
||||||
|
local_depth[x + 16][y] = imageLoad(depth, ivec2(uv) + ivec2(8, 0)).x;
|
||||||
|
|
||||||
barrier();
|
barrier();
|
||||||
|
|
||||||
@ -23,14 +28,20 @@ void main()
|
|||||||
g1 = exp(-0.5 / (sigma * sigma));
|
g1 = exp(-0.5 / (sigma * sigma));
|
||||||
g2 = g1 * g1;
|
g2 = g1 * g1;
|
||||||
float sum = local_src[x + 8][y] * g0;
|
float sum = local_src[x + 8][y] * g0;
|
||||||
|
float pixel_depth = local_depth[x + 8][y];
|
||||||
g0 *= g1;
|
g0 *= g1;
|
||||||
g1 *= g2;
|
g1 *= g2;
|
||||||
|
float tmp_weight, total_weight = g0;
|
||||||
for (int j = 1; j < 8; j++) {
|
for (int j = 1; j < 8; j++) {
|
||||||
sum += local_src[8 + x - j][y] * g0;
|
tmp_weight = max(0.0, 1.0 - .001 * abs(local_depth[8 + x - j][y] - pixel_depth));
|
||||||
sum += local_src[8 + x + j][y] * g0;
|
total_weight += g0 * tmp_weight;
|
||||||
|
sum += local_src[8 + x - j][y] * g0 * tmp_weight;
|
||||||
|
tmp_weight = max(0.0, 1.0 - .001 * abs(local_depth[8 + x + j][y] - pixel_depth));
|
||||||
|
total_weight += g0 * tmp_weight;
|
||||||
|
sum += local_src[8 + x + j][y] * g0 * tmp_weight;
|
||||||
g0 *= g1;
|
g0 *= g1;
|
||||||
g1 *= g2;
|
g1 *= g2;
|
||||||
}
|
}
|
||||||
imageStore(dest, ivec2(uv), vec4(sum));
|
imageStore(dest, ivec2(uv), vec4(sum / total_weight));
|
||||||
}
|
}
|
||||||
|
|
37
data/shaders/bilateralH.frag
Normal file
37
data/shaders/bilateralH.frag
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
||||||
|
|
||||||
|
uniform sampler2D tex;
|
||||||
|
uniform sampler2D depth;
|
||||||
|
uniform vec2 pixel;
|
||||||
|
uniform float sigma = 5.;
|
||||||
|
|
||||||
|
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));
|
||||||
|
g2 = g1 * g1;
|
||||||
|
vec4 sum = texture(tex, vec2(X, Y)) * g0;
|
||||||
|
float pixel_depth = texture(depth, vec2(X, Y)).x;
|
||||||
|
g0 *= g1;
|
||||||
|
g1 *= g2;
|
||||||
|
float tmp_weight, total_weight = g0;
|
||||||
|
for (int i = 1; i < 9; i++) {
|
||||||
|
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X - i * pixel.x, Y)).x - pixel_depth));
|
||||||
|
sum += texture(tex, vec2(X - i * pixel.x, Y)) * g0 * tmp_weight;
|
||||||
|
total_weight += g0 * tmp_weight;
|
||||||
|
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X + i * pixel.x, Y)).x - pixel_depth));
|
||||||
|
sum += texture(tex, vec2(X + i * pixel.x, Y)) * g0 * tmp_weight;
|
||||||
|
total_weight += g0 * tmp_weight;
|
||||||
|
g0 *= g1;
|
||||||
|
g1 *= g2;
|
||||||
|
}
|
||||||
|
|
||||||
|
FragColor = sum / total_weight;
|
||||||
|
}
|
@ -1,20 +1,25 @@
|
|||||||
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
||||||
|
|
||||||
uniform layout(size1x16) restrict readonly image2D source;
|
uniform layout(size1x16) restrict readonly image2D source;
|
||||||
|
uniform layout(size1x32) restrict readonly image2D depth;
|
||||||
uniform layout(size1x16) volatile restrict writeonly image2D dest;
|
uniform layout(size1x16) volatile restrict writeonly image2D dest;
|
||||||
uniform float sigma = 5.;
|
uniform float sigma = 5.;
|
||||||
|
|
||||||
layout (local_size_x = 8, local_size_y = 8) in;
|
layout (local_size_x = 8, local_size_y = 8) in;
|
||||||
|
|
||||||
shared float local_src[8][8 + 2 * 8];
|
shared float local_src[8][8 + 2 * 8];
|
||||||
|
shared float local_depth[8][8 + 2 * 8];
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
int x = int(gl_LocalInvocationID.x), y = int(gl_LocalInvocationID.y);
|
int x = int(gl_LocalInvocationID.x), y = int(gl_LocalInvocationID.y);
|
||||||
ivec2 uv = ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.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] = imageLoad(source, ivec2(uv) - ivec2(0, 8)).x;
|
||||||
|
local_depth[x][y] = imageLoad(depth, ivec2(uv) - ivec2(0, 8)).x;
|
||||||
local_src[x][y + 8] = imageLoad(source, ivec2(uv)).x;
|
local_src[x][y + 8] = imageLoad(source, ivec2(uv)).x;
|
||||||
|
local_depth[x][y + 8] = imageLoad(depth, ivec2(uv)).x;
|
||||||
local_src[x][y + 16] = imageLoad(source, ivec2(uv) + ivec2(0, 8)).x;
|
local_src[x][y + 16] = imageLoad(source, ivec2(uv) + ivec2(0, 8)).x;
|
||||||
|
local_depth[x][y + 16] = imageLoad(depth, ivec2(uv) + ivec2(0, 8)).x;
|
||||||
|
|
||||||
barrier();
|
barrier();
|
||||||
|
|
||||||
@ -23,14 +28,21 @@ void main()
|
|||||||
g1 = exp(-0.5 / (sigma * sigma));
|
g1 = exp(-0.5 / (sigma * sigma));
|
||||||
g2 = g1 * g1;
|
g2 = g1 * g1;
|
||||||
float sum = local_src[x][y + 8] * g0;
|
float sum = local_src[x][y + 8] * g0;
|
||||||
|
float pixel_depth = local_depth[x][y + 8];
|
||||||
g0 *= g1;
|
g0 *= g1;
|
||||||
g1 *= g2;
|
g1 *= g2;
|
||||||
|
float tmp_weight, total_weight = g0;
|
||||||
for (int j = 1; j < 8; j++) {
|
for (int j = 1; j < 8; j++) {
|
||||||
sum += local_src[x][y + 8 + j] * g0;
|
tmp_weight = max(0.0, 1.0 - .001 * abs(local_depth[x][y + 8 + j] - pixel_depth));
|
||||||
sum += local_src[x][y + 8 - j] * g0;
|
sum += local_src[x][y + 8 + j] * g0 * tmp_weight;
|
||||||
|
total_weight += g0 * tmp_weight;
|
||||||
|
tmp_weight = max(0.0, 1.0 - .001 * abs(local_depth[x][y + 8 - j] - pixel_depth));
|
||||||
|
sum += local_src[x][y + 8 - j] * g0 * tmp_weight;
|
||||||
|
total_weight += g0 * tmp_weight;
|
||||||
g0 *= g1;
|
g0 *= g1;
|
||||||
g1 *= g2;
|
g1 *= g2;
|
||||||
|
|
||||||
}
|
}
|
||||||
imageStore(dest, ivec2(uv), vec4(sum));
|
imageStore(dest, ivec2(uv), vec4(sum / total_weight));
|
||||||
}
|
}
|
||||||
|
|
38
data/shaders/bilateralV.frag
Normal file
38
data/shaders/bilateralV.frag
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
||||||
|
|
||||||
|
uniform sampler2D tex;
|
||||||
|
uniform sampler2D depth;
|
||||||
|
uniform vec2 pixel;
|
||||||
|
uniform float sigma = 5.;
|
||||||
|
|
||||||
|
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));
|
||||||
|
g2 = g1 * g1;
|
||||||
|
vec4 sum = texture(tex, vec2(X, Y)) * g0;
|
||||||
|
float pixel_depth = texture(depth, vec2(X, Y)).x;
|
||||||
|
g0 *= g1;
|
||||||
|
g1 *= g2;
|
||||||
|
float tmp_weight, total_weight = g0;
|
||||||
|
for (int i = 1; i < 9; i++) {
|
||||||
|
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X, Y - i * pixel.y)).x - pixel_depth));
|
||||||
|
sum += texture(tex, vec2(X, Y - i * pixel.y)) * g0 * tmp_weight;
|
||||||
|
total_weight += g0 * tmp_weight;
|
||||||
|
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X, Y + i * pixel.y)).x - pixel_depth));
|
||||||
|
sum += texture(tex, vec2(X, Y + i * pixel.y)) * g0 * tmp_weight;
|
||||||
|
total_weight += g0 * tmp_weight;
|
||||||
|
g0 *= g1;
|
||||||
|
g1 *= g2;
|
||||||
|
}
|
||||||
|
|
||||||
|
FragColor = sum / total_weight;
|
||||||
|
}
|
||||||
|
|
@ -1,27 +1,33 @@
|
|||||||
uniform mat4 ModelViewProjectionMatrix;
|
#ifdef UBO_DISABLED
|
||||||
uniform mat4 ModelViewMatrix;
|
uniform mat4 ViewMatrix;
|
||||||
|
uniform mat4 ProjectionMatrix;
|
||||||
|
uniform mat4 InverseViewMatrix;
|
||||||
|
uniform mat4 InverseProjectionMatrix;
|
||||||
|
#else
|
||||||
|
layout (std140) uniform MatrixesData
|
||||||
|
{
|
||||||
|
mat4 ViewMatrix;
|
||||||
|
mat4 ProjectionMatrix;
|
||||||
|
mat4 InverseViewMatrix;
|
||||||
|
mat4 InverseProjectionMatrix;
|
||||||
|
mat4 ShadowViewProjMatrixes[4];
|
||||||
|
vec2 screen;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform mat4 ModelMatrix;
|
||||||
|
|
||||||
|
layout(location = 0) in vec3 Position;
|
||||||
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
layout(location = 4) in vec2 SecondTexcoord;
|
||||||
|
|
||||||
#if __VERSION__ >= 130
|
|
||||||
in vec3 Position;
|
|
||||||
in vec2 Texcoord;
|
|
||||||
in vec2 SecondTexcoord;
|
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
out vec2 uv_bis;
|
out vec2 uv_bis;
|
||||||
out float camdist;
|
out float camdist;
|
||||||
#else
|
|
||||||
attribute vec3 Position;
|
|
||||||
attribute vec2 Texcoord;
|
|
||||||
attribute vec2 SecondTexcoord;
|
|
||||||
varying vec2 uv;
|
|
||||||
varying vec2 uv_bis;
|
|
||||||
varying float camdist;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vec4(Position, 1.);
|
||||||
uv = Texcoord;
|
uv = Texcoord;
|
||||||
uv_bis = SecondTexcoord;
|
uv_bis = SecondTexcoord;
|
||||||
camdist = length(ModelViewMatrix * vec4(Position, 1.));
|
camdist = length(ViewMatrix * ModelMatrix * vec4(Position, 1.));
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
|
||||||
|
|
||||||
uniform sampler2D tex;
|
|
||||||
uniform vec2 pixel;
|
|
||||||
uniform float sigma = 5.;
|
|
||||||
|
|
||||||
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));
|
|
||||||
g2 = g1 * g1;
|
|
||||||
vec4 sum = texture(tex, vec2(X, Y)) * g0;
|
|
||||||
g0 *= g1;
|
|
||||||
g1 *= g2;
|
|
||||||
for (int i = 1; i < 9; i++) {
|
|
||||||
sum += texture(tex, vec2(X - i * pixel.x, Y)) * g0;
|
|
||||||
sum += texture(tex, vec2(X + i * pixel.x, Y)) * g0;
|
|
||||||
g0 *= g1;
|
|
||||||
g1 *= g2;
|
|
||||||
}
|
|
||||||
|
|
||||||
FragColor = sum;
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
|
||||||
|
|
||||||
uniform sampler2D tex;
|
|
||||||
uniform vec2 pixel;
|
|
||||||
uniform float sigma = 5.;
|
|
||||||
|
|
||||||
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));
|
|
||||||
g2 = g1 * g1;
|
|
||||||
vec4 sum = texture(tex, vec2(X, Y)) * g0;
|
|
||||||
g0 *= g1;
|
|
||||||
g1 *= g2;
|
|
||||||
for (int i = 1; i < 9; i++) {
|
|
||||||
sum += texture(tex, vec2(X, Y - i * pixel.y)) * g0;
|
|
||||||
sum += texture(tex, vec2(X, Y + i * pixel.y)) * g0;
|
|
||||||
g0 *= g1;
|
|
||||||
g1 *= g2;
|
|
||||||
}
|
|
||||||
|
|
||||||
FragColor = sum;
|
|
||||||
}
|
|
||||||
|
|
@ -3,22 +3,14 @@ uniform mat4 ModelViewProjectionMatrix;
|
|||||||
uniform mat4 TransposeInverseModelView;
|
uniform mat4 TransposeInverseModelView;
|
||||||
|
|
||||||
|
|
||||||
#if __VERSION__ >= 130
|
|
||||||
in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
in vec3 Normal;
|
layout(location = 1) in vec3 Normal;
|
||||||
in vec2 Texcoord;
|
layout(location = 2) in vec4 Color;
|
||||||
in vec4 Color;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
|
||||||
out vec3 nor;
|
out vec3 nor;
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
#else
|
|
||||||
attribute vec3 Position;
|
|
||||||
attribute vec3 Normal;
|
|
||||||
attribute vec2 Texcoord;
|
|
||||||
attribute vec4 Color;
|
|
||||||
varying vec3 nor;
|
|
||||||
varying vec2 uv;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -15,10 +15,10 @@ in vec3 Origin;
|
|||||||
in vec3 Orientation;
|
in vec3 Orientation;
|
||||||
in vec3 Scale;
|
in vec3 Scale;
|
||||||
|
|
||||||
in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
in vec3 Normal;
|
layout(location = 1) in vec3 Normal;
|
||||||
in vec2 Texcoord;
|
layout(location = 2) in vec4 Color;
|
||||||
in vec4 Color;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
|
||||||
out vec3 nor;
|
out vec3 nor;
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
|
@ -19,9 +19,9 @@ in vec3 Origin;
|
|||||||
in vec3 Orientation;
|
in vec3 Orientation;
|
||||||
in vec3 Scale;
|
in vec3 Scale;
|
||||||
|
|
||||||
in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
in vec3 Normal;
|
layout(location = 1) in vec3 Normal;
|
||||||
in vec2 Texcoord;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
|
||||||
out vec3 nor;
|
out vec3 nor;
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
|
@ -11,8 +11,8 @@ in vec3 Origin;
|
|||||||
in vec3 Orientation;
|
in vec3 Orientation;
|
||||||
in vec3 Scale;
|
in vec3 Scale;
|
||||||
|
|
||||||
in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
in vec2 Texcoord;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
|
||||||
#ifdef VSLayer
|
#ifdef VSLayer
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
|
@ -10,24 +10,15 @@ layout (std140) uniform MatrixesData
|
|||||||
uniform mat4 ModelMatrix;
|
uniform mat4 ModelMatrix;
|
||||||
uniform mat4 InverseModelMatrix;
|
uniform mat4 InverseModelMatrix;
|
||||||
|
|
||||||
#if __VERSION__ >= 130
|
|
||||||
in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
in vec2 Texcoord;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
in vec3 Tangent;
|
layout(location = 5) in vec3 Tangent;
|
||||||
in vec3 Bitangent;
|
layout(location = 6) in vec3 Bitangent;
|
||||||
|
|
||||||
out vec3 tangent;
|
out vec3 tangent;
|
||||||
out vec3 bitangent;
|
out vec3 bitangent;
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
#else
|
|
||||||
attribute vec3 Position;
|
|
||||||
attribute vec2 Texcoord;
|
|
||||||
attribute vec3 Tangent;
|
|
||||||
attribute vec3 Bitangent;
|
|
||||||
varying vec3 tangent;
|
|
||||||
varying vec3 bitangent;
|
|
||||||
varying vec2 uv;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -24,25 +24,17 @@ uniform mat4 TextureMatrix =
|
|||||||
0., 0., 1., 0.,
|
0., 0., 1., 0.,
|
||||||
0., 0., 0., 1.);
|
0., 0., 0., 1.);
|
||||||
|
|
||||||
#if __VERSION__ >= 130
|
|
||||||
in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
in vec2 Texcoord;
|
layout(location = 1) in vec3 Normal;
|
||||||
in vec2 SecondTexcoord;
|
layout(location = 2) in vec4 Color;
|
||||||
in vec3 Normal;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
in vec4 Color;
|
layout(location = 4) in vec2 SecondTexcoord;
|
||||||
|
|
||||||
out vec3 nor;
|
out vec3 nor;
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
out vec2 uv_bis;
|
out vec2 uv_bis;
|
||||||
out vec4 color;
|
out vec4 color;
|
||||||
#else
|
|
||||||
attribute vec3 Position;
|
|
||||||
attribute vec3 Normal;
|
|
||||||
attribute vec2 Texcoord;
|
|
||||||
attribute vec2 SecondTexcoord;
|
|
||||||
varying vec3 nor;
|
|
||||||
varying vec2 uv;
|
|
||||||
varying vec2 uv_bis;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
|
@ -9,9 +9,10 @@ uniform mat4 TextureMatrix =
|
|||||||
0., 0., 0., 1.);
|
0., 0., 0., 1.);
|
||||||
|
|
||||||
|
|
||||||
in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
in vec2 Texcoord;
|
layout(location = 1) in vec3 Normal;
|
||||||
in vec3 Normal;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
|
||||||
out vec3 nor;
|
out vec3 nor;
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ layout (std140) uniform MatrixesData
|
|||||||
|
|
||||||
uniform mat4 ModelMatrix;
|
uniform mat4 ModelMatrix;
|
||||||
|
|
||||||
in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
in vec2 Texcoord;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
|
||||||
#ifdef VSLayer
|
#ifdef VSLayer
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
|
@ -56,7 +56,7 @@ void main(void)
|
|||||||
vec3 norm = -normalize(cross(ddy, ddx));
|
vec3 norm = -normalize(cross(ddy, ddx));
|
||||||
|
|
||||||
float r = radius / FragPos.z;
|
float r = radius / FragPos.z;
|
||||||
float phi = 30. * (x ^ y) + 10. * x * y;
|
float phi = 3. * (x ^ y) + x * y;
|
||||||
float bl = 0.0;
|
float bl = 0.0;
|
||||||
float m = log2(r) + 6 + log2(invSamples);
|
float m = log2(r) + 6 + log2(invSamples);
|
||||||
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
uniform mat4 ModelViewProjectionMatrix;
|
|
||||||
uniform mat4 TextureMatrix;
|
|
||||||
|
|
||||||
#if __VERSION__ >= 130
|
|
||||||
in vec3 Position;
|
|
||||||
in vec2 Texcoord;
|
|
||||||
in vec4 Color;
|
|
||||||
out vec2 uv;
|
|
||||||
out vec4 color;
|
|
||||||
#else
|
|
||||||
attribute vec3 Position;
|
|
||||||
attribute vec2 Texcoord;
|
|
||||||
varying vec2 uv;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
|
|
||||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
|
||||||
color = Color;
|
|
||||||
}
|
|
@ -68,6 +68,14 @@ when the border that intersect at this corner are enabled.
|
|||||||
<!-- Stateless -->
|
<!-- Stateless -->
|
||||||
<element type="background" image="ocean/background.jpg" />
|
<element type="background" image="ocean/background.jpg" />
|
||||||
|
|
||||||
|
<element type="achievement-message" image="ocean/glassbutton.png"
|
||||||
|
left_border="13" right_border="13" top_border="13" bottom_border="13"
|
||||||
|
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
|
||||||
|
|
||||||
|
<element type="friend-message" image="ocean/glassbutton.png"
|
||||||
|
left_border="13" right_border="13" top_border="13" bottom_border="13"
|
||||||
|
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
|
||||||
|
|
||||||
<element type="button" state="neutral" image="ocean/glassbutton.png"
|
<element type="button" state="neutral" image="ocean/glassbutton.png"
|
||||||
left_border="13" right_border="13" top_border="13" bottom_border="13"
|
left_border="13" right_border="13" top_border="13" bottom_border="13"
|
||||||
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
|
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
|
||||||
|
@ -68,6 +68,14 @@ when the border that intersect at this corner are enabled.
|
|||||||
<!-- Stateless -->
|
<!-- Stateless -->
|
||||||
<element type="background" image="peach/background.jpg" />
|
<element type="background" image="peach/background.jpg" />
|
||||||
|
|
||||||
|
<element type="achievement-message" image="peach/achievement.png"
|
||||||
|
left_border="128" right_border="13" top_border="13" bottom_border="13"
|
||||||
|
preserve_h_aspect_ratios="true" hborder_out_portion="0.3" vborder_out_portion="0"/>
|
||||||
|
|
||||||
|
<element type="friend-message" image="peach/friend.png"
|
||||||
|
left_border="128" right_border="13" top_border="13" bottom_border="13"
|
||||||
|
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
|
||||||
|
|
||||||
<element type="button" state="neutral" image="peach/glassbutton.png"
|
<element type="button" state="neutral" image="peach/glassbutton.png"
|
||||||
left_border="13" right_border="13" top_border="13" bottom_border="13"
|
left_border="13" right_border="13" top_border="13" bottom_border="13"
|
||||||
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
|
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
|
||||||
|
BIN
data/skins/peach/achievement.png
Normal file
BIN
data/skins/peach/achievement.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
data/skins/peach/friend.png
Normal file
BIN
data/skins/peach/friend.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
@ -264,7 +264,7 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
|
|||||||
// enumerate video modes
|
// enumerate video modes
|
||||||
s32 modeCount;
|
s32 modeCount;
|
||||||
XF86VidModeModeInfo** modes;
|
XF86VidModeModeInfo** modes;
|
||||||
float refresh_rate;
|
float refresh_rate, refresh_rate_old;
|
||||||
|
|
||||||
XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes);
|
XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes);
|
||||||
|
|
||||||
@ -273,22 +273,17 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
|
|||||||
{
|
{
|
||||||
if (bestMode==-1 && modes[i]->hdisplay >= Width && modes[i]->vdisplay >= Height)
|
if (bestMode==-1 && modes[i]->hdisplay >= Width && modes[i]->vdisplay >= Height)
|
||||||
{
|
{
|
||||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
|
||||||
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
|
|
||||||
refresh_rate = pixels_per_second / pixels_per_frame;
|
|
||||||
bestMode = i;
|
bestMode = i;
|
||||||
}
|
}
|
||||||
else if (bestMode!=-1 &&
|
else if (bestMode!=-1 &&
|
||||||
modes[i]->hdisplay == modes[bestMode]->hdisplay &&
|
modes[i]->hdisplay == modes[bestMode]->hdisplay &&
|
||||||
modes[i]->vdisplay == modes[bestMode]->vdisplay)
|
modes[i]->vdisplay == modes[bestMode]->vdisplay)
|
||||||
{
|
{
|
||||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
refresh_rate_old = (modes[bestMode]->dotclock * 1000.0) / (modes[bestMode]->htotal * modes[bestMode]->vtotal);
|
||||||
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
|
refresh_rate = (modes[i]->dotclock * 1000.0) / (modes[i]->htotal * modes[i]->vtotal);
|
||||||
float refresh_rate_tmp = pixels_per_second / pixels_per_frame;
|
|
||||||
|
|
||||||
if (refresh_rate_tmp > refresh_rate)
|
if (refresh_rate > refresh_rate_old)
|
||||||
{
|
{
|
||||||
refresh_rate = refresh_rate_tmp;
|
|
||||||
bestMode = i;
|
bestMode = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,9 +293,6 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
|
|||||||
modes[i]->hdisplay <= modes[bestMode]->hdisplay &&
|
modes[i]->hdisplay <= modes[bestMode]->hdisplay &&
|
||||||
modes[i]->vdisplay <= modes[bestMode]->vdisplay)
|
modes[i]->vdisplay <= modes[bestMode]->vdisplay)
|
||||||
{
|
{
|
||||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
|
||||||
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
|
|
||||||
refresh_rate = pixels_per_second / pixels_per_frame;
|
|
||||||
bestMode = i;
|
bestMode = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "achievements/achievement.hpp"
|
#include "achievements/achievement.hpp"
|
||||||
|
|
||||||
#include "achievements/achievement_info.hpp"
|
#include "achievements/achievement_info.hpp"
|
||||||
#include "guiengine/dialog_queue.hpp"
|
#include "guiengine/message_queue.hpp"
|
||||||
#include "io/utf_writer.hpp"
|
#include "io/utf_writer.hpp"
|
||||||
#include "config/player_manager.hpp"
|
#include "config/player_manager.hpp"
|
||||||
#include "states_screens/dialogs/notification_dialog.hpp"
|
#include "states_screens/dialogs/notification_dialog.hpp"
|
||||||
@ -202,8 +202,7 @@ void Achievement::check()
|
|||||||
//show achievement
|
//show achievement
|
||||||
core::stringw s = StringUtils::insertValues(_("Completed achievement \"%s\"."),
|
core::stringw s = StringUtils::insertValues(_("Completed achievement \"%s\"."),
|
||||||
m_achievement_info->getTitle());
|
m_achievement_info->getTitle());
|
||||||
GUIEngine::DialogQueue::get()->pushDialog(
|
MessageQueue::add(MessageQueue::MT_ACHIEVEMENT, s);
|
||||||
new NotificationDialog(NotificationDialog::T_Achievements, s));
|
|
||||||
|
|
||||||
// Sends a confirmation to the server that an achievement has been
|
// Sends a confirmation to the server that an achievement has been
|
||||||
// completed, if a user is signed in.
|
// completed, if a user is signed in.
|
||||||
|
@ -33,6 +33,8 @@ AnimationBase::AnimationBase(const XMLNode &node)
|
|||||||
node.get("fps", &fps);
|
node.get("fps", &fps);
|
||||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||||
{
|
{
|
||||||
|
if (node.getNode(i)->getName() == "animated-texture")
|
||||||
|
continue;
|
||||||
Ipo *ipo = new Ipo(*node.getNode(i), fps);
|
Ipo *ipo = new Ipo(*node.getNode(i), fps);
|
||||||
m_all_ipos.push_back(ipo);
|
m_all_ipos.push_back(ipo);
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,11 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
setTexture(0, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
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_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
setTexture(1, irr_driver->getFBO(FBO_LINEAR_DEPTH).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);
|
glUniform1i(FullScreenShader::Gaussian17TapHShader::uniform_tex, 0);
|
||||||
|
glUniform1i(FullScreenShader::Gaussian17TapHShader::uniform_depth, 1);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
}
|
}
|
||||||
@ -425,9 +429,11 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
|
|
||||||
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program);
|
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program);
|
||||||
glBindImageTexture(0, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
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);
|
glBindImageTexture(1, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
||||||
|
glBindImageTexture(2, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_source, 0);
|
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_source, 0);
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_dest, 1);
|
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_depth, 1);
|
||||||
|
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_dest, 2);
|
||||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -446,7 +452,11 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
setTexture(0, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
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_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
setTexture(1, irr_driver->getFBO(FBO_LINEAR_DEPTH).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);
|
glUniform1i(FullScreenShader::Gaussian17TapVShader::uniform_tex, 0);
|
||||||
|
glUniform1i(FullScreenShader::Gaussian17TapVShader::uniform_depth, 1);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
}
|
}
|
||||||
@ -455,9 +465,11 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::Program);
|
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::Program);
|
||||||
glBindImageTexture(0, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
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);
|
glBindImageTexture(1, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
||||||
|
glBindImageTexture(2, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_source, 0);
|
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_source, 0);
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_dest, 1);
|
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_depth, 1);
|
||||||
|
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_dest, 2);
|
||||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "utils/profiler.hpp"
|
#include "utils/profiler.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#define MAX2(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX2(a, b) ((a) > (b) ? (a) : (b))
|
||||||
#define MIN2(a, b) ((a) > (b) ? (b) : (a))
|
#define MIN2(a, b) ((a) > (b) ? (b) : (a))
|
||||||
@ -539,7 +540,7 @@ void IrrDriver::renderSolidFirstPass()
|
|||||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ONE };
|
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ONE };
|
||||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||||
}
|
}
|
||||||
draw<MeshShader::ObjectPass1Shader>(mesh, mesh.vao_first_pass, GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], GroupedFPSM<FPSM_DEFAULT>::TIMVSet[i], 0);
|
draw<MeshShader::ObjectPass1Shader>(mesh, mesh.vao, GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], GroupedFPSM<FPSM_DEFAULT>::TIMVSet[i], 0);
|
||||||
if (!mesh.textures[0])
|
if (!mesh.textures[0])
|
||||||
{
|
{
|
||||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||||
@ -553,7 +554,7 @@ void IrrDriver::renderSolidFirstPass()
|
|||||||
const GLMesh &mesh = *GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i];
|
const GLMesh &mesh = *GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i];
|
||||||
compressTexture(mesh.textures[0], true);
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
draw<MeshShader::ObjectRefPass1Shader>(mesh, mesh.vao_first_pass, GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i]->TextureMatrix, 0);
|
draw<MeshShader::ObjectRefPass1Shader>(mesh, mesh.vao, GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i]->TextureMatrix, 0);
|
||||||
}
|
}
|
||||||
glUseProgram(MeshShader::NormalMapShader::Program);
|
glUseProgram(MeshShader::NormalMapShader::Program);
|
||||||
for (unsigned i = 0; i < GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet.size(); ++i)
|
for (unsigned i = 0; i < GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet.size(); ++i)
|
||||||
@ -564,7 +565,7 @@ void IrrDriver::renderSolidFirstPass()
|
|||||||
setTexture(0, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
compressTexture(mesh.textures[0], true);
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(1, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(1, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
draw<MeshShader::NormalMapShader>(mesh, mesh.vao_first_pass, GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet[i], 0, 1);
|
draw<MeshShader::NormalMapShader>(mesh, mesh.vao, GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet[i], 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -689,8 +690,6 @@ void IrrDriver::renderParticles()
|
|||||||
|
|
||||||
void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height)
|
void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height)
|
||||||
{
|
{
|
||||||
static int tick = 0;
|
|
||||||
tick++;
|
|
||||||
m_scene_manager->drawAll(scene::ESNRP_CAMERA);
|
m_scene_manager->drawAll(scene::ESNRP_CAMERA);
|
||||||
irr_driver->setProjMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION));
|
irr_driver->setProjMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION));
|
||||||
irr_driver->setViewMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW));
|
irr_driver->setViewMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||||
@ -771,9 +770,12 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
|||||||
core::aabbox3df box = smallcambox;
|
core::aabbox3df box = smallcambox;
|
||||||
box = box.intersect(trackbox);
|
box = box.intersect(trackbox);
|
||||||
|
|
||||||
float xmin = INFINITY, xmax = -INFINITY;
|
float xmin = std::numeric_limits<float>::infinity();
|
||||||
float ymin = INFINITY, ymax = -INFINITY;
|
float xmax = -std::numeric_limits<float>::infinity();
|
||||||
float zmin = INFINITY, zmax = -INFINITY;
|
float ymin = std::numeric_limits<float>::infinity();
|
||||||
|
float ymax = -std::numeric_limits<float>::infinity();
|
||||||
|
float zmin = std::numeric_limits<float>::infinity();
|
||||||
|
float zmax = -std::numeric_limits<float>::infinity();
|
||||||
const vector3df vectors[] =
|
const vector3df vectors[] =
|
||||||
{
|
{
|
||||||
frustrum->getFarLeftDown(),
|
frustrum->getFarLeftDown(),
|
||||||
@ -831,7 +833,7 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
|||||||
|
|
||||||
sun_ortho_matrix.push_back(getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW));
|
sun_ortho_matrix.push_back(getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||||
}
|
}
|
||||||
if ((tick % 100) == 2)
|
|
||||||
{
|
{
|
||||||
core::aabbox3df trackbox(vmin->toIrrVector(), vmax->toIrrVector() -
|
core::aabbox3df trackbox(vmin->toIrrVector(), vmax->toIrrVector() -
|
||||||
core::vector3df(0, 30, 0));
|
core::vector3df(0, 30, 0));
|
||||||
@ -910,7 +912,7 @@ void IrrDriver::renderShadows()
|
|||||||
continue;
|
continue;
|
||||||
compressTexture(mesh.textures[0], true);
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
draw<MeshShader::RSMShader>(mesh, mesh.vao_rsm_pass, rsm_matrix, GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], 0);
|
draw<MeshShader::RSMShader>(mesh, mesh.vao, rsm_matrix, GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G
|
|||||||
glGenTextures(1, &result);
|
glGenTextures(1, &result);
|
||||||
glBindTexture(GL_TEXTURE_2D, result);
|
glBindTexture(GL_TEXTURE_2D, result);
|
||||||
#if WIN32
|
#if WIN32
|
||||||
if (irr_driver->getGLSLVersion() < 420)
|
if (irr_driver->getGLSLVersion() >= 420)
|
||||||
glTexStorage2D(GL_TEXTURE_2D, mipmaplevel, internalFormat, res.Width, res.Height);
|
glTexStorage2D(GL_TEXTURE_2D, mipmaplevel, internalFormat, res.Width, res.Height);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -269,21 +269,20 @@ RTT::~RTT()
|
|||||||
glDeleteTextures(1, &DepthStencilTexture);
|
glDeleteTextures(1, &DepthStencilTexture);
|
||||||
if (UserConfigParams::m_shadows)
|
if (UserConfigParams::m_shadows)
|
||||||
{
|
{
|
||||||
|
delete m_shadow_FBO;
|
||||||
glDeleteTextures(1, &shadowColorTex);
|
glDeleteTextures(1, &shadowColorTex);
|
||||||
glDeleteTextures(1, &shadowDepthTex);
|
glDeleteTextures(1, &shadowDepthTex);
|
||||||
}
|
}
|
||||||
if (UserConfigParams::m_gi)
|
if (UserConfigParams::m_gi)
|
||||||
{
|
{
|
||||||
|
delete m_RH_FBO;
|
||||||
|
delete m_RSM;
|
||||||
glDeleteTextures(1, &RSM_Color);
|
glDeleteTextures(1, &RSM_Color);
|
||||||
glDeleteTextures(1, &RSM_Normal);
|
glDeleteTextures(1, &RSM_Normal);
|
||||||
glDeleteTextures(1, &RSM_Depth);
|
glDeleteTextures(1, &RSM_Depth);
|
||||||
glDeleteTextures(1, &RH_Red);
|
glDeleteTextures(1, &RH_Red);
|
||||||
glDeleteTextures(1, &RH_Green);
|
glDeleteTextures(1, &RH_Green);
|
||||||
glDeleteTextures(1, &RH_Blue);
|
glDeleteTextures(1, &RH_Blue);
|
||||||
|
|
||||||
delete m_shadow_FBO;
|
|
||||||
delete m_RH_FBO;
|
|
||||||
delete m_RSM;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1360,19 +1360,24 @@ namespace MeshShader
|
|||||||
void TransparentShader::init()
|
void TransparentShader::init()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/transparent.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparent.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparent.frag").c_str());
|
||||||
attrib_position = glGetAttribLocation(Program, "Position");
|
attrib_position = glGetAttribLocation(Program, "Position");
|
||||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||||
attrib_color = glGetAttribLocation(Program, "Color");
|
attrib_color = glGetAttribLocation(Program, "Color");
|
||||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||||
|
if (!UserConfigParams::m_ubo_disabled)
|
||||||
|
{
|
||||||
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransparentShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex)
|
void TransparentShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex)
|
||||||
{
|
{
|
||||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelMatrix.pointer());
|
||||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||||
glUniform1i(uniform_tex, TU_tex);
|
glUniform1i(uniform_tex, TU_tex);
|
||||||
}
|
}
|
||||||
@ -1394,12 +1399,12 @@ namespace MeshShader
|
|||||||
void TransparentFogShader::init()
|
void TransparentFogShader::init()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/transparent.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparentfog.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparentfog.frag").c_str());
|
||||||
attrib_position = glGetAttribLocation(Program, "Position");
|
attrib_position = glGetAttribLocation(Program, "Position");
|
||||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||||
attrib_color = glGetAttribLocation(Program, "Color");
|
attrib_color = glGetAttribLocation(Program, "Color");
|
||||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||||
uniform_fogmax = glGetUniformLocation(Program, "fogmax");
|
uniform_fogmax = glGetUniformLocation(Program, "fogmax");
|
||||||
@ -1415,9 +1420,9 @@ namespace MeshShader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransparentFogShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex)
|
void TransparentFogShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex)
|
||||||
{
|
{
|
||||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelMatrix.pointer());
|
||||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||||
glUniform1f(uniform_fogmax, fogmax);
|
glUniform1f(uniform_fogmax, fogmax);
|
||||||
glUniform1f(uniform_startH, startH);
|
glUniform1f(uniform_startH, startH);
|
||||||
@ -1728,12 +1733,14 @@ namespace MeshShader
|
|||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/displace.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/displace.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/white.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/white.frag").c_str());
|
||||||
attrib_position = glGetAttribLocation(Program, "Position");
|
attrib_position = glGetAttribLocation(Program, "Position");
|
||||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||||
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaceMaskShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix)
|
void DisplaceMaskShader::setUniforms(const core::matrix4 &ModelMatrix)
|
||||||
{
|
{
|
||||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelMatrix.pointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint DisplaceShader::Program;
|
GLuint DisplaceShader::Program;
|
||||||
@ -1741,7 +1748,6 @@ namespace MeshShader
|
|||||||
GLuint DisplaceShader::attrib_texcoord;
|
GLuint DisplaceShader::attrib_texcoord;
|
||||||
GLuint DisplaceShader::attrib_second_texcoord;
|
GLuint DisplaceShader::attrib_second_texcoord;
|
||||||
GLuint DisplaceShader::uniform_MVP;
|
GLuint DisplaceShader::uniform_MVP;
|
||||||
GLuint DisplaceShader::uniform_MV;
|
|
||||||
GLuint DisplaceShader::uniform_displacement_tex;
|
GLuint DisplaceShader::uniform_displacement_tex;
|
||||||
GLuint DisplaceShader::uniform_mask_tex;
|
GLuint DisplaceShader::uniform_mask_tex;
|
||||||
GLuint DisplaceShader::uniform_color_tex;
|
GLuint DisplaceShader::uniform_color_tex;
|
||||||
@ -1756,8 +1762,7 @@ namespace MeshShader
|
|||||||
attrib_position = glGetAttribLocation(Program, "Position");
|
attrib_position = glGetAttribLocation(Program, "Position");
|
||||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||||
attrib_second_texcoord = glGetAttribLocation(Program, "SecondTexcoord");
|
attrib_second_texcoord = glGetAttribLocation(Program, "SecondTexcoord");
|
||||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||||
uniform_MV = glGetUniformLocation(Program, "ModelViewMatrix");
|
|
||||||
uniform_displacement_tex = glGetUniformLocation(Program, "displacement_tex");
|
uniform_displacement_tex = glGetUniformLocation(Program, "displacement_tex");
|
||||||
uniform_color_tex = glGetUniformLocation(Program, "color_tex");
|
uniform_color_tex = glGetUniformLocation(Program, "color_tex");
|
||||||
uniform_mask_tex = glGetUniformLocation(Program, "mask_tex");
|
uniform_mask_tex = glGetUniformLocation(Program, "mask_tex");
|
||||||
@ -1767,10 +1772,9 @@ namespace MeshShader
|
|||||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaceShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &ModelViewMatrix, const core::vector2df &dir, const core::vector2df &dir2, const core::vector2df &screen, unsigned TU_displacement_tex, unsigned TU_mask_tex, unsigned TU_color_tex)
|
void DisplaceShader::setUniforms(const core::matrix4 &ModelMatrix, const core::vector2df &dir, const core::vector2df &dir2, const core::vector2df &screen, unsigned TU_displacement_tex, unsigned TU_mask_tex, unsigned TU_color_tex)
|
||||||
{
|
{
|
||||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelMatrix.pointer());
|
||||||
glUniformMatrix4fv(uniform_MV, 1, GL_FALSE, ModelViewMatrix.pointer());
|
|
||||||
glUniform2f(uniform_dir, dir.X, dir.Y);
|
glUniform2f(uniform_dir, dir.X, dir.Y);
|
||||||
glUniform2f(uniform_dir2, dir2.X, dir2.Y);
|
glUniform2f(uniform_dir2, dir2.X, dir2.Y);
|
||||||
glUniform1i(uniform_displacement_tex, TU_displacement_tex);
|
glUniform1i(uniform_displacement_tex, TU_displacement_tex);
|
||||||
@ -2495,27 +2499,31 @@ namespace FullScreenShader
|
|||||||
|
|
||||||
GLuint Gaussian17TapHShader::Program;
|
GLuint Gaussian17TapHShader::Program;
|
||||||
GLuint Gaussian17TapHShader::uniform_tex;
|
GLuint Gaussian17TapHShader::uniform_tex;
|
||||||
|
GLuint Gaussian17TapHShader::uniform_depth;
|
||||||
GLuint Gaussian17TapHShader::uniform_pixel;
|
GLuint Gaussian17TapHShader::uniform_pixel;
|
||||||
GLuint Gaussian17TapHShader::vao;
|
GLuint Gaussian17TapHShader::vao;
|
||||||
void Gaussian17TapHShader::init()
|
void Gaussian17TapHShader::init()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian17taph.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bilateralH.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
||||||
|
uniform_depth = glGetUniformLocation(Program, "depth");
|
||||||
vao = createFullScreenVAO(Program);
|
vao = createFullScreenVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint ComputeGaussian17TapHShader::Program;
|
GLuint ComputeGaussian17TapHShader::Program;
|
||||||
GLuint ComputeGaussian17TapHShader::uniform_source;
|
GLuint ComputeGaussian17TapHShader::uniform_source;
|
||||||
|
GLuint ComputeGaussian17TapHShader::uniform_depth;
|
||||||
GLuint ComputeGaussian17TapHShader::uniform_dest;
|
GLuint ComputeGaussian17TapHShader::uniform_dest;
|
||||||
void ComputeGaussian17TapHShader::init()
|
void ComputeGaussian17TapHShader::init()
|
||||||
{
|
{
|
||||||
#if WIN32
|
#if WIN32
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/gaussian.comp").c_str());
|
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/bilateralH.comp").c_str());
|
||||||
uniform_source = glGetUniformLocation(Program, "source");
|
uniform_source = glGetUniformLocation(Program, "source");
|
||||||
|
uniform_depth = glGetUniformLocation(Program, "depth");
|
||||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
uniform_dest = glGetUniformLocation(Program, "dest");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2550,27 +2558,31 @@ namespace FullScreenShader
|
|||||||
|
|
||||||
GLuint Gaussian17TapVShader::Program;
|
GLuint Gaussian17TapVShader::Program;
|
||||||
GLuint Gaussian17TapVShader::uniform_tex;
|
GLuint Gaussian17TapVShader::uniform_tex;
|
||||||
|
GLuint Gaussian17TapVShader::uniform_depth;
|
||||||
GLuint Gaussian17TapVShader::uniform_pixel;
|
GLuint Gaussian17TapVShader::uniform_pixel;
|
||||||
GLuint Gaussian17TapVShader::vao;
|
GLuint Gaussian17TapVShader::vao;
|
||||||
void Gaussian17TapVShader::init()
|
void Gaussian17TapVShader::init()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian17tapv.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bilateralV.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
||||||
|
uniform_depth = glGetUniformLocation(Program, "depth");
|
||||||
vao = createFullScreenVAO(Program);
|
vao = createFullScreenVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint ComputeGaussian17TapVShader::Program;
|
GLuint ComputeGaussian17TapVShader::Program;
|
||||||
GLuint ComputeGaussian17TapVShader::uniform_source;
|
GLuint ComputeGaussian17TapVShader::uniform_source;
|
||||||
|
GLuint ComputeGaussian17TapVShader::uniform_depth;
|
||||||
GLuint ComputeGaussian17TapVShader::uniform_dest;
|
GLuint ComputeGaussian17TapVShader::uniform_dest;
|
||||||
void ComputeGaussian17TapVShader::init()
|
void ComputeGaussian17TapVShader::init()
|
||||||
{
|
{
|
||||||
#if WIN32
|
#if WIN32
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/gaussianv.comp").c_str());
|
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/bilateralV.comp").c_str());
|
||||||
uniform_source = glGetUniformLocation(Program, "source");
|
uniform_source = glGetUniformLocation(Program, "source");
|
||||||
|
uniform_depth = glGetUniformLocation(Program, "depth");
|
||||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
uniform_dest = glGetUniformLocation(Program, "dest");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ public:
|
|||||||
static GLuint uniform_MVP, uniform_TM, uniform_tex;
|
static GLuint uniform_MVP, uniform_TM, uniform_tex;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex);
|
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TransparentFogShader
|
class TransparentFogShader
|
||||||
@ -299,7 +299,7 @@ public:
|
|||||||
static GLuint uniform_MVP, uniform_TM, uniform_tex, uniform_fogmax, uniform_startH, uniform_endH, uniform_start, uniform_end, uniform_col;
|
static GLuint uniform_MVP, uniform_TM, uniform_tex, uniform_fogmax, uniform_startH, uniform_endH, uniform_start, uniform_end, uniform_col;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex);
|
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class BillboardShader
|
class BillboardShader
|
||||||
@ -398,7 +398,7 @@ public:
|
|||||||
static GLuint uniform_MVP;
|
static GLuint uniform_MVP;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix);
|
static void setUniforms(const core::matrix4 &ModelMatrix);
|
||||||
};
|
};
|
||||||
|
|
||||||
class DisplaceShader
|
class DisplaceShader
|
||||||
@ -406,10 +406,10 @@ class DisplaceShader
|
|||||||
public:
|
public:
|
||||||
static GLuint Program;
|
static GLuint Program;
|
||||||
static GLuint attrib_position, attrib_texcoord, attrib_second_texcoord;
|
static GLuint attrib_position, attrib_texcoord, attrib_second_texcoord;
|
||||||
static GLuint uniform_MVP, uniform_MV, uniform_displacement_tex, uniform_mask_tex, uniform_color_tex, uniform_dir, uniform_dir2;
|
static GLuint uniform_MVP, uniform_displacement_tex, uniform_mask_tex, uniform_color_tex, uniform_dir, uniform_dir2;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &ModelViewMatrix, const core::vector2df &dir, const core::vector2df &dir2, const core::vector2df &screen, unsigned TU_displacement_tex, unsigned TU_mask_tex, unsigned TU_color_tex);
|
static void setUniforms(const core::matrix4 &ModelMatrix, const core::vector2df &dir, const core::vector2df &dir2, const core::vector2df &screen, unsigned TU_displacement_tex, unsigned TU_mask_tex, unsigned TU_color_tex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SkyboxShader
|
class SkyboxShader
|
||||||
@ -647,7 +647,7 @@ class Gaussian17TapHShader
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
static GLuint Program;
|
||||||
static GLuint uniform_tex, uniform_pixel;
|
static GLuint uniform_tex, uniform_depth, uniform_pixel;
|
||||||
static GLuint vao;
|
static GLuint vao;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
@ -657,7 +657,7 @@ class ComputeGaussian17TapHShader
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
static GLuint Program;
|
||||||
static GLuint uniform_source, uniform_dest;
|
static GLuint uniform_source, uniform_depth, uniform_dest;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
};
|
};
|
||||||
@ -686,7 +686,7 @@ class Gaussian17TapVShader
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
static GLuint Program;
|
||||||
static GLuint uniform_tex, uniform_pixel;
|
static GLuint uniform_tex, uniform_depth, uniform_pixel;
|
||||||
static GLuint vao;
|
static GLuint vao;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
@ -696,7 +696,7 @@ class ComputeGaussian17TapVShader
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
static GLuint Program;
|
||||||
static GLuint uniform_source, uniform_dest;
|
static GLuint uniform_source, uniform_depth, uniform_dest;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
};
|
};
|
||||||
|
@ -27,18 +27,8 @@ void STKAnimatedMesh::cleanGLMeshes()
|
|||||||
GLMesh mesh = GLmeshes[i];
|
GLMesh mesh = GLmeshes[i];
|
||||||
if (!mesh.vertex_buffer)
|
if (!mesh.vertex_buffer)
|
||||||
continue;
|
continue;
|
||||||
if (mesh.vao_first_pass)
|
if (mesh.vao)
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_first_pass));
|
glDeleteVertexArrays(1, &(mesh.vao));
|
||||||
if (mesh.vao_second_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_second_pass));
|
|
||||||
if (mesh.vao_glow_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_glow_pass));
|
|
||||||
if (mesh.vao_displace_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_displace_pass));
|
|
||||||
if (mesh.vao_displace_mask_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_displace_mask_pass));
|
|
||||||
if (mesh.vao_shadow_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_shadow_pass));
|
|
||||||
glDeleteBuffers(1, &(mesh.vertex_buffer));
|
glDeleteBuffers(1, &(mesh.vertex_buffer));
|
||||||
glDeleteBuffers(1, &(mesh.index_buffer));
|
glDeleteBuffers(1, &(mesh.index_buffer));
|
||||||
}
|
}
|
||||||
@ -230,13 +220,13 @@ void STKAnimatedMesh::render()
|
|||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
{
|
{
|
||||||
TransparentMeshes<TM_DEFAULT>::MeshSet.push_back(mesh);
|
TransparentMeshes<TM_DEFAULT>::MeshSet.push_back(mesh);
|
||||||
TransparentMeshes<TM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
TransparentMeshes<TM_DEFAULT>::MVPSet.push_back(AbsoluteTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
{
|
{
|
||||||
TransparentMeshes<TM_ADDITIVE>::MeshSet.push_back(mesh);
|
TransparentMeshes<TM_ADDITIVE>::MeshSet.push_back(mesh);
|
||||||
TransparentMeshes<TM_ADDITIVE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
TransparentMeshes<TM_ADDITIVE>::MVPSet.push_back(AbsoluteTransformation);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,16 +25,10 @@ void STKInstancedSceneNode::cleanGL()
|
|||||||
GLMesh mesh = GLmeshes[i];
|
GLMesh mesh = GLmeshes[i];
|
||||||
if (!mesh.vertex_buffer)
|
if (!mesh.vertex_buffer)
|
||||||
continue;
|
continue;
|
||||||
if (mesh.vao_first_pass)
|
if (mesh.vao)
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_first_pass));
|
glDeleteVertexArrays(1, &(mesh.vao));
|
||||||
if (mesh.vao_second_pass)
|
if (mesh.vao_second_pass)
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_second_pass));
|
glDeleteVertexArrays(1, &(mesh.vao_second_pass));
|
||||||
if (mesh.vao_glow_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_glow_pass));
|
|
||||||
if (mesh.vao_displace_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_displace_pass));
|
|
||||||
if (mesh.vao_displace_mask_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_displace_mask_pass));
|
|
||||||
if (mesh.vao_shadow_pass)
|
if (mesh.vao_shadow_pass)
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_shadow_pass));
|
glDeleteVertexArrays(1, &(mesh.vao_shadow_pass));
|
||||||
glDeleteBuffers(1, &(mesh.vertex_buffer));
|
glDeleteBuffers(1, &(mesh.vertex_buffer));
|
||||||
@ -81,36 +75,33 @@ void STKInstancedSceneNode::initinstancedvaostate(GLMesh &mesh, GeometricMateria
|
|||||||
switch (GeoMat)
|
switch (GeoMat)
|
||||||
{
|
{
|
||||||
case FPSM_DEFAULT:
|
case FPSM_DEFAULT:
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
MeshShader::InstancedObjectPass1Shader::attrib_position, MeshShader::InstancedObjectRefPass1Shader::attrib_texcoord, -1, MeshShader::InstancedObjectPass1Shader::attrib_normal, -1, -1, -1, mesh.Stride);
|
|
||||||
glGenBuffers(1, &instances_vbo);
|
glGenBuffers(1, &instances_vbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
||||||
setInstanceAttribPointer<MeshShader::InstancedObjectPass1Shader, 1>();
|
setInstanceAttribPointer<MeshShader::InstancedObjectPass1Shader, 1>();
|
||||||
if (irr_driver->getGLSLVersion() >= 150)
|
if (irr_driver->getGLSLVersion() >= 150)
|
||||||
{
|
{
|
||||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::InstancedShadowShader::attrib_position, -1, -1, -1, -1, -1, -1, mesh.Stride);
|
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||||
setInstanceAttribPointer<MeshShader::InstancedShadowShader, 4>();
|
setInstanceAttribPointer<MeshShader::InstancedShadowShader, 4>();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FPSM_ALPHA_REF_TEXTURE:
|
case FPSM_ALPHA_REF_TEXTURE:
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
MeshShader::InstancedObjectRefPass1Shader::attrib_position, MeshShader::InstancedObjectRefPass1Shader::attrib_texcoord, -1, MeshShader::InstancedObjectRefPass1Shader::attrib_normal, -1, -1, -1, mesh.Stride);
|
|
||||||
glGenBuffers(1, &instances_vbo);
|
glGenBuffers(1, &instances_vbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
||||||
setInstanceAttribPointer<MeshShader::InstancedObjectRefPass1Shader, 1>();
|
setInstanceAttribPointer<MeshShader::InstancedObjectRefPass1Shader, 1>();
|
||||||
if (irr_driver->getGLSLVersion() >= 150)
|
if (irr_driver->getGLSLVersion() >= 150)
|
||||||
{
|
{
|
||||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::InstancedRefShadowShader::attrib_position, MeshShader::InstancedRefShadowShader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||||
setInstanceAttribPointer<MeshShader::InstancedRefShadowShader, 4>();
|
setInstanceAttribPointer<MeshShader::InstancedRefShadowShader, 4>();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FPSM_GRASS:
|
case FPSM_GRASS:
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
MeshShader::InstancedGrassPass1Shader::attrib_position, MeshShader::InstancedGrassPass1Shader::attrib_texcoord, -1, MeshShader::InstancedGrassPass1Shader::attrib_normal, -1, -1, MeshShader::InstancedGrassPass1Shader::attrib_color, mesh.Stride);
|
|
||||||
glGenBuffers(1, &instances_vbo);
|
glGenBuffers(1, &instances_vbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
||||||
@ -125,20 +116,17 @@ void STKInstancedSceneNode::initinstancedvaostate(GLMesh &mesh, GeometricMateria
|
|||||||
switch (ShadedMat)
|
switch (ShadedMat)
|
||||||
{
|
{
|
||||||
case SM_DEFAULT:
|
case SM_DEFAULT:
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
MeshShader::InstancedObjectPass2Shader::attrib_position, MeshShader::InstancedObjectPass2Shader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||||
setInstanceAttribPointer<MeshShader::InstancedObjectPass2Shader, 1>();
|
setInstanceAttribPointer<MeshShader::InstancedObjectPass2Shader, 1>();
|
||||||
break;
|
break;
|
||||||
case SM_ALPHA_REF_TEXTURE:
|
case SM_ALPHA_REF_TEXTURE:
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
MeshShader::InstancedObjectRefPass2Shader::attrib_position, MeshShader::InstancedObjectRefPass2Shader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||||
setInstanceAttribPointer<MeshShader::InstancedObjectRefPass2Shader, 1>();
|
setInstanceAttribPointer<MeshShader::InstancedObjectRefPass2Shader, 1>();
|
||||||
break;
|
break;
|
||||||
case SM_GRASS:
|
case SM_GRASS:
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
MeshShader::InstancedGrassPass2Shader::attrib_position, MeshShader::InstancedGrassPass2Shader::attrib_texcoord, -1, MeshShader::InstancedGrassPass2Shader::attrib_normal, -1, -1, MeshShader::InstancedGrassPass2Shader::attrib_color, mesh.Stride);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||||
setInstanceAttribPointer<MeshShader::InstancedGrassPass2Shader, 1>();
|
setInstanceAttribPointer<MeshShader::InstancedGrassPass2Shader, 1>();
|
||||||
break;
|
break;
|
||||||
|
@ -56,54 +56,80 @@ TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE typ
|
|||||||
return TM_DEFAULT;
|
return TM_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint createVAO(GLuint vbo, GLuint idx, GLuint attrib_position, GLuint attrib_texcoord, GLuint attrib_second_texcoord, GLuint attrib_normal, GLuint attrib_tangent, GLuint attrib_bitangent, GLuint attrib_color, size_t stride)
|
video::E_VERTEX_TYPE getVTXTYPEFromStride(size_t stride)
|
||||||
|
{
|
||||||
|
if (stride == sizeof(video::S3DVertex))
|
||||||
|
return video::EVT_STANDARD;
|
||||||
|
else if (stride == sizeof(video::S3DVertex2TCoords))
|
||||||
|
return video::EVT_2TCOORDS;
|
||||||
|
assert(stride == sizeof(video::S3DVertexTangents));
|
||||||
|
return video::EVT_TANGENTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLuint createVAO(GLuint vbo, GLuint idx, video::E_VERTEX_TYPE type)
|
||||||
{
|
{
|
||||||
if (attrib_position == -1)
|
|
||||||
return 0;
|
|
||||||
GLuint vao;
|
GLuint vao;
|
||||||
glGenVertexArrays(1, &vao);
|
glGenVertexArrays(1, &vao);
|
||||||
glBindVertexArray(vao);
|
glBindVertexArray(vao);
|
||||||
|
assert(vbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
glEnableVertexAttribArray(attrib_position);
|
switch (type)
|
||||||
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)
|
case video::EVT_STANDARD:
|
||||||
Log::error("material", "Second texcoords not present in VBO");
|
// Position
|
||||||
glVertexAttribPointer(attrib_second_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 36);
|
glEnableVertexAttribArray(0);
|
||||||
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), 0);
|
||||||
|
// Normal
|
||||||
|
glEnableVertexAttribArray(1);
|
||||||
|
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)12);
|
||||||
|
// Color
|
||||||
|
glEnableVertexAttribArray(2);
|
||||||
|
glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, getVertexPitchFromType(type), (GLvoid*)24);
|
||||||
|
// Texcoord
|
||||||
|
glEnableVertexAttribArray(3);
|
||||||
|
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)28);
|
||||||
|
break;
|
||||||
|
case video::EVT_2TCOORDS:
|
||||||
|
// Position
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), 0);
|
||||||
|
// Normal
|
||||||
|
glEnableVertexAttribArray(1);
|
||||||
|
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)12);
|
||||||
|
// Color
|
||||||
|
glEnableVertexAttribArray(2);
|
||||||
|
glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, getVertexPitchFromType(type), (GLvoid*)24);
|
||||||
|
// Texcoord
|
||||||
|
glEnableVertexAttribArray(3);
|
||||||
|
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)28);
|
||||||
|
// SecondTexcoord
|
||||||
|
glEnableVertexAttribArray(4);
|
||||||
|
glVertexAttribPointer(4, 2, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)36);
|
||||||
|
break;
|
||||||
|
case video::EVT_TANGENTS:
|
||||||
|
// Position
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), 0);
|
||||||
|
// Normal
|
||||||
|
glEnableVertexAttribArray(1);
|
||||||
|
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)12);
|
||||||
|
// Color
|
||||||
|
glEnableVertexAttribArray(2);
|
||||||
|
glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, getVertexPitchFromType(type), (GLvoid*)24);
|
||||||
|
// Texcoord
|
||||||
|
glEnableVertexAttribArray(3);
|
||||||
|
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)28);
|
||||||
|
// Tangent
|
||||||
|
glEnableVertexAttribArray(5);
|
||||||
|
glVertexAttribPointer(5, 3, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)36);
|
||||||
|
// Bitangent
|
||||||
|
glEnableVertexAttribArray(6);
|
||||||
|
glVertexAttribPointer(6, 3, GL_FLOAT, GL_FALSE, getVertexPitchFromType(type), (GLvoid*)48);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(0 && "Wrong vertex type");
|
||||||
}
|
}
|
||||||
if ((GLint)attrib_normal != -1)
|
assert(idx);
|
||||||
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);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idx);
|
||||||
return vao;
|
return vao;
|
||||||
}
|
}
|
||||||
@ -124,6 +150,7 @@ GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb)
|
|||||||
result.Stride = getVertexPitchFromType(vType);
|
result.Stride = getVertexPitchFromType(vType);
|
||||||
const c8* vbuf = static_cast<const c8*>(vertices);
|
const c8* vbuf = static_cast<const c8*>(vertices);
|
||||||
glBufferData(GL_ARRAY_BUFFER, vertexCount * result.Stride, vbuf, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, vertexCount * result.Stride, vbuf, GL_STATIC_DRAW);
|
||||||
|
assert(vertexCount);
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, result.index_buffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, result.index_buffer);
|
||||||
const void* indices = mb->getIndices();
|
const void* indices = mb->getIndices();
|
||||||
@ -224,8 +251,8 @@ void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
|
|||||||
|
|
||||||
MeshShader::GrassPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, windDir, 0);
|
MeshShader::GrassPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, windDir, 0);
|
||||||
|
|
||||||
assert(mesh.vao_first_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_first_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,8 +277,8 @@ void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelMatrix, const c
|
|||||||
setTexture(MeshShader::SphereMapShader::TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::SphereMapShader::TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::SphereMapShader::setUniforms(ModelMatrix, InverseModelMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
MeshShader::SphereMapShader::setUniforms(ModelMatrix, InverseModelMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,8 +357,8 @@ void drawSplatting(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionM
|
|||||||
|
|
||||||
MeshShader::SplattingShader::setUniforms(ModelViewProjectionMatrix);
|
MeshShader::SplattingShader::setUniforms(ModelViewProjectionMatrix);
|
||||||
|
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,8 +384,8 @@ void drawObjectRefPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjec
|
|||||||
|
|
||||||
MeshShader::ObjectRefPass2Shader::setUniforms(ModelViewProjectionMatrix, TextureMatrix);
|
MeshShader::ObjectRefPass2Shader::setUniforms(ModelViewProjectionMatrix, TextureMatrix);
|
||||||
|
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,8 +413,8 @@ void drawGrassPass2(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
|
|||||||
|
|
||||||
MeshShader::GrassPass2Shader::setUniforms(ModelViewProjectionMatrix, windDir);
|
MeshShader::GrassPass2Shader::setUniforms(ModelViewProjectionMatrix, windDir);
|
||||||
|
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,8 +427,8 @@ void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
|||||||
|
|
||||||
MeshShader::UntexturedObjectShader::setUniforms(ModelMatrix);
|
MeshShader::UntexturedObjectShader::setUniforms(ModelMatrix);
|
||||||
|
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,8 +454,8 @@ void drawObjectRimLimit(const GLMesh &mesh, const core::matrix4 &ModelViewProjec
|
|||||||
|
|
||||||
MeshShader::ObjectRimLimitShader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix);
|
MeshShader::ObjectRimLimitShader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix);
|
||||||
|
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,8 +481,8 @@ void drawObjectUnlit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectio
|
|||||||
|
|
||||||
MeshShader::ObjectUnlitShader::setUniforms(ModelViewProjectionMatrix);
|
MeshShader::ObjectUnlitShader::setUniforms(ModelViewProjectionMatrix);
|
||||||
|
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,8 +510,8 @@ void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelView
|
|||||||
|
|
||||||
MeshShader::DetailledObjectPass2Shader::setUniforms(ModelViewProjectionMatrix);
|
MeshShader::DetailledObjectPass2Shader::setUniforms(ModelViewProjectionMatrix);
|
||||||
|
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,8 +537,8 @@ void drawObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectio
|
|||||||
|
|
||||||
MeshShader::ObjectPass2Shader::setUniforms(ModelViewProjectionMatrix, TextureMatrix);
|
MeshShader::ObjectPass2Shader::setUniforms(ModelViewProjectionMatrix, TextureMatrix);
|
||||||
|
|
||||||
assert(mesh.vao_second_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_second_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,8 +554,8 @@ void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewPro
|
|||||||
|
|
||||||
MeshShader::TransparentShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, 0);
|
MeshShader::TransparentShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, 0);
|
||||||
|
|
||||||
assert(mesh.vao_first_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_first_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,8 +589,8 @@ void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelView
|
|||||||
glUseProgram(MeshShader::TransparentFogShader::Program);
|
glUseProgram(MeshShader::TransparentFogShader::Program);
|
||||||
MeshShader::TransparentFogShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, fogmax, startH, endH, start, end, col, Camera::getCamera(0)->getCameraSceneNode()->getAbsolutePosition(), 0);
|
MeshShader::TransparentFogShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, fogmax, startH, endH, start, end, col, Camera::getCamera(0)->getCameraSceneNode()->getAbsolutePosition(), 0);
|
||||||
|
|
||||||
assert(mesh.vao_first_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_first_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,8 +609,8 @@ void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatr
|
|||||||
|
|
||||||
MeshShader::BubbleShader::setUniforms(ModelViewProjectionMatrix, 0, time, transparency);
|
MeshShader::BubbleShader::setUniforms(ModelViewProjectionMatrix, 0, time, transparency);
|
||||||
|
|
||||||
assert(mesh.vao_first_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_first_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,8 +625,8 @@ void drawShadowRef(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
|||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
MeshShader::RefShadowShader::setUniforms(ModelMatrix, 0);
|
MeshShader::RefShadowShader::setUniforms(ModelMatrix, 0);
|
||||||
|
|
||||||
assert(mesh.vao_shadow_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_shadow_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElementsInstanced(ptype, count, itype, 0, 4);
|
glDrawElementsInstanced(ptype, count, itype, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,8 +639,8 @@ void drawShadow(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
|||||||
|
|
||||||
MeshShader::ShadowShader::setUniforms(ModelMatrix);
|
MeshShader::ShadowShader::setUniforms(ModelMatrix);
|
||||||
|
|
||||||
assert(mesh.vao_shadow_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_shadow_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElementsInstanced(ptype, count, itype, 0, 4);
|
glDrawElementsInstanced(ptype, count, itype, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,104 +683,11 @@ bool isObject(video::E_MATERIAL_TYPE type)
|
|||||||
|
|
||||||
void initvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat)
|
void initvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat)
|
||||||
{
|
{
|
||||||
switch (GeoMat)
|
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
{
|
|
||||||
case FPSM_DEFAULT:
|
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::ObjectPass1Shader::attrib_position, MeshShader::ObjectPass1Shader::attrib_texcoord, -1, MeshShader::ObjectPass1Shader::attrib_normal, -1, -1, -1, mesh.Stride);
|
|
||||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::ShadowShader::attrib_position, -1, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
mesh.vao_rsm_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::RSMShader::attrib_position, MeshShader::RSMShader::attrib_texcoord, -1, MeshShader::RSMShader::attrib_normal, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case FPSM_ALPHA_REF_TEXTURE:
|
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::ObjectRefPass1Shader::attrib_position, MeshShader::ObjectRefPass1Shader::attrib_texcoord, -1, MeshShader::ObjectRefPass1Shader::attrib_normal, -1, -1, -1, mesh.Stride);
|
|
||||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::RefShadowShader::attrib_position, MeshShader::RefShadowShader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case FPSM_NORMAL_MAP:
|
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::NormalMapShader::attrib_position, MeshShader::NormalMapShader::attrib_texcoord, -1, -1, MeshShader::NormalMapShader::attrib_tangent, MeshShader::NormalMapShader::attrib_bitangent, -1, mesh.Stride);
|
|
||||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::ShadowShader::attrib_position, -1, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case FPSM_GRASS:
|
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::GrassPass1Shader::attrib_position, MeshShader::GrassPass1Shader::attrib_texcoord, -1, MeshShader::GrassPass1Shader::attrib_normal, -1, -1, MeshShader::GrassPass1Shader::attrib_color, mesh.Stride);
|
|
||||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::GrassShadowShader::attrib_position, MeshShader::GrassShadowShader::attrib_texcoord, -1, -1, -1, -1, MeshShader::GrassShadowShader::attrib_color, mesh.Stride);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(0 && "Unknow material");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (ShadedMat)
|
|
||||||
{
|
|
||||||
case SM_SPHEREMAP:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::SphereMapShader::attrib_position, -1, -1, MeshShader::SphereMapShader::attrib_normal, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case SM_SPLATTING:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::SplattingShader::attrib_position, MeshShader::SplattingShader::attrib_texcoord, MeshShader::SplattingShader::attrib_second_texcoord, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case SM_ALPHA_REF_TEXTURE:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::ObjectRefPass2Shader::attrib_position, MeshShader::ObjectRefPass2Shader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case SM_RIMLIT:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::ObjectRimLimitShader::attrib_position, MeshShader::ObjectRimLimitShader::attrib_texcoord, -1, MeshShader::ObjectRimLimitShader::attrib_normal, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case SM_GRASS:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::GrassPass2Shader::attrib_position, MeshShader::GrassPass2Shader::attrib_texcoord, -1, -1, -1, -1, MeshShader::GrassPass2Shader::attrib_color, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case SM_UNLIT:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::ObjectUnlitShader::attrib_position, MeshShader::ObjectUnlitShader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case SM_DETAILS:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::DetailledObjectPass2Shader::attrib_position, MeshShader::DetailledObjectPass2Shader::attrib_texcoord, MeshShader::DetailledObjectPass2Shader::attrib_second_texcoord, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case SM_UNTEXTURED:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::UntexturedObjectShader::attrib_position, -1, -1, -1, -1, -1, MeshShader::UntexturedObjectShader::attrib_color, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case SM_DEFAULT:
|
|
||||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::ObjectPass2Shader::attrib_position, MeshShader::ObjectPass2Shader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(0 && "unknow shaded material");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
mesh.vao_glow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::ColorizeShader::attrib_position, -1, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
mesh.vao_displace_mask_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::DisplaceShader::attrib_position, -1, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
if (mesh.Stride >= 44)
|
|
||||||
mesh.vao_displace_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::DisplaceShader::attrib_position, MeshShader::DisplaceShader::attrib_texcoord, MeshShader::DisplaceShader::attrib_second_texcoord, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initvaostate(GLMesh &mesh, TransparentMaterial TranspMat)
|
void initvaostate(GLMesh &mesh, TransparentMaterial TranspMat)
|
||||||
{
|
{
|
||||||
switch (TranspMat)
|
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
{
|
|
||||||
case TM_BUBBLE:
|
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::BubbleShader::attrib_position, MeshShader::BubbleShader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
break;
|
|
||||||
case TM_DEFAULT:
|
|
||||||
case TM_ADDITIVE:
|
|
||||||
if (World::getWorld() != NULL && 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
|
|
||||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
|
||||||
MeshShader::TransparentShader::attrib_position, MeshShader::TransparentShader::attrib_texcoord, -1, -1, -1, -1, MeshShader::TransparentShader::attrib_color, mesh.Stride);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
mesh.vao_glow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::ColorizeShader::attrib_position, -1, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
mesh.vao_displace_mask_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::DisplaceShader::attrib_position, -1, -1, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
if (mesh.Stride >= 44)
|
|
||||||
mesh.vao_displace_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::DisplaceShader::attrib_position, MeshShader::DisplaceShader::attrib_texcoord, MeshShader::DisplaceShader::attrib_second_texcoord, -1, -1, -1, -1, mesh.Stride);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ enum TransparentMaterial
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct GLMesh {
|
struct GLMesh {
|
||||||
|
GLuint vao;
|
||||||
GLuint vao_first_pass;
|
GLuint vao_first_pass;
|
||||||
GLuint vao_second_pass;
|
GLuint vao_second_pass;
|
||||||
GLuint vao_glow_pass;
|
GLuint vao_glow_pass;
|
||||||
@ -59,8 +60,9 @@ struct GLMesh {
|
|||||||
core::matrix4 TextureMatrix;
|
core::matrix4 TextureMatrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
GLuint createVAO(GLuint vbo, GLuint idx, GLuint attrib_position, GLuint attrib_texcoord, GLuint attrib_second_texcoord, GLuint attrib_normal, GLuint attrib_tangent, GLuint attrib_bitangent, GLuint attrib_color, size_t stride);
|
|
||||||
GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb);
|
GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb);
|
||||||
|
video::E_VERTEX_TYPE getVTXTYPEFromStride(size_t stride);
|
||||||
|
GLuint createVAO(GLuint vbo, GLuint idx, video::E_VERTEX_TYPE type);
|
||||||
void initvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat);
|
void initvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat);
|
||||||
void initvaostate(GLMesh &mesh, TransparentMaterial TranspMat);
|
void initvaostate(GLMesh &mesh, TransparentMaterial TranspMat);
|
||||||
core::matrix4 computeMVP(const core::matrix4 &ModelViewProjectionMatrix);
|
core::matrix4 computeMVP(const core::matrix4 &ModelViewProjectionMatrix);
|
||||||
|
@ -82,18 +82,8 @@ void STKMeshSceneNode::cleanGLMeshes()
|
|||||||
GLMesh mesh = GLmeshes[i];
|
GLMesh mesh = GLmeshes[i];
|
||||||
if (!mesh.vertex_buffer)
|
if (!mesh.vertex_buffer)
|
||||||
continue;
|
continue;
|
||||||
if (mesh.vao_first_pass)
|
if (mesh.vao)
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_first_pass));
|
glDeleteVertexArrays(1, &(mesh.vao));
|
||||||
if (mesh.vao_second_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_second_pass));
|
|
||||||
if (mesh.vao_glow_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_glow_pass));
|
|
||||||
if (mesh.vao_displace_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_displace_pass));
|
|
||||||
if (mesh.vao_displace_mask_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_displace_mask_pass));
|
|
||||||
if (mesh.vao_shadow_pass)
|
|
||||||
glDeleteVertexArrays(1, &(mesh.vao_shadow_pass));
|
|
||||||
glDeleteBuffers(1, &(mesh.vertex_buffer));
|
glDeleteBuffers(1, &(mesh.vertex_buffer));
|
||||||
glDeleteBuffers(1, &(mesh.index_buffer));
|
glDeleteBuffers(1, &(mesh.index_buffer));
|
||||||
}
|
}
|
||||||
@ -126,8 +116,8 @@ void STKMeshSceneNode::drawGlow(const GLMesh &mesh)
|
|||||||
|
|
||||||
MeshShader::ColorizeShader::setUniforms(AbsoluteTransformation, cb->getRed(), cb->getGreen(), cb->getBlue());
|
MeshShader::ColorizeShader::setUniforms(AbsoluteTransformation, cb->getRed(), cb->getGreen(), cb->getBlue());
|
||||||
|
|
||||||
assert(mesh.vao_glow_pass);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_glow_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,19 +131,14 @@ void STKMeshSceneNode::drawDisplace(const GLMesh &mesh)
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
ModelViewProjectionMatrix = computeMVP(AbsoluteTransformation);
|
|
||||||
core::matrix4 ModelViewMatrix = irr_driver->getViewMatrix();
|
|
||||||
ModelViewMatrix *= AbsoluteTransformation;
|
|
||||||
|
|
||||||
// Generate displace mask
|
// Generate displace mask
|
||||||
// Use RTT_TMP4 as displace mask
|
// Use RTT_TMP4 as displace mask
|
||||||
irr_driver->getFBO(FBO_TMP1_WITH_DS).Bind();
|
irr_driver->getFBO(FBO_TMP1_WITH_DS).Bind();
|
||||||
|
|
||||||
glUseProgram(MeshShader::DisplaceMaskShader::Program);
|
glUseProgram(MeshShader::DisplaceMaskShader::Program);
|
||||||
MeshShader::DisplaceMaskShader::setUniforms(ModelViewProjectionMatrix);
|
MeshShader::DisplaceMaskShader::setUniforms(AbsoluteTransformation);
|
||||||
|
|
||||||
assert(mesh.vao_displace_mask_pass);
|
glBindVertexArray(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao_displace_mask_pass);
|
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
|
|
||||||
// Render the effect
|
// Render the effect
|
||||||
@ -164,15 +149,13 @@ void STKMeshSceneNode::drawDisplace(const GLMesh &mesh)
|
|||||||
setTexture(1, irr_driver->getRenderTargetTexture(RTT_TMP1), GL_LINEAR, GL_LINEAR, true);
|
setTexture(1, irr_driver->getRenderTargetTexture(RTT_TMP1), GL_LINEAR, GL_LINEAR, true);
|
||||||
setTexture(2, irr_driver->getRenderTargetTexture(RTT_COLOR), GL_LINEAR, GL_LINEAR, true);
|
setTexture(2, irr_driver->getRenderTargetTexture(RTT_COLOR), GL_LINEAR, GL_LINEAR, true);
|
||||||
glUseProgram(MeshShader::DisplaceShader::Program);
|
glUseProgram(MeshShader::DisplaceShader::Program);
|
||||||
MeshShader::DisplaceShader::setUniforms(ModelViewProjectionMatrix, ModelViewMatrix,
|
MeshShader::DisplaceShader::setUniforms(AbsoluteTransformation,
|
||||||
core::vector2df(cb->getDirX(), cb->getDirY()),
|
core::vector2df(cb->getDirX(), cb->getDirY()),
|
||||||
core::vector2df(cb->getDir2X(), cb->getDir2Y()),
|
core::vector2df(cb->getDir2X(), cb->getDir2Y()),
|
||||||
core::vector2df(float(UserConfigParams::m_width),
|
core::vector2df(float(UserConfigParams::m_width),
|
||||||
float(UserConfigParams::m_height)),
|
float(UserConfigParams::m_height)),
|
||||||
0, 1, 2);
|
0, 1, 2);
|
||||||
|
|
||||||
assert(mesh.vao_displace_pass);
|
|
||||||
glBindVertexArray(mesh.vao_displace_pass);
|
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,13 +403,13 @@ void STKMeshSceneNode::render()
|
|||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
{
|
{
|
||||||
TransparentMeshes<TM_DEFAULT>::MeshSet.push_back(mesh);
|
TransparentMeshes<TM_DEFAULT>::MeshSet.push_back(mesh);
|
||||||
TransparentMeshes<TM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
TransparentMeshes<TM_DEFAULT>::MVPSet.push_back(AbsoluteTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
{
|
{
|
||||||
TransparentMeshes<TM_ADDITIVE>::MeshSet.push_back(mesh);
|
TransparentMeshes<TM_ADDITIVE>::MeshSet.push_back(mesh);
|
||||||
TransparentMeshes<TM_ADDITIVE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
TransparentMeshes<TM_ADDITIVE>::MVPSet.push_back(AbsoluteTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TransparentMesh[TM_BUBBLE].empty())
|
if (!TransparentMesh[TM_BUBBLE].empty())
|
||||||
|
@ -662,6 +662,7 @@ namespace GUIEngine
|
|||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "guiengine/event_handler.hpp"
|
#include "guiengine/event_handler.hpp"
|
||||||
#include "guiengine/modaldialog.hpp"
|
#include "guiengine/modaldialog.hpp"
|
||||||
|
#include "guiengine/message_queue.hpp"
|
||||||
#include "guiengine/scalable_font.hpp"
|
#include "guiengine/scalable_font.hpp"
|
||||||
#include "guiengine/screen.hpp"
|
#include "guiengine/screen.hpp"
|
||||||
#include "guiengine/skin.hpp"
|
#include "guiengine/skin.hpp"
|
||||||
@ -1189,6 +1190,8 @@ namespace GUIEngine
|
|||||||
// further render)
|
// further render)
|
||||||
g_env->drawAll();
|
g_env->drawAll();
|
||||||
|
|
||||||
|
MessageQueue::update(elapsed_time);
|
||||||
|
|
||||||
// ---- some menus may need updating
|
// ---- some menus may need updating
|
||||||
if (gamestate != GAME)
|
if (gamestate != GAME)
|
||||||
{
|
{
|
||||||
|
180
src/guiengine/message_queue.cpp
Executable file
180
src/guiengine/message_queue.cpp
Executable file
@ -0,0 +1,180 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2014 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.
|
||||||
|
/**
|
||||||
|
\page addons Addons
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "guiengine/message_queue.hpp"
|
||||||
|
|
||||||
|
#include "config/user_config.hpp"
|
||||||
|
#include "guiengine/engine.hpp"
|
||||||
|
#include "guiengine/scalable_font.hpp"
|
||||||
|
#include "guiengine/skin.hpp"
|
||||||
|
|
||||||
|
#include "IGUIElement.h"
|
||||||
|
|
||||||
|
using namespace GUIEngine;
|
||||||
|
|
||||||
|
namespace MessageQueue
|
||||||
|
{
|
||||||
|
|
||||||
|
/** A small helper class to store and sort messages to be displayed. */
|
||||||
|
class Message
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/** The type of the message. */
|
||||||
|
MessageQueue::MessageType m_message_type;
|
||||||
|
/** The message. */
|
||||||
|
core::stringw m_message;
|
||||||
|
|
||||||
|
/** The render type of the message: either achievement-message::neutral
|
||||||
|
* or friend-message::neutral. */
|
||||||
|
std::string m_render_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Message(MessageQueue::MessageType mt, const core::stringw &message)
|
||||||
|
{
|
||||||
|
m_message_type = mt;
|
||||||
|
m_message = message;
|
||||||
|
if(mt==MessageQueue::MT_ACHIEVEMENT)
|
||||||
|
m_render_type = "achievement-message::neutral";
|
||||||
|
else
|
||||||
|
m_render_type = "friend-message::neutral";
|
||||||
|
} // Message
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the message. */
|
||||||
|
const core::stringw & getMessage() const { return m_message; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the type of the message (achievement or friend). */
|
||||||
|
MessageQueue::MessageType getMessageType() const { return m_message_type; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the render type: either achievement-message::neutral or
|
||||||
|
* friend-message::neutral (see skin for details). */
|
||||||
|
const std::string &getRenderType() const
|
||||||
|
{
|
||||||
|
return m_render_type;
|
||||||
|
}
|
||||||
|
}; // class Message
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
/** A function class to compare messages, required for priority_queue. */
|
||||||
|
class CompareMessages
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Used to sort messages by priority in the priority queue. Achievement
|
||||||
|
* messages (1) need to have a higher priority than friend messages
|
||||||
|
* (value 0). */
|
||||||
|
bool operator() (const Message *a, const Message *b) const
|
||||||
|
{
|
||||||
|
return a->getMessageType() < b->getMessageType();
|
||||||
|
} // operator ()
|
||||||
|
}; // operator()
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
/** List of all messages. */
|
||||||
|
std::priority_queue<Message*, std::vector<Message*>,
|
||||||
|
CompareMessages> g_all_messages;
|
||||||
|
|
||||||
|
/** How long the current message has been displayed. The special value
|
||||||
|
* -1 indicates that a new message was added when the queue was empty. */
|
||||||
|
float g_current_display_time = -1.0f;
|
||||||
|
|
||||||
|
/** How long the current message should be displaed. */
|
||||||
|
float g_max_display_time = -1.0f;
|
||||||
|
|
||||||
|
/** The label widget used to show the current message. */
|
||||||
|
SkinWidgetContainer *g_container = NULL;
|
||||||
|
core::recti g_area;
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
void createLabel(const Message *message)
|
||||||
|
{
|
||||||
|
if(!g_container)
|
||||||
|
g_container = new SkinWidgetContainer();
|
||||||
|
|
||||||
|
gui::ScalableFont *font = GUIEngine::getFont();
|
||||||
|
core::dimension2du dim = font->getDimension(message->getMessage().c_str());
|
||||||
|
g_current_display_time = 0.0f;
|
||||||
|
// Maybe make this time dependent on message length as well?
|
||||||
|
g_max_display_time = 5.0f;
|
||||||
|
const GUIEngine::BoxRenderParams &brp =
|
||||||
|
GUIEngine::getSkin()->getBoxRenderParams(message->getRenderType());
|
||||||
|
dim.Width +=brp.m_left_border + brp.m_right_border;
|
||||||
|
int x = (UserConfigParams::m_width - dim.Width) / 2;
|
||||||
|
int y = UserConfigParams::m_height - int(1.5f*dim.Height);
|
||||||
|
g_area = irr::core::recti(x, y, x+dim.Width, y+dim.Height);
|
||||||
|
} // createLabel
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Adds a message to the message queue.
|
||||||
|
* \param mt The MessageType of the message.
|
||||||
|
* \param message The actual message.
|
||||||
|
*/
|
||||||
|
void add(MessageType mt, const irr::core::stringw &message)
|
||||||
|
{
|
||||||
|
Message *m = new Message(mt, message);
|
||||||
|
if(g_all_messages.size()==0)
|
||||||
|
{
|
||||||
|
// Indicate that there is a new message, which should
|
||||||
|
// which needs a new label etc. to be computed.
|
||||||
|
g_current_display_time =-1.0f;
|
||||||
|
}
|
||||||
|
g_all_messages.push(m);
|
||||||
|
} // add
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Update function called from the GUIEngine to handle displaying of the
|
||||||
|
* messages. It will make sure that each message is shown for a certain
|
||||||
|
* amount of time, before it is discarded and the next message (if any)
|
||||||
|
* is displayed.
|
||||||
|
* \param dt Time step size.
|
||||||
|
*/
|
||||||
|
void update(float dt)
|
||||||
|
{
|
||||||
|
if(g_all_messages.size()==0) return;
|
||||||
|
|
||||||
|
g_current_display_time += dt;
|
||||||
|
if(g_current_display_time > g_max_display_time)
|
||||||
|
{
|
||||||
|
Message *last = g_all_messages.top();
|
||||||
|
g_all_messages.pop();
|
||||||
|
delete last;
|
||||||
|
if(g_all_messages.size()==0) return;
|
||||||
|
g_current_display_time = -1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new data for the display.
|
||||||
|
if(g_current_display_time < 0)
|
||||||
|
{
|
||||||
|
createLabel(g_all_messages.top());
|
||||||
|
}
|
||||||
|
|
||||||
|
Message *current = g_all_messages.top();
|
||||||
|
GUIEngine::getSkin()->drawMessage(g_container, g_area,
|
||||||
|
current->getRenderType());
|
||||||
|
gui::ScalableFont *font = GUIEngine::getFont();
|
||||||
|
|
||||||
|
video::SColor color(255, 0, 0, 0);
|
||||||
|
font->draw(current->getMessage(), g_area, color, true, true);
|
||||||
|
|
||||||
|
} // update
|
||||||
|
|
||||||
|
} // namespace GUIEngine
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
43
src/guiengine/message_queue.hpp
Normal file
43
src/guiengine/message_queue.hpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
//
|
||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2014 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_MESSAGE_QUEUE_HPP
|
||||||
|
#define HEADER_MESSAGE_QUEUE_HPP
|
||||||
|
|
||||||
|
#include "guiengine/widgets/label_widget.hpp"
|
||||||
|
|
||||||
|
#include "irrString.h"
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace irr;
|
||||||
|
|
||||||
|
namespace MessageQueue
|
||||||
|
{
|
||||||
|
/** The various message type which can be shown (which might use a
|
||||||
|
* different look. This type is used to sort the messages, so it is
|
||||||
|
* important that messages that need to be shown as early as possible
|
||||||
|
* will be listed last (i.e. have highest priority). */
|
||||||
|
enum MessageType {MT_FRIEND, MT_ACHIEVEMENT};
|
||||||
|
|
||||||
|
void add(MessageType mt, const core::stringw &message);
|
||||||
|
void update(float dt);
|
||||||
|
|
||||||
|
}; // namespace GUIEngine
|
||||||
|
#endif
|
@ -373,6 +373,28 @@ void Skin::drawBgImage()
|
|||||||
irr_driver->getVideoDriver()->enableMaterial2D(false);
|
irr_driver->getVideoDriver()->enableMaterial2D(false);
|
||||||
} // drawBgImage
|
} // drawBgImage
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Returns the BoxRenderParams data structure for a given type.
|
||||||
|
* \param type The type name of the box render param to get.
|
||||||
|
*/
|
||||||
|
const BoxRenderParams& Skin::getBoxRenderParams(const std::string &type)
|
||||||
|
{
|
||||||
|
return SkinConfig::m_render_params[type];
|
||||||
|
} // getBoxRenderParams
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Draws a background box for an in-game notification message. Example would
|
||||||
|
* be an achievement, or friends comming online.
|
||||||
|
* \param w The SkinWidgetContainer for the outline.
|
||||||
|
* \param dest The destination rectangle to use.
|
||||||
|
* \param type The type of the message (achievement or friend).
|
||||||
|
*/
|
||||||
|
void Skin::drawMessage(SkinWidgetContainer* w, const core::recti &dest,
|
||||||
|
const std::string &type)
|
||||||
|
{
|
||||||
|
drawBoxFromStretchableTexture(w, dest, SkinConfig::m_render_params[type]);
|
||||||
|
} // drawMessage
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w,
|
void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w,
|
||||||
const core::recti &dest,
|
const core::recti &dest,
|
||||||
|
@ -270,9 +270,7 @@ namespace GUIEngine
|
|||||||
video::ITexture* bg_image;
|
video::ITexture* bg_image;
|
||||||
std::vector<Widget*> m_tooltips;
|
std::vector<Widget*> m_tooltips;
|
||||||
std::vector<bool> m_tooltip_at_mouse;
|
std::vector<bool> m_tooltip_at_mouse;
|
||||||
#ifdef USE_PER_LINE_BACKGROUND
|
|
||||||
public:
|
|
||||||
#endif
|
|
||||||
LEAK_CHECK()
|
LEAK_CHECK()
|
||||||
|
|
||||||
void drawBoxFromStretchableTexture(SkinWidgetContainer* w,
|
void drawBoxFromStretchableTexture(SkinWidgetContainer* w,
|
||||||
@ -396,10 +394,11 @@ namespace GUIEngine
|
|||||||
virtual const wchar_t*
|
virtual const wchar_t*
|
||||||
getDefaultText(gui::EGUI_DEFAULT_TEXT text) const;
|
getDefaultText(gui::EGUI_DEFAULT_TEXT text) const;
|
||||||
virtual gui::IGUIFont* getFont(gui::EGUI_DEFAULT_FONT which=
|
virtual gui::IGUIFont* getFont(gui::EGUI_DEFAULT_FONT which=
|
||||||
gui::EGDF_DEFAULT) const ;
|
gui::EGDF_DEFAULT) const;
|
||||||
virtual u32 getIcon (gui::EGUI_DEFAULT_ICON icon) const ;
|
virtual u32 getIcon (gui::EGUI_DEFAULT_ICON icon) const;
|
||||||
virtual s32 getSize (gui::EGUI_DEFAULT_SIZE size) const ;
|
virtual s32 getSize (gui::EGUI_DEFAULT_SIZE size) const;
|
||||||
virtual gui::IGUISpriteBank * getSpriteBank () const ;
|
const BoxRenderParams& getBoxRenderParams(const std::string &type);
|
||||||
|
virtual gui::IGUISpriteBank * getSpriteBank () const;
|
||||||
virtual void setColor (gui::EGUI_DEFAULT_COLOR which,
|
virtual void setColor (gui::EGUI_DEFAULT_COLOR which,
|
||||||
video::SColor newColor);
|
video::SColor newColor);
|
||||||
virtual void setDefaultText (gui::EGUI_DEFAULT_TEXT which,
|
virtual void setDefaultText (gui::EGUI_DEFAULT_TEXT which,
|
||||||
@ -411,6 +410,8 @@ namespace GUIEngine
|
|||||||
virtual void setSpriteBank (gui::IGUISpriteBank *bank);
|
virtual void setSpriteBank (gui::IGUISpriteBank *bank);
|
||||||
|
|
||||||
void drawTooltips();
|
void drawTooltips();
|
||||||
|
void drawMessage(SkinWidgetContainer* w, const core::recti &dest,
|
||||||
|
const std::string &type);
|
||||||
|
|
||||||
video::ITexture* getImage(const char* name);
|
video::ITexture* getImage(const char* name);
|
||||||
|
|
||||||
|
@ -2540,6 +2540,8 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
|||||||
|
|
||||||
center_shift.setY(m_skidding->getGraphicalJumpOffset() + lean_height
|
center_shift.setY(m_skidding->getGraphicalJumpOffset() + lean_height
|
||||||
- m_kart_model->getLowestPoint() -chassis_delta );
|
- m_kart_model->getLowestPoint() -chassis_delta );
|
||||||
|
center_shift = getTrans().getBasis() * center_shift;
|
||||||
|
|
||||||
float heading = m_skidding->getVisualSkidRotation();
|
float heading = m_skidding->getVisualSkidRotation();
|
||||||
Moveable::updateGraphics(dt, center_shift,
|
Moveable::updateGraphics(dt, center_shift,
|
||||||
btQuaternion(heading, 0, m_current_lean));
|
btQuaternion(heading, 0, m_current_lean));
|
||||||
|
@ -176,7 +176,7 @@ void MainLoop::run()
|
|||||||
|
|
||||||
PROFILER_SYNC_FRAME();
|
PROFILER_SYNC_FRAME();
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
} // while !m_exit
|
} // while !m_abort
|
||||||
|
|
||||||
} // run
|
} // run
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ void World::resetAllKarts()
|
|||||||
{
|
{
|
||||||
if (count++ > 100)
|
if (count++ > 100)
|
||||||
{
|
{
|
||||||
Log::error("World", "Infitine loop waiting for all_finished?");
|
Log::error("World", "Infinite loop waiting for all_finished?");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_physics->update(1.f/60.f);
|
m_physics->update(1.f/60.f);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "achievements/achievements_manager.hpp"
|
#include "achievements/achievements_manager.hpp"
|
||||||
#include "config/player_manager.hpp"
|
#include "config/player_manager.hpp"
|
||||||
#include "config/user_config.hpp"
|
#include "config/user_config.hpp"
|
||||||
#include "guiengine/dialog_queue.hpp"
|
#include "guiengine/message_queue.hpp"
|
||||||
#include "guiengine/screen.hpp"
|
#include "guiengine/screen.hpp"
|
||||||
#include "online/online_profile.hpp"
|
#include "online/online_profile.hpp"
|
||||||
#include "online/profile_manager.hpp"
|
#include "online/profile_manager.hpp"
|
||||||
@ -379,11 +379,7 @@ namespace Online
|
|||||||
message = _("%d friends are now online.",
|
message = _("%d friends are now online.",
|
||||||
to_notify.size());
|
to_notify.size());
|
||||||
}
|
}
|
||||||
NotificationDialog *dia =
|
MessageQueue::add(MessageQueue::MT_FRIEND, message);
|
||||||
new NotificationDialog(NotificationDialog::T_Friends,
|
|
||||||
message);
|
|
||||||
GUIEngine::DialogQueue::get()->pushDialog(dia, false);
|
|
||||||
OnlineProfileFriends::getInstance()->refreshFriendsList();
|
|
||||||
}
|
}
|
||||||
else if(went_offline)
|
else if(went_offline)
|
||||||
{
|
{
|
||||||
@ -422,10 +418,7 @@ namespace Online
|
|||||||
{
|
{
|
||||||
message = _("You have a new friend request!");
|
message = _("You have a new friend request!");
|
||||||
}
|
}
|
||||||
NotificationDialog *dia =
|
MessageQueue::add(MessageQueue::MT_FRIEND, message);
|
||||||
new NotificationDialog(NotificationDialog::T_Friends,
|
|
||||||
message);
|
|
||||||
GUIEngine::DialogQueue::get()->pushDialog(dia, false);
|
|
||||||
OnlineProfileFriends::getInstance()->refreshFriendsList();
|
OnlineProfileFriends::getInstance()->refreshFriendsList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,12 +101,6 @@ private:
|
|||||||
video::ITexture *m_kart_icon;
|
video::ITexture *m_kart_icon;
|
||||||
/** The times of all karts in the right order. */
|
/** The times of all karts in the right order. */
|
||||||
core::stringw m_finish_time_string;
|
core::stringw m_finish_time_string;
|
||||||
#ifdef USE_PER_LINE_BACKGROUND
|
|
||||||
/** For the background bar behind each line. */
|
|
||||||
GUIEngine::SkinWidgetContainer m_widget_container;
|
|
||||||
/** The parameter for rendering the background box. */
|
|
||||||
GUIEngine::BoxRenderParams m_box_params;
|
|
||||||
#endif
|
|
||||||
}; // Rowinfo
|
}; // Rowinfo
|
||||||
|
|
||||||
/** The team icons. */
|
/** The team icons. */
|
||||||
|
@ -368,6 +368,9 @@ void TrackObjectPresentationMesh::init(const XMLNode* xml_node, scene::ISceneNod
|
|||||||
m_node = irr_driver->addMesh(m_mesh, parent);
|
m_node = irr_driver->addMesh(m_mesh, parent);
|
||||||
m_frame_start = 0;
|
m_frame_start = 0;
|
||||||
m_frame_end = 0;
|
m_frame_end = 0;
|
||||||
|
|
||||||
|
if (World::getWorld() != NULL && World::getWorld()->getTrack() != NULL)
|
||||||
|
World::getWorld()->getTrack()->handleAnimatedTextures(m_node, *xml_node);
|
||||||
}
|
}
|
||||||
//#ifdef DEBUG
|
//#ifdef DEBUG
|
||||||
// std::string debug_name = model_name+" (track-object)";
|
// std::string debug_name = model_name+" (track-object)";
|
||||||
|
27
tools/simplify_challenges.sh
Executable file
27
tools/simplify_challenges.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script simplifies all challenges by removing any time
|
||||||
|
# limit, position requirement, etc, and setting the number
|
||||||
|
# of laps to 0. This is meant to quickly test the story
|
||||||
|
# mode without having to fully play all challenges.
|
||||||
|
|
||||||
|
for i in data/challenges/*.challenge; do
|
||||||
|
echo "Simplifying $i"
|
||||||
|
cat $i | sed 's/position="[0-9]*"/position="99"/' \
|
||||||
|
| sed 's/laps="[0-9]*"/laps="0"/' \
|
||||||
|
| sed 's/energy="[0-9]*"/energy="0"/' \
|
||||||
|
| sed 's/time="[0-9]*"/time="9999"/' \
|
||||||
|
> $i.new
|
||||||
|
mv $i.new $i
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in data/grandprix/*.grandprix; do
|
||||||
|
echo "Simplyfing GP $i"
|
||||||
|
cat $i | sed 's/laps="[0-9]*"/laps="0"/' > $i.new
|
||||||
|
mv $i.new $i
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
echo "All challenges simplified."
|
||||||
|
echo "PLEASE do not commit the changes back to our repository!"
|
||||||
|
echo "========================================================"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user