Example #1
0
void
write_mesh(const BMESH &mesh, ostream &os)
{
   init_strips(mesh); // Initialize triangle strips

   os << header;
   write_verts(mesh, os);
   write_normals(mesh, os);
   os << "        texCoord [  ]" << endl;
   os << "        orderedRGBA [  ]" << endl;
   os << "        }" << endl;
   os << endl;
   write_strips(mesh, os);
   os << "   }" << endl;
   os << "}" << endl;
}
Example #2
0
int 
main(int argc, char *argv[])
{
   // -s option writes "simple" format, meaning faces are written as:
   //
   //   f 1 3 2
   //
   // instead of:
   //
   //   f 1//1 3//3 2//2

   bool do_simple = false;
   if (argc == 2 && string(argv[1]) == "-s") {
      do_simple = true;
   } else if (argc != 1) {
      err_msg("Usage: %s [ -s ] < input.sm > output.sm", argv[0]);
      return 1;
   }

   BMESHptr mesh = BMESH::read_jot_stream(cin);
   if (!mesh || mesh->empty())
      return 1; // didn't work

   if (Config::get_var_bool("JOT_RECENTER"))
      mesh->recenter();

   if (Config::get_var_bool("JOT_PRINT_MESH"))
      mesh->print();

   // write verts
   write_verts(*mesh, cout);

   // write faces
   write_faces(*mesh, cout, do_simple);

   return 0;
}