mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-26 05:58:48 -05:00
Removing more CppCheck warnings
This commit is contained in:
@@ -54,24 +54,19 @@ PlanetGeometry* PlanetGeometry::createFromDictionary(const ghoul::Dictionary& di
|
||||
}
|
||||
|
||||
PlanetGeometry::PlanetGeometry()
|
||||
//: _parent(nullptr)
|
||||
: _parent(nullptr)
|
||||
{
|
||||
setName("PlanetGeometry");
|
||||
}
|
||||
|
||||
PlanetGeometry::~PlanetGeometry()
|
||||
{
|
||||
}
|
||||
PlanetGeometry::~PlanetGeometry() {}
|
||||
|
||||
bool PlanetGeometry::initialize(Renderable* parent)
|
||||
{
|
||||
bool PlanetGeometry::initialize(Renderable* parent) {
|
||||
_parent = parent;
|
||||
return true;
|
||||
}
|
||||
|
||||
void PlanetGeometry::deinitialize()
|
||||
{
|
||||
}
|
||||
void PlanetGeometry::deinitialize() {}
|
||||
|
||||
} // namespace planetgeometry
|
||||
} // namespace openspace
|
||||
|
||||
@@ -552,14 +552,16 @@ void RenderableStars::createDataSlice(ColorOption option) {
|
||||
position[0], position[1], position[2], position[3]
|
||||
} };
|
||||
|
||||
layout.value.bvColor = _fullData[i + 3];
|
||||
layout.value.luminance = _fullData[i + 4];
|
||||
layout.value.absoluteMagnitude = _fullData[i + 5];
|
||||
|
||||
|
||||
#ifdef USING_STELLAR_TEST_GRID
|
||||
layout.value.bvColor = _fullData[i + 3];
|
||||
layout.value.luminance = _fullData[i + 3];
|
||||
layout.value.absoluteMagnitude = _fullData[i + 3];
|
||||
#else
|
||||
layout.value.bvColor = _fullData[i + 3];
|
||||
layout.value.luminance = _fullData[i + 4];
|
||||
layout.value.absoluteMagnitude = _fullData[i + 5];
|
||||
#endif
|
||||
|
||||
_slicedData.insert(_slicedData.end(),
|
||||
|
||||
@@ -71,6 +71,10 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
|
||||
, _vBufferID(0)
|
||||
, _needsSweep(true)
|
||||
, _oldTime(std::numeric_limits<double>::max())
|
||||
, _tropic(0.f)
|
||||
, _ratio(0.f)
|
||||
, _day(0.f)
|
||||
, _increment(0.f)
|
||||
{
|
||||
_successfullDictionaryFetch &= dictionary.getValue(keyBody, _target);
|
||||
_successfullDictionaryFetch &= dictionary.getValue(keyObserver, _observer);
|
||||
|
||||
@@ -41,123 +41,113 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
std::shared_ptr<DebugRenderer> DebugRenderer::_singleton = nullptr;
|
||||
DebugRenderer::DebugRenderer()
|
||||
: _programObject(OsEng.renderEngine().buildRenderProgram(
|
||||
"BasicDebugShader",
|
||||
"${MODULE_DEBUGGING}/rendering/debugshader_vs.glsl",
|
||||
"${MODULE_DEBUGGING}/rendering/debugshader_fs.glsl"
|
||||
))
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<DebugRenderer> DebugRenderer::ref() {
|
||||
static std::shared_ptr<DebugRenderer> renderer = std::make_shared<DebugRenderer>();
|
||||
return renderer;
|
||||
}
|
||||
|
||||
DebugRenderer::DebugRenderer() {
|
||||
_programObject = std::shared_ptr<ProgramObject>(OsEng.renderEngine().buildRenderProgram(
|
||||
"BasicDebugShader",
|
||||
"${MODULE_DEBUGGING}/rendering/debugshader_vs.glsl",
|
||||
"${MODULE_DEBUGGING}/rendering/debugshader_fs.glsl"
|
||||
));
|
||||
|
||||
void DebugRenderer::renderVertices(const std::vector<glm::vec4>& clippingSpacePoints, GLenum mode, glm::vec4 rgba) const {
|
||||
if (clippingSpacePoints.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<DebugRenderer> DebugRenderer::ref() {
|
||||
if (_singleton == nullptr) {
|
||||
try {
|
||||
_singleton = std::make_shared<DebugRenderer>();
|
||||
}
|
||||
catch (const ShaderObject::ShaderCompileError& e) {
|
||||
LERROR(e.what());
|
||||
}
|
||||
}
|
||||
return _singleton;
|
||||
GLuint _vaoID;
|
||||
glGenVertexArrays(1, &_vaoID);
|
||||
ghoul_assert(_vaoID != 0, "Could not generate vertex arrays");
|
||||
|
||||
GLuint _vertexBufferID;
|
||||
glGenBuffers(1, &_vertexBufferID);
|
||||
ghoul_assert(_vertexBufferID != 0, "Could not create vertex buffer");
|
||||
|
||||
_programObject->activate();
|
||||
_programObject->setUniform("color", rgba);
|
||||
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
|
||||
|
||||
// Vertex buffer
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexBufferID);
|
||||
glBufferData(
|
||||
GL_ARRAY_BUFFER,
|
||||
clippingSpacePoints.size() * sizeof(clippingSpacePoints[0]),
|
||||
&clippingSpacePoints[0],
|
||||
GL_STATIC_DRAW);
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(clippingSpacePoints[0]), 0);
|
||||
|
||||
// uniforms
|
||||
|
||||
|
||||
|
||||
glDrawArrays(mode, 0, clippingSpacePoints.size());
|
||||
GLenum error = glGetError();
|
||||
if (error != GL_NO_ERROR) {
|
||||
LERROR(error);
|
||||
}
|
||||
|
||||
void DebugRenderer::renderVertices(const std::vector<glm::vec4>& clippingSpacePoints, GLenum mode, glm::vec4 rgba) const {
|
||||
if (clippingSpacePoints.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
GLuint _vaoID;
|
||||
glGenVertexArrays(1, &_vaoID);
|
||||
ghoul_assert(_vaoID != 0, "Could not generate vertex arrays");
|
||||
|
||||
GLuint _vertexBufferID;
|
||||
glGenBuffers(1, &_vertexBufferID);
|
||||
ghoul_assert(_vertexBufferID != 0, "Could not create vertex buffer");
|
||||
|
||||
_programObject->activate();
|
||||
_programObject->setUniform("color", rgba);
|
||||
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
|
||||
|
||||
// Vertex buffer
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexBufferID);
|
||||
glBufferData(
|
||||
GL_ARRAY_BUFFER,
|
||||
clippingSpacePoints.size() * sizeof(clippingSpacePoints[0]),
|
||||
&clippingSpacePoints[0],
|
||||
GL_STATIC_DRAW);
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(clippingSpacePoints[0]), 0);
|
||||
|
||||
// uniforms
|
||||
|
||||
|
||||
|
||||
glDrawArrays(mode, 0, clippingSpacePoints.size());
|
||||
GLenum error = glGetError();
|
||||
if (error != GL_NO_ERROR) {
|
||||
LERROR(error);
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
glDeleteVertexArrays(1, &_vaoID);
|
||||
glDeleteBuffers(1, &_vertexBufferID);
|
||||
_programObject->deactivate();
|
||||
glDeleteVertexArrays(1, &_vaoID);
|
||||
glDeleteBuffers(1, &_vertexBufferID);
|
||||
_programObject->deactivate();
|
||||
|
||||
}
|
||||
|
||||
void DebugRenderer::renderBoxFaces(const std::vector<glm::vec4>& clippingSpaceBoxCorners, glm::vec4 rgba) const {
|
||||
const std::vector<glm::vec4>& V = clippingSpaceBoxCorners;
|
||||
std::vector<glm::vec4> T;
|
||||
|
||||
// add "sides";
|
||||
|
||||
T.push_back(V[1]); T.push_back(V[0]); T.push_back(V[4]);
|
||||
T.push_back(V[4]); T.push_back(V[5]); T.push_back(V[1]);
|
||||
|
||||
T.push_back(V[3]); T.push_back(V[1]); T.push_back(V[5]);
|
||||
T.push_back(V[5]); T.push_back(V[7]); T.push_back(V[3]);
|
||||
|
||||
T.push_back(V[6]); T.push_back(V[3]); T.push_back(V[7]);
|
||||
T.push_back(V[3]); T.push_back(V[6]); T.push_back(V[2]);
|
||||
|
||||
T.push_back(V[4]); T.push_back(V[2]); T.push_back(V[6]);
|
||||
T.push_back(V[2]); T.push_back(V[4]); T.push_back(V[0]);
|
||||
|
||||
// add "top"
|
||||
T.push_back(V[5]); T.push_back(V[6]); T.push_back(V[7]);
|
||||
T.push_back(V[6]); T.push_back(V[5]); T.push_back(V[4]);
|
||||
|
||||
// add bottom
|
||||
T.push_back(V[0]); T.push_back(V[1]); T.push_back(V[2]);
|
||||
T.push_back(V[3]); T.push_back(V[2]); T.push_back(V[1]);
|
||||
|
||||
renderVertices(T, GL_TRIANGLES, rgba);
|
||||
}
|
||||
|
||||
void DebugRenderer::renderBoxEdges(const std::vector<glm::vec4>& clippingSpacePoints, glm::vec4 rgba) const {
|
||||
const std::vector<glm::vec4>& V = clippingSpacePoints;
|
||||
std::vector<glm::vec4> lineVertices;
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
lineVertices.push_back(V[2 * i]);
|
||||
lineVertices.push_back(V[2 * i + 1]);
|
||||
lineVertices.push_back(V[i]);
|
||||
lineVertices.push_back(V[i + 4]);
|
||||
}
|
||||
|
||||
void DebugRenderer::renderBoxFaces(const std::vector<glm::vec4>& clippingSpaceBoxCorners, glm::vec4 rgba) const {
|
||||
const std::vector<glm::vec4>& V = clippingSpaceBoxCorners;
|
||||
std::vector<glm::vec4> T;
|
||||
|
||||
// add "sides";
|
||||
|
||||
T.push_back(V[1]); T.push_back(V[0]); T.push_back(V[4]);
|
||||
T.push_back(V[4]); T.push_back(V[5]); T.push_back(V[1]);
|
||||
|
||||
T.push_back(V[3]); T.push_back(V[1]); T.push_back(V[5]);
|
||||
T.push_back(V[5]); T.push_back(V[7]); T.push_back(V[3]);
|
||||
|
||||
T.push_back(V[6]); T.push_back(V[3]); T.push_back(V[7]);
|
||||
T.push_back(V[3]); T.push_back(V[6]); T.push_back(V[2]);
|
||||
|
||||
T.push_back(V[4]); T.push_back(V[2]); T.push_back(V[6]);
|
||||
T.push_back(V[2]); T.push_back(V[4]); T.push_back(V[0]);
|
||||
|
||||
// add "top"
|
||||
T.push_back(V[5]); T.push_back(V[6]); T.push_back(V[7]);
|
||||
T.push_back(V[6]); T.push_back(V[5]); T.push_back(V[4]);
|
||||
|
||||
// add bottom
|
||||
T.push_back(V[0]); T.push_back(V[1]); T.push_back(V[2]);
|
||||
T.push_back(V[3]); T.push_back(V[2]); T.push_back(V[1]);
|
||||
|
||||
renderVertices(T, GL_TRIANGLES, rgba);
|
||||
}
|
||||
|
||||
void DebugRenderer::renderBoxEdges(const std::vector<glm::vec4>& clippingSpacePoints, glm::vec4 rgba) const {
|
||||
const std::vector<glm::vec4>& V = clippingSpacePoints;
|
||||
std::vector<glm::vec4> lineVertices;
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
lineVertices.push_back(V[2 * i]);
|
||||
lineVertices.push_back(V[2 * i + 1]);
|
||||
lineVertices.push_back(V[i]);
|
||||
lineVertices.push_back(V[i + 4]);
|
||||
}
|
||||
lineVertices.push_back(V[0]); lineVertices.push_back(V[2]);
|
||||
lineVertices.push_back(V[1]); lineVertices.push_back(V[3]);
|
||||
lineVertices.push_back(V[4]); lineVertices.push_back(V[6]);
|
||||
lineVertices.push_back(V[5]); lineVertices.push_back(V[7]);
|
||||
DebugRenderer::ref()->renderVertices(lineVertices, GL_LINES, rgba);
|
||||
}
|
||||
lineVertices.push_back(V[0]); lineVertices.push_back(V[2]);
|
||||
lineVertices.push_back(V[1]); lineVertices.push_back(V[3]);
|
||||
lineVertices.push_back(V[4]); lineVertices.push_back(V[6]);
|
||||
lineVertices.push_back(V[5]); lineVertices.push_back(V[7]);
|
||||
DebugRenderer::ref()->renderVertices(lineVertices, GL_LINES, rgba);
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -58,10 +58,9 @@ namespace openspace {
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<ProgramObject> _programObject;
|
||||
std::unique_ptr<ProgramObject> _programObject;
|
||||
|
||||
|
||||
static std::shared_ptr<DebugRenderer> _singleton;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include <openspace/query/query.h>
|
||||
#include <glm/gtx/projection.hpp>
|
||||
|
||||
#include <openspace/performance/performancemeasurement.h>
|
||||
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <iomanip>
|
||||
#include <utility>
|
||||
@@ -73,7 +75,7 @@ RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary)
|
||||
, _texture(nullptr)
|
||||
, _drawFOV(false)
|
||||
, _mode(GL_LINES)
|
||||
, _interceptTag{false, false, false, false, false, false, false, false}
|
||||
//, _interceptTag{false, false, false, false, false, false, false, false}
|
||||
, _withinFOV(false)
|
||||
, _vBoundsSize(0)
|
||||
, _vPlaneSize(40)
|
||||
@@ -204,6 +206,7 @@ void RenderableFov::sendToGPU() {
|
||||
}
|
||||
|
||||
void RenderableFov::updateGPU() {
|
||||
PerfMeasure("updateGPU");
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _fovBoundsVBO);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, _vBoundsSize * sizeof(GLfloat), _fovBounds.data());
|
||||
if (!_rebuild){
|
||||
@@ -459,6 +462,7 @@ void RenderableFov::computeColors() {
|
||||
}
|
||||
|
||||
void RenderableFov::determineTarget() {
|
||||
PerfMeasure("determineTarget");
|
||||
_fovTarget = _potentialTargets[0]; //default;
|
||||
for (int i = 0; i < _potentialTargets.size(); i++) {
|
||||
_withinFOV = openspace::SpiceManager::ref().isTargetInFieldOfView(
|
||||
@@ -477,6 +481,7 @@ void RenderableFov::determineTarget() {
|
||||
}
|
||||
|
||||
void RenderableFov::computeIntercepts(const RenderData& data) {
|
||||
PerfMeasure("computeIntercepts");
|
||||
// for each FOV vector
|
||||
_fovBounds.clear();
|
||||
for (int i = 0; i <= _bounds.size(); i++){
|
||||
@@ -563,9 +568,10 @@ void RenderableFov::render(const RenderData& data) {
|
||||
if (openspace::ImageSequencer::ref().isReady())
|
||||
_drawFOV = ImageSequencer::ref().instrumentActive(_instrumentID);
|
||||
|
||||
if (_drawFOV){
|
||||
if (_drawFOV) {
|
||||
// update only when time progresses.
|
||||
if (_oldTime != _time){
|
||||
if (_oldTime != _time) {
|
||||
PerfMeasure("Total");
|
||||
determineTarget();
|
||||
computeColors();
|
||||
computeIntercepts(data);
|
||||
|
||||
@@ -207,7 +207,7 @@ void RenderablePlaneProjection::loadTexture() {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderablePlaneProjection::updatePlane(const Image img, double currentTime) {
|
||||
void RenderablePlaneProjection::updatePlane(const Image& img, double currentTime) {
|
||||
|
||||
std::string frame;
|
||||
std::vector<glm::dvec3> bounds;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
void updatePlane(const Image img, double currentTime);
|
||||
void updatePlane(const Image& img, double currentTime);
|
||||
std::string findClosestTarget(double currentTime);
|
||||
void setTarget(std::string body);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ const std::string _loggerCat = "Decoder";
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Decoder* Decoder::createFromDictionary(const ghoul::Dictionary& dictionary, const std::string type)
|
||||
Decoder* Decoder::createFromDictionary(const ghoul::Dictionary& dictionary, const std::string& type)
|
||||
{
|
||||
ghoul::TemplateFactory<Decoder>* factory
|
||||
= FactoryManager::ref().factory<Decoder>();
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
|
||||
class Decoder {
|
||||
public:
|
||||
static Decoder* createFromDictionary(const ghoul::Dictionary& dictionary, const std::string type);
|
||||
static Decoder* createFromDictionary(const ghoul::Dictionary& dictionary, const std::string& type);
|
||||
|
||||
Decoder(const ghoul::Dictionary& dictionary);
|
||||
virtual ~Decoder();
|
||||
|
||||
@@ -229,7 +229,7 @@ bool HongKangParser::create() {
|
||||
image.startTime = scan_start;
|
||||
image.stopTime = scan_stop;
|
||||
image.path = _defaultCaptureImage;
|
||||
image.activeInstruments = cameraSpiceID;
|
||||
image.activeInstruments = scannerSpiceID;
|
||||
image.target = cameraTarget;
|
||||
image.isPlaceholder = true;
|
||||
image.projected = false;
|
||||
|
||||
@@ -46,10 +46,10 @@ ImageSequencer* ImageSequencer::_instance = nullptr;
|
||||
|
||||
ImageSequencer::ImageSequencer()
|
||||
: _hasData(false)
|
||||
//, _currentTime(0.0)
|
||||
//, _previousTime(0.0)
|
||||
//, _intervalLength(0.0)
|
||||
//, _nextCapture(0.0)
|
||||
, _currentTime(0.0)
|
||||
, _previousTime(0.0)
|
||||
, _intervalLength(0.0)
|
||||
, _nextCapture(0.0)
|
||||
{}
|
||||
|
||||
ImageSequencer& ImageSequencer::ref() {
|
||||
@@ -162,7 +162,7 @@ double ImageSequencer::getNextCaptureTime(){
|
||||
|
||||
return nextCaptureTime;
|
||||
}
|
||||
const Image ImageSequencer::getLatestImageForInstrument(const std::string _instrumentID){
|
||||
Image ImageSequencer::getLatestImageForInstrument(const std::string& _instrumentID){
|
||||
auto it = _latestImages.find(_instrumentID);
|
||||
if (it != _latestImages.end())
|
||||
return _latestImages[_instrumentID];
|
||||
@@ -373,14 +373,13 @@ void ImageSequencer::runSequenceParser(SequenceParser* parser){
|
||||
|
||||
// find the smallest separation of images in time
|
||||
double epsilon;
|
||||
epsilon = findMin(source);
|
||||
//epsilon = findMin(source);
|
||||
epsilon = findMin(destination);
|
||||
// set epsilon as 1% smaller than min
|
||||
epsilon -= min*0.01;
|
||||
|
||||
// IFF images have same time as mission planned capture, erase that event from
|
||||
// 'predicted event file' (mission-playbook)
|
||||
std::vector<Image> tmp;
|
||||
for (int i = 0; i < source.size(); i++){
|
||||
for (int j = 0; j < destination.size(); j++){
|
||||
double diff = abs(source[i].startTime - destination[j].startTime);
|
||||
|
||||
@@ -136,7 +136,8 @@ public:
|
||||
/*
|
||||
* returns latest captured image
|
||||
*/
|
||||
const Image getLatestImageForInstrument(const std::string _instrumentID);
|
||||
Image getLatestImageForInstrument(const std::string& instrumentID);
|
||||
|
||||
private:
|
||||
void sortData();
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ InstrumentDecoder::InstrumentDecoder(const ghoul::Dictionary& dictionary)
|
||||
dictionary.getValue(keyStopCommand, _stopCommand);
|
||||
}
|
||||
|
||||
std::vector<std::string> spice;
|
||||
ghoul::Dictionary spiceDictionary;
|
||||
success = dictionary.getValue(keySpice, spiceDictionary);
|
||||
ghoul_assert(success, "Instrument did not provide spice ids");
|
||||
|
||||
@@ -45,12 +45,12 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
LabelParser::LabelParser(std::string name, const std::string& fileName,
|
||||
ghoul::Dictionary translationDictionary)
|
||||
LabelParser::LabelParser(std::string name, std::string fileName,
|
||||
const ghoul::Dictionary& translationDictionary)
|
||||
: _name(std::move(name))
|
||||
, _badDecoding(false)
|
||||
, _fileName(std::move(fileName))
|
||||
{
|
||||
_fileName = fileName;
|
||||
//get the different instrument types
|
||||
const std::vector<std::string>& decoders = translationDictionary.keys();
|
||||
//for each decoder (assuming might have more if hong makes changes)
|
||||
@@ -167,7 +167,6 @@ bool LabelParser::create() {
|
||||
|
||||
// open up label files
|
||||
std::string line = "";
|
||||
std::string previousSequence;
|
||||
TimeRange instrumentRange;
|
||||
|
||||
double startTime = 0.0;
|
||||
|
||||
@@ -37,8 +37,8 @@ class LabelParser : public SequenceParser{
|
||||
public:
|
||||
LabelParser();
|
||||
LabelParser(std::string name,
|
||||
const std::string& fileName,
|
||||
ghoul::Dictionary translationDictionary);
|
||||
std::string fileName,
|
||||
const ghoul::Dictionary& translationDictionary);
|
||||
|
||||
bool create() override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user