Moving potential targets into ProjectionComponent

This commit is contained in:
Alexander Bock
2016-06-04 13:45:55 +02:00
parent afe2ecc1e8
commit 2700ef6ea8
2 changed files with 15 additions and 14 deletions

View File

@@ -38,7 +38,6 @@
namespace {
const std::string _loggerCat = "RenderablePlanetProjection";
const std::string keyPotentialTargets = "PotentialTargets";
const std::string keyFrame = "Frame";
const std::string keyGeometry = "Geometry";
@@ -84,18 +83,6 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
success = initializeProjectionSettings(dictionary);
ghoul_assert(success, "");
// @TODO copy-n-paste from renderablefov ---abock
ghoul::Dictionary potentialTargets;
success = dictionary.getValue(keyPotentialTargets, potentialTargets);
ghoul_assert(success, "");
_potentialTargets.resize(potentialTargets.size());
for (int i = 0; i < potentialTargets.size(); ++i) {
std::string target;
potentialTargets.getValue(std::to_string(i + 1), target);
_potentialTargets[i] = target;
}
// TODO: textures need to be replaced by a good system similar to the geometry as soon
// as the requirements are fixed (ab)
std::string texturePath = "";
@@ -113,7 +100,6 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
addProperty(_performProjection);
addProperty(_clearAllProjections);
addProperty(_colorTexturePath);
_colorTexturePath.onChange(std::bind(&RenderablePlanetProjection::loadTextures, this));

View File

@@ -36,6 +36,8 @@
#include <ghoul/systemcapabilities/openglcapabilitiescomponent.h>
namespace {
const std::string keyPotentialTargets = "PotentialTargets";
const std::string keyInstrument = "Instrument.Name";
const std::string keyInstrumentFovy = "Instrument.Fovy";
const std::string keyInstrumentAspect = "Instrument.Aspect";
@@ -99,6 +101,19 @@ bool ProjectionComponent::initializeProjectionSettings(const Dictionary& diction
completeSuccess &= s;
ghoul_assert(completeSuccess, "All neccessary attributes not found in modfile");
if (dictionary.hasKeyAndValue<ghoul::Dictionary>(keyPotentialTargets)) {
ghoul::Dictionary potentialTargets = dictionary.value<ghoul::Dictionary>(
keyPotentialTargets
);
_potentialTargets.resize(potentialTargets.size());
for (int i = 0; i < potentialTargets.size(); ++i) {
std::string target;
potentialTargets.getValue(std::to_string(i + 1), target);
_potentialTargets[i] = target;
}
}
return completeSuccess;
}