Remove Vector3 Constructor (#494)

- Packing was enabled because the compiler may add padding which we don't want.
- Constructors were removed because they were either rather primitive or broken (the `pRawFloats` one).
- Use of constructor was replaced with a simple cast, which works just as well.
This commit is contained in:
Jan 2023-07-25 16:31:02 +02:00 committed by GitHub
parent cf8b267d31
commit ddb4670354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View File

@ -13,13 +13,6 @@ union Vector3
float raw[3];
Vector3() : x(0), y(0), z(0) {}
Vector3(float x, float y, float z) : x(x), y(y), z(z) {}
Vector3(float* pRawFloats) // assumes float[3] => vector
{
memcpy(raw, pRawFloats, sizeof(this));
}
void MakeValid()
{
for (auto& fl : raw)

View File

@ -765,8 +765,8 @@ std::string DataTableToString(Datatable* datatable)
case DatatableType::VECTOR:
{
Vector3 pVector((float*)pUntypedVal);
sCSVString += fmt::format("<{},{},{}>", pVector.x, pVector.y, pVector.z);
Vector3* pVector = (Vector3*)(pUntypedVal);
sCSVString += fmt::format("<{},{},{}>", pVector->x, pVector->y, pVector->z);
break;
}