mesh_mode と OBJ ファイル有無に応じてメッシュ生成方法を選ぶ。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(in) | :: | cfg |
メッシュ入力設定を含むアプリ設定。 |
||
| type(mesh_type), | intent(out) | :: | mesh |
構築した三角形メッシュ。 |
subroutine build_mesh_from_config(cfg, mesh) type(app_config), intent(in) :: cfg type(mesh_type), intent(out) :: mesh logical :: has_obj, loaded_obj, need_transform loaded_obj = .false. select case (trim(lower_ascii(cfg%mesh_mode))) case ('obj') call load_obj_mesh(trim(cfg%obj_path), mesh) loaded_obj = .true. case ('template') call build_template_mesh(cfg, mesh) case default inquire (file=trim(cfg%obj_path), exist=has_obj) if (has_obj) then call load_obj_mesh(trim(cfg%obj_path), mesh) loaded_obj = .true. else call build_template_mesh(cfg, mesh) end if end select if (loaded_obj) then need_transform = (cfg%obj_scale /= 1.0d0) .or. & any(cfg%obj_rotation /= 0.0d0) .or. & any(cfg%obj_offset /= 0.0d0) if (need_transform) then call apply_obj_transform(mesh, cfg%obj_scale, cfg%obj_rotation, cfg%obj_offset) end if end if end subroutine build_mesh_from_config