You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Fix (again) loading binary resources with float=64
I had an error while importing my GLB file from 32-bit precision floating point, I guess this was forgotten while implementing 64-bit precision floating point. I'm not sure if there's any other left to do though.
This commit is contained in:
@@ -1547,10 +1547,11 @@ void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const V
|
|||||||
case Variant::COLOR: {
|
case Variant::COLOR: {
|
||||||
f->store_32(VARIANT_COLOR);
|
f->store_32(VARIANT_COLOR);
|
||||||
Color val = p_property;
|
Color val = p_property;
|
||||||
f->store_real(val.r);
|
// Color are always floats
|
||||||
f->store_real(val.g);
|
f->store_float(val.r);
|
||||||
f->store_real(val.b);
|
f->store_float(val.g);
|
||||||
f->store_real(val.a);
|
f->store_float(val.b);
|
||||||
|
f->store_float(val.a);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::STRING_NAME: {
|
case Variant::STRING_NAME: {
|
||||||
@@ -1685,7 +1686,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const V
|
|||||||
f->store_32(len);
|
f->store_32(len);
|
||||||
const float *r = arr.ptr();
|
const float *r = arr.ptr();
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
f->store_real(r[i]);
|
f->store_float(r[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@@ -1743,10 +1744,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const V
|
|||||||
f->store_32(len);
|
f->store_32(len);
|
||||||
const Color *r = arr.ptr();
|
const Color *r = arr.ptr();
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
f->store_real(r[i].r);
|
f->store_float(r[i].r);
|
||||||
f->store_real(r[i].g);
|
f->store_float(r[i].g);
|
||||||
f->store_real(r[i].b);
|
f->store_float(r[i].b);
|
||||||
f->store_real(r[i].a);
|
f->store_float(r[i].a);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
Reference in New Issue
Block a user