Modularize the newhorizons and volume classes

This commit is contained in:
Alexander Bock
2015-05-20 21:08:21 +02:00
parent 523abd6529
commit 59e474d5cd
26 changed files with 250 additions and 25 deletions
+2
View File
@@ -146,6 +146,8 @@ endif ()
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(modules/base) add_subdirectory(modules/base)
add_subdirectory(modules/newhorizons)
add_subdirectory(modules/volume)
option(BUILD_GUI_APPLICATIONS "Build GUI Applications" OFF) option(BUILD_GUI_APPLICATIONS "Build GUI Applications" OFF)
if (BUILD_GUI_APPLICATIONS) if (BUILD_GUI_APPLICATIONS)
-8
View File
@@ -45,10 +45,6 @@
#include <modules/base/rendering/modelgeometry.h> #include <modules/base/rendering/modelgeometry.h>
#include <modules/base/rendering/wavefrontgeometry.h> #include <modules/base/rendering/wavefrontgeometry.h>
namespace {
const std::string _loggerCat = "BaseModule";
}
namespace openspace { namespace openspace {
bool BaseModule::initialize() { bool BaseModule::initialize() {
@@ -81,8 +77,4 @@ bool BaseModule::initialize() {
return true; return true;
} }
bool BaseModule::deinitialize() {
return false;
}
} // namespace openspace } // namespace openspace
-1
View File
@@ -32,7 +32,6 @@ namespace openspace {
class BaseModule : public OpenSpaceModule { class BaseModule : public OpenSpaceModule {
public: public:
bool initialize() override; bool initialize() override;
bool deinitialize() override;
}; };
} // namespace openspace } // namespace openspace
+27
View File
@@ -0,0 +1,27 @@
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetgeometryprojection.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefov.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneprojection.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanetprojection.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometryprojection.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/writeToTexture.h
)
source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetgeometryprojection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefov.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneprojection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanetprojection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometryprojection.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
set(MODULE_CLASS_FILES
${CMAKE_CURRENT_SOURCE_DIR}/newhorizonsmodule.h
${CMAKE_CURRENT_SOURCE_DIR}/newhorizonsmodule.cpp
)
include_directories(${OPENSPACE_BASE_DIR}/include ${OPENSPACE_BASE_DIR})
add_library(openspace-module-newhorizons ${HEADER_FILES} ${SOURCE_FILES} ${MODULE_CLASS_FILES})
+56
View File
@@ -0,0 +1,56 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/newhorizons/newhorizonsmodule.h>
#include <openspace/rendering/renderable.h>
#include <openspace/util/factorymanager.h>
#include <ghoul/misc/assert.h>
#include <modules/newhorizons/rendering/planetgeometryprojection.h>
#include <modules/newhorizons/rendering/renderablefov.h>
#include <modules/newhorizons/rendering/renderableplaneprojection.h>
#include <modules/newhorizons/rendering/renderableplanetprojection.h>
#include <modules/newhorizons/rendering/simplespheregeometryprojection.h>
namespace openspace {
bool NewHorizonsModule::initialize() {
FactoryManager::ref().addFactory(new ghoul::TemplateFactory<planetgeometryprojection::PlanetGeometryProjection>);
auto fRenderable = FactoryManager::ref().factory<Renderable>();
ghoul_assert(fRenderable, "No renderable factory existed");
fRenderable->registerClass<RenderableFov>("RenderableFov");
fRenderable->registerClass<RenderablePlaneProjection>("RenderablePlaneProjection");
fRenderable->registerClass<RenderablePlanetProjection>("RenderablePlanetProjection");
auto fPlanetGeometryProjection = FactoryManager::ref().factory<planetgeometryprojection::PlanetGeometryProjection>();
fPlanetGeometryProjection->registerClass<planetgeometryprojection::SimpleSphereGeometryProjection>("SimpleSphereProjection");
return true;
}
} // namespace openspace
+39
View File
@@ -0,0 +1,39 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __NEWHORIZONSMODULE_H__
#define __NEWHORIZONSMODULE_H__
#include <openspace/util/openspacemodule.h>
namespace openspace {
class NewHorizonsModule : public OpenSpaceModule {
public:
bool initialize() override;
};
} // namespace openspace
#endif // __NEWHORIZONSMODULE_H__
@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/ ****************************************************************************************/
#include <openspace/rendering/planets/planetgeometryprojection.h> #include <modules/newhorizons/rendering/planetgeometryprojection.h>
#include <openspace/util/factorymanager.h> #include <openspace/util/factorymanager.h>
#include <openspace/util/factorymanager.h> #include <openspace/util/factorymanager.h>
@@ -26,7 +26,7 @@
#define __PlanetGeometryProjection_H__ #define __PlanetGeometryProjection_H__
#include <openspace/properties/propertyowner.h> #include <openspace/properties/propertyowner.h>
#include <openspace/rendering/planets/renderableplanetprojection.h> #include <modules/newhorizons/rendering/renderableplanetprojection.h>
#include <ghoul/misc/dictionary.h> #include <ghoul/misc/dictionary.h>
namespace openspace { namespace openspace {
@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/ ****************************************************************************************/
#include <openspace/rendering/renderablefov.h> #include <modules/newhorizons/rendering/renderablefov.h>
#include <openspace/engine/configurationmanager.h> #include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h> #include <openspace/engine/openspaceengine.h>
@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/ ****************************************************************************************/
#include <openspace/rendering/renderableplaneprojection.h> #include <modules/newhorizons/rendering/renderableplaneprojection.h>
#include <openspace/engine/openspaceengine.h> #include <openspace/engine/openspaceengine.h>
#include <openspace/engine/configurationmanager.h> #include <openspace/engine/configurationmanager.h>
#include <openspace/util/constants.h> #include <openspace/util/constants.h>
@@ -23,9 +23,9 @@
****************************************************************************************/ ****************************************************************************************/
// open space includes // open space includes
#include <openspace/rendering/planets/renderableplanetprojection.h> #include <modules/newhorizons/rendering/renderableplanetprojection.h>
#include <openspace/util/constants.h> #include <openspace/util/constants.h>
#include <openspace/rendering/planets/planetgeometryprojection.h> #include <modules/newhorizons/rendering/planetgeometryprojection.h>
#include <openspace/engine/configurationmanager.h> #include <openspace/engine/configurationmanager.h>
@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/ ****************************************************************************************/
#include <openspace/rendering/planets/simplespheregeometryprojection.h> #include <modules/newhorizons/rendering/simplespheregeometryprojection.h>
#include <openspace/util/constants.h> #include <openspace/util/constants.h>
namespace { namespace {
@@ -25,7 +25,7 @@
#ifndef __SIMPLESPHEREGEOMETRYPROJECTION_H__ #ifndef __SIMPLESPHEREGEOMETRYPROJECTION_H__
#define __SIMPLESPHEREGEOMETRYPROJECTION_H__ #define __SIMPLESPHEREGEOMETRYPROJECTION_H__
#include <openspace/rendering/planets/planetgeometryprojection.h> #include <modules/newhorizons/rendering/planetgeometryprojection.h>
#include <openspace/properties/vectorproperty.h> #include <openspace/properties/vectorproperty.h>
#include <openspace/properties/scalarproperty.h> #include <openspace/properties/scalarproperty.h>
#include <openspace/util/powerscaledsphere.h> #include <openspace/util/powerscaledsphere.h>
+20
View File
@@ -0,0 +1,20 @@
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablevolume.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablevolumegl.h
)
source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablevolume.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablevolumegl.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
set(MODULE_CLASS_FILES
${CMAKE_CURRENT_SOURCE_DIR}/volumemodule.h
${CMAKE_CURRENT_SOURCE_DIR}/volumemodule.cpp
)
include_directories(${OPENSPACE_BASE_DIR}/include ${OPENSPACE_BASE_DIR})
add_library(openspace-module-volume ${HEADER_FILES} ${SOURCE_FILES} ${MODULE_CLASS_FILES})
@@ -23,7 +23,7 @@
****************************************************************************************/ ****************************************************************************************/
// open space includes // open space includes
#include <openspace/rendering/renderablevolume.h> #include <modules/volume/rendering/renderablevolume.h>
#include <openspace/engine/openspaceengine.h> #include <openspace/engine/openspaceengine.h>
#include <openspace/util/kameleonwrapper.h> #include <openspace/util/kameleonwrapper.h>
#include <openspace/util/constants.h> #include <openspace/util/constants.h>
@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/ ****************************************************************************************/
#include <openspace/rendering/renderablevolumegl.h> #include <modules/volume/rendering/renderablevolumegl.h>
#include <openspace/abuffer/abuffer.h> #include <openspace/abuffer/abuffer.h>
#include <openspace/engine/configurationmanager.h> #include <openspace/engine/configurationmanager.h>
@@ -25,7 +25,7 @@
#ifndef __RENDERABLEVOLUMEGL_H__ #ifndef __RENDERABLEVOLUMEGL_H__
#define __RENDERABLEVOLUMEGL_H__ #define __RENDERABLEVOLUMEGL_H__
#include <openspace/rendering/renderablevolume.h> #include <modules/volume/rendering/renderablevolume.h>
#include <openspace/util/powerscaledcoordinate.h> #include <openspace/util/powerscaledcoordinate.h>
// Forward declare to minimize dependencies // Forward declare to minimize dependencies
+46
View File
@@ -0,0 +1,46 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/volume/volumemodule.h>
#include <openspace/rendering/renderable.h>
#include <openspace/util/factorymanager.h>
#include <ghoul/misc/assert.h>
#include <modules/volume/rendering/renderablevolumegl.h>
namespace openspace {
bool VolumeModule::initialize() {
auto fRenderable = FactoryManager::ref().factory<Renderable>();
ghoul_assert(fRenderable, "No renderable factory existed");
fRenderable->registerClass<RenderableVolumeGL>("RenderableVolumeGL");
return true;
}
} // namespace openspace
+39
View File
@@ -0,0 +1,39 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __VOLUMEMODULE_H__
#define __VOLUMEMODULE_H__
#include <openspace/util/openspacemodule.h>
namespace openspace {
class VolumeModule : public OpenSpaceModule {
public:
bool initialize() override;
};
} // namespace openspace
#endif // __VOLUMEMODULE_H__
+1 -2
View File
@@ -151,8 +151,7 @@ if (UNIX AND NOT APPLE)
endif (UNIX AND NOT APPLE) endif (UNIX AND NOT APPLE)
set(DEPENDENT_LIBS ${DEPENDENT_LIBS} openspace-module-base) set(DEPENDENT_LIBS ${DEPENDENT_LIBS} openspace-module-base openspace-module-newhorizons openspace-module-volume)
message(${DEPENDENT_LIBS})
include_directories("${HEADER_ROOT_DIR}") include_directories("${HEADER_ROOT_DIR}")
include_directories("${OPENSPACE_BASE_DIR}") include_directories("${OPENSPACE_BASE_DIR}")
+9
View File
@@ -28,6 +28,10 @@
#include <ghoul/logging/logmanager.h> #include <ghoul/logging/logmanager.h>
#include <modules/base/basemodule.h>
#include <modules/newhorizons/newhorizonsmodule.h>
#include <modules/volume/volumemodule.h>
namespace { namespace {
const std::string _loggerCat = "ModuleEngine"; const std::string _loggerCat = "ModuleEngine";
} }
@@ -36,6 +40,11 @@ namespace openspace {
bool ModuleEngine::initialize() { bool ModuleEngine::initialize() {
LDEBUG("Initializing modules"); LDEBUG("Initializing modules");
registerModule(new BaseModule);
registerModule(new NewHorizonsModule);
registerModule(new VolumeModule);
for (OpenSpaceModule* m : _modules) { for (OpenSpaceModule* m : _modules) {
bool success = m->initialize(); bool success = m->initialize();
if (!success) { if (!success) {
-3
View File
@@ -89,8 +89,6 @@ namespace {
} commandlineArgumentPlaceholders; } commandlineArgumentPlaceholders;
} }
#include <modules/base/basemodule.h>
namespace openspace { namespace openspace {
OpenSpaceEngine* OpenSpaceEngine::_engine = nullptr; OpenSpaceEngine* OpenSpaceEngine::_engine = nullptr;
@@ -114,7 +112,6 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName)
ghoul::systemcapabilities::SystemCapabilities::initialize(); ghoul::systemcapabilities::SystemCapabilities::initialize();
// Register modules // Register modules
_moduleEngine->registerModule(new BaseModule);
_moduleEngine->initialize(); _moduleEngine->initialize();
} }