if fields["cb_finite_liquid"] then
engine.setting_set("liquid_finite", fields["cb_finite_liquid"])
end
-
+ if fields["cb_bumpmapping"] then
+ engine.setting_set("enable_bumpmapping", fields["cb_bumpmapping"])
+ end
+ if fields["cb_parallax"] then
+ engine.setting_set("enable_parallax_occlusion", fields["cb_parallax"])
+ end
+ if fields["cb_waving_water"] then
+ engine.setting_set("enable_waving_water", fields["cb_waving_water"])
+ end
+ if fields["cb_waving_leaves"] then
+ engine.setting_set("enable_waving_leaves", fields["cb_waving_leaves"])
+ end
+ if fields["cb_waving_plants"] then
+ engine.setting_set("enable_waving_plants", fields["cb_waving_plants"])
+ end
if fields["btn_change_keys"] ~= nil then
engine.show_keys_menu()
end
--------------------------------------------------------------------------------
function tabbuilder.tab_settings()
- return "vertlabel[0,0;" .. fgettext("SETTINGS") .. "]" ..
- "checkbox[1,0.75;cb_fancy_trees;".. fgettext("Fancy trees") .. ";"
+ tab_string =
+ "vertlabel[0,0;" .. fgettext("SETTINGS") .. "]" ..
+ "checkbox[1,0;cb_fancy_trees;".. fgettext("Fancy Trees") .. ";"
.. dump(engine.setting_getbool("new_style_leaves")) .. "]"..
- "checkbox[1,1.25;cb_smooth_lighting;".. fgettext("Smooth Lighting")
+ "checkbox[1,0.5;cb_smooth_lighting;".. fgettext("Smooth Lighting")
.. ";".. dump(engine.setting_getbool("smooth_lighting")) .. "]"..
- "checkbox[1,1.75;cb_3d_clouds;".. fgettext("3D Clouds") .. ";"
+ "checkbox[1,1;cb_3d_clouds;".. fgettext("3D Clouds") .. ";"
.. dump(engine.setting_getbool("enable_3d_clouds")) .. "]"..
- "checkbox[1,2.25;cb_opaque_water;".. fgettext("Opaque Water") .. ";"
+ "checkbox[1,1.5;cb_opaque_water;".. fgettext("Opaque Water") .. ";"
.. dump(engine.setting_getbool("opaque_water")) .. "]"..
+ "checkbox[1,2.0;cb_pre_ivis;".. fgettext("Preload item visuals") .. ";"
+ .. dump(engine.setting_getbool("preload_item_visuals")) .. "]"..
+ "checkbox[1,2.5;cb_particles;".. fgettext("Enable Particles") .. ";"
+ .. dump(engine.setting_getbool("enable_particles")) .. "]"..
+ "checkbox[1,3.0;cb_finite_liquid;".. fgettext("Finite Liquid") .. ";"
+ .. dump(engine.setting_getbool("liquid_finite")) .. "]"..
- "checkbox[4,0.75;cb_mipmapping;".. fgettext("Mip-Mapping") .. ";"
+ "checkbox[4.5,0;cb_mipmapping;".. fgettext("Mip-Mapping") .. ";"
.. dump(engine.setting_getbool("mip_map")) .. "]"..
- "checkbox[4,1.25;cb_anisotrophic;".. fgettext("Anisotropic Filtering") .. ";"
+ "checkbox[4.5,0.5;cb_anisotrophic;".. fgettext("Anisotropic Filtering") .. ";"
.. dump(engine.setting_getbool("anisotropic_filter")) .. "]"..
- "checkbox[4,1.75;cb_bilinear;".. fgettext("Bi-Linear Filtering") .. ";"
+ "checkbox[4.5,1.0;cb_bilinear;".. fgettext("Bi-Linear Filtering") .. ";"
.. dump(engine.setting_getbool("bilinear_filter")) .. "]"..
- "checkbox[4,2.25;cb_trilinear;".. fgettext("Tri-Linear Filtering") .. ";"
+ "checkbox[4.5,1.5;cb_trilinear;".. fgettext("Tri-Linear Filtering") .. ";"
.. dump(engine.setting_getbool("trilinear_filter")) .. "]"..
- "checkbox[7.5,0.75;cb_shaders;".. fgettext("Shaders") .. ";"
+ "checkbox[8,0;cb_shaders;".. fgettext("Shaders") .. ";"
.. dump(engine.setting_getbool("enable_shaders")) .. "]"..
- "checkbox[7.5,1.25;cb_pre_ivis;".. fgettext("Preload item visuals") .. ";"
- .. dump(engine.setting_getbool("preload_item_visuals")) .. "]"..
- "checkbox[7.5,1.75;cb_particles;".. fgettext("Enable Particles") .. ";"
- .. dump(engine.setting_getbool("enable_particles")) .. "]"..
- "checkbox[7.5,2.25;cb_finite_liquid;".. fgettext("Finite Liquid") .. ";"
- .. dump(engine.setting_getbool("liquid_finite")) .. "]"..
-
- "button[1,4.25;2.25,0.5;btn_change_keys;".. fgettext("Change keys") .. "]"
+ "button[1,4.5;2.25,0.5;btn_change_keys;".. fgettext("Change keys") .. "]"
+
+if engine.setting_getbool("enable_shaders") then
+ tab_string = tab_string ..
+ "checkbox[8,0.5;cb_bumpmapping;".. fgettext("Bumpmapping") .. ";"
+ .. dump(engine.setting_getbool("enable_bumpmapping")) .. "]"..
+ "checkbox[8,1.0;cb_parallax;".. fgettext("Parallax Occlusion") .. ";"
+ .. dump(engine.setting_getbool("enable_parallax_occlusion")) .. "]"..
+ "checkbox[8,1.5;cb_waving_water;".. fgettext("Waving Water") .. ";"
+ .. dump(engine.setting_getbool("enable_waving_water")) .. "]"..
+ "checkbox[8,2.0;cb_waving_leaves;".. fgettext("Waving Leaves") .. ";"
+ .. dump(engine.setting_getbool("enable_waving_leaves")) .. "]"..
+ "checkbox[8,2.5;cb_waving_plants;".. fgettext("Waving Plants") .. ";"
+ .. dump(engine.setting_getbool("enable_waving_plants")) .. "]"
+else
+ tab_string = tab_string ..
+ "textlist[8.33,0.7;4,1;;#888888" .. fgettext("Bumpmapping") .. ";0;true]" ..
+ "textlist[8.33,1.2;4,1;;#888888" .. fgettext("Parallax Occlusion") .. ";0;true]" ..
+ "textlist[8.33,1.7;4,1;;#888888" .. fgettext("Waving Water") .. ";0;true]" ..
+ "textlist[8.33,2.2;4,1;;#888888" .. fgettext("Waving Leaves") .. ";0;true]" ..
+ "textlist[8.33,2.7;4,1;;#888888" .. fgettext("Waving Plants") .. ";0;true]"
+ end
+return tab_string
end
--------------------------------------------------------------------------------
--- /dev/null
+trans_alphach
--- /dev/null
+#version 120\r
+\r
+uniform sampler2D baseTexture;\r
+uniform sampler2D normalTexture;\r
+uniform sampler2D useNormalmap;\r
+\r
+uniform float enableBumpmapping;\r
+uniform float enableParallaxOcclusion;\r
+uniform float parallaxOcclusionScale;\r
+uniform float parallaxOcclusionBias;\r
+\r
+\r
+uniform vec4 skyBgColor;\r
+uniform float fogDistance;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 tsEyeVec;\r
+varying vec3 eyeVec;\r
+\r
+const float e = 2.718281828459;\r
+\r
+void main (void)\r
+{\r
+ float use_normalmap = texture2D(useNormalmap,vec2(1.0,1.0)).r;\r
+ float enable_bumpmapping = enableBumpmapping;\r
+\r
+ vec3 color;\r
+ vec2 uv = gl_TexCoord[0].st;\r
+ float height;\r
+ vec2 tsEye = vec2(tsEyeVec.x,-tsEyeVec.y);\r
+ \r
+ if ((enableParallaxOcclusion == 1.0) && (use_normalmap > 0.0)) {\r
+ float map_height = texture2D(normalTexture, uv).a;\r
+ if (map_height < 1.0){\r
+ float height = parallaxOcclusionScale * map_height - parallaxOcclusionBias;\r
+ uv = uv + height * tsEye;\r
+ }\r
+ }\r
+\r
+ if ((enable_bumpmapping == 1.0) && (use_normalmap > 0.0)) {\r
+ vec3 base = texture2D(baseTexture, uv).rgb;\r
+ vec3 vVec = normalize(eyeVec);\r
+ vec3 bump = normalize(texture2D(normalTexture, uv).xyz * 2.0 - 1.0);\r
+ vec3 R = reflect(-vVec, bump);\r
+ vec3 lVec = normalize(vVec);\r
+ float diffuse = max(dot(lVec, bump), 0.0);\r
+ float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);\r
+ color = mix (base,diffuse*base,1.0) + 0.1 * specular * diffuse;\r
+ } else {\r
+ color = texture2D(baseTexture, uv).rgb;\r
+ }\r
+\r
+ float alpha = texture2D(baseTexture, uv).a;\r
+ vec4 col = vec4(color.r, color.g, color.b, alpha);\r
+ col *= gl_Color;\r
+ col = col * col; // SRGB -> Linear\r
+ col *= 1.8;\r
+ col.r = 1.0 - exp(1.0 - col.r) / e;\r
+ col.g = 1.0 - exp(1.0 - col.g) / e;\r
+ col.b = 1.0 - exp(1.0 - col.b) / e;\r
+ col = sqrt(col); // Linear -> SRGB\r
+ if(fogDistance != 0.0){\r
+ float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
+ col = mix(col, skyBgColor, d);\r
+ }\r
+ gl_FragColor = vec4(col.r, col.g, col.b, alpha); \r
+}\r
--- /dev/null
+#version 120\r
+\r
+uniform mat4 mWorldViewProj;\r
+uniform mat4 mInvWorld;\r
+uniform mat4 mTransWorld;\r
+uniform float dayNightRatio;\r
+\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 eyeVec;\r
+varying vec3 tsEyeVec;\r
+\r
+void main(void)\r
+{\r
+ gl_Position = mWorldViewProj * gl_Vertex;\r
+ vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
+\r
+ vec3 normal,tangent,binormal; \r
+ normal = normalize(gl_NormalMatrix * gl_Normal);\r
+\r
+ if (gl_Normal.x > 0.5) {\r
+ // 1.0, 0.0, 0.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, -1.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));\r
+ } else if (gl_Normal.x < -0.5) {\r
+ // -1.0, 0.0, 0.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));\r
+ } else if (gl_Normal.y > 0.5) {\r
+ // 0.0, 1.0, 0.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));\r
+ } else if (gl_Normal.y < -0.5) {\r
+ // 0.0, -1.0, 0.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));\r
+ } else if (gl_Normal.z > 0.5) {\r
+ // 0.0, 0.0, 1.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));\r
+ } else if (gl_Normal.z < -0.5) {\r
+ // 0.0, 0.0, -1.0\r
+ tangent = normalize(gl_NormalMatrix * vec3(-1.0, 0.0, 0.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));\r
+ }\r
+ \r
+ mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,\r
+ tangent.y, binormal.y, normal.y,\r
+ tangent.z, binormal.z, normal.z);\r
+\r
+ eyeVec = (gl_ModelViewMatrix * gl_Vertex).xyz;\r
+ tsEyeVec = normalize(eyeVec * tbnMatrix);\r
+ \r
+ vec4 color;\r
+ //color = vec4(1.0, 1.0, 1.0, 1.0);\r
+\r
+ float day = gl_Color.r;\r
+ float night = gl_Color.g;\r
+ float light_source = gl_Color.b;\r
+\r
+ /*color.r = mix(night, day, dayNightRatio);\r
+ color.g = color.r;\r
+ color.b = color.r;*/\r
+\r
+ float rg = mix(night, day, dayNightRatio);\r
+ rg += light_source * 2.5; // Make light sources brighter\r
+ float b = rg;\r
+\r
+ // Moonlight is blue\r
+ b += (day - night) / 13.0;\r
+ rg -= (day - night) / 13.0;\r
+\r
+ // Emphase blue a bit in darker places\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
+\r
+ // Artificial light is yellow-ish\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
+\r
+ color.r = clamp(rg,0.0,1.0);\r
+ color.g = clamp(rg,0.0,1.0);\r
+ color.b = clamp(b,0.0,1.0);\r
+\r
+ // Make sides and bottom darker than the top\r
+ color = color * color; // SRGB -> Linear\r
+ if(gl_Normal.y <= 0.5)\r
+ color *= 0.6;\r
+ //color *= 0.7;\r
+ color = sqrt(color); // Linear -> SRGB\r
+\r
+ color.a = gl_Color.a;\r
+\r
+ gl_FrontColor = gl_BackColor = color;\r
+\r
+ gl_TexCoord[0] = gl_MultiTexCoord0;\r
+\r
+}\r
+++ /dev/null
-trans_alphach
+++ /dev/null
-\r
-uniform sampler2D myTexture;\r
-uniform sampler2D normalTexture;\r
-\r
-uniform vec4 skyBgColor;\r
-uniform float fogDistance;\r
-\r
-varying vec3 vPosition;\r
-\r
-varying vec3 viewVec;\r
-\r
-void main (void)\r
-{\r
- vec4 col = texture2D(myTexture, vec2(gl_TexCoord[0]));\r
- float alpha = col.a;\r
- vec2 uv = gl_TexCoord[0].st;\r
- vec4 base = texture2D(myTexture, uv);\r
- vec4 final_color = vec4(0.2, 0.2, 0.2, 1.0) * base;\r
- vec3 vVec = normalize(viewVec);\r
- vec3 bump = normalize(texture2D(normalTexture, uv).xyz * 2.0 - 1.0);\r
- vec3 R = reflect(-vVec, bump);\r
- vec3 lVec = normalize(vec3(0.0, -0.4, 0.5));\r
- float diffuse = max(dot(lVec, bump), 0.0);\r
- \r
- vec3 color = diffuse * texture2D(myTexture, gl_TexCoord[0].st).rgb;\r
- \r
- \r
- float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);\r
- color += vec3(0.2*specular*diffuse);\r
- \r
- \r
- col = vec4(color.r, color.g, color.b, alpha);\r
- col *= gl_Color;\r
- col = col * col; // SRGB -> Linear\r
- col *= 1.8;\r
- col.r = 1.0 - exp(1.0 - col.r) / exp(1.0);\r
- col.g = 1.0 - exp(1.0 - col.g) / exp(1.0);\r
- col.b = 1.0 - exp(1.0 - col.b) / exp(1.0);\r
- col = sqrt(col); // Linear -> SRGB\r
- if(fogDistance != 0.0){\r
- float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
- alpha = mix(alpha, 0.0, d);\r
- }\r
-\r
- gl_FragColor = vec4(col.r, col.g, col.b, alpha); \r
-}\r
+++ /dev/null
-\r
-uniform mat4 mWorldViewProj;\r
-uniform mat4 mInvWorld;\r
-uniform mat4 mTransWorld;\r
-uniform float dayNightRatio;\r
-\r
-varying vec3 vPosition;\r
-varying vec3 viewVec;\r
-\r
-void main(void)\r
-{\r
- gl_Position = mWorldViewProj * gl_Vertex;\r
-\r
- vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
- \r
- vec3 tangent; \r
- vec3 binormal; \r
-\r
- vec3 c1 = cross( gl_Normal, vec3(0.0, 0.0, 1.0) ); \r
- vec3 c2 = cross( gl_Normal, vec3(0.0, 1.0, 0.0) ); \r
-\r
- if( length(c1)>length(c2) )\r
- {\r
- tangent = c1; \r
- }\r
- else\r
- {\r
- tangent = c2; \r
- }\r
-\r
- tangent = normalize(tangent);\r
-\r
-//binormal = cross(gl_Normal, tangent); \r
-//binormal = normalize(binormal);\r
-\r
- vec4 color;\r
- //color = vec4(1.0, 1.0, 1.0, 1.0);\r
-\r
- float day = gl_Color.r;\r
- float night = gl_Color.g;\r
- float light_source = gl_Color.b;\r
-\r
- /*color.r = mix(night, day, dayNightRatio);\r
- color.g = color.r;\r
- color.b = color.r;*/\r
-\r
- float rg = mix(night, day, dayNightRatio);\r
- rg += light_source * 1.5; // Make light sources brighter\r
- float b = rg;\r
-\r
- // Moonlight is blue\r
- b += (day - night) / 13.0;\r
- rg -= (day - night) / 13.0;\r
-\r
- // Emphase blue a bit in darker places\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
-\r
- // Artificial light is yellow-ish\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
-\r
- color.r = rg;\r
- color.g = rg;\r
- color.b = b;\r
-\r
- // Make sides and bottom darker than the top\r
- color = color * color; // SRGB -> Linear\r
- if(gl_Normal.y <= 0.5)\r
- color *= 0.6;\r
- //color *= 0.7;\r
- color = sqrt(color); // Linear -> SRGB\r
-\r
- color.a = gl_Color.a;\r
-\r
- gl_FrontColor = gl_BackColor = color;\r
-\r
- gl_TexCoord[0] = gl_MultiTexCoord0;\r
- \r
- vec3 n1 = normalize(gl_NormalMatrix * gl_Normal);\r
- vec4 tangent1 = vec4(tangent.x, tangent.y, tangent.z, 0);\r
- //vec3 t1 = normalize(gl_NormalMatrix * tangent1);\r
- //vec3 b1 = cross(n1, t1);\r
-\r
- vec3 v;\r
- vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);\r
- vec3 vVec = -vVertex;\r
- //v.x = dot(vVec, t1);\r
- //v.y = dot(vVec, b1);\r
- //v.z = dot(vVec, n1);\r
- //viewVec = vVec;\r
- viewVec = normalize(vec3(0.0, -0.4, 0.5));\r
- //Vector representing the 0th texture coordinate passed to fragment shader\r
-//gl_TexCoord[0] = vec2(gl_MultiTexCoord0);\r
-\r
-// Transform the current vertex\r
-//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\r
-}\r
+++ /dev/null
-trans_alphach_ref
+++ /dev/null
-\r
-uniform sampler2D myTexture;\r
-uniform sampler2D normalTexture;\r
-\r
-uniform vec4 skyBgColor;\r
-uniform float fogDistance;\r
-\r
-varying vec3 vPosition;\r
-\r
-varying vec3 viewVec;\r
-\r
-void main (void)\r
-{\r
- vec4 col = texture2D(myTexture, vec2(gl_TexCoord[0]));\r
- float alpha = col.a;\r
- vec2 uv = gl_TexCoord[0].st;\r
- vec4 base = texture2D(myTexture, uv);\r
- vec4 final_color = vec4(0.2, 0.2, 0.2, 1.0) * base;\r
- vec3 vVec = normalize(viewVec);\r
- vec3 bump = normalize(texture2D(normalTexture, uv).xyz * 2.0 - 1.0);\r
- vec3 R = reflect(-vVec, bump);\r
- vec3 lVec = normalize(vec3(0.0, -0.4, 0.5));\r
- float diffuse = max(dot(lVec, bump), 0.0);\r
- \r
- vec3 color = diffuse * texture2D(myTexture, gl_TexCoord[0].st).rgb;\r
- \r
- \r
- float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);\r
- color += vec3(0.2*specular*diffuse);\r
- \r
- \r
- col = vec4(color.r, color.g, color.b, alpha);\r
- col *= gl_Color;\r
- col = col * col; // SRGB -> Linear\r
- col *= 1.8;\r
- col.r = 1.0 - exp(1.0 - col.r) / exp(1.0);\r
- col.g = 1.0 - exp(1.0 - col.g) / exp(1.0);\r
- col.b = 1.0 - exp(1.0 - col.b) / exp(1.0);\r
- col = sqrt(col); // Linear -> SRGB\r
- if(fogDistance != 0.0){\r
- float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
- col = mix(col, skyBgColor, d);\r
- }\r
- gl_FragColor = vec4(col.r, col.g, col.b, alpha); \r
-}\r
+++ /dev/null
-\r
-uniform mat4 mWorldViewProj;\r
-uniform mat4 mInvWorld;\r
-uniform mat4 mTransWorld;\r
-uniform float dayNightRatio;\r
-\r
-varying vec3 vPosition;\r
-varying vec3 viewVec;\r
-\r
-void main(void)\r
-{\r
- gl_Position = mWorldViewProj * gl_Vertex;\r
-\r
- vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
- \r
- vec3 tangent; \r
- vec3 binormal; \r
-\r
- vec3 c1 = cross( gl_Normal, vec3(0.0, 0.0, 1.0) ); \r
- vec3 c2 = cross( gl_Normal, vec3(0.0, 1.0, 0.0) ); \r
-\r
- if( length(c1)>length(c2) )\r
- {\r
- tangent = c1; \r
- }\r
- else\r
- {\r
- tangent = c2; \r
- }\r
-\r
- tangent = normalize(tangent);\r
-\r
-//binormal = cross(gl_Normal, tangent); \r
-//binormal = normalize(binormal);\r
-\r
- vec4 color;\r
- //color = vec4(1.0, 1.0, 1.0, 1.0);\r
-\r
- float day = gl_Color.r;\r
- float night = gl_Color.g;\r
- float light_source = gl_Color.b;\r
-\r
- /*color.r = mix(night, day, dayNightRatio);\r
- color.g = color.r;\r
- color.b = color.r;*/\r
-\r
- float rg = mix(night, day, dayNightRatio);\r
- rg += light_source * 1.5; // Make light sources brighter\r
- float b = rg;\r
-\r
- // Moonlight is blue\r
- b += (day - night) / 13.0;\r
- rg -= (day - night) / 13.0;\r
-\r
- // Emphase blue a bit in darker places\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
-\r
- // Artificial light is yellow-ish\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
-\r
- color.r = rg;\r
- color.g = rg;\r
- color.b = b;\r
-\r
- // Make sides and bottom darker than the top\r
- color = color * color; // SRGB -> Linear\r
- if(gl_Normal.y <= 0.5)\r
- color *= 0.6;\r
- //color *= 0.7;\r
- color = sqrt(color); // Linear -> SRGB\r
-\r
- color.a = gl_Color.a;\r
-\r
- gl_FrontColor = gl_BackColor = color;\r
-\r
- gl_TexCoord[0] = gl_MultiTexCoord0;\r
- \r
- vec3 n1 = normalize(gl_NormalMatrix * gl_Normal);\r
- vec4 tangent1 = vec4(tangent.x, tangent.y, tangent.z, 0);\r
- //vec3 t1 = normalize(gl_NormalMatrix * tangent1);\r
- //vec3 b1 = cross(n1, t1);\r
-\r
- vec3 v;\r
- vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);\r
- vec3 vVec = -vVertex;\r
- //v.x = dot(vVec, t1);\r
- //v.y = dot(vVec, b1);\r
- //v.z = dot(vVec, n1);\r
- //viewVec = vVec;\r
- viewVec = normalize(vec3(0.0, -0.4, 0.5));\r
- //Vector representing the 0th texture coordinate passed to fragment shader\r
-//gl_TexCoord[0] = vec2(gl_MultiTexCoord0);\r
-\r
-// Transform the current vertex\r
-//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\r
-}\r
--- /dev/null
+trans_alphach_ref
--- /dev/null
+#version 120\r
+\r
+uniform sampler2D baseTexture;\r
+uniform sampler2D normalTexture;\r
+uniform sampler2D useNormalmap;\r
+\r
+uniform float enableBumpmapping;\r
+\r
+uniform vec4 skyBgColor;\r
+uniform float fogDistance;\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 eyeVec;\r
+varying vec4 vColor;\r
+\r
+const float e = 2.718281828459;\r
+\r
+void main (void)\r
+{\r
+ float use_normalmap = texture2D(useNormalmap,vec2(1.0,1.0)).r;\r
+ float enable_bumpmapping = enableBumpmapping;\r
+\r
+ vec3 color;\r
+ vec2 uv = gl_TexCoord[0].st;\r
+\r
+ if ((enable_bumpmapping == 1.0) && (use_normalmap > 0.0)) {\r
+ vec3 base = texture2D(baseTexture, uv).rgb;\r
+ vec3 vVec = normalize(eyeVec);\r
+ vec3 bump = normalize(texture2D(normalTexture, uv).xyz * 2.0 - 1.0);\r
+ vec3 R = reflect(-vVec, bump);\r
+ vec3 lVec = normalize(vVec);\r
+ float diffuse = max(dot(lVec, bump), 0.0);\r
+ float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);\r
+ color = mix (base,diffuse*base,1.0) + 0.1 * specular * diffuse;\r
+ } else {\r
+ color = texture2D(baseTexture, uv).rgb;\r
+ }\r
+\r
+ float alpha = texture2D(baseTexture, uv).a;\r
+ vec4 col = vec4(color.r, color.g, color.b, alpha);\r
+ col *= gl_Color;\r
+ col = col * col; // SRGB -> Linear\r
+ col *= 1.8;\r
+ col.r = 1.0 - exp(1.0 - col.r) / e;\r
+ col.g = 1.0 - exp(1.0 - col.g) / e;\r
+ col.b = 1.0 - exp(1.0 - col.b) / e;\r
+ col = sqrt(col); // Linear -> SRGB\r
+ if(fogDistance != 0.0){\r
+ float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
+ col = mix(col, skyBgColor, d);\r
+ }\r
+ gl_FragColor = vec4(col.r, col.g, col.b, alpha); \r
+}\r
--- /dev/null
+#version 120\r
+\r
+uniform mat4 mWorldViewProj;\r
+uniform mat4 mInvWorld;\r
+uniform mat4 mTransWorld;\r
+uniform float dayNightRatio;\r
+uniform float animationTimer;\r
+\r
+uniform float enableWavingLeaves;\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 eyeVec;\r
+\r
+float smoothCurve( float x ) { \r
+ return x * x *( 3.0 - 2.0 * x ); \r
+} \r
+float triangleWave( float x ) { \r
+ return abs( fract( x + 0.5 ) * 2.0 - 1.0 ); \r
+} \r
+float smoothTriangleWave( float x ) { \r
+ return smoothCurve( triangleWave( x ) ) * 2.0 - 1.0; \r
+} \r
+\r
+void main(void)\r
+{\r
+ gl_TexCoord[0] = gl_MultiTexCoord0;\r
+ if (enableWavingLeaves == 1.0){ \r
+ vec4 pos = gl_Vertex;\r
+ vec4 pos2 = mTransWorld*gl_Vertex;\r
+ pos.x += (smoothTriangleWave(animationTimer*10.0 + pos2.x * 0.01 + pos2.z * 0.01) * 2.0 - 1.0) * 0.4;\r
+ pos.y += (smoothTriangleWave(animationTimer*15.0 + pos2.x * -0.01 + pos2.z * -0.01) * 2.0 - 1.0) * 0.2;\r
+ pos.z += (smoothTriangleWave(animationTimer*10.0 + pos2.x * -0.01 + pos2.z * -0.01) * 2.0 - 1.0) * 0.4;\r
+ gl_Position = mWorldViewProj * pos;\r
+ }\r
+ else \r
+ gl_Position = mWorldViewProj * gl_Vertex;\r
+\r
+ vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
+\r
+ eyeVec = (gl_ModelViewMatrix * gl_Vertex).xyz;\r
+\r
+ vec4 color;\r
+ //color = vec4(1.0, 1.0, 1.0, 1.0);\r
+\r
+ float day = gl_Color.r;\r
+ float night = gl_Color.g;\r
+ float light_source = gl_Color.b;\r
+\r
+ /*color.r = mix(night, day, dayNightRatio);\r
+ color.g = color.r;\r
+ color.b = color.r;*/\r
+\r
+ float rg = mix(night, day, dayNightRatio);\r
+ rg += light_source * 2.5; // Make light sources brighter\r
+ float b = rg;\r
+\r
+ // Moonlight is blue\r
+ b += (day - night) / 13.0;\r
+ rg -= (day - night) / 13.0;\r
+\r
+ // Emphase blue a bit in darker places\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
+\r
+ // Artificial light is yellow-ish\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
+\r
+ color.r = clamp(rg,0.0,1.0);\r
+ color.g = clamp(rg,0.0,1.0);\r
+ color.b = clamp(b,0.0,1.0);\r
+\r
+ // Make sides and bottom darker than the top\r
+ color = color * color; // SRGB -> Linear\r
+ if(gl_Normal.y <= 0.5)\r
+ color *= 0.6;\r
+ //color *= 0.7;\r
+ color = sqrt(color); // Linear -> SRGB\r
+\r
+ color.a = gl_Color.a;\r
+\r
+ gl_FrontColor = gl_BackColor = color;\r
+\r
+ gl_TexCoord[0] = gl_MultiTexCoord0;\r
+\r
+}\r
--- /dev/null
+trans_alphach
--- /dev/null
+#version 120\r
+\r
+uniform sampler2D baseTexture;\r
+uniform sampler2D normalTexture;\r
+uniform sampler2D useNormalmap;\r
+\r
+uniform float enableBumpmapping;\r
+\r
+uniform vec4 skyBgColor;\r
+uniform float fogDistance;\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 eyeVec;\r
+\r
+const float e = 2.718281828459;\r
+\r
+void main (void)\r
+{\r
+ float use_normalmap = texture2D(useNormalmap,vec2(1.0,1.0)).r;\r
+ float enable_bumpmapping = enableBumpmapping;\r
+\r
+ vec3 color;\r
+ vec2 uv = gl_TexCoord[0].st;\r
+\r
+ if ((enable_bumpmapping == 1.0) && (use_normalmap > 0.0)) {\r
+ vec3 base = texture2D(baseTexture, uv).rgb;\r
+ vec3 vVec = normalize(eyeVec);\r
+ vec3 bump = normalize(texture2D(normalTexture, uv).xyz * 2.0 - 1.0);\r
+ vec3 R = reflect(-vVec, bump);\r
+ vec3 lVec = normalize(vVec);\r
+ float diffuse = max(dot(vec3(-1.0, -0.4, 0.5), bump), 0.0);\r
+ float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);\r
+ color = mix (base,diffuse*base,1.0) + 0.1 * specular * diffuse;\r
+ } else {\r
+ color = texture2D(baseTexture, uv).rgb;\r
+ }\r
+\r
+ float alpha = gl_Color.a;\r
+ vec4 col = vec4(color.r, color.g, color.b, alpha);\r
+ col *= gl_Color;\r
+ col = col * col; // SRGB -> Linear\r
+ col *= 1.8;\r
+ col.r = 1.0 - exp(1.0 - col.r) / e;\r
+ col.g = 1.0 - exp(1.0 - col.g) / e;\r
+ col.b = 1.0 - exp(1.0 - col.b) / e;\r
+ col = sqrt(col); // Linear -> SRGB\r
+ if(fogDistance != 0.0){\r
+ float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
+ alpha = mix(alpha, 0.0, d);\r
+ }\r
+ gl_FragColor = vec4(col.r, col.g, col.b, alpha); \r
+}\r
--- /dev/null
+#version 120\r
+\r
+uniform mat4 mWorldViewProj;\r
+uniform mat4 mInvWorld;\r
+uniform mat4 mTransWorld;\r
+uniform float dayNightRatio;\r
+uniform float animationTimer;\r
+\r
+uniform float enableWavingWater;\r
+uniform float waterWaveLength;\r
+uniform float waterWaveHeight;\r
+uniform float waterWaveSpeed;\r
+\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 eyeVec;\r
+\r
+void main(void)\r
+{\r
+ if (enableWavingWater == 1.0){\r
+ vec4 pos2 = gl_Vertex;\r
+ pos2.y -= 2.0;\r
+ pos2.y -= sin (pos2.z/waterWaveLength + animationTimer * waterWaveSpeed * waterWaveLength) * waterWaveHeight\r
+ + sin ((pos2.z/waterWaveLength + animationTimer * waterWaveSpeed * waterWaveLength) / 7.0) * waterWaveHeight;\r
+ gl_Position = mWorldViewProj * pos2;\r
+ } else\r
+ gl_Position = mWorldViewProj * gl_Vertex;\r
+\r
+ eyeVec = (gl_ModelViewMatrix * gl_Vertex).xyz;\r
+ vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
+\r
+ vec4 color;\r
+ //color = vec4(1.0, 1.0, 1.0, 1.0);\r
+\r
+ float day = gl_Color.r;\r
+ float night = gl_Color.g;\r
+ float light_source = gl_Color.b;\r
+\r
+ /*color.r = mix(night, day, dayNightRatio);\r
+ color.g = color.r;\r
+ color.b = color.r;*/\r
+\r
+ float rg = mix(night, day, dayNightRatio);\r
+ rg += light_source * 2.5; // Make light sources brighter\r
+ float b = rg;\r
+\r
+ // Moonlight is blue\r
+ b += (day - night) / 13.0;\r
+ rg -= (day - night) / 13.0;\r
+\r
+ // Emphase blue a bit in darker places\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
+\r
+ // Artificial light is yellow-ish\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
+\r
+ color.r = clamp(rg,0.0,1.0);\r
+ color.g = clamp(rg,0.0,1.0);\r
+ color.b = clamp(b,0.0,1.0);\r
+ color.a = gl_Color.a;\r
+\r
+ gl_FrontColor = gl_BackColor = color;\r
+\r
+ gl_TexCoord[0] = gl_MultiTexCoord0;\r
+\r
+}\r
--- /dev/null
+trans_alphach_ref
--- /dev/null
+#version 120\r
+\r
+uniform sampler2D baseTexture;\r
+uniform sampler2D normalTexture;\r
+uniform sampler2D useNormalmap;\r
+\r
+uniform float enableBumpmapping;\r
+\r
+uniform vec4 skyBgColor;\r
+uniform float fogDistance;\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 eyeVec;\r
+\r
+const float e = 2.718281828459;\r
+\r
+void main (void)\r
+{\r
+ float use_normalmap = texture2D(useNormalmap,vec2(1.0,1.0)).r;\r
+ float enable_bumpmapping = enableBumpmapping;\r
+\r
+ vec3 color;\r
+ vec2 uv = gl_TexCoord[0].st;\r
+\r
+ if ((enable_bumpmapping == 1.0) && (use_normalmap > 0.0)) {\r
+ vec3 base = texture2D(baseTexture, uv).rgb;\r
+ vec3 vVec = normalize(eyeVec);\r
+ vec3 bump = normalize(texture2D(normalTexture, uv).xyz * 2.0 - 1.0);\r
+ vec3 R = reflect(-vVec, bump);\r
+ vec3 lVec = normalize(vVec);\r
+ float diffuse = max(dot(lVec, bump), 0.0);\r
+ float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);\r
+ color = mix (base,diffuse*base,1.0) + 0.1 * specular * diffuse;\r
+ } else {\r
+ color = texture2D(baseTexture, uv).rgb;\r
+ }\r
+\r
+ float alpha = texture2D(baseTexture, uv).a;\r
+ vec4 col = vec4(color.r, color.g, color.b, alpha);\r
+ col *= gl_Color;\r
+ col = col * col; // SRGB -> Linear\r
+ col *= 1.8;\r
+ col.r = 1.0 - exp(1.0 - col.r) / e;\r
+ col.g = 1.0 - exp(1.0 - col.g) / e;\r
+ col.b = 1.0 - exp(1.0 - col.b) / e;\r
+ col = sqrt(col); // Linear -> SRGB\r
+ if(fogDistance != 0.0){\r
+ float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
+ col = mix(col, skyBgColor, d);\r
+ }\r
+ gl_FragColor = vec4(col.r, col.g, col.b, alpha); \r
+}\r
--- /dev/null
+#version 120\r
+\r
+uniform mat4 mWorldViewProj;\r
+uniform mat4 mInvWorld;\r
+uniform mat4 mTransWorld;\r
+uniform float dayNightRatio;\r
+uniform float animationTimer;\r
+\r
+uniform float enableWavingPlants;\r
+\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 eyeVec;\r
+\r
+float smoothCurve( float x ) { \r
+ return x * x *( 3.0 - 2.0 * x ); \r
+} \r
+float triangleWave( float x ) { \r
+ return abs( fract( x + 0.5 ) * 2.0 - 1.0 ); \r
+} \r
+float smoothTriangleWave( float x ) { \r
+ return smoothCurve( triangleWave( x ) ) * 2.0 - 1.0; \r
+} \r
+\r
+void main(void)\r
+{\r
+\r
+ gl_TexCoord[0] = gl_MultiTexCoord0;\r
+ if (enableWavingPlants == 1.0){\r
+ vec4 pos = gl_Vertex;\r
+ vec4 pos2 = mTransWorld * gl_Vertex;\r
+ if (gl_TexCoord[0].y < 0.05) {\r
+ pos.x += (smoothTriangleWave(animationTimer * 20.0 + pos2.x * 0.1 + pos2.z * 0.1) * 2.0 - 1.0) * 0.8;\r
+ pos.y -= (smoothTriangleWave(animationTimer * 10.0 + pos2.x * -0.5 + pos2.z * -0.5) * 2.0 - 1.0) * 0.4; \r
+ }\r
+ gl_Position = mWorldViewProj * pos;\r
+ }\r
+ else \r
+ gl_Position = mWorldViewProj * gl_Vertex;\r
+\r
+ vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
+ eyeVec = (gl_ModelViewMatrix * gl_Vertex).xyz;\r
+\r
+ vec4 color;\r
+ //color = vec4(1.0, 1.0, 1.0, 1.0);\r
+\r
+ float day = gl_Color.r;\r
+ float night = gl_Color.g;\r
+ float light_source = gl_Color.b;\r
+\r
+ /*color.r = mix(night, day, dayNightRatio);\r
+ color.g = color.r;\r
+ color.b = color.r;*/\r
+\r
+ float rg = mix(night, day, dayNightRatio);\r
+ rg += light_source * 2.5; // Make light sources brighter\r
+ float b = rg;\r
+\r
+ // Moonlight is blue\r
+ b += (day - night) / 13.0;\r
+ rg -= (day - night) / 13.0;\r
+\r
+ // Emphase blue a bit in darker places\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
+\r
+ // Artificial light is yellow-ish\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
+\r
+ color.r = clamp(rg,0.0,1.0);\r
+ color.g = clamp(rg,0.0,1.0);\r
+ color.b = clamp(b,0.0,1.0);\r
+\r
+ // Make sides and bottom darker than the top\r
+ color = color * color; // SRGB -> Linear\r
+ if(gl_Normal.y <= 0.5)\r
+ color *= 0.6;\r
+ //color *= 0.7;\r
+ color = sqrt(color); // Linear -> SRGB\r
+\r
+ color.a = gl_Color.a;\r
+\r
+ gl_FrontColor = gl_BackColor = color;\r
+\r
+}\r
--- /dev/null
+trans_alphach_ref
--- /dev/null
+#version 120\r
+\r
+uniform sampler2D baseTexture;\r
+uniform sampler2D normalTexture;\r
+uniform sampler2D useNormalmap;\r
+\r
+uniform float enableBumpmapping;\r
+uniform float enableParallaxOcclusion;\r
+uniform float parallaxOcclusionScale;\r
+uniform float parallaxOcclusionBias;\r
+\r
+\r
+uniform vec4 skyBgColor;\r
+uniform float fogDistance;\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 tsEyeVec;\r
+varying vec3 eyeVec;\r
+varying vec4 vColor;\r
+\r
+const float e = 2.718281828459;\r
+\r
+void main (void)\r
+{\r
+ float use_normalmap = texture2D(useNormalmap,vec2(1.0,1.0)).r;\r
+ float enable_bumpmapping = enableBumpmapping;\r
+\r
+ vec3 color;\r
+ vec2 uv = gl_TexCoord[0].st;\r
+ float height;\r
+ vec2 tsEye = vec2(tsEyeVec.x,-tsEyeVec.y);\r
+ \r
+ if ((enableParallaxOcclusion == 1.0) && (use_normalmap > 0.0)) {\r
+ float map_height = texture2D(normalTexture, uv).a;\r
+ if (map_height < 1.0){\r
+ float height = parallaxOcclusionScale * map_height - parallaxOcclusionBias;\r
+ uv = uv + height * tsEye;\r
+ }\r
+ }\r
+/* Steep parallax code, for future use\r
+ if ((parallaxMappingMode == 2.0) && (use_normalmap > 0.0)) {\r
+ const float numSteps = 40.0;\r
+ float height = 1.0;\r
+ float step = 1.0 / numSteps;\r
+ vec4 NB = texture2D(normalTexture, uv);\r
+ vec2 delta = tsEye * parallaxMappingScale / numSteps;\r
+ for (float i = 0.0; i < numSteps; i++) {\r
+ if (NB.a < height) {\r
+ height -= step;\r
+ uv += delta;\r
+ NB = texture2D(normalTexture, uv);\r
+ } else {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+*/\r
+\r
+ if ((enable_bumpmapping == 1.0) && (use_normalmap > 0.0)) {\r
+ vec3 base = texture2D(baseTexture, uv).rgb;\r
+ vec3 vVec = normalize(eyeVec);\r
+ vec3 bump = normalize(texture2D(normalTexture, uv).xyz * 2.0 - 1.0);\r
+ vec3 R = reflect(-vVec, bump);\r
+ vec3 lVec = normalize(vVec);\r
+ float diffuse = max(dot(lVec, bump), 0.0);\r
+ float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);\r
+ color = mix (base,diffuse*base,1.0) + 0.1 * specular * diffuse;\r
+ } else {\r
+ color = texture2D(baseTexture, uv).rgb;\r
+ }\r
+\r
+ float alpha = texture2D(baseTexture, uv).a;\r
+ vec4 col = vec4(color.r, color.g, color.b, alpha);\r
+ col *= gl_Color;\r
+ col = col * col; // SRGB -> Linear\r
+ col *= 1.8;\r
+ col.r = 1.0 - exp(1.0 - col.r) / e;\r
+ col.g = 1.0 - exp(1.0 - col.g) / e;\r
+ col.b = 1.0 - exp(1.0 - col.b) / e;\r
+ col = sqrt(col); // Linear -> SRGB\r
+ if(fogDistance != 0.0){\r
+ float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
+ col = mix(col, skyBgColor, d);\r
+ }\r
+ gl_FragColor = vec4(col.r, col.g, col.b, alpha); \r
+}\r
--- /dev/null
+#version 120\r
+\r
+uniform mat4 mWorldViewProj;\r
+uniform mat4 mInvWorld;\r
+uniform mat4 mTransWorld;\r
+uniform float dayNightRatio;\r
+\r
+uniform vec3 eyePosition;\r
+\r
+varying vec3 vPosition;\r
+varying vec3 eyeVec;\r
+varying vec3 tsEyeVec;\r
+\r
+void main(void)\r
+{\r
+ gl_Position = mWorldViewProj * gl_Vertex;\r
+ vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
+\r
+ vec3 normal,tangent,binormal; \r
+ normal = normalize(gl_NormalMatrix * gl_Normal);\r
+\r
+ if (gl_Normal.x > 0.5) {\r
+ // 1.0, 0.0, 0.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, -1.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));\r
+ } else if (gl_Normal.x < -0.5) {\r
+ // -1.0, 0.0, 0.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));\r
+ } else if (gl_Normal.y > 0.5) {\r
+ // 0.0, 1.0, 0.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));\r
+ } else if (gl_Normal.y < -0.5) {\r
+ // 0.0, -1.0, 0.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));\r
+ } else if (gl_Normal.z > 0.5) {\r
+ // 0.0, 0.0, 1.0\r
+ tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));\r
+ } else if (gl_Normal.z < -0.5) {\r
+ // 0.0, 0.0, -1.0\r
+ tangent = normalize(gl_NormalMatrix * vec3(-1.0, 0.0, 0.0));\r
+ binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));\r
+ }\r
+ \r
+ mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,\r
+ tangent.y, binormal.y, normal.y,\r
+ tangent.z, binormal.z, normal.z);\r
+\r
+ eyeVec = (gl_ModelViewMatrix * gl_Vertex).xyz;\r
+ tsEyeVec = normalize(eyeVec * tbnMatrix);\r
+ \r
+ vec4 color;\r
+ //color = vec4(1.0, 1.0, 1.0, 1.0);\r
+\r
+ float day = gl_Color.r;\r
+ float night = gl_Color.g;\r
+ float light_source = gl_Color.b;\r
+\r
+ /*color.r = mix(night, day, dayNightRatio);\r
+ color.g = color.r;\r
+ color.b = color.r;*/\r
+\r
+ float rg = mix(night, day, dayNightRatio);\r
+ rg += light_source * 2.5; // Make light sources brighter\r
+ float b = rg;\r
+\r
+ // Moonlight is blue\r
+ b += (day - night) / 13.0;\r
+ rg -= (day - night) / 13.0;\r
+\r
+ // Emphase blue a bit in darker places\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
+\r
+ // Artificial light is yellow-ish\r
+ // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
+ rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
+\r
+ color.r = clamp(rg,0.0,1.0);\r
+ color.g = clamp(rg,0.0,1.0);\r
+ color.b = clamp(b,0.0,1.0);\r
+\r
+ // Make sides and bottom darker than the top\r
+ color = color * color; // SRGB -> Linear\r
+ if(gl_Normal.y <= 0.5)\r
+ color *= 0.6;\r
+ //color *= 0.7;\r
+ color = sqrt(color); // Linear -> SRGB\r
+\r
+ color.a = gl_Color.a;\r
+\r
+ gl_FrontColor = gl_BackColor = color;\r
+\r
+ gl_TexCoord[0] = gl_MultiTexCoord0;\r
+\r
+}\r
+++ /dev/null
-trans_alphach_ref
+++ /dev/null
-\r
-uniform sampler2D myTexture;\r
-uniform vec4 skyBgColor;\r
-uniform float fogDistance;\r
-\r
-varying vec3 vPosition;\r
-\r
-void main (void)\r
-{\r
- //vec4 col = vec4(1.0, 0.0, 0.0, 1.0);\r
- vec4 col = texture2D(myTexture, vec2(gl_TexCoord[0]));\r
- float a = col.a;\r
- col *= gl_Color;\r
- col = col * col; // SRGB -> Linear\r
- col *= 1.8;\r
- col.r = 1.0 - exp(1.0 - col.r) / exp(1.0);\r
- col.g = 1.0 - exp(1.0 - col.g) / exp(1.0);\r
- col.b = 1.0 - exp(1.0 - col.b) / exp(1.0);\r
- col = sqrt(col); // Linear -> SRGB\r
- if(fogDistance != 0.0){\r
- float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
- col = mix(col, skyBgColor, d);\r
- }\r
- gl_FragColor = vec4(col.r, col.g, col.b, a);\r
-}\r
+++ /dev/null
-\r
-uniform mat4 mWorldViewProj;\r
-uniform mat4 mInvWorld;\r
-uniform mat4 mTransWorld;\r
-uniform float dayNightRatio;\r
-\r
-varying vec3 vPosition;\r
-\r
-void main(void)\r
-{\r
- gl_Position = mWorldViewProj * gl_Vertex;\r
-\r
- vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
-\r
- vec4 color;\r
- //color = vec4(1.0, 1.0, 1.0, 1.0);\r
-\r
- float day = gl_Color.r;\r
- float night = gl_Color.g;\r
- float light_source = gl_Color.b;\r
-\r
- /*color.r = mix(night, day, dayNightRatio);\r
- color.g = color.r;\r
- color.b = color.r;*/\r
-\r
- float rg = mix(night, day, dayNightRatio);\r
- rg += light_source * 1.0; // Make light sources brighter\r
- float b = rg;\r
-\r
- // Moonlight is blue\r
- b += (day - night) / 13.0;\r
- rg -= (day - night) / 13.0;\r
-\r
- // Emphase blue a bit in darker places\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
-\r
- // Artificial light is yellow-ish\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
-\r
- color.r = rg;\r
- color.g = rg;\r
- color.b = b;\r
-\r
- // Make sides and bottom darker than the top\r
- color = color * color; // SRGB -> Linear\r
- if(gl_Normal.y <= 0.5)\r
- color *= 0.6;\r
- //color *= 0.7;\r
- color = sqrt(color); // Linear -> SRGB\r
-\r
- color.a = gl_Color.a;\r
-\r
- gl_FrontColor = gl_BackColor = color;\r
-\r
- gl_TexCoord[0] = gl_MultiTexCoord0;\r
-}\r
+++ /dev/null
-trans_alphach
+++ /dev/null
-\r
-uniform sampler2D myTexture;\r
-uniform float fogDistance;\r
-\r
-varying vec3 vPosition;\r
-\r
-void main (void)\r
-{\r
- vec4 col = texture2D(myTexture, vec2(gl_TexCoord[0]));\r
- col *= gl_Color;\r
- float a = gl_Color.a;\r
- col = col * col; // SRGB -> Linear\r
- col *= 1.8;\r
- col.r = 1.0 - exp(1.0 - col.r) / exp(1.0);\r
- col.g = 1.0 - exp(1.0 - col.g) / exp(1.0);\r
- col.b = 1.0 - exp(1.0 - col.b) / exp(1.0);\r
- col = sqrt(col); // Linear -> SRGB\r
- if(fogDistance != 0.0){\r
- float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
- a = mix(a, 0.0, d);\r
- }\r
- gl_FragColor = vec4(col.r, col.g, col.b, a);\r
-}\r
+++ /dev/null
-\r
-uniform mat4 mWorldViewProj;\r
-uniform mat4 mInvWorld;\r
-uniform mat4 mTransWorld;\r
-uniform float dayNightRatio;\r
-\r
-varying vec3 vPosition;\r
-\r
-void main(void)\r
-{\r
- gl_Position = mWorldViewProj * gl_Vertex;\r
-\r
- vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
-\r
- vec4 color;\r
- //color = vec4(1.0, 1.0, 1.0, 1.0);\r
-\r
- float day = gl_Color.r;\r
- float night = gl_Color.g;\r
- float light_source = gl_Color.b;\r
-\r
- /*color.r = mix(night, day, dayNightRatio);\r
- color.g = color.r;\r
- color.b = color.r;*/\r
-\r
- float rg = mix(night, day, dayNightRatio);\r
- rg += light_source * 1.0; // Make light sources brighter\r
- float b = rg;\r
-\r
- // Moonlight is blue\r
- b += (day - night) / 13.0;\r
- rg -= (day - night) / 13.0;\r
-\r
- // Emphase blue a bit in darker places\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
-\r
- // Artificial light is yellow-ish\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
-\r
- color.r = rg;\r
- color.g = rg;\r
- color.b = b;\r
-\r
- color.a = gl_Color.a;\r
-\r
- gl_FrontColor = gl_BackColor = color;\r
-\r
- gl_TexCoord[0] = gl_MultiTexCoord0;\r
-}\r
+++ /dev/null
-trans_alphach
+++ /dev/null
-\r
-uniform sampler2D myTexture;\r
-uniform float fogDistance;\r
-\r
-varying vec3 vPosition;\r
-\r
-void main (void)\r
-{\r
- vec4 col = texture2D(myTexture, vec2(gl_TexCoord[0]));\r
- col *= gl_Color;\r
- float a = col.a;
- col = col * col; // SRGB -> Linear\r
- col *= 1.8;\r
- col.r = 1.0 - exp(1.0 - col.r) / exp(1.0);\r
- col.g = 1.0 - exp(1.0 - col.g) / exp(1.0);\r
- col.b = 1.0 - exp(1.0 - col.b) / exp(1.0);
- col = sqrt(col); // Linear -> SRGB
-
- if(fogDistance != 0.0){\r
- float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));\r
- a = mix(a, 0.0, d);\r
- }
-\r
- gl_FragColor = vec4(col.r, col.g, col.b, a);\r
-}\r
+++ /dev/null
-\r
-uniform mat4 mWorldViewProj;\r
-uniform mat4 mInvWorld;\r
-uniform mat4 mTransWorld;\r
-uniform float dayNightRatio;\r
-\r
-varying vec3 vPosition;\r
-\r
-void main(void)\r
-{\r
- gl_Position = mWorldViewProj * gl_Vertex;\r
-\r
- vPosition = (mWorldViewProj * gl_Vertex).xyz;\r
-\r
- vec4 color;\r
- //color = vec4(1.0, 1.0, 1.0, 1.0);\r
-\r
- float day = gl_Color.r;\r
- float night = gl_Color.g;\r
- float light_source = gl_Color.b;\r
-\r
- /*color.r = mix(night, day, dayNightRatio);\r
- color.g = color.r;\r
- color.b = color.r;*/\r
-\r
- float rg = mix(night, day, dayNightRatio);\r
- rg += light_source * 1.0; // Make light sources brighter\r
- float b = rg;\r
-\r
- // Moonlight is blue\r
- b += (day - night) / 13.0;\r
- rg -= (day - night) / 13.0;\r
-\r
- // Emphase blue a bit in darker places\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- b += max(0.0, (1.0 - abs(b - 0.13)/0.17) * 0.025);\r
-\r
- // Artificial light is yellow-ish\r
- // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
- rg += max(0.0, (1.0 - abs(rg - 0.85)/0.15) * 0.065);\r
-\r
- color.r = rg;\r
- color.g = rg;\r
- color.b = b;\r
-\r
- color.a = gl_Color.a;\r
-\r
- gl_FrontColor = gl_BackColor = color;\r
-\r
- gl_TexCoord[0] = gl_MultiTexCoord0;\r
-}\r
#enable_shaders = true
# Set to true to enable textures bumpmapping. Requires shaders enabled.
#enable_bumpmapping = false
+# Set to true enables parallax occlusion mapping. Requires shaders enabled.
+#enable_parallax_occlusion = false
+# Scale of parallax occlusion effect
+#parallax_mapping_scale = 0.08
+# Bias of parallax occlusion effect, usually scale/2
+#parallax_mapping_scale = 0.04
+# Set to true enables waving water. Requires shaders enabled.
+#enable_waving_water = false
+# Parameters for waving water:
+#water_wave_height = 1.0
+#water_wave_length = 20.0
+#water_wave_speed = 5.0
+# Set to true enables waving leaves. Requires shaders enabled.
+#enable_waving_leaves = false
+# Set to true enables waving plants. Requires shaders enabled.
+#enable_waving_plants = false
# The time in seconds it takes between repeated
# right clicks when holding the right mouse button
#repeat_rightclick_time = 0.25
settings->setDefault("trilinear_filter", "false");
settings->setDefault("preload_item_visuals", "true");
settings->setDefault("enable_bumpmapping", "false");
+ settings->setDefault("enable_parallax_occlusion", "false");
+ settings->setDefault("parallax_occlusion_scale", "0.08");
+ settings->setDefault("parallax_occlusion_bias", "0.04");
+ settings->setDefault("enable_waving_water", "false");
+ settings->setDefault("water_wave_height", "1.0");
+ settings->setDefault("water_wave_length", "20.0");
+ settings->setDefault("water_wave_speed", "5.0");
+ settings->setDefault("enable_waving_leaves", "false");
+ settings->setDefault("enable_waving_plants", "false");
settings->setDefault("enable_shaders", "true");
settings->setDefault("repeat_rightclick_time", "0.25");
settings->setDefault("enable_particles", "true");
float daynight_ratio_f = (float)daynight_ratio / 1000.0;
services->setPixelShaderConstant("dayNightRatio", &daynight_ratio_f, 1);
+ u32 animation_timer = porting::getTimeMs() % 100000;
+ float animation_timer_f = (float)animation_timer / 100000.0;
+ services->setPixelShaderConstant("animationTimer", &animation_timer_f, 1);
+ services->setVertexShaderConstant("animationTimer", &animation_timer_f, 1);
+
+ LocalPlayer* player = m_client->getEnv().getLocalPlayer();
+ v3f eye_position = player->getEyePosition();
+ services->setPixelShaderConstant("eyePosition", (irr::f32*)&eye_position, 3);
+ services->setVertexShaderConstant("eyePosition", (irr::f32*)&eye_position, 3);
+
+ float enable_bumpmapping = 0;
+ if (g_settings->getBool("enable_bumpmapping"))
+ enable_bumpmapping = 1;
+ services->setPixelShaderConstant("enableBumpmapping", &enable_bumpmapping, 1);
+
+ float enable_parallax_occlusion = 0;
+ if (g_settings->getBool("enable_parallax_occlusion"));{
+ enable_parallax_occlusion = 1;
+ float parallax_occlusion_scale = g_settings->getFloat("parallax_occlusion_scale");
+ services->setPixelShaderConstant("parallaxOcclusionScale", ¶llax_occlusion_scale, 1);
+ float parallax_occlusion_bias = g_settings->getFloat("parallax_occlusion_bias");
+ services->setPixelShaderConstant("parallaxOcclusionBias", ¶llax_occlusion_bias, 1);
+ }
+ services->setPixelShaderConstant("enableParallaxOcclusion", &enable_parallax_occlusion, 1);
+
+ float enable_waving_water = 0;
+ if (g_settings->getBool("enable_waving_water")){
+ enable_waving_water = 1;
+ float water_wave_height_f = g_settings->getFloat("water_wave_height");
+ services->setVertexShaderConstant("waterWaveHeight", &water_wave_height_f, 1);
+ float water_wave_length_f = g_settings->getFloat("water_wave_length");
+ services->setVertexShaderConstant("waterWaveLength", &water_wave_length_f, 1);
+ float water_wave_speed_f = g_settings->getFloat("water_wave_speed");
+ services->setVertexShaderConstant("waterWaveSpeed", &water_wave_speed_f, 1);
+ }
+ services->setVertexShaderConstant("enableWavingWater", &enable_waving_water, 1);
+
+ float enable_waving_leaves = 0;
+ if (g_settings->getBool("enable_waving_leaves"))
+ enable_waving_leaves = 1;
+ services->setVertexShaderConstant("enableWavingLeaves", &enable_waving_leaves, 1);
+
+ float enable_waving_plants = 0;
+ if (g_settings->getBool("enable_waving_plants"))
+ enable_waving_plants = 1;
+ services->setVertexShaderConstant("enableWavingPlants", &enable_waving_plants, 1);
+
+
// Normal map texture layer
- int layer = 1;
+ int layer1 = 1;
+ int layer2 = 2;
// before 1.8 there isn't a "integer interface", only float
#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8)
- services->setPixelShaderConstant("normalTexture" , (irr::f32*)&layer, 1);
+ services->setPixelShaderConstant("normalTexture" , (irr::f32*)&layer1, 1);
+ services->setPixelShaderConstant("useNormalmap" , (irr::f32*)&layer2, 1);
#else
- services->setPixelShaderConstant("normalTexture" , (irr::s32*)&layer, 1);
+ services->setPixelShaderConstant("normalTexture" , (irr::s32*)&layer1, 1);
+ services->setPixelShaderConstant("useNormalmap" , (irr::s32*)&layer2, 1);
#endif
}
};
/*
Make a mesh from the node
*/
+ bool reenable_shaders = false;
+ if(g_settings->getBool("enable_shaders")){
+ reenable_shaders = true;
+ g_settings->setBool("enable_shaders",false);
+ }
MeshMakeData mesh_make_data(gamedef);
MapNode mesh_make_node(id, param1, 0);
mesh_make_data.fillSingleNode(&mesh_make_node);
MapBlockMesh mapblock_mesh(&mesh_make_data);
-
scene::IMesh *node_mesh = mapblock_mesh.getMesh();
assert(node_mesh);
video::SColor c(255, 255, 255, 255);
- if(g_settings->getBool("enable_shaders"))
- c = MapBlock_LightColor(255, 0xffff, decode_light(f.light_source));
setMeshColor(node_mesh, c);
/*
//no way reference count can be smaller than 2 in this place!
assert(cc->wield_mesh->getReferenceCount() >= 2);
+
+ if (reenable_shaders)
+ g_settings->setBool("enable_shaders",true);
}
// Put in cache
bool enable_shaders = g_settings->getBool("enable_shaders");
bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping");
- video::E_MATERIAL_TYPE shadermat1, shadermat2, shadermat3, bumpmaps1, bumpmaps2;
- shadermat1 = shadermat2 = shadermat3 = bumpmaps1 = bumpmaps2 = video::EMT_SOLID;
+ video::E_MATERIAL_TYPE shadermat1, shadermat2, shadermat3,
+ shadermat4, shadermat5;
+ shadermat1 = shadermat2 = shadermat3 = shadermat4 = shadermat5 =
+ video::EMT_SOLID;
if (enable_shaders) {
IShaderSource *shdrsrc = m_gamedef->getShaderSource();
- shadermat1 = shdrsrc->getShader("test_shader_1").material;
- shadermat2 = shdrsrc->getShader("test_shader_2").material;
- shadermat3 = shdrsrc->getShader("test_shader_3").material;
- if (enable_bumpmapping) {
- bumpmaps1 = shdrsrc->getShader("bumpmaps_solids").material;
- bumpmaps2 = shdrsrc->getShader("bumpmaps_liquids").material;
- }
+ shadermat1 = shdrsrc->getShader("solids_shader").material;
+ shadermat2 = shdrsrc->getShader("liquids_shader").material;
+ shadermat3 = shdrsrc->getShader("alpha_shader").material;
+ shadermat4 = shdrsrc->getShader("leaves_shader").material;
+ shadermat5 = shdrsrc->getShader("plants_shader").material;
}
for(u32 i = 0; i < collector.prebuffers.size(); i++)
material.setFlag(video::EMF_FOG_ENABLE, true);
//material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
//material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_SIMPLE);
- material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+ //material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
material.setTexture(0, p.tile.texture);
-
+
if (enable_shaders) {
- video::E_MATERIAL_TYPE smat1 = shadermat1;
- video::E_MATERIAL_TYPE smat2 = shadermat2;
- video::E_MATERIAL_TYPE smat3 = shadermat3;
-
+ ITextureSource *tsrc = data->m_gamedef->tsrc();
+ material.setTexture(2, tsrc->getTexture("disable_img.png"));
if (enable_bumpmapping) {
- ITextureSource *tsrc = data->m_gamedef->tsrc();
std::string fname_base = tsrc->getTextureName(p.tile.texture_id);
-
std::string normal_ext = "_normal.png";
size_t pos = fname_base.find(".");
std::string fname_normal = fname_base.substr(0, pos) + normal_ext;
-
+
if (tsrc->isKnownSourceImage(fname_normal)) {
// look for image extension and replace it
size_t i = 0;
fname_base.replace(i, 4, normal_ext);
i += normal_ext.length();
}
-
material.setTexture(1, tsrc->getTexture(fname_base));
-
- smat1 = bumpmaps1;
- smat2 = bumpmaps2;
+ material.setTexture(2, tsrc->getTexture("enable_img.png"));
}
}
-
- p.tile.applyMaterialOptionsWithShaders(material, smat1, smat2, smat3);
+ p.tile.applyMaterialOptionsWithShaders(material,
+ shadermat1, shadermat2, shadermat3, shadermat4, shadermat5);
} else {
p.tile.applyMaterialOptions(material);
}
-
// Create meshbuffer
// This is a "Standard MeshBuffer",
os<<"^[verticalframe:"<<(int)tile.animation_frame_count<<":"<<frame;
// Set the texture
buf->getMaterial().setTexture(0, tsrc->getTexture(os.str()));
+ buf->getMaterial().setTexture(2, tsrc->getTexture("disable_img.png"));
if (enable_shaders && enable_bumpmapping)
{
- std::string basename,normal;
- basename = tsrc->getTextureName(tile.texture_id);
+ std::string fname_base,fname_normal;
+ fname_base = tsrc->getTextureName(tile.texture_id);
unsigned pos;
- pos = basename.find(".");
- normal = basename.substr (0, pos);
- normal += "_normal.png";
- os.str("");
- os<<normal<<"^[verticalframe:"<<(int)tile.animation_frame_count<<":"<<frame;
- if (tsrc->isKnownSourceImage(normal))
+ pos = fname_base.find(".");
+ fname_normal = fname_base.substr (0, pos);
+ fname_normal += "_normal.png";
+ if (tsrc->isKnownSourceImage(fname_normal)){
+ os.str("");
+ os<<fname_normal<<"^[verticalframe:"<<(int)tile.animation_frame_count<<":"<<frame;
buf->getMaterial().setTexture(1, tsrc->getTexture(os.str()));
+ buf->getMaterial().setTexture(2, tsrc->getTexture("enable_img.png"));
+ }
}
}
damage_per_second = 0;
node_box = NodeBox();
selection_box = NodeBox();
+ waving = 0;
legacy_facedir_simple = false;
legacy_wallmounted = false;
sound_footstep = SimpleSoundSpec();
writeU8(os, liquid_range);
// Stuff below should be moved to correct place in a version that otherwise changes
// the protocol version
+ writeU8(os, waving);
}
void ContentFeatures::deSerialize(std::istream &is)
try{
// Stuff below should be moved to correct place in a version that
// otherwise changes the protocol version
+ waving = readU8(is);
}catch(SerializationError &e) {};
}
}
bool is_liquid = false;
+ u8 material_type;
+ material_type = (f->alpha == 255) ? TILE_MATERIAL_BASIC : TILE_MATERIAL_ALPHA;
+
switch(f->drawtype){
default:
case NDT_NORMAL:
tiledef[i].name += std::string("^[noalpha");
}
}
+ if (f->waving == 1)
+ material_type = TILE_MATERIAL_LEAVES;
break;
case NDT_PLANTLIKE:
f->solidness = 0;
f->backface_culling = false;
+ if (f->waving == 1)
+ material_type = TILE_MATERIAL_PLANTS;
break;
case NDT_TORCHLIKE:
case NDT_SIGNLIKE:
break;
}
- u8 material_type;
if (is_liquid)
material_type = (f->alpha == 255) ? TILE_MATERIAL_LIQUID_OPAQUE : TILE_MATERIAL_LIQUID_TRANSPARENT;
- else
- material_type = (f->alpha == 255) ? TILE_MATERIAL_BASIC : TILE_MATERIAL_ALPHA;
// Tiles (fill in f->tiles[])
for(u16 j=0; j<6; j++){
u32 damage_per_second;
NodeBox node_box;
NodeBox selection_box;
+ // Used for waving leaves/plants
+ u8 waving;
// Compatibility with old maps
// Set to true if paramtype used to be 'facedir_simple'
bool legacy_facedir_simple;
f.selection_box = read_nodebox(L, -1);
lua_pop(L, 1);
+ f.waving = getintfield_default(L, index,
+ "waving", f.waving);
+
// Set to true if paramtype used to be 'facedir_simple'
getboolfield(L, index, "legacy_facedir_simple", f.legacy_facedir_simple);
// Set to true if wall_mounted used to be set to true
TILE_MATERIAL_ALPHA,
TILE_MATERIAL_LIQUID_TRANSPARENT,
TILE_MATERIAL_LIQUID_OPAQUE,
+ TILE_MATERIAL_LEAVES,
+ TILE_MATERIAL_PLANTS
};
// Material flags
case TILE_MATERIAL_LIQUID_OPAQUE:
material.MaterialType = video::EMT_SOLID;
break;
+ case TILE_MATERIAL_LEAVES:
+ material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+ break;
+ case TILE_MATERIAL_PLANTS:
+ material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+ break;
}
material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING) ? true : false;
}
void applyMaterialOptionsWithShaders(video::SMaterial &material,
const video::E_MATERIAL_TYPE &basic,
const video::E_MATERIAL_TYPE &liquid,
- const video::E_MATERIAL_TYPE &alpha) const
+ const video::E_MATERIAL_TYPE &alpha,
+ const video::E_MATERIAL_TYPE &leaves,
+ const video::E_MATERIAL_TYPE &plants) const
{
switch(material_type){
case TILE_MATERIAL_BASIC:
case TILE_MATERIAL_LIQUID_OPAQUE:
material.MaterialType = liquid;
break;
+ case TILE_MATERIAL_LEAVES:
+ material.MaterialType = leaves;
+ break;
+ case TILE_MATERIAL_PLANTS:
+ material.MaterialType = plants;
+ break;
}
material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING) ? true : false;
}