1
0

obs-convenience.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /******************************************************************************
  2. Copyright (C) 2014 by Nibbles
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include <obs-module.h>
  16. gs_vertbuffer_t *create_uv_vbuffer(uint32_t num_verts, bool add_color);
  17. void draw_uv_vbuffer(gs_vertbuffer_t *vbuf, gs_texture_t *tex, gs_effect_t *effect, uint32_t num_verts, bool use_color);
  18. #define set_v3_rect(a, x, y, w, h) \
  19. vec3_set(a, x, y, 0.0f); \
  20. vec3_set(a + 1, x + w, y, 0.0f); \
  21. vec3_set(a + 2, x, y + h, 0.0f); \
  22. vec3_set(a + 3, x, y + h, 0.0f); \
  23. vec3_set(a + 4, x + w, y, 0.0f); \
  24. vec3_set(a + 5, x + w, y + h, 0.0f);
  25. #define set_v2_uv(a, u, v, u2, v2) \
  26. vec2_set(a, u, v); \
  27. vec2_set(a + 1, u2, v); \
  28. vec2_set(a + 2, u, v2); \
  29. vec2_set(a + 3, u, v2); \
  30. vec2_set(a + 4, u2, v); \
  31. vec2_set(a + 5, u2, v2);
  32. #define set_rect_colors2(a, c1, c2) \
  33. uint32_t *b = a; \
  34. b[0] = b[1] = b[4] = c1; \
  35. b[2] = b[3] = b[5] = c2;