floats in Vector3f must be 4-bytes aligned on some platforms, so we use chars and cast them in Vector3f on access
| 425 | char attrs[2]; |
| 426 | // floats in Vector3f must be 4-bytes aligned on some platforms, so we use chars and cast them in Vector3f on access |
| 427 | Vector3f vertex( int i ) const |
| 428 | { |
| 429 | #if __cpp_lib_bit_cast >= 201806L |
| 430 | return std::bit_cast<Vector3f>( coords[i] ); |
| 431 | #else |
| 432 | Vector3f v; |
| 433 | std::memcpy( &v, &coords[i], sizeof( coords[i] ) ); |
| 434 | return v; |
| 435 | #endif |
| 436 | } |
| 437 | }; |
| 438 | static_assert( sizeof( StlTriangle ) == 50 ); |
| 439 | static_assert( alignof( StlTriangle ) <= 2 ); |