diff --git a/CREDITS b/CREDITS index 29a39a8c52..d29402c4fb 100644 --- a/CREDITS +++ b/CREDITS @@ -1,4 +1,6 @@ Alexander Bock -Patric Ljung +Joakim Kilby Jonas Strandstedt -Hans-Christian Helltegen \ No newline at end of file +Hans-Christian Helltegen +Michal Marcinkowski +Anton Arbring \ No newline at end of file diff --git a/ext/ghoul b/ext/ghoul index e036e21f0f..bf2ab81efb 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit e036e21f0fb297cdd8aca0632478108ea5c0c063 +Subproject commit bf2ab81efbb379a7a4fd92c6d87dd10ca530c575 diff --git a/ext/spice/include/SpiceZpl.h b/ext/spice/include/SpiceZpl.h index 227393b85d..a8b193139c 100644 --- a/ext/spice/include/SpiceZpl.h +++ b/ext/spice/include/SpiceZpl.h @@ -111,7 +111,7 @@ #define HAVE_PLATFORM_MACROS_H - #define CSPICE_PC_MS + #define CSPICE_MAC_OSX_INTEL_64BIT_GCC #endif diff --git a/ext/spice/lib/gcc_osx/csupport.a b/ext/spice/lib/gcc_osx/csupport.a new file mode 100644 index 0000000000..de843de4c6 Binary files /dev/null and b/ext/spice/lib/gcc_osx/csupport.a differ diff --git a/gui/timelineview/CMakeLists.txt b/gui/timelineview/CMakeLists.txt index 502487c9ed..f9687382ab 100644 --- a/gui/timelineview/CMakeLists.txt +++ b/gui/timelineview/CMakeLists.txt @@ -8,4 +8,4 @@ find_package(Qt5Widgets) find_package(Qt5Network) add_executable(TimelineView main.cpp mainwindow.cpp configurationwidget.cpp informationwidget.cpp controlwidget.cpp timelinewidget.cpp) #add_executable(TimelineView WIN32 main.cpp mainwindow.cpp configurationwidget.cpp informationwidget.cpp controlwidget.cpp timelinewidget.cpp) -target_link_libraries(TimelineView Qt5::Widgets Qt5::Network) \ No newline at end of file +target_link_libraries(TimelineView Qt5::Widgets Qt5::Network) diff --git a/gui/timelineview/controlwidget.cpp b/gui/timelineview/controlwidget.cpp index d66f280641..cd1e57af8e 100644 --- a/gui/timelineview/controlwidget.cpp +++ b/gui/timelineview/controlwidget.cpp @@ -33,7 +33,8 @@ #include #include #include -#include + +#include namespace { struct ImportantDate { @@ -222,11 +223,11 @@ void ControlWidget::onValueChange() { float delta; if (value < 0.f) { value = -value; - float d = std::pow(3, value / 10) - 1.f; + float d = pow(3, value / 10) - 1.f; delta = -d; } else { - float d = std::pow(3, value / 10) - 1.f; + float d = pow(3, value / 10) - 1.f; delta = d; } diff --git a/gui/timelineview/timelinewidget.cpp b/gui/timelineview/timelinewidget.cpp index 7256e45284..aa25576041 100644 --- a/gui/timelineview/timelinewidget.cpp +++ b/gui/timelineview/timelinewidget.cpp @@ -38,21 +38,26 @@ namespace { static const int TextOffset = 5; - const QColor instrumentColors[] = { - QColor(242, 101, 74), - QColor(175, 18, 18), - QColor(211, 154, 31), - QColor(241, 231, 48), - QColor(149, 219, 32), - QColor(49, 234, 219), - QColor(49, 155, 234), - QColor(139, 86, 152), - QColor(84, 79, 149), - QColor(203, 153, 200), - QColor(82, 145, 57), - QColor(35, 185, 125) + QMap InstrumentColors = { + { "NH_ALICE_AIRGLOW", QColor(40, 130, 200) }, + { "NH_ALICE_SOC", QColor(49, 234, 219) }, + { "NH_RALPH_LEISA", QColor(139, 86, 152) }, + { "NH_RALPH_MVIC_NIR", QColor(100, 14, 14) }, + { "NH_RALPH_MVIC_METHANE", QColor(211, 154, 31) }, + { "NH_RALPH_MVIC_RED", QColor(175, 18, 18) }, + { "NH_RALPH_MVIC_BLUE", QColor(84, 79, 149) }, + { "NH_LORRI", QColor(149, 219, 32) }, + { "NH_REX", QColor(35, 185, 125) }, + + { "NH_RALPH_MVIC_PAN1", QColor(203, 153, 200) }, + { "NH_RALPH_MVIC_FT", QColor(242, 101, 74) }, + { "NH_RALPH_MVIC_PAN2", QColor(180, 180, 140) } }; + //{ "NH_ALICE_AIRGLOW", QColor(82, 145, 57) }, + //{ "NH_ALICE_SOC", QColor(241, 231, 48) }, + + QMap InstrumentConversion = { { "NH_ALICE_AIRGLOW", "ALICE Airglow" }, { "NH_RALPH_LEISA", "RALPH LEISA" }, @@ -165,9 +170,9 @@ void TimelineWidget::drawLegend(QPainter& painter, QRectF rect) { } const std::string& instrument = _instruments[i]; - - painter.setBrush(QBrush(instrumentColors[i])); - painter.setPen(QPen(instrumentColors[i])); + ; + painter.setBrush(QBrush(InstrumentColors[QString::fromStdString(instrument)])); + painter.setPen(QPen(InstrumentColors[QString::fromStdString(instrument)])); painter.drawRect(currentHorizontalPosition, currentVerticalPosition, BoxSize, BoxSize); currentHorizontalPosition += BoxSize + Padding; @@ -226,9 +231,8 @@ void TimelineWidget::drawImages( auto it = std::find(_instruments.begin(), _instruments.end(), instrument); if (it == _instruments.end()) qDebug() << "Instrument not found"; - int i = std::distance(_instruments.begin(), it); - painter.setBrush(QBrush(instrumentColors[i])); + painter.setBrush(QBrush(InstrumentColors[QString::fromStdString(instrument)])); double width = timelineRect.width() / instruments.size(); double pos = instruments[instrument] * width; diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 155a9f9e33..4e85dee7c3 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -117,7 +117,6 @@ private: ghoul::cmdparser::CommandlineParser* _commandlineParser; LuaConsole* _console; gui::GUI* _gui; - double _dt; bool _isMaster; SyncBuffer* _syncBuffer; diff --git a/include/openspace/interaction/controller.h b/include/openspace/interaction/controller.h index 0ddd97c67a..d1af77b0a3 100644 --- a/include/openspace/interaction/controller.h +++ b/include/openspace/interaction/controller.h @@ -40,7 +40,7 @@ public: Controller() : _handler(nullptr) {} - + void setHandler(InteractionHandler* handler); protected: diff --git a/include/openspace/interaction/keyboardcontroller.h b/include/openspace/interaction/keyboardcontroller.h index abad186567..5e2f01c26c 100644 --- a/include/openspace/interaction/keyboardcontroller.h +++ b/include/openspace/interaction/keyboardcontroller.h @@ -34,6 +34,7 @@ namespace interaction { class KeyboardController : public Controller { public: + virtual ~KeyboardController() {}; virtual void keyPressed(KeyAction action, Key key, KeyModifier modifier) = 0; }; diff --git a/include/openspace/interaction/mousecontroller.h b/include/openspace/interaction/mousecontroller.h index b3b6206a13..25b93ddf92 100644 --- a/include/openspace/interaction/mousecontroller.h +++ b/include/openspace/interaction/mousecontroller.h @@ -37,6 +37,7 @@ namespace interaction { class MouseController : public Controller { public: MouseController(); + virtual ~MouseController() {} virtual void button(MouseAction action, MouseButton button) = 0; virtual void move(float x, float y) = 0; diff --git a/include/openspace/rendering/planets/renderableplanetprojection.h b/include/openspace/rendering/planets/renderableplanetprojection.h index 2edbb2c5b9..a585aa5b0d 100644 --- a/include/openspace/rendering/planets/renderableplanetprojection.h +++ b/include/openspace/rendering/planets/renderableplanetprojection.h @@ -77,7 +77,7 @@ protected: void textureBind(); void project(); - + void clearAllProjections(); private: void imageProjectGPU(); @@ -88,6 +88,8 @@ private: properties::IntProperty _rotation; properties::FloatProperty _fadeProjection; properties::BoolProperty _performProjection; + properties::BoolProperty _clearAllProjections; + ghoul::opengl::ProgramObject* _programObject; ghoul::opengl::ProgramObject* _fboProgramObject; @@ -136,6 +138,7 @@ private: std::string _target; std::string _frame; std::string _defaultProjImage; + std::string _clearingImage; std::string _next; bool _capture; diff --git a/include/openspace/rendering/renderabletrail.h b/include/openspace/rendering/renderabletrail.h index ed17ea3a21..38a66a5070 100644 --- a/include/openspace/rendering/renderabletrail.h +++ b/include/openspace/rendering/renderabletrail.h @@ -87,7 +87,6 @@ private: float _increment; double _oldTime = 0.0; - float _time; float _distanceFade; }; diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h index f05f6cb329..c03113dc79 100644 --- a/include/openspace/util/spicemanager.h +++ b/include/openspace/util/spicemanager.h @@ -85,7 +85,7 @@ public: * \param filePath The path to the kernel that should be examined * \return true if the operation was successful */ - bool findCkCoverage(std::string& path); + bool findCkCoverage(const std::string& path); /** * Function to find and store the intervals covered by a spk file, this is done @@ -95,7 +95,7 @@ public: * \param filePath The path to the kernel that should be examined * \return true if the operation was successful */ - bool findSpkCoverage(std::string& path); + bool findSpkCoverage(const std::string& path); /** * \return true if SPK kernels have been loaded to cover target diff --git a/include/openspace/util/time.h b/include/openspace/util/time.h index 1814dee2db..39573ea40e 100644 --- a/include/openspace/util/time.h +++ b/include/openspace/util/time.h @@ -188,10 +188,7 @@ private: Time& operator=(const Time& rhs) = delete; static Time* _instance; ///< The singleton instance - - - double _deltaTimePerSecond; ///< The delta time that is used to advance the time - + //sync variables //local copies diff --git a/openspace-data b/openspace-data index cca53fc6d1..3fe0b83814 160000 --- a/openspace-data +++ b/openspace-data @@ -1 +1 @@ -Subproject commit cca53fc6d1df10b5e15d7950997ab0aaf3240f0b +Subproject commit 3fe0b83814a3494007244e1607299273bee519ad diff --git a/shaders/ABuffer/abufferAddToBuffer.hglsl b/shaders/ABuffer/abufferAddToBuffer.hglsl index e6d6734b70..2a3e658130 100644 --- a/shaders/ABuffer/abufferAddToBuffer.hglsl +++ b/shaders/ABuffer/abufferAddToBuffer.hglsl @@ -22,8 +22,6 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef APPLE - #if ABUFFER_IMPLEMENTATION == ABUFFER_SINGLE_LINKED layout (binding = 0, r32ui) uniform uimage2D anchorPointerTexture; layout (binding = 1, rgba32ui) uniform uimageBuffer fragmentTexture; @@ -39,8 +37,6 @@ layout (binding = 1, rgba32ui) uniform uimageBuffer fragmentTexture; #define _SCREEN_HEIGHT_ SCREEN_HEIGHT #endif -#endif - layout(location = 0) out vec4 framebuffer_output_color; ABufferStruct_t createGeometryFragment(vec4 fragColor, vec4 position) { @@ -66,7 +62,7 @@ void addToBuffer(ABufferStruct_t frag) { framebuffer_output_color = _col_(frag); gl_FragDepth = _z_(frag); #endif -#ifndef APPLE + #if ABUFFER_IMPLEMENTATION == ABUFFER_SINGLE_LINKED #ifdef ABUFFER_INCLUDE_POSITION @@ -117,11 +113,8 @@ void addToBuffer(ABufferStruct_t frag) { discard; #endif -#endif } -#ifndef APPLE - ABufferStruct_t loadFromBuffer(uint id) { #ifdef ABUFFER_INCLUDE_POSITION @@ -136,12 +129,14 @@ ABufferStruct_t loadFromBuffer(uint id) { uvec4 u2 = imageLoad(fragmentTexture, int(offset+1)); #endif +#if ABUFFER_IMPLEMENTATION == ABUFFER_SINGLE_LINKED || ABUFFER_IMPLEMENTATION == ABUFFER_FIXED vec4 position = vec4( uintBitsToFloat(u2.x), uintBitsToFloat(u2.y), uintBitsToFloat(u2.z), uintBitsToFloat(u2.w)); return ABufferStruct_t(u1.x, u1.y, u1.z, u1.w, position); +#endif #else #if ABUFFER_IMPLEMENTATION == ABUFFER_SINGLE_LINKED uvec4 u1 = imageLoad(fragmentTexture, int(id)); @@ -153,10 +148,13 @@ ABufferStruct_t loadFromBuffer(uint id) { uvec4 u1 = imageLoad(fragmentTexture, int(offset)); //uvec4 u2 = imageLoad(fragmentTexture, int(offset+1)); #endif + +#if ABUFFER_IMPLEMENTATION == ABUFFER_SINGLE_LINKED || ABUFFER_IMPLEMENTATION == ABUFFER_FIXED return ABufferStruct_t(u1.x, u1.y, u1.z, u1.w); +#endif #endif - + ABufferStruct_t frag; + return frag; + } - -#endif \ No newline at end of file diff --git a/shaders/ABuffer/abufferSort.hglsl b/shaders/ABuffer/abufferSort.hglsl index 71acc355b7..478813a86a 100644 --- a/shaders/ABuffer/abufferSort.hglsl +++ b/shaders/ABuffer/abufferSort.hglsl @@ -57,6 +57,9 @@ int build_local_fragments_list() { return int(frag_count); #endif +#if ABUFFER_IMPLEMENTATION == ABUFFER_FRAMEBUFFER + return 0; +#endif } float pscLength(vec4 v1, vec4 v2) { diff --git a/shaders/fboPass_fs.glsl b/shaders/fboPass_fs.glsl index ad93530214..5c7ea014ab 100644 --- a/shaders/fboPass_fs.glsl +++ b/shaders/fboPass_fs.glsl @@ -42,15 +42,15 @@ out vec4 color; #define M_PI 3.14159265358979323846 vec4 uvToModel( float u, float v, vec4 radius, float segments){ - const float fj = u * segments; - const float fi = v * segments; + float fj = u * segments; + float fi = v * segments; - const float theta = fi * float(M_PI) / segments; // 0 -> PI - const float phi = fj * float(M_PI) * 2.0f / segments; + float theta = fi * float(M_PI) / segments; // 0 -> PI + float phi = fj * float(M_PI) * 2.0f / segments; - const float x = radius[0] * sin(phi) * sin(theta); // - const float y = radius[1] * cos(theta); // up - const float z = radius[2] * cos(phi) * sin(theta); // + float x = radius[0] * sin(phi) * sin(theta); // + float y = radius[1] * cos(theta); // up + float z = radius[2] * cos(phi) * sin(theta); // return vec4(x, y, z, radius[3]); } diff --git a/shaders/gui_fs.glsl b/shaders/gui_fs.glsl index 169aa1f0f5..7652b78703 100644 --- a/shaders/gui_fs.glsl +++ b/shaders/gui_fs.glsl @@ -26,9 +26,11 @@ uniform sampler2D tex; -layout(location = 1) in vec2 in_uv; -layout(location = 2) in vec4 in_color; +layout(location = 1) in vec2 out_uv; +layout(location = 2) in vec4 out_color; + layout(location = 0) out vec4 FragColor; + void main() { - FragColor = in_color * texture(tex, in_uv.st); + FragColor = out_color * texture(tex, out_uv); } \ No newline at end of file diff --git a/shaders/modules/plane/plane_fs.glsl b/shaders/modules/plane/plane_fs.glsl index c3f673f8cf..9e572651db 100644 --- a/shaders/modules/plane/plane_fs.glsl +++ b/shaders/modules/plane/plane_fs.glsl @@ -52,4 +52,8 @@ void main() ABufferStruct_t frag = createGeometryFragment(diffuse, position, depth); addToBuffer(frag); + + gl_FragDepth = depth; + if (diffuse.a == 0.0) + discard; } \ No newline at end of file diff --git a/shaders/modules/trails/path_fs.glsl b/shaders/modules/trails/path_fs.glsl index 0a5443713c..60535c0aba 100644 --- a/shaders/modules/trails/path_fs.glsl +++ b/shaders/modules/trails/path_fs.glsl @@ -24,7 +24,7 @@ #version __CONTEXT__ layout(location = 0) in vec4 vs_point_position; -layout(location = 1) in flat int isHour; +layout(location = 1) flat in int isHour; layout(location = 2) in vec4 vs_point_color; //in flat int isHour; //uniform vec4 campos; diff --git a/shaders/modules/trails/path_vs.glsl b/shaders/modules/trails/path_vs.glsl index 294179bca8..06f37f3876 100644 --- a/shaders/modules/trails/path_vs.glsl +++ b/shaders/modules/trails/path_vs.glsl @@ -55,14 +55,14 @@ uniform vec3 color; //uniform vec4 campos; layout(location = 0) out vec4 vs_point_position; -layout(location = 1) out flat int isHour; +layout(location = 1) flat out int isHour; layout(location = 2) out vec4 vs_point_color; #include "PowerScaling/powerScaling_vs.hglsl" void main() { - vec4 gray = { 0.6f, 0.6f, 0.6f, 0.8f}; + vec4 gray = vec4(0.6f, 0.6f, 0.6f, 0.8f); float cameraTooFar = 1 * pow(k, 10); float bigPoint = 5.f; float smallPoint = 2.f; diff --git a/shaders/projectiveTexture_fs.glsl b/shaders/projectiveTexture_fs.glsl index d62a5ccffa..e6ba17dce7 100644 --- a/shaders/projectiveTexture_fs.glsl +++ b/shaders/projectiveTexture_fs.glsl @@ -96,6 +96,5 @@ void main() ABufferStruct_t frag = createGeometryFragment(diffuse, position, depth); addToBuffer(frag); - discard; } diff --git a/src/abuffer/abufferframebuffer.cpp b/src/abuffer/abufferframebuffer.cpp index ceec27c79e..e2c13d7cae 100644 --- a/src/abuffer/abufferframebuffer.cpp +++ b/src/abuffer/abufferframebuffer.cpp @@ -33,7 +33,7 @@ #include namespace { - std::string _loggerCat = "ABufferSingleLinked"; + std::string _loggerCat = "ABufferFrameBuffer"; } namespace openspace { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 2ad9e0a6e7..bd846fcaec 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -98,8 +98,8 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName) , _commandlineParser(new ghoul::cmdparser::CommandlineParser(programName, true)) , _console(new LuaConsole) , _gui(new gui::GUI) - , _syncBuffer(nullptr) , _isMaster(false) + , _syncBuffer(nullptr) { SpiceManager::initialize(); Time::initialize(); @@ -148,6 +148,13 @@ bool OpenSpaceEngine::create( LDEBUG("Initialize FileSystem"); ghoul::filesystem::FileSystem::initialize(); +#ifdef __APPLE__ + ghoul::filesystem::File app(argv[0]); + std::string dirName = app.directoryName(); + LINFO("Setting starting directory to '" << dirName << "'"); + FileSys.setCurrentDirectory(dirName); +#endif + // Sanity check of values if (argc < 1 || argv == nullptr) { LFATAL("No arguments were passed to this function"); @@ -585,7 +592,6 @@ void OpenSpaceEngine::preSynchronization() { void OpenSpaceEngine::postSynchronizationPreDraw() { Time::ref().postSynchronizationPreDraw(); - bool d = Time::ref().timeJumped(); _scriptEngine->postSynchronizationPreDraw(); _renderEngine->postSynchronizationPreDraw(); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 4e7b0780ae..f022906ac1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -35,7 +35,6 @@ #include #include -#include #include #include #include @@ -84,7 +83,7 @@ namespace { -1.0f, 1.0f, 0.0f, 1.0f ); _program->activate(); - _program->setUniform("tex", unit.glEnum()); + _program->setUniform("tex", unit); _program->setUniform("ortho", ortho); // Grow our buffer according to what we need @@ -116,7 +115,6 @@ namespace { for (int n = 0; n < nCommandLists; ++n) { const ImDrawList* cmd_list = commandLists[n]; int vtx_offset = cmd_offset; - const ImDrawCmd* pcmd_end = cmd_list->commands.end(); for (auto pcmd : cmd_list->commands) { glScissor((int)pcmd.clip_rect.x, (int)(height - pcmd.clip_rect.w), (int)(pcmd.clip_rect.z - pcmd.clip_rect.x), (int)(pcmd.clip_rect.w - pcmd.clip_rect.y)); glDrawArrays(GL_TRIANGLES, vtx_offset, pcmd.vtx_count); @@ -132,79 +130,16 @@ namespace { } } -//void renderIntProperty(Property* prop, const std::string& ownerName) { -// IntProperty* p = static_cast(prop); -// std::string name = p->guiName(); -// -// IntProperty::ValueType value = *p; -// ImGui::SliderInt((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue()); -// p->set(value); -//} -// -//void renderFloatProperty(Property* prop, const std::string& ownerName) { -// FloatProperty* p = static_cast(prop); -// std::string name = p->guiName(); -// -// FloatProperty::ValueType value = *p; -// ImGui::SliderFloat((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue()); -// p->set(value); -//} -// -//void renderVec2Property(Property* prop, const std::string& ownerName) { -// Vec2Property* p = static_cast(prop); -// std::string name = p->guiName(); -// -// Vec2Property::ValueType value = *p; -// -// ImGui::SliderFloat2((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x); -// p->set(value); -//} -// -//void renderVec3Property(Property* prop, const std::string& ownerName) { -// Vec3Property* p = static_cast(prop); -// std::string name = p->guiName(); -// -// Vec3Property::ValueType value = *p; -// -// ImGui::SliderFloat3((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x); -// p->set(value); -//} -// -//void renderVec4Property(Property* prop, const std::string& ownerName) { -// Vec4Property* p = static_cast(prop); -// std::string name = p->guiName(); -// -// Vec4Property::ValueType value = *p; -// -// ImGui::SliderFloat4((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x); -// p->set(value); -//} -// -//void renderTriggerProperty(Property* prop, const std::string& ownerName) { -// std::string name = prop->guiName(); -// bool pressed = ImGui::Button((ownerName + "." + name).c_str()); -// if (pressed) -// prop->set(0); -//} -// -//} - namespace openspace { namespace gui { GUI::GUI() : _isEnabled(false) - //, _showPropertyWindow(false) - //, _showPerformanceWindow(false) , _showHelp(false) - //, _performanceMemory(nullptr) { - //_minMaxValues[0] = 100.f; - //_minMaxValues[1] = 1000.f; } GUI::~GUI() { - //delete _performanceMemory; ImGui::Shutdown(); } @@ -267,8 +202,8 @@ void GUI::initializeGL() { positionLocation = glGetAttribLocation(*_program, "in_position"); uvLocation = glGetAttribLocation(*_program, "in_uv"); colorLocation = glGetAttribLocation(*_program, "in_color"); - - glGenTextures(1, &fontTex); + + glGenTextures(1, &fontTex); glBindTexture(GL_TEXTURE_2D, fontTex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -296,47 +231,11 @@ void GUI::initializeGL() { glVertexAttribPointer(colorLocation, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)offsetof(ImDrawVert, col)); glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); + _property.initializeGL(); _performance.initializeGL(); _help.initializeGL(); - //if (!_program) { - // LERROR("Could not load program object for GUI"); - // return; - //} - // - // positionLocation = glGetAttribLocation(*_program, "in_position"); - // uvLocation = glGetAttribLocation(*_program, "in_uv"); - // colorLocation = glGetAttribLocation(*_program, "in_color"); - - // glGenTextures(1, &fontTex); - // glBindTexture(GL_TEXTURE_2D, fontTex); - // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - // const void* png_data; - // unsigned int png_size; - // ImGui::GetDefaultFontData(NULL, NULL, &png_data, &png_size); - // int tex_x, tex_y, tex_comp; - // void* tex_data = stbi_load_from_memory((const unsigned char*)png_data, (int)png_size, &tex_x, &tex_y, &tex_comp, 0); - // glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_x, tex_y, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex_data); - // stbi_image_free(tex_data); - - // glGenBuffers(1, &vbo); - // glBindBuffer(GL_ARRAY_BUFFER, vbo); - // glBufferData(GL_ARRAY_BUFFER, vboMaxSize, NULL, GL_DYNAMIC_DRAW); - - // glGenVertexArrays(1, &vao); - // glBindVertexArray(vao); - // glBindBuffer(GL_ARRAY_BUFFER, vbo); - // glEnableVertexAttribArray(positionLocation); - // glEnableVertexAttribArray(uvLocation); - // glEnableVertexAttribArray(colorLocation); - - // glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*) offsetof(ImDrawVert, pos)); - // glVertexAttribPointer(uvLocation, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*) offsetof(ImDrawVert, uv)); - // glVertexAttribPointer(colorLocation, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*) offsetof(ImDrawVert, col)); - // glBindVertexArray(0); - // glBindBuffer(GL_ARRAY_BUFFER, 0); } void GUI::deinitializeGL() { @@ -357,10 +256,15 @@ void GUI::startFrame(float deltaTime, const glm::vec2& mousePos, bool mouseButtonsPressed[2]) { + ImGuiIO& io = ImGui::GetIO(); io.DisplaySize = ImVec2(windowSize.x, windowSize.y); io.DeltaTime = deltaTime; - io.MousePos = ImVec2(mousePos.x, mousePos.y); +#ifdef __APPLE__ + io.MousePos = ImVec2(mousePos.x * 2, mousePos.y * 2); +#else + io.MousePos = ImVec2(mousePos.x, mousePos.y); +#endif io.MouseDown[0] = mouseButtonsPressed[0]; io.MouseDown[1] = mouseButtonsPressed[1]; @@ -368,7 +272,6 @@ void GUI::startFrame(float deltaTime, } void GUI::endFrame() { - static bool show = true; renderMainWindow(); if (_property.isEnabled()) diff --git a/src/gui/guiperformancecomponent.cpp b/src/gui/guiperformancecomponent.cpp index 986bdad7f6..eca3734915 100644 --- a/src/gui/guiperformancecomponent.cpp +++ b/src/gui/guiperformancecomponent.cpp @@ -49,7 +49,7 @@ void GuiPerformanceComponent::deinitialize() { void GuiPerformanceComponent::render() { // Copy and paste from renderengine.cpp::storePerformanceMeasurements method - const int8_t Version = 0; +// const int8_t Version = 0; const int nValues = 250; const int lengthName = 256; const int maxValues = 256; diff --git a/src/main.cpp b/src/main.cpp index d7a851db0f..0b7e94a4d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -259,6 +259,7 @@ void postFXPass(){ } void setupPostFX(){ +#ifndef __APPLE__ sgct::PostFX fx[1]; sgct::ShaderProgram *shader; fx[0].init("OpacityControl", absPath("${SHADERS}/postFX_vs.glsl"), absPath("${SHADERS}/postFX_fs.glsl")); @@ -269,4 +270,5 @@ void setupPostFX(){ _postFXOpacityLoc = shader->getUniformLocation("Opacity"); shader->unbind(); _sgctEngine->addPostFX(fx[0]); +#endif } diff --git a/src/properties/selectionproperty.cpp b/src/properties/selectionproperty.cpp index 31fde408d1..56bcf2abd0 100644 --- a/src/properties/selectionproperty.cpp +++ b/src/properties/selectionproperty.cpp @@ -67,16 +67,14 @@ std::vector PropertyDelegate>>::fromLuaVa std::vector result; - if (!lua_istable(state, -1)) { + if (!lua_istable(state, VAL)) { LERROR("Parameter passed to the property is not a table"); success = false; return result; } lua_pushnil(state); - while (lua_next(state, -2) != 0) { - int valueType = lua_type(state, VAL); - + while (lua_next(state, KEY) != 0) { if (lua_isnumber(state, VAL)) { int number = static_cast(lua_tonumber(state, VAL)); result.push_back(number); diff --git a/src/rendering/model/renderablemodel.cpp b/src/rendering/model/renderablemodel.cpp index f3480cb0fa..a68e2d5727 100644 --- a/src/rendering/model/renderablemodel.cpp +++ b/src/rendering/model/renderablemodel.cpp @@ -63,14 +63,14 @@ namespace openspace { RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _colorTexturePath("colorTexture", "Color Texture") + , _performFade("performFading", "Perform Fading", false) + , _fading("fading", "Fade", 0) , _programObject(nullptr) , _texture(nullptr) - , _geometry(nullptr) - , _isGhost(false) - , _performShading("performShading", "Perform Shading", true) - , _alpha(1.f) - , _fading("fading", "Fade", 0) - , _performFade("performFading", "Perform Fading", false) + , _geometry(nullptr) + , _alpha(1.f) + , _isGhost(false) + , _performShading("performShading", "Perform Shading", true) , _frameCount(0) { std::string name; diff --git a/src/rendering/model/wavefrontgeometry.cpp b/src/rendering/model/wavefrontgeometry.cpp index 23e88ab9f8..4d7df39c73 100644 --- a/src/rendering/model/wavefrontgeometry.cpp +++ b/src/rendering/model/wavefrontgeometry.cpp @@ -31,7 +31,7 @@ namespace { const std::string _loggerCat = "WavefrontGeometry"; const std::string keyObjFile = "ObjFile"; - const int8_t CurrentCacheVersion = 3; +// const int8_t CurrentCacheVersion = 3; } namespace openspace { @@ -87,7 +87,6 @@ bool WavefrontGeometry::loadModel(const std::string& filename) { // We add all shapes of the model into the same vertex array, one after the other // The _shapeCounts array stores for each shape, how many vertices that shape has size_t currentPosition = 0; - int currentIndices = 0; size_t p = 0; for (int i = 0; i < shapes.size(); ++i) { for (int j = 0; j < shapes[i].mesh.positions.size() / 3; ++j) { diff --git a/src/rendering/planets/renderableplanet.cpp b/src/rendering/planets/renderableplanet.cpp index 76fcf69dc9..3eddfe5e7b 100644 --- a/src/rendering/planets/renderableplanet.cpp +++ b/src/rendering/planets/renderableplanet.cpp @@ -56,15 +56,15 @@ namespace openspace { RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _colorTexturePath("colorTexture", "Color Texture") - , _nightTexturePath("") , _programObject(nullptr) , _texture(nullptr) , _nightTexture(nullptr) , _geometry(nullptr) , _performShading("performShading", "Perform Shading", true) , _rotation("rotation", "Rotation", 0, 0, 360) - , _hasNightTexture(false) , _alpha(1.f) + , _nightTexturePath("") + , _hasNightTexture(false) { std::string name; bool success = dictionary.getValue(constants::scenegraphnode::keyName, name); diff --git a/src/rendering/planets/renderableplanetprojection.cpp b/src/rendering/planets/renderableplanetprojection.cpp index 533fb5bc17..a0cb398db5 100644 --- a/src/rendering/planets/renderableplanetprojection.cpp +++ b/src/rendering/planets/renderableplanetprojection.cpp @@ -86,16 +86,18 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& : Renderable(dictionary) , _colorTexturePath("planetTexture", "RGB Texture") , _projectionTexturePath("projectionTexture", "RGB Texture") + , _rotation("rotation", "Rotation", 0, 0, 360) , _fadeProjection("fadeProjections", "Image Fading Factor", 0.f, 0.f, 1.f) + , _performProjection("performProjection", "Perform Projections", true) + , _clearAllProjections("clearAllProjections", "Clear Projections", false) , _programObject(nullptr) , _fboProgramObject(nullptr) , _texture(nullptr) - , _textureProj(nullptr) , _textureOriginal(nullptr) + , _textureProj(nullptr) , _textureWhiteSquare(nullptr) , _geometry(nullptr) - , _rotation("rotation", "Rotation", 0, 0, 360) - , _performProjection("performProjection", "Perform Projections", true) + , _clearingImage(absPath("${OPENSPACE_DATA}/scene/common/textures/clear.png")) { std::string name; bool success = dictionary.getValue(constants::scenegraphnode::keyName, name); @@ -166,6 +168,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& addProperty(_rotation); addProperty(_fadeProjection); addProperty(_performProjection); + addProperty(_clearAllProjections); addProperty(_colorTexturePath); _colorTexturePath.onChange(std::bind(&RenderablePlanetProjection::loadTexture, this)); @@ -234,7 +237,7 @@ bool RenderablePlanetProjection::initialize(){ } bool RenderablePlanetProjection::auxiliaryRendertarget(){ - bool completeSuccess = false; + bool completeSuccess = true; // setup FBO glGenFramebuffers(1, &_fboID); glBindFramebuffer(GL_FRAMEBUFFER, _fboID); @@ -431,12 +434,23 @@ void RenderablePlanetProjection::project(){ _capture = false; } +void RenderablePlanetProjection::clearAllProjections(){ + float tmp = _fadeProjection; + _fadeProjection = 1.f; + _projectionTexturePath = _clearingImage; + imageProjectGPU(); + _fadeProjection = tmp; + _clearAllProjections = false; +} + #define GPU_PROJ void RenderablePlanetProjection::render(const RenderData& data){ if (!_programObject) return; if (!_textureProj) return; + if (_clearAllProjections) clearAllProjections(); + _camScaling = data.camera.scaling(); _up = data.camera.lookUpVector(); diff --git a/src/rendering/renderable.cpp b/src/rendering/renderable.cpp index 480ad11ebc..1f9e0780fb 100644 --- a/src/rendering/renderable.cpp +++ b/src/rendering/renderable.cpp @@ -71,12 +71,12 @@ Renderable* Renderable::createFromDictionary(const ghoul::Dictionary& dictionary } Renderable::Renderable(const ghoul::Dictionary& dictionary) - : _enabled("enabled", "Is Enabled", true), - _hasTimeInterval(false), - _startTime(""), - _endTime(""), - _targetBody(""), - _hasBody(false) + : _enabled("enabled", "Is Enabled", true) + , _startTime("") + , _endTime("") + , _targetBody("") + , _hasBody(false) + , _hasTimeInterval(false) { setName("renderable"); #ifndef NDEBUG diff --git a/src/rendering/renderablecrawlingline.cpp b/src/rendering/renderablecrawlingline.cpp index a4f8d1a2c9..3e1166a890 100644 --- a/src/rendering/renderablecrawlingline.cpp +++ b/src/rendering/renderablecrawlingline.cpp @@ -165,6 +165,8 @@ void RenderableCrawlingLine::update(const UpdateData& data) { glm::dvec3 boresight; bool found = openspace::SpiceManager::ref().getFieldOfView(_source, shape, instrument, boresight, bounds); + if (!found) + LERROR("Could not find field of view for instrument"); glm::vec4 target(boresight[0], boresight[1], boresight[2], 12); target = tmp * target; diff --git a/src/rendering/renderablefieldlines.cpp b/src/rendering/renderablefieldlines.cpp index 4baa19bacb..06babef237 100644 --- a/src/rendering/renderablefieldlines.cpp +++ b/src/rendering/renderablefieldlines.cpp @@ -84,12 +84,12 @@ RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary) ) , _seedPointSource("source", "SeedPoint Source") , _seedPointSourceFile("sourceFile", "SeedPoint File") + , _program(nullptr) + , _programIsDirty(false) , _seedPointsAreDirty(true) , _fieldLinesAreDirty(true) - , _fieldlineVAO(0) - , _vertexPositionBuffer(0) - , _program(nullptr) - , _programIsDirty(false) + , _fieldlineVAO(0) + , _vertexPositionBuffer(0) { ghoul_assert( dictionary.hasKeyAndValue(constants::scenegraphnode::keyName), diff --git a/src/rendering/renderablefov.cpp b/src/rendering/renderablefov.cpp index a81d41c5ba..7f4f3fd54b 100644 --- a/src/rendering/renderablefov.cpp +++ b/src/rendering/renderablefov.cpp @@ -70,9 +70,9 @@ namespace openspace { RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _lineWidth("lineWidth", "Line Width", 1.f, 1.f, 20.f) + , _drawSolid("solidDraw", "Draw as Quads", false) , _programObject(nullptr) , _texture(nullptr) - , _drawSolid("solidDraw", "Draw as Quads", false) , _mode(GL_LINES) { bool success = dictionary.getValue(keyBody, _spacecraft); diff --git a/src/rendering/renderablepath.cpp b/src/rendering/renderablepath.cpp index 5e2b6702e9..a5185ece21 100644 --- a/src/rendering/renderablepath.cpp +++ b/src/rendering/renderablepath.cpp @@ -60,13 +60,15 @@ RenderablePath::RenderablePath(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _lineFade("lineFade", "Line Fade", 0.75f, 0.f, 5.f) , _lineWidth("lineWidth", "Line Width", 2.f, 1.f, 20.f) + , _drawLine("drawline", "Draw Line", false) , _programObject(nullptr) , _programIsDirty(true) + , _successfullDictionaryFetch(true) , _vaoID(0) , _vBufferID(0) - , _successfullDictionaryFetch(true) , _needsSweep(true) - , _drawLine("drawline", "Draw Line", false) + , _start(0.0) + , _stop(0.0) { _successfullDictionaryFetch &= dictionary.getValue(keyBody, _target); _successfullDictionaryFetch &= dictionary.getValue(keyObserver, _observer); @@ -78,7 +80,7 @@ RenderablePath::RenderablePath(const ghoul::Dictionary& dictionary) dictionary.getValue(keyColor, color); _lineColor = color; - bool drawLine; + bool drawLine = false; if (dictionary.hasKeyAndValue(keyDrawLine)) dictionary.getValue(keyDrawLine, drawLine); _drawLine = drawLine; @@ -215,7 +217,6 @@ void RenderablePath::calculatePath(std::string observer) { //float r, g, b; //float g = _lineColor[1]; //float b = _lineColor[2]; - float a = 1.f; for (int i = 0; i < segments; i++) { correctPosition = SpiceManager::ref().getTargetPosition(_target, observer, _frame, "NONE", currentTime, pscPos, lightTime); pscPos[3] += 3; diff --git a/src/rendering/renderableplane.cpp b/src/rendering/renderableplane.cpp index 2212d527f3..a986c10985 100644 --- a/src/rendering/renderableplane.cpp +++ b/src/rendering/renderableplane.cpp @@ -55,8 +55,8 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary) , _origin(Origin::Center) , _shader(nullptr) , _programIsDirty(false) - , _texture(nullptr) , _textureIsDirty(false) + , _texture(nullptr) , _quad(0) , _vertexPositionBuffer(0) { diff --git a/src/rendering/renderableplaneprojection.cpp b/src/rendering/renderableplaneprojection.cpp index c5a129b6f2..fed5ad02f6 100644 --- a/src/rendering/renderableplaneprojection.cpp +++ b/src/rendering/renderableplaneprojection.cpp @@ -49,18 +49,17 @@ using namespace constants::renderableplaneprojection; RenderablePlaneProjection::RenderablePlaneProjection(const ghoul::Dictionary& dictionary) : Renderable(dictionary) + , _texturePath("") + , _planeIsDirty(false) , _shader(nullptr) , _programIsDirty(false) + , _textureIsDirty(false) , _texture(nullptr) - , _textureIsDirty(false) , _quad(0) , _vertexPositionBuffer(0) , _name("ImagePlane") - , _texturePath("") - , _planeIsDirty(false) , _previousTime(0) { - dictionary.getValue(keySpacecraft, _spacecraft); dictionary.getValue(keyInstrument, _instrument); dictionary.getValue(keyMoving, _moving); @@ -128,7 +127,6 @@ void RenderablePlaneProjection::render(const RenderData& data) { _shader->setUniform("ModelTransform", transform); setPscUniforms(_shader, &data.camera, data.position); - data.position; ghoul::opengl::TextureUnit unit; unit.activate(); _texture->bind(); diff --git a/src/rendering/renderabletrail.cpp b/src/rendering/renderabletrail.cpp index 4898c00a91..04172a4b05 100644 --- a/src/rendering/renderabletrail.cpp +++ b/src/rendering/renderabletrail.cpp @@ -62,14 +62,14 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary) , _lineColor("lineColor", "Line Color") , _lineFade("lineFade", "Line Fade", 0.75f, 0.f, 5.f) , _lineWidth("lineWidth", "Line Width", 2.f, 1.f, 20.f) + , _showTimestamps("timestamps", "Show Timestamps", false) , _programObject(nullptr) , _programIsDirty(true) + , _successfullDictionaryFetch(true) , _vaoID(0) , _vBufferID(0) - , _oldTime(std::numeric_limits::max()) - , _successfullDictionaryFetch(true) , _needsSweep(true) - , _showTimestamps("timestamps", "Show Timestamps", false) + , _oldTime(std::numeric_limits::max()) { _successfullDictionaryFetch &= dictionary.getValue(keyBody, _target); _successfullDictionaryFetch &= dictionary.getValue(keyObserver, _observer); @@ -213,7 +213,7 @@ void RenderableTrail::update(const UpdateData& data) { // keep the first entry in the array floating and always pointing to the current date // As soon as the time difference between the current time and the last time is bigger // than the fixed distance, we need to create a new fixed point - double deltaTime = abs(data.time - _oldTime); + double deltaTime = std::abs(data.time - _oldTime); int nValues = static_cast(floor(deltaTime / _increment)); // Update the floating current time @@ -283,7 +283,6 @@ void RenderableTrail::fullYearSweep(double time) { _oldTime = time; psc pscPos; - bool validPosition = true; _vertexArray.resize(segments+2); for (int i = 0; i < segments+2; i++) { //if (start > time) diff --git a/src/rendering/renderablevolumegl.cpp b/src/rendering/renderablevolumegl.cpp index b288ee45dc..80a2a583a8 100644 --- a/src/rendering/renderablevolumegl.cpp +++ b/src/rendering/renderablevolumegl.cpp @@ -52,10 +52,10 @@ RenderableVolumeGL::RenderableVolumeGL(const ghoul::Dictionary& dictionary) : RenderableVolume(dictionary) , _transferFunctionName("") , _volumeName("") - , _boxArray(0) - , _vertexPositionBuffer(0) , _volume(nullptr) , _transferFunction(nullptr) + , _boxArray(0) + , _vertexPositionBuffer(0) , _boxProgram(nullptr) , _boxScaling(1.0, 1.0, 1.0) , _w(0.f) diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 206f48d848..6e56d9d780 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -223,13 +223,13 @@ namespace openspace { , _takeScreenshot(false) , _doPerformanceMeasurements(false) , _performanceMemory(nullptr) - , _visualizeABuffer(false) - , _visualizer(nullptr) , _globalBlackOutFactor(0.f) , _fadeDuration(2.f) , _currentFadeTime(0.f) , _fadeDirection(0) , _sgctRenderStatisticsVisible(false) + , _visualizeABuffer(false) + , _visualizer(nullptr) { _onScreenInformation = { glm::vec2(0.f), @@ -460,8 +460,11 @@ namespace openspace { glDisable(GL_BLEND); #else glEnable(GL_DEPTH_TEST); - glDisable(GL_CULL_FACE); - glDisable(GL_BLEND); +// glDisable(GL_CULL_FACE); + glEnable(GL_CULL_FACE); +// glDisable(GL_BLEND); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); #endif // setup the camera for the current frame diff --git a/src/rendering/stars/renderablestars.cpp b/src/rendering/stars/renderablestars.cpp index d607724816..bf8aa1886f 100644 --- a/src/rendering/stars/renderablestars.cpp +++ b/src/rendering/stars/renderablestars.cpp @@ -174,6 +174,9 @@ bool RenderableStars::deinitialize() { } void RenderableStars::render(const RenderData& data) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); + _program->activate(); // @Check overwriting the scaling from the camera; error as parsec->meter conversion @@ -217,6 +220,8 @@ void RenderableStars::render(const RenderData& data) { glBindVertexArray(0); _program->setIgnoreUniformLocationError(false); _program->deactivate(); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } void RenderableStars::update(const UpdateData& data) { diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index bcc8dac5a1..3ce1d2f7ab 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -467,7 +467,6 @@ bool Scene::loadSceneInternal(const std::string& sceneDescriptionFilePath) { glm::vec2 cameraScaling(1); psc cameraPosition(0,0,1,0); - glm::vec3 cameraDirection = glm::vec3(0, 0, -1); //if (_focus->) if (focusIterator != _graph.nodes().end()) { @@ -525,7 +524,6 @@ bool Scene::loadSceneInternal(const std::string& sceneDescriptionFilePath) { // the camera position const SceneGraphNode* fn = OsEng.interactionHandler()->focusNode(); //psc relative = fn->worldPosition() - c->position(); - psc relative = fn->worldPosition() - cameraPosition; glm::mat4 la = glm::lookAt(cameraPosition.vec3(), fn->worldPosition().vec3(), c->lookUpVector()); diff --git a/src/scene/scenegraph.cpp b/src/scene/scenegraph.cpp index fdc5819c97..bc4a0bf59b 100644 --- a/src/scene/scenegraph.cpp +++ b/src/scene/scenegraph.cpp @@ -315,7 +315,8 @@ bool SceneGraph::sortTopologially() { } } - return true; + + return true; } bool SceneGraph::addSceneGraphNode(SceneGraphNode* node) { diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index d57109125e..f0e13470fa 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -126,10 +126,10 @@ SceneGraphNode* SceneGraphNode::createFromDictionary(const ghoul::Dictionary& di SceneGraphNode::SceneGraphNode() : _parent(nullptr) , _ephemeris(new StaticEphemeris) + , _performanceRecord({0, 0, 0}) , _renderable(nullptr) , _renderableVisible(false) , _boundingSphereVisible(false) - , _performanceRecord({0, 0, 0}) { } diff --git a/src/util/camera.cpp b/src/util/camera.cpp index b7625c4826..3ee138bfd4 100644 --- a/src/util/camera.cpp +++ b/src/util/camera.cpp @@ -38,23 +38,23 @@ namespace openspace { Camera::Camera() : _maxFov(0.f) , _sinMaxFov(0.f) - , _localPosition() , _viewProjectionMatrix() , _modelMatrix() , _viewMatrix() , _projectionMatrix() , _viewDirection(0,0,-1) , _cameraDirection(0.f, 0.f, 0.f) - , _localScaling(1.f, 0.f) + , _focusPosition() //, _viewRotation(glm::quat(glm::vec3(0.f, 0.f, 0.f))) , _localViewRotationMatrix(1.f) + , _localScaling(1.f, 0.f) + , _localPosition() + , _sharedScaling(1.f, 0.f) , _sharedPosition() - , _sharedScaling(1.f, 0.f) , _sharedViewRotationMatrix(1.f) - , _syncedPosition() , _syncedScaling(1.f, 0.f) + , _syncedPosition() , _syncedViewRotationMatrix(1.f) - , _focusPosition() { } diff --git a/src/util/hongkangparser.cpp b/src/util/hongkangparser.cpp index b168f0e1a1..df8748c7d5 100644 --- a/src/util/hongkangparser.cpp +++ b/src/util/hongkangparser.cpp @@ -129,8 +129,6 @@ void HongKangParser::create(){ std::string cameraTarget = "VOID"; std::string scannerTarget = "VOID"; - int counter = 0; - while (!file.eof()){//only while inte do, FIX std::getline(file, line); @@ -338,14 +336,13 @@ double HongKangParser::getETfromMet(std::string line){ double HongKangParser::getETfromMet(double met){ double diff; double referenceET; - double et; openspace::SpiceManager::ref().getETfromDate("2015-07-14T11:50:00.00", referenceET); - double missionLaunch = referenceET - _metRef; + double et = referenceET; - diff = abs(met - _metRef); + diff = std::abs(met - _metRef); if (met > _metRef){ et = referenceET + diff; - }else if (met < _metRef){ + } else if (met < _metRef){ et = referenceET - diff; } return et; diff --git a/src/util/imagesequencer.cpp b/src/util/imagesequencer.cpp index a2541beb9a..80c2ea4b30 100644 --- a/src/util/imagesequencer.cpp +++ b/src/util/imagesequencer.cpp @@ -78,8 +78,8 @@ ImageSequencer::ImageSequencer() : _nextCapture(-1.0) , _currentTime(-1.0) , _sequenceIDs(0) - , _targetsAdded(false) , _defaultCaptureImage(absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder_blank.png")) + , _targetsAdded(false) {} @@ -380,7 +380,7 @@ double ImageSequencer::getMissionElapsedTime(std::string timestr){ //met ref time. openspace::SpiceManager::ref().getETfromDate("2015-07-14T11:50:00.00", et); - diff = abs(met - _metRef); + diff = std::abs(met - _metRef); if (met > _metRef){ et += diff; } @@ -466,7 +466,6 @@ bool ImageSequencer::parsePlaybookFile(const std::string& fileName, int& sequenc if (!file.good()) LERROR("Failed to open txt file '" << fileName << "'"); std::string timestr = ""; - double shutter = 0.01; double et; //@TODO: change similar to renderableFOV diff --git a/src/util/imagesequencer2.cpp b/src/util/imagesequencer2.cpp index 0d32115567..41ffa1d74a 100644 --- a/src/util/imagesequencer2.cpp +++ b/src/util/imagesequencer2.cpp @@ -45,10 +45,10 @@ namespace openspace { ImageSequencer2* ImageSequencer2::_instance = nullptr; -ImageSequencer2::ImageSequencer2() : -_hasData(false), -_latestImage(), -_defaultCaptureImage(absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder_blank.png")) +ImageSequencer2::ImageSequencer2() + : _defaultCaptureImage(absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder_blank.png")) + , _latestImage() + , _hasData(false) {} ImageSequencer2& ImageSequencer2::ref() { @@ -74,7 +74,7 @@ void ImageSequencer2::updateSequencer(double time){ Time::ref().setDeltaTime(0.1); } // Time is not properly updated when time jump with dt = 0 - if (_currentTime < time){ + if (_currentTime != time){ _previousTime = _currentTime; _currentTime = time; } diff --git a/src/util/labelparser.cpp b/src/util/labelparser.cpp index 3a2db8d443..8398251f44 100644 --- a/src/util/labelparser.cpp +++ b/src/util/labelparser.cpp @@ -162,6 +162,7 @@ void LabelParser::create(){ line.erase(std::remove(line.begin(), line.end(), '"'), line.end()); line.erase(std::remove(line.begin(), line.end(), ' '), line.end()); + line.erase(std::remove(line.begin(), line.end(), '\r'), line.end()); /* Add more */ if (read == "TARGET_NAME"){ diff --git a/src/util/powerscaledcoordinate.cpp b/src/util/powerscaledcoordinate.cpp index 1825109c89..7bb80e95b7 100644 --- a/src/util/powerscaledcoordinate.cpp +++ b/src/util/powerscaledcoordinate.cpp @@ -74,9 +74,9 @@ PowerScaledCoordinate char buff[600]; // find the number with maximum number of digits - double ad1 = abs(d1); - double ad2 = abs(d2); - double ad3 = abs(d3); + double ad1 = std::abs(d1); + double ad2 = std::abs(d2); + double ad3 = std::abs(d3); double max = (ad2 > ad1) ? ad2 : (ad3 > ad1) ? ad3 : ad1; // find out how many digits diff --git a/src/util/powerscaledscalar.cpp b/src/util/powerscaledscalar.cpp index cd05df2228..ce16ba45ca 100644 --- a/src/util/powerscaledscalar.cpp +++ b/src/util/powerscaledscalar.cpp @@ -53,7 +53,7 @@ PowerScaledScalar PowerScaledScalar::CreatePSS(double d1) { char buff[30]; // find the number with maximum number of digits - double ad1 = abs(d1); + double ad1 = std::abs(d1); // find out how many digits sprintf ( buff, "%.0f", ad1); diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index e80de5fc5b..1e5219021c 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -31,7 +31,7 @@ #include -#define MAXOBJ 1000 +#define MAXOBJ 64 #define WINSIZ 10000 namespace { @@ -147,7 +147,7 @@ SpiceManager::KernelIdentifier SpiceManager::loadKernel(const std::string& fileP } } -bool SpiceManager::findCkCoverage(std::string& path) { +bool SpiceManager::findCkCoverage(const std::string& path) { SpiceInt frame, numberOfIntervals; SpiceDouble b, e; std::pair tempInterval; @@ -178,7 +178,7 @@ bool SpiceManager::findCkCoverage(std::string& path) { return true; } -bool SpiceManager::findSpkCoverage(std::string& path) { +bool SpiceManager::findSpkCoverage(const std::string& path) { SpiceInt obj, numberOfIntervals; SpiceDouble b, e; std::pair tempInterval; @@ -186,7 +186,6 @@ bool SpiceManager::findSpkCoverage(std::string& path) { SPICEDOUBLE_CELL(cover, WINSIZ); spkobj_c(path.c_str(), &ids); - for (SpiceInt i = 0; i < card_c(&ids); ++i) { obj = SPICE_CELL_ELEM_I(&ids, i); @@ -820,6 +819,8 @@ bool SpiceManager::getPositionTransformMatrix(const std::string& fromFrame, bool hasError = checkForError("Error retrieving position transform matrix from " "frame '" + fromFrame + "' to frame '" + toFrame + "' at time '" + std::to_string(ephemerisTime)); + if (hasError) + return false; } positionMatrix = glm::transpose(positionMatrix); diff --git a/src/util/time.cpp b/src/util/time.cpp index 5646a2017f..4590c08064 100644 --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -172,17 +172,16 @@ int time_currentTimeUTC(lua_State* L) { Time* Time::_instance = nullptr; Time::Time() - : _time(-1.0) + : _time(-1.0) , _dt(1.0) , _timeJumped(false) , _timePaused(false) + , _sharedTime(-1.0) + , _sharedDt(1.0) + , _sharedTimeJumped(false) , _syncedTime(-1.0) , _syncedDt(1.0) , _syncedTimeJumped(false) - , _deltaTimePerSecond(1.0) - , _sharedTime(-1.0) - , _sharedDt(1.0) - , _sharedTimeJumped(false) { }