diff options
Diffstat (limited to 'src/Models.cpp')
-rw-r--r-- | src/Models.cpp | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/Models.cpp b/src/Models.cpp index 6d8eecf..8f3dc37 100644 --- a/src/Models.cpp +++ b/src/Models.cpp @@ -1,3 +1,5 @@ +#include <algorithm> + #include "Models.h" #include "misc.h" @@ -90,28 +92,12 @@ void Model::load(const char* path) boundingsphereradius = 0; for (auto&& v : vertex) - boundingsphereradius = max(boundingsphereradius, + boundingsphereradius = std::max(boundingsphereradius, findDistancefast(average, v)); boundingsphereradius = sqrt(boundingsphereradius); CalculateNormals(); } -void Model::save(const char* path) -{ - auto f = fopen(path, "w"); - fprintf(f, "%d %d 0\n", vertexNum, TriangleNum); - for (int i = 0; i < vertexNum; ++i) - fprintf(f, "%.3f %.3f %.3f\n", - vertex[i].x, vertex[i].y, vertex[i].z); - for (int i = 0; i < TriangleNum; ++i) - fprintf(f, "3 %d %d %d %.3f %.3f %.3f\n", - Triangles[i].vertex[0], - Triangles[i].vertex[1], - Triangles[i].vertex[2], - Triangles[i].r, Triangles[i].g, Triangles[i].b); - fclose(f); -} - void Model::Scale(float xscale,float yscale,float zscale) { int i; |