OBJメッシュを走査・解析し、内部 mesh_type へ変換するインポートモジュール。
与えられた行がOBJ頂点行(v)かを判定する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
判定対象の1行文字列。 |
与えられた行がOBJ面行(f)かを判定する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
判定対象の1行文字列。 |
面行に含まれる頂点トークン数を数え、扇形分割時の三角形数算出に使う。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
|
OBJファイルを2パス(件数取得→実データ読込)で読み込み、メッシュを構築する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
読み込むOBJファイルのパス。 |
||
| type(mesh_type), | intent(out) | :: | mesh |
OBJから構築した三角形メッシュ。 |
頂点配列と三角形インデックス配列から面頂点配列(v0,v1,v2)を展開して初期化する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | vertices(:,:) | |||
| integer(kind=i32), | intent(in) | :: | faces(:,:) | |||
| type(mesh_type), | intent(out) | :: | mesh |
展開後に初期化した三角形メッシュ。 |
OBJを行走査して頂点数と三角形分割後の面数を事前計数する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
走査対象のOBJファイルパス。 |
||
| integer(kind=i32), | intent(out) | :: | nvert |
頂点行 |
||
| integer(kind=i32), | intent(out) | :: | ntri |
頂点行 |
OBJの頂点/面行を解析し、負インデックス対応で配列へ格納する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
読み込み対象のOBJファイルパス。 |
||
| real(kind=dp), | intent(out) | :: | vertices(:,:) | |||
| integer(kind=i32), | intent(out) | :: | faces(:,:) |
v x y z 形式の頂点行を3次元座標へ変換する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
OBJ頂点行(例: |
||
| real(kind=dp), | intent(out) | :: | p(3) |
f 行の頂点参照を抽出し、v/vt/vn 形式から頂点インデックスのみを取り出す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
OBJ面行( |
||
| integer(kind=i32), | intent(in) | :: | nvert |
負インデックス解決に使う現在有効な頂点数。 |
||
| integer(kind=i32), | intent(out) | :: | idx(:) | |||
| integer(kind=i32), | intent(out) | :: | ntok |
抽出した頂点参照トークン数。 |
行末の CR 文字 (char 13) をスペースに置換し、CRLF 改行の OBJ に対応する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(inout) | :: | line |
処理対象の行文字列。 |