Skip to content

Commit

Permalink
- fixed parsing of 2D vectors in OBJ model loader
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexey-lysiuk authored and coelckers committed Jul 25, 2021
1 parent 627b27c commit 06b8892
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/common/models/models_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
float coord[L];
for (size_t axis = 0; axis < L; axis++)
T vec;
for (unsigned axis = 0; axis < L; axis++)
{
sc.MustGetFloat();
coord[axis] = (float)sc.Float;
vec[axis] = (float)sc.Float;
}
T vec(coord);
array.Push(vec);
}

Expand Down

0 comments on commit 06b8892

Please sign in to comment.