Add Jeija's waving water
parent
7fbbeb77b7
commit
36416206c3
|
@ -1,8 +1,8 @@
|
|||
|
||||
uniform mat4 mWorldViewProj;
|
||||
uniform mat4 mInvWorld;
|
||||
uniform mat4 mTransWorld;
|
||||
uniform float dayNightRatio;
|
||||
uniform float timeOfDay;
|
||||
uniform vec3 eyePosition;
|
||||
|
||||
varying vec3 vPosition;
|
||||
|
@ -14,9 +14,23 @@ varying vec3 viewPos;
|
|||
varying vec3 cameraPos;
|
||||
varying vec2 uv;
|
||||
|
||||
float rand(vec2 co)
|
||||
{
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = mWorldViewProj * gl_Vertex;
|
||||
int wavelength = 20;
|
||||
float waveheight = 1.7;
|
||||
int wavespeed = 100;
|
||||
int height_randomness = 1;
|
||||
vec4 pos2 = gl_Vertex;
|
||||
pos2.y -= 3.0;
|
||||
pos2.y -= sin (pos2.z/wavelength + timeOfDay * wavespeed * wavelength) * waveheight
|
||||
+ sin ((pos2.z/wavelength + timeOfDay * wavespeed * wavelength)/7) * waveheight * height_randomness;
|
||||
gl_Position = mWorldViewProj * pos2;
|
||||
|
||||
vPosition = (mWorldViewProj * gl_Vertex).xyz;
|
||||
vec3 pos = vec3(gl_Vertex);
|
||||
|
|
|
@ -807,6 +807,7 @@ public:
|
|||
|
||||
float time_of_day_f = m_client->getEnv().getTimeOfDayF();
|
||||
services->setPixelShaderConstant("timeOfDay", &time_of_day_f, 1);
|
||||
services->setVertexShaderConstant("timeOfDay", &time_of_day_f, 1);
|
||||
|
||||
LocalPlayer* player = m_client->getEnv().getLocalPlayer();
|
||||
v3f eye_position = player->getEyePosition();
|
||||
|
|
|
@ -1201,7 +1201,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data):
|
|||
if (enable_shaders) {
|
||||
ITextureSource *tsrc = data->m_gamedef->tsrc();
|
||||
material.setTexture(2, tsrc->getTexture("disable_img.png"));
|
||||
material.setTexture(3, tsrc->getTexture(getTexturePath("water_surface_normalmap.png").c_str));
|
||||
material.setTexture(3, tsrc->getTexture("water_surface_normalmap.png"));
|
||||
if (enable_bumpmapping) {
|
||||
std::string fname_base = tsrc->getTextureName(p.tile.texture_id);
|
||||
std::string normal_ext = "_normal.png";
|
||||
|
|
Loading…
Reference in New Issue