mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 20:50:59 -05:00
Finished with current version of ConstellationBounds
This commit is contained in:
@@ -27,13 +27,29 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
/**
|
||||
* This class renders the constellation bounds as defined in
|
||||
* http://cdsarc.u-strasbg.fr/viz-bin/Cat?cat=VI%2F49. It contains the bounds on the
|
||||
* celestial sky for the different constellations and is used to determine in which region
|
||||
* of the sky a specific object is located.
|
||||
* The bounds are drawn as lines on a sphere with variable radius, set by the
|
||||
* <code>_distance</code> property. Currently, all constellation bounds are lines, which
|
||||
* leads to artifacts if the radius is very small.
|
||||
* Renderable configuration attributes:
|
||||
* <code>File</code> [string] (required): The file that contains the bounds and the
|
||||
* abbreviations for the different constellations
|
||||
* <code>ReferenceFrame</code> [string]: The reference frame in which the points contained
|
||||
* in the <code>File</code> are stored in. Defaults to <code>J2000</code>
|
||||
*
|
||||
* @TODO Add a method to load (and access) a table translating from abbreviations to
|
||||
* full names ---abock
|
||||
* @TODO Make it possible to only show a subset of constellation bounds ---abock
|
||||
*/
|
||||
class RenderableConstellationBounds : public Renderable {
|
||||
public:
|
||||
RenderableConstellationBounds(const ghoul::Dictionary& dictionary);
|
||||
@@ -47,28 +63,39 @@ public:
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
/// Stores the constellation bounds
|
||||
struct ConstellationBound {
|
||||
std::string constellation;
|
||||
int startIndex;
|
||||
int nVertices;
|
||||
std::string constellation; ///< The abbreviation of the constellation
|
||||
size_t startIndex; ///< The index of the first vertex describing the bounds
|
||||
size_t nVertices; ///< The number of vertices describing the bounds
|
||||
};
|
||||
|
||||
/**
|
||||
* Loads the file specified in <code>_filename</code> and fills the
|
||||
* <code>_constellationBounds</code> variable, as well as the
|
||||
* <code>_vertexValues</code> list. If this method fails, the content of either
|
||||
* destination is undefined.
|
||||
* \return <code>true</code> if the loading succeeded, <code>false</code> otherwise
|
||||
*/
|
||||
bool loadFile();
|
||||
|
||||
|
||||
std::string _filename;
|
||||
std::string _filename; ///< The filename containing the constellation bounds
|
||||
|
||||
ghoul::opengl::ProgramObject* _program;
|
||||
bool _programIsDirty;
|
||||
|
||||
/// The list of all loaded constellation bounds
|
||||
std::vector<ConstellationBound> _constellationBounds;
|
||||
|
||||
typedef std::array<float, 3> Vertex;
|
||||
std::vector<Vertex> _vertexValues;
|
||||
std::vector<Vertex> _vertexValues; ///< A list of all vertices of all bounds
|
||||
|
||||
/// The radius of the celestial sphere onto which the bounds are drawn
|
||||
properties::FloatProperty _distance;
|
||||
|
||||
std::string _originReferenceFrame;
|
||||
std::string _originReferenceFrame; ///< Reference frame in which bounds are defined
|
||||
|
||||
/// Used to translate between the origin reference frame and the target frame
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
GLuint _vao;
|
||||
@@ -78,67 +105,3 @@ private:
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __RENDERABLECONSTELLATIONBOUNDS_H__
|
||||
|
||||
//#ifndef __RENDERABLESTARS_H__
|
||||
//#define __RENDERABLESTARS_H__
|
||||
//
|
||||
//#include <openspace/rendering/renderable.h>
|
||||
//#include <openspace/properties/stringproperty.h>
|
||||
//#include <openspace/properties/optionproperty.h>
|
||||
//
|
||||
//#include <ghoul/opengl/programobject.h>
|
||||
//#include <ghoul/opengl/texture.h>
|
||||
//
|
||||
//namespace openspace {
|
||||
//
|
||||
//class RenderableStars : public Renderable {
|
||||
//public:
|
||||
// RenderableStars(const ghoul::Dictionary& dictionary);
|
||||
//
|
||||
// bool initialize() override;
|
||||
// bool deinitialize() override;
|
||||
//
|
||||
// bool isReady() const override;
|
||||
//
|
||||
// void render(const RenderData& data) override;
|
||||
// void update(const UpdateData& data) override;
|
||||
//
|
||||
//private:
|
||||
// enum ColorOption {
|
||||
// Color = 0,
|
||||
// Velocity = 1,
|
||||
// Speed = 2
|
||||
// };
|
||||
//
|
||||
// void createDataSlice(ColorOption option);
|
||||
//
|
||||
// bool loadData();
|
||||
// bool readSpeckFile();
|
||||
// bool loadCachedFile(const std::string& file);
|
||||
// bool saveCachedFile(const std::string& file) const;
|
||||
//
|
||||
// properties::StringProperty _colorTexturePath;
|
||||
// ghoul::opengl::Texture* _texture;
|
||||
// bool _textureIsDirty;
|
||||
//
|
||||
// properties::OptionProperty _colorOption;
|
||||
// bool _dataIsDirty;
|
||||
//
|
||||
// properties::FloatProperty _spriteSize;
|
||||
//
|
||||
// ghoul::opengl::ProgramObject* _program;
|
||||
// bool _programIsDirty;
|
||||
//
|
||||
// std::string _speckFile;
|
||||
//
|
||||
// std::vector<float> _slicedData;
|
||||
// std::vector<float> _fullData;
|
||||
// int _nValuesPerStar;
|
||||
//
|
||||
// GLuint _vao;
|
||||
// GLuint _vbo;
|
||||
//};
|
||||
//
|
||||
//} // namespace openspace
|
||||
//
|
||||
//#endif // __RENDERABLESTARS_H__
|
||||
Reference in New Issue
Block a user