setDepthTest.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. return {
  2. tag = 'graphicsState',
  3. summary = 'Set or disable the depth test.',
  4. description = [[
  5. Sets the current depth test. The depth test controls how overlapping objects are rendered.
  6. ]],
  7. arguments = {
  8. {
  9. name = 'compareMode',
  10. type = 'CompareMode',
  11. default = 'nil',
  12. description = 'The new depth test. Use `nil` to disable the depth test.'
  13. },
  14. {
  15. name = 'write',
  16. type = 'boolean',
  17. default = 'true',
  18. description = 'Whether pixels will have their z value updated when rendered to.'
  19. }
  20. },
  21. returns = {},
  22. notes = [[
  23. The depth test is an advanced technique to control how 3D objects overlap each other when they
  24. are rendered. It works as follows:
  25. - Each pixel keeps track of its z value as well as its color.
  26. - If `write` is enabled when something is drawn, then any pixels that are drawn will have their
  27. z values updated.
  28. - Additionally, anything drawn will first compare the existing z value of a pixel with the new z
  29. value. The `compareMode` setting determines how this comparison is performed. If the
  30. comparison succeeds, the new pixel will overwrite the previous one, otherwise that pixel won't
  31. be rendered to.
  32. Smaller z values are closer to the camera.
  33. The default compare mode is `lequal`, which usually gives good results for normal 3D rendering.
  34. ]]
  35. }