Merge branch 'upstream/master' into fixes

This commit is contained in:
Flakebi
2014-12-19 23:02:41 +01:00
184 changed files with 2462 additions and 1822 deletions

1
.gitignore vendored
View File

@@ -44,3 +44,4 @@ src/html
packets_log.txt
history.dat
README.dependencies
xx

View File

@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDezCCAmOgAwIBAgIJAO+A8uXtEMRsMA0GCSqGSIb3DQEBCwUAMFQxCzAJBgNV
BAYTAlVTMQwwCgYDVQQIDANTVEsxFTATBgNVBAoMDFN1cGVyVHV4S2FydDEgMB4G
A1UEAwwXYWRkb25zLnN1cGVydHV4a2FydC5uZXQwHhcNMTQxMjEwMTEzMTAwWhcN
MjQxMjA3MTEzMTAwWjBUMQswCQYDVQQGEwJVUzEMMAoGA1UECAwDU1RLMRUwEwYD
VQQKDAxTdXBlclR1eEthcnQxIDAeBgNVBAMMF2FkZG9ucy5zdXBlcnR1eGthcnQu
bmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2ysZE9rb4y0tHOhk
wxYpqsvDv5LCRFTAeyfAfyBVDcOn+4A3sX8MkQdoH/QDi823z4bn9ZsGV8T444FN
S4yK/aSRv3eAKkkJm5TUxbs3crATVt3JYusMr5W4wHvRVyDe0DlulSdW4EUEklMP
iPat/jwlDZRvZueio3wJoOhZXnl8E8EfnuYtlNONIB1nYGdUHD9xeNyKSPr4zTEp
brjvSw0l5G88LmQOROQBDbTDknAcIQwsFT1mf9Bt+N9LK14r95GWRmL3ZtfbrJn4
ZEfkOjl0Abv6gET4sQOXv0KioUdEJwzFCwKFLZVcuOrscmcHBOhgD3EruVvprIJ0
wZ3z1wIDAQABo1AwTjAdBgNVHQ4EFgQUmQwaPsD+ylVUUsUXMAYpUlnVbNwwHwYD
VR0jBBgwFoAUmQwaPsD+ylVUUsUXMAYpUlnVbNwwDAYDVR0TBAUwAwEB/zANBgkq
hkiG9w0BAQsFAAOCAQEASyl6BMpnZhJlirDL84/RkVeVjBkr7x68UFAblmKjgfGg
pRbYPNSld0IrfZ4pcrDAUkg9WJb0Zxuh0oYiV+RjdW/6s5mF/qiSv8V60xb2myRd
z90ZGfhB5SAECI5zfIZSmsMjOEjKjuz8S26aEtJe8Vq7GF2P7/889lfNXrbvIkZX
HQpx2P+T07zy++6Ca/K2vmWcf1a+GrN+o0nZTYbz/2r/JJwXdWqT1ZmtEA9GNwvZ
J8HhgvspgjgVP/EURUUhOaQ8zfhriU5CJAIuhMhzW7oOBPHxxtxme3auAfxi5zpK
wRNluCayrrjhy2I8mABRnBqgMwAQUIrgk9IU6SyQxw==
-----END CERTIFICATE-----

View File

@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<challenge version="2">
<track id="islandtrack" laps="3"/>
<track id="20_island" laps="3"/>
<mode major="single" minor="quickrace"/>
<requirements trophies="95"/>

View File

@@ -1,19 +1,19 @@
<?xml version="1.0"?>
<challenge version="2">
<track id="jungle" laps="3"/>
<track id="30_chocolate" laps="3"/>
<mode major="single" minor="quickrace"/>
<requirements trophies="15"/>
<hard>
<karts number="5"/>
<requirements position="1" time="155"/>
<requirements position="1" time="161"/>
</hard>
<medium>
<karts number="4"/>
<requirements time="170"/>
<requirements time="177"/>
</medium>
<easy>
<karts number="4"/>
<requirements time="230"/>
<requirements time="240"/>
</easy>
</challenge>

View File

@@ -6,11 +6,11 @@
<hard>
<karts number="1"/>
<requirements energy="16" time="167"/>
<requirements energy="18" time="167"/>
</hard>
<medium>
<karts number="1"/>
<requirements energy="12" time="185"/>
<requirements energy="15" time="185"/>
</medium>
<easy>
<karts number="1"/>

View File

@@ -20,8 +20,8 @@
max="1000" />
<!-- Size of the particles -->
<size min="0.5"
max="0.3"
<size min="0.3"
max="0.5"
x-increase-factor="2.6"
y-increase-factor="2.6" />

View File

@@ -1,7 +1,7 @@
<supertuxkart_grand_prix name="Off the beaten track">
<track id="jungle" laps="3" reverse="false" />
<track id="30_chocolate" laps="3" reverse="false" />
<track id="snowmountain" laps="3" reverse="false" />
<track id="hacienda" laps="3" reverse="false" />
<track id="zengarden" laps="4" reverse="false" />

View File

@@ -1,7 +1,7 @@
<supertuxkart_grand_prix name="To the moon and back">
<track id="islandtrack" laps="3" reverse="false" />
<track id="20_island" laps="3" reverse="false" />
<track id="greenvalley" laps="2" reverse="false" />
<track id="mansion" laps="3" reverse="false" />
<track id="startrack" laps="3" reverse="false" />

View File

@@ -3,6 +3,7 @@
<card is="Intel(R) HD Graphics 3000" os="windows" version="<9.17.11" disable="a b c"/>
<card contains="NVIDIA" os="windows" version="<344.65" disable="BufferStorage"/>
<card contains="NVIDIA" os="linux" version="<343.22" disable="BufferStorage"/>
<card contains="Mesa" os="linux" version="<10.3" disable="BufferStorage"/>
<card is="Intel(R) HD Graphics 3000" os="osx" version="<=9.17.10" disable="a b c"/>
<card is="" os="bsd" version="<1.2.3" disable="a b c"/>

View File

@@ -2,37 +2,37 @@
<stkgui>
<div x="2%" y="10%" width="96%" height="80%" layout="vertical-row" >
<div proportion="1" width="100%" layout="horizontal-row">
<label id="Red" text="Red"/>
<label id="Red" raw_text="Red"/>
<spacer width="25"/>
<gauge id="red_slider" min_value="0" max_value="100" proportion="1"/>
</div>
<div proportion="1" width="100%" layout="horizontal-row">
<label id="Green" text="Green"/>
<label id="Green" raw_text="Green"/>
<spacer width="25"/>
<gauge id="green_slider" min_value="0" max_value="100" proportion="1"/>
</div>
<div proportion="1" width="100%" layout="horizontal-row">
<label id="Blue" text="Blue"/>
<label id="Blue" raw_text="Blue"/>
<spacer width="25"/>
<gauge id="blue_slider" min_value="0" max_value="100" proportion="1"/>
</div>
<div proportion="1" width="100%" layout="horizontal-row">
<label id="SSAO radius" text="SSAO Radius"/>
<label id="SSAO radius" raw_text="SSAO Radius"/>
<spacer width="50"/>
<gauge id="ssao_radius" min_value="0" max_value="100" proportion="1" />
</div>
<div proportion="1" width="100%" layout="horizontal-row">
<label id="SSAO k" text="SSAO K"/>
<label id="SSAO k" raw_text="SSAO K"/>
<spacer width="25"/>
<gauge id="ssao_k" min_value="0" max_value="100" proportion="1"/>
</div>
<div proportion="1" width="100%" layout="horizontal-row">
<label id="SSAO Sigma" text="SSAO sigma"/>
<label id="SSAO Sigma" raw_text="SSAO sigma"/>
<spacer width="50"/>
<gauge id="ssao_sigma" min_value="0" max_value="100" proportion="1"/>
</div>

View File

@@ -11,10 +11,10 @@
<textbox id="textfield" width="75%" I18N="In the 'add new grand prix' dialog" align="center"/>
<spacer height="20" width="20" />
<button id="cancel" I18N="In the 'add new grand prix' dialog" text="Press ESC to cancel" align="center"/>
<button id="accept" I18N="In the 'add new grand prix' dialog" text="Create" align="center" proportion="1"/>
<spacer height="15" width="20" />
<button id="cancel" I18N="In the 'add new grand prix' dialog" text="Cancel" align="center" proportion="1"/>
</div>
</stkgui>

View File

@@ -40,17 +40,17 @@
<buttonbar id="menu_bottomrow" x="0" y="0" width="38%" height="100%" align="center">
<icon-button id="test_gpwin" width="64" height="64" icon="gui/main_options.png" extend_label="50"
text="TEST: GPWin" label_location="hover"/>
raw_text="TEST: GPWin" label_location="hover"/>
<icon-button id="test_gplose" width="64" height="64" icon="gui/main_options.png" extend_label="50"
text="TEST: GPLose" label_location="hover"/>
raw_text="TEST: GPLose" label_location="hover"/>
<icon-button id="test_unlocked" width="64" height="64" icon="gui/main_options.png" extend_label="50"
text="TEST: Unlocked" label_location="hover"/>
raw_text="TEST: Unlocked" label_location="hover"/>
<icon-button id="test_unlocked2" width="64" height="64" icon="gui/main_options.png" extend_label="50"
text="TEST: Unlocked 2" label_location="hover"/>
raw_text="TEST: Unlocked 2" label_location="hover"/>
<icon-button id="test_intro" width="64" height="64" icon="gui/main_options.png" extend_label="50"
text="TEST: Intro" label_location="hover"/>
raw_text="TEST: Intro" label_location="hover"/>
<icon-button id="test_outro" width="64" height="64" icon="gui/main_options.png" extend_label="50"
text="TEST: Outro" label_location="hover"/>
raw_text="TEST: Outro" label_location="hover"/>
<icon-button id="options" width="64" height="64" icon="gui/main_options.png" extend_label="50"
I18N="In the main screen" text="Options" label_location="hover"/>
<icon-button id="help" width="64" height="64" icon="gui/main_help.png" extend_label="50"

View File

@@ -22,10 +22,10 @@
<div id="search_div" height="fit" width="100%" layout="vertical-row">
<spacer width="10" height="10"/>
<box height="fit" width="100%" layout="vertical-row">
<label height="fit" text_align="left" I18N="In the profile screen" text="Look for more friends:"/>
<label text_align="left" I18N="In the profile screen" text="Look for more friends:"/>
<spacer width="10" height="10"/>
<div height="fit" width="100%" layout="horizontal-row" align="center">
<textbox id="search_box" proportion="1" height="fit"/>
<textbox id="search_box" proportion="1"/>
<spacer width="10" height="100%"/>
<button id="search_button" height="100%" width="fit" text="Search" />
</div>

View File

@@ -53,8 +53,7 @@
-->
<label id="info" height="20%" width="100%" align="center" text_align="center" word_wrap="true"
I18N="In the registration dialog"
text="You can play without creating an online account by unchecking the online checkbox, though then you can not connect to friends, vote for addons etc. You can also use an existing SuperTuxKart Addons account in the next screen if you already have one. Please read our privacy statement at http://privacy.supertuxkart.net"/>
text="You can play without creating an online account by unchecking the online checkbox, though then you can not connect to friends, vote for addons etc. Please read our privacy statement at http://privacy.supertuxkart.net"/>
</div>
<buttonbar id="options" width="40%" height="15%" align="center">

View File

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

File diff suppressed because it is too large Load Diff

26
data/shaders/IBL.frag Normal file
View File

@@ -0,0 +1,26 @@
uniform sampler2D ntex;
uniform sampler2D dtex;
out vec4 Diff;
out vec4 Spec;
vec3 DecodeNormal(vec2 n);
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
vec3 DiffuseIBL(vec3 normal);
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness);
void main(void)
{
vec2 uv = gl_FragCoord.xy / screen;
vec3 normal = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
Diff = vec4(0.25 * DiffuseIBL(normal), 1.);
float z = texture(dtex, uv).x;
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
vec3 eyedir = -normalize(xpos.xyz);
float specval = texture(ntex, uv).z;
Spec = vec4(.25 * SpecularIBL(normal, eyedir, specval), 1.);
}

View File

@@ -3,7 +3,7 @@
uniform sampler2D source;
uniform sampler2D depth;
uniform vec2 pixel;
uniform layout(size1x16) volatile restrict writeonly image2D dest;
uniform layout(r16f) volatile restrict writeonly image2D dest;
uniform float sigma = 5.;
layout (local_size_x = 8, local_size_y = 8) in;

View File

@@ -3,7 +3,7 @@
uniform sampler2D source;
uniform sampler2D depth;
uniform vec2 pixel;
uniform layout(size1x16) volatile restrict writeonly image2D dest;
uniform layout(r16f) volatile restrict writeonly image2D dest;
uniform float sigma = 5.;
layout (local_size_x = 8, local_size_y = 8) in;

View File

@@ -1,7 +1,7 @@
uniform sampler2D source;
uniform layout(r32f) restrict writeonly image2D dest;
uniform vec2 pixel;
uniform float sigma;
uniform float weights[7];
// Gaussian separated blur with radius 6.
@@ -23,18 +23,10 @@ void main()
barrier();
float g0, g1, g2;
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
g1 = exp(-0.5 / (sigma * sigma));
g2 = g1 * g1;
float sum = local_src[x + 6][y] * g0;
g0 *= g1;
g1 *= g2;
float sum = local_src[x + 6][y] * weights[0];
for (int i = 1; i < 6; i++) {
sum += local_src[6 + x - i][y] * g0;
sum += local_src[6 + x + i][y] * g0;
g0 *= g1;
g1 *= g2;
sum += local_src[6 + x - i][y] * weights[i];
sum += local_src[6 + x + i][y] * weights[i];
}
imageStore(dest, iuv, vec4(sum));

View File

@@ -1,7 +1,7 @@
uniform sampler2D source;
uniform layout(r32f) restrict writeonly image2D dest;
uniform vec2 pixel;
uniform float sigma;
uniform float weights[7];
// Gaussian separated blur with radius 6.
@@ -23,18 +23,10 @@ void main()
barrier();
float g0, g1, g2;
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
g1 = exp(-0.5 / (sigma * sigma));
g2 = g1 * g1;
float sum = local_src[x][y + 6] * g0;
g0 *= g1;
g1 *= g2;
float sum = local_src[x][y + 6] * weights[0];
for (int i = 1; i < 6; i++) {
sum += local_src[x][6 + y - i] * g0;
sum += local_src[x][6 + y + i] * g0;
g0 *= g1;
g1 *= g2;
sum += local_src[x][6 + y - i] * weights[i];
sum += local_src[x][6 + y + i] * weights[i];
}
imageStore(dest, iuv, vec4(sum));

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D Albedo;
layout(bindless_sampler) uniform sampler2D Detail;
layout(bindless_sampler) uniform sampler2D SpecMap;
@@ -23,7 +23,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
void main(void)
{
vec4 color = texture(Albedo, uv);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
#ifdef SRGBBindlessFix
color.xyz = pow(color.xyz, vec3(2.2));
#endif

View File

@@ -1,58 +0,0 @@
uniform float blueLmn[9];
uniform float greenLmn[9];
uniform float redLmn[9];
uniform sampler2D ntex;
uniform sampler2D dtex;
uniform samplerCube tex;
uniform mat4 TransposeViewMatrix;
out vec4 Diff;
out vec4 Spec;
vec3 DecodeNormal(vec2 n);
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
mat4 getMatrix(float L[9])
{
float c1 = 0.429043, c2 = 0.511664, c3 = 0.743125, c4 = 0.886227, c5 = 0.247708;
return mat4(
c1 * L[8] /*L22*/, c1 * L[4] /*L2-2*/, c1 * L[7] /*L21*/, c2 * L[3] /*L11*/,
c1 * L[4], - c1 * L[8], c1 * L[5] /*L2-1*/, c2 * L[1] /*L1-1*/,
c1 * L[7], c1 * L[5], c3 * L[6] /*L20*/, c2 * L[2] /*L10*/,
c2 * L[3], c2 * L[1], c2 * L[2], c4 * L[0] /*L00*/ - c5 * L[6]
);
}
void main(void)
{
vec2 uv = gl_FragCoord.xy / screen;
vec3 normal = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
// Convert normal in world space (where SH coordinates were computed)
vec4 extendednormal = TransposeViewMatrix * vec4(normal, 0.);
extendednormal.w = 1.;
mat4 rmat = getMatrix(redLmn);
mat4 gmat = getMatrix(greenLmn);
mat4 bmat = getMatrix(blueLmn);
float r = dot(extendednormal, rmat * extendednormal);
float g = dot(extendednormal, gmat * extendednormal);
float b = dot(extendednormal, bmat * extendednormal);
Diff = max(0.25 * vec4(r, g, b, .1), vec4(0.));
float z = texture(dtex, uv).x;
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
vec3 eyedir = -normalize(xpos.xyz);
vec3 sampleDirection = reflect(-eyedir, normal);
sampleDirection = (InverseViewMatrix * vec4(sampleDirection, 0.)).xyz;
float specval = texture(ntex, uv).z;
// From http://graphics.cs.williams.edu/papers/EnvMipReport2013/
int texSize = textureSize(tex, 0).x;
float lodval = clamp(log2(texSize * sqrt(3.)) - .5 * log2(specval + 1.), 0., 10.);
vec4 specular = textureLod(tex, sampleDirection, lodval);
Spec = max(specular, vec4(0.));
}

View File

@@ -1,6 +1,6 @@
uniform int idx;
in vec3 Position;
layout(location = 0) in vec3 Position;
void main(void)
{

View File

@@ -1,7 +1,7 @@
uniform sampler2D source;
uniform layout(rgba16f) restrict writeonly image2D dest;
uniform vec2 pixel;
uniform float sigma;
uniform float weights[7];
// Gaussian separated blur with radius 6.
@@ -23,18 +23,10 @@ void main()
barrier();
float g0, g1, g2;
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
g1 = exp(-0.5 / (sigma * sigma));
g2 = g1 * g1;
vec4 sum = local_src[x + 6][y] * g0;
g0 *= g1;
g1 *= g2;
vec4 sum = local_src[x + 6][y] * weights[0];
for (int i = 1; i < 6; i++) {
sum += local_src[6 + x - i][y] * g0;
sum += local_src[6 + x + i][y] * g0;
g0 *= g1;
g1 *= g2;
sum += local_src[6 + x - i][y] * weights[i];
sum += local_src[6 + x + i][y] * weights[i];
}
imageStore(dest, iuv, sum);

View File

@@ -1,7 +1,7 @@
uniform sampler2D source;
uniform layout(rgba16f) restrict writeonly image2D dest;
uniform vec2 pixel;
uniform float sigma;
uniform float weights[7];
// Gaussian separated blur with radius 6.
@@ -23,18 +23,10 @@ void main()
barrier();
float g0, g1, g2;
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
g1 = exp(-0.5 / (sigma * sigma));
g2 = g1 * g1;
vec4 sum = local_src[x][y + 6] * g0;
g0 *= g1;
g1 *= g2;
vec4 sum = local_src[x][y + 6] * weights[0];
for (int i = 1; i < 6; i++) {
sum += local_src[x][6 + y - i] * g0;
sum += local_src[x][6 + y + i] * g0;
g0 *= g1;
g1 *= g2;
sum += local_src[x][6 + y - i] * weights[i];
sum += local_src[x][6 + y + i] * weights[i];
}
imageStore(dest, iuv, sum);

View File

@@ -9,7 +9,6 @@ uniform sampler3D SHR;
uniform sampler3D SHG;
uniform sampler3D SHB;
uniform float R_wcs = 10.;
uniform vec3 extents;
uniform mat4 RHMatrix;
uniform mat4 InvRHMatrix;

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D Albedo;
layout(bindless_sampler) uniform sampler2D dtex;
layout(bindless_sampler) uniform sampler2D SpecMap;
@@ -8,8 +8,6 @@ uniform sampler2D dtex;
uniform sampler2D SpecMap;
#endif
uniform vec3 SunDir;
in vec3 nor;
in vec2 uv;
out vec4 FragColor;
@@ -19,7 +17,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
void main(void)
{
vec4 color = texture(Albedo, uv);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
#ifdef SRGBBindlessFix
color.xyz = pow(color.xyz, vec3(2.2));
#endif
@@ -35,10 +33,11 @@ void main(void)
vec3 eyedir = normalize(xpos.xyz);
// Inspired from http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html
float fEdotL = max(0., dot(SunDir, eyedir));
vec3 L = normalize((transpose(InverseViewMatrix) * vec4(sun_direction, 0.)).xyz);
float fEdotL = clamp(dot(L, eyedir), 0., 1.);
float fPowEdotL = pow(fEdotL, 4.);
float fLdotNBack = max(0., - dot(nor, SunDir) * 0.6 + 0.4);
float fLdotNBack = max(0., - dot(nor, L) * 0.6 + 0.4);
float scattering = mix(fPowEdotL, fLdotNBack, .5);
float specmap = texture(SpecMap, uv).g;

View File

@@ -5,6 +5,14 @@ uniform mat4 InverseViewMatrix;
uniform mat4 InverseProjectionMatrix;
uniform mat4 ProjectionViewMatrix;
uniform vec2 screen;
uniform vec3 sun_direction;
uniform vec3 sun_col;
uniform float sun_angle;
uniform float blueLmn[9];
uniform float greenLmn[9];
uniform float redLmn[9];
#else
layout (std140) uniform MatrixesData
{
@@ -16,4 +24,41 @@ layout (std140) uniform MatrixesData
mat4 ShadowViewProjMatrixes[4];
vec2 screen;
};
// Expand because of catalyst (14.12) not correctly associating array in UBO
layout (std140) uniform LightingData
{
vec3 sun_direction;
vec3 sun_col;
float sun_angle;
float bL00;
float bL1m1;
float bL10;
float bL11;
float bL2m2;
float bL2m1;
float bL20;
float bL21;
float bL22;
float gL00;
float gL1m1;
float gL10;
float gL11;
float gL2m2;
float gL2m1;
float gL20;
float gL21;
float gL22;
float rL00;
float rL1m1;
float rL10;
float rL11;
float rL2m2;
float rL2m1;
float rL20;
float rL21;
float rL22;
};
#endif

View File

@@ -0,0 +1,33 @@
uniform samplerCube tex;
uniform samplerBuffer samples;
uniform float ViewportSize;
uniform mat4 PermutationMatrix;
out vec4 FragColor;
void main(void)
{
vec2 uv = gl_FragCoord.xy / ViewportSize;
vec3 RayDir = 2. * vec3(uv, 1.) - 1.;
RayDir = normalize((PermutationMatrix * vec4(RayDir, 0.)).xyz);
vec4 FinalColor = vec4(0.);
vec3 up = (RayDir.y < .99) ? vec3(0., 1., 0.) : vec3(0., 0., 1.);
vec3 Tangent = normalize(cross(up, RayDir));
vec3 Bitangent = cross(RayDir, Tangent);
float weight = 0.;
for (int i = 0; i < 1024; i++)
{
float Theta = texelFetch(samples, i).r;
float Phi = texelFetch(samples, i).g;
vec3 L = cos(Theta) * RayDir + sin(Theta) * cos(Phi) * Tangent + sin(Theta) * sin(Phi) * Bitangent;
float NdotL = clamp(dot(RayDir, L), 0., 1.);
FinalColor += textureLod(tex, L, 0.) * NdotL;
weight += NdotL;
}
FragColor = FinalColor / weight;
}

View File

@@ -1,10 +1,10 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D Albedo;
uniform sampler2D Detail;
uniform sampler2D SpecMap;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
flat in sampler2D thirdhandle;
@@ -17,7 +17,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
void main(void)
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 color = texture(handle, uv);
float specmap = texture(secondhandle, uv).g;
#ifdef SRGBBindlessFix

View File

@@ -9,7 +9,7 @@ layout(location = 3) in vec2 Texcoord;
layout(location = 7) in vec3 Origin;
layout(location = 8) in vec3 Orientation;
layout(location = 9) in vec3 Scale;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(location = 10) in sampler2D Handle;
layout(location = 11) in sampler2D SecondHandle;
#endif
@@ -27,7 +27,7 @@ in vec3 Scale;
out vec3 nor;
out vec2 uv;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat out sampler2D handle;
flat out sampler2D secondhandle;
#endif
@@ -42,7 +42,7 @@ void main()
gl_Position = ProjectionViewMatrix * ModelMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
uv = Texcoord;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
handle = Handle;
secondhandle = SecondHandle;
#endif

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D dtex;
#else
uniform sampler2D Albedo;
@@ -6,9 +6,7 @@ uniform sampler2D SpecMap;
uniform sampler2D dtex;
#endif
uniform vec3 SunDir;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
#endif
@@ -20,7 +18,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
void main(void)
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 color = texture(handle, uv);
float specmap = texture(secondhandle, uv).g;
#ifdef SRGBBindlessFix
@@ -41,10 +39,11 @@ void main(void)
vec3 eyedir = normalize(xpos.xyz);
// Inspired from http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html
float fEdotL = max(0., dot(SunDir, eyedir));
vec3 L = normalize((transpose(InverseViewMatrix) * vec4(sun_direction, 0.)).xyz);
float fEdotL = clamp(dot(L, eyedir), 0., 1.);
float fPowEdotL = pow(fEdotL, 4.);
float fLdotNBack = max(0., - dot(nor, SunDir) * 0.6 + 0.4);
float fLdotNBack = max(0., - dot(nor, L) * 0.6 + 0.4);
float scattering = mix(fPowEdotL, fLdotNBack, .5);

View File

@@ -1,9 +1,9 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D normalMap;
uniform sampler2D glossMap;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D secondhandle;
flat in sampler2D thirdhandle;
#endif
@@ -17,7 +17,7 @@ vec2 EncodeNormal(vec3 n);
void main()
{
// normal in Tangent Space
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec3 TS_normal = 2.0 * texture(thirdhandle, uv).rgb - 1.0;
float gloss = texture(secondhandle, uv).x;
#else
@@ -31,5 +31,5 @@ void main()
vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent - TS_normal.z * Frag_normal;
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(FragmentNormal)) + 0.5;
EncodedNormal.z = exp2(10. * gloss + 1.);
EncodedNormal.z = gloss;
}

View File

@@ -10,7 +10,7 @@ layout(location = 6) in vec3 Bitangent;
layout(location = 7) in vec3 Origin;
layout(location = 8) in vec3 Orientation;
layout(location = 9) in vec3 Scale;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(location = 10) in sampler2D Handle;
layout(location = 11) in sampler2D SecondHandle;
layout(location = 13) in sampler2D ThirdHandle;
@@ -21,6 +21,7 @@ in vec3 Position;
in vec3 Normal;
in vec4 Color;
in vec2 Texcoord;
in vec2 SecondTexcoord;
in vec3 Tangent;
in vec3 Bitangent;
@@ -35,7 +36,7 @@ out vec3 bitangent;
out vec2 uv;
out vec2 uv_bis;
out vec4 color;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat out sampler2D handle;
flat out sampler2D secondhandle;
flat out sampler2D thirdhandle;
@@ -55,7 +56,7 @@ void main(void)
uv = Texcoord;
uv_bis = SecondTexcoord;
color = Color.zyxw;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
handle = Handle;
secondhandle = SecondHandle;
thirdhandle = ThirdHandle;

View File

@@ -1,8 +1,8 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D glosstex;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D secondhandle;
#endif
in vec3 nor;
@@ -13,11 +13,11 @@ vec2 EncodeNormal(vec3 n);
void main(void)
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
float glossmap = texture(secondhandle, uv).x;
#else
float glossmap = texture(glosstex, uv).x;
#endif
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
EncodedNormal.z = exp2(10. * glossmap + 1.);
EncodedNormal.z = glossmap;
}

View File

@@ -1,9 +1,9 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D Albedo;
uniform sampler2D SpecMap;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
#endif
@@ -15,7 +15,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
void main(void)
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 col = texture(handle, uv);
float specmap = texture(secondhandle, uv).g;
float emitmap = texture(secondhandle, uv).b;

View File

@@ -1,8 +1,8 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D tex;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D handle;
#endif
@@ -12,7 +12,7 @@ out vec4 FragColor;
void main(void)
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 col = texture(handle, uv);
#ifdef SRGBBindlessFix
col.xyz = pow(col.xyz, vec3(2.2));

View File

@@ -1,10 +1,10 @@
// See http://www.ozone3d.net/tutorials/glsl_texturing_p04.php for ref
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D tex;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D handle;
#endif
in vec3 nor;
@@ -21,7 +21,7 @@ void main() {
float m = 2.0 * sqrt(r.x * r.x + r.y * r.y + (r.z + 1.0) * (r.z + 1.0));
r.y = - r.y;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 detail0 = texture(handle, r.xy / m + .5);
#ifdef SRGBBindlessFix
detail0.xyz = pow(detail0.xyz, vec3(2.2));

View File

@@ -1,9 +1,9 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D tex;
uniform sampler2D glosstex;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
#endif
@@ -14,7 +14,7 @@ out vec3 EncodedNormal;
vec2 EncodeNormal(vec3 n);
void main() {
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 col = texture(handle, uv);
float glossmap = texture(secondhandle, uv).x;
#else
@@ -24,6 +24,6 @@ void main() {
if (col.a < 0.5)
discard;
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
EncodedNormal.z = exp2(10. * glossmap + 1.);
EncodedNormal.z = glossmap;
}

View File

@@ -1,9 +1,9 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D Albedo;
uniform sampler2D SpecMap;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in sampler2D handle;
flat in sampler2D secondhandle;
#endif
@@ -15,7 +15,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
void main(void)
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 col = texture(handle, uv);
float specmap = texture(secondhandle, uv).g;
#ifdef SRGBBindlessFix

View File

@@ -1,11 +1,11 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D tex;
#endif
in vec2 uv;
in vec3 nor;
in vec4 color;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in uvec2 handle;
#endif
layout (location = 0) out vec3 RSMColor;
@@ -13,7 +13,7 @@ layout (location = 1) out vec3 RSMNormals;
void main()
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 col = texture(sampler2D(handle), uv);
#ifdef SRGBBindlessFix
col.xyz = pow(col.xyz, vec3(2.2));

View File

@@ -8,7 +8,7 @@ layout(location = 4) in vec2 SecondTexcoord;
layout(location = 7) in vec3 Origin;
layout(location = 8) in vec3 Orientation;
layout(location = 9) in vec3 Scale;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(location = 10) in uvec2 Handle;
#endif
@@ -16,7 +16,7 @@ out vec3 nor;
out vec2 uv;
out vec2 uv_bis;
out vec4 color;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat out uvec2 handle;
#endif
@@ -33,7 +33,7 @@ void main(void)
nor = (TransposeInverseModel * vec4(Normal, 0.)).xyz;
uv = Texcoord;
color = Color.zyxw;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
handle = Handle;
#endif
}

View File

@@ -1,21 +1,21 @@
layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in uvec2 hdle[3];
#endif
in vec2 tc[3];
in int layerId[3];
out vec2 uv;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
out flat uvec2 handle;
#endif
void main(void)
{
gl_Layer = layerId[0];
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
handle = hdle[0];
#endif
for(int i=0; i<3; i++)

View File

@@ -1,8 +1,8 @@
#ifndef GL_ARB_bindless_texture
#ifndef Use_Bindless_Texture
uniform sampler2D tex;
#endif
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat in uvec2 handle;
#endif
in vec2 uv;
@@ -11,7 +11,7 @@ out vec4 FragColor;
void main(void)
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 col = texture(sampler2D(handle), uv);
#else
vec4 col = texture(tex, uv);

View File

@@ -9,7 +9,7 @@ layout(location = 3) in vec2 Texcoord;
layout(location = 7) in vec3 Origin;
layout(location = 8) in vec3 Orientation;
layout(location = 9) in vec3 Scale;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(location = 10) in uvec2 Handle;
#endif
@@ -25,13 +25,13 @@ in vec3 Scale;
#ifdef VSLayer
out vec2 uv;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat out uvec2 handle;
#endif
#else
out vec2 tc;
out int layerId;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat out uvec2 hdle;
#endif
#endif
@@ -46,14 +46,14 @@ void main(void)
gl_Layer = layer;
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + windDir * Color.r, 1.);
uv = Texcoord;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
handle = Handle;
#endif
#else
layerId = layer;
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + windDir * Color.r, 1.);
tc = Texcoord;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
hdle = Handle;
#endif
#endif

View File

@@ -7,7 +7,7 @@ layout(location = 3) in vec2 Texcoord;
layout(location = 7) in vec3 Origin;
layout(location = 8) in vec3 Orientation;
layout(location = 9) in vec3 Scale;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(location = 10) in uvec2 Handle;
#endif
@@ -22,13 +22,13 @@ in vec3 Scale;
#ifdef VSLayer
out vec2 uv;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat out uvec2 handle;
#endif
#else
out vec2 tc;
out int layerId;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
flat out uvec2 hdle;
#endif
#endif
@@ -43,14 +43,14 @@ void main(void)
gl_Layer = layer;
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position, 1.);
uv = Texcoord;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
handle = Handle;
#endif
#else
layerId = layer;
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position, 1.);
tc = Texcoord;
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
hdle = Handle;
#endif
#endif

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D normalMap;
layout(bindless_sampler) uniform sampler2D DiffuseForAlpha;
#else
@@ -25,5 +25,5 @@ void main()
vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent - TS_normal.z * Frag_normal;
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(FragmentNormal)) + 0.5;
EncodedNormal.z = exp2(10. * (1. - alpha) + 1.);
EncodedNormal.z = 1. - alpha;
}

View File

@@ -1,5 +1,13 @@
uniform mat4 ModelMatrix;
uniform mat4 InverseModelMatrix;
uniform mat4 ModelMatrix =
mat4(1., 0., 0., 0.,
0., 1., 0., 0.,
0., 0., 1., 0.,
0., 0., 0., 1.);
uniform mat4 InverseModelMatrix =
mat4(1., 0., 0., 0.,
0., 1., 0., 0.,
0., 0., 1., 0.,
0., 0., 0., 1.);
uniform mat4 TextureMatrix =
mat4(1., 0., 0., 0.,

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex;
#else
uniform sampler2D tex;
@@ -19,5 +19,5 @@ void main(void)
{
float glossmap = texture(tex, uv).x;
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
EncodedNormal.z = exp2(10. * glossmap + 1.);
EncodedNormal.z = glossmap;
}

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D Albedo;
layout(bindless_sampler) uniform sampler2D SpecMap;
#else
@@ -14,7 +14,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
void main(void)
{
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
vec4 col = texture(Albedo, uv);
#ifdef SRGBBindlessFix
col.xyz = pow(col.xyz, vec3(2.2));

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex;
#else
uniform sampler2D tex;
@@ -11,7 +11,7 @@ out vec4 FragColor;
void main(void)
{
vec4 col = texture(tex, uv);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
#ifdef SRGBBindlessFix
col.xyz = pow(col.xyz, vec3(2.2));
#endif

View File

@@ -1,6 +1,6 @@
// See http://www.ozone3d.net/tutorials/glsl_texturing_p04.php for ref
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex;
#else
uniform sampler2D tex;
@@ -25,7 +25,7 @@ void main() {
float m = 2.0 * sqrt(r.x * r.x + r.y * r.y + (r.z + 1.0) * (r.z + 1.0));
r.y = - r.y;
vec4 detail0 = texture(tex, r.xy / m + .5);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
#ifdef SRGBBindlessFix
detail0.xyz = pow(detail0.xyz, vec3(2.2));
#endif

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex;
layout(bindless_sampler) uniform sampler2D glosstex;
#else
@@ -24,6 +24,6 @@ void main() {
discard;
float glossmap = texture(glosstex, uv).x;
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
EncodedNormal.z = exp2(10. * glossmap + 1.);
EncodedNormal.z = glossmap;
}

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D Albedo;
layout(bindless_sampler) uniform sampler2D SpecMap;
#else
@@ -15,7 +15,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
void main(void)
{
vec4 col = texture(Albedo, uv);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
#ifdef SRGBBindlessFix
col.xyz = pow(col.xyz, vec3(2.2));
#endif

View File

@@ -6,11 +6,12 @@ flat in float energy;
flat in vec3 col;
flat in float radius;
out vec4 Diffuse;
out vec4 Specular;
out vec4 Diff;
out vec4 Spec;
vec3 DecodeNormal(vec2 n);
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
void main()
@@ -35,8 +36,10 @@ void main()
// Light Direction
vec3 L = -normalize(xpos.xyz - light_pos);
float NdotL = max(0., dot(norm, L));
float NdotL = clamp(dot(norm, L), 0., 1.);
vec3 Specular = SpecularBRDF(norm, eyedir, L, vec3(1.), roughness);
vec3 Diffuse = DiffuseBRDF(norm, eyedir, L, vec3(1.), roughness);
Diffuse = vec4(NdotL * light_col * att, 1.);
Specular = vec4(getSpecular(norm, eyedir, L, light_col, roughness) * NdotL * att, 1.);
Diff = vec4(Diffuse * NdotL * light_col * att, 1.);
Spec = vec4(Specular * NdotL * light_col * att, 1.);
}

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex;
#else
uniform sampler2D tex;

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex_layout;
layout(bindless_sampler) uniform sampler2D tex_detail0;
layout(bindless_sampler) uniform sampler2D tex_detail1;
@@ -32,7 +32,7 @@ void main() {
vec4 detail2 = texture(tex_detail2, uv);
vec4 detail3 = texture(tex_detail3, uv);
vec4 detail4 = vec4(0.0);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
#ifdef SRGBBindlessFix
detail0.xyz = pow(detail0.xyz, vec3(2.2));
detail1.xyz = pow(detail1.xyz, vec3(2.2));

View File

@@ -1,19 +1,12 @@
uniform sampler2D ntex;
uniform sampler2D dtex;
//uniform sampler2D cloudtex;
uniform vec3 direction;
uniform vec3 col;
uniform float sunangle = .54;
//uniform int hasclouds;
//uniform vec2 wind;
out vec4 Diff;
out vec4 Spec;
vec3 DecodeNormal(vec2 n);
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
@@ -28,33 +21,25 @@ vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
void main() {
vec2 uv = gl_FragCoord.xy / screen;
float z = texture(dtex, uv).x;
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
float z = texture(dtex, uv).x;
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
if (z < 0.03)
{
// Skyboxes are fully lit
Diff = vec4(1.0);
Spec = vec4(1.0);
return;
}
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
float roughness = texture(ntex, uv).z;
vec3 eyedir = -normalize(xpos.xyz);
// Normalized on the cpu
vec3 L = direction;
vec3 L = normalize((transpose(InverseViewMatrix) * vec4(sun_direction, 0.)).xyz);
float NdotL = clamp(dot(norm, L), 0., 1.);
float NdotL = max(0., dot(norm, L));
float angle = 3.14 * sunangle / 180.;
float angle = 3.14 * sun_angle / 180.;
vec3 R = reflect(-eyedir, norm);
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
vec3 Lightdir = getMostRepresentativePoint(L, R, angle);
vec3 Specular = getSpecular(norm, eyedir, Lightdir, col, roughness) * NdotL;
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
vec3 Diffuse = DiffuseBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
vec3 outcol = NdotL * col;
Diff = vec4(NdotL * Diffuse * sun_col, 1.);
Spec = vec4(NdotL * Specular * sun_col, 1.);
/* if (hasclouds == 1)
{
@@ -64,7 +49,4 @@ void main() {
outcol *= cloud;
}*/
Diff = vec4(NdotL * col, 1.);
Spec = vec4(Specular, 1.);
}

View File

@@ -7,16 +7,13 @@ uniform float split1;
uniform float split2;
uniform float splitmax;
uniform vec3 direction;
uniform vec3 col;
uniform float sunangle = .54;
in vec2 uv;
out vec4 Diff;
out vec4 Spec;
vec3 DecodeNormal(vec2 n);
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
@@ -29,83 +26,49 @@ vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
return (DdotR < d) ? normalize(d * D + normalize (S) * r) : R;
}
float getShadowFactor(vec3 pos, float bias, int index)
float getShadowFactor(vec3 pos, int index)
{
vec4 shadowcoord = (ShadowViewProjMatrixes[index] * InverseViewMatrix * vec4(pos, 1.0));
shadowcoord.xy /= shadowcoord.w;
vec2 shadowtexcoord = shadowcoord.xy * 0.5 + 0.5;
vec2 shadowoffset[4] = vec2[](
vec2(-1., -1.),
vec2(-1., 1.),
vec2(1., -1.),
vec2(1., 1.)
);
vec4 shadowcoord = (ShadowViewProjMatrixes[index] * InverseViewMatrix * vec4(pos, 1.0));
shadowcoord.xy /= shadowcoord.w;
vec2 shadowtexcoord = shadowcoord.xy * 0.5 + 0.5;
float z = texture(shadowtex, vec3(shadowtexcoord, float(index))).x;
float d = shadowcoord.z;
return min(pow(exp(-32. * d) * z, 8.), 1.);
float z = texture(shadowtex, vec3(shadowtexcoord, float(index))).x;
float d = shadowcoord.z;
return min(pow(exp(-32. * d) * z, 8.), 1.);
}
void main() {
vec2 uv = gl_FragCoord.xy / screen;
float z = texture(dtex, uv).x;
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
float z = texture(dtex, uv).x;
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
float roughness =texture(ntex, uv).z;
vec3 eyedir = -normalize(xpos.xyz);
// Normalized on the cpu
vec3 L = direction;
vec3 L = normalize((transpose(InverseViewMatrix) * vec4(sun_direction, 0.)).xyz);
float NdotL = clamp(dot(norm, L), 0., 1.);
float NdotL = max(0., dot(norm, L));
float angle = 3.14 * sunangle / 180.;
float angle = 3.14 * sun_angle / 180.;
vec3 R = reflect(-eyedir, norm);
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
vec3 Lightdir = getMostRepresentativePoint(L, R, angle);
vec3 Specular = getSpecular(norm, eyedir, Lightdir, col, roughness) * NdotL;
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
vec3 Diffuse = DiffuseBRDF(norm, eyedir, Lightdir, vec3(1.), roughness);
// Shadows
float factor;
if (xpos.z < split0)
factor = getShadowFactor(xpos.xyz, 0);
else if (xpos.z < split1)
factor = getShadowFactor(xpos.xyz, 1);
else if (xpos.z < split2)
factor = getShadowFactor(xpos.xyz, 2);
else if (xpos.z < splitmax)
factor = getShadowFactor(xpos.xyz, 3);
else
factor = 1.;
vec3 outcol = NdotL * col;
// Shadows
float bias = 0.005 * tan(acos(NdotL)); // According to the slope
bias = clamp(bias, 0., 0.01);
float factor;
if (xpos.z < split0)
factor = getShadowFactor(xpos.xyz, bias, 0);
/* else if (xpos.z < 6.)
{
float a = getShadowFactor(xpos.xyz, bias, 0), b = getShadowFactor(xpos.xyz, bias, 1);
factor = mix(a, b, (xpos.z - 5.));
}*/
else if (xpos.z < split1)
factor = getShadowFactor(xpos.xyz, bias, 1);
/* else if (xpos.z < 21.)
{
float a = getShadowFactor(xpos.xyz, bias, 1), b = getShadowFactor(xpos.xyz, bias, 2);
factor = mix(a, b, (xpos.z - 20.));
}*/
else if (xpos.z < split2)
factor = getShadowFactor(xpos.xyz, bias, 2);
/* else if (xpos.z < 55.)
{
float a = getShadowFactor(xpos.xyz, bias, 2), b = getShadowFactor(xpos.xyz, bias, 3);
factor = mix(a, b, (xpos.z - 50.) / 5.);
}*/
else if (xpos.z < splitmax)
factor = getShadowFactor(xpos.xyz, bias, 3);
/* else if (xpos.z < 150.)
{
factor = mix(getShadowFactor(xpos.xyz, bias, 3), 1., (xpos.z - 145.) / 5.);
}*/
else
factor = 1.;
Diff = vec4(factor * NdotL * col, 1.);
Spec = vec4(factor * Specular, 1.);
return;
Diff = vec4(factor * NdotL * Diffuse * sun_col, 1.);
Spec = vec4(factor * NdotL * Specular * sun_col, 1.);
}

View File

@@ -1,9 +1,4 @@
// From http://www.ceng.metu.edu.tr/~akyuz/files/hdrgpu.pdf
uniform sampler2D tex;
uniform sampler2D logluminancetex;
uniform float exposure = .09;
uniform float Lwhite = 1.;
uniform float vignette_weight;
out vec4 FragColor;
@@ -11,25 +6,10 @@ out vec4 FragColor;
vec3 getCIEYxy(vec3 rgbColor);
vec3 getRGBFromCIEXxy(vec3 YxyColor);
float delta = .0001;
float saturation = 1.;
void main()
{
vec2 uv = gl_FragCoord.xy / screen;
vec4 col = texture(tex, uv);
float avgLw = textureLod(logluminancetex, uv, 10.).x;
avgLw = max(exp(avgLw) - delta, delta);
vec3 Cw = getCIEYxy(col.xyz);
float Lw = Cw.y;
/* Reinhard, for reference */
// float L = Lw * exposure / avgLw;
// float Ld = L * (1. + L / (Lwhite * Lwhite));
// Ld /= (1. + L);
// FragColor = vec4(Ld * pow(col.xyz / Lw, vec3(saturation)), 1.);
// Uncharted2 tonemap with Auria's custom coefficients
vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.2 * col + 1.7) + 0.06);
@@ -38,7 +18,6 @@ void main()
vec2 inside = uv - 0.5;
float vignette = 1. - dot(inside, inside) * vignette_weight;
vignette = clamp(pow(vignette, 0.8), 0., 1.);
//vignette = clamp(vignette + vignette - 0.5, 0., 1.15);
FragColor = vec4(perChannel.xyz * vignette, col.a);
}

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex;
#else
uniform sampler2D tex;
@@ -12,7 +12,7 @@ out vec4 FragColor;
void main()
{
vec4 Color = texture(tex, uv);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
Color.xyz = pow(Color.xyz, vec3(2.2));
#endif
Color.xyz *= pow(color.xyz, vec3(2.2));

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex;
#else
uniform sampler2D tex;
@@ -20,7 +20,7 @@ out vec4 FragColor;
void main()
{
vec4 diffusecolor = texture(tex, uv);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
diffusecolor.xyz = pow(diffusecolor.xyz, vec3(2.2));
#endif
diffusecolor.xyz *= pow(color.xyz, vec3(2.2));

View File

@@ -0,0 +1,5 @@
// Lambert model
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness)
{
return color;
}

View File

@@ -0,0 +1,38 @@
// From "An Efficient Representation for Irradiance Environment Maps" article
// See http://graphics.stanford.edu/papers/envmap/
// Coefficients are calculated in IBL.cpp
mat4 getMatrix(float L00, float L1m1, float L10, float L11, float L2m2, float L2m1, float L20, float L21, float L22)
{
float c1 = 0.429043, c2 = 0.511664, c3 = 0.743125, c4 = 0.886227, c5 = 0.247708;
return mat4(
c1 * L22, c1 * L2m2, c1 * L21, c2 * L11,
c1 * L2m2, - c1 * L22, c1 * L2m1, c2 * L1m1,
c1 * L21, c1 * L2m1, c3 * L20, c2 * L10,
c2 * L11, c2 * L1m1, c2 * L10, c4 * L00 - c5 * L20
);
}
vec3 DiffuseIBL(vec3 normal)
{
// Convert normal in wobLd space (where SH coordinates were computed)
vec4 extendednormal = transpose(ViewMatrix) * vec4(normal, 0.);
extendednormal.w = 1.;
#ifdef UBO_DISABLED
mat4 rmat = getMatrix(redLmn[0], redLmn[1], redLmn[2], redLmn[3], redLmn[4], redLmn[5], redLmn[6], redLmn[7], redLmn[8]);
mat4 gmat = getMatrix(greenLmn[0], greenLmn[1], greenLmn[2], greenLmn[3], greenLmn[4], greenLmn[5], greenLmn[6], greenLmn[7], greenLmn[8]);
mat4 bmat = getMatrix(blueLmn[0], blueLmn[1], blueLmn[2], blueLmn[3], blueLmn[4], blueLmn[5], blueLmn[6], blueLmn[7], blueLmn[8]);
#else
mat4 rmat = getMatrix(rL00, rL1m1, rL10, rL11, rL2m2, rL2m1, rL20, rL21, rL22);
mat4 gmat = getMatrix(gL00, gL1m1, gL10, gL11, gL2m2, gL2m1, gL20, gL21, gL22);
mat4 bmat = getMatrix(bL00, bL1m1, bL10, bL11, bL2m2, bL2m1, bL20, bL21, bL22);
#endif
float r = dot(extendednormal, rmat * extendednormal);
float g = dot(extendednormal, gmat * extendednormal);
float b = dot(extendednormal, bmat * extendednormal);
return max(vec3(r, g, b), vec3(0.));
}

View File

@@ -0,0 +1,11 @@
// Blinn Phong with emulated fresnel factor
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness)
{
float exponentroughness = exp2(10. * roughness + 1.);
// Half Light View direction
vec3 H = normalize(eyedir + lightdir);
float NdotH = clamp(dot(normal, H), 0., 1.);
float normalisationFactor = (exponentroughness + 2.) / 8.;
vec3 FresnelSchlick = color + (1.0f - color) * pow(1.0f - clamp(dot(eyedir, H), 0., 1.), 5);
return max(pow(NdotH, exponentroughness) * FresnelSchlick * normalisationFactor, vec3(0.));
}

View File

@@ -0,0 +1,11 @@
uniform samplerCube probe;
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness)
{
vec3 sampleDirection = reflect(-V, normal);
sampleDirection = (InverseViewMatrix * vec4(sampleDirection, 0.)).xyz;
// Assume 8 level of lod (ie 256x256 texture)
float lodval = 8. * (1. - roughness);
return clamp( textureLod(probe, sampleDirection, lodval).rgb, 0., 1.);
}

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D DiffuseMap;
layout(bindless_sampler) uniform sampler2D SpecularMap;
layout(bindless_sampler) uniform sampler2D SSAO;

View File

@@ -1,11 +0,0 @@
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness)
{
// Half Light View direction
vec3 H = normalize(eyedir + lightdir);
float NdotH = max(0., dot(normal, H));
float normalisationFactor = (roughness + 2.) / 8.;
vec3 FresnelSchlick = color + (1.0f - color) * pow(1.0f - max(0., (dot(eyedir, H))), 5);
return max(pow(NdotH, roughness) * FresnelSchlick * normalisationFactor, vec3(0.));
}

View File

@@ -1,4 +1,4 @@
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
layout(bindless_sampler) uniform sampler2D tex;
#else
uniform sampler2D tex;
@@ -20,7 +20,7 @@ out vec4 FragColor;
void main()
{
vec4 diffusecolor = texture(tex, uv);
#ifdef GL_ARB_bindless_texture
#ifdef Use_Bindless_Texture
diffusecolor.xyz = pow(diffusecolor.xyz, vec3(2.2));
#endif
diffusecolor.xyz *= pow(color.xyz, vec3(2.2));

View File

@@ -60,17 +60,16 @@
<!-- The title music. -->
<music title="main_theme.music"/>
<!-- Mostly for debugging: maximum number of history entries -->
<history max-frames="10000"/>
<!-- Replay related values, mostly concerned with saving less data
and using interpolation instead.
max-time: Maximum race time that can be saved in a replay/history file.
delta-t Minumum time between saving consecutive transform events.
delta-pos If the interpolated position is within this delta, a
transform event is not generated.
delta-angle If the interpolated angle is within this delta,
a transform event is not generated. -->
<replay delta-t="0.05" delta-pos="0.1" delta-angle="0.5" />
<replay max-time="600" delta-t="0.05" delta-pos="0.1"
delta-angle="0.5" />
<!-- Skidmark data: maximum number of skid marks, and
time for skidmarks to fade out. -->

View File

@@ -1,21 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDYDCCAsmgAwIBAgIJAKYVnmvPe6cJMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNV
BAYTAkZSMQ8wDQYDVQQIEwZGcmFuY2UxEjAQBgNVBAcTCU1hcnNlaWxsZTEuMCwG
A1UEChMlVHV4RmFtaWx5Lm9yZyBub24tcHJvZml0IG9yZ2FuaXphdGlvbjEaMBgG
A1UEAxMRd2ViLnR1eGZhbWlseS5uZXQwHhcNMDgwNTE0MjMzMDI3WhcNMTgwNTEy
MjMzMDI3WjB+MQswCQYDVQQGEwJGUjEPMA0GA1UECBMGRnJhbmNlMRIwEAYDVQQH
EwlNYXJzZWlsbGUxLjAsBgNVBAoTJVR1eEZhbWlseS5vcmcgbm9uLXByb2ZpdCBv
cmdhbml6YXRpb24xGjAYBgNVBAMTEXdlYi50dXhmYW1pbHkubmV0MIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQCqCWPTYrW59LfzUtMgUFIse9ErIytmnNyVbzk6
11Zj0OTMuCp9ijHW47jqSp7OaOR7X5XmNyhltnidS7elXtVb/jZOINRzdejmLRWs
qBsnvWlab6kx+/u0kLAFH0w6s4Kg2K2s1eHtyid2IZLb+Xl29NGf+C6bRnUq9Bh2
6DF93QIDAQABo4HlMIHiMB0GA1UdDgQWBBSHuse3FoUQ1asK7+4YJ7FxH3tztzCB
sgYDVR0jBIGqMIGngBSHuse3FoUQ1asK7+4YJ7FxH3tzt6GBg6SBgDB+MQswCQYD
VQQGEwJGUjEPMA0GA1UECBMGRnJhbmNlMRIwEAYDVQQHEwlNYXJzZWlsbGUxLjAs
BgNVBAoTJVR1eEZhbWlseS5vcmcgbm9uLXByb2ZpdCBvcmdhbml6YXRpb24xGjAY
BgNVBAMTEXdlYi50dXhmYW1pbHkubmV0ggkAphWea897pwkwDAYDVR0TBAUwAwEB
/zANBgkqhkiG9w0BAQUFAAOBgQBYHLb4pjL7+xTk066JffNe1uCi2xXL93tsuphZ
6LVZkd3y4uIp9yayhUocOws8jptJHtr4TEV5AxS34B89AJgVERcj86K/RVSSwApO
g+ONYIyJ+Xdipdby6TIER+EgQxQJw1cxrMS3zzn7SNuo04CexqOTd5LUrtQJ/dOI
LPEqhw==
-----END CERTIFICATE-----

View File

@@ -135,6 +135,15 @@ namespace irr
return ReferenceCounter;
}
//! Sets the reference count.
/** Use with extreme caution, since using it incorrectly results in memory
corruption or memory leaks. This method is only implemented for 'hollow'
copies of ScalableFont (an STK extention). */
void setReferenceCount(s32 n)
{
ReferenceCounter = n;
}
//! Returns the debug name of the object.
/** The Debugname may only be set and changed by the object
itself. This method should only be used in Debug mode.

View File

@@ -580,7 +580,7 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig)
irr::video::useCoreContext = false;
// fall back to legacy context
os::Printer::log("Creating legacy OpenGL 2.1 context...", ELL_INFORMATION);
Context = glXCreateContextAttribsARB(display, glxFBConfig, 0, True, legacyctx);
Context = glXCreateNewContext(display, glxFBConfig, GLX_RGBA_TYPE, NULL, True);
return Context;
}

View File

@@ -1581,6 +1581,20 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
else
out.append("Microsoft Windows Server 2008 R2 ");
}
else if (osvi.dwMinorVersion == 2)
{
if (osvi.wProductType == VER_NT_WORKSTATION)
out.append("Microsoft Windows 8 ");
else
out.append("Microsoft Windows Server 2012 ");
}
else if (osvi.dwMinorVersion == 3)
{
if (osvi.wProductType == VER_NT_WORKSTATION)
out.append("Microsoft Windows 8.1 ");
else
out.append("Microsoft Windows Server 2012 R2 ");
}
}
if (bOsVersionInfoEx)

View File

@@ -794,6 +794,7 @@ void CSkinnedMesh::checkForAnimation()
AllJoints[i]->UseAnimationFrom->RotationKeys.size() )
{
HasAnimation = true;
break;
}
}
}
@@ -803,8 +804,11 @@ void CSkinnedMesh::checkForAnimation()
{
for(i=0;i<AllJoints.size();++i)
{
if (AllJoints[i]->Weights.size())
HasAnimation = true;
if (AllJoints[i]->Weights.size())
{
HasAnimation = true;
break;
}
}
}
@@ -1470,6 +1474,76 @@ void CSkinnedMesh::calculateTangents(
}
}
// ----------------------------------------------------------------------------
/** Copies a mesh.
*/
CSkinnedMesh *CSkinnedMesh::clone()
{
CSkinnedMesh* skinned_mesh = new CSkinnedMesh();
for (u32 i = 0; i < getMeshBuffers().size(); i++)
{
SSkinMeshBuffer * buffer = skinned_mesh->addMeshBuffer();
*buffer = *(getMeshBuffers()[i]);
}
for (u32 j = 0; j < getAllJoints().size(); ++j)
{
ISkinnedMesh::SJoint *joint = skinned_mesh->addJoint();
*joint = *(getAllJoints()[j]);
}
// fix children pointers (they still have old pointers)
core::array<ISkinnedMesh::SJoint*> & new_joints = skinned_mesh->getAllJoints();
for (u32 i = 0; i < new_joints.size(); ++i)
{
ISkinnedMesh::SJoint * joint = new_joints[i];
for (u32 c = 0; c < joint->Children.size(); ++c)
{
// the child is one of the oldJoints and must be replaced by the newjoint on the same index
bool found = false;
for (u32 k = 0; k < AllJoints.size(); ++k)
{
if (joint->Children[c] == AllJoints[k])
{
joint->Children[c] = new_joints[k];
found = true;
break;
}
} // k < old_joints.size
if (!found)
found = true;
} // c < joint->Children.size()
} // i < new_joints.size()
// In finalize the values from LocalBuffers are copied into
// Weights[].StaticPos. Since skinned_mesh already has the correct
// values in Weights, we have to copy the values from Weights
// into LocalBuffer (so that in the copy from LocalBuffer to weights
// no values are overwritten).
// FIXME: Not ideal, better would be not to copy the values in
// finalize().
for (unsigned int i = 0; i<AllJoints.size(); ++i)
{
SJoint *joint = AllJoints[i];
for (unsigned int j = 0; j<joint->Weights.size(); ++j)
{
const u16 buffer_id = joint->Weights[j].buffer_id;
const u32 vertex_id = joint->Weights[j].vertex_id;
skinned_mesh->LocalBuffers[buffer_id]->getVertex(vertex_id)->Pos = joint->Weights[j].StaticPos;
skinned_mesh->LocalBuffers[buffer_id]->getVertex(vertex_id)->Normal = joint->Weights[j].StaticNormal;
}
}
skinned_mesh->finalize();
return skinned_mesh;
} // clone
} // end namespace scene
} // end namespace irr

View File

@@ -159,7 +159,7 @@ namespace scene
void addJoints(core::array<IBoneSceneNode*> &jointChildSceneNodes,
IAnimatedMeshSceneNode* node,
ISceneManager* smgr);
CSkinnedMesh *clone();
private:
void checkForAnimation();

View File

@@ -800,29 +800,47 @@ bool CIrrDeviceMacOSX::createWindow()
{
CGLPixelFormatAttribute fullattribs[] =
{
kCGLPFAFullScreen,
kCGLPFADisplayMask, (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display),
kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute)kCGLOGLPVersion_3_2_Core,
//kCGLPFAFullScreen,
//kCGLPFADisplayMask, (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display),
kCGLPFADoubleBuffer,
kCGLPFANoRecovery,
kCGLPFAAccelerated,
//kCGLPFANoRecovery,
//kCGLPFAAccelerated,
kCGLPFADepthSize, (CGLPixelFormatAttribute)depthSize,
kCGLPFAColorSize, (CGLPixelFormatAttribute)CreationParams.Bits,
kCGLPFAAlphaSize, (CGLPixelFormatAttribute)alphaSize,
kCGLPFASampleBuffers, (CGLPixelFormatAttribute)(CreationParams.AntiAlias?1:0),
kCGLPFASamples, (CGLPixelFormatAttribute)CreationParams.AntiAlias,
kCGLPFAStencilSize, (CGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
//kCGLPFAAlphaSize, (CGLPixelFormatAttribute)alphaSize,
//kCGLPFASampleBuffers, (CGLPixelFormatAttribute)(CreationParams.AntiAlias?1:0),
//kCGLPFASamples, (CGLPixelFormatAttribute)CreationParams.AntiAlias,
//kCGLPFAStencilSize, (CGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
(CGLPixelFormatAttribute)NULL
};
printf("Creating OpenGL device with flags: kCGLPFAColorSize : %i | kCGLPFADepthSize : %i ",
(int)CreationParams.Bits,
(int)depthSize
);
pixelFormat = NULL;
numPixelFormats = 0;
CGLChoosePixelFormat(fullattribs,&pixelFormat,&numPixelFormats);
CGLError error = CGLChoosePixelFormat(fullattribs,&pixelFormat,&numPixelFormats);
if (error != kCGErrorSuccess)
{
os::Printer::log("CGLChoosePixelFormat returned error", ELL_WARNING);
printf("OSX DEBUG: CGLChoosePixelFormat returned error %i (%s)\n",
(int)error, CGLErrorString (error));
}
if (pixelFormat != NULL)
{
printf("OSX DEBUG: pixelFormat != NULL\n");
CGLCreateContext(pixelFormat,NULL,&CGLContext);
CGLDestroyPixelFormat(pixelFormat);
}
else
{
os::Printer::log("CGLChoosePixelFormat returned NULL pixelFormat", ELL_WARNING);
}
if (CGLContext != NULL)
{
@@ -837,6 +855,10 @@ bool CIrrDeviceMacOSX::createWindow()
CreationParams.WindowSize.set(ScreenWidth, ScreenHeight);
result = true;
}
else
{
os::Printer::log("CGLContext is null", ELL_WARNING);
}
}
else
{
@@ -1290,6 +1312,9 @@ void CIrrDeviceMacOSX::storeMouseLocation()
x = (int)point.x;
y = (int)point.y;
if (CursorControl == NULL)
return;
const core::position2di& curr = ((CCursorControl *)CursorControl)->getPosition();
if (curr.X != x || curr.Y != y)
{
@@ -1302,8 +1327,9 @@ void CIrrDeviceMacOSX::storeMouseLocation()
postEventFromUser(ievent);
}
}
((CCursorControl *)CursorControl)->updateInternalCursorPosition(x,y);
if (CursorControl != NULL)
((CCursorControl *)CursorControl)->updateInternalCursorPosition(x,y);
}

View File

@@ -234,9 +234,10 @@ local gzFile gz_open(path, fd, mode)
/* open the file with the appropriate flags (or just use fd) */
state->fd = fd > -1 ? fd : (
#ifdef _WIN32
fd == -2 ? _wopen(path, oflag, 0666) :
#endif
fd == -2 ? _wopen(path, oflag, 0666) : _open(path, oflag, 0666));
#else
open(path, oflag, 0666));
#endif
if (state->fd == -1) {
free(state->path);
free(state);

View File

@@ -27,7 +27,11 @@ local int gz_load(state, buf, len, have)
*have = 0;
do {
#ifdef _WIN32
ret = _read(state->fd, buf + *have, len - *have);
#else
ret = read(state->fd, buf + *have, len - *have);
#endif
if (ret <= 0)
break;
*have += ret;
@@ -583,7 +587,11 @@ int ZEXPORT gzclose_r(file)
err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
gz_error(state, Z_OK, NULL);
free(state->path);
#ifdef _WIN32
ret = _close(state->fd);
#else
ret = close(state->fd);
#endif
free(state);
return ret ? Z_ERRNO : err;
}

View File

@@ -81,7 +81,11 @@ local int gz_comp(state, flush)
/* write directly if requested */
if (state->direct) {
#ifdef _WIN32
got = _write(state->fd, strm->next_in, strm->avail_in);
#else
got = write(state->fd, strm->next_in, strm->avail_in);
#endif
if (got < 0 || (unsigned)got != strm->avail_in) {
gz_error(state, Z_ERRNO, zstrerror());
return -1;
@@ -98,8 +102,12 @@ local int gz_comp(state, flush)
if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
(flush != Z_FINISH || ret == Z_STREAM_END))) {
have = (unsigned)(strm->next_out - state->x.next);
#ifdef _WIN32
if (have && ((got = _write(state->fd, state->x.next, have)) < 0 ||
#else
if (have && ((got = write(state->fd, state->x.next, have)) < 0 ||
(unsigned)got != have)) {
#endif
(unsigned)got != have)) {
gz_error(state, Z_ERRNO, zstrerror());
return -1;
}
@@ -558,8 +566,12 @@ int ZEXPORT gzclose_w(file)
}
gz_error(state, Z_OK, NULL);
free(state->path);
if (close(state->fd) == -1)
ret = Z_ERRNO;
#ifdef _WIN32
if (_close(state->fd) == -1)
#else
if (_close(state->fd) == -1)
#endif
ret = Z_ERRNO;
free(state);
return ret;
}

View File

@@ -1,5 +1,5 @@
# Modify this file to change the last-modified date when you add/remove a file.
# This will then trigger a new cmake run automatically.
# This will then trigger a new cmake run automatically.
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")

View File

@@ -46,8 +46,6 @@ AchievementsManager::AchievementsManager()
for (unsigned int i = 0; i < num_nodes; i++)
{
const XMLNode *node = root->getNode(i);
std::string type("");
node->get("type", &type);
AchievementInfo * achievement_info = new AchievementInfo(node);
m_achievements_info[achievement_info->getID()] = achievement_info;
}

View File

@@ -466,7 +466,6 @@ bool AddonsManager::anyAddonsInstalled() const
*/
bool AddonsManager::install(const Addon &addon)
{
bool success=true;
file_manager->checkAndCreateDirForAddons(addon.getDataDir());
//extract the zip in the addons folder called like the addons name
@@ -474,7 +473,7 @@ bool AddonsManager::install(const Addon &addon)
std::string from = file_manager->getAddonsFile("tmp/"+base_name);
std::string to = addon.getDataDir();
success = extract_zip(from, to);
bool success = extract_zip(from, to);
if (!success)
{
// TODO: show a message in the interface

View File

@@ -49,7 +49,7 @@ NewsManager::~NewsManager()
// ---------------------------------------------------------------------------
/** This function initialises the data for the news manager. It starts a
* separate thread to execute downloadNews() - which (if necessary) downaloads
* separate thread to execute downloadNews() - which (if necessary) downloads
* the news.xml file and updates the list of news messages. It also
* initialises the addons manager (which can trigger another download of
* news.xml).
@@ -458,7 +458,7 @@ bool NewsManager::conditionFulfilled(const std::string &cond)
// ==============================
else if(cond[1]=="not" && cond[2]=="installed")
{
// The addons_manager can not be access, since it's
// The addons_manager cannot be accessed, since it's
// being initialised after the news manager. So a simple
// test is made to see if the directory exists. It is
// necessary to check for karts and tracks separately,

View File

@@ -274,7 +274,10 @@ void* SFXManager::mainLoop(void *obj)
me->m_sfx_commands.getData().erase(me->m_sfx_commands.getData().begin());
if (current->m_command == SFX_EXIT)
{
delete current;
break;
}
me->m_sfx_commands.unlock();
switch(current->m_command)
{

View File

@@ -16,6 +16,11 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef __MINGW32__
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
#include "config/hardware_stats.hpp"
#include "config/user_config.hpp"
@@ -230,6 +235,7 @@ void determineOSVersion()
case 0x0600: m_os_version="Windows Vista"; break;
case 0x0601: m_os_version="Windows 7"; break;
case 0x0602: m_os_version="Windows 8"; break;
case 0x0603: m_os_version="Windows 8_1"; break;
default: {
m_os_version = StringUtils::insertValues("Windows %d",
windows_version);

View File

@@ -326,7 +326,7 @@ void PlayerManager::enforceCurrentPlayer()
{
if (!player->isGuestAccount())
{
Log::info("PlayerManager", "Enfocring current player '%ls'.",
Log::info("PlayerManager", "Enforcing current player '%ls'.",
player->getName().c_str() );
m_current_player = player;
return;
@@ -340,7 +340,7 @@ void PlayerManager::enforceCurrentPlayer()
{
if (!player->isGuestAccount())
{
Log::info("PlayerManager", "Enfocring current player '%s'.",
Log::info("PlayerManager", "Enforcing current player '%s'.",
player->getName().c_str());
m_current_player = player;
return;
@@ -353,8 +353,8 @@ void PlayerManager::enforceCurrentPlayer()
// ----------------------------------------------------------------------------
/** Called when no player profiles exists. It creates two players: one
* guest player, and one non-guest player for whic hit tries to guess a
* mame based on environment variables.
* guest player, and one non-guest player for which it tries to guess a
* name based on environment variables.
*/
void PlayerManager::addDefaultPlayer()
{

View File

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

View File

@@ -133,7 +133,6 @@ void STKConfig::load(const std::string &filename)
CHECK_NEG(m_bubblegum_counter, "bubblegum disappear counter");
CHECK_NEG(m_bubblegum_shield_time, "bubblegum shield-time" );
CHECK_NEG(m_explosion_impulse_objects, "explosion-impulse-objects" );
CHECK_NEG(m_max_history, "max-history" );
CHECK_NEG(m_max_skidmarks, "max-skidmarks" );
CHECK_NEG(m_min_kart_version, "<kart-version min...>" );
CHECK_NEG(m_max_kart_version, "<kart-version max=...>" );
@@ -146,6 +145,7 @@ void STKConfig::load(const std::string &filename)
CHECK_NEG(m_leader_time_per_kart, "leader time-per-kart" );
CHECK_NEG(m_penalty_time, "penalty-time" );
CHECK_NEG(m_max_display_news, "max-display-news" );
CHECK_NEG(m_replay_max_time, "replay max-time" );
CHECK_NEG(m_replay_delta_angle, "replay delta-angle" );
CHECK_NEG(m_replay_delta_pos2, "replay delta-position" );
CHECK_NEG(m_replay_dt, "replay delta-t" );
@@ -177,13 +177,13 @@ void STKConfig::init_defaults()
m_bubblegum_shield_time = -100;
m_shield_restrict_weapos = false;
m_max_karts = -100;
m_max_history = -100;
m_max_skidmarks = -100;
m_min_kart_version = -100;
m_max_kart_version = -100;
m_min_track_version = -100;
m_max_track_version = -100;
m_max_display_news = -100;
m_replay_max_time = -100;
m_replay_delta_angle = -100;
m_replay_delta_pos2 = -100;
m_replay_dt = -100;
@@ -286,9 +286,6 @@ void STKConfig::getAllData(const XMLNode * root)
Log::error("StkConfig", "Cannot load title music : %s", title_music.c_str());
}
if(const XMLNode *history_node = root->getNode("history"))
history_node->get("max-frames", &m_max_history);
if(const XMLNode *skidmarks_node = root->getNode("skid-marks"))
{
skidmarks_node->get("max-number", &m_max_skidmarks );
@@ -376,6 +373,8 @@ void STKConfig::getAllData(const XMLNode * root)
replay_node->get("delta-angle", &m_replay_delta_angle);
replay_node->get("delta-pos", &m_replay_delta_pos2 );
replay_node->get("delta-t", &m_replay_dt );
replay_node->get("max-time", &m_replay_max_time );
}
// Get the default KartProperties

View File

@@ -96,8 +96,6 @@ public:
float m_music_credit_time; /**<Time the music credits are
displayed. */
int m_max_karts; /**<Maximum number of karts. */
int m_max_history; /**<Maximum number of frames to save in
a history files. */
bool m_smooth_normals; /**< If normals for raycasts for wheels
should be interpolated. */
/** If the angle between a normal on a vertex and the normal of the
@@ -145,6 +143,9 @@ public:
/** Filename of the title music to play.*/
MusicInformation *m_title_music;
/** Maximum time of a replay. */
int m_replay_max_time;
/** Minimum time between consecutive saved tranform events. */
float m_replay_dt;

View File

@@ -467,6 +467,9 @@ namespace UserConfigParams
PARAM_PREFIX BoolUserConfigParam m_azdo
PARAM_DEFAULT(BoolUserConfigParam(false, "enable_azdo",
&m_video_group, "Enable 'Approaching Zero Driver Overhead' mode (very experimental !)"));
PARAM_PREFIX BoolUserConfigParam m_sdsm
PARAM_DEFAULT(BoolUserConfigParam(false, "enable_sdsm",
&m_video_group, "Enable Sampled Distribued Shadow Map (buggy atm)"));
// ---- Debug - not saved to config file
/** If gamepad debugging is enabled. */
@@ -730,7 +733,7 @@ namespace UserConfigParams
"A random number to avoid duplicated reports.") );
PARAM_PREFIX StringUserConfigParam m_server_hw_report
PARAM_DEFAULT( StringUserConfigParam( "http://104.131.193.44:8080",
PARAM_DEFAULT( StringUserConfigParam( "http://addons.supertuxkart.net:8080",
"hw-report-server",
&m_hw_report_group,
"The server used for reporting statistics to."));
@@ -746,31 +749,33 @@ namespace UserConfigParams
PARAM_PREFIX BoolUserConfigParam m_always_show_login_screen
PARAM_DEFAULT( BoolUserConfigParam(false, "always_show_login_screen",
"Always show the login screen even if last player's session was saved."));
// ---- Online gameplay related
// ---- Online gameplay related
PARAM_PREFIX GroupUserConfigParam m_online_group
PARAM_DEFAULT( GroupUserConfigParam("OnlinePlay",
PARAM_DEFAULT( GroupUserConfigParam("OnlineServer",
"Everything related to online play.") );
PARAM_PREFIX StringUserConfigParam m_server_multiplayer
PARAM_DEFAULT( StringUserConfigParam( "https://api.stkaddons.net/",
PARAM_DEFAULT( StringUserConfigParam( "https://addons.supertuxkart.net/api/",
"server_multiplayer",
&m_online_group,
"The server used for online multiplayer."));
PARAM_PREFIX IntUserConfigParam m_server_version
PARAM_DEFAULT( IntUserConfigParam( 1,
PARAM_DEFAULT( IntUserConfigParam( 2,
"server-version",
&m_online_group,
"Version of the server API to use."));
// ---- Addon server related entries
PARAM_PREFIX GroupUserConfigParam m_addon_group
PARAM_DEFAULT( GroupUserConfigParam("AddonAndNews",
PARAM_DEFAULT( GroupUserConfigParam("AddonServer",
"Addon and news related settings") );
PARAM_PREFIX StringUserConfigParam m_server_addons
PARAM_DEFAULT( StringUserConfigParam("http://stkaddons.net/dl/xml",
PARAM_DEFAULT( StringUserConfigParam("http://addons.supertuxkart.net/dl/xml",
"server_addons",
&m_addon_group,
"The server used for addon."));

337
src/graphics/IBL.cpp Normal file
View File

@@ -0,0 +1,337 @@
#include "IBL.hpp"
#include "gl_headers.hpp"
#include "shaders.hpp"
#include <cmath>
#include <set>
static void getXYZ(GLenum face, float i, float j, float &x, float &y, float &z)
{
switch (face)
{
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
x = 1.;
y = -i;
z = -j;
break;
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
x = -1.;
y = -i;
z = j;
break;
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
x = j;
y = 1.;
z = i;
break;
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
x = j;
y = -1;
z = -i;
break;
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
x = j;
y = -i;
z = 1;
break;
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
x = -j;
y = -i;
z = -1;
break;
}
float norm = sqrt(x * x + y * y + z * z);
x /= norm, y /= norm, z /= norm;
return;
}
static void getYml(GLenum face, size_t edge_size,
float *Y00,
float *Y1minus1, float *Y10, float *Y11,
float *Y2minus2, float *Y2minus1, float *Y20, float *Y21, float *Y22)
{
#pragma omp parallel for
for (int i = 0; i < int(edge_size); i++)
{
for (unsigned j = 0; j < edge_size; j++)
{
float x, y, z;
float fi = float(i), fj = float(j);
fi /= edge_size, fj /= edge_size;
fi = 2 * fi - 1, fj = 2 * fj - 1;
getXYZ(face, fi, fj, x, y, z);
// constant part of Ylm
float c00 = 0.282095f;
float c1minus1 = 0.488603f;
float c10 = 0.488603f;
float c11 = 0.488603f;
float c2minus2 = 1.092548f;
float c2minus1 = 1.092548f;
float c21 = 1.092548f;
float c20 = 0.315392f;
float c22 = 0.546274f;
size_t idx = i * edge_size + j;
Y00[idx] = c00;
Y1minus1[idx] = c1minus1 * y;
Y10[idx] = c10 * z;
Y11[idx] = c11 * x;
Y2minus2[idx] = c2minus2 * x * y;
Y2minus1[idx] = c2minus1 * y * z;
Y21[idx] = c21 * x * z;
Y20[idx] = c20 * (3 * z * z - 1);
Y22[idx] = c22 * (x * x - y * y);
}
}
}
static void projectSH(Color *CubemapFace[6], size_t edge_size,
float *Y00[],
float *Y1minus1[], float *Y10[], float *Y11[],
float *Y2minus2[], float *Y2minus1[], float * Y20[], float *Y21[], float *Y22[],
float *blueSHCoeff, float *greenSHCoeff, float *redSHCoeff
)
{
for (unsigned i = 0; i < 9; i++)
{
blueSHCoeff[i] = 0;
greenSHCoeff[i] = 0;
redSHCoeff[i] = 0;
}
float wh = float(edge_size * edge_size);
for (unsigned face = 0; face < 6; face++)
{
#pragma omp parallel for
for (int i = 0; i < int(edge_size); i++)
{
for (unsigned j = 0; j < edge_size; j++)
{
int idx = i * edge_size + j;
float fi = float(i), fj = float(j);
fi /= edge_size, fj /= edge_size;
fi = 2 * fi - 1, fj = 2 * fj - 1;
float d = sqrt(fi * fi + fj * fj + 1);
// Constant obtained by projecting unprojected ref values
float solidangle = 2.75f / (wh * pow(d, 1.5f));
// pow(., 2.2) to convert from srgb
float b = CubemapFace[face][edge_size * i + j].Blue;
float g = CubemapFace[face][edge_size * i + j].Green;
float r = CubemapFace[face][edge_size * i + j].Red;
blueSHCoeff[0] += b * Y00[face][idx] * solidangle;
blueSHCoeff[1] += b * Y1minus1[face][idx] * solidangle;
blueSHCoeff[2] += b * Y10[face][idx] * solidangle;
blueSHCoeff[3] += b * Y11[face][idx] * solidangle;
blueSHCoeff[4] += b * Y2minus2[face][idx] * solidangle;
blueSHCoeff[5] += b * Y2minus1[face][idx] * solidangle;
blueSHCoeff[6] += b * Y20[face][idx] * solidangle;
blueSHCoeff[7] += b * Y21[face][idx] * solidangle;
blueSHCoeff[8] += b * Y22[face][idx] * solidangle;
greenSHCoeff[0] += g * Y00[face][idx] * solidangle;
greenSHCoeff[1] += g * Y1minus1[face][idx] * solidangle;
greenSHCoeff[2] += g * Y10[face][idx] * solidangle;
greenSHCoeff[3] += g * Y11[face][idx] * solidangle;
greenSHCoeff[4] += g * Y2minus2[face][idx] * solidangle;
greenSHCoeff[5] += g * Y2minus1[face][idx] * solidangle;
greenSHCoeff[6] += g * Y20[face][idx] * solidangle;
greenSHCoeff[7] += g * Y21[face][idx] * solidangle;
greenSHCoeff[8] += g * Y22[face][idx] * solidangle;
redSHCoeff[0] += r * Y00[face][idx] * solidangle;
redSHCoeff[1] += r * Y1minus1[face][idx] * solidangle;
redSHCoeff[2] += r * Y10[face][idx] * solidangle;
redSHCoeff[3] += r * Y11[face][idx] * solidangle;
redSHCoeff[4] += r * Y2minus2[face][idx] * solidangle;
redSHCoeff[5] += r * Y2minus1[face][idx] * solidangle;
redSHCoeff[6] += r * Y20[face][idx] * solidangle;
redSHCoeff[7] += r * Y21[face][idx] * solidangle;
redSHCoeff[8] += r * Y22[face][idx] * solidangle;
}
}
}
}
void SphericalHarmonics(Color *CubemapFace[6], size_t edge_size, float *blueSHCoeff, float *greenSHCoeff, float *redSHCoeff)
{
float *Y00[6];
float *Y1minus1[6];
float *Y10[6];
float *Y11[6];
float *Y2minus2[6];
float *Y2minus1[6];
float *Y20[6];
float *Y21[6];
float *Y22[6];
for (unsigned face = 0; face < 6; face++)
{
Y00[face] = new float[edge_size * edge_size];
Y1minus1[face] = new float[edge_size * edge_size];
Y10[face] = new float[edge_size * edge_size];
Y11[face] = new float[edge_size * edge_size];
Y2minus2[face] = new float[edge_size * edge_size];
Y2minus1[face] = new float[edge_size * edge_size];
Y20[face] = new float[edge_size * edge_size];
Y21[face] = new float[edge_size * edge_size];
Y22[face] = new float[edge_size * edge_size];
getYml(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, edge_size, Y00[face], Y1minus1[face], Y10[face], Y11[face], Y2minus2[face], Y2minus1[face], Y20[face], Y21[face], Y22[face]);
}
projectSH(CubemapFace, edge_size,
Y00,
Y1minus1, Y10, Y11,
Y2minus2, Y2minus1, Y20, Y21, Y22,
blueSHCoeff, greenSHCoeff, redSHCoeff
);
for (unsigned face = 0; face < 6; face++)
{
delete[] Y00[face];
delete[] Y1minus1[face];
delete[] Y10[face];
delete[] Y11[face];
delete[] Y2minus2[face];
delete[] Y2minus1[face];
delete[] Y20[face];
delete[] Y21[face];
delete[] Y22[face];
}
}
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html
/** Returns the index-th pair from Hammersley set of pseudo random set.
Hammersley set is a uniform distribution between 0 and 1 for 2 components.
We use the natural indexation on the set to avoid storing the whole set.
\param index of the pair
\param size of the set. */
std::pair<float, float> HammersleySequence(int index, int samples)
{
float InvertedBinaryRepresentation = 0.;
for (size_t i = 0; i < 32; i++)
{
InvertedBinaryRepresentation += ((index >> i) & 0x1) * powf(.5, (float) (i + 1.));
}
return std::make_pair(float(index) / float(samples), InvertedBinaryRepresentation);
}
/** Returns a pseudo random (theta, phi) generated from a probability density function modeled after Phong function.
\param a pseudo random float pair from a uniform density function between 0 and 1.
\param exponent from the Phong formula. */
std::pair<float, float> ImportanceSamplingPhong(std::pair<float, float> Seeds, float exponent)
{
return std::make_pair(acosf(powf(Seeds.first, 1.f / (exponent + 1.f))), 2.f * 3.14f * Seeds.second);
}
static
core::matrix4 getPermutationMatrix(size_t indexX, float valX, size_t indexY, float valY, size_t indexZ, float valZ)
{
core::matrix4 resultMat;
float *M = resultMat.pointer();
memset(M, 0, 16 * sizeof(float));
assert(indexX < 4);
assert(indexY < 4);
assert(indexZ < 4);
M[indexX] = valX;
M[4 + indexY] = valY;
M[8 + indexZ] = valZ;
return resultMat;
}
GLuint generateSpecularCubemap(GLuint probe)
{
GLuint cubemap_texture;
glGenTextures(1, &cubemap_texture);
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemap_texture);
size_t cubemap_size = 256;
for (int i = 0; i < 6; i++)
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA16F, cubemap_size, cubemap_size, 0, GL_BGRA, GL_FLOAT, 0);
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
if (!UserConfigParams::m_dynamic_lights)
return cubemap_texture;
GLuint fbo;
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glViewport(0, 0, cubemap_size, cubemap_size);
GLenum bufs[] = { GL_COLOR_ATTACHMENT0 };
glDrawBuffers(1, bufs);
glUseProgram(UtilShader::SpecularIBLGenerator::getInstance()->Program);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
core::matrix4 M[6] = {
getPermutationMatrix(2, -1., 1, -1., 0, 1.),
getPermutationMatrix(2, 1., 1, -1., 0, -1.),
getPermutationMatrix(0, 1., 2, 1., 1, 1.),
getPermutationMatrix(0, 1., 2, -1., 1, -1.),
getPermutationMatrix(0, 1., 1, -1., 2, 1.),
getPermutationMatrix(0, -1., 1, -1., 2, -1.),
};
for (unsigned level = 0; level < 8; level++)
{
// Blinn Phong can be approximated by Phong with 4x the specular coefficient
// See http://seblagarde.wordpress.com/2012/03/29/relationship-between-phong-and-blinn-lighting-model/
// NOTE : Removed because it makes too sharp reflexion
float roughness = (8 - level) * pow(2.f, 10.f) / 8.f;
float viewportSize = float(1 << (8 - level));
float *tmp = new float[2048];
for (unsigned i = 0; i < 1024; i++)
{
std::pair<float, float> sample = ImportanceSamplingPhong(HammersleySequence(i, 1024), roughness);
tmp[2 * i] = sample.first;
tmp[2 * i + 1] = sample.second;
}
glBindVertexArray(0);
glActiveTexture(GL_TEXTURE0 + UtilShader::SpecularIBLGenerator::getInstance()->TU_Samples);
GLuint sampleTex, sampleBuffer;
glGenBuffers(1, &sampleBuffer);
glBindBuffer(GL_TEXTURE_BUFFER, sampleBuffer);
glBufferData(GL_TEXTURE_BUFFER, 2048 * sizeof(float), tmp, GL_STATIC_DRAW);
glGenTextures(1, &sampleTex);
glBindTexture(GL_TEXTURE_BUFFER, sampleTex);
glTexBuffer(GL_TEXTURE_BUFFER, GL_RG32F, sampleBuffer);
glBindVertexArray(SharedObject::FullScreenQuadVAO);
for (unsigned face = 0; face < 6; face++)
{
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, cubemap_texture, level);
GLuint status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
assert(status == GL_FRAMEBUFFER_COMPLETE);
UtilShader::SpecularIBLGenerator::getInstance()->SetTextureUnits(probe);
UtilShader::SpecularIBLGenerator::getInstance()->setUniforms(M[face], viewportSize);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
glActiveTexture(GL_TEXTURE0 + UtilShader::SpecularIBLGenerator::getInstance()->TU_Samples);
glBindBuffer(GL_TEXTURE_BUFFER, 0);
glBindTexture(GL_TEXTURE_BUFFER, 0);
delete[] tmp;
glDeleteTextures(1, &sampleTex);
glDeleteBuffers(1, &sampleBuffer);
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &fbo);
return cubemap_texture;
}

21
src/graphics/IBL.hpp Normal file
View File

@@ -0,0 +1,21 @@
#ifndef IBL_HPP
#define IBL_HPP
#include "gl_headers.hpp"
struct Color
{
float Red;
float Green;
float Blue;
};
/** Generate the 9 first SH coefficients for each color channel
using the cubemap provided by CubemapFace.
* \param textures sequence of 6 square textures.
* \param row/columns count of textures.
*/
void SphericalHarmonics(Color *CubemapFace[6], size_t edge_size, float *blueSHCoeff, float *greenSHCoeff, float *redSHCoeff);
GLuint generateSpecularCubemap(GLuint probe);
#endif

View File

@@ -46,17 +46,6 @@ debugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei le
return;
}
// Suppress warnings about GL_ARB_bindless_texture not being supported
// when we're not even using it
if (UserConfigParams::m_azdo == false &&
source == GL_DEBUG_SOURCE_SHADER_COMPILER_ARB && msg != NULL &&
std::string(msg).find("GL_ARB_bindless_texture") != std::string::npos)
{
Log::debug("GLWrap", "Suppressed warning: %s", msg);
return;
}
switch(source)
{
case GL_DEBUG_SOURCE_API_ARB:
@@ -182,8 +171,10 @@ unsigned GPUTimer::elapsedTimeus()
FrameBuffer::FrameBuffer() {}
FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, size_t w, size_t h, bool layered) :
RenderTargets(RTTs), DepthTexture(0), width(w), height(h), fbolayer(0)
FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, size_t w, size_t h,
bool layered)
: fbolayer(0), RenderTargets(RTTs), DepthTexture(0),
width(w), height(h)
{
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -201,8 +192,10 @@ RenderTargets(RTTs), DepthTexture(0), width(w), height(h), fbolayer(0)
assert(result == GL_FRAMEBUFFER_COMPLETE_EXT);
}
FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered) :
RenderTargets(RTTs), DepthTexture(DS), width(w), height(h), fbolayer(0)
FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w,
size_t h, bool layered)
: fbolayer(0), RenderTargets(RTTs), DepthTexture(DS), width(w),
height(h)
{
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -282,12 +275,12 @@ void draw3DLine(const core::vector3df& start,
end.X, end.Y, end.Z
};
glBindVertexArray(UtilShader::ColoredLine::vao);
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo);
glBindVertexArray(UtilShader::ColoredLine::getInstance()->vao);
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::getInstance()->vbo);
glBufferSubData(GL_ARRAY_BUFFER, 0, 6 * sizeof(float), vertex);
glUseProgram(UtilShader::ColoredLine::Program);
UtilShader::ColoredLine::setUniforms(color);
glUseProgram(UtilShader::ColoredLine::getInstance()->Program);
UtilShader::ColoredLine::getInstance()->setUniforms(color);
glDrawArrays(GL_LINES, 0, 2);
glGetError();

View File

@@ -55,7 +55,7 @@ private:
{
std::string s = version;
std::string::iterator p = s.begin();
while(p !=s.end() && (*p<'0') || (*p>'9') )
while( (p !=s.end()) && ((*p<'0') || (*p>'9')) )
p++;
s.erase(s.begin(), p);
m_version = StringUtils::splitToUInt(s, '.');
@@ -84,7 +84,9 @@ public:
Version(const std::string &driver_version, const std::string &card_name)
{
m_version.clear();
// Intel card: driver version = "3.1.0 - Build 9.17.10.3517"
// ---------------------------------------------------------
if (StringUtils::startsWith(card_name, "Intel"))
{
std::vector<std::string> s = StringUtils::split(driver_version, '-');
@@ -95,6 +97,19 @@ public:
}
}
// Nvidia: driver_version = "4.3.0 NVIDIA 340.58"
// ----------------------------------------------
if (driver_version.find("NVIDIA") != std::string::npos)
{
std::vector<std::string> s = StringUtils::split(driver_version, ' ');
if (s.size() == 3)
{
convertVersionString(s[2]);
return;
}
}
Log::warn("Graphics", "Can not find version for '%s' '%s' - ignored.",
driver_version.c_str(), card_name.c_str());
@@ -121,6 +136,14 @@ public:
if(other.m_version[i]>=m_version[i]) return false;
return true;
} // operator>
// ------------------------------------------------------------------------
bool operator<= (const Version &other) const
{
unsigned int min_n = std::min(m_version.size(), other.m_version.size());
for(unsigned int i=0; i<min_n; i++)
if(other.m_version[i]>m_version[i]) return false;
return true;
} // operator>
}; // class Version
// ============================================================================
@@ -232,10 +255,13 @@ public:
break;
case VERSION_LESS_EQUAL:
if(m_driver_version < version) return false;
case VERSION_LESS:
if(m_driver_version <= version) return false;
} // switch m_version_test
return true;
// -----------------------------------------------
}
} // applies
// ------------------------------------------------------------------------
/** Returns a list of options to disable. */
const std::vector<std::string>& getRestrictions() const
@@ -277,6 +303,7 @@ void init()
}
m_all_rules.push_back(new Rule(rule));
}
delete rules;
} // init
// ----------------------------------------------------------------------------

View File

@@ -67,6 +67,7 @@
#include "utils/vs.hpp"
#include <irrlicht.h>
#include "../lib/irrlicht/source/Irrlicht/CSkinnedMesh.h"
/* Build-time check that the Irrlicht we're building against works for us.
* Should help prevent distros building against an incompatible library.
@@ -494,10 +495,16 @@ void IrrDriver::initDevice()
m_need_rh_workaround = false;
m_need_srgb_workaround = false;
m_support_sdsm = true;
m_support_texture_compression = true;
#ifdef WIN32
// Fix for Intel Sandy Bridge on Windows which supports GL up to 3.1 only
if (strstr((const char *)glGetString(GL_VENDOR), "Intel") != NULL && (m_gl_major_version == 3 && m_gl_minor_version == 1))
m_need_ubo_workaround = true;
if (strstr((const char *)glGetString(GL_VENDOR), "Intel") != NULL)
{
// Intel on windows doesnt support srgb compressed textures properly
m_support_texture_compression = false;
// Fix for Intel Sandy Bridge on Windows which supports GL up to 3.1 only
if (m_gl_major_version == 3 && m_gl_minor_version == 1)
m_need_ubo_workaround = true;
}
#endif
// Fix for Nvidia and instanced RH
if (strstr((const char *)glGetString(GL_VENDOR), "NVIDIA") != NULL)
@@ -527,6 +534,7 @@ void IrrDriver::initDevice()
hasComputeShaders = false;
hasTextureStorage = false;
hasTextureView = false;
hasBindlessTexture = false;
// Default false value for hasVSLayer if --no-graphics argument is used
#if !defined(__APPLE__)
if (!ProfileWorld::isNoGraphics())
@@ -559,6 +567,10 @@ void IrrDriver::initDevice()
hasTextureView = true;
Log::info("GLDriver", "ARB Texture View enabled");
}
if (hasGLExtension("GL_ARB_bindless_texture")) {
hasBindlessTexture = true;
Log::info("GLDriver", "ARB Bindless Texture enabled");
}
m_support_sdsm = m_support_sdsm && hasComputeShaders && hasBuffserStorage;
std::string driver((char*)(glGetString(GL_VERSION)));
@@ -595,6 +607,14 @@ void IrrDriver::initDevice()
{
Log::info("irr_driver", "GLSL supported.");
}
if (!supportGeometryShader())
{
// these options require geometry shaders
UserConfigParams::m_shadows = 0;
UserConfigParams::m_gi = false;
}
// m_glsl might be reset in rtt if an error occurs.
if(m_glsl)
{
@@ -603,9 +623,6 @@ void IrrDriver::initDevice()
m_mrt.clear();
m_mrt.reallocate(2);
glGenQueries(1, &m_lensflare_query);
m_query_issued = false;
scene::IMesh * sphere = m_scene_manager->getGeometryCreator()->createSphereMesh(1, 16, 16);
for (unsigned i = 0; i < sphere->getMeshBufferCount(); ++i)
{
@@ -628,13 +645,6 @@ void IrrDriver::initDevice()
sphere->drop();
m_lensflare = new scene::CLensFlareSceneNode(NULL, m_scene_manager, -1);
video::ITexture * const tex = getTexture(FileManager::TEXTURE,
"lensflare.png" );
if (!tex) Log::fatal("irr_driver", "Cannot find lens flare texture");
m_lensflare->setMaterialTexture(0, tex);
m_lensflare->setAutomaticCulling(scene::EAC_OFF);
m_suncam = m_scene_manager->addCameraSceneNode(0, vector3df(0), vector3df(0), -1, false);
m_suncam->grab();
m_suncam->setParent(NULL);
@@ -994,6 +1004,26 @@ scene::IMesh *IrrDriver::getMesh(const std::string &filename)
return am->getMesh(0);
} // getMesh
// ----------------------------------------------------------------------------
/** Create a skinned mesh which has copied all meshbuffers and joints of the
* original mesh. Note, that this will not copy any other information like
* joints data.
* \param mesh Original mesh
* \return Newly created skinned mesh. You should call drop() when you don't
* need it anymore.
*/
scene::IAnimatedMesh *IrrDriver::copyAnimatedMesh(scene::IAnimatedMesh *orig)
{
using namespace scene;
CSkinnedMesh *mesh = dynamic_cast<CSkinnedMesh*>(orig);
if (!mesh)
{
Log::error("copyAnimatedMesh", "Given mesh was not a skinned mesh.");
return NULL;
}
return mesh->clone();
} // copyAnimatedMesh
// ----------------------------------------------------------------------------
/** Sets the material flags in this mesh depending on the settings in
* material_manager.
@@ -1233,22 +1263,25 @@ scene::IMesh *IrrDriver::createTexturedQuadMesh(const video::SMaterial *material
v1.Pos = core::vector3df(-w_2,-h_2,0);
v1.Normal = core::vector3df(0, 0, -1.0f);
v1.TCoords = core::vector2d<f32>(1,1);
v1.Color = video::SColor(255, 255, 255, 255);
video::S3DVertex v2;
v2.Pos = core::vector3df(w_2,-h_2,0);
v2.Normal = core::vector3df(0, 0, -1.0f);
v2.TCoords = core::vector2d<f32>(0,1);
v1.Color = video::SColor(255, 255, 255, 255);
video::S3DVertex v3;
v3.Pos = core::vector3df(w_2,h_2,0);
v3.Normal = core::vector3df(0, 0, -1.0f);
v3.TCoords = core::vector2d<f32>(0,0);
v3.Color = video::SColor(255, 255, 255, 255);
video::S3DVertex v4;
v4.Pos = core::vector3df(-w_2,h_2,0);
v4.Normal = core::vector3df(0, 0, -1.0f);
v4.TCoords = core::vector2d<f32>(1,0);
v4.Color = video::SColor(255, 255, 255, 255);
// Add the vertices
// ----------------
@@ -1369,7 +1402,8 @@ scene::ISceneNode *IrrDriver::addSkyBox(const std::vector<video::ITexture*> &tex
SkyboxTextures = texture;
SphericalHarmonicsTextures = sphericalHarmonics;
SkyboxCubeMap = 0;
m_SH_dirty = true;
SkyboxSpecularProbe = 0;
m_skybox_ready = false;
return m_scene_manager->addSkyBoxSceneNode(texture[0], texture[1],
texture[2], texture[3],
texture[4], texture[5]);
@@ -1379,10 +1413,14 @@ void IrrDriver::suppressSkyBox()
{
SkyboxTextures.clear();
SphericalHarmonicsTextures.clear();
m_SH_dirty = true;
m_skybox_ready = false;
if ((SkyboxCubeMap) && (!ProfileWorld::isNoGraphics()))
{
glDeleteTextures(1, &SkyboxCubeMap);
glDeleteTextures(1, &SkyboxSpecularProbe);
}
SkyboxCubeMap = 0;
SkyboxSpecularProbe = 0;
}
// ----------------------------------------------------------------------------
@@ -1761,7 +1799,7 @@ void IrrDriver::onUnloadWorld()
void IrrDriver::setAmbientLight(const video::SColorf &light)
{
m_scene_manager->setAmbientLight(light);
m_SH_dirty = true;
m_skybox_ready = false;
} // setAmbientLight
video::SColorf IrrDriver::getAmbientLight() const
@@ -2541,9 +2579,6 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos, float energy,
//m_sun_interposer->setPosition(pos);
//m_sun_interposer->updateAbsolutePosition();
m_lensflare->setPosition(pos);
m_lensflare->updateAbsolutePosition();
m_suncam->setPosition(pos);
m_suncam->updateAbsolutePosition();

View File

@@ -191,7 +191,9 @@ private:
bool hasComputeShaders;
bool hasTextureStorage;
bool hasTextureView;
bool hasBindlessTexture;
bool m_support_sdsm;
bool m_support_texture_compression;
bool m_need_ubo_workaround;
bool m_need_rh_workaround;
bool m_need_srgb_workaround;
@@ -234,11 +236,13 @@ private:
std::vector<video::ITexture *> SkyboxTextures;
std::vector<video::ITexture *> SphericalHarmonicsTextures;
bool m_SH_dirty;
bool m_skybox_ready;
public:
float blueSHCoeff[9];
float greenSHCoeff[9];
float redSHCoeff[9];
private:
/** Keep a trace of the origin file name of a texture. */
std::map<video::ITexture*, std::string> m_texturesFileName;
@@ -253,6 +257,7 @@ private:
public:
GLuint SkyboxCubeMap;
GLuint SkyboxSpecularProbe;
/** A simple class to store video resolutions. */
class VideoMode
{
@@ -282,7 +287,37 @@ public:
bool supportsSDSM() const
{
return m_support_sdsm;
return m_support_sdsm && UserConfigParams::m_sdsm;
}
bool supportTextureCompression() const
{
return m_support_texture_compression;
}
bool supportGeometryShader() const
{
return getGLSLVersion() >= 330;
}
bool usesShadows() const
{
return supportGeometryShader() && UserConfigParams::m_shadows && !needUBOWorkaround();
}
bool usesGI() const
{
return supportGeometryShader() && UserConfigParams::m_gi && !needUBOWorkaround();
}
bool usesTextureCompression() const
{
return UserConfigParams::m_texture_compression && m_support_texture_compression;
}
bool useAZDO() const
{
return hasBindlessTexture && UserConfigParams::m_azdo;
}
bool needUBOWorkaround() const
@@ -335,6 +370,11 @@ public:
return hasTextureView;
}
bool hasARBBindlessTexture() const
{
return hasBindlessTexture;
}
video::SColorf getAmbientLight() const;
struct GlowData {
@@ -375,10 +415,7 @@ private:
unsigned object_count[PASS_COUNT];
unsigned poly_count[PASS_COUNT];
u32 m_renderpass;
u32 m_lensflare_query;
bool m_query_issued;
class STKMeshSceneNode *m_sun_interposer;
scene::CLensFlareSceneNode *m_lensflare;
scene::ICameraSceneNode *m_suncam;
core::vector3df m_sundirection;
video::SColorf m_suncolor;
@@ -435,7 +472,7 @@ public:
void getOpenGLData(std::string *vendor, std::string *renderer,
std::string *version);
void generateSkyboxCubemap();
void prepareSkybox();
void generateDiffuseCoefficients();
void renderSkybox(const scene::ICameraSceneNode *camera);
void setPhase(STKRenderingPass);
@@ -451,6 +488,7 @@ public:
void setAllMaterialFlags(scene::IMesh *mesh) const;
scene::IAnimatedMesh *getAnimatedMesh(const std::string &name);
scene::IMesh *getMesh(const std::string &name);
scene::IAnimatedMesh *copyAnimatedMesh(scene::IAnimatedMesh *orig);
video::ITexture *applyMask(video::ITexture* texture,
const std::string& mask_path);
void displayFPS();
@@ -625,12 +663,7 @@ public:
// -----------------------------------------------------------------------
void setSunDirection(const core::vector3df &SunPos)
{
core::matrix4 m_view = getViewMatrix();
m_view.makeInverse();
m_view = m_view.getTransposed();
m_sundirection = SunPos;
m_view.transformVect(m_sundirection);
m_sundirection.normalize();
}
// -----------------------------------------------------------------------
video::SColorf getSunColor() const { return m_suncolor; }

View File

@@ -27,8 +27,9 @@
#include <stdexcept>
ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,255,255),
m_max_start_color(255,255,255,255), m_name(file)
ParticleKind::ParticleKind(const std::string &file)
: m_min_start_color(255,255,255,255),
m_max_start_color(255,255,255,255), m_name(file)
{
// ---- Initial values to prevent readin uninitialized values
m_max_size = 0.5f;
@@ -52,7 +53,7 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
m_fade_away_end = -1.0f;
m_force_lost_to_gravity_time = 1000;
m_emission_decay_rate = 0;
m_has_scale_affector = NULL;
m_has_scale_affector = false;
m_scale_affector_factor_x = 0.0f;
m_scale_affector_factor_y = 0.0f;
m_wind_speed = 0;

View File

@@ -113,7 +113,7 @@ public:
* @param file Name of the file to load (no full path)
* @throw std::runtime_error If the file cannot be found or is heavily malformed
*/
ParticleKind(const std::string file);
ParticleKind(const std::string &file);
virtual ~ParticleKind() {}
@@ -172,7 +172,7 @@ public:
bool randomizeInitialY() const { return m_randomize_initial_y; }
std::string getName() const { return m_name; }
const std::string& getName() const { return m_name; }
};
#endif

Some files were not shown because too many files have changed in this diff Show More