Compute shader cloth simulation
This commit is contained in:
parent
fd439a59e2
commit
a55759b31b
14 changed files with 1157 additions and 0 deletions
35
data/shaders/computecloth/cloth.vert
Normal file
35
data/shaders/computecloth/cloth.vert
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec2 inUV;
|
||||
layout (location = 2) in vec3 inNormal;
|
||||
|
||||
layout (location = 0) out vec2 outUV;
|
||||
layout (location = 1) out vec3 outNormal;
|
||||
layout (location = 2) out vec3 outViewVec;
|
||||
layout (location = 3) out vec3 outLightVec;
|
||||
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 modelview;
|
||||
vec4 lightPos;
|
||||
} ubo;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main ()
|
||||
{
|
||||
outUV = inUV;
|
||||
outNormal = inNormal.xyz;
|
||||
vec4 eyePos = ubo.modelview * vec4(inPos.x, inPos.y, inPos.z, 1.0);
|
||||
gl_Position = ubo.projection * eyePos;
|
||||
vec4 pos = vec4(inPos, 1.0);
|
||||
vec3 lPos = ubo.lightPos.xyz;
|
||||
outLightVec = lPos - pos.xyz;
|
||||
outViewVec = -pos.xyz;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue