SoftwareRasterizer.h 864 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@gmx.de>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include "GLStruct.h"
  8. #include <LibGfx/Bitmap.h>
  9. #include <LibGfx/Vector4.h>
  10. namespace GL {
  11. struct RasterizerOptions {
  12. bool shade_smooth { false };
  13. bool enable_depth_test { false };
  14. };
  15. class SoftwareRasterizer final {
  16. public:
  17. SoftwareRasterizer(const Gfx::IntSize& min_size);
  18. void submit_triangle(const GLTriangle& triangle);
  19. void resize(const Gfx::IntSize& min_size);
  20. void clear_color(const FloatVector4&);
  21. void clear_depth(float);
  22. void blit_to(Gfx::Bitmap&);
  23. void wait_for_all_threads() const;
  24. void set_options(const RasterizerOptions&);
  25. RasterizerOptions options() const { return m_options; }
  26. private:
  27. RefPtr<Gfx::Bitmap> m_render_target;
  28. RasterizerOptions m_options;
  29. };
  30. }