Merge branch 'develop' of openspace.itn.liu.se:/openspace into develop

Conflicts:
	src/rendering/model/renderablemodel.cpp
	src/rendering/renderablecrawlingline.cpp
	src/rendering/renderableplaneprojection.cpp
This commit is contained in:
Anton Arbring
2015-05-13 16:44:03 -04:00
57 changed files with 198 additions and 259 deletions

View File

@@ -1,4 +1,6 @@
Alexander Bock
Patric Ljung
Joakim Kilby
Jonas Strandstedt
Hans-Christian Helltegen
Hans-Christian Helltegen
Michal Marcinkowski
Anton Arbring

View File

@@ -111,7 +111,7 @@
#define HAVE_PLATFORM_MACROS_H
#define CSPICE_PC_MS
#define CSPICE_MAC_OSX_INTEL_64BIT_GCC
#endif

Binary file not shown.

View File

@@ -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)
target_link_libraries(TimelineView Qt5::Widgets Qt5::Network)

View File

@@ -33,7 +33,8 @@
#include <QLabel>
#include <QPushButton>
#include <QSlider>
#include <QDebug>
#include <math.h>
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;
}

View File

@@ -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<QString, QColor> 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<QString, QString> 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;

View File

@@ -117,7 +117,6 @@ private:
ghoul::cmdparser::CommandlineParser* _commandlineParser;
LuaConsole* _console;
gui::GUI* _gui;
double _dt;
bool _isMaster;
SyncBuffer* _syncBuffer;

View File

@@ -40,7 +40,7 @@ public:
Controller() :
_handler(nullptr)
{}
void setHandler(InteractionHandler* handler);
protected:

View File

@@ -34,6 +34,7 @@ namespace interaction {
class KeyboardController : public Controller {
public:
virtual ~KeyboardController() {};
virtual void keyPressed(KeyAction action, Key key, KeyModifier modifier) = 0;
};

View File

@@ -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;

View File

@@ -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;

View File

@@ -87,7 +87,6 @@ private:
float _increment;
double _oldTime = 0.0;
float _time;
float _distanceFade;
};

View File

@@ -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 <code>target</code>

View File

@@ -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

View File

@@ -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

View File

@@ -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) {

View File

@@ -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]);
}

View File

@@ -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);
}

View File

@@ -52,4 +52,8 @@ void main()
ABufferStruct_t frag = createGeometryFragment(diffuse, position, depth);
addToBuffer(frag);
gl_FragDepth = depth;
if (diffuse.a == 0.0)
discard;
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -96,6 +96,5 @@ void main()
ABufferStruct_t frag = createGeometryFragment(diffuse, position, depth);
addToBuffer(frag);
discard;
}

View File

@@ -33,7 +33,7 @@
#include <string>
namespace {
std::string _loggerCat = "ABufferSingleLinked";
std::string _loggerCat = "ABufferFrameBuffer";
}
namespace openspace {

View File

@@ -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();

View File

@@ -35,7 +35,6 @@
#include <openspace/properties/property.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/textureunit.h>
@@ -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<IntProperty*>(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<FloatProperty*>(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<Vec2Property*>(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<Vec3Property*>(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<Vec4Property*>(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())

View File

@@ -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;

View File

@@ -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
}

View File

@@ -67,16 +67,14 @@ std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaVa
std::vector<int> 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<int>(lua_tonumber(state, VAL));
result.push_back(number);

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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();

View File

@@ -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

View File

@@ -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;

View File

@@ -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<std::string>(constants::scenegraphnode::keyName),

View File

@@ -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);

View File

@@ -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<bool>(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;

View File

@@ -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)
{

View File

@@ -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();

View File

@@ -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<float>::max())
, _successfullDictionaryFetch(true)
, _needsSweep(true)
, _showTimestamps("timestamps", "Show Timestamps", false)
, _oldTime(std::numeric_limits<float>::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<int>(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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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) {

View File

@@ -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());

View File

@@ -315,7 +315,8 @@ bool SceneGraph::sortTopologially() {
}
}
return true;
return true;
}
bool SceneGraph::addSceneGraphNode(SceneGraphNode* node) {

View File

@@ -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})
{
}

View File

@@ -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()
{
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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"){

View File

@@ -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

View File

@@ -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);

View File

@@ -31,7 +31,7 @@
#include <algorithm>
#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 <double, double> 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 <double, double> 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);

View File

@@ -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)
{
}