New lightmapper

-Added LocalVector (needed it)
-Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too)
-Fixes and changes all around the place
-Added library for 128 bits fixed point (required for Delaunay3D)
This commit is contained in:
Juan Linietsky 2020-05-01 09:34:23 -03:00
parent 6a0473bcc2
commit 1bea8e1eac
434 changed files with 126122 additions and 3384 deletions

View file

@ -267,13 +267,21 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale)
header.channels = channel_infos;
header.pixel_types = pixel_types;
header.requested_pixel_types = requested_pixel_types;
header.compression_type = TINYEXR_COMPRESSIONTYPE_PIZ;
CharString utf8_filename = p_path.utf8();
const char *err;
int ret = SaveEXRImageToFile(&image, &header, utf8_filename.ptr(), &err);
if (ret != TINYEXR_SUCCESS) {
unsigned char *mem = nullptr;
const char *err = nullptr;
size_t bytes = SaveEXRImageToMemory(&image, &header, &mem, &err);
if (bytes == 0) {
print_error(String("Saving EXR failed. Error: {0}").format(varray(err)));
return ERR_FILE_CANT_WRITE;
} else {
FileAccessRef ref = FileAccess::open(p_path, FileAccess::WRITE);
ERR_FAIL_COND_V(!ref, ERR_FILE_CANT_WRITE);
ref->store_buffer(mem, bytes);
free(mem);
}
return OK;