feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
Import("env_modules")
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@
|
|||
|
||||
#include "image_loader_hdr.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
Error ImageLoaderHDR::load_image(Ref<Image> p_image, Ref<FileAccess> f, BitField<ImageFormatLoader::LoaderFlags> p_flags, float p_scale) {
|
||||
String header = f->get_token();
|
||||
|
||||
|
|
@ -68,9 +65,11 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, Ref<FileAccess> f, BitField
|
|||
imgdata.resize(height * width * (int)sizeof(uint32_t));
|
||||
|
||||
{
|
||||
uint8_t *w = imgdata.ptrw();
|
||||
uint8_t *ptr = imgdata.ptrw();
|
||||
|
||||
uint8_t *ptr = (uint8_t *)w;
|
||||
Vector<uint8_t> temp_read_data;
|
||||
temp_read_data.resize(128);
|
||||
uint8_t *temp_read_ptr = temp_read_data.ptrw();
|
||||
|
||||
if (width < 8 || width >= 32768) {
|
||||
// Read flat data
|
||||
|
|
@ -113,8 +112,9 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, Ref<FileAccess> f, BitField
|
|||
}
|
||||
} else {
|
||||
// Dump
|
||||
f->get_buffer(temp_read_ptr, count);
|
||||
for (int z = 0; z < count; ++z) {
|
||||
ptr[(j * width + i++) * 4 + k] = f->get_8();
|
||||
ptr[(j * width + i++) * 4 + k] = temp_read_ptr[z];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -122,20 +122,27 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, Ref<FileAccess> f, BitField
|
|||
}
|
||||
}
|
||||
|
||||
const bool force_linear = p_flags & FLAG_FORCE_LINEAR;
|
||||
|
||||
//convert
|
||||
for (int i = 0; i < width * height; i++) {
|
||||
float exp = pow(2.0f, ptr[3] - 128.0f);
|
||||
int e = ptr[3] - 128;
|
||||
|
||||
Color c(
|
||||
ptr[0] * exp / 255.0,
|
||||
ptr[1] * exp / 255.0,
|
||||
ptr[2] * exp / 255.0);
|
||||
if (force_linear || (e < -15 || e > 15)) {
|
||||
float exp = pow(2.0f, e);
|
||||
Color c(ptr[0] * exp / 255.0, ptr[1] * exp / 255.0, ptr[2] * exp / 255.0);
|
||||
|
||||
if (p_flags & FLAG_FORCE_LINEAR) {
|
||||
c = c.srgb_to_linear();
|
||||
if (force_linear) {
|
||||
c = c.srgb_to_linear();
|
||||
}
|
||||
|
||||
*(uint32_t *)ptr = c.to_rgbe9995();
|
||||
} else {
|
||||
// https://github.com/george-steel/rgbe-rs/blob/e7cc33b7f42b4eb3272c166dac75385e48687c92/src/types.rs#L123-L129
|
||||
uint32_t e5 = (uint32_t)(e + 15);
|
||||
*(uint32_t *)ptr = ((e5 << 27) | ((uint32_t)ptr[2] << 19) | ((uint32_t)ptr[1] << 10) | ((uint32_t)ptr[0] << 1));
|
||||
}
|
||||
|
||||
*(uint32_t *)ptr = c.to_rgbe9995();
|
||||
ptr += 4;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class ImageLoaderHDR : public ImageFormatLoader {
|
|||
public:
|
||||
virtual Error load_image(Ref<Image> p_image, Ref<FileAccess> f, BitField<ImageFormatLoader::LoaderFlags> p_flags, float p_scale);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
|
||||
ImageLoaderHDR();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue