mqo.h
説明を見る。
1 //
2 // Copyright (c) 2003-2011, MIST Project, Nagoya University
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the name of the Nagoya University nor the names of its contributors
16 // may be used to endorse or promote products derived from this software
17 // without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
20 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28 
33 #ifndef __INCLUDE_MIST_MQO__
34 #define __INCLUDE_MIST_MQO__
35 
36 
37 #ifndef __INCLUDE_MIST_H__
38 #include "../mist.h"
39 #endif
40 
41 // ポリゴンオブジェクトの型を読み込む
42 #ifndef __INCLUDE_MIST_FACET__
43 #include "../facet.h"
44 #endif
45 
46 
47 #include <iostream>
48 #include <string>
49 #include <vector>
50 
51 
52 
53 // mist名前空間の始まり
55 
56 
57 namespace __mqo_controller__
58 {
59  template < class T >
60  struct mqo_controller
61  {
62  typedef facet_list< T > facet_list_type;
63  typedef typename facet_list_type::facet_type facet_type;
64  typedef typename facet_type::vector_type vector_type;
65  typedef typename facet_type::size_type size_type;
66  typedef vector3< size_type > ivector_type;
67 
68  static const unsigned char *get_line( const unsigned char *s, const unsigned char *e, std::string &line )
69  {
70  line = "";
71  while( s < e )
72  {
73  if( s[ 0 ] == '\r' )
74  {
75  if( s + 1 != e && s[ 1 ] == '\n' )
76  {
77  s = s + 2;
78  }
79  else
80  {
81  s++;
82  }
83  break;
84  }
85  else if( s[ 0 ] == '\n' )
86  {
87  s = s + 1;
88  break;
89  }
90  line += *s;
91  s++;
92  }
93  return( s > e ? e : s );
94  }
95 
96  static const unsigned char *get_value( const unsigned char *s, const unsigned char *e, std::string &line, bool &flag )
97  {
98  line = "";
99  // 先頭の空白(改行やタブを含む)を飛ばす
100  while( s < e )
101  {
102  if( flag && s[ 0 ] == '#' )
103  {
104  // コメント行なのですっ飛ばす
105  while( s < e )
106  {
107  if( s[ 0 ] == '\r' )
108  {
109  if( s + 1 != e && s[ 1 ] == '\n' )
110  {
111  s = s + 2;
112  }
113  else
114  {
115  s++;
116  }
117  break;
118  }
119  else if( s[ 0 ] == '\n' )
120  {
121  s++;
122  break;
123  }
124  s++;
125  }
126  }
127  else if( s[ 0 ] == '\r' )
128  {
129  if( s + 1 != e && s[ 1 ] == '\n' )
130  {
131  s = s + 2;
132  }
133  else
134  {
135  s = s + 1;
136  }
137  flag = true;
138  }
139  else if( s[ 0 ] == '\n' )
140  {
141  s++;
142  flag = true;
143  }
144  else if( s[ 0 ] == ' ' || s[ 0 ] == '\t' )
145  {
146  s++;
147  }
148  else
149  {
150  break;
151  }
152  }
153 
154  // 次に空白が来る前まで進める
155  flag = false;
156  while( s < e )
157  {
158  if( s[ 0 ] == '\r' )
159  {
160  if( s + 1 != e && s[ 1 ] == '\n' )
161  {
162  s = s + 2;
163  }
164  else
165  {
166  s++;
167  }
168  flag = true;
169  break;
170  }
171  else if( s[ 0 ] == '\n' )
172  {
173  s++;
174  flag = true;
175  break;
176  }
177  else if( s[ 0 ] == ' ' || s[ 0 ] == '\t' )
178  {
179  s++;
180  break;
181  }
182  line += *s;
183  s++;
184  }
185  return( s > e ? e : s );
186  }
187 
188  static size_type split_string( const std::string &line, const char ch, std::vector< std::string > &elements )
189  {
190  std::string str = "";
191  size_type i = 0;
192  elements.clear( );
193  while( i < line.size( ) )
194  {
195  for( ; i < line.size( ) && line[ i ] == ch ; i++ );
196 
197  str = "";
198  for( ; i < line.size( ) && line[ i ] != ch ; i++ )
199  {
200  str += line[ i ];
201  }
202 
203  if( str != "" )
204  {
205  elements.push_back( str );
206  }
207  }
208  return( elements.size( ) );
209  }
210 
211  static std::string to_lower( std::string line )
212  {
213  for( size_t i = 0 ; i < line.size( ) ; i++ )
214  {
215  if( 'A' <= line[ i ] && line[ i ] <= 'Z' )
216  {
217  line[ i ] += 'a' - 'A';
218  }
219  }
220  return( line );
221  }
222 
223  static const unsigned char *skip_chunk( const unsigned char *p, const unsigned char *e, const std::string &ch )
224  {
225  std::string line = "";
226 
227  bool eol = true;
228  while( p < e )
229  {
230  p = get_line( p, e, line );
231 
232  if( line.find_last_of( ch ) != std::string::npos )
233  {
234  return( p );
235  }
236  }
237 
238  return( NULL );
239  }
240 
241  static const unsigned char *skip_chunk( const unsigned char *p, const unsigned char *e, const char ch )
242  {
243  std::string line = "";
244 
245  bool eol = true;
246  while( p < e )
247  {
248  p = get_line( p, e, line );
249 
250  for( size_type i = 0 ; i < line.size( ) ; )
251  {
252  // SJISの2倍と文字はスキップする
253  unsigned char v1 = line[ i ];
254  unsigned char v2 = i + 1 < line.size( ) ? line[ i + 1 ] : 0x00;
255 
256  if( ( ( 0x81 <= v1 && v1 <= 0x9f ) || ( 0xe0 <= v1 && v1 <= 0xef ) ) && ( 0x40 <= v2 && v2 <= 0xfc && v2 != 0x7f ) )
257  {
258  i += 2;
259  }
260  else if( v1 == ch )
261  {
262  return( p );
263  }
264  else
265  {
266  i++;
267  }
268  }
269  }
270 
271  return( NULL );
272  }
273 
274  static const unsigned char *process_vertex_chunk( std::vector< vector_type > &vertices, const unsigned char *p, const unsigned char *e )
275  {
276  std::string line = "";
277  std::vector< std::string > elements;
278 
279  bool eol = true;
280 
281  // 頂点数を読み込む
282  p = get_value( p, e, line, eol );
283 
284  if( eol )
285  {
286  std::cerr << "EOL was found before vertex count appeared!!" << std::endl;
287  return( NULL );
288  }
289 
290  size_type num_vertices = atoi( line.c_str( ) );
291 
292  // 末尾を読み込む
293  p = skip_chunk( p, e, "{" );
294 
295  if( p == NULL )
296  {
297  std::cerr << "'{' was not found before EOL appeared!!" << std::endl;
298  return( NULL );
299  }
300 
301  vertices.clear( );
302  vertices.reserve( num_vertices );
303 
304  // vertex チャンクを処理する
305  while( p < e )
306  {
307  // オブジェクト名を読み込む
308  p = get_line( p, e, line );
309 
310  if( line.find_last_of( '}' ) != std::string::npos )
311  {
312  // vertex チャンクの終了
313  break;
314  }
315 
316  if( split_string( line, ' ', elements ) != 3 )
317  {
318  std::cerr << "Vertex must have three components." << std::endl;
319  return( NULL );
320  }
321 
322  vertices.push_back( vector_type( atof( elements[ 0 ].c_str( ) ), atof( elements[ 1 ].c_str( ) ), atof( elements[ 2 ].c_str( ) ) ) );
323  }
324 
325  return( vertices.size( ) == num_vertices ? p : NULL );
326  }
327 
328  static const unsigned char *process_face_chunk( std::vector< ivector_type > &faces, const unsigned char *p, const unsigned char *e )
329  {
330  std::string line = "";
331  std::vector< std::string > elements;
332 
333  bool eol = true;
334 
335  // 頂点数を読み込む
336  p = get_value( p, e, line, eol );
337 
338  if( eol )
339  {
340  std::cerr << "EOL was found before face count appeared!!" << std::endl;
341  return( NULL );
342  }
343 
344  size_type num_faces = atoi( line.c_str( ) );
345 
346  // 末尾を読み込む
347  p = skip_chunk( p, e, "{" );
348 
349  if( p == NULL )
350  {
351  std::cerr << "'{' was not found before EOL appeared!!" << std::endl;
352  return( NULL );
353  }
354 
355  faces.clear( );
356  faces.reserve( num_faces );
357 
358  // vertex チャンクを処理する
359  while( p < e )
360  {
361  // オブジェクト名を読み込む
362  p = get_line( p, e, line );
363 
364  if( line.find_last_of( '}' ) != std::string::npos )
365  {
366  // vertex チャンクの終了
367  break;
368  }
369 
370  int num = 0;
371  sscanf( line.c_str( ), "%d", &num );
372 
373  size_type si = line.find( "V(" );
374  if( si == std::string::npos )
375  {
376  std::cerr << "Incorrect face chunk is found." << std::endl;
377  return( NULL );
378  }
379  else
380  {
381  si += 2;
382  }
383 
384  size_type ei = line.find( ')', si + 1 );
385  if( ei == std::string::npos )
386  {
387  std::cerr << "Incorrect face chunk is found." << std::endl;
388  return( NULL );
389  }
390  else
391  {
392  ei -= 1;
393  }
394 
395  line = line.substr( si, ei - si + 1 );
396 
397  if( split_string( line, ' ', elements ) != num )
398  {
399  std::cerr << "Incorrect face chunk is found." << std::endl;
400  return( NULL );
401  }
402  else if( num < 3 )
403  {
404  // 未サポート
405  std::cerr << "Face should have more than three vertices." << std::endl;
406  continue;
407  }
408  else if( num > 4 )
409  {
410  // 未サポート
411  std::cerr << "Face should have less than five vertices." << std::endl;
412  continue;
413  }
414 
415  if( num == 3 )
416  {
417  // 頂点が時計回りで並んでいるので,反時計回りに変換する
418  faces.push_back( ivector_type( atoi( elements[ 0 ].c_str( ) ), atoi( elements[ 2 ].c_str( ) ), atoi( elements[ 1 ].c_str( ) ) ) );
419  }
420  else
421  {
422  // 頂点が時計回りで並んでいるので,反時計回りに変換する
423  faces.push_back( ivector_type( atoi( elements[ 0 ].c_str( ) ), atoi( elements[ 3 ].c_str( ) ), atoi( elements[ 2 ].c_str( ) ) ) );
424  faces.push_back( ivector_type( atoi( elements[ 0 ].c_str( ) ), atoi( elements[ 2 ].c_str( ) ), atoi( elements[ 1 ].c_str( ) ) ) );
425  num_faces++;
426  }
427  }
428 
429  return( faces.size( ) == num_faces ? p : NULL );
430  }
431 
432  static const unsigned char *process_object_chunk( facet_list_type &facets, const unsigned char *p, const unsigned char *e )
433  {
434  std::string line = "";
435 
436  bool eol = true;
437 
438  // オブジェクト名を読み込む
439  p = get_value( p, e, line, eol );
440 
441  if( eol )
442  {
443  std::cerr << "EOL was found before object name appeared!!" << std::endl;
444  return( NULL );
445  }
446 
447  if( line.size( ) > 0 && line[ 0 ] == '\"' && line[ line.size( ) - 1 ] == '\"' )
448  {
449  facets.name = line.substr( 1, line.size( ) - 2 );
450  }
451  else
452  {
453  facets.name = line;
454  }
455 
456  // 末尾を読み込む
457  p = skip_chunk( p, e, "{" );
458 
459  if( p == NULL )
460  {
461  std::cerr << "'{' was not found before EOL appeared!!" << std::endl;
462  return( NULL );
463  }
464 
465  std::vector< vector_type > vertices;
466  std::vector< ivector_type > faces;
467 
468  // object チャンクを処理する
469  while( p != NULL && p < e )
470  {
471  // オブジェクト名を読み込む
472  p = get_value( p, e, line, eol );
473  line = to_lower( line );
474 
475  if( line == "}" )
476  {
477  // object チャンクの終了
478  break;
479  }
480  else if( line == "depth" )
481  {
482  }
483  else if( line == "folding" )
484  {
485  }
486  else if( line == "scale" )
487  {
488  }
489  else if( line == "rotation" )
490  {
491  }
492  else if( line == "translation" )
493  {
494  }
495  else if( line == "patch" )
496  {
497  }
498  else if( line == "segment" )
499  {
500  }
501  else if( line == "visible" )
502  {
503  }
504  else if( line == "locking" )
505  {
506  }
507  else if( line == "shading" )
508  {
509  }
510  else if( line == "facet" )
511  {
512  }
513  else if( line == "color" )
514  {
515  }
516  else if( line == "color_type" )
517  {
518  }
519  else if( line == "mirror" )
520  {
521  }
522  else if( line == "mirror_axis" )
523  {
524  }
525  else if( line == "mirror_dis" )
526  {
527  }
528  else if( line == "lathe" )
529  {
530  }
531  else if( line == "lathe_axis" )
532  {
533  }
534  else if( line == "lathe_seg" )
535  {
536  }
537  else if( line == "vertexattr" )
538  {
539  // 未サポート
540  std::cerr << "vertexattr chunk is currently not supported." << std::endl;
541  return( NULL );
542  }
543  else if( line == "bvertex" )
544  {
545  // 未サポート
546  std::cerr << "BVertex chunk is currently not supported." << std::endl;
547  return( NULL );
548  }
549  else if( line == "vertex" )
550  {
551  p = process_vertex_chunk( vertices, p, e );
552  eol = true;
553  }
554  else if( line == "face" )
555  {
556  p = process_face_chunk( faces, p, e );
557  eol = true;
558  }
559  else
560  {
561  // 未サポート
562  std::cerr << "Unknown chunk is found!!" << std::endl;
563  return( NULL );
564  }
565 
566  if( !eol )
567  {
568  p = get_line( p, e, line );
569  }
570  }
571 
572  if( p == NULL )
573  {
574  return( NULL );
575  }
576 
577  facets.clear( );
578  facets.reserve( faces.size( ) );
579 
580  for( size_type i = 0 ; i < faces.size( ) ; i++ )
581  {
582  const ivector_type &v = faces[ i ];
583 
584  facet_type f;
585  if( 0 <= v.x && v.x < vertices.size( ) )
586  {
587  f.p1 = vertices[ v.x ];
588  }
589  else
590  {
591  std::cerr << "Incorrect face found: (" << v << ")" << std::endl;
592  }
593 
594  if( 0 <= v.y && v.y < vertices.size( ) )
595  {
596  f.p2 = vertices[ v.y ];
597  }
598  else
599  {
600  std::cerr << "Incorrect face found: (" << v << ")" << std::endl;
601  }
602 
603  if( 0 <= v.z && v.z < vertices.size( ) )
604  {
605  f.p3 = vertices[ v.z ];
606  }
607  else
608  {
609  std::cerr << "Incorrect face found: (" << v << ")" << std::endl;
610  }
611 
612  f.normal = ( ( f.p2 - f.p1 ).outer( f.p3 - f.p1 ) ).unit( );
613 
614  facets.push_back( f );
615  }
616 
617  return( p );
618  }
619 
620  static const unsigned char * __process_object_chunk__( std::vector< facet_list_type > &facet_lists, const unsigned char *p, const unsigned char *e )
621  {
622  facet_lists.push_back( facet_list_type( ) );
623  facet_list_type &facets = facet_lists.back( );
624  p = process_object_chunk( facets, p, e );
625  if( p == NULL )
626  {
627  facet_lists.pop_back( );
628  }
629 
630  return( p );
631  }
632 
633  static const unsigned char * __process_object_chunk__( facet_list_type &facets, const unsigned char *p, const unsigned char *e )
634  {
635  facet_list_type fff;
636  p = process_object_chunk( fff, p, e );
637  if( p != NULL )
638  {
639  facets.insert( facets.end( ), fff.begin( ), fff.end( ) );
640  }
641 
642  return( p );
643  }
644 
645  template < class FACETLIST >
646  static bool convert_from_data( FACETLIST &facet_lists, const unsigned char *buff, size_type len )
647  {
648  const unsigned char *p = buff;
649  const unsigned char *e = buff + len;
650  std::string line = "";
651  std::vector< std::string > elements;
652 
653  {
654  // ヘッダ部分を解析
655  // Metasequoia Document
656  // Format %s Ver %.1f
657  p = get_line( p, e, line );
658  if( line != "Metasequoia Document" )
659  {
660  std::cerr << "This is not a Metasequoia Document." << std::endl;
661  return( false );
662  }
663 
664  char buff[ 4096 ];
665  float ver = 0.0;
666  p = get_line( p, e, line );
667  if( sscanf( line.c_str( ), "Format %s Ver %.1f", buff, ver ) <= 0 )
668  {
669  std::cerr << "This is not a Metasequoia Document." << std::endl;
670  return( false );
671  }
672  }
673 
674  bool eol = true;
675  while( p != NULL && p < e )
676  {
677  p = get_value( p, e, line, eol );
678 
679  line = to_lower( line );
680 
681  if( line == "" )
682  {
683  continue;
684  }
685  else if( line == "eof" )
686  {
687  continue;
688  }
689  else if( line == "trialnoise" )
690  {
691  p = skip_chunk( p, e, '}' );
692  }
693  else if( line == "includexml" )
694  {
695  p = skip_chunk( p, e, '}' );
696  }
697  else if( line == "scene" )
698  {
699  p = skip_chunk( p, e, '}' );
700  }
701  else if( line == "backimage" )
702  {
703  p = skip_chunk( p, e, '}' );
704  }
705  else if( line == "material" )
706  {
707  p = skip_chunk( p, e, '}' );
708  }
709  else if( line == "blob" )
710  {
711  p = skip_chunk( p, e, '}' );
712  }
713  else if( line == "object" )
714  {
715  p = __process_object_chunk__( facet_lists, p, e );
716  }
717  else
718  {
719  std::cerr << "Unknown chunk found!!" << std::endl;
720  return( false );
721  }
722  }
723 
724  return( true );
725  }
726 
727  template < class FACETLIST >
728  static bool read( FACETLIST &facet_lists, const std::string &filename )
729  {
730  // データをクリアする
731  facet_lists.clear( );
732 
733  size_type filesize;
734  FILE *fp;
735  if( ( fp = fopen( filename.c_str( ), "rb" ) ) == NULL ) return( false );
736  // ファイルサイズを取得
737  fseek( fp, 0, SEEK_END );
738  filesize = ftell( fp );
739  fseek( fp, 0, SEEK_SET );
740 
741  // すべてのデータをファイルから読み込む
742  unsigned char *buff = new unsigned char[ filesize + 1 ];
743  unsigned char *pointer = buff;
744  size_type read_size = 0;
745  while( feof( fp ) == 0 )
746  {
747  read_size = fread( pointer, sizeof( unsigned char ), 1024, fp );
748  if( read_size < 1024 )
749  {
750  break;
751  }
752  pointer += read_size;
753  }
754  fclose( fp );
755 
756  bool ret = convert_from_data( facet_lists, buff, filesize );
757 
758  delete [] buff;
759 
760  return( ret );
761  }
762 
763  static bool write( const std::vector< facet_list_type > &facet_lists, const std::string &filename )
764  {
765  if( facet_lists.empty( ) )
766  {
767  std::cerr << "There is no object!" << std::endl;
768  return( false );
769  }
770 
771  FILE *fp;
772  if( ( fp = fopen( filename.c_str( ), "wb" ) ) == NULL )
773  {
774  return( false );
775  }
776 
777  fprintf( fp, "Metasequoia Document\r\n" );
778  fprintf( fp, "Format Text Ver 1.0\r\n\r\n" );
779 
780  {
781  fprintf( fp, "Scene {\r\n" );
782  fprintf( fp, "\tpos 0.0000 0.0000 1000.0\r\n" );
783  fprintf( fp, "\tlookat 0.0000 0.0000 0.0000\r\n" );
784  fprintf( fp, "\thead 0.0000\r\n" );
785  fprintf( fp, "\tpich 0.0000\r\n" );
786  fprintf( fp, "\tortho 0\r\n" );
787  fprintf( fp, "\tzoom2 5.0\r\n" );
788  fprintf( fp, "\tamb 0.250 0.250 0.250\r\n" );
789  fprintf( fp, "}\r\n" );
790  }
791  {
792  fprintf( fp, "Material 1 {\r\n" );
793  fprintf( fp, "\t\"default\" shader(3) col(1.000 1.000 1.000 1.000) dif(0.800) amb(0.600) emi(0.000) spc(0.000) power(5.00)\r\n" );
794  fprintf( fp, "}\r\n" );
795  }
796 
797  for( size_type l = 0 ; l < facet_lists.size( ) ; l++ )
798  {
799  const facet_list_type &facets = facet_lists[ l ];
800 
801  std::vector< vector_type > vertices;
802  std::vector< ivector_type > faces;
803  if( convert_to_vertex_face_list( facets, vertices, faces ) )
804  {
805  fprintf( fp, "Object \"%s\" {\r\n", facets.name.c_str( ) );
806  fprintf( fp, "\tvisible 15\r\n" );
807  fprintf( fp, "\tlocking 0\r\n" );
808  fprintf( fp, "\tshading 1\r\n" );
809  fprintf( fp, "\tcolor 1.000 1.000 1.000\r\n" );
810  fprintf( fp, "\tcolor_type 0\r\n" );
811 
812  {
813  fprintf( fp, "\tvertex %d {\r\n", static_cast< int >( vertices.size( ) ) );
814  for( size_type i = 0 ; i < vertices.size( ) ; i++ )
815  {
816  const vector_type &f = vertices[ i ];
817  double fx = ( f.x * 1e4 + 0.5 ) * 1e-4;
818  double fy = ( f.y * 1e4 + 0.5 ) * 1e-4;
819  double fz = ( f.z * 1e4 + 0.5 ) * 1e-4;
820  fprintf( fp, "\t\t%.4f %.4f %.4f\r\n", f.x, f.y, f.z );
821  }
822  fprintf( fp, "\t}\r\n" );
823  }
824 
825  {
826  fprintf( fp, "\tface %d {\r\n", static_cast< int >( faces.size( ) ) );
827  for( size_type i = 0 ; i < faces.size( ) ; i++ )
828  {
829  const ivector_type &f = faces[ i ];
830 
831  // 頂点は反時計回りに並んでいるため,時計回りで出力する
832  fprintf( fp, "\t\t%d V(%d %d %d) M(0)\r\n", 3, f.x, f.z, f.y );
833  }
834  fprintf( fp, "\t}\r\n" );
835  }
836 
837  fprintf( fp, "}\r\n" );
838  }
839  }
840 
841  fprintf( fp, "Eof" );
842 
843  fclose( fp );
844 
845  return( true );
846  }
847  };
848 }
849 
850 
853 
865 
866 
875 template < class T >
876 bool read_mqo( std::vector< facet_list< T > > &facet_lists, const std::string &filename )
877 {
878  return( __mqo_controller__::mqo_controller< T >::read( facet_lists, filename ) );
879 }
880 
881 
890 template < class T >
891 bool read_mqo( std::vector< facet_list< T > > &facet_lists, const std::wstring &filename )
892 {
893  return( read_mqo( facet_lists, wstr2str( filename ) ) );
894 }
895 
896 
905 template < class T >
906 bool read_mqo( facet_list< T > &facets, const std::string &filename )
907 {
908  return( __mqo_controller__::mqo_controller< T >::read( facets, filename ) );
909 }
910 
911 
920 template < class T >
921 bool read_mqo( facet_list< T > &facets, const std::wstring &filename )
922 {
923  return( read_mqo( facets, wstr2str( filename ) ) );
924 }
925 
926 
935 template < class T >
936 inline bool write_mqo( const std::vector< facet_list< T > > &facet_lists, const std::string &filename )
937 {
938  return( __mqo_controller__::mqo_controller< T >::write( facet_lists, filename ) );
939 }
940 
949 template < class T >
950 inline bool write_mqo( const std::vector< facet_list< T > > &facet_lists, const std::wstring &filename )
951 {
952  return( write_mqo( facet_lists, wstr2str( filename ) ) );
953 }
954 
963 template < class T >
964 inline bool write_mqo( const facet_list< T > &facets, const std::string &filename )
965 {
966  std::vector< facet_list< T > > tmp;
967  tmp.push_back( facets );
968  return( __mqo_controller__::mqo_controller< T >::write( tmp, filename ) );
969 }
970 
971 
980 template < class T >
981 inline bool write_mqo( const facet_list< T > &facets, const std::wstring &filename )
982 {
983  return( write_mqo( tmp, wstr2str( filename ) ) );
984 }
985 
986 
987 
989 // Metasequoiaのポリゴンデータの入出力グループの終わり
990 
992 // CADデータ入出力グループの終わり
993 
994 
995 // mist名前空間の終わり
996 _MIST_END
997 
998 
999 #endif // __INCLUDE_MIST_MQO__
1000 

Generated on Wed Nov 12 2014 19:44:20 for MIST by doxygen 1.8.1.2