diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-06-02 22:08:41 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-06-02 22:08:41 -0300 |
commit | 8a1097a2243a9829d5d7e61ef10133f8096aa5e2 (patch) | |
tree | 2ec55a650b676975e6ef2ed60e25d68307381269 | |
parent | e79d7149ea751e32312cb8625548085d4537c591 (diff) |
many fixes to image loader, voxel cone tracing, etc.
-rw-r--r-- | drivers/gles3/shaders/ssao_blur.glsl | 2 | ||||
-rw-r--r-- | drivers/png/image_loader_png.cpp | 1 | ||||
-rw-r--r-- | modules/squish/image_compress_squish.cpp | 4 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 7 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 4 |
5 files changed, 10 insertions, 8 deletions
diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl index ff852487c0..ce4154f50c 100644 --- a/drivers/gles3/shaders/ssao_blur.glsl +++ b/drivers/gles3/shaders/ssao_blur.glsl @@ -24,7 +24,7 @@ layout(location = 0) out float visibility; // Tunable Parameters: /** Increase to make depth edges crisper. Decrease to reduce flicker. */ -#define EDGE_SHARPNESS (1.0) +#define EDGE_SHARPNESS (4.0) /** Step in 2-pixel intervals since we already blurred against neighbors in the first AO pass. This constant can be increased while R decreases to improve diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 25ab767bed..33d271248c 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -256,6 +256,7 @@ static Ref<Image> _load_mem_png(const uint8_t *p_png, int p_size) { static Ref<Image> _lossless_unpack_png(const PoolVector<uint8_t> &p_data) { int len = p_data.size(); + ERR_FAIL_COND_V(len < 4, Ref<Image>()); PoolVector<uint8_t>::Read r = p_data.read(); ERR_FAIL_COND_V(r[0] != 'P' || r[1] != 'N' || r[2] != 'G' || r[3] != ' ', Ref<Image>()); return _load_mem_png(&r[4], len - 4); diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index efed0b8665..e927f1ceaa 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -153,8 +153,8 @@ void image_compress_squish(Image *p_image, bool p_srgb) { int bh = h % 4 != 0 ? h + (4 - h % 4) : h; int src_ofs = p_image->get_mipmap_offset(i); - squish::CompressImage(&rb[src_ofs], bw, bh, &wb[dst_ofs], squish_comp); - dst_ofs += (MAX(4, w) * MAX(4, h)) >> shift; + squish::CompressImage(&rb[src_ofs], w, h, &wb[dst_ofs], squish_comp); + dst_ofs += (MAX(4, bw) * MAX(4, bh)) >> shift; w >>= 1; h >>= 1; } diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 3542b8b876..2acbed3b4e 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -909,10 +909,11 @@ Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_colo for (int i = 0; i < bake_texture_size * bake_texture_size; i++) { Color c; - c.r = r[i * 4 + 0] / 255.0; - c.g = r[i * 4 + 1] / 255.0; - c.b = r[i * 4 + 2] / 255.0; + c.r = (r[i * 4 + 0] / 255.0) * p_color.r; + c.g = (r[i * 4 + 1] / 255.0) * p_color.g; + c.b = (r[i * 4 + 2] / 255.0) * p_color.b; c.a = r[i * 4 + 3] / 255.0; + ret[i] = c; } diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index bc8deb501e..68a11b821d 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -494,9 +494,9 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla img = Image::lossy_unpacker(pv); } - if (img.is_null()) { + if (img.is_null() || img->empty()) { memdelete(f); - ERR_FAIL_COND_V(img->empty(), ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(img.is_null() || img->empty(), ERR_FILE_CORRUPT); } total_size += img->get_data().size(); |