MeshStorage.lua 1.1 KB

1234567891011121314151617181920212223242526272829
  1. return {
  2. summary = 'Whether a Mesh stores its data on the CPU or GPU.',
  3. description = 'Whether a Mesh stores its data on the CPU or GPU.',
  4. values = {
  5. {
  6. name = 'cpu',
  7. description = 'The Mesh will store a copy of the vertices on the CPU.'
  8. },
  9. {
  10. name = 'gpu',
  11. description = 'The Mesh will not keep a CPU copy, only storing vertices on the GPU.'
  12. }
  13. },
  14. notes = [[
  15. There are some significant differences and tradeoffs between the two modes:
  16. - CPU meshes store a second copy of the vertices in RAM, which can be expensive for large
  17. meshes.
  18. - When vertices are modified, CPU meshes will update the CPU copy, and only upload to the GPU
  19. the next time the Mesh is drawn. GPU meshes, on the other hand, will immediately upload
  20. modified vertices to the GPU. This means that calling `Mesh:setVertices` multiple times per
  21. frame will be faster with a CPU mesh.
  22. - CPU meshes have an internal vertex buffer that can't be accessed from Lua.
  23. - CPU meshes can compute their bounding box using `Mesh:computeBoundingBox`. GPU meshes can't.
  24. ]],
  25. related = {
  26. 'lovr.graphics.newMesh'
  27. }
  28. }