setGeometry.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. return {
  2. tag = 'listener',
  3. summary = 'Set the geometry for audio effects.',
  4. description = [[
  5. Sets a mesh of triangles to use for modeling audio effects, using a table of vertices or a
  6. Model. When the appropriate effects are enabled, audio from `Source` objects will correctly be
  7. occluded by walls and bounce around to create realistic reverb.
  8. An optional `AudioMaterial` may be provided to specify the acoustic properties of the geometry.
  9. ]],
  10. arguments = {
  11. vertices = {
  12. type = 'table',
  13. description = [[
  14. A flat table of vertices. Each vertex is 3 numbers representing its x, y, and z position.
  15. The units used for audio coordinates are up to you, but meters are recommended.
  16. ]]
  17. },
  18. indices = {
  19. type = 'table',
  20. description = [[
  21. A list of indices, indicating how the vertices are connected into triangles. Indices are
  22. 1-indexed and are 32 bits (they can be bigger than 65535).
  23. ]]
  24. },
  25. model = {
  26. type = 'Model',
  27. description = 'A model to use for the audio geometry.'
  28. },
  29. material = {
  30. type = 'AudioMaterial',
  31. default = [['generic']],
  32. description = 'The acoustic material to use.'
  33. }
  34. },
  35. returns = {
  36. success = {
  37. type = 'boolean',
  38. description = [[
  39. Whether audio geometry is supported by the current spatializer and the geometry was loaded
  40. successfully.
  41. ]]
  42. }
  43. },
  44. variants = {
  45. {
  46. arguments = { 'vertices', 'indices', 'material' },
  47. returns = { 'success' }
  48. },
  49. {
  50. arguments = { 'model', 'material' },
  51. returns = { 'success' }
  52. }
  53. },
  54. notes = [[
  55. This is currently only supported/used by the `phonon` spatializer.
  56. The `Effect`s that use geometry are:
  57. - `occlusion`
  58. - `reverb`
  59. - `transmission`
  60. If an existing geometry has been set, this function will replace it.
  61. The triangles must use counterclockwise winding.
  62. ]],
  63. related = {
  64. 'lovr.audio.getSpatializer',
  65. 'Source:setEffectEnabled'
  66. }
  67. }