GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
model_loader.cpp
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
8#include "model_loader.h"
9
10#include <DxLib.h>
11
12
13namespace designlab
14{
15
16int ModelLoader::GetModelHandle(const std::string& file_path)
17{
18 // すでに読み込み済みのモデルの場合は,ハンドル番号を返す.
19 if (model_handle_map_.count(file_path) != 0)
20 {
21 return model_handle_map_[file_path];
22 }
23
24 // モデルを読み込む.
25 int handle = MV1LoadModel(file_path.c_str());
26
27 // 読み込みに失敗した場合は-1を返す.
28 if (handle == -1)
29 {
30 return -1;
31 }
32
33 // 読み込みに成功した場合は,対応表に追加する.
34 model_handle_map_[file_path] = handle;
35
36 return handle;
37}
38
39} // namespace designlab
int GetModelHandle(const std::string &file_path)
Dxlibは3Dモデルを描画する際に,モデルのハンドルを指定する. モデルがまだ読み込まれていない場合は, モデルを読み込んでから,ハンドル番号を返す. すでに読み込みずみのモデルを読み込んだ場...