Pyrogenesis  trunk
ColladaManager.h
Go to the documentation of this file.
1 /* Copyright (C) 2021 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_COLLADAMANAGER
19 #define INCLUDED_COLLADAMANAGER
20 
21 #include "lib/file/vfs/vfs.h"
22 
24 
26 {
28 
29 public:
30  enum FileType { PMD, PSA };
31 
32  CColladaManager(const PIVFS& vfs);
34 
35  /**
36  * Returns the VFS path to a PMD/PSA file for the given source file.
37  * Performs a (cached) conversion from COLLADA if necessary.
38  *
39  * @param pathnameNoExtension path and name, minus extension, of file to load.
40  * One of either "sourceName.pmd" or "sourceName.dae" should exist.
41  * @param type FileType, .pmd or .psa
42  *
43  * @return full VFS path (including extension) of file to load; or empty
44  * string if there was a problem and it could not be loaded. Doesn't knowingly
45  * return an invalid path.
46  */
47  VfsPath GetLoadablePath(const VfsPath& pathnameNoExtension, FileType type);
48 
49  /**
50  * Converts DAE to archive cached .pmd/psa and outputs the resulting path
51  * (used by archive builder)
52  *
53  * @param[in] sourcePath path of the .dae to load
54  * @param[in] type FileType, .pmd or .psa
55  * @param[out] archiveCachePath output path of the cached file
56  *
57  * @return true if COLLADA converter completed successfully; or false if it failed
58  */
59  bool GenerateCachedFile(const VfsPath& sourcePath, FileType type, VfsPath& archiveCachePath);
60 
61 private:
64 };
65 
66 #endif // INCLUDED_COLLADAMANAGER
Definition: ColladaManager.h:30
VfsPath GetLoadablePath(const VfsPath &pathnameNoExtension, FileType type)
Returns the VFS path to a PMD/PSA file for the given source file.
Definition: ColladaManager.cpp:326
NONCOPYABLE(CColladaManager)
PIVFS m_VFS
Definition: ColladaManager.h:63
std::shared_ptr< IVFS > PIVFS
Definition: vfs.h:220
Definition: path.h:79
bool GenerateCachedFile(const VfsPath &sourcePath, FileType type, VfsPath &archiveCachePath)
Converts DAE to archive cached .pmd/psa and outputs the resulting path (used by archive builder) ...
Definition: ColladaManager.cpp:417
Definition: ColladaManager.cpp:58
FileType
Definition: ColladaManager.h:30
CColladaManager(const PIVFS &vfs)
Definition: ColladaManager.cpp:316
CColladaManagerImpl * m
Definition: ColladaManager.h:62
~CColladaManager()
Definition: ColladaManager.cpp:321
Definition: ColladaManager.h:30
Definition: ColladaManager.h:25
Definition: vfs_util.cpp:39