mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-01 17:19:05 -06:00
Imagesequencer update:
- label/image data works - fixed issues with instrument firing - read handled in more uniform way - adding ALICE scanner - distance fading in renderabletrail (WIP) - essential fixes to renderableFOV - and additional changes to other classes reliant on imagesequenser.
This commit is contained in:
@@ -42,6 +42,8 @@ public:
|
||||
virtual bool initialize(RenderableModel* parent);
|
||||
virtual void deinitialize();
|
||||
virtual void render() = 0;
|
||||
virtual void changeRenderMode(const GLenum mode) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
RenderableModel* _parent;
|
||||
|
||||
@@ -63,7 +63,6 @@ private:
|
||||
ghoul::opengl::Texture* _texture;
|
||||
ghoul::opengl::Texture* _bumpMap;
|
||||
|
||||
|
||||
modelgeometry::ModelGeometry* _geometry;
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
@@ -75,8 +74,9 @@ private:
|
||||
|
||||
properties::BoolProperty _performShading;
|
||||
properties::BoolProperty _performFade;
|
||||
|
||||
properties::FloatProperty _fading;
|
||||
bool _isGhost;
|
||||
double _time;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
bool initialize(RenderableModel* parent) override;
|
||||
void deinitialize() override;
|
||||
void render() override;
|
||||
void changeRenderMode(const GLenum mode);
|
||||
|
||||
private:
|
||||
struct Vertex {
|
||||
@@ -56,6 +57,7 @@ private:
|
||||
GLuint _vaoID;
|
||||
GLuint _vbo;
|
||||
GLuint _ibo;
|
||||
GLenum _mode;
|
||||
|
||||
std::vector<Vertex> _vertices;
|
||||
std::vector<int> _indices;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/imagesequencer.h>
|
||||
#include <openspace/util/imagesequencer2.h>
|
||||
|
||||
#include <openspace/util/sequenceparser.h>
|
||||
@@ -83,11 +82,13 @@ private:
|
||||
properties::StringProperty _colorTexturePath;
|
||||
properties::StringProperty _projectionTexturePath;
|
||||
properties::TriggerProperty _imageTrigger;
|
||||
properties::FloatProperty _fadeProjection;
|
||||
|
||||
ghoul::opengl::ProgramObject* _programObject;
|
||||
ghoul::opengl::ProgramObject* _fboProgramObject;
|
||||
|
||||
ghoul::opengl::Texture* _texture;
|
||||
ghoul::opengl::Texture* _textureOriginal;
|
||||
ghoul::opengl::Texture* _textureProj;
|
||||
planetgeometryprojection::PlanetGeometryProjection* _geometry;
|
||||
|
||||
|
||||
@@ -76,9 +76,9 @@ public:
|
||||
int _nrInserted = 0;
|
||||
int _isteps;
|
||||
bool _rebuild = false;
|
||||
bool _interceptTag[5];
|
||||
bool _interceptTag[9];
|
||||
bool _withinFOV;
|
||||
psc _projectionBounds[4];
|
||||
psc _projectionBounds[8];
|
||||
psc _interceptVector;
|
||||
|
||||
// spice
|
||||
|
||||
@@ -86,6 +86,8 @@ private:
|
||||
|
||||
float _increment;
|
||||
float _oldTime = 0;
|
||||
float _time;
|
||||
float _distanceFade;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -36,6 +36,19 @@
|
||||
#include <openspace/util/sequenceparser.h>
|
||||
|
||||
namespace openspace {
|
||||
/**
|
||||
* The ImageSequencer singleton main function is to manage the timekeeping and
|
||||
* distribution of large image data-sets across all openspace renderable instances,
|
||||
* both for past and future unmanned-spacecraft missions. To load the instance with
|
||||
* data the client must provide a parser inherited from the abstract base class
|
||||
* SequenceParser. Hence, there is no restriction imposed on data input, whether its
|
||||
* data in the form of existing images or in the form of a planned observation schedule.
|
||||
* Notably, in order for the sequencer to function the client must provide or write a
|
||||
* parser that fills the ImageSequencers private members.
|
||||
* \see SequenceParser
|
||||
* \see ImageSequencer2::runSequenceParser(SequenceParser* parser)
|
||||
* std::map<std::string, bool>
|
||||
*/
|
||||
class ImageSequencer2 {
|
||||
public:
|
||||
ImageSequencer2();
|
||||
@@ -43,65 +56,140 @@ public:
|
||||
* Singelton instantiation
|
||||
*/
|
||||
static ImageSequencer2* _instance;
|
||||
|
||||
/**
|
||||
* Returns the reference to the singleton ImageSequencer object that must have been
|
||||
* initialized by a call to the initialize method earlier.
|
||||
* \return The ImageSequencer singleton
|
||||
*/
|
||||
static ImageSequencer2& ref();
|
||||
/**
|
||||
* Initializer that initializes the static member.
|
||||
*/
|
||||
static void initialize();
|
||||
/**
|
||||
* Deinitializes that deinitializes the static member.
|
||||
*/
|
||||
static void deinitialize();
|
||||
|
||||
/**
|
||||
* Returns true if sequencer has been loaded with data.
|
||||
*/
|
||||
bool isReady();
|
||||
|
||||
//provides the sequencer with current time
|
||||
/**
|
||||
* Updates sequencer with current <code>time</code>. This is used internally for keeping
|
||||
* track of both current simulation time and the time of the previously rendered frame.
|
||||
*/
|
||||
void updateSequencer(double time);
|
||||
/**
|
||||
* Runs parser and recieves the datastructures filled by it.
|
||||
* \see SequenceParser
|
||||
*/
|
||||
void runSequenceParser(SequenceParser* parser);
|
||||
|
||||
//translates playbook ambiguous namesetting to spice calls, augments each observation with targets and
|
||||
//stores all images in its own subset (see _subsetMap member)
|
||||
bool parsePlaybookFile(const std::string& fileName,
|
||||
std::string spacecraft,
|
||||
std::map<std::string, std::vector<std::string>> acronymDictionary,
|
||||
std::vector<std::string> potentialTargets);
|
||||
|
||||
// returns upcoming target
|
||||
/**
|
||||
* Retrieves the next upcoming target in time.
|
||||
*/
|
||||
std::pair<double, std::string> getNextTarget();
|
||||
// returns next target
|
||||
|
||||
/**
|
||||
* Retrieves the most current target in time.
|
||||
*/
|
||||
std::pair<double, std::string> getCurrentTarget();
|
||||
// returns current target and (in the list) adjacent targets, the number to retrieve is user set
|
||||
|
||||
/**
|
||||
* Retrieves current target and (in the list) adjacent targets, the number to retrieve is user set
|
||||
*/
|
||||
std::pair<double, std::vector<std::string>> getIncidentTargetList(int range = 2);
|
||||
|
||||
/**
|
||||
* Retrieves the next upcoming time of image capture.
|
||||
*/
|
||||
double getNextCaptureTime();
|
||||
|
||||
/**
|
||||
* Retrieves the time interval length between the current time and an upcoming capture.
|
||||
*/
|
||||
double getIntervalLength();
|
||||
std::vector<std::pair<std::string, bool>> getActiveInstruments();
|
||||
bool ImageSequencer2::getImagePaths(std::vector<std::pair<double, std::string>>& captures, std::string projectee, std::string instrumentID);
|
||||
bool ImageSequencer2::getImagePaths(std::vector<std::pair<double, std::string>>& captures, std::string projectee);
|
||||
|
||||
/*
|
||||
* Returns a map with key instrument names whose value indicate whether
|
||||
* an instrument is active or not.
|
||||
*/
|
||||
std::map<std::string, bool> getActiveInstruments();
|
||||
|
||||
/*
|
||||
* Retrieves the relevant data from a specific subset based on the what instance
|
||||
* makes the request. If an instance is not registered in the class then the singleton
|
||||
* returns false and no projections will occur.
|
||||
*/
|
||||
bool ImageSequencer2::getImagePaths(std::vector<std::pair<double, std::string>>& captures,
|
||||
std::string projectee,
|
||||
std::string instrumentID);
|
||||
|
||||
bool ImageSequencer2::getImagePaths(std::vector<std::pair<double, std::string>>& captures,
|
||||
std::string projectee);
|
||||
|
||||
/*
|
||||
* returns true if instrumentID is within a capture range.
|
||||
*/
|
||||
bool instumentActive(std::string instrumentID);
|
||||
|
||||
const Image* findLatestImageInSubset( ImageSubset& subset);
|
||||
//const Image* findLatestImageInSubset( ImageSubset& subset);
|
||||
private:
|
||||
//default comparison function
|
||||
bool imageComparer(const Image &a, const Image &b);
|
||||
|
||||
//binary find O(log n) always
|
||||
std::vector<Image>::iterator binary_find(std::vector<Image>::iterator begin,
|
||||
std::vector<Image>::iterator end,
|
||||
const Image &val,
|
||||
bool(*imageComparer)(const Image &a, const Image &b));
|
||||
|
||||
//var
|
||||
double _currentTime;
|
||||
double _previousTime;
|
||||
double _intervalLength;
|
||||
double _nextCapture;
|
||||
|
||||
std::string _defaultCaptureImage;
|
||||
std::vector<std::pair<std::string, bool>> _instrumentOnOff;
|
||||
|
||||
std::map<std::string, ImageSubset> _subsetMap;
|
||||
std::vector<std::pair<double, std::string>> _targetTimes;
|
||||
std::vector<std::pair<std::string, TimeRange>> _instrumentTimes;
|
||||
std::vector<double> _captureProgression;
|
||||
void sortData();
|
||||
|
||||
/*
|
||||
* _fileTranslation handles any types of ambiguities between the data and
|
||||
* spice/openspace -calls. This map is composed of a key that is a string in
|
||||
* the data to be translated and a Decoder that holds the corresponding
|
||||
* translation provided through a modfile.
|
||||
* \see Decoder
|
||||
* \see (projection mod files)
|
||||
*/
|
||||
std::map<std::string, Decoder*> _fileTranslation;
|
||||
|
||||
/*
|
||||
* This is the main container of image data. The key is the target name,
|
||||
* the value is a subset of images.
|
||||
* \see SequenceParser
|
||||
*/
|
||||
std::map<std::string, ImageSubset> _subsetMap;
|
||||
|
||||
/*
|
||||
* In order for the simulation to know when to turn on/off any instrument within
|
||||
* all instruments in the spacecraft payload, the key is the data-file given
|
||||
* instrument name.
|
||||
*/
|
||||
std::map<std::string, bool> _switchingMap;
|
||||
|
||||
/*
|
||||
* This datastructure holds the specific times when the spacecraft switches from
|
||||
* observing one inertial body to the next. This happens a lot in such missions
|
||||
* and the coupling of target with specific time is usually therefore not 1:1.
|
||||
*/
|
||||
std::vector<std::pair<double, std::string>> _targetTimes;
|
||||
|
||||
/*
|
||||
* Holds the time ranges of each instruments on and off periods. An instrument
|
||||
* rendering class may ask the ImageSequencer whether or not it
|
||||
*/
|
||||
std::vector<std::pair<std::string, TimeRange>> _instrumentTimes;
|
||||
|
||||
/*
|
||||
* Each consecutive images capture time, for easier traversal.
|
||||
*/
|
||||
std::vector<double> _captureProgression;
|
||||
|
||||
// current simulation time
|
||||
double _currentTime;
|
||||
// simulation time of previous frame
|
||||
double _previousTime;
|
||||
// time between current simulation time and an upcoming capture
|
||||
double _intervalLength;
|
||||
// next consecutive capture in time
|
||||
double _nextCapture;
|
||||
// default capture image
|
||||
std::string _defaultCaptureImage;
|
||||
// if no data, no run
|
||||
bool _hasData;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,8 +36,10 @@ public:
|
||||
InstrumentDecoder(const ghoul::Dictionary& dictionary);
|
||||
virtual std::string getDecoderType();
|
||||
virtual std::vector<std::string> getTranslation();
|
||||
std::string getStopCommand();
|
||||
private:
|
||||
std::string _type;
|
||||
std::string _stopCommand;
|
||||
std::vector<std::string> _spiceIDs;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,44 +33,54 @@
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
class LabelParser : public SequenceParser{
|
||||
public:
|
||||
LabelParser();
|
||||
LabelParser(const std::string& fileName,
|
||||
ghoul::Dictionary translationDictionary);
|
||||
virtual void create();
|
||||
virtual std::map<std::string, ImageSubset> getSubsetMap();
|
||||
virtual std::vector<std::pair<std::string, TimeRange>> getIstrumentTimes();
|
||||
virtual std::vector<std::pair<double, std::string>> getTargetTimes();
|
||||
class LabelParser : public SequenceParser{
|
||||
public:
|
||||
LabelParser();
|
||||
LabelParser(const std::string& fileName,
|
||||
ghoul::Dictionary translationDictionary);
|
||||
virtual void create();
|
||||
virtual std::map<std::string, ImageSubset> getSubsetMap();
|
||||
virtual std::vector<std::pair<std::string, TimeRange>> getIstrumentTimes();
|
||||
virtual std::vector<std::pair<double, std::string>> getTargetTimes();
|
||||
|
||||
// temporary need to figure this out
|
||||
std::map<std::string, Decoder*> getTranslation(){ return _fileTranslation; };
|
||||
virtual std::vector<double> getCaptureProgression(){ return _captureProgression; };
|
||||
// temporary need to figure this out
|
||||
std::map<std::string, Decoder*> getTranslation(){ return _fileTranslation; };
|
||||
virtual std::vector<double> getCaptureProgression(){ return _captureProgression; };
|
||||
|
||||
private:
|
||||
void createImage(Image& image,
|
||||
double startTime,
|
||||
double stopTime,
|
||||
std::vector<std::string> instr,
|
||||
std::string targ,
|
||||
std::string pot);
|
||||
private:
|
||||
void createImage(Image& image,
|
||||
double startTime,
|
||||
double stopTime,
|
||||
std::vector<std::string> instr,
|
||||
std::string targ,
|
||||
std::string path);
|
||||
|
||||
bool augmentWithSpice(Image& image,
|
||||
std::string spacecraft,
|
||||
std::vector<std::string> payload,
|
||||
std::vector<std::string> potentialTargets);
|
||||
std::string decode(std::string line);
|
||||
|
||||
bool augmentWithSpice(Image& image,
|
||||
std::string spacecraft,
|
||||
std::vector<std::string> payload,
|
||||
std::vector<std::string> potentialTargets);
|
||||
|
||||
std::string _fileName;
|
||||
std::string _spacecraft;
|
||||
std::map<std::string, Decoder*> _fileTranslation;
|
||||
std::vector<std::string> _specsOfInterest;
|
||||
std::string _fileName;
|
||||
std::string _spacecraft;
|
||||
std::map<std::string, Decoder*> _fileTranslation;
|
||||
std::vector<std::string> _specsOfInterest;
|
||||
|
||||
//returnable
|
||||
std::map<std::string, ImageSubset> _subsetMap;
|
||||
std::vector<std::pair<std::string, TimeRange>> _instrumentTimes;
|
||||
std::vector<std::pair<double, std::string>> _targetTimes;
|
||||
std::vector<double> _captureProgression;
|
||||
};
|
||||
//returnable
|
||||
std::map<std::string, ImageSubset> _subsetMap;
|
||||
std::vector<std::pair<std::string, TimeRange>> _instrumentTimes;
|
||||
std::vector<std::pair<double, std::string>> _targetTimes;
|
||||
std::vector<double> _captureProgression;
|
||||
|
||||
|
||||
std::string _target;
|
||||
std::string _instrumentID;
|
||||
std::string _instrumentHostID;
|
||||
std::string _detectorType;
|
||||
std::string _sequenceID;
|
||||
double _startTime;
|
||||
double _stopTime;
|
||||
};
|
||||
}
|
||||
#endif //__LABELPARSER_H__
|
||||
@@ -35,8 +35,11 @@ public:
|
||||
ScannerDecoder(const ghoul::Dictionary& dictionary);
|
||||
virtual std::string getDecoderType();
|
||||
virtual std::vector<std::string> getSpiceIDs();
|
||||
std::string getStopCommand();
|
||||
void setStopCommand(std::string stopCommand);
|
||||
private:
|
||||
std::string _type;
|
||||
std::string _abort;
|
||||
std::vector<std::string> _spiceIDs;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace openspace {
|
||||
double startTime;
|
||||
double stopTime;
|
||||
std::string path;
|
||||
std::vector<std::string> activeInstruments;
|
||||
std::vector<std::string> activeInstruments;
|
||||
std::string target;
|
||||
bool projected;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user