|
@@ -1156,6 +1156,11 @@ void _fix_array_compatibility(const Vector<uint8_t> &p_src, uint64_t p_old_forma
|
|
uint16_t *dst = (uint16_t *)&dst_vertex_ptr[i * dst_normal_tangent_stride + dst_offsets[Mesh::ARRAY_NORMAL]];
|
|
uint16_t *dst = (uint16_t *)&dst_vertex_ptr[i * dst_normal_tangent_stride + dst_offsets[Mesh::ARRAY_NORMAL]];
|
|
dst[0] = (uint16_t)CLAMP(res.x * 65535, 0, 65535);
|
|
dst[0] = (uint16_t)CLAMP(res.x * 65535, 0, 65535);
|
|
dst[1] = (uint16_t)CLAMP(res.y * 65535, 0, 65535);
|
|
dst[1] = (uint16_t)CLAMP(res.y * 65535, 0, 65535);
|
|
|
|
+ if (dst[0] == 0 && dst[1] == 65535) {
|
|
|
|
+ // (1, 1) and (0, 1) decode to the same value, but (0, 1) messes with our compression detection.
|
|
|
|
+ // So we sanitize here.
|
|
|
|
+ dst[0] = 65535;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
src_offset += sizeof(uint8_t) * 4;
|
|
src_offset += sizeof(uint8_t) * 4;
|
|
} else {
|
|
} else {
|
|
@@ -1167,6 +1172,11 @@ void _fix_array_compatibility(const Vector<uint8_t> &p_src, uint64_t p_old_forma
|
|
uint16_t *dst = (uint16_t *)&dst_vertex_ptr[i * dst_normal_tangent_stride + dst_offsets[Mesh::ARRAY_NORMAL]];
|
|
uint16_t *dst = (uint16_t *)&dst_vertex_ptr[i * dst_normal_tangent_stride + dst_offsets[Mesh::ARRAY_NORMAL]];
|
|
dst[0] = (uint16_t)CLAMP(res.x * 65535, 0, 65535);
|
|
dst[0] = (uint16_t)CLAMP(res.x * 65535, 0, 65535);
|
|
dst[1] = (uint16_t)CLAMP(res.y * 65535, 0, 65535);
|
|
dst[1] = (uint16_t)CLAMP(res.y * 65535, 0, 65535);
|
|
|
|
+ if (dst[0] == 0 && dst[1] == 65535) {
|
|
|
|
+ // (1, 1) and (0, 1) decode to the same value, but (0, 1) messes with our compression detection.
|
|
|
|
+ // So we sanitize here.
|
|
|
|
+ dst[0] = 65535;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
src_offset += sizeof(float) * 4;
|
|
src_offset += sizeof(float) * 4;
|
|
}
|
|
}
|