DepthRange.h 959 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <GL/glew.h>
  3. #include <glm/mat4x4.hpp>
  4. namespace WallpaperEngine::Render::DepthRange {
  5. /**
  6. * WE renders its scene with a reversed float depth buffer (1 at the near plane, 0 at the far one, D32F cleared to 0,
  7. * sub_14009A360). With ARB_clip_control that is what a scene is drawn with here: clip z is mapped to 0..1 while the
  8. * scene renders (Scope), every matrix handed to a pass has its depth built or remapped that way, and depth tests
  9. * are the mirrored ones. Without the extension everything stays forward, 0 at the near plane
  10. */
  11. bool supported ();
  12. class Scope {
  13. public:
  14. Scope ();
  15. ~Scope ();
  16. Scope (const Scope&) = delete;
  17. Scope& operator= (const Scope&) = delete;
  18. };
  19. glm::mat4 toClip (const glm::mat4& projection);
  20. glm::mat4 perspective (float fovY, float aspect, float near, float far);
  21. GLenum depthFunc (GLenum forward);
  22. GLclampd farDepth ();
  23. float nearClip ();
  24. float farClip ();
  25. float middleClip ();
  26. }