mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Code cleanup branch (#618)
* Make height map fallback layer work again * Add documentation to joystick button bindings * Removed grouped property headers * Add new version number constant generated by CMake * Make Joystick deadzone work properly * Change the startup date on Earth to today * Fix key modifier handling * Add debugging indices for TreeNodeDebugging * Fix script schedule for OsirisRex * Do not open Mission schedule automatically * Upload default projection texture automatically * General code cleanup * Fix check_style_guide warnings * Remove .clang-format * MacOS compile fixes * Clang analyzer fixes
This commit is contained in:
@@ -24,19 +24,17 @@
|
||||
|
||||
#include <modules/spacecraftinstruments/rendering/renderableplanetprojection.h>
|
||||
|
||||
#include <modules/spacecraftinstruments/spacecraftinstrumentsmodule.h>
|
||||
#include <modules/space/rendering/planetgeometry.h>
|
||||
#include <modules/spacecraftinstruments/spacecraftinstrumentsmodule.h>
|
||||
#include <modules/spacecraftinstruments/util/imagesequencer.h>
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/properties/triggerproperty.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/opengl/textureconversion.h>
|
||||
@@ -57,7 +55,7 @@ namespace {
|
||||
|
||||
constexpr const char* NoImageText = "No Image";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ColorTexturePathsInfo = {
|
||||
const openspace::properties::Property::PropertyInfo ColorTexturePathsInfo = {
|
||||
"ColorTexturePaths",
|
||||
"Color Texture",
|
||||
"The texture path selected in this property is used as the base texture that is "
|
||||
@@ -66,14 +64,14 @@ namespace {
|
||||
"asset, the last texture is used."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AddColorTextureInfo = {
|
||||
const openspace::properties::Property::PropertyInfo AddColorTextureInfo = {
|
||||
"AddColorTexture",
|
||||
"Add Color Base Texture",
|
||||
"Adds a new base color texture to the list of selectable base maps used prior to "
|
||||
"any image projection."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HeightTexturePathsInfo = {
|
||||
const openspace::properties::Property::PropertyInfo HeightTexturePathsInfo = {
|
||||
"HeightTexturePaths",
|
||||
"Heightmap Texture",
|
||||
"The texture path selected in this property is used as the height map on the "
|
||||
@@ -81,13 +79,13 @@ namespace {
|
||||
"this value is specified in an asset, the last texture is used."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AddHeightTextureInfo = {
|
||||
const openspace::properties::Property::PropertyInfo AddHeightTextureInfo = {
|
||||
"AddHeightTexture",
|
||||
"Add Heightmap Texture",
|
||||
"Adds a new height map texture to the list of selectable height maps used."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HeightExaggerationInfo = {
|
||||
const openspace::properties::Property::PropertyInfo HeightExaggerationInfo = {
|
||||
"HeightExaggeration",
|
||||
"Height Exaggeration",
|
||||
"This value determines the level of height exaggeration that is applied to a "
|
||||
@@ -95,7 +93,7 @@ namespace {
|
||||
"value of '1' uses the measured height field."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MeridianShiftInfo = {
|
||||
const openspace::properties::Property::PropertyInfo MeridianShiftInfo = {
|
||||
"MeridianShift",
|
||||
"Meridian Shift",
|
||||
"If this value is enabled, a shift of the meridian by 180 degrees is performed. "
|
||||
@@ -104,7 +102,7 @@ namespace {
|
||||
"shift."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AmbientBrightnessInfo = {
|
||||
const openspace::properties::Property::PropertyInfo AmbientBrightnessInfo = {
|
||||
"AmbientBrightness",
|
||||
"Ambient Brightness",
|
||||
"This value determines the ambient brightness of the dark side of the planet."
|
||||
@@ -175,18 +173,11 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
|
||||
: Renderable(dict)
|
||||
, _colorTexturePaths(ColorTexturePathsInfo)
|
||||
, _addColorTexturePath(AddColorTextureInfo)
|
||||
, _colorTextureDirty(false)
|
||||
, _heightMapTexturePaths(HeightTexturePathsInfo)
|
||||
, _addHeightMapTexturePath(AddHeightTextureInfo)
|
||||
, _heightMapTextureDirty(false)
|
||||
, _programObject(nullptr)
|
||||
, _fboProgramObject(nullptr)
|
||||
, _baseTexture(nullptr)
|
||||
, _heightMapTexture(nullptr)
|
||||
, _heightExaggeration(HeightExaggerationInfo, 1.f, 0.f, 1e6f, 1.f, 3.f)
|
||||
, _meridianShift(MeridianShiftInfo, false)
|
||||
, _ambientBrightness(AmbientBrightnessInfo, 0.075f, 0.f, 1.f)
|
||||
, _capture(false)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
@@ -194,13 +185,8 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
|
||||
"RenderablePlanetProjection"
|
||||
);
|
||||
|
||||
ghoul::Dictionary geometryDictionary;
|
||||
bool success = dict.getValue(KeyGeometry, geometryDictionary);
|
||||
if (success) {
|
||||
_geometry = planetgeometry::PlanetGeometry::createFromDictionary(
|
||||
geometryDictionary
|
||||
);
|
||||
}
|
||||
ghoul::Dictionary geometryDictionary = dict.value<ghoul::Dictionary>(KeyGeometry);
|
||||
_geometry = planetgeometry::PlanetGeometry::createFromDictionary(geometryDictionary);
|
||||
|
||||
_projectionComponent.initialize(
|
||||
identifier(),
|
||||
@@ -208,13 +194,11 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
|
||||
);
|
||||
|
||||
_colorTexturePaths.addOption(0, NoImageText);
|
||||
_colorTexturePaths.onChange([this](){
|
||||
_colorTextureDirty = true;
|
||||
});
|
||||
_colorTexturePaths.onChange([this](){ _colorTextureDirty = true; });
|
||||
addProperty(_colorTexturePaths);
|
||||
|
||||
if (dict.hasKey(ColorTexturePathsInfo.identifier)) {
|
||||
ghoul::Dictionary value = dict.value<ghoul::Dictionary>(
|
||||
if (dict.hasKeyAndValue<ghoul::Dictionary>(ColorTexturePathsInfo.identifier)) {
|
||||
const ghoul::Dictionary& value = dict.value<ghoul::Dictionary>(
|
||||
ColorTexturePathsInfo.identifier
|
||||
);
|
||||
|
||||
@@ -253,14 +237,12 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
|
||||
|
||||
|
||||
_heightMapTexturePaths.addOption(0, NoImageText);
|
||||
_heightMapTexturePaths.onChange([this]() {
|
||||
_heightMapTextureDirty = true;
|
||||
});
|
||||
_heightMapTexturePaths.onChange([this]() { _heightMapTextureDirty = true; });
|
||||
addProperty(_heightMapTexturePaths);
|
||||
|
||||
|
||||
if (dict.hasKey(HeightTexturePathsInfo.identifier)) {
|
||||
ghoul::Dictionary value = dict.value<ghoul::Dictionary>(
|
||||
if (dict.hasKeyAndValue<ghoul::Dictionary>(HeightTexturePathsInfo.identifier)) {
|
||||
const ghoul::Dictionary& value = dict.value<ghoul::Dictionary>(
|
||||
HeightTexturePathsInfo.identifier
|
||||
);
|
||||
|
||||
@@ -318,7 +300,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
|
||||
addProperty(_ambientBrightness);
|
||||
}
|
||||
|
||||
RenderablePlanetProjection::~RenderablePlanetProjection() {}
|
||||
RenderablePlanetProjection::~RenderablePlanetProjection() {} // NOLINT
|
||||
|
||||
void RenderablePlanetProjection::initializeGL() {
|
||||
_programObject =
|
||||
@@ -395,37 +377,36 @@ void RenderablePlanetProjection::initializeGL() {
|
||||
loadColorTexture();
|
||||
loadHeightTexture();
|
||||
_projectionComponent.initializeGL();
|
||||
_geometry->initialize(this);
|
||||
_geometry->initialize();
|
||||
setBoundingSphere(_geometry->boundingSphere());
|
||||
|
||||
//completeSuccess &= auxiliaryRendertarget();
|
||||
// SCREEN-QUAD
|
||||
const GLfloat size = 1.f;
|
||||
const GLfloat w = 1.f;
|
||||
const GLfloat vertex_data[] = {
|
||||
-size, -size, 0.f, w, 0.f, 0.f,
|
||||
size, size, 0.f, w, 1.f, 1.f,
|
||||
-size, size, 0.f, w, 0.f, 1.f,
|
||||
-size, -size, 0.f, w, 0.f, 0.f,
|
||||
size, -size, 0.f, w, 1.f, 0.f,
|
||||
size, size, 0.f, w, 1.f, 1.f,
|
||||
const GLfloat vertexData[] = {
|
||||
-1.f, -1.f,
|
||||
1.f, 1.f,
|
||||
-1.f, 1.f,
|
||||
-1.f, -1.f,
|
||||
1.f, -1.f,
|
||||
1.f, 1.f,
|
||||
};
|
||||
|
||||
glGenVertexArrays(1, &_quad);
|
||||
glBindVertexArray(_quad);
|
||||
glGenBuffers(1, &_vertexPositionBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, nullptr);
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(
|
||||
1,
|
||||
2,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
sizeof(GLfloat) * 6,
|
||||
reinterpret_cast<void*>(sizeof(GLfloat) * 4)
|
||||
);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 2, nullptr);
|
||||
// glEnableVertexAttribArray(1);
|
||||
// glVertexAttribPointer(
|
||||
// 1,
|
||||
// 2,
|
||||
// GL_FLOAT,
|
||||
// GL_FALSE,
|
||||
// sizeof(GLfloat) * 2,
|
||||
// reinterpret_cast<void*>(sizeof(GLfloat) * 4)
|
||||
// );
|
||||
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
@@ -578,12 +559,12 @@ void RenderablePlanetProjection::render(const RenderData& data, RendererTasks&)
|
||||
_camScaling = glm::vec2(1.f, 0.f); // Unit scaling
|
||||
_up = data.camera.lookUpVectorCameraSpace();
|
||||
|
||||
if (_capture && _projectionComponent.doesPerformProjection()) {
|
||||
if (_shouldCapture && _projectionComponent.doesPerformProjection()) {
|
||||
for (const Image& img : _imageTimes) {
|
||||
RenderablePlanetProjection::attitudeParameters(img.timeRange.start);
|
||||
imageProjectGPU(_projectionComponent.loadProjectionTexture(img.path));
|
||||
}
|
||||
_capture = false;
|
||||
_shouldCapture = false;
|
||||
}
|
||||
attitudeParameters(_time);
|
||||
_imageTimes.clear();
|
||||
@@ -745,7 +726,7 @@ void RenderablePlanetProjection::update(const UpdateData& data) {
|
||||
if (openspace::ImageSequencer::ref().isReady()) {
|
||||
openspace::ImageSequencer::ref().updateSequencer(time);
|
||||
if (_projectionComponent.doesPerformProjection()) {
|
||||
_capture = openspace::ImageSequencer::ref().getImagePaths(
|
||||
_shouldCapture = openspace::ImageSequencer::ref().imagePaths(
|
||||
_imageTimes,
|
||||
_projectionComponent.projecteeId(),
|
||||
_projectionComponent.instrumentId(),
|
||||
|
||||
Reference in New Issue
Block a user