Weiter an den Dialogen gearbeitet
This commit is contained in:
34
blight-assets/src/main/resources/Shaders/GrassSeed.vert
Normal file
34
blight-assets/src/main/resources/Shaders/GrassSeed.vert
Normal file
@@ -0,0 +1,34 @@
|
||||
uniform mat4 g_WorldViewProjectionMatrix;
|
||||
uniform mat4 g_WorldMatrix;
|
||||
uniform float g_Time;
|
||||
|
||||
uniform float m_WindSpeed;
|
||||
uniform float m_WindStrength;
|
||||
uniform vec2 m_WindDir;
|
||||
|
||||
in vec3 inPosition;
|
||||
in vec2 inTexCoord; // echte UV-Koordinaten der Samen-Textur
|
||||
|
||||
out vec2 varUV;
|
||||
|
||||
void main() {
|
||||
vec4 pos = vec4(inPosition, 1.0);
|
||||
|
||||
vec2 worldXZ = (g_WorldMatrix * pos).xz;
|
||||
float t = g_Time * m_WindSpeed;
|
||||
|
||||
vec2 windN = (dot(m_WindDir, m_WindDir) > 0.001) ? normalize(m_WindDir) : vec2(0.0, 1.0);
|
||||
float wavePhase = dot(worldXZ, windN);
|
||||
float randPhase = fract(sin(dot(worldXZ, vec2(127.1, 311.7))) * 43758.5453) * 6.2832;
|
||||
|
||||
float sway = sin(t * 2.1 + wavePhase * 0.10 + randPhase) * 0.6
|
||||
+ sin(t * 1.4 + wavePhase * 0.06 + randPhase * 0.73) * 0.4;
|
||||
|
||||
// Samen sitzen immer an der Spitze → voller Windfaktor (wf = 1.0)
|
||||
float bend = sway * m_WindStrength;
|
||||
pos.x += windN.x * bend;
|
||||
pos.z += windN.y * bend;
|
||||
|
||||
varUV = inTexCoord;
|
||||
gl_Position = g_WorldViewProjectionMatrix * pos;
|
||||
}
|
||||
Reference in New Issue
Block a user