Merge branch 'develop' of openspace.itn.liu.se:/openspace into develop

Conflicts:
	src/scenegraph/scenegraph.cpp
This commit is contained in:
Jonas Strandstedt
2014-12-02 11:19:51 +01:00
51 changed files with 1155 additions and 955 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ enum class KeyAction {
};
enum class KeyModifier {
None = 0,
NoModifier = 0,
Shift = GLFW_MOD_SHIFT,
Control = GLFW_MOD_CONTROL,
Alt = GLFW_MOD_ALT,
+8 -8
View File
@@ -40,14 +40,14 @@ enum class MouseButton {
Left = SGCT_MOUSE_BUTTON_LEFT,
Right = SGCT_MOUSE_BUTTON_RIGHT,
Middle = SGCT_MOUSE_BUTTON_MIDDLE,
Button1 = SGCT_MOUSE_BUTTON_1,
Button2 = SGCT_MOUSE_BUTTON_2,
Button3 = SGCT_MOUSE_BUTTON_3,
Button4 = SGCT_MOUSE_BUTTON_4,
Button5 = SGCT_MOUSE_BUTTON_5,
Button6 = SGCT_MOUSE_BUTTON_6,
Button7 = SGCT_MOUSE_BUTTON_7,
Button8 = SGCT_MOUSE_BUTTON_8,
//Button1 = SGCT_MOUSE_BUTTON_1,
//Button2 = SGCT_MOUSE_BUTTON_2,
//Button3 = SGCT_MOUSE_BUTTON_3,
//Button4 = SGCT_MOUSE_BUTTON_4,
//Button5 = SGCT_MOUSE_BUTTON_5,
//Button6 = SGCT_MOUSE_BUTTON_6,
//Button7 = SGCT_MOUSE_BUTTON_7,
//Button8 = SGCT_MOUSE_BUTTON_8,
ButtonLast = SGCT_MOUSE_BUTTON_LAST,
};
@@ -0,0 +1,97 @@
/*****************************************************************************************
* *
* 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 __OPTIONPROPERTY_H__
#define __OPTIONPROPERTY_H__
#include <openspace/properties/scalarproperty.h>
#include <vector>
namespace openspace {
namespace properties {
/**
* The OptionProperty is a property that provides a number of predefined (using the
* addOption method) options consisting of a <code>description</code> and a
* <code>value</code>. The available options can be queried using the options method.
* Only values representing valid options can be used to set this property, or an error
* will be logged
*/
class OptionProperty : public IntProperty {
public:
/**
* The struct storing a single option consisting of an integer <code>value</code> and
* a <code>string</code> description.
*/
struct Option {
int value;
std::string description;
};
/**
* The constructor delegating the <code>identifier</code> and the <code>guiName</code>
* to its super class.
* \param identifier A unique identifier for this property
* \param guiName The GUI name that should be used to represent this property
*/
OptionProperty(std::string identifier, std::string guiName);
/**
* Returns the name of the class for reflection purposes.
* \return The name of this class for reflection purposes
*/
std::string className() const override;
using IntProperty::operator=;
/**
* Adds the passed option to the list of available options. The <code>value</code> of
* the <code>option</code> must not have been registered previously, or a warning will
* be logged.
* \param option The option that will be added to the list of available options
*/
void addOption(Option option);
/**
* Returns the list of available options.
* /return The list of available options
*/
const std::vector<Option>& options() const;
/**
* The overritten TemplateProperty::setValue method that checks if the provided value
* represents a valid Option
* \param value The value of the Option that should be set
*/
void setValue(int value) override;
private:
/// The list of options which have been registered with this OptionProperty
std::vector<Option> _options;
};
} // namespace properties
} // namespace openspace
#endif // __STRINGPROPERTY_H__
@@ -158,7 +158,7 @@ public:
* <code>T</code>. If the value are different, the listeners are notified.
* \param val The new value for this TemplateProperty
*/
void setValue(T val);
virtual void setValue(T val);
/**
* Returns the currently stored value.
@@ -49,6 +49,8 @@ public:
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
@@ -48,6 +48,7 @@ public:
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
+2
View File
@@ -55,6 +55,8 @@ public:
virtual bool initialize() = 0;
virtual bool deinitialize() = 0;
virtual bool isReady() const = 0;
void setBoundingSphere(const PowerScaledScalar& boundingSphere);
const PowerScaledScalar& getBoundingSphere();
@@ -43,6 +43,8 @@ public:
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
@@ -27,11 +27,9 @@
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/util/updatestructures.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/filesystem/file.h>
namespace openspace {
struct LinePoint;
@@ -44,8 +42,9 @@ public:
bool initialize();
bool deinitialize();
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
std::vector<std::vector<LinePoint> > getFieldlinesData(std::string filename, ghoul::Dictionary hintsDictionary);
@@ -54,18 +53,11 @@ private:
std::vector<std::string> _filenames;
std::vector<glm::vec3> _seedPoints;
ghoul::opengl::ProgramObject *_fieldlinesProgram;
GLuint _VAO, _seedpointVAO;
ghoul::filesystem::File* _vertexSourceFile;
ghoul::filesystem::File* _fragmentSourceFile;
ghoul::opengl::ProgramObject* _shader;
GLuint _fieldlineVAO;
std::vector<GLint> _lineStart;
std::vector<GLsizei> _lineCount;
bool _programUpdateOnSave;
bool _update;
void safeShaderCompilation();
};
} // namespace openspace
@@ -44,6 +44,8 @@ public:
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
@@ -44,6 +44,8 @@ namespace openspace {
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
@@ -47,8 +47,10 @@ public:
RenderablePlane(const ghoul::Dictionary& dictionary);
~RenderablePlane();
bool initialize();
bool deinitialize();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
@@ -44,6 +44,8 @@ public:
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
@@ -44,6 +44,8 @@ public:
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
@@ -46,8 +46,10 @@ public:
RenderableVolumeGL(const ghoul::Dictionary& dictionary);
~RenderableVolumeGL();
bool initialize();
bool deinitialize();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
virtual void render(const RenderData& data) override;
virtual void update(const UpdateData& data) override;
@@ -25,54 +25,61 @@
#ifndef __RENDERABLESTARS_H__
#define __RENDERABLESTARS_H__
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/optionproperty.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace openspace {
namespace openspace{
class RenderableStars : public Renderable{
class RenderableStars : public Renderable {
public:
RenderableStars(const ghoul::Dictionary& dictionary);
~RenderableStars();
bool initialize() override;
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:
std::ifstream& skipToLine(std::ifstream& file, unsigned int num);
bool readSpeckFile(const std::string& path);
void generateBufferObjects(const void* data);
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::ProgramObject* _haloProgram;
ghoul::opengl::ProgramObject* _pointProgram;
ghoul::opengl::Texture* _texture;
bool _textureIsDirty;
std::string _speckPath;
properties::OptionProperty _colorOption;
bool _dataIsDirty;
//GLint vertsToDraw;
properties::FloatProperty _spriteSize;
GLuint _vboID;
GLuint _vaoID;
GLint positionAttrib;
GLint brightnessDataAttrib;
int v_size;
int v_stride;
int v_total;
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
+2 -1
View File
@@ -57,12 +57,13 @@ public:
void initializeLuaState(lua_State* state);
void addLibrary(const LuaLibrary& library);
void addLibrary(LuaLibrary library);
bool hasLibrary(const std::string& name);
bool runScript(const std::string& script);
bool runScriptFile(const std::string& filename);
bool writeDocumentation(const std::string& filename, const std::string& type) const;
private:
bool registerLuaLibrary(lua_State* state, const LuaLibrary& library);
@@ -47,7 +47,7 @@ protected:
#define SRCLEN 128
const int nrMetaKernels = 9;
int which, handle, count = 0;
SpiceInt which, handle, count = 0;
char file[FILLEN], filtyp[TYPLEN], source[SRCLEN];
double abs_error = 0.00001;
@@ -353,8 +353,8 @@ TEST_F(SpiceManagerTest, getPositionTransformMatrix){
TEST_F(SpiceManagerTest, getFieldOfView){
loadMetaKernel();
int n;
int cassini_ID;
SpiceInt n;
SpiceInt cassini_ID;
double et;
glm::dvec3 boresight;
double bounds_ref[5][3];
@@ -395,7 +395,7 @@ TEST_F(SpiceManagerTest, planetocentricToRectangular){
double lat = -35.0; //initial values
double lon = 100.0;
double rectangular_ref[3];
int naifId;
SpiceInt naifId;
SpiceBoolean foundSpice;
bodn2c_c("EARTH", &naifId, &foundSpice);
+4 -2
View File
@@ -42,6 +42,8 @@ namespace configurationmanager {
const std::string keyCachePath = keyPaths + "." + keyCache;
const std::string keyFonts = "Fonts";
const std::string keyConfigSgct = "SGCTConfig";
const std::string keyLuaDocumentationType = "LuaDocumentationFile.Type";
const std::string keyLuaDocumentationFile = "LuaDocumentationFile.File";
const std::string keyConfigScene = "Scene";
const std::string keyStartupScript = "StartupScripts";
const std::string keySpiceTimeKernel = "SpiceKernel.Time";
@@ -88,8 +90,8 @@ namespace modelgeometry {
} // namespace modelgeometry
namespace renderablestars {
const std::string keySpeckFile = "SpeckFile";
const std::string keyPathModule = "ModulePath";
const std::string keyFile = "File";
const std::string keyTexture = "Texture";
} // namespace renderablestars
namespace renderablevolumegl {