[game.v.glsl] Waving water is now seamless between chunks.
This commit is contained in:
parent
81209dbe64
commit
91c2e33ae3
@ -20,7 +20,7 @@ void main() {
|
||||
|
||||
vec4 color = getColor();
|
||||
if (v_blockID == 8) {
|
||||
color.w = 0.75;
|
||||
color.w = 0.85;
|
||||
}
|
||||
|
||||
// FIXME: FINISH THIS WITH PROPER CODE AND SUN BASIC DISPLAY
|
||||
|
@ -22,11 +22,13 @@ uniform int u_time;
|
||||
|
||||
void main() {
|
||||
vec3 finalPos = coord3d.xyz;
|
||||
// if (coord3d.w == 8) {
|
||||
// finalPos.y += sin((u_time / 1000.0 + finalPos.x) * 1.5) / 8.8f;
|
||||
// finalPos.y += cos((u_time / 1000.0 + finalPos.z) * 1.5) / 8.1f;
|
||||
// finalPos.y -= 0.2;
|
||||
// }
|
||||
if (coord3d.w == 8) {
|
||||
finalPos.y += sin((u_time / 1000.0 + mod(finalPos.x, 16)) * 1.75) / 10.0;
|
||||
finalPos.y += cos((u_time / 1000.0 + mod(finalPos.z, 16)) * 1.75) / 10.0;
|
||||
finalPos.y -= 0.25;
|
||||
finalPos.y -= 1 / 16;
|
||||
/* finalPos.y += sin(u_time / 1000.0) / 8.0 - 0.25; */
|
||||
}
|
||||
|
||||
// Used for lighting
|
||||
v_coord3d = u_modelMatrix * vec4(finalPos, 1.0);
|
||||
|
@ -42,7 +42,7 @@ void GameState::initShaders() {
|
||||
m_projectionMatrix = glm::perspective(45.0f, (float)SCREEN_WIDTH / SCREEN_HEIGHT, DIST_NEAR, DIST_FAR);
|
||||
m_shader.setUniform("u_projectionMatrix", m_projectionMatrix);
|
||||
m_shader.setUniform("u_tex", 0);
|
||||
// m_shader.setUniform("u_time", 0);
|
||||
m_shader.setUniform("u_time", 0);
|
||||
|
||||
Shader::bind(nullptr);
|
||||
}
|
||||
@ -63,9 +63,9 @@ void GameState::onEvent(const SDL_Event &event) {
|
||||
}
|
||||
|
||||
void GameState::update() {
|
||||
// Shader::bind(&m_shader);
|
||||
// m_shader.setUniform("u_time", GameClock::getTicks());
|
||||
// Shader::bind(nullptr);
|
||||
Shader::bind(&m_shader);
|
||||
m_shader.setUniform("u_time", GameClock::getTicks());
|
||||
Shader::bind(nullptr);
|
||||
|
||||
m_world.updateChunks();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user