added management of optional quality
This commit is contained in:
parent
19bb932a8f
commit
966d98da5a
|
@ -102,20 +102,25 @@ static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0,bool tri
|
||||||
m.Clear();
|
m.Clear();
|
||||||
|
|
||||||
Point3f pp;
|
Point3f pp;
|
||||||
|
float q;
|
||||||
int cnt=0;
|
int cnt=0;
|
||||||
int ret;
|
int ret;
|
||||||
|
char buf[1024];
|
||||||
/* Read a single facet from an ASCII .STL file */
|
/* Read a single facet from an ASCII .STL file */
|
||||||
while(!feof(fp))
|
while(!feof(fp))
|
||||||
{
|
{
|
||||||
if(cb && (++cnt)%1000) cb( (ftell(fp)*100)/fileLen, "ASC Mesh Loading");
|
if(cb && (++cnt)%1000) cb( (ftell(fp)*100)/fileLen, "ASC Mesh Loading");
|
||||||
if(feof(fp)) break;
|
if(feof(fp)) break;
|
||||||
ret=fscanf(fp, "%f, %f, %f\n", &pp.X(), &pp.Y(), &pp.Z());
|
fgets(buf,1024,fp);
|
||||||
if(ret!=3) return E_UNESPECTEDEOF;
|
ret=sscanf(buf, "%f, %f, %f, %f\n", &pp.X(), &pp.Y(), &pp.Z(),&q);
|
||||||
|
if(ret<3) return E_UNESPECTEDEOF;
|
||||||
VertexIterator vi=Allocator<MESH_TYPE>::AddVertices(m,1);
|
VertexIterator vi=Allocator<MESH_TYPE>::AddVertices(m,1);
|
||||||
(*vi).P().Import(pp);
|
(*vi).P().Import(pp);
|
||||||
|
if(ret==4) (*vi).Q()=q;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
if(!triangulate) return E_NOERROR;
|
||||||
// now try to triangulate.
|
// now try to triangulate.
|
||||||
// search for the first jump
|
// search for the first jump
|
||||||
float baseY = m.vert[0].P().Y();
|
float baseY = m.vert[0].P().Y();
|
||||||
|
|
Loading…
Reference in New Issue