From 602a0c5951050e7cce645534cb4f136cf9f4fee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Thu, 17 Jun 2021 14:20:54 +0700 Subject: Rename source and build directory --- Source/Models.cpp | 341 ------------------------------------------------------ 1 file changed, 341 deletions(-) delete mode 100644 Source/Models.cpp (limited to 'Source/Models.cpp') diff --git a/Source/Models.cpp b/Source/Models.cpp deleted file mode 100644 index 8caefd8..0000000 --- a/Source/Models.cpp +++ /dev/null @@ -1,341 +0,0 @@ -#include "Models.h" - -#include "Serialize.h" - -//Functions -void Model::UpdateVertexArray(){ - int i; - for(i=0;iboundingboxmax.x)boundingboxmax.x=vertex[i].x; - if(vertex[i].y>boundingboxmax.y)boundingboxmax.y=vertex[i].y; - if(vertex[i].z>boundingboxmax.z)boundingboxmax.z=vertex[i].z; - } - average=average/howmany; - boundingspherecenter=average; - boundingsphereradius=0; - for(int i=0;iboundingsphereradius)boundingsphereradius=findDistancefast(average,vertex[i]); - } - boundingsphereradius=fast_sqrt(boundingsphereradius); -} - -bool Model::load(Str255 Name) -{ - short tfile; - long err; - Files file; - - tfile=file.OpenFile(Name); - SetFPos(tfile,fsFromStart,0); - - // read model settings - - err=ReadShort(tfile,1,&vertexNum); - err=ReadShort(tfile,1,&TriangleNum); - - // read the model data - - err=ReadXYZ(tfile,vertexNum,vertex); - err=ReadTexturedTriangle(tfile,TriangleNum,Triangles); - - FSClose(tfile); - - UpdateVertexArray(); - - XYZ average; - int howmany; - average=0; - howmany=0; - for(int i=0;iboundingsphereradius)boundingsphereradius=findDistancefast(average,vertex[i]); - } - boundingsphereradius=fast_sqrt(boundingsphereradius); - - return 1; -} - -void Model::Scale(float xscale,float yscale,float zscale) -{ - int i; - for(i=0; ix,p1->y,p1->z, - p2->x,p2->y,p2->z, - boundingspherecenter.x,boundingspherecenter.y,boundingspherecenter.z, - boundingsphereradius)) - for (j=0;jx)*(point.x-p1->x)+(point.y-p1->y)*(point.y-p1->y)+(point.z-p1->z)*(point.z-p1->z); - if((distance