rasterizer_canvas_gles3.h 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**************************************************************************/
  2. /* rasterizer_canvas_gles3.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef RASTERIZER_CANVAS_GLES3_H
  31. #define RASTERIZER_CANVAS_GLES3_H
  32. #include "drivers/gles_common/rasterizer_canvas_batcher.h"
  33. #include "rasterizer_canvas_base_gles3.h"
  34. class RasterizerCanvasGLES3 : public RasterizerCanvasBaseGLES3, public RasterizerCanvasBatcher<RasterizerCanvasGLES3, RasterizerStorageGLES3> {
  35. friend class RasterizerCanvasBatcher<RasterizerCanvasGLES3, RasterizerStorageGLES3>;
  36. private:
  37. struct BatchGLData {
  38. // for batching
  39. GLuint batch_vertex_array[5];
  40. } batch_gl_data;
  41. public:
  42. virtual void canvas_render_items_begin(const Color &p_modulate, Light *p_light, const Transform2D &p_base_transform);
  43. virtual void canvas_render_items_end();
  44. virtual void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_base_transform);
  45. virtual void canvas_begin();
  46. virtual void canvas_end();
  47. private:
  48. // legacy codepath .. to remove after testing
  49. void _legacy_canvas_render_item(Item *p_ci, RenderItemState &r_ris);
  50. // high level batch funcs
  51. void canvas_render_items_implementation(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_base_transform);
  52. void render_joined_item(const BItemJoined &p_bij, RenderItemState &r_ris);
  53. bool try_join_item(Item *p_ci, RenderItemState &r_ris, bool &r_batch_break);
  54. void render_batches(Item *p_current_clip, bool &r_reclip, RasterizerStorageGLES3::Material *p_material);
  55. // low level batch funcs
  56. void _batch_upload_buffers();
  57. void _batch_render_prepare();
  58. void _batch_render_generic(const Batch &p_batch, RasterizerStorageGLES3::Material *p_material);
  59. void _batch_render_lines(const Batch &p_batch, RasterizerStorageGLES3::Material *p_material, bool p_anti_alias);
  60. // funcs used from rasterizer_canvas_batcher template
  61. void gl_enable_scissor(int p_x, int p_y, int p_width, int p_height) const;
  62. void gl_disable_scissor() const;
  63. public:
  64. void initialize();
  65. RasterizerCanvasGLES3();
  66. };
  67. #endif // RASTERIZER_CANVAS_GLES3_H