diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..0328f80400 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,74 @@ +def modules = [ + "base", + "debugging", + "fieldlines", + "galaxy", + "globebrowsing", + "iswa", + "kameleon", + "kameleonvolume", + "multiresvolume", + "newhorizons", + "onscreengui", + "space", + "toyvolume", + "volume" +]; + +def flags = "-DGHOUL_USE_DEVIL=OFF " + +for (module in modules) { + flags += "-DOPENSPACE_OPENSPACE_MODULE_" + module.toUpperCase() + "=ON " +} + +echo flags + +stage('Build') { + parallel linux: { + node('linux') { + checkout scm + sh 'git submodule update --init --recursive' + sh ''' + mkdir -p build + cd build + cmake ''' + + flags + ''' .. + make + ''' + } + }, + windows: { + node('windows') { + checkout scm + bat ''' + git submodule update --init --recursive + if not exist "build" mkdir "build" + cd build + cmake -G "Visual Studio 14 2015 Win64" ''' + + flags + ''' .. + msbuild.exe OpenSpace.sln /m:8 /p:Configuration=Debug + ''' + } + }, + osx: { + node('osx') { + checkout scm + sh 'git submodule update --init --recursive' + sh ''' + export PATH=${PATH}:/usr/local/bin:/Applications/CMake.app/Contents/bin + export CMAKE_BUILD_TOOL=/Applications/CMake.app/Contents/bin/CMake + srcDir=$PWD + if [ ! -d ${srcDir} ]; then + mkdir ${srcDir} + fi + if [ ! -d ${srcDir}/build ]; then + mkdir ${srcDir}/build + fi + cd ${srcDir}/build + /Applications/CMake.app/Contents/bin/cmake -G Xcode -D NASM=/usr/local/Cellar/nasm/2.11.08/bin/nasm ${srcDir} ''' + + flags + ''' + xcodebuild + ''' + } + } +} \ No newline at end of file diff --git a/include/openspace/util/task.h b/include/openspace/util/task.h index 20fd7e51be..c218ceff54 100644 --- a/include/openspace/util/task.h +++ b/include/openspace/util/task.h @@ -1,5 +1,29 @@ -#ifndef __CONVERSIONTASK_H__ -#define __CONVERSIONTASK_H__ +/***************************************************************************************** +* * +* OpenSpace * +* * +* Copyright (c) 2014-2016 * +* * +* 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 __OPENSPACE_CORE___TASK___H__ +#define __OPENSPACE_CORE___TASK___H__ #include #include diff --git a/modules/base/basemodule.h b/modules/base/basemodule.h index 28bc2c3355..257cdec7ce 100644 --- a/modules/base/basemodule.h +++ b/modules/base/basemodule.h @@ -32,7 +32,7 @@ namespace openspace { class BaseModule : public OpenSpaceModule { public: BaseModule(); - + virtual ~BaseModule() = default; std::vector documentations() const override; protected: diff --git a/modules/galaxy/CMakeLists.txt b/modules/galaxy/CMakeLists.txt index e77c3e699f..a70b4b03d6 100644 --- a/modules/galaxy/CMakeLists.txt +++ b/modules/galaxy/CMakeLists.txt @@ -27,7 +27,7 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/galaxymodule.h ${CMAKE_CURRENT_SOURCE_DIR}/rendering/galaxyraycaster.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablegalaxy.h + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablegalaxy.h ${CMAKE_CURRENT_SOURCE_DIR}/tasks/milkywayconversiontask.h ${CMAKE_CURRENT_SOURCE_DIR}/tasks/milkywaypointsconversiontask.h ) @@ -36,7 +36,8 @@ source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/galaxymodule.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/galaxyraycaster.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablegalaxy.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablegalaxy.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tasks/milkywayconversiontask.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tasks/milkywaypointsconversiontask.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/modules/galaxy/galaxymodule.cpp b/modules/galaxy/galaxymodule.cpp index 1a20cbce44..636055634c 100644 --- a/modules/galaxy/galaxymodule.cpp +++ b/modules/galaxy/galaxymodule.cpp @@ -41,7 +41,7 @@ void GalaxyModule::internalInitialize() { auto fTask = FactoryManager::ref().factory(); ghoul_assert(fRenderable, "No task factory existed"); - fTask->registerClass("MilkywayPointsConversionTask"); + fTask->registerClass("MilkywayConversionTask"); fTask->registerClass("MilkywayPointsConversionTask"); } diff --git a/modules/galaxy/tasks/milkywayconversiontask.cpp b/modules/galaxy/tasks/milkywayconversiontask.cpp index 907684bbcc..dca36ca0de 100644 --- a/modules/galaxy/tasks/milkywayconversiontask.cpp +++ b/modules/galaxy/tasks/milkywayconversiontask.cpp @@ -22,15 +22,14 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include #include #include namespace openspace { -namespace dataconverter { -MilkyWayConversionTask::MilkyWayConversionTask( +/*MilkywayConversionTask::MilkywayConversionTask( const std::string& inFilenamePrefix, const std::string& inFilenameSuffix, size_t inFirstIndex, @@ -42,10 +41,20 @@ MilkyWayConversionTask::MilkyWayConversionTask( , _inFirstIndex(inFirstIndex) , _inNSlices(inNSlices) , _outFilename(outFilename) - , _outDimensions(outDimensions) {} + , _outDimensions(outDimensions) {}*/ -void MilkyWayConversionTask::perform(const std::function& onProgress) { +MilkywayConversionTask::MilkywayConversionTask(const ghoul::Dictionary& dictionary) { +} + +MilkywayConversionTask::~MilkywayConversionTask() {} + +std::string MilkywayConversionTask::description() +{ + return std::string(); +} + +void MilkywayConversionTask::perform(const Task::ProgressCallback& progressCallback) { std::vector filenames; for (int i = 0; i < _inNSlices; i++) { filenames.push_back(_inFilenamePrefix + std::to_string(i + _inFirstIndex) + _inFilenameSuffix); @@ -67,8 +76,12 @@ void MilkyWayConversionTask::perform(const std::function& onProgres return value; }; - rawWriter.write(sampleFunction, onProgress); + rawWriter.write(sampleFunction, progressCallback); +} + +Documentation MilkywayConversionTask::documentation() +{ + return Documentation(); } } -} diff --git a/modules/galaxy/tasks/milkywayconversiontask.h b/modules/galaxy/tasks/milkywayconversiontask.h index d9a32e5cb1..1a37fb5950 100644 --- a/modules/galaxy/tasks/milkywayconversiontask.h +++ b/modules/galaxy/tasks/milkywayconversiontask.h @@ -22,8 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_APP_DATACONVERTER___MILKYWAYCONVERSIONTASK___H__ -#define __OPENSPACE_APP_DATACONVERTER___MILKYWAYCONVERSIONTASK___H__ +#ifndef __OPENSPACE_MODULE_GALAXY___MILKYWAYCONVERSIONTASK___H__ +#define __OPENSPACE_MODULE_GALAXY___MILKYWAYCONVERSIONTASK___H__ #include #include @@ -34,22 +34,18 @@ namespace openspace { -namespace dataconverter { /** * Converts a set of exr image slices to a raw volume * with floating point RGBA data (32 bit per channel). */ -class MilkyWayConversionTask : public Task { +class MilkywayConversionTask : public Task { public: - MilkyWayConversionTask(const std::string& inFilenamePrefix, - const std::string& inFilenameSuffix, - size_t inFirstIndex, - size_t inNSlices, - const std::string& outFilename, - const glm::ivec3& outDimensions); - - void perform(const std::function& onProgress) override; + MilkywayConversionTask(const ghoul::Dictionary& dictionary); + virtual ~MilkywayConversionTask(); + std::string description() override; + void perform(const Task::ProgressCallback& onProgress) override; + static Documentation documentation(); private: std::string _inFilenamePrefix; std::string _inFilenameSuffix; @@ -59,7 +55,6 @@ private: glm::ivec3 _outDimensions; }; -} // namespace dataconverter -} // namespace openspace +} -#endif // __OPENSPACE_APP_DATACONVERTER___MILKYWAYCONVERSIONTASK___H__ +#endif // __OPENSPACE_MODULE_GALAXY___MILKYWAYCONVERSIONTASK___H__ diff --git a/modules/galaxy/tasks/milkywaypointsconversiontask.cpp b/modules/galaxy/tasks/milkywaypointsconversiontask.cpp index 1a25b36c14..d06c8a0f56 100644 --- a/modules/galaxy/tasks/milkywaypointsconversiontask.cpp +++ b/modules/galaxy/tasks/milkywaypointsconversiontask.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include #include #include @@ -30,27 +30,30 @@ #include namespace openspace { -namespace dataconverter { - - -MilkyWayPointsConversionTask::MilkyWayPointsConversionTask( +/*MilkywayPointsConversionTask::MilkywayPointsConversionTask( const std::string& inFilename, const std::string& outFilename) : _inFilename(inFilename) - , _outFilename(outFilename) {} + , _outFilename(outFilename) {}*/ +MilkywayPointsConversionTask::MilkywayPointsConversionTask(const ghoul::Dictionary & dictionary) {} -void MilkyWayPointsConversionTask::perform(const std::function& onProgress) { +MilkywayPointsConversionTask::~MilkywayPointsConversionTask() {} + +std::string MilkywayPointsConversionTask::description() +{ + return std::string(); +} + +void MilkywayPointsConversionTask::perform(const Task::ProgressCallback & progressCallback) { std::ifstream in(_inFilename, std::ios::in); std::ofstream out(_outFilename, std::ios::out | std::ios::binary); - + std::string format; int64_t nPoints; in >> format >> nPoints; - - size_t nFloats = nPoints * 7; float* pointData = new float[nFloats]; @@ -66,8 +69,9 @@ void MilkyWayPointsConversionTask::perform(const std::function& onP pointData[i * 7 + 4] = g; pointData[i * 7 + 5] = b; pointData[i * 7 + 6] = a; - onProgress(static_cast(i + 1) / nPoints); - } else { + progressCallback(static_cast(i + 1) / nPoints); + } + else { std::cout << "Failed to convert point data."; return; } @@ -80,7 +84,9 @@ void MilkyWayPointsConversionTask::perform(const std::function& onP out.close(); } - +Documentation MilkywayPointsConversionTask::documentation() +{ + return Documentation(); +} -} } diff --git a/modules/galaxy/tasks/milkywaypointsconversiontask.h b/modules/galaxy/tasks/milkywaypointsconversiontask.h index 6da5a42cd4..ffc1582957 100644 --- a/modules/galaxy/tasks/milkywaypointsconversiontask.h +++ b/modules/galaxy/tasks/milkywaypointsconversiontask.h @@ -22,10 +22,10 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_APP_DATACONVERTER___MILKYWAYPOINTSCONVERSIONTASK___H__ -#define __OPENSPACE_APP_DATACONVERTER___MILKYWAYPOINTSCONVERSIONTASK___H__ +#ifndef __OPENSPACE_MODULE_GALAXY___MILKYWAYPOINTSCONVERSIONTASK_H__ +#define __OPENSPACE_MODULE_GALAXY___MILKYWAYPOINTSCONVERSIONTASK_H__ -#include +#include #include #include #include @@ -34,7 +34,6 @@ namespace openspace { -namespace dataconverter { /** * Converts ascii based point data @@ -42,18 +41,18 @@ namespace dataconverter { * (float x, float y, float z, float r, float g, float b) * n * to a binary (floating point) representation with the same layout. */ -class MilkyWayPointsConversionTask : public Task { +class MilkywayPointsConversionTask : public Task { public: - MilkyWayPointsConversionTask(const std::string& inFilename, - const std::string& outFilename); - - void perform(const std::function& onProgress) override; + MilkywayPointsConversionTask(const ghoul::Dictionary& dictionary); + virtual ~MilkywayPointsConversionTask(); + std::string description() override; + void perform(const Task::ProgressCallback& progressCallback) override; + static Documentation documentation(); private: std::string _inFilename; std::string _outFilename; }; -} // namespace dataconverter -} // namespace openspace +} -#endif // __OPENSPACE_APP_DATACONVERTER___MILKYWAYPOINTSCONVERSIONTASK___H__ +#endif // __OPENSPACE_MODULE_GALAXY___MILKYWAYPOINTSCONVERSIONTASK_H__ diff --git a/modules/kameleon/include/kameleonwrapper.h b/modules/kameleon/include/kameleonwrapper.h index 76f6e0c5a3..1b4149e95f 100644 --- a/modules/kameleon/include/kameleonwrapper.h +++ b/modules/kameleon/include/kameleonwrapper.h @@ -136,6 +136,7 @@ public: Model model(); GridType gridType(); + std::string getParent(); std::string getFrame(); std::vector getVariables(); std::vector getLoadedVariables(); diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index 7da9e23cc6..e835c8b758 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -1008,20 +1008,34 @@ glm::vec4 KameleonWrapper::classifyFieldline(FieldlineEnd fEnd, FieldlineEnd bEn return color; } -std::string KameleonWrapper::getFrame(){ - if( _type == KameleonWrapper::Model::BATSRUS || - _type == KameleonWrapper::Model::OpenGGCM || - _type == KameleonWrapper::Model::LFM) - { +std::string KameleonWrapper::getParent() { + switch (_type) { + case KameleonWrapper::Model::BATSRUS: + case KameleonWrapper::Model::OpenGGCM: + case KameleonWrapper::Model::LFM: + return "Earth"; + case KameleonWrapper::Model::ENLIL: + case KameleonWrapper::Model::MAS: + case KameleonWrapper::Model::Adapt3D: + case KameleonWrapper::Model::SWMF: + return "Sun"; + default: + return ""; + } +} + +std::string KameleonWrapper::getFrame() { + switch (_type) { + case KameleonWrapper::Model::BATSRUS: + case KameleonWrapper::Model::OpenGGCM: + case KameleonWrapper::Model::LFM: return "GSM"; - }else if( - _type == KameleonWrapper::Model::ENLIL || - _type == KameleonWrapper::Model::MAS || - _type == KameleonWrapper::Model::Adapt3D || - _type == KameleonWrapper::Model::SWMF) - { + case KameleonWrapper::Model::ENLIL: + case KameleonWrapper::Model::MAS: + case KameleonWrapper::Model::Adapt3D: + case KameleonWrapper::Model::SWMF: return "HEEQ"; - }else{ + default: return ""; } } diff --git a/modules/kameleonvolume/kameleonvolumemodule.h b/modules/kameleonvolume/kameleonvolumemodule.h index fd83620e7d..ceccb8de98 100644 --- a/modules/kameleonvolume/kameleonvolumemodule.h +++ b/modules/kameleonvolume/kameleonvolumemodule.h @@ -22,8 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __KAMELEONVOLUMEMODULE_H__ -#define __KAMELEONVOLUMEMODULE_H__ +#ifndef __OPENSPACE_MODULE_KAMELEONVOLUME___BASEMODULE___H__ +#define __OPENSPACE_MODULE_KAMELEONVOLUME___BASEMODULE___H__ #include @@ -32,6 +32,7 @@ namespace openspace { class KameleonVolumeModule : public OpenSpaceModule { public: KameleonVolumeModule(); + virtual ~KameleonVolumeModule() = default; void internalInitialize() override; std::vector documentations() const override; }; diff --git a/modules/kameleonvolume/rendering/kameleonvolumeraycaster.h b/modules/kameleonvolume/rendering/kameleonvolumeraycaster.h index 7d1e9c8fa0..10c1df2084 100644 --- a/modules/kameleonvolume/rendering/kameleonvolumeraycaster.h +++ b/modules/kameleonvolume/rendering/kameleonvolumeraycaster.h @@ -25,7 +25,6 @@ #ifndef __OPENSPACE_MODULE_KAMELEONVOLUME___KAMELEONVOLUMERAYCASTER_H__ #define __OPENSPACE_MODULE_KAMELEONVOLUME___KAMELEONVOLUMERAYCASTER_H__ - #include #include #include diff --git a/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp b/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp index 5406ce7b85..73b694918d 100644 --- a/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp +++ b/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp @@ -154,7 +154,7 @@ bool MultiresVolumeRaycaster::cameraIsInside(const RenderData& data, glm::vec3& } void MultiresVolumeRaycaster::postRaycast(const RaycastData& data, ghoul::opengl::ProgramObject& program) { - _textureUnit = nullptr; + _atlasUnit = nullptr; _tfUnit = nullptr; } diff --git a/modules/space/spacemodule.h b/modules/space/spacemodule.h index f1f90d513b..3d954c30a9 100644 --- a/modules/space/spacemodule.h +++ b/modules/space/spacemodule.h @@ -22,8 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_MODULE_SPACE___BASEMODULE___H__ -#define __OPENSPACE_MODULE_SPACE___BASEMODULE___H__ +#ifndef __OPENSPACE_MODULE_SPACE___SPACEMODULE___H__ +#define __OPENSPACE_MODULE_SPACE___SPACEMODULE___H__ #include @@ -32,7 +32,7 @@ namespace openspace { class SpaceModule : public OpenSpaceModule { public: SpaceModule(); - + virtual ~SpaceModule() = default; std::vector documentations() const override; protected: @@ -41,4 +41,4 @@ protected: } // namespace openspace -#endif // __OPENSPACE_MODULE_SPACE___BASEMODULE___H__ +#endif // __OPENSPACE_MODULE_SPACE___SPACEMODULE___H__ diff --git a/modules/volume/textureslicevolumereader.inl b/modules/volume/textureslicevolumereader.inl index 6a3513383e..0366096d1e 100644 --- a/modules/volume/textureslicevolumereader.inl +++ b/modules/volume/textureslicevolumereader.inl @@ -29,7 +29,7 @@ namespace openspace { template VoxelType TextureSliceVolumeReader::get(const glm::ivec3& coordinates) const { ghoul::opengl::Texture& slice = getSlice(coordinates.z); - return slice.texel(glm::ivec2(coordinates)); + return slice.texel(glm::uvec2(coordinates.x, coordinates.y)); } template @@ -52,7 +52,8 @@ void TextureSliceVolumeReader::initialize() { std::shared_ptr firstSlice = ghoul::io::TextureReader::ref().loadTexture(_paths[0]); - _sliceDimensions = firstSlice->dimensions(); + glm::uvec3 dimensions = firstSlice->dimensions(); + _sliceDimensions = glm::uvec2(dimensions.x, dimensions.y); _initialized = true; _cache.set(0, firstSlice); } @@ -72,7 +73,8 @@ ghoul::opengl::Texture& TextureSliceVolumeReader::getSlice(int sliceI std::shared_ptr texture = ghoul::io::TextureReader::ref().loadTexture(_paths[sliceIndex]); - glm::ivec2 dims = texture->dimensions(); + glm::uvec3 dimensions = texture->dimensions(); + glm::ivec2 dims = glm::uvec2(dimensions.x, dimensions.y); ghoul_assert(dims == _sliceDimensions, "Slice dimensions do not agree."); _cache.set(sliceIndex, std::move(texture)); }