etc2.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /****************************************************************************
  2. Copyright (c) 2010-2012 cocos2d-x.org
  3. Copyright (c) 2013-2016 Chukong Technologies Inc.
  4. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  5. http://www.cocos2d-x.org
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. THE SOFTWARE.
  21. ****************************************************************************/
  22. #ifndef __etc2_h__
  23. #define __etc2_h__
  24. /// @cond DO_NOT_SHOW
  25. typedef unsigned char etc2_byte;
  26. typedef int etc2_bool;
  27. typedef unsigned int etc2_uint32;
  28. #ifndef GL_COMPRESSED_RGB8_ETC2
  29. #define GL_COMPRESSED_RGB8_ETC2 0x9274
  30. #endif
  31. #ifndef GL_COMPRESSED_RGBA8_ETC2_EAC
  32. #define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. // Size of a PKM header, in bytes.
  38. #define ETC2_PKM_HEADER_SIZE 16
  39. #define ETC2_RGB_NO_MIPMAPS 1
  40. #define ETC2_RGBA_NO_MIPMAPS 3
  41. // Check if a PKM header is correctly formatted.
  42. etc2_bool etc2_pkm_is_valid(const etc2_byte* pHeader);
  43. // Read the image width from a PKM header
  44. etc2_uint32 etc2_pkm_get_width(const etc2_byte* pHeader);
  45. // Read the image height from a PKM header
  46. etc2_uint32 etc2_pkm_get_height(const etc2_byte* pHeader);
  47. // Read the image format from a PKM header
  48. etc2_uint32 etc2_pkm_get_format(const etc2_byte* pHeader);
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. /// @endcond
  53. #endif