hi,
here some tools for Diet3D, I need a java code that does parse the XML
binary stream,
(C code is also welcome)
zip archive provide some samples (see cube-xmlbin.xml)
here is the write code :
int fprintObjectXMLBin(FILE* f, Object const * const o)
{
unsigned int i=0;
fprintf(f,"\n<object");
if ( o->name) fprintf(f," name=\"%s\"",o->name);
else fprintf(f," name=\"unknown\"");
fprintf(f," vertices=\"%d\" faces=\"%d\"", o->nv, o->nf);
fprintf(f,">\n\n");
fprintf(f,"<vertices format=\"3f\" count=\"%d\">",o->nv);
for(i=0;i<o->nv;i++) {
fwrite( &(o->vv[i].x),sizeof( o->vv[i].x ),1,f);
fwrite( &(o->vv[i].y),sizeof( o->vv[i].y ),1,f);
fwrite( &(o->vv[i].z),sizeof( o->vv[i].z ),1,f);
}
fprintf(f,"</vertices>\n");
fprintf(f,"\n<faces format=\"3i\" count=\"%d\">",o->nf);
for(i=0;i<o->nf;i++) {
fwrite( &(o->vf[i].a),sizeof( o->vf[i].a ),1,f);
fwrite( &(o->vf[i].b),sizeof( o->vf[i].b ),1,f);
fwrite( &(o->vf[i].c),sizeof( o->vf[i].c ),1,f);
}
fprintf(f,"</faces>\n");
fprintf(f,"\n</object>\n");
return 1;
}
--
C-x C-c
# Philippe.COVAL(a)IFrance.COM @ http://RzR.online.FR #
# Hire me (as a S/W Eng) @ http://rzr.online.fr/job.htm #
# im:icq,msn,aim,etc @ http://RzR.online.FR/contact.htm #
People who deny the existence of robots may be robots themselves