OBJファイルを2パス(件数取得→実データ読込)で読み込み、メッシュを構築する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
読み込むOBJファイルのパス。 |
||
| type(mesh_type), | intent(out) | :: | mesh |
OBJから構築した三角形メッシュ。 |
subroutine load_obj_mesh(path, mesh) character(len=*), intent(in) :: path type(mesh_type), intent(out) :: mesh integer(i32) :: nvert, ntri real(dp), allocatable :: vertices(:, :) integer(i32), allocatable :: faces(:, :) call scan_obj(path, nvert, ntri) if (nvert == 0 .or. ntri == 0) error stop "OBJ has no vertices/faces" allocate (vertices(3, nvert), faces(3, ntri)) call parse_obj(path, vertices, faces) call build_mesh_from_indexed(vertices, faces, mesh) end subroutine load_obj_mesh