mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-25 06:19:02 -06:00
Removing code analysis warnings
Start cleaning RenderEngine
This commit is contained in:
Submodule ext/ghoul updated: 6881033dc5...6034743e6e
@@ -74,10 +74,6 @@ public:
|
||||
FPSAvg
|
||||
};
|
||||
|
||||
static const std::string KeyFontMono;
|
||||
static const std::string KeyFontLight;
|
||||
static const std::vector<FrametimeType> FrametimeTypes;
|
||||
|
||||
RenderEngine();
|
||||
~RenderEngine();
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ void RenderableModel::render(const RenderData& data) {
|
||||
void RenderableModel::update(const UpdateData& data) {
|
||||
if (_programObject->isDirty())
|
||||
_programObject->rebuildFromFile();
|
||||
double _time = data.time;
|
||||
// double _time = data.time;
|
||||
|
||||
//if (_isGhost){
|
||||
// futureTime = openspace::ImageSequencer::ref().getNextCaptureTime();
|
||||
|
||||
@@ -88,7 +88,7 @@ RawTile RawTile::deserializeMetaData(std::istream& is) {
|
||||
char binaryDataSeparator;
|
||||
is >> binaryDataSeparator; // not used
|
||||
|
||||
char* buffer = new char[res.nBytesImageData]();
|
||||
// char* buffer = new char[res.nBytesImageData]();
|
||||
return std::move(res);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ TileDataset::IODescription TileDataset::IODescription::cut(PixelRegion::Side sid
|
||||
ratio.x = write.region.numPixels.x / (double) read.region.numPixels.x;
|
||||
ratio.y = write.region.numPixels.y / (double) read.region.numPixels.y;
|
||||
|
||||
double ratioRatio = ratio.x / ratio.y;
|
||||
// double ratioRatio = ratio.x / ratio.y;
|
||||
|
||||
//ghoul_assert(glm::abs(ratioRatio - 1.0) < 0.01, "Different read/write aspect ratio!");
|
||||
|
||||
@@ -439,7 +439,7 @@ PixelRegion TileDataset::gdalPixelRegion(const GeodeticPatch& geodeticPatch) con
|
||||
|
||||
GDALRasterBand* TileDataset::gdalRasterBand(int overview, int raster) const {
|
||||
GDALRasterBand* rasterBand = _dataset->GetRasterBand(raster);
|
||||
int numberOfOverviews = rasterBand->GetOverviewCount();
|
||||
// int numberOfOverviews = rasterBand->GetOverviewCount();
|
||||
rasterBand = gdalHasOverviews() ? rasterBand->GetOverview(overview) : rasterBand;
|
||||
ghoul_assert(rasterBand != nullptr, "Rasterband is null");
|
||||
return rasterBand;
|
||||
@@ -637,7 +637,7 @@ CPLErr TileDataset::repeatedRasterIO(GDALRasterBand* rasterBand, const IODescrip
|
||||
// +--------------+
|
||||
|
||||
if (cutoff.read.region.area() > 0) {
|
||||
didCutOff = true;
|
||||
// didCutOff = true;
|
||||
|
||||
// Wrap by repeating
|
||||
PixelRegion::Side oppositeSide = (PixelRegion::Side) ((i + 2) % 4);
|
||||
@@ -676,7 +676,7 @@ CPLErr TileDataset::repeatedRasterIO(GDALRasterBand* rasterBand, const IODescrip
|
||||
}
|
||||
|
||||
CPLErr err = rasterIO(rasterBand, io, dataDestination);
|
||||
worstError = std::max(worstError, err);
|
||||
// worstError = std::max(worstError, err);
|
||||
|
||||
// The return error from a repeated rasterIO is ONLY based on the main region,
|
||||
// which in the usual case will cover the main area of the patch anyway
|
||||
@@ -732,7 +732,7 @@ std::shared_ptr<TileMetaData> TileDataset::getTileMetaData(
|
||||
const PixelRegion& region) const
|
||||
{
|
||||
size_t bytesPerLine = _dataLayout.bytesPerPixel * region.numPixels.x;
|
||||
size_t totalNumBytes = bytesPerLine * region.numPixels.y;
|
||||
// size_t totalNumBytes = bytesPerLine * region.numPixels.y;
|
||||
|
||||
TileMetaData* preprocessData = new TileMetaData();
|
||||
preprocessData->maxValues.resize(_dataLayout.numRasters);
|
||||
|
||||
@@ -98,7 +98,7 @@ size_t getMaximumValue(GDALDataType gdalType) {
|
||||
case GDT_Int16:
|
||||
return 1 << 15;
|
||||
case GDT_UInt32:
|
||||
return 1 << 32;
|
||||
return size_t(1) << 32;
|
||||
case GDT_Int32:
|
||||
return 1 << 31;
|
||||
default:
|
||||
|
||||
@@ -199,7 +199,7 @@ Tile CachingTileProvider::createTile(std::shared_ptr<RawTile> rawTile) {
|
||||
return{ nullptr, nullptr, Tile::Status::IOError };
|
||||
}
|
||||
|
||||
TileIndex::TileHashKey key = rawTile->tileIndex.hashKey();
|
||||
// TileIndex::TileHashKey key = rawTile->tileIndex.hashKey();
|
||||
TileDataLayout dataLayout =
|
||||
_asyncTextureDataProvider->getTextureDataProvider()->getDataLayout();
|
||||
|
||||
|
||||
@@ -108,8 +108,6 @@ Tile TextTileProvider::createChunkIndexTile(const TileIndex& tileIndex) {
|
||||
0
|
||||
);
|
||||
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
|
||||
glViewport(
|
||||
0, 0,
|
||||
static_cast<GLsizei>(tile.texture->width()),
|
||||
|
||||
@@ -80,7 +80,7 @@ void DataProcessorJson::addDataValues(std::string data, properties::SelectionPro
|
||||
|
||||
for(int i=0; i<numOptions; i++){
|
||||
json row = variables[options[i].description];
|
||||
int rowsize = row.size();
|
||||
// int rowsize = row.size();
|
||||
|
||||
for(int y=0; y<row.size(); y++){
|
||||
json col = row.at(y);
|
||||
@@ -107,7 +107,7 @@ std::vector<float*> DataProcessorJson::processData(std::string data, properties:
|
||||
json variables = j["variables"];
|
||||
|
||||
std::vector<int> selectedOptions = dataOptions.value();
|
||||
int numSelected = selectedOptions.size();
|
||||
// int numSelected = selectedOptions.size();
|
||||
|
||||
auto options = dataOptions.options();
|
||||
int numOptions = options.size();
|
||||
|
||||
@@ -112,7 +112,7 @@ std::vector<float*> DataProcessorKameleon::processData(std::string path, propert
|
||||
initializeKameleonWrapper(path);
|
||||
|
||||
std::vector<int> selectedOptions = dataOptions.value();
|
||||
int numSelected = selectedOptions.size();
|
||||
// int numSelected = selectedOptions.size();
|
||||
|
||||
auto options = dataOptions.options();
|
||||
int numOptions = options.size();
|
||||
|
||||
@@ -150,7 +150,7 @@ std::vector<float*> DataProcessorText::processData(std::string data, properties:
|
||||
std::stringstream memorystream(data);
|
||||
|
||||
std::vector<int> selectedOptions = dataOptions.value();
|
||||
int numSelected = selectedOptions.size();
|
||||
// int numSelected = selectedOptions.size();
|
||||
int numOptions = dataOptions.options().size();
|
||||
|
||||
std::vector<float> values;
|
||||
@@ -195,7 +195,7 @@ std::vector<float*> DataProcessorText::processData(std::string data, properties:
|
||||
// }
|
||||
// ----------- OLD METHODS ------------------------
|
||||
|
||||
first = 0;
|
||||
// first = 0;
|
||||
last = 0;
|
||||
option = -3;
|
||||
lineSize = line.size();
|
||||
|
||||
@@ -424,14 +424,12 @@ bool BrickManager::DiskToPBO(BUFFER_INDEX _pboIndex) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
delete[] seqBuffer;
|
||||
|
||||
} // if in pbo
|
||||
|
||||
// Update the brick index
|
||||
brickIndex += sequence;
|
||||
|
||||
delete[] seqBuffer;
|
||||
}
|
||||
|
||||
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
@@ -94,7 +94,7 @@ bool ErrorHistogramManager::buildFromLeaf(unsigned int bstOffset, unsigned int o
|
||||
int numOtNodes = _tsp->numOTNodes();
|
||||
unsigned int leafIndex = bstOffset * numOtNodes + octreeOffset;
|
||||
std::vector<float> leafValues = readValues(leafIndex);
|
||||
int numVoxels = leafValues.size();
|
||||
// int numVoxels = leafValues.size();
|
||||
|
||||
int bstNode = bstOffset;
|
||||
bool bstRightOnly = true;
|
||||
|
||||
@@ -91,7 +91,7 @@ void LocalTfBrickSelector::selectBricks(int timestep, std::vector<int>& bricks)
|
||||
unsigned int brickIndex = bs.brickIndex;
|
||||
priorityQueue.pop_back();
|
||||
if (bs.splitType == BrickSelection::SplitType::Temporal) {
|
||||
int timeSpanCenter = bs.centerT();
|
||||
// int timeSpanCenter = bs.centerT();
|
||||
unsigned int childBrickIndex;
|
||||
bool pickRightTimeChild = bs.timestepInRightChild(timestep);
|
||||
|
||||
|
||||
@@ -273,12 +273,11 @@ bool HongKangParser::augmentWithSpice(Image& image, std::string spacecraft,
|
||||
}
|
||||
|
||||
for (int i = 0; i < potentialTargets.size(); ++i) {
|
||||
bool _withinFOV = false;
|
||||
for (int j = 0; j < image.activeInstruments.size(); ++j) {
|
||||
double time = image.timeRange.start;
|
||||
for (int k = 0; k < exposureTime; k++) {
|
||||
time += k;
|
||||
_withinFOV = SpiceManager::ref().isTargetInFieldOfView(
|
||||
bool withinFOV = SpiceManager::ref().isTargetInFieldOfView(
|
||||
potentialTargets[i],
|
||||
spacecraft,
|
||||
image.activeInstruments[j],
|
||||
@@ -287,9 +286,8 @@ bool HongKangParser::augmentWithSpice(Image& image, std::string spacecraft,
|
||||
time
|
||||
);
|
||||
|
||||
if (_withinFOV) {
|
||||
if (withinFOV) {
|
||||
image.target = potentialTargets[i];
|
||||
_withinFOV = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,4 +325,4 @@ double HongKangParser::getMetFromET(double et) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -242,7 +242,7 @@ void ProjectionComponent::initialize(const ghoul::Dictionary& dictionary) {
|
||||
if (foundSequence) {
|
||||
sequenceSource = absPath(sequenceSource);
|
||||
|
||||
foundSequence = dictionary.getValue(keySequenceType, sequenceType);
|
||||
dictionary.getValue(keySequenceType, sequenceType);
|
||||
//Important: client must define translation-list in mod file IFF playbook
|
||||
if (dictionary.hasKey(keyTranslation)) {
|
||||
ghoul::Dictionary translationDictionary;
|
||||
|
||||
@@ -279,6 +279,15 @@ void TLETranslation::readTLEFile(const std::string& filename) {
|
||||
double meanMotion;
|
||||
double epoch;
|
||||
} keplerElements;
|
||||
|
||||
enum class State {
|
||||
Initial = 0,
|
||||
ReadFirstLine,
|
||||
ReadSecondLine,
|
||||
Finished = ReadSecondLine
|
||||
};
|
||||
|
||||
State state = State::Initial;
|
||||
|
||||
std::string line;
|
||||
while (std::getline(file, line)) {
|
||||
@@ -301,8 +310,15 @@ void TLETranslation::readTLEFile(const std::string& filename) {
|
||||
// 14 69-69 Checksum (modulo 10)
|
||||
|
||||
keplerElements.epoch = epochFromSubstring(line.substr(18, 14));
|
||||
state = State::ReadFirstLine;
|
||||
}
|
||||
else if (line[0] == '2') {
|
||||
if (state != State::ReadFirstLine) {
|
||||
throw ghoul::RuntimeError(
|
||||
"Malformed TLE file: '" + filename + "'. Line 2 before line 1",
|
||||
"TLETranslation"
|
||||
);
|
||||
}
|
||||
// Second line
|
||||
//Field Columns Content
|
||||
// 1 01-01 Line number
|
||||
@@ -348,10 +364,18 @@ void TLETranslation::readTLEFile(const std::string& filename) {
|
||||
stream.str(line.substr(52, 11));
|
||||
stream >> keplerElements.meanMotion;
|
||||
|
||||
state = State::ReadSecondLine;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state != State::Finished) {
|
||||
throw ghoul::RuntimeError(
|
||||
"Malformed TLE file: Line 1 or 2 missing",
|
||||
"TLETranslation"
|
||||
);
|
||||
}
|
||||
|
||||
// Calculate the semi major axis based on the mean motion using kepler's laws
|
||||
keplerElements.semiMajorAxis = calculateSemiMajorAxis(keplerElements.meanMotion);
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ namespace volumeutils {
|
||||
size_t coordsToIndex(const glm::vec3& coords, const glm::ivec3& dims) {
|
||||
size_t w = dims.x;
|
||||
size_t h = dims.y;
|
||||
size_t d = dims.z;
|
||||
|
||||
size_t x = coords.x;
|
||||
size_t y = coords.y;
|
||||
size_t z = coords.z;
|
||||
// size_t d = dims.z;
|
||||
//
|
||||
// size_t x = coords.x;
|
||||
// size_t y = coords.y;
|
||||
// size_t z = coords.z;
|
||||
|
||||
return coords.z * (h * w) + coords.y * w + coords.x;
|
||||
}
|
||||
|
||||
@@ -810,7 +810,7 @@ void OpenSpaceEngine::initializeGL() {
|
||||
|
||||
LINFO("Initializing Rendering Engine");
|
||||
// @CLEANUP: Remove the return statement and replace with exceptions ---abock
|
||||
bool success = _renderEngine->initializeGL();
|
||||
_renderEngine->initializeGL();
|
||||
|
||||
for (const auto& func : _moduleCallbacks.initializeGL) {
|
||||
func();
|
||||
|
||||
@@ -110,9 +110,9 @@ glm::ivec2 SGCTWindowWrapper::currentWindowSize() const {
|
||||
}
|
||||
|
||||
glm::ivec2 SGCTWindowWrapper::currentWindowResolution() const {
|
||||
auto window = sgct::Engine::instance()->getCurrentWindowPtr();
|
||||
int x, y;
|
||||
sgct::Engine::instance()->getCurrentWindowPtr()->getFinalFBODimensions(x, y);
|
||||
auto window = sgct::Engine::instance()->getCurrentWindowPtr();
|
||||
window->getFinalFBODimensions(x, y);
|
||||
return glm::ivec2(x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,19 +99,14 @@ namespace {
|
||||
std::chrono::seconds ScreenLogTimeToLive(15);
|
||||
const std::string DefaultRenderingMethod = "ABuffer";
|
||||
const std::string RenderFsPath = "${SHADERS}/render.frag";
|
||||
|
||||
const std::string KeyFontMono = "Mono";
|
||||
const std::string KeyFontLight = "Light";
|
||||
}
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
const std::string RenderEngine::KeyFontMono = "Mono";
|
||||
const std::string RenderEngine::KeyFontLight = "Light";
|
||||
const std::vector<RenderEngine::FrametimeType> RenderEngine::FrametimeTypes({
|
||||
RenderEngine::FrametimeType::DtTimeAvg,
|
||||
RenderEngine::FrametimeType::FPS,
|
||||
RenderEngine::FrametimeType::FPSAvg
|
||||
});
|
||||
|
||||
RenderEngine::RenderEngine()
|
||||
: _mainCamera(nullptr)
|
||||
, _raycasterManager(nullptr)
|
||||
@@ -191,15 +186,15 @@ void RenderEngine::setRendererFromString(const std::string& renderingMethod) {
|
||||
|
||||
std::unique_ptr<Renderer> newRenderer = nullptr;
|
||||
switch (_rendererImplementation) {
|
||||
case RendererImplementation::Framebuffer:
|
||||
newRenderer = std::make_unique<FramebufferRenderer>();
|
||||
break;
|
||||
case RendererImplementation::ABuffer:
|
||||
newRenderer = std::make_unique<ABufferRenderer>();
|
||||
break;
|
||||
case RendererImplementation::Invalid:
|
||||
LFATAL("Rendering method '" << renderingMethod << "' not among the available "
|
||||
<< "rendering methods");
|
||||
case RendererImplementation::Framebuffer:
|
||||
newRenderer = std::make_unique<FramebufferRenderer>();
|
||||
break;
|
||||
case RendererImplementation::ABuffer:
|
||||
newRenderer = std::make_unique<ABufferRenderer>();
|
||||
break;
|
||||
case RendererImplementation::Invalid:
|
||||
LFATAL("Rendering method '" << renderingMethod << "' not among the available "
|
||||
<< "rendering methods");
|
||||
}
|
||||
|
||||
setRenderer(std::move(newRenderer));
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace openspace {
|
||||
using datamessagestructures::TimeKeyframe;
|
||||
|
||||
void TimeManager::preSynchronization(double dt) {
|
||||
double now = OsEng.runTime();
|
||||
// double now = OsEng.runTime();
|
||||
removeKeyframesBefore(_latestConsumedTimestamp);
|
||||
if (_keyframes.size() == 0) {
|
||||
Time::ref().advanceTime(dt);
|
||||
@@ -150,4 +150,4 @@ bool TimeManager::compareKeyframeTimes(const TimeKeyframe& a, const TimeKeyframe
|
||||
return a._timestamp < b._timestamp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user