Skip to content

Commit

Permalink
Fix the animation speed of leaves which accelerates when the camera i…
Browse files Browse the repository at this point in the history
…s moving
  • Loading branch information
depressed-pho committed Dec 31, 2018
1 parent d0dcbcf commit 151930b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Bugfixes:
* Fixed the color and the intensity of ambient light being calculated
incorrectly.
* Shadows no longer disappear completely when it rains.
* The animation speed of leaves no longer accelerate when the camera
is moving. Water has the same issue but we don't know how to fix it.

## 1.1.0

Expand Down
8 changes: 6 additions & 2 deletions src/shaders/glsl/renderchunk.vertex
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ void main()
/* Waves */
#if !defined(BYPASS_PIXEL_SHADER) && defined(ENABLE_WAVES)
if (isLeaf(color)) {
POS3 posw = worldPos.xyz;
POS3 posw = POSITION.xyz;
highp float wave = sin(TIME * 3.5 + 2.0 * posw.x + 2.0 * posw.z + posw.y);
gl_Position.x += wave * 0.015;
}
else if (isWater(color)) {
POS3 posw = worldPos.xyz;
/* THINKME: In theory this should be the position of the
* vertex in the world coordinates without getting affected by
* the view position, but actually it's not working as
* expected. I don't know why. */
POS3 posw = worldPos.xyz + VIEW_POS;

/* We want water to swell in proportion to its volume. The more
* the vertex is close to the ground (i.e. integral points in the
Expand Down

0 comments on commit 151930b

Please sign in to comment.