2004-03-09 22:26:47 +01:00
|
|
|
/****************************************************************************
|
2004-03-08 10:24:59 +01:00
|
|
|
* VCGLib o o *
|
|
|
|
* Visual and Computer Graphics Library o o *
|
|
|
|
* _ O _ *
|
|
|
|
* 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 *
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
|
|
|
* for more details. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
|
|
History
|
|
|
|
|
|
|
|
$Log: not supported by cvs2svn $
|
2008-05-16 19:44:31 +02:00
|
|
|
Revision 1.30 2008/04/29 11:51:28 corsini
|
|
|
|
set defaut callback (in save) to null
|
|
|
|
|
2008-04-29 13:51:28 +02:00
|
|
|
Revision 1.29 2008/01/24 11:54:23 cignoni
|
|
|
|
passed the callback in the save
|
|
|
|
|
2008-01-24 12:54:23 +01:00
|
|
|
Revision 1.28 2007/12/13 00:20:34 cignoni
|
|
|
|
removed harmless printf cast warnings
|
|
|
|
|
2007-12-13 01:20:34 +01:00
|
|
|
Revision 1.27 2007/11/06 10:59:41 ponchio
|
|
|
|
Typo
|
|
|
|
|
2007-11-06 11:59:41 +01:00
|
|
|
Revision 1.26 2007/11/06 10:51:55 ponchio
|
|
|
|
Fixed wrong 'return false' in Save.
|
|
|
|
|
2007-11-06 11:51:55 +01:00
|
|
|
Revision 1.25 2007/10/22 14:47:19 cignoni
|
|
|
|
Added saving of per vertex normals
|
|
|
|
|
2007-10-22 16:47:19 +02:00
|
|
|
Revision 1.24 2007/07/23 13:27:50 tarini
|
|
|
|
fixed bug on saving flags-per-face
|
|
|
|
|
2007-07-23 15:27:50 +02:00
|
|
|
Revision 1.23 2007/03/12 16:40:17 tarini
|
|
|
|
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
|
|
|
|
2007-03-12 17:40:17 +01:00
|
|
|
Revision 1.22 2007/02/18 08:01:07 cignoni
|
|
|
|
Added missing typename
|
|
|
|
|
2007-02-18 09:01:07 +01:00
|
|
|
Revision 1.21 2007/02/14 16:07:41 ganovelli
|
|
|
|
added HasPerFaceFlag
|
|
|
|
|
2007-02-14 17:07:41 +01:00
|
|
|
Revision 1.20 2007/02/14 15:40:20 ganovelli
|
|
|
|
a wrong "!" corrected
|
|
|
|
|
2007-02-14 16:40:20 +01:00
|
|
|
Revision 1.19 2007/02/14 15:30:13 ganovelli
|
|
|
|
added treatment of HasPerVertexFlags absent
|
|
|
|
|
2007-02-14 16:30:13 +01:00
|
|
|
Revision 1.18 2006/12/18 09:46:39 callieri
|
|
|
|
camera+shot revamp: changed field names to something with more sense, cleaning of various functions, correction of minor bugs/incongruences, removal of the infamous reference in shot.
|
|
|
|
|
2006-12-18 10:46:39 +01:00
|
|
|
Revision 1.17 2006/11/30 22:49:32 cignoni
|
|
|
|
Added save with (unused) callback
|
|
|
|
|
2006-11-30 23:49:32 +01:00
|
|
|
Revision 1.16 2006/10/14 00:39:22 cignoni
|
|
|
|
Added a comment on an assert
|
|
|
|
|
2006-10-14 02:39:22 +02:00
|
|
|
Revision 1.15 2006/01/30 13:43:59 cignoni
|
|
|
|
Added GetExportMaskCapability
|
|
|
|
|
2006-01-30 14:43:59 +01:00
|
|
|
Revision 1.14 2006/01/27 09:11:48 corsini
|
|
|
|
fix signed/unsigned mismatch
|
|
|
|
|
2006-01-27 10:11:48 +01:00
|
|
|
Revision 1.13 2006/01/13 15:47:43 cignoni
|
|
|
|
Uniformed return type to the style of Open. Now every export function returns 0 in case of success.
|
|
|
|
|
2006-01-13 16:47:43 +01:00
|
|
|
Revision 1.12 2006/01/10 13:20:42 cignoni
|
|
|
|
Changed ply::PlyMask to io::Mask
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
Revision 1.11 2005/11/23 15:48:25 pietroni
|
|
|
|
changed shot::similarity to shot::Similarity() and shot::camera to shot::Camera()
|
|
|
|
|
2005-11-23 16:48:25 +01:00
|
|
|
Revision 1.10 2004/10/28 00:52:45 cignoni
|
|
|
|
Better Doxygen documentation
|
|
|
|
|
2004-10-28 02:56:44 +02:00
|
|
|
Revision 1.9 2004/10/27 09:33:10 ganovelli
|
|
|
|
cast from scalar type to float added
|
|
|
|
|
2004-10-27 11:33:10 +02:00
|
|
|
Revision 1.8 2004/10/07 14:19:06 ganovelli
|
|
|
|
shot/camera io added
|
|
|
|
|
2004-10-07 16:19:06 +02:00
|
|
|
Revision 1.7 2004/07/15 10:54:48 ganovelli
|
|
|
|
std added
|
|
|
|
|
2004-07-15 12:54:48 +02:00
|
|
|
Revision 1.6 2004/05/28 14:11:13 ganovelli
|
|
|
|
changes to comply io_mask moving in vcg::ply namesp
|
|
|
|
|
2004-05-28 16:11:13 +02:00
|
|
|
Revision 1.5 2004/05/12 14:43:36 cignoni
|
|
|
|
removed warning of unused variables
|
|
|
|
|
2004-05-12 16:43:36 +02:00
|
|
|
Revision 1.4 2004/05/12 10:19:30 ganovelli
|
|
|
|
new line added at the end of file
|
|
|
|
|
2004-05-12 12:19:30 +02:00
|
|
|
Revision 1.3 2004/03/18 15:30:46 cignoni
|
|
|
|
Removed float/double warning
|
|
|
|
|
2004-03-18 16:30:57 +01:00
|
|
|
Revision 1.2 2004/03/09 21:26:47 cignoni
|
|
|
|
cr lf mismatch
|
|
|
|
|
2004-03-09 22:26:47 +01:00
|
|
|
Revision 1.1 2004/03/08 09:21:33 cignoni
|
|
|
|
Initial commit
|
|
|
|
|
2004-03-08 10:24:59 +01:00
|
|
|
Revision 1.1 2004/03/03 15:00:51 cignoni
|
|
|
|
Initial commit
|
|
|
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
@name Load and Save in Ply format
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
|
|
|
|
#ifndef __VCGLIB_EXPORT_PLY
|
|
|
|
#define __VCGLIB_EXPORT_PLY
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
//#include<wrap/ply/io_mask.h>
|
|
|
|
#include<wrap/io_trimesh/io_mask.h>
|
2004-03-08 10:24:59 +01:00
|
|
|
#include<wrap/io_trimesh/io_ply.h>
|
2007-02-14 16:30:13 +01:00
|
|
|
#include<vcg/container/simple_temporary_data.h>
|
|
|
|
|
2004-03-08 10:24:59 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
namespace vcg {
|
|
|
|
namespace tri {
|
|
|
|
namespace io {
|
|
|
|
|
|
|
|
|
|
|
|
template <class SaveMeshType>
|
|
|
|
class ExporterPLY
|
|
|
|
{
|
2004-03-09 22:26:47 +01:00
|
|
|
// Si occupa di convertire da un tipo all'altro.
|
|
|
|
// usata nella saveply per matchare i tipi tra stotype e memtype.
|
|
|
|
// Ad es se in memoria c'e' un int e voglio salvare un float
|
|
|
|
// src sara in effetti un puntatore a int il cui valore deve
|
|
|
|
// essere convertito al tipo di ritorno desiderato (stotype)
|
|
|
|
|
|
|
|
template <class StoType>
|
|
|
|
static void PlyConv(int mem_type, void *src, StoType &dest)
|
|
|
|
{
|
|
|
|
switch (mem_type){
|
|
|
|
case ply::T_FLOAT : dest = (StoType) (* ((float *) src)); break;
|
|
|
|
case ply::T_DOUBLE: dest = (StoType) (* ((double *) src)); break;
|
|
|
|
case ply::T_INT : dest = (StoType) (* ((int *) src)); break;
|
|
|
|
case ply::T_SHORT : dest = (StoType) (* ((short *) src)); break;
|
|
|
|
case ply::T_CHAR : dest = (StoType) (* ((char *) src)); break;
|
|
|
|
case ply::T_UCHAR : dest = (StoType) (* ((unsigned char *)src)); break;
|
|
|
|
default : assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-08 10:24:59 +01:00
|
|
|
public:
|
|
|
|
typedef ::vcg::ply::PropDescriptor PropDescriptor ;
|
|
|
|
typedef typename SaveMeshType::VertexPointer VertexPointer;
|
|
|
|
typedef typename SaveMeshType::ScalarType ScalarType;
|
|
|
|
typedef typename SaveMeshType::VertexType VertexType;
|
|
|
|
typedef typename SaveMeshType::FaceType FaceType;
|
2004-03-09 22:26:47 +01:00
|
|
|
typedef typename SaveMeshType::FacePointer FacePointer;
|
2004-03-08 10:24:59 +01:00
|
|
|
typedef typename SaveMeshType::VertexIterator VertexIterator;
|
|
|
|
typedef typename SaveMeshType::FaceIterator FaceIterator;
|
|
|
|
|
2006-01-13 16:47:43 +01:00
|
|
|
static int Save(SaveMeshType &m, const char * filename, bool binary=true)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
PlyInfo pi;
|
2004-03-09 22:26:47 +01:00
|
|
|
return Save(m,filename,binary,pi);
|
2004-03-08 10:24:59 +01:00
|
|
|
}
|
|
|
|
|
2008-07-02 15:30:21 +02:00
|
|
|
static int Save(SaveMeshType &m, const char * filename, int savemask, bool binary = true, CallBackPos *cb=0 )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
PlyInfo pi;
|
|
|
|
pi.mask=savemask;
|
2008-07-02 15:30:21 +02:00
|
|
|
return Save(m,filename,binary,pi,cb);
|
2004-03-08 10:24:59 +01:00
|
|
|
}
|
|
|
|
|
2008-04-29 13:51:28 +02:00
|
|
|
static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &pi, CallBackPos *cb=0) // V1.0
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
FILE * fpout;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
const char * hbin = "binary_little_endian";
|
|
|
|
const char * hasc = "ascii";
|
|
|
|
const char * h;
|
|
|
|
|
|
|
|
bool multit = false;
|
|
|
|
|
|
|
|
if(binary) h=hbin;
|
|
|
|
else h=hasc;
|
|
|
|
|
|
|
|
fpout = fopen(filename,"wb");
|
2007-11-06 11:51:55 +01:00
|
|
|
if(fpout==NULL) {
|
|
|
|
pi.status=::vcg::ply::E_CANTOPEN;
|
2007-11-06 11:59:41 +01:00
|
|
|
return ::vcg::ply::E_CANTOPEN;
|
2007-11-06 11:51:55 +01:00
|
|
|
}
|
2004-03-08 10:24:59 +01:00
|
|
|
fprintf(fpout,
|
|
|
|
"ply\n"
|
|
|
|
"format %s 1.0\n"
|
|
|
|
"comment VCGLIB generated\n"
|
|
|
|
,h
|
|
|
|
);
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( pi.mask & Mask::IOM_WEDGTEXCOORD )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2006-01-13 16:47:43 +01:00
|
|
|
const char * TFILE = "TextureFile";
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2006-01-27 10:11:48 +01:00
|
|
|
for(i=0; i < static_cast<int>(m.textures.size()); ++i)
|
2006-01-13 16:47:43 +01:00
|
|
|
fprintf(fpout,"comment %s %s\n", TFILE, (const char *)(m.textures[i].c_str()) );
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2007-03-12 17:40:17 +01:00
|
|
|
if(m.textures.size()>1 && (m.HasPerWedgeTexCoord() || m.HasPerVertexTexCoord())) multit = true;
|
2004-03-08 10:24:59 +01:00
|
|
|
}
|
|
|
|
|
2006-12-18 10:46:39 +01:00
|
|
|
if((pi.mask & Mask::IOM_CAMERA))
|
2004-10-07 16:19:06 +02:00
|
|
|
{
|
2004-03-08 10:24:59 +01:00
|
|
|
fprintf(fpout,
|
|
|
|
"element camera 1\n"
|
|
|
|
"property float view_px\n"
|
|
|
|
"property float view_py\n"
|
|
|
|
"property float view_pz\n"
|
|
|
|
"property float x_axisx\n"
|
|
|
|
"property float x_axisy\n"
|
|
|
|
"property float x_axisz\n"
|
|
|
|
"property float y_axisx\n"
|
|
|
|
"property float y_axisy\n"
|
|
|
|
"property float y_axisz\n"
|
|
|
|
"property float z_axisx\n"
|
|
|
|
"property float z_axisy\n"
|
|
|
|
"property float z_axisz\n"
|
|
|
|
"property float focal\n"
|
|
|
|
"property float scalex\n"
|
|
|
|
"property float scaley\n"
|
|
|
|
"property float centerx\n"
|
|
|
|
"property float centery\n"
|
|
|
|
"property int viewportx\n"
|
|
|
|
"property int viewporty\n"
|
|
|
|
"property float k1\n"
|
|
|
|
"property float k2\n"
|
|
|
|
"property float k3\n"
|
|
|
|
"property float k4\n"
|
|
|
|
);
|
2004-10-07 16:19:06 +02:00
|
|
|
}
|
2004-03-08 10:24:59 +01:00
|
|
|
|
|
|
|
fprintf(fpout,
|
|
|
|
"element vertex %d\n"
|
|
|
|
"property float x\n"
|
|
|
|
"property float y\n"
|
|
|
|
"property float z\n"
|
|
|
|
,m.vn
|
|
|
|
);
|
|
|
|
|
2007-10-22 16:47:19 +02:00
|
|
|
if( m.HasPerVertexNormal() &&( pi.mask & Mask::IOM_VERTNORMAL) )
|
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property float nx\n"
|
|
|
|
"property float ny\n"
|
|
|
|
"property float nz\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2007-02-14 16:30:13 +01:00
|
|
|
if( m.HasPerVertexFlags() &&( pi.mask & Mask::IOM_VERTFLAGS) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property int flags\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerVertexColor() && (pi.mask & Mask::IOM_VERTCOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property uchar red\n"
|
|
|
|
"property uchar green\n"
|
|
|
|
"property uchar blue\n"
|
|
|
|
"property uchar alpha\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerVertexQuality() && (pi.mask & Mask::IOM_VERTQUALITY) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property float quality\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i=0;i<pi.vdn;i++)
|
|
|
|
fprintf(fpout,"property %s %s\n",pi.VertexData[i].stotypename(),pi.VertexData[i].propname);
|
|
|
|
|
|
|
|
fprintf(fpout,
|
|
|
|
"element face %d\n"
|
|
|
|
"property list uchar int vertex_indices\n"
|
|
|
|
,m.fn
|
|
|
|
);
|
|
|
|
|
2007-02-14 16:30:13 +01:00
|
|
|
if(m.HasPerFaceFlags() && (pi.mask & Mask::IOM_FACEFLAGS) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property int flags\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2007-03-12 17:40:17 +01:00
|
|
|
if( ( m.HasPerVertexTexCoord() && pi.mask & Mask::IOM_VERTTEXCOORD ) ||
|
|
|
|
( m.HasPerWedgeTexCoord() && pi.mask & Mask::IOM_WEDGTEXCOORD ) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property list uchar float texcoord\n"
|
|
|
|
);
|
|
|
|
|
|
|
|
if(multit)
|
|
|
|
fprintf(fpout,
|
|
|
|
"property int texnumber\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerFaceColor() && (pi.mask & Mask::IOM_FACECOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property uchar red\n"
|
|
|
|
"property uchar green\n"
|
|
|
|
"property uchar blue\n"
|
|
|
|
"property uchar alpha\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if ( m.HasPerWedgeColor() && (pi.mask & Mask::IOM_WEDGCOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property list uchar float color\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerFaceQuality() && (pi.mask & Mask::IOM_FACEQUALITY) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,
|
|
|
|
"property float quality\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i=0;i<pi.fdn;i++)
|
|
|
|
fprintf(fpout,"property %s %s\n",pi.FaceData[i].stotypename(),pi.FaceData[i].propname);
|
|
|
|
|
|
|
|
fprintf(fpout, "end_header\n" );
|
|
|
|
|
|
|
|
// Salvataggio camera
|
2006-12-18 10:46:39 +01:00
|
|
|
if((pi.mask & Mask::IOM_CAMERA))
|
2004-10-07 16:19:06 +02:00
|
|
|
{
|
|
|
|
if(binary)
|
|
|
|
{
|
|
|
|
float t[17];
|
|
|
|
|
2008-09-26 19:05:49 +02:00
|
|
|
t[ 0] = (float)m.shot.Extrinsics.Tra()[0];
|
|
|
|
t[ 1] = (float)m.shot.Extrinsics.Tra()[1];
|
|
|
|
t[ 2] = (float)m.shot.Extrinsics.Tra()[2];
|
|
|
|
t[ 3] = (float)m.shot.Extrinsics.Rot()[0][0];
|
|
|
|
t[ 4] = (float)m.shot.Extrinsics.Rot()[0][1];
|
|
|
|
t[ 5] = (float)m.shot.Extrinsics.Rot()[0][2];
|
|
|
|
t[ 6] = (float)m.shot.Extrinsics.Rot()[1][0];
|
|
|
|
t[ 7] = (float)m.shot.Extrinsics.Rot()[1][1];
|
|
|
|
t[ 8] = (float)m.shot.Extrinsics.Rot()[1][2];
|
|
|
|
t[ 9] = (float)m.shot.Extrinsics.Rot()[2][0];
|
|
|
|
t[10] = (float)m.shot.Extrinsics.Rot()[2][1];
|
|
|
|
t[11] = (float)m.shot.Extrinsics.Rot()[2][2];
|
2006-12-18 10:46:39 +01:00
|
|
|
t[12] = (float)m.shot.Intrinsics.FocalMm;
|
|
|
|
t[13] = (float)m.shot.Intrinsics.PixelSizeMm[0];
|
|
|
|
t[14] = (float)m.shot.Intrinsics.PixelSizeMm[1];
|
|
|
|
t[15] = (float)m.shot.Intrinsics.CenterPx[0];
|
|
|
|
t[16] = (float)m.shot.Intrinsics.CenterPx[1];
|
2004-10-07 16:19:06 +02:00
|
|
|
fwrite(t,sizeof(float),17,fpout);
|
|
|
|
|
2006-12-18 10:46:39 +01:00
|
|
|
fwrite( &m.shot.Intrinsics.ViewportPx[0],sizeof(int),2,fpout );
|
2004-10-07 16:19:06 +02:00
|
|
|
|
2006-12-18 10:46:39 +01:00
|
|
|
t[ 0] = (float)m.shot.Intrinsics.k[0];
|
|
|
|
t[ 1] = (float)m.shot.Intrinsics.k[1];
|
|
|
|
t[ 2] = (float)m.shot.Intrinsics.k[2];
|
|
|
|
t[ 3] = (float)m.shot.Intrinsics.k[3];
|
2004-10-07 16:19:06 +02:00
|
|
|
fwrite(t,sizeof(float),4,fpout);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fprintf(fpout,"%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d %d %g %g %g %g\n"
|
2008-09-26 19:05:49 +02:00
|
|
|
,-m.shot.Extrinsics.Tra()[0]
|
|
|
|
,-m.shot.Extrinsics.Tra()[1]
|
|
|
|
,-m.shot.Extrinsics.Tra()[2]
|
|
|
|
,m.shot.Extrinsics.Rot()[0][0]
|
|
|
|
,m.shot.Extrinsics.Rot()[0][1]
|
|
|
|
,m.shot.Extrinsics.Rot()[0][2]
|
|
|
|
,m.shot.Extrinsics.Rot()[1][0]
|
|
|
|
,m.shot.Extrinsics.Rot()[1][1]
|
|
|
|
,m.shot.Extrinsics.Rot()[1][2]
|
|
|
|
,m.shot.Extrinsics.Rot()[2][0]
|
|
|
|
,m.shot.Extrinsics.Rot()[2][1]
|
|
|
|
,m.shot.Extrinsics.Rot()[2][2]
|
2006-12-18 10:46:39 +01:00
|
|
|
,m.shot.Intrinsics.FocalMm
|
|
|
|
,m.shot.Intrinsics.PixelSizeMm[0]
|
|
|
|
,m.shot.Intrinsics.PixelSizeMm[1]
|
|
|
|
,m.shot.Intrinsics.CenterPx[0]
|
|
|
|
,m.shot.Intrinsics.CenterPx[1]
|
|
|
|
,m.shot.Intrinsics.ViewportPx[0]
|
|
|
|
,m.shot.Intrinsics.ViewportPx[1]
|
|
|
|
,m.shot.Intrinsics.k[0]
|
|
|
|
,m.shot.Intrinsics.k[1]
|
|
|
|
,m.shot.Intrinsics.k[2]
|
|
|
|
,m.shot.Intrinsics.k[3]
|
2004-10-07 16:19:06 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2004-03-08 10:24:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
int j;
|
2007-02-14 16:30:13 +01:00
|
|
|
std::vector<int> FlagV;
|
2004-03-09 22:26:47 +01:00
|
|
|
VertexPointer vp;
|
|
|
|
VertexIterator vi;
|
2007-02-18 09:01:07 +01:00
|
|
|
SimpleTempData<typename SaveMeshType::VertContainer,int> indices(m.vert);
|
2007-02-14 16:30:13 +01:00
|
|
|
|
|
|
|
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi){
|
2004-03-08 10:24:59 +01:00
|
|
|
vp=&(*vi);
|
2008-05-29 17:15:19 +02:00
|
|
|
indices[vi] = j;
|
2007-02-14 16:30:13 +01:00
|
|
|
|
2008-07-02 15:30:21 +02:00
|
|
|
if(cb && ((j%1000)==0))(*cb)( (100*j)/(m.vn+m.fn), "Saving Vertices");
|
|
|
|
|
2007-02-14 16:30:13 +01:00
|
|
|
if( !m.HasPerVertexFlags() || !vp->IsD() )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
if(binary)
|
|
|
|
{
|
|
|
|
float t;
|
|
|
|
|
2004-03-09 22:26:47 +01:00
|
|
|
t = float(vp->UberP()[0]); fwrite(&t,sizeof(float),1,fpout);
|
|
|
|
t = float(vp->UberP()[1]); fwrite(&t,sizeof(float),1,fpout);
|
|
|
|
t = float(vp->UberP()[2]); fwrite(&t,sizeof(float),1,fpout);
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2007-10-22 16:47:19 +02:00
|
|
|
if( m.HasPerVertexNormal() && (pi.mask & Mask::IOM_VERTNORMAL) )
|
|
|
|
{
|
|
|
|
t = float(vp->N()[0]); fwrite(&t,sizeof(float),1,fpout);
|
|
|
|
t = float(vp->N()[1]); fwrite(&t,sizeof(float),1,fpout);
|
|
|
|
t = float(vp->N()[2]); fwrite(&t,sizeof(float),1,fpout);
|
|
|
|
}
|
2007-02-14 16:30:13 +01:00
|
|
|
if( m.HasPerVertexFlags() && (pi.mask & Mask::IOM_VERTFLAGS) )
|
2004-03-09 22:26:47 +01:00
|
|
|
fwrite(&(vp->UberFlags()),sizeof(int),1,fpout);
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerVertexColor() && (pi.mask & Mask::IOM_VERTCOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
fwrite(&( vp->C() ),sizeof(char),4,fpout);
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerVertexQuality() && (pi.mask & Mask::IOM_VERTQUALITY) )
|
2004-03-08 10:24:59 +01:00
|
|
|
fwrite(&( vp->Q() ),sizeof(float),1,fpout);
|
|
|
|
|
|
|
|
|
2004-03-09 22:26:47 +01:00
|
|
|
for(i=0;i<pi.vdn;i++)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2004-10-27 11:33:10 +02:00
|
|
|
double td(0); float tf(0);int ti;short ts; char tc; unsigned char tuc;
|
2004-03-09 22:26:47 +01:00
|
|
|
switch (pi.VertexData[i].stotype1)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2004-03-09 22:26:47 +01:00
|
|
|
case ply::T_FLOAT : PlyConv(pi.VertexData[i].memtype1, ((char *)vp)+pi.VertexData[i].offset1, tf ); fwrite(&tf, sizeof(float),1,fpout); break;
|
|
|
|
case ply::T_DOUBLE : PlyConv(pi.VertexData[i].memtype1, ((char *)vp)+pi.VertexData[i].offset1, td ); fwrite(&td, sizeof(double),1,fpout); break;
|
|
|
|
case ply::T_INT : PlyConv(pi.VertexData[i].memtype1, ((char *)vp)+pi.VertexData[i].offset1, ti ); fwrite(&ti, sizeof(int),1,fpout); break;
|
|
|
|
case ply::T_SHORT : PlyConv(pi.VertexData[i].memtype1, ((char *)vp)+pi.VertexData[i].offset1, ts ); fwrite(&ts, sizeof(short),1,fpout); break;
|
|
|
|
case ply::T_CHAR : PlyConv(pi.VertexData[i].memtype1, ((char *)vp)+pi.VertexData[i].offset1, tc ); fwrite(&tc, sizeof(char),1,fpout); break;
|
|
|
|
case ply::T_UCHAR : PlyConv(pi.VertexData[i].memtype1, ((char *)vp)+pi.VertexData[i].offset1, tuc); fwrite(&tuc,sizeof(unsigned char),1,fpout); break;
|
2004-03-08 10:24:59 +01:00
|
|
|
default : assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // ***** ASCII *****
|
|
|
|
{
|
|
|
|
fprintf(fpout,"%g %g %g " ,vp->P()[0],vp->P()[1],vp->P()[2]);
|
|
|
|
|
2007-10-22 16:47:19 +02:00
|
|
|
if( m.HasPerVertexNormal() && (pi.mask & Mask::IOM_VERTNORMAL) )
|
2007-12-13 01:20:34 +01:00
|
|
|
fprintf(fpout,"%g %g %g " ,double(vp->N()[0]),double(vp->N()[1]),double(vp->N()[2]));
|
2007-10-22 16:47:19 +02:00
|
|
|
|
2007-02-14 16:30:13 +01:00
|
|
|
if( m.HasPerVertexFlags() && (pi.mask & Mask::IOM_VERTFLAGS))
|
2004-03-09 22:26:47 +01:00
|
|
|
fprintf(fpout,"%d ",vp->UberFlags());
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerVertexColor() && (pi.mask & Mask::IOM_VERTCOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
fprintf(fpout,"%d %d %d %d ",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] );
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerVertexQuality() && (pi.mask & Mask::IOM_VERTQUALITY) )
|
2004-03-08 10:24:59 +01:00
|
|
|
fprintf(fpout,"%g ",vp->Q());
|
|
|
|
|
2004-03-09 22:26:47 +01:00
|
|
|
for(i=0;i<pi.vdn;i++)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2004-10-27 11:33:10 +02:00
|
|
|
float tf(0); double td(0);
|
2004-03-08 10:24:59 +01:00
|
|
|
int ti;
|
2004-03-09 22:26:47 +01:00
|
|
|
switch (pi.VertexData[i].memtype1)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2004-03-09 22:26:47 +01:00
|
|
|
case ply::T_FLOAT : tf=*( (float *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%g ",tf); break;
|
2004-03-18 16:30:57 +01:00
|
|
|
case ply::T_DOUBLE : td=*( (double *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%g ",tf); break;
|
2004-03-09 22:26:47 +01:00
|
|
|
case ply::T_INT : ti=*( (int *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
2004-03-18 16:30:57 +01:00
|
|
|
case ply::T_SHORT : ti=*( (short *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
2004-03-09 22:26:47 +01:00
|
|
|
case ply::T_CHAR : ti=*( (char *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
|
|
|
case ply::T_UCHAR : ti=*( (unsigned char *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
2004-03-08 10:24:59 +01:00
|
|
|
default : assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(fpout,"\n");
|
|
|
|
}
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
2006-10-14 02:39:22 +02:00
|
|
|
// this assert triggers when the vn != number of vertexes in vert that are not deleted.
|
|
|
|
assert(j==m.vn);
|
2004-03-08 10:24:59 +01:00
|
|
|
|
|
|
|
char c = 3;
|
|
|
|
unsigned char b9 = 9;
|
|
|
|
unsigned char b6 = 6;
|
2004-03-09 22:26:47 +01:00
|
|
|
FacePointer fp;
|
2004-03-08 10:24:59 +01:00
|
|
|
int vv[3];
|
2004-03-09 22:26:47 +01:00
|
|
|
FaceIterator fi;
|
2004-03-08 10:24:59 +01:00
|
|
|
int fcnt=0;
|
2004-03-09 22:26:47 +01:00
|
|
|
for(j=0,fi=m.face.begin();fi!=m.face.end();++fi)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2008-07-02 15:30:21 +02:00
|
|
|
if(cb && ((j%1000)==0) ) (*cb)( 100*(m.vn+j)/(m.vn+m.fn), "Saving Vertices");
|
|
|
|
|
2004-03-08 10:24:59 +01:00
|
|
|
fp=&(*fi);
|
2004-03-09 22:26:47 +01:00
|
|
|
if( ! fp->IsD() )
|
2004-03-08 10:24:59 +01:00
|
|
|
{ fcnt++;
|
|
|
|
if(binary)
|
|
|
|
{
|
2008-05-16 19:44:31 +02:00
|
|
|
vv[0]=indices[fp->cV(0)];
|
|
|
|
vv[1]=indices[fp->cV(1)];
|
|
|
|
vv[2]=indices[fp->cV(2)];
|
2007-02-14 16:30:13 +01:00
|
|
|
fwrite(&c,1,1,fpout);
|
|
|
|
fwrite(vv,sizeof(int),3,fpout);
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2007-07-23 15:27:50 +02:00
|
|
|
if(m.HasPerFaceFlags()&&( pi.mask & Mask::IOM_FACEFLAGS) )
|
2004-03-08 10:24:59 +01:00
|
|
|
fwrite(&(fp->Flags()),sizeof(int),1,fpout);
|
|
|
|
|
2007-03-12 17:40:17 +01:00
|
|
|
if( m.HasPerVertexTexCoord() && (pi.mask & Mask::IOM_VERTTEXCOORD) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fwrite(&b6,sizeof(char),1,fpout);
|
|
|
|
float t[6];
|
|
|
|
for(int k=0;k<3;++k)
|
|
|
|
{
|
|
|
|
t[k*2+0] = fp->V(k)->T().u();
|
|
|
|
t[k*2+1] = fp->V(k)->T().v();
|
|
|
|
}
|
|
|
|
fwrite(t,sizeof(float),6,fpout);
|
|
|
|
}
|
2007-03-12 17:40:17 +01:00
|
|
|
else if( m.HasPerWedgeTexCoord() && (pi.mask & Mask::IOM_WEDGTEXCOORD) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fwrite(&b6,sizeof(char),1,fpout);
|
|
|
|
float t[6];
|
|
|
|
for(int k=0;k<3;++k)
|
|
|
|
{
|
|
|
|
t[k*2+0] = fp->WT(k).u();
|
|
|
|
t[k*2+1] = fp->WT(k).v();
|
|
|
|
}
|
|
|
|
fwrite(t,sizeof(float),6,fpout);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(multit)
|
|
|
|
{
|
|
|
|
int t = fp->WT(0).n();
|
|
|
|
fwrite(&t,sizeof(int),1,fpout);
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerFaceColor() && (pi.mask & Mask::IOM_FACECOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
fwrite(&( fp->C() ),sizeof(char),4,fpout);
|
|
|
|
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerWedgeColor() && (pi.mask & Mask::IOM_WEDGCOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fwrite(&b9,sizeof(char),1,fpout);
|
|
|
|
float t[3];
|
|
|
|
for(int z=0;z<3;++z)
|
|
|
|
{
|
|
|
|
t[0] = float(fp->WC(z)[0])/255;
|
|
|
|
t[1] = float(fp->WC(z)[1])/255;
|
|
|
|
t[2] = float(fp->WC(z)[2])/255;
|
|
|
|
fwrite( t,sizeof(float),3,fpout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerFaceQuality() && (pi.mask & Mask::IOM_FACEQUALITY) )
|
2004-03-08 10:24:59 +01:00
|
|
|
fwrite( &(fp->Q()),sizeof(float),1,fpout);
|
|
|
|
|
|
|
|
|
2004-03-09 22:26:47 +01:00
|
|
|
for(i=0;i<pi.fdn;i++)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2004-10-27 11:33:10 +02:00
|
|
|
double td(0); float tf(0);int ti;short ts; char tc; unsigned char tuc;
|
2004-03-09 22:26:47 +01:00
|
|
|
switch (pi.FaceData[i].stotype1){
|
|
|
|
case ply::T_FLOAT : PlyConv(pi.FaceData[i].memtype1, ((char *)fp)+pi.FaceData[i].offset1, tf ); fwrite(&tf, sizeof(float),1,fpout); break;
|
|
|
|
case ply::T_DOUBLE : PlyConv(pi.FaceData[i].memtype1, ((char *)fp)+pi.FaceData[i].offset1, td ); fwrite(&td, sizeof(double),1,fpout); break;
|
|
|
|
case ply::T_INT : PlyConv(pi.FaceData[i].memtype1, ((char *)fp)+pi.FaceData[i].offset1, ti ); fwrite(&ti, sizeof(int),1,fpout); break;
|
|
|
|
case ply::T_SHORT : PlyConv(pi.FaceData[i].memtype1, ((char *)fp)+pi.FaceData[i].offset1, ts ); fwrite(&ts, sizeof(short),1,fpout); break;
|
|
|
|
case ply::T_CHAR : PlyConv(pi.FaceData[i].memtype1, ((char *)fp)+pi.FaceData[i].offset1, tc ); fwrite(&tc, sizeof(char),1,fpout); break;
|
|
|
|
case ply::T_UCHAR : PlyConv(pi.FaceData[i].memtype1, ((char *)fp)+pi.FaceData[i].offset1, tuc); fwrite(&tuc,sizeof(unsigned char),1,fpout); break;
|
2004-03-08 10:24:59 +01:00
|
|
|
default : assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // ***** ASCII *****
|
|
|
|
{
|
2007-02-14 16:30:13 +01:00
|
|
|
fprintf(fpout,"3 %d %d %d ",
|
|
|
|
indices[fp->cV(0)], indices[fp->cV(1)], indices[fp->cV(2)] );
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2007-07-23 15:27:50 +02:00
|
|
|
if(m.HasPerFaceFlags()&&( pi.mask & Mask::IOM_FACEFLAGS ))
|
2004-03-08 10:24:59 +01:00
|
|
|
fprintf(fpout,"%d ",fp->Flags());
|
|
|
|
|
2007-03-12 17:40:17 +01:00
|
|
|
if( m.HasPerVertexTexCoord() && (pi.mask & Mask::IOM_VERTTEXCOORD) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,"6 ");
|
|
|
|
for(int k=0;k<3;++k)
|
|
|
|
fprintf(fpout,"%g %g "
|
|
|
|
,fp->V(k)->T().u()
|
|
|
|
,fp->V(k)->T().v()
|
|
|
|
);
|
|
|
|
}
|
2007-03-12 17:40:17 +01:00
|
|
|
else if( m.HasPerWedgeTexCoord() && (pi.mask & Mask::IOM_WEDGTEXCOORD) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,"6 ");
|
|
|
|
for(int k=0;k<3;++k)
|
|
|
|
fprintf(fpout,"%g %g "
|
|
|
|
,fp->WT(k).u()
|
|
|
|
,fp->WT(k).v()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(multit)
|
|
|
|
{
|
|
|
|
fprintf(fpout,"%d ",fp->WT(0).n());
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerFaceColor() && (pi.mask & Mask::IOM_FACECOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
float t[3];
|
|
|
|
t[0] = float(fp->C()[0])/255;
|
|
|
|
t[1] = float(fp->C()[1])/255;
|
|
|
|
t[2] = float(fp->C()[2])/255;
|
|
|
|
fprintf(fpout,"9 ");
|
|
|
|
fprintf(fpout,"%g %g %g ",t[0],t[1],t[2]);
|
|
|
|
fprintf(fpout,"%g %g %g ",t[0],t[1],t[2]);
|
|
|
|
fprintf(fpout,"%g %g %g ",t[0],t[1],t[2]);
|
|
|
|
}
|
2006-01-10 14:20:42 +01:00
|
|
|
else if( m.HasPerWedgeColor() && (pi.mask & Mask::IOM_WEDGCOLOR) )
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
|
|
|
fprintf(fpout,"9 ");
|
|
|
|
for(int z=0;z<3;++z)
|
|
|
|
fprintf(fpout,"%g %g %g "
|
|
|
|
,double(fp->WC(z)[0])/255
|
|
|
|
,double(fp->WC(z)[1])/255
|
|
|
|
,double(fp->WC(z)[2])/255
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:20:42 +01:00
|
|
|
if( m.HasPerFaceQuality() && (pi.mask & Mask::IOM_FACEQUALITY) )
|
2004-03-08 10:24:59 +01:00
|
|
|
fprintf(fpout,"%g ",fp->Q());
|
|
|
|
|
2004-03-09 22:26:47 +01:00
|
|
|
for(i=0;i<pi.fdn;i++)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2004-10-27 11:33:10 +02:00
|
|
|
float tf(0); double td(0);
|
2004-03-08 10:24:59 +01:00
|
|
|
int ti;
|
2004-03-09 22:26:47 +01:00
|
|
|
switch (pi.FaceData[i].memtype1)
|
2004-03-08 10:24:59 +01:00
|
|
|
{
|
2004-03-09 22:26:47 +01:00
|
|
|
case ply::T_FLOAT : tf=*( (float *) (((char *)fp)+pi.FaceData[i].offset1)); fprintf(fpout,"%g ",tf); break;
|
2004-03-18 16:30:57 +01:00
|
|
|
case ply::T_DOUBLE : td=*( (double *) (((char *)fp)+pi.FaceData[i].offset1)); fprintf(fpout,"%g ",tf); break;
|
2004-03-09 22:26:47 +01:00
|
|
|
case ply::T_INT : ti=*( (int *) (((char *)fp)+pi.FaceData[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
|
|
|
case ply::T_SHORT : ti=*( (short *) (((char *)fp)+pi.FaceData[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
|
|
|
case ply::T_CHAR : ti=*( (char *) (((char *)fp)+pi.FaceData[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
|
|
|
case ply::T_UCHAR : ti=*( (unsigned char *) (((char *)fp)+pi.FaceData[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
2004-03-08 10:24:59 +01:00
|
|
|
default : assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(fpout,"\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-03-09 22:26:47 +01:00
|
|
|
assert(fcnt==m.fn);
|
2004-03-08 10:24:59 +01:00
|
|
|
fclose(fpout);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-01-13 16:47:43 +01:00
|
|
|
static const char *ErrorMsg(int error)
|
|
|
|
{
|
|
|
|
static std::vector<std::string> ply_error_msg;
|
|
|
|
if(ply_error_msg.empty())
|
|
|
|
{
|
|
|
|
ply_error_msg.resize(PlyInfo::E_MAXPLYINFOERRORS );
|
|
|
|
ply_error_msg[ply::E_NOERROR ]="No errors";
|
|
|
|
ply_error_msg[ply::E_CANTOPEN ]="Can't open file";
|
|
|
|
ply_error_msg[ply::E_NOTHEADER ]="Header not found";
|
|
|
|
ply_error_msg[ply::E_UNESPECTEDEOF ]="Eof in header";
|
|
|
|
ply_error_msg[ply::E_NOFORMAT ]="Format not found";
|
|
|
|
ply_error_msg[ply::E_SYNTAX ]="Syntax error on header";
|
|
|
|
ply_error_msg[ply::E_PROPOUTOFELEMENT]="Property without element";
|
|
|
|
ply_error_msg[ply::E_BADTYPENAME ]="Bad type name";
|
|
|
|
ply_error_msg[ply::E_ELEMNOTFOUND ]="Element not found";
|
|
|
|
ply_error_msg[ply::E_PROPNOTFOUND ]="Property not found";
|
|
|
|
ply_error_msg[ply::E_BADTYPE ]="Bad type on addtoread";
|
|
|
|
ply_error_msg[ply::E_INCOMPATIBLETYPE]="Incompatible type";
|
|
|
|
ply_error_msg[ply::E_BADCAST ]="Bad cast";
|
|
|
|
|
|
|
|
ply_error_msg[PlyInfo::E_NO_VERTEX ]="No vertex field found";
|
|
|
|
ply_error_msg[PlyInfo::E_NO_FACE ]="No face field found";
|
|
|
|
ply_error_msg[PlyInfo::E_SHORTFILE ]="Unespected eof";
|
|
|
|
ply_error_msg[PlyInfo::E_NO_3VERTINFACE ]="Face with more than 3 vertices";
|
|
|
|
ply_error_msg[PlyInfo::E_BAD_VERT_INDEX ]="Bad vertex index in face";
|
|
|
|
ply_error_msg[PlyInfo::E_NO_6TCOORD ]="Face with no 6 texture coordinates";
|
|
|
|
ply_error_msg[PlyInfo::E_DIFFER_COLORS ]="Number of color differ from vertices";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(error>PlyInfo::E_MAXPLYINFOERRORS || error<0) return "Unknown error";
|
|
|
|
else return ply_error_msg[error].c_str();
|
|
|
|
};
|
2004-03-08 10:24:59 +01:00
|
|
|
|
2006-01-30 14:43:59 +01:00
|
|
|
static int GetExportMaskCapability()
|
|
|
|
{
|
|
|
|
int capability = 0;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_VERTCOORD ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_VERTFLAGS ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_VERTCOLOR ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_VERTQUALITY ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_VERTNORMAL ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_VERTTEXCOORD ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_FACEINDEX ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_FACEFLAGS ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_FACECOLOR ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_FACEQUALITY ;
|
2007-10-22 16:47:19 +02:00
|
|
|
// capability |= vcg::tri::io::Mask::IOM_FACENORMAL ;
|
2006-01-30 14:43:59 +01:00
|
|
|
capability |= vcg::tri::io::Mask::IOM_WEDGCOLOR ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_WEDGTEXCOORD ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_WEDGTEXMULTI ;
|
|
|
|
capability |= vcg::tri::io::Mask::IOM_WEDGNORMAL ;
|
|
|
|
return capability;
|
|
|
|
}
|
2004-03-08 10:24:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
}; // end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace tri
|
|
|
|
} // end namespace io
|
|
|
|
} // end namespace vcg
|
2004-10-28 02:56:44 +02:00
|
|
|
//@}
|
2004-05-12 12:19:30 +02:00
|
|
|
#endif
|