mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-24 13:09:22 -06:00
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:
@@ -33,7 +33,7 @@
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
std::string _loggerCat = "ABufferSingleLinked";
|
||||
std::string _loggerCat = "ABufferFrameBuffer";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -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();
|
||||
|
||||
117
src/gui/gui.cpp
117
src/gui/gui.cpp
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -315,7 +315,8 @@ bool SceneGraph::sortTopologially() {
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SceneGraph::addSceneGraphNode(SceneGraphNode* node) {
|
||||
|
||||
@@ -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})
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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"){
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user