PeriDyno 1.0.0
Loading...
Searching...
No Matches
SceneLoaderFactory.h
Go to the documentation of this file.
1#pragma once
2#include "SceneGraph.h"
3
4namespace dyno {
5
7 {
8 public:
9 virtual std::shared_ptr<SceneGraph> load(const std::string filename) { return nullptr; }
10
11 virtual bool save(std::shared_ptr<SceneGraph> scn, const std::string filename) { return false; }
12
13 virtual bool canLoadFileByName(const std::string filename) {
14 std::string str = filename;
15 std::string::size_type pos = str.find_last_of('.');
16 if (pos == std::string::npos)
17 return false; // no extension
18
19 return canLoadFileByExtension(str.substr(pos + 1));
20 }
21
22 virtual bool canLoadFileByExtension(const std::string extension) { return false; }
23 };
24
26 {
27 public:
28 typedef std::vector<SceneLoader*> SceneLoaderList;
29
32
33 public:
35 SceneLoader* getEntryByFileExtension(std::string extension);
36
38 SceneLoader* getEntryByFileName(std::string filename);
39
42
45
46 private:
48
51 };
52
53
54}
static SceneLoaderFactory & getInstance()
Get the ObjectFactory singleton instance.
std::vector< SceneLoader * > SceneLoaderList
SceneLoader * getEntryByFileExtension(std::string extension)
Get an entry given a file extension.
SceneLoader * addEntry(SceneLoader *loader)
Add a scene loader.
SceneLoader * getEntryByFileName(std::string filename)
Get an entry given a file name.
SceneLoaderList * getEntryList()
Get the list of loaders.
SceneLoaderList m_loaders
Main class registry.
virtual bool save(std::shared_ptr< SceneGraph > scn, const std::string filename)
virtual bool canLoadFileByExtension(const std::string extension)
virtual std::shared_ptr< SceneGraph > load(const std::string filename)
virtual bool canLoadFileByName(const std::string filename)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25