computeBoundingBox.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. return {
  2. summary = 'Compute the bounding box of the Mesh.',
  3. description = [[
  4. Computes the axis-aligned bounding box of the Mesh from its vertices.
  5. If the Mesh was created with the `gpu` storage mode, this function will do nothing and return
  6. `false`.
  7. If the Mesh does not have an attribute named `VertexPosition` with the `f32x3` (aka `vec3`)
  8. type, this function will do nothing and return `false`.
  9. Otherwise, the bounding box will be set and the return value will be `true`.
  10. The bounding box can also be assigned manually using `Mesh:setBoundingBox`, which can be used to
  11. set the bounding box on a `gpu` mesh or for cases where the bounding box is already known.
  12. Passes will use the bounding box of a Mesh to cull it against the cameras when
  13. `Pass:setViewCull` is enabled, which avoids rendering it when it's out of view.
  14. ]],
  15. arguments = {},
  16. returns = {
  17. updated = {
  18. type = 'boolean',
  19. description = 'Whether the bounding box was updated.'
  20. }
  21. },
  22. variants = {
  23. {
  24. arguments = {},
  25. returns = { 'updated' }
  26. }
  27. },
  28. related = {
  29. 'Mesh:getBoundingBox',
  30. 'Mesh:setBoundingBox',
  31. 'Pass:setViewCull',
  32. 'Collider:getAABB',
  33. 'Shape:getAABB',
  34. 'Model:getBoundingBox',
  35. 'ModelData:getBoundingBox'
  36. }
  37. }