Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/shaders/glsl/water_high.vs
#version 110 | #version 110 | ||||
#if USE_SHADOWS_ON_WATER | |||||
#include "common/shadows_vertex.h" | |||||
#endif | |||||
uniform mat4 reflectionMatrix; | uniform mat4 reflectionMatrix; | ||||
uniform mat4 refractionMatrix; | uniform mat4 refractionMatrix; | ||||
uniform mat4 losMatrix; | uniform mat4 losMatrix; | ||||
uniform mat4 shadowTransform; | |||||
uniform float repeatScale; | uniform float repeatScale; | ||||
uniform float windAngle; | uniform float windAngle; | ||||
// "Wildness" of the reflections and refractions; choose based on texture | // "Wildness" of the reflections and refractions; choose based on texture | ||||
uniform float waviness; | uniform float waviness; | ||||
uniform vec3 sunDir; | uniform vec3 sunDir; | ||||
#if USE_SHADOW_SAMPLER && USE_SHADOW_PCF | |||||
uniform vec4 shadowScale; | |||||
#endif | |||||
uniform float time; | uniform float time; | ||||
uniform mat4 transform; | uniform mat4 transform; | ||||
uniform vec3 cameraPos; | uniform vec3 cameraPos; | ||||
varying float moddedTime; | varying float moddedTime; | ||||
varying vec3 worldPos; | varying vec3 worldPos; | ||||
Show All 9 Lines | |||||
#if USE_REFRACTION | #if USE_REFRACTION | ||||
varying vec3 refractionCoords; | varying vec3 refractionCoords; | ||||
#endif | #endif | ||||
varying vec2 losCoords; | varying vec2 losCoords; | ||||
varying float fwaviness; | varying float fwaviness; | ||||
varying vec2 WindCosSin; | varying vec2 WindCosSin; | ||||
#if USE_SHADOW && USE_SHADOWS_ON_WATER | |||||
varying vec4 v_shadow; | |||||
#endif | |||||
attribute vec3 a_vertex; | attribute vec3 a_vertex; | ||||
attribute vec2 a_waterInfo; | attribute vec2 a_waterInfo; | ||||
attribute vec3 a_otherPosition; | attribute vec3 a_otherPosition; | ||||
void main() | void main() | ||||
{ | { | ||||
worldPos = a_vertex; | worldPos = a_vertex; | ||||
waterInfo = a_waterInfo; | waterInfo = a_waterInfo; | ||||
Show All 10 Lines | |||||
#if USE_REFLECTION | #if USE_REFLECTION | ||||
reflectionCoords = (reflectionMatrix * vec4(a_vertex, 1.0)).rga; | reflectionCoords = (reflectionMatrix * vec4(a_vertex, 1.0)).rga; | ||||
#endif | #endif | ||||
#if USE_REFRACTION | #if USE_REFRACTION | ||||
refractionCoords = (refractionMatrix * vec4(a_vertex, 1.0)).rga; | refractionCoords = (refractionMatrix * vec4(a_vertex, 1.0)).rga; | ||||
#endif | #endif | ||||
losCoords = (losMatrix * vec4(a_vertex, 1.0)).rg; | losCoords = (losMatrix * vec4(a_vertex, 1.0)).rg; | ||||
#if USE_SHADOW && USE_SHADOWS_ON_WATER | #if USE_SHADOWS_ON_WATER | ||||
v_shadow = shadowTransform * vec4(a_vertex, 1.0); | calculatePositionInShadowSpace(vec4(a_vertex, 1.0)); | ||||
#if USE_SHADOW_SAMPLER && USE_SHADOW_PCF | |||||
v_shadow.xy *= shadowScale.xy; | |||||
#endif | |||||
#endif | #endif | ||||
v_eyeVec = normalize(cameraPos - worldPos); | v_eyeVec = normalize(cameraPos - worldPos); | ||||
moddedTime = mod(time * 60.0, 8.0) / 8.0; | moddedTime = mod(time * 60.0, 8.0) / 8.0; | ||||
// Fix the waviness for local wind strength | // Fix the waviness for local wind strength | ||||
fwaviness = waviness * (0.15 + a_waterInfo.r / 1.15); | fwaviness = waviness * (0.15 + a_waterInfo.r / 1.15); | ||||
gl_Position = transform * vec4(a_vertex, 1.0); | gl_Position = transform * vec4(a_vertex, 1.0); | ||||
} | } |
Wildfire Games · Phabricator