mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Nodes shader: Decrease amplitude of waving leaves and plants
Fix initialisation of variable 'disp' Fix a few minor code style issues Add independent X motion combining 2 prime frequencies
This commit is contained in:
parent
630f453da4
commit
597c1d73da
@ -15,7 +15,6 @@ varying vec3 lightVec;
|
|||||||
varying vec3 tsEyeVec;
|
varying vec3 tsEyeVec;
|
||||||
varying vec3 tsLightVec;
|
varying vec3 tsLightVec;
|
||||||
varying float area_enable_parallax;
|
varying float area_enable_parallax;
|
||||||
varying float disp;
|
|
||||||
|
|
||||||
const float e = 2.718281828459;
|
const float e = 2.718281828459;
|
||||||
const float BS = 10.0;
|
const float BS = 10.0;
|
||||||
@ -55,12 +54,16 @@ void main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
float disp_x;
|
||||||
|
float disp_z;
|
||||||
#if (MATERIAL_TYPE == TILE_MATERIAL_WAVING_LEAVES && ENABLE_WAVING_LEAVES) || (MATERIAL_TYPE == TILE_MATERIAL_WAVING_PLANTS && ENABLE_WAVING_PLANTS)
|
#if (MATERIAL_TYPE == TILE_MATERIAL_WAVING_LEAVES && ENABLE_WAVING_LEAVES) || (MATERIAL_TYPE == TILE_MATERIAL_WAVING_PLANTS && ENABLE_WAVING_PLANTS)
|
||||||
vec4 pos2 = mWorld * gl_Vertex;
|
vec4 pos2 = mWorld * gl_Vertex;
|
||||||
float tOffset = (pos2.x + pos2.y) * 0.001 + pos2.z * 0.002;
|
float tOffset = (pos2.x + pos2.y) * 0.001 + pos2.z * 0.002;
|
||||||
disp = (smoothTriangleWave(animationTimer * 31.0 + tOffset) +
|
disp_x = (smoothTriangleWave(animationTimer * 23.0 + tOffset) +
|
||||||
|
smoothTriangleWave(animationTimer * 11.0 + tOffset)) * 0.4;
|
||||||
|
disp_z = (smoothTriangleWave(animationTimer * 31.0 + tOffset) +
|
||||||
smoothTriangleWave(animationTimer * 29.0 + tOffset) +
|
smoothTriangleWave(animationTimer * 29.0 + tOffset) +
|
||||||
smoothTriangleWave(animationTimer * 13.0 + tOffset)) - 0.9;
|
smoothTriangleWave(animationTimer * 13.0 + tOffset)) * 0.5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -72,14 +75,15 @@ void main(void)
|
|||||||
gl_Position = mWorldViewProj * pos;
|
gl_Position = mWorldViewProj * pos;
|
||||||
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_LEAVES && ENABLE_WAVING_LEAVES
|
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_LEAVES && ENABLE_WAVING_LEAVES
|
||||||
vec4 pos = gl_Vertex;
|
vec4 pos = gl_Vertex;
|
||||||
pos.x += disp * 0.1;
|
pos.x += disp_x;
|
||||||
pos.y += disp * 0.1;
|
pos.y += disp_z * 0.1;
|
||||||
pos.z += disp;
|
pos.z += disp_z;
|
||||||
gl_Position = mWorldViewProj * pos;
|
gl_Position = mWorldViewProj * pos;
|
||||||
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_PLANTS && ENABLE_WAVING_PLANTS
|
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_PLANTS && ENABLE_WAVING_PLANTS
|
||||||
vec4 pos = gl_Vertex;
|
vec4 pos = gl_Vertex;
|
||||||
if (gl_TexCoord[0].y < 0.05) {
|
if (gl_TexCoord[0].y < 0.05) {
|
||||||
pos.z += disp;
|
pos.x += disp_x;
|
||||||
|
pos.z += disp_z;
|
||||||
}
|
}
|
||||||
gl_Position = mWorldViewProj * pos;
|
gl_Position = mWorldViewProj * pos;
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user