설명 없음

particle_integrate.comp 618B

1234567891011121314151617181920212223242526272829303132333435
  1. #version 450
  2. #extension GL_ARB_separate_shader_objects : enable
  3. #extension GL_ARB_shading_language_420pack : enable
  4. struct Particle
  5. {
  6. vec4 pos;
  7. vec4 vel;
  8. };
  9. // Binding 0 : Position storage buffer
  10. layout(std140, binding = 0) buffer Pos
  11. {
  12. Particle particles[ ];
  13. };
  14. layout (local_size_x = 256) in;
  15. layout (binding = 1) uniform UBO
  16. {
  17. float deltaT;
  18. float destX;
  19. float destY;
  20. int particleCount;
  21. } ubo;
  22. void main()
  23. {
  24. int index = int(gl_GlobalInvocationID);
  25. vec4 position = particles[index].pos;
  26. vec4 velocity = particles[index].vel;
  27. position += ubo.deltaT * velocity;
  28. particles[index].pos = position;
  29. }