OSDN Git Service

update site
[meshio/meshio_doc.git] / source / meshio.rst
1 ==================================
2 meshio
3 ==================================
4
5 .. toctree::
6    :maxdepth: 2
7
8 C++で実装したpmd, mqoの読み書きライブラリ。本プロジェクトの本体。
9 2次元画像のlibjpegやlibpngのような使い勝手のライブラリを目指している。
10
11 swigで作ったpythonバインディングでBlender addonを作っていたのだが
12 ビルド済みのCモジュールを提供するのはめんどくさいことがわかった。
13 Blenderはpymeshioに切り離す方向で整理中。
14 あと、luaバインディングを実験中。
15
16
17 sample code(c++)
18 ==================================
19 ::
20
21    #include <meshio.h>
22    #include <iostream>
23    
24    
25    int main(int argc, char **argv)
26    {
27       using namespace meshio;
28    
29       if(argc<2){
30          std::wcout << "usage: " << argv[0] << " {mqo file}" << std::endl;
31          return -1;
32       }
33       mqo::IO io;
34       if(!io.read(argv[1])){
35          std::wcout << "fail to read " << argv[1] << std::endl;
36          return -1;
37       }
38    
39       for(std::vector<mqo::Material>::iterator it=io.materials.begin();
40             it!=io.materials.end();
41             ++it)
42       {
43          std::wcout << it->getName() << std::endl;
44       }
45    
46       return 0;
47    }
48