- fixed parsing of 2D vectors in OBJ model loader

There is no `TVector2<>` constructor that accepts a pointer to float. However, there is such constructor in `TVector3<>`, so `TVector2<>` can be constructed from `float*` implicitly via temporary `TVector3<>` object.
This commit is contained in:
alexey.lysiuk 2021-06-13 10:27:41 +03:00
parent e8f007c6ce
commit ff784fc905
1 changed files with 3 additions and 4 deletions

View File

@ -240,13 +240,12 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length
*/ */
template<typename T, size_t L> void FOBJModel::ParseVector(TArray<T> &array) template<typename T, size_t L> void FOBJModel::ParseVector(TArray<T> &array)
{ {
float coord[L]; T vec;
for (size_t axis = 0; axis < L; axis++) for (unsigned axis = 0; axis < L; axis++)
{ {
sc.MustGetFloat(); sc.MustGetFloat();
coord[axis] = (float)sc.Float; vec[axis] = (float)sc.Float;
} }
T vec(coord);
array.Push(vec); array.Push(vec);
} }