diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index dae55381ab..c3c3c0022e 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -46,13 +46,22 @@ // #define OPENSPACE_VIDEO_EXPORT +namespace ghoul { + namespace cmdparser { + class CommandlineParser; + class CommandlineCommand; + } +} + namespace openspace { -class ScriptEngine; +namespace scripting { + class ScriptEngine; +} class OpenSpaceEngine { public: - static void create(int argc, char** argv, std::vector& sgctArguments); + static bool create(int argc, char** argv, std::vector& sgctArguments); static void destroy(); static OpenSpaceEngine& ref(); @@ -67,6 +76,7 @@ public: ghoul::opencl::CLContext& clContext(); InteractionHandler& interactionHandler(); RenderEngine& renderEngine(); + scripting::ScriptEngine& scriptEngine(); ShaderCreator& shaderBuilder(); // SGCT callbacks @@ -84,14 +94,18 @@ public: void decode(); private: - OpenSpaceEngine(); + OpenSpaceEngine(std::string programName); ~OpenSpaceEngine(); + bool gatherCommandlineArguments(); + static OpenSpaceEngine* _engine; ghoul::Dictionary* _configurationManager; InteractionHandler* _interactionHandler; RenderEngine* _renderEngine; + scripting::ScriptEngine* _scriptEngine; + ghoul::cmdparser::CommandlineParser* _commandlineParser; #ifdef OPENSPACE_VIDEO_EXPORT bool _doVideoExport; #endif diff --git a/shaders/ABuffer/abufferResolveFragment.glsl b/shaders/ABuffer/abufferResolveFragment.glsl index 6c3245cdff..c076cad685 100644 --- a/shaders/ABuffer/abufferResolveFragment.glsl +++ b/shaders/ABuffer/abufferResolveFragment.glsl @@ -137,6 +137,7 @@ void blendStep(inout vec4 dst, in vec4 src, in float stepSize) { } float volumeRaycastingDistance(in int id, in ABufferStruct_t startFrag, in ABufferStruct_t endFrag) { +#if MAX_VOLUMES > 0 #if ZTYPE == ZDEPTH const float S1 = volume_zlength[id].x; const float S2 = volume_zlength[id].y; @@ -155,6 +156,9 @@ float volumeRaycastingDistance(in int id, in ABufferStruct_t startFrag, in ABuff // const float z2 = _z_(endFrag); return (dist / L) * volume_length[id]; #endif +#else + return 0.f; +#endif } vec4 calculate_final_color(uint frag_count) { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 3ef492befe..595ec959ca 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -155,29 +156,28 @@ bool OpenSpaceEngine::registerBasePathFromConfigurationFile(const std::string& f bool OpenSpaceEngine::findConfiguration(std::string& filename) { - return FileSys.fileExists(filename); - std::string currentDirectory = FileSys.absolutePath(FileSys.currentDirectory()); - size_t occurrences = std::count(currentDirectory.begin(), currentDirectory.end(), - ghoul::filesystem::FileSystem::PathSeparator); + //return FileSys.fileExists(filename); + std::string currentDirectory = FileSys.absolutePath(FileSys.currentDirectory()); + size_t occurrences = std::count(currentDirectory.begin(), currentDirectory.end(), + ghoul::filesystem::FileSystem::PathSeparator); - std::string cfgname = _configurationFile; + std::string cfgname = _configurationFile; - bool cfgFileFound = false; - for (size_t i = 0; i < occurrences; ++i) { - if (i > 0) - cfgname = "../" + cfgname; - if (FileSys.fileExists(cfgname)) { - cfgFileFound = true; - break; - } + bool cfgFileFound = false; + for (size_t i = 0; i < occurrences; ++i) { + if (i > 0) + cfgname = "../" + cfgname; + if (FileSys.fileExists(cfgname)) { + cfgFileFound = true; + break; } - if (!cfgFileFound) - return false; - - filename = cfgname; - - return true; } + if (!cfgFileFound) + return false; + + filename = cfgname; + + return true; } bool OpenSpaceEngine::create(int argc, char** argv, diff --git a/src/scenegraph/scenegraph.cpp b/src/scenegraph/scenegraph.cpp index 9108e7bc28..b2ac485212 100644 --- a/src/scenegraph/scenegraph.cpp +++ b/src/scenegraph/scenegraph.cpp @@ -50,18 +50,18 @@ #include #include - #include + //#include namespace { const std::string _loggerCat = "SceneGraph"; const std::string _moduleExtension = ".mod"; -{ - LDEBUGC("Tree", pre << node->name()); - const std::vector& children = node->children(); - for (openspace::SceneGraphNode* child : children) - printTree(child, pre + " "); -} - +//{ +// LDEBUGC("Tree", pre << node->name()); +// const std::vector& children = node->children(); +// for (openspace::SceneGraphNode* child : children) +// printTree(child, pre + " "); +//} +// } namespace openspace { @@ -374,7 +374,7 @@ void SceneGraph::loadModule(const std::string& modulePath) } // Print the tree - printTree(_root); + //printTree(_root); } void SceneGraph::printChildren() const diff --git a/src/scenegraph/scenegraphnode.cpp b/src/scenegraph/scenegraphnode.cpp index 0ce7b0f9e6..5e349c782c 100644 --- a/src/scenegraph/scenegraphnode.cpp +++ b/src/scenegraph/scenegraphnode.cpp @@ -42,6 +42,8 @@ #include +#include + namespace { const std::string _loggerCat = "SceneGraphNode"; } @@ -347,7 +349,7 @@ PowerScaledScalar SceneGraphNode::calculateBoundingSphere() } - LWARNING(_nodeName << ": " << _boundingSphere); + LWARNING(name() << ": " << _boundingSphere); return _boundingSphere; } diff --git a/src/util/shadercreator.cpp b/src/util/shadercreator.cpp index b4b1b0d930..a70c9032a4 100644 --- a/src/util/shadercreator.cpp +++ b/src/util/shadercreator.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include // #include @@ -143,15 +143,18 @@ std::string ShaderCreator::_loadSource(const std::string& filename, unsigned int return contents; } - boost::regex e1(R"(^\s*#include \"(.+)\"\s*)"); - boost::regex e2(R"(^\s*#include <(.+)>\s*)"); + std::regex e1(R"(^\s*#include \"(.+)\"\s*)"); + std::regex e2(R"(^\s*#include <(.+)>\s*)"); while(std::getline(f, line)) { - boost::smatch m; - if(boost::regex_search(line, m, e1)) { + std::smatch m; + if(std::regex_search(line, m, e1)) { + using namespace ghoul::filesystem; std::string includeFilename = m[1]; - includeFilename = filename.substr(0, filename.find_last_of("/")+1) + includeFilename; + File f(filename); + includeFilename = f.directoryName() + FileSystem::PathSeparator + includeFilename; + //includeFilename = filename.substr(0, filename.find_last_of("/")+1) + includeFilename; line = _loadSource(includeFilename, depth + 1); - } else if(boost::regex_search(line, m, e2)) { + } else if(std::regex_search(line, m, e2)) { std::string includeFilename = m[1]; line = _loadSource(absPath(includeFilename), depth + 1); }