modified some type declarations

This commit is contained in:
Nico Pietroni 2004-06-03 15:46:15 +00:00
parent be69a22a35
commit abd8b7003e
1 changed files with 25 additions and 28 deletions

View File

@ -1,16 +1,7 @@
/**************************************************************************** * VCGLib o o * * Visual and Computer Graphics Library o o * * _ O _ * #ifndef __VCGLIB_IMPORTERTS
* Copyright(C) 2004 \/)\/ * * Visual Computing Lab /\/| * * ISTI - Italian National Research Council | * * \ * * All rights reserved. * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #define __VCGLIB_IMPORTERTS
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * for more details. * * * ****************************************************************************/ #define NULL 0
/**************************************************************************** #include <vcg/space/point3.h>
History
$Log: not supported by cvs2svn $
Revision 1.3 2004/05/10 13:14:28 ganovelli
converted to library style (namespaces etc..)
****************************************************************************/ #ifndef __VCGLIB_IMPORTERSMF
#define __VCGLIB_IMPORTERSMF #include <vcg/space/point3.h>
namespace vcg { namespace vcg {
namespace tetra { namespace tetra {
@ -18,17 +9,17 @@ namespace io {
template <typename MESHTYPE> template <typename MESHTYPE>
class ImporterTS{ class ImporterTS{
typedef typename MESHTYPE Tetramesh;
typedef typename MESHTYPE::VertexPointer VertexPointer; typedef typename Tetramesh::VertexPointer VertexPointer;
typedef typename MESHTYPE::VertexType VertexType; typedef typename Tetramesh::VertexType VertexType;
typedef typename MESHTYPE::TetraType FaceType; typedef typename Tetramesh::TetraType FaceType;
typedef typename MESHTYPE::VertexIterator VertexIterator; typedef typename Tetramesh::VertexIterator VertexIterator;
typedef typename MESHTYPE::FaceIterator FaceIterator; typedef typename Tetramesh::TetraIterator FaceIterator;
typedef MESHTYPE::ScalarType ScalarType; typedef typename Tetramesh::ScalarType ScalarType;
typedef Point3<ScalarType> Point3x; typedef Point3<ScalarType> Point3x;
public:
int Load( MESHTYPE & m, const char * filename ) { int Load( Tetramesh & m, const char * filename ) {
int nvertex; int nvertex;
int ntetra; int ntetra;
float x; float x;
@ -60,10 +51,10 @@ int Load( MESHTYPE & m, const char * filename ) {
//fscanf(f, "%f", &mass ); //fscanf(f, "%f", &mass );
p1.ClearFlags(); p1.ClearFlags();
p1.P()=Point3x(x, y,z ); p1.P()=Point3x(x, y,z );
vert.push_back(p1); m.vert.push_back(p1);
} }
tetra.reserve(ntetra*10); m.tetra.reserve(ntetra*10);
vert.reserve(nvertex*10); m.vert.reserve(nvertex*10);
for (j=0;j<ntetra;j++) for (j=0;j<ntetra;j++)
{ {
fscanf(f, "%i", &tp0 ); fscanf(f, "%i", &tp0 );
@ -72,8 +63,14 @@ int Load( MESHTYPE & m, const char * filename ) {
fscanf(f, "%i", &tp3 ); fscanf(f, "%i", &tp3 );
Tetramesh::TetraType newTetra; Tetramesh::TetraType newTetra;
tetra.push_back(newTetra); m.tetra.push_back(newTetra);
tetra.back().Init(&vert[tp0],&vert[tp1],&vert[tp2],&vert[tp3]); m.tetra.back().Init(&m.vert[tp0],&m.vert[tp1],&m.vert[tp2],&m.vert[tp3]);
} }
} }
return 0; } };// end class };// end of io };// end of tri };// end of vcg #endif return 0;
}
};// end class
};// end of io
};// end of tri
};// end of vcg
#endif