mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-21 20:39:08 -06:00
Renamed OpenSpaceModule's initialize method to create
Created new initialize method that gets called in OpenSpaceEngine initialize
This commit is contained in:
@@ -33,6 +33,9 @@ class OpenSpaceModule;
|
||||
|
||||
class ModuleEngine {
|
||||
public:
|
||||
bool create();
|
||||
bool destroy();
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ public:
|
||||
OpenSpaceModule(std::string name);
|
||||
virtual ~OpenSpaceModule() = default;
|
||||
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
|
||||
virtual bool initialize();
|
||||
virtual bool deinitialize();
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ BaseModule::BaseModule()
|
||||
: OpenSpaceModule("Base")
|
||||
{}
|
||||
|
||||
bool BaseModule::initialize() {
|
||||
bool success = OpenSpaceModule::initialize();
|
||||
bool BaseModule::create() {
|
||||
bool success = OpenSpaceModule::create();
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
class BaseModule : public OpenSpaceModule {
|
||||
public:
|
||||
BaseModule();
|
||||
bool initialize() override;
|
||||
bool create() override;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -37,8 +37,8 @@ FieldlinesModule::FieldlinesModule()
|
||||
: OpenSpaceModule("Fieldlines")
|
||||
{}
|
||||
|
||||
bool FieldlinesModule::initialize() {
|
||||
bool success = OpenSpaceModule::initialize();
|
||||
bool FieldlinesModule::create() {
|
||||
bool success = OpenSpaceModule::create();
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
class FieldlinesModule : public OpenSpaceModule {
|
||||
public:
|
||||
FieldlinesModule();
|
||||
bool initialize() override;
|
||||
bool create() override;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -30,8 +30,8 @@ KameleonModule::KameleonModule()
|
||||
: OpenSpaceModule("Kameleon")
|
||||
{}
|
||||
|
||||
bool KameleonModule::initialize() {
|
||||
bool success = OpenSpaceModule::initialize();
|
||||
bool KameleonModule::create() {
|
||||
bool success = OpenSpaceModule::create();
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
class KameleonModule : public OpenSpaceModule {
|
||||
public:
|
||||
KameleonModule();
|
||||
bool initialize() override;
|
||||
bool create() override;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -50,8 +50,8 @@ NewHorizonsModule::NewHorizonsModule()
|
||||
: OpenSpaceModule("NewHorizons")
|
||||
{}
|
||||
|
||||
bool NewHorizonsModule::initialize() {
|
||||
bool success = OpenSpaceModule::initialize();
|
||||
bool NewHorizonsModule::create() {
|
||||
bool success = OpenSpaceModule::create();
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
class NewHorizonsModule : public OpenSpaceModule {
|
||||
public:
|
||||
NewHorizonsModule();
|
||||
bool initialize() override;
|
||||
bool create() override;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -30,8 +30,8 @@ OnScreenGUIModule::OnScreenGUIModule()
|
||||
: OpenSpaceModule("OnScreenGUI")
|
||||
{}
|
||||
|
||||
bool OnScreenGUIModule::initialize() {
|
||||
bool success = OpenSpaceModule::initialize();
|
||||
bool OnScreenGUIModule::create() {
|
||||
bool success = OpenSpaceModule::create();
|
||||
if (!success)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
class OnScreenGUIModule : public OpenSpaceModule {
|
||||
public:
|
||||
OnScreenGUIModule();
|
||||
bool initialize() override;
|
||||
bool create() override;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -37,8 +37,8 @@ VolumeModule::VolumeModule()
|
||||
: OpenSpaceModule("Volume")
|
||||
{}
|
||||
|
||||
bool VolumeModule::initialize() {
|
||||
bool success = OpenSpaceModule::initialize();
|
||||
bool VolumeModule::create() {
|
||||
bool success = OpenSpaceModule::create();
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
class VolumeModule : public OpenSpaceModule {
|
||||
public:
|
||||
VolumeModule();
|
||||
bool initialize() override;
|
||||
bool create() override;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -36,11 +36,39 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
bool ModuleEngine::initialize() {
|
||||
LDEBUG("Initializing modules");
|
||||
bool ModuleEngine::create() {
|
||||
LDEBUG("Creating modules");
|
||||
|
||||
registerModules(AllModules);
|
||||
|
||||
for (OpenSpaceModule* m : _modules) {
|
||||
bool success = m->create();
|
||||
if (!success) {
|
||||
LERROR("Could not initialize module '" << m->name() << "'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
LDEBUG("Finished creating modules");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModuleEngine::destroy() {
|
||||
LDEBUG("Destroying modules");
|
||||
for (OpenSpaceModule* m : _modules) {
|
||||
bool success = m->destroy();
|
||||
if (!success) {
|
||||
LERROR("Could not deinitialize module '" << m->name() << "'");
|
||||
return false;
|
||||
}
|
||||
delete m;
|
||||
}
|
||||
LDEBUG("Finished destroying modules");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModuleEngine::initialize() {
|
||||
LDEBUG("Initializing modules");
|
||||
|
||||
for (OpenSpaceModule* m : _modules) {
|
||||
bool success = m->initialize();
|
||||
if (!success) {
|
||||
@@ -54,13 +82,13 @@ bool ModuleEngine::initialize() {
|
||||
|
||||
bool ModuleEngine::deinitialize() {
|
||||
LDEBUG("Deinitializing modules");
|
||||
|
||||
for (OpenSpaceModule* m : _modules) {
|
||||
bool success = m->deinitialize();
|
||||
if (!success) {
|
||||
LERROR("Could not deinitialize module '" << m->name() << "'");
|
||||
return false;
|
||||
}
|
||||
delete m;
|
||||
}
|
||||
LDEBUG("Finished Deinitializing modules");
|
||||
return true;
|
||||
@@ -78,5 +106,4 @@ const std::vector<OpenSpaceModule*> ModuleEngine::modules() const {
|
||||
return _modules;
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -230,7 +230,7 @@ bool OpenSpaceEngine::create(
|
||||
}
|
||||
|
||||
// Register modules
|
||||
_engine->_moduleEngine->initialize();
|
||||
_engine->_moduleEngine->create();
|
||||
|
||||
// Create the cachemanager
|
||||
FileSys.createCacheManager(absPath("${" + ConfigurationManager::KeyCache + "}"), CacheVersion);
|
||||
@@ -264,6 +264,7 @@ bool OpenSpaceEngine::create(
|
||||
|
||||
void OpenSpaceEngine::destroy() {
|
||||
_engine->_moduleEngine->deinitialize();
|
||||
_engine->_moduleEngine->destroy();
|
||||
_engine->_console->deinitialize();
|
||||
|
||||
_engine->_scriptEngine->deinitialize();
|
||||
@@ -351,11 +352,6 @@ bool OpenSpaceEngine::initialize() {
|
||||
|
||||
// initialize the RenderEngine
|
||||
_renderEngine->initialize();
|
||||
// if (_configurationManager->hasKeyAndValue<std::string>(KeyRenderingMethod))
|
||||
// _renderEngine->initialize(_configurationManager->value<std::string>(KeyRenderingMethod));
|
||||
// else
|
||||
// _renderEngine->initialize(DefaultRenderingMethod);
|
||||
|
||||
sceneGraph->initialize();
|
||||
|
||||
std::string sceneDescriptionPath;
|
||||
@@ -365,8 +361,6 @@ bool OpenSpaceEngine::initialize() {
|
||||
sceneGraph->scheduleLoadSceneFile(sceneDescriptionPath);
|
||||
|
||||
_interactionHandler->setKeyboardController(new interaction::KeyboardControllerFixed);
|
||||
//_interactionHandler.setKeyboardController(new interaction::KeyboardControllerLua);
|
||||
//_interactionHandler.setMouseController(new interaction::TrackballMouseController);
|
||||
_interactionHandler->setMouseController(new interaction::OrbitalMouseController);
|
||||
|
||||
// Run start up scripts
|
||||
@@ -378,6 +372,8 @@ bool OpenSpaceEngine::initialize() {
|
||||
LINFO("Initializing GUI");
|
||||
_gui->initialize();
|
||||
|
||||
// Initialize modules
|
||||
_moduleEngine->initialize();
|
||||
|
||||
LINFO("Finished initializing");
|
||||
return true;
|
||||
|
||||
@@ -43,7 +43,7 @@ OpenSpaceModule::OpenSpaceModule(std::string name)
|
||||
ghoul_assert(!_name.empty(), "Empty module name is not allowed");
|
||||
}
|
||||
|
||||
bool OpenSpaceModule::initialize() {
|
||||
bool OpenSpaceModule::create() {
|
||||
std::string moduleNameUpper = name();
|
||||
std::transform(moduleNameUpper.begin(), moduleNameUpper.end(), moduleNameUpper.begin(), toupper);
|
||||
std::string moduleToken =
|
||||
@@ -58,7 +58,7 @@ bool OpenSpaceModule::initialize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenSpaceModule::deinitialize() {
|
||||
bool OpenSpaceModule::destroy() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -80,5 +80,13 @@ std::string OpenSpaceModule::modulePath() const {
|
||||
return "";
|
||||
}
|
||||
|
||||
bool OpenSpaceModule::initialize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenSpaceModule::deinitialize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user