Modularized the base classes

This commit is contained in:
Alexander Bock
2015-05-20 19:19:10 +02:00
parent fdead75cfa
commit 523abd6529
61 changed files with 438 additions and 99 deletions
@@ -22,29 +22,29 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __WAVEFRONTGEOMETRY_H__
#define __WAVEFRONTGEOMETRY_H__
#ifndef __MODULEENGINE_H__
#define __MODULEENGINE_H__
#include <openspace/rendering/model/modelgeometry.h>
#include <vector>
namespace openspace {
class RenderableModel;
class OpenSpaceModule;
namespace modelgeometry {
class WavefrontGeometry : public ModelGeometry {
class ModuleEngine {
public:
WavefrontGeometry(const ghoul::Dictionary& dictionary);
bool initialize();
bool deinitialize();
bool initialize(RenderableModel* parent) override;
void deinitialize() override;
private:
bool loadModel(const std::string& filename);
void registerModules(std::vector<OpenSpaceModule*> modules);
void registerModule(OpenSpaceModule* module);
const std::vector<OpenSpaceModule*> modules() const;
protected:
std::vector<OpenSpaceModule*> _modules;
};
} // namespace modelgeometry
} // namespace openspace
#endif // __WAVEFRONTOBJECT_H__
} // namespace openspace
#endif // __MODULEENGINE_H__
@@ -44,6 +44,7 @@ class NetworkEngine;
class GUI;
class RenderEngine;
class SyncBuffer;
class ModuleEngine;
namespace interaction {
class InteractionHandler;
@@ -71,6 +72,7 @@ public:
scripting::ScriptEngine* scriptEngine();
NetworkEngine* networkEngine();
LuaConsole* console();
ModuleEngine* moduleEngine();
gui::GUI* gui();
@@ -116,6 +118,7 @@ private:
NetworkEngine* _networkEngine;
ghoul::cmdparser::CommandlineParser* _commandlineParser;
LuaConsole* _console;
ModuleEngine* _moduleEngine;
gui::GUI* _gui;
bool _isMaster;
@@ -1,73 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __MODELGEOMETRY_H__
#define __MODELGEOMETRY_H__
#include <openspace/properties/propertyowner.h>
#include <openspace/rendering/model/renderablemodel.h>
#include <ghoul/misc/dictionary.h>
namespace openspace {
namespace modelgeometry {
class ModelGeometry : public properties::PropertyOwner {
public:
static ModelGeometry* createFromDictionary(const ghoul::Dictionary& dictionary);
ModelGeometry(const ghoul::Dictionary& dictionary);
virtual ~ModelGeometry();
virtual bool initialize(RenderableModel* parent);
virtual void deinitialize();
void render();
virtual bool loadModel(const std::string& filename) = 0;
void changeRenderMode(const GLenum mode);
protected:
RenderableModel* _parent;
struct Vertex {
GLfloat location[4];
GLfloat tex[2];
GLfloat normal[3];
};
bool loadObj(const std::string& filename);
bool loadCachedFile(const std::string& filename);
bool saveCachedFile(const std::string& filename);
GLuint _vaoID;
GLuint _vbo;
GLuint _ibo;
GLenum _mode;
std::vector<Vertex> _vertices;
std::vector<int> _indices;
std::string _file;
};
} // namespace modelgeometry
} // namespace openspace
#endif // __MODELGEOMETRY_H__
@@ -1,84 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLEMODEL_H__
#define __RENDERABLEMODEL_H__
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace openspace {
namespace modelgeometry {
class ModelGeometry;
}
class RenderableModel : public Renderable {
public:
RenderableModel(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;
protected:
void loadTexture();
private:
properties::StringProperty _colorTexturePath;
properties::BoolProperty _performFade;
properties::FloatProperty _fading;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
modelgeometry::ModelGeometry* _geometry;
float _alpha;
glm::dmat3 _stateMatrix;
std::string _source;
std::string _destination;
std::string _target;
//bool _isGhost;
int _frameCount;
psc _sunPosition;
properties::BoolProperty _performShading;
};
} // namespace openspace
#endif // __RENDERABLEMODEL_H__
@@ -1,53 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __PlanetGeometryProjection_H__
#define __PlanetGeometryProjection_H__
#include <openspace/properties/propertyowner.h>
#include <openspace/rendering/planets/renderableplanetprojection.h>
#include <ghoul/misc/dictionary.h>
namespace openspace {
namespace planetgeometryprojection {
class PlanetGeometryProjection : public properties::PropertyOwner {
public:
static PlanetGeometryProjection* createFromDictionary(const ghoul::Dictionary& dictionary);
PlanetGeometryProjection();
virtual ~PlanetGeometryProjection();
virtual bool initialize(RenderablePlanetProjection* parent);
virtual void deinitialize();
virtual void render() = 0;
protected:
RenderablePlanetProjection* _parent;
};
} // namespace planetgeometry
} // namespace openspace
#endif // __PLANETGEOMETRY_H__
@@ -1,83 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLEPLANET_H__
#define __RENDERABLEPLANET_H__
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/util/updatestructures.h>
// ghoul includes
namespace ghoul {
namespace opengl {
class ProgramObject;
class Texture;
}
}
namespace openspace {
namespace planetgeometry {
class PlanetGeometry;
}
class RenderablePlanet : public Renderable {
public:
RenderablePlanet(const ghoul::Dictionary& dictionary);
~RenderablePlanet();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
protected:
void loadTexture();
private:
properties::StringProperty _colorTexturePath;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
ghoul::opengl::Texture* _nightTexture;
planetgeometry::PlanetGeometry* _geometry;
properties::BoolProperty _performShading;
properties::IntProperty _rotation;
float _alpha;
glm::dmat3 _stateMatrix;
std::string _nightTexturePath;
std::string _frame;
std::string _target;
bool _hasNightTexture;
double _time;
};
} // namespace openspace
#endif // __RENDERABLEPLANET_H__
@@ -1,155 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLEPLANETPROJECTION_H__
#define __RENDERABLEPLANETPROJECTION_H__
#include <ghoul/opengl/textureunit.h>
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/util/imagesequencer2.h>
#include <openspace/util/sequenceparser.h>
#include <openspace/util/hongkangparser.h>
#include <openspace/util/labelparser.h>
#include <openspace/util/decoder.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/opengl/framebufferobject.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <openspace/query/query.h>
namespace openspace {
namespace planetgeometryprojection {
class PlanetGeometryProjection;
}
class RenderablePlanetProjection : public Renderable {
public:
RenderablePlanetProjection(const ghoul::Dictionary& dictionary);
~RenderablePlanetProjection();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
protected:
void loadTexture();
void loadProjectionTexture();
bool auxiliaryRendertarget();
glm::mat4 computeProjectorMatrix(const glm::vec3 loc, glm::dvec3 aim, const glm::vec3 up);
void attitudeParameters(double time);
void textureBind();
void project();
void clearAllProjections();
private:
void imageProjectGPU();
std::map<std::string, Decoder*> _fileTranslation;
properties::StringProperty _colorTexturePath;
properties::StringProperty _projectionTexturePath;
properties::IntProperty _rotation;
properties::FloatProperty _fadeProjection;
properties::BoolProperty _performProjection;
properties::BoolProperty _clearAllProjections;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::ProgramObject* _fboProgramObject;
ghoul::opengl::Texture* _texture;
ghoul::opengl::Texture* _textureOriginal;
ghoul::opengl::Texture* _textureProj;
ghoul::opengl::Texture* _textureWhiteSquare;
planetgeometryprojection::PlanetGeometryProjection* _geometry;
glm::vec2 _camScaling;
glm::vec3 _up;
glm::mat4 _transform;
glm::mat4 _projectorMatrix;
//sequenceloading
std::string _sequenceSource;
std::string _sequenceType;
bool _foundSequence;
// spice
std::string _instrumentID;
std::string _projectorID;
std::string _projecteeID;
std::string _aberration;
std::vector<std::string> _potentialTargets; // @TODO copy-n-paste from renderablefov
float _fovy;
float _aspectRatio;
float _nearPlane;
float _farPlane;
glm::dmat3 _stateMatrix;
glm::dmat3 _instrumentMatrix;
glm::vec3 _boresight;
double _time;
double _previousTime;
double _previousCapture;
double lightTime;
std::vector<Image> _imageTimes;
int _sequenceID;
std::string _target;
std::string _frame;
std::string _defaultProjImage;
std::string _clearingImage;
std::string _next;
bool _capture;
// FBO stuff
GLuint _fboID;
GLuint _quad;
GLuint _vertexPositionBuffer;
};
} // namespace openspace
#endif // __RENDERABLEPLANETPROJECTION_H__
@@ -1,64 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __SIMPLESPHEREGEOMETRY_H__
#define __SIMPLESPHEREGEOMETRY_H__
#include <openspace/rendering/planets/planetgeometry.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/properties/scalarproperty.h>
namespace openspace {
class RenderablePlanet;
class PowerScaledSphere;
namespace planetgeometry {
class SimpleSphereGeometry : public PlanetGeometry {
public:
SimpleSphereGeometry(const ghoul::Dictionary& dictionary);
~SimpleSphereGeometry();
bool initialize(RenderablePlanet* parent) override;
void deinitialize() override;
void render() override;
PowerScaledSphere* _planet;
private:
void createSphere();
glm::vec2 _modRadius;
properties::Vec4Property _realRadius;
properties::IntProperty _segments;
std::string _name;
PowerScaledSphere* _sphere;
};
} // namespace planetgeometry
} // namespace openspace
#endif // __SIMPLESPHEREGEOMETRY_H__
@@ -1,63 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __SIMPLESPHEREGEOMETRYPROJECTION_H__
#define __SIMPLESPHEREGEOMETRYPROJECTION_H__
#include <openspace/rendering/planets/planetgeometryprojection.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/util/powerscaledsphere.h>
namespace openspace {
class RenderablePlanet;
namespace planetgeometryprojection {
class SimpleSphereGeometryProjection : public PlanetGeometryProjection {
public:
SimpleSphereGeometryProjection(const ghoul::Dictionary& dictionary);
~SimpleSphereGeometryProjection();
bool initialize(RenderablePlanetProjection* parent) override;
void deinitialize() override;
void render() override;
private:
void createSphere();
glm::vec2 _modRadius;
properties::Vec4Property _realRadius;
properties::IntProperty _segments;
std::string _name;
PowerScaledSphere* _planet;
};
} // namespace planetgeometry
} // namespace openspace
#endif // __SIMPLESPHEREGEOMETRY_H__
@@ -1,71 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLEPLANET_H__
#define __RENDERABLEPLANET_H__
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/util/updatestructures.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace openspace {
namespace planetgeometry {
class PlanetGeometry;
}
class RenderablePlanet : public Renderable {
public:
RenderablePlanet(const ghoul::Dictionary& dictionary);
~RenderablePlanet();
bool initialize() override;
bool deinitialize() override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
protected:
void loadTexture();
private:
properties::StringProperty _colorTexturePath;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
planetgeometry::PlanetGeometry* _geometry;
glm::dmat3 _stateMatrix;
std::string _target;
};
} // namespace openspace
#endif // __RENDERABLEPLANET_H__
@@ -1,65 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLECRAWLINGLINE_H__
#define __RENDERABLECRAWLINGLINE_H__
#include <openspace/rendering/renderable.h>
namespace openspace {
class RenderableCrawlingLine : public Renderable {
public:
RenderableCrawlingLine(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:
ghoul::opengl::ProgramObject* _program;
std::string _instrumentName;
std::string _source;
std::string _target;
std::string _referenceFrame;
glm::vec3 _lineColor;
psc _positions[2];
int _frameCounter;
bool _drawLine;
float _imageSequenceTime;
GLuint _vao;
GLuint _vbo;
};
} // namespace openspace
#endif // __RENDERABLECRAWLINGLINE_H__
@@ -1,98 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLEFIELDLINES_H__
#define __RENDERABLEFIELDLINES_H__
#include <openspace/rendering/renderable.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/properties/vectorproperty.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/opengl/ghoul_gl.h>
namespace ghoul {
namespace opengl {
class ProgramObject;
}
}
namespace openspace {
struct LinePoint;
class RenderableFieldlines : public Renderable {
public:
RenderableFieldlines(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:
typedef std::vector<LinePoint> Line;
void initializeDefaultPropertyValues();
//std::vector<std::vector<LinePoint> > getFieldlinesData(std::string filename, ghoul::Dictionary hintsDictionary);
std::vector<Line> getFieldlinesData();
void loadSeedPoints();
void loadSeedPointsFromFile();
void loadSeedPointsFromTable();
std::vector<Line> generateFieldlines();
std::vector<Line> generateFieldlinesVolumeKameleon();
properties::FloatProperty _stepSize;
properties::BoolProperty _classification;
properties::Vec4Property _fieldlineColor;
properties::OptionProperty _seedPointSource;
properties::StringProperty _seedPointSourceFile;
ghoul::opengl::ProgramObject* _program;
ghoul::Dictionary _vectorFieldInfo;
ghoul::Dictionary _fieldlineInfo;
ghoul::Dictionary _seedPointsInfo;
bool _seedPointsAreDirty;
bool _fieldLinesAreDirty;
std::vector<glm::vec3> _seedPoints;
GLuint _fieldlineVAO;
GLuint _vertexPositionBuffer;
std::vector<GLint> _lineStart;
std::vector<GLsizei> _lineCount;
};
} // namespace openspace
#endif // __RENDERABLEFIELDLINES_H__
-127
View File
@@ -1,127 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RenderableFov_H__
#define __RenderableFov_H__
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/query/query.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
//#include <openspace/util/runtimedata.h>
#include <openspace/util/powerscaledcoordinate.h>
namespace openspace {
class RenderableFov : public Renderable{
public:
RenderableFov(const ghoul::Dictionary& dictionary);
~RenderableFov();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
properties::FloatProperty _lineWidth;
properties::BoolProperty _drawSolid;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
openspace::SceneGraphNode* _targetNode;
void loadTexture();
void allocateData();
void insertPoint(std::vector<float>& arr, psc p, glm::vec4 c);
void fovProjection(bool H[], std::vector<glm::dvec3> bounds);
psc orthogonalProjection(glm::dvec3 camvec);
psc checkForIntercept(glm::dvec3 ray);
psc pscInterpolate(psc p0, psc p1, float t);
psc sphericalInterpolate(glm::dvec3 p0, glm::dvec3 p1, float t);
glm::dvec3 interpolate(glm::dvec3 p0, glm::dvec3 p1, float t);
glm::dvec3 bisection(glm::dvec3 p1, glm::dvec3 p2, double tolerance);
void computeColors();
// instance variables
int _nrInserted = 0;
int _isteps;
bool _rebuild = false;
bool _interceptTag[9];
bool _withinFOV;
psc _projectionBounds[8];
psc _interceptVector;
// spice
std::string _spacecraft;
std::string _observer;
std::string _frame;
std::string _instrumentID;
std::string _method;
std::string _aberrationCorrection;
std::string _fovTarget;
std::vector<std::string> _potentialTargets;
glm::dvec3 ipoint, ivec;
glm::dvec3 _previousHalf;
glm::vec3 _c;
double _r, _g, _b;
// GPU stuff
GLuint _vaoID[2] ;
GLuint _vboID[2] ;
GLuint _iboID[2];
GLenum _mode;
unsigned int _isize[2];
unsigned int _vsize[2];
unsigned int _vtotal[2];
unsigned int _stride[2];
std::vector<float> _varray1;
std::vector<float> _varray2;
int* _iarray1[2];
void updateData();
void sendToGPU();
glm::dmat3 _stateMatrix;
// time
double _time = 0;
double _oldTime = 0;
// capturetime
double _timeInterval;
double _nextCaptureTime;
};
}
#endif
@@ -1,94 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLEPATH_H__
#define __RENDERABLEPATH_H__
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/vectorproperty.h>
#include <ghoul/opengl/ghoul_gl.h>
namespace ghoul {
namespace opengl {
class ProgramObject;
class Texture;
}
}
namespace openspace {
class RenderablePath : public Renderable {
public:
RenderablePath(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;
void calculatePath(std::string observer);
private:
struct VertexInfo {
float x, y, z, e;
//float r, g, b, a;
};
void sendToGPU();
void addPosition(psc pos);
void addColor(glm::vec4 col);
glm::vec3 _lineColor;
glm::vec4 _lastPosition;
properties::FloatProperty _lineFade;
properties::FloatProperty _lineWidth;
properties::BoolProperty _drawLine;
ghoul::opengl::ProgramObject* _programObject;
bool _successfullDictionaryFetch;
std::string _target;
std::string _observer;
std::string _frame;
GLuint _vaoID;
GLuint _vBufferID;
bool _needsSweep;
std::vector<VertexInfo> _vertexArray;
float _increment;
double _start;
double _stop;
float _distanceFade;
};
} // namespace openspace
#endif // __RENDERABLEPATH_H__
@@ -1,86 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef RENDERABLEPLANE_H_
#define RENDERABLEPLANE_H_
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/util/updatestructures.h>
namespace ghoul {
namespace filesystem {
class File;
}
namespace opengl {
class ProgramObject;
class Texture;
}
}
namespace openspace {
struct LinePoint;
class RenderablePlane : public Renderable {
enum class Origin {
LowerLeft, LowerRight, UpperLeft, UpperRight, Center
};
public:
RenderablePlane(const ghoul::Dictionary& dictionary);
~RenderablePlane();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
void loadTexture();
void createPlane();
properties::StringProperty _texturePath;
properties::BoolProperty _billboard;
properties::Vec2Property _size;
Origin _origin;
bool _planeIsDirty;
ghoul::opengl::ProgramObject* _shader;
bool _textureIsDirty;
ghoul::opengl::Texture* _texture;
ghoul::filesystem::File* _textureFile;
GLuint _quad;
GLuint _vertexPositionBuffer;
};
} // namespace openspace
#endif // RENDERABLEFIELDLINES_H_
@@ -1,98 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef _RENDERABLEPLANEPROJECTION_H_
#define _RENDERABLEPLANEPROJECTION_H_
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/util/imagesequencer2.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/util/updatestructures.h>
namespace ghoul {
namespace filesystem {
class File;
}
namespace opengl {
class ProgramObject;
class Texture;
}
}
namespace openspace {
struct LinePoint;
struct target {
std::string body;
std::string frame;
std::string node;
};
class RenderablePlaneProjection : public Renderable {
public:
RenderablePlaneProjection(const ghoul::Dictionary& dictionary);
~RenderablePlaneProjection();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
void loadTexture();
void updatePlane(const Image img, double currentTime);
std::string findClosestTarget(double currentTime);
void setTarget(std::string body);
std::string _texturePath;
bool _planeIsDirty;
glm::dmat3 _stateMatrix;
std::string _frame;
ghoul::opengl::ProgramObject* _shader;
bool _textureIsDirty;
ghoul::opengl::Texture* _texture;
ghoul::filesystem::File* _textureFile;
GLuint _quad;
GLuint _vertexPositionBuffer;
std::string _spacecraft;
std::string _instrument;
double _previousTime;
target _target;
std::string _name;
bool _moving;
};
} // namespace openspace
#endif
@@ -1,74 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLESPHERE_H__
#define __RENDERABLESPHERE_H__
#include <openspace/rendering/renderable.h>
#include <openspace/util/updatestructures.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/vectorproperty.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace openspace {
class PowerScaledSphere;
class RenderableSphere : public Renderable {
public:
RenderableSphere(const ghoul::Dictionary& dictionary);
~RenderableSphere();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
void loadTexture();
properties::StringProperty _texturePath;
properties::OptionProperty _orientation;
properties::Vec2Property _size;
properties::IntProperty _segments;
properties::FloatProperty _transparency;
ghoul::opengl::ProgramObject* _shader;
ghoul::opengl::Texture* _texture;
PowerScaledSphere* _sphere;
bool _sphereIsDirty;
};
} // namespace openspace
#endif // __RENDERABLESPHERE_H__
@@ -1,83 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLESPHERICALGRID_H__
#define __RENDERABLESPHERICALGRID_H__
// more or less a brutal adaptation of powerscaledsphere class
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace openspace {
class RenderableSphericalGrid : public Renderable{
public:
RenderableSphericalGrid(const ghoul::Dictionary& dictionary);
~RenderableSphericalGrid();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
protected:
typedef struct {
GLfloat location[4];
GLfloat tex[2];
GLfloat normal[3];
GLubyte padding[28]; // Pads the struct out to 64 bytes for performance increase
} Vertex;
ghoul::opengl::ProgramObject* _gridProgram;
std::string _gridType;
glm::vec4 _gridColor;
glm::mat4 _gridMatrix;
int _segments;
bool staticGrid;
std::string _parentsRotation;
glm::dmat3 _parentMatrix;
PowerScaledScalar _radius;
GLuint _vaoID = 3;
GLuint _vBufferID = 4;
GLuint _iBufferID = 5;
GLenum _mode;
unsigned int _isize;
unsigned int _vsize;
Vertex* _varray;
int* _iarray;
};
}// namespace openspace
#endif
@@ -1,94 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLETRAIL_H__
#define __RENDERABLETRAIL_H__
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/vectorproperty.h>
#include <ghoul/opengl/ghoul_gl.h>
namespace ghoul {
namespace opengl {
class ProgramObject;
class Texture;
}
}
namespace openspace {
class RenderableTrail : public Renderable {
public:
RenderableTrail(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:
struct TrailVBOLayout {
float x, y, z, e;
};
void fullYearSweep(double time);
void sendToGPU();
properties::Vec3Property _lineColor;
properties::FloatProperty _lineFade;
properties::FloatProperty _lineWidth;
properties::BoolProperty _showTimestamps;
ghoul::opengl::ProgramObject* _programObject;
bool _successfullDictionaryFetch;
std::string _target;
std::string _observer;
std::string _frame;
float _tropic;
float _ratio;
float _day;
GLuint _vaoID;
GLuint _vBufferID;
bool _needsSweep;
std::vector<TrailVBOLayout> _vertexArray;
float _increment;
double _oldTime = 0.0;
float _distanceFade;
};
} // namespace openspace
#endif // __RENDERABLETRAIL_H__
@@ -1,63 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLEVOLUME_H__
#define __RENDERABLEVOLUME_H__
// open space includes
#include <openspace/rendering/renderable.h>
// ghoul includes
#include <ghoul/io/rawvolumereader.h>
// Forward declare to minimize dependencies
namespace ghoul {
namespace filesystem {
class File;
}
namespace opengl {
class Texture;
}
}
namespace openspace {
class RenderableVolume: public Renderable {
public:
// constructors & destructor
RenderableVolume(const ghoul::Dictionary& dictionary);
~RenderableVolume();
protected:
ghoul::opengl::Texture* loadVolume(const std::string& filepath, const ghoul::Dictionary& hintsDictionary);
glm::vec3 getVolumeOffset(const std::string& filepath, const ghoul::Dictionary& hintsDictionary);
ghoul::RawVolumeReader::ReadHints readHints(const ghoul::Dictionary& dictionary);
ghoul::opengl::Texture* loadTransferFunction(const std::string& filepath);
private:
};
} // namespace openspace
#endif
@@ -1,86 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLEVOLUMEGL_H__
#define __RENDERABLEVOLUMEGL_H__
#include <openspace/rendering/renderablevolume.h>
#include <openspace/util/powerscaledcoordinate.h>
// Forward declare to minimize dependencies
namespace ghoul {
namespace filesystem {
class File;
}
namespace opengl {
class ProgramObject;
class Texture;
}
}
namespace openspace {
class RenderableVolumeGL: public RenderableVolume {
public:
RenderableVolumeGL(const ghoul::Dictionary& dictionary);
~RenderableVolumeGL();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
virtual void render(const RenderData& data) override;
virtual void update(const UpdateData& data) override;
private:
ghoul::Dictionary _hintsDictionary;
std::string _filename;
std::string _transferFunctionName;
std::string _volumeName;
std::string _transferFunctionPath;
std::string _samplerFilename;
ghoul::filesystem::File* _transferFunctionFile;
ghoul::opengl::Texture* _volume;
ghoul::opengl::Texture* _transferFunction;
GLuint _boxArray;
GLuint _vertexPositionBuffer;
ghoul::opengl::ProgramObject* _boxProgram;
glm::vec3 _boxScaling;
psc _pscOffset;
float _w;
bool _updateTransferfunction;
int _id;
};
} // namespace openspace
#endif
@@ -1,129 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLECONSTELLATIONBOUNDS_H__
#define __RENDERABLECONSTELLATIONBOUNDS_H__
#include <openspace/rendering/renderable.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/properties/selectionproperty.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>ConstellationFile</code> [string]: The file that contains the mapping between
* abbreviations and full names. If the file is omitted, the abbreviations are used as the
* full names.
* <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>
*/
class RenderableConstellationBounds : public Renderable {
public:
RenderableConstellationBounds(const ghoul::Dictionary& dictionary);
~RenderableConstellationBounds();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
/// Stores the constellation bounds
struct ConstellationBound {
std::string constellationAbbreviation; ///< The abbreviation of the constellation
std::string constellationFullName;
bool isEnabled;
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>_vertexFilename</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 loadVertexFile();
/**
* Loads the file specified in <code>_constellationFilename</code> that contains the
* mapping between abbreviations and full names of constellations.
* \return <code>true</code> if the loading succeeded, <code>false</code> otherwise
*/
bool loadConstellationFile();
/// Fills the <code>_constellationSelection</code> property with all constellations
void fillSelectionProperty();
/**
* Callback method that gets triggered when <code>_constellationSelection</code>
* changes.
*/
void selectionPropertyHasChanged();
std::string _vertexFilename; ///< The filename containing the constellation bounds
std::string _constellationFilename; ///< The file containing constellation names
ghoul::opengl::ProgramObject* _program;
/// The list of all loaded constellation bounds
std::vector<ConstellationBound> _constellationBounds;
typedef std::array<float, 3> Vertex;
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;
/// The property that stores all indices of constellations that should be drawn
properties::SelectionProperty _constellationSelection;
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;
GLuint _vbo;
};
} // namespace openspace
#endif // __RENDERABLECONSTELLATIONBOUNDS_H__
@@ -1,93 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERABLESTARS_H__
#define __RENDERABLESTARS_H__
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/vectorproperty.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace openspace {
class RenderableStars : public Renderable {
public:
RenderableStars(const ghoul::Dictionary& dictionary);
~RenderableStars();
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 _pointSpreadFunctionTexturePath;
ghoul::opengl::Texture* _pointSpreadFunctionTexture;
bool _pointSpreadFunctionTextureIsDirty;
properties::StringProperty _colorTexturePath;
ghoul::opengl::Texture* _colorTexture;
bool _colorTextureIsDirty;
properties::OptionProperty _colorOption;
bool _dataIsDirty;
properties::FloatProperty _scaleFactor;
properties::FloatProperty _minBillboardSize;
ghoul::opengl::ProgramObject* _program;
std::string _speckFile;
std::vector<float> _slicedData;
std::vector<float> _fullData;
int _nValuesPerStar;
GLuint _vao;
GLuint _vbo;
};
} // namespace openspace
#endif // __RENDERABLESTARS_H__
@@ -22,32 +22,29 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __PLANETGEOMETRY_H__
#define __PLANETGEOMETRY_H__
#ifndef __OPENSPACEMODULE_H__
#define __OPENSPACEMODULE_H__
#include <openspace/properties/propertyowner.h>
#include <openspace/rendering/planets/renderableplanet.h>
#include <ghoul/misc/dictionary.h>
#include <string>
namespace openspace {
namespace planetgeometry {
class PlanetGeometry : public properties::PropertyOwner {
class OpenSpaceModule {
public:
static PlanetGeometry* createFromDictionary(const ghoul::Dictionary& dictionary);
OpenSpaceModule() = default;
virtual ~OpenSpaceModule() = default;
PlanetGeometry();
virtual ~PlanetGeometry();
virtual bool initialize(RenderablePlanet* parent);
virtual void deinitialize();
virtual void render() = 0;
virtual bool initialize() { return true; }
virtual bool deinitialize() { return true; }
std::string name() const { return _name; }
protected:
RenderablePlanet* _parent;
void setName(std::string name) { _name = std::move(name); }
std::string _name;
};
} // namespace planetgeometry
} // namespace openspace
} // namespace openspace
#endif // __PLANETGEOMETRY_H__
#endif // __OPENSPACEMODULE_H__