mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
gobj: fix crash reading unaligned float4 column in GeomVertexReader
Observed when calling flatten_strong() on model with vertex colors loaded via Assimp.
This commit is contained in:
parent
9bf37051ac
commit
ba3a826bff
@ -258,7 +258,12 @@ make_packer() const {
|
|||||||
case 3:
|
case 3:
|
||||||
return new Packer_point_nativefloat_3;
|
return new Packer_point_nativefloat_3;
|
||||||
case 4:
|
case 4:
|
||||||
return new Packer_point_nativefloat_4;
|
// Reader may assume 16-byte alignment.
|
||||||
|
if ((get_start() & 0xf) == 0) {
|
||||||
|
return new Packer_point_nativefloat_4;
|
||||||
|
} else {
|
||||||
|
return new Packer_point_float32_4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (get_num_components()) {
|
switch (get_num_components()) {
|
||||||
@ -309,7 +314,8 @@ make_packer() const {
|
|||||||
return new Packer_argb_packed;
|
return new Packer_argb_packed;
|
||||||
|
|
||||||
case NT_float32:
|
case NT_float32:
|
||||||
if (sizeof(float) == sizeof(PN_float32)) {
|
if (sizeof(float) == sizeof(PN_float32) &&
|
||||||
|
(get_start() & 0xf) == 0) {
|
||||||
// Use the native float type implementation for a tiny bit more
|
// Use the native float type implementation for a tiny bit more
|
||||||
// optimization.
|
// optimization.
|
||||||
return new Packer_rgba_nativefloat_4;
|
return new Packer_rgba_nativefloat_4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user