🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
612 B

  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <vector>
  4. #define STB_IMAGE_WRITE_IMPLEMENTATION
  5. #include "stb_image_write.h"
  6. #include "tinyexr.h"
  7. int main(int argc, char** argv)
  8. {
  9. if (argc < 3) {
  10. printf("Usage: exr2rgbe input.exr output.hdr\n");
  11. exit(-1);
  12. }
  13. int width, height;
  14. float* rgba;
  15. const char* err;
  16. {
  17. int ret = LoadEXR(&rgba, &width, &height, argv[1], &err);
  18. if (ret != 0) {
  19. printf("err: %s\n", err);
  20. return -1;
  21. }
  22. }
  23. {
  24. int ret = stbi_write_hdr(argv[2], width, height, 4, rgba);
  25. if (ret == 0) {
  26. return -1; // fail
  27. }
  28. }
  29. return 0;
  30. }