Added support to additional per-face data in stl files. Code patch initially contributed by Tommy Odom (thanks!)
This commit is contained in:
parent
ecd1de4d94
commit
f44a3cfa78
|
@ -72,12 +72,15 @@ template <class SaveMeshType>
|
|||
class ExporterSTL
|
||||
{
|
||||
public:
|
||||
typedef typename SaveMeshType::FaceType FaceType;
|
||||
typedef unsigned short CallBackSTLFaceAttribute(const SaveMeshType &m, const FaceType &f);
|
||||
|
||||
static int Save(SaveMeshType &m, const char * filename, const int &/*mask*/, CallBackPos *)
|
||||
{
|
||||
return Save(m,filename,true);
|
||||
}
|
||||
|
||||
static int Save(SaveMeshType &m, const char * filename , bool binary =true, const char *objectname=0)
|
||||
static int Save(SaveMeshType &m, const char * filename , bool binary =true, const char *objectname=0, CallBackSTLFaceAttribute *faceAttributeCallback = NULL)
|
||||
{
|
||||
typedef typename SaveMeshType::FaceIterator FaceIterator;
|
||||
FILE *fp;
|
||||
|
@ -108,6 +111,9 @@ static int Save(SaveMeshType &m, const char * filename , bool binary =true, cons
|
|||
p.Import((*fi).V(k)->P());
|
||||
fwrite(p.V(),3,sizeof(float),fp);
|
||||
}
|
||||
if (faceAttributeCallback != NULL) {
|
||||
attributes = (*faceAttributeCallback)(m, *fi);
|
||||
}
|
||||
fwrite(&attributes,1,sizeof(short),fp);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue