StbCommon.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2025, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. #pragma once
  34. #if _MSC_VER // "unreferenced function has been removed" (SSE2 detection routine in x64 builds)
  35. #pragma warning(push)
  36. #pragma warning(disable : 4505)
  37. #else
  38. #pragma GCC diagnostic push
  39. #pragma GCC diagnostic ignored "-Wunused-function"
  40. #endif
  41. #if defined(__clang__)
  42. #pragma clang diagnostic push
  43. #pragma clang diagnostic ignored "-Wunused-function"
  44. #endif
  45. #ifndef STB_USE_HUNTER
  46. /* Use prefixed names for the symbols from stb_image as it is a very commonly embedded library.
  47. Including vanilla stb_image symbols causes duplicate symbol problems if assimp is linked
  48. statically together with another library or executable that also embeds stb_image.
  49. Symbols are not prefixed if using Hunter because in such case there exists a single true
  50. stb_image library on the system that is used by assimp and can be used by all the other
  51. libraries and executables.
  52. The list can be regenerated using the following:
  53. cat "path/to/stb/stb_image.h" | fgrep STBIDEF | fgrep '(' | sed -E 's/\*|\(.+//g' | \
  54. awk '{print "#define " $(NF) " assimp_" $(NF) }' | sort | uniq
  55. */
  56. #define stbi_convert_iphone_png_to_rgb assimp_stbi_convert_iphone_png_to_rgb
  57. #define stbi_convert_iphone_png_to_rgb_thread assimp_stbi_convert_iphone_png_to_rgb_thread
  58. #define stbi_convert_wchar_to_utf8 assimp_stbi_convert_wchar_to_utf8
  59. #define stbi_failure_reason assimp_stbi_failure_reason
  60. #define stbi_hdr_to_ldr_gamma assimp_stbi_hdr_to_ldr_gamma
  61. #define stbi_hdr_to_ldr_scale assimp_stbi_hdr_to_ldr_scale
  62. #define stbi_image_free assimp_stbi_image_free
  63. #define stbi_info assimp_stbi_info
  64. #define stbi_info_from_callbacks assimp_stbi_info_from_callbacks
  65. #define stbi_info_from_file assimp_stbi_info_from_file
  66. #define stbi_info_from_memory assimp_stbi_info_from_memory
  67. #define stbi_is_16_bit assimp_stbi_is_16_bit
  68. #define stbi_is_16_bit_from_callbacks assimp_stbi_is_16_bit_from_callbacks
  69. #define stbi_is_16_bit_from_file assimp_stbi_is_16_bit_from_file
  70. #define stbi_is_16_bit_from_memory assimp_stbi_is_16_bit_from_memory
  71. #define stbi_is_hdr assimp_stbi_is_hdr
  72. #define stbi_is_hdr_from_callbacks assimp_stbi_is_hdr_from_callbacks
  73. #define stbi_is_hdr_from_file assimp_stbi_is_hdr_from_file
  74. #define stbi_is_hdr_from_memory assimp_stbi_is_hdr_from_memory
  75. #define stbi_ldr_to_hdr_gamma assimp_stbi_ldr_to_hdr_gamma
  76. #define stbi_ldr_to_hdr_scale assimp_stbi_ldr_to_hdr_scale
  77. #define stbi_load assimp_stbi_load
  78. #define stbi_load_16 assimp_stbi_load_16
  79. #define stbi_load_16_from_callbacks assimp_stbi_load_16_from_callbacks
  80. #define stbi_load_16_from_memory assimp_stbi_load_16_from_memory
  81. #define stbi_load_from_callbacks assimp_stbi_load_from_callbacks
  82. #define stbi_load_from_file assimp_stbi_load_from_file
  83. #define stbi_load_from_file_16 assimp_stbi_load_from_file_16
  84. #define stbi_load_from_memory assimp_stbi_load_from_memory
  85. #define stbi_load_gif_from_memory assimp_stbi_load_gif_from_memory
  86. #define stbi_loadf assimp_stbi_loadf
  87. #define stbi_loadf_from_callbacks assimp_stbi_loadf_from_callbacks
  88. #define stbi_loadf_from_file assimp_stbi_loadf_from_file
  89. #define stbi_loadf_from_memory assimp_stbi_loadf_from_memory
  90. #define stbi_set_flip_vertically_on_load assimp_stbi_set_flip_vertically_on_load
  91. #define stbi_set_flip_vertically_on_load_thread assimp_stbi_set_flip_vertically_on_load_thread
  92. #define stbi_set_unpremultiply_on_load assimp_stbi_set_unpremultiply_on_load
  93. #define stbi_set_unpremultiply_on_load_thread assimp_stbi_set_unpremultiply_on_load_thread
  94. #define stbi_zlib_decode_buffer assimp_stbi_zlib_decode_buffer
  95. #define stbi_zlib_decode_malloc assimp_stbi_zlib_decode_malloc
  96. #define stbi_zlib_decode_malloc_guesssize assimp_stbi_zlib_decode_malloc_guesssize
  97. #define stbi_zlib_decode_malloc_guesssize_headerflag assimp_stbi_zlib_decode_malloc_guesssize_headerflag
  98. #define stbi_zlib_decode_noheader_buffer assimp_stbi_zlib_decode_noheader_buffer
  99. #define stbi_zlib_decode_noheader_malloc assimp_stbi_zlib_decode_noheader_malloc
  100. #endif
  101. #include "stb/stb_image.h"
  102. #if _MSC_VER
  103. #pragma warning(pop)
  104. #else
  105. #pragma GCC diagnostic pop
  106. #endif
  107. #if defined(__clang__)
  108. #pragma clang diagnostic pop
  109. #endif